@bugjar/reporter 0.1.2 → 0.1.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/dist/index.cjs CHANGED
@@ -1,25 +1,25 @@
1
- "use strict";var xc=Object.defineProperty;var Ec=(r,e,t)=>e in r?xc(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var k=(r,e,t)=>Ec(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react/jsx-runtime"),le=require("react"),Ac=require("react-dom");var Ii,Vt=Ac;if(process.env.NODE_ENV==="production")Ii=Vt.createRoot,Vt.hydrateRoot;else{var cn=Vt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;Ii=function(r,e){cn.usingClientEntryPoint=!0;try{return Vt.createRoot(r,e)}finally{cn.usingClientEntryPoint=!1}}}function Er(r){const e=new Error(r);return e.source="ulid",e}const As="0123456789ABCDEFGHJKMNPQRSTVWXYZ",bt=As.length,un=Math.pow(2,48)-1,Rc=10,Mc=16;function kc(r){let e=Math.floor(r()*bt);return e===bt&&(e=bt-1),As.charAt(e)}function Nc(r,e){if(isNaN(r))throw new Error(r+" must be a number");if(r>un)throw Er("cannot encode time greater than "+un);if(r<0)throw Er("time must be positive");if(Number.isInteger(Number(r))===!1)throw Er("time must be an integer");let t,i="";for(;e>0;e--)t=r%bt,i=As.charAt(t)+i,r=(r-t)/bt;return i}function _c(r,e){let t="";for(;r>0;r--)t=kc(e)+t;return t}function Ic(r=!1,e){e||(e=typeof window<"u"?window:null);const t=e&&(e.crypto||e.msCrypto);if(t)return()=>{const i=new Uint8Array(1);return t.getRandomValues(i),i[0]/255};try{const i=require("crypto");return()=>i.randomBytes(1).readUInt8()/255}catch{}if(r){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch{}return()=>Math.random()}throw Er("secure crypto unusable, insecure Math.random not allowed")}function Dc(r){return r||(r=Ic()),function(t){return isNaN(t)&&(t=Date.now()),Nc(t,Rc)+_c(Mc,r)}}const hn=Dc();function Tc(r,e){const t=[];let i=!1,s=0;const n={},o=["log","info","warn","error","debug"];for(const l of o){const c=console[l];n[l]=c,console[l]=(...u)=>{if(l==="error"&&e?.(),i){const h=u.map(Oc).join(" "),f=performance.now()-s;t.push({level:l,message:h,timestamp:f,stack:l==="error"?new Error().stack:void 0}),t.length>r&&t.shift()}c.apply(console,u)}}const a=l=>{e?.(),i&&(t.push({level:"error",message:`Unhandled error: ${l.message}`,timestamp:performance.now()-s,stack:l.error?.stack}),t.length>r&&t.shift())};return window.addEventListener("error",a),{entries:t,activate(l,c){c?.preserveEntries||(t.length=0),s=l,i=!0},deactivate(){i=!1},snapshot(){return t.slice()},hydrate(l){t.length=0;for(const c of l)t.push(c)},dispose(){for(const l of o)n[l]&&(console[l]=n[l]);window.removeEventListener("error",a)}}}function Oc(r){if(r===null)return"null";if(r===void 0)return"undefined";if(typeof r=="string")return r;if(r instanceof Error)return r.stack??r.message;try{return JSON.stringify(r)}catch{return String(r)}}const Le="http://www.w3.org/2000/svg";class Pc{constructor(e){k(this,"svg");k(this,"overlay");k(this,"tool","cursor");k(this,"color","#ef4444");k(this,"strokeWidth",3);k(this,"pinCount",0);k(this,"active",null);k(this,"undoStack",[]);k(this,"openEditor",null);k(this,"onPointerDown");k(this,"onPointerMove");k(this,"onPointerUp");k(this,"onResize");this.host=e,this.host.setAttribute("data-bugjar-capture","true"),this.host.style.cssText=["position:absolute","top:0","left:0","width:100%",`height:${Math.max(document.documentElement.scrollHeight,window.innerHeight)}px`,"pointer-events:none","z-index:2147482000","font-family:system-ui,-apple-system,sans-serif"].join(";"),this.svg=document.createElementNS(Le,"svg"),this.svg.setAttribute("width","100%"),this.svg.setAttribute("height","100%"),this.svg.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:visible",this.installArrowMarker(),this.host.appendChild(this.svg),this.overlay=document.createElement("div"),this.overlay.style.cssText="position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none",this.host.appendChild(this.overlay),this.onPointerDown=t=>this.handlePointerDown(t),this.onPointerMove=t=>this.handlePointerMove(t),this.onPointerUp=t=>this.handlePointerUp(t),this.onResize=()=>this.resizeHost(),this.host.addEventListener("pointerdown",this.onPointerDown),this.host.addEventListener("pointermove",this.onPointerMove),this.host.addEventListener("pointerup",this.onPointerUp),this.host.addEventListener("pointercancel",this.onPointerUp),window.addEventListener("resize",this.onResize)}setTool(e){this.commitOpenEditor(),this.tool=e,e==="cursor"?(this.host.style.pointerEvents="none",this.host.style.cursor="auto"):e==="pin"?(this.host.style.pointerEvents="auto",this.host.style.cursor="text"):(this.host.style.pointerEvents="auto",this.host.style.cursor="crosshair")}setColor(e){this.color=e}undo(){this.commitOpenEditor();const e=this.undoStack.pop();e&&e.remove()}clearAll(){this.commitOpenEditor();for(const e of this.undoStack)e.remove();this.undoStack=[],this.pinCount=0}destroy(){this.host.removeEventListener("pointerdown",this.onPointerDown),this.host.removeEventListener("pointermove",this.onPointerMove),this.host.removeEventListener("pointerup",this.onPointerUp),this.host.removeEventListener("pointercancel",this.onPointerUp),window.removeEventListener("resize",this.onResize),this.host.replaceChildren(),this.undoStack=[],this.pinCount=0}resizeHost(){const e=Math.max(document.documentElement.scrollHeight,window.innerHeight);this.host.style.height=`${e}px`}installArrowMarker(){const e=document.createElementNS(Le,"defs");for(const t of["#ef4444","#f59e0b","#3b82f6"]){const i=document.createElementNS(Le,"marker");i.setAttribute("id",`bugjar-arrowhead-${t.slice(1)}`),i.setAttribute("viewBox","0 0 10 10"),i.setAttribute("refX","9"),i.setAttribute("refY","5"),i.setAttribute("markerWidth","6"),i.setAttribute("markerHeight","6"),i.setAttribute("orient","auto-start-reverse");const s=document.createElementNS(Le,"path");s.setAttribute("d","M 0 0 L 10 5 L 0 10 z"),s.setAttribute("fill",t),i.appendChild(s),e.appendChild(i)}this.svg.appendChild(e)}docCoords(e){const t=this.host.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}handlePointerDown(e){if(this.tool==="cursor"||e.target?.closest("[data-bugjar-markup-editor]"))return;e.preventDefault();const{x:t,y:i}=this.docCoords(e);if(this.tool==="pen"){const s=document.createElementNS(Le,"path");s.setAttribute("d",`M ${t} ${i}`),s.setAttribute("stroke",this.color),s.setAttribute("stroke-width",String(this.strokeWidth)),s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),s.setAttribute("fill","none"),this.svg.appendChild(s),this.active={kind:"pen",el:s,startDocX:t,startDocY:i,points:[t,i]},this.undoStack.push(s)}else if(this.tool==="arrow"){const s=document.createElementNS(Le,"line");s.setAttribute("x1",String(t)),s.setAttribute("y1",String(i)),s.setAttribute("x2",String(t)),s.setAttribute("y2",String(i)),s.setAttribute("stroke",this.color),s.setAttribute("stroke-width",String(this.strokeWidth)),s.setAttribute("stroke-linecap","round"),s.setAttribute("marker-end",`url(#bugjar-arrowhead-${this.color.slice(1)})`),this.svg.appendChild(s),this.active={kind:"arrow",el:s,startDocX:t,startDocY:i,points:[]},this.undoStack.push(s)}else if(this.tool==="rectangle"){const s=document.createElementNS(Le,"rect");s.setAttribute("x",String(t)),s.setAttribute("y",String(i)),s.setAttribute("width","0"),s.setAttribute("height","0"),s.setAttribute("stroke",this.color),s.setAttribute("stroke-width",String(this.strokeWidth)),s.setAttribute("fill","none"),this.svg.appendChild(s),this.active={kind:"rectangle",el:s,startDocX:t,startDocY:i,points:[]},this.undoStack.push(s)}else this.tool==="pin"&&this.openPinEditor(t,i)}handlePointerMove(e){if(!this.active)return;const{x:t,y:i}=this.docCoords(e);if(this.active.kind==="pen"){this.active.points.push(t,i);const s=Lc(this.active.points);this.active.el.setAttribute("d",s)}else if(this.active.kind==="arrow")this.active.el.setAttribute("x2",String(t)),this.active.el.setAttribute("y2",String(i));else if(this.active.kind==="rectangle"){const s=Math.min(this.active.startDocX,t),n=Math.min(this.active.startDocY,i),o=Math.abs(t-this.active.startDocX),a=Math.abs(i-this.active.startDocY);this.active.el.setAttribute("x",String(s)),this.active.el.setAttribute("y",String(n)),this.active.el.setAttribute("width",String(o)),this.active.el.setAttribute("height",String(a))}}handlePointerUp(e){if(!this.active)return;const t=this.active.el.getBoundingClientRect?.();t&&t.width<2&&t.height<2&&this.active.kind!=="pen"&&(this.active.el.remove(),this.undoStack.pop()),this.active=null}openPinEditor(e,t){this.commitOpenEditor(),this.pinCount+=1;const i=this.pinCount,s=document.createElement("div");s.setAttribute("data-bugjar-markup-editor","true"),s.style.cssText=["position:absolute",`left:${e-14}px`,`top:${t-14}px`,"display:flex","align-items:flex-start","gap:8px","pointer-events:auto","z-index:1"].join(";");const n=document.createElement("div");n.style.cssText=["width:28px","height:28px",`background:${this.color}`,"color:white","border-radius:50%","display:flex","align-items:center","justify-content:center","font-size:13px","font-weight:700","font-family:system-ui,-apple-system,sans-serif","box-shadow:0 4px 12px rgba(0,0,0,0.25)","flex-shrink:0"].join(";"),n.textContent=String(i);const o=document.createElement("div");o.contentEditable="true",o.style.cssText=["min-width:160px","max-width:320px","min-height:20px","background:white","color:#111827","font-size:13px","font-family:system-ui,-apple-system,sans-serif","border:1px solid #e5e7eb","border-radius:6px","padding:6px 10px","box-shadow:0 8px 24px rgba(0,0,0,0.15)","outline:none","white-space:pre-wrap"].join(";"),o.setAttribute("data-placeholder","Add a comment…"),o.addEventListener("keydown",a=>{if(a.key==="Escape"){a.preventDefault(),s.remove();const l=this.undoStack.indexOf(s);l>=0&&this.undoStack.splice(l,1),this.openEditor=null}else a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),this.commitOpenEditor())}),s.appendChild(n),s.appendChild(o),this.overlay.appendChild(s),o.focus(),this.openEditor=s,this.undoStack.push(s)}commitOpenEditor(){if(!this.openEditor)return;const e=this.openEditor.querySelector("[contenteditable]")??this.openEditor;if((e.textContent??"").trim())e.contentEditable="false",this.openEditor.style.pointerEvents="none";else{this.openEditor.remove();const i=this.undoStack.indexOf(this.openEditor);i>=0&&this.undoStack.splice(i,1),this.openEditor.matches("[data-bugjar-markup-editor]")&&this.openEditor.querySelector('[style*="border-radius:50%"]')&&(this.pinCount=Math.max(0,this.pinCount-1))}this.openEditor=null}}function Lc(r){if(r.length<2)return"";let e=`M ${r[0]} ${r[1]}`;for(let t=2;t<r.length;t+=2)e+=` L ${r[t]} ${r[t+1]}`;return e}function $c(r,e){const t=[];let i=!1,s=0;const n=window.fetch.bind(window);window.fetch=async(...l)=>{const c=performance.now(),[u,h]=l,f=(h?.method??"GET").toUpperCase(),d=typeof u=="string"?u:u.url;try{const m=await n(...l);return m.status>=400&&e?.(),i&&(t.push({method:f,url:d,status:m.status,durationMs:performance.now()-c,timestamp:c-s,ok:m.ok}),t.length>r&&t.shift()),m}catch(m){throw e?.(),i&&(t.push({method:f,url:d,timestamp:c-s,ok:!1,error:m instanceof Error?m.message:String(m)}),t.length>r&&t.shift()),m}};const o=window.XMLHttpRequest;class a extends o{constructor(){super(...arguments);k(this,"_bugjarMethod","GET");k(this,"_bugjarUrl","");k(this,"_bugjarStart",0)}open(u,h,...f){this._bugjarMethod=u.toUpperCase(),this._bugjarUrl=String(h),this._bugjarStart=performance.now(),super.open(u,h,...f),this.addEventListener("loadend",()=>{this.status>=400&&e?.(),i&&(t.push({method:this._bugjarMethod,url:this._bugjarUrl,status:this.status,durationMs:performance.now()-this._bugjarStart,timestamp:this._bugjarStart-s,ok:this.status>=200&&this.status<400}),t.length>r&&t.shift())})}}return window.XMLHttpRequest=a,{entries:t,activate(l,c){c?.preserveEntries||(t.length=0),s=l,i=!0},deactivate(){i=!1},snapshot(){return t.slice()},hydrate(l){t.length=0;for(const c of l)t.push(c)},dispose(){window.fetch=n,window.XMLHttpRequest=o}}}const Fc="bugjar-sdk",jc=1,_r="recordings",Bc=60*1e3;let Gt=null;function Hr(){return Gt||(Gt=new Promise((r,e)=>{if(typeof indexedDB>"u"){e(new Error("IndexedDB unavailable"));return}const t=indexedDB.open(Fc,jc);t.onupgradeneeded=()=>{const i=t.result;i.objectStoreNames.contains(_r)||i.createObjectStore(_r,{keyPath:"sessionId"})},t.onsuccess=()=>r(t.result),t.onerror=()=>e(t.error??new Error("IndexedDB open failed"))}),Gt)}function Zr(r,e){const t=r.transaction(_r,e),i=new Promise((s,n)=>{t.oncomplete=()=>s(),t.onabort=()=>n(t.error??new Error("IDB transaction aborted")),t.onerror=()=>n(t.error??new Error("IDB transaction error"))});return{store:t.objectStore(_r),done:i}}function Zo(r){return new Promise((e,t)=>{r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error??new Error("IDB request error"))})}async function Uc(r){const e=await Hr(),{store:t}=Zr(e,"readonly");return await Zo(t.get(r))??null}async function zc(r){const e=await Hr(),{store:t,done:i}=Zr(e,"readwrite");t.put(r),await i}async function Yt(r){const e=await Hr(),{store:t,done:i}=Zr(e,"readwrite");t.delete(r),await i}async function $t(r,e){const t=await Hr(),{store:i,done:s}=Zr(t,"readwrite"),n=await Zo(i.get(r));n&&(i.put(e(n)),await s)}async function Wc(r,e){e.length!==0&&await $t(r,t=>({...t,events:t.events.concat(e),lastSeenAt:Date.now()}))}async function Vc(r,e){await $t(r,t=>({...t,audioChunks:[...t.audioChunks,e],lastSeenAt:Date.now()}))}async function Gc(r,e){await $t(r,t=>({...t,consoleEntries:e,lastSeenAt:Date.now()}))}async function Yc(r,e){await $t(r,t=>({...t,networkEvents:e,lastSeenAt:Date.now()}))}async function Hc(r,e){await $t(r,t=>({...t,activeMs:e,lastSeenAt:Date.now()}))}function Rs(r){return`bugjar:active-session:${r}`}function Zc(r){try{const e=localStorage.getItem(Rs(r));return e?JSON.parse(e):null}catch{return null}}function fn(r,e){try{localStorage.setItem(Rs(r),JSON.stringify({sessionId:e,projectKey:r,lastSeenAt:Date.now()}))}catch{}}function We(r){try{localStorage.removeItem(Rs(r))}catch{}}function Xc(r){return Date.now()-r.lastSeenAt<Bc}const Jc=new Set(["auth_header","private_key_pem","jwt","aws_key","github_token","stripe_key","openai_key","anthropic_key","credit_card","url_query"]),Kc=new Set(["email","phone","ssn","credit_card","iban","jwt","aws_key","github_token","stripe_key","openai_key","anthropic_key","auth_header","generic_bearer","private_key_pem","connection_string","url_query","field_name"]),qc=new Set(["token","code","password","pass","email","session","sessionid","sess","sid","secret","key","apikey","api_key","access_token","refresh_token","id_token","auth","auth_token","authorization","redirect","redirect_uri","redirect_url","return_to","state","verify","verification","invite","invitation","reset","otp","magic","bugjar_capture"]),Qc=/\bhttps?:\/\/[^\s<>"'`\\]+/gi;function eu(r){const e=new Set;for(const t of r){if(!Kc.has(t))continue;const i=t;Jc.has(i)||e.add(i)}return e}const tu=[{category:"auth_header",pattern:/Authorization:\s*(Bearer|Basic|Digest)\s+[A-Za-z0-9\-._~+/=]+/gi},{category:"private_key_pem",pattern:/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g},{category:"jwt",pattern:/\beyJ[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\b/g},{category:"aws_key",pattern:/\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/g},{category:"github_token",pattern:/\b(?:ghp|gho|ghs|ghu|ghr|github_pat)_[A-Za-z0-9_]{20,}\b/g},{category:"stripe_key",pattern:/\b(?:sk|rk|pk)_(?:live|test)_[A-Za-z0-9]{20,}\b/g},{category:"openai_key",pattern:/\bsk-[A-Za-z0-9]{32,}\b/g},{category:"anthropic_key",pattern:/\bsk-ant-[A-Za-z0-9\-_]{20,}\b/g},{category:"connection_string",pattern:/\b(?:postgres|postgresql|mysql|mongodb|redis|amqp)(?:\+[a-z]+)?:\/\/[^\s"']+/gi},{category:"generic_bearer",pattern:/\b(?:token|apikey|api_key|access_token|secret)[=:]\s*["']?[A-Za-z0-9_\-\.]{16,}["']?/gi},{category:"credit_card",pattern:/\b(?:\d[ -]?){13,19}\b/g},{category:"iban",pattern:/\b[A-Z]{2}\d{2}[A-Z0-9]{11,30}\b/g},{category:"ssn",pattern:/\b\d{3}-\d{2}-\d{4}\b/g},{category:"phone",pattern:/(?:\+?\d{1,3}[ -]?)?\(?\d{3}\)?[ -]?\d{3}[ -]?\d{4}\b/g},{category:"email",pattern:/\b[A-Za-z0-9._%+\-]+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,}\b/g}],Xo=new Set(["password","passwd","pwd","pass","email","email_address","mail","phone","phone_number","mobile","tel","ssn","social_security_number","tax_id","tin","dob","date_of_birth","birthdate","birthday","credit_card","card_number","cc_number","cvv","cvc","iban","account_number","routing_number","auth","authorization","bearer","token","access_token","refresh_token","id_token","api_key","apikey","apisecret","client_secret","secret","private_key","mrn","medical_record_number","patient_id","insurance_id","member_id","first_name","firstname","last_name","lastname","fullname","address","street","address_line_1","address_line_2","zip","postal_code"]),dn=Array.from(Xo).map(r=>new RegExp(`\\b${r.replace(/_/g,"[_ -]?")}\\b`,"i"));function Jo(){return{counts:{},totalMatches:0}}function Ko(r,e,t={}){if(!r||typeof r!="string")return r;const i=t.disabledCategories;let s=r;i?.has("url_query")||(s=s.replace(Qc,n=>Di(n,e)));for(const{category:n,pattern:o}of tu)i?.has(n)||(s=s.replace(o,()=>(e.counts[n]=(e.counts[n]??0)+1,e.totalMatches+=1,`[REDACTED:${n}]`)));return s}function Di(r,e){if(!r||typeof r!="string")return r;let t,i=!1;try{t=new URL(r)}catch{try{t=new URL(r,"http://_bugjar.invalid"),i=!0}catch{return r}}let s=!1;for(const[n]of Array.from(t.searchParams.entries()))qc.has(n.toLowerCase())&&(t.searchParams.set(n,"[REDACTED:url_query]"),e.counts.url_query=(e.counts.url_query??0)+1,e.totalMatches+=1,s=!0);return s?i?t.pathname+t.search+t.hash:t.toString():r}function xt(r,e,t={}){if(r==null)return r;if(typeof r=="string")return Ko(r,e,t);if(typeof r!="object")return r;if(Array.isArray(r))return r.map(n=>xt(n,e,t));const i={},s=t.disabledCategories?.has("field_name")??!1;for(const[n,o]of Object.entries(r))!s&&Xo.has(n.toLowerCase())?(i[n]="[REDACTED:field_name]",e.counts.field_name=(e.counts.field_name??0)+1,e.totalMatches+=1):i[n]=xt(o,e,t);return i}function ru(r){let e=r?.nodeType===Node.ELEMENT_NODE?r:r?.parentElement??null,t=0;for(;e&&t<6;){const i=[e.getAttribute("name"),e.getAttribute("aria-label"),e.getAttribute("placeholder"),e.getAttribute("data-field"),e.id].filter(Boolean);for(const n of i)for(const o of dn)if(o.test(n))return!0;const s=e.getAttribute("aria-labelledby");if(s){const n=document.getElementById(s)?.textContent??"";for(const o of dn)if(o.test(n))return!0}e=e.parentElement,t+=1}return!1}function iu(r={}){const e=r.disabledCategories?.has("field_name")??!1;return(t,i)=>{if(su(i))return t;if(r.strict)return t.replace(/\S/g,"•");if(!e&&i&&ru(i))return t.replace(/\S/g,"•");const s=Jo();return Ko(t,s,{disabledCategories:r.disabledCategories})}}function su(r){let e=r?.nodeType===Node.ELEMENT_NODE?r:r?.parentElement??null,t=0;for(;e&&t<20;){if(e.getAttribute?.("data-bugjar-capture")==="true")return!0;e=e.parentElement,t+=1}return!1}function nu(r,e,t={}){return r.map(i=>xt(i,e,t))}const ou=500;class pn{constructor(e){k(this,"events",[]);k(this,"pendingEvents",[]);k(this,"stopRrweb",null);k(this,"mediaRecorder",null);k(this,"micStream",null);k(this,"audioChunks",[]);k(this,"segmentStartedAt",0);k(this,"tickInterval",null);k(this,"capTimeout",null);k(this,"flushInterval",null);k(this,"beforeUnloadHandler",null);this.opts=e}async start(){if(this.pendingEvents=[],this.segmentStartedAt=performance.now(),this.opts.captureMicrophone)try{this.micStream=await navigator.mediaDevices.getUserMedia({audio:!0});const n=au();this.mediaRecorder=new MediaRecorder(this.micStream,n?{mimeType:n}:void 0),this.mediaRecorder.ondataavailable=o=>{o.data.size>0&&(this.audioChunks.push(o.data),Vc(this.opts.sessionId,o.data))},this.mediaRecorder.start(1e3)}catch{this.micStream=null,this.mediaRecorder=null}let e;try{e=await Promise.resolve().then(()=>require("./rrweb-BXdUj-Sd.cjs"))}catch(n){throw new Error(`Failed to load the recording engine. ${n instanceof Error?n.message:String(n)}`)}this.stopRrweb=e.record({emit:n=>{this.events.push(n),this.pendingEvents.push(n)},maskAllInputs:!0,maskTextFn:iu({strict:this.opts.strictMode,disabledCategories:this.opts.disabledCategories}),blockSelector:"[data-bugjar-block]",maskTextSelector:"[data-bugjar-mask]",sampling:{scroll:150,input:"last"},maskInputOptions:{password:!0,email:!0,tel:!0}})??null;const t=this.segmentStartedAt-this.opts.persistedActiveMs,i=this.opts.persistedActiveMs>0;this.opts.consoleCapture.activate(t,{preserveEntries:i}),this.opts.networkCapture.activate(t,{preserveEntries:i}),this.tickInterval=window.setInterval(()=>{this.opts.onTick(this.combinedElapsedMs())},250);const s=Math.max(0,this.opts.maxDurationSec*1e3-this.opts.persistedActiveMs);this.capTimeout=window.setTimeout(()=>{this.stop()},s),fn(this.opts.projectKey,this.opts.sessionId),this.flushInterval=window.setInterval(()=>{this.flushPending()},ou),this.beforeUnloadHandler=()=>{fn(this.opts.projectKey,this.opts.sessionId),this.flushPending()},window.addEventListener("beforeunload",this.beforeUnloadHandler)}async flushPending(){const e=this.pendingEvents.splice(0);e.length>0&&await Wc(this.opts.sessionId,e);const t=performance.now()-this.segmentStartedAt,i=this.opts.persistedActiveMs+t;await Promise.all([Gc(this.opts.sessionId,this.opts.consoleCapture.snapshot()),Yc(this.opts.sessionId,this.opts.networkCapture.snapshot()),Hc(this.opts.sessionId,i)])}async stop(){this.capTimeout!==null&&(clearTimeout(this.capTimeout),this.capTimeout=null),this.tickInterval!==null&&(clearInterval(this.tickInterval),this.tickInterval=null),this.flushInterval!==null&&(clearInterval(this.flushInterval),this.flushInterval=null),this.beforeUnloadHandler&&(window.removeEventListener("beforeunload",this.beforeUnloadHandler),this.beforeUnloadHandler=null),this.stopRrweb&&this.stopRrweb(),this.stopRrweb=null,this.opts.consoleCapture.deactivate(),this.opts.networkCapture.deactivate();let e=null;this.mediaRecorder&&this.mediaRecorder.state!=="inactive"&&(await new Promise(s=>{this.mediaRecorder.onstop=()=>s(),this.mediaRecorder.stop()}),this.audioChunks.length>0&&(e=new Blob(this.audioChunks,{type:this.mediaRecorder.mimeType||"audio/webm"}))),this.micStream&&(this.micStream.getTracks().forEach(s=>s.stop()),this.micStream=null);const t=performance.now()-this.segmentStartedAt;await this.flushPending();const i=this.opts.persistedActiveMs+t;this.opts.onStop({events:this.events,audioBlob:e,durationMs:i})}toggleMic(e){if(this.micStream)for(const t of this.micStream.getAudioTracks())t.enabled=!e}hydrateEvents(e){this.events=e.slice()}hydrateAudioChunks(e){this.audioChunks=e.slice()}combinedElapsedMs(){return this.opts.persistedActiveMs+(performance.now()-this.segmentStartedAt)}}function au(){const r=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus"];for(const e of r)if(typeof MediaRecorder<"u"&&MediaRecorder.isTypeSupported(e))return e;return null}const qo="[modern-screenshot]",et=typeof window<"u",lu=et&&"Worker"in window,Ms=et?window.navigator?.userAgent:"",Qo=Ms.includes("Chrome"),Ir=Ms.includes("AppleWebKit")&&!Qo,ks=Ms.includes("Firefox"),cu=r=>r&&"__CONTEXT__"in r,uu=r=>r.constructor.name==="CSSFontFaceRule",hu=r=>r.constructor.name==="CSSImportRule",fu=r=>r.constructor.name==="CSSLayerBlockRule",Ee=r=>r.nodeType===1,Ft=r=>typeof r.className=="object",ea=r=>r.tagName==="image",du=r=>r.tagName==="use",Et=r=>Ee(r)&&typeof r.style<"u"&&!Ft(r),pu=r=>r.nodeType===8,mu=r=>r.nodeType===3,tt=r=>r.tagName==="IMG",Xr=r=>r.tagName==="VIDEO",gu=r=>r.tagName==="CANVAS",yu=r=>r.tagName==="TEXTAREA",wu=r=>r.tagName==="INPUT",bu=r=>r.tagName==="STYLE",vu=r=>r.tagName==="SCRIPT",Su=r=>r.tagName==="SELECT",Cu=r=>r.tagName==="SLOT",xu=r=>r.tagName==="IFRAME",Eu=(...r)=>console.warn(qo,...r);function Au(r){const e=r?.createElement?.("canvas");return e&&(e.height=e.width=1),!!e&&"toDataURL"in e&&!!e.toDataURL("image/webp").includes("image/webp")}const Ti=r=>r.startsWith("data:");function ta(r,e){if(r.match(/^[a-z]+:\/\//i))return r;if(et&&r.match(/^\/\//))return window.location.protocol+r;if(r.match(/^[a-z]+:/i)||!et)return r;const t=Jr().implementation.createHTMLDocument(),i=t.createElement("base"),s=t.createElement("a");return t.head.appendChild(i),t.body.appendChild(s),e&&(i.href=e),s.href=r,s.href}function Jr(r){return(r&&Ee(r)?r?.ownerDocument:r)??window.document}const Kr="http://www.w3.org/2000/svg";function Ru(r,e,t){const i=Jr(t).createElementNS(Kr,"svg");return i.setAttributeNS(null,"width",r.toString()),i.setAttributeNS(null,"height",e.toString()),i.setAttributeNS(null,"viewBox",`0 0 ${r} ${e}`),i}function Mu(r,e){let t=new XMLSerializer().serializeToString(r);return e&&(t=t.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu,"")),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function ku(r,e){return new Promise((t,i)=>{const s=new FileReader;s.onload=()=>t(s.result),s.onerror=()=>i(s.error),s.onabort=()=>i(new Error(`Failed read blob to ${e}`)),s.readAsDataURL(r)})}const Nu=r=>ku(r,"dataUrl");function qe(r,e){const t=Jr(e).createElement("img");return t.decoding="sync",t.loading="eager",t.src=r,t}function At(r,e){return new Promise(t=>{const{timeout:i,ownerDocument:s,onError:n,onWarn:o}=e??{},a=typeof r=="string"?qe(r,Jr(s)):r;let l=null,c=null;function u(){t(a),l&&clearTimeout(l),c?.()}if(i&&(l=setTimeout(u,i)),Xr(a)){const h=a.currentSrc||a.src;if(!h)return a.poster?At(a.poster,e).then(t):u();if(a.readyState>=2)return u();const f=u,d=m=>{o?.("Failed video load",h,m),n?.(m),u()};c=()=>{a.removeEventListener("loadeddata",f),a.removeEventListener("error",d)},a.addEventListener("loadeddata",f,{once:!0}),a.addEventListener("error",d,{once:!0})}else{const h=ea(a)?a.href.baseVal:a.currentSrc||a.src;if(!h)return u();const f=async()=>{if(tt(a)&&"decode"in a)try{await a.decode()}catch(m){o?.("Failed to decode image, trying to render anyway",a.dataset.originalSrc||h,m)}u()},d=m=>{o?.("Failed image load",a.dataset.originalSrc||h,m),u()};if(tt(a)&&a.complete)return f();c=()=>{a.removeEventListener("load",f),a.removeEventListener("error",d)},a.addEventListener("load",f,{once:!0}),a.addEventListener("error",d,{once:!0})}})}async function _u(r,e){Et(r)&&(tt(r)||Xr(r)?await At(r,e):await Promise.all(["img","video"].flatMap(t=>Array.from(r.querySelectorAll(t)).map(i=>At(i,e)))))}const ra=function(){let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)}();function ia(r){return r?.split(",").map(e=>e.trim().replace(/"|'/g,"").toLowerCase()).filter(Boolean)}let mn=0;function Iu(r){const e=`${qo}[#${mn}]`;return mn++,{time:t=>r&&console.time(`${e} ${t}`),timeEnd:t=>r&&console.timeEnd(`${e} ${t}`),warn:(...t)=>r&&Eu(...t)}}function Du(r){return{cache:r?"no-cache":"force-cache"}}async function sa(r,e){return cu(r)?r:Tu(r,{...e,autoDestruct:!0})}async function Tu(r,e){const{scale:t=1,workerUrl:i,workerNumber:s=1}=e||{},n=!!e?.debug,o=e?.features??!0,a=r.ownerDocument??(et?window.document:void 0),l=r.ownerDocument?.defaultView??(et?window:void 0),c=new Map,u={width:0,height:0,quality:1,type:"image/png",scale:t,backgroundColor:null,style:null,filter:null,maximumCanvasSize:0,timeout:3e4,progress:null,debug:n,fetch:{requestInit:Du(e?.fetch?.bypassingCache),placeholderImage:"data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",bypassingCache:!1,...e?.fetch},fetchFn:null,font:{},drawImageInterval:100,workerUrl:null,workerNumber:s,onCloneEachNode:null,onCloneNode:null,onEmbedNode:null,onCreateForeignObjectSvg:null,includeStyleProperties:null,autoDestruct:!1,...e,__CONTEXT__:!0,log:Iu(n),node:r,ownerDocument:a,ownerWindow:l,dpi:t===1?null:96*t,svgStyleElement:na(a),svgDefsElement:a?.createElementNS(Kr,"defs"),svgStyles:new Map,defaultComputedStyles:new Map,workers:[...Array.from({length:lu&&i&&s?s:0})].map(()=>{try{const d=new Worker(i);return d.onmessage=async m=>{const{url:w,result:p}=m.data;p?c.get(w)?.resolve?.(p):c.get(w)?.reject?.(new Error(`Error receiving message from worker: ${w}`))},d.onmessageerror=m=>{const{url:w}=m.data;c.get(w)?.reject?.(new Error(`Error receiving message from worker: ${w}`))},d}catch(d){return u.log.warn("Failed to new Worker",d),null}}).filter(Boolean),fontFamilies:new Map,fontCssTexts:new Map,acceptOfImage:`${[Au(a)&&"image/webp","image/svg+xml","image/*","*/*"].filter(Boolean).join(",")};q=0.8`,requests:c,drawImageCount:0,tasks:[],features:o,isEnable:d=>d==="restoreScrollPosition"?typeof o=="boolean"?!1:o[d]??!1:typeof o=="boolean"?o:o[d]??!0,shadowRoots:[]};u.log.time("wait until load"),await _u(r,{timeout:u.timeout,onWarn:u.log.warn}),u.log.timeEnd("wait until load");const{width:h,height:f}=Ou(r,u);return u.width=h,u.height=f,u}function na(r){if(!r)return;const e=r.createElement("style"),t=e.ownerDocument.createTextNode(`
1
+ "use strict";var xc=Object.defineProperty;var Ec=(r,e,t)=>e in r?xc(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var M=(r,e,t)=>Ec(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),oe=require("react"),Ac=require("react-dom");var Ii,Vt=Ac;if(process.env.NODE_ENV==="production")Ii=Vt.createRoot,Vt.hydrateRoot;else{var cn=Vt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;Ii=function(r,e){cn.usingClientEntryPoint=!0;try{return Vt.createRoot(r,e)}finally{cn.usingClientEntryPoint=!1}}}function Er(r){const e=new Error(r);return e.source="ulid",e}const As="0123456789ABCDEFGHJKMNPQRSTVWXYZ",bt=As.length,un=Math.pow(2,48)-1,Rc=10,kc=16;function Mc(r){let e=Math.floor(r()*bt);return e===bt&&(e=bt-1),As.charAt(e)}function Nc(r,e){if(isNaN(r))throw new Error(r+" must be a number");if(r>un)throw Er("cannot encode time greater than "+un);if(r<0)throw Er("time must be positive");if(Number.isInteger(Number(r))===!1)throw Er("time must be an integer");let t,i="";for(;e>0;e--)t=r%bt,i=As.charAt(t)+i,r=(r-t)/bt;return i}function _c(r,e){let t="";for(;r>0;r--)t=Mc(e)+t;return t}function Ic(r=!1,e){e||(e=typeof window<"u"?window:null);const t=e&&(e.crypto||e.msCrypto);if(t)return()=>{const i=new Uint8Array(1);return t.getRandomValues(i),i[0]/255};try{const i=require("crypto");return()=>i.randomBytes(1).readUInt8()/255}catch{}if(r){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch{}return()=>Math.random()}throw Er("secure crypto unusable, insecure Math.random not allowed")}function Dc(r){return r||(r=Ic()),function(t){return isNaN(t)&&(t=Date.now()),Nc(t,Rc)+_c(kc,r)}}const hn=Dc();function Tc(r,e){const t=[];let i=!1,s=0;const n={},o=["log","info","warn","error","debug"];for(const l of o){const c=console[l];n[l]=c,console[l]=(...u)=>{if(l==="error"&&e?.(),i){const h=u.map(Oc).join(" "),f=performance.now()-s;t.push({level:l,message:h,timestamp:f,stack:l==="error"?new Error().stack:void 0}),t.length>r&&t.shift()}c.apply(console,u)}}const a=l=>{e?.(),i&&(t.push({level:"error",message:`Unhandled error: ${l.message}`,timestamp:performance.now()-s,stack:l.error?.stack}),t.length>r&&t.shift())};return window.addEventListener("error",a),{entries:t,activate(l,c){c?.preserveEntries||(t.length=0),s=l,i=!0},deactivate(){i=!1},snapshot(){return t.slice()},hydrate(l){t.length=0;for(const c of l)t.push(c)},dispose(){for(const l of o)n[l]&&(console[l]=n[l]);window.removeEventListener("error",a)}}}function Oc(r){if(r===null)return"null";if(r===void 0)return"undefined";if(typeof r=="string")return r;if(r instanceof Error)return r.stack??r.message;try{return JSON.stringify(r)}catch{return String(r)}}const Le="http://www.w3.org/2000/svg";class Pc{constructor(e){M(this,"svg");M(this,"overlay");M(this,"tool","cursor");M(this,"color","#ef4444");M(this,"strokeWidth",3);M(this,"pinCount",0);M(this,"active",null);M(this,"undoStack",[]);M(this,"openEditor",null);M(this,"onPointerDown");M(this,"onPointerMove");M(this,"onPointerUp");M(this,"onResize");this.host=e,this.host.setAttribute("data-bugjar-capture","true"),this.host.style.cssText=["position:absolute","top:0","left:0","width:100%",`height:${Math.max(document.documentElement.scrollHeight,window.innerHeight)}px`,"pointer-events:none","z-index:2147482000","font-family:system-ui,-apple-system,sans-serif"].join(";"),this.svg=document.createElementNS(Le,"svg"),this.svg.setAttribute("width","100%"),this.svg.setAttribute("height","100%"),this.svg.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:visible",this.installArrowMarker(),this.host.appendChild(this.svg),this.overlay=document.createElement("div"),this.overlay.style.cssText="position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none",this.host.appendChild(this.overlay),this.onPointerDown=t=>this.handlePointerDown(t),this.onPointerMove=t=>this.handlePointerMove(t),this.onPointerUp=t=>this.handlePointerUp(t),this.onResize=()=>this.resizeHost(),this.host.addEventListener("pointerdown",this.onPointerDown),this.host.addEventListener("pointermove",this.onPointerMove),this.host.addEventListener("pointerup",this.onPointerUp),this.host.addEventListener("pointercancel",this.onPointerUp),window.addEventListener("resize",this.onResize)}setTool(e){this.commitOpenEditor(),this.tool=e,e==="cursor"?(this.host.style.pointerEvents="none",this.host.style.cursor="auto"):e==="pin"?(this.host.style.pointerEvents="auto",this.host.style.cursor="text"):(this.host.style.pointerEvents="auto",this.host.style.cursor="crosshair")}setColor(e){this.color=e}undo(){this.commitOpenEditor();const e=this.undoStack.pop();e&&e.remove()}clearAll(){this.commitOpenEditor();for(const e of this.undoStack)e.remove();this.undoStack=[],this.pinCount=0}destroy(){this.host.removeEventListener("pointerdown",this.onPointerDown),this.host.removeEventListener("pointermove",this.onPointerMove),this.host.removeEventListener("pointerup",this.onPointerUp),this.host.removeEventListener("pointercancel",this.onPointerUp),window.removeEventListener("resize",this.onResize),this.host.replaceChildren(),this.undoStack=[],this.pinCount=0}resizeHost(){const e=Math.max(document.documentElement.scrollHeight,window.innerHeight);this.host.style.height=`${e}px`}installArrowMarker(){const e=document.createElementNS(Le,"defs");for(const t of["#ef4444","#f59e0b","#3b82f6"]){const i=document.createElementNS(Le,"marker");i.setAttribute("id",`bugjar-arrowhead-${t.slice(1)}`),i.setAttribute("viewBox","0 0 10 10"),i.setAttribute("refX","9"),i.setAttribute("refY","5"),i.setAttribute("markerWidth","6"),i.setAttribute("markerHeight","6"),i.setAttribute("orient","auto-start-reverse");const s=document.createElementNS(Le,"path");s.setAttribute("d","M 0 0 L 10 5 L 0 10 z"),s.setAttribute("fill",t),i.appendChild(s),e.appendChild(i)}this.svg.appendChild(e)}docCoords(e){const t=this.host.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}handlePointerDown(e){if(this.tool==="cursor"||e.target?.closest("[data-bugjar-markup-editor]"))return;e.preventDefault();const{x:t,y:i}=this.docCoords(e);if(this.tool==="pen"){const s=document.createElementNS(Le,"path");s.setAttribute("d",`M ${t} ${i}`),s.setAttribute("stroke",this.color),s.setAttribute("stroke-width",String(this.strokeWidth)),s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),s.setAttribute("fill","none"),this.svg.appendChild(s),this.active={kind:"pen",el:s,startDocX:t,startDocY:i,points:[t,i]},this.undoStack.push(s)}else if(this.tool==="arrow"){const s=document.createElementNS(Le,"line");s.setAttribute("x1",String(t)),s.setAttribute("y1",String(i)),s.setAttribute("x2",String(t)),s.setAttribute("y2",String(i)),s.setAttribute("stroke",this.color),s.setAttribute("stroke-width",String(this.strokeWidth)),s.setAttribute("stroke-linecap","round"),s.setAttribute("marker-end",`url(#bugjar-arrowhead-${this.color.slice(1)})`),this.svg.appendChild(s),this.active={kind:"arrow",el:s,startDocX:t,startDocY:i,points:[]},this.undoStack.push(s)}else if(this.tool==="rectangle"){const s=document.createElementNS(Le,"rect");s.setAttribute("x",String(t)),s.setAttribute("y",String(i)),s.setAttribute("width","0"),s.setAttribute("height","0"),s.setAttribute("stroke",this.color),s.setAttribute("stroke-width",String(this.strokeWidth)),s.setAttribute("fill","none"),this.svg.appendChild(s),this.active={kind:"rectangle",el:s,startDocX:t,startDocY:i,points:[]},this.undoStack.push(s)}else this.tool==="pin"&&this.openPinEditor(t,i)}handlePointerMove(e){if(!this.active)return;const{x:t,y:i}=this.docCoords(e);if(this.active.kind==="pen"){this.active.points.push(t,i);const s=Lc(this.active.points);this.active.el.setAttribute("d",s)}else if(this.active.kind==="arrow")this.active.el.setAttribute("x2",String(t)),this.active.el.setAttribute("y2",String(i));else if(this.active.kind==="rectangle"){const s=Math.min(this.active.startDocX,t),n=Math.min(this.active.startDocY,i),o=Math.abs(t-this.active.startDocX),a=Math.abs(i-this.active.startDocY);this.active.el.setAttribute("x",String(s)),this.active.el.setAttribute("y",String(n)),this.active.el.setAttribute("width",String(o)),this.active.el.setAttribute("height",String(a))}}handlePointerUp(e){if(!this.active)return;const t=this.active.el.getBoundingClientRect?.();t&&t.width<2&&t.height<2&&this.active.kind!=="pen"&&(this.active.el.remove(),this.undoStack.pop()),this.active=null}openPinEditor(e,t){this.commitOpenEditor(),this.pinCount+=1;const i=this.pinCount,s=document.createElement("div");s.setAttribute("data-bugjar-markup-editor","true"),s.style.cssText=["position:absolute",`left:${e-14}px`,`top:${t-14}px`,"display:flex","align-items:flex-start","gap:8px","pointer-events:auto","z-index:1"].join(";");const n=document.createElement("div");n.style.cssText=["width:28px","height:28px",`background:${this.color}`,"color:white","border-radius:50%","display:flex","align-items:center","justify-content:center","font-size:13px","font-weight:700","font-family:system-ui,-apple-system,sans-serif","box-shadow:0 4px 12px rgba(0,0,0,0.25)","flex-shrink:0"].join(";"),n.textContent=String(i);const o=document.createElement("div");o.contentEditable="true",o.style.cssText=["min-width:160px","max-width:320px","min-height:20px","background:white","color:#111827","font-size:13px","font-family:system-ui,-apple-system,sans-serif","border:1px solid #e5e7eb","border-radius:6px","padding:6px 10px","box-shadow:0 8px 24px rgba(0,0,0,0.15)","outline:none","white-space:pre-wrap"].join(";"),o.setAttribute("data-placeholder","Add a comment…"),o.addEventListener("keydown",a=>{if(a.key==="Escape"){a.preventDefault(),s.remove();const l=this.undoStack.indexOf(s);l>=0&&this.undoStack.splice(l,1),this.openEditor=null}else a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),this.commitOpenEditor())}),s.appendChild(n),s.appendChild(o),this.overlay.appendChild(s),o.focus(),this.openEditor=s,this.undoStack.push(s)}commitOpenEditor(){if(!this.openEditor)return;const e=this.openEditor.querySelector("[contenteditable]")??this.openEditor;if((e.textContent??"").trim())e.contentEditable="false",this.openEditor.style.pointerEvents="none";else{this.openEditor.remove();const i=this.undoStack.indexOf(this.openEditor);i>=0&&this.undoStack.splice(i,1),this.openEditor.matches("[data-bugjar-markup-editor]")&&this.openEditor.querySelector('[style*="border-radius:50%"]')&&(this.pinCount=Math.max(0,this.pinCount-1))}this.openEditor=null}}function Lc(r){if(r.length<2)return"";let e=`M ${r[0]} ${r[1]}`;for(let t=2;t<r.length;t+=2)e+=` L ${r[t]} ${r[t+1]}`;return e}function $c(r,e){const t=[];let i=!1,s=0;const n=window.fetch.bind(window);window.fetch=async(...l)=>{const c=performance.now(),[u,h]=l,f=(h?.method??"GET").toUpperCase(),d=typeof u=="string"?u:u.url;try{const g=await n(...l);return g.status>=400&&e?.(),i&&(t.push({method:f,url:d,status:g.status,durationMs:performance.now()-c,timestamp:c-s,ok:g.ok}),t.length>r&&t.shift()),g}catch(g){throw e?.(),i&&(t.push({method:f,url:d,timestamp:c-s,ok:!1,error:g instanceof Error?g.message:String(g)}),t.length>r&&t.shift()),g}};const o=window.XMLHttpRequest;class a extends o{constructor(){super(...arguments);M(this,"_bugjarMethod","GET");M(this,"_bugjarUrl","");M(this,"_bugjarStart",0)}open(u,h,...f){this._bugjarMethod=u.toUpperCase(),this._bugjarUrl=String(h),this._bugjarStart=performance.now(),super.open(u,h,...f),this.addEventListener("loadend",()=>{this.status>=400&&e?.(),i&&(t.push({method:this._bugjarMethod,url:this._bugjarUrl,status:this.status,durationMs:performance.now()-this._bugjarStart,timestamp:this._bugjarStart-s,ok:this.status>=200&&this.status<400}),t.length>r&&t.shift())})}}return window.XMLHttpRequest=a,{entries:t,activate(l,c){c?.preserveEntries||(t.length=0),s=l,i=!0},deactivate(){i=!1},snapshot(){return t.slice()},hydrate(l){t.length=0;for(const c of l)t.push(c)},dispose(){window.fetch=n,window.XMLHttpRequest=o}}}const jc="bugjar-sdk",Fc=1,_r="recordings",Bc=60*1e3;let Gt=null;function Hr(){return Gt||(Gt=new Promise((r,e)=>{if(typeof indexedDB>"u"){e(new Error("IndexedDB unavailable"));return}const t=indexedDB.open(jc,Fc);t.onupgradeneeded=()=>{const i=t.result;i.objectStoreNames.contains(_r)||i.createObjectStore(_r,{keyPath:"sessionId"})},t.onsuccess=()=>r(t.result),t.onerror=()=>e(t.error??new Error("IndexedDB open failed"))}),Gt)}function Zr(r,e){const t=r.transaction(_r,e),i=new Promise((s,n)=>{t.oncomplete=()=>s(),t.onabort=()=>n(t.error??new Error("IDB transaction aborted")),t.onerror=()=>n(t.error??new Error("IDB transaction error"))});return{store:t.objectStore(_r),done:i}}function Zo(r){return new Promise((e,t)=>{r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error??new Error("IDB request error"))})}async function Uc(r){const e=await Hr(),{store:t}=Zr(e,"readonly");return await Zo(t.get(r))??null}async function zc(r){const e=await Hr(),{store:t,done:i}=Zr(e,"readwrite");t.put(r),await i}async function Yt(r){const e=await Hr(),{store:t,done:i}=Zr(e,"readwrite");t.delete(r),await i}async function $t(r,e){const t=await Hr(),{store:i,done:s}=Zr(t,"readwrite"),n=await Zo(i.get(r));n&&(i.put(e(n)),await s)}async function Wc(r,e){e.length!==0&&await $t(r,t=>({...t,events:t.events.concat(e),lastSeenAt:Date.now()}))}async function Vc(r,e){await $t(r,t=>({...t,audioChunks:[...t.audioChunks,e],lastSeenAt:Date.now()}))}async function Gc(r,e){await $t(r,t=>({...t,consoleEntries:e,lastSeenAt:Date.now()}))}async function Yc(r,e){await $t(r,t=>({...t,networkEvents:e,lastSeenAt:Date.now()}))}async function Hc(r,e){await $t(r,t=>({...t,activeMs:e,lastSeenAt:Date.now()}))}function Rs(r){return`bugjar:active-session:${r}`}function Zc(r){try{const e=localStorage.getItem(Rs(r));return e?JSON.parse(e):null}catch{return null}}function fn(r,e){try{localStorage.setItem(Rs(r),JSON.stringify({sessionId:e,projectKey:r,lastSeenAt:Date.now()}))}catch{}}function We(r){try{localStorage.removeItem(Rs(r))}catch{}}function Xc(r){return Date.now()-r.lastSeenAt<Bc}const Jc=new Set(["auth_header","private_key_pem","jwt","aws_key","github_token","stripe_key","openai_key","anthropic_key","credit_card","url_query"]),Kc=new Set(["email","phone","ssn","credit_card","iban","jwt","aws_key","github_token","stripe_key","openai_key","anthropic_key","auth_header","generic_bearer","private_key_pem","connection_string","url_query","field_name"]),qc=new Set(["token","code","password","pass","email","session","sessionid","sess","sid","secret","key","apikey","api_key","access_token","refresh_token","id_token","auth","auth_token","authorization","redirect","redirect_uri","redirect_url","return_to","state","verify","verification","invite","invitation","reset","otp","magic","bugjar_capture"]),Qc=/\bhttps?:\/\/[^\s<>"'`\\]+/gi;function eu(r){const e=new Set;for(const t of r){if(!Kc.has(t))continue;const i=t;Jc.has(i)||e.add(i)}return e}const tu=[{category:"auth_header",pattern:/Authorization:\s*(Bearer|Basic|Digest)\s+[A-Za-z0-9\-._~+/=]+/gi},{category:"private_key_pem",pattern:/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g},{category:"jwt",pattern:/\beyJ[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\b/g},{category:"aws_key",pattern:/\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/g},{category:"github_token",pattern:/\b(?:ghp|gho|ghs|ghu|ghr|github_pat)_[A-Za-z0-9_]{20,}\b/g},{category:"stripe_key",pattern:/\b(?:sk|rk|pk)_(?:live|test)_[A-Za-z0-9]{20,}\b/g},{category:"openai_key",pattern:/\bsk-[A-Za-z0-9]{32,}\b/g},{category:"anthropic_key",pattern:/\bsk-ant-[A-Za-z0-9\-_]{20,}\b/g},{category:"connection_string",pattern:/\b(?:postgres|postgresql|mysql|mongodb|redis|amqp)(?:\+[a-z]+)?:\/\/[^\s"']+/gi},{category:"generic_bearer",pattern:/\b(?:token|apikey|api_key|access_token|secret)[=:]\s*["']?[A-Za-z0-9_\-\.]{16,}["']?/gi},{category:"credit_card",pattern:/\b(?:\d[ -]?){13,19}\b/g},{category:"iban",pattern:/\b[A-Z]{2}\d{2}[A-Z0-9]{11,30}\b/g},{category:"ssn",pattern:/\b\d{3}-\d{2}-\d{4}\b/g},{category:"phone",pattern:/(?:\+?\d{1,3}[ -]?)?\(?\d{3}\)?[ -]?\d{3}[ -]?\d{4}\b/g},{category:"email",pattern:/\b[A-Za-z0-9._%+\-]+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,}\b/g}],Xo=new Set(["password","passwd","pwd","pass","email","email_address","mail","phone","phone_number","mobile","tel","ssn","social_security_number","tax_id","tin","dob","date_of_birth","birthdate","birthday","credit_card","card_number","cc_number","cvv","cvc","iban","account_number","routing_number","auth","authorization","bearer","token","access_token","refresh_token","id_token","api_key","apikey","apisecret","client_secret","secret","private_key","mrn","medical_record_number","patient_id","insurance_id","member_id","first_name","firstname","last_name","lastname","fullname","address","street","address_line_1","address_line_2","zip","postal_code"]),dn=Array.from(Xo).map(r=>new RegExp(`\\b${r.replace(/_/g,"[_ -]?")}\\b`,"i"));function Jo(){return{counts:{},totalMatches:0}}function Ko(r,e,t={}){if(!r||typeof r!="string")return r;const i=t.disabledCategories;let s=r;i?.has("url_query")||(s=s.replace(Qc,n=>Di(n,e)));for(const{category:n,pattern:o}of tu)i?.has(n)||(s=s.replace(o,()=>(e.counts[n]=(e.counts[n]??0)+1,e.totalMatches+=1,`[REDACTED:${n}]`)));return s}function Di(r,e){if(!r||typeof r!="string")return r;let t,i=!1;try{t=new URL(r)}catch{try{t=new URL(r,"http://_bugjar.invalid"),i=!0}catch{return r}}let s=!1;for(const[n]of Array.from(t.searchParams.entries()))qc.has(n.toLowerCase())&&(t.searchParams.set(n,"[REDACTED:url_query]"),e.counts.url_query=(e.counts.url_query??0)+1,e.totalMatches+=1,s=!0);return s?i?t.pathname+t.search+t.hash:t.toString():r}function xt(r,e,t={}){if(r==null)return r;if(typeof r=="string")return Ko(r,e,t);if(typeof r!="object")return r;if(Array.isArray(r))return r.map(n=>xt(n,e,t));const i={},s=t.disabledCategories?.has("field_name")??!1;for(const[n,o]of Object.entries(r))!s&&Xo.has(n.toLowerCase())?(i[n]="[REDACTED:field_name]",e.counts.field_name=(e.counts.field_name??0)+1,e.totalMatches+=1):i[n]=xt(o,e,t);return i}function ru(r){let e=r?.nodeType===Node.ELEMENT_NODE?r:r?.parentElement??null,t=0;for(;e&&t<6;){const i=[e.getAttribute("name"),e.getAttribute("aria-label"),e.getAttribute("placeholder"),e.getAttribute("data-field"),e.id].filter(Boolean);for(const n of i)for(const o of dn)if(o.test(n))return!0;const s=e.getAttribute("aria-labelledby");if(s){const n=document.getElementById(s)?.textContent??"";for(const o of dn)if(o.test(n))return!0}e=e.parentElement,t+=1}return!1}function iu(r={}){const e=r.disabledCategories?.has("field_name")??!1;return(t,i)=>{if(su(i))return t;if(r.strict)return t.replace(/\S/g,"•");if(!e&&i&&ru(i))return t.replace(/\S/g,"•");const s=Jo();return Ko(t,s,{disabledCategories:r.disabledCategories})}}function su(r){let e=r?.nodeType===Node.ELEMENT_NODE?r:r?.parentElement??null,t=0;for(;e&&t<20;){if(e.getAttribute?.("data-bugjar-capture")==="true")return!0;e=e.parentElement,t+=1}return!1}function nu(r,e,t={}){return r.map(i=>xt(i,e,t))}const ou=500;class pn{constructor(e){M(this,"events",[]);M(this,"pendingEvents",[]);M(this,"stopRrweb",null);M(this,"mediaRecorder",null);M(this,"micStream",null);M(this,"audioChunks",[]);M(this,"segmentStartedAt",0);M(this,"tickInterval",null);M(this,"capTimeout",null);M(this,"flushInterval",null);M(this,"beforeUnloadHandler",null);this.opts=e}async start(){if(this.pendingEvents=[],this.segmentStartedAt=performance.now(),this.opts.captureMicrophone)try{this.micStream=await navigator.mediaDevices.getUserMedia({audio:!0});const n=au();this.mediaRecorder=new MediaRecorder(this.micStream,n?{mimeType:n}:void 0),this.mediaRecorder.ondataavailable=o=>{o.data.size>0&&(this.audioChunks.push(o.data),Vc(this.opts.sessionId,o.data))},this.mediaRecorder.start(1e3)}catch{this.micStream=null,this.mediaRecorder=null}let e;try{e=await Promise.resolve().then(()=>require("./rrweb-BXdUj-Sd.cjs"))}catch(n){throw new Error(`Failed to load the recording engine. ${n instanceof Error?n.message:String(n)}`)}this.stopRrweb=e.record({emit:n=>{this.events.push(n),this.pendingEvents.push(n)},maskAllInputs:!0,maskTextFn:iu({strict:this.opts.strictMode,disabledCategories:this.opts.disabledCategories}),blockSelector:"[data-bugjar-block]",maskTextSelector:"[data-bugjar-mask]",sampling:{scroll:150,input:"last"},maskInputOptions:{password:!0,email:!0,tel:!0}})??null;const t=this.segmentStartedAt-this.opts.persistedActiveMs,i=this.opts.persistedActiveMs>0;this.opts.consoleCapture.activate(t,{preserveEntries:i}),this.opts.networkCapture.activate(t,{preserveEntries:i}),this.tickInterval=window.setInterval(()=>{this.opts.onTick(this.combinedElapsedMs())},250);const s=Math.max(0,this.opts.maxDurationSec*1e3-this.opts.persistedActiveMs);this.capTimeout=window.setTimeout(()=>{this.stop()},s),fn(this.opts.projectKey,this.opts.sessionId),this.flushInterval=window.setInterval(()=>{this.flushPending()},ou),this.beforeUnloadHandler=()=>{fn(this.opts.projectKey,this.opts.sessionId),this.flushPending()},window.addEventListener("beforeunload",this.beforeUnloadHandler)}async flushPending(){const e=this.pendingEvents.splice(0);e.length>0&&await Wc(this.opts.sessionId,e);const t=performance.now()-this.segmentStartedAt,i=this.opts.persistedActiveMs+t;await Promise.all([Gc(this.opts.sessionId,this.opts.consoleCapture.snapshot()),Yc(this.opts.sessionId,this.opts.networkCapture.snapshot()),Hc(this.opts.sessionId,i)])}async stop(){this.capTimeout!==null&&(clearTimeout(this.capTimeout),this.capTimeout=null),this.tickInterval!==null&&(clearInterval(this.tickInterval),this.tickInterval=null),this.flushInterval!==null&&(clearInterval(this.flushInterval),this.flushInterval=null),this.beforeUnloadHandler&&(window.removeEventListener("beforeunload",this.beforeUnloadHandler),this.beforeUnloadHandler=null),this.stopRrweb&&this.stopRrweb(),this.stopRrweb=null,this.opts.consoleCapture.deactivate(),this.opts.networkCapture.deactivate();let e=null;this.mediaRecorder&&this.mediaRecorder.state!=="inactive"&&(await new Promise(s=>{this.mediaRecorder.onstop=()=>s(),this.mediaRecorder.stop()}),this.audioChunks.length>0&&(e=new Blob(this.audioChunks,{type:this.mediaRecorder.mimeType||"audio/webm"}))),this.micStream&&(this.micStream.getTracks().forEach(s=>s.stop()),this.micStream=null);const t=performance.now()-this.segmentStartedAt;await this.flushPending();const i=Math.round(this.opts.persistedActiveMs+t);this.opts.onStop({events:this.events,audioBlob:e,durationMs:i})}toggleMic(e){if(this.micStream)for(const t of this.micStream.getAudioTracks())t.enabled=!e}hydrateEvents(e){this.events=e.slice()}hydrateAudioChunks(e){this.audioChunks=e.slice()}combinedElapsedMs(){return this.opts.persistedActiveMs+(performance.now()-this.segmentStartedAt)}}function au(){const r=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus"];for(const e of r)if(typeof MediaRecorder<"u"&&MediaRecorder.isTypeSupported(e))return e;return null}const qo="[modern-screenshot]",et=typeof window<"u",lu=et&&"Worker"in window,ks=et?window.navigator?.userAgent:"",Qo=ks.includes("Chrome"),Ir=ks.includes("AppleWebKit")&&!Qo,Ms=ks.includes("Firefox"),cu=r=>r&&"__CONTEXT__"in r,uu=r=>r.constructor.name==="CSSFontFaceRule",hu=r=>r.constructor.name==="CSSImportRule",fu=r=>r.constructor.name==="CSSLayerBlockRule",Ee=r=>r.nodeType===1,jt=r=>typeof r.className=="object",ea=r=>r.tagName==="image",du=r=>r.tagName==="use",Et=r=>Ee(r)&&typeof r.style<"u"&&!jt(r),pu=r=>r.nodeType===8,mu=r=>r.nodeType===3,tt=r=>r.tagName==="IMG",Xr=r=>r.tagName==="VIDEO",gu=r=>r.tagName==="CANVAS",yu=r=>r.tagName==="TEXTAREA",wu=r=>r.tagName==="INPUT",bu=r=>r.tagName==="STYLE",vu=r=>r.tagName==="SCRIPT",Su=r=>r.tagName==="SELECT",Cu=r=>r.tagName==="SLOT",xu=r=>r.tagName==="IFRAME",Eu=(...r)=>console.warn(qo,...r);function Au(r){const e=r?.createElement?.("canvas");return e&&(e.height=e.width=1),!!e&&"toDataURL"in e&&!!e.toDataURL("image/webp").includes("image/webp")}const Ti=r=>r.startsWith("data:");function ta(r,e){if(r.match(/^[a-z]+:\/\//i))return r;if(et&&r.match(/^\/\//))return window.location.protocol+r;if(r.match(/^[a-z]+:/i)||!et)return r;const t=Jr().implementation.createHTMLDocument(),i=t.createElement("base"),s=t.createElement("a");return t.head.appendChild(i),t.body.appendChild(s),e&&(i.href=e),s.href=r,s.href}function Jr(r){return(r&&Ee(r)?r?.ownerDocument:r)??window.document}const Kr="http://www.w3.org/2000/svg";function Ru(r,e,t){const i=Jr(t).createElementNS(Kr,"svg");return i.setAttributeNS(null,"width",r.toString()),i.setAttributeNS(null,"height",e.toString()),i.setAttributeNS(null,"viewBox",`0 0 ${r} ${e}`),i}function ku(r,e){let t=new XMLSerializer().serializeToString(r);return e&&(t=t.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu,"")),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function Mu(r,e){return new Promise((t,i)=>{const s=new FileReader;s.onload=()=>t(s.result),s.onerror=()=>i(s.error),s.onabort=()=>i(new Error(`Failed read blob to ${e}`)),s.readAsDataURL(r)})}const Nu=r=>Mu(r,"dataUrl");function qe(r,e){const t=Jr(e).createElement("img");return t.decoding="sync",t.loading="eager",t.src=r,t}function At(r,e){return new Promise(t=>{const{timeout:i,ownerDocument:s,onError:n,onWarn:o}=e??{},a=typeof r=="string"?qe(r,Jr(s)):r;let l=null,c=null;function u(){t(a),l&&clearTimeout(l),c?.()}if(i&&(l=setTimeout(u,i)),Xr(a)){const h=a.currentSrc||a.src;if(!h)return a.poster?At(a.poster,e).then(t):u();if(a.readyState>=2)return u();const f=u,d=g=>{o?.("Failed video load",h,g),n?.(g),u()};c=()=>{a.removeEventListener("loadeddata",f),a.removeEventListener("error",d)},a.addEventListener("loadeddata",f,{once:!0}),a.addEventListener("error",d,{once:!0})}else{const h=ea(a)?a.href.baseVal:a.currentSrc||a.src;if(!h)return u();const f=async()=>{if(tt(a)&&"decode"in a)try{await a.decode()}catch(g){o?.("Failed to decode image, trying to render anyway",a.dataset.originalSrc||h,g)}u()},d=g=>{o?.("Failed image load",a.dataset.originalSrc||h,g),u()};if(tt(a)&&a.complete)return f();c=()=>{a.removeEventListener("load",f),a.removeEventListener("error",d)},a.addEventListener("load",f,{once:!0}),a.addEventListener("error",d,{once:!0})}})}async function _u(r,e){Et(r)&&(tt(r)||Xr(r)?await At(r,e):await Promise.all(["img","video"].flatMap(t=>Array.from(r.querySelectorAll(t)).map(i=>At(i,e)))))}const ra=function(){let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)}();function ia(r){return r?.split(",").map(e=>e.trim().replace(/"|'/g,"").toLowerCase()).filter(Boolean)}let mn=0;function Iu(r){const e=`${qo}[#${mn}]`;return mn++,{time:t=>r&&console.time(`${e} ${t}`),timeEnd:t=>r&&console.timeEnd(`${e} ${t}`),warn:(...t)=>r&&Eu(...t)}}function Du(r){return{cache:r?"no-cache":"force-cache"}}async function sa(r,e){return cu(r)?r:Tu(r,{...e,autoDestruct:!0})}async function Tu(r,e){const{scale:t=1,workerUrl:i,workerNumber:s=1}=e||{},n=!!e?.debug,o=e?.features??!0,a=r.ownerDocument??(et?window.document:void 0),l=r.ownerDocument?.defaultView??(et?window:void 0),c=new Map,u={width:0,height:0,quality:1,type:"image/png",scale:t,backgroundColor:null,style:null,filter:null,maximumCanvasSize:0,timeout:3e4,progress:null,debug:n,fetch:{requestInit:Du(e?.fetch?.bypassingCache),placeholderImage:"data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",bypassingCache:!1,...e?.fetch},fetchFn:null,font:{},drawImageInterval:100,workerUrl:null,workerNumber:s,onCloneEachNode:null,onCloneNode:null,onEmbedNode:null,onCreateForeignObjectSvg:null,includeStyleProperties:null,autoDestruct:!1,...e,__CONTEXT__:!0,log:Iu(n),node:r,ownerDocument:a,ownerWindow:l,dpi:t===1?null:96*t,svgStyleElement:na(a),svgDefsElement:a?.createElementNS(Kr,"defs"),svgStyles:new Map,defaultComputedStyles:new Map,workers:[...Array.from({length:lu&&i&&s?s:0})].map(()=>{try{const d=new Worker(i);return d.onmessage=async g=>{const{url:w,result:p}=g.data;p?c.get(w)?.resolve?.(p):c.get(w)?.reject?.(new Error(`Error receiving message from worker: ${w}`))},d.onmessageerror=g=>{const{url:w}=g.data;c.get(w)?.reject?.(new Error(`Error receiving message from worker: ${w}`))},d}catch(d){return u.log.warn("Failed to new Worker",d),null}}).filter(Boolean),fontFamilies:new Map,fontCssTexts:new Map,acceptOfImage:`${[Au(a)&&"image/webp","image/svg+xml","image/*","*/*"].filter(Boolean).join(",")};q=0.8`,requests:c,drawImageCount:0,tasks:[],features:o,isEnable:d=>d==="restoreScrollPosition"?typeof o=="boolean"?!1:o[d]??!1:typeof o=="boolean"?o:o[d]??!0,shadowRoots:[]};u.log.time("wait until load"),await _u(r,{timeout:u.timeout,onWarn:u.log.warn}),u.log.timeEnd("wait until load");const{width:h,height:f}=Ou(r,u);return u.width=h,u.height=f,u}function na(r){if(!r)return;const e=r.createElement("style"),t=e.ownerDocument.createTextNode(`
2
2
  .______background-clip--text {
3
3
  background-clip: text;
4
4
  -webkit-background-clip: text;
5
5
  }
6
- `);return e.appendChild(t),e}function Ou(r,e){let{width:t,height:i}=e;if(Ee(r)&&(!t||!i)){const s=r.getBoundingClientRect();t=t||s.width||Number(r.getAttribute("width"))||0,i=i||s.height||Number(r.getAttribute("height"))||0}return{width:t,height:i}}async function Pu(r,e){const{log:t,timeout:i,drawImageCount:s,drawImageInterval:n}=e;t.time("image to canvas");const o=await At(r,{timeout:i,onWarn:e.log.warn}),{canvas:a,context2d:l}=Lu(r.ownerDocument,e),c=()=>{try{l?.drawImage(o,0,0,a.width,a.height)}catch(u){e.log.warn("Failed to drawImage",u)}};if(c(),e.isEnable("fixSvgXmlDecode"))for(let u=0;u<s;u++)await new Promise(h=>{setTimeout(()=>{l?.clearRect(0,0,a.width,a.height),c(),h()},u+n)});return e.drawImageCount=0,t.timeEnd("image to canvas"),a}function Lu(r,e){const{width:t,height:i,scale:s,backgroundColor:n,maximumCanvasSize:o}=e,a=r.createElement("canvas");a.width=Math.floor(t*s),a.height=Math.floor(i*s),a.style.width=`${t}px`,a.style.height=`${i}px`,o&&(a.width>o||a.height>o)&&(a.width>o&&a.height>o?a.width>a.height?(a.height*=o/a.width,a.width=o):(a.width*=o/a.height,a.height=o):a.width>o?(a.height*=o/a.width,a.width=o):(a.width*=o/a.height,a.height=o));const l=a.getContext("2d");return l&&n&&(l.fillStyle=n,l.fillRect(0,0,a.width,a.height)),{canvas:a,context2d:l}}function oa(r,e){if(r.ownerDocument)try{const n=r.toDataURL();if(n!=="data:,")return qe(n,r.ownerDocument)}catch(n){e.log.warn("Failed to clone canvas",n)}const t=r.cloneNode(!1),i=r.getContext("2d"),s=t.getContext("2d");try{return i&&s&&s.putImageData(i.getImageData(0,0,r.width,r.height),0,0),t}catch(n){e.log.warn("Failed to clone canvas",n)}return t}function $u(r,e){try{if(r?.contentDocument?.documentElement)return Ns(r.contentDocument.documentElement,e)}catch(t){e.log.warn("Failed to clone iframe",t)}return r.cloneNode(!1)}function Fu(r){const e=r.cloneNode(!1);return r.currentSrc&&r.currentSrc!==r.src&&(e.src=r.currentSrc,e.srcset=""),e.loading==="lazy"&&(e.loading="eager"),e}async function ju(r,e){if(r.ownerDocument&&!r.currentSrc&&r.poster)return qe(r.poster,r.ownerDocument);const t=r.cloneNode(!1);t.crossOrigin="anonymous",r.currentSrc&&r.currentSrc!==r.src&&(t.src=r.currentSrc);const i=t.ownerDocument;if(i){let s=!0;if(await At(t,{onError:()=>s=!1,onWarn:e.log.warn}),!s)return r.poster?qe(r.poster,r.ownerDocument):t;t.currentTime=r.currentTime,await new Promise(o=>{t.addEventListener("seeked",o,{once:!0})});const n=i.createElement("canvas");n.width=r.offsetWidth,n.height=r.offsetHeight;try{const o=n.getContext("2d");o&&o.drawImage(t,0,0,n.width,n.height)}catch(o){return e.log.warn("Failed to clone video",o),r.poster?qe(r.poster,r.ownerDocument):t}return oa(n,e)}return t}function Bu(r,e){return gu(r)?oa(r,e):xu(r)?$u(r,e):tt(r)?Fu(r):Xr(r)?ju(r,e):r.cloneNode(!1)}function Uu(r){let e=r.sandbox;if(!e){const{ownerDocument:t}=r;try{t&&(e=t.createElement("iframe"),e.id=`__SANDBOX__${ra()}`,e.width="0",e.height="0",e.style.visibility="hidden",e.style.position="fixed",t.body.appendChild(e),e.srcdoc='<!DOCTYPE html><meta charset="UTF-8"><title></title><body>',r.sandbox=e)}catch(i){r.log.warn("Failed to getSandBox",i)}}return e}const zu=["width","height","-webkit-text-fill-color"],Wu=["stroke","fill"];function aa(r,e,t){const{defaultComputedStyles:i}=t,s=r.nodeName.toLowerCase(),n=Ft(r)&&s!=="svg",o=n?Wu.map(w=>[w,r.getAttribute(w)]).filter(([,w])=>w!==null):[],a=[n&&"svg",s,o.map((w,p)=>`${w}=${p}`).join(","),e].filter(Boolean).join(":");if(i.has(a))return i.get(a);const c=Uu(t)?.contentWindow;if(!c)return new Map;const u=c?.document;let h,f;n?(h=u.createElementNS(Kr,"svg"),f=h.ownerDocument.createElementNS(h.namespaceURI,s),o.forEach(([w,p])=>{f.setAttributeNS(null,w,p)}),h.appendChild(f)):h=f=u.createElement(s),f.textContent=" ",u.body.appendChild(h);const d=c.getComputedStyle(f,e),m=new Map;for(let w=d.length,p=0;p<w;p++){const y=d.item(p);zu.includes(y)||m.set(y,d.getPropertyValue(y))}return u.body.removeChild(h),i.set(a,m),m}function la(r,e,t){const i=new Map,s=[],n=new Map;if(t)for(const a of t)o(a);else for(let a=r.length,l=0;l<a;l++){const c=r.item(l);o(c)}for(let a=s.length,l=0;l<a;l++)n.get(s[l])?.forEach((c,u)=>i.set(u,c));function o(a){const l=r.getPropertyValue(a),c=r.getPropertyPriority(a),u=a.lastIndexOf("-"),h=u>-1?a.substring(0,u):void 0;if(h){let f=n.get(h);f||(f=new Map,n.set(h,f)),f.set(a,[l,c])}e.get(a)===l&&!c||(h?s.push(h):i.set(a,[l,c]))}return i}function Vu(r,e,t,i){const{ownerWindow:s,includeStyleProperties:n,currentParentNodeStyle:o}=i,a=e.style,l=s.getComputedStyle(r),c=aa(r,null,i);o?.forEach((h,f)=>{c.delete(f)});const u=la(l,c,n);u.delete("transition-property"),u.delete("all"),u.delete("d"),u.delete("content"),t&&(u.delete("position"),u.delete("margin-top"),u.delete("margin-right"),u.delete("margin-bottom"),u.delete("margin-left"),u.delete("margin-block-start"),u.delete("margin-block-end"),u.delete("margin-inline-start"),u.delete("margin-inline-end"),u.set("box-sizing",["border-box",""])),u.get("background-clip")?.[0]==="text"&&e.classList.add("______background-clip--text"),Qo&&(u.has("font-kerning")||u.set("font-kerning",["normal",""]),(u.get("overflow-x")?.[0]==="hidden"||u.get("overflow-y")?.[0]==="hidden")&&u.get("text-overflow")?.[0]==="ellipsis"&&r.scrollWidth===r.clientWidth&&u.set("text-overflow",["clip",""]));for(let h=a.length,f=0;f<h;f++)a.removeProperty(a.item(f));return u.forEach(([h,f],d)=>{a.setProperty(d,h,f)}),u}function Gu(r,e){(yu(r)||wu(r)||Su(r))&&e.setAttribute("value",r.value)}const Yu=["::before","::after"],Hu=["::-webkit-scrollbar","::-webkit-scrollbar-button","::-webkit-scrollbar-thumb","::-webkit-scrollbar-track","::-webkit-scrollbar-track-piece","::-webkit-scrollbar-corner","::-webkit-resizer"];function Zu(r,e,t,i,s){const{ownerWindow:n,svgStyleElement:o,svgStyles:a,currentNodeStyle:l}=i;if(!o||!n)return;function c(u){const h=n.getComputedStyle(r,u);let f=h.getPropertyValue("content");if(!f||f==="none")return;s?.(f),f=f.replace(/(')|(")|(counter\(.+\))/g,"");const d=[ra()],m=aa(r,u,i);l?.forEach((v,x)=>{m.delete(x)});const w=la(h,m,i.includeStyleProperties);w.delete("content"),w.delete("-webkit-locale"),w.get("background-clip")?.[0]==="text"&&e.classList.add("______background-clip--text");const p=[`content: '${f}';`];if(w.forEach(([v,x],M)=>{p.push(`${M}: ${v}${x?" !important":""};`)}),p.length===1)return;try{e.className=[e.className,...d].join(" ")}catch(v){i.log.warn("Failed to copyPseudoClass",v);return}const y=p.join(`
7
- `);let b=a.get(y);b||(b=[],a.set(y,b)),b.push(`.${d[0]}${u}`)}Yu.forEach(c),t&&Hu.forEach(c)}const gn=new Set(["symbol"]);async function yn(r,e,t,i,s){if(Ee(t)&&(bu(t)||vu(t))||i.filter&&!i.filter(t))return;gn.has(e.nodeName)||gn.has(t.nodeName)?i.currentParentNodeStyle=void 0:i.currentParentNodeStyle=i.currentNodeStyle;const n=await Ns(t,i,!1,s);i.isEnable("restoreScrollPosition")&&Xu(r,n),e.appendChild(n)}async function wn(r,e,t,i){let s=r.firstChild;Ee(r)&&r.shadowRoot&&(s=r.shadowRoot?.firstChild,t.shadowRoots.push(r.shadowRoot));for(let n=s;n;n=n.nextSibling)if(!pu(n))if(Ee(n)&&Cu(n)&&typeof n.assignedNodes=="function"){const o=n.assignedNodes();for(let a=0;a<o.length;a++)await yn(r,e,o[a],t,i)}else await yn(r,e,n,t,i)}function Xu(r,e){if(!Et(r)||!Et(e))return;const{scrollTop:t,scrollLeft:i}=r;if(!t&&!i)return;const{transform:s}=e.style,n=new DOMMatrix(s),{a:o,b:a,c:l,d:c}=n;n.a=1,n.b=0,n.c=0,n.d=1,n.translateSelf(-i,-t),n.a=o,n.b=a,n.c=l,n.d=c,e.style.transform=n.toString()}function Ju(r,e){const{backgroundColor:t,width:i,height:s,style:n}=e,o=r.style;if(t&&o.setProperty("background-color",t,"important"),i&&o.setProperty("width",`${i}px`,"important"),s&&o.setProperty("height",`${s}px`,"important"),n)for(const a in n)o[a]=n[a]}const Ku=/^[\w-:]+$/;async function Ns(r,e,t=!1,i){const{ownerDocument:s,ownerWindow:n,fontFamilies:o,onCloneEachNode:a}=e;if(s&&mu(r))return i&&/\S/.test(r.data)&&i(r.data),s.createTextNode(r.data);if(s&&n&&Ee(r)&&(Et(r)||Ft(r))){const c=await Bu(r,e);if(e.isEnable("removeAbnormalAttributes")){const w=c.getAttributeNames();for(let p=w.length,y=0;y<p;y++){const b=w[y];Ku.test(b)||c.removeAttribute(b)}}const u=e.currentNodeStyle=Vu(r,c,t,e);t&&Ju(c,e);let h=!1;if(e.isEnable("copyScrollbar")){const w=[u.get("overflow-x")?.[0],u.get("overflow-y")?.[0]];h=w.includes("scroll")||(w.includes("auto")||w.includes("overlay"))&&(r.scrollHeight>r.clientHeight||r.scrollWidth>r.clientWidth)}const f=u.get("text-transform")?.[0],d=ia(u.get("font-family")?.[0]),m=d?w=>{f==="uppercase"?w=w.toUpperCase():f==="lowercase"?w=w.toLowerCase():f==="capitalize"&&(w=w[0].toUpperCase()+w.substring(1)),d.forEach(p=>{let y=o.get(p);y||o.set(p,y=new Set),w.split("").forEach(b=>y.add(b))})}:void 0;return Zu(r,c,h,e,m),Gu(r,c),Xr(r)||await wn(r,c,e,m),await a?.(c),c}const l=r.cloneNode(!1);return await wn(r,l,e),await a?.(l),l}function qu(r){if(r.ownerDocument=void 0,r.ownerWindow=void 0,r.svgStyleElement=void 0,r.svgDefsElement=void 0,r.svgStyles.clear(),r.defaultComputedStyles.clear(),r.sandbox){try{r.sandbox.remove()}catch(e){r.log.warn("Failed to destroyContext",e)}r.sandbox=void 0}r.workers=[],r.fontFamilies.clear(),r.fontCssTexts.clear(),r.requests.clear(),r.tasks=[],r.shadowRoots=[]}function Qu(r){const{url:e,timeout:t,responseType:i,...s}=r,n=new AbortController,o=t?setTimeout(()=>n.abort(),t):void 0;return fetch(e,{signal:n.signal,...s}).then(a=>{if(!a.ok)throw new Error("Failed fetch, not 2xx response",{cause:a});switch(i){case"arrayBuffer":return a.arrayBuffer();case"dataUrl":return a.blob().then(Nu);case"text":default:return a.text()}}).finally(()=>clearTimeout(o))}function Rt(r,e){const{url:t,requestType:i="text",responseType:s="text",imageDom:n}=e;let o=t;const{timeout:a,acceptOfImage:l,requests:c,fetchFn:u,fetch:{requestInit:h,bypassingCache:f,placeholderImage:d},font:m,workers:w,fontFamilies:p}=r;i==="image"&&(Ir||ks)&&r.drawImageCount++;let y=c.get(t);if(!y){f&&f instanceof RegExp&&f.test(o)&&(o+=(/\?/.test(o)?"&":"?")+new Date().getTime());const b=i.startsWith("font")&&m&&m.minify,v=new Set;b&&i.split(";")[1].split(",").forEach(j=>{p.has(j)&&p.get(j).forEach(D=>v.add(D))});const x=b&&v.size,M={url:o,timeout:a,responseType:x?"arrayBuffer":s,headers:i==="image"?{accept:l}:void 0,...h};y={type:i,resolve:void 0,reject:void 0,response:null},y.response=(async()=>{if(u&&i==="image"){const N=await u(t);if(N)return N}return!Ir&&t.startsWith("http")&&w.length?new Promise((N,j)=>{w[c.size&w.length-1].postMessage({rawUrl:t,...M}),y.resolve=N,y.reject=j}):Qu(M)})().catch(N=>{if(c.delete(t),i==="image"&&d)return r.log.warn("Failed to fetch image base64, trying to use placeholder image",o),typeof d=="string"?d:d(n);throw N}),c.set(t,y)}return y.response}async function ca(r,e,t,i){if(!ua(r))return r;for(const[s,n]of eh(r,e))try{const o=await Rt(t,{url:n,requestType:i?"image":"text",responseType:"dataUrl"});r=r.replace(th(s),`$1${o}$3`)}catch(o){t.log.warn("Failed to fetch css data url",s,o)}return r}function ua(r){return/url\((['"]?)([^'"]+?)\1\)/.test(r)}const ha=/url\((['"]?)([^'"]+?)\1\)/g;function eh(r,e){const t=[];return r.replace(ha,(i,s,n)=>(t.push([n,ta(n,e)]),i)),t.filter(([i])=>!Ti(i))}function th(r){const e=r.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}const rh=["background-image","border-image-source","-webkit-border-image","-webkit-mask-image","list-style-image"];function ih(r,e){return rh.map(t=>{const i=r.getPropertyValue(t);return!i||i==="none"?null:((Ir||ks)&&e.drawImageCount++,ca(i,null,e,!0).then(s=>{!s||i===s||r.setProperty(t,s,r.getPropertyPriority(t))}))}).filter(Boolean)}function sh(r,e){if(tt(r)){const t=r.currentSrc||r.src;if(!Ti(t))return[Rt(e,{url:t,imageDom:r,requestType:"image",responseType:"dataUrl"}).then(i=>{i&&(r.srcset="",r.dataset.originalSrc=t,r.src=i||"")})];(Ir||ks)&&e.drawImageCount++}else if(Ft(r)&&!Ti(r.href.baseVal)){const t=r.href.baseVal;return[Rt(e,{url:t,imageDom:r,requestType:"image",responseType:"dataUrl"}).then(i=>{i&&(r.dataset.originalSrc=t,r.href.baseVal=i||"")})]}return[]}function nh(r,e){const{ownerDocument:t,svgDefsElement:i}=e,s=r.getAttribute("href")??r.getAttribute("xlink:href");if(!s)return[];const[n,o]=s.split("#");if(o){const a=`#${o}`,l=e.shadowRoots.reduce((c,u)=>c??u.querySelector(`svg ${a}`),t?.querySelector(`svg ${a}`));if(n&&r.setAttribute("href",a),i?.querySelector(a))return[];if(l)return i?.appendChild(l.cloneNode(!0)),[];if(n)return[Rt(e,{url:n,responseType:"text"}).then(c=>{i?.insertAdjacentHTML("beforeend",c)})]}return[]}function fa(r,e){const{tasks:t}=e;Ee(r)&&((tt(r)||ea(r))&&t.push(...sh(r,e)),du(r)&&t.push(...nh(r,e))),Et(r)&&t.push(...ih(r.style,e)),r.childNodes.forEach(i=>{fa(i,e)})}async function oh(r,e){const{ownerDocument:t,svgStyleElement:i,fontFamilies:s,fontCssTexts:n,tasks:o,font:a}=e;if(!(!t||!i||!s.size))if(a&&a.cssText){const l=vn(a.cssText,e);i.appendChild(t.createTextNode(`${l}
8
- `))}else{const l=Array.from(t.styleSheets).filter(d=>{try{return"cssRules"in d&&!!d.cssRules.length}catch(m){return e.log.warn(`Error while reading CSS rules from ${d.href}`,m),!1}}),c=t.implementation.createHTMLDocument(""),u=c.createElement("style");c.head.appendChild(u);const h=u.sheet;await Promise.all(l.flatMap(d=>Array.from(d.cssRules).map(async m=>{if(hu(m)){const w=m.href;let p="";try{p=await Rt(e,{url:w,requestType:"text",responseType:"text"})}catch(b){e.log.warn(`Error fetch remote css import from ${w}`,b)}const y=p.replace(ha,(b,v,x)=>b.replace(x,ta(x,w)));for(const b of lh(y))try{h.insertRule(b,h.cssRules.length)}catch(v){e.log.warn("Error inserting rule from remote css import",{rule:b,error:v})}}}))),h.cssRules.length&&l.push(h);const f=[];l.forEach(d=>{Oi(d.cssRules,f)}),f.filter(d=>uu(d)&&ua(d.style.getPropertyValue("src"))&&ia(d.style.getPropertyValue("font-family"))?.some(m=>s.has(m))).forEach(d=>{const m=d,w=n.get(m.cssText);w?i.appendChild(t.createTextNode(`${w}
9
- `)):o.push(ca(m.cssText,m.parentStyleSheet?m.parentStyleSheet.href:null,e).then(p=>{p=vn(p,e),n.set(m.cssText,p),i.appendChild(t.createTextNode(`${p}
10
- `))}))})}}const ah=/(\/\*[\s\S]*?\*\/)/g,bn=/((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;function lh(r){if(r==null)return[];const e=[];let t=r.replace(ah,"");for(;;){const n=bn.exec(t);if(!n)break;e.push(n[0])}t=t.replace(bn,"");const i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,s=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;;){let n=i.exec(t);if(n)s.lastIndex=i.lastIndex;else if(n=s.exec(t),n)i.lastIndex=s.lastIndex;else break;e.push(n[0])}return e}const ch=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,uh=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function vn(r,e){const{font:t}=e,i=t?t?.preferredFormat:void 0;return i?r.replace(uh,s=>{for(;;){const[n,,o]=ch.exec(s)||[];if(!o)return"";if(o===i)return`src: ${n};`}}):r}function Oi(r,e=[]){for(const t of Array.from(r))fu(t)?e.push(...Oi(t.cssRules)):"cssRules"in t?Oi(t.cssRules,e):e.push(t);return e}const hh=/\bx?link:?href\s*=\s*["'](?!data:)[^"']+["']/i;function fh(r){return hh.test(r.innerHTML)}async function dh(r,e){const t=await sa(r,e);if(Ee(t.node)&&Ft(t.node)&&!fh(t.node))return t.node;const{ownerDocument:i,log:s,tasks:n,svgStyleElement:o,svgDefsElement:a,svgStyles:l,font:c,progress:u,autoDestruct:h,onCloneNode:f,onEmbedNode:d,onCreateForeignObjectSvg:m}=t;s.time("clone node");const w=await Ns(t.node,t,!0);if(o&&i){let x="";l.forEach((M,N)=>{x+=`${M.join(`,
6
+ `);return e.appendChild(t),e}function Ou(r,e){let{width:t,height:i}=e;if(Ee(r)&&(!t||!i)){const s=r.getBoundingClientRect();t=t||s.width||Number(r.getAttribute("width"))||0,i=i||s.height||Number(r.getAttribute("height"))||0}return{width:t,height:i}}async function Pu(r,e){const{log:t,timeout:i,drawImageCount:s,drawImageInterval:n}=e;t.time("image to canvas");const o=await At(r,{timeout:i,onWarn:e.log.warn}),{canvas:a,context2d:l}=Lu(r.ownerDocument,e),c=()=>{try{l?.drawImage(o,0,0,a.width,a.height)}catch(u){e.log.warn("Failed to drawImage",u)}};if(c(),e.isEnable("fixSvgXmlDecode"))for(let u=0;u<s;u++)await new Promise(h=>{setTimeout(()=>{l?.clearRect(0,0,a.width,a.height),c(),h()},u+n)});return e.drawImageCount=0,t.timeEnd("image to canvas"),a}function Lu(r,e){const{width:t,height:i,scale:s,backgroundColor:n,maximumCanvasSize:o}=e,a=r.createElement("canvas");a.width=Math.floor(t*s),a.height=Math.floor(i*s),a.style.width=`${t}px`,a.style.height=`${i}px`,o&&(a.width>o||a.height>o)&&(a.width>o&&a.height>o?a.width>a.height?(a.height*=o/a.width,a.width=o):(a.width*=o/a.height,a.height=o):a.width>o?(a.height*=o/a.width,a.width=o):(a.width*=o/a.height,a.height=o));const l=a.getContext("2d");return l&&n&&(l.fillStyle=n,l.fillRect(0,0,a.width,a.height)),{canvas:a,context2d:l}}function oa(r,e){if(r.ownerDocument)try{const n=r.toDataURL();if(n!=="data:,")return qe(n,r.ownerDocument)}catch(n){e.log.warn("Failed to clone canvas",n)}const t=r.cloneNode(!1),i=r.getContext("2d"),s=t.getContext("2d");try{return i&&s&&s.putImageData(i.getImageData(0,0,r.width,r.height),0,0),t}catch(n){e.log.warn("Failed to clone canvas",n)}return t}function $u(r,e){try{if(r?.contentDocument?.documentElement)return Ns(r.contentDocument.documentElement,e)}catch(t){e.log.warn("Failed to clone iframe",t)}return r.cloneNode(!1)}function ju(r){const e=r.cloneNode(!1);return r.currentSrc&&r.currentSrc!==r.src&&(e.src=r.currentSrc,e.srcset=""),e.loading==="lazy"&&(e.loading="eager"),e}async function Fu(r,e){if(r.ownerDocument&&!r.currentSrc&&r.poster)return qe(r.poster,r.ownerDocument);const t=r.cloneNode(!1);t.crossOrigin="anonymous",r.currentSrc&&r.currentSrc!==r.src&&(t.src=r.currentSrc);const i=t.ownerDocument;if(i){let s=!0;if(await At(t,{onError:()=>s=!1,onWarn:e.log.warn}),!s)return r.poster?qe(r.poster,r.ownerDocument):t;t.currentTime=r.currentTime,await new Promise(o=>{t.addEventListener("seeked",o,{once:!0})});const n=i.createElement("canvas");n.width=r.offsetWidth,n.height=r.offsetHeight;try{const o=n.getContext("2d");o&&o.drawImage(t,0,0,n.width,n.height)}catch(o){return e.log.warn("Failed to clone video",o),r.poster?qe(r.poster,r.ownerDocument):t}return oa(n,e)}return t}function Bu(r,e){return gu(r)?oa(r,e):xu(r)?$u(r,e):tt(r)?ju(r):Xr(r)?Fu(r,e):r.cloneNode(!1)}function Uu(r){let e=r.sandbox;if(!e){const{ownerDocument:t}=r;try{t&&(e=t.createElement("iframe"),e.id=`__SANDBOX__${ra()}`,e.width="0",e.height="0",e.style.visibility="hidden",e.style.position="fixed",t.body.appendChild(e),e.srcdoc='<!DOCTYPE html><meta charset="UTF-8"><title></title><body>',r.sandbox=e)}catch(i){r.log.warn("Failed to getSandBox",i)}}return e}const zu=["width","height","-webkit-text-fill-color"],Wu=["stroke","fill"];function aa(r,e,t){const{defaultComputedStyles:i}=t,s=r.nodeName.toLowerCase(),n=jt(r)&&s!=="svg",o=n?Wu.map(w=>[w,r.getAttribute(w)]).filter(([,w])=>w!==null):[],a=[n&&"svg",s,o.map((w,p)=>`${w}=${p}`).join(","),e].filter(Boolean).join(":");if(i.has(a))return i.get(a);const c=Uu(t)?.contentWindow;if(!c)return new Map;const u=c?.document;let h,f;n?(h=u.createElementNS(Kr,"svg"),f=h.ownerDocument.createElementNS(h.namespaceURI,s),o.forEach(([w,p])=>{f.setAttributeNS(null,w,p)}),h.appendChild(f)):h=f=u.createElement(s),f.textContent=" ",u.body.appendChild(h);const d=c.getComputedStyle(f,e),g=new Map;for(let w=d.length,p=0;p<w;p++){const y=d.item(p);zu.includes(y)||g.set(y,d.getPropertyValue(y))}return u.body.removeChild(h),i.set(a,g),g}function la(r,e,t){const i=new Map,s=[],n=new Map;if(t)for(const a of t)o(a);else for(let a=r.length,l=0;l<a;l++){const c=r.item(l);o(c)}for(let a=s.length,l=0;l<a;l++)n.get(s[l])?.forEach((c,u)=>i.set(u,c));function o(a){const l=r.getPropertyValue(a),c=r.getPropertyPriority(a),u=a.lastIndexOf("-"),h=u>-1?a.substring(0,u):void 0;if(h){let f=n.get(h);f||(f=new Map,n.set(h,f)),f.set(a,[l,c])}e.get(a)===l&&!c||(h?s.push(h):i.set(a,[l,c]))}return i}function Vu(r,e,t,i){const{ownerWindow:s,includeStyleProperties:n,currentParentNodeStyle:o}=i,a=e.style,l=s.getComputedStyle(r),c=aa(r,null,i);o?.forEach((h,f)=>{c.delete(f)});const u=la(l,c,n);u.delete("transition-property"),u.delete("all"),u.delete("d"),u.delete("content"),t&&(u.delete("position"),u.delete("margin-top"),u.delete("margin-right"),u.delete("margin-bottom"),u.delete("margin-left"),u.delete("margin-block-start"),u.delete("margin-block-end"),u.delete("margin-inline-start"),u.delete("margin-inline-end"),u.set("box-sizing",["border-box",""])),u.get("background-clip")?.[0]==="text"&&e.classList.add("______background-clip--text"),Qo&&(u.has("font-kerning")||u.set("font-kerning",["normal",""]),(u.get("overflow-x")?.[0]==="hidden"||u.get("overflow-y")?.[0]==="hidden")&&u.get("text-overflow")?.[0]==="ellipsis"&&r.scrollWidth===r.clientWidth&&u.set("text-overflow",["clip",""]));for(let h=a.length,f=0;f<h;f++)a.removeProperty(a.item(f));return u.forEach(([h,f],d)=>{a.setProperty(d,h,f)}),u}function Gu(r,e){(yu(r)||wu(r)||Su(r))&&e.setAttribute("value",r.value)}const Yu=["::before","::after"],Hu=["::-webkit-scrollbar","::-webkit-scrollbar-button","::-webkit-scrollbar-thumb","::-webkit-scrollbar-track","::-webkit-scrollbar-track-piece","::-webkit-scrollbar-corner","::-webkit-resizer"];function Zu(r,e,t,i,s){const{ownerWindow:n,svgStyleElement:o,svgStyles:a,currentNodeStyle:l}=i;if(!o||!n)return;function c(u){const h=n.getComputedStyle(r,u);let f=h.getPropertyValue("content");if(!f||f==="none")return;s?.(f),f=f.replace(/(')|(")|(counter\(.+\))/g,"");const d=[ra()],g=aa(r,u,i);l?.forEach((v,x)=>{g.delete(x)});const w=la(h,g,i.includeStyleProperties);w.delete("content"),w.delete("-webkit-locale"),w.get("background-clip")?.[0]==="text"&&e.classList.add("______background-clip--text");const p=[`content: '${f}';`];if(w.forEach(([v,x],k)=>{p.push(`${k}: ${v}${x?" !important":""};`)}),p.length===1)return;try{e.className=[e.className,...d].join(" ")}catch(v){i.log.warn("Failed to copyPseudoClass",v);return}const y=p.join(`
7
+ `);let b=a.get(y);b||(b=[],a.set(y,b)),b.push(`.${d[0]}${u}`)}Yu.forEach(c),t&&Hu.forEach(c)}const gn=new Set(["symbol"]);async function yn(r,e,t,i,s){if(Ee(t)&&(bu(t)||vu(t))||i.filter&&!i.filter(t))return;gn.has(e.nodeName)||gn.has(t.nodeName)?i.currentParentNodeStyle=void 0:i.currentParentNodeStyle=i.currentNodeStyle;const n=await Ns(t,i,!1,s);i.isEnable("restoreScrollPosition")&&Xu(r,n),e.appendChild(n)}async function wn(r,e,t,i){let s=r.firstChild;Ee(r)&&r.shadowRoot&&(s=r.shadowRoot?.firstChild,t.shadowRoots.push(r.shadowRoot));for(let n=s;n;n=n.nextSibling)if(!pu(n))if(Ee(n)&&Cu(n)&&typeof n.assignedNodes=="function"){const o=n.assignedNodes();for(let a=0;a<o.length;a++)await yn(r,e,o[a],t,i)}else await yn(r,e,n,t,i)}function Xu(r,e){if(!Et(r)||!Et(e))return;const{scrollTop:t,scrollLeft:i}=r;if(!t&&!i)return;const{transform:s}=e.style,n=new DOMMatrix(s),{a:o,b:a,c:l,d:c}=n;n.a=1,n.b=0,n.c=0,n.d=1,n.translateSelf(-i,-t),n.a=o,n.b=a,n.c=l,n.d=c,e.style.transform=n.toString()}function Ju(r,e){const{backgroundColor:t,width:i,height:s,style:n}=e,o=r.style;if(t&&o.setProperty("background-color",t,"important"),i&&o.setProperty("width",`${i}px`,"important"),s&&o.setProperty("height",`${s}px`,"important"),n)for(const a in n)o[a]=n[a]}const Ku=/^[\w-:]+$/;async function Ns(r,e,t=!1,i){const{ownerDocument:s,ownerWindow:n,fontFamilies:o,onCloneEachNode:a}=e;if(s&&mu(r))return i&&/\S/.test(r.data)&&i(r.data),s.createTextNode(r.data);if(s&&n&&Ee(r)&&(Et(r)||jt(r))){const c=await Bu(r,e);if(e.isEnable("removeAbnormalAttributes")){const w=c.getAttributeNames();for(let p=w.length,y=0;y<p;y++){const b=w[y];Ku.test(b)||c.removeAttribute(b)}}const u=e.currentNodeStyle=Vu(r,c,t,e);t&&Ju(c,e);let h=!1;if(e.isEnable("copyScrollbar")){const w=[u.get("overflow-x")?.[0],u.get("overflow-y")?.[0]];h=w.includes("scroll")||(w.includes("auto")||w.includes("overlay"))&&(r.scrollHeight>r.clientHeight||r.scrollWidth>r.clientWidth)}const f=u.get("text-transform")?.[0],d=ia(u.get("font-family")?.[0]),g=d?w=>{f==="uppercase"?w=w.toUpperCase():f==="lowercase"?w=w.toLowerCase():f==="capitalize"&&(w=w[0].toUpperCase()+w.substring(1)),d.forEach(p=>{let y=o.get(p);y||o.set(p,y=new Set),w.split("").forEach(b=>y.add(b))})}:void 0;return Zu(r,c,h,e,g),Gu(r,c),Xr(r)||await wn(r,c,e,g),await a?.(c),c}const l=r.cloneNode(!1);return await wn(r,l,e),await a?.(l),l}function qu(r){if(r.ownerDocument=void 0,r.ownerWindow=void 0,r.svgStyleElement=void 0,r.svgDefsElement=void 0,r.svgStyles.clear(),r.defaultComputedStyles.clear(),r.sandbox){try{r.sandbox.remove()}catch(e){r.log.warn("Failed to destroyContext",e)}r.sandbox=void 0}r.workers=[],r.fontFamilies.clear(),r.fontCssTexts.clear(),r.requests.clear(),r.tasks=[],r.shadowRoots=[]}function Qu(r){const{url:e,timeout:t,responseType:i,...s}=r,n=new AbortController,o=t?setTimeout(()=>n.abort(),t):void 0;return fetch(e,{signal:n.signal,...s}).then(a=>{if(!a.ok)throw new Error("Failed fetch, not 2xx response",{cause:a});switch(i){case"arrayBuffer":return a.arrayBuffer();case"dataUrl":return a.blob().then(Nu);case"text":default:return a.text()}}).finally(()=>clearTimeout(o))}function Rt(r,e){const{url:t,requestType:i="text",responseType:s="text",imageDom:n}=e;let o=t;const{timeout:a,acceptOfImage:l,requests:c,fetchFn:u,fetch:{requestInit:h,bypassingCache:f,placeholderImage:d},font:g,workers:w,fontFamilies:p}=r;i==="image"&&(Ir||Ms)&&r.drawImageCount++;let y=c.get(t);if(!y){f&&f instanceof RegExp&&f.test(o)&&(o+=(/\?/.test(o)?"&":"?")+new Date().getTime());const b=i.startsWith("font")&&g&&g.minify,v=new Set;b&&i.split(";")[1].split(",").forEach(F=>{p.has(F)&&p.get(F).forEach(D=>v.add(D))});const x=b&&v.size,k={url:o,timeout:a,responseType:x?"arrayBuffer":s,headers:i==="image"?{accept:l}:void 0,...h};y={type:i,resolve:void 0,reject:void 0,response:null},y.response=(async()=>{if(u&&i==="image"){const N=await u(t);if(N)return N}return!Ir&&t.startsWith("http")&&w.length?new Promise((N,F)=>{w[c.size&w.length-1].postMessage({rawUrl:t,...k}),y.resolve=N,y.reject=F}):Qu(k)})().catch(N=>{if(c.delete(t),i==="image"&&d)return r.log.warn("Failed to fetch image base64, trying to use placeholder image",o),typeof d=="string"?d:d(n);throw N}),c.set(t,y)}return y.response}async function ca(r,e,t,i){if(!ua(r))return r;for(const[s,n]of eh(r,e))try{const o=await Rt(t,{url:n,requestType:i?"image":"text",responseType:"dataUrl"});r=r.replace(th(s),`$1${o}$3`)}catch(o){t.log.warn("Failed to fetch css data url",s,o)}return r}function ua(r){return/url\((['"]?)([^'"]+?)\1\)/.test(r)}const ha=/url\((['"]?)([^'"]+?)\1\)/g;function eh(r,e){const t=[];return r.replace(ha,(i,s,n)=>(t.push([n,ta(n,e)]),i)),t.filter(([i])=>!Ti(i))}function th(r){const e=r.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}const rh=["background-image","border-image-source","-webkit-border-image","-webkit-mask-image","list-style-image"];function ih(r,e){return rh.map(t=>{const i=r.getPropertyValue(t);return!i||i==="none"?null:((Ir||Ms)&&e.drawImageCount++,ca(i,null,e,!0).then(s=>{!s||i===s||r.setProperty(t,s,r.getPropertyPriority(t))}))}).filter(Boolean)}function sh(r,e){if(tt(r)){const t=r.currentSrc||r.src;if(!Ti(t))return[Rt(e,{url:t,imageDom:r,requestType:"image",responseType:"dataUrl"}).then(i=>{i&&(r.srcset="",r.dataset.originalSrc=t,r.src=i||"")})];(Ir||Ms)&&e.drawImageCount++}else if(jt(r)&&!Ti(r.href.baseVal)){const t=r.href.baseVal;return[Rt(e,{url:t,imageDom:r,requestType:"image",responseType:"dataUrl"}).then(i=>{i&&(r.dataset.originalSrc=t,r.href.baseVal=i||"")})]}return[]}function nh(r,e){const{ownerDocument:t,svgDefsElement:i}=e,s=r.getAttribute("href")??r.getAttribute("xlink:href");if(!s)return[];const[n,o]=s.split("#");if(o){const a=`#${o}`,l=e.shadowRoots.reduce((c,u)=>c??u.querySelector(`svg ${a}`),t?.querySelector(`svg ${a}`));if(n&&r.setAttribute("href",a),i?.querySelector(a))return[];if(l)return i?.appendChild(l.cloneNode(!0)),[];if(n)return[Rt(e,{url:n,responseType:"text"}).then(c=>{i?.insertAdjacentHTML("beforeend",c)})]}return[]}function fa(r,e){const{tasks:t}=e;Ee(r)&&((tt(r)||ea(r))&&t.push(...sh(r,e)),du(r)&&t.push(...nh(r,e))),Et(r)&&t.push(...ih(r.style,e)),r.childNodes.forEach(i=>{fa(i,e)})}async function oh(r,e){const{ownerDocument:t,svgStyleElement:i,fontFamilies:s,fontCssTexts:n,tasks:o,font:a}=e;if(!(!t||!i||!s.size))if(a&&a.cssText){const l=vn(a.cssText,e);i.appendChild(t.createTextNode(`${l}
8
+ `))}else{const l=Array.from(t.styleSheets).filter(d=>{try{return"cssRules"in d&&!!d.cssRules.length}catch(g){return e.log.warn(`Error while reading CSS rules from ${d.href}`,g),!1}}),c=t.implementation.createHTMLDocument(""),u=c.createElement("style");c.head.appendChild(u);const h=u.sheet;await Promise.all(l.flatMap(d=>Array.from(d.cssRules).map(async g=>{if(hu(g)){const w=g.href;let p="";try{p=await Rt(e,{url:w,requestType:"text",responseType:"text"})}catch(b){e.log.warn(`Error fetch remote css import from ${w}`,b)}const y=p.replace(ha,(b,v,x)=>b.replace(x,ta(x,w)));for(const b of lh(y))try{h.insertRule(b,h.cssRules.length)}catch(v){e.log.warn("Error inserting rule from remote css import",{rule:b,error:v})}}}))),h.cssRules.length&&l.push(h);const f=[];l.forEach(d=>{Oi(d.cssRules,f)}),f.filter(d=>uu(d)&&ua(d.style.getPropertyValue("src"))&&ia(d.style.getPropertyValue("font-family"))?.some(g=>s.has(g))).forEach(d=>{const g=d,w=n.get(g.cssText);w?i.appendChild(t.createTextNode(`${w}
9
+ `)):o.push(ca(g.cssText,g.parentStyleSheet?g.parentStyleSheet.href:null,e).then(p=>{p=vn(p,e),n.set(g.cssText,p),i.appendChild(t.createTextNode(`${p}
10
+ `))}))})}}const ah=/(\/\*[\s\S]*?\*\/)/g,bn=/((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;function lh(r){if(r==null)return[];const e=[];let t=r.replace(ah,"");for(;;){const n=bn.exec(t);if(!n)break;e.push(n[0])}t=t.replace(bn,"");const i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,s=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;;){let n=i.exec(t);if(n)s.lastIndex=i.lastIndex;else if(n=s.exec(t),n)i.lastIndex=s.lastIndex;else break;e.push(n[0])}return e}const ch=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,uh=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function vn(r,e){const{font:t}=e,i=t?t?.preferredFormat:void 0;return i?r.replace(uh,s=>{for(;;){const[n,,o]=ch.exec(s)||[];if(!o)return"";if(o===i)return`src: ${n};`}}):r}function Oi(r,e=[]){for(const t of Array.from(r))fu(t)?e.push(...Oi(t.cssRules)):"cssRules"in t?Oi(t.cssRules,e):e.push(t);return e}const hh=/\bx?link:?href\s*=\s*["'](?!data:)[^"']+["']/i;function fh(r){return hh.test(r.innerHTML)}async function dh(r,e){const t=await sa(r,e);if(Ee(t.node)&&jt(t.node)&&!fh(t.node))return t.node;const{ownerDocument:i,log:s,tasks:n,svgStyleElement:o,svgDefsElement:a,svgStyles:l,font:c,progress:u,autoDestruct:h,onCloneNode:f,onEmbedNode:d,onCreateForeignObjectSvg:g}=t;s.time("clone node");const w=await Ns(t.node,t,!0);if(o&&i){let x="";l.forEach((k,N)=>{x+=`${k.join(`,
11
11
  `)} {
12
12
  ${N}
13
13
  }
14
- `}),o.appendChild(i.createTextNode(x))}s.timeEnd("clone node"),await f?.(w),c!==!1&&Ee(w)&&(s.time("embed web font"),await oh(w,t),s.timeEnd("embed web font")),s.time("embed node"),fa(w,t);const p=n.length;let y=0;const b=async()=>{for(;;){const x=n.pop();if(!x)break;try{await x}catch(M){t.log.warn("Failed to run task",M)}u?.(++y,p)}};u?.(y,p),await Promise.all([...Array.from({length:4})].map(b)),s.timeEnd("embed node"),await d?.(w);const v=ph(w,t);return a&&v.insertBefore(a,v.children[0]),o&&v.insertBefore(o,v.children[0]),h&&qu(t),await m?.(v),v}function ph(r,e){const{width:t,height:i}=e,s=Ru(t,i,r.ownerDocument),n=s.ownerDocument.createElementNS(s.namespaceURI,"foreignObject");return n.setAttributeNS(null,"x","0%"),n.setAttributeNS(null,"y","0%"),n.setAttributeNS(null,"width","100%"),n.setAttributeNS(null,"height","100%"),n.append(r),s.appendChild(n),s}async function mh(r,e){const t=await sa(r,e),i=await dh(t),s=Mu(i,t.isEnable("removeControlCharacter"));t.autoDestruct||(t.svgStyleElement=na(t.ownerDocument),t.svgDefsElement=t.ownerDocument?.createElementNS(Kr,"defs"),t.svgStyles.clear());const n=qe(s,i.ownerDocument);return await Pu(n,t)}async function gh(){const r=await yh();return bh(r)}async function yh(){try{return await mh(document.body,{backgroundColor:"#ffffff",filter:r=>{const e=r;return typeof e.closest!="function"?!0:!e.closest("[data-bugjar-block]")},scale:Math.min(window.devicePixelRatio,1.5)})}catch{return wh()}}function wh(){const r=Math.max(document.documentElement.clientWidth,window.innerWidth),e=Math.max(document.documentElement.scrollHeight,window.innerHeight),t=Math.min(window.devicePixelRatio,1.5),i=document.createElement("canvas");i.width=Math.round(r*t),i.height=Math.round(e*t);const s=i.getContext("2d");return s.fillStyle="#ffffff",s.fillRect(0,0,i.width,i.height),s.fillStyle="#9ca3af",s.font=`${Math.round(11*t)}px system-ui, -apple-system, sans-serif`,s.fillText("Page render unavailable",12*t,22*t),i}async function bh(r){return new Promise((e,t)=>{r.toBlob(i=>{i?e(i):t(new Error("toBlob returned null"))},"image/png")})}const vh={maxDurationSec:90,captureNetwork:!0,captureConsole:!0,captureMicrophone:!0,networkBufferSize:100,consoleBufferSize:500},Sh={primaryColor:"#ea580c",position:"bottom-right",showTrigger:!0,showOnError:!1,triggerLabel:"Report a bug"},Ch="https://console.bugjar.app/api/v1",Pi=[{id:"cursor",label:"Use page",icon:"↖"},{id:"pen",label:"Pen",icon:"✎"},{id:"arrow",label:"Arrow",icon:"➜"},{id:"rectangle",label:"Box",icon:"▭"},{id:"pin",label:"Comment",icon:"💬"}],da=["#ef4444","#f59e0b","#3b82f6"];function xh(r){const[e,t]=le.useState("cursor"),[i,s]=le.useState("#ef4444"),[n,o]=le.useState(!1),a=Ah(),[l,c]=le.useState(!1),u=d=>{t(d),r.onSelectTool(d)},h=d=>{s(d),r.onSelectColor(d)},f=()=>{const d=!n;o(d),r.onToggleMicMute(d)};return a?g.jsx(Eh,{...r,tool:e,color:i,muted:n,collapsed:l,onSelectTool:u,onSelectColor:h,onToggleMute:f,onSetCollapsed:c}):g.jsxs("div",{style:{position:"fixed",left:"50%",bottom:20,transform:"translateX(-50%)",background:"#111827",color:"white",borderRadius:12,padding:8,display:"flex",alignItems:"center",gap:6,boxShadow:"0 10px 30px rgba(0,0,0,0.35)",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:12,zIndex:2147483001,userSelect:"none",maxWidth:"calc(100vw - 40px)",flexWrap:"wrap"},children:[Pi.map(d=>g.jsx(Rh,{label:d.label,icon:d.icon,active:e===d.id,primaryColor:r.primaryColor,onClick:()=>u(d.id)},d.id)),g.jsx(Ht,{}),da.map(d=>g.jsx("button",{onClick:()=>h(d),title:`Color ${d}`,style:{width:22,height:22,borderRadius:"50%",background:d,border:i===d?"2px solid white":"2px solid transparent",padding:0,cursor:"pointer",boxShadow:i===d?`0 0 0 2px ${d}`:"none"}},d)),g.jsx(Ht,{}),g.jsx("button",{onClick:r.onUndo,title:"Undo last markup",style:Zt,children:"↶ Undo"}),g.jsx(Ht,{}),r.isRecording?g.jsxs(g.Fragment,{children:[g.jsx("span",{style:{width:8,height:8,background:"#ef4444",borderRadius:"50%",animation:"bugjar-pulse 1.2s infinite",flexShrink:0}}),g.jsx("style",{children:"@keyframes bugjar-pulse { 0%,100%{opacity:1} 50%{opacity:0.35} }"}),g.jsxs("span",{style:{fontVariantNumeric:"tabular-nums",minWidth:58,textAlign:"center"},children:[Li(r.elapsedMs)," / ",r.maxDurationSec,"s"]}),g.jsx("button",{onClick:f,style:Zt,title:"Toggle microphone",children:n?"🔇":"🎙️"}),g.jsx("button",{onClick:r.onStopRecording,style:{...Sn,background:"#ef4444"},children:"■ Stop"})]}):g.jsx("button",{onClick:r.onStartRecording,style:{...Zt,...r.hasRecording?{borderColor:"#f59e0b",color:"#fbbf24"}:{}},title:r.hasRecording?"Re-record: discards your current recording and starts a new one (up to 90s)":"Start recording (up to 90s) — captures DOM + mic + console + network",children:r.hasRecording?"↻ Re-record":"● Record"}),g.jsx(Ht,{}),g.jsx("button",{onClick:r.onDone,style:{...Sn,background:r.primaryColor},title:"Finish and review the report",children:"Done →"}),g.jsx("button",{onClick:r.onCancel,style:Zt,title:"Cancel and discard",children:"✕"})]})}function Eh(r){const e=Pi.find(t=>t.id===r.tool);return g.jsxs(g.Fragment,{children:[g.jsx("style",{children:`
14
+ `}),o.appendChild(i.createTextNode(x))}s.timeEnd("clone node"),await f?.(w),c!==!1&&Ee(w)&&(s.time("embed web font"),await oh(w,t),s.timeEnd("embed web font")),s.time("embed node"),fa(w,t);const p=n.length;let y=0;const b=async()=>{for(;;){const x=n.pop();if(!x)break;try{await x}catch(k){t.log.warn("Failed to run task",k)}u?.(++y,p)}};u?.(y,p),await Promise.all([...Array.from({length:4})].map(b)),s.timeEnd("embed node"),await d?.(w);const v=ph(w,t);return a&&v.insertBefore(a,v.children[0]),o&&v.insertBefore(o,v.children[0]),h&&qu(t),await g?.(v),v}function ph(r,e){const{width:t,height:i}=e,s=Ru(t,i,r.ownerDocument),n=s.ownerDocument.createElementNS(s.namespaceURI,"foreignObject");return n.setAttributeNS(null,"x","0%"),n.setAttributeNS(null,"y","0%"),n.setAttributeNS(null,"width","100%"),n.setAttributeNS(null,"height","100%"),n.append(r),s.appendChild(n),s}async function mh(r,e){const t=await sa(r,e),i=await dh(t),s=ku(i,t.isEnable("removeControlCharacter"));t.autoDestruct||(t.svgStyleElement=na(t.ownerDocument),t.svgDefsElement=t.ownerDocument?.createElementNS(Kr,"defs"),t.svgStyles.clear());const n=qe(s,i.ownerDocument);return await Pu(n,t)}async function gh(){const r=await yh();return bh(r)}async function yh(){try{return await mh(document.body,{backgroundColor:"#ffffff",filter:r=>{const e=r;return typeof e.closest!="function"?!0:!e.closest("[data-bugjar-block]")},scale:Math.min(window.devicePixelRatio,1.5)})}catch{return wh()}}function wh(){const r=Math.max(document.documentElement.clientWidth,window.innerWidth),e=Math.max(document.documentElement.scrollHeight,window.innerHeight),t=Math.min(window.devicePixelRatio,1.5),i=document.createElement("canvas");i.width=Math.round(r*t),i.height=Math.round(e*t);const s=i.getContext("2d");return s.fillStyle="#ffffff",s.fillRect(0,0,i.width,i.height),s.fillStyle="#9ca3af",s.font=`${Math.round(11*t)}px system-ui, -apple-system, sans-serif`,s.fillText("Page render unavailable",12*t,22*t),i}async function bh(r){return new Promise((e,t)=>{r.toBlob(i=>{i?e(i):t(new Error("toBlob returned null"))},"image/png")})}const vh={maxDurationSec:90,captureNetwork:!0,captureConsole:!0,captureMicrophone:!0,networkBufferSize:100,consoleBufferSize:500},Sh={primaryColor:"#ea580c",position:"bottom-right",showTrigger:!0,showOnError:!1,triggerLabel:"Report a bug"},Ch="https://console.bugjar.app/api/v1",Pi=[{id:"cursor",label:"Use page",icon:"↖"},{id:"pen",label:"Pen",icon:"✎"},{id:"arrow",label:"Arrow",icon:"➜"},{id:"rectangle",label:"Box",icon:"▭"},{id:"pin",label:"Comment",icon:"💬"}],da=["#ef4444","#f59e0b","#3b82f6"];function xh(r){const[e,t]=oe.useState("cursor"),[i,s]=oe.useState("#ef4444"),[n,o]=oe.useState(!1),a=Ah(),[l,c]=oe.useState(!1),u=d=>{t(d),r.onSelectTool(d)},h=d=>{s(d),r.onSelectColor(d)},f=()=>{const d=!n;o(d),r.onToggleMicMute(d)};return a?m.jsx(Eh,{...r,tool:e,color:i,muted:n,collapsed:l,onSelectTool:u,onSelectColor:h,onToggleMute:f,onSetCollapsed:c}):m.jsxs("div",{style:{position:"fixed",left:"50%",bottom:20,transform:"translateX(-50%)",background:"#111827",color:"white",borderRadius:12,padding:8,display:"flex",alignItems:"center",gap:6,boxShadow:"0 10px 30px rgba(0,0,0,0.35)",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:12,zIndex:2147483001,userSelect:"none",maxWidth:"calc(100vw - 40px)",flexWrap:"wrap"},children:[Pi.map(d=>m.jsx(Rh,{label:d.label,icon:d.icon,active:e===d.id,primaryColor:r.primaryColor,onClick:()=>u(d.id)},d.id)),m.jsx(Ht,{}),da.map(d=>m.jsx("button",{onClick:()=>h(d),title:`Color ${d}`,style:{width:22,height:22,borderRadius:"50%",background:d,border:i===d?"2px solid white":"2px solid transparent",padding:0,cursor:"pointer",boxShadow:i===d?`0 0 0 2px ${d}`:"none"}},d)),m.jsx(Ht,{}),m.jsx("button",{onClick:r.onUndo,title:"Undo last markup",style:Zt,children:"↶ Undo"}),m.jsx(Ht,{}),r.isRecording?m.jsxs(m.Fragment,{children:[m.jsx("span",{style:{width:8,height:8,background:"#ef4444",borderRadius:"50%",animation:"bugjar-pulse 1.2s infinite",flexShrink:0}}),m.jsx("style",{children:"@keyframes bugjar-pulse { 0%,100%{opacity:1} 50%{opacity:0.35} }"}),m.jsxs("span",{style:{fontVariantNumeric:"tabular-nums",minWidth:58,textAlign:"center"},children:[Li(r.elapsedMs)," / ",r.maxDurationSec,"s"]}),m.jsx("button",{onClick:f,style:Zt,title:"Toggle microphone",children:n?"🔇":"🎙️"}),m.jsx("button",{onClick:r.onStopRecording,style:{...Sn,background:"#ef4444"},children:"■ Stop"})]}):m.jsx("button",{onClick:r.onStartRecording,style:{...Zt,...r.hasRecording?{borderColor:"#f59e0b",color:"#fbbf24"}:{}},title:r.hasRecording?"Re-record: discards your current recording and starts a new one (up to 90s)":"Start recording (up to 90s) — captures DOM + mic + console + network",children:r.hasRecording?"↻ Re-record":"● Record"}),m.jsx(Ht,{}),m.jsx("button",{onClick:r.onDone,style:{...Sn,background:r.primaryColor},title:"Finish and review the report",children:"Done →"}),m.jsx("button",{onClick:r.onCancel,style:Zt,title:"Cancel and discard",children:"✕"})]})}function Eh(r){const e=Pi.find(t=>t.id===r.tool);return m.jsxs(m.Fragment,{children:[m.jsx("style",{children:`
15
15
  @keyframes bugjar-pulse { 0%,100%{opacity:1} 50%{opacity:0.35} }
16
- `}),g.jsx("div",{style:{position:"fixed",left:0,right:0,bottom:0,background:"#111827",color:"white",borderTopLeftRadius:16,borderTopRightRadius:16,boxShadow:"0 -8px 32px rgba(0,0,0,0.35)",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:13,zIndex:2147483001,userSelect:"none",paddingBottom:"env(safe-area-inset-bottom, 0px)"},children:r.collapsed?g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px"},children:[g.jsxs("button",{onClick:()=>r.onSetCollapsed(!1),"aria-label":"Expand markup toolbar",style:{flex:1,display:"flex",alignItems:"center",gap:10,background:"transparent",border:"none",color:"white",padding:"8px 6px",cursor:"pointer",textAlign:"left",fontSize:13},children:[r.isRecording?g.jsxs(g.Fragment,{children:[g.jsx("span",{style:{width:8,height:8,background:"#ef4444",borderRadius:"50%",animation:"bugjar-pulse 1.2s infinite",flexShrink:0}}),g.jsxs("span",{style:{fontVariantNumeric:"tabular-nums",fontWeight:600},children:[Li(r.elapsedMs)," / ",r.maxDurationSec,"s"]})]}):g.jsxs("span",{style:{opacity:.85},children:[g.jsx("span",{style:{marginRight:6},children:e?.icon}),e?.label??"Markup"]}),g.jsx("span",{style:{marginLeft:"auto",fontSize:16,opacity:.6},children:"⌃"})]}),g.jsx("button",{onClick:r.onDone,style:{...fi,background:r.primaryColor},children:"Done →"}),g.jsx("button",{onClick:r.onCancel,style:Mh,"aria-label":"Cancel",children:"✕"})]}):g.jsxs("div",{children:[g.jsx("button",{onClick:()=>r.onSetCollapsed(!0),"aria-label":"Collapse markup toolbar",style:{background:"transparent",border:"none",width:"100%",padding:"8px 0 4px",display:"flex",justifyContent:"center",cursor:"pointer"},children:g.jsx("span",{style:{width:36,height:4,background:"#4b5563",borderRadius:2}})}),g.jsxs("div",{style:{padding:"4px 12px 12px",display:"flex",flexDirection:"column",gap:10},children:[g.jsx("div",{style:{display:"flex",gap:4,overflowX:"auto",WebkitOverflowScrolling:"touch"},children:Pi.map(t=>g.jsxs("button",{onClick:()=>r.onSelectTool(t.id),style:{background:r.tool===t.id?r.primaryColor:"transparent",color:"white",border:"none",borderRadius:8,minWidth:60,padding:"8px 4px",cursor:"pointer",display:"flex",flexDirection:"column",alignItems:"center",gap:2,flexShrink:0,fontWeight:600},"aria-label":t.label,children:[g.jsx("span",{style:{fontSize:18,lineHeight:1},children:t.icon}),g.jsx("span",{style:{fontSize:10,opacity:.85,fontWeight:500},children:t.label})]},t.id))}),g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[da.map(t=>g.jsx("button",{onClick:()=>r.onSelectColor(t),"aria-label":`Color ${t}`,style:{width:28,height:28,borderRadius:"50%",background:t,border:r.color===t?"2px solid white":"2px solid transparent",padding:0,cursor:"pointer",boxShadow:r.color===t?`0 0 0 2px ${t}`:"none"}},t)),g.jsx("button",{onClick:r.onUndo,style:{...Xt,marginLeft:"auto"},children:"↶ Undo"})]}),g.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:r.isRecording?g.jsxs(g.Fragment,{children:[g.jsx("span",{style:{width:8,height:8,background:"#ef4444",borderRadius:"50%",animation:"bugjar-pulse 1.2s infinite",flexShrink:0}}),g.jsxs("span",{style:{fontVariantNumeric:"tabular-nums",fontWeight:600},children:[Li(r.elapsedMs)," / ",r.maxDurationSec,"s"]}),g.jsx("button",{onClick:r.onToggleMute,style:{...Xt,marginLeft:"auto"},"aria-label":"Toggle microphone",children:r.muted?"🔇":"🎙️"}),g.jsx("button",{onClick:r.onStopRecording,style:{...fi,background:"#ef4444"},children:"■ Stop"})]}):g.jsx("button",{onClick:r.onStartRecording,style:{...Xt,...r.hasRecording?{borderColor:"#f59e0b",color:"#fbbf24"}:{}},children:r.hasRecording?"↻ Re-record":"● Record (up to 90s)"})}),g.jsxs("div",{style:{display:"flex",gap:8,marginTop:2},children:[g.jsx("button",{onClick:r.onDone,style:{...fi,background:r.primaryColor,flex:1,padding:"12px 16px",fontSize:14},children:"Done →"}),g.jsx("button",{onClick:r.onCancel,style:{...Xt,padding:"12px 18px",fontSize:14},children:"Cancel"})]})]})]})})]})}function Ah(){const[r,e]=le.useState(!1);return le.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const t=window.matchMedia("(max-width: 640px)"),i=()=>e(t.matches);return i(),typeof t.addEventListener=="function"?(t.addEventListener("change",i),()=>t.removeEventListener("change",i)):(t.addListener(i),()=>t.removeListener(i))},[]),r}function Ht(){return g.jsx("span",{style:{width:1,height:24,background:"#374151",margin:"0 2px"}})}function Rh({label:r,icon:e,active:t,primaryColor:i,onClick:s}){return g.jsxs("button",{onClick:s,title:r,style:{background:t?i:"transparent",color:"white",border:"none",padding:"6px 8px",borderRadius:6,cursor:"pointer",fontSize:14,minWidth:32,fontWeight:600,display:"flex",flexDirection:"column",alignItems:"center",gap:2},children:[g.jsx("span",{style:{fontSize:14,lineHeight:1},children:e}),g.jsx("span",{style:{fontSize:10,opacity:.85},children:r})]})}const Zt={background:"transparent",border:"1px solid #374151",color:"white",padding:"5px 10px",borderRadius:6,cursor:"pointer",fontSize:12,fontWeight:500},Sn={border:"none",color:"white",padding:"6px 12px",borderRadius:6,cursor:"pointer",fontWeight:600,fontSize:12},Xt={background:"transparent",border:"1px solid #374151",color:"white",padding:"8px 14px",borderRadius:8,cursor:"pointer",fontSize:13,fontWeight:500},fi={border:"none",color:"white",padding:"10px 16px",borderRadius:8,cursor:"pointer",fontWeight:600,fontSize:13},Mh={background:"transparent",border:"1px solid #374151",color:"white",width:40,height:40,borderRadius:8,cursor:"pointer",fontSize:16,fontWeight:600,display:"flex",alignItems:"center",justifyContent:"center"};function Li(r){const e=Math.floor(r/1e3),t=Math.floor(e/60),i=e%60;return`${t}:${String(i).padStart(2,"0")}`}var kh=Object.defineProperty,Nh=(r,e,t)=>e in r?kh(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Cn=(r,e,t)=>Nh(r,typeof e!="symbol"?e+"":e,t);function Mt(){}function xn(r,e){for(const t in e)r[t]=e[t];return r}function pa(r){return r()}function En(){return Object.create(null)}function ut(r){r.forEach(pa)}function ma(r){return typeof r=="function"}function _s(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function _h(r){return Object.keys(r).length===0}function An(r){const e={};for(const t in r)t[0]!=="$"&&(e[t]=r[t]);return e}function P(r,e){r.appendChild(e)}function _e(r,e,t){r.insertBefore(e,t||null)}function Ae(r){r.parentNode&&r.parentNode.removeChild(r)}function di(r,e){for(let t=0;t<r.length;t+=1)r[t]&&r[t].d(e)}function se(r){return document.createElement(r)}function Dr(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function Be(r){return document.createTextNode(r)}function he(){return Be(" ")}function Ih(){return Be("")}function Je(r,e,t,i){return r.addEventListener(e,t,i),()=>r.removeEventListener(e,t,i)}function I(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function Dh(r){return Array.from(r.childNodes)}function Tr(r,e){e=""+e,r.data!==e&&(r.data=e)}function te(r,e,t,i){t==null?r.style.removeProperty(e):r.style.setProperty(e,t,"")}function rt(r,e,t){r.classList.toggle(e,!!t)}function Th(r,e,{bubbles:t=!1,cancelable:i=!1}={}){return new CustomEvent(r,{detail:e,bubbles:t,cancelable:i})}let kt;function vt(r){kt=r}function qr(){if(!kt)throw new Error("Function called outside component initialization");return kt}function ga(r){qr().$$.on_mount.push(r)}function Oh(r){qr().$$.after_update.push(r)}function ya(r){qr().$$.on_destroy.push(r)}function Ph(){const r=qr();return(e,t,{cancelable:i=!1}={})=>{const s=r.$$.callbacks[e];if(s){const n=Th(e,t,{cancelable:i});return s.slice().forEach(o=>{o.call(r,n)}),!n.defaultPrevented}return!0}}const Ye=[],Fe=[];let Qe=[];const $i=[],Lh=Promise.resolve();let Fi=!1;function $h(){Fi||(Fi=!0,Lh.then(wa))}function ji(r){Qe.push(r)}function Fh(r){$i.push(r)}const pi=new Set;let Ve=0;function wa(){if(Ve!==0)return;const r=kt;do{try{for(;Ve<Ye.length;){const e=Ye[Ve];Ve++,vt(e),jh(e.$$)}}catch(e){throw Ye.length=0,Ve=0,e}for(vt(null),Ye.length=0,Ve=0;Fe.length;)Fe.pop()();for(let e=0;e<Qe.length;e+=1){const t=Qe[e];pi.has(t)||(pi.add(t),t())}Qe.length=0}while(Ye.length);for(;$i.length;)$i.pop()();Fi=!1,pi.clear(),vt(r)}function jh(r){if(r.fragment!==null){r.update(),ut(r.before_update);const e=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,e),r.after_update.forEach(ji)}}function Bh(r){const e=[],t=[];Qe.forEach(i=>r.indexOf(i)===-1?e.push(i):t.push(i)),t.forEach(i=>i()),Qe=e}const Ar=new Set;let $e;function ba(){$e={r:0,c:[],p:$e}}function va(){$e.r||ut($e.c),$e=$e.p}function Me(r,e){r&&r.i&&(Ar.delete(r),r.i(e))}function it(r,e,t,i){if(r&&r.o){if(Ar.has(r))return;Ar.add(r),$e.c.push(()=>{Ar.delete(r),i&&(t&&r.d(1),i())}),r.o(e)}else i&&i()}function Ge(r){return r?.length!==void 0?r:Array.from(r)}function Uh(r,e,t){const i=r.$$.props[e];i!==void 0&&(r.$$.bound[i]=t,t(r.$$.ctx[i]))}function Sa(r){r&&r.c()}function Is(r,e,t){const{fragment:i,after_update:s}=r.$$;i&&i.m(e,t),ji(()=>{const n=r.$$.on_mount.map(pa).filter(ma);r.$$.on_destroy?r.$$.on_destroy.push(...n):ut(n),r.$$.on_mount=[]}),s.forEach(ji)}function Ds(r,e){const t=r.$$;t.fragment!==null&&(Bh(t.after_update),ut(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function zh(r,e){r.$$.dirty[0]===-1&&(Ye.push(r),$h(),r.$$.dirty.fill(0)),r.$$.dirty[e/31|0]|=1<<e%31}function Ts(r,e,t,i,s,n,o=null,a=[-1]){const l=kt;vt(r);const c=r.$$={fragment:null,ctx:[],props:n,update:Mt,not_equal:s,bound:En(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(l?l.$$.context:[])),callbacks:En(),dirty:a,skip_bound:!1,root:e.target||l.$$.root};o&&o(c.root);let u=!1;if(c.ctx=t?t(r,e.props||{},(h,f,...d)=>{const m=d.length?d[0]:f;return c.ctx&&s(c.ctx[h],c.ctx[h]=m)&&(!c.skip_bound&&c.bound[h]&&c.bound[h](m),u&&zh(r,h)),f}):[],c.update(),u=!0,ut(c.before_update),c.fragment=i?i(c.ctx):!1,e.target){if(e.hydrate){const h=Dh(e.target);c.fragment&&c.fragment.l(h),h.forEach(Ae)}else c.fragment&&c.fragment.c();e.intro&&Me(r.$$.fragment),Is(r,e.target,e.anchor),wa()}vt(l)}class Os{constructor(){Cn(this,"$$"),Cn(this,"$$set")}$destroy(){Ds(this,1),this.$destroy=Mt}$on(e,t){if(!ma(t))return Mt;const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(t),()=>{const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}$set(e){this.$$set&&!_h(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Wh="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Wh);var Vh=Object.defineProperty,Gh=(r,e,t)=>e in r?Vh(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_=(r,e,t)=>Gh(r,typeof e!="symbol"?e+"":e,t),Rn,Yh=Object.defineProperty,Hh=(r,e,t)=>e in r?Yh(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Mn=(r,e,t)=>Hh(r,typeof e!="symbol"?e+"":e,t),Q=(r=>(r[r.Document=0]="Document",r[r.DocumentType=1]="DocumentType",r[r.Element=2]="Element",r[r.Text=3]="Text",r[r.CDATA=4]="CDATA",r[r.Comment=5]="Comment",r))(Q||{});function Zh(r){return r.nodeType===r.ELEMENT_NODE}class Ca{constructor(){Mn(this,"idNodeMap",new Map),Mn(this,"nodeMetaMap",new WeakMap)}getId(e){var t;return e?((t=this.getMeta(e))==null?void 0:t.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(i=>this.removeNodeFromMap(i))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const i=t.id;this.idNodeMap.set(i,e),this.nodeMetaMap.set(e,t)}replace(e,t){const i=this.getNode(e);if(i){const s=this.nodeMetaMap.get(i);s&&this.nodeMetaMap.set(t,s)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function xa(){return new Ca}function Xh(r){return r.toLowerCase()}function Jh(r,e){return!r||!e||r.type!==e.type?!1:r.type===Q.Document?r.compatMode===e.compatMode:r.type===Q.DocumentType?r.name===e.name&&r.publicId===e.publicId&&r.systemId===e.systemId:r.type===Q.Comment||r.type===Q.Text||r.type===Q.CDATA?r.textContent===e.textContent:r.type===Q.Element?r.tagName===e.tagName&&JSON.stringify(r.attributes)===JSON.stringify(e.attributes)&&r.isSVG===e.isSVG&&r.needBlock===e.needBlock:!1}function Kh(r,e){let t;try{t=new URL(r,e??window.location.href)}catch{return null}const i=/\.([0-9a-z]+)(?:$)/i,s=t.pathname.match(i);return s?.[1]??null}const qh=/(max|min)-device-(width|height)/,kn=new RegExp(qh.source,"g"),Qh={postcssPlugin:"postcss-custom-selectors",prepare(){return{postcssPlugin:"postcss-custom-selectors",AtRule:function(r){r.params.match(kn)&&(r.params=r.params.replace(kn,"$1-$2"))}}}},ef={postcssPlugin:"postcss-hover-classes",prepare:function(){const r=[];return{Rule:function(e){r.indexOf(e)===-1&&(r.push(e),e.selectors.forEach(function(t){t.includes(":hover")&&(e.selector+=`,
16
+ `}),m.jsx("div",{style:{position:"fixed",left:0,right:0,bottom:0,background:"#111827",color:"white",borderTopLeftRadius:16,borderTopRightRadius:16,boxShadow:"0 -8px 32px rgba(0,0,0,0.35)",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:13,zIndex:2147483001,userSelect:"none",paddingBottom:"env(safe-area-inset-bottom, 0px)"},children:r.collapsed?m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px"},children:[m.jsxs("button",{onClick:()=>r.onSetCollapsed(!1),"aria-label":"Expand markup toolbar",style:{flex:1,display:"flex",alignItems:"center",gap:10,background:"transparent",border:"none",color:"white",padding:"8px 6px",cursor:"pointer",textAlign:"left",fontSize:13},children:[r.isRecording?m.jsxs(m.Fragment,{children:[m.jsx("span",{style:{width:8,height:8,background:"#ef4444",borderRadius:"50%",animation:"bugjar-pulse 1.2s infinite",flexShrink:0}}),m.jsxs("span",{style:{fontVariantNumeric:"tabular-nums",fontWeight:600},children:[Li(r.elapsedMs)," / ",r.maxDurationSec,"s"]})]}):m.jsxs("span",{style:{opacity:.85},children:[m.jsx("span",{style:{marginRight:6},children:e?.icon}),e?.label??"Markup"]}),m.jsx("span",{style:{marginLeft:"auto",fontSize:16,opacity:.6},children:"⌃"})]}),m.jsx("button",{onClick:r.onDone,style:{...fi,background:r.primaryColor},children:"Done →"}),m.jsx("button",{onClick:r.onCancel,style:kh,"aria-label":"Cancel",children:"✕"})]}):m.jsxs("div",{children:[m.jsx("button",{onClick:()=>r.onSetCollapsed(!0),"aria-label":"Collapse markup toolbar",style:{background:"transparent",border:"none",width:"100%",padding:"8px 0 4px",display:"flex",justifyContent:"center",cursor:"pointer"},children:m.jsx("span",{style:{width:36,height:4,background:"#4b5563",borderRadius:2}})}),m.jsxs("div",{style:{padding:"4px 12px 12px",display:"flex",flexDirection:"column",gap:10},children:[m.jsx("div",{style:{display:"flex",gap:4,overflowX:"auto",WebkitOverflowScrolling:"touch"},children:Pi.map(t=>m.jsxs("button",{onClick:()=>r.onSelectTool(t.id),style:{background:r.tool===t.id?r.primaryColor:"transparent",color:"white",border:"none",borderRadius:8,minWidth:60,padding:"8px 4px",cursor:"pointer",display:"flex",flexDirection:"column",alignItems:"center",gap:2,flexShrink:0,fontWeight:600},"aria-label":t.label,children:[m.jsx("span",{style:{fontSize:18,lineHeight:1},children:t.icon}),m.jsx("span",{style:{fontSize:10,opacity:.85,fontWeight:500},children:t.label})]},t.id))}),m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[da.map(t=>m.jsx("button",{onClick:()=>r.onSelectColor(t),"aria-label":`Color ${t}`,style:{width:28,height:28,borderRadius:"50%",background:t,border:r.color===t?"2px solid white":"2px solid transparent",padding:0,cursor:"pointer",boxShadow:r.color===t?`0 0 0 2px ${t}`:"none"}},t)),m.jsx("button",{onClick:r.onUndo,style:{...Xt,marginLeft:"auto"},children:"↶ Undo"})]}),m.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:r.isRecording?m.jsxs(m.Fragment,{children:[m.jsx("span",{style:{width:8,height:8,background:"#ef4444",borderRadius:"50%",animation:"bugjar-pulse 1.2s infinite",flexShrink:0}}),m.jsxs("span",{style:{fontVariantNumeric:"tabular-nums",fontWeight:600},children:[Li(r.elapsedMs)," / ",r.maxDurationSec,"s"]}),m.jsx("button",{onClick:r.onToggleMute,style:{...Xt,marginLeft:"auto"},"aria-label":"Toggle microphone",children:r.muted?"🔇":"🎙️"}),m.jsx("button",{onClick:r.onStopRecording,style:{...fi,background:"#ef4444"},children:"■ Stop"})]}):m.jsx("button",{onClick:r.onStartRecording,style:{...Xt,...r.hasRecording?{borderColor:"#f59e0b",color:"#fbbf24"}:{}},children:r.hasRecording?"↻ Re-record":"● Record (up to 90s)"})}),m.jsxs("div",{style:{display:"flex",gap:8,marginTop:2},children:[m.jsx("button",{onClick:r.onDone,style:{...fi,background:r.primaryColor,flex:1,padding:"12px 16px",fontSize:14},children:"Done →"}),m.jsx("button",{onClick:r.onCancel,style:{...Xt,padding:"12px 18px",fontSize:14},children:"Cancel"})]})]})]})})]})}function Ah(){const[r,e]=oe.useState(!1);return oe.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const t=window.matchMedia("(max-width: 640px)"),i=()=>e(t.matches);return i(),typeof t.addEventListener=="function"?(t.addEventListener("change",i),()=>t.removeEventListener("change",i)):(t.addListener(i),()=>t.removeListener(i))},[]),r}function Ht(){return m.jsx("span",{style:{width:1,height:24,background:"#374151",margin:"0 2px"}})}function Rh({label:r,icon:e,active:t,primaryColor:i,onClick:s}){return m.jsxs("button",{onClick:s,title:r,style:{background:t?i:"transparent",color:"white",border:"none",padding:"6px 8px",borderRadius:6,cursor:"pointer",fontSize:14,minWidth:32,fontWeight:600,display:"flex",flexDirection:"column",alignItems:"center",gap:2},children:[m.jsx("span",{style:{fontSize:14,lineHeight:1},children:e}),m.jsx("span",{style:{fontSize:10,opacity:.85},children:r})]})}const Zt={background:"transparent",border:"1px solid #374151",color:"white",padding:"5px 10px",borderRadius:6,cursor:"pointer",fontSize:12,fontWeight:500},Sn={border:"none",color:"white",padding:"6px 12px",borderRadius:6,cursor:"pointer",fontWeight:600,fontSize:12},Xt={background:"transparent",border:"1px solid #374151",color:"white",padding:"8px 14px",borderRadius:8,cursor:"pointer",fontSize:13,fontWeight:500},fi={border:"none",color:"white",padding:"10px 16px",borderRadius:8,cursor:"pointer",fontWeight:600,fontSize:13},kh={background:"transparent",border:"1px solid #374151",color:"white",width:40,height:40,borderRadius:8,cursor:"pointer",fontSize:16,fontWeight:600,display:"flex",alignItems:"center",justifyContent:"center"};function Li(r){const e=Math.floor(r/1e3),t=Math.floor(e/60),i=e%60;return`${t}:${String(i).padStart(2,"0")}`}var Mh=Object.defineProperty,Nh=(r,e,t)=>e in r?Mh(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Cn=(r,e,t)=>Nh(r,typeof e!="symbol"?e+"":e,t);function kt(){}function xn(r,e){for(const t in e)r[t]=e[t];return r}function pa(r){return r()}function En(){return Object.create(null)}function ut(r){r.forEach(pa)}function ma(r){return typeof r=="function"}function _s(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function _h(r){return Object.keys(r).length===0}function An(r){const e={};for(const t in r)t[0]!=="$"&&(e[t]=r[t]);return e}function P(r,e){r.appendChild(e)}function _e(r,e,t){r.insertBefore(e,t||null)}function Ae(r){r.parentNode&&r.parentNode.removeChild(r)}function di(r,e){for(let t=0;t<r.length;t+=1)r[t]&&r[t].d(e)}function se(r){return document.createElement(r)}function Dr(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function Be(r){return document.createTextNode(r)}function he(){return Be(" ")}function Ih(){return Be("")}function Je(r,e,t,i){return r.addEventListener(e,t,i),()=>r.removeEventListener(e,t,i)}function I(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function Dh(r){return Array.from(r.childNodes)}function Tr(r,e){e=""+e,r.data!==e&&(r.data=e)}function te(r,e,t,i){t==null?r.style.removeProperty(e):r.style.setProperty(e,t,"")}function rt(r,e,t){r.classList.toggle(e,!!t)}function Th(r,e,{bubbles:t=!1,cancelable:i=!1}={}){return new CustomEvent(r,{detail:e,bubbles:t,cancelable:i})}let Mt;function vt(r){Mt=r}function qr(){if(!Mt)throw new Error("Function called outside component initialization");return Mt}function ga(r){qr().$$.on_mount.push(r)}function Oh(r){qr().$$.after_update.push(r)}function ya(r){qr().$$.on_destroy.push(r)}function Ph(){const r=qr();return(e,t,{cancelable:i=!1}={})=>{const s=r.$$.callbacks[e];if(s){const n=Th(e,t,{cancelable:i});return s.slice().forEach(o=>{o.call(r,n)}),!n.defaultPrevented}return!0}}const Ye=[],je=[];let Qe=[];const $i=[],Lh=Promise.resolve();let ji=!1;function $h(){ji||(ji=!0,Lh.then(wa))}function Fi(r){Qe.push(r)}function jh(r){$i.push(r)}const pi=new Set;let Ve=0;function wa(){if(Ve!==0)return;const r=Mt;do{try{for(;Ve<Ye.length;){const e=Ye[Ve];Ve++,vt(e),Fh(e.$$)}}catch(e){throw Ye.length=0,Ve=0,e}for(vt(null),Ye.length=0,Ve=0;je.length;)je.pop()();for(let e=0;e<Qe.length;e+=1){const t=Qe[e];pi.has(t)||(pi.add(t),t())}Qe.length=0}while(Ye.length);for(;$i.length;)$i.pop()();ji=!1,pi.clear(),vt(r)}function Fh(r){if(r.fragment!==null){r.update(),ut(r.before_update);const e=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,e),r.after_update.forEach(Fi)}}function Bh(r){const e=[],t=[];Qe.forEach(i=>r.indexOf(i)===-1?e.push(i):t.push(i)),t.forEach(i=>i()),Qe=e}const Ar=new Set;let $e;function ba(){$e={r:0,c:[],p:$e}}function va(){$e.r||ut($e.c),$e=$e.p}function ke(r,e){r&&r.i&&(Ar.delete(r),r.i(e))}function it(r,e,t,i){if(r&&r.o){if(Ar.has(r))return;Ar.add(r),$e.c.push(()=>{Ar.delete(r),i&&(t&&r.d(1),i())}),r.o(e)}else i&&i()}function Ge(r){return r?.length!==void 0?r:Array.from(r)}function Uh(r,e,t){const i=r.$$.props[e];i!==void 0&&(r.$$.bound[i]=t,t(r.$$.ctx[i]))}function Sa(r){r&&r.c()}function Is(r,e,t){const{fragment:i,after_update:s}=r.$$;i&&i.m(e,t),Fi(()=>{const n=r.$$.on_mount.map(pa).filter(ma);r.$$.on_destroy?r.$$.on_destroy.push(...n):ut(n),r.$$.on_mount=[]}),s.forEach(Fi)}function Ds(r,e){const t=r.$$;t.fragment!==null&&(Bh(t.after_update),ut(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function zh(r,e){r.$$.dirty[0]===-1&&(Ye.push(r),$h(),r.$$.dirty.fill(0)),r.$$.dirty[e/31|0]|=1<<e%31}function Ts(r,e,t,i,s,n,o=null,a=[-1]){const l=Mt;vt(r);const c=r.$$={fragment:null,ctx:[],props:n,update:kt,not_equal:s,bound:En(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(l?l.$$.context:[])),callbacks:En(),dirty:a,skip_bound:!1,root:e.target||l.$$.root};o&&o(c.root);let u=!1;if(c.ctx=t?t(r,e.props||{},(h,f,...d)=>{const g=d.length?d[0]:f;return c.ctx&&s(c.ctx[h],c.ctx[h]=g)&&(!c.skip_bound&&c.bound[h]&&c.bound[h](g),u&&zh(r,h)),f}):[],c.update(),u=!0,ut(c.before_update),c.fragment=i?i(c.ctx):!1,e.target){if(e.hydrate){const h=Dh(e.target);c.fragment&&c.fragment.l(h),h.forEach(Ae)}else c.fragment&&c.fragment.c();e.intro&&ke(r.$$.fragment),Is(r,e.target,e.anchor),wa()}vt(l)}class Os{constructor(){Cn(this,"$$"),Cn(this,"$$set")}$destroy(){Ds(this,1),this.$destroy=kt}$on(e,t){if(!ma(t))return kt;const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(t),()=>{const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}$set(e){this.$$set&&!_h(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Wh="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Wh);var Vh=Object.defineProperty,Gh=(r,e,t)=>e in r?Vh(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_=(r,e,t)=>Gh(r,typeof e!="symbol"?e+"":e,t),Rn,Yh=Object.defineProperty,Hh=(r,e,t)=>e in r?Yh(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,kn=(r,e,t)=>Hh(r,typeof e!="symbol"?e+"":e,t),Q=(r=>(r[r.Document=0]="Document",r[r.DocumentType=1]="DocumentType",r[r.Element=2]="Element",r[r.Text=3]="Text",r[r.CDATA=4]="CDATA",r[r.Comment=5]="Comment",r))(Q||{});function Zh(r){return r.nodeType===r.ELEMENT_NODE}class Ca{constructor(){kn(this,"idNodeMap",new Map),kn(this,"nodeMetaMap",new WeakMap)}getId(e){var t;return e?((t=this.getMeta(e))==null?void 0:t.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(i=>this.removeNodeFromMap(i))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const i=t.id;this.idNodeMap.set(i,e),this.nodeMetaMap.set(e,t)}replace(e,t){const i=this.getNode(e);if(i){const s=this.nodeMetaMap.get(i);s&&this.nodeMetaMap.set(t,s)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function xa(){return new Ca}function Xh(r){return r.toLowerCase()}function Jh(r,e){return!r||!e||r.type!==e.type?!1:r.type===Q.Document?r.compatMode===e.compatMode:r.type===Q.DocumentType?r.name===e.name&&r.publicId===e.publicId&&r.systemId===e.systemId:r.type===Q.Comment||r.type===Q.Text||r.type===Q.CDATA?r.textContent===e.textContent:r.type===Q.Element?r.tagName===e.tagName&&JSON.stringify(r.attributes)===JSON.stringify(e.attributes)&&r.isSVG===e.isSVG&&r.needBlock===e.needBlock:!1}function Kh(r,e){let t;try{t=new URL(r,e??window.location.href)}catch{return null}const i=/\.([0-9a-z]+)(?:$)/i,s=t.pathname.match(i);return s?.[1]??null}const qh=/(max|min)-device-(width|height)/,Mn=new RegExp(qh.source,"g"),Qh={postcssPlugin:"postcss-custom-selectors",prepare(){return{postcssPlugin:"postcss-custom-selectors",AtRule:function(r){r.params.match(Mn)&&(r.params=r.params.replace(Mn,"$1-$2"))}}}},ef={postcssPlugin:"postcss-hover-classes",prepare:function(){const r=[];return{Rule:function(e){r.indexOf(e)===-1&&(r.push(e),e.selectors.forEach(function(t){t.includes(":hover")&&(e.selector+=`,
17
17
  `+t.replace(/:hover/g,".\\:hover"))}))}}}};function tf(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function rf(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function i(){return this instanceof i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:function(){return r[i]}})}),t}var Ps={exports:{}},G=String,Ea=function(){return{isColorSupported:!1,reset:G,bold:G,dim:G,italic:G,underline:G,inverse:G,hidden:G,strikethrough:G,black:G,red:G,green:G,yellow:G,blue:G,magenta:G,cyan:G,white:G,gray:G,bgBlack:G,bgRed:G,bgGreen:G,bgYellow:G,bgBlue:G,bgMagenta:G,bgCyan:G,bgWhite:G}};Ps.exports=Ea();Ps.exports.createColors=Ea;var sf=Ps.exports;const nf={},of=Object.freeze(Object.defineProperty({__proto__:null,default:nf},Symbol.toStringTag,{value:"Module"})),ge=rf(of);let Nn=sf,_n=ge,Bi=class Aa extends Error{constructor(e,t,i,s,n,o){super(e),this.name="CssSyntaxError",this.reason=e,n&&(this.file=n),s&&(this.source=s),o&&(this.plugin=o),typeof t<"u"&&typeof i<"u"&&(typeof t=="number"?(this.line=t,this.column=i):(this.line=t.line,this.column=t.column,this.endLine=i.line,this.endColumn=i.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,Aa)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;e==null&&(e=Nn.isColorSupported),_n&&e&&(t=_n(t));let i=t.split(/\r?\n/),s=Math.max(this.line-3,0),n=Math.min(this.line+2,i.length),o=String(n).length,a,l;if(e){let{bold:c,gray:u,red:h}=Nn.createColors(!0);a=f=>c(h(f)),l=f=>u(f)}else a=l=c=>c;return i.slice(s,n).map((c,u)=>{let h=s+1+u,f=" "+(" "+h).slice(-o)+" | ";if(h===this.line){let d=l(f.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return a(">")+l(f)+c+`
18
18
  `+d+a("^")}return" "+l(f)+c}).join(`
19
19
  `)}toString(){let e=this.showSourceCode();return e&&(e=`
20
20
 
21
21
  `+e+`
22
- `),this.name+": "+this.message+e}};var Ls=Bi;Bi.default=Bi;var jt={};jt.isClean=Symbol("isClean");jt.my=Symbol("my");const In={after:`
22
+ `),this.name+": "+this.message+e}};var Ls=Bi;Bi.default=Bi;var Ft={};Ft.isClean=Symbol("isClean");Ft.my=Symbol("my");const In={after:`
23
23
  `,beforeClose:`
24
24
  `,beforeComment:`
25
25
  `,beforeDecl:`
@@ -30,19 +30,19 @@
30
30
  `)&&(i=i.replace(/[^\n]+$/,"")),!1}),typeof i>"u"?i=this.raw(t,null,"beforeDecl"):i&&(i=i.replace(/\S/g,"")),i}rawBeforeDecl(e,t){let i;return e.walkDecls(s=>{if(typeof s.raws.before<"u")return i=s.raws.before,i.includes(`
31
31
  `)&&(i=i.replace(/[^\n]+$/,"")),!1}),typeof i>"u"?i=this.raw(t,null,"beforeRule"):i&&(i=i.replace(/\S/g,"")),i}rawBeforeOpen(e){let t;return e.walk(i=>{if(i.type!=="decl"&&(t=i.raws.between,typeof t<"u"))return!1}),t}rawBeforeRule(e){let t;return e.walk(i=>{if(i.nodes&&(i.parent!==e||e.first!==i)&&typeof i.raws.before<"u")return t=i.raws.before,t.includes(`
32
32
  `)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(i=>{if(typeof i.raws.between<"u")return t=i.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(i=>{if(i.nodes&&i.nodes.length===0&&(t=i.raws.after,typeof t<"u"))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(i=>{let s=i.parent;if(s&&s!==e&&s.parent&&s.parent===e&&typeof i.raws.before<"u"){let n=i.raws.before.split(`
33
- `);return t=n[n.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(i=>{if(i.nodes&&i.nodes.length&&i.last.type==="decl"&&(t=i.raws.semicolon,typeof t<"u"))return!1}),t}rawValue(e,t){let i=e[t],s=e.raws[t];return s&&s.value===i?s.raw:i}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}};var Ra=Ui;Ui.default=Ui;let lf=Ra;function zi(r,e){new lf(e).stringify(r)}var Qr=zi;zi.default=zi;let{isClean:Jt,my:cf}=jt,uf=Ls,hf=Ra,ff=Qr;function Wi(r,e){let t=new r.constructor;for(let i in r){if(!Object.prototype.hasOwnProperty.call(r,i)||i==="proxyCache")continue;let s=r[i],n=typeof s;i==="parent"&&n==="object"?e&&(t[i]=e):i==="source"?t[i]=s:Array.isArray(s)?t[i]=s.map(o=>Wi(o,t)):(n==="object"&&s!==null&&(s=Wi(s)),t[i]=s)}return t}let Vi=class{constructor(e={}){this.raws={},this[Jt]=!1,this[cf]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let i of e[t])typeof i.clone=="function"?this.append(i.clone()):this.append(i)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=Wi(this);for(let i in e)t[i]=e[i];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:i,start:s}=this.rangeBy(t);return this.source.input.error(e,{column:s.column,line:s.line},{column:i.column,line:i.line},t)}return new uf(e)}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t]},set(e,t,i){return e[t]===i||(e[t]=i,(t==="prop"||t==="value"||t==="name"||t==="params"||t==="important"||t==="text")&&e.markDirty()),!0}}}markDirty(){if(this[Jt]){this[Jt]=!1;let e=this;for(;e=e.parent;)e[Jt]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let i=this.source.start;if(e.index)i=this.positionInside(e.index,t);else if(e.word){t=this.toString();let s=t.indexOf(e.word);s!==-1&&(i=this.positionInside(s,t))}return i}positionInside(e,t){let i=t||this.toString(),s=this.source.start.column,n=this.source.start.line;for(let o=0;o<e;o++)i[o]===`
34
- `?(s=1,n+=1):s+=1;return{column:s,line:n}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},i=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let s=this.toString(),n=s.indexOf(e.word);n!==-1&&(t=this.positionInside(n,s),i=this.positionInside(n+e.word.length,s))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?i={column:e.end.column,line:e.end.line}:typeof e.endIndex=="number"?i=this.positionInside(e.endIndex):e.index&&(i=this.positionInside(e.index+1));return(i.line<t.line||i.line===t.line&&i.column<=t.column)&&(i={column:t.column+1,line:t.line}),{end:i,start:t}}raw(e,t){return new hf().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,i=!1;for(let s of e)s===this?i=!0:i?(this.parent.insertAfter(t,s),t=s):this.parent.insertBefore(t,s);i||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let i={},s=t==null;t=t||new Map;let n=0;for(let o in this){if(!Object.prototype.hasOwnProperty.call(this,o)||o==="parent"||o==="proxyCache")continue;let a=this[o];if(Array.isArray(a))i[o]=a.map(l=>typeof l=="object"&&l.toJSON?l.toJSON(null,t):l);else if(typeof a=="object"&&a.toJSON)i[o]=a.toJSON(null,t);else if(o==="source"){let l=t.get(a.input);l==null&&(l=n,t.set(a.input,n),n++),i[o]={end:a.end,inputId:l,start:a.start}}else i[o]=a}return s&&(i.inputs=[...t.keys()].map(o=>o.toJSON())),i}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=ff){e.stringify&&(e=e.stringify);let t="";return e(this,i=>{t+=i}),t}warn(e,t,i){let s={node:this};for(let n in i)s[n]=i[n];return e.warn(t,s)}get proxyOf(){return this}};var ei=Vi;Vi.default=Vi;let df=ei,Gi=class extends df{constructor(e){e&&typeof e.value<"u"&&typeof e.value!="string"&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}};var ti=Gi;Gi.default=Gi;let pf="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",mf=(r=21)=>{let e="",t=r;for(;t--;)e+=pf[Math.random()*64|0];return e};var gf={nanoid:mf};let{SourceMapConsumer:Dn,SourceMapGenerator:Tn}=ge,{existsSync:yf,readFileSync:wf}=ge,{dirname:mi,join:bf}=ge;function vf(r){return Buffer?Buffer.from(r,"base64").toString():window.atob(r)}let Yi=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let i=t.map?t.map.prev:void 0,s=this.loadMap(t.from,i);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=mi(this.mapFile)),s&&(this.text=s)}consumer(){return this.consumerCache||(this.consumerCache=new Dn(this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\/json;charset=utf-?8;base64,/,i=/^data:application\/json;base64,/,s=/^data:application\/json;charset=utf-?8,/,n=/^data:application\/json,/;if(s.test(e)||n.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(t.test(e)||i.test(e))return vf(e.substr(RegExp.lastMatch.length));let o=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+o)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e!="object"?!1:typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let i=e.lastIndexOf(t.pop()),s=e.indexOf("*/",i);i>-1&&s>-1&&(this.annotation=this.getAnnotationURL(e.substring(i,s)))}loadFile(e){if(this.root=mi(e),yf(e))return this.mapFile=e,wf(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let i=t(e);if(i){let s=this.loadFile(i);if(!s)throw new Error("Unable to load previous source map: "+i.toString());return s}}else{if(t instanceof Dn)return Tn.fromSourceMap(t).toString();if(t instanceof Tn)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let i=this.annotation;return e&&(i=bf(mi(e),i)),this.loadFile(i)}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};var Ma=Yi;Yi.default=Yi;let{SourceMapConsumer:Sf,SourceMapGenerator:Cf}=ge,{fileURLToPath:On,pathToFileURL:Kt}=ge,{isAbsolute:Hi,resolve:Zi}=ge,{nanoid:xf}=gf,gi=ge,Pn=Ls,Ef=Ma,yi=Symbol("fromOffsetCache"),Af=!!(Sf&&Cf),Ln=!!(Zi&&Hi),Or=class{constructor(e,t={}){if(e===null||typeof e>"u"||typeof e=="object"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]==="\uFEFF"||this.css[0]==="￾"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!Ln||/^\w+:\/\//.test(t.from)||Hi(t.from)?this.file=t.from:this.file=Zi(t.from)),Ln&&Af){let i=new Ef(this.css,t);if(i.text){this.map=i;let s=i.consumer().file;!this.file&&s&&(this.file=this.mapResolve(s))}}this.file||(this.id="<input css "+xf(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,i,s={}){let n,o,a;if(t&&typeof t=="object"){let c=t,u=i;if(typeof c.offset=="number"){let h=this.fromOffset(c.offset);t=h.line,i=h.col}else t=c.line,i=c.column;if(typeof u.offset=="number"){let h=this.fromOffset(u.offset);o=h.line,a=h.col}else o=u.line,a=u.column}else if(!i){let c=this.fromOffset(t);t=c.line,i=c.col}let l=this.origin(t,i,o,a);return l?n=new Pn(e,l.endLine===void 0?l.line:{column:l.column,line:l.line},l.endLine===void 0?l.column:{column:l.endColumn,line:l.endLine},l.source,l.file,s.plugin):n=new Pn(e,o===void 0?t:{column:i,line:t},o===void 0?i:{column:a,line:o},this.css,this.file,s.plugin),n.input={column:i,endColumn:a,endLine:o,line:t,source:this.css},this.file&&(Kt&&(n.input.url=Kt(this.file).toString()),n.input.file=this.file),n}fromOffset(e){let t,i;if(this[yi])i=this[yi];else{let n=this.css.split(`
35
- `);i=new Array(n.length);let o=0;for(let a=0,l=n.length;a<l;a++)i[a]=o,o+=n[a].length+1;this[yi]=i}t=i[i.length-1];let s=0;if(e>=t)s=i.length-1;else{let n=i.length-2,o;for(;s<n;)if(o=s+(n-s>>1),e<i[o])n=o-1;else if(e>=i[o+1])s=o+1;else{s=o;break}}return{col:e-i[s]+1,line:s+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:Zi(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,i,s){if(!this.map)return!1;let n=this.map.consumer(),o=n.originalPositionFor({column:t,line:e});if(!o.source)return!1;let a;typeof i=="number"&&(a=n.originalPositionFor({column:s,line:i}));let l;Hi(o.source)?l=Kt(o.source):l=new URL(o.source,this.map.consumer().sourceRoot||Kt(this.map.mapFile));let c={column:o.column,endColumn:a&&a.column,endLine:a&&a.line,line:o.line,url:l.toString()};if(l.protocol==="file:")if(On)c.file=On(l);else throw new Error("file: protocol is not available in this PostCSS build");let u=n.sourceContentFor(o.source);return u&&(c.source=u),c}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}};var ri=Or;Or.default=Or;gi&&gi.registerInput&&gi.registerInput(Or);let{SourceMapConsumer:ka,SourceMapGenerator:Rr}=ge,{dirname:Mr,relative:Na,resolve:_a,sep:Ia}=ge,{pathToFileURL:$n}=ge,Rf=ri,Mf=!!(ka&&Rr),kf=!!(Mr&&_a&&Na&&Ia),Nf=class{constructor(e,t,i,s){this.stringify=e,this.mapOpts=i.map||{},this.root=t,this.opts=i,this.css=s,this.originalCSS=s,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;this.isInline()?e="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?e=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?e=this.mapOpts.annotation(this.opts.to,this.root):e=this.outputFile()+".map";let t=`
33
+ `);return t=n[n.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(i=>{if(i.nodes&&i.nodes.length&&i.last.type==="decl"&&(t=i.raws.semicolon,typeof t<"u"))return!1}),t}rawValue(e,t){let i=e[t],s=e.raws[t];return s&&s.value===i?s.raw:i}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}};var Ra=Ui;Ui.default=Ui;let lf=Ra;function zi(r,e){new lf(e).stringify(r)}var Qr=zi;zi.default=zi;let{isClean:Jt,my:cf}=Ft,uf=Ls,hf=Ra,ff=Qr;function Wi(r,e){let t=new r.constructor;for(let i in r){if(!Object.prototype.hasOwnProperty.call(r,i)||i==="proxyCache")continue;let s=r[i],n=typeof s;i==="parent"&&n==="object"?e&&(t[i]=e):i==="source"?t[i]=s:Array.isArray(s)?t[i]=s.map(o=>Wi(o,t)):(n==="object"&&s!==null&&(s=Wi(s)),t[i]=s)}return t}let Vi=class{constructor(e={}){this.raws={},this[Jt]=!1,this[cf]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let i of e[t])typeof i.clone=="function"?this.append(i.clone()):this.append(i)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=Wi(this);for(let i in e)t[i]=e[i];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:i,start:s}=this.rangeBy(t);return this.source.input.error(e,{column:s.column,line:s.line},{column:i.column,line:i.line},t)}return new uf(e)}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t]},set(e,t,i){return e[t]===i||(e[t]=i,(t==="prop"||t==="value"||t==="name"||t==="params"||t==="important"||t==="text")&&e.markDirty()),!0}}}markDirty(){if(this[Jt]){this[Jt]=!1;let e=this;for(;e=e.parent;)e[Jt]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let i=this.source.start;if(e.index)i=this.positionInside(e.index,t);else if(e.word){t=this.toString();let s=t.indexOf(e.word);s!==-1&&(i=this.positionInside(s,t))}return i}positionInside(e,t){let i=t||this.toString(),s=this.source.start.column,n=this.source.start.line;for(let o=0;o<e;o++)i[o]===`
34
+ `?(s=1,n+=1):s+=1;return{column:s,line:n}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},i=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let s=this.toString(),n=s.indexOf(e.word);n!==-1&&(t=this.positionInside(n,s),i=this.positionInside(n+e.word.length,s))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?i={column:e.end.column,line:e.end.line}:typeof e.endIndex=="number"?i=this.positionInside(e.endIndex):e.index&&(i=this.positionInside(e.index+1));return(i.line<t.line||i.line===t.line&&i.column<=t.column)&&(i={column:t.column+1,line:t.line}),{end:i,start:t}}raw(e,t){return new hf().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,i=!1;for(let s of e)s===this?i=!0:i?(this.parent.insertAfter(t,s),t=s):this.parent.insertBefore(t,s);i||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let i={},s=t==null;t=t||new Map;let n=0;for(let o in this){if(!Object.prototype.hasOwnProperty.call(this,o)||o==="parent"||o==="proxyCache")continue;let a=this[o];if(Array.isArray(a))i[o]=a.map(l=>typeof l=="object"&&l.toJSON?l.toJSON(null,t):l);else if(typeof a=="object"&&a.toJSON)i[o]=a.toJSON(null,t);else if(o==="source"){let l=t.get(a.input);l==null&&(l=n,t.set(a.input,n),n++),i[o]={end:a.end,inputId:l,start:a.start}}else i[o]=a}return s&&(i.inputs=[...t.keys()].map(o=>o.toJSON())),i}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=ff){e.stringify&&(e=e.stringify);let t="";return e(this,i=>{t+=i}),t}warn(e,t,i){let s={node:this};for(let n in i)s[n]=i[n];return e.warn(t,s)}get proxyOf(){return this}};var ei=Vi;Vi.default=Vi;let df=ei,Gi=class extends df{constructor(e){e&&typeof e.value<"u"&&typeof e.value!="string"&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}};var ti=Gi;Gi.default=Gi;let pf="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",mf=(r=21)=>{let e="",t=r;for(;t--;)e+=pf[Math.random()*64|0];return e};var gf={nanoid:mf};let{SourceMapConsumer:Dn,SourceMapGenerator:Tn}=ge,{existsSync:yf,readFileSync:wf}=ge,{dirname:mi,join:bf}=ge;function vf(r){return Buffer?Buffer.from(r,"base64").toString():window.atob(r)}let Yi=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let i=t.map?t.map.prev:void 0,s=this.loadMap(t.from,i);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=mi(this.mapFile)),s&&(this.text=s)}consumer(){return this.consumerCache||(this.consumerCache=new Dn(this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\/json;charset=utf-?8;base64,/,i=/^data:application\/json;base64,/,s=/^data:application\/json;charset=utf-?8,/,n=/^data:application\/json,/;if(s.test(e)||n.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(t.test(e)||i.test(e))return vf(e.substr(RegExp.lastMatch.length));let o=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+o)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e!="object"?!1:typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let i=e.lastIndexOf(t.pop()),s=e.indexOf("*/",i);i>-1&&s>-1&&(this.annotation=this.getAnnotationURL(e.substring(i,s)))}loadFile(e){if(this.root=mi(e),yf(e))return this.mapFile=e,wf(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let i=t(e);if(i){let s=this.loadFile(i);if(!s)throw new Error("Unable to load previous source map: "+i.toString());return s}}else{if(t instanceof Dn)return Tn.fromSourceMap(t).toString();if(t instanceof Tn)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let i=this.annotation;return e&&(i=bf(mi(e),i)),this.loadFile(i)}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};var ka=Yi;Yi.default=Yi;let{SourceMapConsumer:Sf,SourceMapGenerator:Cf}=ge,{fileURLToPath:On,pathToFileURL:Kt}=ge,{isAbsolute:Hi,resolve:Zi}=ge,{nanoid:xf}=gf,gi=ge,Pn=Ls,Ef=ka,yi=Symbol("fromOffsetCache"),Af=!!(Sf&&Cf),Ln=!!(Zi&&Hi),Or=class{constructor(e,t={}){if(e===null||typeof e>"u"||typeof e=="object"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]==="\uFEFF"||this.css[0]==="￾"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!Ln||/^\w+:\/\//.test(t.from)||Hi(t.from)?this.file=t.from:this.file=Zi(t.from)),Ln&&Af){let i=new Ef(this.css,t);if(i.text){this.map=i;let s=i.consumer().file;!this.file&&s&&(this.file=this.mapResolve(s))}}this.file||(this.id="<input css "+xf(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,i,s={}){let n,o,a;if(t&&typeof t=="object"){let c=t,u=i;if(typeof c.offset=="number"){let h=this.fromOffset(c.offset);t=h.line,i=h.col}else t=c.line,i=c.column;if(typeof u.offset=="number"){let h=this.fromOffset(u.offset);o=h.line,a=h.col}else o=u.line,a=u.column}else if(!i){let c=this.fromOffset(t);t=c.line,i=c.col}let l=this.origin(t,i,o,a);return l?n=new Pn(e,l.endLine===void 0?l.line:{column:l.column,line:l.line},l.endLine===void 0?l.column:{column:l.endColumn,line:l.endLine},l.source,l.file,s.plugin):n=new Pn(e,o===void 0?t:{column:i,line:t},o===void 0?i:{column:a,line:o},this.css,this.file,s.plugin),n.input={column:i,endColumn:a,endLine:o,line:t,source:this.css},this.file&&(Kt&&(n.input.url=Kt(this.file).toString()),n.input.file=this.file),n}fromOffset(e){let t,i;if(this[yi])i=this[yi];else{let n=this.css.split(`
35
+ `);i=new Array(n.length);let o=0;for(let a=0,l=n.length;a<l;a++)i[a]=o,o+=n[a].length+1;this[yi]=i}t=i[i.length-1];let s=0;if(e>=t)s=i.length-1;else{let n=i.length-2,o;for(;s<n;)if(o=s+(n-s>>1),e<i[o])n=o-1;else if(e>=i[o+1])s=o+1;else{s=o;break}}return{col:e-i[s]+1,line:s+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:Zi(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,i,s){if(!this.map)return!1;let n=this.map.consumer(),o=n.originalPositionFor({column:t,line:e});if(!o.source)return!1;let a;typeof i=="number"&&(a=n.originalPositionFor({column:s,line:i}));let l;Hi(o.source)?l=Kt(o.source):l=new URL(o.source,this.map.consumer().sourceRoot||Kt(this.map.mapFile));let c={column:o.column,endColumn:a&&a.column,endLine:a&&a.line,line:o.line,url:l.toString()};if(l.protocol==="file:")if(On)c.file=On(l);else throw new Error("file: protocol is not available in this PostCSS build");let u=n.sourceContentFor(o.source);return u&&(c.source=u),c}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}};var ri=Or;Or.default=Or;gi&&gi.registerInput&&gi.registerInput(Or);let{SourceMapConsumer:Ma,SourceMapGenerator:Rr}=ge,{dirname:kr,relative:Na,resolve:_a,sep:Ia}=ge,{pathToFileURL:$n}=ge,Rf=ri,kf=!!(Ma&&Rr),Mf=!!(kr&&_a&&Na&&Ia),Nf=class{constructor(e,t,i,s){this.stringify=e,this.mapOpts=i.map||{},this.root=t,this.opts=i,this.css=s,this.originalCSS=s,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;this.isInline()?e="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?e=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?e=this.mapOpts.annotation(this.opts.to,this.root):e=this.outputFile()+".map";let t=`
36
36
  `;this.css.includes(`\r
37
37
  `)&&(t=`\r
38
- `),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),i=e.root||Mr(e.file),s;this.mapOpts.sourcesContent===!1?(s=new ka(e.text),s.sourcesContent&&(s.sourcesContent=null)):s=e.consumer(),this.map.applySourceMap(s,t,this.toUrl(this.path(i)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type==="comment"&&e.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),kf&&Mf&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Rr.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Rr({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new Rr({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,i="<no source>",s={generated:{column:0,line:0},original:{column:0,line:0},source:""},n,o;this.stringify(this.root,(a,l,c)=>{if(this.css+=a,l&&c!=="end"&&(s.generated.line=e,s.generated.column=t-1,l.source&&l.source.start?(s.source=this.sourcePath(l),s.original.line=l.source.start.line,s.original.column=l.source.start.column-1,this.map.addMapping(s)):(s.source=i,s.original.line=1,s.original.column=0,this.map.addMapping(s))),n=a.match(/\n/g),n?(e+=n.length,o=a.lastIndexOf(`
39
- `),t=a.length-o):t+=a.length,l&&c!=="start"){let u=l.parent||{raws:{}};(!(l.type==="decl"||l.type==="atrule"&&!l.nodes)||l!==u.last||u.raws.semicolon)&&(l.source&&l.source.end?(s.source=this.sourcePath(l),s.original.line=l.source.end.line,s.original.column=l.source.end.column-1,s.generated.line=e,s.generated.column=t-2,this.map.addMapping(s)):(s.source=i,s.original.line=1,s.original.column=0,s.generated.line=e,s.generated.column=t-1,this.map.addMapping(s)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(e=>e.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let e=this.mapOpts.annotation;return typeof e<"u"&&e!==!0?!1:this.previous().length?this.previous().some(t=>t.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(e=>e.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let i=this.opts.to?Mr(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(i=Mr(_a(i,this.mapOpts.annotation)));let s=Na(i,e);return this.memoizedPaths.set(e,s),s}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Rf(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let i=t.source.input.from;if(i&&!e[i]){e[i]=!0;let s=this.usesFileUrls?this.toFileUrl(i):this.toUrl(this.path(i));this.map.setSourceContent(s,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if($n){let i=$n(e).toString();return this.memoizedFileURLs.set(e,i),i}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;Ia==="\\"&&(e=e.replace(/\\/g,"/"));let i=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,i),i}};var Da=Nf;let _f=ei,Xi=class extends _f{constructor(e){super(e),this.type="comment"}};var ii=Xi;Xi.default=Xi;let{isClean:Ta,my:Oa}=jt,Pa=ti,La=ii,If=ei,$a,$s,Fs,Fa;function ja(r){return r.map(e=>(e.nodes&&(e.nodes=ja(e.nodes)),delete e.source,e))}function Ba(r){if(r[Ta]=!1,r.proxyOf.nodes)for(let e of r.proxyOf.nodes)Ba(e)}let ke=class Ua extends If{append(...e){for(let t of e){let i=this.normalize(t,this.last);for(let s of i)this.proxyOf.nodes.push(s)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),i,s;for(;this.indexes[t]<this.proxyOf.nodes.length&&(i=this.indexes[t],s=e(this.proxyOf.nodes[i],i),s!==!1);)this.indexes[t]+=1;return delete this.indexes[t],s}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:e[t]?t==="each"||typeof t=="string"&&t.startsWith("walk")?(...i)=>e[t](...i.map(s=>typeof s=="function"?(n,o)=>s(n.toProxy(),o):s)):t==="every"||t==="some"?i=>e[t]((s,...n)=>i(s.toProxy(),...n)):t==="root"?()=>e.root().toProxy():t==="nodes"?e.nodes.map(i=>i.toProxy()):t==="first"||t==="last"?e[t].toProxy():e[t]:e[t]},set(e,t,i){return e[t]===i||(e[t]=i,(t==="name"||t==="params"||t==="selector")&&e.markDirty()),!0}}}index(e){return typeof e=="number"?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let i=this.index(e),s=this.normalize(t,this.proxyOf.nodes[i]).reverse();i=this.index(e);for(let o of s)this.proxyOf.nodes.splice(i+1,0,o);let n;for(let o in this.indexes)n=this.indexes[o],i<n&&(this.indexes[o]=n+s.length);return this.markDirty(),this}insertBefore(e,t){let i=this.index(e),s=i===0?"prepend":!1,n=this.normalize(t,this.proxyOf.nodes[i],s).reverse();i=this.index(e);for(let a of n)this.proxyOf.nodes.splice(i,0,a);let o;for(let a in this.indexes)o=this.indexes[a],i<=o&&(this.indexes[a]=o+n.length);return this.markDirty(),this}normalize(e,t){if(typeof e=="string")e=ja($a(e).nodes);else if(typeof e>"u")e=[];else if(Array.isArray(e)){e=e.slice(0);for(let s of e)s.parent&&s.parent.removeChild(s,"ignore")}else if(e.type==="root"&&this.type!=="document"){e=e.nodes.slice(0);for(let s of e)s.parent&&s.parent.removeChild(s,"ignore")}else if(e.type)e=[e];else if(e.prop){if(typeof e.value>"u")throw new Error("Value field is missed in node creation");typeof e.value!="string"&&(e.value=String(e.value)),e=[new Pa(e)]}else if(e.selector)e=[new $s(e)];else if(e.name)e=[new Fs(e)];else if(e.text)e=[new La(e)];else throw new Error("Unknown node type in node creation");return e.map(s=>(s[Oa]||Ua.rebuild(s),s=s.proxyOf,s.parent&&s.parent.removeChild(s),s[Ta]&&Ba(s),typeof s.raws.before>"u"&&t&&typeof t.raws.before<"u"&&(s.raws.before=t.raws.before.replace(/\S/g,"")),s.parent=this.proxyOf,s))}prepend(...e){e=e.reverse();for(let t of e){let i=this.normalize(t,this.first,"prepend").reverse();for(let s of i)this.proxyOf.nodes.unshift(s);for(let s in this.indexes)this.indexes[s]=this.indexes[s]+i.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let i in this.indexes)t=this.indexes[i],t>=e&&(this.indexes[i]=t-1);return this.markDirty(),this}replaceValues(e,t,i){return i||(i=t,t={}),this.walkDecls(s=>{t.props&&!t.props.includes(s.prop)||t.fast&&!s.value.includes(t.fast)||(s.value=s.value.replace(e,i))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,i)=>{let s;try{s=e(t,i)}catch(n){throw t.addToError(n)}return s!==!1&&t.walk&&(s=t.walk(e)),s})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((i,s)=>{if(i.type==="atrule"&&e.test(i.name))return t(i,s)}):this.walk((i,s)=>{if(i.type==="atrule"&&i.name===e)return t(i,s)}):(t=e,this.walk((i,s)=>{if(i.type==="atrule")return t(i,s)}))}walkComments(e){return this.walk((t,i)=>{if(t.type==="comment")return e(t,i)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((i,s)=>{if(i.type==="decl"&&e.test(i.prop))return t(i,s)}):this.walk((i,s)=>{if(i.type==="decl"&&i.prop===e)return t(i,s)}):(t=e,this.walk((i,s)=>{if(i.type==="decl")return t(i,s)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((i,s)=>{if(i.type==="rule"&&e.test(i.selector))return t(i,s)}):this.walk((i,s)=>{if(i.type==="rule"&&i.selector===e)return t(i,s)}):(t=e,this.walk((i,s)=>{if(i.type==="rule")return t(i,s)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};ke.registerParse=r=>{$a=r};ke.registerRule=r=>{$s=r};ke.registerAtRule=r=>{Fs=r};ke.registerRoot=r=>{Fa=r};var Ue=ke;ke.default=ke;ke.rebuild=r=>{r.type==="atrule"?Object.setPrototypeOf(r,Fs.prototype):r.type==="rule"?Object.setPrototypeOf(r,$s.prototype):r.type==="decl"?Object.setPrototypeOf(r,Pa.prototype):r.type==="comment"?Object.setPrototypeOf(r,La.prototype):r.type==="root"&&Object.setPrototypeOf(r,Fa.prototype),r[Oa]=!0,r.nodes&&r.nodes.forEach(e=>{ke.rebuild(e)})};let Df=Ue,za,Wa,Nt=class extends Df{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new za(new Wa,this,e).stringify()}};Nt.registerLazyResult=r=>{za=r};Nt.registerProcessor=r=>{Wa=r};var js=Nt;Nt.default=Nt;let Fn={};var Va=function(e){Fn[e]||(Fn[e]=!0,typeof console<"u"&&console.warn&&console.warn(e))};let Ji=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let i=t.node.rangeBy(t);this.line=i.start.line,this.column=i.start.column,this.endLine=i.end.line,this.endColumn=i.end.column}for(let i in t)this[i]=t[i]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}};var Ga=Ji;Ji.default=Ji;let Tf=Ga,Ki=class{constructor(e,t,i){this.processor=e,this.messages=[],this.root=t,this.opts=i,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let i=new Tf(e,t);return this.messages.push(i),i}warnings(){return this.messages.filter(e=>e.type==="warning")}get content(){return this.css}};var Bs=Ki;Ki.default=Ki;const wi=39,jn=34,qt=92,Bn=47,Qt=10,ft=32,er=12,tr=9,rr=13,Of=91,Pf=93,Lf=40,$f=41,Ff=123,jf=125,Bf=59,Uf=42,zf=58,Wf=64,ir=/[\t\n\f\r "#'()/;[\\\]{}]/g,sr=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,Vf=/.[\r\n"'(/\\]/,Un=/[\da-f]/i;var Gf=function(e,t={}){let i=e.css.valueOf(),s=t.ignoreErrors,n,o,a,l,c,u,h,f,d,m,w=i.length,p=0,y=[],b=[];function v(){return p}function x(D){throw e.error("Unclosed "+D,p)}function M(){return b.length===0&&p>=w}function N(D){if(b.length)return b.pop();if(p>=w)return;let J=D?D.ignoreUnclosed:!1;switch(n=i.charCodeAt(p),n){case Qt:case ft:case tr:case rr:case er:{o=p;do o+=1,n=i.charCodeAt(o);while(n===ft||n===Qt||n===tr||n===rr||n===er);m=["space",i.slice(p,o)],p=o-1;break}case Of:case Pf:case Ff:case jf:case zf:case Bf:case $f:{let W=String.fromCharCode(n);m=[W,W,p];break}case Lf:{if(f=y.length?y.pop()[1]:"",d=i.charCodeAt(p+1),f==="url"&&d!==wi&&d!==jn&&d!==ft&&d!==Qt&&d!==tr&&d!==er&&d!==rr){o=p;do{if(u=!1,o=i.indexOf(")",o+1),o===-1)if(s||J){o=p;break}else x("bracket");for(h=o;i.charCodeAt(h-1)===qt;)h-=1,u=!u}while(u);m=["brackets",i.slice(p,o+1),p,o],p=o}else o=i.indexOf(")",p+1),l=i.slice(p,o+1),o===-1||Vf.test(l)?m=["(","(",p]:(m=["brackets",l,p,o],p=o);break}case wi:case jn:{a=n===wi?"'":'"',o=p;do{if(u=!1,o=i.indexOf(a,o+1),o===-1)if(s||J){o=p+1;break}else x("string");for(h=o;i.charCodeAt(h-1)===qt;)h-=1,u=!u}while(u);m=["string",i.slice(p,o+1),p,o],p=o;break}case Wf:{ir.lastIndex=p+1,ir.test(i),ir.lastIndex===0?o=i.length-1:o=ir.lastIndex-2,m=["at-word",i.slice(p,o+1),p,o],p=o;break}case qt:{for(o=p,c=!0;i.charCodeAt(o+1)===qt;)o+=1,c=!c;if(n=i.charCodeAt(o+1),c&&n!==Bn&&n!==ft&&n!==Qt&&n!==tr&&n!==rr&&n!==er&&(o+=1,Un.test(i.charAt(o)))){for(;Un.test(i.charAt(o+1));)o+=1;i.charCodeAt(o+1)===ft&&(o+=1)}m=["word",i.slice(p,o+1),p,o],p=o;break}default:{n===Bn&&i.charCodeAt(p+1)===Uf?(o=i.indexOf("*/",p+2)+1,o===0&&(s||J?o=i.length:x("comment")),m=["comment",i.slice(p,o+1),p,o],p=o):(sr.lastIndex=p+1,sr.test(i),sr.lastIndex===0?o=i.length-1:o=sr.lastIndex-2,m=["word",i.slice(p,o+1),p,o],y.push(m),p=o);break}}return p++,m}function j(D){b.push(D)}return{back:j,endOfFile:M,nextToken:N,position:v}};let Ya=Ue,Pr=class extends Ya{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}};var Us=Pr;Pr.default=Pr;Ya.registerAtRule(Pr);let Ha=Ue,Za,Xa,st=class extends Ha{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,i){let s=super.normalize(e);if(t){if(i==="prepend")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let n of s)n.raws.before=t.raws.before}return s}removeChild(e,t){let i=this.index(e);return!t&&i===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[i].raws.before),super.removeChild(e)}toResult(e={}){return new Za(new Xa,this,e).stringify()}};st.registerLazyResult=r=>{Za=r};st.registerProcessor=r=>{Xa=r};var Bt=st;st.default=st;Ha.registerRoot(st);let _t={comma(r){return _t.split(r,[","],!0)},space(r){let e=[" ",`
40
- `," "];return _t.split(r,e)},split(r,e,t){let i=[],s="",n=!1,o=0,a=!1,l="",c=!1;for(let u of r)c?c=!1:u==="\\"?c=!0:a?u===l&&(a=!1):u==='"'||u==="'"?(a=!0,l=u):u==="("?o+=1:u===")"?o>0&&(o-=1):o===0&&e.includes(u)&&(n=!0),n?(s!==""&&i.push(s.trim()),s="",n=!1):s+=u;return(t||s!=="")&&i.push(s.trim()),i}};var Ja=_t;_t.default=_t;let Ka=Ue,Yf=Ja,Lr=class extends Ka{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return Yf.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,i=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(i)}};var zs=Lr;Lr.default=Lr;Ka.registerRule(Lr);let Hf=ti,Zf=Gf,Xf=ii,Jf=Us,Kf=Bt,zn=zs;const Wn={empty:!0,space:!0};function qf(r){for(let e=r.length-1;e>=0;e--){let t=r[e],i=t[3]||t[2];if(i)return i}}let Qf=class{constructor(e){this.input=e,this.root=new Kf,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new Jf;t.name=e[1].slice(1),t.name===""&&this.unnamedAtrule(t,e),this.init(t,e[2]);let i,s,n,o=!1,a=!1,l=[],c=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),i=e[0],i==="("||i==="["?c.push(i==="("?")":"]"):i==="{"&&c.length>0?c.push("}"):i===c[c.length-1]&&c.pop(),c.length===0)if(i===";"){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(i==="{"){a=!0;break}else if(i==="}"){if(l.length>0){for(n=l.length-1,s=l[n];s&&s[0]==="space";)s=l[--n];s&&(t.source.end=this.getPosition(s[3]||s[2]),t.source.end.offset++)}this.end(e);break}else l.push(e);else l.push(e);if(this.tokenizer.endOfFile()){o=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(t.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(t,"params",l),o&&(e=l[l.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between="")):(t.raws.afterName="",t.params=""),a&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let i=0,s;for(let n=t-1;n>=0&&(s=e[n],!(s[0]!=="space"&&(i+=1,i===2)));n--);throw this.input.error("Missed semicolon",s[0]==="word"?s[3]+1:s[2])}colon(e){let t=0,i,s,n;for(let[o,a]of e.entries()){if(i=a,s=i[0],s==="("&&(t+=1),s===")"&&(t-=1),t===0&&s===":")if(!n)this.doubleColon(i);else{if(n[0]==="word"&&n[1]==="progid")continue;return o}n=i}return!1}comment(e){let t=new Xf;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let i=e[1].slice(2,-2);if(/^\s*$/.test(i))t.text="",t.raws.left=i,t.raws.right="";else{let s=i.match(/^(\s*)([^]*\S)(\s*)$/);t.text=s[2],t.raws.left=s[1],t.raws.right=s[3]}}createTokenizer(){this.tokenizer=Zf(this.input)}decl(e,t){let i=new Hf;this.init(i,e[0][2]);let s=e[e.length-1];for(s[0]===";"&&(this.semicolon=!0,e.pop()),i.source.end=this.getPosition(s[3]||s[2]||qf(e)),i.source.end.offset++;e[0][0]!=="word";)e.length===1&&this.unknownWord(e),i.raws.before+=e.shift()[1];for(i.source.start=this.getPosition(e[0][2]),i.prop="";e.length;){let c=e[0][0];if(c===":"||c==="space"||c==="comment")break;i.prop+=e.shift()[1]}i.raws.between="";let n;for(;e.length;)if(n=e.shift(),n[0]===":"){i.raws.between+=n[1];break}else n[0]==="word"&&/\w/.test(n[1])&&this.unknownWord([n]),i.raws.between+=n[1];(i.prop[0]==="_"||i.prop[0]==="*")&&(i.raws.before+=i.prop[0],i.prop=i.prop.slice(1));let o=[],a;for(;e.length&&(a=e[0][0],!(a!=="space"&&a!=="comment"));)o.push(e.shift());this.precheckMissedSemicolon(e);for(let c=e.length-1;c>=0;c--){if(n=e[c],n[1].toLowerCase()==="!important"){i.important=!0;let u=this.stringFrom(e,c);u=this.spacesFromEnd(e)+u,u!==" !important"&&(i.raws.important=u);break}else if(n[1].toLowerCase()==="important"){let u=e.slice(0),h="";for(let f=c;f>0;f--){let d=u[f][0];if(h.trim().indexOf("!")===0&&d!=="space")break;h=u.pop()[1]+h}h.trim().indexOf("!")===0&&(i.important=!0,i.raws.important=h,e=u)}if(n[0]!=="space"&&n[0]!=="comment")break}e.some(c=>c[0]!=="space"&&c[0]!=="comment")&&(i.raws.between+=o.map(c=>c[1]).join(""),o=[]),this.raw(i,"value",o.concat(e),t),i.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new zn;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type==="rule"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="",e.type!=="comment"&&(this.semicolon=!1)}other(e){let t=!1,i=null,s=!1,n=null,o=[],a=e[1].startsWith("--"),l=[],c=e;for(;c;){if(i=c[0],l.push(c),i==="("||i==="[")n||(n=c),o.push(i==="("?")":"]");else if(a&&s&&i==="{")n||(n=c),o.push("}");else if(o.length===0)if(i===";")if(s){this.decl(l,a);return}else break;else if(i==="{"){this.rule(l);return}else if(i==="}"){this.tokenizer.back(l.pop()),t=!0;break}else i===":"&&(s=!0);else i===o[o.length-1]&&(o.pop(),o.length===0&&(n=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(n),t&&s){if(!a)for(;l.length&&(c=l[l.length-1][0],!(c!=="space"&&c!=="comment"));)this.tokenizer.back(l.pop());this.decl(l,a)}else this.unknownWord(l)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,i,s){let n,o,a=i.length,l="",c=!0,u,h;for(let f=0;f<a;f+=1)n=i[f],o=n[0],o==="space"&&f===a-1&&!s?c=!1:o==="comment"?(h=i[f-1]?i[f-1][0]:"empty",u=i[f+1]?i[f+1][0]:"empty",!Wn[h]&&!Wn[u]?l.slice(-1)===","?c=!1:l+=n[1]:c=!1):l+=n[1];if(!c){let f=i.reduce((d,m)=>d+m[1],"");e.raws[t]={raw:f,value:l}}e[t]=l}rule(e){e.pop();let t=new zn;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,i="";for(;e.length&&(t=e[e.length-1][0],!(t!=="space"&&t!=="comment"));)i=e.pop()[1]+i;return i}spacesAndCommentsFromStart(e){let t,i="";for(;e.length&&(t=e[0][0],!(t!=="space"&&t!=="comment"));)i+=e.shift()[1];return i}spacesFromEnd(e){let t,i="";for(;e.length&&(t=e[e.length-1][0],t==="space");)i=e.pop()[1]+i;return i}stringFrom(e,t){let i="";for(let s=t;s<e.length;s++)i+=e[s][1];return e.splice(t,e.length-t),i}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}};var ed=Qf;let td=Ue,rd=ed,id=ri;function $r(r,e){let t=new id(r,e),i=new rd(t);try{i.parse()}catch(s){throw process.env.NODE_ENV!=="production"&&s.name==="CssSyntaxError"&&e&&e.from&&(/\.scss$/i.test(e.from)?s.message+=`
38
+ `),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),i=e.root||kr(e.file),s;this.mapOpts.sourcesContent===!1?(s=new Ma(e.text),s.sourcesContent&&(s.sourcesContent=null)):s=e.consumer(),this.map.applySourceMap(s,t,this.toUrl(this.path(i)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type==="comment"&&e.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),Mf&&kf&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Rr.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Rr({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new Rr({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,i="<no source>",s={generated:{column:0,line:0},original:{column:0,line:0},source:""},n,o;this.stringify(this.root,(a,l,c)=>{if(this.css+=a,l&&c!=="end"&&(s.generated.line=e,s.generated.column=t-1,l.source&&l.source.start?(s.source=this.sourcePath(l),s.original.line=l.source.start.line,s.original.column=l.source.start.column-1,this.map.addMapping(s)):(s.source=i,s.original.line=1,s.original.column=0,this.map.addMapping(s))),n=a.match(/\n/g),n?(e+=n.length,o=a.lastIndexOf(`
39
+ `),t=a.length-o):t+=a.length,l&&c!=="start"){let u=l.parent||{raws:{}};(!(l.type==="decl"||l.type==="atrule"&&!l.nodes)||l!==u.last||u.raws.semicolon)&&(l.source&&l.source.end?(s.source=this.sourcePath(l),s.original.line=l.source.end.line,s.original.column=l.source.end.column-1,s.generated.line=e,s.generated.column=t-2,this.map.addMapping(s)):(s.source=i,s.original.line=1,s.original.column=0,s.generated.line=e,s.generated.column=t-1,this.map.addMapping(s)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(e=>e.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let e=this.mapOpts.annotation;return typeof e<"u"&&e!==!0?!1:this.previous().length?this.previous().some(t=>t.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(e=>e.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let i=this.opts.to?kr(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(i=kr(_a(i,this.mapOpts.annotation)));let s=Na(i,e);return this.memoizedPaths.set(e,s),s}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Rf(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let i=t.source.input.from;if(i&&!e[i]){e[i]=!0;let s=this.usesFileUrls?this.toFileUrl(i):this.toUrl(this.path(i));this.map.setSourceContent(s,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if($n){let i=$n(e).toString();return this.memoizedFileURLs.set(e,i),i}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;Ia==="\\"&&(e=e.replace(/\\/g,"/"));let i=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,i),i}};var Da=Nf;let _f=ei,Xi=class extends _f{constructor(e){super(e),this.type="comment"}};var ii=Xi;Xi.default=Xi;let{isClean:Ta,my:Oa}=Ft,Pa=ti,La=ii,If=ei,$a,$s,js,ja;function Fa(r){return r.map(e=>(e.nodes&&(e.nodes=Fa(e.nodes)),delete e.source,e))}function Ba(r){if(r[Ta]=!1,r.proxyOf.nodes)for(let e of r.proxyOf.nodes)Ba(e)}let Me=class Ua extends If{append(...e){for(let t of e){let i=this.normalize(t,this.last);for(let s of i)this.proxyOf.nodes.push(s)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),i,s;for(;this.indexes[t]<this.proxyOf.nodes.length&&(i=this.indexes[t],s=e(this.proxyOf.nodes[i],i),s!==!1);)this.indexes[t]+=1;return delete this.indexes[t],s}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:e[t]?t==="each"||typeof t=="string"&&t.startsWith("walk")?(...i)=>e[t](...i.map(s=>typeof s=="function"?(n,o)=>s(n.toProxy(),o):s)):t==="every"||t==="some"?i=>e[t]((s,...n)=>i(s.toProxy(),...n)):t==="root"?()=>e.root().toProxy():t==="nodes"?e.nodes.map(i=>i.toProxy()):t==="first"||t==="last"?e[t].toProxy():e[t]:e[t]},set(e,t,i){return e[t]===i||(e[t]=i,(t==="name"||t==="params"||t==="selector")&&e.markDirty()),!0}}}index(e){return typeof e=="number"?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let i=this.index(e),s=this.normalize(t,this.proxyOf.nodes[i]).reverse();i=this.index(e);for(let o of s)this.proxyOf.nodes.splice(i+1,0,o);let n;for(let o in this.indexes)n=this.indexes[o],i<n&&(this.indexes[o]=n+s.length);return this.markDirty(),this}insertBefore(e,t){let i=this.index(e),s=i===0?"prepend":!1,n=this.normalize(t,this.proxyOf.nodes[i],s).reverse();i=this.index(e);for(let a of n)this.proxyOf.nodes.splice(i,0,a);let o;for(let a in this.indexes)o=this.indexes[a],i<=o&&(this.indexes[a]=o+n.length);return this.markDirty(),this}normalize(e,t){if(typeof e=="string")e=Fa($a(e).nodes);else if(typeof e>"u")e=[];else if(Array.isArray(e)){e=e.slice(0);for(let s of e)s.parent&&s.parent.removeChild(s,"ignore")}else if(e.type==="root"&&this.type!=="document"){e=e.nodes.slice(0);for(let s of e)s.parent&&s.parent.removeChild(s,"ignore")}else if(e.type)e=[e];else if(e.prop){if(typeof e.value>"u")throw new Error("Value field is missed in node creation");typeof e.value!="string"&&(e.value=String(e.value)),e=[new Pa(e)]}else if(e.selector)e=[new $s(e)];else if(e.name)e=[new js(e)];else if(e.text)e=[new La(e)];else throw new Error("Unknown node type in node creation");return e.map(s=>(s[Oa]||Ua.rebuild(s),s=s.proxyOf,s.parent&&s.parent.removeChild(s),s[Ta]&&Ba(s),typeof s.raws.before>"u"&&t&&typeof t.raws.before<"u"&&(s.raws.before=t.raws.before.replace(/\S/g,"")),s.parent=this.proxyOf,s))}prepend(...e){e=e.reverse();for(let t of e){let i=this.normalize(t,this.first,"prepend").reverse();for(let s of i)this.proxyOf.nodes.unshift(s);for(let s in this.indexes)this.indexes[s]=this.indexes[s]+i.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let i in this.indexes)t=this.indexes[i],t>=e&&(this.indexes[i]=t-1);return this.markDirty(),this}replaceValues(e,t,i){return i||(i=t,t={}),this.walkDecls(s=>{t.props&&!t.props.includes(s.prop)||t.fast&&!s.value.includes(t.fast)||(s.value=s.value.replace(e,i))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,i)=>{let s;try{s=e(t,i)}catch(n){throw t.addToError(n)}return s!==!1&&t.walk&&(s=t.walk(e)),s})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((i,s)=>{if(i.type==="atrule"&&e.test(i.name))return t(i,s)}):this.walk((i,s)=>{if(i.type==="atrule"&&i.name===e)return t(i,s)}):(t=e,this.walk((i,s)=>{if(i.type==="atrule")return t(i,s)}))}walkComments(e){return this.walk((t,i)=>{if(t.type==="comment")return e(t,i)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((i,s)=>{if(i.type==="decl"&&e.test(i.prop))return t(i,s)}):this.walk((i,s)=>{if(i.type==="decl"&&i.prop===e)return t(i,s)}):(t=e,this.walk((i,s)=>{if(i.type==="decl")return t(i,s)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((i,s)=>{if(i.type==="rule"&&e.test(i.selector))return t(i,s)}):this.walk((i,s)=>{if(i.type==="rule"&&i.selector===e)return t(i,s)}):(t=e,this.walk((i,s)=>{if(i.type==="rule")return t(i,s)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};Me.registerParse=r=>{$a=r};Me.registerRule=r=>{$s=r};Me.registerAtRule=r=>{js=r};Me.registerRoot=r=>{ja=r};var Ue=Me;Me.default=Me;Me.rebuild=r=>{r.type==="atrule"?Object.setPrototypeOf(r,js.prototype):r.type==="rule"?Object.setPrototypeOf(r,$s.prototype):r.type==="decl"?Object.setPrototypeOf(r,Pa.prototype):r.type==="comment"?Object.setPrototypeOf(r,La.prototype):r.type==="root"&&Object.setPrototypeOf(r,ja.prototype),r[Oa]=!0,r.nodes&&r.nodes.forEach(e=>{Me.rebuild(e)})};let Df=Ue,za,Wa,Nt=class extends Df{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new za(new Wa,this,e).stringify()}};Nt.registerLazyResult=r=>{za=r};Nt.registerProcessor=r=>{Wa=r};var Fs=Nt;Nt.default=Nt;let jn={};var Va=function(e){jn[e]||(jn[e]=!0,typeof console<"u"&&console.warn&&console.warn(e))};let Ji=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let i=t.node.rangeBy(t);this.line=i.start.line,this.column=i.start.column,this.endLine=i.end.line,this.endColumn=i.end.column}for(let i in t)this[i]=t[i]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}};var Ga=Ji;Ji.default=Ji;let Tf=Ga,Ki=class{constructor(e,t,i){this.processor=e,this.messages=[],this.root=t,this.opts=i,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let i=new Tf(e,t);return this.messages.push(i),i}warnings(){return this.messages.filter(e=>e.type==="warning")}get content(){return this.css}};var Bs=Ki;Ki.default=Ki;const wi=39,Fn=34,qt=92,Bn=47,Qt=10,ft=32,er=12,tr=9,rr=13,Of=91,Pf=93,Lf=40,$f=41,jf=123,Ff=125,Bf=59,Uf=42,zf=58,Wf=64,ir=/[\t\n\f\r "#'()/;[\\\]{}]/g,sr=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,Vf=/.[\r\n"'(/\\]/,Un=/[\da-f]/i;var Gf=function(e,t={}){let i=e.css.valueOf(),s=t.ignoreErrors,n,o,a,l,c,u,h,f,d,g,w=i.length,p=0,y=[],b=[];function v(){return p}function x(D){throw e.error("Unclosed "+D,p)}function k(){return b.length===0&&p>=w}function N(D){if(b.length)return b.pop();if(p>=w)return;let J=D?D.ignoreUnclosed:!1;switch(n=i.charCodeAt(p),n){case Qt:case ft:case tr:case rr:case er:{o=p;do o+=1,n=i.charCodeAt(o);while(n===ft||n===Qt||n===tr||n===rr||n===er);g=["space",i.slice(p,o)],p=o-1;break}case Of:case Pf:case jf:case Ff:case zf:case Bf:case $f:{let W=String.fromCharCode(n);g=[W,W,p];break}case Lf:{if(f=y.length?y.pop()[1]:"",d=i.charCodeAt(p+1),f==="url"&&d!==wi&&d!==Fn&&d!==ft&&d!==Qt&&d!==tr&&d!==er&&d!==rr){o=p;do{if(u=!1,o=i.indexOf(")",o+1),o===-1)if(s||J){o=p;break}else x("bracket");for(h=o;i.charCodeAt(h-1)===qt;)h-=1,u=!u}while(u);g=["brackets",i.slice(p,o+1),p,o],p=o}else o=i.indexOf(")",p+1),l=i.slice(p,o+1),o===-1||Vf.test(l)?g=["(","(",p]:(g=["brackets",l,p,o],p=o);break}case wi:case Fn:{a=n===wi?"'":'"',o=p;do{if(u=!1,o=i.indexOf(a,o+1),o===-1)if(s||J){o=p+1;break}else x("string");for(h=o;i.charCodeAt(h-1)===qt;)h-=1,u=!u}while(u);g=["string",i.slice(p,o+1),p,o],p=o;break}case Wf:{ir.lastIndex=p+1,ir.test(i),ir.lastIndex===0?o=i.length-1:o=ir.lastIndex-2,g=["at-word",i.slice(p,o+1),p,o],p=o;break}case qt:{for(o=p,c=!0;i.charCodeAt(o+1)===qt;)o+=1,c=!c;if(n=i.charCodeAt(o+1),c&&n!==Bn&&n!==ft&&n!==Qt&&n!==tr&&n!==rr&&n!==er&&(o+=1,Un.test(i.charAt(o)))){for(;Un.test(i.charAt(o+1));)o+=1;i.charCodeAt(o+1)===ft&&(o+=1)}g=["word",i.slice(p,o+1),p,o],p=o;break}default:{n===Bn&&i.charCodeAt(p+1)===Uf?(o=i.indexOf("*/",p+2)+1,o===0&&(s||J?o=i.length:x("comment")),g=["comment",i.slice(p,o+1),p,o],p=o):(sr.lastIndex=p+1,sr.test(i),sr.lastIndex===0?o=i.length-1:o=sr.lastIndex-2,g=["word",i.slice(p,o+1),p,o],y.push(g),p=o);break}}return p++,g}function F(D){b.push(D)}return{back:F,endOfFile:k,nextToken:N,position:v}};let Ya=Ue,Pr=class extends Ya{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}};var Us=Pr;Pr.default=Pr;Ya.registerAtRule(Pr);let Ha=Ue,Za,Xa,st=class extends Ha{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,i){let s=super.normalize(e);if(t){if(i==="prepend")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let n of s)n.raws.before=t.raws.before}return s}removeChild(e,t){let i=this.index(e);return!t&&i===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[i].raws.before),super.removeChild(e)}toResult(e={}){return new Za(new Xa,this,e).stringify()}};st.registerLazyResult=r=>{Za=r};st.registerProcessor=r=>{Xa=r};var Bt=st;st.default=st;Ha.registerRoot(st);let _t={comma(r){return _t.split(r,[","],!0)},space(r){let e=[" ",`
40
+ `," "];return _t.split(r,e)},split(r,e,t){let i=[],s="",n=!1,o=0,a=!1,l="",c=!1;for(let u of r)c?c=!1:u==="\\"?c=!0:a?u===l&&(a=!1):u==='"'||u==="'"?(a=!0,l=u):u==="("?o+=1:u===")"?o>0&&(o-=1):o===0&&e.includes(u)&&(n=!0),n?(s!==""&&i.push(s.trim()),s="",n=!1):s+=u;return(t||s!=="")&&i.push(s.trim()),i}};var Ja=_t;_t.default=_t;let Ka=Ue,Yf=Ja,Lr=class extends Ka{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return Yf.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,i=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(i)}};var zs=Lr;Lr.default=Lr;Ka.registerRule(Lr);let Hf=ti,Zf=Gf,Xf=ii,Jf=Us,Kf=Bt,zn=zs;const Wn={empty:!0,space:!0};function qf(r){for(let e=r.length-1;e>=0;e--){let t=r[e],i=t[3]||t[2];if(i)return i}}let Qf=class{constructor(e){this.input=e,this.root=new Kf,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new Jf;t.name=e[1].slice(1),t.name===""&&this.unnamedAtrule(t,e),this.init(t,e[2]);let i,s,n,o=!1,a=!1,l=[],c=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),i=e[0],i==="("||i==="["?c.push(i==="("?")":"]"):i==="{"&&c.length>0?c.push("}"):i===c[c.length-1]&&c.pop(),c.length===0)if(i===";"){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(i==="{"){a=!0;break}else if(i==="}"){if(l.length>0){for(n=l.length-1,s=l[n];s&&s[0]==="space";)s=l[--n];s&&(t.source.end=this.getPosition(s[3]||s[2]),t.source.end.offset++)}this.end(e);break}else l.push(e);else l.push(e);if(this.tokenizer.endOfFile()){o=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(t.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(t,"params",l),o&&(e=l[l.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between="")):(t.raws.afterName="",t.params=""),a&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let i=0,s;for(let n=t-1;n>=0&&(s=e[n],!(s[0]!=="space"&&(i+=1,i===2)));n--);throw this.input.error("Missed semicolon",s[0]==="word"?s[3]+1:s[2])}colon(e){let t=0,i,s,n;for(let[o,a]of e.entries()){if(i=a,s=i[0],s==="("&&(t+=1),s===")"&&(t-=1),t===0&&s===":")if(!n)this.doubleColon(i);else{if(n[0]==="word"&&n[1]==="progid")continue;return o}n=i}return!1}comment(e){let t=new Xf;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let i=e[1].slice(2,-2);if(/^\s*$/.test(i))t.text="",t.raws.left=i,t.raws.right="";else{let s=i.match(/^(\s*)([^]*\S)(\s*)$/);t.text=s[2],t.raws.left=s[1],t.raws.right=s[3]}}createTokenizer(){this.tokenizer=Zf(this.input)}decl(e,t){let i=new Hf;this.init(i,e[0][2]);let s=e[e.length-1];for(s[0]===";"&&(this.semicolon=!0,e.pop()),i.source.end=this.getPosition(s[3]||s[2]||qf(e)),i.source.end.offset++;e[0][0]!=="word";)e.length===1&&this.unknownWord(e),i.raws.before+=e.shift()[1];for(i.source.start=this.getPosition(e[0][2]),i.prop="";e.length;){let c=e[0][0];if(c===":"||c==="space"||c==="comment")break;i.prop+=e.shift()[1]}i.raws.between="";let n;for(;e.length;)if(n=e.shift(),n[0]===":"){i.raws.between+=n[1];break}else n[0]==="word"&&/\w/.test(n[1])&&this.unknownWord([n]),i.raws.between+=n[1];(i.prop[0]==="_"||i.prop[0]==="*")&&(i.raws.before+=i.prop[0],i.prop=i.prop.slice(1));let o=[],a;for(;e.length&&(a=e[0][0],!(a!=="space"&&a!=="comment"));)o.push(e.shift());this.precheckMissedSemicolon(e);for(let c=e.length-1;c>=0;c--){if(n=e[c],n[1].toLowerCase()==="!important"){i.important=!0;let u=this.stringFrom(e,c);u=this.spacesFromEnd(e)+u,u!==" !important"&&(i.raws.important=u);break}else if(n[1].toLowerCase()==="important"){let u=e.slice(0),h="";for(let f=c;f>0;f--){let d=u[f][0];if(h.trim().indexOf("!")===0&&d!=="space")break;h=u.pop()[1]+h}h.trim().indexOf("!")===0&&(i.important=!0,i.raws.important=h,e=u)}if(n[0]!=="space"&&n[0]!=="comment")break}e.some(c=>c[0]!=="space"&&c[0]!=="comment")&&(i.raws.between+=o.map(c=>c[1]).join(""),o=[]),this.raw(i,"value",o.concat(e),t),i.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new zn;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type==="rule"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="",e.type!=="comment"&&(this.semicolon=!1)}other(e){let t=!1,i=null,s=!1,n=null,o=[],a=e[1].startsWith("--"),l=[],c=e;for(;c;){if(i=c[0],l.push(c),i==="("||i==="[")n||(n=c),o.push(i==="("?")":"]");else if(a&&s&&i==="{")n||(n=c),o.push("}");else if(o.length===0)if(i===";")if(s){this.decl(l,a);return}else break;else if(i==="{"){this.rule(l);return}else if(i==="}"){this.tokenizer.back(l.pop()),t=!0;break}else i===":"&&(s=!0);else i===o[o.length-1]&&(o.pop(),o.length===0&&(n=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(n),t&&s){if(!a)for(;l.length&&(c=l[l.length-1][0],!(c!=="space"&&c!=="comment"));)this.tokenizer.back(l.pop());this.decl(l,a)}else this.unknownWord(l)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,i,s){let n,o,a=i.length,l="",c=!0,u,h;for(let f=0;f<a;f+=1)n=i[f],o=n[0],o==="space"&&f===a-1&&!s?c=!1:o==="comment"?(h=i[f-1]?i[f-1][0]:"empty",u=i[f+1]?i[f+1][0]:"empty",!Wn[h]&&!Wn[u]?l.slice(-1)===","?c=!1:l+=n[1]:c=!1):l+=n[1];if(!c){let f=i.reduce((d,g)=>d+g[1],"");e.raws[t]={raw:f,value:l}}e[t]=l}rule(e){e.pop();let t=new zn;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,i="";for(;e.length&&(t=e[e.length-1][0],!(t!=="space"&&t!=="comment"));)i=e.pop()[1]+i;return i}spacesAndCommentsFromStart(e){let t,i="";for(;e.length&&(t=e[0][0],!(t!=="space"&&t!=="comment"));)i+=e.shift()[1];return i}spacesFromEnd(e){let t,i="";for(;e.length&&(t=e[e.length-1][0],t==="space");)i=e.pop()[1]+i;return i}stringFrom(e,t){let i="";for(let s=t;s<e.length;s++)i+=e[s][1];return e.splice(t,e.length-t),i}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}};var ed=Qf;let td=Ue,rd=ed,id=ri;function $r(r,e){let t=new id(r,e),i=new rd(t);try{i.parse()}catch(s){throw process.env.NODE_ENV!=="production"&&s.name==="CssSyntaxError"&&e&&e.from&&(/\.scss$/i.test(e.from)?s.message+=`
41
41
  You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser`:/\.sass/i.test(e.from)?s.message+=`
42
42
  You tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser`:/\.less$/i.test(e.from)&&(s.message+=`
43
- You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),s}return i.root}var Ws=$r;$r.default=$r;td.registerParse($r);let{isClean:Se,my:sd}=jt,nd=Da,od=Qr,ad=Ue,ld=js,cd=Va,Vn=Bs,ud=Ws,hd=Bt;const fd={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},dd={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},pd={Once:!0,postcssPlugin:!0,prepare:!0},nt=0;function dt(r){return typeof r=="object"&&typeof r.then=="function"}function qa(r){let e=!1,t=fd[r.type];return r.type==="decl"?e=r.prop.toLowerCase():r.type==="atrule"&&(e=r.name.toLowerCase()),e&&r.append?[t,t+"-"+e,nt,t+"Exit",t+"Exit-"+e]:e?[t,t+"-"+e,t+"Exit",t+"Exit-"+e]:r.append?[t,nt,t+"Exit"]:[t,t+"Exit"]}function Gn(r){let e;return r.type==="document"?e=["Document",nt,"DocumentExit"]:r.type==="root"?e=["Root",nt,"RootExit"]:e=qa(r),{eventIndex:0,events:e,iterator:0,node:r,visitorIndex:0,visitors:[]}}function qi(r){return r[Se]=!1,r.nodes&&r.nodes.forEach(e=>qi(e)),r}let Qi={},ot=class Qa{constructor(e,t,i){this.stringified=!1,this.processed=!1;let s;if(typeof t=="object"&&t!==null&&(t.type==="root"||t.type==="document"))s=qi(t);else if(t instanceof Qa||t instanceof Vn)s=qi(t.root),t.map&&(typeof i.map>"u"&&(i.map={}),i.map.inline||(i.map.inline=!1),i.map.prev=t.map);else{let n=ud;i.syntax&&(n=i.syntax.parse),i.parser&&(n=i.parser),n.parse&&(n=n.parse);try{s=n(t,i)}catch(o){this.processed=!0,this.error=o}s&&!s[sd]&&ad.rebuild(s)}this.result=new Vn(e,s,i),this.helpers={...Qi,postcss:Qi,result:this.result},this.plugins=this.processor.plugins.map(n=>typeof n=="object"&&n.prepare?{...n,...n.prepare(this.result)}:n)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let i=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,e.name==="CssSyntaxError"&&!e.plugin)e.plugin=i.postcssPlugin,e.setMessage();else if(i.postcssVersion&&process.env.NODE_ENV!=="production"){let s=i.postcssPlugin,n=i.postcssVersion,o=this.result.processor.version,a=n.split("."),l=o.split(".");(a[0]!==l[0]||parseInt(a[1])>parseInt(l[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+o+", but "+s+" uses "+n+". Perhaps this is the source of the error below.")}}catch(s){console&&console.error&&console.error(s)}return e}prepareVisitors(){this.listeners={};let e=(t,i,s)=>{this.listeners[i]||(this.listeners[i]=[]),this.listeners[i].push([t,s])};for(let t of this.plugins)if(typeof t=="object")for(let i in t){if(!dd[i]&&/^[A-Z]/.test(i))throw new Error(`Unknown event ${i} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!pd[i])if(typeof t[i]=="object")for(let s in t[i])s==="*"?e(t,i,t[i][s]):e(t,i+"-"+s.toLowerCase(),t[i][s]);else typeof t[i]=="function"&&e(t,i,t[i])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],i=this.runOnRoot(t);if(dt(i))try{await i}catch(s){throw this.handleError(s)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Se];){e[Se]=!0;let t=[Gn(e)];for(;t.length>0;){let i=this.visitTick(t);if(dt(i))try{await i}catch(s){let n=t[t.length-1].node;throw this.handleError(s,n)}}}if(this.listeners.OnceExit)for(let[t,i]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type==="document"){let s=e.nodes.map(n=>i(n,this.helpers));await Promise.all(s)}else await i(e,this.helpers)}catch(s){throw this.handleError(s)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e=="object"&&e.Once){if(this.result.root.type==="document"){let t=this.result.root.nodes.map(i=>e.Once(i,this.helpers));return dt(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e=="function")return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=od;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let s=new nd(t,this.result.root,this.result.opts).generate();return this.result.css=s[0],this.result.map=s[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){let t=this.runOnRoot(e);if(dt(t))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Se];)e[Se]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type==="document")for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return process.env.NODE_ENV!=="production"&&("from"in this.opts||cd("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[i,s]of e){this.result.lastPlugin=i;let n;try{n=s(t,this.helpers)}catch(o){throw this.handleError(o,t.proxyOf)}if(t.type!=="root"&&t.type!=="document"&&!t.parent)return!0;if(dt(n))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:i,visitors:s}=t;if(i.type!=="root"&&i.type!=="document"&&!i.parent){e.pop();return}if(s.length>0&&t.visitorIndex<s.length){let[o,a]=s[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===s.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=o;try{return a(i.toProxy(),this.helpers)}catch(l){throw this.handleError(l,i)}}if(t.iterator!==0){let o=t.iterator,a;for(;a=i.nodes[i.indexes[o]];)if(i.indexes[o]+=1,!a[Se]){a[Se]=!0,e.push(Gn(a));return}t.iterator=0,delete i.indexes[o]}let n=t.events;for(;t.eventIndex<n.length;){let o=n[t.eventIndex];if(t.eventIndex+=1,o===nt){i.nodes&&i.nodes.length&&(i[Se]=!0,t.iterator=i.getIterator());return}else if(this.listeners[o]){t.visitors=this.listeners[o];return}}e.pop()}walkSync(e){e[Se]=!0;let t=qa(e);for(let i of t)if(i===nt)e.nodes&&e.each(s=>{s[Se]||this.walkSync(s)});else{let s=this.listeners[i];if(s&&this.visitSync(s,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};ot.registerPostcss=r=>{Qi=r};var el=ot;ot.default=ot;hd.registerLazyResult(ot);ld.registerLazyResult(ot);let md=Da,gd=Qr,yd=Va,wd=Ws;const bd=Bs;let es=class{constructor(e,t,i){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=i,this._map=void 0;let s,n=gd;this.result=new bd(this._processor,s,this._opts),this.result.css=t;let o=this;Object.defineProperty(this.result,"root",{get(){return o.root}});let a=new md(n,s,this._opts,t);if(a.isMap()){let[l,c]=a.generate();l&&(this.result.css=l),c&&(this.result.map=c)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return process.env.NODE_ENV!=="production"&&("from"in this._opts||yd("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=wd;try{e=t(this._css,this._opts)}catch(i){this.error=i}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}};var vd=es;es.default=es;let Sd=vd,Cd=el,xd=js,Ed=Bt,It=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let i of e)if(i.postcss===!0?i=i():i.postcss&&(i=i.postcss),typeof i=="object"&&Array.isArray(i.plugins))t=t.concat(i.plugins);else if(typeof i=="object"&&i.postcssPlugin)t.push(i);else if(typeof i=="function")t.push(i);else if(typeof i=="object"&&(i.parse||i.stringify)){if(process.env.NODE_ENV!=="production")throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}else throw new Error(i+" is not a PostCSS plugin");return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new Sd(this,e,t):new Cd(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var Ad=It;It.default=It;Ed.registerProcessor(It);xd.registerProcessor(It);let Rd=ti,Md=Ma,kd=ii,Nd=Us,_d=ri,Id=Bt,Dd=zs;function Dt(r,e){if(Array.isArray(r))return r.map(s=>Dt(s));let{inputs:t,...i}=r;if(t){e=[];for(let s of t){let n={...s,__proto__:_d.prototype};n.map&&(n.map={...n.map,__proto__:Md.prototype}),e.push(n)}}if(i.nodes&&(i.nodes=r.nodes.map(s=>Dt(s,e))),i.source){let{inputId:s,...n}=i.source;i.source=n,s!=null&&(i.source.input=e[s])}if(i.type==="root")return new Id(i);if(i.type==="decl")return new Rd(i);if(i.type==="rule")return new Dd(i);if(i.type==="comment")return new kd(i);if(i.type==="atrule")return new Nd(i);throw new Error("Unknown node type: "+r.type)}var Td=Dt;Dt.default=Dt;let Od=Ls,tl=ti,Pd=el,Ld=Ue,Vs=Ad,$d=Qr,Fd=Td,rl=js,jd=Ga,il=ii,sl=Us,Bd=Bs,Ud=ri,zd=Ws,Wd=Ja,nl=zs,ol=Bt,Vd=ei;function U(...r){return r.length===1&&Array.isArray(r[0])&&(r=r[0]),new Vs(r)}U.plugin=function(e,t){let i=!1;function s(...o){console&&console.warn&&!i&&(i=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:
43
+ You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),s}return i.root}var Ws=$r;$r.default=$r;td.registerParse($r);let{isClean:Se,my:sd}=Ft,nd=Da,od=Qr,ad=Ue,ld=Fs,cd=Va,Vn=Bs,ud=Ws,hd=Bt;const fd={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},dd={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},pd={Once:!0,postcssPlugin:!0,prepare:!0},nt=0;function dt(r){return typeof r=="object"&&typeof r.then=="function"}function qa(r){let e=!1,t=fd[r.type];return r.type==="decl"?e=r.prop.toLowerCase():r.type==="atrule"&&(e=r.name.toLowerCase()),e&&r.append?[t,t+"-"+e,nt,t+"Exit",t+"Exit-"+e]:e?[t,t+"-"+e,t+"Exit",t+"Exit-"+e]:r.append?[t,nt,t+"Exit"]:[t,t+"Exit"]}function Gn(r){let e;return r.type==="document"?e=["Document",nt,"DocumentExit"]:r.type==="root"?e=["Root",nt,"RootExit"]:e=qa(r),{eventIndex:0,events:e,iterator:0,node:r,visitorIndex:0,visitors:[]}}function qi(r){return r[Se]=!1,r.nodes&&r.nodes.forEach(e=>qi(e)),r}let Qi={},ot=class Qa{constructor(e,t,i){this.stringified=!1,this.processed=!1;let s;if(typeof t=="object"&&t!==null&&(t.type==="root"||t.type==="document"))s=qi(t);else if(t instanceof Qa||t instanceof Vn)s=qi(t.root),t.map&&(typeof i.map>"u"&&(i.map={}),i.map.inline||(i.map.inline=!1),i.map.prev=t.map);else{let n=ud;i.syntax&&(n=i.syntax.parse),i.parser&&(n=i.parser),n.parse&&(n=n.parse);try{s=n(t,i)}catch(o){this.processed=!0,this.error=o}s&&!s[sd]&&ad.rebuild(s)}this.result=new Vn(e,s,i),this.helpers={...Qi,postcss:Qi,result:this.result},this.plugins=this.processor.plugins.map(n=>typeof n=="object"&&n.prepare?{...n,...n.prepare(this.result)}:n)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let i=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,e.name==="CssSyntaxError"&&!e.plugin)e.plugin=i.postcssPlugin,e.setMessage();else if(i.postcssVersion&&process.env.NODE_ENV!=="production"){let s=i.postcssPlugin,n=i.postcssVersion,o=this.result.processor.version,a=n.split("."),l=o.split(".");(a[0]!==l[0]||parseInt(a[1])>parseInt(l[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+o+", but "+s+" uses "+n+". Perhaps this is the source of the error below.")}}catch(s){console&&console.error&&console.error(s)}return e}prepareVisitors(){this.listeners={};let e=(t,i,s)=>{this.listeners[i]||(this.listeners[i]=[]),this.listeners[i].push([t,s])};for(let t of this.plugins)if(typeof t=="object")for(let i in t){if(!dd[i]&&/^[A-Z]/.test(i))throw new Error(`Unknown event ${i} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!pd[i])if(typeof t[i]=="object")for(let s in t[i])s==="*"?e(t,i,t[i][s]):e(t,i+"-"+s.toLowerCase(),t[i][s]);else typeof t[i]=="function"&&e(t,i,t[i])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],i=this.runOnRoot(t);if(dt(i))try{await i}catch(s){throw this.handleError(s)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Se];){e[Se]=!0;let t=[Gn(e)];for(;t.length>0;){let i=this.visitTick(t);if(dt(i))try{await i}catch(s){let n=t[t.length-1].node;throw this.handleError(s,n)}}}if(this.listeners.OnceExit)for(let[t,i]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type==="document"){let s=e.nodes.map(n=>i(n,this.helpers));await Promise.all(s)}else await i(e,this.helpers)}catch(s){throw this.handleError(s)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e=="object"&&e.Once){if(this.result.root.type==="document"){let t=this.result.root.nodes.map(i=>e.Once(i,this.helpers));return dt(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e=="function")return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=od;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let s=new nd(t,this.result.root,this.result.opts).generate();return this.result.css=s[0],this.result.map=s[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){let t=this.runOnRoot(e);if(dt(t))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Se];)e[Se]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type==="document")for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return process.env.NODE_ENV!=="production"&&("from"in this.opts||cd("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[i,s]of e){this.result.lastPlugin=i;let n;try{n=s(t,this.helpers)}catch(o){throw this.handleError(o,t.proxyOf)}if(t.type!=="root"&&t.type!=="document"&&!t.parent)return!0;if(dt(n))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:i,visitors:s}=t;if(i.type!=="root"&&i.type!=="document"&&!i.parent){e.pop();return}if(s.length>0&&t.visitorIndex<s.length){let[o,a]=s[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===s.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=o;try{return a(i.toProxy(),this.helpers)}catch(l){throw this.handleError(l,i)}}if(t.iterator!==0){let o=t.iterator,a;for(;a=i.nodes[i.indexes[o]];)if(i.indexes[o]+=1,!a[Se]){a[Se]=!0,e.push(Gn(a));return}t.iterator=0,delete i.indexes[o]}let n=t.events;for(;t.eventIndex<n.length;){let o=n[t.eventIndex];if(t.eventIndex+=1,o===nt){i.nodes&&i.nodes.length&&(i[Se]=!0,t.iterator=i.getIterator());return}else if(this.listeners[o]){t.visitors=this.listeners[o];return}}e.pop()}walkSync(e){e[Se]=!0;let t=qa(e);for(let i of t)if(i===nt)e.nodes&&e.each(s=>{s[Se]||this.walkSync(s)});else{let s=this.listeners[i];if(s&&this.visitSync(s,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};ot.registerPostcss=r=>{Qi=r};var el=ot;ot.default=ot;hd.registerLazyResult(ot);ld.registerLazyResult(ot);let md=Da,gd=Qr,yd=Va,wd=Ws;const bd=Bs;let es=class{constructor(e,t,i){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=i,this._map=void 0;let s,n=gd;this.result=new bd(this._processor,s,this._opts),this.result.css=t;let o=this;Object.defineProperty(this.result,"root",{get(){return o.root}});let a=new md(n,s,this._opts,t);if(a.isMap()){let[l,c]=a.generate();l&&(this.result.css=l),c&&(this.result.map=c)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return process.env.NODE_ENV!=="production"&&("from"in this._opts||yd("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=wd;try{e=t(this._css,this._opts)}catch(i){this.error=i}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}};var vd=es;es.default=es;let Sd=vd,Cd=el,xd=Fs,Ed=Bt,It=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let i of e)if(i.postcss===!0?i=i():i.postcss&&(i=i.postcss),typeof i=="object"&&Array.isArray(i.plugins))t=t.concat(i.plugins);else if(typeof i=="object"&&i.postcssPlugin)t.push(i);else if(typeof i=="function")t.push(i);else if(typeof i=="object"&&(i.parse||i.stringify)){if(process.env.NODE_ENV!=="production")throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}else throw new Error(i+" is not a PostCSS plugin");return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new Sd(this,e,t):new Cd(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var Ad=It;It.default=It;Ed.registerProcessor(It);xd.registerProcessor(It);let Rd=ti,kd=ka,Md=ii,Nd=Us,_d=ri,Id=Bt,Dd=zs;function Dt(r,e){if(Array.isArray(r))return r.map(s=>Dt(s));let{inputs:t,...i}=r;if(t){e=[];for(let s of t){let n={...s,__proto__:_d.prototype};n.map&&(n.map={...n.map,__proto__:kd.prototype}),e.push(n)}}if(i.nodes&&(i.nodes=r.nodes.map(s=>Dt(s,e))),i.source){let{inputId:s,...n}=i.source;i.source=n,s!=null&&(i.source.input=e[s])}if(i.type==="root")return new Id(i);if(i.type==="decl")return new Rd(i);if(i.type==="rule")return new Dd(i);if(i.type==="comment")return new Md(i);if(i.type==="atrule")return new Nd(i);throw new Error("Unknown node type: "+r.type)}var Td=Dt;Dt.default=Dt;let Od=Ls,tl=ti,Pd=el,Ld=Ue,Vs=Ad,$d=Qr,jd=Td,rl=Fs,Fd=Ga,il=ii,sl=Us,Bd=Bs,Ud=ri,zd=Ws,Wd=Ja,nl=zs,ol=Bt,Vd=ei;function U(...r){return r.length===1&&Array.isArray(r[0])&&(r=r[0]),new Vs(r)}U.plugin=function(e,t){let i=!1;function s(...o){console&&console.warn&&!i&&(i=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:
44
44
  https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+`: 里面 postcss.plugin 被弃用. 迁移指南:
45
- https://www.w3ctech.com/topic/2226`));let a=t(...o);return a.postcssPlugin=e,a.postcssVersion=new Vs().version,a}let n;return Object.defineProperty(s,"postcss",{get(){return n||(n=s()),n}}),s.process=function(o,a,l){return U([s(l)]).process(o,a)},s};U.stringify=$d;U.parse=zd;U.fromJSON=Fd;U.list=Wd;U.comment=r=>new il(r);U.atRule=r=>new sl(r);U.decl=r=>new tl(r);U.rule=r=>new nl(r);U.root=r=>new ol(r);U.document=r=>new rl(r);U.CssSyntaxError=Od;U.Declaration=tl;U.Container=Ld;U.Processor=Vs;U.Document=rl;U.Comment=il;U.Warning=jd;U.AtRule=sl;U.Result=Bd;U.Input=Ud;U.Rule=nl;U.Root=ol;U.Node=Vd;Pd.registerPostcss(U);var Gd=U;U.default=U;const Z=tf(Gd);Z.stringify;Z.fromJSON;Z.plugin;Z.parse;Z.list;Z.document;Z.comment;Z.atRule;Z.rule;Z.decl;Z.root;Z.CssSyntaxError;Z.Declaration;Z.Container;Z.Processor;Z.Document;Z.Comment;Z.Warning;Z.AtRule;Z.Result;Z.Input;Z.Rule;Z.Root;Z.Node;const Yn={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};function Yd(r){let e=Yn[r.tagName]?Yn[r.tagName]:r.tagName;return e==="link"&&r.attributes._cssText&&(e="style"),e}function si(r,e){const t=e?.stylesWithHoverClass.get(r);if(t)return t;let i=r;try{i=Z([Qh,ef]).process(r).css}catch(s){console.warn("Failed to adapt css for replay",s)}return e?.stylesWithHoverClass.set(r,i),i}function Hn(){return{stylesWithHoverClass:new Map}}function Hd(r,e,t,i){const s=[];for(const l of r.childNodes)l.type===Q.Text&&s.push(l);const n=e.split("/* rr_split */");for(;n.length>1&&n.length>s.length;)n.splice(-2,2,n.slice(-2).join(""));let o="";t&&(o=si(n.join(""),i));let a=0;for(let l=0;l<s.length&&l!==n.length;l++){const c=s[l];if(!t)c.textContent=n[l];else if(l<n.length-1){let u=a,h=n[l+1].length;h=Math.min(h,30);let f=!1;for(;h>2;h--){const d=n[l+1].substring(0,h),m=o.substring(a).indexOf(d);if(f=m!==-1,f){u+=m;break}}f||(u+=n[l].length),c.textContent=o.substring(a,u),a=u}else c.textContent=o.substring(a)}}function Zd(r,e,t,i){const{doc:s,hackCss:n,cache:o}=i;r.childNodes.length?Hd(r,t,n,o):(n&&(t=si(t,o)),e.appendChild(s.createTextNode(t)))}function Xd(r,e){var t;const{doc:i,hackCss:s,cache:n}=e;switch(r.type){case Q.Document:return i.implementation.createDocument(null,"",null);case Q.DocumentType:return i.implementation.createDocumentType(r.name||"html",r.publicId,r.systemId);case Q.Element:{const o=Yd(r);let a;r.isSVG?a=i.createElementNS("http://www.w3.org/2000/svg",o):(r.isCustom&&((t=i.defaultView)!=null&&t.customElements)&&!i.defaultView.customElements.get(r.tagName)&&i.defaultView.customElements.define(r.tagName,class extends i.defaultView.HTMLElement{}),a=i.createElement(o));const l={};for(const c in r.attributes){if(!Object.prototype.hasOwnProperty.call(r.attributes,c))continue;let u=r.attributes[c];if(!(o==="option"&&c==="selected"&&u===!1)&&u!==null){if(u===!0&&(u=""),c.startsWith("rr_")){l[c]=u;continue}if(typeof u=="string"){if(o==="style"&&c==="_cssText"){Zd(r,a,u,e);continue}else if(o==="textarea"&&c==="value"){a.appendChild(i.createTextNode(u)),r.childNodes=[];continue}}try{if(r.isSVG&&c==="xlink:href")a.setAttributeNS("http://www.w3.org/1999/xlink",c,u.toString());else if(c==="onload"||c==="onclick"||c.substring(0,7)==="onmouse")a.setAttribute("_"+c,u.toString());else if(o==="meta"&&r.attributes["http-equiv"]==="Content-Security-Policy"&&c==="content"){a.setAttribute("csp-content",u.toString());continue}else o==="link"&&(r.attributes.rel==="preload"&&r.attributes.as==="script"||r.attributes.rel==="modulepreload")||o==="link"&&r.attributes.rel==="prefetch"&&typeof r.attributes.href=="string"&&Kh(r.attributes.href)==="js"||(o==="img"&&r.attributes.srcset&&r.attributes.rr_dataURL?a.setAttribute("rrweb-original-srcset",r.attributes.srcset):a.setAttribute(c,u.toString()))}catch{}}}for(const c in l){const u=l[c];if(o==="canvas"&&c==="rr_dataURL"){const h=i.createElement("img");h.onload=()=>{const f=a.getContext("2d");f&&f.drawImage(h,0,0,h.width,h.height)},h.src=u.toString(),a.RRNodeType&&(a.rr_dataURL=u.toString())}else if(o==="img"&&c==="rr_dataURL"){const h=a;h.currentSrc.startsWith("data:")||(h.setAttribute("rrweb-original-src",r.attributes.src),h.src=u.toString())}if(c==="rr_width")a.style.setProperty("width",u.toString());else if(c==="rr_height")a.style.setProperty("height",u.toString());else if(c==="rr_mediaCurrentTime"&&typeof u=="number")a.currentTime=u;else if(c==="rr_mediaState")switch(u){case"played":a.play().catch(h=>console.warn("media playback error",h));break;case"paused":a.pause();break}else c==="rr_mediaPlaybackRate"&&typeof u=="number"?a.playbackRate=u:c==="rr_mediaMuted"&&typeof u=="boolean"?a.muted=u:c==="rr_mediaLoop"&&typeof u=="boolean"?a.loop=u:c==="rr_mediaVolume"&&typeof u=="number"?a.volume=u:c==="rr_open_mode"&&a.setAttribute("rr_open_mode",u)}if(r.isShadowHost)if(!a.shadowRoot)a.attachShadow({mode:"open"});else for(;a.shadowRoot.firstChild;)a.shadowRoot.removeChild(a.shadowRoot.firstChild);return a}case Q.Text:return r.isStyle&&s?i.createTextNode(si(r.textContent,n)):i.createTextNode(r.textContent);case Q.CDATA:return i.createCDATASection(r.textContent);case Q.Comment:return i.createComment(r.textContent);default:return null}}function St(r,e){const{doc:t,mirror:i,skipChild:s=!1,hackCss:n=!0,afterAppend:o,cache:a}=e;if(i.has(r.id)){const c=i.getNode(r.id),u=i.getMeta(c);if(Jh(u,r))return i.getNode(r.id)}let l=Xd(r,{doc:t,hackCss:n,cache:a});if(!l)return null;if(r.rootId&&i.getNode(r.rootId)!==t&&i.replace(r.rootId,t),r.type===Q.Document&&(t.close(),t.open(),r.compatMode==="BackCompat"&&r.childNodes&&r.childNodes[0].type!==Q.DocumentType&&(r.childNodes[0].type===Q.Element&&"xmlns"in r.childNodes[0].attributes&&r.childNodes[0].attributes.xmlns==="http://www.w3.org/1999/xhtml"?t.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):t.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),l=t),i.add(l,r),(r.type===Q.Document||r.type===Q.Element)&&!s)for(const c of r.childNodes){const u=St(c,{doc:t,mirror:i,skipChild:!1,hackCss:n,afterAppend:o,cache:a});if(!u){console.warn("Failed to rebuild",c);continue}if(c.isShadow&&Zh(l)&&l.shadowRoot)l.shadowRoot.appendChild(u);else if(r.type===Q.Document&&c.type==Q.Element){const h=u;let f=null;h.childNodes.forEach(d=>{d.nodeName==="BODY"&&(f=d)}),f?(h.removeChild(f),l.appendChild(u),h.appendChild(f)):l.appendChild(u)}else l.appendChild(u);o&&o(u,c.id)}return l}function Jd(r,e){function t(i){e(i)}for(const i of r.getIds())r.has(i)&&t(r.getNode(i))}function Kd(r,e){const t=e.getMeta(r);if(t?.type!==Q.Element)return;const i=r;for(const s in t.attributes){if(!(Object.prototype.hasOwnProperty.call(t.attributes,s)&&s.startsWith("rr_")))continue;const n=t.attributes[s];s==="rr_scrollLeft"&&(i.scrollLeft=n),s==="rr_scrollTop"&&(i.scrollTop=n)}}function qd(r,e){const{doc:t,onVisit:i,hackCss:s=!0,afterAppend:n,cache:o,mirror:a=new Ca}=e,l=St(r,{doc:t,mirror:a,skipChild:!1,hackCss:s,afterAppend:n,cache:o});return Jd(a,c=>{i&&i(c),Kd(c,a)}),l}var Qd=Object.defineProperty,ep=(r,e,t)=>e in r?Qd(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,E=(r,e,t)=>ep(r,typeof e!="symbol"?e+"":e,t),tp=Object.defineProperty,rp=(r,e,t)=>e in r?tp(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Zn=(r,e,t)=>rp(r,typeof e!="symbol"?e+"":e,t);let ip=class{constructor(){Zn(this,"idNodeMap",new Map),Zn(this,"nodeMetaMap",new WeakMap)}getId(e){var t;return e?((t=this.getMeta(e))==null?void 0:t.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(i=>this.removeNodeFromMap(i))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const i=t.id;this.idNodeMap.set(i,e),this.nodeMetaMap.set(e,t)}replace(e,t){const i=this.getNode(e);if(i){const s=this.nodeMetaMap.get(i);s&&this.nodeMetaMap.set(t,s)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function sp(){return new ip}function np(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function op(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function i(){return this instanceof i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:function(){return r[i]}})}),t}var Gs={exports:{}},Y=String,al=function(){return{isColorSupported:!1,reset:Y,bold:Y,dim:Y,italic:Y,underline:Y,inverse:Y,hidden:Y,strikethrough:Y,black:Y,red:Y,green:Y,yellow:Y,blue:Y,magenta:Y,cyan:Y,white:Y,gray:Y,bgBlack:Y,bgRed:Y,bgGreen:Y,bgYellow:Y,bgBlue:Y,bgMagenta:Y,bgCyan:Y,bgWhite:Y}};Gs.exports=al();Gs.exports.createColors=al;var ap=Gs.exports;const lp={},cp=Object.freeze(Object.defineProperty({__proto__:null,default:lp},Symbol.toStringTag,{value:"Module"})),ye=op(cp);let Xn=ap,Jn=ye,ts=class ll extends Error{constructor(e,t,i,s,n,o){super(e),this.name="CssSyntaxError",this.reason=e,n&&(this.file=n),s&&(this.source=s),o&&(this.plugin=o),typeof t<"u"&&typeof i<"u"&&(typeof t=="number"?(this.line=t,this.column=i):(this.line=t.line,this.column=t.column,this.endLine=i.line,this.endColumn=i.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,ll)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;e==null&&(e=Xn.isColorSupported),Jn&&e&&(t=Jn(t));let i=t.split(/\r?\n/),s=Math.max(this.line-3,0),n=Math.min(this.line+2,i.length),o=String(n).length,a,l;if(e){let{bold:c,gray:u,red:h}=Xn.createColors(!0);a=f=>c(h(f)),l=f=>u(f)}else a=l=c=>c;return i.slice(s,n).map((c,u)=>{let h=s+1+u,f=" "+(" "+h).slice(-o)+" | ";if(h===this.line){let d=l(f.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return a(">")+l(f)+c+`
45
+ https://www.w3ctech.com/topic/2226`));let a=t(...o);return a.postcssPlugin=e,a.postcssVersion=new Vs().version,a}let n;return Object.defineProperty(s,"postcss",{get(){return n||(n=s()),n}}),s.process=function(o,a,l){return U([s(l)]).process(o,a)},s};U.stringify=$d;U.parse=zd;U.fromJSON=jd;U.list=Wd;U.comment=r=>new il(r);U.atRule=r=>new sl(r);U.decl=r=>new tl(r);U.rule=r=>new nl(r);U.root=r=>new ol(r);U.document=r=>new rl(r);U.CssSyntaxError=Od;U.Declaration=tl;U.Container=Ld;U.Processor=Vs;U.Document=rl;U.Comment=il;U.Warning=Fd;U.AtRule=sl;U.Result=Bd;U.Input=Ud;U.Rule=nl;U.Root=ol;U.Node=Vd;Pd.registerPostcss(U);var Gd=U;U.default=U;const Z=tf(Gd);Z.stringify;Z.fromJSON;Z.plugin;Z.parse;Z.list;Z.document;Z.comment;Z.atRule;Z.rule;Z.decl;Z.root;Z.CssSyntaxError;Z.Declaration;Z.Container;Z.Processor;Z.Document;Z.Comment;Z.Warning;Z.AtRule;Z.Result;Z.Input;Z.Rule;Z.Root;Z.Node;const Yn={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};function Yd(r){let e=Yn[r.tagName]?Yn[r.tagName]:r.tagName;return e==="link"&&r.attributes._cssText&&(e="style"),e}function si(r,e){const t=e?.stylesWithHoverClass.get(r);if(t)return t;let i=r;try{i=Z([Qh,ef]).process(r).css}catch(s){console.warn("Failed to adapt css for replay",s)}return e?.stylesWithHoverClass.set(r,i),i}function Hn(){return{stylesWithHoverClass:new Map}}function Hd(r,e,t,i){const s=[];for(const l of r.childNodes)l.type===Q.Text&&s.push(l);const n=e.split("/* rr_split */");for(;n.length>1&&n.length>s.length;)n.splice(-2,2,n.slice(-2).join(""));let o="";t&&(o=si(n.join(""),i));let a=0;for(let l=0;l<s.length&&l!==n.length;l++){const c=s[l];if(!t)c.textContent=n[l];else if(l<n.length-1){let u=a,h=n[l+1].length;h=Math.min(h,30);let f=!1;for(;h>2;h--){const d=n[l+1].substring(0,h),g=o.substring(a).indexOf(d);if(f=g!==-1,f){u+=g;break}}f||(u+=n[l].length),c.textContent=o.substring(a,u),a=u}else c.textContent=o.substring(a)}}function Zd(r,e,t,i){const{doc:s,hackCss:n,cache:o}=i;r.childNodes.length?Hd(r,t,n,o):(n&&(t=si(t,o)),e.appendChild(s.createTextNode(t)))}function Xd(r,e){var t;const{doc:i,hackCss:s,cache:n}=e;switch(r.type){case Q.Document:return i.implementation.createDocument(null,"",null);case Q.DocumentType:return i.implementation.createDocumentType(r.name||"html",r.publicId,r.systemId);case Q.Element:{const o=Yd(r);let a;r.isSVG?a=i.createElementNS("http://www.w3.org/2000/svg",o):(r.isCustom&&((t=i.defaultView)!=null&&t.customElements)&&!i.defaultView.customElements.get(r.tagName)&&i.defaultView.customElements.define(r.tagName,class extends i.defaultView.HTMLElement{}),a=i.createElement(o));const l={};for(const c in r.attributes){if(!Object.prototype.hasOwnProperty.call(r.attributes,c))continue;let u=r.attributes[c];if(!(o==="option"&&c==="selected"&&u===!1)&&u!==null){if(u===!0&&(u=""),c.startsWith("rr_")){l[c]=u;continue}if(typeof u=="string"){if(o==="style"&&c==="_cssText"){Zd(r,a,u,e);continue}else if(o==="textarea"&&c==="value"){a.appendChild(i.createTextNode(u)),r.childNodes=[];continue}}try{if(r.isSVG&&c==="xlink:href")a.setAttributeNS("http://www.w3.org/1999/xlink",c,u.toString());else if(c==="onload"||c==="onclick"||c.substring(0,7)==="onmouse")a.setAttribute("_"+c,u.toString());else if(o==="meta"&&r.attributes["http-equiv"]==="Content-Security-Policy"&&c==="content"){a.setAttribute("csp-content",u.toString());continue}else o==="link"&&(r.attributes.rel==="preload"&&r.attributes.as==="script"||r.attributes.rel==="modulepreload")||o==="link"&&r.attributes.rel==="prefetch"&&typeof r.attributes.href=="string"&&Kh(r.attributes.href)==="js"||(o==="img"&&r.attributes.srcset&&r.attributes.rr_dataURL?a.setAttribute("rrweb-original-srcset",r.attributes.srcset):a.setAttribute(c,u.toString()))}catch{}}}for(const c in l){const u=l[c];if(o==="canvas"&&c==="rr_dataURL"){const h=i.createElement("img");h.onload=()=>{const f=a.getContext("2d");f&&f.drawImage(h,0,0,h.width,h.height)},h.src=u.toString(),a.RRNodeType&&(a.rr_dataURL=u.toString())}else if(o==="img"&&c==="rr_dataURL"){const h=a;h.currentSrc.startsWith("data:")||(h.setAttribute("rrweb-original-src",r.attributes.src),h.src=u.toString())}if(c==="rr_width")a.style.setProperty("width",u.toString());else if(c==="rr_height")a.style.setProperty("height",u.toString());else if(c==="rr_mediaCurrentTime"&&typeof u=="number")a.currentTime=u;else if(c==="rr_mediaState")switch(u){case"played":a.play().catch(h=>console.warn("media playback error",h));break;case"paused":a.pause();break}else c==="rr_mediaPlaybackRate"&&typeof u=="number"?a.playbackRate=u:c==="rr_mediaMuted"&&typeof u=="boolean"?a.muted=u:c==="rr_mediaLoop"&&typeof u=="boolean"?a.loop=u:c==="rr_mediaVolume"&&typeof u=="number"?a.volume=u:c==="rr_open_mode"&&a.setAttribute("rr_open_mode",u)}if(r.isShadowHost)if(!a.shadowRoot)a.attachShadow({mode:"open"});else for(;a.shadowRoot.firstChild;)a.shadowRoot.removeChild(a.shadowRoot.firstChild);return a}case Q.Text:return r.isStyle&&s?i.createTextNode(si(r.textContent,n)):i.createTextNode(r.textContent);case Q.CDATA:return i.createCDATASection(r.textContent);case Q.Comment:return i.createComment(r.textContent);default:return null}}function St(r,e){const{doc:t,mirror:i,skipChild:s=!1,hackCss:n=!0,afterAppend:o,cache:a}=e;if(i.has(r.id)){const c=i.getNode(r.id),u=i.getMeta(c);if(Jh(u,r))return i.getNode(r.id)}let l=Xd(r,{doc:t,hackCss:n,cache:a});if(!l)return null;if(r.rootId&&i.getNode(r.rootId)!==t&&i.replace(r.rootId,t),r.type===Q.Document&&(t.close(),t.open(),r.compatMode==="BackCompat"&&r.childNodes&&r.childNodes[0].type!==Q.DocumentType&&(r.childNodes[0].type===Q.Element&&"xmlns"in r.childNodes[0].attributes&&r.childNodes[0].attributes.xmlns==="http://www.w3.org/1999/xhtml"?t.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):t.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),l=t),i.add(l,r),(r.type===Q.Document||r.type===Q.Element)&&!s)for(const c of r.childNodes){const u=St(c,{doc:t,mirror:i,skipChild:!1,hackCss:n,afterAppend:o,cache:a});if(!u){console.warn("Failed to rebuild",c);continue}if(c.isShadow&&Zh(l)&&l.shadowRoot)l.shadowRoot.appendChild(u);else if(r.type===Q.Document&&c.type==Q.Element){const h=u;let f=null;h.childNodes.forEach(d=>{d.nodeName==="BODY"&&(f=d)}),f?(h.removeChild(f),l.appendChild(u),h.appendChild(f)):l.appendChild(u)}else l.appendChild(u);o&&o(u,c.id)}return l}function Jd(r,e){function t(i){e(i)}for(const i of r.getIds())r.has(i)&&t(r.getNode(i))}function Kd(r,e){const t=e.getMeta(r);if(t?.type!==Q.Element)return;const i=r;for(const s in t.attributes){if(!(Object.prototype.hasOwnProperty.call(t.attributes,s)&&s.startsWith("rr_")))continue;const n=t.attributes[s];s==="rr_scrollLeft"&&(i.scrollLeft=n),s==="rr_scrollTop"&&(i.scrollTop=n)}}function qd(r,e){const{doc:t,onVisit:i,hackCss:s=!0,afterAppend:n,cache:o,mirror:a=new Ca}=e,l=St(r,{doc:t,mirror:a,skipChild:!1,hackCss:s,afterAppend:n,cache:o});return Jd(a,c=>{i&&i(c),Kd(c,a)}),l}var Qd=Object.defineProperty,ep=(r,e,t)=>e in r?Qd(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,E=(r,e,t)=>ep(r,typeof e!="symbol"?e+"":e,t),tp=Object.defineProperty,rp=(r,e,t)=>e in r?tp(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Zn=(r,e,t)=>rp(r,typeof e!="symbol"?e+"":e,t);let ip=class{constructor(){Zn(this,"idNodeMap",new Map),Zn(this,"nodeMetaMap",new WeakMap)}getId(e){var t;return e?((t=this.getMeta(e))==null?void 0:t.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(i=>this.removeNodeFromMap(i))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const i=t.id;this.idNodeMap.set(i,e),this.nodeMetaMap.set(e,t)}replace(e,t){const i=this.getNode(e);if(i){const s=this.nodeMetaMap.get(i);s&&this.nodeMetaMap.set(t,s)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function sp(){return new ip}function np(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function op(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function i(){return this instanceof i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:function(){return r[i]}})}),t}var Gs={exports:{}},Y=String,al=function(){return{isColorSupported:!1,reset:Y,bold:Y,dim:Y,italic:Y,underline:Y,inverse:Y,hidden:Y,strikethrough:Y,black:Y,red:Y,green:Y,yellow:Y,blue:Y,magenta:Y,cyan:Y,white:Y,gray:Y,bgBlack:Y,bgRed:Y,bgGreen:Y,bgYellow:Y,bgBlue:Y,bgMagenta:Y,bgCyan:Y,bgWhite:Y}};Gs.exports=al();Gs.exports.createColors=al;var ap=Gs.exports;const lp={},cp=Object.freeze(Object.defineProperty({__proto__:null,default:lp},Symbol.toStringTag,{value:"Module"})),ye=op(cp);let Xn=ap,Jn=ye,ts=class ll extends Error{constructor(e,t,i,s,n,o){super(e),this.name="CssSyntaxError",this.reason=e,n&&(this.file=n),s&&(this.source=s),o&&(this.plugin=o),typeof t<"u"&&typeof i<"u"&&(typeof t=="number"?(this.line=t,this.column=i):(this.line=t.line,this.column=t.column,this.endLine=i.line,this.endColumn=i.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,ll)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;e==null&&(e=Xn.isColorSupported),Jn&&e&&(t=Jn(t));let i=t.split(/\r?\n/),s=Math.max(this.line-3,0),n=Math.min(this.line+2,i.length),o=String(n).length,a,l;if(e){let{bold:c,gray:u,red:h}=Xn.createColors(!0);a=f=>c(h(f)),l=f=>u(f)}else a=l=c=>c;return i.slice(s,n).map((c,u)=>{let h=s+1+u,f=" "+(" "+h).slice(-o)+" | ";if(h===this.line){let d=l(f.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return a(">")+l(f)+c+`
46
46
  `+d+a("^")}return" "+l(f)+c}).join(`
47
47
  `)}toString(){let e=this.showSourceCode();return e&&(e=`
48
48
 
@@ -59,20 +59,20 @@ https://www.w3ctech.com/topic/2226`));let a=t(...o);return a.postcssPlugin=e,a.p
59
59
  `)&&(i=i.replace(/[^\n]+$/,"")),!1}),typeof i>"u"?i=this.raw(t,null,"beforeRule"):i&&(i=i.replace(/\S/g,"")),i}rawBeforeOpen(e){let t;return e.walk(i=>{if(i.type!=="decl"&&(t=i.raws.between,typeof t<"u"))return!1}),t}rawBeforeRule(e){let t;return e.walk(i=>{if(i.nodes&&(i.parent!==e||e.first!==i)&&typeof i.raws.before<"u")return t=i.raws.before,t.includes(`
60
60
  `)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(i=>{if(typeof i.raws.between<"u")return t=i.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(i=>{if(i.nodes&&i.nodes.length===0&&(t=i.raws.after,typeof t<"u"))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(i=>{let s=i.parent;if(s&&s!==e&&s.parent&&s.parent===e&&typeof i.raws.before<"u"){let n=i.raws.before.split(`
61
61
  `);return t=n[n.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(i=>{if(i.nodes&&i.nodes.length&&i.last.type==="decl"&&(t=i.raws.semicolon,typeof t<"u"))return!1}),t}rawValue(e,t){let i=e[t],s=e.raws[t];return s&&s.value===i?s.raw:i}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}};var cl=rs;rs.default=rs;let hp=cl;function is(r,e){new hp(e).stringify(r)}var ni=is;is.default=is;let{isClean:nr,my:fp}=Ut,dp=Ys,pp=cl,mp=ni;function ss(r,e){let t=new r.constructor;for(let i in r){if(!Object.prototype.hasOwnProperty.call(r,i)||i==="proxyCache")continue;let s=r[i],n=typeof s;i==="parent"&&n==="object"?e&&(t[i]=e):i==="source"?t[i]=s:Array.isArray(s)?t[i]=s.map(o=>ss(o,t)):(n==="object"&&s!==null&&(s=ss(s)),t[i]=s)}return t}let ns=class{constructor(e={}){this.raws={},this[nr]=!1,this[fp]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let i of e[t])typeof i.clone=="function"?this.append(i.clone()):this.append(i)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=ss(this);for(let i in e)t[i]=e[i];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:i,start:s}=this.rangeBy(t);return this.source.input.error(e,{column:s.column,line:s.line},{column:i.column,line:i.line},t)}return new dp(e)}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t]},set(e,t,i){return e[t]===i||(e[t]=i,(t==="prop"||t==="value"||t==="name"||t==="params"||t==="important"||t==="text")&&e.markDirty()),!0}}}markDirty(){if(this[nr]){this[nr]=!1;let e=this;for(;e=e.parent;)e[nr]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let i=this.source.start;if(e.index)i=this.positionInside(e.index,t);else if(e.word){t=this.toString();let s=t.indexOf(e.word);s!==-1&&(i=this.positionInside(s,t))}return i}positionInside(e,t){let i=t||this.toString(),s=this.source.start.column,n=this.source.start.line;for(let o=0;o<e;o++)i[o]===`
62
- `?(s=1,n+=1):s+=1;return{column:s,line:n}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},i=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let s=this.toString(),n=s.indexOf(e.word);n!==-1&&(t=this.positionInside(n,s),i=this.positionInside(n+e.word.length,s))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?i={column:e.end.column,line:e.end.line}:typeof e.endIndex=="number"?i=this.positionInside(e.endIndex):e.index&&(i=this.positionInside(e.index+1));return(i.line<t.line||i.line===t.line&&i.column<=t.column)&&(i={column:t.column+1,line:t.line}),{end:i,start:t}}raw(e,t){return new pp().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,i=!1;for(let s of e)s===this?i=!0:i?(this.parent.insertAfter(t,s),t=s):this.parent.insertBefore(t,s);i||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let i={},s=t==null;t=t||new Map;let n=0;for(let o in this){if(!Object.prototype.hasOwnProperty.call(this,o)||o==="parent"||o==="proxyCache")continue;let a=this[o];if(Array.isArray(a))i[o]=a.map(l=>typeof l=="object"&&l.toJSON?l.toJSON(null,t):l);else if(typeof a=="object"&&a.toJSON)i[o]=a.toJSON(null,t);else if(o==="source"){let l=t.get(a.input);l==null&&(l=n,t.set(a.input,n),n++),i[o]={end:a.end,inputId:l,start:a.start}}else i[o]=a}return s&&(i.inputs=[...t.keys()].map(o=>o.toJSON())),i}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=mp){e.stringify&&(e=e.stringify);let t="";return e(this,i=>{t+=i}),t}warn(e,t,i){let s={node:this};for(let n in i)s[n]=i[n];return e.warn(t,s)}get proxyOf(){return this}};var oi=ns;ns.default=ns;let gp=oi,os=class extends gp{constructor(e){e&&typeof e.value<"u"&&typeof e.value!="string"&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}};var ai=os;os.default=os;let yp="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",wp=(r=21)=>{let e="",t=r;for(;t--;)e+=yp[Math.random()*64|0];return e};var bp={nanoid:wp};let{SourceMapConsumer:qn,SourceMapGenerator:Qn}=ye,{existsSync:vp,readFileSync:Sp}=ye,{dirname:bi,join:Cp}=ye;function xp(r){return Buffer?Buffer.from(r,"base64").toString():window.atob(r)}let as=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let i=t.map?t.map.prev:void 0,s=this.loadMap(t.from,i);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=bi(this.mapFile)),s&&(this.text=s)}consumer(){return this.consumerCache||(this.consumerCache=new qn(this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\/json;charset=utf-?8;base64,/,i=/^data:application\/json;base64,/,s=/^data:application\/json;charset=utf-?8,/,n=/^data:application\/json,/;if(s.test(e)||n.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(t.test(e)||i.test(e))return xp(e.substr(RegExp.lastMatch.length));let o=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+o)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e!="object"?!1:typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let i=e.lastIndexOf(t.pop()),s=e.indexOf("*/",i);i>-1&&s>-1&&(this.annotation=this.getAnnotationURL(e.substring(i,s)))}loadFile(e){if(this.root=bi(e),vp(e))return this.mapFile=e,Sp(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let i=t(e);if(i){let s=this.loadFile(i);if(!s)throw new Error("Unable to load previous source map: "+i.toString());return s}}else{if(t instanceof qn)return Qn.fromSourceMap(t).toString();if(t instanceof Qn)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let i=this.annotation;return e&&(i=Cp(bi(e),i)),this.loadFile(i)}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};var ul=as;as.default=as;let{SourceMapConsumer:Ep,SourceMapGenerator:Ap}=ye,{fileURLToPath:eo,pathToFileURL:or}=ye,{isAbsolute:ls,resolve:cs}=ye,{nanoid:Rp}=bp,vi=ye,to=Ys,Mp=ul,Si=Symbol("fromOffsetCache"),kp=!!(Ep&&Ap),ro=!!(cs&&ls),Fr=class{constructor(e,t={}){if(e===null||typeof e>"u"||typeof e=="object"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]==="\uFEFF"||this.css[0]==="￾"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!ro||/^\w+:\/\//.test(t.from)||ls(t.from)?this.file=t.from:this.file=cs(t.from)),ro&&kp){let i=new Mp(this.css,t);if(i.text){this.map=i;let s=i.consumer().file;!this.file&&s&&(this.file=this.mapResolve(s))}}this.file||(this.id="<input css "+Rp(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,i,s={}){let n,o,a;if(t&&typeof t=="object"){let c=t,u=i;if(typeof c.offset=="number"){let h=this.fromOffset(c.offset);t=h.line,i=h.col}else t=c.line,i=c.column;if(typeof u.offset=="number"){let h=this.fromOffset(u.offset);o=h.line,a=h.col}else o=u.line,a=u.column}else if(!i){let c=this.fromOffset(t);t=c.line,i=c.col}let l=this.origin(t,i,o,a);return l?n=new to(e,l.endLine===void 0?l.line:{column:l.column,line:l.line},l.endLine===void 0?l.column:{column:l.endColumn,line:l.endLine},l.source,l.file,s.plugin):n=new to(e,o===void 0?t:{column:i,line:t},o===void 0?i:{column:a,line:o},this.css,this.file,s.plugin),n.input={column:i,endColumn:a,endLine:o,line:t,source:this.css},this.file&&(or&&(n.input.url=or(this.file).toString()),n.input.file=this.file),n}fromOffset(e){let t,i;if(this[Si])i=this[Si];else{let n=this.css.split(`
63
- `);i=new Array(n.length);let o=0;for(let a=0,l=n.length;a<l;a++)i[a]=o,o+=n[a].length+1;this[Si]=i}t=i[i.length-1];let s=0;if(e>=t)s=i.length-1;else{let n=i.length-2,o;for(;s<n;)if(o=s+(n-s>>1),e<i[o])n=o-1;else if(e>=i[o+1])s=o+1;else{s=o;break}}return{col:e-i[s]+1,line:s+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:cs(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,i,s){if(!this.map)return!1;let n=this.map.consumer(),o=n.originalPositionFor({column:t,line:e});if(!o.source)return!1;let a;typeof i=="number"&&(a=n.originalPositionFor({column:s,line:i}));let l;ls(o.source)?l=or(o.source):l=new URL(o.source,this.map.consumer().sourceRoot||or(this.map.mapFile));let c={column:o.column,endColumn:a&&a.column,endLine:a&&a.line,line:o.line,url:l.toString()};if(l.protocol==="file:")if(eo)c.file=eo(l);else throw new Error("file: protocol is not available in this PostCSS build");let u=n.sourceContentFor(o.source);return u&&(c.source=u),c}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}};var li=Fr;Fr.default=Fr;vi&&vi.registerInput&&vi.registerInput(Fr);let{SourceMapConsumer:hl,SourceMapGenerator:kr}=ye,{dirname:Nr,relative:fl,resolve:dl,sep:pl}=ye,{pathToFileURL:io}=ye,Np=li,_p=!!(hl&&kr),Ip=!!(Nr&&dl&&fl&&pl),Dp=class{constructor(e,t,i,s){this.stringify=e,this.mapOpts=i.map||{},this.root=t,this.opts=i,this.css=s,this.originalCSS=s,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;this.isInline()?e="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?e=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?e=this.mapOpts.annotation(this.opts.to,this.root):e=this.outputFile()+".map";let t=`
62
+ `?(s=1,n+=1):s+=1;return{column:s,line:n}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},i=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let s=this.toString(),n=s.indexOf(e.word);n!==-1&&(t=this.positionInside(n,s),i=this.positionInside(n+e.word.length,s))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?i={column:e.end.column,line:e.end.line}:typeof e.endIndex=="number"?i=this.positionInside(e.endIndex):e.index&&(i=this.positionInside(e.index+1));return(i.line<t.line||i.line===t.line&&i.column<=t.column)&&(i={column:t.column+1,line:t.line}),{end:i,start:t}}raw(e,t){return new pp().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,i=!1;for(let s of e)s===this?i=!0:i?(this.parent.insertAfter(t,s),t=s):this.parent.insertBefore(t,s);i||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let i={},s=t==null;t=t||new Map;let n=0;for(let o in this){if(!Object.prototype.hasOwnProperty.call(this,o)||o==="parent"||o==="proxyCache")continue;let a=this[o];if(Array.isArray(a))i[o]=a.map(l=>typeof l=="object"&&l.toJSON?l.toJSON(null,t):l);else if(typeof a=="object"&&a.toJSON)i[o]=a.toJSON(null,t);else if(o==="source"){let l=t.get(a.input);l==null&&(l=n,t.set(a.input,n),n++),i[o]={end:a.end,inputId:l,start:a.start}}else i[o]=a}return s&&(i.inputs=[...t.keys()].map(o=>o.toJSON())),i}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=mp){e.stringify&&(e=e.stringify);let t="";return e(this,i=>{t+=i}),t}warn(e,t,i){let s={node:this};for(let n in i)s[n]=i[n];return e.warn(t,s)}get proxyOf(){return this}};var oi=ns;ns.default=ns;let gp=oi,os=class extends gp{constructor(e){e&&typeof e.value<"u"&&typeof e.value!="string"&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}};var ai=os;os.default=os;let yp="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",wp=(r=21)=>{let e="",t=r;for(;t--;)e+=yp[Math.random()*64|0];return e};var bp={nanoid:wp};let{SourceMapConsumer:qn,SourceMapGenerator:Qn}=ye,{existsSync:vp,readFileSync:Sp}=ye,{dirname:bi,join:Cp}=ye;function xp(r){return Buffer?Buffer.from(r,"base64").toString():window.atob(r)}let as=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let i=t.map?t.map.prev:void 0,s=this.loadMap(t.from,i);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=bi(this.mapFile)),s&&(this.text=s)}consumer(){return this.consumerCache||(this.consumerCache=new qn(this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\/json;charset=utf-?8;base64,/,i=/^data:application\/json;base64,/,s=/^data:application\/json;charset=utf-?8,/,n=/^data:application\/json,/;if(s.test(e)||n.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(t.test(e)||i.test(e))return xp(e.substr(RegExp.lastMatch.length));let o=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+o)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e!="object"?!1:typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let i=e.lastIndexOf(t.pop()),s=e.indexOf("*/",i);i>-1&&s>-1&&(this.annotation=this.getAnnotationURL(e.substring(i,s)))}loadFile(e){if(this.root=bi(e),vp(e))return this.mapFile=e,Sp(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let i=t(e);if(i){let s=this.loadFile(i);if(!s)throw new Error("Unable to load previous source map: "+i.toString());return s}}else{if(t instanceof qn)return Qn.fromSourceMap(t).toString();if(t instanceof Qn)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let i=this.annotation;return e&&(i=Cp(bi(e),i)),this.loadFile(i)}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};var ul=as;as.default=as;let{SourceMapConsumer:Ep,SourceMapGenerator:Ap}=ye,{fileURLToPath:eo,pathToFileURL:or}=ye,{isAbsolute:ls,resolve:cs}=ye,{nanoid:Rp}=bp,vi=ye,to=Ys,kp=ul,Si=Symbol("fromOffsetCache"),Mp=!!(Ep&&Ap),ro=!!(cs&&ls),jr=class{constructor(e,t={}){if(e===null||typeof e>"u"||typeof e=="object"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]==="\uFEFF"||this.css[0]==="￾"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!ro||/^\w+:\/\//.test(t.from)||ls(t.from)?this.file=t.from:this.file=cs(t.from)),ro&&Mp){let i=new kp(this.css,t);if(i.text){this.map=i;let s=i.consumer().file;!this.file&&s&&(this.file=this.mapResolve(s))}}this.file||(this.id="<input css "+Rp(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,i,s={}){let n,o,a;if(t&&typeof t=="object"){let c=t,u=i;if(typeof c.offset=="number"){let h=this.fromOffset(c.offset);t=h.line,i=h.col}else t=c.line,i=c.column;if(typeof u.offset=="number"){let h=this.fromOffset(u.offset);o=h.line,a=h.col}else o=u.line,a=u.column}else if(!i){let c=this.fromOffset(t);t=c.line,i=c.col}let l=this.origin(t,i,o,a);return l?n=new to(e,l.endLine===void 0?l.line:{column:l.column,line:l.line},l.endLine===void 0?l.column:{column:l.endColumn,line:l.endLine},l.source,l.file,s.plugin):n=new to(e,o===void 0?t:{column:i,line:t},o===void 0?i:{column:a,line:o},this.css,this.file,s.plugin),n.input={column:i,endColumn:a,endLine:o,line:t,source:this.css},this.file&&(or&&(n.input.url=or(this.file).toString()),n.input.file=this.file),n}fromOffset(e){let t,i;if(this[Si])i=this[Si];else{let n=this.css.split(`
63
+ `);i=new Array(n.length);let o=0;for(let a=0,l=n.length;a<l;a++)i[a]=o,o+=n[a].length+1;this[Si]=i}t=i[i.length-1];let s=0;if(e>=t)s=i.length-1;else{let n=i.length-2,o;for(;s<n;)if(o=s+(n-s>>1),e<i[o])n=o-1;else if(e>=i[o+1])s=o+1;else{s=o;break}}return{col:e-i[s]+1,line:s+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:cs(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,i,s){if(!this.map)return!1;let n=this.map.consumer(),o=n.originalPositionFor({column:t,line:e});if(!o.source)return!1;let a;typeof i=="number"&&(a=n.originalPositionFor({column:s,line:i}));let l;ls(o.source)?l=or(o.source):l=new URL(o.source,this.map.consumer().sourceRoot||or(this.map.mapFile));let c={column:o.column,endColumn:a&&a.column,endLine:a&&a.line,line:o.line,url:l.toString()};if(l.protocol==="file:")if(eo)c.file=eo(l);else throw new Error("file: protocol is not available in this PostCSS build");let u=n.sourceContentFor(o.source);return u&&(c.source=u),c}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}};var li=jr;jr.default=jr;vi&&vi.registerInput&&vi.registerInput(jr);let{SourceMapConsumer:hl,SourceMapGenerator:Mr}=ye,{dirname:Nr,relative:fl,resolve:dl,sep:pl}=ye,{pathToFileURL:io}=ye,Np=li,_p=!!(hl&&Mr),Ip=!!(Nr&&dl&&fl&&pl),Dp=class{constructor(e,t,i,s){this.stringify=e,this.mapOpts=i.map||{},this.root=t,this.opts=i,this.css=s,this.originalCSS=s,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;this.isInline()?e="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?e=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?e=this.mapOpts.annotation(this.opts.to,this.root):e=this.outputFile()+".map";let t=`
64
64
  `;this.css.includes(`\r
65
65
  `)&&(t=`\r
66
- `),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),i=e.root||Nr(e.file),s;this.mapOpts.sourcesContent===!1?(s=new hl(e.text),s.sourcesContent&&(s.sourcesContent=null)):s=e.consumer(),this.map.applySourceMap(s,t,this.toUrl(this.path(i)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type==="comment"&&e.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),Ip&&_p&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=kr.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new kr({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new kr({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,i="<no source>",s={generated:{column:0,line:0},original:{column:0,line:0},source:""},n,o;this.stringify(this.root,(a,l,c)=>{if(this.css+=a,l&&c!=="end"&&(s.generated.line=e,s.generated.column=t-1,l.source&&l.source.start?(s.source=this.sourcePath(l),s.original.line=l.source.start.line,s.original.column=l.source.start.column-1,this.map.addMapping(s)):(s.source=i,s.original.line=1,s.original.column=0,this.map.addMapping(s))),n=a.match(/\n/g),n?(e+=n.length,o=a.lastIndexOf(`
67
- `),t=a.length-o):t+=a.length,l&&c!=="start"){let u=l.parent||{raws:{}};(!(l.type==="decl"||l.type==="atrule"&&!l.nodes)||l!==u.last||u.raws.semicolon)&&(l.source&&l.source.end?(s.source=this.sourcePath(l),s.original.line=l.source.end.line,s.original.column=l.source.end.column-1,s.generated.line=e,s.generated.column=t-2,this.map.addMapping(s)):(s.source=i,s.original.line=1,s.original.column=0,s.generated.line=e,s.generated.column=t-1,this.map.addMapping(s)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(e=>e.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let e=this.mapOpts.annotation;return typeof e<"u"&&e!==!0?!1:this.previous().length?this.previous().some(t=>t.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(e=>e.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let i=this.opts.to?Nr(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(i=Nr(dl(i,this.mapOpts.annotation)));let s=fl(i,e);return this.memoizedPaths.set(e,s),s}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Np(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let i=t.source.input.from;if(i&&!e[i]){e[i]=!0;let s=this.usesFileUrls?this.toFileUrl(i):this.toUrl(this.path(i));this.map.setSourceContent(s,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(io){let i=io(e).toString();return this.memoizedFileURLs.set(e,i),i}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;pl==="\\"&&(e=e.replace(/\\/g,"/"));let i=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,i),i}};var ml=Dp;let Tp=oi,us=class extends Tp{constructor(e){super(e),this.type="comment"}};var ci=us;us.default=us;let{isClean:gl,my:yl}=Ut,wl=ai,bl=ci,Op=oi,vl,Hs,Zs,Sl;function Cl(r){return r.map(e=>(e.nodes&&(e.nodes=Cl(e.nodes)),delete e.source,e))}function xl(r){if(r[gl]=!1,r.proxyOf.nodes)for(let e of r.proxyOf.nodes)xl(e)}let Ne=class El extends Op{append(...e){for(let t of e){let i=this.normalize(t,this.last);for(let s of i)this.proxyOf.nodes.push(s)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),i,s;for(;this.indexes[t]<this.proxyOf.nodes.length&&(i=this.indexes[t],s=e(this.proxyOf.nodes[i],i),s!==!1);)this.indexes[t]+=1;return delete this.indexes[t],s}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:e[t]?t==="each"||typeof t=="string"&&t.startsWith("walk")?(...i)=>e[t](...i.map(s=>typeof s=="function"?(n,o)=>s(n.toProxy(),o):s)):t==="every"||t==="some"?i=>e[t]((s,...n)=>i(s.toProxy(),...n)):t==="root"?()=>e.root().toProxy():t==="nodes"?e.nodes.map(i=>i.toProxy()):t==="first"||t==="last"?e[t].toProxy():e[t]:e[t]},set(e,t,i){return e[t]===i||(e[t]=i,(t==="name"||t==="params"||t==="selector")&&e.markDirty()),!0}}}index(e){return typeof e=="number"?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let i=this.index(e),s=this.normalize(t,this.proxyOf.nodes[i]).reverse();i=this.index(e);for(let o of s)this.proxyOf.nodes.splice(i+1,0,o);let n;for(let o in this.indexes)n=this.indexes[o],i<n&&(this.indexes[o]=n+s.length);return this.markDirty(),this}insertBefore(e,t){let i=this.index(e),s=i===0?"prepend":!1,n=this.normalize(t,this.proxyOf.nodes[i],s).reverse();i=this.index(e);for(let a of n)this.proxyOf.nodes.splice(i,0,a);let o;for(let a in this.indexes)o=this.indexes[a],i<=o&&(this.indexes[a]=o+n.length);return this.markDirty(),this}normalize(e,t){if(typeof e=="string")e=Cl(vl(e).nodes);else if(typeof e>"u")e=[];else if(Array.isArray(e)){e=e.slice(0);for(let s of e)s.parent&&s.parent.removeChild(s,"ignore")}else if(e.type==="root"&&this.type!=="document"){e=e.nodes.slice(0);for(let s of e)s.parent&&s.parent.removeChild(s,"ignore")}else if(e.type)e=[e];else if(e.prop){if(typeof e.value>"u")throw new Error("Value field is missed in node creation");typeof e.value!="string"&&(e.value=String(e.value)),e=[new wl(e)]}else if(e.selector)e=[new Hs(e)];else if(e.name)e=[new Zs(e)];else if(e.text)e=[new bl(e)];else throw new Error("Unknown node type in node creation");return e.map(s=>(s[yl]||El.rebuild(s),s=s.proxyOf,s.parent&&s.parent.removeChild(s),s[gl]&&xl(s),typeof s.raws.before>"u"&&t&&typeof t.raws.before<"u"&&(s.raws.before=t.raws.before.replace(/\S/g,"")),s.parent=this.proxyOf,s))}prepend(...e){e=e.reverse();for(let t of e){let i=this.normalize(t,this.first,"prepend").reverse();for(let s of i)this.proxyOf.nodes.unshift(s);for(let s in this.indexes)this.indexes[s]=this.indexes[s]+i.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let i in this.indexes)t=this.indexes[i],t>=e&&(this.indexes[i]=t-1);return this.markDirty(),this}replaceValues(e,t,i){return i||(i=t,t={}),this.walkDecls(s=>{t.props&&!t.props.includes(s.prop)||t.fast&&!s.value.includes(t.fast)||(s.value=s.value.replace(e,i))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,i)=>{let s;try{s=e(t,i)}catch(n){throw t.addToError(n)}return s!==!1&&t.walk&&(s=t.walk(e)),s})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((i,s)=>{if(i.type==="atrule"&&e.test(i.name))return t(i,s)}):this.walk((i,s)=>{if(i.type==="atrule"&&i.name===e)return t(i,s)}):(t=e,this.walk((i,s)=>{if(i.type==="atrule")return t(i,s)}))}walkComments(e){return this.walk((t,i)=>{if(t.type==="comment")return e(t,i)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((i,s)=>{if(i.type==="decl"&&e.test(i.prop))return t(i,s)}):this.walk((i,s)=>{if(i.type==="decl"&&i.prop===e)return t(i,s)}):(t=e,this.walk((i,s)=>{if(i.type==="decl")return t(i,s)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((i,s)=>{if(i.type==="rule"&&e.test(i.selector))return t(i,s)}):this.walk((i,s)=>{if(i.type==="rule"&&i.selector===e)return t(i,s)}):(t=e,this.walk((i,s)=>{if(i.type==="rule")return t(i,s)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};Ne.registerParse=r=>{vl=r};Ne.registerRule=r=>{Hs=r};Ne.registerAtRule=r=>{Zs=r};Ne.registerRoot=r=>{Sl=r};var ze=Ne;Ne.default=Ne;Ne.rebuild=r=>{r.type==="atrule"?Object.setPrototypeOf(r,Zs.prototype):r.type==="rule"?Object.setPrototypeOf(r,Hs.prototype):r.type==="decl"?Object.setPrototypeOf(r,wl.prototype):r.type==="comment"?Object.setPrototypeOf(r,bl.prototype):r.type==="root"&&Object.setPrototypeOf(r,Sl.prototype),r[yl]=!0,r.nodes&&r.nodes.forEach(e=>{Ne.rebuild(e)})};let Pp=ze,Al,Rl,Tt=class extends Pp{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new Al(new Rl,this,e).stringify()}};Tt.registerLazyResult=r=>{Al=r};Tt.registerProcessor=r=>{Rl=r};var Xs=Tt;Tt.default=Tt;let so={};var Ml=function(e){so[e]||(so[e]=!0,typeof console<"u"&&console.warn&&console.warn(e))};let hs=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let i=t.node.rangeBy(t);this.line=i.start.line,this.column=i.start.column,this.endLine=i.end.line,this.endColumn=i.end.column}for(let i in t)this[i]=t[i]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}};var kl=hs;hs.default=hs;let Lp=kl,fs=class{constructor(e,t,i){this.processor=e,this.messages=[],this.root=t,this.opts=i,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let i=new Lp(e,t);return this.messages.push(i),i}warnings(){return this.messages.filter(e=>e.type==="warning")}get content(){return this.css}};var Js=fs;fs.default=fs;const Ci=39,no=34,ar=92,oo=47,lr=10,pt=32,cr=12,ur=9,hr=13,$p=91,Fp=93,jp=40,Bp=41,Up=123,zp=125,Wp=59,Vp=42,Gp=58,Yp=64,fr=/[\t\n\f\r "#'()/;[\\\]{}]/g,dr=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,Hp=/.[\r\n"'(/\\]/,ao=/[\da-f]/i;var Zp=function(e,t={}){let i=e.css.valueOf(),s=t.ignoreErrors,n,o,a,l,c,u,h,f,d,m,w=i.length,p=0,y=[],b=[];function v(){return p}function x(D){throw e.error("Unclosed "+D,p)}function M(){return b.length===0&&p>=w}function N(D){if(b.length)return b.pop();if(p>=w)return;let J=D?D.ignoreUnclosed:!1;switch(n=i.charCodeAt(p),n){case lr:case pt:case ur:case hr:case cr:{o=p;do o+=1,n=i.charCodeAt(o);while(n===pt||n===lr||n===ur||n===hr||n===cr);m=["space",i.slice(p,o)],p=o-1;break}case $p:case Fp:case Up:case zp:case Gp:case Wp:case Bp:{let W=String.fromCharCode(n);m=[W,W,p];break}case jp:{if(f=y.length?y.pop()[1]:"",d=i.charCodeAt(p+1),f==="url"&&d!==Ci&&d!==no&&d!==pt&&d!==lr&&d!==ur&&d!==cr&&d!==hr){o=p;do{if(u=!1,o=i.indexOf(")",o+1),o===-1)if(s||J){o=p;break}else x("bracket");for(h=o;i.charCodeAt(h-1)===ar;)h-=1,u=!u}while(u);m=["brackets",i.slice(p,o+1),p,o],p=o}else o=i.indexOf(")",p+1),l=i.slice(p,o+1),o===-1||Hp.test(l)?m=["(","(",p]:(m=["brackets",l,p,o],p=o);break}case Ci:case no:{a=n===Ci?"'":'"',o=p;do{if(u=!1,o=i.indexOf(a,o+1),o===-1)if(s||J){o=p+1;break}else x("string");for(h=o;i.charCodeAt(h-1)===ar;)h-=1,u=!u}while(u);m=["string",i.slice(p,o+1),p,o],p=o;break}case Yp:{fr.lastIndex=p+1,fr.test(i),fr.lastIndex===0?o=i.length-1:o=fr.lastIndex-2,m=["at-word",i.slice(p,o+1),p,o],p=o;break}case ar:{for(o=p,c=!0;i.charCodeAt(o+1)===ar;)o+=1,c=!c;if(n=i.charCodeAt(o+1),c&&n!==oo&&n!==pt&&n!==lr&&n!==ur&&n!==hr&&n!==cr&&(o+=1,ao.test(i.charAt(o)))){for(;ao.test(i.charAt(o+1));)o+=1;i.charCodeAt(o+1)===pt&&(o+=1)}m=["word",i.slice(p,o+1),p,o],p=o;break}default:{n===oo&&i.charCodeAt(p+1)===Vp?(o=i.indexOf("*/",p+2)+1,o===0&&(s||J?o=i.length:x("comment")),m=["comment",i.slice(p,o+1),p,o],p=o):(dr.lastIndex=p+1,dr.test(i),dr.lastIndex===0?o=i.length-1:o=dr.lastIndex-2,m=["word",i.slice(p,o+1),p,o],y.push(m),p=o);break}}return p++,m}function j(D){b.push(D)}return{back:j,endOfFile:M,nextToken:N,position:v}};let Nl=ze,jr=class extends Nl{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}};var Ks=jr;jr.default=jr;Nl.registerAtRule(jr);let _l=ze,Il,Dl,at=class extends _l{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,i){let s=super.normalize(e);if(t){if(i==="prepend")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let n of s)n.raws.before=t.raws.before}return s}removeChild(e,t){let i=this.index(e);return!t&&i===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[i].raws.before),super.removeChild(e)}toResult(e={}){return new Il(new Dl,this,e).stringify()}};at.registerLazyResult=r=>{Il=r};at.registerProcessor=r=>{Dl=r};var zt=at;at.default=at;_l.registerRoot(at);let Ot={comma(r){return Ot.split(r,[","],!0)},space(r){let e=[" ",`
68
- `," "];return Ot.split(r,e)},split(r,e,t){let i=[],s="",n=!1,o=0,a=!1,l="",c=!1;for(let u of r)c?c=!1:u==="\\"?c=!0:a?u===l&&(a=!1):u==='"'||u==="'"?(a=!0,l=u):u==="("?o+=1:u===")"?o>0&&(o-=1):o===0&&e.includes(u)&&(n=!0),n?(s!==""&&i.push(s.trim()),s="",n=!1):s+=u;return(t||s!=="")&&i.push(s.trim()),i}};var Tl=Ot;Ot.default=Ot;let Ol=ze,Xp=Tl,Br=class extends Ol{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return Xp.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,i=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(i)}};var qs=Br;Br.default=Br;Ol.registerRule(Br);let Jp=ai,Kp=Zp,qp=ci,Qp=Ks,em=zt,lo=qs;const co={empty:!0,space:!0};function tm(r){for(let e=r.length-1;e>=0;e--){let t=r[e],i=t[3]||t[2];if(i)return i}}let rm=class{constructor(e){this.input=e,this.root=new em,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new Qp;t.name=e[1].slice(1),t.name===""&&this.unnamedAtrule(t,e),this.init(t,e[2]);let i,s,n,o=!1,a=!1,l=[],c=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),i=e[0],i==="("||i==="["?c.push(i==="("?")":"]"):i==="{"&&c.length>0?c.push("}"):i===c[c.length-1]&&c.pop(),c.length===0)if(i===";"){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(i==="{"){a=!0;break}else if(i==="}"){if(l.length>0){for(n=l.length-1,s=l[n];s&&s[0]==="space";)s=l[--n];s&&(t.source.end=this.getPosition(s[3]||s[2]),t.source.end.offset++)}this.end(e);break}else l.push(e);else l.push(e);if(this.tokenizer.endOfFile()){o=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(t.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(t,"params",l),o&&(e=l[l.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between="")):(t.raws.afterName="",t.params=""),a&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let i=0,s;for(let n=t-1;n>=0&&(s=e[n],!(s[0]!=="space"&&(i+=1,i===2)));n--);throw this.input.error("Missed semicolon",s[0]==="word"?s[3]+1:s[2])}colon(e){let t=0,i,s,n;for(let[o,a]of e.entries()){if(i=a,s=i[0],s==="("&&(t+=1),s===")"&&(t-=1),t===0&&s===":")if(!n)this.doubleColon(i);else{if(n[0]==="word"&&n[1]==="progid")continue;return o}n=i}return!1}comment(e){let t=new qp;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let i=e[1].slice(2,-2);if(/^\s*$/.test(i))t.text="",t.raws.left=i,t.raws.right="";else{let s=i.match(/^(\s*)([^]*\S)(\s*)$/);t.text=s[2],t.raws.left=s[1],t.raws.right=s[3]}}createTokenizer(){this.tokenizer=Kp(this.input)}decl(e,t){let i=new Jp;this.init(i,e[0][2]);let s=e[e.length-1];for(s[0]===";"&&(this.semicolon=!0,e.pop()),i.source.end=this.getPosition(s[3]||s[2]||tm(e)),i.source.end.offset++;e[0][0]!=="word";)e.length===1&&this.unknownWord(e),i.raws.before+=e.shift()[1];for(i.source.start=this.getPosition(e[0][2]),i.prop="";e.length;){let c=e[0][0];if(c===":"||c==="space"||c==="comment")break;i.prop+=e.shift()[1]}i.raws.between="";let n;for(;e.length;)if(n=e.shift(),n[0]===":"){i.raws.between+=n[1];break}else n[0]==="word"&&/\w/.test(n[1])&&this.unknownWord([n]),i.raws.between+=n[1];(i.prop[0]==="_"||i.prop[0]==="*")&&(i.raws.before+=i.prop[0],i.prop=i.prop.slice(1));let o=[],a;for(;e.length&&(a=e[0][0],!(a!=="space"&&a!=="comment"));)o.push(e.shift());this.precheckMissedSemicolon(e);for(let c=e.length-1;c>=0;c--){if(n=e[c],n[1].toLowerCase()==="!important"){i.important=!0;let u=this.stringFrom(e,c);u=this.spacesFromEnd(e)+u,u!==" !important"&&(i.raws.important=u);break}else if(n[1].toLowerCase()==="important"){let u=e.slice(0),h="";for(let f=c;f>0;f--){let d=u[f][0];if(h.trim().indexOf("!")===0&&d!=="space")break;h=u.pop()[1]+h}h.trim().indexOf("!")===0&&(i.important=!0,i.raws.important=h,e=u)}if(n[0]!=="space"&&n[0]!=="comment")break}e.some(c=>c[0]!=="space"&&c[0]!=="comment")&&(i.raws.between+=o.map(c=>c[1]).join(""),o=[]),this.raw(i,"value",o.concat(e),t),i.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new lo;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type==="rule"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="",e.type!=="comment"&&(this.semicolon=!1)}other(e){let t=!1,i=null,s=!1,n=null,o=[],a=e[1].startsWith("--"),l=[],c=e;for(;c;){if(i=c[0],l.push(c),i==="("||i==="[")n||(n=c),o.push(i==="("?")":"]");else if(a&&s&&i==="{")n||(n=c),o.push("}");else if(o.length===0)if(i===";")if(s){this.decl(l,a);return}else break;else if(i==="{"){this.rule(l);return}else if(i==="}"){this.tokenizer.back(l.pop()),t=!0;break}else i===":"&&(s=!0);else i===o[o.length-1]&&(o.pop(),o.length===0&&(n=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(n),t&&s){if(!a)for(;l.length&&(c=l[l.length-1][0],!(c!=="space"&&c!=="comment"));)this.tokenizer.back(l.pop());this.decl(l,a)}else this.unknownWord(l)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,i,s){let n,o,a=i.length,l="",c=!0,u,h;for(let f=0;f<a;f+=1)n=i[f],o=n[0],o==="space"&&f===a-1&&!s?c=!1:o==="comment"?(h=i[f-1]?i[f-1][0]:"empty",u=i[f+1]?i[f+1][0]:"empty",!co[h]&&!co[u]?l.slice(-1)===","?c=!1:l+=n[1]:c=!1):l+=n[1];if(!c){let f=i.reduce((d,m)=>d+m[1],"");e.raws[t]={raw:f,value:l}}e[t]=l}rule(e){e.pop();let t=new lo;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,i="";for(;e.length&&(t=e[e.length-1][0],!(t!=="space"&&t!=="comment"));)i=e.pop()[1]+i;return i}spacesAndCommentsFromStart(e){let t,i="";for(;e.length&&(t=e[0][0],!(t!=="space"&&t!=="comment"));)i+=e.shift()[1];return i}spacesFromEnd(e){let t,i="";for(;e.length&&(t=e[e.length-1][0],t==="space");)i=e.pop()[1]+i;return i}stringFrom(e,t){let i="";for(let s=t;s<e.length;s++)i+=e[s][1];return e.splice(t,e.length-t),i}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}};var im=rm;let sm=ze,nm=im,om=li;function Ur(r,e){let t=new om(r,e),i=new nm(t);try{i.parse()}catch(s){throw process.env.NODE_ENV!=="production"&&s.name==="CssSyntaxError"&&e&&e.from&&(/\.scss$/i.test(e.from)?s.message+=`
66
+ `),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),i=e.root||Nr(e.file),s;this.mapOpts.sourcesContent===!1?(s=new hl(e.text),s.sourcesContent&&(s.sourcesContent=null)):s=e.consumer(),this.map.applySourceMap(s,t,this.toUrl(this.path(i)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type==="comment"&&e.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),Ip&&_p&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Mr.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Mr({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new Mr({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,i="<no source>",s={generated:{column:0,line:0},original:{column:0,line:0},source:""},n,o;this.stringify(this.root,(a,l,c)=>{if(this.css+=a,l&&c!=="end"&&(s.generated.line=e,s.generated.column=t-1,l.source&&l.source.start?(s.source=this.sourcePath(l),s.original.line=l.source.start.line,s.original.column=l.source.start.column-1,this.map.addMapping(s)):(s.source=i,s.original.line=1,s.original.column=0,this.map.addMapping(s))),n=a.match(/\n/g),n?(e+=n.length,o=a.lastIndexOf(`
67
+ `),t=a.length-o):t+=a.length,l&&c!=="start"){let u=l.parent||{raws:{}};(!(l.type==="decl"||l.type==="atrule"&&!l.nodes)||l!==u.last||u.raws.semicolon)&&(l.source&&l.source.end?(s.source=this.sourcePath(l),s.original.line=l.source.end.line,s.original.column=l.source.end.column-1,s.generated.line=e,s.generated.column=t-2,this.map.addMapping(s)):(s.source=i,s.original.line=1,s.original.column=0,s.generated.line=e,s.generated.column=t-1,this.map.addMapping(s)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(e=>e.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let e=this.mapOpts.annotation;return typeof e<"u"&&e!==!0?!1:this.previous().length?this.previous().some(t=>t.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(e=>e.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let i=this.opts.to?Nr(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(i=Nr(dl(i,this.mapOpts.annotation)));let s=fl(i,e);return this.memoizedPaths.set(e,s),s}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Np(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let i=t.source.input.from;if(i&&!e[i]){e[i]=!0;let s=this.usesFileUrls?this.toFileUrl(i):this.toUrl(this.path(i));this.map.setSourceContent(s,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(io){let i=io(e).toString();return this.memoizedFileURLs.set(e,i),i}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;pl==="\\"&&(e=e.replace(/\\/g,"/"));let i=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,i),i}};var ml=Dp;let Tp=oi,us=class extends Tp{constructor(e){super(e),this.type="comment"}};var ci=us;us.default=us;let{isClean:gl,my:yl}=Ut,wl=ai,bl=ci,Op=oi,vl,Hs,Zs,Sl;function Cl(r){return r.map(e=>(e.nodes&&(e.nodes=Cl(e.nodes)),delete e.source,e))}function xl(r){if(r[gl]=!1,r.proxyOf.nodes)for(let e of r.proxyOf.nodes)xl(e)}let Ne=class El extends Op{append(...e){for(let t of e){let i=this.normalize(t,this.last);for(let s of i)this.proxyOf.nodes.push(s)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),i,s;for(;this.indexes[t]<this.proxyOf.nodes.length&&(i=this.indexes[t],s=e(this.proxyOf.nodes[i],i),s!==!1);)this.indexes[t]+=1;return delete this.indexes[t],s}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:e[t]?t==="each"||typeof t=="string"&&t.startsWith("walk")?(...i)=>e[t](...i.map(s=>typeof s=="function"?(n,o)=>s(n.toProxy(),o):s)):t==="every"||t==="some"?i=>e[t]((s,...n)=>i(s.toProxy(),...n)):t==="root"?()=>e.root().toProxy():t==="nodes"?e.nodes.map(i=>i.toProxy()):t==="first"||t==="last"?e[t].toProxy():e[t]:e[t]},set(e,t,i){return e[t]===i||(e[t]=i,(t==="name"||t==="params"||t==="selector")&&e.markDirty()),!0}}}index(e){return typeof e=="number"?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let i=this.index(e),s=this.normalize(t,this.proxyOf.nodes[i]).reverse();i=this.index(e);for(let o of s)this.proxyOf.nodes.splice(i+1,0,o);let n;for(let o in this.indexes)n=this.indexes[o],i<n&&(this.indexes[o]=n+s.length);return this.markDirty(),this}insertBefore(e,t){let i=this.index(e),s=i===0?"prepend":!1,n=this.normalize(t,this.proxyOf.nodes[i],s).reverse();i=this.index(e);for(let a of n)this.proxyOf.nodes.splice(i,0,a);let o;for(let a in this.indexes)o=this.indexes[a],i<=o&&(this.indexes[a]=o+n.length);return this.markDirty(),this}normalize(e,t){if(typeof e=="string")e=Cl(vl(e).nodes);else if(typeof e>"u")e=[];else if(Array.isArray(e)){e=e.slice(0);for(let s of e)s.parent&&s.parent.removeChild(s,"ignore")}else if(e.type==="root"&&this.type!=="document"){e=e.nodes.slice(0);for(let s of e)s.parent&&s.parent.removeChild(s,"ignore")}else if(e.type)e=[e];else if(e.prop){if(typeof e.value>"u")throw new Error("Value field is missed in node creation");typeof e.value!="string"&&(e.value=String(e.value)),e=[new wl(e)]}else if(e.selector)e=[new Hs(e)];else if(e.name)e=[new Zs(e)];else if(e.text)e=[new bl(e)];else throw new Error("Unknown node type in node creation");return e.map(s=>(s[yl]||El.rebuild(s),s=s.proxyOf,s.parent&&s.parent.removeChild(s),s[gl]&&xl(s),typeof s.raws.before>"u"&&t&&typeof t.raws.before<"u"&&(s.raws.before=t.raws.before.replace(/\S/g,"")),s.parent=this.proxyOf,s))}prepend(...e){e=e.reverse();for(let t of e){let i=this.normalize(t,this.first,"prepend").reverse();for(let s of i)this.proxyOf.nodes.unshift(s);for(let s in this.indexes)this.indexes[s]=this.indexes[s]+i.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let i in this.indexes)t=this.indexes[i],t>=e&&(this.indexes[i]=t-1);return this.markDirty(),this}replaceValues(e,t,i){return i||(i=t,t={}),this.walkDecls(s=>{t.props&&!t.props.includes(s.prop)||t.fast&&!s.value.includes(t.fast)||(s.value=s.value.replace(e,i))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,i)=>{let s;try{s=e(t,i)}catch(n){throw t.addToError(n)}return s!==!1&&t.walk&&(s=t.walk(e)),s})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((i,s)=>{if(i.type==="atrule"&&e.test(i.name))return t(i,s)}):this.walk((i,s)=>{if(i.type==="atrule"&&i.name===e)return t(i,s)}):(t=e,this.walk((i,s)=>{if(i.type==="atrule")return t(i,s)}))}walkComments(e){return this.walk((t,i)=>{if(t.type==="comment")return e(t,i)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((i,s)=>{if(i.type==="decl"&&e.test(i.prop))return t(i,s)}):this.walk((i,s)=>{if(i.type==="decl"&&i.prop===e)return t(i,s)}):(t=e,this.walk((i,s)=>{if(i.type==="decl")return t(i,s)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((i,s)=>{if(i.type==="rule"&&e.test(i.selector))return t(i,s)}):this.walk((i,s)=>{if(i.type==="rule"&&i.selector===e)return t(i,s)}):(t=e,this.walk((i,s)=>{if(i.type==="rule")return t(i,s)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};Ne.registerParse=r=>{vl=r};Ne.registerRule=r=>{Hs=r};Ne.registerAtRule=r=>{Zs=r};Ne.registerRoot=r=>{Sl=r};var ze=Ne;Ne.default=Ne;Ne.rebuild=r=>{r.type==="atrule"?Object.setPrototypeOf(r,Zs.prototype):r.type==="rule"?Object.setPrototypeOf(r,Hs.prototype):r.type==="decl"?Object.setPrototypeOf(r,wl.prototype):r.type==="comment"?Object.setPrototypeOf(r,bl.prototype):r.type==="root"&&Object.setPrototypeOf(r,Sl.prototype),r[yl]=!0,r.nodes&&r.nodes.forEach(e=>{Ne.rebuild(e)})};let Pp=ze,Al,Rl,Tt=class extends Pp{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new Al(new Rl,this,e).stringify()}};Tt.registerLazyResult=r=>{Al=r};Tt.registerProcessor=r=>{Rl=r};var Xs=Tt;Tt.default=Tt;let so={};var kl=function(e){so[e]||(so[e]=!0,typeof console<"u"&&console.warn&&console.warn(e))};let hs=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let i=t.node.rangeBy(t);this.line=i.start.line,this.column=i.start.column,this.endLine=i.end.line,this.endColumn=i.end.column}for(let i in t)this[i]=t[i]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}};var Ml=hs;hs.default=hs;let Lp=Ml,fs=class{constructor(e,t,i){this.processor=e,this.messages=[],this.root=t,this.opts=i,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let i=new Lp(e,t);return this.messages.push(i),i}warnings(){return this.messages.filter(e=>e.type==="warning")}get content(){return this.css}};var Js=fs;fs.default=fs;const Ci=39,no=34,ar=92,oo=47,lr=10,pt=32,cr=12,ur=9,hr=13,$p=91,jp=93,Fp=40,Bp=41,Up=123,zp=125,Wp=59,Vp=42,Gp=58,Yp=64,fr=/[\t\n\f\r "#'()/;[\\\]{}]/g,dr=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,Hp=/.[\r\n"'(/\\]/,ao=/[\da-f]/i;var Zp=function(e,t={}){let i=e.css.valueOf(),s=t.ignoreErrors,n,o,a,l,c,u,h,f,d,g,w=i.length,p=0,y=[],b=[];function v(){return p}function x(D){throw e.error("Unclosed "+D,p)}function k(){return b.length===0&&p>=w}function N(D){if(b.length)return b.pop();if(p>=w)return;let J=D?D.ignoreUnclosed:!1;switch(n=i.charCodeAt(p),n){case lr:case pt:case ur:case hr:case cr:{o=p;do o+=1,n=i.charCodeAt(o);while(n===pt||n===lr||n===ur||n===hr||n===cr);g=["space",i.slice(p,o)],p=o-1;break}case $p:case jp:case Up:case zp:case Gp:case Wp:case Bp:{let W=String.fromCharCode(n);g=[W,W,p];break}case Fp:{if(f=y.length?y.pop()[1]:"",d=i.charCodeAt(p+1),f==="url"&&d!==Ci&&d!==no&&d!==pt&&d!==lr&&d!==ur&&d!==cr&&d!==hr){o=p;do{if(u=!1,o=i.indexOf(")",o+1),o===-1)if(s||J){o=p;break}else x("bracket");for(h=o;i.charCodeAt(h-1)===ar;)h-=1,u=!u}while(u);g=["brackets",i.slice(p,o+1),p,o],p=o}else o=i.indexOf(")",p+1),l=i.slice(p,o+1),o===-1||Hp.test(l)?g=["(","(",p]:(g=["brackets",l,p,o],p=o);break}case Ci:case no:{a=n===Ci?"'":'"',o=p;do{if(u=!1,o=i.indexOf(a,o+1),o===-1)if(s||J){o=p+1;break}else x("string");for(h=o;i.charCodeAt(h-1)===ar;)h-=1,u=!u}while(u);g=["string",i.slice(p,o+1),p,o],p=o;break}case Yp:{fr.lastIndex=p+1,fr.test(i),fr.lastIndex===0?o=i.length-1:o=fr.lastIndex-2,g=["at-word",i.slice(p,o+1),p,o],p=o;break}case ar:{for(o=p,c=!0;i.charCodeAt(o+1)===ar;)o+=1,c=!c;if(n=i.charCodeAt(o+1),c&&n!==oo&&n!==pt&&n!==lr&&n!==ur&&n!==hr&&n!==cr&&(o+=1,ao.test(i.charAt(o)))){for(;ao.test(i.charAt(o+1));)o+=1;i.charCodeAt(o+1)===pt&&(o+=1)}g=["word",i.slice(p,o+1),p,o],p=o;break}default:{n===oo&&i.charCodeAt(p+1)===Vp?(o=i.indexOf("*/",p+2)+1,o===0&&(s||J?o=i.length:x("comment")),g=["comment",i.slice(p,o+1),p,o],p=o):(dr.lastIndex=p+1,dr.test(i),dr.lastIndex===0?o=i.length-1:o=dr.lastIndex-2,g=["word",i.slice(p,o+1),p,o],y.push(g),p=o);break}}return p++,g}function F(D){b.push(D)}return{back:F,endOfFile:k,nextToken:N,position:v}};let Nl=ze,Fr=class extends Nl{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}};var Ks=Fr;Fr.default=Fr;Nl.registerAtRule(Fr);let _l=ze,Il,Dl,at=class extends _l{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,i){let s=super.normalize(e);if(t){if(i==="prepend")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let n of s)n.raws.before=t.raws.before}return s}removeChild(e,t){let i=this.index(e);return!t&&i===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[i].raws.before),super.removeChild(e)}toResult(e={}){return new Il(new Dl,this,e).stringify()}};at.registerLazyResult=r=>{Il=r};at.registerProcessor=r=>{Dl=r};var zt=at;at.default=at;_l.registerRoot(at);let Ot={comma(r){return Ot.split(r,[","],!0)},space(r){let e=[" ",`
68
+ `," "];return Ot.split(r,e)},split(r,e,t){let i=[],s="",n=!1,o=0,a=!1,l="",c=!1;for(let u of r)c?c=!1:u==="\\"?c=!0:a?u===l&&(a=!1):u==='"'||u==="'"?(a=!0,l=u):u==="("?o+=1:u===")"?o>0&&(o-=1):o===0&&e.includes(u)&&(n=!0),n?(s!==""&&i.push(s.trim()),s="",n=!1):s+=u;return(t||s!=="")&&i.push(s.trim()),i}};var Tl=Ot;Ot.default=Ot;let Ol=ze,Xp=Tl,Br=class extends Ol{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return Xp.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,i=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(i)}};var qs=Br;Br.default=Br;Ol.registerRule(Br);let Jp=ai,Kp=Zp,qp=ci,Qp=Ks,em=zt,lo=qs;const co={empty:!0,space:!0};function tm(r){for(let e=r.length-1;e>=0;e--){let t=r[e],i=t[3]||t[2];if(i)return i}}let rm=class{constructor(e){this.input=e,this.root=new em,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new Qp;t.name=e[1].slice(1),t.name===""&&this.unnamedAtrule(t,e),this.init(t,e[2]);let i,s,n,o=!1,a=!1,l=[],c=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),i=e[0],i==="("||i==="["?c.push(i==="("?")":"]"):i==="{"&&c.length>0?c.push("}"):i===c[c.length-1]&&c.pop(),c.length===0)if(i===";"){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(i==="{"){a=!0;break}else if(i==="}"){if(l.length>0){for(n=l.length-1,s=l[n];s&&s[0]==="space";)s=l[--n];s&&(t.source.end=this.getPosition(s[3]||s[2]),t.source.end.offset++)}this.end(e);break}else l.push(e);else l.push(e);if(this.tokenizer.endOfFile()){o=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(t.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(t,"params",l),o&&(e=l[l.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between="")):(t.raws.afterName="",t.params=""),a&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let i=0,s;for(let n=t-1;n>=0&&(s=e[n],!(s[0]!=="space"&&(i+=1,i===2)));n--);throw this.input.error("Missed semicolon",s[0]==="word"?s[3]+1:s[2])}colon(e){let t=0,i,s,n;for(let[o,a]of e.entries()){if(i=a,s=i[0],s==="("&&(t+=1),s===")"&&(t-=1),t===0&&s===":")if(!n)this.doubleColon(i);else{if(n[0]==="word"&&n[1]==="progid")continue;return o}n=i}return!1}comment(e){let t=new qp;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let i=e[1].slice(2,-2);if(/^\s*$/.test(i))t.text="",t.raws.left=i,t.raws.right="";else{let s=i.match(/^(\s*)([^]*\S)(\s*)$/);t.text=s[2],t.raws.left=s[1],t.raws.right=s[3]}}createTokenizer(){this.tokenizer=Kp(this.input)}decl(e,t){let i=new Jp;this.init(i,e[0][2]);let s=e[e.length-1];for(s[0]===";"&&(this.semicolon=!0,e.pop()),i.source.end=this.getPosition(s[3]||s[2]||tm(e)),i.source.end.offset++;e[0][0]!=="word";)e.length===1&&this.unknownWord(e),i.raws.before+=e.shift()[1];for(i.source.start=this.getPosition(e[0][2]),i.prop="";e.length;){let c=e[0][0];if(c===":"||c==="space"||c==="comment")break;i.prop+=e.shift()[1]}i.raws.between="";let n;for(;e.length;)if(n=e.shift(),n[0]===":"){i.raws.between+=n[1];break}else n[0]==="word"&&/\w/.test(n[1])&&this.unknownWord([n]),i.raws.between+=n[1];(i.prop[0]==="_"||i.prop[0]==="*")&&(i.raws.before+=i.prop[0],i.prop=i.prop.slice(1));let o=[],a;for(;e.length&&(a=e[0][0],!(a!=="space"&&a!=="comment"));)o.push(e.shift());this.precheckMissedSemicolon(e);for(let c=e.length-1;c>=0;c--){if(n=e[c],n[1].toLowerCase()==="!important"){i.important=!0;let u=this.stringFrom(e,c);u=this.spacesFromEnd(e)+u,u!==" !important"&&(i.raws.important=u);break}else if(n[1].toLowerCase()==="important"){let u=e.slice(0),h="";for(let f=c;f>0;f--){let d=u[f][0];if(h.trim().indexOf("!")===0&&d!=="space")break;h=u.pop()[1]+h}h.trim().indexOf("!")===0&&(i.important=!0,i.raws.important=h,e=u)}if(n[0]!=="space"&&n[0]!=="comment")break}e.some(c=>c[0]!=="space"&&c[0]!=="comment")&&(i.raws.between+=o.map(c=>c[1]).join(""),o=[]),this.raw(i,"value",o.concat(e),t),i.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new lo;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type==="rule"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="",e.type!=="comment"&&(this.semicolon=!1)}other(e){let t=!1,i=null,s=!1,n=null,o=[],a=e[1].startsWith("--"),l=[],c=e;for(;c;){if(i=c[0],l.push(c),i==="("||i==="[")n||(n=c),o.push(i==="("?")":"]");else if(a&&s&&i==="{")n||(n=c),o.push("}");else if(o.length===0)if(i===";")if(s){this.decl(l,a);return}else break;else if(i==="{"){this.rule(l);return}else if(i==="}"){this.tokenizer.back(l.pop()),t=!0;break}else i===":"&&(s=!0);else i===o[o.length-1]&&(o.pop(),o.length===0&&(n=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(n),t&&s){if(!a)for(;l.length&&(c=l[l.length-1][0],!(c!=="space"&&c!=="comment"));)this.tokenizer.back(l.pop());this.decl(l,a)}else this.unknownWord(l)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,i,s){let n,o,a=i.length,l="",c=!0,u,h;for(let f=0;f<a;f+=1)n=i[f],o=n[0],o==="space"&&f===a-1&&!s?c=!1:o==="comment"?(h=i[f-1]?i[f-1][0]:"empty",u=i[f+1]?i[f+1][0]:"empty",!co[h]&&!co[u]?l.slice(-1)===","?c=!1:l+=n[1]:c=!1):l+=n[1];if(!c){let f=i.reduce((d,g)=>d+g[1],"");e.raws[t]={raw:f,value:l}}e[t]=l}rule(e){e.pop();let t=new lo;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,i="";for(;e.length&&(t=e[e.length-1][0],!(t!=="space"&&t!=="comment"));)i=e.pop()[1]+i;return i}spacesAndCommentsFromStart(e){let t,i="";for(;e.length&&(t=e[0][0],!(t!=="space"&&t!=="comment"));)i+=e.shift()[1];return i}spacesFromEnd(e){let t,i="";for(;e.length&&(t=e[e.length-1][0],t==="space");)i=e.pop()[1]+i;return i}stringFrom(e,t){let i="";for(let s=t;s<e.length;s++)i+=e[s][1];return e.splice(t,e.length-t),i}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}};var im=rm;let sm=ze,nm=im,om=li;function Ur(r,e){let t=new om(r,e),i=new nm(t);try{i.parse()}catch(s){throw process.env.NODE_ENV!=="production"&&s.name==="CssSyntaxError"&&e&&e.from&&(/\.scss$/i.test(e.from)?s.message+=`
69
69
  You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser`:/\.sass/i.test(e.from)?s.message+=`
70
70
  You tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser`:/\.less$/i.test(e.from)&&(s.message+=`
71
- You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),s}return i.root}var Qs=Ur;Ur.default=Ur;sm.registerParse(Ur);let{isClean:Ce,my:am}=Ut,lm=ml,cm=ni,um=ze,hm=Xs,fm=Ml,uo=Js,dm=Qs,pm=zt;const mm={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},gm={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},ym={Once:!0,postcssPlugin:!0,prepare:!0},lt=0;function mt(r){return typeof r=="object"&&typeof r.then=="function"}function Pl(r){let e=!1,t=mm[r.type];return r.type==="decl"?e=r.prop.toLowerCase():r.type==="atrule"&&(e=r.name.toLowerCase()),e&&r.append?[t,t+"-"+e,lt,t+"Exit",t+"Exit-"+e]:e?[t,t+"-"+e,t+"Exit",t+"Exit-"+e]:r.append?[t,lt,t+"Exit"]:[t,t+"Exit"]}function ho(r){let e;return r.type==="document"?e=["Document",lt,"DocumentExit"]:r.type==="root"?e=["Root",lt,"RootExit"]:e=Pl(r),{eventIndex:0,events:e,iterator:0,node:r,visitorIndex:0,visitors:[]}}function ds(r){return r[Ce]=!1,r.nodes&&r.nodes.forEach(e=>ds(e)),r}let ps={},ct=class Ll{constructor(e,t,i){this.stringified=!1,this.processed=!1;let s;if(typeof t=="object"&&t!==null&&(t.type==="root"||t.type==="document"))s=ds(t);else if(t instanceof Ll||t instanceof uo)s=ds(t.root),t.map&&(typeof i.map>"u"&&(i.map={}),i.map.inline||(i.map.inline=!1),i.map.prev=t.map);else{let n=dm;i.syntax&&(n=i.syntax.parse),i.parser&&(n=i.parser),n.parse&&(n=n.parse);try{s=n(t,i)}catch(o){this.processed=!0,this.error=o}s&&!s[am]&&um.rebuild(s)}this.result=new uo(e,s,i),this.helpers={...ps,postcss:ps,result:this.result},this.plugins=this.processor.plugins.map(n=>typeof n=="object"&&n.prepare?{...n,...n.prepare(this.result)}:n)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let i=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,e.name==="CssSyntaxError"&&!e.plugin)e.plugin=i.postcssPlugin,e.setMessage();else if(i.postcssVersion&&process.env.NODE_ENV!=="production"){let s=i.postcssPlugin,n=i.postcssVersion,o=this.result.processor.version,a=n.split("."),l=o.split(".");(a[0]!==l[0]||parseInt(a[1])>parseInt(l[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+o+", but "+s+" uses "+n+". Perhaps this is the source of the error below.")}}catch(s){console&&console.error&&console.error(s)}return e}prepareVisitors(){this.listeners={};let e=(t,i,s)=>{this.listeners[i]||(this.listeners[i]=[]),this.listeners[i].push([t,s])};for(let t of this.plugins)if(typeof t=="object")for(let i in t){if(!gm[i]&&/^[A-Z]/.test(i))throw new Error(`Unknown event ${i} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!ym[i])if(typeof t[i]=="object")for(let s in t[i])s==="*"?e(t,i,t[i][s]):e(t,i+"-"+s.toLowerCase(),t[i][s]);else typeof t[i]=="function"&&e(t,i,t[i])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],i=this.runOnRoot(t);if(mt(i))try{await i}catch(s){throw this.handleError(s)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Ce];){e[Ce]=!0;let t=[ho(e)];for(;t.length>0;){let i=this.visitTick(t);if(mt(i))try{await i}catch(s){let n=t[t.length-1].node;throw this.handleError(s,n)}}}if(this.listeners.OnceExit)for(let[t,i]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type==="document"){let s=e.nodes.map(n=>i(n,this.helpers));await Promise.all(s)}else await i(e,this.helpers)}catch(s){throw this.handleError(s)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e=="object"&&e.Once){if(this.result.root.type==="document"){let t=this.result.root.nodes.map(i=>e.Once(i,this.helpers));return mt(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e=="function")return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=cm;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let s=new lm(t,this.result.root,this.result.opts).generate();return this.result.css=s[0],this.result.map=s[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){let t=this.runOnRoot(e);if(mt(t))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Ce];)e[Ce]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type==="document")for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return process.env.NODE_ENV!=="production"&&("from"in this.opts||fm("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[i,s]of e){this.result.lastPlugin=i;let n;try{n=s(t,this.helpers)}catch(o){throw this.handleError(o,t.proxyOf)}if(t.type!=="root"&&t.type!=="document"&&!t.parent)return!0;if(mt(n))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:i,visitors:s}=t;if(i.type!=="root"&&i.type!=="document"&&!i.parent){e.pop();return}if(s.length>0&&t.visitorIndex<s.length){let[o,a]=s[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===s.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=o;try{return a(i.toProxy(),this.helpers)}catch(l){throw this.handleError(l,i)}}if(t.iterator!==0){let o=t.iterator,a;for(;a=i.nodes[i.indexes[o]];)if(i.indexes[o]+=1,!a[Ce]){a[Ce]=!0,e.push(ho(a));return}t.iterator=0,delete i.indexes[o]}let n=t.events;for(;t.eventIndex<n.length;){let o=n[t.eventIndex];if(t.eventIndex+=1,o===lt){i.nodes&&i.nodes.length&&(i[Ce]=!0,t.iterator=i.getIterator());return}else if(this.listeners[o]){t.visitors=this.listeners[o];return}}e.pop()}walkSync(e){e[Ce]=!0;let t=Pl(e);for(let i of t)if(i===lt)e.nodes&&e.each(s=>{s[Ce]||this.walkSync(s)});else{let s=this.listeners[i];if(s&&this.visitSync(s,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};ct.registerPostcss=r=>{ps=r};var $l=ct;ct.default=ct;pm.registerLazyResult(ct);hm.registerLazyResult(ct);let wm=ml,bm=ni,vm=Ml,Sm=Qs;const Cm=Js;let ms=class{constructor(e,t,i){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=i,this._map=void 0;let s,n=bm;this.result=new Cm(this._processor,s,this._opts),this.result.css=t;let o=this;Object.defineProperty(this.result,"root",{get(){return o.root}});let a=new wm(n,s,this._opts,t);if(a.isMap()){let[l,c]=a.generate();l&&(this.result.css=l),c&&(this.result.map=c)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return process.env.NODE_ENV!=="production"&&("from"in this._opts||vm("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=Sm;try{e=t(this._css,this._opts)}catch(i){this.error=i}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}};var xm=ms;ms.default=ms;let Em=xm,Am=$l,Rm=Xs,Mm=zt,Pt=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let i of e)if(i.postcss===!0?i=i():i.postcss&&(i=i.postcss),typeof i=="object"&&Array.isArray(i.plugins))t=t.concat(i.plugins);else if(typeof i=="object"&&i.postcssPlugin)t.push(i);else if(typeof i=="function")t.push(i);else if(typeof i=="object"&&(i.parse||i.stringify)){if(process.env.NODE_ENV!=="production")throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}else throw new Error(i+" is not a PostCSS plugin");return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new Em(this,e,t):new Am(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var km=Pt;Pt.default=Pt;Mm.registerProcessor(Pt);Rm.registerProcessor(Pt);let Nm=ai,_m=ul,Im=ci,Dm=Ks,Tm=li,Om=zt,Pm=qs;function Lt(r,e){if(Array.isArray(r))return r.map(s=>Lt(s));let{inputs:t,...i}=r;if(t){e=[];for(let s of t){let n={...s,__proto__:Tm.prototype};n.map&&(n.map={...n.map,__proto__:_m.prototype}),e.push(n)}}if(i.nodes&&(i.nodes=r.nodes.map(s=>Lt(s,e))),i.source){let{inputId:s,...n}=i.source;i.source=n,s!=null&&(i.source.input=e[s])}if(i.type==="root")return new Om(i);if(i.type==="decl")return new Nm(i);if(i.type==="rule")return new Pm(i);if(i.type==="comment")return new Im(i);if(i.type==="atrule")return new Dm(i);throw new Error("Unknown node type: "+r.type)}var Lm=Lt;Lt.default=Lt;let $m=Ys,Fl=ai,Fm=$l,jm=ze,en=km,Bm=ni,Um=Lm,jl=Xs,zm=kl,Bl=ci,Ul=Ks,Wm=Js,Vm=li,Gm=Qs,Ym=Tl,zl=qs,Wl=zt,Hm=oi;function z(...r){return r.length===1&&Array.isArray(r[0])&&(r=r[0]),new en(r)}z.plugin=function(e,t){let i=!1;function s(...o){console&&console.warn&&!i&&(i=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:
71
+ You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),s}return i.root}var Qs=Ur;Ur.default=Ur;sm.registerParse(Ur);let{isClean:Ce,my:am}=Ut,lm=ml,cm=ni,um=ze,hm=Xs,fm=kl,uo=Js,dm=Qs,pm=zt;const mm={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},gm={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},ym={Once:!0,postcssPlugin:!0,prepare:!0},lt=0;function mt(r){return typeof r=="object"&&typeof r.then=="function"}function Pl(r){let e=!1,t=mm[r.type];return r.type==="decl"?e=r.prop.toLowerCase():r.type==="atrule"&&(e=r.name.toLowerCase()),e&&r.append?[t,t+"-"+e,lt,t+"Exit",t+"Exit-"+e]:e?[t,t+"-"+e,t+"Exit",t+"Exit-"+e]:r.append?[t,lt,t+"Exit"]:[t,t+"Exit"]}function ho(r){let e;return r.type==="document"?e=["Document",lt,"DocumentExit"]:r.type==="root"?e=["Root",lt,"RootExit"]:e=Pl(r),{eventIndex:0,events:e,iterator:0,node:r,visitorIndex:0,visitors:[]}}function ds(r){return r[Ce]=!1,r.nodes&&r.nodes.forEach(e=>ds(e)),r}let ps={},ct=class Ll{constructor(e,t,i){this.stringified=!1,this.processed=!1;let s;if(typeof t=="object"&&t!==null&&(t.type==="root"||t.type==="document"))s=ds(t);else if(t instanceof Ll||t instanceof uo)s=ds(t.root),t.map&&(typeof i.map>"u"&&(i.map={}),i.map.inline||(i.map.inline=!1),i.map.prev=t.map);else{let n=dm;i.syntax&&(n=i.syntax.parse),i.parser&&(n=i.parser),n.parse&&(n=n.parse);try{s=n(t,i)}catch(o){this.processed=!0,this.error=o}s&&!s[am]&&um.rebuild(s)}this.result=new uo(e,s,i),this.helpers={...ps,postcss:ps,result:this.result},this.plugins=this.processor.plugins.map(n=>typeof n=="object"&&n.prepare?{...n,...n.prepare(this.result)}:n)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let i=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,e.name==="CssSyntaxError"&&!e.plugin)e.plugin=i.postcssPlugin,e.setMessage();else if(i.postcssVersion&&process.env.NODE_ENV!=="production"){let s=i.postcssPlugin,n=i.postcssVersion,o=this.result.processor.version,a=n.split("."),l=o.split(".");(a[0]!==l[0]||parseInt(a[1])>parseInt(l[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+o+", but "+s+" uses "+n+". Perhaps this is the source of the error below.")}}catch(s){console&&console.error&&console.error(s)}return e}prepareVisitors(){this.listeners={};let e=(t,i,s)=>{this.listeners[i]||(this.listeners[i]=[]),this.listeners[i].push([t,s])};for(let t of this.plugins)if(typeof t=="object")for(let i in t){if(!gm[i]&&/^[A-Z]/.test(i))throw new Error(`Unknown event ${i} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!ym[i])if(typeof t[i]=="object")for(let s in t[i])s==="*"?e(t,i,t[i][s]):e(t,i+"-"+s.toLowerCase(),t[i][s]);else typeof t[i]=="function"&&e(t,i,t[i])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],i=this.runOnRoot(t);if(mt(i))try{await i}catch(s){throw this.handleError(s)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Ce];){e[Ce]=!0;let t=[ho(e)];for(;t.length>0;){let i=this.visitTick(t);if(mt(i))try{await i}catch(s){let n=t[t.length-1].node;throw this.handleError(s,n)}}}if(this.listeners.OnceExit)for(let[t,i]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type==="document"){let s=e.nodes.map(n=>i(n,this.helpers));await Promise.all(s)}else await i(e,this.helpers)}catch(s){throw this.handleError(s)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e=="object"&&e.Once){if(this.result.root.type==="document"){let t=this.result.root.nodes.map(i=>e.Once(i,this.helpers));return mt(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e=="function")return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=cm;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let s=new lm(t,this.result.root,this.result.opts).generate();return this.result.css=s[0],this.result.map=s[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){let t=this.runOnRoot(e);if(mt(t))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Ce];)e[Ce]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type==="document")for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return process.env.NODE_ENV!=="production"&&("from"in this.opts||fm("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[i,s]of e){this.result.lastPlugin=i;let n;try{n=s(t,this.helpers)}catch(o){throw this.handleError(o,t.proxyOf)}if(t.type!=="root"&&t.type!=="document"&&!t.parent)return!0;if(mt(n))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:i,visitors:s}=t;if(i.type!=="root"&&i.type!=="document"&&!i.parent){e.pop();return}if(s.length>0&&t.visitorIndex<s.length){let[o,a]=s[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===s.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=o;try{return a(i.toProxy(),this.helpers)}catch(l){throw this.handleError(l,i)}}if(t.iterator!==0){let o=t.iterator,a;for(;a=i.nodes[i.indexes[o]];)if(i.indexes[o]+=1,!a[Ce]){a[Ce]=!0,e.push(ho(a));return}t.iterator=0,delete i.indexes[o]}let n=t.events;for(;t.eventIndex<n.length;){let o=n[t.eventIndex];if(t.eventIndex+=1,o===lt){i.nodes&&i.nodes.length&&(i[Ce]=!0,t.iterator=i.getIterator());return}else if(this.listeners[o]){t.visitors=this.listeners[o];return}}e.pop()}walkSync(e){e[Ce]=!0;let t=Pl(e);for(let i of t)if(i===lt)e.nodes&&e.each(s=>{s[Ce]||this.walkSync(s)});else{let s=this.listeners[i];if(s&&this.visitSync(s,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};ct.registerPostcss=r=>{ps=r};var $l=ct;ct.default=ct;pm.registerLazyResult(ct);hm.registerLazyResult(ct);let wm=ml,bm=ni,vm=kl,Sm=Qs;const Cm=Js;let ms=class{constructor(e,t,i){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=i,this._map=void 0;let s,n=bm;this.result=new Cm(this._processor,s,this._opts),this.result.css=t;let o=this;Object.defineProperty(this.result,"root",{get(){return o.root}});let a=new wm(n,s,this._opts,t);if(a.isMap()){let[l,c]=a.generate();l&&(this.result.css=l),c&&(this.result.map=c)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return process.env.NODE_ENV!=="production"&&("from"in this._opts||vm("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=Sm;try{e=t(this._css,this._opts)}catch(i){this.error=i}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}};var xm=ms;ms.default=ms;let Em=xm,Am=$l,Rm=Xs,km=zt,Pt=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let i of e)if(i.postcss===!0?i=i():i.postcss&&(i=i.postcss),typeof i=="object"&&Array.isArray(i.plugins))t=t.concat(i.plugins);else if(typeof i=="object"&&i.postcssPlugin)t.push(i);else if(typeof i=="function")t.push(i);else if(typeof i=="object"&&(i.parse||i.stringify)){if(process.env.NODE_ENV!=="production")throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}else throw new Error(i+" is not a PostCSS plugin");return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new Em(this,e,t):new Am(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var Mm=Pt;Pt.default=Pt;km.registerProcessor(Pt);Rm.registerProcessor(Pt);let Nm=ai,_m=ul,Im=ci,Dm=Ks,Tm=li,Om=zt,Pm=qs;function Lt(r,e){if(Array.isArray(r))return r.map(s=>Lt(s));let{inputs:t,...i}=r;if(t){e=[];for(let s of t){let n={...s,__proto__:Tm.prototype};n.map&&(n.map={...n.map,__proto__:_m.prototype}),e.push(n)}}if(i.nodes&&(i.nodes=r.nodes.map(s=>Lt(s,e))),i.source){let{inputId:s,...n}=i.source;i.source=n,s!=null&&(i.source.input=e[s])}if(i.type==="root")return new Om(i);if(i.type==="decl")return new Nm(i);if(i.type==="rule")return new Pm(i);if(i.type==="comment")return new Im(i);if(i.type==="atrule")return new Dm(i);throw new Error("Unknown node type: "+r.type)}var Lm=Lt;Lt.default=Lt;let $m=Ys,jl=ai,jm=$l,Fm=ze,en=Mm,Bm=ni,Um=Lm,Fl=Xs,zm=Ml,Bl=ci,Ul=Ks,Wm=Js,Vm=li,Gm=Qs,Ym=Tl,zl=qs,Wl=zt,Hm=oi;function z(...r){return r.length===1&&Array.isArray(r[0])&&(r=r[0]),new en(r)}z.plugin=function(e,t){let i=!1;function s(...o){console&&console.warn&&!i&&(i=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:
72
72
  https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+`: 里面 postcss.plugin 被弃用. 迁移指南:
73
- https://www.w3ctech.com/topic/2226`));let a=t(...o);return a.postcssPlugin=e,a.postcssVersion=new en().version,a}let n;return Object.defineProperty(s,"postcss",{get(){return n||(n=s()),n}}),s.process=function(o,a,l){return z([s(l)]).process(o,a)},s};z.stringify=Bm;z.parse=Gm;z.fromJSON=Um;z.list=Ym;z.comment=r=>new Bl(r);z.atRule=r=>new Ul(r);z.decl=r=>new Fl(r);z.rule=r=>new zl(r);z.root=r=>new Wl(r);z.document=r=>new jl(r);z.CssSyntaxError=$m;z.Declaration=Fl;z.Container=jm;z.Processor=en;z.Document=jl;z.Comment=Bl;z.Warning=zm;z.AtRule=Ul;z.Result=Wm;z.Input=Vm;z.Rule=zl;z.Root=Wl;z.Node=Hm;Fm.registerPostcss(z);var Zm=z;z.default=z;const X=np(Zm);X.stringify;X.fromJSON;X.plugin;X.parse;X.list;X.document;X.comment;X.atRule;X.rule;X.decl;X.root;X.CssSyntaxError;X.Declaration;X.Container;X.Processor;X.Document;X.Comment;X.Warning;X.AtRule;X.Result;X.Input;X.Rule;X.Root;X.Node;var T=(r=>(r[r.Document=0]="Document",r[r.DocumentType=1]="DocumentType",r[r.Element=2]="Element",r[r.Text=3]="Text",r[r.CDATA=4]="CDATA",r[r.Comment=5]="Comment",r))(T||{});function Xm(r){const e={},t=/;(?![^(]*\))/g,i=/:(.+)/,s=/\/\*.*?\*\//g;return r.replace(s,"").split(t).forEach(function(n){if(n){const o=n.split(i);o.length>1&&(e[gs(o[0].trim())]=o[1].trim())}}),e}function fo(r){const e=[];for(const t in r){const i=r[t];if(typeof i!="string")continue;const s=Qm(t);e.push(`${s}: ${i};`)}return e.join(" ")}const Jm=/-([a-z])/g,Km=/^--[a-zA-Z0-9-]+$/,gs=r=>Km.test(r)?r:r.replace(Jm,(e,t)=>t?t.toUpperCase():""),qm=/\B([A-Z])/g,Qm=r=>r.replace(qm,"-$1").toLowerCase();class we{constructor(...e){E(this,"parentElement",null),E(this,"parentNode",null),E(this,"ownerDocument"),E(this,"firstChild",null),E(this,"lastChild",null),E(this,"previousSibling",null),E(this,"nextSibling",null),E(this,"ELEMENT_NODE",1),E(this,"TEXT_NODE",3),E(this,"nodeType"),E(this,"nodeName"),E(this,"RRNodeType")}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(e instanceof we){if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0}else return!1;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}class tn extends we{constructor(...e){super(e),E(this,"nodeType",9),E(this,"nodeName","#document"),E(this,"compatMode","CSS1Compat"),E(this,"RRNodeType",T.Document),E(this,"textContent",null),this.ownerDocument=this}get documentElement(){return this.childNodes.find(e=>e.RRNodeType===T.Element&&e.tagName==="HTML")||null}get body(){var e;return((e=this.documentElement)==null?void 0:e.childNodes.find(t=>t.RRNodeType===T.Element&&t.tagName==="BODY"))||null}get head(){var e;return((e=this.documentElement)==null?void 0:e.childNodes.find(t=>t.RRNodeType===T.Element&&t.tagName==="HEAD"))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(e){const t=e.RRNodeType;if((t===T.Element||t===T.DocumentType)&&this.childNodes.some(s=>s.RRNodeType===t))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${t===T.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const i=rn(this,e);return i.parentElement=null,i}insertBefore(e,t){const i=e.RRNodeType;if((i===T.Element||i===T.DocumentType)&&this.childNodes.some(n=>n.RRNodeType===i))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${i===T.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const s=Zl(this,e,t);return s.parentElement=null,s}removeChild(e){return Xl(this,e)}open(){this.firstChild=null,this.lastChild=null}close(){}write(e){let t;if(e==='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'?t="-//W3C//DTD XHTML 1.0 Transitional//EN":e==='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'&&(t="-//W3C//DTD HTML 4.0 Transitional//EN"),t){const i=this.createDocumentType("html",t,"");this.open(),this.appendChild(i)}}createDocument(e,t,i){return new tn}createDocumentType(e,t,i){const s=new Vl(e,t,i);return s.ownerDocument=this,s}createElement(e){const t=new ui(e);return t.ownerDocument=this,t}createElementNS(e,t){return this.createElement(t)}createTextNode(e){const t=new Gl(e);return t.ownerDocument=this,t}createComment(e){const t=new Yl(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new Hl(e);return t.ownerDocument=this,t}toString(){return"RRDocument"}}class Vl extends we{constructor(e,t,i){super(),E(this,"nodeType",10),E(this,"RRNodeType",T.DocumentType),E(this,"name"),E(this,"publicId"),E(this,"systemId"),E(this,"textContent",null),this.name=e,this.publicId=t,this.systemId=i,this.nodeName=e}toString(){return"RRDocumentType"}}class ui extends we{constructor(e){super(),E(this,"nodeType",1),E(this,"RRNodeType",T.Element),E(this,"tagName"),E(this,"attributes",{}),E(this,"shadowRoot",null),E(this,"scrollLeft"),E(this,"scrollTop"),this.tagName=e.toUpperCase(),this.nodeName=e.toUpperCase()}get textContent(){let e="";return this.childNodes.forEach(t=>e+=t.textContent),e}set textContent(e){this.firstChild=null,this.lastChild=null,this.appendChild(this.ownerDocument.createTextNode(e))}get classList(){return new rg(this.attributes.class,e=>{this.attributes.class=e})}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const e=this.attributes.style?Xm(this.attributes.style):{},t=/\B([A-Z])/g;return e.setProperty=(i,s,n)=>{if(t.test(i))return;const o=gs(i);s?e[o]=s:delete e[o],n==="important"&&(e[o]+=" !important"),this.attributes.style=fo(e)},e.removeProperty=i=>{if(t.test(i))return"";const s=gs(i),n=e[s]||"";return delete e[s],this.attributes.style=fo(e),n},e}getAttribute(e){return this.attributes[e]===void 0?null:this.attributes[e]}setAttribute(e,t){this.attributes[e]=t}setAttributeNS(e,t,i){this.setAttribute(t,i)}removeAttribute(e){delete this.attributes[e]}appendChild(e){return rn(this,e)}insertBefore(e,t){return Zl(this,e,t)}removeChild(e){return Xl(this,e)}attachShadow(e){const t=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=t,t}dispatchEvent(e){return!0}toString(){let e="";for(const t in this.attributes)e+=`${t}="${this.attributes[t]}" `;return`${this.tagName} ${e}`}}class eg extends ui{constructor(){super(...arguments),E(this,"currentTime"),E(this,"volume"),E(this,"paused"),E(this,"muted"),E(this,"playbackRate"),E(this,"loop")}attachShadow(e){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}class tg extends ui{constructor(){super(...arguments),E(this,"tagName","DIALOG"),E(this,"nodeName","DIALOG")}get isModal(){return this.getAttribute("rr_open_mode")==="modal"}get open(){return this.getAttribute("open")!==null}close(){this.removeAttribute("open"),this.removeAttribute("rr_open_mode")}show(){this.setAttribute("open",""),this.setAttribute("rr_open_mode","non-modal")}showModal(){this.setAttribute("open",""),this.setAttribute("rr_open_mode","modal")}}class Gl extends we{constructor(e){super(),E(this,"nodeType",3),E(this,"nodeName","#text"),E(this,"RRNodeType",T.Text),E(this,"data"),this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRText text=${JSON.stringify(this.data)}`}}class Yl extends we{constructor(e){super(),E(this,"nodeType",8),E(this,"nodeName","#comment"),E(this,"RRNodeType",T.Comment),E(this,"data"),this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}class Hl extends we{constructor(e){super(),E(this,"nodeName","#cdata-section"),E(this,"nodeType",4),E(this,"RRNodeType",T.CDATA),E(this,"data"),this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}class rg{constructor(e,t){if(E(this,"onChange"),E(this,"classes",[]),E(this,"add",(...i)=>{for(const s of i){const n=String(s);this.classes.indexOf(n)>=0||this.classes.push(n)}this.onChange&&this.onChange(this.classes.join(" "))}),E(this,"remove",(...i)=>{this.classes=this.classes.filter(s=>i.indexOf(s)===-1),this.onChange&&this.onChange(this.classes.join(" "))}),e){const i=e.trim().split(/\s+/);this.classes.push(...i)}this.onChange=t}}function rn(r,e){return e.parentNode&&e.parentNode.removeChild(e),r.lastChild?(r.lastChild.nextSibling=e,e.previousSibling=r.lastChild):(r.firstChild=e,e.previousSibling=null),r.lastChild=e,e.nextSibling=null,e.parentNode=r,e.parentElement=r,e.ownerDocument=r.ownerDocument,e}function Zl(r,e,t){if(!t)return rn(r,e);if(t.parentNode!==r)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return e===t||(e.parentNode&&e.parentNode.removeChild(e),e.previousSibling=t.previousSibling,t.previousSibling=e,e.nextSibling=t,e.previousSibling?e.previousSibling.nextSibling=e:r.firstChild=e,e.parentElement=r,e.parentNode=r,e.ownerDocument=r.ownerDocument),e}function Xl(r,e){if(e.parentNode!==r)throw new Error("Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode.");return e.previousSibling?e.previousSibling.nextSibling=e.nextSibling:r.firstChild=e.nextSibling,e.nextSibling?e.nextSibling.previousSibling=e.previousSibling:r.lastChild=e.previousSibling,e.previousSibling=null,e.nextSibling=null,e.parentElement=null,e.parentNode=null,e}var ue=(r=>(r[r.PLACEHOLDER=0]="PLACEHOLDER",r[r.ELEMENT_NODE=1]="ELEMENT_NODE",r[r.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",r[r.TEXT_NODE=3]="TEXT_NODE",r[r.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",r[r.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",r[r.ENTITY_NODE=6]="ENTITY_NODE",r[r.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",r[r.COMMENT_NODE=8]="COMMENT_NODE",r[r.DOCUMENT_NODE=9]="DOCUMENT_NODE",r[r.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",r[r.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE",r))(ue||{});const ys={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},ig={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};let xe=null;function zr(r,e,t,i=e.mirror||e.ownerDocument.mirror){r=sg(r,e,t,i),Jl(r,e,t,i),ng(r,e,t)}function sg(r,e,t,i){var s;if(t.afterAppend&&!xe&&(xe=new WeakSet,setTimeout(()=>{xe=null},0)),!sn(r,e)){const n=Wr(e,t.mirror,i);(s=r.parentNode)==null||s.replaceChild(n,r),r=n}switch(e.RRNodeType){case T.Document:{if(!He(r,e,t.mirror,i)){const n=i.getMeta(e);n&&(t.mirror.removeNodeFromMap(r),r.close(),r.open(),t.mirror.add(r,n),xe?.add(r))}break}case T.Element:{const n=r,o=e;switch(o.tagName){case"IFRAME":{const a=r.contentDocument;if(!a)break;zr(a,e.contentDocument,t,i);break}}o.shadowRoot&&(n.shadowRoot||n.attachShadow({mode:"open"}),Jl(n.shadowRoot,o.shadowRoot,t,i)),og(n,o,i);break}}return r}function ng(r,e,t){var i;switch(e.RRNodeType){case T.Document:{const s=e.scrollData;s&&t.applyScroll(s,!0);break}case T.Element:{const s=r,n=e;switch(n.scrollData&&t.applyScroll(n.scrollData,!0),n.inputData&&t.applyInput(n.inputData),n.tagName){case"AUDIO":case"VIDEO":{const o=r,a=n;a.paused!==void 0&&(a.paused?o.pause():o.play()),a.muted!==void 0&&(o.muted=a.muted),a.volume!==void 0&&(o.volume=a.volume),a.currentTime!==void 0&&(o.currentTime=a.currentTime),a.playbackRate!==void 0&&(o.playbackRate=a.playbackRate),a.loop!==void 0&&(o.loop=a.loop);break}case"CANVAS":{const o=e;if(o.rr_dataURL!==null){const a=document.createElement("img");a.onload=()=>{const l=s.getContext("2d");l&&l.drawImage(a,0,0,a.width,a.height)},a.src=o.rr_dataURL}o.canvasMutations.forEach(a=>t.applyCanvas(a.event,a.mutation,r));break}case"STYLE":{const o=s.sheet;o&&e.rules.forEach(a=>t.applyStyleSheetMutation(a,o));break}case"DIALOG":{const o=s,a=n,l=o.open,c=o.matches("dialog:modal"),u=a.open,h=a.isModal,f=c!==h,d=l!==u;if((f||l&&d)&&o.close(),u&&(d||f))try{h?o.showModal():o.show()}catch(m){console.warn(m)}break}}break}case T.Text:case T.Comment:case T.CDATA:{r.textContent!==e.data&&(r.textContent=e.data);break}}xe?.has(r)&&(xe.delete(r),(i=t.afterAppend)==null||i.call(t,r,t.mirror.getId(r)))}function og(r,e,t){const i=r.attributes,s=e.attributes;for(const n in s){const o=s[n],a=t.getMeta(e);if(a?.isSVG&&ys[n])r.setAttributeNS(ys[n],n,o);else if(e.tagName==="CANVAS"&&n==="rr_dataURL"){const l=document.createElement("img");l.src=o,l.onload=()=>{const c=r.getContext("2d");c&&c.drawImage(l,0,0,l.width,l.height)}}else{if(e.tagName==="IFRAME"&&n==="srcdoc")continue;try{r.setAttribute(n,o)}catch(l){console.warn(l)}}}for(const{name:n}of Array.from(i))n in s||r.removeAttribute(n);e.scrollLeft&&(r.scrollLeft=e.scrollLeft),e.scrollTop&&(r.scrollTop=e.scrollTop)}function Jl(r,e,t,i){const s=Array.from(r.childNodes),n=e.childNodes;if(s.length===0&&n.length===0)return;let o=0,a=s.length-1,l=0,c=n.length-1,u=s[o],h=s[a],f=n[l],d=n[c],m,w;for(;o<=a&&l<=c;)if(u===void 0)u=s[++o];else if(h===void 0)h=s[--a];else if(He(u,f,t.mirror,i))u=s[++o],f=n[++l];else if(He(h,d,t.mirror,i))h=s[--a],d=n[--c];else if(He(u,d,t.mirror,i)){try{r.insertBefore(u,h.nextSibling)}catch(b){console.warn(b)}u=s[++o],d=n[--c]}else if(He(h,f,t.mirror,i)){try{r.insertBefore(h,u)}catch(b){console.warn(b)}h=s[--a],f=n[++l]}else{if(!m){m={};for(let v=o;v<=a;v++){const x=s[v];x&&t.mirror.hasNode(x)&&(m[t.mirror.getId(x)]=v)}}w=m[i.getId(f)];const b=s[w];if(w!==void 0&&b&&He(b,f,t.mirror,i)){try{r.insertBefore(b,u)}catch(v){console.warn(v)}s[w]=void 0}else{const v=Wr(f,t.mirror,i);r.nodeName==="#document"&&u&&(v.nodeType===v.DOCUMENT_TYPE_NODE&&u.nodeType===u.DOCUMENT_TYPE_NODE||v.nodeType===v.ELEMENT_NODE&&u.nodeType===u.ELEMENT_NODE)&&(r.removeChild(u),t.mirror.removeNodeFromMap(u),u=s[++o]);try{r.insertBefore(v,u||null)}catch(x){console.warn(x)}}f=n[++l]}if(o>a){const b=n[c+1];let v=null;for(b&&(v=t.mirror.getNode(i.getId(b)));l<=c;++l){const x=Wr(n[l],t.mirror,i);try{r.insertBefore(x,v)}catch(M){console.warn(M)}}}else if(l>c)for(;o<=a;o++){const b=s[o];if(!(!b||b.parentNode!==r))try{r.removeChild(b),t.mirror.removeNodeFromMap(b)}catch(v){console.warn(v)}}let p=r.firstChild,y=e.firstChild;for(;p!==null&&y!==null;)zr(p,y,t,i),p=p.nextSibling,y=y.nextSibling}function Wr(r,e,t){const i=t.getId(r),s=t.getMeta(r);let n=null;if(i>-1&&(n=e.getNode(i)),n!==null&&sn(n,r))return n;switch(r.RRNodeType){case T.Document:n=new Document;break;case T.DocumentType:n=document.implementation.createDocumentType(r.name,r.publicId,r.systemId);break;case T.Element:{let o=r.tagName.toLowerCase();o=ig[o]||o,s&&"isSVG"in s&&s?.isSVG?n=document.createElementNS(ys.svg,o):n=document.createElement(r.tagName);break}case T.Text:n=document.createTextNode(r.data);break;case T.Comment:n=document.createComment(r.data);break;case T.CDATA:n=document.createCDATASection(r.data);break}s&&e.add(n,{...s});try{xe?.add(n)}catch{}return n}function sn(r,e){return r.nodeType!==e.nodeType?!1:r.nodeType!==r.ELEMENT_NODE||r.tagName.toUpperCase()===e.tagName}function He(r,e,t,i){const s=t.getId(r),n=i.getId(e);return s===-1||s!==n?!1:sn(r,e)}class ht extends tn{constructor(e){super(),E(this,"UNSERIALIZED_STARTING_ID",-2),E(this,"_unserializedId",this.UNSERIALIZED_STARTING_ID),E(this,"mirror",wg()),E(this,"scrollData",null),e&&(this.mirror=e)}get unserializedId(){return this._unserializedId--}createDocument(e,t,i){return new ht}createDocumentType(e,t,i){const s=new ag(e,t,i);return s.ownerDocument=this,s}createElement(e){const t=e.toUpperCase();let i;switch(t){case"AUDIO":case"VIDEO":i=new lg(t);break;case"IFRAME":i=new fg(t,this.mirror);break;case"CANVAS":i=new ug(t);break;case"STYLE":i=new hg(t);break;case"DIALOG":i=new cg(t);break;default:i=new hi(t);break}return i.ownerDocument=this,i}createComment(e){const t=new pg(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new mg(e);return t.ownerDocument=this,t}createTextNode(e){const t=new dg(e);return t.ownerDocument=this,t}destroyTree(){this.firstChild=null,this.lastChild=null,this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}}const ag=Vl;class hi extends ui{constructor(){super(...arguments),E(this,"inputData",null),E(this,"scrollData",null)}}class lg extends eg{}class cg extends tg{}class ug extends hi{constructor(){super(...arguments),E(this,"rr_dataURL",null),E(this,"canvasMutations",[])}getContext(){return null}}class hg extends hi{constructor(){super(...arguments),E(this,"rules",[])}}class fg extends hi{constructor(e,t){super(e),E(this,"contentDocument",new ht),this.contentDocument.mirror=t}}const dg=Gl,pg=Yl,mg=Hl;function gg(r){return r instanceof HTMLFormElement?"FORM":r.tagName.toUpperCase()}function Kl(r,e,t,i){let s;switch(r.nodeType){case ue.DOCUMENT_NODE:i&&i.nodeName==="IFRAME"?s=i.contentDocument:(s=e,s.compatMode=r.compatMode);break;case ue.DOCUMENT_TYPE_NODE:{const o=r;s=e.createDocumentType(o.name,o.publicId,o.systemId);break}case ue.ELEMENT_NODE:{const o=r,a=gg(o);s=e.createElement(a);const l=s;for(const{name:c,value:u}of Array.from(o.attributes))l.attributes[c]=u;o.scrollLeft&&(l.scrollLeft=o.scrollLeft),o.scrollTop&&(l.scrollTop=o.scrollTop);break}case ue.TEXT_NODE:s=e.createTextNode(r.textContent||"");break;case ue.CDATA_SECTION_NODE:s=e.createCDATASection(r.data);break;case ue.COMMENT_NODE:s=e.createComment(r.textContent||"");break;case ue.DOCUMENT_FRAGMENT_NODE:s=i.attachShadow({mode:"open"});break;default:return null}let n=t.getMeta(r);return e instanceof ht&&(n||(n=ql(s,e.unserializedId),t.add(r,n)),e.mirror.add(s,{...n})),s}function yg(r,e=sp(),t=new ht){function i(s,n){const o=Kl(s,t,e,n);if(o!==null)if(n?.nodeName!=="IFRAME"&&s.nodeType!==ue.DOCUMENT_FRAGMENT_NODE&&(n?.appendChild(o),o.parentNode=n,o.parentElement=n),s.nodeName==="IFRAME"){const a=s.contentDocument;a&&i(a,o)}else(s.nodeType===ue.DOCUMENT_NODE||s.nodeType===ue.ELEMENT_NODE||s.nodeType===ue.DOCUMENT_FRAGMENT_NODE)&&(s.nodeType===ue.ELEMENT_NODE&&s.shadowRoot&&i(s.shadowRoot,o),s.childNodes.forEach(a=>i(a,o)))}return i(r,null),t}function wg(){return new bg}class bg{constructor(){E(this,"idNodeMap",new Map),E(this,"nodeMetaMap",new WeakMap)}getId(e){var t;return e?((t=this.getMeta(e))==null?void 0:t.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(i=>this.removeNodeFromMap(i))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const i=t.id;this.idNodeMap.set(i,e),this.nodeMetaMap.set(e,t)}replace(e,t){const i=this.getNode(e);if(i){const s=this.nodeMetaMap.get(i);s&&this.nodeMetaMap.set(t,s)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function ql(r,e){switch(r.RRNodeType){case T.Document:return{id:e,type:r.RRNodeType,childNodes:[]};case T.DocumentType:{const t=r;return{id:e,type:r.RRNodeType,name:t.name,publicId:t.publicId,systemId:t.systemId}}case T.Element:return{id:e,type:r.RRNodeType,tagName:r.tagName.toLowerCase(),attributes:{},childNodes:[]};case T.Text:return{id:e,type:r.RRNodeType,textContent:r.textContent||""};case T.Comment:return{id:e,type:r.RRNodeType,textContent:r.textContent||""};case T.CDATA:return{id:e,type:r.RRNodeType,textContent:""}}}const po={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},mo={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},pr={},vg=()=>!!globalThis.Zone;function nn(r){if(pr[r])return pr[r];const e=globalThis[r],t=e.prototype,i=r in po?po[r]:void 0,s=!!(i&&i.every(a=>{var l,c;return!!((c=(l=Object.getOwnPropertyDescriptor(t,a))==null?void 0:l.get)!=null&&c.toString().includes("[native code]"))})),n=r in mo?mo[r]:void 0,o=!!(n&&n.every(a=>{var l;return typeof t[a]=="function"&&((l=t[a])==null?void 0:l.toString().includes("[native code]"))}));if(s&&o&&!vg())return pr[r]=e.prototype,e.prototype;try{const a=document.createElement("iframe");document.body.appendChild(a);const l=a.contentWindow;if(!l)return e.prototype;const c=l[r].prototype;return document.body.removeChild(a),c?pr[r]=c:t}catch{return t}}const xi={};function Ie(r,e,t){var i;const s=`${r}.${String(t)}`;if(xi[s])return xi[s].call(e);const n=nn(r),o=(i=Object.getOwnPropertyDescriptor(n,t))==null?void 0:i.get;return o?(xi[s]=o,o.call(e)):e[t]}const Ei={};function Ql(r,e,t){const i=`${r}.${String(t)}`;if(Ei[i])return Ei[i].bind(e);const n=nn(r)[t];return typeof n!="function"?e[t]:(Ei[i]=n,n.bind(e))}function Sg(r){return Ie("Node",r,"ownerDocument")}function Cg(r){return Ie("Node",r,"childNodes")}function xg(r){return Ie("Node",r,"parentNode")}function Eg(r){return Ie("Node",r,"parentElement")}function Ag(r){return Ie("Node",r,"textContent")}function Rg(r,e){return Ql("Node",r,"contains")(e)}function Mg(r){return Ql("Node",r,"getRootNode")()}function kg(r){return!r||!("host"in r)?null:Ie("ShadowRoot",r,"host")}function Ng(r){return r.styleSheets}function _g(r){return!r||!("shadowRoot"in r)?null:Ie("Element",r,"shadowRoot")}function Ig(r,e){return Ie("Element",r,"querySelector")(e)}function Dg(r,e){return Ie("Element",r,"querySelectorAll")(e)}function Tg(){return nn("MutationObserver").constructor}function Og(r,e,t){try{if(!(e in r))return()=>{};const i=r[e],s=t(i);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i}})),r[e]=s,()=>{r[e]=i}}catch{return()=>{}}}const Pg={ownerDocument:Sg,childNodes:Cg,parentNode:xg,parentElement:Eg,textContent:Ag,contains:Rg,getRootNode:Mg,host:kg,styleSheets:Ng,shadowRoot:_g,querySelector:Ig,querySelectorAll:Dg,mutationObserver:Tg,patch:Og},Ze=`Please stop import mirror directly. Instead of that,\r
73
+ https://www.w3ctech.com/topic/2226`));let a=t(...o);return a.postcssPlugin=e,a.postcssVersion=new en().version,a}let n;return Object.defineProperty(s,"postcss",{get(){return n||(n=s()),n}}),s.process=function(o,a,l){return z([s(l)]).process(o,a)},s};z.stringify=Bm;z.parse=Gm;z.fromJSON=Um;z.list=Ym;z.comment=r=>new Bl(r);z.atRule=r=>new Ul(r);z.decl=r=>new jl(r);z.rule=r=>new zl(r);z.root=r=>new Wl(r);z.document=r=>new Fl(r);z.CssSyntaxError=$m;z.Declaration=jl;z.Container=Fm;z.Processor=en;z.Document=Fl;z.Comment=Bl;z.Warning=zm;z.AtRule=Ul;z.Result=Wm;z.Input=Vm;z.Rule=zl;z.Root=Wl;z.Node=Hm;jm.registerPostcss(z);var Zm=z;z.default=z;const X=np(Zm);X.stringify;X.fromJSON;X.plugin;X.parse;X.list;X.document;X.comment;X.atRule;X.rule;X.decl;X.root;X.CssSyntaxError;X.Declaration;X.Container;X.Processor;X.Document;X.Comment;X.Warning;X.AtRule;X.Result;X.Input;X.Rule;X.Root;X.Node;var T=(r=>(r[r.Document=0]="Document",r[r.DocumentType=1]="DocumentType",r[r.Element=2]="Element",r[r.Text=3]="Text",r[r.CDATA=4]="CDATA",r[r.Comment=5]="Comment",r))(T||{});function Xm(r){const e={},t=/;(?![^(]*\))/g,i=/:(.+)/,s=/\/\*.*?\*\//g;return r.replace(s,"").split(t).forEach(function(n){if(n){const o=n.split(i);o.length>1&&(e[gs(o[0].trim())]=o[1].trim())}}),e}function fo(r){const e=[];for(const t in r){const i=r[t];if(typeof i!="string")continue;const s=Qm(t);e.push(`${s}: ${i};`)}return e.join(" ")}const Jm=/-([a-z])/g,Km=/^--[a-zA-Z0-9-]+$/,gs=r=>Km.test(r)?r:r.replace(Jm,(e,t)=>t?t.toUpperCase():""),qm=/\B([A-Z])/g,Qm=r=>r.replace(qm,"-$1").toLowerCase();class we{constructor(...e){E(this,"parentElement",null),E(this,"parentNode",null),E(this,"ownerDocument"),E(this,"firstChild",null),E(this,"lastChild",null),E(this,"previousSibling",null),E(this,"nextSibling",null),E(this,"ELEMENT_NODE",1),E(this,"TEXT_NODE",3),E(this,"nodeType"),E(this,"nodeName"),E(this,"RRNodeType")}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(e instanceof we){if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0}else return!1;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}class tn extends we{constructor(...e){super(e),E(this,"nodeType",9),E(this,"nodeName","#document"),E(this,"compatMode","CSS1Compat"),E(this,"RRNodeType",T.Document),E(this,"textContent",null),this.ownerDocument=this}get documentElement(){return this.childNodes.find(e=>e.RRNodeType===T.Element&&e.tagName==="HTML")||null}get body(){var e;return((e=this.documentElement)==null?void 0:e.childNodes.find(t=>t.RRNodeType===T.Element&&t.tagName==="BODY"))||null}get head(){var e;return((e=this.documentElement)==null?void 0:e.childNodes.find(t=>t.RRNodeType===T.Element&&t.tagName==="HEAD"))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(e){const t=e.RRNodeType;if((t===T.Element||t===T.DocumentType)&&this.childNodes.some(s=>s.RRNodeType===t))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${t===T.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const i=rn(this,e);return i.parentElement=null,i}insertBefore(e,t){const i=e.RRNodeType;if((i===T.Element||i===T.DocumentType)&&this.childNodes.some(n=>n.RRNodeType===i))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${i===T.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const s=Zl(this,e,t);return s.parentElement=null,s}removeChild(e){return Xl(this,e)}open(){this.firstChild=null,this.lastChild=null}close(){}write(e){let t;if(e==='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'?t="-//W3C//DTD XHTML 1.0 Transitional//EN":e==='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'&&(t="-//W3C//DTD HTML 4.0 Transitional//EN"),t){const i=this.createDocumentType("html",t,"");this.open(),this.appendChild(i)}}createDocument(e,t,i){return new tn}createDocumentType(e,t,i){const s=new Vl(e,t,i);return s.ownerDocument=this,s}createElement(e){const t=new ui(e);return t.ownerDocument=this,t}createElementNS(e,t){return this.createElement(t)}createTextNode(e){const t=new Gl(e);return t.ownerDocument=this,t}createComment(e){const t=new Yl(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new Hl(e);return t.ownerDocument=this,t}toString(){return"RRDocument"}}class Vl extends we{constructor(e,t,i){super(),E(this,"nodeType",10),E(this,"RRNodeType",T.DocumentType),E(this,"name"),E(this,"publicId"),E(this,"systemId"),E(this,"textContent",null),this.name=e,this.publicId=t,this.systemId=i,this.nodeName=e}toString(){return"RRDocumentType"}}class ui extends we{constructor(e){super(),E(this,"nodeType",1),E(this,"RRNodeType",T.Element),E(this,"tagName"),E(this,"attributes",{}),E(this,"shadowRoot",null),E(this,"scrollLeft"),E(this,"scrollTop"),this.tagName=e.toUpperCase(),this.nodeName=e.toUpperCase()}get textContent(){let e="";return this.childNodes.forEach(t=>e+=t.textContent),e}set textContent(e){this.firstChild=null,this.lastChild=null,this.appendChild(this.ownerDocument.createTextNode(e))}get classList(){return new rg(this.attributes.class,e=>{this.attributes.class=e})}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const e=this.attributes.style?Xm(this.attributes.style):{},t=/\B([A-Z])/g;return e.setProperty=(i,s,n)=>{if(t.test(i))return;const o=gs(i);s?e[o]=s:delete e[o],n==="important"&&(e[o]+=" !important"),this.attributes.style=fo(e)},e.removeProperty=i=>{if(t.test(i))return"";const s=gs(i),n=e[s]||"";return delete e[s],this.attributes.style=fo(e),n},e}getAttribute(e){return this.attributes[e]===void 0?null:this.attributes[e]}setAttribute(e,t){this.attributes[e]=t}setAttributeNS(e,t,i){this.setAttribute(t,i)}removeAttribute(e){delete this.attributes[e]}appendChild(e){return rn(this,e)}insertBefore(e,t){return Zl(this,e,t)}removeChild(e){return Xl(this,e)}attachShadow(e){const t=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=t,t}dispatchEvent(e){return!0}toString(){let e="";for(const t in this.attributes)e+=`${t}="${this.attributes[t]}" `;return`${this.tagName} ${e}`}}class eg extends ui{constructor(){super(...arguments),E(this,"currentTime"),E(this,"volume"),E(this,"paused"),E(this,"muted"),E(this,"playbackRate"),E(this,"loop")}attachShadow(e){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}class tg extends ui{constructor(){super(...arguments),E(this,"tagName","DIALOG"),E(this,"nodeName","DIALOG")}get isModal(){return this.getAttribute("rr_open_mode")==="modal"}get open(){return this.getAttribute("open")!==null}close(){this.removeAttribute("open"),this.removeAttribute("rr_open_mode")}show(){this.setAttribute("open",""),this.setAttribute("rr_open_mode","non-modal")}showModal(){this.setAttribute("open",""),this.setAttribute("rr_open_mode","modal")}}class Gl extends we{constructor(e){super(),E(this,"nodeType",3),E(this,"nodeName","#text"),E(this,"RRNodeType",T.Text),E(this,"data"),this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRText text=${JSON.stringify(this.data)}`}}class Yl extends we{constructor(e){super(),E(this,"nodeType",8),E(this,"nodeName","#comment"),E(this,"RRNodeType",T.Comment),E(this,"data"),this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}class Hl extends we{constructor(e){super(),E(this,"nodeName","#cdata-section"),E(this,"nodeType",4),E(this,"RRNodeType",T.CDATA),E(this,"data"),this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}class rg{constructor(e,t){if(E(this,"onChange"),E(this,"classes",[]),E(this,"add",(...i)=>{for(const s of i){const n=String(s);this.classes.indexOf(n)>=0||this.classes.push(n)}this.onChange&&this.onChange(this.classes.join(" "))}),E(this,"remove",(...i)=>{this.classes=this.classes.filter(s=>i.indexOf(s)===-1),this.onChange&&this.onChange(this.classes.join(" "))}),e){const i=e.trim().split(/\s+/);this.classes.push(...i)}this.onChange=t}}function rn(r,e){return e.parentNode&&e.parentNode.removeChild(e),r.lastChild?(r.lastChild.nextSibling=e,e.previousSibling=r.lastChild):(r.firstChild=e,e.previousSibling=null),r.lastChild=e,e.nextSibling=null,e.parentNode=r,e.parentElement=r,e.ownerDocument=r.ownerDocument,e}function Zl(r,e,t){if(!t)return rn(r,e);if(t.parentNode!==r)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return e===t||(e.parentNode&&e.parentNode.removeChild(e),e.previousSibling=t.previousSibling,t.previousSibling=e,e.nextSibling=t,e.previousSibling?e.previousSibling.nextSibling=e:r.firstChild=e,e.parentElement=r,e.parentNode=r,e.ownerDocument=r.ownerDocument),e}function Xl(r,e){if(e.parentNode!==r)throw new Error("Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode.");return e.previousSibling?e.previousSibling.nextSibling=e.nextSibling:r.firstChild=e.nextSibling,e.nextSibling?e.nextSibling.previousSibling=e.previousSibling:r.lastChild=e.previousSibling,e.previousSibling=null,e.nextSibling=null,e.parentElement=null,e.parentNode=null,e}var ue=(r=>(r[r.PLACEHOLDER=0]="PLACEHOLDER",r[r.ELEMENT_NODE=1]="ELEMENT_NODE",r[r.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",r[r.TEXT_NODE=3]="TEXT_NODE",r[r.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",r[r.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",r[r.ENTITY_NODE=6]="ENTITY_NODE",r[r.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",r[r.COMMENT_NODE=8]="COMMENT_NODE",r[r.DOCUMENT_NODE=9]="DOCUMENT_NODE",r[r.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",r[r.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE",r))(ue||{});const ys={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},ig={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};let xe=null;function zr(r,e,t,i=e.mirror||e.ownerDocument.mirror){r=sg(r,e,t,i),Jl(r,e,t,i),ng(r,e,t)}function sg(r,e,t,i){var s;if(t.afterAppend&&!xe&&(xe=new WeakSet,setTimeout(()=>{xe=null},0)),!sn(r,e)){const n=Wr(e,t.mirror,i);(s=r.parentNode)==null||s.replaceChild(n,r),r=n}switch(e.RRNodeType){case T.Document:{if(!He(r,e,t.mirror,i)){const n=i.getMeta(e);n&&(t.mirror.removeNodeFromMap(r),r.close(),r.open(),t.mirror.add(r,n),xe?.add(r))}break}case T.Element:{const n=r,o=e;switch(o.tagName){case"IFRAME":{const a=r.contentDocument;if(!a)break;zr(a,e.contentDocument,t,i);break}}o.shadowRoot&&(n.shadowRoot||n.attachShadow({mode:"open"}),Jl(n.shadowRoot,o.shadowRoot,t,i)),og(n,o,i);break}}return r}function ng(r,e,t){var i;switch(e.RRNodeType){case T.Document:{const s=e.scrollData;s&&t.applyScroll(s,!0);break}case T.Element:{const s=r,n=e;switch(n.scrollData&&t.applyScroll(n.scrollData,!0),n.inputData&&t.applyInput(n.inputData),n.tagName){case"AUDIO":case"VIDEO":{const o=r,a=n;a.paused!==void 0&&(a.paused?o.pause():o.play()),a.muted!==void 0&&(o.muted=a.muted),a.volume!==void 0&&(o.volume=a.volume),a.currentTime!==void 0&&(o.currentTime=a.currentTime),a.playbackRate!==void 0&&(o.playbackRate=a.playbackRate),a.loop!==void 0&&(o.loop=a.loop);break}case"CANVAS":{const o=e;if(o.rr_dataURL!==null){const a=document.createElement("img");a.onload=()=>{const l=s.getContext("2d");l&&l.drawImage(a,0,0,a.width,a.height)},a.src=o.rr_dataURL}o.canvasMutations.forEach(a=>t.applyCanvas(a.event,a.mutation,r));break}case"STYLE":{const o=s.sheet;o&&e.rules.forEach(a=>t.applyStyleSheetMutation(a,o));break}case"DIALOG":{const o=s,a=n,l=o.open,c=o.matches("dialog:modal"),u=a.open,h=a.isModal,f=c!==h,d=l!==u;if((f||l&&d)&&o.close(),u&&(d||f))try{h?o.showModal():o.show()}catch(g){console.warn(g)}break}}break}case T.Text:case T.Comment:case T.CDATA:{r.textContent!==e.data&&(r.textContent=e.data);break}}xe?.has(r)&&(xe.delete(r),(i=t.afterAppend)==null||i.call(t,r,t.mirror.getId(r)))}function og(r,e,t){const i=r.attributes,s=e.attributes;for(const n in s){const o=s[n],a=t.getMeta(e);if(a?.isSVG&&ys[n])r.setAttributeNS(ys[n],n,o);else if(e.tagName==="CANVAS"&&n==="rr_dataURL"){const l=document.createElement("img");l.src=o,l.onload=()=>{const c=r.getContext("2d");c&&c.drawImage(l,0,0,l.width,l.height)}}else{if(e.tagName==="IFRAME"&&n==="srcdoc")continue;try{r.setAttribute(n,o)}catch(l){console.warn(l)}}}for(const{name:n}of Array.from(i))n in s||r.removeAttribute(n);e.scrollLeft&&(r.scrollLeft=e.scrollLeft),e.scrollTop&&(r.scrollTop=e.scrollTop)}function Jl(r,e,t,i){const s=Array.from(r.childNodes),n=e.childNodes;if(s.length===0&&n.length===0)return;let o=0,a=s.length-1,l=0,c=n.length-1,u=s[o],h=s[a],f=n[l],d=n[c],g,w;for(;o<=a&&l<=c;)if(u===void 0)u=s[++o];else if(h===void 0)h=s[--a];else if(He(u,f,t.mirror,i))u=s[++o],f=n[++l];else if(He(h,d,t.mirror,i))h=s[--a],d=n[--c];else if(He(u,d,t.mirror,i)){try{r.insertBefore(u,h.nextSibling)}catch(b){console.warn(b)}u=s[++o],d=n[--c]}else if(He(h,f,t.mirror,i)){try{r.insertBefore(h,u)}catch(b){console.warn(b)}h=s[--a],f=n[++l]}else{if(!g){g={};for(let v=o;v<=a;v++){const x=s[v];x&&t.mirror.hasNode(x)&&(g[t.mirror.getId(x)]=v)}}w=g[i.getId(f)];const b=s[w];if(w!==void 0&&b&&He(b,f,t.mirror,i)){try{r.insertBefore(b,u)}catch(v){console.warn(v)}s[w]=void 0}else{const v=Wr(f,t.mirror,i);r.nodeName==="#document"&&u&&(v.nodeType===v.DOCUMENT_TYPE_NODE&&u.nodeType===u.DOCUMENT_TYPE_NODE||v.nodeType===v.ELEMENT_NODE&&u.nodeType===u.ELEMENT_NODE)&&(r.removeChild(u),t.mirror.removeNodeFromMap(u),u=s[++o]);try{r.insertBefore(v,u||null)}catch(x){console.warn(x)}}f=n[++l]}if(o>a){const b=n[c+1];let v=null;for(b&&(v=t.mirror.getNode(i.getId(b)));l<=c;++l){const x=Wr(n[l],t.mirror,i);try{r.insertBefore(x,v)}catch(k){console.warn(k)}}}else if(l>c)for(;o<=a;o++){const b=s[o];if(!(!b||b.parentNode!==r))try{r.removeChild(b),t.mirror.removeNodeFromMap(b)}catch(v){console.warn(v)}}let p=r.firstChild,y=e.firstChild;for(;p!==null&&y!==null;)zr(p,y,t,i),p=p.nextSibling,y=y.nextSibling}function Wr(r,e,t){const i=t.getId(r),s=t.getMeta(r);let n=null;if(i>-1&&(n=e.getNode(i)),n!==null&&sn(n,r))return n;switch(r.RRNodeType){case T.Document:n=new Document;break;case T.DocumentType:n=document.implementation.createDocumentType(r.name,r.publicId,r.systemId);break;case T.Element:{let o=r.tagName.toLowerCase();o=ig[o]||o,s&&"isSVG"in s&&s?.isSVG?n=document.createElementNS(ys.svg,o):n=document.createElement(r.tagName);break}case T.Text:n=document.createTextNode(r.data);break;case T.Comment:n=document.createComment(r.data);break;case T.CDATA:n=document.createCDATASection(r.data);break}s&&e.add(n,{...s});try{xe?.add(n)}catch{}return n}function sn(r,e){return r.nodeType!==e.nodeType?!1:r.nodeType!==r.ELEMENT_NODE||r.tagName.toUpperCase()===e.tagName}function He(r,e,t,i){const s=t.getId(r),n=i.getId(e);return s===-1||s!==n?!1:sn(r,e)}class ht extends tn{constructor(e){super(),E(this,"UNSERIALIZED_STARTING_ID",-2),E(this,"_unserializedId",this.UNSERIALIZED_STARTING_ID),E(this,"mirror",wg()),E(this,"scrollData",null),e&&(this.mirror=e)}get unserializedId(){return this._unserializedId--}createDocument(e,t,i){return new ht}createDocumentType(e,t,i){const s=new ag(e,t,i);return s.ownerDocument=this,s}createElement(e){const t=e.toUpperCase();let i;switch(t){case"AUDIO":case"VIDEO":i=new lg(t);break;case"IFRAME":i=new fg(t,this.mirror);break;case"CANVAS":i=new ug(t);break;case"STYLE":i=new hg(t);break;case"DIALOG":i=new cg(t);break;default:i=new hi(t);break}return i.ownerDocument=this,i}createComment(e){const t=new pg(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new mg(e);return t.ownerDocument=this,t}createTextNode(e){const t=new dg(e);return t.ownerDocument=this,t}destroyTree(){this.firstChild=null,this.lastChild=null,this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}}const ag=Vl;class hi extends ui{constructor(){super(...arguments),E(this,"inputData",null),E(this,"scrollData",null)}}class lg extends eg{}class cg extends tg{}class ug extends hi{constructor(){super(...arguments),E(this,"rr_dataURL",null),E(this,"canvasMutations",[])}getContext(){return null}}class hg extends hi{constructor(){super(...arguments),E(this,"rules",[])}}class fg extends hi{constructor(e,t){super(e),E(this,"contentDocument",new ht),this.contentDocument.mirror=t}}const dg=Gl,pg=Yl,mg=Hl;function gg(r){return r instanceof HTMLFormElement?"FORM":r.tagName.toUpperCase()}function Kl(r,e,t,i){let s;switch(r.nodeType){case ue.DOCUMENT_NODE:i&&i.nodeName==="IFRAME"?s=i.contentDocument:(s=e,s.compatMode=r.compatMode);break;case ue.DOCUMENT_TYPE_NODE:{const o=r;s=e.createDocumentType(o.name,o.publicId,o.systemId);break}case ue.ELEMENT_NODE:{const o=r,a=gg(o);s=e.createElement(a);const l=s;for(const{name:c,value:u}of Array.from(o.attributes))l.attributes[c]=u;o.scrollLeft&&(l.scrollLeft=o.scrollLeft),o.scrollTop&&(l.scrollTop=o.scrollTop);break}case ue.TEXT_NODE:s=e.createTextNode(r.textContent||"");break;case ue.CDATA_SECTION_NODE:s=e.createCDATASection(r.data);break;case ue.COMMENT_NODE:s=e.createComment(r.textContent||"");break;case ue.DOCUMENT_FRAGMENT_NODE:s=i.attachShadow({mode:"open"});break;default:return null}let n=t.getMeta(r);return e instanceof ht&&(n||(n=ql(s,e.unserializedId),t.add(r,n)),e.mirror.add(s,{...n})),s}function yg(r,e=sp(),t=new ht){function i(s,n){const o=Kl(s,t,e,n);if(o!==null)if(n?.nodeName!=="IFRAME"&&s.nodeType!==ue.DOCUMENT_FRAGMENT_NODE&&(n?.appendChild(o),o.parentNode=n,o.parentElement=n),s.nodeName==="IFRAME"){const a=s.contentDocument;a&&i(a,o)}else(s.nodeType===ue.DOCUMENT_NODE||s.nodeType===ue.ELEMENT_NODE||s.nodeType===ue.DOCUMENT_FRAGMENT_NODE)&&(s.nodeType===ue.ELEMENT_NODE&&s.shadowRoot&&i(s.shadowRoot,o),s.childNodes.forEach(a=>i(a,o)))}return i(r,null),t}function wg(){return new bg}class bg{constructor(){E(this,"idNodeMap",new Map),E(this,"nodeMetaMap",new WeakMap)}getId(e){var t;return e?((t=this.getMeta(e))==null?void 0:t.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(i=>this.removeNodeFromMap(i))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const i=t.id;this.idNodeMap.set(i,e),this.nodeMetaMap.set(e,t)}replace(e,t){const i=this.getNode(e);if(i){const s=this.nodeMetaMap.get(i);s&&this.nodeMetaMap.set(t,s)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function ql(r,e){switch(r.RRNodeType){case T.Document:return{id:e,type:r.RRNodeType,childNodes:[]};case T.DocumentType:{const t=r;return{id:e,type:r.RRNodeType,name:t.name,publicId:t.publicId,systemId:t.systemId}}case T.Element:return{id:e,type:r.RRNodeType,tagName:r.tagName.toLowerCase(),attributes:{},childNodes:[]};case T.Text:return{id:e,type:r.RRNodeType,textContent:r.textContent||""};case T.Comment:return{id:e,type:r.RRNodeType,textContent:r.textContent||""};case T.CDATA:return{id:e,type:r.RRNodeType,textContent:""}}}const po={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},mo={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},pr={},vg=()=>!!globalThis.Zone;function nn(r){if(pr[r])return pr[r];const e=globalThis[r],t=e.prototype,i=r in po?po[r]:void 0,s=!!(i&&i.every(a=>{var l,c;return!!((c=(l=Object.getOwnPropertyDescriptor(t,a))==null?void 0:l.get)!=null&&c.toString().includes("[native code]"))})),n=r in mo?mo[r]:void 0,o=!!(n&&n.every(a=>{var l;return typeof t[a]=="function"&&((l=t[a])==null?void 0:l.toString().includes("[native code]"))}));if(s&&o&&!vg())return pr[r]=e.prototype,e.prototype;try{const a=document.createElement("iframe");document.body.appendChild(a);const l=a.contentWindow;if(!l)return e.prototype;const c=l[r].prototype;return document.body.removeChild(a),c?pr[r]=c:t}catch{return t}}const xi={};function Ie(r,e,t){var i;const s=`${r}.${String(t)}`;if(xi[s])return xi[s].call(e);const n=nn(r),o=(i=Object.getOwnPropertyDescriptor(n,t))==null?void 0:i.get;return o?(xi[s]=o,o.call(e)):e[t]}const Ei={};function Ql(r,e,t){const i=`${r}.${String(t)}`;if(Ei[i])return Ei[i].bind(e);const n=nn(r)[t];return typeof n!="function"?e[t]:(Ei[i]=n,n.bind(e))}function Sg(r){return Ie("Node",r,"ownerDocument")}function Cg(r){return Ie("Node",r,"childNodes")}function xg(r){return Ie("Node",r,"parentNode")}function Eg(r){return Ie("Node",r,"parentElement")}function Ag(r){return Ie("Node",r,"textContent")}function Rg(r,e){return Ql("Node",r,"contains")(e)}function kg(r){return Ql("Node",r,"getRootNode")()}function Mg(r){return!r||!("host"in r)?null:Ie("ShadowRoot",r,"host")}function Ng(r){return r.styleSheets}function _g(r){return!r||!("shadowRoot"in r)?null:Ie("Element",r,"shadowRoot")}function Ig(r,e){return Ie("Element",r,"querySelector")(e)}function Dg(r,e){return Ie("Element",r,"querySelectorAll")(e)}function Tg(){return nn("MutationObserver").constructor}function Og(r,e,t){try{if(!(e in r))return()=>{};const i=r[e],s=t(i);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i}})),r[e]=s,()=>{r[e]=i}}catch{return()=>{}}}const Pg={ownerDocument:Sg,childNodes:Cg,parentNode:xg,parentElement:Eg,textContent:Ag,contains:Rg,getRootNode:kg,host:Mg,styleSheets:Ng,shadowRoot:_g,querySelector:Ig,querySelectorAll:Dg,mutationObserver:Tg,patch:Og},Ze=`Please stop import mirror directly. Instead of that,\r
74
74
  now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
75
- or you can use record.mirror to access the mirror instance during recording.`;let go={map:{},getId(){return console.error(Ze),-1},getNode(){return console.error(Ze),null},removeNodeFromMap(){console.error(Ze)},has(){return console.error(Ze),!1},reset(){console.error(Ze)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(go=new Proxy(go,{get(r,e,t){return e==="map"&&console.error(Ze),Reflect.get(r,e,t)}}));Date.now().toString();function Lg(r=window){"NodeList"in r&&!r.NodeList.prototype.forEach&&(r.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in r&&!r.DOMTokenList.prototype.forEach&&(r.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function $g(r){const e={},t=(s,n)=>{const o={value:s,parent:n,children:[]};return e[s.node.id]=o,o},i=[];for(const s of r){const{nextId:n,parentId:o}=s;if(n&&n in e){const a=e[n];if(a.parent){const l=a.parent.children.indexOf(a);a.parent.children.splice(l,0,t(s,a.parent))}else{const l=i.indexOf(a);i.splice(l,0,t(s,null))}continue}if(o in e){const a=e[o];a.children.push(t(s,a));continue}i.push(t(s,null))}return i}function ec(r,e){e(r.value);for(let t=r.children.length-1;t>=0;t--)ec(r.children[t],e)}function Ai(r,e){return!!(r.nodeName==="IFRAME"&&e.getMeta(r))}function tc(r,e){var t,i;const s=(i=(t=r.ownerDocument)==null?void 0:t.defaultView)==null?void 0:i.frameElement;if(!s||s===e)return{x:0,y:0,relativeScale:1,absoluteScale:1};const n=s.getBoundingClientRect(),o=tc(s,e),a=n.height/s.clientHeight;return{x:n.x*o.relativeScale+o.x,y:n.y*o.relativeScale+o.y,relativeScale:a,absoluteScale:o.absoluteScale*a}}function mr(r){return r?r instanceof we&&"shadowRoot"in r?!!r.shadowRoot:!!Pg.shadowRoot(r):!1}function yt(r,e){const t=r[e[0]];return e.length===1?t:yt(t.cssRules[e[1]].cssRules,e.slice(2))}function yo(r){const e=[...r],t=e.pop();return{positions:e,index:t}}function Fg(r){const e=new Set,t=[];for(let i=r.length;i--;){const s=r[i];e.has(s.id)||(t.push(s),e.add(s.id))}return t}class jg{constructor(){_(this,"id",1),_(this,"styleIDMap",new WeakMap),_(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let i;return t===void 0?i=this.id++:i=t,this.styleIDMap.set(e,i),this.idStyleMap.set(i,e),i}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}var K=(r=>(r[r.DomContentLoaded=0]="DomContentLoaded",r[r.Load=1]="Load",r[r.FullSnapshot=2]="FullSnapshot",r[r.IncrementalSnapshot=3]="IncrementalSnapshot",r[r.Meta=4]="Meta",r[r.Custom=5]="Custom",r[r.Plugin=6]="Plugin",r))(K||{}),F=(r=>(r[r.Mutation=0]="Mutation",r[r.MouseMove=1]="MouseMove",r[r.MouseInteraction=2]="MouseInteraction",r[r.Scroll=3]="Scroll",r[r.ViewportResize=4]="ViewportResize",r[r.Input=5]="Input",r[r.TouchMove=6]="TouchMove",r[r.MediaInteraction=7]="MediaInteraction",r[r.StyleSheetRule=8]="StyleSheetRule",r[r.CanvasMutation=9]="CanvasMutation",r[r.Font=10]="Font",r[r.Log=11]="Log",r[r.Drag=12]="Drag",r[r.StyleDeclaration=13]="StyleDeclaration",r[r.Selection=14]="Selection",r[r.AdoptedStyleSheet=15]="AdoptedStyleSheet",r[r.CustomElement=16]="CustomElement",r))(F||{}),ie=(r=>(r[r.MouseUp=0]="MouseUp",r[r.MouseDown=1]="MouseDown",r[r.Click=2]="Click",r[r.ContextMenu=3]="ContextMenu",r[r.DblClick=4]="DblClick",r[r.Focus=5]="Focus",r[r.Blur=6]="Blur",r[r.TouchStart=7]="TouchStart",r[r.TouchMove_Departed=8]="TouchMove_Departed",r[r.TouchEnd=9]="TouchEnd",r[r.TouchCancel=10]="TouchCancel",r))(ie||{}),Vr=(r=>(r[r["2D"]=0]="2D",r[r.WebGL=1]="WebGL",r[r.WebGL2=2]="WebGL2",r))(Vr||{}),ws=(r=>(r[r.Play=0]="Play",r[r.Pause=1]="Pause",r[r.Seeked=2]="Seeked",r[r.VolumeChange=3]="VolumeChange",r[r.RateChange=4]="RateChange",r))(ws||{}),O=(r=>(r.Start="start",r.Pause="pause",r.Resume="resume",r.Resize="resize",r.Finish="finish",r.FullsnapshotRebuilded="fullsnapshot-rebuilded",r.LoadStylesheetStart="load-stylesheet-start",r.LoadStylesheetEnd="load-stylesheet-end",r.SkipStart="skip-start",r.SkipEnd="skip-end",r.MouseInteraction="mouse-interaction",r.EventCast="event-cast",r.CustomEvent="custom-event",r.Flush="flush",r.StateChange="state-change",r.PlayBack="play-back",r.Destroy="destroy",r))(O||{}),Te=(r=>(r[r.Document=0]="Document",r[r.DocumentType=1]="DocumentType",r[r.Element=2]="Element",r[r.Text=3]="Text",r[r.CDATA=4]="CDATA",r[r.Comment=5]="Comment",r))(Te||{}),wo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",wt=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var gr=0;gr<wo.length;gr++)wt[wo.charCodeAt(gr)]=gr;var Bg=function(r){var e=r.length*.75,t=r.length,i,s=0,n,o,a,l;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);var c=new ArrayBuffer(e),u=new Uint8Array(c);for(i=0;i<t;i+=4)n=wt[r.charCodeAt(i)],o=wt[r.charCodeAt(i+1)],a=wt[r.charCodeAt(i+2)],l=wt[r.charCodeAt(i+3)],u[s++]=n<<2|o>>4,u[s++]=(o&15)<<4|a>>2,u[s++]=(a&3)<<6|l&63;return c};const Ug="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",zg=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0));typeof window<"u"&&window.Blob&&new Blob([zg(Ug)],{type:"text/javascript;charset=utf-8"});try{if(Array.from([1],r=>r*2)[0]!==2){const r=document.createElement("iframe");document.body.appendChild(r),Array.from=((Rn=r.contentWindow)==null?void 0:Rn.Array.from)||Array.from,document.body.removeChild(r)}}catch(r){console.debug("Unable to override Array.from",r)}xa();function rc(r){return{all:r=r||new Map,on:function(e,t){var i=r.get(e);i?i.push(t):r.set(e,[t])},off:function(e,t){var i=r.get(e);i&&(t?i.splice(i.indexOf(t)>>>0,1):r.set(e,[]))},emit:function(e,t){var i=r.get(e);i&&i.slice().map(function(s){s(t)}),(i=r.get("*"))&&i.slice().map(function(s){s(e,t)})}}}const Wg=Object.freeze(Object.defineProperty({__proto__:null,default:rc},Symbol.toStringTag,{value:"Module"}));function Vg(r=window,e=document){if("scrollBehavior"in e.documentElement.style&&r.__forceSmoothScrollPolyfill__!==!0)return;const t=r.HTMLElement||r.Element,i=468,s={scroll:r.scroll||r.scrollTo,scrollBy:r.scrollBy,elementScroll:t.prototype.scroll||l,scrollIntoView:t.prototype.scrollIntoView},n=r.performance&&r.performance.now?r.performance.now.bind(r.performance):Date.now;function o(y){const b=["MSIE ","Trident/","Edge/"];return new RegExp(b.join("|")).test(y)}const a=o(r.navigator.userAgent)?1:0;function l(y,b){this.scrollLeft=y,this.scrollTop=b}function c(y){return .5*(1-Math.cos(Math.PI*y))}function u(y){if(y===null||typeof y!="object"||y.behavior===void 0||y.behavior==="auto"||y.behavior==="instant")return!0;if(typeof y=="object"&&y.behavior==="smooth")return!1;throw new TypeError("behavior member of ScrollOptions "+y.behavior+" is not a valid value for enumeration ScrollBehavior.")}function h(y,b){if(b==="Y")return y.clientHeight+a<y.scrollHeight;if(b==="X")return y.clientWidth+a<y.scrollWidth}function f(y,b){const v=r.getComputedStyle(y,null)["overflow"+b];return v==="auto"||v==="scroll"}function d(y){const b=h(y,"Y")&&f(y,"Y"),v=h(y,"X")&&f(y,"X");return b||v}function m(y){for(;y!==e.body&&d(y)===!1;)y=y.parentNode||y.host;return y}function w(y){const b=n();let v,x,M,N=(b-y.startTime)/i;N=N>1?1:N,v=c(N),x=y.startX+(y.x-y.startX)*v,M=y.startY+(y.y-y.startY)*v,y.method.call(y.scrollable,x,M),(x!==y.x||M!==y.y)&&r.requestAnimationFrame(w.bind(r,y))}function p(y,b,v){let x,M,N,j;const D=n();y===e.body?(x=r,M=r.scrollX||r.pageXOffset,N=r.scrollY||r.pageYOffset,j=s.scroll):(x=y,M=y.scrollLeft,N=y.scrollTop,j=l),w({scrollable:x,method:j,startTime:D,startX:M,startY:N,x:b,y:v})}r.scroll=r.scrollTo=function(){if(arguments[0]!==void 0){if(u(arguments[0])===!0){s.scroll.call(r,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:r.scrollX||r.pageXOffset,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:r.scrollY||r.pageYOffset);return}p.call(r,e.body,arguments[0].left!==void 0?~~arguments[0].left:r.scrollX||r.pageXOffset,arguments[0].top!==void 0?~~arguments[0].top:r.scrollY||r.pageYOffset)}},r.scrollBy=function(){if(arguments[0]!==void 0){if(u(arguments[0])){s.scrollBy.call(r,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:0,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:0);return}p.call(r,e.body,~~arguments[0].left+(r.scrollX||r.pageXOffset),~~arguments[0].top+(r.scrollY||r.pageYOffset))}},t.prototype.scroll=t.prototype.scrollTo=function(){if(arguments[0]===void 0)return;if(u(arguments[0])===!0){if(typeof arguments[0]=="number"&&arguments[1]===void 0)throw new SyntaxError("Value could not be converted");s.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left:typeof arguments[0]!="object"?~~arguments[0]:this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top:arguments[1]!==void 0?~~arguments[1]:this.scrollTop);return}const y=arguments[0].left,b=arguments[0].top;p.call(this,this,typeof y>"u"?this.scrollLeft:~~y,typeof b>"u"?this.scrollTop:~~b)},t.prototype.scrollBy=function(){if(arguments[0]!==void 0){if(u(arguments[0])===!0){s.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop);return}this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior})}},t.prototype.scrollIntoView=function(){if(u(arguments[0])===!0){s.scrollIntoView.call(this,arguments[0]===void 0?!0:arguments[0]);return}const y=m(this),b=y.getBoundingClientRect(),v=this.getBoundingClientRect();y!==e.body?(p.call(this,y,y.scrollLeft+v.left-b.left,y.scrollTop+v.top-b.top),r.getComputedStyle(y).position!=="fixed"&&r.scrollBy({left:b.left,top:b.top,behavior:"smooth"})):r.scrollBy({left:v.left,top:v.top,behavior:"smooth"})}}class Gg{constructor(e=[],t){_(this,"timeOffset",0),_(this,"speed"),_(this,"actions"),_(this,"raf",null),_(this,"lastTimestamp"),this.actions=e,this.speed=t.speed}addAction(e){const t=this.raf===!0;if(!this.actions.length||this.actions[this.actions.length-1].delay<=e.delay)this.actions.push(e);else{const i=this.findActionIndex(e);this.actions.splice(i,0,e)}t&&(this.raf=requestAnimationFrame(this.rafCheck.bind(this)))}start(){this.timeOffset=0,this.lastTimestamp=performance.now(),this.raf=requestAnimationFrame(this.rafCheck.bind(this))}rafCheck(){const e=performance.now();for(this.timeOffset+=(e-this.lastTimestamp)*this.speed,this.lastTimestamp=e;this.actions.length;){const t=this.actions[0];if(this.timeOffset>=t.delay)this.actions.shift(),t.doAction();else break}this.actions.length>0?this.raf=requestAnimationFrame(this.rafCheck.bind(this)):this.raf=!0}clear(){this.raf&&(this.raf!==!0&&cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(e){this.speed=e}isActive(){return this.raf!==null}findActionIndex(e){let t=0,i=this.actions.length-1;for(;t<=i;){const s=Math.floor((t+i)/2);if(this.actions[s].delay<e.delay)t=s+1;else if(this.actions[s].delay>e.delay)i=s-1;else return s+1}return t}}function bo(r,e){if(r.type===K.IncrementalSnapshot&&r.data.source===F.MouseMove&&r.data.positions&&r.data.positions.length){const t=r.data.positions[0].timeOffset,i=r.timestamp+t;return r.delay=i-e,i-e}return r.delay=r.timestamp-e,r.delay}/*! *****************************************************************************
75
+ or you can use record.mirror to access the mirror instance during recording.`;let go={map:{},getId(){return console.error(Ze),-1},getNode(){return console.error(Ze),null},removeNodeFromMap(){console.error(Ze)},has(){return console.error(Ze),!1},reset(){console.error(Ze)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(go=new Proxy(go,{get(r,e,t){return e==="map"&&console.error(Ze),Reflect.get(r,e,t)}}));Date.now().toString();function Lg(r=window){"NodeList"in r&&!r.NodeList.prototype.forEach&&(r.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in r&&!r.DOMTokenList.prototype.forEach&&(r.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function $g(r){const e={},t=(s,n)=>{const o={value:s,parent:n,children:[]};return e[s.node.id]=o,o},i=[];for(const s of r){const{nextId:n,parentId:o}=s;if(n&&n in e){const a=e[n];if(a.parent){const l=a.parent.children.indexOf(a);a.parent.children.splice(l,0,t(s,a.parent))}else{const l=i.indexOf(a);i.splice(l,0,t(s,null))}continue}if(o in e){const a=e[o];a.children.push(t(s,a));continue}i.push(t(s,null))}return i}function ec(r,e){e(r.value);for(let t=r.children.length-1;t>=0;t--)ec(r.children[t],e)}function Ai(r,e){return!!(r.nodeName==="IFRAME"&&e.getMeta(r))}function tc(r,e){var t,i;const s=(i=(t=r.ownerDocument)==null?void 0:t.defaultView)==null?void 0:i.frameElement;if(!s||s===e)return{x:0,y:0,relativeScale:1,absoluteScale:1};const n=s.getBoundingClientRect(),o=tc(s,e),a=n.height/s.clientHeight;return{x:n.x*o.relativeScale+o.x,y:n.y*o.relativeScale+o.y,relativeScale:a,absoluteScale:o.absoluteScale*a}}function mr(r){return r?r instanceof we&&"shadowRoot"in r?!!r.shadowRoot:!!Pg.shadowRoot(r):!1}function yt(r,e){const t=r[e[0]];return e.length===1?t:yt(t.cssRules[e[1]].cssRules,e.slice(2))}function yo(r){const e=[...r],t=e.pop();return{positions:e,index:t}}function jg(r){const e=new Set,t=[];for(let i=r.length;i--;){const s=r[i];e.has(s.id)||(t.push(s),e.add(s.id))}return t}class Fg{constructor(){_(this,"id",1),_(this,"styleIDMap",new WeakMap),_(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let i;return t===void 0?i=this.id++:i=t,this.styleIDMap.set(e,i),this.idStyleMap.set(i,e),i}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}var K=(r=>(r[r.DomContentLoaded=0]="DomContentLoaded",r[r.Load=1]="Load",r[r.FullSnapshot=2]="FullSnapshot",r[r.IncrementalSnapshot=3]="IncrementalSnapshot",r[r.Meta=4]="Meta",r[r.Custom=5]="Custom",r[r.Plugin=6]="Plugin",r))(K||{}),j=(r=>(r[r.Mutation=0]="Mutation",r[r.MouseMove=1]="MouseMove",r[r.MouseInteraction=2]="MouseInteraction",r[r.Scroll=3]="Scroll",r[r.ViewportResize=4]="ViewportResize",r[r.Input=5]="Input",r[r.TouchMove=6]="TouchMove",r[r.MediaInteraction=7]="MediaInteraction",r[r.StyleSheetRule=8]="StyleSheetRule",r[r.CanvasMutation=9]="CanvasMutation",r[r.Font=10]="Font",r[r.Log=11]="Log",r[r.Drag=12]="Drag",r[r.StyleDeclaration=13]="StyleDeclaration",r[r.Selection=14]="Selection",r[r.AdoptedStyleSheet=15]="AdoptedStyleSheet",r[r.CustomElement=16]="CustomElement",r))(j||{}),ie=(r=>(r[r.MouseUp=0]="MouseUp",r[r.MouseDown=1]="MouseDown",r[r.Click=2]="Click",r[r.ContextMenu=3]="ContextMenu",r[r.DblClick=4]="DblClick",r[r.Focus=5]="Focus",r[r.Blur=6]="Blur",r[r.TouchStart=7]="TouchStart",r[r.TouchMove_Departed=8]="TouchMove_Departed",r[r.TouchEnd=9]="TouchEnd",r[r.TouchCancel=10]="TouchCancel",r))(ie||{}),Vr=(r=>(r[r["2D"]=0]="2D",r[r.WebGL=1]="WebGL",r[r.WebGL2=2]="WebGL2",r))(Vr||{}),ws=(r=>(r[r.Play=0]="Play",r[r.Pause=1]="Pause",r[r.Seeked=2]="Seeked",r[r.VolumeChange=3]="VolumeChange",r[r.RateChange=4]="RateChange",r))(ws||{}),O=(r=>(r.Start="start",r.Pause="pause",r.Resume="resume",r.Resize="resize",r.Finish="finish",r.FullsnapshotRebuilded="fullsnapshot-rebuilded",r.LoadStylesheetStart="load-stylesheet-start",r.LoadStylesheetEnd="load-stylesheet-end",r.SkipStart="skip-start",r.SkipEnd="skip-end",r.MouseInteraction="mouse-interaction",r.EventCast="event-cast",r.CustomEvent="custom-event",r.Flush="flush",r.StateChange="state-change",r.PlayBack="play-back",r.Destroy="destroy",r))(O||{}),Te=(r=>(r[r.Document=0]="Document",r[r.DocumentType=1]="DocumentType",r[r.Element=2]="Element",r[r.Text=3]="Text",r[r.CDATA=4]="CDATA",r[r.Comment=5]="Comment",r))(Te||{}),wo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",wt=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var gr=0;gr<wo.length;gr++)wt[wo.charCodeAt(gr)]=gr;var Bg=function(r){var e=r.length*.75,t=r.length,i,s=0,n,o,a,l;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);var c=new ArrayBuffer(e),u=new Uint8Array(c);for(i=0;i<t;i+=4)n=wt[r.charCodeAt(i)],o=wt[r.charCodeAt(i+1)],a=wt[r.charCodeAt(i+2)],l=wt[r.charCodeAt(i+3)],u[s++]=n<<2|o>>4,u[s++]=(o&15)<<4|a>>2,u[s++]=(a&3)<<6|l&63;return c};const Ug="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",zg=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0));typeof window<"u"&&window.Blob&&new Blob([zg(Ug)],{type:"text/javascript;charset=utf-8"});try{if(Array.from([1],r=>r*2)[0]!==2){const r=document.createElement("iframe");document.body.appendChild(r),Array.from=((Rn=r.contentWindow)==null?void 0:Rn.Array.from)||Array.from,document.body.removeChild(r)}}catch(r){console.debug("Unable to override Array.from",r)}xa();function rc(r){return{all:r=r||new Map,on:function(e,t){var i=r.get(e);i?i.push(t):r.set(e,[t])},off:function(e,t){var i=r.get(e);i&&(t?i.splice(i.indexOf(t)>>>0,1):r.set(e,[]))},emit:function(e,t){var i=r.get(e);i&&i.slice().map(function(s){s(t)}),(i=r.get("*"))&&i.slice().map(function(s){s(e,t)})}}}const Wg=Object.freeze(Object.defineProperty({__proto__:null,default:rc},Symbol.toStringTag,{value:"Module"}));function Vg(r=window,e=document){if("scrollBehavior"in e.documentElement.style&&r.__forceSmoothScrollPolyfill__!==!0)return;const t=r.HTMLElement||r.Element,i=468,s={scroll:r.scroll||r.scrollTo,scrollBy:r.scrollBy,elementScroll:t.prototype.scroll||l,scrollIntoView:t.prototype.scrollIntoView},n=r.performance&&r.performance.now?r.performance.now.bind(r.performance):Date.now;function o(y){const b=["MSIE ","Trident/","Edge/"];return new RegExp(b.join("|")).test(y)}const a=o(r.navigator.userAgent)?1:0;function l(y,b){this.scrollLeft=y,this.scrollTop=b}function c(y){return .5*(1-Math.cos(Math.PI*y))}function u(y){if(y===null||typeof y!="object"||y.behavior===void 0||y.behavior==="auto"||y.behavior==="instant")return!0;if(typeof y=="object"&&y.behavior==="smooth")return!1;throw new TypeError("behavior member of ScrollOptions "+y.behavior+" is not a valid value for enumeration ScrollBehavior.")}function h(y,b){if(b==="Y")return y.clientHeight+a<y.scrollHeight;if(b==="X")return y.clientWidth+a<y.scrollWidth}function f(y,b){const v=r.getComputedStyle(y,null)["overflow"+b];return v==="auto"||v==="scroll"}function d(y){const b=h(y,"Y")&&f(y,"Y"),v=h(y,"X")&&f(y,"X");return b||v}function g(y){for(;y!==e.body&&d(y)===!1;)y=y.parentNode||y.host;return y}function w(y){const b=n();let v,x,k,N=(b-y.startTime)/i;N=N>1?1:N,v=c(N),x=y.startX+(y.x-y.startX)*v,k=y.startY+(y.y-y.startY)*v,y.method.call(y.scrollable,x,k),(x!==y.x||k!==y.y)&&r.requestAnimationFrame(w.bind(r,y))}function p(y,b,v){let x,k,N,F;const D=n();y===e.body?(x=r,k=r.scrollX||r.pageXOffset,N=r.scrollY||r.pageYOffset,F=s.scroll):(x=y,k=y.scrollLeft,N=y.scrollTop,F=l),w({scrollable:x,method:F,startTime:D,startX:k,startY:N,x:b,y:v})}r.scroll=r.scrollTo=function(){if(arguments[0]!==void 0){if(u(arguments[0])===!0){s.scroll.call(r,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:r.scrollX||r.pageXOffset,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:r.scrollY||r.pageYOffset);return}p.call(r,e.body,arguments[0].left!==void 0?~~arguments[0].left:r.scrollX||r.pageXOffset,arguments[0].top!==void 0?~~arguments[0].top:r.scrollY||r.pageYOffset)}},r.scrollBy=function(){if(arguments[0]!==void 0){if(u(arguments[0])){s.scrollBy.call(r,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:0,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:0);return}p.call(r,e.body,~~arguments[0].left+(r.scrollX||r.pageXOffset),~~arguments[0].top+(r.scrollY||r.pageYOffset))}},t.prototype.scroll=t.prototype.scrollTo=function(){if(arguments[0]===void 0)return;if(u(arguments[0])===!0){if(typeof arguments[0]=="number"&&arguments[1]===void 0)throw new SyntaxError("Value could not be converted");s.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left:typeof arguments[0]!="object"?~~arguments[0]:this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top:arguments[1]!==void 0?~~arguments[1]:this.scrollTop);return}const y=arguments[0].left,b=arguments[0].top;p.call(this,this,typeof y>"u"?this.scrollLeft:~~y,typeof b>"u"?this.scrollTop:~~b)},t.prototype.scrollBy=function(){if(arguments[0]!==void 0){if(u(arguments[0])===!0){s.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop);return}this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior})}},t.prototype.scrollIntoView=function(){if(u(arguments[0])===!0){s.scrollIntoView.call(this,arguments[0]===void 0?!0:arguments[0]);return}const y=g(this),b=y.getBoundingClientRect(),v=this.getBoundingClientRect();y!==e.body?(p.call(this,y,y.scrollLeft+v.left-b.left,y.scrollTop+v.top-b.top),r.getComputedStyle(y).position!=="fixed"&&r.scrollBy({left:b.left,top:b.top,behavior:"smooth"})):r.scrollBy({left:v.left,top:v.top,behavior:"smooth"})}}class Gg{constructor(e=[],t){_(this,"timeOffset",0),_(this,"speed"),_(this,"actions"),_(this,"raf",null),_(this,"lastTimestamp"),this.actions=e,this.speed=t.speed}addAction(e){const t=this.raf===!0;if(!this.actions.length||this.actions[this.actions.length-1].delay<=e.delay)this.actions.push(e);else{const i=this.findActionIndex(e);this.actions.splice(i,0,e)}t&&(this.raf=requestAnimationFrame(this.rafCheck.bind(this)))}start(){this.timeOffset=0,this.lastTimestamp=performance.now(),this.raf=requestAnimationFrame(this.rafCheck.bind(this))}rafCheck(){const e=performance.now();for(this.timeOffset+=(e-this.lastTimestamp)*this.speed,this.lastTimestamp=e;this.actions.length;){const t=this.actions[0];if(this.timeOffset>=t.delay)this.actions.shift(),t.doAction();else break}this.actions.length>0?this.raf=requestAnimationFrame(this.rafCheck.bind(this)):this.raf=!0}clear(){this.raf&&(this.raf!==!0&&cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(e){this.speed=e}isActive(){return this.raf!==null}findActionIndex(e){let t=0,i=this.actions.length-1;for(;t<=i;){const s=Math.floor((t+i)/2);if(this.actions[s].delay<e.delay)t=s+1;else if(this.actions[s].delay>e.delay)i=s-1;else return s+1}return t}}function bo(r,e){if(r.type===K.IncrementalSnapshot&&r.data.source===j.MouseMove&&r.data.positions&&r.data.positions.length){const t=r.data.positions[0].timeOffset,i=r.timestamp+t;return r.delay=i-e,i-e}return r.delay=r.timestamp-e,r.delay}/*! *****************************************************************************
76
76
  Copyright (c) Microsoft Corporation.
77
77
 
78
78
  Permission to use, copy, modify, and/or distribute this software for any
@@ -85,14 +85,14 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
85
85
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
86
86
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
87
87
  PERFORMANCE OF THIS SOFTWARE.
88
- ***************************************************************************** */function vo(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i,s,n=t.call(r),o=[];try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return o}var Ke;(function(r){r[r.NotStarted=0]="NotStarted",r[r.Running=1]="Running",r[r.Stopped=2]="Stopped"})(Ke||(Ke={}));var ic={type:"xstate.init"};function Ri(r){return r===void 0?[]:[].concat(r)}function Xe(r){return{type:"xstate.assign",assignment:r}}function So(r,e){return typeof(r=typeof r=="string"&&e&&e[r]?e[r]:r)=="string"?{type:r}:typeof r=="function"?{type:r.name,exec:r}:r}function Gr(r){return function(e){return r===e}}function sc(r){return typeof r=="string"?{type:r}:r}function Co(r,e){return{value:r,context:e,actions:[],changed:!1,matches:Gr(r)}}function xo(r,e,t){var i=e,s=!1;return[r.filter(function(n){if(n.type==="xstate.assign"){s=!0;var o=Object.assign({},i);return typeof n.assignment=="function"?o=n.assignment(i,t):Object.keys(n.assignment).forEach(function(a){o[a]=typeof n.assignment[a]=="function"?n.assignment[a](i,t):n.assignment[a]}),i=o,!1}return!0}),i,s]}function nc(r,e){e===void 0&&(e={});var t=vo(xo(Ri(r.states[r.initial].entry).map(function(o){return So(o,e.actions)}),r.context,ic),2),i=t[0],s=t[1],n={config:r,_options:e,initialState:{value:r.initial,actions:i,context:s,matches:Gr(r.initial)},transition:function(o,a){var l,c,u=typeof o=="string"?{value:o,context:r.context}:o,h=u.value,f=u.context,d=sc(a),m=r.states[h];if(m.on){var w=Ri(m.on[d.type]);try{for(var p=function(V){var ae=typeof Symbol=="function"&&Symbol.iterator,ne=ae&&V[ae],re=0;if(ne)return ne.call(V);if(V&&typeof V.length=="number")return{next:function(){return V&&re>=V.length&&(V=void 0),{value:V&&V[re++],done:!V}}};throw new TypeError(ae?"Object is not iterable.":"Symbol.iterator is not defined.")}(w),y=p.next();!y.done;y=p.next()){var b=y.value;if(b===void 0)return Co(h,f);var v=typeof b=="string"?{target:b}:b,x=v.target,M=v.actions,N=M===void 0?[]:M,j=v.cond,D=j===void 0?function(){return!0}:j,J=x===void 0,W=x??h,de=r.states[W];if(D(f,d)){var ce=vo(xo((J?Ri(N):[].concat(m.exit,N,de.entry).filter(function(V){return V})).map(function(V){return So(V,n._options.actions)}),f,d),3),ee=ce[0],B=ce[1],oe=ce[2],L=x??h;return{value:L,context:B,actions:ee,changed:x!==h||ee.length>0||oe,matches:Gr(L)}}}}catch(V){l={error:V}}finally{try{y&&!y.done&&(c=p.return)&&c.call(p)}finally{if(l)throw l.error}}}return Co(h,f)}};return n}var Eo=function(r,e){return r.actions.forEach(function(t){var i=t.exec;return i&&i(r.context,e)})};function oc(r){var e=r.initialState,t=Ke.NotStarted,i=new Set,s={_machine:r,send:function(n){t===Ke.Running&&(e=r.transition(e,n),Eo(e,sc(n)),i.forEach(function(o){return o(e)}))},subscribe:function(n){return i.add(n),n(e),{unsubscribe:function(){return i.delete(n)}}},start:function(n){if(n){var o=typeof n=="object"?n:{context:r.config.context,value:n};e={value:o.value,actions:[],context:o.context,matches:Gr(o.value)}}return t=Ke.Running,Eo(e,ic),s},stop:function(){return t=Ke.Stopped,i.clear(),s},get state(){return e},get status(){return t}};return s}function Yg(r,e){for(let t=r.length-1;t>=0;t--){const i=r[t];if(i.type===K.Meta&&i.timestamp<=e)return r.slice(t)}return r}function Hg(r,{getCastFn:e,applyEventsSynchronously:t,emitter:i}){const s=nc({id:"player",context:r,initial:"paused",states:{playing:{on:{PAUSE:{target:"paused",actions:["pause"]},CAST_EVENT:{target:"playing",actions:"castEvent"},END:{target:"paused",actions:["resetLastPlayedEvent","pause"]},ADD_EVENT:{target:"playing",actions:["addEvent"]}}},paused:{on:{PLAY:{target:"playing",actions:["recordTimeOffset","play"]},CAST_EVENT:{target:"paused",actions:"castEvent"},TO_LIVE:{target:"live",actions:["startLive"]},ADD_EVENT:{target:"paused",actions:["addEvent"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:Xe({lastPlayedEvent:(n,o)=>o.type==="CAST_EVENT"?o.payload.event:n.lastPlayedEvent}),recordTimeOffset:Xe((n,o)=>{let a=n.timeOffset;return"payload"in o&&"timeOffset"in o.payload&&(a=o.payload.timeOffset),{...n,timeOffset:a,baselineTime:n.events[0].timestamp+a}}),play(n){var o;const{timer:a,events:l,baselineTime:c,lastPlayedEvent:u}=n;a.clear();for(const m of l)bo(m,c);const h=Yg(l,c);let f=u?.timestamp;u?.type===K.IncrementalSnapshot&&u.data.source===F.MouseMove&&(f=u.timestamp+((o=u.data.positions[0])==null?void 0:o.timeOffset)),c<(f||0)&&i.emit(O.PlayBack);const d=new Array;for(const m of h)if(!(f&&f<c&&(m.timestamp<=f||m===u)))if(m.timestamp<c)d.push(m);else{const w=e(m,!1);a.addAction({doAction:()=>{w()},delay:m.delay})}t(d),i.emit(O.Flush),a.start()},pause(n){n.timer.clear()},resetLastPlayedEvent:Xe(n=>({...n,lastPlayedEvent:null})),startLive:Xe({baselineTime:(n,o)=>(n.timer.start(),o.type==="TO_LIVE"&&o.payload.baselineTime?o.payload.baselineTime:Date.now())}),addEvent:Xe((n,o)=>{const{baselineTime:a,timer:l,events:c}=n;if(o.type==="ADD_EVENT"){const{event:u}=o.payload;bo(u,a);let h=c.length-1;if(!c[h]||c[h].timestamp<=u.timestamp)c.push(u);else{let m=-1,w=0;for(;w<=h;){const p=Math.floor((w+h)/2);c[p].timestamp<=u.timestamp?w=p+1:h=p-1}m===-1&&(m=w),c.splice(m,0,u)}const f=u.timestamp<a,d=e(u,f);f?d():l.isActive()&&l.addAction({doAction:()=>{d()},delay:u.delay})}return{...n,events:c}})}});return oc(s)}function Zg(r){const e=nc({id:"speed",context:r,initial:"normal",states:{normal:{on:{FAST_FORWARD:{target:"skipping",actions:["recordSpeed","setSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}},skipping:{on:{BACK_TO_NORMAL:{target:"normal",actions:["restoreSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}}}},{actions:{setSpeed:(t,i)=>{"payload"in i&&t.timer.setSpeed(i.payload.speed)},recordSpeed:Xe({normalSpeed:t=>t.timer.speed}),restoreSpeed:t=>{t.timer.setSpeed(t.normalSpeed)}}});return oc(e)}const Xg=r=>[`.${r} { background: currentColor }`,"noscript { display: none !important; }"],Ao=new Map;function ac(r,e){let t=Ao.get(r);return t||(t=new Map,Ao.set(r,t)),t.has(e)||t.set(e,[]),t.get(e)}function Oe(r,e,t){return async i=>{if(i&&typeof i=="object"&&"rr_type"in i)if(t&&(t.isUnchanged=!1),i.rr_type==="ImageBitmap"&&"args"in i){const s=await Oe(r,e,t)(i.args);return await createImageBitmap.apply(null,s)}else if("index"in i){if(t||e===null)return i;const{rr_type:s,index:n}=i;return ac(e,s)[n]}else if("args"in i){const{rr_type:s,args:n}=i,o=window[s];return new o(...await Promise.all(n.map(Oe(r,e,t))))}else{if("base64"in i)return Bg(i.base64);if("src"in i){const s=r.get(i.src);if(s)return s;{const n=new Image;return n.src=i.src,r.set(i.src,n),n}}else if("data"in i&&i.rr_type==="Blob"){const s=await Promise.all(i.data.map(Oe(r,e,t)));return new Blob(s,{type:i.type})}}else if(Array.isArray(i))return await Promise.all(i.map(Oe(r,e,t)));return i}}function Jg(r,e){try{return e===Vr.WebGL?r.getContext("webgl")||r.getContext("experimental-webgl"):r.getContext("webgl2")}catch{return null}}const Kg=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function qg(r,e){if(!e?.constructor)return;const{name:t}=e.constructor;if(!Kg.includes(t))return;const i=ac(r,t);i.includes(e)||i.push(e)}async function Qg({mutation:r,target:e,type:t,imageMap:i,errorHandler:s}){try{const n=Jg(e,t);if(!n)return;if(r.setter){n[r.property]=r.args[0];return}const o=n[r.property],a=await Promise.all(r.args.map(Oe(i,n))),l=o.apply(n,a);qg(n,l);const c=!1}catch(n){s(r,n)}}async function ey({event:r,mutations:e,target:t,imageMap:i,errorHandler:s}){const n=t.getContext("2d");if(!n){s(e[0],new Error("Canvas context is null"));return}const o=e.map(async l=>Promise.all(l.args.map(Oe(i,n))));(await Promise.all(o)).forEach((l,c)=>{const u=e[c];try{if(u.setter){n[u.property]=u.args[0];return}const h=n[u.property];u.property==="drawImage"&&typeof u.args[0]=="string"?(i.get(r),h.apply(n,u.args)):h.apply(n,l)}catch(h){s(u,h)}})}async function Ro({event:r,mutation:e,target:t,imageMap:i,canvasEventMap:s,errorHandler:n}){try{const o=s.get(r)||e,a="commands"in o?o.commands:[o];if([Vr.WebGL,Vr.WebGL2].includes(e.type)){for(let l=0;l<a.length;l++){const c=a[l];await Qg({mutation:c,type:e.type,target:t,imageMap:i,errorHandler:n})}return}await ey({event:r,mutations:a,target:t,imageMap:i,errorHandler:n})}catch(o){n(e,o)}}class ty{constructor(e){_(this,"mediaMap",new Map),_(this,"warn"),_(this,"service"),_(this,"speedService"),_(this,"emitter"),_(this,"getCurrentTime"),_(this,"metadataCallbackMap",new Map),this.warn=e.warn,this.service=e.service,this.speedService=e.speedService,this.emitter=e.emitter,this.getCurrentTime=e.getCurrentTime,this.emitter.on(O.Start,this.start.bind(this)),this.emitter.on(O.SkipStart,this.start.bind(this)),this.emitter.on(O.Pause,this.pause.bind(this)),this.emitter.on(O.Finish,this.pause.bind(this)),this.speedService.subscribe(()=>{this.syncAllMediaElements()})}syncAllMediaElements(e={pause:!1}){this.mediaMap.forEach((t,i)=>{this.syncTargetWithState(i),e.pause&&i.pause()})}start(){this.syncAllMediaElements()}pause(){this.syncAllMediaElements({pause:!0})}seekTo({time:e,target:t,mediaState:i}){if(i.isPlaying){const n=(e-i.lastInteractionTimeOffset)/1e3*i.playbackRate,o="duration"in t&&t.duration;if(Number.isNaN(o)){this.waitForMetadata(t);return}let a=i.currentTimeAtLastInteraction+n;t.loop&&o!==!1&&(a=a%o),t.currentTime=a}else t.pause(),t.currentTime=i.currentTimeAtLastInteraction}waitForMetadata(e){if(this.metadataCallbackMap.has(e)||!("addEventListener"in e))return;const t=()=>{this.metadataCallbackMap.delete(e);const i=this.mediaMap.get(e);i&&this.seekTo({time:this.getCurrentTime(),target:e,mediaState:i})};this.metadataCallbackMap.set(e,t),e.addEventListener("loadedmetadata",t,{once:!0})}getMediaStateFromMutation({target:e,timeOffset:t,mutation:i}){const s=this.mediaMap.get(e),{type:n,playbackRate:o,currentTime:a,muted:l,volume:c,loop:u}=i;return{isPlaying:n===ws.Play||n!==ws.Pause&&(s?.isPlaying||e.getAttribute("autoplay")!==null),currentTimeAtLastInteraction:a??s?.currentTimeAtLastInteraction??0,lastInteractionTimeOffset:t,playbackRate:o??s?.playbackRate??1,volume:c??s?.volume??1,muted:l??s?.muted??e.getAttribute("muted")===null,loop:u??s?.loop??e.getAttribute("loop")===null}}syncTargetWithState(e){const t=this.mediaMap.get(e);if(!t)return;const{muted:i,loop:s,volume:n,isPlaying:o}=t,a=this.service.state.matches("paused"),l=t.playbackRate*this.speedService.state.context.timer.speed;try{this.seekTo({time:this.getCurrentTime(),target:e,mediaState:t}),e.volume!==n&&(e.volume=n),e.muted=i,e.loop=s,e.playbackRate!==l&&(e.playbackRate=l),o&&!a?e.play():e.pause()}catch(c){this.warn(`Failed to replay media interactions: ${c.message||c}`)}}addMediaElements(e,t,i){if(!["AUDIO","VIDEO"].includes(e.nodeName))return;const s=e,n=i.getMeta(s);if(!n||!("attributes"in n))return;const o=this.service.state.matches("paused"),a=n.attributes;let l=!1;a.rr_mediaState?l=a.rr_mediaState==="played":l=s.getAttribute("autoplay")!==null,l&&o&&s.pause();let c=1;typeof a.rr_mediaPlaybackRate=="number"&&(c=a.rr_mediaPlaybackRate);let u=!1;typeof a.rr_mediaMuted=="boolean"?u=a.rr_mediaMuted:u=s.getAttribute("muted")!==null;let h=!1;typeof a.rr_mediaLoop=="boolean"?h=a.rr_mediaLoop:h=s.getAttribute("loop")!==null;let f=1;typeof a.rr_mediaVolume=="number"&&(f=a.rr_mediaVolume);let d=0;typeof a.rr_mediaCurrentTime=="number"&&(d=a.rr_mediaCurrentTime),this.mediaMap.set(s,{isPlaying:l,currentTimeAtLastInteraction:d,lastInteractionTimeOffset:t,playbackRate:c,volume:f,muted:u,loop:h}),this.syncTargetWithState(s)}mediaMutation({target:e,timeOffset:t,mutation:i}){this.mediaMap.set(e,this.getMediaStateFromMutation({target:e,timeOffset:t,mutation:i})),this.syncTargetWithState(e)}isSupportedMediaElement(e){return["AUDIO","VIDEO"].includes(e.nodeName)}reset(){this.mediaMap.clear()}}function yr(r,e){if(r.nodeName!=="DIALOG"||r instanceof we)return;const t=r,i=t.open,s=i&&t.matches("dialog:modal"),n=t.getAttribute("rr_open_mode"),o=typeof e?.attributes.open=="string"||typeof t.getAttribute("open")=="string",a=n==="modal";if(!(i&&!(s&&n==="non-modal"||!s&&a))){if(!t.isConnected){console.warn("dialog is not attached to the dom",t);return}i&&t.close(),o&&(a?t.showModal():t.show())}}function ry(r,e){if(r.nodeName!=="DIALOG"||r instanceof we)return;const t=r;if(!t.isConnected){console.warn("dialog is not attached to the dom",t);return}e.attributes.open===null&&(t.removeAttribute("open"),t.removeAttribute("rr_open_mode"))}const iy=5*1e3,sy=rc||Wg,Mo="[replayer]",Mi={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function ko(r){return r.type==K.IncrementalSnapshot&&(r.data.source==F.TouchMove||r.data.source==F.MouseInteraction&&r.data.type==ie.TouchStart)}class ny{constructor(e,t){if(_(this,"wrapper"),_(this,"iframe"),_(this,"service"),_(this,"speedService"),_(this,"config"),_(this,"usingVirtualDom",!1),_(this,"virtualDom",new ht),_(this,"mouse"),_(this,"mouseTail",null),_(this,"tailPositions",[]),_(this,"emitter",sy()),_(this,"nextUserInteractionEvent"),_(this,"legacy_missingNodeRetryMap",{}),_(this,"cache",Hn()),_(this,"imageMap",new Map),_(this,"canvasEventMap",new Map),_(this,"mirror",xa()),_(this,"styleMirror",new jg),_(this,"mediaManager"),_(this,"firstFullSnapshot",null),_(this,"newDocumentQueue",[]),_(this,"mousePos",null),_(this,"touchActive",null),_(this,"lastMouseDownEvent",null),_(this,"lastHoveredRootNode"),_(this,"lastSelectionData",null),_(this,"constructedStyleMutations",[]),_(this,"adoptedStyleSheets",[]),_(this,"handleResize",a=>{this.iframe.style.display="inherit";for(const l of[this.mouseTail,this.iframe])l&&(l.setAttribute("width",String(a.width)),l.setAttribute("height",String(a.height)))}),_(this,"applyEventsSynchronously",a=>{for(const l of a){switch(l.type){case K.DomContentLoaded:case K.Load:case K.Custom:continue;case K.FullSnapshot:case K.Meta:case K.Plugin:case K.IncrementalSnapshot:break}this.getCastFn(l,!0)()}}),_(this,"getCastFn",(a,l=!1)=>{let c;switch(a.type){case K.DomContentLoaded:case K.Load:break;case K.Custom:c=()=>{this.emitter.emit(O.CustomEvent,a)};break;case K.Meta:c=()=>this.emitter.emit(O.Resize,{width:a.data.width,height:a.data.height});break;case K.FullSnapshot:c=()=>{var h;if(this.firstFullSnapshot){if(this.firstFullSnapshot===a){this.firstFullSnapshot=!0;return}}else this.firstFullSnapshot=!0;this.mediaManager.reset(),this.styleMirror.reset(),this.rebuildFullSnapshot(a,l),(h=this.iframe.contentWindow)==null||h.scrollTo(a.data.initialOffset)};break;case K.IncrementalSnapshot:c=()=>{if(this.applyIncremental(a,l),!l&&(a===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive&&!this.nextUserInteractionEvent)){for(const h of this.service.state.context.events)if(!(h.timestamp<=a.timestamp)&&this.isUserInteraction(h)){h.delay-a.delay>this.config.inactivePeriodThreshold*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=h);break}if(this.nextUserInteractionEvent){const h=this.nextUserInteractionEvent.delay-a.delay,f={speed:Math.min(Math.round(h/iy),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:f}),this.emitter.emit(O.SkipStart,f)}}};break}return()=>{c&&c();for(const f of this.config.plugins||[])f.handler&&f.handler(a,l,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:a}});const h=this.service.state.context.events.length-1;if(!this.config.liveMode&&a===this.service.state.context.events[h]){const f=()=>{h<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send("END"),this.emitter.emit(O.Finish))};let d=50;a.type===K.IncrementalSnapshot&&a.data.source===F.MouseMove&&a.data.positions.length&&(d+=Math.max(0,-a.data.positions[0].timeOffset)),setTimeout(f,d)}this.emitter.emit(O.EventCast,a)}}),!t?.liveMode&&e.length<2)throw new Error("Replayer need at least 2 events.");const i={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:!1,inactivePeriodThreshold:10*1e3,showWarning:!0,showDebug:!1,blockClass:"rr-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:Mi,useVirtualDom:!0,logger:console};this.config=Object.assign({},i,t),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on(O.Resize,this.handleResize),this.setupDom();for(const a of this.config.plugins||[])a.getMirror&&a.getMirror({nodeMirror:this.mirror});this.emitter.on(O.Flush,()=>{if(this.usingVirtualDom){const a={mirror:this.mirror,applyCanvas:(l,c,u)=>{Ro({event:l,mutation:c,target:u,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this),applyStyleSheetMutation:(l,c)=>{l.source===F.StyleSheetRule?this.applyStyleSheetRule(l,c):l.source===F.StyleDeclaration&&this.applyStyleDeclaration(l,c)},afterAppend:(l,c)=>{for(const u of this.config.plugins||[])u.onBuild&&u.onBuild(l,{id:c,replayer:this})}};if(this.iframe.contentDocument)try{zr(this.iframe.contentDocument,this.virtualDom,a,this.virtualDom.mirror)}catch(l){console.warn(l)}if(this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(const l in this.legacy_missingNodeRetryMap)try{const c=this.legacy_missingNodeRetryMap[l],u=Wr(c.node,this.mirror,this.virtualDom.mirror);zr(u,c.node,a,this.virtualDom.mirror),c.node=u}catch(c){this.warn(c)}this.constructedStyleMutations.forEach(l=>{this.applyStyleSheetMutation(l)}),this.constructedStyleMutations=[],this.adoptedStyleSheets.forEach(l=>{this.applyAdoptedStyleSheet(l)}),this.adoptedStyleSheets=[]}if(this.mousePos&&(this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,!0,this.mousePos.debugData),this.mousePos=null),this.touchActive===!0?this.mouse.classList.add("touch-active"):this.touchActive===!1&&this.mouse.classList.remove("touch-active"),this.touchActive=null,this.lastMouseDownEvent){const[a,l]=this.lastMouseDownEvent;a.dispatchEvent(l)}this.lastMouseDownEvent=null,this.lastSelectionData&&(this.applySelection(this.lastSelectionData),this.lastSelectionData=null)}),this.emitter.on(O.PlayBack,()=>{this.firstFullSnapshot=null,this.mirror.reset(),this.styleMirror.reset(),this.mediaManager.reset()});const s=new Gg([],{speed:this.config.speed});this.service=Hg({events:e.map(a=>t&&t.unpackFn?t.unpackFn(a):a).sort((a,l)=>a.timestamp-l.timestamp),timer:s,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe(a=>{this.emitter.emit(O.StateChange,{player:a})}),this.speedService=Zg({normalSpeed:-1,timer:s}),this.speedService.start(),this.speedService.subscribe(a=>{this.emitter.emit(O.StateChange,{speed:a})}),this.mediaManager=new ty({warn:this.warn.bind(this),service:this.service,speedService:this.speedService,emitter:this.emitter,getCurrentTime:this.getCurrentTime.bind(this)});const n=this.service.state.context.events.find(a=>a.type===K.Meta),o=this.service.state.context.events.find(a=>a.type===K.FullSnapshot);if(n){const{width:a,height:l}=n.data;setTimeout(()=>{this.emitter.emit(O.Resize,{width:a,height:l})},0)}o&&setTimeout(()=>{var a;this.firstFullSnapshot||(this.firstFullSnapshot=o,this.rebuildFullSnapshot(o),(a=this.iframe.contentWindow)==null||a.scrollTo(o.data.initialOffset))},1),this.service.state.context.events.find(ko)&&this.mouse.classList.add("touch-device")}get timer(){return this.service.state.context.timer}on(e,t){return this.emitter.on(e,t),this}off(e,t){return this.emitter.off(e,t),this}setConfig(e){Object.keys(e).forEach(t=>{e[t],this.config[t]=e[t]}),this.config.skipInactive||this.backToNormal(),typeof e.speed<"u"&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),typeof e.mouseTail<"u"&&(e.mouseTail===!1?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))}getMetaData(){const e=this.service.state.context.events[0],t=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:e.timestamp,endTime:t.timestamp,totalTime:t.timestamp-e.timestamp}}getCurrentTime(){return this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){const{baselineTime:e,events:t}=this.service.state.context;return e-t[0].timestamp}getMirror(){return this.mirror}play(e=0){var t,i;this.service.state.matches("paused")?this.service.send({type:"PLAY",payload:{timeOffset:e}}):(this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}})),(i=(t=this.iframe.contentDocument)==null?void 0:t.getElementsByTagName("html")[0])==null||i.classList.remove("rrweb-paused"),this.emitter.emit(O.Start)}pause(e){var t,i;e===void 0&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),typeof e=="number"&&(this.play(e),this.service.send({type:"PAUSE"})),(i=(t=this.iframe.contentDocument)==null?void 0:t.getElementsByTagName("html")[0])==null||i.classList.add("rrweb-paused"),this.emitter.emit(O.Pause)}resume(e=0){this.warn("The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface."),this.play(e),this.emitter.emit(O.Resume)}destroy(){this.pause(),this.mirror.reset(),this.styleMirror.reset(),this.mediaManager.reset(),this.config.root.removeChild(this.wrapper),this.emitter.emit(O.Destroy)}startLive(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})}addEvent(e){const t=this.config.unpackFn?this.config.unpackFn(e):e;ko(t)&&this.mouse.classList.add("touch-device"),Promise.resolve().then(()=>this.service.send({type:"ADD_EVENT",payload:{event:t}}))}enableInteract(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"}disableInteract(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"}resetCache(){this.cache=Hn()}setupDom(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),this.config.mouseTail!==!1&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");const e=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&e.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",e.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(Vg(this.iframe.contentWindow,this.iframe.contentDocument),Lg(this.iframe.contentWindow))}rebuildFullSnapshot(e,t=!1){if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&this.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={};const i=[],s=new Set,n=(l,c)=>{if(l.nodeName==="DIALOG"&&s.add(l),this.collectIframeAndAttachDocument(i,l),this.mediaManager.isSupportedMediaElement(l)){const{events:u}=this.service.state.context;this.mediaManager.addMediaElements(l,e.timestamp-u[0].timestamp,this.mirror)}for(const u of this.config.plugins||[])u.onBuild&&u.onBuild(l,{id:c,replayer:this})};this.usingVirtualDom&&(this.virtualDom.destroyTree(),this.usingVirtualDom=!1),this.mirror.reset(),qd(e.data.node,{doc:this.iframe.contentDocument,afterAppend:n,cache:this.cache,mirror:this.mirror}),n(this.iframe.contentDocument,e.data.node.id);for(const{mutationInQueue:l,builtNode:c}of i)this.attachDocumentToIframe(l,c),this.newDocumentQueue=this.newDocumentQueue.filter(u=>u!==l);const{documentElement:o,head:a}=this.iframe.contentDocument;this.insertStyleRules(o,a),s.forEach(l=>yr(l)),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(O.FullsnapshotRebuilded,e),t||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(e,t){var i;const s=Xg(this.config.blockClass).concat(this.config.insertStyleRules);if(this.config.pauseAnimation&&s.push("html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }"),!!s.length)if(this.usingVirtualDom){const n=this.virtualDom.createElement("style");this.virtualDom.mirror.add(n,ql(n,this.virtualDom.unserializedId)),e.insertBefore(n,t),n.rules.push({source:F.StyleSheetRule,adds:s.map((o,a)=>({rule:o,index:a}))})}else{const n=document.createElement("style");e.insertBefore(n,t);for(let o=0;o<s.length;o++)(i=n.sheet)==null||i.insertRule(s[o],o)}}attachDocumentToIframe(e,t){const i=this.usingVirtualDom?this.virtualDom.mirror:this.mirror,s=[],n=new Set,o=(a,l)=>{a.nodeName==="DIALOG"&&n.add(a),this.collectIframeAndAttachDocument(s,a);const c=i.getMeta(a);if(c?.type===Te.Element&&c?.tagName.toUpperCase()==="HTML"){const{documentElement:u,head:h}=t.contentDocument;this.insertStyleRules(u,h)}if(!this.usingVirtualDom)for(const u of this.config.plugins||[])u.onBuild&&u.onBuild(a,{id:l,replayer:this})};St(e.node,{doc:t.contentDocument,mirror:i,hackCss:!0,skipChild:!1,afterAppend:o,cache:this.cache}),o(t.contentDocument,e.node.id);for(const{mutationInQueue:a,builtNode:l}of s)this.attachDocumentToIframe(a,l),this.newDocumentQueue=this.newDocumentQueue.filter(c=>c!==a);n.forEach(a=>yr(a))}collectIframeAndAttachDocument(e,t){if(Ai(t,this.mirror)){const i=this.newDocumentQueue.find(s=>s.parentId===this.mirror.getId(t));i&&e.push({mutationInQueue:i,builtNode:t})}}waitForStylesheetLoad(){var e;const t=(e=this.iframe.contentDocument)==null?void 0:e.head;if(t){const i=new Set;let s,n=this.service.state;const o=()=>{n=this.service.state};this.emitter.on(O.Start,o),this.emitter.on(O.Pause,o);const a=()=>{this.emitter.off(O.Start,o),this.emitter.off(O.Pause,o)};t.querySelectorAll('link[rel="stylesheet"]').forEach(l=>{l.sheet||(i.add(l),l.addEventListener("load",()=>{i.delete(l),i.size===0&&s!==-1&&(n.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit(O.LoadStylesheetEnd),s&&clearTimeout(s),a())}))}),i.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(O.LoadStylesheetStart),s=setTimeout(()=>{n.matches("playing")&&this.play(this.getCurrentTime()),s=-1,a()},this.config.loadTimeout))}}async preloadAllImages(){const e=[];for(const t of this.service.state.context.events)t.type===K.IncrementalSnapshot&&t.data.source===F.CanvasMutation&&(e.push(this.deserializeAndPreloadCanvasEvents(t.data,t)),("commands"in t.data?t.data.commands:[t.data]).forEach(s=>{this.preloadImages(s,t)}));return Promise.all(e)}preloadImages(e,t){if(e.property==="drawImage"&&typeof e.args[0]=="string"&&!this.imageMap.has(t)){const i=document.createElement("canvas"),s=i.getContext("2d"),n=s?.createImageData(i.width,i.height);s?.putImageData(n,0,0)}}async deserializeAndPreloadCanvasEvents(e,t){if(!this.canvasEventMap.has(t)){const i={isUnchanged:!0};if("commands"in e){const s=await Promise.all(e.commands.map(async n=>{const o=await Promise.all(n.args.map(Oe(this.imageMap,null,i)));return{...n,args:o}}));i.isUnchanged===!1&&this.canvasEventMap.set(t,{...e,commands:s})}else{const s=await Promise.all(e.args.map(Oe(this.imageMap,null,i)));i.isUnchanged===!1&&this.canvasEventMap.set(t,{...e,args:s})}}}applyIncremental(e,t){var i,s,n;const{data:o}=e;switch(o.source){case F.Mutation:{try{this.applyMutation(o,t)}catch(a){this.warn(`Exception in mutation ${a.message||a}`,o)}break}case F.Drag:case F.TouchMove:case F.MouseMove:if(t){const a=o.positions[o.positions.length-1];this.mousePos={x:a.x,y:a.y,id:a.id,debugData:o}}else o.positions.forEach(a=>{const l={doAction:()=>{this.moveAndHover(a.x,a.y,a.id,t,o)},delay:a.timeOffset+e.timestamp-this.service.state.context.baselineTime};this.timer.addAction(l)}),this.timer.addAction({doAction(){},delay:e.delay-((i=o.positions[0])==null?void 0:i.timeOffset)});break;case F.MouseInteraction:{if(o.id===-1)break;const a=new Event(Xh(ie[o.type])),l=this.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);this.emitter.emit(O.MouseInteraction,{type:o.type,target:l});const{triggerFocus:c}=this.config;switch(o.type){case ie.Blur:"blur"in l&&l.blur();break;case ie.Focus:c&&l.focus&&l.focus({preventScroll:!0});break;case ie.Click:case ie.TouchStart:case ie.TouchEnd:case ie.MouseDown:case ie.MouseUp:t?(o.type===ie.TouchStart?this.touchActive=!0:o.type===ie.TouchEnd&&(this.touchActive=!1),o.type===ie.MouseDown?this.lastMouseDownEvent=[l,a]:o.type===ie.MouseUp&&(this.lastMouseDownEvent=null),this.mousePos={x:o.x||0,y:o.y||0,id:o.id,debugData:o}):(o.type===ie.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(o.x||0,o.y||0,o.id,t,o),o.type===ie.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):o.type===ie.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):o.type===ie.TouchEnd?this.mouse.classList.remove("touch-active"):l.dispatchEvent(a));break;case ie.TouchCancel:t?this.touchActive=!1:this.mouse.classList.remove("touch-active");break;default:l.dispatchEvent(a)}break}case F.Scroll:{if(o.id===-1)break;if(this.usingVirtualDom){const a=this.virtualDom.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);a.scrollData=o;break}this.applyScroll(o,t);break}case F.ViewportResize:this.emitter.emit(O.Resize,{width:o.width,height:o.height});break;case F.Input:{if(o.id===-1)break;if(this.usingVirtualDom){const a=this.virtualDom.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);a.inputData=o;break}this.applyInput(o);break}case F.MediaInteraction:{const a=this.usingVirtualDom?this.virtualDom.mirror.getNode(o.id):this.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);const l=a,{events:c}=this.service.state.context;this.mediaManager.mediaMutation({target:l,timeOffset:e.timestamp-c[0].timestamp,mutation:o});break}case F.StyleSheetRule:case F.StyleDeclaration:{this.usingVirtualDom?o.styleId?this.constructedStyleMutations.push(o):o.id&&((s=this.virtualDom.mirror.getNode(o.id))==null||s.rules.push(o)):this.applyStyleSheetMutation(o);break}case F.CanvasMutation:{if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){const a=this.virtualDom.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);a.canvasMutations.push({event:e,mutation:o})}else{const a=this.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);Ro({event:e,mutation:o,target:a,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break}case F.Font:{try{const a=new FontFace(o.family,o.buffer?new Uint8Array(JSON.parse(o.fontSource)):o.fontSource,o.descriptors);(n=this.iframe.contentDocument)==null||n.fonts.add(a)}catch(a){this.warn(a)}break}case F.Selection:{if(t){this.lastSelectionData=o;break}this.applySelection(o);break}case F.AdoptedStyleSheet:{this.usingVirtualDom?this.adoptedStyleSheets.push(o):this.applyAdoptedStyleSheet(o);break}}}applyMutation(e,t){if(this.config.useVirtualDom&&!this.usingVirtualDom&&t&&(this.usingVirtualDom=!0,yg(this.iframe.contentDocument,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length))for(const c in this.legacy_missingNodeRetryMap)try{const u=this.legacy_missingNodeRetryMap[c],h=Kl(u.node,this.virtualDom,this.mirror);h&&(u.node=h)}catch(u){this.warn(u)}const i=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;e.removes=e.removes.filter(c=>i.getNode(c.id)?!0:(this.warnNodeNotFound(e,c.id),!1)),e.removes.forEach(c=>{var u;const h=i.getNode(c.id);if(!h)return;let f=i.getNode(c.parentId);if(!f)return this.warnNodeNotFound(e,c.parentId);if(c.isShadow&&mr(f)&&(f=f.shadowRoot),i.removeNodeFromMap(h),f)try{f.removeChild(h),this.usingVirtualDom&&h.nodeName==="#text"&&f.nodeName==="STYLE"&&((u=f.rules)==null?void 0:u.length)>0&&(f.rules=[])}catch(d){if(d instanceof DOMException)this.warn("parent could not remove child in mutation",f,h,e);else throw d}});const s={...this.legacy_missingNodeRetryMap},n=[],o=c=>{let u=null;return c.nextId&&(u=i.getNode(c.nextId)),c.nextId!==null&&c.nextId!==void 0&&c.nextId!==-1&&!u},a=c=>{var u,h;if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");let f=i.getNode(c.parentId);if(!f)return c.node.type===Te.Document?this.newDocumentQueue.push(c):n.push(c);c.node.isShadow&&(mr(f)||f.attachShadow({mode:"open"}),f=f.shadowRoot);let d=null,m=null;if(c.previousId&&(d=i.getNode(c.previousId)),c.nextId&&(m=i.getNode(c.nextId)),o(c))return n.push(c);if(c.node.rootId&&!i.getNode(c.node.rootId))return;const w=c.node.rootId?i.getNode(c.node.rootId):this.usingVirtualDom?this.virtualDom:this.iframe.contentDocument;if(Ai(f,i)){this.attachDocumentToIframe(c,f);return}const p=(v,x)=>{if(!this.usingVirtualDom){yr(v);for(const M of this.config.plugins||[])M.onBuild&&M.onBuild(v,{id:x,replayer:this})}},y=St(c.node,{doc:w,mirror:i,skipChild:!0,hackCss:!0,cache:this.cache,afterAppend:p});if(c.previousId===-1||c.nextId===-1){s[c.node.id]={node:y,mutation:c};return}const b=i.getMeta(f);if(b&&b.type===Te.Element&&c.node.type===Te.Text){const v=Array.isArray(f.childNodes)?f.childNodes:Array.from(f.childNodes);if(b.tagName==="textarea")for(const x of v)x.nodeType===f.TEXT_NODE&&f.removeChild(x);else if(b.tagName==="style"&&v.length===1)for(const x of v)x.nodeType===f.TEXT_NODE&&!i.hasNode(x)&&(y.textContent=x.textContent,f.removeChild(x))}else if(b?.type===Te.Document){const v=f;c.node.type===Te.DocumentType&&((u=v.childNodes[0])==null?void 0:u.nodeType)===Node.DOCUMENT_TYPE_NODE&&v.removeChild(v.childNodes[0]),y.nodeName==="HTML"&&v.documentElement&&v.removeChild(v.documentElement)}if(d&&d.nextSibling&&d.nextSibling.parentNode?f.insertBefore(y,d.nextSibling):m&&m.parentNode?f.contains(m)?f.insertBefore(y,m):f.insertBefore(y,null):f.appendChild(y),p(y,c.node.id),this.usingVirtualDom&&y.nodeName==="#text"&&f.nodeName==="STYLE"&&((h=f.rules)==null?void 0:h.length)>0&&(f.rules=[]),Ai(y,this.mirror)){const v=this.mirror.getId(y),x=this.newDocumentQueue.find(M=>M.parentId===v);x&&(this.attachDocumentToIframe(x,y),this.newDocumentQueue=this.newDocumentQueue.filter(M=>M!==x))}(c.previousId||c.nextId)&&this.legacy_resolveMissingNode(s,f,y,c)};e.adds.forEach(c=>{a(c)});const l=Date.now();for(;n.length;){const c=$g(n);if(n.length=0,Date.now()-l>500){this.warn("Timeout in the loop, please check the resolve tree data:",c);break}for(const u of c)i.getNode(u.value.parentId)?ec(u,f=>{a(f)}):this.debug("Drop resolve tree since there is no parent for the root node.",u)}Object.keys(s).length&&Object.assign(this.legacy_missingNodeRetryMap,s),Fg(e.texts).forEach(c=>{var u;const h=i.getNode(c.id);if(!h)return e.removes.find(d=>d.id===c.id)?void 0:this.warnNodeNotFound(e,c.id);const f=h.parentElement;if(c.value&&f&&f.tagName==="STYLE"?h.textContent=si(c.value,this.cache):h.textContent=c.value,this.usingVirtualDom){const d=h.parentNode;((u=d?.rules)==null?void 0:u.length)>0&&(d.rules=[])}}),e.attributes.forEach(c=>{var u;const h=i.getNode(c.id);if(!h)return e.removes.find(f=>f.id===c.id)?void 0:this.warnNodeNotFound(e,c.id);for(const f in c.attributes)if(typeof f=="string"){const d=c.attributes[f];if(d===null)h.removeAttribute(f),f==="open"&&ry(h,c);else if(typeof d=="string")try{if(f==="_cssText"&&(h.nodeName==="LINK"||h.nodeName==="STYLE"))try{const m=i.getMeta(h),w=St({...m,attributes:{...m.attributes,...c.attributes}},{doc:h.ownerDocument,mirror:i,skipChild:!0,hackCss:!0,cache:this.cache});Object.assign(m.attributes,c.attributes);const p=h.nextSibling,y=h.parentNode;if(w&&y){y.removeChild(h),y.insertBefore(w,p),i.replace(c.id,w);break}}catch{}if(f==="value"&&h.nodeName==="TEXTAREA"){const m=h;m.childNodes.forEach(p=>m.removeChild(p));const w=(u=h.ownerDocument)==null?void 0:u.createTextNode(d);w&&m.appendChild(w)}else h.setAttribute(f,d);f==="rr_open_mode"&&h.nodeName==="DIALOG"&&yr(h,c)}catch(m){this.warn("An error occurred may due to the checkout feature.",m)}else if(f==="style"){const m=d,w=h;for(const p in m)if(m[p]===!1)w.style.removeProperty(p);else if(m[p]instanceof Array){const y=m[p];w.style.setProperty(p,y[0],y[1])}else{const y=m[p];w.style.setProperty(p,y)}}}})}applyScroll(e,t){var i,s;const n=this.mirror.getNode(e.id);if(!n)return this.debugNodeNotFound(e,e.id);const o=this.mirror.getMeta(n);if(n===this.iframe.contentDocument)(i=this.iframe.contentWindow)==null||i.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"});else if(o?.type===Te.Document)(s=n.defaultView)==null||s.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"});else try{n.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"})}catch{}}applyInput(e){const t=this.mirror.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);try{t.checked=e.isChecked,t.value=e.text}catch{}}applySelection(e){try{const t=new Set,i=e.ranges.map(({start:s,startOffset:n,end:o,endOffset:a})=>{const l=this.mirror.getNode(s),c=this.mirror.getNode(o);if(!l||!c)return;const u=new Range;u.setStart(l,n),u.setEnd(c,a);const h=l.ownerDocument,f=h?.getSelection();return f&&t.add(f),{range:u,selection:f}});t.forEach(s=>s.removeAllRanges()),i.forEach(s=>{var n;return s&&((n=s.selection)==null?void 0:n.addRange(s.range))})}catch{}}applyStyleSheetMutation(e){var t;let i=null;e.styleId?i=this.styleMirror.getStyle(e.styleId):e.id&&(i=((t=this.mirror.getNode(e.id))==null?void 0:t.sheet)||null),i&&(e.source===F.StyleSheetRule?this.applyStyleSheetRule(e,i):e.source===F.StyleDeclaration&&this.applyStyleDeclaration(e,i))}applyStyleSheetRule(e,t){var i,s,n,o;if((i=e.adds)==null||i.forEach(({rule:a,index:l})=>{try{if(Array.isArray(l)){const{positions:c,index:u}=yo(l);yt(t.cssRules,c).insertRule(a,u)}else{const c=l===void 0?void 0:Math.min(l,t.cssRules.length);t?.insertRule(a,c)}}catch{}}),(s=e.removes)==null||s.forEach(({index:a})=>{try{if(Array.isArray(a)){const{positions:l,index:c}=yo(a);yt(t.cssRules,l).deleteRule(c||0)}else t?.deleteRule(a)}catch{}}),e.replace)try{(n=t.replace)==null||n.call(t,e.replace)}catch{}if(e.replaceSync)try{(o=t.replaceSync)==null||o.call(t,e.replaceSync)}catch{}}applyStyleDeclaration(e,t){e.set&&yt(t.rules,e.index).style.setProperty(e.set.property,e.set.value,e.set.priority),e.remove&&yt(t.rules,e.index).style.removeProperty(e.remove.property)}applyAdoptedStyleSheet(e){var t;const i=this.mirror.getNode(e.id);if(!i)return;(t=e.styles)==null||t.forEach(a=>{var l;let c=null,u=null;if(mr(i)?u=((l=i.ownerDocument)==null?void 0:l.defaultView)||null:i.nodeName==="#document"&&(u=i.defaultView),!!u)try{c=new u.CSSStyleSheet,this.styleMirror.add(c,a.styleId),this.applyStyleSheetRule({source:F.StyleSheetRule,adds:a.rules},c)}catch{}});const s=10;let n=0;const o=(a,l)=>{const c=l.map(u=>this.styleMirror.getStyle(u)).filter(u=>u!==null);mr(a)?a.shadowRoot.adoptedStyleSheets=c:a.nodeName==="#document"&&(a.adoptedStyleSheets=c),c.length!==l.length&&n<s&&(setTimeout(()=>o(a,l),0+100*n),n++)};o(i,e.styleIds)}legacy_resolveMissingNode(e,t,i,s){const{previousId:n,nextId:o}=s,a=n&&e[n],l=o&&e[o];if(a){const{node:c,mutation:u}=a;t.insertBefore(c,i),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,c,u)}if(l){const{node:c,mutation:u}=l;t.insertBefore(c,i.nextSibling),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,c,u)}}moveAndHover(e,t,i,s,n){const o=this.mirror.getNode(i);if(!o)return this.debugNodeNotFound(n,i);const a=tc(o,this.iframe),l=e*a.absoluteScale+a.x,c=t*a.absoluteScale+a.y;this.mouse.style.left=`${l}px`,this.mouse.style.top=`${c}px`,s||this.drawMouseTail({x:l,y:c}),this.hoverElements(o)}drawMouseTail(e){if(!this.mouseTail)return;const{lineCap:t,lineWidth:i,strokeStyle:s,duration:n}=this.config.mouseTail===!0?Mi:Object.assign({},Mi,this.config.mouseTail),o=()=>{if(!this.mouseTail)return;const a=this.mouseTail.getContext("2d");!a||!this.tailPositions.length||(a.clearRect(0,0,this.mouseTail.width,this.mouseTail.height),a.beginPath(),a.lineWidth=i,a.lineCap=t,a.strokeStyle=s,a.moveTo(this.tailPositions[0].x,this.tailPositions[0].y),this.tailPositions.forEach(l=>a.lineTo(l.x,l.y)),a.stroke())};this.tailPositions.push(e),o(),setTimeout(()=>{this.tailPositions=this.tailPositions.filter(a=>a!==e),o()},n/this.speedService.state.context.timer.speed)}hoverElements(e){var t;(t=this.lastHoveredRootNode||this.iframe.contentDocument)==null||t.querySelectorAll(".\\:hover").forEach(s=>{s.classList.remove(":hover")}),this.lastHoveredRootNode=e.getRootNode();let i=e;for(;i;)i.classList&&i.classList.add(":hover"),i=i.parentElement}isUserInteraction(e){return e.type!==K.IncrementalSnapshot?!1:e.data.source>F.Mutation&&e.data.source<=F.Input}backToNormal(){this.nextUserInteractionEvent=null,!this.speedService.state.matches("normal")&&(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(O.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(e,t){this.warn(`Node with id '${t}' not found. `,e)}warnCanvasMutationFailed(e,t){this.warn("Has error on canvas update",t,"canvas mutation:",e)}debugNodeNotFound(e,t){this.debug(`Node with id '${t}' not found. `,e)}warn(...e){this.config.showWarning&&this.config.logger.warn(Mo,...e)}debug(...e){this.config.showDebug&&this.config.logger.log(Mo,...e)}}var fe=Uint8Array,je=Uint16Array,bs=Uint32Array,lc=new fe([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),cc=new fe([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),oy=new fe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),uc=function(r,e){for(var t=new je(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];for(var s=new bs(t[30]),i=1;i<30;++i)for(var n=t[i];n<t[i+1];++n)s[n]=n-t[i]<<5|i;return[t,s]},hc=uc(lc,2),fc=hc[0],ay=hc[1];fc[28]=258,ay[258]=28;var ly=uc(cc,0),cy=ly[0],dc=new je(32768);for(var H=0;H<32768;++H){var De=(H&43690)>>>1|(H&21845)<<1;De=(De&52428)>>>2|(De&13107)<<2,De=(De&61680)>>>4|(De&3855)<<4,dc[H]=((De&65280)>>>8|(De&255)<<8)>>>1}var Ct=function(r,e,t){for(var i=r.length,s=0,n=new je(e);s<i;++s)++n[r[s]-1];var o=new je(e);for(s=0;s<e;++s)o[s]=o[s-1]+n[s-1]<<1;var a;{a=new je(1<<e);var l=15-e;for(s=0;s<i;++s)if(r[s])for(var c=s<<4|r[s],u=e-r[s],h=o[r[s]-1]++<<u,f=h|(1<<u)-1;h<=f;++h)a[dc[h]>>>l]=c}return a},Wt=new fe(288);for(var H=0;H<144;++H)Wt[H]=8;for(var H=144;H<256;++H)Wt[H]=9;for(var H=256;H<280;++H)Wt[H]=7;for(var H=280;H<288;++H)Wt[H]=8;var pc=new fe(32);for(var H=0;H<32;++H)pc[H]=5;var uy=Ct(Wt,9),hy=Ct(pc,5),ki=function(r){for(var e=r[0],t=1;t<r.length;++t)r[t]>e&&(e=r[t]);return e},me=function(r,e,t){var i=e/8>>0;return(r[i]|r[i+1]<<8)>>>(e&7)&t},Ni=function(r,e){var t=e/8>>0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>>(e&7)},fy=function(r){return(r/8>>0)+(r&7&&1)},mc=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof je?je:r instanceof bs?bs:fe)(t-e);return i.set(r.subarray(e,t)),i},dy=function(r,e,t){var i=r.length,s=!e||t,n=!t||t.i;t||(t={}),e||(e=new fe(i*3));var o=function(S){var R=e.length;if(S>R){var $=new fe(Math.max(R*2,S));$.set(e),e=$}},a=t.f||0,l=t.p||0,c=t.b||0,u=t.l,h=t.d,f=t.m,d=t.n,m=i*8;do{if(!u){t.f=a=me(r,l,1);var w=me(r,l+1,3);if(l+=3,w)if(w==1)u=uy,h=hy,f=9,d=5;else if(w==2){var v=me(r,l,31)+257,x=me(r,l+10,15)+4,M=v+me(r,l+5,31)+1;l+=14;for(var N=new fe(M),j=new fe(19),D=0;D<x;++D)j[oy[D]]=me(r,l+D*3,7);l+=x*3;var J=ki(j),W=(1<<J)-1;if(!n&&l+M*(J+7)>m)break;for(var de=Ct(j,J),D=0;D<M;){var ce=de[me(r,l,W)];l+=ce&15;var p=ce>>>4;if(p<16)N[D++]=p;else{var ee=0,B=0;for(p==16?(B=3+me(r,l,3),l+=2,ee=N[D-1]):p==17?(B=3+me(r,l,7),l+=3):p==18&&(B=11+me(r,l,127),l+=7);B--;)N[D++]=ee}}var oe=N.subarray(0,v),L=N.subarray(v);f=ki(oe),d=ki(L),u=Ct(oe,f),h=Ct(L,d)}else throw"invalid block type";else{var p=fy(l)+4,y=r[p-4]|r[p-3]<<8,b=p+y;if(b>i){if(n)throw"unexpected EOF";break}s&&o(c+y),e.set(r.subarray(p,b),c),t.b=c+=y,t.p=l=b*8;continue}if(l>m)throw"unexpected EOF"}s&&o(c+131072);for(var V=(1<<f)-1,ae=(1<<d)-1,ne=f+d+18;n||l+ne<m;){var ee=u[Ni(r,l)&V],re=ee>>>4;if(l+=ee&15,l>m)throw"unexpected EOF";if(!ee)throw"invalid length/literal";if(re<256)e[c++]=re;else if(re==256){u=null;break}else{var q=re-254;if(re>264){var D=re-257,pe=lc[D];q=me(r,l,(1<<pe)-1)+fc[D],l+=pe}var be=h[Ni(r,l)&ae],A=be>>>4;if(!be)throw"invalid distance";l+=be&15;var L=cy[A];if(A>3){var pe=cc[A];L+=Ni(r,l)&(1<<pe)-1,l+=pe}if(l>m)throw"unexpected EOF";s&&o(c+131072);for(var C=c+q;c<C;c+=4)e[c]=e[c-L],e[c+1]=e[c+1-L],e[c+2]=e[c+2-L],e[c+3]=e[c+3-L];c=C}}t.l=u,t.p=l,t.b=c,u&&(a=1,t.m=f,t.d=h,t.n=d)}while(!a);return c==e.length?e:mc(e,0,c)},py=function(r){if((r[0]&15)!=8||r[0]>>>4>7||(r[0]<<8|r[1])%31)throw"invalid zlib data";if(r[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function my(r,e){return dy((py(r),r.subarray(2,-4)),e)}function gy(r,e){for(var t=r.length,i=new fe(r.length+(r.length>>>1)),s=0,n=function(c){i[s++]=c},o=0;o<t;++o){if(s+5>i.length){var a=new fe(s+8+(t-o<<1));a.set(i),i=a}var l=r.charCodeAt(o);n(l)}return mc(i,0,s)}function yy(r,e){var t="";if(typeof TextDecoder<"u")return new TextDecoder().decode(r);for(var i=0;i<r.length;){var s=r[i++];s<128||e?t+=String.fromCharCode(s):s<224?t+=String.fromCharCode((s&31)<<6|r[i++]&63):s<240?t+=String.fromCharCode((s&15)<<12|(r[i++]&63)<<6|r[i++]&63):(s=((s&15)<<18|(r[i++]&63)<<12|(r[i++]&63)<<6|r[i++]&63)-65536,t+=String.fromCharCode(55296|s>>10,56320|s&1023))}return t}const No="v1",wy=r=>{if(typeof r!="string")return r;try{const e=JSON.parse(r);if(e.timestamp)return e}catch{}try{const e=JSON.parse(yy(my(gy(r,!0))));if(e.v===No)return e;throw new Error(`These events were packed with packer ${e.v} which is incompatible with current packer ${No}.`)}catch(e){throw console.error(e),new Error("Unknown data format.")}};var on=(r=>(r[r.DomContentLoaded=0]="DomContentLoaded",r[r.Load=1]="Load",r[r.FullSnapshot=2]="FullSnapshot",r[r.IncrementalSnapshot=3]="IncrementalSnapshot",r[r.Meta=4]="Meta",r[r.Custom=5]="Custom",r[r.Plugin=6]="Plugin",r))(on||{}),vs=(r=>(r[r.Mutation=0]="Mutation",r[r.MouseMove=1]="MouseMove",r[r.MouseInteraction=2]="MouseInteraction",r[r.Scroll=3]="Scroll",r[r.ViewportResize=4]="ViewportResize",r[r.Input=5]="Input",r[r.TouchMove=6]="TouchMove",r[r.MediaInteraction=7]="MediaInteraction",r[r.StyleSheetRule=8]="StyleSheetRule",r[r.CanvasMutation=9]="CanvasMutation",r[r.Font=10]="Font",r[r.Log=11]="Log",r[r.Drag=12]="Drag",r[r.StyleDeclaration=13]="StyleDeclaration",r[r.Selection=14]="Selection",r[r.AdoptedStyleSheet=15]="AdoptedStyleSheet",r[r.CustomElement=16]="CustomElement",r))(vs||{});function _o(r){let e="";return Object.keys(r).forEach(t=>{e+=`${t}: ${r[t]};`}),e}function gt(r,e=2){let t=String(r);const i=Math.pow(10,e-1);if(r<i)for(;String(i).length>t.length;)t=`0${r}`;return t}const gc=1e3,Ss=60*gc,Io=60*Ss;function wr(r){if(r<=0)return"00:00";const e=Math.floor(r/Io);r=r%Io;const t=Math.floor(r/Ss);r=r%Ss;const i=Math.floor(r/gc);return e?`${gt(e)}:${gt(t)}:${gt(i)}`:`${gt(t)}:${gt(i)}`}function by(r){return r.requestFullscreen?r.requestFullscreen():r.mozRequestFullScreen?r.mozRequestFullScreen():r.webkitRequestFullscreen?r.webkitRequestFullscreen():r.msRequestFullscreen?r.msRequestFullscreen():Promise.resolve()}function vy(){return document.exitFullscreen?document.exitFullscreen():document.mozExitFullscreen?document.mozExitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen?document.msExitFullscreen():Promise.resolve()}function Do(){let r=!1;return["fullscreen","webkitIsFullScreen","mozFullScreen","msFullscreenElement"].forEach(e=>{e in document&&(r=r||!!document[e])}),r}function Sy(r){return document.addEventListener("fullscreenchange",r),document.addEventListener("webkitfullscreenchange",r),document.addEventListener("mozfullscreenchange",r),document.addEventListener("MSFullscreenChange",r),()=>{document.removeEventListener("fullscreenchange",r),document.removeEventListener("webkitfullscreenchange",r),document.removeEventListener("mozfullscreenchange",r),document.removeEventListener("MSFullscreenChange",r)}}function To(r){return{"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regExp","[object Undefined]":"undefined","[object Null]":"null","[object Object]":"object"}[Object.prototype.toString.call(r)]}function Cy(r){return r.type!==on.IncrementalSnapshot?!1:r.data.source>vs.Mutation&&r.data.source<=vs.Input}function xy(r,e){const t=[];let i=r[0].timestamp;for(const s of r)Cy(s)&&(s.timestamp-i>e&&t.push([i,s.timestamp]),i=s.timestamp);return t}function Ey(r){let e,t,i,s,n,o,a,l,c;return{c(){e=se("div"),t=se("input"),i=he(),s=se("label"),n=he(),o=se("span"),a=Be(r[3]),I(t,"type","checkbox"),I(t,"id",r[2]),t.disabled=r[1],I(t,"class","svelte-a6h7w7"),I(s,"for",r[2]),I(s,"class","svelte-a6h7w7"),I(o,"class","label svelte-a6h7w7"),I(e,"class","switch svelte-a6h7w7"),rt(e,"disabled",r[1])},m(u,h){_e(u,e,h),P(e,t),t.checked=r[0],P(e,i),P(e,s),P(e,n),P(e,o),P(o,a),l||(c=Je(t,"change",r[4]),l=!0)},p(u,[h]){h&4&&I(t,"id",u[2]),h&2&&(t.disabled=u[1]),h&1&&(t.checked=u[0]),h&4&&I(s,"for",u[2]),h&8&&Tr(a,u[3]),h&2&&rt(e,"disabled",u[1])},i:Mt,o:Mt,d(u){u&&Ae(e),l=!1,c()}}}function Ay(r,e,t){let{disabled:i}=e,{checked:s}=e,{id:n}=e,{label:o}=e;function a(){s=this.checked,t(0,s)}return r.$$set=l=>{"disabled"in l&&t(1,i=l.disabled),"checked"in l&&t(0,s=l.checked),"id"in l&&t(2,n=l.id),"label"in l&&t(3,o=l.label)},[s,i,n,o,a]}class Ry extends Os{constructor(e){super(),Ts(this,e,Ay,Ey,_s,{disabled:1,checked:0,id:2,label:3})}}function Oo(r,e,t){const i=r.slice();return i[38]=e[t],i}function Po(r,e,t){const i=r.slice();return i[41]=e[t],i}function Lo(r,e,t){const i=r.slice();return i[44]=e[t],i}function $o(r){let e,t,i,s=wr(r[6])+"",n,o,a,l,c,u,h,f,d,m,w=wr(r[8].totalTime)+"",p,y,b,v,x,M,N,j,D,J,W,de,ce,ee=Ge(r[13]),B=[];for(let A=0;A<ee.length;A+=1)B[A]=Fo(Lo(r,ee,A));let oe=Ge(r[9]),L=[];for(let A=0;A<oe.length;A+=1)L[A]=jo(Po(r,oe,A));function V(A,C){return A[7]==="playing"?ky:My}let ae=V(r),ne=ae(r),re=Ge(r[3]),q=[];for(let A=0;A<re.length;A+=1)q[A]=Bo(Oo(r,re,A));function pe(A){r[29](A)}let be={id:"skip",disabled:r[10]==="skipping",label:"skip inactive"};return r[0]!==void 0&&(be.checked=r[0]),N=new Ry({props:be}),Fe.push(()=>Uh(N,"checked",pe)),{c(){e=se("div"),t=se("div"),i=se("span"),n=Be(s),o=he(),a=se("div"),l=se("div"),c=he();for(let A=0;A<B.length;A+=1)B[A].c();u=he();for(let A=0;A<L.length;A+=1)L[A].c();h=he(),f=se("div"),d=he(),m=se("span"),p=Be(w),y=he(),b=se("div"),v=se("button"),ne.c(),x=he();for(let A=0;A<q.length;A+=1)q[A].c();M=he(),Sa(N.$$.fragment),D=he(),J=se("button"),J.innerHTML=`<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><defs><style type="text/css"></style></defs><path d="M916 380c-26.4 0-48-21.6-48-48L868 223.2 613.6 477.6c-18.4
88
+ ***************************************************************************** */function vo(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i,s,n=t.call(r),o=[];try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return o}var Ke;(function(r){r[r.NotStarted=0]="NotStarted",r[r.Running=1]="Running",r[r.Stopped=2]="Stopped"})(Ke||(Ke={}));var ic={type:"xstate.init"};function Ri(r){return r===void 0?[]:[].concat(r)}function Xe(r){return{type:"xstate.assign",assignment:r}}function So(r,e){return typeof(r=typeof r=="string"&&e&&e[r]?e[r]:r)=="string"?{type:r}:typeof r=="function"?{type:r.name,exec:r}:r}function Gr(r){return function(e){return r===e}}function sc(r){return typeof r=="string"?{type:r}:r}function Co(r,e){return{value:r,context:e,actions:[],changed:!1,matches:Gr(r)}}function xo(r,e,t){var i=e,s=!1;return[r.filter(function(n){if(n.type==="xstate.assign"){s=!0;var o=Object.assign({},i);return typeof n.assignment=="function"?o=n.assignment(i,t):Object.keys(n.assignment).forEach(function(a){o[a]=typeof n.assignment[a]=="function"?n.assignment[a](i,t):n.assignment[a]}),i=o,!1}return!0}),i,s]}function nc(r,e){e===void 0&&(e={});var t=vo(xo(Ri(r.states[r.initial].entry).map(function(o){return So(o,e.actions)}),r.context,ic),2),i=t[0],s=t[1],n={config:r,_options:e,initialState:{value:r.initial,actions:i,context:s,matches:Gr(r.initial)},transition:function(o,a){var l,c,u=typeof o=="string"?{value:o,context:r.context}:o,h=u.value,f=u.context,d=sc(a),g=r.states[h];if(g.on){var w=Ri(g.on[d.type]);try{for(var p=function(V){var le=typeof Symbol=="function"&&Symbol.iterator,ne=le&&V[le],re=0;if(ne)return ne.call(V);if(V&&typeof V.length=="number")return{next:function(){return V&&re>=V.length&&(V=void 0),{value:V&&V[re++],done:!V}}};throw new TypeError(le?"Object is not iterable.":"Symbol.iterator is not defined.")}(w),y=p.next();!y.done;y=p.next()){var b=y.value;if(b===void 0)return Co(h,f);var v=typeof b=="string"?{target:b}:b,x=v.target,k=v.actions,N=k===void 0?[]:k,F=v.cond,D=F===void 0?function(){return!0}:F,J=x===void 0,W=x??h,de=r.states[W];if(D(f,d)){var ce=vo(xo((J?Ri(N):[].concat(g.exit,N,de.entry).filter(function(V){return V})).map(function(V){return So(V,n._options.actions)}),f,d),3),ee=ce[0],B=ce[1],ae=ce[2],L=x??h;return{value:L,context:B,actions:ee,changed:x!==h||ee.length>0||ae,matches:Gr(L)}}}}catch(V){l={error:V}}finally{try{y&&!y.done&&(c=p.return)&&c.call(p)}finally{if(l)throw l.error}}}return Co(h,f)}};return n}var Eo=function(r,e){return r.actions.forEach(function(t){var i=t.exec;return i&&i(r.context,e)})};function oc(r){var e=r.initialState,t=Ke.NotStarted,i=new Set,s={_machine:r,send:function(n){t===Ke.Running&&(e=r.transition(e,n),Eo(e,sc(n)),i.forEach(function(o){return o(e)}))},subscribe:function(n){return i.add(n),n(e),{unsubscribe:function(){return i.delete(n)}}},start:function(n){if(n){var o=typeof n=="object"?n:{context:r.config.context,value:n};e={value:o.value,actions:[],context:o.context,matches:Gr(o.value)}}return t=Ke.Running,Eo(e,ic),s},stop:function(){return t=Ke.Stopped,i.clear(),s},get state(){return e},get status(){return t}};return s}function Yg(r,e){for(let t=r.length-1;t>=0;t--){const i=r[t];if(i.type===K.Meta&&i.timestamp<=e)return r.slice(t)}return r}function Hg(r,{getCastFn:e,applyEventsSynchronously:t,emitter:i}){const s=nc({id:"player",context:r,initial:"paused",states:{playing:{on:{PAUSE:{target:"paused",actions:["pause"]},CAST_EVENT:{target:"playing",actions:"castEvent"},END:{target:"paused",actions:["resetLastPlayedEvent","pause"]},ADD_EVENT:{target:"playing",actions:["addEvent"]}}},paused:{on:{PLAY:{target:"playing",actions:["recordTimeOffset","play"]},CAST_EVENT:{target:"paused",actions:"castEvent"},TO_LIVE:{target:"live",actions:["startLive"]},ADD_EVENT:{target:"paused",actions:["addEvent"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:Xe({lastPlayedEvent:(n,o)=>o.type==="CAST_EVENT"?o.payload.event:n.lastPlayedEvent}),recordTimeOffset:Xe((n,o)=>{let a=n.timeOffset;return"payload"in o&&"timeOffset"in o.payload&&(a=o.payload.timeOffset),{...n,timeOffset:a,baselineTime:n.events[0].timestamp+a}}),play(n){var o;const{timer:a,events:l,baselineTime:c,lastPlayedEvent:u}=n;a.clear();for(const g of l)bo(g,c);const h=Yg(l,c);let f=u?.timestamp;u?.type===K.IncrementalSnapshot&&u.data.source===j.MouseMove&&(f=u.timestamp+((o=u.data.positions[0])==null?void 0:o.timeOffset)),c<(f||0)&&i.emit(O.PlayBack);const d=new Array;for(const g of h)if(!(f&&f<c&&(g.timestamp<=f||g===u)))if(g.timestamp<c)d.push(g);else{const w=e(g,!1);a.addAction({doAction:()=>{w()},delay:g.delay})}t(d),i.emit(O.Flush),a.start()},pause(n){n.timer.clear()},resetLastPlayedEvent:Xe(n=>({...n,lastPlayedEvent:null})),startLive:Xe({baselineTime:(n,o)=>(n.timer.start(),o.type==="TO_LIVE"&&o.payload.baselineTime?o.payload.baselineTime:Date.now())}),addEvent:Xe((n,o)=>{const{baselineTime:a,timer:l,events:c}=n;if(o.type==="ADD_EVENT"){const{event:u}=o.payload;bo(u,a);let h=c.length-1;if(!c[h]||c[h].timestamp<=u.timestamp)c.push(u);else{let g=-1,w=0;for(;w<=h;){const p=Math.floor((w+h)/2);c[p].timestamp<=u.timestamp?w=p+1:h=p-1}g===-1&&(g=w),c.splice(g,0,u)}const f=u.timestamp<a,d=e(u,f);f?d():l.isActive()&&l.addAction({doAction:()=>{d()},delay:u.delay})}return{...n,events:c}})}});return oc(s)}function Zg(r){const e=nc({id:"speed",context:r,initial:"normal",states:{normal:{on:{FAST_FORWARD:{target:"skipping",actions:["recordSpeed","setSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}},skipping:{on:{BACK_TO_NORMAL:{target:"normal",actions:["restoreSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}}}},{actions:{setSpeed:(t,i)=>{"payload"in i&&t.timer.setSpeed(i.payload.speed)},recordSpeed:Xe({normalSpeed:t=>t.timer.speed}),restoreSpeed:t=>{t.timer.setSpeed(t.normalSpeed)}}});return oc(e)}const Xg=r=>[`.${r} { background: currentColor }`,"noscript { display: none !important; }"],Ao=new Map;function ac(r,e){let t=Ao.get(r);return t||(t=new Map,Ao.set(r,t)),t.has(e)||t.set(e,[]),t.get(e)}function Oe(r,e,t){return async i=>{if(i&&typeof i=="object"&&"rr_type"in i)if(t&&(t.isUnchanged=!1),i.rr_type==="ImageBitmap"&&"args"in i){const s=await Oe(r,e,t)(i.args);return await createImageBitmap.apply(null,s)}else if("index"in i){if(t||e===null)return i;const{rr_type:s,index:n}=i;return ac(e,s)[n]}else if("args"in i){const{rr_type:s,args:n}=i,o=window[s];return new o(...await Promise.all(n.map(Oe(r,e,t))))}else{if("base64"in i)return Bg(i.base64);if("src"in i){const s=r.get(i.src);if(s)return s;{const n=new Image;return n.src=i.src,r.set(i.src,n),n}}else if("data"in i&&i.rr_type==="Blob"){const s=await Promise.all(i.data.map(Oe(r,e,t)));return new Blob(s,{type:i.type})}}else if(Array.isArray(i))return await Promise.all(i.map(Oe(r,e,t)));return i}}function Jg(r,e){try{return e===Vr.WebGL?r.getContext("webgl")||r.getContext("experimental-webgl"):r.getContext("webgl2")}catch{return null}}const Kg=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function qg(r,e){if(!e?.constructor)return;const{name:t}=e.constructor;if(!Kg.includes(t))return;const i=ac(r,t);i.includes(e)||i.push(e)}async function Qg({mutation:r,target:e,type:t,imageMap:i,errorHandler:s}){try{const n=Jg(e,t);if(!n)return;if(r.setter){n[r.property]=r.args[0];return}const o=n[r.property],a=await Promise.all(r.args.map(Oe(i,n))),l=o.apply(n,a);qg(n,l);const c=!1}catch(n){s(r,n)}}async function ey({event:r,mutations:e,target:t,imageMap:i,errorHandler:s}){const n=t.getContext("2d");if(!n){s(e[0],new Error("Canvas context is null"));return}const o=e.map(async l=>Promise.all(l.args.map(Oe(i,n))));(await Promise.all(o)).forEach((l,c)=>{const u=e[c];try{if(u.setter){n[u.property]=u.args[0];return}const h=n[u.property];u.property==="drawImage"&&typeof u.args[0]=="string"?(i.get(r),h.apply(n,u.args)):h.apply(n,l)}catch(h){s(u,h)}})}async function Ro({event:r,mutation:e,target:t,imageMap:i,canvasEventMap:s,errorHandler:n}){try{const o=s.get(r)||e,a="commands"in o?o.commands:[o];if([Vr.WebGL,Vr.WebGL2].includes(e.type)){for(let l=0;l<a.length;l++){const c=a[l];await Qg({mutation:c,type:e.type,target:t,imageMap:i,errorHandler:n})}return}await ey({event:r,mutations:a,target:t,imageMap:i,errorHandler:n})}catch(o){n(e,o)}}class ty{constructor(e){_(this,"mediaMap",new Map),_(this,"warn"),_(this,"service"),_(this,"speedService"),_(this,"emitter"),_(this,"getCurrentTime"),_(this,"metadataCallbackMap",new Map),this.warn=e.warn,this.service=e.service,this.speedService=e.speedService,this.emitter=e.emitter,this.getCurrentTime=e.getCurrentTime,this.emitter.on(O.Start,this.start.bind(this)),this.emitter.on(O.SkipStart,this.start.bind(this)),this.emitter.on(O.Pause,this.pause.bind(this)),this.emitter.on(O.Finish,this.pause.bind(this)),this.speedService.subscribe(()=>{this.syncAllMediaElements()})}syncAllMediaElements(e={pause:!1}){this.mediaMap.forEach((t,i)=>{this.syncTargetWithState(i),e.pause&&i.pause()})}start(){this.syncAllMediaElements()}pause(){this.syncAllMediaElements({pause:!0})}seekTo({time:e,target:t,mediaState:i}){if(i.isPlaying){const n=(e-i.lastInteractionTimeOffset)/1e3*i.playbackRate,o="duration"in t&&t.duration;if(Number.isNaN(o)){this.waitForMetadata(t);return}let a=i.currentTimeAtLastInteraction+n;t.loop&&o!==!1&&(a=a%o),t.currentTime=a}else t.pause(),t.currentTime=i.currentTimeAtLastInteraction}waitForMetadata(e){if(this.metadataCallbackMap.has(e)||!("addEventListener"in e))return;const t=()=>{this.metadataCallbackMap.delete(e);const i=this.mediaMap.get(e);i&&this.seekTo({time:this.getCurrentTime(),target:e,mediaState:i})};this.metadataCallbackMap.set(e,t),e.addEventListener("loadedmetadata",t,{once:!0})}getMediaStateFromMutation({target:e,timeOffset:t,mutation:i}){const s=this.mediaMap.get(e),{type:n,playbackRate:o,currentTime:a,muted:l,volume:c,loop:u}=i;return{isPlaying:n===ws.Play||n!==ws.Pause&&(s?.isPlaying||e.getAttribute("autoplay")!==null),currentTimeAtLastInteraction:a??s?.currentTimeAtLastInteraction??0,lastInteractionTimeOffset:t,playbackRate:o??s?.playbackRate??1,volume:c??s?.volume??1,muted:l??s?.muted??e.getAttribute("muted")===null,loop:u??s?.loop??e.getAttribute("loop")===null}}syncTargetWithState(e){const t=this.mediaMap.get(e);if(!t)return;const{muted:i,loop:s,volume:n,isPlaying:o}=t,a=this.service.state.matches("paused"),l=t.playbackRate*this.speedService.state.context.timer.speed;try{this.seekTo({time:this.getCurrentTime(),target:e,mediaState:t}),e.volume!==n&&(e.volume=n),e.muted=i,e.loop=s,e.playbackRate!==l&&(e.playbackRate=l),o&&!a?e.play():e.pause()}catch(c){this.warn(`Failed to replay media interactions: ${c.message||c}`)}}addMediaElements(e,t,i){if(!["AUDIO","VIDEO"].includes(e.nodeName))return;const s=e,n=i.getMeta(s);if(!n||!("attributes"in n))return;const o=this.service.state.matches("paused"),a=n.attributes;let l=!1;a.rr_mediaState?l=a.rr_mediaState==="played":l=s.getAttribute("autoplay")!==null,l&&o&&s.pause();let c=1;typeof a.rr_mediaPlaybackRate=="number"&&(c=a.rr_mediaPlaybackRate);let u=!1;typeof a.rr_mediaMuted=="boolean"?u=a.rr_mediaMuted:u=s.getAttribute("muted")!==null;let h=!1;typeof a.rr_mediaLoop=="boolean"?h=a.rr_mediaLoop:h=s.getAttribute("loop")!==null;let f=1;typeof a.rr_mediaVolume=="number"&&(f=a.rr_mediaVolume);let d=0;typeof a.rr_mediaCurrentTime=="number"&&(d=a.rr_mediaCurrentTime),this.mediaMap.set(s,{isPlaying:l,currentTimeAtLastInteraction:d,lastInteractionTimeOffset:t,playbackRate:c,volume:f,muted:u,loop:h}),this.syncTargetWithState(s)}mediaMutation({target:e,timeOffset:t,mutation:i}){this.mediaMap.set(e,this.getMediaStateFromMutation({target:e,timeOffset:t,mutation:i})),this.syncTargetWithState(e)}isSupportedMediaElement(e){return["AUDIO","VIDEO"].includes(e.nodeName)}reset(){this.mediaMap.clear()}}function yr(r,e){if(r.nodeName!=="DIALOG"||r instanceof we)return;const t=r,i=t.open,s=i&&t.matches("dialog:modal"),n=t.getAttribute("rr_open_mode"),o=typeof e?.attributes.open=="string"||typeof t.getAttribute("open")=="string",a=n==="modal";if(!(i&&!(s&&n==="non-modal"||!s&&a))){if(!t.isConnected){console.warn("dialog is not attached to the dom",t);return}i&&t.close(),o&&(a?t.showModal():t.show())}}function ry(r,e){if(r.nodeName!=="DIALOG"||r instanceof we)return;const t=r;if(!t.isConnected){console.warn("dialog is not attached to the dom",t);return}e.attributes.open===null&&(t.removeAttribute("open"),t.removeAttribute("rr_open_mode"))}const iy=5*1e3,sy=rc||Wg,ko="[replayer]",ki={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function Mo(r){return r.type==K.IncrementalSnapshot&&(r.data.source==j.TouchMove||r.data.source==j.MouseInteraction&&r.data.type==ie.TouchStart)}class ny{constructor(e,t){if(_(this,"wrapper"),_(this,"iframe"),_(this,"service"),_(this,"speedService"),_(this,"config"),_(this,"usingVirtualDom",!1),_(this,"virtualDom",new ht),_(this,"mouse"),_(this,"mouseTail",null),_(this,"tailPositions",[]),_(this,"emitter",sy()),_(this,"nextUserInteractionEvent"),_(this,"legacy_missingNodeRetryMap",{}),_(this,"cache",Hn()),_(this,"imageMap",new Map),_(this,"canvasEventMap",new Map),_(this,"mirror",xa()),_(this,"styleMirror",new Fg),_(this,"mediaManager"),_(this,"firstFullSnapshot",null),_(this,"newDocumentQueue",[]),_(this,"mousePos",null),_(this,"touchActive",null),_(this,"lastMouseDownEvent",null),_(this,"lastHoveredRootNode"),_(this,"lastSelectionData",null),_(this,"constructedStyleMutations",[]),_(this,"adoptedStyleSheets",[]),_(this,"handleResize",a=>{this.iframe.style.display="inherit";for(const l of[this.mouseTail,this.iframe])l&&(l.setAttribute("width",String(a.width)),l.setAttribute("height",String(a.height)))}),_(this,"applyEventsSynchronously",a=>{for(const l of a){switch(l.type){case K.DomContentLoaded:case K.Load:case K.Custom:continue;case K.FullSnapshot:case K.Meta:case K.Plugin:case K.IncrementalSnapshot:break}this.getCastFn(l,!0)()}}),_(this,"getCastFn",(a,l=!1)=>{let c;switch(a.type){case K.DomContentLoaded:case K.Load:break;case K.Custom:c=()=>{this.emitter.emit(O.CustomEvent,a)};break;case K.Meta:c=()=>this.emitter.emit(O.Resize,{width:a.data.width,height:a.data.height});break;case K.FullSnapshot:c=()=>{var h;if(this.firstFullSnapshot){if(this.firstFullSnapshot===a){this.firstFullSnapshot=!0;return}}else this.firstFullSnapshot=!0;this.mediaManager.reset(),this.styleMirror.reset(),this.rebuildFullSnapshot(a,l),(h=this.iframe.contentWindow)==null||h.scrollTo(a.data.initialOffset)};break;case K.IncrementalSnapshot:c=()=>{if(this.applyIncremental(a,l),!l&&(a===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive&&!this.nextUserInteractionEvent)){for(const h of this.service.state.context.events)if(!(h.timestamp<=a.timestamp)&&this.isUserInteraction(h)){h.delay-a.delay>this.config.inactivePeriodThreshold*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=h);break}if(this.nextUserInteractionEvent){const h=this.nextUserInteractionEvent.delay-a.delay,f={speed:Math.min(Math.round(h/iy),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:f}),this.emitter.emit(O.SkipStart,f)}}};break}return()=>{c&&c();for(const f of this.config.plugins||[])f.handler&&f.handler(a,l,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:a}});const h=this.service.state.context.events.length-1;if(!this.config.liveMode&&a===this.service.state.context.events[h]){const f=()=>{h<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send("END"),this.emitter.emit(O.Finish))};let d=50;a.type===K.IncrementalSnapshot&&a.data.source===j.MouseMove&&a.data.positions.length&&(d+=Math.max(0,-a.data.positions[0].timeOffset)),setTimeout(f,d)}this.emitter.emit(O.EventCast,a)}}),!t?.liveMode&&e.length<2)throw new Error("Replayer need at least 2 events.");const i={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:!1,inactivePeriodThreshold:10*1e3,showWarning:!0,showDebug:!1,blockClass:"rr-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:ki,useVirtualDom:!0,logger:console};this.config=Object.assign({},i,t),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on(O.Resize,this.handleResize),this.setupDom();for(const a of this.config.plugins||[])a.getMirror&&a.getMirror({nodeMirror:this.mirror});this.emitter.on(O.Flush,()=>{if(this.usingVirtualDom){const a={mirror:this.mirror,applyCanvas:(l,c,u)=>{Ro({event:l,mutation:c,target:u,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this),applyStyleSheetMutation:(l,c)=>{l.source===j.StyleSheetRule?this.applyStyleSheetRule(l,c):l.source===j.StyleDeclaration&&this.applyStyleDeclaration(l,c)},afterAppend:(l,c)=>{for(const u of this.config.plugins||[])u.onBuild&&u.onBuild(l,{id:c,replayer:this})}};if(this.iframe.contentDocument)try{zr(this.iframe.contentDocument,this.virtualDom,a,this.virtualDom.mirror)}catch(l){console.warn(l)}if(this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(const l in this.legacy_missingNodeRetryMap)try{const c=this.legacy_missingNodeRetryMap[l],u=Wr(c.node,this.mirror,this.virtualDom.mirror);zr(u,c.node,a,this.virtualDom.mirror),c.node=u}catch(c){this.warn(c)}this.constructedStyleMutations.forEach(l=>{this.applyStyleSheetMutation(l)}),this.constructedStyleMutations=[],this.adoptedStyleSheets.forEach(l=>{this.applyAdoptedStyleSheet(l)}),this.adoptedStyleSheets=[]}if(this.mousePos&&(this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,!0,this.mousePos.debugData),this.mousePos=null),this.touchActive===!0?this.mouse.classList.add("touch-active"):this.touchActive===!1&&this.mouse.classList.remove("touch-active"),this.touchActive=null,this.lastMouseDownEvent){const[a,l]=this.lastMouseDownEvent;a.dispatchEvent(l)}this.lastMouseDownEvent=null,this.lastSelectionData&&(this.applySelection(this.lastSelectionData),this.lastSelectionData=null)}),this.emitter.on(O.PlayBack,()=>{this.firstFullSnapshot=null,this.mirror.reset(),this.styleMirror.reset(),this.mediaManager.reset()});const s=new Gg([],{speed:this.config.speed});this.service=Hg({events:e.map(a=>t&&t.unpackFn?t.unpackFn(a):a).sort((a,l)=>a.timestamp-l.timestamp),timer:s,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe(a=>{this.emitter.emit(O.StateChange,{player:a})}),this.speedService=Zg({normalSpeed:-1,timer:s}),this.speedService.start(),this.speedService.subscribe(a=>{this.emitter.emit(O.StateChange,{speed:a})}),this.mediaManager=new ty({warn:this.warn.bind(this),service:this.service,speedService:this.speedService,emitter:this.emitter,getCurrentTime:this.getCurrentTime.bind(this)});const n=this.service.state.context.events.find(a=>a.type===K.Meta),o=this.service.state.context.events.find(a=>a.type===K.FullSnapshot);if(n){const{width:a,height:l}=n.data;setTimeout(()=>{this.emitter.emit(O.Resize,{width:a,height:l})},0)}o&&setTimeout(()=>{var a;this.firstFullSnapshot||(this.firstFullSnapshot=o,this.rebuildFullSnapshot(o),(a=this.iframe.contentWindow)==null||a.scrollTo(o.data.initialOffset))},1),this.service.state.context.events.find(Mo)&&this.mouse.classList.add("touch-device")}get timer(){return this.service.state.context.timer}on(e,t){return this.emitter.on(e,t),this}off(e,t){return this.emitter.off(e,t),this}setConfig(e){Object.keys(e).forEach(t=>{e[t],this.config[t]=e[t]}),this.config.skipInactive||this.backToNormal(),typeof e.speed<"u"&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),typeof e.mouseTail<"u"&&(e.mouseTail===!1?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))}getMetaData(){const e=this.service.state.context.events[0],t=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:e.timestamp,endTime:t.timestamp,totalTime:t.timestamp-e.timestamp}}getCurrentTime(){return this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){const{baselineTime:e,events:t}=this.service.state.context;return e-t[0].timestamp}getMirror(){return this.mirror}play(e=0){var t,i;this.service.state.matches("paused")?this.service.send({type:"PLAY",payload:{timeOffset:e}}):(this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}})),(i=(t=this.iframe.contentDocument)==null?void 0:t.getElementsByTagName("html")[0])==null||i.classList.remove("rrweb-paused"),this.emitter.emit(O.Start)}pause(e){var t,i;e===void 0&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),typeof e=="number"&&(this.play(e),this.service.send({type:"PAUSE"})),(i=(t=this.iframe.contentDocument)==null?void 0:t.getElementsByTagName("html")[0])==null||i.classList.add("rrweb-paused"),this.emitter.emit(O.Pause)}resume(e=0){this.warn("The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface."),this.play(e),this.emitter.emit(O.Resume)}destroy(){this.pause(),this.mirror.reset(),this.styleMirror.reset(),this.mediaManager.reset(),this.config.root.removeChild(this.wrapper),this.emitter.emit(O.Destroy)}startLive(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})}addEvent(e){const t=this.config.unpackFn?this.config.unpackFn(e):e;Mo(t)&&this.mouse.classList.add("touch-device"),Promise.resolve().then(()=>this.service.send({type:"ADD_EVENT",payload:{event:t}}))}enableInteract(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"}disableInteract(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"}resetCache(){this.cache=Hn()}setupDom(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),this.config.mouseTail!==!1&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");const e=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&e.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",e.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(Vg(this.iframe.contentWindow,this.iframe.contentDocument),Lg(this.iframe.contentWindow))}rebuildFullSnapshot(e,t=!1){if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&this.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={};const i=[],s=new Set,n=(l,c)=>{if(l.nodeName==="DIALOG"&&s.add(l),this.collectIframeAndAttachDocument(i,l),this.mediaManager.isSupportedMediaElement(l)){const{events:u}=this.service.state.context;this.mediaManager.addMediaElements(l,e.timestamp-u[0].timestamp,this.mirror)}for(const u of this.config.plugins||[])u.onBuild&&u.onBuild(l,{id:c,replayer:this})};this.usingVirtualDom&&(this.virtualDom.destroyTree(),this.usingVirtualDom=!1),this.mirror.reset(),qd(e.data.node,{doc:this.iframe.contentDocument,afterAppend:n,cache:this.cache,mirror:this.mirror}),n(this.iframe.contentDocument,e.data.node.id);for(const{mutationInQueue:l,builtNode:c}of i)this.attachDocumentToIframe(l,c),this.newDocumentQueue=this.newDocumentQueue.filter(u=>u!==l);const{documentElement:o,head:a}=this.iframe.contentDocument;this.insertStyleRules(o,a),s.forEach(l=>yr(l)),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(O.FullsnapshotRebuilded,e),t||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(e,t){var i;const s=Xg(this.config.blockClass).concat(this.config.insertStyleRules);if(this.config.pauseAnimation&&s.push("html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }"),!!s.length)if(this.usingVirtualDom){const n=this.virtualDom.createElement("style");this.virtualDom.mirror.add(n,ql(n,this.virtualDom.unserializedId)),e.insertBefore(n,t),n.rules.push({source:j.StyleSheetRule,adds:s.map((o,a)=>({rule:o,index:a}))})}else{const n=document.createElement("style");e.insertBefore(n,t);for(let o=0;o<s.length;o++)(i=n.sheet)==null||i.insertRule(s[o],o)}}attachDocumentToIframe(e,t){const i=this.usingVirtualDom?this.virtualDom.mirror:this.mirror,s=[],n=new Set,o=(a,l)=>{a.nodeName==="DIALOG"&&n.add(a),this.collectIframeAndAttachDocument(s,a);const c=i.getMeta(a);if(c?.type===Te.Element&&c?.tagName.toUpperCase()==="HTML"){const{documentElement:u,head:h}=t.contentDocument;this.insertStyleRules(u,h)}if(!this.usingVirtualDom)for(const u of this.config.plugins||[])u.onBuild&&u.onBuild(a,{id:l,replayer:this})};St(e.node,{doc:t.contentDocument,mirror:i,hackCss:!0,skipChild:!1,afterAppend:o,cache:this.cache}),o(t.contentDocument,e.node.id);for(const{mutationInQueue:a,builtNode:l}of s)this.attachDocumentToIframe(a,l),this.newDocumentQueue=this.newDocumentQueue.filter(c=>c!==a);n.forEach(a=>yr(a))}collectIframeAndAttachDocument(e,t){if(Ai(t,this.mirror)){const i=this.newDocumentQueue.find(s=>s.parentId===this.mirror.getId(t));i&&e.push({mutationInQueue:i,builtNode:t})}}waitForStylesheetLoad(){var e;const t=(e=this.iframe.contentDocument)==null?void 0:e.head;if(t){const i=new Set;let s,n=this.service.state;const o=()=>{n=this.service.state};this.emitter.on(O.Start,o),this.emitter.on(O.Pause,o);const a=()=>{this.emitter.off(O.Start,o),this.emitter.off(O.Pause,o)};t.querySelectorAll('link[rel="stylesheet"]').forEach(l=>{l.sheet||(i.add(l),l.addEventListener("load",()=>{i.delete(l),i.size===0&&s!==-1&&(n.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit(O.LoadStylesheetEnd),s&&clearTimeout(s),a())}))}),i.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(O.LoadStylesheetStart),s=setTimeout(()=>{n.matches("playing")&&this.play(this.getCurrentTime()),s=-1,a()},this.config.loadTimeout))}}async preloadAllImages(){const e=[];for(const t of this.service.state.context.events)t.type===K.IncrementalSnapshot&&t.data.source===j.CanvasMutation&&(e.push(this.deserializeAndPreloadCanvasEvents(t.data,t)),("commands"in t.data?t.data.commands:[t.data]).forEach(s=>{this.preloadImages(s,t)}));return Promise.all(e)}preloadImages(e,t){if(e.property==="drawImage"&&typeof e.args[0]=="string"&&!this.imageMap.has(t)){const i=document.createElement("canvas"),s=i.getContext("2d"),n=s?.createImageData(i.width,i.height);s?.putImageData(n,0,0)}}async deserializeAndPreloadCanvasEvents(e,t){if(!this.canvasEventMap.has(t)){const i={isUnchanged:!0};if("commands"in e){const s=await Promise.all(e.commands.map(async n=>{const o=await Promise.all(n.args.map(Oe(this.imageMap,null,i)));return{...n,args:o}}));i.isUnchanged===!1&&this.canvasEventMap.set(t,{...e,commands:s})}else{const s=await Promise.all(e.args.map(Oe(this.imageMap,null,i)));i.isUnchanged===!1&&this.canvasEventMap.set(t,{...e,args:s})}}}applyIncremental(e,t){var i,s,n;const{data:o}=e;switch(o.source){case j.Mutation:{try{this.applyMutation(o,t)}catch(a){this.warn(`Exception in mutation ${a.message||a}`,o)}break}case j.Drag:case j.TouchMove:case j.MouseMove:if(t){const a=o.positions[o.positions.length-1];this.mousePos={x:a.x,y:a.y,id:a.id,debugData:o}}else o.positions.forEach(a=>{const l={doAction:()=>{this.moveAndHover(a.x,a.y,a.id,t,o)},delay:a.timeOffset+e.timestamp-this.service.state.context.baselineTime};this.timer.addAction(l)}),this.timer.addAction({doAction(){},delay:e.delay-((i=o.positions[0])==null?void 0:i.timeOffset)});break;case j.MouseInteraction:{if(o.id===-1)break;const a=new Event(Xh(ie[o.type])),l=this.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);this.emitter.emit(O.MouseInteraction,{type:o.type,target:l});const{triggerFocus:c}=this.config;switch(o.type){case ie.Blur:"blur"in l&&l.blur();break;case ie.Focus:c&&l.focus&&l.focus({preventScroll:!0});break;case ie.Click:case ie.TouchStart:case ie.TouchEnd:case ie.MouseDown:case ie.MouseUp:t?(o.type===ie.TouchStart?this.touchActive=!0:o.type===ie.TouchEnd&&(this.touchActive=!1),o.type===ie.MouseDown?this.lastMouseDownEvent=[l,a]:o.type===ie.MouseUp&&(this.lastMouseDownEvent=null),this.mousePos={x:o.x||0,y:o.y||0,id:o.id,debugData:o}):(o.type===ie.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(o.x||0,o.y||0,o.id,t,o),o.type===ie.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):o.type===ie.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):o.type===ie.TouchEnd?this.mouse.classList.remove("touch-active"):l.dispatchEvent(a));break;case ie.TouchCancel:t?this.touchActive=!1:this.mouse.classList.remove("touch-active");break;default:l.dispatchEvent(a)}break}case j.Scroll:{if(o.id===-1)break;if(this.usingVirtualDom){const a=this.virtualDom.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);a.scrollData=o;break}this.applyScroll(o,t);break}case j.ViewportResize:this.emitter.emit(O.Resize,{width:o.width,height:o.height});break;case j.Input:{if(o.id===-1)break;if(this.usingVirtualDom){const a=this.virtualDom.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);a.inputData=o;break}this.applyInput(o);break}case j.MediaInteraction:{const a=this.usingVirtualDom?this.virtualDom.mirror.getNode(o.id):this.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);const l=a,{events:c}=this.service.state.context;this.mediaManager.mediaMutation({target:l,timeOffset:e.timestamp-c[0].timestamp,mutation:o});break}case j.StyleSheetRule:case j.StyleDeclaration:{this.usingVirtualDom?o.styleId?this.constructedStyleMutations.push(o):o.id&&((s=this.virtualDom.mirror.getNode(o.id))==null||s.rules.push(o)):this.applyStyleSheetMutation(o);break}case j.CanvasMutation:{if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){const a=this.virtualDom.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);a.canvasMutations.push({event:e,mutation:o})}else{const a=this.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);Ro({event:e,mutation:o,target:a,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break}case j.Font:{try{const a=new FontFace(o.family,o.buffer?new Uint8Array(JSON.parse(o.fontSource)):o.fontSource,o.descriptors);(n=this.iframe.contentDocument)==null||n.fonts.add(a)}catch(a){this.warn(a)}break}case j.Selection:{if(t){this.lastSelectionData=o;break}this.applySelection(o);break}case j.AdoptedStyleSheet:{this.usingVirtualDom?this.adoptedStyleSheets.push(o):this.applyAdoptedStyleSheet(o);break}}}applyMutation(e,t){if(this.config.useVirtualDom&&!this.usingVirtualDom&&t&&(this.usingVirtualDom=!0,yg(this.iframe.contentDocument,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length))for(const c in this.legacy_missingNodeRetryMap)try{const u=this.legacy_missingNodeRetryMap[c],h=Kl(u.node,this.virtualDom,this.mirror);h&&(u.node=h)}catch(u){this.warn(u)}const i=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;e.removes=e.removes.filter(c=>i.getNode(c.id)?!0:(this.warnNodeNotFound(e,c.id),!1)),e.removes.forEach(c=>{var u;const h=i.getNode(c.id);if(!h)return;let f=i.getNode(c.parentId);if(!f)return this.warnNodeNotFound(e,c.parentId);if(c.isShadow&&mr(f)&&(f=f.shadowRoot),i.removeNodeFromMap(h),f)try{f.removeChild(h),this.usingVirtualDom&&h.nodeName==="#text"&&f.nodeName==="STYLE"&&((u=f.rules)==null?void 0:u.length)>0&&(f.rules=[])}catch(d){if(d instanceof DOMException)this.warn("parent could not remove child in mutation",f,h,e);else throw d}});const s={...this.legacy_missingNodeRetryMap},n=[],o=c=>{let u=null;return c.nextId&&(u=i.getNode(c.nextId)),c.nextId!==null&&c.nextId!==void 0&&c.nextId!==-1&&!u},a=c=>{var u,h;if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");let f=i.getNode(c.parentId);if(!f)return c.node.type===Te.Document?this.newDocumentQueue.push(c):n.push(c);c.node.isShadow&&(mr(f)||f.attachShadow({mode:"open"}),f=f.shadowRoot);let d=null,g=null;if(c.previousId&&(d=i.getNode(c.previousId)),c.nextId&&(g=i.getNode(c.nextId)),o(c))return n.push(c);if(c.node.rootId&&!i.getNode(c.node.rootId))return;const w=c.node.rootId?i.getNode(c.node.rootId):this.usingVirtualDom?this.virtualDom:this.iframe.contentDocument;if(Ai(f,i)){this.attachDocumentToIframe(c,f);return}const p=(v,x)=>{if(!this.usingVirtualDom){yr(v);for(const k of this.config.plugins||[])k.onBuild&&k.onBuild(v,{id:x,replayer:this})}},y=St(c.node,{doc:w,mirror:i,skipChild:!0,hackCss:!0,cache:this.cache,afterAppend:p});if(c.previousId===-1||c.nextId===-1){s[c.node.id]={node:y,mutation:c};return}const b=i.getMeta(f);if(b&&b.type===Te.Element&&c.node.type===Te.Text){const v=Array.isArray(f.childNodes)?f.childNodes:Array.from(f.childNodes);if(b.tagName==="textarea")for(const x of v)x.nodeType===f.TEXT_NODE&&f.removeChild(x);else if(b.tagName==="style"&&v.length===1)for(const x of v)x.nodeType===f.TEXT_NODE&&!i.hasNode(x)&&(y.textContent=x.textContent,f.removeChild(x))}else if(b?.type===Te.Document){const v=f;c.node.type===Te.DocumentType&&((u=v.childNodes[0])==null?void 0:u.nodeType)===Node.DOCUMENT_TYPE_NODE&&v.removeChild(v.childNodes[0]),y.nodeName==="HTML"&&v.documentElement&&v.removeChild(v.documentElement)}if(d&&d.nextSibling&&d.nextSibling.parentNode?f.insertBefore(y,d.nextSibling):g&&g.parentNode?f.contains(g)?f.insertBefore(y,g):f.insertBefore(y,null):f.appendChild(y),p(y,c.node.id),this.usingVirtualDom&&y.nodeName==="#text"&&f.nodeName==="STYLE"&&((h=f.rules)==null?void 0:h.length)>0&&(f.rules=[]),Ai(y,this.mirror)){const v=this.mirror.getId(y),x=this.newDocumentQueue.find(k=>k.parentId===v);x&&(this.attachDocumentToIframe(x,y),this.newDocumentQueue=this.newDocumentQueue.filter(k=>k!==x))}(c.previousId||c.nextId)&&this.legacy_resolveMissingNode(s,f,y,c)};e.adds.forEach(c=>{a(c)});const l=Date.now();for(;n.length;){const c=$g(n);if(n.length=0,Date.now()-l>500){this.warn("Timeout in the loop, please check the resolve tree data:",c);break}for(const u of c)i.getNode(u.value.parentId)?ec(u,f=>{a(f)}):this.debug("Drop resolve tree since there is no parent for the root node.",u)}Object.keys(s).length&&Object.assign(this.legacy_missingNodeRetryMap,s),jg(e.texts).forEach(c=>{var u;const h=i.getNode(c.id);if(!h)return e.removes.find(d=>d.id===c.id)?void 0:this.warnNodeNotFound(e,c.id);const f=h.parentElement;if(c.value&&f&&f.tagName==="STYLE"?h.textContent=si(c.value,this.cache):h.textContent=c.value,this.usingVirtualDom){const d=h.parentNode;((u=d?.rules)==null?void 0:u.length)>0&&(d.rules=[])}}),e.attributes.forEach(c=>{var u;const h=i.getNode(c.id);if(!h)return e.removes.find(f=>f.id===c.id)?void 0:this.warnNodeNotFound(e,c.id);for(const f in c.attributes)if(typeof f=="string"){const d=c.attributes[f];if(d===null)h.removeAttribute(f),f==="open"&&ry(h,c);else if(typeof d=="string")try{if(f==="_cssText"&&(h.nodeName==="LINK"||h.nodeName==="STYLE"))try{const g=i.getMeta(h),w=St({...g,attributes:{...g.attributes,...c.attributes}},{doc:h.ownerDocument,mirror:i,skipChild:!0,hackCss:!0,cache:this.cache});Object.assign(g.attributes,c.attributes);const p=h.nextSibling,y=h.parentNode;if(w&&y){y.removeChild(h),y.insertBefore(w,p),i.replace(c.id,w);break}}catch{}if(f==="value"&&h.nodeName==="TEXTAREA"){const g=h;g.childNodes.forEach(p=>g.removeChild(p));const w=(u=h.ownerDocument)==null?void 0:u.createTextNode(d);w&&g.appendChild(w)}else h.setAttribute(f,d);f==="rr_open_mode"&&h.nodeName==="DIALOG"&&yr(h,c)}catch(g){this.warn("An error occurred may due to the checkout feature.",g)}else if(f==="style"){const g=d,w=h;for(const p in g)if(g[p]===!1)w.style.removeProperty(p);else if(g[p]instanceof Array){const y=g[p];w.style.setProperty(p,y[0],y[1])}else{const y=g[p];w.style.setProperty(p,y)}}}})}applyScroll(e,t){var i,s;const n=this.mirror.getNode(e.id);if(!n)return this.debugNodeNotFound(e,e.id);const o=this.mirror.getMeta(n);if(n===this.iframe.contentDocument)(i=this.iframe.contentWindow)==null||i.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"});else if(o?.type===Te.Document)(s=n.defaultView)==null||s.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"});else try{n.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"})}catch{}}applyInput(e){const t=this.mirror.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);try{t.checked=e.isChecked,t.value=e.text}catch{}}applySelection(e){try{const t=new Set,i=e.ranges.map(({start:s,startOffset:n,end:o,endOffset:a})=>{const l=this.mirror.getNode(s),c=this.mirror.getNode(o);if(!l||!c)return;const u=new Range;u.setStart(l,n),u.setEnd(c,a);const h=l.ownerDocument,f=h?.getSelection();return f&&t.add(f),{range:u,selection:f}});t.forEach(s=>s.removeAllRanges()),i.forEach(s=>{var n;return s&&((n=s.selection)==null?void 0:n.addRange(s.range))})}catch{}}applyStyleSheetMutation(e){var t;let i=null;e.styleId?i=this.styleMirror.getStyle(e.styleId):e.id&&(i=((t=this.mirror.getNode(e.id))==null?void 0:t.sheet)||null),i&&(e.source===j.StyleSheetRule?this.applyStyleSheetRule(e,i):e.source===j.StyleDeclaration&&this.applyStyleDeclaration(e,i))}applyStyleSheetRule(e,t){var i,s,n,o;if((i=e.adds)==null||i.forEach(({rule:a,index:l})=>{try{if(Array.isArray(l)){const{positions:c,index:u}=yo(l);yt(t.cssRules,c).insertRule(a,u)}else{const c=l===void 0?void 0:Math.min(l,t.cssRules.length);t?.insertRule(a,c)}}catch{}}),(s=e.removes)==null||s.forEach(({index:a})=>{try{if(Array.isArray(a)){const{positions:l,index:c}=yo(a);yt(t.cssRules,l).deleteRule(c||0)}else t?.deleteRule(a)}catch{}}),e.replace)try{(n=t.replace)==null||n.call(t,e.replace)}catch{}if(e.replaceSync)try{(o=t.replaceSync)==null||o.call(t,e.replaceSync)}catch{}}applyStyleDeclaration(e,t){e.set&&yt(t.rules,e.index).style.setProperty(e.set.property,e.set.value,e.set.priority),e.remove&&yt(t.rules,e.index).style.removeProperty(e.remove.property)}applyAdoptedStyleSheet(e){var t;const i=this.mirror.getNode(e.id);if(!i)return;(t=e.styles)==null||t.forEach(a=>{var l;let c=null,u=null;if(mr(i)?u=((l=i.ownerDocument)==null?void 0:l.defaultView)||null:i.nodeName==="#document"&&(u=i.defaultView),!!u)try{c=new u.CSSStyleSheet,this.styleMirror.add(c,a.styleId),this.applyStyleSheetRule({source:j.StyleSheetRule,adds:a.rules},c)}catch{}});const s=10;let n=0;const o=(a,l)=>{const c=l.map(u=>this.styleMirror.getStyle(u)).filter(u=>u!==null);mr(a)?a.shadowRoot.adoptedStyleSheets=c:a.nodeName==="#document"&&(a.adoptedStyleSheets=c),c.length!==l.length&&n<s&&(setTimeout(()=>o(a,l),0+100*n),n++)};o(i,e.styleIds)}legacy_resolveMissingNode(e,t,i,s){const{previousId:n,nextId:o}=s,a=n&&e[n],l=o&&e[o];if(a){const{node:c,mutation:u}=a;t.insertBefore(c,i),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,c,u)}if(l){const{node:c,mutation:u}=l;t.insertBefore(c,i.nextSibling),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,c,u)}}moveAndHover(e,t,i,s,n){const o=this.mirror.getNode(i);if(!o)return this.debugNodeNotFound(n,i);const a=tc(o,this.iframe),l=e*a.absoluteScale+a.x,c=t*a.absoluteScale+a.y;this.mouse.style.left=`${l}px`,this.mouse.style.top=`${c}px`,s||this.drawMouseTail({x:l,y:c}),this.hoverElements(o)}drawMouseTail(e){if(!this.mouseTail)return;const{lineCap:t,lineWidth:i,strokeStyle:s,duration:n}=this.config.mouseTail===!0?ki:Object.assign({},ki,this.config.mouseTail),o=()=>{if(!this.mouseTail)return;const a=this.mouseTail.getContext("2d");!a||!this.tailPositions.length||(a.clearRect(0,0,this.mouseTail.width,this.mouseTail.height),a.beginPath(),a.lineWidth=i,a.lineCap=t,a.strokeStyle=s,a.moveTo(this.tailPositions[0].x,this.tailPositions[0].y),this.tailPositions.forEach(l=>a.lineTo(l.x,l.y)),a.stroke())};this.tailPositions.push(e),o(),setTimeout(()=>{this.tailPositions=this.tailPositions.filter(a=>a!==e),o()},n/this.speedService.state.context.timer.speed)}hoverElements(e){var t;(t=this.lastHoveredRootNode||this.iframe.contentDocument)==null||t.querySelectorAll(".\\:hover").forEach(s=>{s.classList.remove(":hover")}),this.lastHoveredRootNode=e.getRootNode();let i=e;for(;i;)i.classList&&i.classList.add(":hover"),i=i.parentElement}isUserInteraction(e){return e.type!==K.IncrementalSnapshot?!1:e.data.source>j.Mutation&&e.data.source<=j.Input}backToNormal(){this.nextUserInteractionEvent=null,!this.speedService.state.matches("normal")&&(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(O.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(e,t){this.warn(`Node with id '${t}' not found. `,e)}warnCanvasMutationFailed(e,t){this.warn("Has error on canvas update",t,"canvas mutation:",e)}debugNodeNotFound(e,t){this.debug(`Node with id '${t}' not found. `,e)}warn(...e){this.config.showWarning&&this.config.logger.warn(ko,...e)}debug(...e){this.config.showDebug&&this.config.logger.log(ko,...e)}}var fe=Uint8Array,Fe=Uint16Array,bs=Uint32Array,lc=new fe([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),cc=new fe([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),oy=new fe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),uc=function(r,e){for(var t=new Fe(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];for(var s=new bs(t[30]),i=1;i<30;++i)for(var n=t[i];n<t[i+1];++n)s[n]=n-t[i]<<5|i;return[t,s]},hc=uc(lc,2),fc=hc[0],ay=hc[1];fc[28]=258,ay[258]=28;var ly=uc(cc,0),cy=ly[0],dc=new Fe(32768);for(var H=0;H<32768;++H){var De=(H&43690)>>>1|(H&21845)<<1;De=(De&52428)>>>2|(De&13107)<<2,De=(De&61680)>>>4|(De&3855)<<4,dc[H]=((De&65280)>>>8|(De&255)<<8)>>>1}var Ct=function(r,e,t){for(var i=r.length,s=0,n=new Fe(e);s<i;++s)++n[r[s]-1];var o=new Fe(e);for(s=0;s<e;++s)o[s]=o[s-1]+n[s-1]<<1;var a;{a=new Fe(1<<e);var l=15-e;for(s=0;s<i;++s)if(r[s])for(var c=s<<4|r[s],u=e-r[s],h=o[r[s]-1]++<<u,f=h|(1<<u)-1;h<=f;++h)a[dc[h]>>>l]=c}return a},Wt=new fe(288);for(var H=0;H<144;++H)Wt[H]=8;for(var H=144;H<256;++H)Wt[H]=9;for(var H=256;H<280;++H)Wt[H]=7;for(var H=280;H<288;++H)Wt[H]=8;var pc=new fe(32);for(var H=0;H<32;++H)pc[H]=5;var uy=Ct(Wt,9),hy=Ct(pc,5),Mi=function(r){for(var e=r[0],t=1;t<r.length;++t)r[t]>e&&(e=r[t]);return e},me=function(r,e,t){var i=e/8>>0;return(r[i]|r[i+1]<<8)>>>(e&7)&t},Ni=function(r,e){var t=e/8>>0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>>(e&7)},fy=function(r){return(r/8>>0)+(r&7&&1)},mc=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof Fe?Fe:r instanceof bs?bs:fe)(t-e);return i.set(r.subarray(e,t)),i},dy=function(r,e,t){var i=r.length,s=!e||t,n=!t||t.i;t||(t={}),e||(e=new fe(i*3));var o=function(S){var R=e.length;if(S>R){var $=new fe(Math.max(R*2,S));$.set(e),e=$}},a=t.f||0,l=t.p||0,c=t.b||0,u=t.l,h=t.d,f=t.m,d=t.n,g=i*8;do{if(!u){t.f=a=me(r,l,1);var w=me(r,l+1,3);if(l+=3,w)if(w==1)u=uy,h=hy,f=9,d=5;else if(w==2){var v=me(r,l,31)+257,x=me(r,l+10,15)+4,k=v+me(r,l+5,31)+1;l+=14;for(var N=new fe(k),F=new fe(19),D=0;D<x;++D)F[oy[D]]=me(r,l+D*3,7);l+=x*3;var J=Mi(F),W=(1<<J)-1;if(!n&&l+k*(J+7)>g)break;for(var de=Ct(F,J),D=0;D<k;){var ce=de[me(r,l,W)];l+=ce&15;var p=ce>>>4;if(p<16)N[D++]=p;else{var ee=0,B=0;for(p==16?(B=3+me(r,l,3),l+=2,ee=N[D-1]):p==17?(B=3+me(r,l,7),l+=3):p==18&&(B=11+me(r,l,127),l+=7);B--;)N[D++]=ee}}var ae=N.subarray(0,v),L=N.subarray(v);f=Mi(ae),d=Mi(L),u=Ct(ae,f),h=Ct(L,d)}else throw"invalid block type";else{var p=fy(l)+4,y=r[p-4]|r[p-3]<<8,b=p+y;if(b>i){if(n)throw"unexpected EOF";break}s&&o(c+y),e.set(r.subarray(p,b),c),t.b=c+=y,t.p=l=b*8;continue}if(l>g)throw"unexpected EOF"}s&&o(c+131072);for(var V=(1<<f)-1,le=(1<<d)-1,ne=f+d+18;n||l+ne<g;){var ee=u[Ni(r,l)&V],re=ee>>>4;if(l+=ee&15,l>g)throw"unexpected EOF";if(!ee)throw"invalid length/literal";if(re<256)e[c++]=re;else if(re==256){u=null;break}else{var q=re-254;if(re>264){var D=re-257,pe=lc[D];q=me(r,l,(1<<pe)-1)+fc[D],l+=pe}var be=h[Ni(r,l)&le],A=be>>>4;if(!be)throw"invalid distance";l+=be&15;var L=cy[A];if(A>3){var pe=cc[A];L+=Ni(r,l)&(1<<pe)-1,l+=pe}if(l>g)throw"unexpected EOF";s&&o(c+131072);for(var C=c+q;c<C;c+=4)e[c]=e[c-L],e[c+1]=e[c+1-L],e[c+2]=e[c+2-L],e[c+3]=e[c+3-L];c=C}}t.l=u,t.p=l,t.b=c,u&&(a=1,t.m=f,t.d=h,t.n=d)}while(!a);return c==e.length?e:mc(e,0,c)},py=function(r){if((r[0]&15)!=8||r[0]>>>4>7||(r[0]<<8|r[1])%31)throw"invalid zlib data";if(r[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function my(r,e){return dy((py(r),r.subarray(2,-4)),e)}function gy(r,e){for(var t=r.length,i=new fe(r.length+(r.length>>>1)),s=0,n=function(c){i[s++]=c},o=0;o<t;++o){if(s+5>i.length){var a=new fe(s+8+(t-o<<1));a.set(i),i=a}var l=r.charCodeAt(o);n(l)}return mc(i,0,s)}function yy(r,e){var t="";if(typeof TextDecoder<"u")return new TextDecoder().decode(r);for(var i=0;i<r.length;){var s=r[i++];s<128||e?t+=String.fromCharCode(s):s<224?t+=String.fromCharCode((s&31)<<6|r[i++]&63):s<240?t+=String.fromCharCode((s&15)<<12|(r[i++]&63)<<6|r[i++]&63):(s=((s&15)<<18|(r[i++]&63)<<12|(r[i++]&63)<<6|r[i++]&63)-65536,t+=String.fromCharCode(55296|s>>10,56320|s&1023))}return t}const No="v1",wy=r=>{if(typeof r!="string")return r;try{const e=JSON.parse(r);if(e.timestamp)return e}catch{}try{const e=JSON.parse(yy(my(gy(r,!0))));if(e.v===No)return e;throw new Error(`These events were packed with packer ${e.v} which is incompatible with current packer ${No}.`)}catch(e){throw console.error(e),new Error("Unknown data format.")}};var on=(r=>(r[r.DomContentLoaded=0]="DomContentLoaded",r[r.Load=1]="Load",r[r.FullSnapshot=2]="FullSnapshot",r[r.IncrementalSnapshot=3]="IncrementalSnapshot",r[r.Meta=4]="Meta",r[r.Custom=5]="Custom",r[r.Plugin=6]="Plugin",r))(on||{}),vs=(r=>(r[r.Mutation=0]="Mutation",r[r.MouseMove=1]="MouseMove",r[r.MouseInteraction=2]="MouseInteraction",r[r.Scroll=3]="Scroll",r[r.ViewportResize=4]="ViewportResize",r[r.Input=5]="Input",r[r.TouchMove=6]="TouchMove",r[r.MediaInteraction=7]="MediaInteraction",r[r.StyleSheetRule=8]="StyleSheetRule",r[r.CanvasMutation=9]="CanvasMutation",r[r.Font=10]="Font",r[r.Log=11]="Log",r[r.Drag=12]="Drag",r[r.StyleDeclaration=13]="StyleDeclaration",r[r.Selection=14]="Selection",r[r.AdoptedStyleSheet=15]="AdoptedStyleSheet",r[r.CustomElement=16]="CustomElement",r))(vs||{});function _o(r){let e="";return Object.keys(r).forEach(t=>{e+=`${t}: ${r[t]};`}),e}function gt(r,e=2){let t=String(r);const i=Math.pow(10,e-1);if(r<i)for(;String(i).length>t.length;)t=`0${r}`;return t}const gc=1e3,Ss=60*gc,Io=60*Ss;function wr(r){if(r<=0)return"00:00";const e=Math.floor(r/Io);r=r%Io;const t=Math.floor(r/Ss);r=r%Ss;const i=Math.floor(r/gc);return e?`${gt(e)}:${gt(t)}:${gt(i)}`:`${gt(t)}:${gt(i)}`}function by(r){return r.requestFullscreen?r.requestFullscreen():r.mozRequestFullScreen?r.mozRequestFullScreen():r.webkitRequestFullscreen?r.webkitRequestFullscreen():r.msRequestFullscreen?r.msRequestFullscreen():Promise.resolve()}function vy(){return document.exitFullscreen?document.exitFullscreen():document.mozExitFullscreen?document.mozExitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen?document.msExitFullscreen():Promise.resolve()}function Do(){let r=!1;return["fullscreen","webkitIsFullScreen","mozFullScreen","msFullscreenElement"].forEach(e=>{e in document&&(r=r||!!document[e])}),r}function Sy(r){return document.addEventListener("fullscreenchange",r),document.addEventListener("webkitfullscreenchange",r),document.addEventListener("mozfullscreenchange",r),document.addEventListener("MSFullscreenChange",r),()=>{document.removeEventListener("fullscreenchange",r),document.removeEventListener("webkitfullscreenchange",r),document.removeEventListener("mozfullscreenchange",r),document.removeEventListener("MSFullscreenChange",r)}}function To(r){return{"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regExp","[object Undefined]":"undefined","[object Null]":"null","[object Object]":"object"}[Object.prototype.toString.call(r)]}function Cy(r){return r.type!==on.IncrementalSnapshot?!1:r.data.source>vs.Mutation&&r.data.source<=vs.Input}function xy(r,e){const t=[];let i=r[0].timestamp;for(const s of r)Cy(s)&&(s.timestamp-i>e&&t.push([i,s.timestamp]),i=s.timestamp);return t}function Ey(r){let e,t,i,s,n,o,a,l,c;return{c(){e=se("div"),t=se("input"),i=he(),s=se("label"),n=he(),o=se("span"),a=Be(r[3]),I(t,"type","checkbox"),I(t,"id",r[2]),t.disabled=r[1],I(t,"class","svelte-a6h7w7"),I(s,"for",r[2]),I(s,"class","svelte-a6h7w7"),I(o,"class","label svelte-a6h7w7"),I(e,"class","switch svelte-a6h7w7"),rt(e,"disabled",r[1])},m(u,h){_e(u,e,h),P(e,t),t.checked=r[0],P(e,i),P(e,s),P(e,n),P(e,o),P(o,a),l||(c=Je(t,"change",r[4]),l=!0)},p(u,[h]){h&4&&I(t,"id",u[2]),h&2&&(t.disabled=u[1]),h&1&&(t.checked=u[0]),h&4&&I(s,"for",u[2]),h&8&&Tr(a,u[3]),h&2&&rt(e,"disabled",u[1])},i:kt,o:kt,d(u){u&&Ae(e),l=!1,c()}}}function Ay(r,e,t){let{disabled:i}=e,{checked:s}=e,{id:n}=e,{label:o}=e;function a(){s=this.checked,t(0,s)}return r.$$set=l=>{"disabled"in l&&t(1,i=l.disabled),"checked"in l&&t(0,s=l.checked),"id"in l&&t(2,n=l.id),"label"in l&&t(3,o=l.label)},[s,i,n,o,a]}class Ry extends Os{constructor(e){super(),Ts(this,e,Ay,Ey,_s,{disabled:1,checked:0,id:2,label:3})}}function Oo(r,e,t){const i=r.slice();return i[38]=e[t],i}function Po(r,e,t){const i=r.slice();return i[41]=e[t],i}function Lo(r,e,t){const i=r.slice();return i[44]=e[t],i}function $o(r){let e,t,i,s=wr(r[6])+"",n,o,a,l,c,u,h,f,d,g,w=wr(r[8].totalTime)+"",p,y,b,v,x,k,N,F,D,J,W,de,ce,ee=Ge(r[13]),B=[];for(let A=0;A<ee.length;A+=1)B[A]=jo(Lo(r,ee,A));let ae=Ge(r[9]),L=[];for(let A=0;A<ae.length;A+=1)L[A]=Fo(Po(r,ae,A));function V(A,C){return A[7]==="playing"?My:ky}let le=V(r),ne=le(r),re=Ge(r[3]),q=[];for(let A=0;A<re.length;A+=1)q[A]=Bo(Oo(r,re,A));function pe(A){r[29](A)}let be={id:"skip",disabled:r[10]==="skipping",label:"skip inactive"};return r[0]!==void 0&&(be.checked=r[0]),N=new Ry({props:be}),je.push(()=>Uh(N,"checked",pe)),{c(){e=se("div"),t=se("div"),i=se("span"),n=Be(s),o=he(),a=se("div"),l=se("div"),c=he();for(let A=0;A<B.length;A+=1)B[A].c();u=he();for(let A=0;A<L.length;A+=1)L[A].c();h=he(),f=se("div"),d=he(),g=se("span"),p=Be(w),y=he(),b=se("div"),v=se("button"),ne.c(),x=he();for(let A=0;A<q.length;A+=1)q[A].c();k=he(),Sa(N.$$.fragment),D=he(),J=se("button"),J.innerHTML=`<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><defs><style type="text/css"></style></defs><path d="M916 380c-26.4 0-48-21.6-48-48L868 223.2 613.6 477.6c-18.4
89
89
  18.4-48.8 18.4-68 0-18.4-18.4-18.4-48.8 0-68L800 156 692 156c-26.4
90
90
  0-48-21.6-48-48 0-26.4 21.6-48 48-48l224 0c26.4 0 48 21.6 48 48l0
91
91
  224C964 358.4 942.4 380 916 380zM231.2 860l108.8 0c26.4 0 48 21.6 48
92
92
  48s-21.6 48-48 48l-224 0c-26.4 0-48-21.6-48-48l0-224c0-26.4 21.6-48
93
93
  48-48 26.4 0 48 21.6 48 48L164 792l253.6-253.6c18.4-18.4 48.8-18.4
94
- 68 0 18.4 18.4 18.4 48.8 0 68L231.2 860z"></path></svg>`,I(i,"class","rr-timeline__time svelte-189zk2r"),I(l,"class","rr-progress__step svelte-189zk2r"),te(l,"width",r[12]),I(f,"class","rr-progress__handler svelte-189zk2r"),te(f,"left",r[12]),I(a,"class","rr-progress svelte-189zk2r"),rt(a,"disabled",r[10]==="skipping"),I(m,"class","rr-timeline__time svelte-189zk2r"),I(t,"class","rr-timeline svelte-189zk2r"),I(v,"class","svelte-189zk2r"),I(J,"class","svelte-189zk2r"),I(b,"class","rr-controller__btns svelte-189zk2r"),I(e,"class","rr-controller svelte-189zk2r")},m(A,C){_e(A,e,C),P(e,t),P(t,i),P(i,n),P(t,o),P(t,a),P(a,l),P(a,c);for(let S=0;S<B.length;S+=1)B[S]&&B[S].m(a,null);P(a,u);for(let S=0;S<L.length;S+=1)L[S]&&L[S].m(a,null);P(a,h),P(a,f),r[27](a),P(t,d),P(t,m),P(m,p),P(e,y),P(e,b),P(b,v),ne.m(v,null),P(b,x);for(let S=0;S<q.length;S+=1)q[S]&&q[S].m(b,null);P(b,M),Is(N,b,null),P(b,D),P(b,J),W=!0,de||(ce=[Je(a,"click",r[15]),Je(a,"keydown",r[16]),Je(v,"click",r[4]),Je(J,"click",r[30])],de=!0)},p(A,C){if((!W||C[0]&64)&&s!==(s=wr(A[6])+"")&&Tr(n,s),(!W||C[0]&4096)&&te(l,"width",A[12]),C[0]&8192){ee=Ge(A[13]);let R;for(R=0;R<ee.length;R+=1){const $=Lo(A,ee,R);B[R]?B[R].p($,C):(B[R]=Fo($),B[R].c(),B[R].m(a,u))}for(;R<B.length;R+=1)B[R].d(1);B.length=ee.length}if(C[0]&512){oe=Ge(A[9]);let R;for(R=0;R<oe.length;R+=1){const $=Po(A,oe,R);L[R]?L[R].p($,C):(L[R]=jo($),L[R].c(),L[R].m(a,h))}for(;R<L.length;R+=1)L[R].d(1);L.length=oe.length}if((!W||C[0]&4096)&&te(f,"left",A[12]),(!W||C[0]&1024)&&rt(a,"disabled",A[10]==="skipping"),(!W||C[0]&256)&&w!==(w=wr(A[8].totalTime)+"")&&Tr(p,w),ae!==(ae=V(A))&&(ne.d(1),ne=ae(A),ne&&(ne.c(),ne.m(v,null))),C[0]&1066){re=Ge(A[3]);let R;for(R=0;R<re.length;R+=1){const $=Oo(A,re,R);q[R]?q[R].p($,C):(q[R]=Bo($),q[R].c(),q[R].m(b,M))}for(;R<q.length;R+=1)q[R].d(1);q.length=re.length}const S={};C[0]&1024&&(S.disabled=A[10]==="skipping"),!j&&C[0]&1&&(j=!0,S.checked=A[0],Fh(()=>j=!1)),N.$set(S)},i(A){W||(Me(N.$$.fragment,A),W=!0)},o(A){it(N.$$.fragment,A),W=!1},d(A){A&&Ae(e),di(B,A),di(L,A),r[27](null),ne.d(),di(q,A),Ds(N),de=!1,ut(ce)}}}function Fo(r){let e,t;return{c(){e=se("div"),I(e,"title",t=r[44].name),te(e,"width",r[44].width),te(e,"height","4px"),te(e,"position","absolute"),te(e,"background",r[44].background),te(e,"left",r[44].position)},m(i,s){_e(i,e,s)},p(i,s){s[0]&8192&&t!==(t=i[44].name)&&I(e,"title",t),s[0]&8192&&te(e,"width",i[44].width),s[0]&8192&&te(e,"background",i[44].background),s[0]&8192&&te(e,"left",i[44].position)},d(i){i&&Ae(e)}}}function jo(r){let e,t;return{c(){e=se("div"),I(e,"title",t=r[41].name),te(e,"width","10px"),te(e,"height","5px"),te(e,"position","absolute"),te(e,"top","2px"),te(e,"transform","translate(-50%, -50%)"),te(e,"background",r[41].background),te(e,"left",r[41].position)},m(i,s){_e(i,e,s)},p(i,s){s[0]&512&&t!==(t=i[41].name)&&I(e,"title",t),s[0]&512&&te(e,"background",i[41].background),s[0]&512&&te(e,"left",i[41].position)},d(i){i&&Ae(e)}}}function My(r){let e,t;return{c(){e=Dr("svg"),t=Dr("path"),I(t,"d",`M170.65984 896l0-768 640 384zM644.66944
95
- 512l-388.66944-233.32864 0 466.65728z`),I(e,"class","icon"),I(e,"viewBox","0 0 1024 1024"),I(e,"version","1.1"),I(e,"xmlns","http://www.w3.org/2000/svg"),I(e,"xmlns:xlink","http://www.w3.org/1999/xlink"),I(e,"width","16"),I(e,"height","16")},m(i,s){_e(i,e,s),P(e,t)},d(i){i&&Ae(e)}}}function ky(r){let e,t;return{c(){e=Dr("svg"),t=Dr("path"),I(t,"d",`M682.65984 128q53.00224 0 90.50112 37.49888t37.49888 90.50112l0
94
+ 68 0 18.4 18.4 18.4 48.8 0 68L231.2 860z"></path></svg>`,I(i,"class","rr-timeline__time svelte-189zk2r"),I(l,"class","rr-progress__step svelte-189zk2r"),te(l,"width",r[12]),I(f,"class","rr-progress__handler svelte-189zk2r"),te(f,"left",r[12]),I(a,"class","rr-progress svelte-189zk2r"),rt(a,"disabled",r[10]==="skipping"),I(g,"class","rr-timeline__time svelte-189zk2r"),I(t,"class","rr-timeline svelte-189zk2r"),I(v,"class","svelte-189zk2r"),I(J,"class","svelte-189zk2r"),I(b,"class","rr-controller__btns svelte-189zk2r"),I(e,"class","rr-controller svelte-189zk2r")},m(A,C){_e(A,e,C),P(e,t),P(t,i),P(i,n),P(t,o),P(t,a),P(a,l),P(a,c);for(let S=0;S<B.length;S+=1)B[S]&&B[S].m(a,null);P(a,u);for(let S=0;S<L.length;S+=1)L[S]&&L[S].m(a,null);P(a,h),P(a,f),r[27](a),P(t,d),P(t,g),P(g,p),P(e,y),P(e,b),P(b,v),ne.m(v,null),P(b,x);for(let S=0;S<q.length;S+=1)q[S]&&q[S].m(b,null);P(b,k),Is(N,b,null),P(b,D),P(b,J),W=!0,de||(ce=[Je(a,"click",r[15]),Je(a,"keydown",r[16]),Je(v,"click",r[4]),Je(J,"click",r[30])],de=!0)},p(A,C){if((!W||C[0]&64)&&s!==(s=wr(A[6])+"")&&Tr(n,s),(!W||C[0]&4096)&&te(l,"width",A[12]),C[0]&8192){ee=Ge(A[13]);let R;for(R=0;R<ee.length;R+=1){const $=Lo(A,ee,R);B[R]?B[R].p($,C):(B[R]=jo($),B[R].c(),B[R].m(a,u))}for(;R<B.length;R+=1)B[R].d(1);B.length=ee.length}if(C[0]&512){ae=Ge(A[9]);let R;for(R=0;R<ae.length;R+=1){const $=Po(A,ae,R);L[R]?L[R].p($,C):(L[R]=Fo($),L[R].c(),L[R].m(a,h))}for(;R<L.length;R+=1)L[R].d(1);L.length=ae.length}if((!W||C[0]&4096)&&te(f,"left",A[12]),(!W||C[0]&1024)&&rt(a,"disabled",A[10]==="skipping"),(!W||C[0]&256)&&w!==(w=wr(A[8].totalTime)+"")&&Tr(p,w),le!==(le=V(A))&&(ne.d(1),ne=le(A),ne&&(ne.c(),ne.m(v,null))),C[0]&1066){re=Ge(A[3]);let R;for(R=0;R<re.length;R+=1){const $=Oo(A,re,R);q[R]?q[R].p($,C):(q[R]=Bo($),q[R].c(),q[R].m(b,k))}for(;R<q.length;R+=1)q[R].d(1);q.length=re.length}const S={};C[0]&1024&&(S.disabled=A[10]==="skipping"),!F&&C[0]&1&&(F=!0,S.checked=A[0],jh(()=>F=!1)),N.$set(S)},i(A){W||(ke(N.$$.fragment,A),W=!0)},o(A){it(N.$$.fragment,A),W=!1},d(A){A&&Ae(e),di(B,A),di(L,A),r[27](null),ne.d(),di(q,A),Ds(N),de=!1,ut(ce)}}}function jo(r){let e,t;return{c(){e=se("div"),I(e,"title",t=r[44].name),te(e,"width",r[44].width),te(e,"height","4px"),te(e,"position","absolute"),te(e,"background",r[44].background),te(e,"left",r[44].position)},m(i,s){_e(i,e,s)},p(i,s){s[0]&8192&&t!==(t=i[44].name)&&I(e,"title",t),s[0]&8192&&te(e,"width",i[44].width),s[0]&8192&&te(e,"background",i[44].background),s[0]&8192&&te(e,"left",i[44].position)},d(i){i&&Ae(e)}}}function Fo(r){let e,t;return{c(){e=se("div"),I(e,"title",t=r[41].name),te(e,"width","10px"),te(e,"height","5px"),te(e,"position","absolute"),te(e,"top","2px"),te(e,"transform","translate(-50%, -50%)"),te(e,"background",r[41].background),te(e,"left",r[41].position)},m(i,s){_e(i,e,s)},p(i,s){s[0]&512&&t!==(t=i[41].name)&&I(e,"title",t),s[0]&512&&te(e,"background",i[41].background),s[0]&512&&te(e,"left",i[41].position)},d(i){i&&Ae(e)}}}function ky(r){let e,t;return{c(){e=Dr("svg"),t=Dr("path"),I(t,"d",`M170.65984 896l0-768 640 384zM644.66944
95
+ 512l-388.66944-233.32864 0 466.65728z`),I(e,"class","icon"),I(e,"viewBox","0 0 1024 1024"),I(e,"version","1.1"),I(e,"xmlns","http://www.w3.org/2000/svg"),I(e,"xmlns:xlink","http://www.w3.org/1999/xlink"),I(e,"width","16"),I(e,"height","16")},m(i,s){_e(i,e,s),P(e,t)},d(i){i&&Ae(e)}}}function My(r){let e,t;return{c(){e=Dr("svg"),t=Dr("path"),I(t,"d",`M682.65984 128q53.00224 0 90.50112 37.49888t37.49888 90.50112l0
96
96
  512q0 53.00224-37.49888 90.50112t-90.50112
97
97
  37.49888-90.50112-37.49888-37.49888-90.50112l0-512q0-53.00224
98
98
  37.49888-90.50112t90.50112-37.49888zM341.34016 128q53.00224 0
@@ -105,7 +105,7 @@ PERFORMANCE OF THIS SOFTWARE.
105
105
  12.4928-30.16704l0-512q0-17.67424-12.4928-30.16704t-30.16704-12.4928zM682.65984
106
106
  213.34016q-17.67424 0-30.16704 12.4928t-12.4928 30.16704l0 512q0
107
107
  17.67424 12.4928 30.16704t30.16704 12.4928 30.16704-12.4928
108
- 12.4928-30.16704l0-512q0-17.67424-12.4928-30.16704t-30.16704-12.4928z`),I(e,"class","icon"),I(e,"viewBox","0 0 1024 1024"),I(e,"version","1.1"),I(e,"xmlns","http://www.w3.org/2000/svg"),I(e,"xmlns:xlink","http://www.w3.org/1999/xlink"),I(e,"width","16"),I(e,"height","16")},m(i,s){_e(i,e,s),P(e,t)},d(i){i&&Ae(e)}}}function Bo(r){let e,t=r[38]+"",i,s,n,o,a;function l(){return r[28](r[38])}return{c(){e=se("button"),i=Be(t),s=Be("x"),e.disabled=n=r[10]==="skipping",I(e,"class","svelte-189zk2r"),rt(e,"active",r[38]===r[1]&&r[10]!=="skipping")},m(c,u){_e(c,e,u),P(e,i),P(e,s),o||(a=Je(e,"click",l),o=!0)},p(c,u){r=c,u[0]&8&&t!==(t=r[38]+"")&&Tr(i,t),u[0]&1024&&n!==(n=r[10]==="skipping")&&(e.disabled=n),u[0]&1034&&rt(e,"active",r[38]===r[1]&&r[10]!=="skipping")},d(c){c&&Ae(e),o=!1,a()}}}function Ny(r){let e,t,i=r[2]&&$o(r);return{c(){i&&i.c(),e=Ih()},m(s,n){i&&i.m(s,n),_e(s,e,n),t=!0},p(s,n){s[2]?i?(i.p(s,n),n[0]&4&&Me(i,1)):(i=$o(s),i.c(),Me(i,1),i.m(e.parentNode,e)):i&&(ba(),it(i,1,1,()=>{i=null}),va())},i(s){t||(Me(i),t=!0)},o(s){it(i),t=!1},d(s){s&&Ae(e),i&&i.d(s)}}}function Uo(r,e,t){const i=e-r;return(100-(e-t)/i*100).toFixed(2)}function _y(r,e,t){const i=Ph();let{replayer:s}=e,{showController:n}=e,{autoPlay:o}=e,{skipInactive:a}=e,{speedOption:l}=e,{speed:c=l.length?l[0]:1}=e,{tags:u={}}=e,{inactiveColor:h}=e,f=0,d=null,m,w,p,y,b=!1,v=null,x=null,M,N,j,D;const J=()=>{W();function C(){t(6,f=s.getCurrentTime()),b&&f>=b&&(x?oe(x.start,x.end,!0,void 0):(s.pause(),v&&(v(),v=null))),f<M.totalTime&&(d=requestAnimationFrame(C))}d=requestAnimationFrame(C)},W=()=>{d&&(cancelAnimationFrame(d),d=null)},de=()=>{switch(m){case"playing":ee();break;case"paused":ce();break}},ce=()=>{m==="paused"&&(y?(s.play(),y=!1):s.play(f))},ee=()=>{m==="playing"&&(s.pause(),b=!1)},B=(C,S)=>{t(6,f=C),b=!1,y=!1,(typeof S=="boolean"?S:m==="playing")?s.play(C):s.pause(C)},oe=(C,S,R=!1,$=void 0)=>{R?x={start:C,end:S}:x=null,t(6,f=C),b=S,v=$||null,s.play(C)},L=C=>{if(w==="skipping")return;const S=p.getBoundingClientRect();let $=(C.clientX-S.left)/S.width;$<0?$=0:$>1&&($=1);const ve=M.totalTime*$;B(ve)},V=C=>{w!=="skipping"&&(C.key==="ArrowLeft"?B(f-5):C.key==="ArrowRight"&&B(f+5))},ae=C=>{let S=m==="playing";t(1,c=C),S&&s.pause(),s.setConfig({speed:c}),S&&s.play(f)},ne=()=>{t(0,a=!a)},re=()=>Promise.resolve().then(()=>{t(8,M=s.getMetaData())});ga(()=>{t(7,m=s.service.state.value),t(10,w=s.speedService.state.value),s.on("state-change",C=>{const{player:S,speed:R}=C;if(S?.value&&m!==S.value)switch(t(7,m=S.value),m){case"playing":J();break;case"paused":W();break}R?.value&&w!==R.value&&t(10,w=R.value)}),s.on("finish",()=>{y=!0,v&&(v(),v=null)}),o&&s.play()}),Oh(()=>{a!==s.config.skipInactive&&s.setConfig({skipInactive:a})}),ya(()=>{s.pause(),W()});function q(C){Fe[C?"unshift":"push"](()=>{p=C,t(11,p)})}const pe=C=>ae(C);function be(C){a=C,t(0,a)}const A=()=>i("fullscreen");return r.$$set=C=>{"replayer"in C&&t(17,s=C.replayer),"showController"in C&&t(2,n=C.showController),"autoPlay"in C&&t(18,o=C.autoPlay),"skipInactive"in C&&t(0,a=C.skipInactive),"speedOption"in C&&t(3,l=C.speedOption),"speed"in C&&t(1,c=C.speed),"tags"in C&&t(19,u=C.tags),"inactiveColor"in C&&t(20,h=C.inactiveColor)},r.$$.update=()=>{if(r.$$.dirty[0]&64&&i("ui-update-current-time",{payload:f}),r.$$.dirty[0]&128&&i("ui-update-player-state",{payload:m}),r.$$.dirty[0]&131072&&t(8,M=s.getMetaData()),r.$$.dirty[0]&320){const C=Math.min(1,f/M.totalTime);t(12,N=`${100*C}%`),i("ui-update-progress",{payload:C})}r.$$.dirty[0]&655360&&t(9,j=(()=>{const{context:C}=s.service.state,S=C.events.length,R=C.events[0].timestamp,$=C.events[S-1].timestamp,ve=[];return C.events.forEach(Re=>{if(Re.type===on.Custom){const Pe={name:Re.data.tag,background:u[Re.data.tag]||"rgb(73, 80, 246)",position:`${Uo(R,$,Re.timestamp)}%`};ve.push(Pe)}}),ve})()),r.$$.dirty[0]&1179648&&t(13,D=(()=>{try{const{context:C}=s.service.state,S=C.events.length,R=C.events[0].timestamp,$=C.events[S-1].timestamp,ve=xy(C.events,s.config.inactivePeriodThreshold),Re=(Pe,bc,vc,Sc)=>{const Cc=bc-Pe;return((Sc-vc)/Cc*100).toFixed(2)};return ve.map(Pe=>({name:"inactive period",background:h,position:`${Uo(R,$,Pe[0])}%`,width:`${Re(R,$,Pe[0],Pe[1])}%`}))}catch{return[]}})())},[a,c,n,l,de,ae,f,m,M,j,w,p,N,D,i,L,V,s,o,u,h,ce,ee,B,oe,ne,re,q,pe,be,A]}class Iy extends Os{constructor(e){super(),Ts(this,e,_y,Ny,_s,{replayer:17,showController:2,autoPlay:18,skipInactive:0,speedOption:3,speed:1,tags:19,inactiveColor:20,toggle:4,play:21,pause:22,goto:23,playRange:24,setSpeed:5,toggleSkipInactive:25,triggerUpdateMeta:26},null,[-1,-1])}get toggle(){return this.$$.ctx[4]}get play(){return this.$$.ctx[21]}get pause(){return this.$$.ctx[22]}get goto(){return this.$$.ctx[23]}get playRange(){return this.$$.ctx[24]}get setSpeed(){return this.$$.ctx[5]}get toggleSkipInactive(){return this.$$.ctx[25]}get triggerUpdateMeta(){return this.$$.ctx[26]}}function zo(r){let e,t,i={replayer:r[7],showController:r[3],autoPlay:r[1],speedOption:r[2],skipInactive:r[0],tags:r[4],inactiveColor:r[5]};return e=new Iy({props:i}),r[32](e),e.$on("fullscreen",r[33]),{c(){Sa(e.$$.fragment)},m(s,n){Is(e,s,n),t=!0},p(s,n){const o={};n[0]&128&&(o.replayer=s[7]),n[0]&8&&(o.showController=s[3]),n[0]&2&&(o.autoPlay=s[1]),n[0]&4&&(o.speedOption=s[2]),n[0]&1&&(o.skipInactive=s[0]),n[0]&16&&(o.tags=s[4]),n[0]&32&&(o.inactiveColor=s[5]),e.$set(o)},i(s){t||(Me(e.$$.fragment,s),t=!0)},o(s){it(e.$$.fragment,s),t=!1},d(s){r[32](null),Ds(e,s)}}}function Dy(r){let e,t,i,s,n=r[7]&&zo(r);return{c(){e=se("div"),t=se("div"),i=he(),n&&n.c(),I(t,"class","rr-player__frame"),I(t,"style",r[11]),I(e,"class","rr-player"),I(e,"style",r[12])},m(o,a){_e(o,e,a),P(e,t),r[31](t),P(e,i),n&&n.m(e,null),r[34](e),s=!0},p(o,a){(!s||a[0]&2048)&&I(t,"style",o[11]),o[7]?n?(n.p(o,a),a[0]&128&&Me(n,1)):(n=zo(o),n.c(),Me(n,1),n.m(e,null)):n&&(ba(),it(n,1,1,()=>{n=null}),va()),(!s||a[0]&4096)&&I(e,"style",o[12])},i(o){s||(Me(n),s=!0)},o(o){it(n),s=!1},d(o){o&&Ae(e),r[31](null),n&&n.d(),r[34](null)}}}const Wo=80;function Ty(r,e,t){let{width:i=1024}=e,{height:s=576}=e,{maxScale:n=1}=e,{events:o}=e,{skipInactive:a=!0}=e,{autoPlay:l=!0}=e,{speedOption:c=[1,2,4,8]}=e,{speed:u=1}=e,{showController:h=!0}=e,{tags:f={}}=e,{inactiveColor:d="#D4D4D4"}=e,m;const w=()=>m.getMirror();let p,y,b,v=i,x=s,M,N,j;const D=(S,R)=>{const $=i/R.width,ve=s/R.height,Re=[$,ve];n&&Re.push(n),S.style.transform=`scale(${Math.min(...Re)})translate(-50%, -50%)`},J=()=>{D(m.wrapper,{width:m.iframe.offsetWidth,height:m.iframe.offsetHeight})},W=()=>{p&&(Do()?vy():by(p))},de=(S,R)=>{switch(m.on(S,R),S){case"ui-update-current-time":case"ui-update-progress":case"ui-update-player-state":M.$on(S,({detail:$})=>R($))}},ce=S=>{m.addEvent(S),M.triggerUpdateMeta()},ee=()=>m.getMetaData(),B=()=>m,oe=()=>{M.toggle()},L=S=>{M.setSpeed(S)},V=()=>{M.toggleSkipInactive()},ae=()=>{M.play()},ne=()=>{M.pause()},re=(S,R)=>{M.goto(S,R)},q=(S,R,$=!1,ve=void 0)=>{M.playRange(S,R,$,ve)};ga(()=>{if(c!==void 0&&To(c)!=="array")throw new Error("speedOption must be array");if(c.forEach(S=>{if(To(S)!=="number")throw new Error("item of speedOption must be number")}),c.indexOf(u)<0)throw new Error(`speed must be one of speedOption,
108
+ 12.4928-30.16704l0-512q0-17.67424-12.4928-30.16704t-30.16704-12.4928z`),I(e,"class","icon"),I(e,"viewBox","0 0 1024 1024"),I(e,"version","1.1"),I(e,"xmlns","http://www.w3.org/2000/svg"),I(e,"xmlns:xlink","http://www.w3.org/1999/xlink"),I(e,"width","16"),I(e,"height","16")},m(i,s){_e(i,e,s),P(e,t)},d(i){i&&Ae(e)}}}function Bo(r){let e,t=r[38]+"",i,s,n,o,a;function l(){return r[28](r[38])}return{c(){e=se("button"),i=Be(t),s=Be("x"),e.disabled=n=r[10]==="skipping",I(e,"class","svelte-189zk2r"),rt(e,"active",r[38]===r[1]&&r[10]!=="skipping")},m(c,u){_e(c,e,u),P(e,i),P(e,s),o||(a=Je(e,"click",l),o=!0)},p(c,u){r=c,u[0]&8&&t!==(t=r[38]+"")&&Tr(i,t),u[0]&1024&&n!==(n=r[10]==="skipping")&&(e.disabled=n),u[0]&1034&&rt(e,"active",r[38]===r[1]&&r[10]!=="skipping")},d(c){c&&Ae(e),o=!1,a()}}}function Ny(r){let e,t,i=r[2]&&$o(r);return{c(){i&&i.c(),e=Ih()},m(s,n){i&&i.m(s,n),_e(s,e,n),t=!0},p(s,n){s[2]?i?(i.p(s,n),n[0]&4&&ke(i,1)):(i=$o(s),i.c(),ke(i,1),i.m(e.parentNode,e)):i&&(ba(),it(i,1,1,()=>{i=null}),va())},i(s){t||(ke(i),t=!0)},o(s){it(i),t=!1},d(s){s&&Ae(e),i&&i.d(s)}}}function Uo(r,e,t){const i=e-r;return(100-(e-t)/i*100).toFixed(2)}function _y(r,e,t){const i=Ph();let{replayer:s}=e,{showController:n}=e,{autoPlay:o}=e,{skipInactive:a}=e,{speedOption:l}=e,{speed:c=l.length?l[0]:1}=e,{tags:u={}}=e,{inactiveColor:h}=e,f=0,d=null,g,w,p,y,b=!1,v=null,x=null,k,N,F,D;const J=()=>{W();function C(){t(6,f=s.getCurrentTime()),b&&f>=b&&(x?ae(x.start,x.end,!0,void 0):(s.pause(),v&&(v(),v=null))),f<k.totalTime&&(d=requestAnimationFrame(C))}d=requestAnimationFrame(C)},W=()=>{d&&(cancelAnimationFrame(d),d=null)},de=()=>{switch(g){case"playing":ee();break;case"paused":ce();break}},ce=()=>{g==="paused"&&(y?(s.play(),y=!1):s.play(f))},ee=()=>{g==="playing"&&(s.pause(),b=!1)},B=(C,S)=>{t(6,f=C),b=!1,y=!1,(typeof S=="boolean"?S:g==="playing")?s.play(C):s.pause(C)},ae=(C,S,R=!1,$=void 0)=>{R?x={start:C,end:S}:x=null,t(6,f=C),b=S,v=$||null,s.play(C)},L=C=>{if(w==="skipping")return;const S=p.getBoundingClientRect();let $=(C.clientX-S.left)/S.width;$<0?$=0:$>1&&($=1);const ve=k.totalTime*$;B(ve)},V=C=>{w!=="skipping"&&(C.key==="ArrowLeft"?B(f-5):C.key==="ArrowRight"&&B(f+5))},le=C=>{let S=g==="playing";t(1,c=C),S&&s.pause(),s.setConfig({speed:c}),S&&s.play(f)},ne=()=>{t(0,a=!a)},re=()=>Promise.resolve().then(()=>{t(8,k=s.getMetaData())});ga(()=>{t(7,g=s.service.state.value),t(10,w=s.speedService.state.value),s.on("state-change",C=>{const{player:S,speed:R}=C;if(S?.value&&g!==S.value)switch(t(7,g=S.value),g){case"playing":J();break;case"paused":W();break}R?.value&&w!==R.value&&t(10,w=R.value)}),s.on("finish",()=>{y=!0,v&&(v(),v=null)}),o&&s.play()}),Oh(()=>{a!==s.config.skipInactive&&s.setConfig({skipInactive:a})}),ya(()=>{s.pause(),W()});function q(C){je[C?"unshift":"push"](()=>{p=C,t(11,p)})}const pe=C=>le(C);function be(C){a=C,t(0,a)}const A=()=>i("fullscreen");return r.$$set=C=>{"replayer"in C&&t(17,s=C.replayer),"showController"in C&&t(2,n=C.showController),"autoPlay"in C&&t(18,o=C.autoPlay),"skipInactive"in C&&t(0,a=C.skipInactive),"speedOption"in C&&t(3,l=C.speedOption),"speed"in C&&t(1,c=C.speed),"tags"in C&&t(19,u=C.tags),"inactiveColor"in C&&t(20,h=C.inactiveColor)},r.$$.update=()=>{if(r.$$.dirty[0]&64&&i("ui-update-current-time",{payload:f}),r.$$.dirty[0]&128&&i("ui-update-player-state",{payload:g}),r.$$.dirty[0]&131072&&t(8,k=s.getMetaData()),r.$$.dirty[0]&320){const C=Math.min(1,f/k.totalTime);t(12,N=`${100*C}%`),i("ui-update-progress",{payload:C})}r.$$.dirty[0]&655360&&t(9,F=(()=>{const{context:C}=s.service.state,S=C.events.length,R=C.events[0].timestamp,$=C.events[S-1].timestamp,ve=[];return C.events.forEach(Re=>{if(Re.type===on.Custom){const Pe={name:Re.data.tag,background:u[Re.data.tag]||"rgb(73, 80, 246)",position:`${Uo(R,$,Re.timestamp)}%`};ve.push(Pe)}}),ve})()),r.$$.dirty[0]&1179648&&t(13,D=(()=>{try{const{context:C}=s.service.state,S=C.events.length,R=C.events[0].timestamp,$=C.events[S-1].timestamp,ve=xy(C.events,s.config.inactivePeriodThreshold),Re=(Pe,bc,vc,Sc)=>{const Cc=bc-Pe;return((Sc-vc)/Cc*100).toFixed(2)};return ve.map(Pe=>({name:"inactive period",background:h,position:`${Uo(R,$,Pe[0])}%`,width:`${Re(R,$,Pe[0],Pe[1])}%`}))}catch{return[]}})())},[a,c,n,l,de,le,f,g,k,F,w,p,N,D,i,L,V,s,o,u,h,ce,ee,B,ae,ne,re,q,pe,be,A]}class Iy extends Os{constructor(e){super(),Ts(this,e,_y,Ny,_s,{replayer:17,showController:2,autoPlay:18,skipInactive:0,speedOption:3,speed:1,tags:19,inactiveColor:20,toggle:4,play:21,pause:22,goto:23,playRange:24,setSpeed:5,toggleSkipInactive:25,triggerUpdateMeta:26},null,[-1,-1])}get toggle(){return this.$$.ctx[4]}get play(){return this.$$.ctx[21]}get pause(){return this.$$.ctx[22]}get goto(){return this.$$.ctx[23]}get playRange(){return this.$$.ctx[24]}get setSpeed(){return this.$$.ctx[5]}get toggleSkipInactive(){return this.$$.ctx[25]}get triggerUpdateMeta(){return this.$$.ctx[26]}}function zo(r){let e,t,i={replayer:r[7],showController:r[3],autoPlay:r[1],speedOption:r[2],skipInactive:r[0],tags:r[4],inactiveColor:r[5]};return e=new Iy({props:i}),r[32](e),e.$on("fullscreen",r[33]),{c(){Sa(e.$$.fragment)},m(s,n){Is(e,s,n),t=!0},p(s,n){const o={};n[0]&128&&(o.replayer=s[7]),n[0]&8&&(o.showController=s[3]),n[0]&2&&(o.autoPlay=s[1]),n[0]&4&&(o.speedOption=s[2]),n[0]&1&&(o.skipInactive=s[0]),n[0]&16&&(o.tags=s[4]),n[0]&32&&(o.inactiveColor=s[5]),e.$set(o)},i(s){t||(ke(e.$$.fragment,s),t=!0)},o(s){it(e.$$.fragment,s),t=!1},d(s){r[32](null),Ds(e,s)}}}function Dy(r){let e,t,i,s,n=r[7]&&zo(r);return{c(){e=se("div"),t=se("div"),i=he(),n&&n.c(),I(t,"class","rr-player__frame"),I(t,"style",r[11]),I(e,"class","rr-player"),I(e,"style",r[12])},m(o,a){_e(o,e,a),P(e,t),r[31](t),P(e,i),n&&n.m(e,null),r[34](e),s=!0},p(o,a){(!s||a[0]&2048)&&I(t,"style",o[11]),o[7]?n?(n.p(o,a),a[0]&128&&ke(n,1)):(n=zo(o),n.c(),ke(n,1),n.m(e,null)):n&&(ba(),it(n,1,1,()=>{n=null}),va()),(!s||a[0]&4096)&&I(e,"style",o[12])},i(o){s||(ke(n),s=!0)},o(o){it(n),s=!1},d(o){o&&Ae(e),r[31](null),n&&n.d(),r[34](null)}}}const Wo=80;function Ty(r,e,t){let{width:i=1024}=e,{height:s=576}=e,{maxScale:n=1}=e,{events:o}=e,{skipInactive:a=!0}=e,{autoPlay:l=!0}=e,{speedOption:c=[1,2,4,8]}=e,{speed:u=1}=e,{showController:h=!0}=e,{tags:f={}}=e,{inactiveColor:d="#D4D4D4"}=e,g;const w=()=>g.getMirror();let p,y,b,v=i,x=s,k,N,F;const D=(S,R)=>{const $=i/R.width,ve=s/R.height,Re=[$,ve];n&&Re.push(n),S.style.transform=`scale(${Math.min(...Re)})translate(-50%, -50%)`},J=()=>{D(g.wrapper,{width:g.iframe.offsetWidth,height:g.iframe.offsetHeight})},W=()=>{p&&(Do()?vy():by(p))},de=(S,R)=>{switch(g.on(S,R),S){case"ui-update-current-time":case"ui-update-progress":case"ui-update-player-state":k.$on(S,({detail:$})=>R($))}},ce=S=>{g.addEvent(S),k.triggerUpdateMeta()},ee=()=>g.getMetaData(),B=()=>g,ae=()=>{k.toggle()},L=S=>{k.setSpeed(S)},V=()=>{k.toggleSkipInactive()},le=()=>{k.play()},ne=()=>{k.pause()},re=(S,R)=>{k.goto(S,R)},q=(S,R,$=!1,ve=void 0)=>{k.playRange(S,R,$,ve)};ga(()=>{if(c!==void 0&&To(c)!=="array")throw new Error("speedOption must be array");if(c.forEach(S=>{if(To(S)!=="number")throw new Error("item of speedOption must be number")}),c.indexOf(u)<0)throw new Error(`speed must be one of speedOption,
109
109
  current config:
110
110
  {
111
111
  ...
@@ -113,8 +113,8 @@ PERFORMANCE OF THIS SOFTWARE.
113
113
  speedOption: [${c.toString()}]
114
114
  ...
115
115
  }
116
- `);t(7,m=new ny(o,{speed:u,root:y,unpackFn:wy,...e})),m.on("resize",S=>{D(m.wrapper,S)}),b=Sy(()=>{Do()?setTimeout(()=>{v=i,x=s,t(13,i=p.offsetWidth),t(14,s=p.offsetHeight-(h?Wo:0)),D(m.wrapper,{width:m.iframe.offsetWidth,height:m.iframe.offsetHeight})},0):(t(13,i=v),t(14,s=x),D(m.wrapper,{width:m.iframe.offsetWidth,height:m.iframe.offsetHeight}))})}),ya(()=>{b&&b()});function pe(S){Fe[S?"unshift":"push"](()=>{y=S,t(9,y)})}function be(S){Fe[S?"unshift":"push"](()=>{M=S,t(10,M)})}const A=()=>W();function C(S){Fe[S?"unshift":"push"](()=>{p=S,t(8,p)})}return r.$$set=S=>{t(39,e=xn(xn({},e),An(S))),"width"in S&&t(13,i=S.width),"height"in S&&t(14,s=S.height),"maxScale"in S&&t(15,n=S.maxScale),"events"in S&&t(16,o=S.events),"skipInactive"in S&&t(0,a=S.skipInactive),"autoPlay"in S&&t(1,l=S.autoPlay),"speedOption"in S&&t(2,c=S.speedOption),"speed"in S&&t(17,u=S.speed),"showController"in S&&t(3,h=S.showController),"tags"in S&&t(4,f=S.tags),"inactiveColor"in S&&t(5,d=S.inactiveColor)},r.$$.update=()=>{r.$$.dirty[0]&24576&&t(11,N=_o({width:`${i}px`,height:`${s}px`})),r.$$.dirty[0]&24584&&t(12,j=_o({width:`${i}px`,height:`${s+(h?Wo:0)}px`}))},e=An(e),[a,l,c,h,f,d,W,m,p,y,M,N,j,i,s,n,o,u,w,J,de,ce,ee,B,oe,L,V,ae,ne,re,q,pe,be,A,C]}let Oy=class extends Os{constructor(e){super(),Ts(this,e,Ty,Dy,_s,{width:13,height:14,maxScale:15,events:16,skipInactive:0,autoPlay:1,speedOption:2,speed:17,showController:3,tags:4,inactiveColor:5,getMirror:18,triggerResize:19,toggleFullscreen:6,addEventListener:20,addEvent:21,getMetaData:22,getReplayer:23,toggle:24,setSpeed:25,toggleSkipInactive:26,play:27,pause:28,goto:29,playRange:30},null,[-1,-1])}get getMirror(){return this.$$.ctx[18]}get triggerResize(){return this.$$.ctx[19]}get toggleFullscreen(){return this.$$.ctx[6]}get addEventListener(){return this.$$.ctx[20]}get addEvent(){return this.$$.ctx[21]}get getMetaData(){return this.$$.ctx[22]}get getReplayer(){return this.$$.ctx[23]}get toggle(){return this.$$.ctx[24]}get setSpeed(){return this.$$.ctx[25]}get toggleSkipInactive(){return this.$$.ctx[26]}get play(){return this.$$.ctx[27]}get pause(){return this.$$.ctx[28]}get goto(){return this.$$.ctx[29]}get playRange(){return this.$$.ctx[30]}};class Py extends Oy{constructor(e){super({target:e.target,props:e.data||e.props})}}const Ly=["image/png","image/jpeg","image/webp","image/gif","application/pdf","text/plain","application/json"],$y=2*1024*1024,Cs=5;function Fy(r){const[e,t]=le.useState(""),[i,s]=le.useState([]),[n,o]=le.useState(!1),[a,l]=le.useState("console"),c=e.trim().length>0;return g.jsxs(Yy,{children:[g.jsxs("div",{style:Zy,children:[g.jsx("h2",{style:{margin:0,fontSize:18,fontWeight:700},children:"Review & send"}),g.jsx("span",{style:{fontSize:12,color:"#6b7280"},children:"You're seeing exactly what we'll upload."})]}),g.jsx(By,{hasReplay:r.hasReplay&&r.replayEvents.length>0,events:r.replayEvents,audioBlobUrl:r.audioBlobUrl,screenshotUrl:r.screenshotUrl,durationMs:r.durationMs,capturedViewport:r.capturedViewport,consoleCount:r.consoleLogs.length,networkCount:r.networkEvents.length,redactionSummary:r.redactionSummary}),g.jsxs("div",{style:{marginTop:18},children:[g.jsxs("label",{style:Yo,children:["What happened? ",g.jsx("span",{style:{color:"#ef4444"},children:"*"})]}),g.jsx("textarea",{value:e,onChange:u=>t(u.target.value),rows:4,placeholder:"Describe the bug — what you expected, what happened instead…",style:Xy})]}),g.jsxs("div",{style:{marginTop:14},children:[g.jsxs("label",{style:Yo,children:["Attachments"," ",g.jsxs("span",{style:{color:"#9ca3af",fontWeight:400},children:["(max ",Cs,", 2 MB each)"]})]}),g.jsx("input",{type:"file",multiple:!0,accept:".png,.jpg,.jpeg,.webp,.gif,.pdf,.txt,.log,.json",onChange:u=>jy(u.target.files,i,s),style:{fontSize:12}}),i.length>0&&g.jsx("ul",{style:{margin:"8px 0 0 0",paddingLeft:16,fontSize:12,color:"#4b5563"},children:i.map((u,h)=>g.jsxs("li",{children:[u.name," (",Math.round(u.size/1024)," KB)"]},h))})]}),g.jsxs("div",{style:{marginTop:18},children:[g.jsxs("button",{type:"button",onClick:()=>o(u=>!u),style:Jy,children:[g.jsx("span",{children:n?"▾":"▸"}),g.jsx("span",{style:{fontWeight:600},children:"Inspect what's being sent"}),g.jsxs("span",{style:{color:"#9ca3af",fontWeight:400},children:["· ",r.consoleLogs.length," logs · ",r.networkEvents.length," requests ·"," ",r.redactionSummary.totalMatches," redactions"]})]}),n&&g.jsxs("div",{style:Ky,children:[g.jsxs("div",{style:qy,children:[g.jsxs(br,{active:a==="console",onClick:()=>l("console"),children:["Console (",r.consoleLogs.length,")"]}),g.jsxs(br,{active:a==="network",onClick:()=>l("network"),children:["Network (",r.networkEvents.length,")"]}),g.jsxs(br,{active:a==="redactions",onClick:()=>l("redactions"),children:["Redactions (",r.redactionSummary.totalMatches,")"]}),g.jsx(br,{active:a==="metadata",onClick:()=>l("metadata"),children:"Metadata"})]}),g.jsxs("div",{style:{padding:"12px 14px",maxHeight:240,overflow:"auto"},children:[a==="console"&&g.jsx(Uy,{logs:r.consoleLogs}),a==="network"&&g.jsx(zy,{events:r.networkEvents}),a==="redactions"&&g.jsx(Wy,{summary:r.redactionSummary}),a==="metadata"&&g.jsx(Vy,{pageUrl:r.pageUrl,userAgent:r.userAgent,durationMs:r.durationMs,viewport:r.capturedViewport,hasReplay:r.hasReplay,hasAudio:!!r.audioBlobUrl,attachments:i})]})]})]}),g.jsxs("div",{style:ew,children:[g.jsxs("div",{style:{display:"flex",gap:8},children:[g.jsx(Go,{onClick:r.onCancel,children:"Cancel"}),g.jsx(Go,{onClick:r.onBackToMarkup,children:"← Back to edit"})]}),g.jsx(Hy,{color:r.color,onClick:()=>r.onSend({description:e,annotations:[],attachments:i}),disabled:!c,title:c?void 0:"Description is required",children:"Send report"})]})]})}function jy(r,e,t){if(!r)return;const i=[...e];for(const s of Array.from(r))if(Ly.includes(s.type)&&!(s.size>$y)&&(i.push(s),i.length>=Cs))break;t(i.slice(0,Cs))}function By(r){const[e,t]=le.useState(r.hasReplay?"replay":"screenshot");return g.jsxs("div",{style:{background:"#0E1117",borderRadius:10,padding:14,border:"1px solid #1f2937"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[r.hasReplay?g.jsxs("div",{style:{display:"flex",gap:4},children:[g.jsxs(Vo,{active:e==="replay",onClick:()=>t("replay"),children:["Replay · ",ln(r.durationMs),r.audioBlobUrl?" · audio":""]}),g.jsx(Vo,{active:e==="screenshot",onClick:()=>t("screenshot"),children:"Screenshot"})]}):g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[g.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:"#9ca3af"}}),g.jsx("span",{style:{color:"#e5e7eb",fontSize:12,fontWeight:600},children:"Screenshot only"})]}),g.jsxs("div",{style:{color:"#9ca3af",fontSize:11,display:"flex",gap:12},children:[g.jsxs("span",{children:[r.consoleCount," logs"]}),g.jsx("span",{children:"·"}),g.jsxs("span",{children:[r.networkCount," requests"]}),g.jsx("span",{children:"·"}),g.jsxs("span",{style:{color:"#34d399"},children:[r.redactionSummary.totalMatches," redactions"]})]})]}),e==="replay"&&r.hasReplay?g.jsx(Gy,{events:r.events,audioBlobUrl:r.audioBlobUrl,capturedViewport:r.capturedViewport}):g.jsx("div",{style:{maxHeight:"60vh",overflow:"auto",background:"#000",borderRadius:6},children:g.jsx("img",{src:r.screenshotUrl,alt:"annotated page",style:{width:"100%",display:"block"}})})]})}function Uy({logs:r}){return r.length===0?g.jsx(an,{children:"Nothing was logged during the recording."}):g.jsx("pre",{style:Qy,children:r.map(e=>`[${ln(e.timestamp)}] [${e.level}] ${e.message}`).join(`
117
- `)})}function zy({events:r}){return r.length===0?g.jsx(an,{children:"No network requests captured."}):g.jsxs("table",{style:{width:"100%",fontSize:11,borderCollapse:"collapse"},children:[g.jsx("thead",{children:g.jsxs("tr",{style:{color:"#6b7280",textAlign:"left"},children:[g.jsx("th",{style:vr,children:"method"}),g.jsx("th",{style:vr,children:"status"}),g.jsx("th",{style:vr,children:"url"}),g.jsx("th",{style:{...vr,textAlign:"right"},children:"ms"})]})}),g.jsx("tbody",{children:r.map((e,t)=>g.jsxs("tr",{style:{color:e.ok?"#1f2937":"#b91c1c",borderTop:"1px solid #f3f4f6"},children:[g.jsx("td",{style:Sr,children:e.method}),g.jsx("td",{style:Sr,children:e.status??"—"}),g.jsx("td",{style:{...Sr,fontFamily:"monospace",wordBreak:"break-all"},children:e.url}),g.jsx("td",{style:{...Sr,textAlign:"right"},children:e.durationMs!=null?Math.round(e.durationMs):"—"})]},t))})]})}function Wy({summary:r}){const e=Object.entries(r.counts).filter(([,t])=>t>0);return e.length===0?g.jsx(an,{children:"No regex matches. Form input values are still automatically masked by rrweb."}):g.jsxs("div",{children:[g.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:10},children:e.map(([t,i])=>g.jsxs("span",{style:{background:"#dcfce7",color:"#065f46",padding:"3px 9px",borderRadius:999,fontSize:11,fontWeight:600},children:[i," × ",t.replace(/_/g," ")]},t))}),g.jsxs("p",{style:{margin:0,fontSize:11,color:"#6b7280",lineHeight:1.55},children:["Pattern matches were replaced with"," ",g.jsx("code",{style:{background:"#f3f4f6",padding:"1px 4px",borderRadius:3},children:"[REDACTED:<category>]"})," ","before this preview rendered. The original values are not in the upload payload."]})]})}function Vy(r){const e=[["Page URL",r.pageUrl],["User agent",r.userAgent],["Viewport",`${r.viewport.width} × ${r.viewport.height}`],["Recording",r.hasReplay?`${ln(r.durationMs)} (replay)`:"screenshot only"],["Audio",r.hasAudio?"attached":"none"],["Attachments",r.attachments.length===0?"none":r.attachments.map(t=>`${t.name} (${Math.round(t.size/1024)} KB)`).join(", ")]];return g.jsx("table",{style:{width:"100%",fontSize:12,borderCollapse:"collapse"},children:g.jsx("tbody",{children:e.map(([t,i])=>g.jsxs("tr",{style:{borderTop:"1px solid #f3f4f6"},children:[g.jsx("td",{style:{padding:"7px 8px",color:"#6b7280",fontWeight:500,width:130,verticalAlign:"top"},children:t}),g.jsx("td",{style:{padding:"7px 8px",color:"#1f2937",fontFamily:"monospace",wordBreak:"break-all"},children:i})]},t))})})}function an({children:r}){return g.jsx("div",{style:{fontSize:12,color:"#9ca3af",fontStyle:"italic",padding:"20px 0",textAlign:"center"},children:r})}function br({active:r,onClick:e,children:t}){return g.jsx("button",{type:"button",onClick:e,style:{padding:"8px 12px",background:r?"white":"transparent",border:"none",borderBottom:r?"2px solid #ea580c":"2px solid transparent",fontSize:12,fontWeight:r?600:500,color:r?"#1f2937":"#6b7280",cursor:"pointer"},children:t})}function Vo({active:r,onClick:e,children:t}){return g.jsx("button",{type:"button",onClick:e,style:{padding:"5px 10px",background:r?"#1f2937":"transparent",border:"1px solid",borderColor:r?"#374151":"transparent",borderRadius:6,fontSize:12,fontWeight:600,color:r?"#e5e7eb":"#6b7280",cursor:"pointer",fontFamily:"inherit"},children:t})}function Gy(r){const e=le.useRef(null),t=le.useRef(null);return le.useEffect(()=>{const i=e.current;if(!i||r.events.length===0)return;i.replaceChildren();const s=Math.min(720,i.clientWidth||720),n=r.capturedViewport.height/Math.max(1,r.capturedViewport.width),o=s,a=Math.max(280,Math.min(420,Math.round(o*n))),l=new Py({target:i,props:{events:r.events,width:o,height:a,autoPlay:!1,skipInactive:!1,showController:!0}}),c=h=>{const f=h?.payload??0,d=t.current;if(d?.duration&&!Number.isNaN(d.duration)){const m=f/1e3;Math.abs(d.currentTime-m)>.15&&(d.currentTime=Math.min(m,d.duration))}},u=h=>{const f=h?.payload,d=t.current;d&&(f==="playing"?d.play().catch(()=>{}):(f==="paused"||f==="ended"||f==="live")&&d.pause())};return l.addEventListener("ui-update-current-time",c),l.addEventListener("ui-update-player-state",u),()=>{try{l.$destroy?.()}catch{}i.replaceChildren()}},[r.events,r.capturedViewport.width,r.capturedViewport.height]),g.jsxs("div",{children:[g.jsx("div",{ref:e,style:{minHeight:280,maxWidth:"100%",background:"#000",borderRadius:6,overflow:"hidden",position:"relative",margin:"0 auto"}}),r.audioBlobUrl&&g.jsx("audio",{ref:t,src:r.audioBlobUrl,preload:"auto",style:{display:"none"}})]})}function Yy({children:r}){return g.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(17, 24, 39, 0.55)",display:"flex",alignItems:"center",justifyContent:"center",padding:20,zIndex:2147483647},children:g.jsx("div",{style:{background:"white",borderRadius:14,padding:22,width:820,maxWidth:"100%",maxHeight:"92vh",overflow:"auto",fontFamily:"system-ui, -apple-system, sans-serif",color:"#111827",boxShadow:"0 20px 60px rgba(0,0,0,0.3)"},children:r})})}function Hy({color:r,onClick:e,children:t,disabled:i,title:s}){return g.jsx("button",{onClick:e,disabled:i,title:s,style:{background:i?"#cbd5e1":r,color:"white",border:"none",borderRadius:6,padding:"10px 18px",fontWeight:600,fontSize:13,cursor:i?"not-allowed":"pointer"},children:t})}function Go({onClick:r,children:e}){return g.jsx("button",{onClick:r,style:{background:"white",color:"#111827",border:"1px solid #d1d5db",borderRadius:6,padding:"10px 18px",fontWeight:500,fontSize:13,cursor:"pointer"},children:e})}const Zy={display:"flex",alignItems:"baseline",justifyContent:"space-between",marginBottom:14},Yo={display:"block",fontSize:12,fontWeight:600,marginBottom:6,color:"#374151"},Xy={width:"100%",boxSizing:"border-box",padding:10,borderRadius:6,border:"1px solid #d1d5db",fontFamily:"inherit",fontSize:13,resize:"vertical"},Jy={width:"100%",display:"flex",alignItems:"center",gap:8,background:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:8,padding:"10px 14px",fontSize:13,color:"#1f2937",cursor:"pointer",textAlign:"left"},Ky={marginTop:8,border:"1px solid #e5e7eb",borderRadius:8,background:"#fafafa",overflow:"hidden"},qy={display:"flex",gap:4,background:"#f3f4f6",borderBottom:"1px solid #e5e7eb",padding:"0 8px"},Qy={margin:0,fontFamily:"ui-monospace, monospace",fontSize:11,lineHeight:1.5,color:"#1f2937",whiteSpace:"pre-wrap",wordBreak:"break-all"},vr={padding:"6px 8px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:.5,borderBottom:"1px solid #e5e7eb"},Sr={padding:"6px 8px",verticalAlign:"top"},ew={position:"sticky",bottom:-22,marginTop:22,marginLeft:-22,marginRight:-22,marginBottom:-22,padding:"14px 22px 22px 22px",display:"flex",gap:8,justifyContent:"space-between",background:"rgba(255,255,255,0.96)",backdropFilter:"blur(6px)",borderTop:"1px solid #e5e7eb",zIndex:1};function ln(r){const e=Math.floor(r/1e3),t=Math.floor(e/60),i=e%60;return`${t}:${String(i).padStart(2,"0")}`}const tw={"bottom-right":{right:20,bottom:20},"bottom-left":{left:20,bottom:20},"top-right":{right:20,top:20},"top-left":{left:20,top:20}};function rw(r){return g.jsxs("div",{"data-bugjar-block":"true",style:{position:"fixed",zIndex:2147483e3,...tw[r.position]},children:[r.view==="idle"&&r.triggerVisible&&g.jsx(sw,{color:r.primaryColor,label:r.triggerLabel,onClick:r.onOpenActive}),r.view==="active"&&g.jsx(xh,{primaryColor:r.primaryColor,isRecording:r.isRecording,hasRecording:r.hasRecording,elapsedMs:r.elapsedMs,maxDurationSec:r.maxDurationSec,onSelectTool:r.onSelectTool,onSelectColor:r.onSelectColor,onUndo:r.onUndoMarkup,onStartRecording:()=>{r.onStartRecording()},onStopRecording:()=>{r.onStopRecording()},onToggleMicMute:r.onToggleMicMute,onDone:()=>{r.onFinalize()},onCancel:r.onCancel}),r.view==="preview"&&r.preview&&g.jsx(Fy,{color:r.primaryColor,hasReplay:r.preview.hasReplay,durationMs:r.preview.durationMs,replayEvents:r.preview.replayEvents,audioBlobUrl:r.preview.audioBlobUrl,screenshotUrl:r.preview.screenshotUrl,consoleLogs:r.preview.consoleLogs,networkEvents:r.preview.networkEvents,redactionSummary:r.preview.redactionSummary,capturedViewport:r.preview.capturedViewport,pageUrl:r.preview.pageUrl,userAgent:r.preview.userAgent,onCancel:r.onCancel,onBackToMarkup:r.onBackToMarkup,onSend:r.onSendReport}),r.view==="uploading"&&g.jsx(lw,{children:"Uploading report…"}),r.view==="success"&&g.jsx(cw,{color:r.primaryColor,url:r.preview?.reportUrl??null,onDismiss:r.onCancel}),r.view==="failed"&&g.jsx(uw,{error:r.error??"Upload failed",onDismiss:r.onCancel,onDownload:()=>{r.onDownloadFailed()}}),r.resumingToast&&g.jsx(iw,{color:r.primaryColor,remainingMs:r.resumingToast.remainingMs})]})}function iw({color:r,remainingMs:e}){const t=Math.max(1,Math.ceil(e/1e3));return g.jsxs("div",{style:{position:"fixed",left:"50%",top:24,transform:"translateX(-50%)",background:"#111827",color:"white",padding:"10px 14px",borderRadius:10,fontFamily:"system-ui, -apple-system, sans-serif",fontSize:13,boxShadow:"0 10px 30px rgba(0,0,0,0.35)",display:"flex",alignItems:"center",gap:10,zIndex:2147483002,userSelect:"none",maxWidth:"calc(100vw - 32px)"},children:[g.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:r,animation:"bugjar-pulse 1.2s infinite",flexShrink:0}}),g.jsx("style",{children:"@keyframes bugjar-pulse { 0%,100%{opacity:1} 50%{opacity:0.35} }"}),g.jsxs("span",{children:["Continuing recording — ",t,"s left"]})]})}function sw({color:r,label:e,onClick:t}){const i=nw(r,.12),s=ow(r,.33);return g.jsxs(g.Fragment,{children:[g.jsx("style",{children:`
116
+ `);t(7,g=new ny(o,{speed:u,root:y,unpackFn:wy,...e})),g.on("resize",S=>{D(g.wrapper,S)}),b=Sy(()=>{Do()?setTimeout(()=>{v=i,x=s,t(13,i=p.offsetWidth),t(14,s=p.offsetHeight-(h?Wo:0)),D(g.wrapper,{width:g.iframe.offsetWidth,height:g.iframe.offsetHeight})},0):(t(13,i=v),t(14,s=x),D(g.wrapper,{width:g.iframe.offsetWidth,height:g.iframe.offsetHeight}))})}),ya(()=>{b&&b()});function pe(S){je[S?"unshift":"push"](()=>{y=S,t(9,y)})}function be(S){je[S?"unshift":"push"](()=>{k=S,t(10,k)})}const A=()=>W();function C(S){je[S?"unshift":"push"](()=>{p=S,t(8,p)})}return r.$$set=S=>{t(39,e=xn(xn({},e),An(S))),"width"in S&&t(13,i=S.width),"height"in S&&t(14,s=S.height),"maxScale"in S&&t(15,n=S.maxScale),"events"in S&&t(16,o=S.events),"skipInactive"in S&&t(0,a=S.skipInactive),"autoPlay"in S&&t(1,l=S.autoPlay),"speedOption"in S&&t(2,c=S.speedOption),"speed"in S&&t(17,u=S.speed),"showController"in S&&t(3,h=S.showController),"tags"in S&&t(4,f=S.tags),"inactiveColor"in S&&t(5,d=S.inactiveColor)},r.$$.update=()=>{r.$$.dirty[0]&24576&&t(11,N=_o({width:`${i}px`,height:`${s}px`})),r.$$.dirty[0]&24584&&t(12,F=_o({width:`${i}px`,height:`${s+(h?Wo:0)}px`}))},e=An(e),[a,l,c,h,f,d,W,g,p,y,k,N,F,i,s,n,o,u,w,J,de,ce,ee,B,ae,L,V,le,ne,re,q,pe,be,A,C]}let Oy=class extends Os{constructor(e){super(),Ts(this,e,Ty,Dy,_s,{width:13,height:14,maxScale:15,events:16,skipInactive:0,autoPlay:1,speedOption:2,speed:17,showController:3,tags:4,inactiveColor:5,getMirror:18,triggerResize:19,toggleFullscreen:6,addEventListener:20,addEvent:21,getMetaData:22,getReplayer:23,toggle:24,setSpeed:25,toggleSkipInactive:26,play:27,pause:28,goto:29,playRange:30},null,[-1,-1])}get getMirror(){return this.$$.ctx[18]}get triggerResize(){return this.$$.ctx[19]}get toggleFullscreen(){return this.$$.ctx[6]}get addEventListener(){return this.$$.ctx[20]}get addEvent(){return this.$$.ctx[21]}get getMetaData(){return this.$$.ctx[22]}get getReplayer(){return this.$$.ctx[23]}get toggle(){return this.$$.ctx[24]}get setSpeed(){return this.$$.ctx[25]}get toggleSkipInactive(){return this.$$.ctx[26]}get play(){return this.$$.ctx[27]}get pause(){return this.$$.ctx[28]}get goto(){return this.$$.ctx[29]}get playRange(){return this.$$.ctx[30]}};class Py extends Oy{constructor(e){super({target:e.target,props:e.data||e.props})}}const Ly=["image/png","image/jpeg","image/webp","image/gif","application/pdf","text/plain","application/json"],$y=2*1024*1024,Cs=5;function jy(r){const[e,t]=oe.useState(""),[i,s]=oe.useState([]),[n,o]=oe.useState(!1),[a,l]=oe.useState("console"),c=e.trim().length>0;return m.jsxs(Yy,{children:[m.jsxs("div",{style:Zy,children:[m.jsx("h2",{style:{margin:0,fontSize:18,fontWeight:700},children:"Review & send"}),m.jsx("span",{style:{fontSize:12,color:"#6b7280"},children:"You're seeing exactly what we'll upload."})]}),m.jsx(By,{hasReplay:r.hasReplay&&r.replayEvents.length>0,events:r.replayEvents,audioBlobUrl:r.audioBlobUrl,screenshotUrl:r.screenshotUrl,durationMs:r.durationMs,capturedViewport:r.capturedViewport,consoleCount:r.consoleLogs.length,networkCount:r.networkEvents.length,redactionSummary:r.redactionSummary}),m.jsxs("div",{style:{marginTop:18},children:[m.jsxs("label",{style:Yo,children:["What happened? ",m.jsx("span",{style:{color:"#ef4444"},children:"*"})]}),m.jsx("textarea",{value:e,onChange:u=>t(u.target.value),rows:4,placeholder:"Describe the bug — what you expected, what happened instead…",style:Xy})]}),m.jsxs("div",{style:{marginTop:14},children:[m.jsxs("label",{style:Yo,children:["Attachments"," ",m.jsxs("span",{style:{color:"#9ca3af",fontWeight:400},children:["(max ",Cs,", 2 MB each)"]})]}),m.jsx("input",{type:"file",multiple:!0,accept:".png,.jpg,.jpeg,.webp,.gif,.pdf,.txt,.log,.json",onChange:u=>Fy(u.target.files,i,s),style:{fontSize:12}}),i.length>0&&m.jsx("ul",{style:{margin:"8px 0 0 0",paddingLeft:16,fontSize:12,color:"#4b5563"},children:i.map((u,h)=>m.jsxs("li",{children:[u.name," (",Math.round(u.size/1024)," KB)"]},h))})]}),m.jsxs("div",{style:{marginTop:18},children:[m.jsxs("button",{type:"button",onClick:()=>o(u=>!u),style:Jy,children:[m.jsx("span",{children:n?"▾":"▸"}),m.jsx("span",{style:{fontWeight:600},children:"Inspect what's being sent"}),m.jsxs("span",{style:{color:"#9ca3af",fontWeight:400},children:["· ",r.consoleLogs.length," logs · ",r.networkEvents.length," requests ·"," ",r.redactionSummary.totalMatches," redactions"]})]}),n&&m.jsxs("div",{style:Ky,children:[m.jsxs("div",{style:qy,children:[m.jsxs(br,{active:a==="console",onClick:()=>l("console"),children:["Console (",r.consoleLogs.length,")"]}),m.jsxs(br,{active:a==="network",onClick:()=>l("network"),children:["Network (",r.networkEvents.length,")"]}),m.jsxs(br,{active:a==="redactions",onClick:()=>l("redactions"),children:["Redactions (",r.redactionSummary.totalMatches,")"]}),m.jsx(br,{active:a==="metadata",onClick:()=>l("metadata"),children:"Metadata"})]}),m.jsxs("div",{style:{padding:"12px 14px",maxHeight:240,overflow:"auto"},children:[a==="console"&&m.jsx(Uy,{logs:r.consoleLogs}),a==="network"&&m.jsx(zy,{events:r.networkEvents}),a==="redactions"&&m.jsx(Wy,{summary:r.redactionSummary}),a==="metadata"&&m.jsx(Vy,{pageUrl:r.pageUrl,userAgent:r.userAgent,durationMs:r.durationMs,viewport:r.capturedViewport,hasReplay:r.hasReplay,hasAudio:!!r.audioBlobUrl,attachments:i})]})]})]}),m.jsxs("div",{style:ew,children:[m.jsxs("div",{style:{display:"flex",gap:8},children:[m.jsx(Go,{onClick:r.onCancel,children:"Cancel"}),m.jsx(Go,{onClick:r.onBackToMarkup,children:"← Back to edit"})]}),m.jsx(Hy,{color:r.color,onClick:()=>r.onSend({description:e,annotations:[],attachments:i}),disabled:!c,title:c?void 0:"Description is required",children:"Send report"})]})]})}function Fy(r,e,t){if(!r)return;const i=[...e];for(const s of Array.from(r))if(Ly.includes(s.type)&&!(s.size>$y)&&(i.push(s),i.length>=Cs))break;t(i.slice(0,Cs))}function By(r){const[e,t]=oe.useState(r.hasReplay?"replay":"screenshot");return m.jsxs("div",{style:{background:"#0E1117",borderRadius:10,padding:14,border:"1px solid #1f2937"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[r.hasReplay?m.jsxs("div",{style:{display:"flex",gap:4},children:[m.jsxs(Vo,{active:e==="replay",onClick:()=>t("replay"),children:["Replay · ",ln(r.durationMs),r.audioBlobUrl?" · audio":""]}),m.jsx(Vo,{active:e==="screenshot",onClick:()=>t("screenshot"),children:"Screenshot"})]}):m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[m.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:"#9ca3af"}}),m.jsx("span",{style:{color:"#e5e7eb",fontSize:12,fontWeight:600},children:"Screenshot only"})]}),m.jsxs("div",{style:{color:"#9ca3af",fontSize:11,display:"flex",gap:12},children:[m.jsxs("span",{children:[r.consoleCount," logs"]}),m.jsx("span",{children:"·"}),m.jsxs("span",{children:[r.networkCount," requests"]}),m.jsx("span",{children:"·"}),m.jsxs("span",{style:{color:"#34d399"},children:[r.redactionSummary.totalMatches," redactions"]})]})]}),e==="replay"&&r.hasReplay?m.jsx(Gy,{events:r.events,audioBlobUrl:r.audioBlobUrl,capturedViewport:r.capturedViewport}):m.jsx("div",{style:{maxHeight:"60vh",overflow:"auto",background:"#000",borderRadius:6},children:m.jsx("img",{src:r.screenshotUrl,alt:"annotated page",style:{width:"100%",display:"block"}})})]})}function Uy({logs:r}){return r.length===0?m.jsx(an,{children:"Nothing was logged during the recording."}):m.jsx("pre",{style:Qy,children:r.map(e=>`[${ln(e.timestamp)}] [${e.level}] ${e.message}`).join(`
117
+ `)})}function zy({events:r}){return r.length===0?m.jsx(an,{children:"No network requests captured."}):m.jsxs("table",{style:{width:"100%",fontSize:11,borderCollapse:"collapse"},children:[m.jsx("thead",{children:m.jsxs("tr",{style:{color:"#6b7280",textAlign:"left"},children:[m.jsx("th",{style:vr,children:"method"}),m.jsx("th",{style:vr,children:"status"}),m.jsx("th",{style:vr,children:"url"}),m.jsx("th",{style:{...vr,textAlign:"right"},children:"ms"})]})}),m.jsx("tbody",{children:r.map((e,t)=>m.jsxs("tr",{style:{color:e.ok?"#1f2937":"#b91c1c",borderTop:"1px solid #f3f4f6"},children:[m.jsx("td",{style:Sr,children:e.method}),m.jsx("td",{style:Sr,children:e.status??"—"}),m.jsx("td",{style:{...Sr,fontFamily:"monospace",wordBreak:"break-all"},children:e.url}),m.jsx("td",{style:{...Sr,textAlign:"right"},children:e.durationMs!=null?Math.round(e.durationMs):"—"})]},t))})]})}function Wy({summary:r}){const e=Object.entries(r.counts).filter(([,t])=>t>0);return e.length===0?m.jsx(an,{children:"No regex matches. Form input values are still automatically masked by rrweb."}):m.jsxs("div",{children:[m.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:10},children:e.map(([t,i])=>m.jsxs("span",{style:{background:"#dcfce7",color:"#065f46",padding:"3px 9px",borderRadius:999,fontSize:11,fontWeight:600},children:[i," × ",t.replace(/_/g," ")]},t))}),m.jsxs("p",{style:{margin:0,fontSize:11,color:"#6b7280",lineHeight:1.55},children:["Pattern matches were replaced with"," ",m.jsx("code",{style:{background:"#f3f4f6",padding:"1px 4px",borderRadius:3},children:"[REDACTED:<category>]"})," ","before this preview rendered. The original values are not in the upload payload."]})]})}function Vy(r){const e=[["Page URL",r.pageUrl],["User agent",r.userAgent],["Viewport",`${r.viewport.width} × ${r.viewport.height}`],["Recording",r.hasReplay?`${ln(r.durationMs)} (replay)`:"screenshot only"],["Audio",r.hasAudio?"attached":"none"],["Attachments",r.attachments.length===0?"none":r.attachments.map(t=>`${t.name} (${Math.round(t.size/1024)} KB)`).join(", ")]];return m.jsx("table",{style:{width:"100%",fontSize:12,borderCollapse:"collapse"},children:m.jsx("tbody",{children:e.map(([t,i])=>m.jsxs("tr",{style:{borderTop:"1px solid #f3f4f6"},children:[m.jsx("td",{style:{padding:"7px 8px",color:"#6b7280",fontWeight:500,width:130,verticalAlign:"top"},children:t}),m.jsx("td",{style:{padding:"7px 8px",color:"#1f2937",fontFamily:"monospace",wordBreak:"break-all"},children:i})]},t))})})}function an({children:r}){return m.jsx("div",{style:{fontSize:12,color:"#9ca3af",fontStyle:"italic",padding:"20px 0",textAlign:"center"},children:r})}function br({active:r,onClick:e,children:t}){return m.jsx("button",{type:"button",onClick:e,style:{padding:"8px 12px",background:r?"white":"transparent",border:"none",borderBottom:r?"2px solid #ea580c":"2px solid transparent",fontSize:12,fontWeight:r?600:500,color:r?"#1f2937":"#6b7280",cursor:"pointer"},children:t})}function Vo({active:r,onClick:e,children:t}){return m.jsx("button",{type:"button",onClick:e,style:{padding:"5px 10px",background:r?"#1f2937":"transparent",border:"1px solid",borderColor:r?"#374151":"transparent",borderRadius:6,fontSize:12,fontWeight:600,color:r?"#e5e7eb":"#6b7280",cursor:"pointer",fontFamily:"inherit"},children:t})}function Gy(r){const e=oe.useRef(null),t=oe.useRef(null);return oe.useEffect(()=>{const i=e.current;if(!i||r.events.length===0)return;i.replaceChildren();const s=Math.min(720,i.clientWidth||720),n=r.capturedViewport.height/Math.max(1,r.capturedViewport.width),o=s,a=Math.max(280,Math.min(420,Math.round(o*n))),l=new Py({target:i,props:{events:r.events,width:o,height:a,autoPlay:!1,skipInactive:!1,showController:!0}}),c=h=>{const f=h?.payload??0,d=t.current;if(d?.duration&&!Number.isNaN(d.duration)){const g=f/1e3;Math.abs(d.currentTime-g)>.15&&(d.currentTime=Math.min(g,d.duration))}},u=h=>{const f=h?.payload,d=t.current;d&&(f==="playing"?d.play().catch(()=>{}):(f==="paused"||f==="ended"||f==="live")&&d.pause())};return l.addEventListener("ui-update-current-time",c),l.addEventListener("ui-update-player-state",u),()=>{try{l.$destroy?.()}catch{}i.replaceChildren()}},[r.events,r.capturedViewport.width,r.capturedViewport.height]),m.jsxs("div",{children:[m.jsx("div",{ref:e,style:{minHeight:280,maxWidth:"100%",background:"#000",borderRadius:6,overflow:"hidden",position:"relative",margin:"0 auto"}}),r.audioBlobUrl&&m.jsx("audio",{ref:t,src:r.audioBlobUrl,preload:"auto",style:{display:"none"}})]})}function Yy({children:r}){return m.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(17, 24, 39, 0.55)",display:"flex",alignItems:"center",justifyContent:"center",padding:20,zIndex:2147483647},children:m.jsx("div",{style:{background:"white",borderRadius:14,padding:22,width:820,maxWidth:"100%",maxHeight:"92vh",overflow:"auto",fontFamily:"system-ui, -apple-system, sans-serif",color:"#111827",boxShadow:"0 20px 60px rgba(0,0,0,0.3)"},children:r})})}function Hy({color:r,onClick:e,children:t,disabled:i,title:s}){return m.jsx("button",{onClick:e,disabled:i,title:s,style:{background:i?"#cbd5e1":r,color:"white",border:"none",borderRadius:6,padding:"10px 18px",fontWeight:600,fontSize:13,cursor:i?"not-allowed":"pointer"},children:t})}function Go({onClick:r,children:e}){return m.jsx("button",{onClick:r,style:{background:"white",color:"#111827",border:"1px solid #d1d5db",borderRadius:6,padding:"10px 18px",fontWeight:500,fontSize:13,cursor:"pointer"},children:e})}const Zy={display:"flex",alignItems:"baseline",justifyContent:"space-between",marginBottom:14},Yo={display:"block",fontSize:12,fontWeight:600,marginBottom:6,color:"#374151"},Xy={width:"100%",boxSizing:"border-box",padding:10,borderRadius:6,border:"1px solid #d1d5db",fontFamily:"inherit",fontSize:13,resize:"vertical"},Jy={width:"100%",display:"flex",alignItems:"center",gap:8,background:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:8,padding:"10px 14px",fontSize:13,color:"#1f2937",cursor:"pointer",textAlign:"left"},Ky={marginTop:8,border:"1px solid #e5e7eb",borderRadius:8,background:"#fafafa",overflow:"hidden"},qy={display:"flex",gap:4,background:"#f3f4f6",borderBottom:"1px solid #e5e7eb",padding:"0 8px"},Qy={margin:0,fontFamily:"ui-monospace, monospace",fontSize:11,lineHeight:1.5,color:"#1f2937",whiteSpace:"pre-wrap",wordBreak:"break-all"},vr={padding:"6px 8px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:.5,borderBottom:"1px solid #e5e7eb"},Sr={padding:"6px 8px",verticalAlign:"top"},ew={position:"sticky",bottom:-22,marginTop:22,marginLeft:-22,marginRight:-22,marginBottom:-22,padding:"14px 22px 22px 22px",display:"flex",gap:8,justifyContent:"space-between",background:"rgba(255,255,255,0.96)",backdropFilter:"blur(6px)",borderTop:"1px solid #e5e7eb",zIndex:1};function ln(r){const e=Math.floor(r/1e3),t=Math.floor(e/60),i=e%60;return`${t}:${String(i).padStart(2,"0")}`}const tw={"bottom-right":{right:20,bottom:20},"bottom-left":{left:20,bottom:20},"top-right":{right:20,top:20},"top-left":{left:20,top:20}};function rw(r){return m.jsxs("div",{"data-bugjar-block":"true",style:{position:"fixed",zIndex:2147483e3,...tw[r.position]},children:[r.view==="idle"&&r.triggerVisible&&m.jsx(sw,{color:r.primaryColor,label:r.triggerLabel,onClick:r.onOpenActive}),r.view==="active"&&m.jsx(xh,{primaryColor:r.primaryColor,isRecording:r.isRecording,hasRecording:r.hasRecording,elapsedMs:r.elapsedMs,maxDurationSec:r.maxDurationSec,onSelectTool:r.onSelectTool,onSelectColor:r.onSelectColor,onUndo:r.onUndoMarkup,onStartRecording:()=>{r.onStartRecording()},onStopRecording:()=>{r.onStopRecording()},onToggleMicMute:r.onToggleMicMute,onDone:()=>{r.onFinalize()},onCancel:r.onCancel}),r.view==="preview"&&r.preview&&m.jsx(jy,{color:r.primaryColor,hasReplay:r.preview.hasReplay,durationMs:r.preview.durationMs,replayEvents:r.preview.replayEvents,audioBlobUrl:r.preview.audioBlobUrl,screenshotUrl:r.preview.screenshotUrl,consoleLogs:r.preview.consoleLogs,networkEvents:r.preview.networkEvents,redactionSummary:r.preview.redactionSummary,capturedViewport:r.preview.capturedViewport,pageUrl:r.preview.pageUrl,userAgent:r.preview.userAgent,onCancel:r.onCancel,onBackToMarkup:r.onBackToMarkup,onSend:r.onSendReport}),r.view==="uploading"&&m.jsx(lw,{color:r.primaryColor}),r.view==="success"&&m.jsx(cw,{color:r.primaryColor,url:r.preview?.reportUrl??null,onDismiss:r.onCancel}),r.view==="failed"&&m.jsx(uw,{error:r.error??"Upload failed",onDismiss:r.onCancel,onDownload:()=>{r.onDownloadFailed()}}),r.resumingToast&&m.jsx(iw,{color:r.primaryColor,remainingMs:r.resumingToast.remainingMs})]})}function iw({color:r,remainingMs:e}){const t=Math.max(1,Math.ceil(e/1e3));return m.jsxs("div",{style:{position:"fixed",left:"50%",top:24,transform:"translateX(-50%)",background:"#111827",color:"white",padding:"10px 14px",borderRadius:10,fontFamily:"system-ui, -apple-system, sans-serif",fontSize:13,boxShadow:"0 10px 30px rgba(0,0,0,0.35)",display:"flex",alignItems:"center",gap:10,zIndex:2147483002,userSelect:"none",maxWidth:"calc(100vw - 32px)"},children:[m.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:r,animation:"bugjar-pulse 1.2s infinite",flexShrink:0}}),m.jsx("style",{children:"@keyframes bugjar-pulse { 0%,100%{opacity:1} 50%{opacity:0.35} }"}),m.jsxs("span",{children:["Continuing recording — ",t,"s left"]})]})}function sw({color:r,label:e,onClick:t}){const i=nw(r,.12),s=ow(r,.33);return m.jsxs(m.Fragment,{children:[m.jsx("style",{children:`
118
118
  [data-bugjar-block] .bugjar-trigger {
119
119
  background: ${r};
120
120
  color: #fff;
@@ -146,5 +146,31 @@ PERFORMANCE OF THIS SOFTWARE.
146
146
  outline: none;
147
147
  box-shadow: 0 0 0 3px ${s}, 0 6px 24px -8px rgba(0, 0, 0, 0.28);
148
148
  }
149
- `}),g.jsxs("button",{type:"button",className:"bugjar-trigger",onClick:t,children:[g.jsx(aw,{size:14,stroke:2}),e]})]})}function nw(r,e){const t=r.match(/^#([0-9a-f]{6})$/i);if(!t)return r;const i=parseInt(t[1],16),s=Math.max(0,Math.round((i>>16&255)*(1-e))),n=Math.max(0,Math.round((i>>8&255)*(1-e))),o=Math.max(0,Math.round((i&255)*(1-e)));return`#${(s<<16|n<<8|o).toString(16).padStart(6,"0")}`}function ow(r,e){const t=r.match(/^#([0-9a-f]{6})$/i);if(!t)return r;const i=parseInt(t[1],16);return`rgba(${i>>16&255}, ${i>>8&255}, ${i&255}, ${e})`}function aw({size:r=14,stroke:e=1.7}){return g.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",style:{flexShrink:0},"aria-hidden":"true",children:[g.jsx("ellipse",{cx:"12",cy:"13",rx:"5",ry:"6",stroke:"currentColor",strokeWidth:e}),g.jsx("path",{d:"M12 7 V4 M9 5 l3 2 3-2 M5 11 l-2.5 -1 M5 15 l-2.5 1 M19 11 l2.5 -1 M19 15 l2.5 1 M9 18 l-2 2 M15 18 l2 2",stroke:"currentColor",strokeWidth:e,strokeLinecap:"round",strokeLinejoin:"round"})]})}function lw({children:r}){return g.jsx("div",{style:{background:"#111827",color:"white",padding:"10px 16px",borderRadius:8,fontFamily:"system-ui",fontSize:13},children:r})}function cw({color:r,url:e,onDismiss:t}){return g.jsxs("div",{style:{background:"white",padding:16,borderRadius:8,border:`2px solid ${r}`,fontFamily:"system-ui",fontSize:13,boxShadow:"0 10px 30px rgba(0,0,0,0.2)",maxWidth:320},children:[g.jsx("div",{style:{fontWeight:600,marginBottom:6},children:"Report sent — thank you!"}),e&&g.jsx("a",{href:e,target:"_blank",rel:"noreferrer",style:{color:r},children:"View in dashboard →"}),g.jsx("div",{style:{marginTop:12,textAlign:"right"},children:g.jsx(xs,{onClick:t,children:"Close"})})]})}function uw({error:r,onDismiss:e,onDownload:t}){return g.jsxs("div",{style:{background:"white",padding:16,borderRadius:8,border:"2px solid #ef4444",fontFamily:"system-ui",fontSize:13,boxShadow:"0 10px 30px rgba(0,0,0,0.2)",maxWidth:360},children:[g.jsx("div",{style:{fontWeight:600,marginBottom:6,color:"#b91c1c"},children:"Upload failed"}),g.jsx("div",{style:{color:"#4b5563",marginBottom:4,fontFamily:"ui-monospace, monospace",fontSize:12,wordBreak:"break-word"},children:r}),g.jsx("div",{style:{color:"#9ca3af",fontSize:11,lineHeight:1.5,marginTop:6},children:"Your report is still in memory. You can save it as a file and email it to support, or dismiss this toast to discard."}),g.jsxs("div",{style:{marginTop:12,display:"flex",gap:8,justifyContent:"flex-end"},children:[g.jsx(xs,{onClick:e,children:"Discard"}),g.jsx(xs,{onClick:t,children:"Download as file"})]})]})}function xs({onClick:r,children:e}){return g.jsx("button",{onClick:r,style:{background:"white",color:"#111827",border:"1px solid #d1d5db",borderRadius:6,padding:"10px 18px",fontWeight:500,fontSize:13,cursor:"pointer"},children:e})}const hw=typeof window<"u"?window.fetch.bind(window):fetch;async function fw(r){const{apiUrl:e,projectKey:t,userToken:i,captureToken:s,report:n,attachments:o}=r,a=n.rrwebEvents.length>0,l={replay:a?{sizeBytes:yw(n.rrwebEvents),durationMs:n.durationMs}:null,audio:n.audioBlob?{sizeBytes:n.audioBlob.size}:null,screenshot:{sizeBytes:n.screenshotBlob.size},attachments:o.map(p=>({filename:p.name,sizeBytes:p.size,mimeType:p.type}))},c=await Es(`${e}/upload-url`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({projectKey:t,manifest:l,...i?{userToken:i}:{},...s?{captureToken:s}:{}})});if(!c.ok)throw new Error(`upload-url failed: ${c.status} ${(await c.text()).slice(0,200)}`);const{reportId:u,finalizeToken:h,uploads:f}=await c.json(),d=[];f.replay&&a&&d.push(Cr(f.replay.url,new Blob([JSON.stringify(n.rrwebEvents)],{type:"application/json"}))),f.audio&&n.audioBlob&&d.push(Cr(f.audio.url,n.audioBlob)),d.push(Cr(f.screenshot.url,n.screenshotBlob));for(let p=0;p<o.length;p++){const y=o[p],b=f.attachments[p];if(!y||!b)throw new Error(`Server returned ${f.attachments.length} presigns for ${o.length} attachments`);d.push(Cr(b.url,y))}await Promise.all(d);const m=await Es(`${e}/reports/${u}/finalize`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({projectKey:t,finalizeToken:h,description:n.description,durationMs:n.durationMs,consoleLogs:n.consoleLogs,networkEvents:n.networkEvents,annotations:n.annotations,url:n.url,userAgent:n.userAgent,viewport:n.viewport,redactionSummary:n.redactionSummary,strictMode:n.strictMode,attachmentIds:f.attachments.map(p=>p.id)})});if(!m.ok)throw new Error(`finalize failed: ${m.status}`);const{dashboardUrl:w}=await m.json();return{reportId:u,dashboardUrl:w}}async function Cr(r,e){const t=await Es(r,{method:"PUT",headers:{"Content-Type":e.type||"application/octet-stream"},body:e});if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(`PUT ${Yr(r)} failed: ${t.status} ${i.slice(0,160)}`)}}const xr=[200,800,3200],Ho=3e4;async function Es(r,e){let t=null;for(let i=0;i<=xr.length;i++){try{const o=await gw(r,e);if(!dw(o.status)||i===xr.length)return o}catch(o){if(t=o,i===xr.length)throw o}const s=xr[i],n=(Math.random()-.5)*.5*s;await pw(s+n)}throw t instanceof Error?t:new Error(`retryingFetch exhausted attempts for ${Yr(r)}`)}function dw(r){return r===408||r===502||r===503||r===504}function pw(r){return new Promise(e=>setTimeout(e,Math.max(0,r)))}function mw(r,e){return!r||typeof AbortSignal.any!="function"?e:AbortSignal.any([r,e])}async function gw(r,e){const t=AbortSignal.timeout(Ho),i=mw(e.signal,t);try{return await hw(r,{...e,signal:i})}catch(s){const n=(e.method??"GET").toUpperCase();if(t.aborted&&!e.signal?.aborted)throw new Error(`${n} ${Yr(r)} timed out after ${Ho/1e3}s`);const a=s,l=a?.cause instanceof Error?`: ${a.cause.message}`:a?.cause?`: ${String(a.cause)}`:"",c=s instanceof Error?s.message:String(s);throw new Error(`${n} ${Yr(r)} failed: ${c}${l}`)}}function Yr(r){try{const e=new URL(r),t=e.pathname.length>60?`${e.pathname.slice(0,57)}…`:e.pathname;return`${e.host}${t}`}catch{return r.slice(0,80)}}function yw(r){try{return new Blob([JSON.stringify(r)]).size}catch{return 0}}async function ww(r,e){const t={reportId:r.reportId,createdAt:r.createdAt,durationMs:r.durationMs,description:r.description,url:r.url,userAgent:r.userAgent,viewport:r.viewport,consoleLogs:r.consoleLogs,networkEvents:r.networkEvents,annotations:r.annotations,redactionSummary:r.redactionSummary,strictMode:r.strictMode,attachmentNames:e.map(n=>n.name)},i=new Blob([JSON.stringify({manifest:t,rrwebEvents:r.rrwebEvents},null,2)],{type:"application/json"}),s=document.createElement("a");s.href=URL.createObjectURL(i),s.download=`bugjar-report-${r.reportId}.json`,s.click(),URL.revokeObjectURL(s.href)}class bw{constructor(){k(this,"config",null);k(this,"root",null);k(this,"host",null);k(this,"markupHost",null);k(this,"markupController",null);k(this,"consoleCapture",null);k(this,"networkCapture",null);k(this,"recorder",null);k(this,"view","idle");k(this,"isRecording",!1);k(this,"elapsedMs",0);k(this,"capturedReport",null);k(this,"preview",null);k(this,"previewObjectUrls",[]);k(this,"error",null);k(this,"failedAttachments",null);k(this,"errorObserved",!1);k(this,"sessionId",null);k(this,"persistedActiveMs",0);k(this,"resumingToast",null);k(this,"lastRecording",null);k(this,"finalizingInFlight",!1)}init(e){if(this.config)return this.publicApi();this.config=vw(e),this.host=document.createElement("div"),this.host.setAttribute("data-bugjar-block","true"),this.host.id="bugjar-root",document.body.appendChild(this.host),this.root=Ii(this.host);const t=()=>this.onErrorObserved();this.consoleCapture=Tc(this.config.capture.consoleBufferSize,t),this.networkCapture=$c(this.config.capture.networkBufferSize,t);const i=Sw(this.config.captureTokenParam);return i&&this.applyCaptureToken(i),this.render(),this.attemptRecovery(),this.publicApi()}async attemptRecovery(){if(!this.config)return;const e=this.config.projectKey,t=Zc(e);if(!t)return;if(!Xc(t)){We(e);try{await Yt(t.sessionId)}catch{}return}let i=null;try{i=await Uc(t.sessionId)}catch{We(e);return}if(!i){We(e);return}const s=Math.max(0,i.maxDurationMs-i.activeMs);if(s<500){We(e);try{await Yt(i.sessionId)}catch{}return}try{this.consoleCapture.hydrate(i.consoleEntries),this.networkCapture.hydrate(i.networkEvents)}catch(o){this.config.onError?.(o instanceof Error?o:new Error(String(o)))}this.sessionId=i.sessionId,this.persistedActiveMs=i.activeMs,this.view="active",this.isRecording=!0,this.elapsedMs=i.activeMs,this.resumingToast={remainingMs:s},this.ensureMarkupLayer(),this.render();const n=new pn({sessionId:i.sessionId,projectKey:e,persistedActiveMs:i.activeMs,strictMode:this.config.strictMode,disabledCategories:this.config.disabledCategories,captureMicrophone:this.config.capture.captureMicrophone,maxDurationSec:this.config.capture.maxDurationSec,consoleCapture:this.consoleCapture,networkCapture:this.networkCapture,onTick:o=>{this.elapsedMs=o,this.render()},onStop:o=>{this.lastRecording={events:o.events,audioBlob:o.audioBlob,durationMs:o.durationMs},this.isRecording=!1,this.recorder=null,this.render()}});n.hydrateEvents(i.events),n.hydrateAudioChunks(i.audioChunks),this.recorder=n;try{await n.start()}catch(o){this.recorder=null,this.sessionId=null,this.persistedActiveMs=0,this.isRecording=!1,this.view="idle",this.resumingToast=null,We(e);try{await Yt(i.sessionId)}catch{}this.config.onError?.(o instanceof Error?o:new Error(String(o))),this.render();return}window.setTimeout(()=>{this.resumingToast=null,this.render()},3500)}onErrorObserved(){this.errorObserved||(this.errorObserved=!0,this.render())}publicApi(){return{open:()=>this.open(),close:()=>this.close()}}async applyCaptureToken(e){if(this.config&&this.config.captureToken!==e)try{const t=await fetch(`${this.config.apiUrl}/capture-invitations/${encodeURIComponent(e)}/scope`,{method:"GET",headers:{Accept:"application/json"}});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(`capture-token scope fetch failed (${t.status}): ${n.error?.code??"unknown"}`)}const{disableCategories:i}=await t.json(),s=eu(i);this.config.captureToken=e,this.config.disabledCategories=s}catch(t){this.config.onError?.(t instanceof Error?t:new Error(String(t)))}}ensureMarkupLayer(){if(this.markupController)return this.markupController;const e=document.createElement("div");return e.id="bugjar-markup-layer",document.body.appendChild(e),this.markupHost=e,this.markupController=new Pc(e),this.markupController}teardownMarkupLayer(){this.markupController&&(this.markupController.destroy(),this.markupController=null),this.markupHost&&(this.markupHost.remove(),this.markupHost=null)}open(){if(!this.config)throw new Error("BugJar.init() must be called first");this.view="active",this.isRecording=!1,this.elapsedMs=0,this.lastRecording=null,this.ensureMarkupLayer(),this.render()}close(){this.view="idle",this.isRecording=!1,this.elapsedMs=0,this.capturedReport=null,this.preview=null,this.error=null,this.lastRecording=null,this.resumingToast=null,this.releasePreviewObjectUrls(),this.recorder&&(this.recorder.stop().catch(()=>{}),this.recorder=null),this.discardPersistedSession(),this.teardownMarkupLayer(),this.render()}discardPersistedSession(){if(!this.config||!this.sessionId)return;const e=this.config.projectKey,t=this.sessionId;We(e),Yt(t).catch(()=>{}),this.sessionId=null,this.persistedActiveMs=0}releasePreviewObjectUrls(){for(const e of this.previewObjectUrls)try{URL.revokeObjectURL(e)}catch{}this.previewObjectUrls=[]}render(){if(!this.root||!this.config)return;const{showTrigger:e,showOnError:t}=this.config.ui,i=e&&(this.errorObserved||!t);this.root.render(g.jsx(le.StrictMode,{children:g.jsx(rw,{projectKey:this.config.projectKey,primaryColor:this.config.ui.primaryColor,position:this.config.ui.position,maxDurationSec:this.config.capture.maxDurationSec,strictMode:this.config.strictMode,triggerVisible:i,triggerLabel:this.config.ui.triggerLabel,view:this.view,isRecording:this.isRecording,hasRecording:this.lastRecording!==null,elapsedMs:this.elapsedMs,preview:this.preview,error:this.error,resumingToast:this.resumingToast,onOpenActive:()=>this.open(),onCancel:()=>this.close(),onStartRecording:async()=>{await this.startRecording()},onStopRecording:async()=>{await this.stopRecording()},onToggleMicMute:s=>this.recorder?.toggleMic(s),onFinalize:async()=>{await this.finalizeReport()},onBackToMarkup:()=>this.backToMarkup(),onSendReport:async s=>{await this.sendReport(s)},onDownloadFailed:async()=>{await this.downloadOnDemand()},onSelectTool:s=>this.markupController?.setTool(s),onSelectColor:s=>this.markupController?.setColor(s),onUndoMarkup:()=>this.markupController?.undo()})}))}async startRecording(){if(!this.config||this.isRecording||this.recorder)return;this.discardPersistedSession(),this.isRecording=!0,this.elapsedMs=0,this.lastRecording=null,this.persistedActiveMs=0;const e=hn();this.sessionId=e;const t={sessionId:e,projectKey:this.config.projectKey,startedAt:Date.now(),activeMs:0,maxDurationMs:this.config.capture.maxDurationSec*1e3,events:[],audioChunks:[],consoleEntries:[],networkEvents:[],lastSeenAt:Date.now()};try{await zc(t)}catch(i){this.config.onError?.(i instanceof Error?i:new Error(String(i)))}this.render(),this.recorder=new pn({sessionId:e,projectKey:this.config.projectKey,persistedActiveMs:0,strictMode:this.config.strictMode,disabledCategories:this.config.disabledCategories,captureMicrophone:this.config.capture.captureMicrophone,maxDurationSec:this.config.capture.maxDurationSec,consoleCapture:this.consoleCapture,networkCapture:this.networkCapture,onTick:i=>{this.elapsedMs=i,this.render()},onStop:i=>{this.lastRecording={events:i.events,audioBlob:i.audioBlob,durationMs:i.durationMs},this.isRecording=!1,this.recorder=null,this.render()}});try{await this.recorder.start()}catch(i){await this.recorder.stop().catch(()=>{}),this.recorder=null,this.isRecording=!1,this.lastRecording=null,this.discardPersistedSession(),this.error=i instanceof Error?i.message:String(i),this.config.onError?.(i instanceof Error?i:new Error(String(i))),this.render()}}async stopRecording(){this.recorder&&await this.recorder.stop()}async finalizeReport(){if(this.config&&!this.finalizingInFlight){this.finalizingInFlight=!0;try{this.recorder&&await this.recorder.stop(),this.discardPersistedSession();const e=Jo(),t={disabledCategories:this.config.disabledCategories},i=this.lastRecording,s=i?nu(i.events,e,t):[],n=i?this.consoleCapture.snapshot().map(m=>xt(m,e,t)):[],o=i?this.networkCapture.snapshot().map(m=>{const w=xt(m,e,t);return{...w,url:Di(w.url,e)}}):[],a=await gh(),l={width:window.innerWidth,height:window.innerHeight},c=i?.audioBlob??null,u=i?.durationMs??0,h={reportId:hn(),createdAt:Date.now(),durationMs:u,rrwebEvents:s,audioBlob:c,screenshotBlob:a,consoleLogs:n,networkEvents:o,annotations:[],description:"",url:Di(location.href,e),userAgent:navigator.userAgent,viewport:l,redactionSummary:e,strictMode:this.config.strictMode};this.capturedReport=h,this.releasePreviewObjectUrls();const f=URL.createObjectURL(a),d=c?URL.createObjectURL(c):null;this.previewObjectUrls=[f,d].filter(m=>m!==null),this.preview={hasReplay:s.length>0,durationMs:u,replayEvents:s,replayEventCount:s.length,hasAudio:c!==null,audioBlobUrl:d,consoleLogs:n,networkEvents:o,redactionSummary:e,screenshotUrl:f,capturedViewport:l,pageUrl:location.href,userAgent:navigator.userAgent,reportUrl:null},this.view="preview",this.render()}finally{this.finalizingInFlight=!1}}}backToMarkup(){this.preview=null,this.capturedReport=null,this.view="active",this.render()}async sendReport(e){if(!(!this.capturedReport||!this.config)){this.capturedReport.description=e.description,this.capturedReport.annotations=e.annotations,this.view="uploading",this.render();try{const{reportId:t,dashboardUrl:i}=await fw({apiUrl:this.config.apiUrl,projectKey:this.config.projectKey,userToken:this.config.userToken,captureToken:this.config.captureToken,report:this.capturedReport,attachments:e.attachments});this.preview&&(this.preview.reportUrl=i),this.view="success",this.teardownMarkupLayer(),this.config.onReportSubmitted?.(t),this.render()}catch(t){this.error=t instanceof Error?t.message:String(t),this.failedAttachments=e.attachments,this.view="failed",this.config.onError?.(t instanceof Error?t:new Error(String(t))),this.render()}}}async downloadOnDemand(){if(this.capturedReport)try{await ww(this.capturedReport,this.failedAttachments??[])}catch(e){this.config?.onError?.(e instanceof Error?e:new Error(String(e)))}}}function vw(r){return{projectKey:r.projectKey,apiUrl:Ch,userToken:r.userToken??null,user:r.user??{id:""},strictMode:r.strictMode??!1,capture:{...vh,...r.capture??{}},ui:{...Sh,...r.ui??{}},onReportSubmitted:r.onReportSubmitted??(()=>{}),onError:r.onError??(()=>{}),captureTokenParam:r.captureTokenParam??"bugjar_capture",captureToken:null,disabledCategories:new Set}}function Sw(r){if(typeof window>"u"||!window.location)return null;try{const t=new URLSearchParams(window.location.search).get(r);return t&&t.length>0?t:null}catch{return null}}const yc=new bw,_i=yc,wc={init:r=>_i.init(r),open:()=>_i.open(),close:()=>_i.close()};typeof window<"u"&&(window.BugJar=wc);exports.BugJar=wc;exports._client=yc;
150
- //# sourceMappingURL=index.cjs.map
149
+ `}),m.jsxs("button",{type:"button",className:"bugjar-trigger",onClick:t,children:[m.jsx(aw,{size:14,stroke:2}),e]})]})}function nw(r,e){const t=r.match(/^#([0-9a-f]{6})$/i);if(!t)return r;const i=parseInt(t[1],16),s=Math.max(0,Math.round((i>>16&255)*(1-e))),n=Math.max(0,Math.round((i>>8&255)*(1-e))),o=Math.max(0,Math.round((i&255)*(1-e)));return`#${(s<<16|n<<8|o).toString(16).padStart(6,"0")}`}function ow(r,e){const t=r.match(/^#([0-9a-f]{6})$/i);if(!t)return r;const i=parseInt(t[1],16);return`rgba(${i>>16&255}, ${i>>8&255}, ${i&255}, ${e})`}function aw({size:r=14,stroke:e=1.7}){return m.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",style:{flexShrink:0},"aria-hidden":"true",children:[m.jsx("ellipse",{cx:"12",cy:"13",rx:"5",ry:"6",stroke:"currentColor",strokeWidth:e}),m.jsx("path",{d:"M12 7 V4 M9 5 l3 2 3-2 M5 11 l-2.5 -1 M5 15 l-2.5 1 M19 11 l2.5 -1 M19 15 l2.5 1 M9 18 l-2 2 M15 18 l2 2",stroke:"currentColor",strokeWidth:e,strokeLinecap:"round",strokeLinejoin:"round"})]})}function lw({color:r}){const[e,t]=oe.useState(0);oe.useEffect(()=>{const s=window.setTimeout(()=>t(1),4e3),n=window.setTimeout(()=>t(2),1e4);return()=>{window.clearTimeout(s),window.clearTimeout(n)}},[]);const i=["Uploading your report…","Uploading replay — this can take a moment…","Almost done — finalizing…"];return m.jsxs(m.Fragment,{children:[m.jsx("style",{children:`
150
+ @keyframes bugjar-spin { to { transform: rotate(360deg); } }
151
+ @keyframes bugjar-bar { 0% { background-position: 0 0; } 100% { background-position: 24px 0; } }
152
+ .bugjar-spinner {
153
+ width: 14px;
154
+ height: 14px;
155
+ border-radius: 50%;
156
+ border: 2px solid rgba(255,255,255,0.25);
157
+ border-top-color: white;
158
+ animation: bugjar-spin 0.8s linear infinite;
159
+ flex-shrink: 0;
160
+ }
161
+ .bugjar-upload-bar {
162
+ height: 2px;
163
+ background: linear-gradient(
164
+ 90deg,
165
+ transparent 0%,
166
+ ${r} 30%,
167
+ ${r} 60%,
168
+ transparent 100%
169
+ );
170
+ background-size: 200% 100%;
171
+ background-repeat: repeat-x;
172
+ animation: bugjar-bar 1.2s linear infinite;
173
+ margin-top: 8px;
174
+ border-radius: 2px;
175
+ }
176
+ `}),m.jsxs("div",{style:{background:"#111827",color:"white",padding:"12px 16px",borderRadius:10,fontFamily:"system-ui, -apple-system, sans-serif",fontSize:13,boxShadow:"0 10px 30px rgba(0,0,0,0.3)",minWidth:240,maxWidth:320},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[m.jsx("span",{className:"bugjar-spinner"}),m.jsx("span",{children:i[e]})]}),m.jsx("div",{className:"bugjar-upload-bar"})]})]})}function cw({color:r,url:e,onDismiss:t}){return m.jsxs("div",{style:{background:"white",padding:16,borderRadius:8,border:`2px solid ${r}`,fontFamily:"system-ui",fontSize:13,boxShadow:"0 10px 30px rgba(0,0,0,0.2)",maxWidth:320},children:[m.jsx("div",{style:{fontWeight:600,marginBottom:6},children:"Report sent — thank you!"}),e&&m.jsx("a",{href:e,target:"_blank",rel:"noreferrer",style:{color:r},children:"View in dashboard →"}),m.jsx("div",{style:{marginTop:12,textAlign:"right"},children:m.jsx(xs,{onClick:t,children:"Close"})})]})}function uw({error:r,onDismiss:e,onDownload:t}){return m.jsxs("div",{style:{background:"white",padding:16,borderRadius:8,border:"2px solid #ef4444",fontFamily:"system-ui",fontSize:13,boxShadow:"0 10px 30px rgba(0,0,0,0.2)",maxWidth:360},children:[m.jsx("div",{style:{fontWeight:600,marginBottom:6,color:"#b91c1c"},children:"Upload failed"}),m.jsx("div",{style:{color:"#4b5563",marginBottom:4,fontFamily:"ui-monospace, monospace",fontSize:12,wordBreak:"break-word"},children:r}),m.jsx("div",{style:{color:"#9ca3af",fontSize:11,lineHeight:1.5,marginTop:6},children:"Your report is still in memory. You can save it as a file and email it to support, or dismiss this toast to discard."}),m.jsxs("div",{style:{marginTop:12,display:"flex",gap:8,justifyContent:"flex-end"},children:[m.jsx(xs,{onClick:e,children:"Discard"}),m.jsx(xs,{onClick:t,children:"Download as file"})]})]})}function xs({onClick:r,children:e}){return m.jsx("button",{onClick:r,style:{background:"white",color:"#111827",border:"1px solid #d1d5db",borderRadius:6,padding:"10px 18px",fontWeight:500,fontSize:13,cursor:"pointer"},children:e})}const hw=typeof window<"u"?window.fetch.bind(window):fetch;async function fw(r){const{apiUrl:e,projectKey:t,userToken:i,captureToken:s,report:n,attachments:o}=r,a=n.rrwebEvents.length>0,l={replay:a?{sizeBytes:yw(n.rrwebEvents),durationMs:n.durationMs}:null,audio:n.audioBlob?{sizeBytes:n.audioBlob.size}:null,screenshot:{sizeBytes:n.screenshotBlob.size},attachments:o.map(p=>({filename:p.name,sizeBytes:p.size,mimeType:p.type}))},c=await Es(`${e}/upload-url`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({projectKey:t,manifest:l,...i?{userToken:i}:{},...s?{captureToken:s}:{}})});if(!c.ok)throw new Error(`upload-url failed: ${c.status} ${(await c.text()).slice(0,200)}`);const{reportId:u,finalizeToken:h,uploads:f}=await c.json(),d=[];f.replay&&a&&d.push(Cr(f.replay.url,new Blob([JSON.stringify(n.rrwebEvents)],{type:"application/json"}))),f.audio&&n.audioBlob&&d.push(Cr(f.audio.url,n.audioBlob)),d.push(Cr(f.screenshot.url,n.screenshotBlob));for(let p=0;p<o.length;p++){const y=o[p],b=f.attachments[p];if(!y||!b)throw new Error(`Server returned ${f.attachments.length} presigns for ${o.length} attachments`);d.push(Cr(b.url,y))}await Promise.all(d);const g=await Es(`${e}/reports/${u}/finalize`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({projectKey:t,finalizeToken:h,description:n.description,durationMs:n.durationMs,consoleLogs:n.consoleLogs,networkEvents:n.networkEvents,annotations:n.annotations,url:n.url,userAgent:n.userAgent,viewport:n.viewport,redactionSummary:n.redactionSummary,strictMode:n.strictMode,attachmentIds:f.attachments.map(p=>p.id)})});if(!g.ok)throw new Error(`finalize failed: ${g.status}`);const{dashboardUrl:w}=await g.json();return{reportId:u,dashboardUrl:w}}async function Cr(r,e){const t=await Es(r,{method:"PUT",headers:{"Content-Type":e.type||"application/octet-stream"},body:e});if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(`PUT ${Yr(r)} failed: ${t.status} ${i.slice(0,160)}`)}}const xr=[200,800,3200],Ho=3e4;async function Es(r,e){let t=null;for(let i=0;i<=xr.length;i++){try{const o=await gw(r,e);if(!dw(o.status)||i===xr.length)return o}catch(o){if(t=o,i===xr.length)throw o}const s=xr[i],n=(Math.random()-.5)*.5*s;await pw(s+n)}throw t instanceof Error?t:new Error(`retryingFetch exhausted attempts for ${Yr(r)}`)}function dw(r){return r===408||r===502||r===503||r===504}function pw(r){return new Promise(e=>setTimeout(e,Math.max(0,r)))}function mw(r,e){return!r||typeof AbortSignal.any!="function"?e:AbortSignal.any([r,e])}async function gw(r,e){const t=AbortSignal.timeout(Ho),i=mw(e.signal,t);try{return await hw(r,{...e,signal:i})}catch(s){const n=(e.method??"GET").toUpperCase();if(t.aborted&&!e.signal?.aborted)throw new Error(`${n} ${Yr(r)} timed out after ${Ho/1e3}s`);const a=s,l=a?.cause instanceof Error?`: ${a.cause.message}`:a?.cause?`: ${String(a.cause)}`:"",c=s instanceof Error?s.message:String(s);throw new Error(`${n} ${Yr(r)} failed: ${c}${l}`)}}function Yr(r){try{const e=new URL(r),t=e.pathname.length>60?`${e.pathname.slice(0,57)}…`:e.pathname;return`${e.host}${t}`}catch{return r.slice(0,80)}}function yw(r){try{return new Blob([JSON.stringify(r)]).size}catch{return 0}}async function ww(r,e){const t={reportId:r.reportId,createdAt:r.createdAt,durationMs:r.durationMs,description:r.description,url:r.url,userAgent:r.userAgent,viewport:r.viewport,consoleLogs:r.consoleLogs,networkEvents:r.networkEvents,annotations:r.annotations,redactionSummary:r.redactionSummary,strictMode:r.strictMode,attachmentNames:e.map(n=>n.name)},i=new Blob([JSON.stringify({manifest:t,rrwebEvents:r.rrwebEvents},null,2)],{type:"application/json"}),s=document.createElement("a");s.href=URL.createObjectURL(i),s.download=`bugjar-report-${r.reportId}.json`,s.click(),URL.revokeObjectURL(s.href)}class bw{constructor(){M(this,"config",null);M(this,"root",null);M(this,"host",null);M(this,"markupHost",null);M(this,"markupController",null);M(this,"consoleCapture",null);M(this,"networkCapture",null);M(this,"recorder",null);M(this,"view","idle");M(this,"isRecording",!1);M(this,"elapsedMs",0);M(this,"capturedReport",null);M(this,"preview",null);M(this,"previewObjectUrls",[]);M(this,"error",null);M(this,"failedAttachments",null);M(this,"errorObserved",!1);M(this,"sessionId",null);M(this,"persistedActiveMs",0);M(this,"resumingToast",null);M(this,"lastRecording",null);M(this,"finalizingInFlight",!1)}init(e){if(this.config)return this.publicApi();this.config=vw(e),this.host=document.createElement("div"),this.host.setAttribute("data-bugjar-block","true"),this.host.id="bugjar-root",document.body.appendChild(this.host),this.root=Ii(this.host);const t=()=>this.onErrorObserved();this.consoleCapture=Tc(this.config.capture.consoleBufferSize,t),this.networkCapture=$c(this.config.capture.networkBufferSize,t);const i=Sw(this.config.captureTokenParam);return i&&this.applyCaptureToken(i),this.render(),this.attemptRecovery(),this.publicApi()}async attemptRecovery(){if(!this.config)return;const e=this.config.projectKey,t=Zc(e);if(!t)return;if(!Xc(t)){We(e);try{await Yt(t.sessionId)}catch{}return}let i=null;try{i=await Uc(t.sessionId)}catch{We(e);return}if(!i){We(e);return}const s=Math.max(0,i.maxDurationMs-i.activeMs);if(s<500){We(e);try{await Yt(i.sessionId)}catch{}return}try{this.consoleCapture.hydrate(i.consoleEntries),this.networkCapture.hydrate(i.networkEvents)}catch(o){this.config.onError?.(o instanceof Error?o:new Error(String(o)))}this.sessionId=i.sessionId,this.persistedActiveMs=i.activeMs,this.view="active",this.isRecording=!0,this.elapsedMs=i.activeMs,this.resumingToast={remainingMs:s},this.ensureMarkupLayer(),this.render();const n=new pn({sessionId:i.sessionId,projectKey:e,persistedActiveMs:i.activeMs,strictMode:this.config.strictMode,disabledCategories:this.config.disabledCategories,captureMicrophone:this.config.capture.captureMicrophone,maxDurationSec:this.config.capture.maxDurationSec,consoleCapture:this.consoleCapture,networkCapture:this.networkCapture,onTick:o=>{this.elapsedMs=o,this.render()},onStop:o=>{this.lastRecording={events:o.events,audioBlob:o.audioBlob,durationMs:o.durationMs},this.isRecording=!1,this.recorder=null,this.render()}});n.hydrateEvents(i.events),n.hydrateAudioChunks(i.audioChunks),this.recorder=n;try{await n.start()}catch(o){this.recorder=null,this.sessionId=null,this.persistedActiveMs=0,this.isRecording=!1,this.view="idle",this.resumingToast=null,We(e);try{await Yt(i.sessionId)}catch{}this.config.onError?.(o instanceof Error?o:new Error(String(o))),this.render();return}window.setTimeout(()=>{this.resumingToast=null,this.render()},3500)}onErrorObserved(){this.errorObserved||(this.errorObserved=!0,this.render())}publicApi(){return{open:()=>this.open(),close:()=>this.close()}}async applyCaptureToken(e){if(this.config&&this.config.captureToken!==e)try{const t=await fetch(`${this.config.apiUrl}/capture-invitations/${encodeURIComponent(e)}/scope`,{method:"GET",headers:{Accept:"application/json"}});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(`capture-token scope fetch failed (${t.status}): ${n.error?.code??"unknown"}`)}const{disableCategories:i}=await t.json(),s=eu(i);this.config.captureToken=e,this.config.disabledCategories=s,this.view==="idle"&&this.open()}catch(t){this.config.onError?.(t instanceof Error?t:new Error(String(t)))}}ensureMarkupLayer(){if(this.markupController)return this.markupController;const e=document.createElement("div");return e.id="bugjar-markup-layer",document.body.appendChild(e),this.markupHost=e,this.markupController=new Pc(e),this.markupController}teardownMarkupLayer(){this.markupController&&(this.markupController.destroy(),this.markupController=null),this.markupHost&&(this.markupHost.remove(),this.markupHost=null)}open(){if(!this.config)throw new Error("BugJar.init() must be called first");this.view="active",this.isRecording=!1,this.elapsedMs=0,this.lastRecording=null,this.ensureMarkupLayer(),this.render()}close(){this.view="idle",this.isRecording=!1,this.elapsedMs=0,this.capturedReport=null,this.preview=null,this.error=null,this.lastRecording=null,this.resumingToast=null,this.releasePreviewObjectUrls(),this.recorder&&(this.recorder.stop().catch(()=>{}),this.recorder=null),this.discardPersistedSession(),this.teardownMarkupLayer(),this.render()}discardPersistedSession(){if(!this.config||!this.sessionId)return;const e=this.config.projectKey,t=this.sessionId;We(e),Yt(t).catch(()=>{}),this.sessionId=null,this.persistedActiveMs=0}releasePreviewObjectUrls(){for(const e of this.previewObjectUrls)try{URL.revokeObjectURL(e)}catch{}this.previewObjectUrls=[]}render(){if(!this.root||!this.config)return;const{showTrigger:e,showOnError:t}=this.config.ui,i=e&&(this.errorObserved||!t);this.root.render(m.jsx(oe.StrictMode,{children:m.jsx(rw,{projectKey:this.config.projectKey,primaryColor:this.config.ui.primaryColor,position:this.config.ui.position,maxDurationSec:this.config.capture.maxDurationSec,strictMode:this.config.strictMode,triggerVisible:i,triggerLabel:this.config.ui.triggerLabel,view:this.view,isRecording:this.isRecording,hasRecording:this.lastRecording!==null,elapsedMs:this.elapsedMs,preview:this.preview,error:this.error,resumingToast:this.resumingToast,onOpenActive:()=>this.open(),onCancel:()=>this.close(),onStartRecording:async()=>{await this.startRecording()},onStopRecording:async()=>{await this.stopRecording()},onToggleMicMute:s=>this.recorder?.toggleMic(s),onFinalize:async()=>{await this.finalizeReport()},onBackToMarkup:()=>this.backToMarkup(),onSendReport:async s=>{await this.sendReport(s)},onDownloadFailed:async()=>{await this.downloadOnDemand()},onSelectTool:s=>this.markupController?.setTool(s),onSelectColor:s=>this.markupController?.setColor(s),onUndoMarkup:()=>this.markupController?.undo()})}))}async startRecording(){if(!this.config||this.isRecording||this.recorder)return;this.discardPersistedSession(),this.isRecording=!0,this.elapsedMs=0,this.lastRecording=null,this.persistedActiveMs=0;const e=hn();this.sessionId=e;const t={sessionId:e,projectKey:this.config.projectKey,startedAt:Date.now(),activeMs:0,maxDurationMs:this.config.capture.maxDurationSec*1e3,events:[],audioChunks:[],consoleEntries:[],networkEvents:[],lastSeenAt:Date.now()};try{await zc(t)}catch(i){this.config.onError?.(i instanceof Error?i:new Error(String(i)))}this.render(),this.recorder=new pn({sessionId:e,projectKey:this.config.projectKey,persistedActiveMs:0,strictMode:this.config.strictMode,disabledCategories:this.config.disabledCategories,captureMicrophone:this.config.capture.captureMicrophone,maxDurationSec:this.config.capture.maxDurationSec,consoleCapture:this.consoleCapture,networkCapture:this.networkCapture,onTick:i=>{this.elapsedMs=i,this.render()},onStop:i=>{this.lastRecording={events:i.events,audioBlob:i.audioBlob,durationMs:i.durationMs},this.isRecording=!1,this.recorder=null,this.render()}});try{await this.recorder.start()}catch(i){await this.recorder.stop().catch(()=>{}),this.recorder=null,this.isRecording=!1,this.lastRecording=null,this.discardPersistedSession(),this.error=i instanceof Error?i.message:String(i),this.config.onError?.(i instanceof Error?i:new Error(String(i))),this.render()}}async stopRecording(){this.recorder&&await this.recorder.stop()}async finalizeReport(){if(this.config&&!this.finalizingInFlight){this.finalizingInFlight=!0;try{this.recorder&&await this.recorder.stop(),this.discardPersistedSession();const e=Jo(),t={disabledCategories:this.config.disabledCategories},i=this.lastRecording,s=i?nu(i.events,e,t):[],n=i?this.consoleCapture.snapshot().map(g=>xt(g,e,t)):[],o=i?this.networkCapture.snapshot().map(g=>{const w=xt(g,e,t);return{...w,url:Di(w.url,e)}}):[],a=await gh(),l={width:window.innerWidth,height:window.innerHeight},c=i?.audioBlob??null,u=i?.durationMs??0,h={reportId:hn(),createdAt:Date.now(),durationMs:u,rrwebEvents:s,audioBlob:c,screenshotBlob:a,consoleLogs:n,networkEvents:o,annotations:[],description:"",url:Di(location.href,e),userAgent:navigator.userAgent,viewport:l,redactionSummary:e,strictMode:this.config.strictMode};this.capturedReport=h,this.releasePreviewObjectUrls();const f=URL.createObjectURL(a),d=c?URL.createObjectURL(c):null;this.previewObjectUrls=[f,d].filter(g=>g!==null),this.preview={hasReplay:s.length>0,durationMs:u,replayEvents:s,replayEventCount:s.length,hasAudio:c!==null,audioBlobUrl:d,consoleLogs:n,networkEvents:o,redactionSummary:e,screenshotUrl:f,capturedViewport:l,pageUrl:location.href,userAgent:navigator.userAgent,reportUrl:null},this.view="preview",this.render()}finally{this.finalizingInFlight=!1}}}backToMarkup(){this.preview=null,this.capturedReport=null,this.view="active",this.render()}async sendReport(e){if(!(!this.capturedReport||!this.config)){this.capturedReport.description=e.description,this.capturedReport.annotations=e.annotations,this.view="uploading",this.render();try{const{reportId:t,dashboardUrl:i}=await fw({apiUrl:this.config.apiUrl,projectKey:this.config.projectKey,userToken:this.config.userToken,captureToken:this.config.captureToken,report:this.capturedReport,attachments:e.attachments});this.preview&&(this.preview.reportUrl=i),this.view="success",this.teardownMarkupLayer(),this.config.onReportSubmitted?.(t),this.render()}catch(t){this.error=t instanceof Error?t.message:String(t),this.failedAttachments=e.attachments,this.view="failed",this.config.onError?.(t instanceof Error?t:new Error(String(t))),this.render()}}}async downloadOnDemand(){if(this.capturedReport)try{await ww(this.capturedReport,this.failedAttachments??[])}catch(e){this.config?.onError?.(e instanceof Error?e:new Error(String(e)))}}}function vw(r){return{projectKey:r.projectKey,apiUrl:Ch,userToken:r.userToken??null,user:r.user??{id:""},strictMode:r.strictMode??!1,capture:{...vh,...r.capture??{}},ui:{...Sh,...r.ui??{}},onReportSubmitted:r.onReportSubmitted??(()=>{}),onError:r.onError??(()=>{}),captureTokenParam:r.captureTokenParam??"bugjar_capture",captureToken:null,disabledCategories:new Set}}function Sw(r){if(typeof window>"u"||!window.location)return null;try{const t=new URLSearchParams(window.location.search).get(r);return t&&t.length>0?t:null}catch{return null}}const yc=new bw,_i=yc,wc={init:r=>_i.init(r),open:()=>_i.open(),close:()=>_i.close()};typeof window<"u"&&(window.BugJar=wc);exports.BugJar=wc;exports._client=yc;