UNPKG

@sprig-technologies/sprig-bundled

Version:

npm package for the sprig web sdk with bundled dependencies

20 lines (19 loc) 294 kB
"use strict";var Cd=Object.defineProperty;var kd=(e,t,r)=>t in e?Cd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var de=(e,t,r)=>kd(e,typeof t!="symbol"?t+"":t,r);var Ed=Object.create,po=Object.defineProperty,xd=Object.getOwnPropertyDescriptor,Td=Object.getOwnPropertyNames,Rd=Object.getPrototypeOf,Ld=Object.prototype.hasOwnProperty,gr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Od=gr((e,t)=>{var r;r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t.exports=r}),Ad=gr((e,t)=>{t.exports=function(s){if(!s)return!1;var n=r.call(s);return n==="[object Function]"||typeof s=="function"&&n!=="[object RegExp]"||typeof window<"u"&&(s===window.setTimeout||s===window.alert||s===window.confirm||s===window.prompt)};var r=Object.prototype.toString}),Md=gr((e,t)=>{var r=function(n){return n.replace(/^\s+|\s+$/g,"")},s=function(n){return Object.prototype.toString.call(n)==="[object Array]"};t.exports=function(n){if(!n)return{};for(var i={},a=r(n).split(` `),o=0;o<a.length;o++){var l=a[o],c=l.indexOf(":"),u=r(l.slice(0,c)).toLowerCase(),d=r(l.slice(c+1));i[u]===void 0?i[u]=d:s(i[u])?i[u].push(d):i[u]=[i[u],d]}return i}}),Ud=gr((e,t)=>{t.exports=function(){for(var s={},n=0;n<arguments.length;n++){var i=arguments[n];for(var a in i)r.call(i,a)&&(s[a]=i[a])}return s};var r=Object.prototype.hasOwnProperty}),Dd=gr((e,t)=>{var r=Od(),s=Ad(),n=Md(),i=Ud();function a(c,u,d){var h=c;return s(u)?(d=u,typeof c=="string"&&(h={uri:c})):h=i(u,{uri:c}),h.callback=d,h}function o(c,u,d){return l(u=a(c,u,d))}function l(c){if(c.callback===void 0)throw new Error("callback argument missing");var u=!1,d=function(T,R,S){u||(u=!0,c.callback(T,R,S))};function h(){var T=void 0;if(T=p.response?p.response:p.responseText||function(R){try{if(R.responseType==="document")return R.responseXML;var S=R.responseXML&&R.responseXML.documentElement.nodeName==="parsererror";if(R.responseType===""&&!S)return R.responseXML}catch{}return null}(p),M)try{T=JSON.parse(T)}catch{}return T}function f(T){return clearTimeout(g),T instanceof Error||(T=new Error(""+(T||"Unknown XMLHttpRequest Error"))),T.statusCode=0,d(T,k)}function w(){if(!m){var T;clearTimeout(g),T=c.useXDR&&p.status===void 0?200:p.status===1223?204:p.status;var R=k,S=null;return T!==0?(R={body:h(),statusCode:T,method:I,headers:{},url:v,rawRequest:p},p.getAllResponseHeaders&&(R.headers=n(p.getAllResponseHeaders()))):S=new Error("Internal XMLHttpRequest Error"),d(S,R,R.body)}}var p=c.xhr||null;p||(p=c.cors||c.useXDR?new o.XDomainRequest:new o.XMLHttpRequest);var C,m,g,v=p.url=c.uri||c.url,I=p.method=c.method||"GET",O=c.body||c.data,E=p.headers=c.headers||{},A=!!c.sync,M=!1,k={body:void 0,headers:{},statusCode:0,method:I,url:v,rawRequest:p};if("json"in c&&c.json!==!1&&(M=!0,E.accept||E.Accept||(E.Accept="application/json"),I!=="GET"&&I!=="HEAD"&&(E["content-type"]||E["Content-Type"]||(E["Content-Type"]="application/json"),O=JSON.stringify(c.json===!0?O:c.json))),p.onreadystatechange=function(){p.readyState===4&&setTimeout(w,0)},p.onload=w,p.onerror=f,p.onprogress=function(){},p.onabort=function(){m=!0},p.ontimeout=f,p.open(I,v,!A,c.username,c.password),A||(p.withCredentials=!!c.withCredentials),!A&&c.timeout>0&&(g=setTimeout(function(){if(!m){m=!0,p.abort("timeout");var T=new Error("XMLHttpRequest timeout");T.code="ETIMEDOUT",f(T)}},c.timeout)),p.setRequestHeader)for(C in E)E.hasOwnProperty(C)&&p.setRequestHeader(C,E[C]);else if(c.headers&&!function(T){for(var R in T)if(T.hasOwnProperty(R))return!1;return!0}(c.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in c&&(p.responseType=c.responseType),"beforeSend"in c&&typeof c.beforeSend=="function"&&c.beforeSend(p),p.send(O||null),p}t.exports=o,t.exports.default=o,o.XMLHttpRequest=r.XMLHttpRequest||function(){},o.XDomainRequest="withCredentials"in new o.XMLHttpRequest?o.XMLHttpRequest:r.XDomainRequest,function(c,u){for(var d=0;d<c.length;d++)u(c[d])}(["get","put","post","patch","head","delete"],function(c){o[c==="delete"?"del":c]=function(u,d,h){return(d=a(u,d,h)).method=c.toUpperCase(),l(d)}})});function Mi(e,t,...r){if(!e)throw new TypeError(ml(t,r))}function ml(e,t){let r=0;return e.replace(/%[os]/gu,()=>fl(t[r++]))}function fl(e){return typeof e!="object"||e===null?String(e):Object.prototype.toString.call(e)}var Ue=typeof window<"u"?window:typeof self<"u"?self:typeof global<"u"?global:typeof globalThis<"u"?globalThis:void 0,dt=class{constructor(e,t){this.code=e,this.message=t}warn(...e){var t;try{let r=((t=new Error().stack)!==null&&t!==void 0?t:"").replace(/^(?:.+?\n){2}/gu,` `);console.warn(this.message,...e,r)}catch{}}},Pd=new dt("W01","Unable to initialize event under dispatching."),_d=new dt("W02","Assigning any falsy value to 'cancelBubble' property has no effect."),Nd=new dt("W03","Assigning any truthy value to 'returnValue' property has no effect."),Fd=new dt("W04","Unable to preventDefault on non-cancelable events."),Bd=new dt("W05","Unable to preventDefault inside passive event listener invocation."),zd=new dt("W06","An event listener wasn't added because it has been added already: %o, %o"),Xs=new dt("W07","The %o option value was abandoned because the event listener wasn't added as duplicated."),ho=new dt("W08","The 'callback' argument must be a function or an object that has 'handleEvent' method: %o"),Ke=class{static get NONE(){return mo}static get CAPTURING_PHASE(){return fo}static get AT_TARGET(){return go}static get BUBBLING_PHASE(){return yo}constructor(e,t){Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let r=t??{};En.set(this,{type:String(e),bubbles:!!r.bubbles,cancelable:!!r.cancelable,composed:!!r.composed,target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1,inPassiveListenerFlag:!1,dispatchFlag:!1,timeStamp:Date.now()})}get type(){return he(this).type}get target(){return he(this).target}get srcElement(){return he(this).target}get currentTarget(){return he(this).currentTarget}composedPath(){let e=he(this).currentTarget;return e?[e]:[]}get NONE(){return mo}get CAPTURING_PHASE(){return fo}get AT_TARGET(){return go}get BUBBLING_PHASE(){return yo}get eventPhase(){return he(this).dispatchFlag?2:0}stopPropagation(){he(this).stopPropagationFlag=!0}get cancelBubble(){return he(this).stopPropagationFlag}set cancelBubble(e){e?he(this).stopPropagationFlag=!0:_d.warn()}stopImmediatePropagation(){let e=he(this);e.stopPropagationFlag=e.stopImmediatePropagationFlag=!0}get bubbles(){return he(this).bubbles}get cancelable(){return he(this).cancelable}get returnValue(){return!he(this).canceledFlag}set returnValue(e){e?Nd.warn():wo(he(this))}preventDefault(){wo(he(this))}get defaultPrevented(){return he(this).canceledFlag}get composed(){return he(this).composed}get isTrusted(){return!1}get timeStamp(){return he(this).timeStamp}initEvent(e,t=!1,r=!1){let s=he(this);s.dispatchFlag?Pd.warn():En.set(this,{...s,type:String(e),bubbles:!!t,cancelable:!!r,target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1})}},mo=0,fo=1,go=2,yo=3,En=new WeakMap;function he(e,t="this"){let r=En.get(e);return Mi(r!=null,"'%s' must be an object that Event constructor created, but got another one: %o",t,e),r}function wo(e){e.inPassiveListenerFlag?Bd.warn():e.cancelable?e.canceledFlag=!0:Fd.warn()}Object.defineProperty(Ke,"NONE",{enumerable:!0}),Object.defineProperty(Ke,"CAPTURING_PHASE",{enumerable:!0}),Object.defineProperty(Ke,"AT_TARGET",{enumerable:!0}),Object.defineProperty(Ke,"BUBBLING_PHASE",{enumerable:!0});var Zs=Object.getOwnPropertyNames(Ke.prototype);for(let e=0;e<Zs.length;++e)Zs[e]!=="constructor"&&Object.defineProperty(Ke.prototype,Zs[e],{enumerable:!0});Ue!==void 0&&Ue.Event!==void 0&&Object.setPrototypeOf(Ke.prototype,Ue.Event.prototype);var vt,bo={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};function vo(e){let t=Object.keys(bo);for(let r=0;r<t.length;++r){let s=t[r],n=bo[s];Object.defineProperty(e,s,{get:()=>n,configurable:!0,enumerable:!0})}}var fs=class extends Ke{static wrap(e){return new(yl(e))(e)}constructor(e){super(e.type,{bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed}),e.cancelBubble&&super.stopPropagation(),e.defaultPrevented&&super.preventDefault(),gl.set(this,{original:e});let t=Object.keys(e);for(let r=0;r<t.length;++r){let s=t[r];s in this||Object.defineProperty(this,s,wl(e,s))}}stopPropagation(){super.stopPropagation();let{original:e}=nt(this);"stopPropagation"in e&&e.stopPropagation()}get cancelBubble(){return super.cancelBubble}set cancelBubble(e){super.cancelBubble=e;let{original:t}=nt(this);"cancelBubble"in t&&(t.cancelBubble=e)}stopImmediatePropagation(){super.stopImmediatePropagation();let{original:e}=nt(this);"stopImmediatePropagation"in e&&e.stopImmediatePropagation()}get returnValue(){return super.returnValue}set returnValue(e){super.returnValue=e;let{original:t}=nt(this);"returnValue"in t&&(t.returnValue=e)}preventDefault(){super.preventDefault();let{original:e}=nt(this);"preventDefault"in e&&e.preventDefault()}get timeStamp(){let{original:e}=nt(this);return"timeStamp"in e?e.timeStamp:super.timeStamp}},gl=new WeakMap;function nt(e){let t=gl.get(e);return Mi(t!=null,"'this' is expected an Event object, but got",e),t}var gs=new WeakMap;function yl(e){let t=Object.getPrototypeOf(e);if(t==null)return fs;let r=gs.get(t);return r==null&&(r=function(s,n){class i extends s{}let a=Object.keys(n);for(let o=0;o<a.length;++o)Object.defineProperty(i.prototype,a[o],wl(n,a[o]));return i}(yl(t),t),gs.set(t,r)),r}function wl(e,t){let r=Object.getOwnPropertyDescriptor(e,t);return{get(){let s=nt(this).original,n=s[t];return typeof n=="function"?n.bind(s):n},set(s){nt(this).original[t]=s},configurable:r.configurable,enumerable:r.enumerable}}function bl(e){return!(1&~e.flags)}function So(e){return!(2&~e.flags)}function Io(e){return!(4&~e.flags)}function jd(e){return!(8&~e.flags)}function Wd({callback:e},t,r){try{typeof e=="function"?e.call(t,r):typeof e.handleEvent=="function"&&e.handleEvent(r)}catch(s){(function(n){try{let i=n instanceof Error?n:new Error(fl(n));if(typeof dispatchEvent=="function"&&typeof ErrorEvent=="function")dispatchEvent(new ErrorEvent("error",{error:i,message:i.message}));else if(typeof process<"u"&&typeof process.emit=="function")return void process.emit("uncaughtException",i);console.error(i)}catch{}})(s)}}function vl({listeners:e},t,r){for(let s=0;s<e.length;++s)if(e[s].callback===t&&bl(e[s])===r)return s;return-1}function Co(e,t,r){let s=vl(e,t,r);return s!==-1&&Sl(e,s)}function Sl(e,t,r=!1){let s=e.listeners[t];return function(n){n.flags|=8}(s),s.signal&&s.signal.removeEventListener("abort",s.signalListener),e.cow&&!r?(e.cow=!1,e.listeners=e.listeners.filter((n,i)=>i!==t),!1):(e.listeners.splice(t,1),!0)}gs.set(Object.prototype,fs),Ue!==void 0&&Ue.Event!==void 0&&gs.set(Ue.Event.prototype,fs);var Ds=class{constructor(){Cl.set(this,Object.create(null))}addEventListener(e,t,r){let s=Qs(this),{callback:n,capture:i,once:a,passive:o,signal:l,type:c}=function(h,f,w){var p;return ko(f),typeof w=="object"&&w!==null?{type:String(h),callback:f??void 0,capture:!!w.capture,passive:!!w.passive,once:!!w.once,signal:(p=w.signal)!==null&&p!==void 0?p:void 0}:{type:String(h),callback:f??void 0,capture:!!w,passive:!1,once:!1,signal:void 0}}(e,t,r);if(n==null||l!=null&&l.aborted)return;let u=function(h,f){var w;return(w=h[f])!==null&&w!==void 0?w:h[f]={attrCallback:void 0,attrListener:void 0,cow:!1,listeners:[]}}(s,c),d=vl(u,n,i);d===-1?function(h,f,w,p,C,m){let g;m&&(g=Co.bind(null,h,f,w),m.addEventListener("abort",g));let v=function(I,O,E,A,M,k){return{callback:I,flags:(O?1:0)|(E?2:0)|(A?4:0),signal:M,signalListener:k}}(f,w,p,C,m,g);h.cow?(h.cow=!1,h.listeners=[...h.listeners,v]):h.listeners.push(v)}(u,n,i,o,a,l):function(h,f,w,p){zd.warn(bl(h)?"capture":"bubble",h.callback),So(h)!==f&&Xs.warn("passive"),Io(h)!==w&&Xs.warn("once"),h.signal!==p&&Xs.warn("signal")}(u.listeners[d],o,a,l)}removeEventListener(e,t,r){let s=Qs(this),{callback:n,capture:i,type:a}=function(l,c,u){return ko(c),typeof u=="object"&&u!==null?{type:String(l),callback:c??void 0,capture:!!u.capture}:{type:String(l),callback:c??void 0,capture:!!u}}(e,t,r),o=s[a];n!=null&&o&&Co(o,n,i)}dispatchEvent(e){let t=Qs(this)[String(e.type)];if(t==null)return!0;let r=e instanceof Ke?e:fs.wrap(e),s=he(r,"event");if(s.dispatchFlag)throw n="This event has been in dispatching.",Ue.DOMException?new Ue.DOMException(n,"InvalidStateError"):(vt==null&&(vt=class Il extends Error{constructor(a){super(a),Error.captureStackTrace&&Error.captureStackTrace(this,Il)}get code(){return 11}get name(){return"InvalidStateError"}},Object.defineProperties(vt.prototype,{code:{enumerable:!0},name:{enumerable:!0}}),vo(vt),vo(vt.prototype)),new vt(n));var n;if(s.dispatchFlag=!0,s.target=s.currentTarget=this,!s.stopPropagationFlag){let{cow:i,listeners:a}=t;t.cow=!0;for(let o=0;o<a.length;++o){let l=a[o];if(!jd(l)&&(Io(l)&&Sl(t,o,!i)&&(o-=1),s.inPassiveListenerFlag=So(l),Wd(l,this,r),s.inPassiveListenerFlag=!1,s.stopImmediatePropagationFlag))break}i||(t.cow=!1)}return s.target=null,s.currentTarget=null,s.stopImmediatePropagationFlag=!1,s.stopPropagationFlag=!1,s.dispatchFlag=!1,!s.canceledFlag}},Cl=new WeakMap;function Qs(e,t="this"){let r=Cl.get(e);return Mi(r!=null,"'%s' must be an object that EventTarget constructor created, but got another one: %o",t,e),r}function ko(e){if(typeof e!="function"&&(typeof e!="object"||e===null||typeof e.handleEvent!="function")){if(e==null||typeof e=="object")return void ho.warn(e);throw new TypeError(ml(ho.message,[e]))}}var en=Object.getOwnPropertyNames(Ds.prototype);for(let e=0;e<en.length;++e)en[e]!=="constructor"&&Object.defineProperty(Ds.prototype,en[e],{enumerable:!0});Ue!==void 0&&Ue.EventTarget!==void 0&&Object.setPrototypeOf(Ds.prototype,Ue.EventTarget.prototype);var Eo,Vd=((e,t,r)=>(r=e!=null?Ed(Rd(e)):{},((s,n,i,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of Td(n))!Ld.call(s,o)&&o!==i&&po(s,o,{get:()=>n[o],enumerable:!(a=xd(n,o))||a.enumerable});return s})(e&&e.__esModule?r:po(r,"default",{value:e,enumerable:!0}),e)))(Dd()),Ps=512e3,_s=256,xn=(e,{minChunkSize:t=_s,maxChunkSize:r=Ps}={})=>e==null||typeof e=="number"&&e>=256&&e%256==0&&e>=t&&e<=r,Tn=(e,{minChunkSize:t=_s,maxChunkSize:r=Ps}={})=>new TypeError(`chunkSize ${e} must be a positive number in multiples of 256, between ${t} and ${r}`),Hd=class{constructor(e,t={}){var r,s,n;if(this.readableStream=e,!xn(t.defaultChunkSize,t))throw Tn(t.defaultChunkSize,t);this.defaultChunkSize=(r=t.defaultChunkSize)!=null?r:30720,this.minChunkSize=(s=t.minChunkSize)!=null?s:_s,this.maxChunkSize=(n=t.maxChunkSize)!=null?n:Ps}get chunkSize(){var e;return(e=this._chunkSize)!=null?e:this.defaultChunkSize}set chunkSize(e){if(!xn(e,this))throw Tn(e,this);this._chunkSize=e}get chunkByteSize(){return 1024*this.chunkSize}async*[Symbol.asyncIterator](){let e,t=this.readableStream.getReader();try{for(;;){let{done:r,value:s}=await t.read();if(r){if(e){let i=e;e=void 0,yield i}break}let n=s instanceof Uint8Array?new Blob([s],{type:"application/octet-stream"}):s;for(e=e?new Blob([e,n]):n;e;){if(e.size===this.chunkByteSize){let i=e;e=void 0,yield i;break}if(e.size<this.chunkByteSize)break;{let i=e.slice(0,this.chunkByteSize);e=e.slice(this.chunkByteSize),yield i}}}}finally{if(e){let r=e;e=void 0,yield r}return void t.releaseLock()}}},Gd=[200,201,202,204,308],kl=[408,502,503,504],El=(e,t)=>!!e&&Gd.includes(e.statusCode),$d=(e,t)=>t.attemptCount>=t.attempts||!(El(e)||((r,{retryCodes:s=kl})=>!r||s.includes(r.statusCode))(e,t)),xl=class{static createUpload(e){return new xl(e)}constructor(e){this.endpoint=e.endpoint,this.file=e.file,this.headers=e.headers||{},this.method=e.method||"PUT",this.attempts=e.attempts||5,this.delayBeforeAttempt=e.delayBeforeAttempt||1,this.retryCodes=e.retryCodes||kl,this.dynamicChunkSize=e.dynamicChunkSize||!1,this.maxFileBytes=1024*(e.maxFileSize||0),this.chunkCount=0,this.attemptCount=0,this.offline=!1,this._paused=!1,this.success=!1,this.nextChunkRangeStart=0,this.chunkedStreamIterable=new Hd(this.file.stream(),{...e,defaultChunkSize:e.chunkSize}),this.chunkedStreamIterator=this.chunkedStreamIterable[Symbol.asyncIterator](),this.totalChunks=Math.ceil(this.file.size/this.chunkByteSize),this.eventTarget=new Ds,this.validateOptions(),this.getEndpoint().then(()=>this.sendChunks()),typeof window<"u"&&(window.addEventListener("online",()=>{!this.offline||(this.offline=!1,this.dispatch("online"),this.sendChunks())}),window.addEventListener("offline",()=>{this.offline=!0,this.dispatch("offline")}))}get maxChunkSize(){var e,t;return(t=(e=this.chunkedStreamIterable)==null?void 0:e.maxChunkSize)!=null?t:Ps}get minChunkSize(){var e,t;return(t=(e=this.chunkedStreamIterable)==null?void 0:e.minChunkSize)!=null?t:_s}get chunkSize(){var e,t;return(t=(e=this.chunkedStreamIterable)==null?void 0:e.chunkSize)!=null?t:30720}set chunkSize(e){this.chunkedStreamIterable.chunkSize=e}get chunkByteSize(){return this.chunkedStreamIterable.chunkByteSize}get totalChunkSize(){return Math.ceil(this.file.size/this.chunkByteSize)}on(e,t){this.eventTarget.addEventListener(e,t)}once(e,t){this.eventTarget.addEventListener(e,t,{once:!0})}off(e,t){this.eventTarget.removeEventListener(e,t)}get paused(){return this._paused}abort(){var e;this.pause(),(e=this.currentXhr)==null||e.abort()}pause(){this._paused=!0}resume(){this._paused&&(this._paused=!1,this.sendChunks())}dispatch(e,t){let r=new CustomEvent(e,{detail:t});this.eventTarget.dispatchEvent(r)}validateOptions(){if(!this.endpoint||typeof this.endpoint!="function"&&typeof this.endpoint!="string")throw new TypeError("endpoint must be defined as a string or a function that returns a promise");if(!(this.file instanceof File))throw new TypeError("file must be a File object");if(this.headers&&typeof this.headers!="function"&&typeof this.headers!="object")throw new TypeError("headers must be null, an object, or a function that returns an object or a promise");if(!xn(this.chunkSize,{maxChunkSize:this.maxChunkSize,minChunkSize:this.minChunkSize}))throw Tn(this.chunkSize,{maxChunkSize:this.maxChunkSize,minChunkSize:this.minChunkSize});if(this.maxChunkSize&&(typeof this.maxChunkSize!="number"||this.maxChunkSize<256||this.maxChunkSize%256!=0||this.maxChunkSize<this.chunkSize||this.maxChunkSize<this.minChunkSize))throw new TypeError(`maxChunkSize must be a positive number in multiples of 256, and larger than or equal to both ${this.minChunkSize} and ${this.chunkSize}`);if(this.minChunkSize&&(typeof this.minChunkSize!="number"||this.minChunkSize<256||this.minChunkSize%256!=0||this.minChunkSize>this.chunkSize||this.minChunkSize>this.maxChunkSize))throw new TypeError(`minChunkSize must be a positive number in multiples of 256, and smaller than ${this.chunkSize} and ${this.maxChunkSize}`);if(this.maxFileBytes>0&&this.maxFileBytes<this.file.size)throw new Error(`file size exceeds maximum (${this.file.size} > ${this.maxFileBytes})`);if(this.attempts&&(typeof this.attempts!="number"||this.attempts<=0))throw new TypeError("retries must be a positive number");if(this.delayBeforeAttempt&&(typeof this.delayBeforeAttempt!="number"||this.delayBeforeAttempt<0))throw new TypeError("delayBeforeAttempt must be a positive number")}getEndpoint(){return typeof this.endpoint=="string"?(this.endpointValue=this.endpoint,Promise.resolve(this.endpoint)):this.endpoint(this.file).then(e=>(this.endpointValue=e,this.endpointValue))}xhrPromise(e){let t=r=>{r.upload.onprogress=s=>{var n;let i=this.totalChunks-this.chunkCount,a=(this.file.size-this.nextChunkRangeStart)/this.file.size/i,o=this.nextChunkRangeStart/this.file.size,l=s.loaded/((n=s.total)!=null?n:this.chunkByteSize)*a;this.dispatch("progress",Math.min(100*(o+l),100))}};return new Promise((r,s)=>{this.currentXhr=(0,Vd.default)({...e,beforeSend:t},(n,i)=>(this.currentXhr=void 0,n?s(n):r(i)))})}async sendChunk(e){let t=this.nextChunkRangeStart,r=t+e.size-1,s={...await(typeof this.headers=="function"?this.headers():this.headers),"Content-Type":this.file.type,"Content-Range":`bytes ${t}-${r}/${this.file.size}`};return this.dispatch("attempt",{chunkNumber:this.chunkCount,totalChunks:this.totalChunks,chunkSize:this.chunkSize}),this.xhrPromise({headers:s,url:this.endpointValue,method:this.method,body:e})}async sendChunkWithRetries(e){let t;try{this.attemptCount=this.attemptCount+1,this.lastChunkStart=new Date,t=await this.sendChunk(e)}catch{}let r={retryCodes:this.retryCodes,attemptCount:this.attemptCount,attempts:this.attempts};return El(t)?(async s=>{var n;let i=(new Date().getTime()-this.lastChunkStart.getTime())/1e3;if(this.dispatch("chunkSuccess",{chunk:this.chunkCount,chunkSize:this.chunkSize,attempts:this.attemptCount,timeInterval:i,response:s}),this.attemptCount=0,this.chunkCount=((n=this.chunkCount)!=null?n:0)+1,this.nextChunkRangeStart=this.nextChunkRangeStart+this.chunkByteSize,this.dynamicChunkSize){let a=this.chunkSize;i<10?a=Math.min(2*this.chunkSize,this.maxChunkSize):i>30&&(a=Math.max(this.chunkSize/2,this.minChunkSize)),this.chunkSize=256*Math.ceil(a/256);let o=(this.file.size-this.nextChunkRangeStart)/this.chunkByteSize;this.totalChunks=Math.ceil(this.chunkCount+o)}return!0})(t):$d(t,r)?(async s=>(this.dispatch("error",{message:`Server responded with ${s.statusCode}. Stopping upload.`,chunk:this.chunkCount,attempts:this.attemptCount}),!1))(t):(async()=>(this.dispatch("attemptFailure",{message:`An error occured uploading chunk ${this.chunkCount}. ${this.attempts-this.attemptCount} retries left.`,chunkNumber:this.chunkCount,attemptsLeft:this.attempts-this.attemptCount}),new Promise(s=>{setTimeout(async()=>{if(this._paused||this.offline)return this.pendingChunk=e,void s(!1);let n=await this.sendChunkWithRetries(e);s(n)},1e3*this.delayBeforeAttempt)})))()}async sendChunks(){if(this.pendingChunk&&!this._paused&&!this.offline){let e=this.pendingChunk;this.pendingChunk=void 0;let t=await this.sendChunkWithRetries(e);this.success&&t&&this.dispatch("success")}for(;!(this.success||this._paused||this.offline);){let{value:e,done:t}=await this.chunkedStreamIterator.next(),r=!e&&t;if(e&&(r=await this.sendChunkWithRetries(e)),this.success=!!t,this.success&&r&&this.dispatch("success"),!r)return}}},Yd=xl.createUpload,qd=Object.defineProperty,x=(e,t,r)=>((s,n,i)=>n in s?qd(s,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[n]=i)(e,typeof t!="symbol"?t+"":t,r),Jd=Object.defineProperty,xo=(e,t,r)=>((s,n,i)=>n in s?Jd(s,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[n]=i)(e,typeof t!="symbol"?t+"":t,r),fe=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(fe||{});const To={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Ro={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Ir={};function Ui(e){if(Ir[e])return Ir[e];const t=globalThis[e],r=t.prototype,s=e in To?To[e]:void 0,n=!!(s&&s.every(o=>{var l,c;return!!((c=(l=Object.getOwnPropertyDescriptor(r,o))==null?void 0:l.get)!=null&&c.toString().includes("[native code]"))})),i=e in Ro?Ro[e]:void 0,a=!!(i&&i.every(o=>{var l;return typeof r[o]=="function"&&((l=r[o])==null?void 0:l.toString().includes("[native code]"))}));if(n&&a)return Ir[e]=t.prototype,t.prototype;try{const o=document.createElement("iframe");document.body.appendChild(o);const l=o.contentWindow;if(!l)return t.prototype;const c=l[e].prototype;return document.body.removeChild(o),c?Ir[e]=c:r}catch{return r}}const tn={};function tt(e,t,r){var s;const n=`${e}.${String(r)}`;if(tn[n])return tn[n].call(t);const i=Ui(e),a=(s=Object.getOwnPropertyDescriptor(i,r))==null?void 0:s.get;return a?(tn[n]=a,a.call(t)):t[r]}const rn={};function Lo(e,t,r){const s=`${e}.${String(r)}`;if(rn[s])return rn[s].bind(t);const n=Ui(e)[r];return typeof n!="function"?t[r]:(rn[s]=n,n.bind(t))}const ye={childNodes:function(e){return tt("Node",e,"childNodes")},parentNode:function(e){return tt("Node",e,"parentNode")},parentElement:function(e){return tt("Node",e,"parentElement")},textContent:function(e){return tt("Node",e,"textContent")},contains:function(e,t){return Lo("Node",e,"contains")(t)},getRootNode:function(e){return Lo("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?tt("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?tt("Element",e,"shadowRoot"):null},querySelector:function(e,t){return tt("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return tt("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return Ui("MutationObserver").constructor}};function Tl(e){return e.nodeType===e.ELEMENT_NODE}function Xt(e){const t=e&&"host"in e&&"mode"in e&&ye.host(e)||null;return!!(t&&"shadowRoot"in t&&ye.shadowRoot(t)===e)}function Zt(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Jr(e){try{const r=e.rules||e.cssRules;return r?((t=Array.from(r,n=>Rl(n,e.href)).join("")).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t):null}catch{return null}var t}function Rl(e,t){if(function(r){return"styleSheet"in r}(e)){let r;try{r=Jr(e.styleSheet)||function(s){const{cssText:n}=s;if(n.split('"').length<3)return n;const i=["@import",`url(${JSON.stringify(s.href)})`];return s.layerName===""?i.push("layer"):s.layerName&&i.push(`layer(${s.layerName})`),s.supportsText&&i.push(`supports(${s.supportsText})`),s.media.length&&i.push(s.media.mediaText),i.join(" ")+";"}(e)}catch{r=e.cssText}return e.styleSheet.href?ys(r,e.styleSheet.href):r}{let r=e.cssText;return function(s){return"selectorText"in s}(e)&&e.selectorText.includes(":")&&(r=function(s){const n=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return s.replace(n,"$1\\$2")}(r)),t?ys(r,t):r}}class Ll{constructor(){xo(this,"idNodeMap",new Map),xo(this,"nodeMetaMap",new WeakMap)}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(s=>this.removeNodeFromMap(s))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){const s=r.id;this.idNodeMap.set(s,t),this.nodeMetaMap.set(t,r)}replace(t,r){const s=this.getNode(t);if(s){const n=this.nodeMetaMap.get(s);n&&this.nodeMetaMap.set(r,n)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Di({element:e,maskInputOptions:t,tagName:r,type:s,value:n,maskInputFn:i}){let a=n||"";const o=s&&ft(s);return(t[r.toLowerCase()]||o&&t[o])&&(a=i?i(a,e):"*".repeat(a.length)),a}function ft(e){return e.toLowerCase()}const Oo="__rrweb_original__";function Pi(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?ft(t):null}function Ao(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}const s=r.pathname.match(/\.([0-9a-z]+)(?:$)/i);return(s==null?void 0:s[1])??null}const Kd=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Xd=/^(?:[a-z+]+:)?\/\//i,Zd=/^www\..*/i,Qd=/^(data:)([^,]*),(.*)/i;function ys(e,t){return(e||"").replace(Kd,(r,s,n,i,a,o)=>{const l=n||a||o,c=s||i||"";if(!l)return r;if(Xd.test(l)||Zd.test(l))return`url(${c}${l}${c})`;if(Qd.test(l))return`url(${c}${l}${c})`;if(l[0]==="/")return`url(${c}${function(h){let f="";return f=h.indexOf("//")>-1?h.split("/").slice(0,3).join("/"):h.split("/")[0],f=f.split("?")[0],f}(t)+l}${c})`;const u=t.split("/"),d=l.split("/");u.pop();for(const h of d)h!=="."&&(h===".."?u.pop():u.push(h));return`url(${c}${u.join("/")}${c})`})}let ep=1;const tp=new RegExp("[^a-z0-9-_:]");function Ol(){return ep++}let St,Mo;const rp=/^[^ \t\n\r\u000c]+/,sp=/^[, \t\n\r\u000c]+/,Uo=new WeakMap;function Ft(e,t){return t&&t.trim()!==""?_i(e,t):t}function np(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function _i(e,t){let r=Uo.get(e);if(r||(r=e.createElement("a"),Uo.set(e,r)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return r.setAttribute("href",t),r.href}function Al(e,t,r,s){return s&&(r==="src"||r==="href"&&(t!=="use"||s[0]!=="#")||r==="xlink:href"&&s[0]!=="#"?Ft(e,s):r!=="background"||t!=="table"&&t!=="td"&&t!=="th"?r==="srcset"?function(n,i){if(i.trim()==="")return i;let a=0;function o(c){let u;const d=c.exec(i.substring(a));return d?(u=d[0],a+=u.length,u):""}const l=[];for(;o(sp),!(a>=i.length);){let c=o(rp);if(c.slice(-1)===",")c=Ft(n,c.substring(0,c.length-1)),l.push(c);else{let u="";c=Ft(n,c);let d=!1;for(;;){const h=i.charAt(a);if(h===""){l.push((c+u).trim());break}if(d)h===")"&&(d=!1);else{if(h===","){a+=1,l.push((c+u).trim());break}h==="("&&(d=!0)}u+=h,a+=1}}}return l.join(", ")}(e,s):r==="style"?ys(s,_i(e)):t==="object"&&r==="data"?Ft(e,s):s:Ft(e,s))}function Ml(e,t,r){return(e==="video"||e==="audio")&&t==="autoplay"}function ws(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&ws(ye.parentNode(e),t,r);for(let s=e.classList.length;s--;){const n=e.classList[s];if(t.test(n))return!0}return!!r&&ws(ye.parentNode(e),t,r)}function Ul(e,t,r,s){let n;if(Tl(e)){if(n=e,!ye.childNodes(n).length)return!1}else{if(ye.parentElement(e)===null)return!1;n=ye.parentElement(e)}try{if(typeof t=="string"){if(s){if(n.closest(`.${t}`))return!0}else if(n.classList.contains(t))return!0}else if(ws(n,t,s))return!0;if(r){if(s){if(n.closest(r))return!0}else if(n.matches(r))return!0}}catch{}return!1}function ip(e,t){const{doc:r,mirror:s,blockClass:n,blockSelector:i,needsMask:a,inlineStylesheet:o,maskInputOptions:l={},maskTextFn:c,maskInputFn:u,dataURLOptions:d={},inlineImages:h,recordCanvas:f,keepIframeSrcFn:w,newlyAddedElement:p=!1}=t,C=function(m,g){if(!g.hasNode(m))return;const v=g.getId(m);return v===1?void 0:v}(r,s);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:fe.Document,childNodes:[],compatMode:e.compatMode}:{type:fe.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:fe.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:C};case e.ELEMENT_NODE:return function(m,g){const{doc:v,blockClass:I,blockSelector:O,inlineStylesheet:E,maskInputOptions:A={},maskInputFn:M,dataURLOptions:k={},inlineImages:T,recordCanvas:R,keepIframeSrcFn:S,newlyAddedElement:P=!1,rootId:D}=g,b=function(L,N,ee){try{if(typeof N=="string"){if(L.classList.contains(N))return!0}else for(let q=L.classList.length;q--;){const me=L.classList[q];if(N.test(me))return!0}if(ee)return L.matches(ee)}catch{}return!1}(m,I,O),y=function(L){if(L instanceof HTMLFormElement)return"form";const N=ft(L.tagName);return tp.test(N)?"div":N}(m);let U={};const F=m.attributes.length;for(let L=0;L<F;L++){const N=m.attributes[L];Ml(y,N.name,N.value)||(U[N.name]=Al(v,y,ft(N.name),N.value))}if(y==="link"&&E){const L=Array.from(v.styleSheets).find(ee=>ee.href===m.href);let N=null;L&&(N=Jr(L)),N&&(delete U.rel,delete U.href,U._cssText=N)}if(y==="style"&&m.sheet&&!(m.innerText||ye.textContent(m)||"").trim().length){const L=Jr(m.sheet);L&&(U._cssText=L)}if(y==="input"||y==="textarea"||y==="select"){const L=m.value,N=m.checked;U.type!=="radio"&&U.type!=="checkbox"&&U.type!=="submit"&&U.type!=="button"&&L?U.value=Di({element:m,type:Pi(m),tagName:y,value:L,maskInputOptions:A,maskInputFn:M}):N&&(U.checked=N)}if(y==="option"&&(m.selected&&!A.select?U.selected=!0:delete U.selected),y==="dialog"&&m.open&&(U.rr_open_mode=m.matches("dialog:modal")?"modal":"non-modal"),y==="canvas"&&R){if(m.__context==="2d")(function(L){const N=L.getContext("2d");if(!N)return!0;for(let ee=0;ee<L.width;ee+=50)for(let q=0;q<L.height;q+=50){const me=N.getImageData,Ne=Oo in me?me[Oo]:me;if(new Uint32Array(Ne.call(N,ee,q,Math.min(50,L.width-ee),Math.min(50,L.height-q)).data.buffer).some(we=>we!==0))return!1}return!0})(m)||(U.rr_dataURL=m.toDataURL(k.type,k.quality));else if(!("__context"in m)){const L=m.toDataURL(k.type,k.quality),N=v.createElement("canvas");N.width=m.width,N.height=m.height,L!==N.toDataURL(k.type,k.quality)&&(U.rr_dataURL=L)}}if(y==="img"&&T){St||(St=v.createElement("canvas"),Mo=St.getContext("2d"));const L=m,N=L.currentSrc||L.getAttribute("src")||"<unknown-src>",ee=L.crossOrigin,q=()=>{L.removeEventListener("load",q);try{St.width=L.naturalWidth,St.height=L.naturalHeight,Mo.drawImage(L,0,0),U.rr_dataURL=St.toDataURL(k.type,k.quality)}catch(me){if(L.crossOrigin!=="anonymous")return L.crossOrigin="anonymous",void(L.complete&&L.naturalWidth!==0?q():L.addEventListener("load",q));console.warn(`Cannot inline img src=${N}! Error: ${me}`)}L.crossOrigin==="anonymous"&&(ee?U.crossOrigin=ee:L.removeAttribute("crossorigin"))};L.complete&&L.naturalWidth!==0?q():L.addEventListener("load",q)}if(y==="audio"||y==="video"){const L=U;L.rr_mediaState=m.paused?"paused":"played",L.rr_mediaCurrentTime=m.currentTime,L.rr_mediaPlaybackRate=m.playbackRate,L.rr_mediaMuted=m.muted,L.rr_mediaLoop=m.loop,L.rr_mediaVolume=m.volume}if(P||(m.scrollLeft&&(U.rr_scrollLeft=m.scrollLeft),m.scrollTop&&(U.rr_scrollTop=m.scrollTop)),b){const{width:L,height:N}=m.getBoundingClientRect();U={class:U.class,rr_width:`${L}px`,rr_height:`${N}px`}}y!=="iframe"||S(U.src)||(m.contentDocument||(U.rr_src=U.src),delete U.src);let j;try{customElements.get(y)&&(j=!0)}catch{}return{type:fe.Element,tagName:y,attributes:U,childNodes:[],isSVG:np(m)||void 0,needBlock:b,rootId:D,isCustom:j}}(e,{doc:r,blockClass:n,blockSelector:i,inlineStylesheet:o,maskInputOptions:l,maskInputFn:u,dataURLOptions:d,inlineImages:h,recordCanvas:f,keepIframeSrcFn:w,newlyAddedElement:p,rootId:C});case e.TEXT_NODE:return function(m,g){var v;const{needsMask:I,maskTextFn:O,rootId:E}=g,A=ye.parentNode(m),M=A&&A.tagName;let k=ye.textContent(m);const T=M==="STYLE"||void 0,R=M==="SCRIPT"||void 0;if(T&&k){try{m.nextSibling||m.previousSibling||(v=A.sheet)!=null&&v.cssRules&&(k=Jr(A.sheet))}catch(S){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${S}`,m)}k=ys(k,_i(g.doc))}return R&&(k="SCRIPT_PLACEHOLDER"),!T&&!R&&k&&I&&(k=O?O(k,ye.parentElement(m)):k.replace(/[\S]/g,"*")),{type:fe.Text,textContent:k||"",isStyle:T,rootId:E}}(e,{doc:r,needsMask:a,maskTextFn:c,rootId:C});case e.CDATA_SECTION_NODE:return{type:fe.CDATA,textContent:"",rootId:C};case e.COMMENT_NODE:return{type:fe.Comment,textContent:ye.textContent(e)||"",rootId:C};default:return!1}}function te(e){return e==null?"":e.toLowerCase()}function xt(e,t){const{doc:r,mirror:s,blockClass:n,blockSelector:i,maskTextClass:a,maskTextSelector:o,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:h,slimDOMOptions:f,dataURLOptions:w={},inlineImages:p=!1,recordCanvas:C=!1,onSerialize:m,onIframeLoad:g,iframeLoadTimeout:v=5e3,onStylesheetLoad:I,stylesheetLoadTimeout:O=5e3,keepIframeSrcFn:E=()=>!1,newlyAddedElement:A=!1}=t;let{needsMask:M}=t,{preserveWhiteSpace:k=!0}=t;M||(M=Ul(e,a,o,M===void 0));const T=ip(e,{doc:r,mirror:s,blockClass:n,blockSelector:i,needsMask:M,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,dataURLOptions:w,inlineImages:p,recordCanvas:C,keepIframeSrcFn:E,newlyAddedElement:A});if(!T)return console.warn(e,"not serialized"),null;let R;R=s.hasNode(e)?s.getId(e):!function(b,y){return!!(y.comment&&b.type===fe.Comment||b.type===fe.Element&&(y.script&&(b.tagName==="script"||b.tagName==="link"&&(b.attributes.rel==="preload"||b.attributes.rel==="modulepreload")&&b.attributes.as==="script"||b.tagName==="link"&&b.attributes.rel==="prefetch"&&typeof b.attributes.href=="string"&&Ao(b.attributes.href)==="js")||y.headFavicon&&(b.tagName==="link"&&b.attributes.rel==="shortcut icon"||b.tagName==="meta"&&(te(b.attributes.name).match(/^msapplication-tile(image|color)$/)||te(b.attributes.name)==="application-name"||te(b.attributes.rel)==="icon"||te(b.attributes.rel)==="apple-touch-icon"||te(b.attributes.rel)==="shortcut icon"))||b.tagName==="meta"&&(y.headMetaDescKeywords&&te(b.attributes.name).match(/^description|keywords$/)||y.headMetaSocial&&(te(b.attributes.property).match(/^(og|twitter|fb):/)||te(b.attributes.name).match(/^(og|twitter):/)||te(b.attributes.name)==="pinterest")||y.headMetaRobots&&(te(b.attributes.name)==="robots"||te(b.attributes.name)==="googlebot"||te(b.attributes.name)==="bingbot")||y.headMetaHttpEquiv&&b.attributes["http-equiv"]!==void 0||y.headMetaAuthorship&&(te(b.attributes.name)==="author"||te(b.attributes.name)==="generator"||te(b.attributes.name)==="framework"||te(b.attributes.name)==="publisher"||te(b.attributes.name)==="progid"||te(b.attributes.property).match(/^article:/)||te(b.attributes.property).match(/^product:/))||y.headMetaVerification&&(te(b.attributes.name)==="google-site-verification"||te(b.attributes.name)==="yandex-verification"||te(b.attributes.name)==="csrf-token"||te(b.attributes.name)==="p:domain_verify"||te(b.attributes.name)==="verify-v1"||te(b.attributes.name)==="verification"||te(b.attributes.name)==="shopify-checkout-api-token"))))}(T,f)&&(k||T.type!==fe.Text||T.isStyle||T.textContent.replace(/^\s+|\s+$/gm,"").length)?Ol():-2;const S=Object.assign(T,{id:R});if(s.add(e,S),R===-2)return null;m&&m(e);let P=!l;if(S.type===fe.Element){P=P&&!S.needBlock,delete S.needBlock;const b=ye.shadowRoot(e);b&&Zt(b)&&(S.isShadowHost=!0)}if((S.type===fe.Document||S.type===fe.Element)&&P){f.headWhitespace&&S.type===fe.Element&&S.tagName==="head"&&(k=!1);const b={doc:r,mirror:s,blockClass:n,blockSelector:i,needsMask:M,maskTextClass:a,maskTextSelector:o,skipChild:l,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,slimDOMOptions:f,dataURLOptions:w,inlineImages:p,recordCanvas:C,preserveWhiteSpace:k,onSerialize:m,onIframeLoad:g,iframeLoadTimeout:v,onStylesheetLoad:I,stylesheetLoadTimeout:O,keepIframeSrcFn:E};if(!(S.type===fe.Element&&S.tagName==="textarea"&&S.attributes.value!==void 0))for(const U of Array.from(ye.childNodes(e))){const F=xt(U,b);F&&S.childNodes.push(F)}let y=null;if(Tl(e)&&(y=ye.shadowRoot(e)))for(const U of Array.from(ye.childNodes(y))){const F=xt(U,b);F&&(Zt(y)&&(F.isShadow=!0),S.childNodes.push(F))}}const D=ye.parentNode(e);return D&&Xt(D)&&Zt(D)&&(S.isShadow=!0),S.type===fe.Element&&S.tagName==="iframe"&&function(b,y,U){const F=b.contentWindow;if(!F)return;let j,L=!1;try{j=F.document.readyState}catch{return}if(j!=="complete"){const ee=setTimeout(()=>{L||(y(),L=!0)},U);return void b.addEventListener("load",()=>{clearTimeout(ee),L=!0,y()})}const N="about:blank";if(F.location.href!==N||b.src===N||b.src==="")return setTimeout(y,0),b.addEventListener("load",y);b.addEventListener("load",y)}(e,()=>{const b=e.contentDocument;if(b&&g){const y=xt(b,{doc:b,mirror:s,blockClass:n,blockSelector:i,needsMask:M,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,slimDOMOptions:f,dataURLOptions:w,inlineImages:p,recordCanvas:C,preserveWhiteSpace:k,onSerialize:m,onIframeLoad:g,iframeLoadTimeout:v,onStylesheetLoad:I,stylesheetLoadTimeout:O,keepIframeSrcFn:E});y&&g(e,y)}},v),S.type===fe.Element&&S.tagName==="link"&&typeof S.attributes.rel=="string"&&(S.attributes.rel==="stylesheet"||S.attributes.rel==="preload"&&typeof S.attributes.href=="string"&&Ao(S.attributes.href)==="css")&&function(b,y,U){let F,j=!1;try{F=b.sheet}catch{return}if(F)return;const L=setTimeout(()=>{j||(y(),j=!0)},U);b.addEventListener("load",()=>{clearTimeout(L),j=!0,y()})}(e,()=>{if(I){const b=xt(e,{doc:r,mirror:s,blockClass:n,blockSelector:i,needsMask:M,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,slimDOMOptions:f,dataURLOptions:w,inlineImages:p,recordCanvas:C,preserveWhiteSpace:k,onSerialize:m,onIframeLoad:g,iframeLoadTimeout:v,onStylesheetLoad:I,stylesheetLoadTimeout:O,keepIframeSrcFn:E});b&&I(e,b)}},O),S}function op(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ap(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function s(){return this instanceof s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(r,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}),r}var Rn={exports:{}},ie=String,Do=function(){return{isColorSupported:!1,reset:ie,bold:ie,dim:ie,italic:ie,underline:ie,inverse:ie,hidden:ie,strikethrough:ie,black:ie,red:ie,green:ie,yellow:ie,blue:ie,magenta:ie,cyan:ie,white:ie,gray:ie,bgBlack:ie,bgRed:ie,bgGreen:ie,bgYellow:ie,bgBlue:ie,bgMagenta:ie,bgCyan:ie,bgWhite:ie}};Rn.exports=Do(),Rn.exports.createColors=Do;var lp=Rn.exports;const Pe=ap(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));let Po=lp,_o=Pe,Ln=class Dl extends Error{constructor(t,r,s,n,i,a){super(t),this.name="CssSyntaxError",this.reason=t,i&&(this.file=i),n&&(this.source=n),a&&(this.plugin=a),r!==void 0&&s!==void 0&&(typeof r=="number"?(this.line=r,this.column=s):(this.line=r.line,this.column=r.column,this.endLine=s.line,this.endColumn=s.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,Dl)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",this.line!==void 0&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(t){if(!this.source)return"";let r=this.source;t==null&&(t=Po.isColorSupported),_o&&t&&(r=_o(r));let s,n,i=r.split(/\r?\n/),a=Math.max(this.line-3,0),o=Math.min(this.line+2,i.length),l=String(o).length;if(t){let{bold:c,gray:u,red:d}=Po.createColors(!0);s=h=>c(d(h)),n=h=>u(h)}else s=n=c=>c;return i.slice(a,o).map((c,u)=>{let d=a+1+u,h=" "+(" "+d).slice(-l)+" | ";if(d===this.line){let f=n(h.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return s(">")+n(h)+c+` `+f+s("^")}return" "+n(h)+c}).join(` `)}toString(){let t=this.showSourceCode();return t&&(t=` `+t+` `),this.name+": "+this.message+t}};var Ni=Ln;Ln.default=Ln;var ir={};ir.isClean=Symbol("isClean"),ir.my=Symbol("my");const No={after:` `,beforeClose:` `,beforeComment:` `,beforeDecl:` `,beforeOpen:" ",beforeRule:` `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};let On=class{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,s=e.params?this.rawValue(e,"params"):"";if(e.raws.afterName!==void 0?r+=e.raws.afterName:s&&(r+=" "),e.nodes)this.block(e,r+s);else{let n=(e.raws.between||"")+(t?";":"");this.builder(r+s+n,e)}}beforeAfter(e,t){let r;r=e.type==="decl"?this.raw(e,null,"beforeDecl"):e.type==="comment"?this.raw(e,null,"beforeComment"):t==="before"?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let s=e.parent,n=0;for(;s&&s.type!=="root";)n+=1,s=s.parent;if(r.includes(` `)){let i=this.raw(e,null,"indent");if(i.length)for(let a=0;a<n;a++)r+=i}return r}block(e,t){let r,s=this.raw(e,"between","beforeOpen");this.builder(t+s+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),r=this.raw(e,"after")):r=this.raw(e,"after","emptyBody"),r&&this.builder(r),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&e.nodes[t].type==="comment";)t-=1;let r=this.raw(e,"semicolon");for(let s=0;s<e.nodes.length;s++){let n=e.nodes[s],i=this.raw(n,"before");i&&this.builder(i),this.stringify(n,t!==s||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),s=e.prop+r+this.rawValue(e,"value");e.important&&(s+=e.raws.important||" !important"),t&&(s+=";"),this.builder(s,e)}document(e){this.body(e)}raw(e,t,r){let s;if(r||(r=t),t&&(s=e.raws[t],s!==void 0))return s;let n=e.parent;if(r==="before"&&(!n||n.type==="root"&&n.first===e||n&&n.type==="document"))return"";if(!n)return No[r];let i=e.root();if(i.rawCache||(i.rawCache={}),i.rawCache[r]!==void 0)return i.rawCache[r];if(r==="before"||r==="after")return this.beforeAfter(e,r);{let o="raw"+((a=r)[0].toUpperCase()+a.slice(1));this[o]?s=this[o](i,e):i.walk(l=>{if(s=l.raws[t],s!==void 0)return!1})}var a;return s===void 0&&(s=No[r]),i.rawCache[r]=s,s}rawBeforeClose(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length>0&&r.raws.after!==void 0)return t=r.raws.after,t.includes(` `)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(s=>{if(s.raws.before!==void 0)return r=s.raws.before,r.includes(` `)&&(r=r.replace(/[^\n]+$/,"")),!1}),r===void 0?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(s=>{if(s.raws.before!==void 0)return r=s.raws.before,r.includes(` `)&&(r=r.replace(/[^\n]+$/,"")),!1}),r===void 0?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(r=>{if(r.type!=="decl"&&(t=r.raws.between,t!==void 0))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&r.raws.before!==void 0)return t=r.raws.before,t.includes(` `)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(r=>{if(r.raws.between!==void 0)return t=r.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length===0&&(t=r.raws.after,t!==void 0))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let s=r.parent;if(s&&s!==e&&s.parent&&s.parent===e&&r.raws.before!==void 0){let n=r.raws.before.split(` `);return t=n[n.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(t=r.raws.semicolon,t!==void 0))return!1}),t}rawValue(e,t){let r=e[t],s=e.raws[t];return s&&s.value===r?s.raw:r}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 Pl=On;On.default=On;let cp=Pl;function An(e,t){new cp(t).stringify(e)}var Ns=An;An.default=An;let{isClean:Cr,my:up}=ir,dp=Ni,pp=Pl,hp=Ns;function Mn(e,t){let r=new e.constructor;for(let s in e){if(!Object.prototype.hasOwnProperty.call(e,s)||s==="proxyCache")continue;let n=e[s],i=typeof n;s==="parent"&&i==="object"?t&&(r[s]=t):s==="source"?r[s]=n:Array.isArray(n)?r[s]=n.map(a=>Mn(a,r)):(i==="object"&&n!==null&&(n=Mn(n)),r[s]=n)}return r}let Un=class{constructor(e={}){this.raws={},this[Cr]=!1,this[up]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let r of e[t])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}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=Mn(this);for(let r in e)t[r]=e[r];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:r,start:s}=this.rangeBy(t);return this.source.input.error(e,{column:s.column,line:s.line},{column:r.column,line:r.line},t)}return new dp(e)}getProxyProcessor(){return{get:(e,t)=>t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,t!=="prop"&&t!=="value"&&t!=="name"&&t!=="params"&&t!=="important"&&t!=="text"||e.markDirty()),!0)}}markDirty(){if(this[Cr]){this[Cr]=!1;let e=this;for(;e=e.parent;)e[Cr]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){let s=(t=this.toString()).indexOf(e.word);s!==-1&&(r=this.positionInside(s,t))}return r}positionInside(e,t){let r=t||this.toString(),s=this.source.start.column,n=this.source.start.line;for(let i=0;i<e;i++)r[i]===` `?(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},r=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),r=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?r={column:e.end.column,line:e.end.line}:typeof e.endIndex=="number"?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return new pp()