var nre=Object.defineProperty;var ore=(l,n,o)=>n in l?nre(l,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):l[n]=o;var f4=(l,n,o)=>(ore(l,typeof n!="symbol"?n+"":n,o),o);import{a as HK,c as sre,g as rre,f as ire}from"./index-D7jpPlDx.js";import{g as a1}from"./index-BRx_-aOC.js";var are=Object.create,UK=Object.defineProperty,lre=Object.getOwnPropertyDescriptor,VK=Object.getOwnPropertyNames,cre=Object.getPrototypeOf,ure=Object.prototype.hasOwnProperty,E0=(l,n)=>function(){return n||(0,l[VK(l)[0]])((n={exports:{}}).exports,n),n.exports},dre=(l,n,o,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let u of VK(n))!ure.call(l,u)&&u!==o&&UK(l,u,{get:()=>n[u],enumerable:!(i=lre(n,u))||i.enumerable});return l},Ja=(l,n,o)=>(o=l!=null?are(cre(l)):{},dre(n||!l||!l.__esModule?UK(o,"default",{value:l,enumerable:!0}):o,l)),td=E0({"node_modules/alpinejs/dist/module.cjs.js"(l,n){var o=Object.create,i=Object.defineProperty,u=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyNames,g=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty,S=(F,M)=>function(){return M||(0,F[h(F)[0]])((M={exports:{}}).exports,M),M.exports},T=(F,M)=>{for(var Ee in M)i(F,Ee,{get:M[Ee],enumerable:!0})},k=(F,M,Ee,Ve)=>{if(M&&typeof M=="object"||typeof M=="function")for(let tt of h(M))!b.call(F,tt)&&tt!==Ee&&i(F,tt,{get:()=>M[tt],enumerable:!(Ve=u(M,tt))||Ve.enumerable});return F},R=(F,M,Ee)=>(Ee=F!=null?o(g(F)):{},k(M||!F||!F.__esModule?i(Ee,"default",{value:F,enumerable:!0}):Ee,F)),V=F=>k(i({},"__esModule",{value:!0}),F),z=S({"node_modules/@vue/shared/dist/shared.cjs.js"(F){Object.defineProperty(F,"__esModule",{value:!0});function M(Bt,io){const Qn=Object.create(null),Po=Bt.split(",");for(let Js=0;Js<Po.length;Js++)Qn[Po[Js]]=!0;return io?Js=>!!Qn[Js.toLowerCase()]:Js=>!!Qn[Js]}var Ee={1:"TEXT",2:"CLASS",4:"STYLE",8:"PROPS",16:"FULL_PROPS",32:"HYDRATE_EVENTS",64:"STABLE_FRAGMENT",128:"KEYED_FRAGMENT",256:"UNKEYED_FRAGMENT",512:"NEED_PATCH",1024:"DYNAMIC_SLOTS",2048:"DEV_ROOT_FRAGMENT",[-1]:"HOISTED",[-2]:"BAIL"},Ve={1:"STABLE",2:"DYNAMIC",3:"FORWARDED"},tt="Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt",Ze=M(tt),pt=2;function gt(Bt,io=0,Qn=Bt.length){let Po=Bt.split(/(\r?\n)/);const Js=Po.filter((ce,Ne)=>Ne%2===1);Po=Po.filter((ce,Ne)=>Ne%2===0);let N=0;const X=[];for(let ce=0;ce<Po.length;ce++)if(N+=Po[ce].length+(Js[ce]&&Js[ce].length||0),N>=io){for(let Ne=ce-pt;Ne<=ce+pt||Qn>N;Ne++){if(Ne<0||Ne>=Po.length)continue;const We=Ne+1;X.push(`${We}${" ".repeat(Math.max(3-String(We).length,0))}|  ${Po[Ne]}`);const Kt=Po[Ne].length,Yn=Js[Ne]&&Js[Ne].length||0;if(Ne===ce){const Co=io-(N-(Kt+Yn)),$o=Math.max(1,Qn>N?Kt-Co:Qn-io);X.push("   |  "+" ".repeat(Co)+"^".repeat($o))}else if(Ne>ce){if(Qn>N){const Co=Math.max(Math.min(Qn-N,Kt),1);X.push("   |  "+"^".repeat(Co))}N+=Kt+Yn}}break}return X.join(`
`)}var ln="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Io=M(ln),ss=M(ln+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected"),Sr=/[>/="'\u0009\u000a\u000c\u0020]/,vs={};function _s(Bt){if(vs.hasOwnProperty(Bt))return vs[Bt];const io=Sr.test(Bt);return io&&console.error(`unsafe attribute name: ${Bt}`),vs[Bt]=!io}var ki={acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},Sl=M("animation-iteration-count,border-image-outset,border-image-slice,border-image-width,box-flex,box-flex-group,box-ordinal-group,column-count,columns,flex,flex-grow,flex-positive,flex-shrink,flex-negative,flex-order,grid-row,grid-row-end,grid-row-span,grid-row-start,grid-column,grid-column-end,grid-column-span,grid-column-start,font-weight,line-clamp,line-height,opacity,order,orphans,tab-size,widows,z-index,zoom,fill-opacity,flood-opacity,stop-opacity,stroke-dasharray,stroke-dashoffset,stroke-miterlimit,stroke-opacity,stroke-width"),ns=M("accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap");function Vs(Bt){if(Ji(Bt)){const io={};for(let Qn=0;Qn<Bt.length;Qn++){const Po=Bt[Qn],Js=Vs(ma(Po)?Wn(Po):Po);if(Js)for(const N in Js)io[N]=Js[N]}return io}else if(oi(Bt))return Bt}var xs=/;(?![^(]*\))/g,ks=/:(.+)/;function Wn(Bt){const io={};return Bt.split(xs).forEach(Qn=>{if(Qn){const Po=Qn.split(ks);Po.length>1&&(io[Po[0].trim()]=Po[1].trim())}}),io}function cr(Bt){let io="";if(!Bt)return io;for(const Qn in Bt){const Po=Bt[Qn],Js=Qn.startsWith("--")?Qn:Ua(Qn);(ma(Po)||typeof Po=="number"&&Sl(Js))&&(io+=`${Js}:${Po};`)}return io}function el(Bt){let io="";if(ma(Bt))io=Bt;else if(Ji(Bt))for(let Qn=0;Qn<Bt.length;Qn++){const Po=el(Bt[Qn]);Po&&(io+=Po+" ")}else if(oi(Bt))for(const Qn in Bt)Bt[Qn]&&(io+=Qn+" ");return io.trim()}var sd="html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot",ou="svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view",Sa="area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr",su=M(sd),rd=M(ou),ni=M(Sa),ru=/["'&<>]/;function gc(Bt){const io=""+Bt,Qn=ru.exec(io);if(!Qn)return io;let Po="",Js,N,X=0;for(N=Qn.index;N<io.length;N++){switch(io.charCodeAt(N)){case 34:Js="&quot;";break;case 38:Js="&amp;";break;case 39:Js="&#39;";break;case 60:Js="&lt;";break;case 62:Js="&gt;";break;default:continue}X!==N&&(Po+=io.substring(X,N)),X=N+1,Po+=Js}return X!==N?Po+io.substring(X,N):Po}var bc=/^-?>|<!--|-->|--!>|<!-$/g;function ff(Bt){return Bt.replace(bc,"")}function Du(Bt,io){if(Bt.length!==io.length)return!1;let Qn=!0;for(let Po=0;Qn&&Po<Bt.length;Po++)Qn=vc(Bt[Po],io[Po]);return Qn}function vc(Bt,io){if(Bt===io)return!0;let Qn=ha(Bt),Po=ha(io);if(Qn||Po)return Qn&&Po?Bt.getTime()===io.getTime():!1;if(Qn=Ji(Bt),Po=Ji(io),Qn||Po)return Qn&&Po?Du(Bt,io):!1;if(Qn=oi(Bt),Po=oi(io),Qn||Po){if(!Qn||!Po)return!1;const Js=Object.keys(Bt).length,N=Object.keys(io).length;if(Js!==N)return!1;for(const X in Bt){const ce=Bt.hasOwnProperty(X),Ne=io.hasOwnProperty(X);if(ce&&!Ne||!ce&&Ne||!vc(Bt[X],io[X]))return!1}}return String(Bt)===String(io)}function hf(Bt,io){return Bt.findIndex(Qn=>vc(Qn,io))}var Rr=Bt=>Bt==null?"":oi(Bt)?JSON.stringify(Bt,Vl,2):String(Bt),Vl=(Bt,io)=>Ha(io)?{[`Map(${io.size})`]:[...io.entries()].reduce((Qn,[Po,Js])=>(Qn[`${Po} =>`]=Js,Qn),{})}:Cl(io)?{[`Set(${io.size})`]:[...io.values()]}:oi(io)&&!Ji(io)&&!lt(io)?String(io):io,Ui=["bigInt","optionalChaining","nullishCoalescingOperator"],xc=Object.freeze({}),Kr=Object.freeze([]),El=()=>{},wi=()=>!1,Pi=/^on[^a-z]/,Uc=Bt=>Pi.test(Bt),Rt=Bt=>Bt.startsWith("onUpdate:"),fa=Object.assign,iu=(Bt,io)=>{const Qn=Bt.indexOf(io);Qn>-1&&Bt.splice(Qn,1)},qr=Object.prototype.hasOwnProperty,$a=(Bt,io)=>qr.call(Bt,io),Ji=Array.isArray,Ha=Bt=>yc(Bt)==="[object Map]",Cl=Bt=>yc(Bt)==="[object Set]",ha=Bt=>Bt instanceof Date,ys=Bt=>typeof Bt=="function",ma=Bt=>typeof Bt=="string",Vi=Bt=>typeof Bt=="symbol",oi=Bt=>Bt!==null&&typeof Bt=="object",Vc=Bt=>oi(Bt)&&ys(Bt.then)&&ys(Bt.catch),_l=Object.prototype.toString,yc=Bt=>_l.call(Bt),ul=Bt=>yc(Bt).slice(8,-1),lt=Bt=>yc(Bt)==="[object Object]",Si=Bt=>ma(Bt)&&Bt!=="NaN"&&Bt[0]!=="-"&&""+parseInt(Bt,10)===Bt,au=M(",key,ref,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),rr=Bt=>{const io=Object.create(null);return Qn=>io[Qn]||(io[Qn]=Bt(Qn))},Tl=/-(\w)/g,pa=rr(Bt=>Bt.replace(Tl,(io,Qn)=>Qn?Qn.toUpperCase():"")),Or=/\B([A-Z])/g,Ua=rr(Bt=>Bt.replace(Or,"-$1").toLowerCase()),Xs=rr(Bt=>Bt.charAt(0).toUpperCase()+Bt.slice(1)),di=rr(Bt=>Bt?`on${Xs(Bt)}`:""),nc=(Bt,io)=>Bt!==io&&(Bt===Bt||io===io),wc=(Bt,io)=>{for(let Qn=0;Qn<Bt.length;Qn++)Bt[Qn](io)},ku=(Bt,io,Qn)=>{Object.defineProperty(Bt,io,{configurable:!0,enumerable:!1,value:Qn})},zc=Bt=>{const io=parseFloat(Bt);return isNaN(io)?Bt:io},Gc,mf=()=>Gc||(Gc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});F.EMPTY_ARR=Kr,F.EMPTY_OBJ=xc,F.NO=wi,F.NOOP=El,F.PatchFlagNames=Ee,F.babelParserDefaultPlugins=Ui,F.camelize=pa,F.capitalize=Xs,F.def=ku,F.escapeHtml=gc,F.escapeHtmlComment=ff,F.extend=fa,F.generateCodeFrame=gt,F.getGlobalThis=mf,F.hasChanged=nc,F.hasOwn=$a,F.hyphenate=Ua,F.invokeArrayFns=wc,F.isArray=Ji,F.isBooleanAttr=ss,F.isDate=ha,F.isFunction=ys,F.isGloballyWhitelisted=Ze,F.isHTMLTag=su,F.isIntegerKey=Si,F.isKnownAttr=ns,F.isMap=Ha,F.isModelListener=Rt,F.isNoUnitNumericStyleProp=Sl,F.isObject=oi,F.isOn=Uc,F.isPlainObject=lt,F.isPromise=Vc,F.isReservedProp=au,F.isSSRSafeAttrName=_s,F.isSVGTag=rd,F.isSet=Cl,F.isSpecialBooleanAttr=Io,F.isString=ma,F.isSymbol=Vi,F.isVoidTag=ni,F.looseEqual=vc,F.looseIndexOf=hf,F.makeMap=M,F.normalizeClass=el,F.normalizeStyle=Vs,F.objectToString=_l,F.parseStringStyle=Wn,F.propsToAttrMap=ki,F.remove=iu,F.slotFlagsText=Ve,F.stringifyStyle=cr,F.toDisplayString=Rr,F.toHandlerKey=di,F.toNumber=zc,F.toRawType=ul,F.toTypeString=yc}}),$=S({"node_modules/@vue/shared/index.js"(F,M){M.exports=z()}}),W=S({"node_modules/@vue/reactivity/dist/reactivity.cjs.js"(F){Object.defineProperty(F,"__esModule",{value:!0});var M=$(),Ee=new WeakMap,Ve=[],tt,Ze=Symbol("iterate"),pt=Symbol("Map key iterate");function gt($e){return $e&&$e._isEffect===!0}function ln($e,cn=M.EMPTY_OBJ){gt($e)&&($e=$e.raw);const Ln=Sr($e,cn);return cn.lazy||Ln(),Ln}function Io($e){$e.active&&(vs($e),$e.options.onStop&&$e.options.onStop(),$e.active=!1)}var ss=0;function Sr($e,cn){const Ln=function(){if(!Ln.active)return $e();if(!Ve.includes(Ln)){vs(Ln);try{return ns(),Ve.push(Ln),tt=Ln,$e()}finally{Ve.pop(),Vs(),tt=Ve[Ve.length-1]}}};return Ln.id=ss++,Ln.allowRecurse=!!cn.allowRecurse,Ln._isEffect=!0,Ln.active=!0,Ln.raw=$e,Ln.deps=[],Ln.options=cn,Ln}function vs($e){const{deps:cn}=$e;if(cn.length){for(let Ln=0;Ln<cn.length;Ln++)cn[Ln].delete($e);cn.length=0}}var _s=!0,ki=[];function Sl(){ki.push(_s),_s=!1}function ns(){ki.push(_s),_s=!0}function Vs(){const $e=ki.pop();_s=$e===void 0?!0:$e}function xs($e,cn,Ln){if(!_s||tt===void 0)return;let Wo=Ee.get($e);Wo||Ee.set($e,Wo=new Map);let bn=Wo.get(Ln);bn||Wo.set(Ln,bn=new Set),bn.has(tt)||(bn.add(tt),tt.deps.push(bn),tt.options.onTrack&&tt.options.onTrack({effect:tt,target:$e,type:cn,key:Ln}))}function ks($e,cn,Ln,Wo,bn,Jo){const Vo=Ee.get($e);if(!Vo)return;const Yr=new Set,za=pr=>{pr&&pr.forEach(dl=>{(dl!==tt||dl.allowRecurse)&&Yr.add(dl)})};if(cn==="clear")Vo.forEach(za);else if(Ln==="length"&&M.isArray($e))Vo.forEach((pr,dl)=>{(dl==="length"||dl>=Wo)&&za(pr)});else switch(Ln!==void 0&&za(Vo.get(Ln)),cn){case"add":M.isArray($e)?M.isIntegerKey(Ln)&&za(Vo.get("length")):(za(Vo.get(Ze)),M.isMap($e)&&za(Vo.get(pt)));break;case"delete":M.isArray($e)||(za(Vo.get(Ze)),M.isMap($e)&&za(Vo.get(pt)));break;case"set":M.isMap($e)&&za(Vo.get(Ze));break}const Au=pr=>{pr.options.onTrigger&&pr.options.onTrigger({effect:pr,target:$e,key:Ln,type:cn,newValue:Wo,oldValue:bn,oldTarget:Jo}),pr.options.scheduler?pr.options.scheduler(pr):pr()};Yr.forEach(Au)}var Wn=M.makeMap("__proto__,__v_isRef,__isVue"),cr=new Set(Object.getOwnPropertyNames(Symbol).map($e=>Symbol[$e]).filter(M.isSymbol)),el=ni(),sd=ni(!1,!0),ou=ni(!0),Sa=ni(!0,!0),su=rd();function rd(){const $e={};return["includes","indexOf","lastIndexOf"].forEach(cn=>{$e[cn]=function(...Ln){const Wo=Bt(this);for(let Jo=0,Vo=this.length;Jo<Vo;Jo++)xs(Wo,"get",Jo+"");const bn=Wo[cn](...Ln);return bn===-1||bn===!1?Wo[cn](...Ln.map(Bt)):bn}}),["push","pop","shift","unshift","splice"].forEach(cn=>{$e[cn]=function(...Ln){Sl();const Wo=Bt(this)[cn].apply(this,Ln);return Vs(),Wo}}),$e}function ni($e=!1,cn=!1){return function(Wo,bn,Jo){if(bn==="__v_isReactive")return!$e;if(bn==="__v_isReadonly")return $e;if(bn==="__v_raw"&&Jo===($e?cn?pa:Tl:cn?rr:au).get(Wo))return Wo;const Vo=M.isArray(Wo);if(!$e&&Vo&&M.hasOwn(su,bn))return Reflect.get(su,bn,Jo);const Yr=Reflect.get(Wo,bn,Jo);return(M.isSymbol(bn)?cr.has(bn):Wn(bn))||($e||xs(Wo,"get",bn),cn)?Yr:Po(Yr)?!Vo||!M.isIntegerKey(bn)?Yr.value:Yr:M.isObject(Yr)?$e?nc(Yr):Xs(Yr):Yr}}var ru=bc(),gc=bc(!0);function bc($e=!1){return function(Ln,Wo,bn,Jo){let Vo=Ln[Wo];if(!$e&&(bn=Bt(bn),Vo=Bt(Vo),!M.isArray(Ln)&&Po(Vo)&&!Po(bn)))return Vo.value=bn,!0;const Yr=M.isArray(Ln)&&M.isIntegerKey(Wo)?Number(Wo)<Ln.length:M.hasOwn(Ln,Wo),za=Reflect.set(Ln,Wo,bn,Jo);return Ln===Bt(Jo)&&(Yr?M.hasChanged(bn,Vo)&&ks(Ln,"set",Wo,bn,Vo):ks(Ln,"add",Wo,bn)),za}}function ff($e,cn){const Ln=M.hasOwn($e,cn),Wo=$e[cn],bn=Reflect.deleteProperty($e,cn);return bn&&Ln&&ks($e,"delete",cn,void 0,Wo),bn}function Du($e,cn){const Ln=Reflect.has($e,cn);return(!M.isSymbol(cn)||!cr.has(cn))&&xs($e,"has",cn),Ln}function vc($e){return xs($e,"iterate",M.isArray($e)?"length":Ze),Reflect.ownKeys($e)}var hf={get:el,set:ru,deleteProperty:ff,has:Du,ownKeys:vc},Rr={get:ou,set($e,cn){return console.warn(`Set operation on key "${String(cn)}" failed: target is readonly.`,$e),!0},deleteProperty($e,cn){return console.warn(`Delete operation on key "${String(cn)}" failed: target is readonly.`,$e),!0}},Vl=M.extend({},hf,{get:sd,set:gc}),Ui=M.extend({},Rr,{get:Sa}),xc=$e=>M.isObject($e)?Xs($e):$e,Kr=$e=>M.isObject($e)?nc($e):$e,El=$e=>$e,wi=$e=>Reflect.getPrototypeOf($e);function Pi($e,cn,Ln=!1,Wo=!1){$e=$e.__v_raw;const bn=Bt($e),Jo=Bt(cn);cn!==Jo&&!Ln&&xs(bn,"get",cn),!Ln&&xs(bn,"get",Jo);const{has:Vo}=wi(bn),Yr=Wo?El:Ln?Kr:xc;if(Vo.call(bn,cn))return Yr($e.get(cn));if(Vo.call(bn,Jo))return Yr($e.get(Jo));$e!==bn&&$e.get(cn)}function Uc($e,cn=!1){const Ln=this.__v_raw,Wo=Bt(Ln),bn=Bt($e);return $e!==bn&&!cn&&xs(Wo,"has",$e),!cn&&xs(Wo,"has",bn),$e===bn?Ln.has($e):Ln.has($e)||Ln.has(bn)}function Rt($e,cn=!1){return $e=$e.__v_raw,!cn&&xs(Bt($e),"iterate",Ze),Reflect.get($e,"size",$e)}function fa($e){$e=Bt($e);const cn=Bt(this);return wi(cn).has.call(cn,$e)||(cn.add($e),ks(cn,"add",$e,$e)),this}function iu($e,cn){cn=Bt(cn);const Ln=Bt(this),{has:Wo,get:bn}=wi(Ln);let Jo=Wo.call(Ln,$e);Jo?Si(Ln,Wo,$e):($e=Bt($e),Jo=Wo.call(Ln,$e));const Vo=bn.call(Ln,$e);return Ln.set($e,cn),Jo?M.hasChanged(cn,Vo)&&ks(Ln,"set",$e,cn,Vo):ks(Ln,"add",$e,cn),this}function qr($e){const cn=Bt(this),{has:Ln,get:Wo}=wi(cn);let bn=Ln.call(cn,$e);bn?Si(cn,Ln,$e):($e=Bt($e),bn=Ln.call(cn,$e));const Jo=Wo?Wo.call(cn,$e):void 0,Vo=cn.delete($e);return bn&&ks(cn,"delete",$e,void 0,Jo),Vo}function $a(){const $e=Bt(this),cn=$e.size!==0,Ln=M.isMap($e)?new Map($e):new Set($e),Wo=$e.clear();return cn&&ks($e,"clear",void 0,void 0,Ln),Wo}function Ji($e,cn){return function(Wo,bn){const Jo=this,Vo=Jo.__v_raw,Yr=Bt(Vo),za=cn?El:$e?Kr:xc;return!$e&&xs(Yr,"iterate",Ze),Vo.forEach((Au,pr)=>Wo.call(bn,za(Au),za(pr),Jo))}}function Ha($e,cn,Ln){return function(...Wo){const bn=this.__v_raw,Jo=Bt(bn),Vo=M.isMap(Jo),Yr=$e==="entries"||$e===Symbol.iterator&&Vo,za=$e==="keys"&&Vo,Au=bn[$e](...Wo),pr=Ln?El:cn?Kr:xc;return!cn&&xs(Jo,"iterate",za?pt:Ze),{next(){const{value:dl,done:Gf}=Au.next();return Gf?{value:dl,done:Gf}:{value:Yr?[pr(dl[0]),pr(dl[1])]:pr(dl),done:Gf}},[Symbol.iterator](){return this}}}}function Cl($e){return function(...cn){{const Ln=cn[0]?`on key "${cn[0]}" `:"";console.warn(`${M.capitalize($e)} operation ${Ln}failed: target is readonly.`,Bt(this))}return $e==="delete"?!1:this}}function ha(){const $e={get(Jo){return Pi(this,Jo)},get size(){return Rt(this)},has:Uc,add:fa,set:iu,delete:qr,clear:$a,forEach:Ji(!1,!1)},cn={get(Jo){return Pi(this,Jo,!1,!0)},get size(){return Rt(this)},has:Uc,add:fa,set:iu,delete:qr,clear:$a,forEach:Ji(!1,!0)},Ln={get(Jo){return Pi(this,Jo,!0)},get size(){return Rt(this,!0)},has(Jo){return Uc.call(this,Jo,!0)},add:Cl("add"),set:Cl("set"),delete:Cl("delete"),clear:Cl("clear"),forEach:Ji(!0,!1)},Wo={get(Jo){return Pi(this,Jo,!0,!0)},get size(){return Rt(this,!0)},has(Jo){return Uc.call(this,Jo,!0)},add:Cl("add"),set:Cl("set"),delete:Cl("delete"),clear:Cl("clear"),forEach:Ji(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(Jo=>{$e[Jo]=Ha(Jo,!1,!1),Ln[Jo]=Ha(Jo,!0,!1),cn[Jo]=Ha(Jo,!1,!0),Wo[Jo]=Ha(Jo,!0,!0)}),[$e,Ln,cn,Wo]}var[ys,ma,Vi,oi]=ha();function Vc($e,cn){const Ln=cn?$e?oi:Vi:$e?ma:ys;return(Wo,bn,Jo)=>bn==="__v_isReactive"?!$e:bn==="__v_isReadonly"?$e:bn==="__v_raw"?Wo:Reflect.get(M.hasOwn(Ln,bn)&&bn in Wo?Ln:Wo,bn,Jo)}var _l={get:Vc(!1,!1)},yc={get:Vc(!1,!0)},ul={get:Vc(!0,!1)},lt={get:Vc(!0,!0)};function Si($e,cn,Ln){const Wo=Bt(Ln);if(Wo!==Ln&&cn.call($e,Wo)){const bn=M.toRawType($e);console.warn(`Reactive ${bn} contains both the raw and reactive versions of the same object${bn==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}var au=new WeakMap,rr=new WeakMap,Tl=new WeakMap,pa=new WeakMap;function Or($e){switch($e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Ua($e){return $e.__v_skip||!Object.isExtensible($e)?0:Or(M.toRawType($e))}function Xs($e){return $e&&$e.__v_isReadonly?$e:ku($e,!1,hf,_l,au)}function di($e){return ku($e,!1,Vl,yc,rr)}function nc($e){return ku($e,!0,Rr,ul,Tl)}function wc($e){return ku($e,!0,Ui,lt,pa)}function ku($e,cn,Ln,Wo,bn){if(!M.isObject($e))return console.warn(`value cannot be made reactive: ${String($e)}`),$e;if($e.__v_raw&&!(cn&&$e.__v_isReactive))return $e;const Jo=bn.get($e);if(Jo)return Jo;const Vo=Ua($e);if(Vo===0)return $e;const Yr=new Proxy($e,Vo===2?Wo:Ln);return bn.set($e,Yr),Yr}function zc($e){return Gc($e)?zc($e.__v_raw):!!($e&&$e.__v_isReactive)}function Gc($e){return!!($e&&$e.__v_isReadonly)}function mf($e){return zc($e)||Gc($e)}function Bt($e){return $e&&Bt($e.__v_raw)||$e}function io($e){return M.def($e,"__v_skip",!0),$e}var Qn=$e=>M.isObject($e)?Xs($e):$e;function Po($e){return!!($e&&$e.__v_isRef===!0)}function Js($e){return ce($e)}function N($e){return ce($e,!0)}var X=class{constructor($e,cn=!1){this._shallow=cn,this.__v_isRef=!0,this._rawValue=cn?$e:Bt($e),this._value=cn?$e:Qn($e)}get value(){return xs(Bt(this),"get","value"),this._value}set value($e){$e=this._shallow?$e:Bt($e),M.hasChanged($e,this._rawValue)&&(this._rawValue=$e,this._value=this._shallow?$e:Qn($e),ks(Bt(this),"set","value",$e))}};function ce($e,cn=!1){return Po($e)?$e:new X($e,cn)}function Ne($e){ks(Bt($e),"set","value",$e.value)}function We($e){return Po($e)?$e.value:$e}var Kt={get:($e,cn,Ln)=>We(Reflect.get($e,cn,Ln)),set:($e,cn,Ln,Wo)=>{const bn=$e[cn];return Po(bn)&&!Po(Ln)?(bn.value=Ln,!0):Reflect.set($e,cn,Ln,Wo)}};function Yn($e){return zc($e)?$e:new Proxy($e,Kt)}var Co=class{constructor($e){this.__v_isRef=!0;const{get:cn,set:Ln}=$e(()=>xs(this,"get","value"),()=>ks(this,"set","value"));this._get=cn,this._set=Ln}get value(){return this._get()}set value($e){this._set($e)}};function $o($e){return new Co($e)}function Jn($e){mf($e)||console.warn("toRefs() expects a reactive object but received a plain one.");const cn=M.isArray($e)?new Array($e.length):{};for(const Ln in $e)cn[Ln]=Vr($e,Ln);return cn}var mr=class{constructor($e,cn){this._object=$e,this._key=cn,this.__v_isRef=!0}get value(){return this._object[this._key]}set value($e){this._object[this._key]=$e}};function Vr($e,cn){return Po($e[cn])?$e[cn]:new mr($e,cn)}var Va=class{constructor($e,cn,Ln){this._setter=cn,this._dirty=!0,this.__v_isRef=!0,this.effect=ln($e,{lazy:!0,scheduler:()=>{this._dirty||(this._dirty=!0,ks(Bt(this),"set","value"))}}),this.__v_isReadonly=Ln}get value(){const $e=Bt(this);return $e._dirty&&($e._value=this.effect(),$e._dirty=!1),xs($e,"get","value"),$e._value}set value($e){this._setter($e)}};function Dl($e){let cn,Ln;return M.isFunction($e)?(cn=$e,Ln=()=>{console.warn("Write operation failed: computed value is readonly")}):(cn=$e.get,Ln=$e.set),new Va(cn,Ln,M.isFunction($e)||!$e.set)}F.ITERATE_KEY=Ze,F.computed=Dl,F.customRef=$o,F.effect=ln,F.enableTracking=ns,F.isProxy=mf,F.isReactive=zc,F.isReadonly=Gc,F.isRef=Po,F.markRaw=io,F.pauseTracking=Sl,F.proxyRefs=Yn,F.reactive=Xs,F.readonly=nc,F.ref=Js,F.resetTracking=Vs,F.shallowReactive=di,F.shallowReadonly=wc,F.shallowRef=N,F.stop=Io,F.toRaw=Bt,F.toRef=Vr,F.toRefs=Jn,F.track=xs,F.trigger=ks,F.triggerRef=Ne,F.unref=We}}),Q=S({"node_modules/@vue/reactivity/index.js"(F,M){M.exports=W()}}),j={};T(j,{Alpine:()=>Md,default:()=>pc}),n.exports=V(j);var se=!1,re=!1,Y=[],me=-1;function ae(F){Ce(F)}function Ce(F){Y.includes(F)||Y.push(F),ot()}function Ue(F){let M=Y.indexOf(F);M!==-1&&M>me&&Y.splice(M,1)}function ot(){!re&&!se&&(se=!0,queueMicrotask(Ae))}function Ae(){se=!1,re=!0;for(let F=0;F<Y.length;F++)Y[F](),me=F;Y.length=0,me=-1,re=!1}var ve,Oe,O,De,Fe=!0;function st(F){Fe=!1,F(),Fe=!0}function Ut(F){ve=F.reactive,O=F.release,Oe=M=>F.effect(M,{scheduler:Ee=>{Fe?ae(Ee):Ee()}}),De=F.raw}function et(F){Oe=F}function Dt(F){let M=()=>{};return[Ve=>{let tt=Oe(Ve);return F._x_effects||(F._x_effects=new Set,F._x_runEffects=()=>{F._x_effects.forEach(Ze=>Ze())}),F._x_effects.add(tt),M=()=>{tt!==void 0&&(F._x_effects.delete(tt),O(tt))},tt},()=>{M()}]}function Xe(F,M){let Ee=!0,Ve,tt=Oe(()=>{let Ze=F();JSON.stringify(Ze),Ee?Ve=Ze:queueMicrotask(()=>{M(Ze,Ve),Ve=Ze}),Ee=!1});return()=>O(tt)}var it=[],qe=[],mt=[];function Un(F){mt.push(F)}function on(F,M){typeof M=="function"?(F._x_cleanups||(F._x_cleanups=[]),F._x_cleanups.push(M)):(M=F,qe.push(M))}function vt(F){it.push(F)}function an(F,M,Ee){F._x_attributeCleanups||(F._x_attributeCleanups={}),F._x_attributeCleanups[M]||(F._x_attributeCleanups[M]=[]),F._x_attributeCleanups[M].push(Ee)}function J(F,M){F._x_attributeCleanups&&Object.entries(F._x_attributeCleanups).forEach(([Ee,Ve])=>{(M===void 0||M.includes(Ee))&&(Ve.forEach(tt=>tt()),delete F._x_attributeCleanups[Ee])})}function Bn(F){if(F._x_cleanups)for(;F._x_cleanups.length;)F._x_cleanups.pop()()}var Vn=new MutationObserver(yo),Rn=!1;function An(){Vn.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),Rn=!0}function jn(){mo(),Vn.disconnect(),Rn=!1}var to=[];function mo(){let F=Vn.takeRecords();to.push(()=>F.length>0&&yo(F));let M=to.length;queueMicrotask(()=>{if(to.length===M)for(;to.length>0;)to.shift()()})}function $t(F){if(!Rn)return F();jn();let M=F();return An(),M}var xe=!1,It=[];function Dn(){xe=!0}function Ct(){xe=!1,yo(It),It=[]}function yo(F){if(xe){It=It.concat(F);return}let M=new Set,Ee=new Set,Ve=new Map,tt=new Map;for(let Ze=0;Ze<F.length;Ze++)if(!F[Ze].target._x_ignoreMutationObserver&&(F[Ze].type==="childList"&&(F[Ze].addedNodes.forEach(pt=>pt.nodeType===1&&M.add(pt)),F[Ze].removedNodes.forEach(pt=>pt.nodeType===1&&Ee.add(pt))),F[Ze].type==="attributes")){let pt=F[Ze].target,gt=F[Ze].attributeName,ln=F[Ze].oldValue,Io=()=>{Ve.has(pt)||Ve.set(pt,[]),Ve.get(pt).push({name:gt,value:pt.getAttribute(gt)})},ss=()=>{tt.has(pt)||tt.set(pt,[]),tt.get(pt).push(gt)};pt.hasAttribute(gt)&&ln===null?Io():pt.hasAttribute(gt)?(ss(),Io()):ss()}tt.forEach((Ze,pt)=>{J(pt,Ze)}),Ve.forEach((Ze,pt)=>{it.forEach(gt=>gt(pt,Ze))});for(let Ze of Ee)M.has(Ze)||qe.forEach(pt=>pt(Ze));M.forEach(Ze=>{Ze._x_ignoreSelf=!0,Ze._x_ignore=!0});for(let Ze of M)Ee.has(Ze)||Ze.isConnected&&(delete Ze._x_ignoreSelf,delete Ze._x_ignore,mt.forEach(pt=>pt(Ze)),Ze._x_ignore=!0,Ze._x_ignoreSelf=!0);M.forEach(Ze=>{delete Ze._x_ignoreSelf,delete Ze._x_ignore}),M=null,Ee=null,Ve=null,tt=null}function Kn(F){return Cn(Qt(F))}function Jt(F,M,Ee){return F._x_dataStack=[M,...Qt(Ee||F)],()=>{F._x_dataStack=F._x_dataStack.filter(Ve=>Ve!==M)}}function Qt(F){return F._x_dataStack?F._x_dataStack:typeof ShadowRoot=="function"&&F instanceof ShadowRoot?Qt(F.host):F.parentNode?Qt(F.parentNode):[]}function Cn(F){return new Proxy({objects:F},Nn)}var Nn={ownKeys({objects:F}){return Array.from(new Set(F.flatMap(M=>Object.keys(M))))},has({objects:F},M){return M==Symbol.unscopables?!1:F.some(Ee=>Object.prototype.hasOwnProperty.call(Ee,M)||Reflect.has(Ee,M))},get({objects:F},M,Ee){return M=="toJSON"?kt:Reflect.get(F.find(Ve=>Reflect.has(Ve,M))||{},M,Ee)},set({objects:F},M,Ee,Ve){const tt=F.find(pt=>Object.prototype.hasOwnProperty.call(pt,M))||F[F.length-1],Ze=Object.getOwnPropertyDescriptor(tt,M);return Ze!=null&&Ze.set&&(Ze!=null&&Ze.get)?Ze.set.call(Ve,Ee)||!0:Reflect.set(tt,M,Ee)}};function kt(){return Reflect.ownKeys(this).reduce((M,Ee)=>(M[Ee]=Reflect.get(this,Ee),M),{})}function jo(F){let M=Ve=>typeof Ve=="object"&&!Array.isArray(Ve)&&Ve!==null,Ee=(Ve,tt="")=>{Object.entries(Object.getOwnPropertyDescriptors(Ve)).forEach(([Ze,{value:pt,enumerable:gt}])=>{if(gt===!1||pt===void 0||typeof pt=="object"&&pt!==null&&pt.__v_skip)return;let ln=tt===""?Ze:`${tt}.${Ze}`;typeof pt=="object"&&pt!==null&&pt._x_interceptor?Ve[Ze]=pt.initialize(F,ln,Ze):M(pt)&&pt!==Ve&&!(pt instanceof Element)&&Ee(pt,ln)})};return Ee(F)}function ms(F,M=()=>{}){let Ee={initialValue:void 0,_x_interceptor:!0,initialize(Ve,tt,Ze){return F(this.initialValue,()=>as(Ve,tt),pt=>xt(Ve,tt,pt),tt,Ze)}};return M(Ee),Ve=>{if(typeof Ve=="object"&&Ve!==null&&Ve._x_interceptor){let tt=Ee.initialize.bind(Ee);Ee.initialize=(Ze,pt,gt)=>{let ln=Ve.initialize(Ze,pt,gt);return Ee.initialValue=ln,tt(Ze,pt,gt)}}else Ee.initialValue=Ve;return Ee}}function as(F,M){return M.split(".").reduce((Ee,Ve)=>Ee[Ve],F)}function xt(F,M,Ee){if(typeof M=="string"&&(M=M.split(".")),M.length===1)F[M[0]]=Ee;else{if(M.length===0)throw error;return F[M[0]]||(F[M[0]]={}),xt(F[M[0]],M.slice(1),Ee)}}var Pt={};function gn(F,M){Pt[F]=M}function At(F,M){return Object.entries(Pt).forEach(([Ee,Ve])=>{let tt=null;function Ze(){if(tt)return tt;{let[pt,gt]=Tn(M);return tt={interceptor:ms,...pt},on(M,gt),tt}}Object.defineProperty(F,`$${Ee}`,{get(){return Ve(M,Ze())},enumerable:!1})}),F}function On(F,M,Ee,...Ve){try{return Ee(...Ve)}catch(tt){In(tt,F,M)}}function In(F,M,Ee=void 0){F=Object.assign(F??{message:"No error message given."},{el:M,expression:Ee}),console.warn(`Alpine Expression Error: ${F.message}

${Ee?'Expression: "'+Ee+`"

`:""}`,M),setTimeout(()=>{throw F},0)}var Is=!0;function kr(F){let M=Is;Is=!1;let Ee=F();return Is=M,Ee}function Yt(F,M,Ee={}){let Ve;return Ps(F,M)(tt=>Ve=tt,Ee),Ve}function Ps(...F){return qo(...F)}var qo=bs;function _i(F){qo=F}function bs(F,M){let Ee={};At(Ee,F);let Ve=[Ee,...Qt(F)],tt=typeof M=="function"?Ar(Ve,M):ps(Ve,M,F);return On.bind(null,F,M,tt)}function Ar(F,M){return(Ee=()=>{},{scope:Ve={},params:tt=[]}={})=>{let Ze=M.apply(Cn([Ve,...F]),tt);dn(Ee,Ze)}}var Bl={};function aa(F,M){if(Bl[F])return Bl[F];let Ee=Object.getPrototypeOf(async function(){}).constructor,Ve=/^[\n\s]*if.*\(.*\)/.test(F.trim())||/^(let|const)\s/.test(F.trim())?`(async()=>{ ${F} })()`:F,Ze=(()=>{try{let pt=new Ee(["__self","scope"],`with (scope) { __self.result = ${Ve} }; __self.finished = true; return __self.result;`);return Object.defineProperty(pt,"name",{value:`[Alpine] ${F}`}),pt}catch(pt){return In(pt,M,F),Promise.resolve()}})();return Bl[F]=Ze,Ze}function ps(F,M,Ee){let Ve=aa(M,Ee);return(tt=()=>{},{scope:Ze={},params:pt=[]}={})=>{Ve.result=void 0,Ve.finished=!1;let gt=Cn([Ze,...F]);if(typeof Ve=="function"){let ln=Ve(Ve,gt).catch(Io=>In(Io,Ee,M));Ve.finished?(dn(tt,Ve.result,gt,pt,Ee),Ve.result=void 0):ln.then(Io=>{dn(tt,Io,gt,pt,Ee)}).catch(Io=>In(Io,Ee,M)).finally(()=>Ve.result=void 0)}}}function dn(F,M,Ee,Ve,tt){if(Is&&typeof M=="function"){let Ze=M.apply(Ee,Ve);Ze instanceof Promise?Ze.then(pt=>dn(F,pt,Ee,Ve)).catch(pt=>In(pt,tt,M)):F(Ze)}else typeof M=="object"&&M instanceof Promise?M.then(Ze=>F(Ze)):F(M)}var vo="x-";function Gn(F=""){return vo+F}function yn(F){vo=F}var vr={};function ao(F,M){return vr[F]=M,{before(Ee){if(!vr[Ee]){console.warn(String.raw`Cannot find directive \`${Ee}\`. \`${F}\` will use the default order of execution`);return}const Ve=ts.indexOf(Ee);ts.splice(Ve>=0?Ve:ts.indexOf("DEFAULT"),0,F)}}}function ze(F){return Object.keys(vr).includes(F)}function Ie(F,M,Ee){if(M=Array.from(M),F._x_virtualDirectives){let Ze=Object.entries(F._x_virtualDirectives).map(([gt,ln])=>({name:gt,value:ln})),pt=Ot(Ze);Ze=Ze.map(gt=>pt.find(ln=>ln.name===gt.name)?{name:`x-bind:${gt.name}`,value:`"${gt.value}"`}:gt),M=M.concat(Ze)}let Ve={};return M.map(To((Ze,pt)=>Ve[Ze]=pt)).filter(es).map(hr(Ve,Ee)).sort(tr).map(Ze=>Xn(F,Ze))}function Ot(F){return Array.from(F).map(To()).filter(M=>!es(M))}var _t=!1,Nt=new Map,_n=Symbol();function sn(F){_t=!0;let M=Symbol();_n=M,Nt.set(M,[]);let Ee=()=>{for(;Nt.get(M).length;)Nt.get(M).shift()();Nt.delete(M)},Ve=()=>{_t=!1,Ee()};F(Ee),Ve()}function Tn(F){let M=[],Ee=gt=>M.push(gt),[Ve,tt]=Dt(F);return M.push(tt),[{Alpine:da,effect:Ve,cleanup:Ee,evaluateLater:Ps.bind(Ps,F),evaluate:Yt.bind(Yt,F)},()=>M.forEach(gt=>gt())]}function Xn(F,M){let Ee=()=>{},Ve=vr[M.type]||Ee,[tt,Ze]=Tn(F);an(F,M.original,Ze);let pt=()=>{F._x_ignore||F._x_ignoreSelf||(Ve.inline&&Ve.inline(F,M,tt),Ve=Ve.bind(Ve,F,M,tt),_t?Nt.get(_n).push(Ve):Ve())};return pt.runCleanups=Ze,pt}var zn=(F,M)=>({name:Ee,value:Ve})=>(Ee.startsWith(F)&&(Ee=Ee.replace(F,M)),{name:Ee,value:Ve}),Ko=F=>F;function To(F=()=>{}){return({name:M,value:Ee})=>{let{name:Ve,value:tt}=Yo.reduce((Ze,pt)=>pt(Ze),{name:M,value:Ee});return Ve!==M&&F(Ve,M),{name:Ve,value:tt}}}var Yo=[];function Lo(F){Yo.push(F)}function es({name:F}){return Ms().test(F)}var Ms=()=>new RegExp(`^${vo}([^:^.]+)\\b`);function hr(F,M){return({name:Ee,value:Ve})=>{let tt=Ee.match(Ms()),Ze=Ee.match(/:([a-zA-Z0-9\-_:]+)/),pt=Ee.match(/\.[^.\]]+(?=[^\]]*$)/g)||[],gt=M||F[Ee]||Ee;return{type:tt?tt[1]:null,value:Ze?Ze[1]:null,modifiers:pt.map(ln=>ln.replace(".","")),expression:Ve,original:gt}}}var po="DEFAULT",ts=["ignore","ref","data","id","anchor","bind","init","for","model","modelable","transition","show","if",po,"teleport"];function tr(F,M){let Ee=ts.indexOf(F.type)===-1?po:F.type,Ve=ts.indexOf(M.type)===-1?po:M.type;return ts.indexOf(Ee)-ts.indexOf(Ve)}function ai(F,M,Ee={}){F.dispatchEvent(new CustomEvent(M,{detail:Ee,bubbles:!0,composed:!0,cancelable:!0}))}function Ur(F,M){if(typeof ShadowRoot=="function"&&F instanceof ShadowRoot){Array.from(F.children).forEach(tt=>Ur(tt,M));return}let Ee=!1;if(M(F,()=>Ee=!0),Ee)return;let Ve=F.firstElementChild;for(;Ve;)Ur(Ve,M),Ve=Ve.nextElementSibling}function Ti(F,...M){console.warn(`Alpine Warning: ${F}`,...M)}var la=!1;function li(){la&&Ti("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems."),la=!0,document.body||Ti("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?"),ai(document,"alpine:init"),ai(document,"alpine:initializing"),An(),Un(M=>yr(M,Ur)),on(M=>Ql(M)),vt((M,Ee)=>{Ie(M,Ee).forEach(Ve=>Ve())});let F=M=>!La(M.parentElement,!0);Array.from(document.querySelectorAll(Hi().join(","))).filter(F).forEach(M=>{yr(M)}),ai(document,"alpine:initialized"),setTimeout(()=>{Nr()})}var Qc=[],xr=[];function qs(){return Qc.map(F=>F())}function Hi(){return Qc.concat(xr).map(F=>F())}function Aa(F){Qc.push(F)}function Qa(F){xr.push(F)}function La(F,M=!1){return Na(F,Ee=>{if((M?Hi():qs()).some(tt=>Ee.matches(tt)))return!0})}function Na(F,M){if(F){if(M(F))return F;if(F._x_teleportBack&&(F=F._x_teleportBack),!!F.parentElement)return Na(F.parentElement,M)}}function vi(F){return qs().some(M=>F.matches(M))}var jr=[];function ca(F){jr.push(F)}function yr(F,M=Ur,Ee=()=>{}){sn(()=>{M(F,(Ve,tt)=>{Ee(Ve,tt),jr.forEach(Ze=>Ze(Ve,tt)),Ie(Ve,Ve.attributes).forEach(Ze=>Ze()),Ve._x_ignore&&tt()})})}function Ql(F,M=Ur){M(F,Ee=>{J(Ee),Bn(Ee)})}function Nr(){[["ui","dialog",["[x-dialog], [x-popover]"]],["anchor","anchor",["[x-anchor]"]],["sort","sort",["[x-sort]"]]].forEach(([M,Ee,Ve])=>{ze(Ee)||Ve.some(tt=>{if(document.querySelector(tt))return Ti(`found "${tt}", but missing ${M} plugin`),!0})})}var Fa=[],Ra=!1;function ua(F=()=>{}){return queueMicrotask(()=>{Ra||setTimeout(()=>{Eo()})}),new Promise(M=>{Fa.push(()=>{F(),M()})})}function Eo(){for(Ra=!1;Fa.length;)Fa.shift()()}function Mc(){Ra=!0}function xi(F,M){return Array.isArray(M)?Di(F,M.join(" ")):typeof M=="object"&&M!==null?Ba(F,M):typeof M=="function"?xi(F,M()):Di(F,M)}function Di(F,M){let Ee=tt=>tt.split(" ").filter(Ze=>!F.classList.contains(Ze)).filter(Boolean),Ve=tt=>(F.classList.add(...tt),()=>{F.classList.remove(...tt)});return M=M===!0?M="":M||"",Ve(Ee(M))}function Ba(F,M){let Ee=gt=>gt.split(" ").filter(Boolean),Ve=Object.entries(M).flatMap(([gt,ln])=>ln?Ee(gt):!1).filter(Boolean),tt=Object.entries(M).flatMap(([gt,ln])=>ln?!1:Ee(gt)).filter(Boolean),Ze=[],pt=[];return tt.forEach(gt=>{F.classList.contains(gt)&&(F.classList.remove(gt),pt.push(gt))}),Ve.forEach(gt=>{F.classList.contains(gt)||(F.classList.add(gt),Ze.push(gt))}),()=>{pt.forEach(gt=>F.classList.add(gt)),Ze.forEach(gt=>F.classList.remove(gt))}}function Lr(F,M){return typeof M=="object"&&M!==null?ei(F,M):ec(F,M)}function ei(F,M){let Ee={};return Object.entries(M).forEach(([Ve,tt])=>{Ee[Ve]=F.style[Ve],Ve.startsWith("--")||(Ve=Ro(Ve)),F.style.setProperty(Ve,tt)}),setTimeout(()=>{F.style.length===0&&F.removeAttribute("style")}),()=>{Lr(F,Ee)}}function ec(F,M){let Ee=F.getAttribute("style",M);return F.setAttribute("style",M),()=>{F.setAttribute("style",Ee||"")}}function Ro(F){return F.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function tc(F,M=()=>{}){let Ee=!1;return function(){Ee?M.apply(this,arguments):(Ee=!0,F.apply(this,arguments))}}ao("transition",(F,{value:M,modifiers:Ee,expression:Ve},{evaluate:tt})=>{typeof Ve=="function"&&(Ve=tt(Ve)),Ve!==!1&&(!Ve||typeof Ve=="boolean"?Fr(F,Ee,M):rl(F,Ve,M))});function rl(F,M,Ee){il(F,xi,""),{enter:tt=>{F._x_transition.enter.during=tt},"enter-start":tt=>{F._x_transition.enter.start=tt},"enter-end":tt=>{F._x_transition.enter.end=tt},leave:tt=>{F._x_transition.leave.during=tt},"leave-start":tt=>{F._x_transition.leave.start=tt},"leave-end":tt=>{F._x_transition.leave.end=tt}}[Ee](M)}function Fr(F,M,Ee){il(F,Lr);let Ve=!M.includes("in")&&!M.includes("out")&&!Ee,tt=Ve||M.includes("in")||["enter"].includes(Ee),Ze=Ve||M.includes("out")||["leave"].includes(Ee);M.includes("in")&&!Ve&&(M=M.filter((Vs,xs)=>xs<M.indexOf("out"))),M.includes("out")&&!Ve&&(M=M.filter((Vs,xs)=>xs>M.indexOf("out")));let pt=!M.includes("opacity")&&!M.includes("scale"),gt=pt||M.includes("opacity"),ln=pt||M.includes("scale"),Io=gt?0:1,ss=ln?us(M,"scale",95)/100:1,Sr=us(M,"delay",0)/1e3,vs=us(M,"origin","center"),_s="opacity, transform",ki=us(M,"duration",150)/1e3,Sl=us(M,"duration",75)/1e3,ns="cubic-bezier(0.4, 0.0, 0.2, 1)";tt&&(F._x_transition.enter.during={transformOrigin:vs,transitionDelay:`${Sr}s`,transitionProperty:_s,transitionDuration:`${ki}s`,transitionTimingFunction:ns},F._x_transition.enter.start={opacity:Io,transform:`scale(${ss})`},F._x_transition.enter.end={opacity:1,transform:"scale(1)"}),Ze&&(F._x_transition.leave.during={transformOrigin:vs,transitionDelay:`${Sr}s`,transitionProperty:_s,transitionDuration:`${Sl}s`,transitionTimingFunction:ns},F._x_transition.leave.start={opacity:1,transform:"scale(1)"},F._x_transition.leave.end={opacity:Io,transform:`scale(${ss})`})}function il(F,M,Ee={}){F._x_transition||(F._x_transition={enter:{during:Ee,start:Ee,end:Ee},leave:{during:Ee,start:Ee,end:Ee},in(Ve=()=>{},tt=()=>{}){Cu(F,M,{during:this.enter.during,start:this.enter.start,end:this.enter.end},Ve,tt)},out(Ve=()=>{},tt=()=>{}){Cu(F,M,{during:this.leave.during,start:this.leave.start,end:this.leave.end},Ve,tt)}})}window.Element.prototype._x_toggleAndCascadeWithTransitions=function(F,M,Ee,Ve){const tt=document.visibilityState==="visible"?requestAnimationFrame:setTimeout;let Ze=()=>tt(Ee);if(M){F._x_transition&&(F._x_transition.enter||F._x_transition.leave)?F._x_transition.enter&&(Object.entries(F._x_transition.enter.during).length||Object.entries(F._x_transition.enter.start).length||Object.entries(F._x_transition.enter.end).length)?F._x_transition.in(Ee):Ze():F._x_transition?F._x_transition.in(Ee):Ze();return}F._x_hidePromise=F._x_transition?new Promise((pt,gt)=>{F._x_transition.out(()=>{},()=>pt(Ve)),F._x_transitioning&&F._x_transitioning.beforeCancel(()=>gt({isFromCancelledTransition:!0}))}):Promise.resolve(Ve),queueMicrotask(()=>{let pt=yi(F);pt?(pt._x_hideChildren||(pt._x_hideChildren=[]),pt._x_hideChildren.push(F)):tt(()=>{let gt=ln=>{let Io=Promise.all([ln._x_hidePromise,...(ln._x_hideChildren||[]).map(gt)]).then(([ss])=>ss==null?void 0:ss());return delete ln._x_hidePromise,delete ln._x_hideChildren,Io};gt(F).catch(ln=>{if(!ln.isFromCancelledTransition)throw ln})})})};function yi(F){let M=F.parentNode;if(M)return M._x_hidePromise?M:yi(M)}function Cu(F,M,{during:Ee,start:Ve,end:tt}={},Ze=()=>{},pt=()=>{}){if(F._x_transitioning&&F._x_transitioning.cancel(),Object.keys(Ee).length===0&&Object.keys(Ve).length===0&&Object.keys(tt).length===0){Ze(),pt();return}let gt,ln,Io;_u(F,{start(){gt=M(F,Ve)},during(){ln=M(F,Ee)},before:Ze,end(){gt(),Io=M(F,tt)},after:pt,cleanup(){ln(),Io()}})}function _u(F,M){let Ee,Ve,tt,Ze=tc(()=>{$t(()=>{Ee=!0,Ve||M.before(),tt||(M.end(),Eo()),M.after(),F.isConnected&&M.cleanup(),delete F._x_transitioning})});F._x_transitioning={beforeCancels:[],beforeCancel(pt){this.beforeCancels.push(pt)},cancel:tc(function(){for(;this.beforeCancels.length;)this.beforeCancels.shift()();Ze()}),finish:Ze},$t(()=>{M.start(),M.during()}),Mc(),requestAnimationFrame(()=>{if(Ee)return;let pt=Number(getComputedStyle(F).transitionDuration.replace(/,.*/,"").replace("s",""))*1e3,gt=Number(getComputedStyle(F).transitionDelay.replace(/,.*/,"").replace("s",""))*1e3;pt===0&&(pt=Number(getComputedStyle(F).animationDuration.replace("s",""))*1e3),$t(()=>{M.before()}),Ve=!0,requestAnimationFrame(()=>{Ee||($t(()=>{M.end()}),Eo(),setTimeout(F._x_transitioning.finish,pt+gt),tt=!0)})})}function us(F,M,Ee){if(F.indexOf(M)===-1)return Ee;const Ve=F[F.indexOf(M)+1];if(!Ve||M==="scale"&&isNaN(Ve))return Ee;if(M==="duration"||M==="delay"){let tt=Ve.match(/([0-9]+)ms/);if(tt)return tt[1]}return M==="origin"&&["top","right","left","center","bottom"].includes(F[F.indexOf(M)+2])?[Ve,F[F.indexOf(M)+2]].join(" "):Ve}var al=!1;function pe(F,M=()=>{}){return(...Ee)=>al?M(...Ee):F(...Ee)}function Ge(F){return(...M)=>al&&F(...M)}var Qe=[];function Tt(F){Qe.push(F)}function pn(F,M){Qe.forEach(Ee=>Ee(F,M)),al=!0,Ds(()=>{yr(M,(Ee,Ve)=>{Ve(Ee,()=>{})})}),al=!1}var Sn=!1;function Cs(F,M){M._x_dataStack||(M._x_dataStack=F._x_dataStack),al=!0,Sn=!0,Ds(()=>{wr(M)}),al=!1,Sn=!1}function wr(F){let M=!1;yr(F,(Ve,tt)=>{Ur(Ve,(Ze,pt)=>{if(M&&vi(Ze))return pt();M=!0,tt(Ze,pt)})})}function Ds(F){let M=Oe;et((Ee,Ve)=>{let tt=M(Ee);return O(tt),()=>{}}),F(),et(M)}function lr(F,M,Ee,Ve=[]){switch(F._x_bindings||(F._x_bindings=ve({})),F._x_bindings[M]=Ee,M=Ve.includes("camel")?Bc(M):M,M){case"value":ds(F,Ee);break;case"style":Nc(F,Ee);break;case"class":Zr(F,Ee);break;case"selected":case"checked":gs(F,M,Ee);break;default:nd(F,M,Ee);break}}function ds(F,M){if(F.type==="radio")F.attributes.value===void 0&&(F.value=M),window.fromModel&&(typeof M=="boolean"?F.checked=eu(F.value)===M:F.checked=Kp(F.value,M));else if(F.type==="checkbox")Number.isInteger(M)?F.value=M:!Array.isArray(M)&&typeof M!="boolean"&&![null,void 0].includes(M)?F.value=String(M):Array.isArray(M)?F.checked=M.some(Ee=>Kp(Ee,F.value)):F.checked=!!M;else if(F.tagName==="SELECT")Fc(F,M);else{if(F.value===M)return;F.value=M===void 0?"":M}}function Zr(F,M){F._x_undoAddedClasses&&F._x_undoAddedClasses(),F._x_undoAddedClasses=xi(F,M)}function Nc(F,M){F._x_undoAddedStyles&&F._x_undoAddedStyles(),F._x_undoAddedStyles=Lr(F,M)}function gs(F,M,Ee){nd(F,M,Ee),lf(F,M,Ee)}function nd(F,M,Ee){[null,void 0,!1].includes(Ee)&&C0(M)?F.removeAttribute(M):(Zp(M)&&(Ee=M),Ld(F,M,Ee))}function Ld(F,M,Ee){F.getAttribute(M)!=Ee&&F.setAttribute(M,Ee)}function lf(F,M,Ee){F[M]!==Ee&&(F[M]=Ee)}function Fc(F,M){const Ee=[].concat(M).map(Ve=>Ve+"");Array.from(F.options).forEach(Ve=>{Ve.selected=Ee.includes(Ve.value)})}function Bc(F){return F.toLowerCase().replace(/-(\w)/g,(M,Ee)=>Ee.toUpperCase())}function Kp(F,M){return F==M}function eu(F){return[1,"1","true","on","yes",!0].includes(F)?!0:[0,"0","false","off","no",!1].includes(F)?!1:F?!!F:null}function Zp(F){return["disabled","checked","required","readonly","open","selected","autofocus","itemscope","multiple","novalidate","allowfullscreen","allowpaymentrequest","formnovalidate","autoplay","controls","loop","muted","playsinline","default","ismap","reversed","async","defer","nomodule"].includes(F)}function C0(F){return!["aria-pressed","aria-checked","aria-expanded","aria-selected"].includes(F)}function av(F,M,Ee){return F._x_bindings&&F._x_bindings[M]!==void 0?F._x_bindings[M]:Rd(F,M,Ee)}function hn(F,M,Ee,Ve=!0){if(F._x_bindings&&F._x_bindings[M]!==void 0)return F._x_bindings[M];if(F._x_inlineBindings&&F._x_inlineBindings[M]!==void 0){let tt=F._x_inlineBindings[M];return tt.extract=Ve,kr(()=>Yt(F,tt.expression))}return Rd(F,M,Ee)}function Rd(F,M,Ee){let Ve=F.getAttribute(M);return Ve===null?typeof Ee=="function"?Ee():Ee:Ve===""?!0:Zp(M)?!![M,"true"].includes(Ve):Ve}function Rh(F,M){var Ee;return function(){var Ve=this,tt=arguments,Ze=function(){Ee=null,F.apply(Ve,tt)};clearTimeout(Ee),Ee=setTimeout(Ze,M)}}function Od(F,M){let Ee;return function(){let Ve=this,tt=arguments;Ee||(F.apply(Ve,tt),Ee=!0,setTimeout(()=>Ee=!1,M))}}function wa({get:F,set:M},{get:Ee,set:Ve}){let tt=!0,Ze,pt=Oe(()=>{let gt=F(),ln=Ee();if(tt)Ve(Oh(gt)),tt=!1;else{let Io=JSON.stringify(gt),ss=JSON.stringify(ln);Io!==Ze?Ve(Oh(gt)):Io!==ss&&M(Oh(ln))}Ze=JSON.stringify(F()),JSON.stringify(Ee())});return()=>{O(pt)}}function Oh(F){return typeof F=="object"?JSON.parse(JSON.stringify(F)):F}function cf(F){(Array.isArray(F)?F:[F]).forEach(Ee=>Ee(da))}var uc={},Fm=!1;function Bm(F,M){if(Fm||(uc=ve(uc),Fm=!0),M===void 0)return uc[F];uc[F]=M,typeof M=="object"&&M!==null&&M.hasOwnProperty("init")&&typeof M.init=="function"&&uc[F].init(),jo(uc[F])}function Id(){return uc}var _0={};function qp(F,M){let Ee=typeof M!="function"?()=>M:M;return F instanceof Element?Xp(F,Ee()):(_0[F]=Ee,()=>{})}function Yp(F){return Object.entries(_0).forEach(([M,Ee])=>{Object.defineProperty(F,M,{get(){return(...Ve)=>Ee(...Ve)}})}),F}function Xp(F,M,Ee){let Ve=[];for(;Ve.length;)Ve.pop()();let tt=Object.entries(M).map(([pt,gt])=>({name:pt,value:gt})),Ze=Ot(tt);return tt=tt.map(pt=>Ze.find(gt=>gt.name===pt.name)?{name:`x-bind:${pt.name}`,value:`"${pt.value}"`}:pt),Ie(F,tt,Ee).map(pt=>{Ve.push(pt.runCleanups),pt()}),()=>{for(;Ve.length;)Ve.pop()()}}var $m={};function Jp(F,M){$m[F]=M}function Ih(F,M){return Object.entries($m).forEach(([Ee,Ve])=>{Object.defineProperty(F,Ee,{get(){return(...tt)=>Ve.bind(M)(...tt)},enumerable:!1})}),F}var tu={get reactive(){return ve},get release(){return O},get effect(){return Oe},get raw(){return De},version:"3.14.1",flushAndStopDeferringMutations:Ct,dontAutoEvaluateFunctions:kr,disableEffectScheduling:st,startObservingMutations:An,stopObservingMutations:jn,setReactivityEngine:Ut,onAttributeRemoved:an,onAttributesAdded:vt,closestDataStack:Qt,skipDuringClone:pe,onlyDuringClone:Ge,addRootSelector:Aa,addInitSelector:Qa,interceptClone:Tt,addScopeToNode:Jt,deferMutations:Dn,mapAttributes:Lo,evaluateLater:Ps,interceptInit:ca,setEvaluator:_i,mergeProxies:Cn,extractProp:hn,findClosest:Na,onElRemoved:on,closestRoot:La,destroyTree:Ql,interceptor:ms,transition:Cu,setStyles:Lr,mutateDom:$t,directive:ao,entangle:wa,throttle:Od,debounce:Rh,evaluate:Yt,initTree:yr,nextTick:ua,prefixed:Gn,prefix:yn,plugin:cf,magic:gn,store:Bm,start:li,clone:Cs,cloneNode:pn,bound:av,$data:Kn,watch:Xe,walk:Ur,data:Jp,bind:qp},da=tu,ls=R(Q());gn("nextTick",()=>ua),gn("dispatch",F=>ai.bind(ai,F)),gn("watch",(F,{evaluateLater:M,cleanup:Ee})=>(Ve,tt)=>{let Ze=M(Ve),gt=Xe(()=>{let ln;return Ze(Io=>ln=Io),ln},tt);Ee(gt)}),gn("store",Id),gn("data",F=>Kn(F)),gn("root",F=>La(F)),gn("refs",F=>(F._x_refs_proxy||(F._x_refs_proxy=Cn($c(F))),F._x_refs_proxy));function $c(F){let M=[];return Na(F,Ee=>{Ee._x_refs&&M.push(Ee._x_refs)}),M}var $l={};function Tu(F){return $l[F]||($l[F]=0),++$l[F]}function uf(F,M){return Na(F,Ee=>{if(Ee._x_ids&&Ee._x_ids[M])return!0})}function ll(F,M){F._x_ids||(F._x_ids={}),F._x_ids[M]||(F._x_ids[M]=Tu(M))}gn("id",(F,{cleanup:M})=>(Ee,Ve=null)=>{let tt=`${Ee}${Ve?`-${Ve}`:""}`;return ti(F,tt,M,()=>{let Ze=uf(F,Ee),pt=Ze?Ze._x_ids[Ee]:Tu(Ee);return Ve?`${Ee}-${pt}-${Ve}`:`${Ee}-${pt}`})}),Tt((F,M)=>{F._x_id&&(M._x_id=F._x_id)});function ti(F,M,Ee,Ve){if(F._x_id||(F._x_id={}),F._x_id[M])return F._x_id[M];let tt=Ve();return F._x_id[M]=tt,Ee(()=>{delete F._x_id[M]}),tt}gn("el",F=>F),Ph("Focus","focus","focus"),Ph("Persist","persist","persist");function Ph(F,M,Ee){gn(M,Ve=>Ti(`You can't use [$${M}] without first installing the "${F}" plugin here: https://alpinejs.dev/plugins/${Ee}`,Ve))}ao("modelable",(F,{expression:M},{effect:Ee,evaluateLater:Ve,cleanup:tt})=>{let Ze=Ve(M),pt=()=>{let ss;return Ze(Sr=>ss=Sr),ss},gt=Ve(`${M} = __placeholder`),ln=ss=>gt(()=>{},{scope:{__placeholder:ss}}),Io=pt();ln(Io),queueMicrotask(()=>{if(!F._x_model)return;F._x_removeModelListeners.default();let ss=F._x_model.get,Sr=F._x_model.set,vs=wa({get(){return ss()},set(_s){Sr(_s)}},{get(){return pt()},set(_s){ln(_s)}});tt(vs)})}),ao("teleport",(F,{modifiers:M,expression:Ee},{cleanup:Ve})=>{F.tagName.toLowerCase()!=="template"&&Ti("x-teleport can only be used on a <template> tag",F);let tt=ci(Ee),Ze=F.content.cloneNode(!0).firstElementChild;F._x_teleport=Ze,Ze._x_teleportBack=F,F.setAttribute("data-teleport-template",!0),Ze.setAttribute("data-teleport-target",!0),F._x_forwardEvents&&F._x_forwardEvents.forEach(gt=>{Ze.addEventListener(gt,ln=>{ln.stopPropagation(),F.dispatchEvent(new ln.constructor(ln.type,ln))})}),Jt(Ze,{},F);let pt=(gt,ln,Io)=>{Io.includes("prepend")?ln.parentNode.insertBefore(gt,ln):Io.includes("append")?ln.parentNode.insertBefore(gt,ln.nextSibling):ln.appendChild(gt)};$t(()=>{pt(Ze,tt,M),pe(()=>{yr(Ze),Ze._x_ignore=!0})()}),F._x_teleportPutBack=()=>{let gt=ci(Ee);$t(()=>{pt(F._x_teleport,gt,M)})},Ve(()=>Ze.remove())});var Hl=document.createElement("div");function ci(F){let M=pe(()=>document.querySelector(F),()=>Hl)();return M||Ti(`Cannot find x-teleport element for selector: "${F}"`),M}var ui=()=>{};ui.inline=(F,{modifiers:M},{cleanup:Ee})=>{M.includes("self")?F._x_ignoreSelf=!0:F._x_ignore=!0,Ee(()=>{M.includes("self")?delete F._x_ignoreSelf:delete F._x_ignore})},ao("ignore",ui),ao("effect",pe((F,{expression:M},{effect:Ee})=>{Ee(Ps(F,M))}));function $s(F,M,Ee,Ve){let tt=F,Ze=ln=>Ve(ln),pt={},gt=(ln,Io)=>ss=>Io(ln,ss);if(Ee.includes("dot")&&(M=Hc(M)),Ee.includes("camel")&&(M=Oa(M)),Ee.includes("passive")&&(pt.passive=!0),Ee.includes("capture")&&(pt.capture=!0),Ee.includes("window")&&(tt=window),Ee.includes("document")&&(tt=document),Ee.includes("debounce")){let ln=Ee[Ee.indexOf("debounce")+1]||"invalid-wait",Io=Ul(ln.split("ms")[0])?Number(ln.split("ms")[0]):250;Ze=Rh(Ze,Io)}if(Ee.includes("throttle")){let ln=Ee[Ee.indexOf("throttle")+1]||"invalid-wait",Io=Ul(ln.split("ms")[0])?Number(ln.split("ms")[0]):250;Ze=Od(Ze,Io)}return Ee.includes("prevent")&&(Ze=gt(Ze,(ln,Io)=>{Io.preventDefault(),ln(Io)})),Ee.includes("stop")&&(Ze=gt(Ze,(ln,Io)=>{Io.stopPropagation(),ln(Io)})),Ee.includes("once")&&(Ze=gt(Ze,(ln,Io)=>{ln(Io),tt.removeEventListener(M,Ze,pt)})),(Ee.includes("away")||Ee.includes("outside"))&&(tt=document,Ze=gt(Ze,(ln,Io)=>{F.contains(Io.target)||Io.target.isConnected!==!1&&(F.offsetWidth<1&&F.offsetHeight<1||F._x_isShown!==!1&&ln(Io))})),Ee.includes("self")&&(Ze=gt(Ze,(ln,Io)=>{Io.target===F&&ln(Io)})),(Xi(M)||Vf(M))&&(Ze=gt(Ze,(ln,Io)=>{Oi(Io,Ee)||ln(Io)})),tt.addEventListener(M,Ze,pt),()=>{tt.removeEventListener(M,Ze,pt)}}function Hc(F){return F.replace(/-/g,".")}function Oa(F){return F.toLowerCase().replace(/-(\w)/g,(M,Ee)=>Ee.toUpperCase())}function Ul(F){return!Array.isArray(F)&&!isNaN(F)}function dc(F){return[" ","_"].includes(F)?F:F.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]/,"-").toLowerCase()}function Xi(F){return["keydown","keyup"].includes(F)}function Vf(F){return["contextmenu","click","mouse"].some(M=>F.includes(M))}function Oi(F,M){let Ee=M.filter(Ze=>!["window","document","prevent","stop","once","capture","self","away","outside","passive"].includes(Ze));if(Ee.includes("debounce")){let Ze=Ee.indexOf("debounce");Ee.splice(Ze,Ul((Ee[Ze+1]||"invalid-wait").split("ms")[0])?2:1)}if(Ee.includes("throttle")){let Ze=Ee.indexOf("throttle");Ee.splice(Ze,Ul((Ee[Ze+1]||"invalid-wait").split("ms")[0])?2:1)}if(Ee.length===0||Ee.length===1&&Ys(F.key).includes(Ee[0]))return!1;const tt=["ctrl","shift","alt","meta","cmd","super"].filter(Ze=>Ee.includes(Ze));return Ee=Ee.filter(Ze=>!tt.includes(Ze)),!(tt.length>0&&tt.filter(pt=>((pt==="cmd"||pt==="super")&&(pt="meta"),F[`${pt}Key`])).length===tt.length&&(Vf(F.type)||Ys(F.key).includes(Ee[0])))}function Ys(F){if(!F)return[];F=dc(F);let M={ctrl:"control",slash:"/",space:" ",spacebar:" ",cmd:"meta",esc:"escape",up:"arrow-up",down:"arrow-down",left:"arrow-left",right:"arrow-right",period:".",comma:",",equal:"=",minus:"-",underscore:"_"};return M[F]=F,Object.keys(M).map(Ee=>{if(M[Ee]===F)return Ee}).filter(Ee=>Ee)}ao("model",(F,{modifiers:M,expression:Ee},{effect:Ve,cleanup:tt})=>{let Ze=F;M.includes("parent")&&(Ze=F.parentNode);let pt=Ps(Ze,Ee),gt;typeof Ee=="string"?gt=Ps(Ze,`${Ee} = __placeholder`):typeof Ee=="function"&&typeof Ee()=="string"?gt=Ps(Ze,`${Ee()} = __placeholder`):gt=()=>{};let ln=()=>{let vs;return pt(_s=>vs=_s),Pd(vs)?vs.get():vs},Io=vs=>{let _s;pt(ki=>_s=ki),Pd(_s)?_s.set(vs):gt(()=>{},{scope:{__placeholder:vs}})};typeof Ee=="string"&&F.type==="radio"&&$t(()=>{F.hasAttribute("name")||F.setAttribute("name",Ee)});var ss=F.tagName.toLowerCase()==="select"||["checkbox","radio"].includes(F.type)||M.includes("lazy")?"change":"input";let Sr=al?()=>{}:$s(F,ss,M,vs=>{Io(fc(F,M,vs,ln()))});if(M.includes("fill")&&([void 0,null,""].includes(ln())||F.type==="checkbox"&&Array.isArray(ln())||F.tagName.toLowerCase()==="select"&&F.multiple)&&Io(fc(F,M,{target:F},ln())),F._x_removeModelListeners||(F._x_removeModelListeners={}),F._x_removeModelListeners.default=Sr,tt(()=>F._x_removeModelListeners.default()),F.form){let vs=$s(F.form,"reset",[],_s=>{ua(()=>F._x_model&&F._x_model.set(fc(F,M,{target:F},ln())))});tt(()=>vs())}F._x_model={get(){return ln()},set(vs){Io(vs)}},F._x_forceModelUpdate=vs=>{vs===void 0&&typeof Ee=="string"&&Ee.match(/\./)&&(vs=""),window.fromModel=!0,$t(()=>lr(F,"value",vs)),delete window.fromModel},Ve(()=>{let vs=ln();M.includes("unintrusive")&&document.activeElement.isSameNode(F)||F._x_forceModelUpdate(vs)})});function fc(F,M,Ee,Ve){return $t(()=>{if(Ee instanceof CustomEvent&&Ee.detail!==void 0)return Ee.detail!==null&&Ee.detail!==void 0?Ee.detail:Ee.target.value;if(F.type==="checkbox")if(Array.isArray(Ve)){let tt=null;return M.includes("number")?tt=hc(Ee.target.value):M.includes("boolean")?tt=eu(Ee.target.value):tt=Ee.target.value,Ee.target.checked?Ve.includes(tt)?Ve:Ve.concat([tt]):Ve.filter(Ze=>!Ii(Ze,tt))}else return Ee.target.checked;else{if(F.tagName.toLowerCase()==="select"&&F.multiple)return M.includes("number")?Array.from(Ee.target.selectedOptions).map(tt=>{let Ze=tt.value||tt.text;return hc(Ze)}):M.includes("boolean")?Array.from(Ee.target.selectedOptions).map(tt=>{let Ze=tt.value||tt.text;return eu(Ze)}):Array.from(Ee.target.selectedOptions).map(tt=>tt.value||tt.text);{let tt;return F.type==="radio"?Ee.target.checked?tt=Ee.target.value:tt=Ve:tt=Ee.target.value,M.includes("number")?hc(tt):M.includes("boolean")?eu(tt):M.includes("trim")?tt.trim():tt}}})}function hc(F){let M=F?parseFloat(F):null;return ho(M)?M:F}function Ii(F,M){return F==M}function ho(F){return!Array.isArray(F)&&!isNaN(F)}function Pd(F){return F!==null&&typeof F=="object"&&typeof F.get=="function"&&typeof F.set=="function"}ao("cloak",F=>queueMicrotask(()=>$t(()=>F.removeAttribute(Gn("cloak"))))),Qa(()=>`[${Gn("init")}]`),ao("init",pe((F,{expression:M},{evaluate:Ee})=>typeof M=="string"?!!M.trim()&&Ee(M,{},!1):Ee(M,{},!1))),ao("text",(F,{expression:M},{effect:Ee,evaluateLater:Ve})=>{let tt=Ve(M);Ee(()=>{tt(Ze=>{$t(()=>{F.textContent=Ze})})})}),ao("html",(F,{expression:M},{effect:Ee,evaluateLater:Ve})=>{let tt=Ve(M);Ee(()=>{tt(Ze=>{$t(()=>{F.innerHTML=Ze,F._x_ignoreSelf=!0,yr(F),delete F._x_ignoreSelf})})})}),Lo(zn(":",Ko(Gn("bind:"))));var mc=(F,{value:M,modifiers:Ee,expression:Ve,original:tt},{effect:Ze,cleanup:pt})=>{if(!M){let ln={};Yp(ln),Ps(F,Ve)(ss=>{Xp(F,ss,tt)},{scope:ln});return}if(M==="key")return nr(F,Ve);if(F._x_inlineBindings&&F._x_inlineBindings[M]&&F._x_inlineBindings[M].extract)return;let gt=Ps(F,Ve);Ze(()=>gt(ln=>{ln===void 0&&typeof Ve=="string"&&Ve.match(/\./)&&(ln=""),$t(()=>lr(F,M,ln,Ee))})),pt(()=>{F._x_undoAddedClasses&&F._x_undoAddedClasses(),F._x_undoAddedStyles&&F._x_undoAddedStyles()})};mc.inline=(F,{value:M,modifiers:Ee,expression:Ve})=>{M&&(F._x_inlineBindings||(F._x_inlineBindings={}),F._x_inlineBindings[M]={expression:Ve,extract:!1})},ao("bind",mc);function nr(F,M){F._x_keyExpression=M}Aa(()=>`[${Gn("data")}]`),ao("data",(F,{expression:M},{cleanup:Ee})=>{if(od(F))return;M=M===""?"{}":M;let Ve={};At(Ve,F);let tt={};Ih(tt,Ve);let Ze=Yt(F,M,{scope:tt});(Ze===void 0||Ze===!0)&&(Ze={}),At(Ze,F);let pt=ve(Ze);jo(pt);let gt=Jt(F,pt);pt.init&&Yt(F,pt.init),Ee(()=>{pt.destroy&&Yt(F,pt.destroy),gt()})}),Tt((F,M)=>{F._x_dataStack&&(M._x_dataStack=F._x_dataStack,M.setAttribute("data-has-alpine-state",!0))});function od(F){return al?Sn?!0:F.hasAttribute("data-has-alpine-state"):!1}ao("show",(F,{modifiers:M,expression:Ee},{effect:Ve})=>{let tt=Ps(F,Ee);F._x_doHide||(F._x_doHide=()=>{$t(()=>{F.style.setProperty("display","none",M.includes("important")?"important":void 0)})}),F._x_doShow||(F._x_doShow=()=>{$t(()=>{F.style.length===1&&F.style.display==="none"?F.removeAttribute("style"):F.style.removeProperty("display")})});let Ze=()=>{F._x_doHide(),F._x_isShown=!1},pt=()=>{F._x_doShow(),F._x_isShown=!0},gt=()=>setTimeout(pt),ln=tc(Sr=>Sr?pt():Ze(),Sr=>{typeof F._x_toggleAndCascadeWithTransitions=="function"?F._x_toggleAndCascadeWithTransitions(F,Sr,pt,Ze):Sr?gt():Ze()}),Io,ss=!0;Ve(()=>tt(Sr=>{!ss&&Sr===Io||(M.includes("immediate")&&(Sr?gt():Ze()),ln(Sr),Io=Sr,ss=!1)}))}),ao("for",(F,{expression:M},{effect:Ee,cleanup:Ve})=>{let tt=nu(M),Ze=Ps(F,tt.items),pt=Ps(F,F._x_keyExpression||"index");F._x_prevKeys=[],F._x_lookup={},Ee(()=>zf(F,tt,Ze,pt)),Ve(()=>{Object.values(F._x_lookup).forEach(gt=>gt.remove()),delete F._x_prevKeys,delete F._x_lookup})});function zf(F,M,Ee,Ve){let tt=pt=>typeof pt=="object"&&!Array.isArray(pt),Ze=F;Ee(pt=>{cl(pt)&&pt>=0&&(pt=Array.from(Array(pt).keys(),ns=>ns+1)),pt===void 0&&(pt=[]);let gt=F._x_lookup,ln=F._x_prevKeys,Io=[],ss=[];if(tt(pt))pt=Object.entries(pt).map(([ns,Vs])=>{let xs=os(M,Vs,ns,pt);Ve(ks=>{ss.includes(ks)&&Ti("Duplicate key on x-for",F),ss.push(ks)},{scope:{index:ns,...xs}}),Io.push(xs)});else for(let ns=0;ns<pt.length;ns++){let Vs=os(M,pt[ns],ns,pt);Ve(xs=>{ss.includes(xs)&&Ti("Duplicate key on x-for",F),ss.push(xs)},{scope:{index:ns,...Vs}}),Io.push(Vs)}let Sr=[],vs=[],_s=[],ki=[];for(let ns=0;ns<ln.length;ns++){let Vs=ln[ns];ss.indexOf(Vs)===-1&&_s.push(Vs)}ln=ln.filter(ns=>!_s.includes(ns));let Sl="template";for(let ns=0;ns<ss.length;ns++){let Vs=ss[ns],xs=ln.indexOf(Vs);if(xs===-1)ln.splice(ns,0,Vs),Sr.push([Sl,ns]);else if(xs!==ns){let ks=ln.splice(ns,1)[0],Wn=ln.splice(xs-1,1)[0];ln.splice(ns,0,Wn),ln.splice(xs,0,ks),vs.push([ks,Wn])}else ki.push(Vs);Sl=Vs}for(let ns=0;ns<_s.length;ns++){let Vs=_s[ns];gt[Vs]._x_effects&&gt[Vs]._x_effects.forEach(Ue),gt[Vs].remove(),gt[Vs]=null,delete gt[Vs]}for(let ns=0;ns<vs.length;ns++){let[Vs,xs]=vs[ns],ks=gt[Vs],Wn=gt[xs],cr=document.createElement("div");$t(()=>{Wn||Ti('x-for ":key" is undefined or invalid',Ze,xs,gt),Wn.after(cr),ks.after(Wn),Wn._x_currentIfEl&&Wn.after(Wn._x_currentIfEl),cr.before(ks),ks._x_currentIfEl&&ks.after(ks._x_currentIfEl),cr.remove()}),Wn._x_refreshXForScope(Io[ss.indexOf(xs)])}for(let ns=0;ns<Sr.length;ns++){let[Vs,xs]=Sr[ns],ks=Vs==="template"?Ze:gt[Vs];ks._x_currentIfEl&&(ks=ks._x_currentIfEl);let Wn=Io[xs],cr=ss[xs],el=document.importNode(Ze.content,!0).firstElementChild,sd=ve(Wn);Jt(el,sd,Ze),el._x_refreshXForScope=ou=>{Object.entries(ou).forEach(([Sa,su])=>{sd[Sa]=su})},$t(()=>{ks.after(el),pe(()=>yr(el))()}),typeof cr=="object"&&Ti("x-for key cannot be an object, it must be a string or an integer",Ze),gt[cr]=el}for(let ns=0;ns<ki.length;ns++)gt[ki[ns]]._x_refreshXForScope(Io[ss.indexOf(ki[ns])]);Ze._x_prevKeys=ss})}function nu(F){let M=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Ee=/^\s*\(|\)\s*$/g,Ve=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,tt=F.match(Ve);if(!tt)return;let Ze={};Ze.items=tt[2].trim();let pt=tt[1].replace(Ee,"").trim(),gt=pt.match(M);return gt?(Ze.item=pt.replace(M,"").trim(),Ze.index=gt[1].trim(),gt[2]&&(Ze.collection=gt[2].trim())):Ze.item=pt,Ze}function os(F,M,Ee,Ve){let tt={};return/^\[.*\]$/.test(F.item)&&Array.isArray(M)?F.item.replace("[","").replace("]","").split(",").map(pt=>pt.trim()).forEach((pt,gt)=>{tt[pt]=M[gt]}):/^\{.*\}$/.test(F.item)&&!Array.isArray(M)&&typeof M=="object"?F.item.replace("{","").replace("}","").split(",").map(pt=>pt.trim()).forEach(pt=>{tt[pt]=M[pt]}):tt[F.item]=M,F.index&&(tt[F.index]=Ee),F.collection&&(tt[F.collection]=Ve),tt}function cl(F){return!Array.isArray(F)&&!isNaN(F)}function Mh(){}Mh.inline=(F,{expression:M},{cleanup:Ee})=>{let Ve=La(F);Ve._x_refs||(Ve._x_refs={}),Ve._x_refs[M]=F,Ee(()=>delete Ve._x_refs[M])},ao("ref",Mh),ao("if",(F,{expression:M},{effect:Ee,cleanup:Ve})=>{F.tagName.toLowerCase()!=="template"&&Ti("x-if can only be used on a <template> tag",F);let tt=Ps(F,M),Ze=()=>{if(F._x_currentIfEl)return F._x_currentIfEl;let gt=F.content.cloneNode(!0).firstElementChild;return Jt(gt,{},F),$t(()=>{F.after(gt),pe(()=>yr(gt))()}),F._x_currentIfEl=gt,F._x_undoIf=()=>{Ur(gt,ln=>{ln._x_effects&&ln._x_effects.forEach(Ue)}),gt.remove(),delete F._x_currentIfEl},gt},pt=()=>{F._x_undoIf&&(F._x_undoIf(),delete F._x_undoIf)};Ee(()=>tt(gt=>{gt?Ze():pt()})),Ve(()=>F._x_undoIf&&F._x_undoIf())}),ao("id",(F,{expression:M},{evaluate:Ee})=>{Ee(M).forEach(tt=>ll(F,tt))}),Tt((F,M)=>{F._x_ids&&(M._x_ids=F._x_ids)}),Lo(zn("@",Ko(Gn("on:")))),ao("on",pe((F,{value:M,modifiers:Ee,expression:Ve},{cleanup:tt})=>{let Ze=Ve?Ps(F,Ve):()=>{};F.tagName.toLowerCase()==="template"&&(F._x_forwardEvents||(F._x_forwardEvents=[]),F._x_forwardEvents.includes(M)||F._x_forwardEvents.push(M));let pt=$s(F,M,Ee,gt=>{Ze(()=>{},{scope:{$event:gt},params:[gt]})});tt(()=>pt())})),df("Collapse","collapse","collapse"),df("Intersect","intersect","intersect"),df("Focus","trap","focus"),df("Mask","mask","mask");function df(F,M,Ee){ao(M,Ve=>Ti(`You can't use [x-${M}] without first installing the "${F}" plugin here: https://alpinejs.dev/plugins/${Ee}`,Ve))}da.setEvaluator(bs),da.setReactivityEngine({reactive:ls.reactive,effect:ls.effect,release:ls.stop,raw:ls.toRaw});var Md=da,pc=Md}}),fre=E0({"node_modules/@alpinejs/collapse/dist/module.cjs.js"(l,n){var o=Object.defineProperty,i=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,h=Object.prototype.hasOwnProperty,g=(z,$)=>{for(var W in $)o(z,W,{get:$[W],enumerable:!0})},b=(z,$,W,Q)=>{if($&&typeof $=="object"||typeof $=="function")for(let j of u($))!h.call(z,j)&&j!==W&&o(z,j,{get:()=>$[j],enumerable:!(Q=i($,j))||Q.enumerable});return z},S=z=>b(o({},"__esModule",{value:!0}),z),T={};g(T,{collapse:()=>k,default:()=>V}),n.exports=S(T);function k(z){z.directive("collapse",$),$.inline=(W,{modifiers:Q})=>{Q.includes("min")&&(W._x_doShow=()=>{},W._x_doHide=()=>{})};function $(W,{modifiers:Q}){let j=R(Q,"duration",250)/1e3,se=R(Q,"min",0),re=!Q.includes("min");W._x_isShown||(W.style.height=`${se}px`),!W._x_isShown&&re&&(W.hidden=!0),W._x_isShown||(W.style.overflow="hidden");let Y=(ae,Ce)=>{let Ue=z.setStyles(ae,Ce);return Ce.height?()=>{}:Ue},me={transitionProperty:"height",transitionDuration:`${j}s`,transitionTimingFunction:"cubic-bezier(0.4, 0.0, 0.2, 1)"};W._x_transition={in(ae=()=>{},Ce=()=>{}){re&&(W.hidden=!1),re&&(W.style.display=null);let Ue=W.getBoundingClientRect().height;W.style.height="auto";let ot=W.getBoundingClientRect().height;Ue===ot&&(Ue=se),z.transition(W,z.setStyles,{during:me,start:{height:Ue+"px"},end:{height:ot+"px"}},()=>W._x_isShown=!0,()=>{Math.abs(W.getBoundingClientRect().height-ot)<1&&(W.style.overflow=null)})},out(ae=()=>{},Ce=()=>{}){let Ue=W.getBoundingClientRect().height;z.transition(W,Y,{during:me,start:{height:Ue+"px"},end:{height:se+"px"}},()=>W.style.overflow="hidden",()=>{W._x_isShown=!1,W.style.height==`${se}px`&&re&&(W.style.display="none",W.hidden=!0)})}}}}function R(z,$,W){if(z.indexOf($)===-1)return W;const Q=z[z.indexOf($)+1];if(!Q)return W;if($==="duration"){let j=Q.match(/([0-9]+)ms/);if(j)return j[1]}if($==="min"){let j=Q.match(/([0-9]+)px/);if(j)return j[1]}return Q}var V=k}}),hre=E0({"node_modules/@alpinejs/focus/dist/module.cjs.js"(l,n){var o=Object.create,i=Object.defineProperty,u=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyNames,g=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty,S=(Ce,Ue)=>function(){return Ue||(0,Ce[h(Ce)[0]])((Ue={exports:{}}).exports,Ue),Ue.exports},T=(Ce,Ue)=>{for(var ot in Ue)i(Ce,ot,{get:Ue[ot],enumerable:!0})},k=(Ce,Ue,ot,Ae)=>{if(Ue&&typeof Ue=="object"||typeof Ue=="function")for(let ve of h(Ue))!b.call(Ce,ve)&&ve!==ot&&i(Ce,ve,{get:()=>Ue[ve],enumerable:!(Ae=u(Ue,ve))||Ae.enumerable});return Ce},R=(Ce,Ue,ot)=>(ot=Ce!=null?o(g(Ce)):{},k(Ue||!Ce||!Ce.__esModule?i(ot,"default",{value:Ce,enumerable:!0}):ot,Ce)),V=Ce=>k(i({},"__esModule",{value:!0}),Ce),z=S({"node_modules/tabbable/dist/index.js"(Ce){Object.defineProperty(Ce,"__esModule",{value:!0});var Ue=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"],ot=Ue.join(","),Ae=typeof Element>"u",ve=Ae?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Oe=!Ae&&Element.prototype.getRootNode?function($t){return $t.getRootNode()}:function($t){return $t.ownerDocument},O=function(xe,It,Dn){var Ct=Array.prototype.slice.apply(xe.querySelectorAll(ot));return It&&ve.call(xe,ot)&&Ct.unshift(xe),Ct=Ct.filter(Dn),Ct},De=function $t(xe,It,Dn){for(var Ct=[],yo=Array.from(xe);yo.length;){var Kn=yo.shift();if(Kn.tagName==="SLOT"){var Jt=Kn.assignedElements(),Qt=Jt.length?Jt:Kn.children,Cn=$t(Qt,!0,Dn);Dn.flatten?Ct.push.apply(Ct,Cn):Ct.push({scope:Kn,candidates:Cn})}else{var Nn=ve.call(Kn,ot);Nn&&Dn.filter(Kn)&&(It||!xe.includes(Kn))&&Ct.push(Kn);var kt=Kn.shadowRoot||typeof Dn.getShadowRoot=="function"&&Dn.getShadowRoot(Kn),jo=!Dn.shadowRootFilter||Dn.shadowRootFilter(Kn);if(kt&&jo){var ms=$t(kt===!0?Kn.children:kt.children,!0,Dn);Dn.flatten?Ct.push.apply(Ct,ms):Ct.push({scope:Kn,candidates:ms})}else yo.unshift.apply(yo,Kn.children)}}return Ct},Fe=function(xe,It){return xe.tabIndex<0&&(It||/^(AUDIO|VIDEO|DETAILS)$/.test(xe.tagName)||xe.isContentEditable)&&isNaN(parseInt(xe.getAttribute("tabindex"),10))?0:xe.tabIndex},st=function(xe,It){return xe.tabIndex===It.tabIndex?xe.documentOrder-It.documentOrder:xe.tabIndex-It.tabIndex},Ut=function(xe){return xe.tagName==="INPUT"},et=function(xe){return Ut(xe)&&xe.type==="hidden"},Dt=function(xe){var It=xe.tagName==="DETAILS"&&Array.prototype.slice.apply(xe.children).some(function(Dn){return Dn.tagName==="SUMMARY"});return It},Xe=function(xe,It){for(var Dn=0;Dn<xe.length;Dn++)if(xe[Dn].checked&&xe[Dn].form===It)return xe[Dn]},it=function(xe){if(!xe.name)return!0;var It=xe.form||Oe(xe),Dn=function(Jt){return It.querySelectorAll('input[type="radio"][name="'+Jt+'"]')},Ct;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")Ct=Dn(window.CSS.escape(xe.name));else try{Ct=Dn(xe.name)}catch(Kn){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",Kn.message),!1}var yo=Xe(Ct,xe.form);return!yo||yo===xe},qe=function(xe){return Ut(xe)&&xe.type==="radio"},mt=function(xe){return qe(xe)&&!it(xe)},Un=function(xe){var It=xe.getBoundingClientRect(),Dn=It.width,Ct=It.height;return Dn===0&&Ct===0},on=function(xe,It){var Dn=It.displayCheck,Ct=It.getShadowRoot;if(getComputedStyle(xe).visibility==="hidden")return!0;var yo=ve.call(xe,"details>summary:first-of-type"),Kn=yo?xe.parentElement:xe;if(ve.call(Kn,"details:not([open]) *"))return!0;var Jt=Oe(xe).host,Qt=(Jt==null?void 0:Jt.ownerDocument.contains(Jt))||xe.ownerDocument.contains(xe);if(!Dn||Dn==="full"){if(typeof Ct=="function"){for(var Cn=xe;xe;){var Nn=xe.parentElement,kt=Oe(xe);if(Nn&&!Nn.shadowRoot&&Ct(Nn)===!0)return Un(xe);xe.assignedSlot?xe=xe.assignedSlot:!Nn&&kt!==xe.ownerDocument?xe=kt.host:xe=Nn}xe=Cn}if(Qt)return!xe.getClientRects().length}else if(Dn==="non-zero-area")return Un(xe);return!1},vt=function(xe){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(xe.tagName))for(var It=xe.parentElement;It;){if(It.tagName==="FIELDSET"&&It.disabled){for(var Dn=0;Dn<It.children.length;Dn++){var Ct=It.children.item(Dn);if(Ct.tagName==="LEGEND")return ve.call(It,"fieldset[disabled] *")?!0:!Ct.contains(xe)}return!0}It=It.parentElement}return!1},an=function(xe,It){return!(It.disabled||et(It)||on(It,xe)||Dt(It)||vt(It))},J=function(xe,It){return!(mt(It)||Fe(It)<0||!an(xe,It))},Bn=function(xe){var It=parseInt(xe.getAttribute("tabindex"),10);return!!(isNaN(It)||It>=0)},Vn=function $t(xe){var It=[],Dn=[];return xe.forEach(function(Ct,yo){var Kn=!!Ct.scope,Jt=Kn?Ct.scope:Ct,Qt=Fe(Jt,Kn),Cn=Kn?$t(Ct.candidates):Jt;Qt===0?Kn?It.push.apply(It,Cn):It.push(Jt):Dn.push({documentOrder:yo,tabIndex:Qt,item:Ct,isScope:Kn,content:Cn})}),Dn.sort(st).reduce(function(Ct,yo){return yo.isScope?Ct.push.apply(Ct,yo.content):Ct.push(yo.content),Ct},[]).concat(It)},Rn=function(xe,It){It=It||{};var Dn;return It.getShadowRoot?Dn=De([xe],It.includeContainer,{filter:J.bind(null,It),flatten:!1,getShadowRoot:It.getShadowRoot,shadowRootFilter:Bn}):Dn=O(xe,It.includeContainer,J.bind(null,It)),Vn(Dn)},An=function(xe,It){It=It||{};var Dn;return It.getShadowRoot?Dn=De([xe],It.includeContainer,{filter:an.bind(null,It),flatten:!0,getShadowRoot:It.getShadowRoot}):Dn=O(xe,It.includeContainer,an.bind(null,It)),Dn},jn=function(xe,It){if(It=It||{},!xe)throw new Error("No node provided");return ve.call(xe,ot)===!1?!1:J(It,xe)},to=Ue.concat("iframe").join(","),mo=function(xe,It){if(It=It||{},!xe)throw new Error("No node provided");return ve.call(xe,to)===!1?!1:an(It,xe)};Ce.focusable=An,Ce.isFocusable=mo,Ce.isTabbable=jn,Ce.tabbable=Rn}}),$=S({"node_modules/focus-trap/dist/focus-trap.js"(Ce){Object.defineProperty(Ce,"__esModule",{value:!0});var Ue=z();function ot(it,qe){var mt=Object.keys(it);if(Object.getOwnPropertySymbols){var Un=Object.getOwnPropertySymbols(it);qe&&(Un=Un.filter(function(on){return Object.getOwnPropertyDescriptor(it,on).enumerable})),mt.push.apply(mt,Un)}return mt}function Ae(it){for(var qe=1;qe<arguments.length;qe++){var mt=arguments[qe]!=null?arguments[qe]:{};qe%2?ot(Object(mt),!0).forEach(function(Un){ve(it,Un,mt[Un])}):Object.getOwnPropertyDescriptors?Object.defineProperties(it,Object.getOwnPropertyDescriptors(mt)):ot(Object(mt)).forEach(function(Un){Object.defineProperty(it,Un,Object.getOwnPropertyDescriptor(mt,Un))})}return it}function ve(it,qe,mt){return qe in it?Object.defineProperty(it,qe,{value:mt,enumerable:!0,configurable:!0,writable:!0}):it[qe]=mt,it}var Oe=function(){var it=[];return{activateTrap:function(mt){if(it.length>0){var Un=it[it.length-1];Un!==mt&&Un.pause()}var on=it.indexOf(mt);on===-1||it.splice(on,1),it.push(mt)},deactivateTrap:function(mt){var Un=it.indexOf(mt);Un!==-1&&it.splice(Un,1),it.length>0&&it[it.length-1].unpause()}}}(),O=function(qe){return qe.tagName&&qe.tagName.toLowerCase()==="input"&&typeof qe.select=="function"},De=function(qe){return qe.key==="Escape"||qe.key==="Esc"||qe.keyCode===27},Fe=function(qe){return qe.key==="Tab"||qe.keyCode===9},st=function(qe){return setTimeout(qe,0)},Ut=function(qe,mt){var Un=-1;return qe.every(function(on,vt){return mt(on)?(Un=vt,!1):!0}),Un},et=function(qe){for(var mt=arguments.length,Un=new Array(mt>1?mt-1:0),on=1;on<mt;on++)Un[on-1]=arguments[on];return typeof qe=="function"?qe.apply(void 0,Un):qe},Dt=function(qe){return qe.target.shadowRoot&&typeof qe.composedPath=="function"?qe.composedPath()[0]:qe.target},Xe=function(qe,mt){var Un=(mt==null?void 0:mt.document)||document,on=Ae({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0},mt),vt={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0},an,J=function(Jt,Qt,Cn){return Jt&&Jt[Qt]!==void 0?Jt[Qt]:on[Cn||Qt]},Bn=function(Jt){return vt.containerGroups.findIndex(function(Qt){var Cn=Qt.container,Nn=Qt.tabbableNodes;return Cn.contains(Jt)||Nn.find(function(kt){return kt===Jt})})},Vn=function(Jt){var Qt=on[Jt];if(typeof Qt=="function"){for(var Cn=arguments.length,Nn=new Array(Cn>1?Cn-1:0),kt=1;kt<Cn;kt++)Nn[kt-1]=arguments[kt];Qt=Qt.apply(void 0,Nn)}if(Qt===!0&&(Qt=void 0),!Qt){if(Qt===void 0||Qt===!1)return Qt;throw new Error("`".concat(Jt,"` was specified but was not a node, or did not return a node"))}var jo=Qt;if(typeof Qt=="string"&&(jo=Un.querySelector(Qt),!jo))throw new Error("`".concat(Jt,"` as selector refers to no known node"));return jo},Rn=function(){var Jt=Vn("initialFocus");if(Jt===!1)return!1;if(Jt===void 0)if(Bn(Un.activeElement)>=0)Jt=Un.activeElement;else{var Qt=vt.tabbableGroups[0],Cn=Qt&&Qt.firstTabbableNode;Jt=Cn||Vn("fallbackFocus")}if(!Jt)throw new Error("Your focus-trap needs to have at least one focusable element");return Jt},An=function(){if(vt.containerGroups=vt.containers.map(function(Jt){var Qt=Ue.tabbable(Jt,on.tabbableOptions),Cn=Ue.focusable(Jt,on.tabbableOptions);return{container:Jt,tabbableNodes:Qt,focusableNodes:Cn,firstTabbableNode:Qt.length>0?Qt[0]:null,lastTabbableNode:Qt.length>0?Qt[Qt.length-1]:null,nextTabbableNode:function(kt){var jo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,ms=Cn.findIndex(function(as){return as===kt});if(!(ms<0))return jo?Cn.slice(ms+1).find(function(as){return Ue.isTabbable(as,on.tabbableOptions)}):Cn.slice(0,ms).reverse().find(function(as){return Ue.isTabbable(as,on.tabbableOptions)})}}}),vt.tabbableGroups=vt.containerGroups.filter(function(Jt){return Jt.tabbableNodes.length>0}),vt.tabbableGroups.length<=0&&!Vn("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")},jn=function Kn(Jt){if(Jt!==!1&&Jt!==Un.activeElement){if(!Jt||!Jt.focus){Kn(Rn());return}Jt.focus({preventScroll:!!on.preventScroll}),vt.mostRecentlyFocusedNode=Jt,O(Jt)&&Jt.select()}},to=function(Jt){var Qt=Vn("setReturnFocus",Jt);return Qt||(Qt===!1?!1:Jt)},mo=function(Jt){var Qt=Dt(Jt);if(!(Bn(Qt)>=0)){if(et(on.clickOutsideDeactivates,Jt)){an.deactivate({returnFocus:on.returnFocusOnDeactivate&&!Ue.isFocusable(Qt,on.tabbableOptions)});return}et(on.allowOutsideClick,Jt)||Jt.preventDefault()}},$t=function(Jt){var Qt=Dt(Jt),Cn=Bn(Qt)>=0;Cn||Qt instanceof Document?Cn&&(vt.mostRecentlyFocusedNode=Qt):(Jt.stopImmediatePropagation(),jn(vt.mostRecentlyFocusedNode||Rn()))},xe=function(Jt){var Qt=Dt(Jt);An();var Cn=null;if(vt.tabbableGroups.length>0){var Nn=Bn(Qt),kt=Nn>=0?vt.containerGroups[Nn]:void 0;if(Nn<0)Jt.shiftKey?Cn=vt.tabbableGroups[vt.tabbableGroups.length-1].lastTabbableNode:Cn=vt.tabbableGroups[0].firstTabbableNode;else if(Jt.shiftKey){var jo=Ut(vt.tabbableGroups,function(At){var On=At.firstTabbableNode;return Qt===On});if(jo<0&&(kt.container===Qt||Ue.isFocusable(Qt,on.tabbableOptions)&&!Ue.isTabbable(Qt,on.tabbableOptions)&&!kt.nextTabbableNode(Qt,!1))&&(jo=Nn),jo>=0){var ms=jo===0?vt.tabbableGroups.length-1:jo-1,as=vt.tabbableGroups[ms];Cn=as.lastTabbableNode}}else{var xt=Ut(vt.tabbableGroups,function(At){var On=At.lastTabbableNode;return Qt===On});if(xt<0&&(kt.container===Qt||Ue.isFocusable(Qt,on.tabbableOptions)&&!Ue.isTabbable(Qt,on.tabbableOptions)&&!kt.nextTabbableNode(Qt))&&(xt=Nn),xt>=0){var Pt=xt===vt.tabbableGroups.length-1?0:xt+1,gn=vt.tabbableGroups[Pt];Cn=gn.firstTabbableNode}}}else Cn=Vn("fallbackFocus");Cn&&(Jt.preventDefault(),jn(Cn))},It=function(Jt){if(De(Jt)&&et(on.escapeDeactivates,Jt)!==!1){Jt.preventDefault(),an.deactivate();return}if(Fe(Jt)){xe(Jt);return}},Dn=function(Jt){var Qt=Dt(Jt);Bn(Qt)>=0||et(on.clickOutsideDeactivates,Jt)||et(on.allowOutsideClick,Jt)||(Jt.preventDefault(),Jt.stopImmediatePropagation())},Ct=function(){if(vt.active)return Oe.activateTrap(an),vt.delayInitialFocusTimer=on.delayInitialFocus?st(function(){jn(Rn())}):jn(Rn()),Un.addEventListener("focusin",$t,!0),Un.addEventListener("mousedown",mo,{capture:!0,passive:!1}),Un.addEventListener("touchstart",mo,{capture:!0,passive:!1}),Un.addEventListener("click",Dn,{capture:!0,passive:!1}),Un.addEventListener("keydown",It,{capture:!0,passive:!1}),an},yo=function(){if(vt.active)return Un.removeEventListener("focusin",$t,!0),Un.removeEventListener("mousedown",mo,!0),Un.removeEventListener("touchstart",mo,!0),Un.removeEventListener("click",Dn,!0),Un.removeEventListener("keydown",It,!0),an};return an={get active(){return vt.active},get paused(){return vt.paused},activate:function(Jt){if(vt.active)return this;var Qt=J(Jt,"onActivate"),Cn=J(Jt,"onPostActivate"),Nn=J(Jt,"checkCanFocusTrap");Nn||An(),vt.active=!0,vt.paused=!1,vt.nodeFocusedBeforeActivation=Un.activeElement,Qt&&Qt();var kt=function(){Nn&&An(),Ct(),Cn&&Cn()};return Nn?(Nn(vt.containers.concat()).then(kt,kt),this):(kt(),this)},deactivate:function(Jt){if(!vt.active)return this;var Qt=Ae({onDeactivate:on.onDeactivate,onPostDeactivate:on.onPostDeactivate,checkCanReturnFocus:on.checkCanReturnFocus},Jt);clearTimeout(vt.delayInitialFocusTimer),vt.delayInitialFocusTimer=void 0,yo(),vt.active=!1,vt.paused=!1,Oe.deactivateTrap(an);var Cn=J(Qt,"onDeactivate"),Nn=J(Qt,"onPostDeactivate"),kt=J(Qt,"checkCanReturnFocus"),jo=J(Qt,"returnFocus","returnFocusOnDeactivate");Cn&&Cn();var ms=function(){st(function(){jo&&jn(to(vt.nodeFocusedBeforeActivation)),Nn&&Nn()})};return jo&&kt?(kt(to(vt.nodeFocusedBeforeActivation)).then(ms,ms),this):(ms(),this)},pause:function(){return vt.paused||!vt.active?this:(vt.paused=!0,yo(),this)},unpause:function(){return!vt.paused||!vt.active?this:(vt.paused=!1,An(),Ct(),this)},updateContainerElements:function(Jt){var Qt=[].concat(Jt).filter(Boolean);return vt.containers=Qt.map(function(Cn){return typeof Cn=="string"?Un.querySelector(Cn):Cn}),vt.active&&An(),this}},an.updateContainerElements(qe),an};Ce.createFocusTrap=Xe}}),W={};T(W,{default:()=>ae,focus:()=>se}),n.exports=V(W);var Q=R($()),j=R(z());function se(Ce){let Ue,ot;window.addEventListener("focusin",()=>{Ue=ot,ot=document.activeElement}),Ce.magic("focus",Ae=>{let ve=Ae;return{__noscroll:!1,__wrapAround:!1,within(Oe){return ve=Oe,this},withoutScrolling(){return this.__noscroll=!0,this},noscroll(){return this.__noscroll=!0,this},withWrapAround(){return this.__wrapAround=!0,this},wrap(){return this.withWrapAround()},focusable(Oe){return(0,j.isFocusable)(Oe)},previouslyFocused(){return Ue},lastFocused(){return Ue},focused(){return ot},focusables(){return Array.isArray(ve)?ve:(0,j.focusable)(ve,{displayCheck:"none"})},all(){return this.focusables()},isFirst(Oe){let O=this.all();return O[0]&&O[0].isSameNode(Oe)},isLast(Oe){let O=this.all();return O.length&&O.slice(-1)[0].isSameNode(Oe)},getFirst(){return this.all()[0]},getLast(){return this.all().slice(-1)[0]},getNext(){let Oe=this.all(),O=document.activeElement;if(Oe.indexOf(O)!==-1)return this.__wrapAround&&Oe.indexOf(O)===Oe.length-1?Oe[0]:Oe[Oe.indexOf(O)+1]},getPrevious(){let Oe=this.all(),O=document.activeElement;if(Oe.indexOf(O)!==-1)return this.__wrapAround&&Oe.indexOf(O)===0?Oe.slice(-1)[0]:Oe[Oe.indexOf(O)-1]},first(){this.focus(this.getFirst())},last(){this.focus(this.getLast())},next(){this.focus(this.getNext())},previous(){this.focus(this.getPrevious())},prev(){return this.previous()},focus(Oe){Oe&&setTimeout(()=>{Oe.hasAttribute("tabindex")||Oe.setAttribute("tabindex","0"),Oe.focus({preventScroll:this.__noscroll})})}}}),Ce.directive("trap",Ce.skipDuringClone((Ae,{expression:ve,modifiers:Oe},{effect:O,evaluateLater:De,cleanup:Fe})=>{let st=De(ve),Ut=!1,et={escapeDeactivates:!1,allowOutsideClick:!0,fallbackFocus:()=>Ae};if(Oe.includes("noautofocus"))et.initialFocus=!1;else{let mt=Ae.querySelector("[autofocus]");mt&&(et.initialFocus=mt)}let Dt=(0,Q.createFocusTrap)(Ae,et),Xe=()=>{},it=()=>{};const qe=()=>{Xe(),Xe=()=>{},it(),it=()=>{},Dt.deactivate({returnFocus:!Oe.includes("noreturn")})};O(()=>st(mt=>{Ut!==mt&&(mt&&!Ut&&(Oe.includes("noscroll")&&(it=me()),Oe.includes("inert")&&(Xe=re(Ae)),setTimeout(()=>{Dt.activate()},15)),!mt&&Ut&&qe(),Ut=!!mt)})),Fe(qe)},(Ae,{expression:ve,modifiers:Oe},{evaluate:O})=>{Oe.includes("inert")&&O(ve)&&re(Ae)}))}function re(Ce){let Ue=[];return Y(Ce,ot=>{let Ae=ot.hasAttribute("aria-hidden");ot.setAttribute("aria-hidden","true"),Ue.push(()=>Ae||ot.removeAttribute("aria-hidden"))}),()=>{for(;Ue.length;)Ue.pop()()}}function Y(Ce,Ue){Ce.isSameNode(document.body)||!Ce.parentNode||Array.from(Ce.parentNode.children).forEach(ot=>{ot.isSameNode(Ce)?Y(Ce.parentNode,Ue):Ue(ot)})}function me(){let Ce=document.documentElement.style.overflow,Ue=document.documentElement.style.paddingRight,ot=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=`${ot}px`,()=>{document.documentElement.style.overflow=Ce,document.documentElement.style.paddingRight=Ue}}var ae=se}}),mre=E0({"node_modules/@alpinejs/persist/dist/module.cjs.js"(l,n){var o=Object.defineProperty,i=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,h=Object.prototype.hasOwnProperty,g=(W,Q)=>{for(var j in Q)o(W,j,{get:Q[j],enumerable:!0})},b=(W,Q,j,se)=>{if(Q&&typeof Q=="object"||typeof Q=="function")for(let re of u(Q))!h.call(W,re)&&re!==j&&o(W,re,{get:()=>Q[re],enumerable:!(se=i(Q,re))||se.enumerable});return W},S=W=>b(o({},"__esModule",{value:!0}),W),T={};g(T,{default:()=>$,persist:()=>k}),n.exports=S(T);function k(W){let Q=()=>{let j,se;try{se=localStorage}catch(re){console.error(re),console.warn("Alpine: $persist is using temporary storage since localStorage is unavailable.");let Y=new Map;se={getItem:Y.get.bind(Y),setItem:Y.set.bind(Y)}}return W.interceptor((re,Y,me,ae,Ce)=>{let Ue=j||`_x_${ae}`,ot=R(Ue,se)?V(Ue,se):re;return me(ot),W.effect(()=>{let Ae=Y();z(Ue,Ae,se),me(Ae)}),ot},re=>{re.as=Y=>(j=Y,re),re.using=Y=>(se=Y,re)})};Object.defineProperty(W,"$persist",{get:()=>Q()}),W.magic("persist",Q),W.persist=(j,{get:se,set:re},Y=localStorage)=>{let me=R(j,Y)?V(j,Y):se();re(me),W.effect(()=>{let ae=se();z(j,ae,Y),re(ae)})}}function R(W,Q){return Q.getItem(W)!==null}function V(W,Q){let j=Q.getItem(W,Q);if(j!==void 0)return JSON.parse(j)}function z(W,Q,j){j.setItem(W,JSON.stringify(Q))}var $=k}}),pre=E0({"node_modules/@alpinejs/intersect/dist/module.cjs.js"(l,n){var o=Object.defineProperty,i=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,h=Object.prototype.hasOwnProperty,g=(W,Q)=>{for(var j in Q)o(W,j,{get:Q[j],enumerable:!0})},b=(W,Q,j,se)=>{if(Q&&typeof Q=="object"||typeof Q=="function")for(let re of u(Q))!h.call(W,re)&&re!==j&&o(W,re,{get:()=>Q[re],enumerable:!(se=i(Q,re))||se.enumerable});return W},S=W=>b(o({},"__esModule",{value:!0}),W),T={};g(T,{default:()=>$,intersect:()=>k}),n.exports=S(T);function k(W){W.directive("intersect",W.skipDuringClone((Q,{value:j,expression:se,modifiers:re},{evaluateLater:Y,cleanup:me})=>{let ae=Y(se),Ce={rootMargin:z(re),threshold:R(re)},Ue=new IntersectionObserver(ot=>{ot.forEach(Ae=>{Ae.isIntersecting!==(j==="leave")&&(ae(),re.includes("once")&&Ue.disconnect())})},Ce);Ue.observe(Q),me(()=>{Ue.disconnect()})}))}function R(W){if(W.includes("full"))return .99;if(W.includes("half"))return .5;if(!W.includes("threshold"))return 0;let Q=W[W.indexOf("threshold")+1];return Q==="100"?1:Q==="0"?0:+`.${Q}`}function V(W){let Q=W.match(/^(-?[0-9]+)(px|%)?$/);return Q?Q[1]+(Q[2]||"px"):void 0}function z(W){const Q="margin",j="0px 0px 0px 0px",se=W.indexOf(Q);if(se===-1)return j;let re=[];for(let Y=1;Y<5;Y++)re.push(V(W[se+Y]||""));return re=re.filter(Y=>Y!==void 0),re.length?re.join(" ").trim():j}var $=k}}),gre=E0({"node_modules/@alpinejs/resize/dist/module.cjs.js"(l,n){var o=Object.defineProperty,i=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,h=Object.prototype.hasOwnProperty,g=(j,se)=>{for(var re in se)o(j,re,{get:se[re],enumerable:!0})},b=(j,se,re,Y)=>{if(se&&typeof se=="object"||typeof se=="function")for(let me of u(se))!h.call(j,me)&&me!==re&&o(j,me,{get:()=>se[me],enumerable:!(Y=i(se,me))||Y.enumerable});return j},S=j=>b(o({},"__esModule",{value:!0}),j),T={};g(T,{default:()=>Q,resize:()=>k}),n.exports=S(T);function k(j){j.directive("resize",j.skipDuringClone((se,{value:re,expression:Y,modifiers:me},{evaluateLater:ae,cleanup:Ce})=>{let Ue=ae(Y),ot=(ve,Oe)=>{Ue(()=>{},{scope:{$width:ve,$height:Oe}})},Ae=me.includes("document")?$(ot):R(se,ot);Ce(()=>Ae())}))}function R(j,se){let re=new ResizeObserver(Y=>{let[me,ae]=W(Y);se(me,ae)});return re.observe(j),()=>re.disconnect()}var V,z=new Set;function $(j){return z.add(j),V||(V=new ResizeObserver(se=>{let[re,Y]=W(se);z.forEach(me=>me(re,Y))}),V.observe(document.documentElement)),()=>{z.delete(j)}}function W(j){let se,re;for(let Y of j)se=Y.borderBoxSize[0].inlineSize,re=Y.borderBoxSize[0].blockSize;return[se,re]}var Q=k}}),bre=E0({"node_modules/@alpinejs/anchor/dist/module.cjs.js"(l,n){var o=Object.defineProperty,i=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,h=Object.prototype.hasOwnProperty,g=(ze,Ie)=>{for(var Ot in Ie)o(ze,Ot,{get:Ie[Ot],enumerable:!0})},b=(ze,Ie,Ot,_t)=>{if(Ie&&typeof Ie=="object"||typeof Ie=="function")for(let Nt of u(Ie))!h.call(ze,Nt)&&Nt!==Ot&&o(ze,Nt,{get:()=>Ie[Nt],enumerable:!(_t=i(Ie,Nt))||_t.enumerable});return ze},S=ze=>b(o({},"__esModule",{value:!0}),ze),T={};g(T,{anchor:()=>Gn,default:()=>ao}),n.exports=S(T);var k=Math.min,R=Math.max,V=Math.round,z=Math.floor,$=ze=>({x:ze,y:ze}),W={left:"right",right:"left",bottom:"top",top:"bottom"},Q={start:"end",end:"start"};function j(ze,Ie,Ot){return R(ze,k(Ie,Ot))}function se(ze,Ie){return typeof ze=="function"?ze(Ie):ze}function re(ze){return ze.split("-")[0]}function Y(ze){return ze.split("-")[1]}function me(ze){return ze==="x"?"y":"x"}function ae(ze){return ze==="y"?"height":"width"}function Ce(ze){return["top","bottom"].includes(re(ze))?"y":"x"}function Ue(ze){return me(Ce(ze))}function ot(ze,Ie,Ot){Ot===void 0&&(Ot=!1);const _t=Y(ze),Nt=Ue(ze),_n=ae(Nt);let sn=Nt==="x"?_t===(Ot?"end":"start")?"right":"left":_t==="start"?"bottom":"top";return Ie.reference[_n]>Ie.floating[_n]&&(sn=De(sn)),[sn,De(sn)]}function Ae(ze){const Ie=De(ze);return[ve(ze),Ie,ve(Ie)]}function ve(ze){return ze.replace(/start|end/g,Ie=>Q[Ie])}function Oe(ze,Ie,Ot){const _t=["left","right"],Nt=["right","left"],_n=["top","bottom"],sn=["bottom","top"];switch(ze){case"top":case"bottom":return Ot?Ie?Nt:_t:Ie?_t:Nt;case"left":case"right":return Ie?_n:sn;default:return[]}}function O(ze,Ie,Ot,_t){const Nt=Y(ze);let _n=Oe(re(ze),Ot==="start",_t);return Nt&&(_n=_n.map(sn=>sn+"-"+Nt),Ie&&(_n=_n.concat(_n.map(ve)))),_n}function De(ze){return ze.replace(/left|right|bottom|top/g,Ie=>W[Ie])}function Fe(ze){return{top:0,right:0,bottom:0,left:0,...ze}}function st(ze){return typeof ze!="number"?Fe(ze):{top:ze,right:ze,bottom:ze,left:ze}}function Ut(ze){return{...ze,top:ze.y,left:ze.x,right:ze.x+ze.width,bottom:ze.y+ze.height}}function et(ze,Ie,Ot){let{reference:_t,floating:Nt}=ze;const _n=Ce(Ie),sn=Ue(Ie),Tn=ae(sn),Xn=re(Ie),zn=_n==="y",Ko=_t.x+_t.width/2-Nt.width/2,To=_t.y+_t.height/2-Nt.height/2,Yo=_t[Tn]/2-Nt[Tn]/2;let Lo;switch(Xn){case"top":Lo={x:Ko,y:_t.y-Nt.height};break;case"bottom":Lo={x:Ko,y:_t.y+_t.height};break;case"right":Lo={x:_t.x+_t.width,y:To};break;case"left":Lo={x:_t.x-Nt.width,y:To};break;default:Lo={x:_t.x,y:_t.y}}switch(Y(Ie)){case"start":Lo[sn]-=Yo*(Ot&&zn?-1:1);break;case"end":Lo[sn]+=Yo*(Ot&&zn?-1:1);break}return Lo}var Dt=async(ze,Ie,Ot)=>{const{placement:_t="bottom",strategy:Nt="absolute",middleware:_n=[],platform:sn}=Ot,Tn=_n.filter(Boolean),Xn=await(sn.isRTL==null?void 0:sn.isRTL(Ie));let zn=await sn.getElementRects({reference:ze,floating:Ie,strategy:Nt}),{x:Ko,y:To}=et(zn,_t,Xn),Yo=_t,Lo={},es=0;for(let Ms=0;Ms<Tn.length;Ms++){const{name:hr,fn:po}=Tn[Ms],{x:ts,y:tr,data:ai,reset:Ur}=await po({x:Ko,y:To,initialPlacement:_t,placement:Yo,strategy:Nt,middlewareData:Lo,rects:zn,platform:sn,elements:{reference:ze,floating:Ie}});if(Ko=ts??Ko,To=tr??To,Lo={...Lo,[hr]:{...Lo[hr],...ai}},Ur&&es<=50){es++,typeof Ur=="object"&&(Ur.placement&&(Yo=Ur.placement),Ur.rects&&(zn=Ur.rects===!0?await sn.getElementRects({reference:ze,floating:Ie,strategy:Nt}):Ur.rects),{x:Ko,y:To}=et(zn,Yo,Xn)),Ms=-1;continue}}return{x:Ko,y:To,placement:Yo,strategy:Nt,middlewareData:Lo}};async function Xe(ze,Ie){var Ot;Ie===void 0&&(Ie={});const{x:_t,y:Nt,platform:_n,rects:sn,elements:Tn,strategy:Xn}=ze,{boundary:zn="clippingAncestors",rootBoundary:Ko="viewport",elementContext:To="floating",altBoundary:Yo=!1,padding:Lo=0}=se(Ie,ze),es=st(Lo),hr=Tn[Yo?To==="floating"?"reference":"floating":To],po=Ut(await _n.getClippingRect({element:(Ot=await(_n.isElement==null?void 0:_n.isElement(hr)))==null||Ot?hr:hr.contextElement||await(_n.getDocumentElement==null?void 0:_n.getDocumentElement(Tn.floating)),boundary:zn,rootBoundary:Ko,strategy:Xn})),ts=To==="floating"?{...sn.floating,x:_t,y:Nt}:sn.reference,tr=await(_n.getOffsetParent==null?void 0:_n.getOffsetParent(Tn.floating)),ai=await(_n.isElement==null?void 0:_n.isElement(tr))?await(_n.getScale==null?void 0:_n.getScale(tr))||{x:1,y:1}:{x:1,y:1},Ur=Ut(_n.convertOffsetParentRelativeRectToViewportRelativeRect?await _n.convertOffsetParentRelativeRectToViewportRelativeRect({rect:ts,offsetParent:tr,strategy:Xn}):ts);return{top:(po.top-Ur.top+es.top)/ai.y,bottom:(Ur.bottom-po.bottom+es.bottom)/ai.y,left:(po.left-Ur.left+es.left)/ai.x,right:(Ur.right-po.right+es.right)/ai.x}}var it=function(ze){return ze===void 0&&(ze={}),{name:"flip",options:ze,async fn(Ie){var Ot,_t;const{placement:Nt,middlewareData:_n,rects:sn,initialPlacement:Tn,platform:Xn,elements:zn}=Ie,{mainAxis:Ko=!0,crossAxis:To=!0,fallbackPlacements:Yo,fallbackStrategy:Lo="bestFit",fallbackAxisSideDirection:es="none",flipAlignment:Ms=!0,...hr}=se(ze,Ie);if((Ot=_n.arrow)!=null&&Ot.alignmentOffset)return{};const po=re(Nt),ts=re(Tn)===Tn,tr=await(Xn.isRTL==null?void 0:Xn.isRTL(zn.floating)),ai=Yo||(ts||!Ms?[De(Tn)]:Ae(Tn));!Yo&&es!=="none"&&ai.push(...O(Tn,Ms,es,tr));const Ur=[Tn,...ai],Ti=await Xe(Ie,hr),la=[];let li=((_t=_n.flip)==null?void 0:_t.overflows)||[];if(Ko&&la.push(Ti[po]),To){const Hi=ot(Nt,sn,tr);la.push(Ti[Hi[0]],Ti[Hi[1]])}if(li=[...li,{placement:Nt,overflows:la}],!la.every(Hi=>Hi<=0)){var Qc,xr;const Hi=(((Qc=_n.flip)==null?void 0:Qc.index)||0)+1,Aa=Ur[Hi];if(Aa)return{data:{index:Hi,overflows:li},reset:{placement:Aa}};let Qa=(xr=li.filter(La=>La.overflows[0]<=0).sort((La,Na)=>La.overflows[1]-Na.overflows[1])[0])==null?void 0:xr.placement;if(!Qa)switch(Lo){case"bestFit":{var qs;const La=(qs=li.map(Na=>[Na.placement,Na.overflows.filter(vi=>vi>0).reduce((vi,jr)=>vi+jr,0)]).sort((Na,vi)=>Na[1]-vi[1])[0])==null?void 0:qs[0];La&&(Qa=La);break}case"initialPlacement":Qa=Tn;break}if(Nt!==Qa)return{reset:{placement:Qa}}}return{}}}};async function qe(ze,Ie){const{placement:Ot,platform:_t,elements:Nt}=ze,_n=await(_t.isRTL==null?void 0:_t.isRTL(Nt.floating)),sn=re(Ot),Tn=Y(Ot),Xn=Ce(Ot)==="y",zn=["left","top"].includes(sn)?-1:1,Ko=_n&&Xn?-1:1,To=se(Ie,ze);let{mainAxis:Yo,crossAxis:Lo,alignmentAxis:es}=typeof To=="number"?{mainAxis:To,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...To};return Tn&&typeof es=="number"&&(Lo=Tn==="end"?es*-1:es),Xn?{x:Lo*Ko,y:Yo*zn}:{x:Yo*zn,y:Lo*Ko}}var mt=function(ze){return ze===void 0&&(ze=0),{name:"offset",options:ze,async fn(Ie){const{x:Ot,y:_t}=Ie,Nt=await qe(Ie,ze);return{x:Ot+Nt.x,y:_t+Nt.y,data:Nt}}}},Un=function(ze){return ze===void 0&&(ze={}),{name:"shift",options:ze,async fn(Ie){const{x:Ot,y:_t,placement:Nt}=Ie,{mainAxis:_n=!0,crossAxis:sn=!1,limiter:Tn={fn:hr=>{let{x:po,y:ts}=hr;return{x:po,y:ts}}},...Xn}=se(ze,Ie),zn={x:Ot,y:_t},Ko=await Xe(Ie,Xn),To=Ce(re(Nt)),Yo=me(To);let Lo=zn[Yo],es=zn[To];if(_n){const hr=Yo==="y"?"top":"left",po=Yo==="y"?"bottom":"right",ts=Lo+Ko[hr],tr=Lo-Ko[po];Lo=j(ts,Lo,tr)}if(sn){const hr=To==="y"?"top":"left",po=To==="y"?"bottom":"right",ts=es+Ko[hr],tr=es-Ko[po];es=j(ts,es,tr)}const Ms=Tn.fn({...Ie,[Yo]:Lo,[To]:es});return{...Ms,data:{x:Ms.x-Ot,y:Ms.y-_t}}}}};function on(ze){return J(ze)?(ze.nodeName||"").toLowerCase():"#document"}function vt(ze){var Ie;return(ze==null||(Ie=ze.ownerDocument)==null?void 0:Ie.defaultView)||window}function an(ze){var Ie;return(Ie=(J(ze)?ze.ownerDocument:ze.document)||window.document)==null?void 0:Ie.documentElement}function J(ze){return ze instanceof Node||ze instanceof vt(ze).Node}function Bn(ze){return ze instanceof Element||ze instanceof vt(ze).Element}function Vn(ze){return ze instanceof HTMLElement||ze instanceof vt(ze).HTMLElement}function Rn(ze){return typeof ShadowRoot>"u"?!1:ze instanceof ShadowRoot||ze instanceof vt(ze).ShadowRoot}function An(ze){const{overflow:Ie,overflowX:Ot,overflowY:_t,display:Nt}=It(ze);return/auto|scroll|overlay|hidden|clip/.test(Ie+_t+Ot)&&!["inline","contents"].includes(Nt)}function jn(ze){return["table","td","th"].includes(on(ze))}function to(ze){const Ie=$t(),Ot=It(ze);return Ot.transform!=="none"||Ot.perspective!=="none"||(Ot.containerType?Ot.containerType!=="normal":!1)||!Ie&&(Ot.backdropFilter?Ot.backdropFilter!=="none":!1)||!Ie&&(Ot.filter?Ot.filter!=="none":!1)||["transform","perspective","filter"].some(_t=>(Ot.willChange||"").includes(_t))||["paint","layout","strict","content"].some(_t=>(Ot.contain||"").includes(_t))}function mo(ze){let Ie=Ct(ze);for(;Vn(Ie)&&!xe(Ie);){if(to(Ie))return Ie;Ie=Ct(Ie)}return null}function $t(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function xe(ze){return["html","body","#document"].includes(on(ze))}function It(ze){return vt(ze).getComputedStyle(ze)}function Dn(ze){return Bn(ze)?{scrollLeft:ze.scrollLeft,scrollTop:ze.scrollTop}:{scrollLeft:ze.pageXOffset,scrollTop:ze.pageYOffset}}function Ct(ze){if(on(ze)==="html")return ze;const Ie=ze.assignedSlot||ze.parentNode||Rn(ze)&&ze.host||an(ze);return Rn(Ie)?Ie.host:Ie}function yo(ze){const Ie=Ct(ze);return xe(Ie)?ze.ownerDocument?ze.ownerDocument.body:ze.body:Vn(Ie)&&An(Ie)?Ie:yo(Ie)}function Kn(ze,Ie,Ot){var _t;Ie===void 0&&(Ie=[]),Ot===void 0&&(Ot=!0);const Nt=yo(ze),_n=Nt===((_t=ze.ownerDocument)==null?void 0:_t.body),sn=vt(Nt);return _n?Ie.concat(sn,sn.visualViewport||[],An(Nt)?Nt:[],sn.frameElement&&Ot?Kn(sn.frameElement):[]):Ie.concat(Nt,Kn(Nt,[],Ot))}function Jt(ze){const Ie=It(ze);let Ot=parseFloat(Ie.width)||0,_t=parseFloat(Ie.height)||0;const Nt=Vn(ze),_n=Nt?ze.offsetWidth:Ot,sn=Nt?ze.offsetHeight:_t,Tn=V(Ot)!==_n||V(_t)!==sn;return Tn&&(Ot=_n,_t=sn),{width:Ot,height:_t,$:Tn}}function Qt(ze){return Bn(ze)?ze:ze.contextElement}function Cn(ze){const Ie=Qt(ze);if(!Vn(Ie))return $(1);const Ot=Ie.getBoundingClientRect(),{width:_t,height:Nt,$:_n}=Jt(Ie);let sn=(_n?V(Ot.width):Ot.width)/_t,Tn=(_n?V(Ot.height):Ot.height)/Nt;return(!sn||!Number.isFinite(sn))&&(sn=1),(!Tn||!Number.isFinite(Tn))&&(Tn=1),{x:sn,y:Tn}}var Nn=$(0);function kt(ze){const Ie=vt(ze);return!$t()||!Ie.visualViewport?Nn:{x:Ie.visualViewport.offsetLeft,y:Ie.visualViewport.offsetTop}}function jo(ze,Ie,Ot){return Ie===void 0&&(Ie=!1),!Ot||Ie&&Ot!==vt(ze)?!1:Ie}function ms(ze,Ie,Ot,_t){Ie===void 0&&(Ie=!1),Ot===void 0&&(Ot=!1);const Nt=ze.getBoundingClientRect(),_n=Qt(ze);let sn=$(1);Ie&&(_t?Bn(_t)&&(sn=Cn(_t)):sn=Cn(ze));const Tn=jo(_n,Ot,_t)?kt(_n):$(0);let Xn=(Nt.left+Tn.x)/sn.x,zn=(Nt.top+Tn.y)/sn.y,Ko=Nt.width/sn.x,To=Nt.height/sn.y;if(_n){const Yo=vt(_n),Lo=_t&&Bn(_t)?vt(_t):_t;let es=Yo.frameElement;for(;es&&_t&&Lo!==Yo;){const Ms=Cn(es),hr=es.getBoundingClientRect(),po=It(es),ts=hr.left+(es.clientLeft+parseFloat(po.paddingLeft))*Ms.x,tr=hr.top+(es.clientTop+parseFloat(po.paddingTop))*Ms.y;Xn*=Ms.x,zn*=Ms.y,Ko*=Ms.x,To*=Ms.y,Xn+=ts,zn+=tr,es=vt(es).frameElement}}return Ut({width:Ko,height:To,x:Xn,y:zn})}function as(ze){let{rect:Ie,offsetParent:Ot,strategy:_t}=ze;const Nt=Vn(Ot),_n=an(Ot);if(Ot===_n)return Ie;let sn={scrollLeft:0,scrollTop:0},Tn=$(1);const Xn=$(0);if((Nt||!Nt&&_t!=="fixed")&&((on(Ot)!=="body"||An(_n))&&(sn=Dn(Ot)),Vn(Ot))){const zn=ms(Ot);Tn=Cn(Ot),Xn.x=zn.x+Ot.clientLeft,Xn.y=zn.y+Ot.clientTop}return{width:Ie.width*Tn.x,height:Ie.height*Tn.y,x:Ie.x*Tn.x-sn.scrollLeft*Tn.x+Xn.x,y:Ie.y*Tn.y-sn.scrollTop*Tn.y+Xn.y}}function xt(ze){return Array.from(ze.getClientRects())}function Pt(ze){return ms(an(ze)).left+Dn(ze).scrollLeft}function gn(ze){const Ie=an(ze),Ot=Dn(ze),_t=ze.ownerDocument.body,Nt=R(Ie.scrollWidth,Ie.clientWidth,_t.scrollWidth,_t.clientWidth),_n=R(Ie.scrollHeight,Ie.clientHeight,_t.scrollHeight,_t.clientHeight);let sn=-Ot.scrollLeft+Pt(ze);const Tn=-Ot.scrollTop;return It(_t).direction==="rtl"&&(sn+=R(Ie.clientWidth,_t.clientWidth)-Nt),{width:Nt,height:_n,x:sn,y:Tn}}function At(ze,Ie){const Ot=vt(ze),_t=an(ze),Nt=Ot.visualViewport;let _n=_t.clientWidth,sn=_t.clientHeight,Tn=0,Xn=0;if(Nt){_n=Nt.width,sn=Nt.height;const zn=$t();(!zn||zn&&Ie==="fixed")&&(Tn=Nt.offsetLeft,Xn=Nt.offsetTop)}return{width:_n,height:sn,x:Tn,y:Xn}}function On(ze,Ie){const Ot=ms(ze,!0,Ie==="fixed"),_t=Ot.top+ze.clientTop,Nt=Ot.left+ze.clientLeft,_n=Vn(ze)?Cn(ze):$(1),sn=ze.clientWidth*_n.x,Tn=ze.clientHeight*_n.y,Xn=Nt*_n.x,zn=_t*_n.y;return{width:sn,height:Tn,x:Xn,y:zn}}function In(ze,Ie,Ot){let _t;if(Ie==="viewport")_t=At(ze,Ot);else if(Ie==="document")_t=gn(an(ze));else if(Bn(Ie))_t=On(Ie,Ot);else{const Nt=kt(ze);_t={...Ie,x:Ie.x-Nt.x,y:Ie.y-Nt.y}}return Ut(_t)}function Is(ze,Ie){const Ot=Ct(ze);return Ot===Ie||!Bn(Ot)||xe(Ot)?!1:It(Ot).position==="fixed"||Is(Ot,Ie)}function kr(ze,Ie){const Ot=Ie.get(ze);if(Ot)return Ot;let _t=Kn(ze,[],!1).filter(Tn=>Bn(Tn)&&on(Tn)!=="body"),Nt=null;const _n=It(ze).position==="fixed";let sn=_n?Ct(ze):ze;for(;Bn(sn)&&!xe(sn);){const Tn=It(sn),Xn=to(sn);!Xn&&Tn.position==="fixed"&&(Nt=null),(_n?!Xn&&!Nt:!Xn&&Tn.position==="static"&&!!Nt&&["absolute","fixed"].includes(Nt.position)||An(sn)&&!Xn&&Is(ze,sn))?_t=_t.filter(Ko=>Ko!==sn):Nt=Tn,sn=Ct(sn)}return Ie.set(ze,_t),_t}function Yt(ze){let{element:Ie,boundary:Ot,rootBoundary:_t,strategy:Nt}=ze;const sn=[...Ot==="clippingAncestors"?kr(Ie,this._c):[].concat(Ot),_t],Tn=sn[0],Xn=sn.reduce((zn,Ko)=>{const To=In(Ie,Ko,Nt);return zn.top=R(To.top,zn.top),zn.right=k(To.right,zn.right),zn.bottom=k(To.bottom,zn.bottom),zn.left=R(To.left,zn.left),zn},In(Ie,Tn,Nt));return{width:Xn.right-Xn.left,height:Xn.bottom-Xn.top,x:Xn.left,y:Xn.top}}function Ps(ze){return Jt(ze)}function qo(ze,Ie,Ot){const _t=Vn(Ie),Nt=an(Ie),_n=Ot==="fixed",sn=ms(ze,!0,_n,Ie);let Tn={scrollLeft:0,scrollTop:0};const Xn=$(0);if(_t||!_t&&!_n)if((on(Ie)!=="body"||An(Nt))&&(Tn=Dn(Ie)),_t){const zn=ms(Ie,!0,_n,Ie);Xn.x=zn.x+Ie.clientLeft,Xn.y=zn.y+Ie.clientTop}else Nt&&(Xn.x=Pt(Nt));return{x:sn.left+Tn.scrollLeft-Xn.x,y:sn.top+Tn.scrollTop-Xn.y,width:sn.width,height:sn.height}}function _i(ze,Ie){return!Vn(ze)||It(ze).position==="fixed"?null:Ie?Ie(ze):ze.offsetParent}function bs(ze,Ie){const Ot=vt(ze);if(!Vn(ze))return Ot;let _t=_i(ze,Ie);for(;_t&&jn(_t)&&It(_t).position==="static";)_t=_i(_t,Ie);return _t&&(on(_t)==="html"||on(_t)==="body"&&It(_t).position==="static"&&!to(_t))?Ot:_t||mo(ze)||Ot}var Ar=async function(ze){let{reference:Ie,floating:Ot,strategy:_t}=ze;const Nt=this.getOffsetParent||bs,_n=this.getDimensions;return{reference:qo(Ie,await Nt(Ot),_t),floating:{x:0,y:0,...await _n(Ot)}}};function Bl(ze){return It(ze).direction==="rtl"}var aa={convertOffsetParentRelativeRectToViewportRelativeRect:as,getDocumentElement:an,getClippingRect:Yt,getOffsetParent:bs,getElementRects:Ar,getClientRects:xt,getDimensions:Ps,getScale:Cn,isElement:Bn,isRTL:Bl};function ps(ze,Ie){let Ot=null,_t;const Nt=an(ze);function _n(){clearTimeout(_t),Ot&&Ot.disconnect(),Ot=null}function sn(Tn,Xn){Tn===void 0&&(Tn=!1),Xn===void 0&&(Xn=1),_n();const{left:zn,top:Ko,width:To,height:Yo}=ze.getBoundingClientRect();if(Tn||Ie(),!To||!Yo)return;const Lo=z(Ko),es=z(Nt.clientWidth-(zn+To)),Ms=z(Nt.clientHeight-(Ko+Yo)),hr=z(zn),ts={rootMargin:-Lo+"px "+-es+"px "+-Ms+"px "+-hr+"px",threshold:R(0,k(1,Xn))||1};let tr=!0;function ai(Ur){const Ti=Ur[0].intersectionRatio;if(Ti!==Xn){if(!tr)return sn();Ti?sn(!1,Ti):_t=setTimeout(()=>{sn(!1,1e-7)},100)}tr=!1}try{Ot=new IntersectionObserver(ai,{...ts,root:Nt.ownerDocument})}catch{Ot=new IntersectionObserver(ai,ts)}Ot.observe(ze)}return sn(!0),_n}function dn(ze,Ie,Ot,_t){_t===void 0&&(_t={});const{ancestorScroll:Nt=!0,ancestorResize:_n=!0,elementResize:sn=typeof ResizeObserver=="function",layoutShift:Tn=typeof IntersectionObserver=="function",animationFrame:Xn=!1}=_t,zn=Qt(ze),Ko=Nt||_n?[...zn?Kn(zn):[],...Kn(Ie)]:[];Ko.forEach(po=>{Nt&&po.addEventListener("scroll",Ot,{passive:!0}),_n&&po.addEventListener("resize",Ot)});const To=zn&&Tn?ps(zn,Ot):null;let Yo=-1,Lo=null;sn&&(Lo=new ResizeObserver(po=>{let[ts]=po;ts&&ts.target===zn&&Lo&&(Lo.unobserve(Ie),cancelAnimationFrame(Yo),Yo=requestAnimationFrame(()=>{Lo&&Lo.observe(Ie)})),Ot()}),zn&&!Xn&&Lo.observe(zn),Lo.observe(Ie));let es,Ms=Xn?ms(ze):null;Xn&&hr();function hr(){const po=ms(ze);Ms&&(po.x!==Ms.x||po.y!==Ms.y||po.width!==Ms.width||po.height!==Ms.height)&&Ot(),Ms=po,es=requestAnimationFrame(hr)}return Ot(),()=>{Ko.forEach(po=>{Nt&&po.removeEventListener("scroll",Ot),_n&&po.removeEventListener("resize",Ot)}),To&&To(),Lo&&Lo.disconnect(),Lo=null,Xn&&cancelAnimationFrame(es)}}var vo=(ze,Ie,Ot)=>{const _t=new Map,Nt={platform:aa,...Ot},_n={...Nt.platform,_c:_t};return Dt(ze,Ie,{...Nt,platform:_n})};function Gn(ze){ze.magic("anchor",Ie=>{if(!Ie._x_anchor)throw"Alpine: No x-anchor directive found on element using $anchor...";return Ie._x_anchor}),ze.interceptClone((Ie,Ot)=>{Ie&&Ie._x_anchor&&!Ot._x_anchor&&(Ot._x_anchor=Ie._x_anchor)}),ze.directive("anchor",ze.skipDuringClone((Ie,{expression:Ot,modifiers:_t,value:Nt},{cleanup:_n,evaluate:sn})=>{let{placement:Tn,offsetValue:Xn,unstyled:zn}=vr(_t);Ie._x_anchor=ze.reactive({x:0,y:0});let Ko=sn(Ot);if(!Ko)throw"Alpine: no element provided to x-anchor...";let To=()=>{let Lo;vo(Ko,Ie,{placement:Tn,middleware:[it(),Un({padding:5}),mt(Xn)]}).then(({x:es,y:Ms})=>{zn||yn(Ie,es,Ms),JSON.stringify({x:es,y:Ms})!==Lo&&(Ie._x_anchor.x=es,Ie._x_anchor.y=Ms),Lo=JSON.stringify({x:es,y:Ms})})},Yo=dn(Ko,Ie,()=>To());_n(()=>Yo())},(Ie,{expression:Ot,modifiers:_t,value:Nt},{cleanup:_n,evaluate:sn})=>{let{placement:Tn,offsetValue:Xn,unstyled:zn}=vr(_t);Ie._x_anchor&&(zn||yn(Ie,Ie._x_anchor.x,Ie._x_anchor.y))}))}function yn(ze,Ie,Ot){Object.assign(ze.style,{left:Ie+"px",top:Ot+"px",position:"absolute"})}function vr(ze){let Ot=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"].find(_n=>ze.includes(_n)),_t=0;if(ze.includes("offset")){let _n=ze.findIndex(sn=>sn==="offset");_t=ze[_n+1]!==void 0?Number(ze[_n+1]):_t}let Nt=ze.includes("no-style");return{placement:Ot,offsetValue:_t,unstyled:Nt}}var ao=Gn}}),vre=E0({"node_modules/nprogress/nprogress.js"(l,n){(function(o,i){typeof define=="function"&&define.amd?define(i):typeof l=="object"?n.exports=i():o.NProgress=i()})(l,function(){var o={};o.version="0.2.0";var i=o.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'};o.configure=function($){var W,Q;for(W in $)Q=$[W],Q!==void 0&&$.hasOwnProperty(W)&&(i[W]=Q);return this},o.status=null,o.set=function($){var W=o.isStarted();$=u($,i.minimum,1),o.status=$===1?null:$;var Q=o.render(!W),j=Q.querySelector(i.barSelector),se=i.speed,re=i.easing;return Q.offsetWidth,b(function(Y){i.positionUsing===""&&(i.positionUsing=o.getPositioningCSS()),S(j,g($,se,re)),$===1?(S(Q,{transition:"none",opacity:1}),Q.offsetWidth,setTimeout(function(){S(Q,{transition:"all "+se+"ms linear",opacity:0}),setTimeout(function(){o.remove(),Y()},se)},se)):setTimeout(Y,se)}),this},o.isStarted=function(){return typeof o.status=="number"},o.start=function(){o.status||o.set(0);var $=function(){setTimeout(function(){o.status&&(o.trickle(),$())},i.trickleSpeed)};return i.trickle&&$(),this},o.done=function($){return!$&&!o.status?this:o.inc(.3+.5*Math.random()).set(1)},o.inc=function($){var W=o.status;return W?(typeof $!="number"&&($=(1-W)*u(Math.random()*W,.1,.95)),W=u(W+$,0,.994),o.set(W)):o.start()},o.trickle=function(){return o.inc(Math.random()*i.trickleRate)},function(){var $=0,W=0;o.promise=function(Q){return!Q||Q.state()==="resolved"?this:(W===0&&o.start(),$++,W++,Q.always(function(){W--,W===0?($=0,o.done()):o.set(($-W)/$)}),this)}}(),o.render=function($){if(o.isRendered())return document.getElementById("nprogress");k(document.documentElement,"nprogress-busy");var W=document.createElement("div");W.id="nprogress",W.innerHTML=i.template;var Q=W.querySelector(i.barSelector),j=$?"-100":h(o.status||0),se=document.querySelector(i.parent),re;return S(Q,{transition:"all 0 linear",transform:"translate3d("+j+"%,0,0)"}),i.showSpinner||(re=W.querySelector(i.spinnerSelector),re&&z(re)),se!=document.body&&k(se,"nprogress-custom-parent"),se.appendChild(W),W},o.remove=function(){R(document.documentElement,"nprogress-busy"),R(document.querySelector(i.parent),"nprogress-custom-parent");var $=document.getElementById("nprogress");$&&z($)},o.isRendered=function(){return!!document.getElementById("nprogress")},o.getPositioningCSS=function(){var $=document.body.style,W="WebkitTransform"in $?"Webkit":"MozTransform"in $?"Moz":"msTransform"in $?"ms":"OTransform"in $?"O":"";return W+"Perspective"in $?"translate3d":W+"Transform"in $?"translate":"margin"};function u($,W,Q){return $<W?W:$>Q?Q:$}function h($){return(-1+$)*100}function g($,W,Q){var j;return i.positionUsing==="translate3d"?j={transform:"translate3d("+h($)+"%,0,0)"}:i.positionUsing==="translate"?j={transform:"translate("+h($)+"%,0)"}:j={"margin-left":h($)+"%"},j.transition="all "+W+"ms "+Q,j}var b=function(){var $=[];function W(){var Q=$.shift();Q&&Q(W)}return function(Q){$.push(Q),$.length==1&&W()}}(),S=function(){var $=["Webkit","O","Moz","ms"],W={};function Q(Y){return Y.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(me,ae){return ae.toUpperCase()})}function j(Y){var me=document.body.style;if(Y in me)return Y;for(var ae=$.length,Ce=Y.charAt(0).toUpperCase()+Y.slice(1),Ue;ae--;)if(Ue=$[ae]+Ce,Ue in me)return Ue;return Y}function se(Y){return Y=Q(Y),W[Y]||(W[Y]=j(Y))}function re(Y,me,ae){me=se(me),Y.style[me]=ae}return function(Y,me){var ae=arguments,Ce,Ue;if(ae.length==2)for(Ce in me)Ue=me[Ce],Ue!==void 0&&me.hasOwnProperty(Ce)&&re(Y,Ce,Ue);else re(Y,ae[1],ae[2])}}();function T($,W){var Q=typeof $=="string"?$:V($);return Q.indexOf(" "+W+" ")>=0}function k($,W){var Q=V($),j=Q+W;T(Q,W)||($.className=j.substring(1))}function R($,W){var Q=V($),j;T($,W)&&(j=Q.replace(" "+W+" "," "),$.className=j.substring(1,j.length-1))}function V($){return(" "+($.className||"")+" ").replace(/\s+/gi," ")}function z($){$&&$.parentNode&&$.parentNode.removeChild($)}return o})}}),xre=E0({"node_modules/@alpinejs/morph/dist/module.cjs.js"(l,n){var o=Object.defineProperty,i=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,h=Object.prototype.hasOwnProperty,g=(ae,Ce)=>{for(var Ue in Ce)o(ae,Ue,{get:Ce[Ue],enumerable:!0})},b=(ae,Ce,Ue,ot)=>{if(Ce&&typeof Ce=="object"||typeof Ce=="function")for(let Ae of u(Ce))!h.call(ae,Ae)&&Ae!==Ue&&o(ae,Ae,{get:()=>Ce[Ae],enumerable:!(ot=i(Ce,Ae))||ot.enumerable});return ae},S=ae=>b(o({},"__esModule",{value:!0}),ae),T={};g(T,{default:()=>me,morph:()=>Y}),n.exports=S(T);function k(ae,Ce,Ue){se();let ot,Ae,ve,Oe,O,De,Fe,st,Ut;function et(J={}){let Bn=Rn=>Rn.getAttribute("key"),Vn=()=>{};Oe=J.updating||Vn,O=J.updated||Vn,De=J.removing||Vn,Fe=J.removed||Vn,st=J.adding||Vn,Ut=J.added||Vn,Ae=J.key||Bn,ve=J.lookahead||!1}function Dt(J,Bn){if(Xe(J,Bn))return it(J,Bn);let Vn=!1;if(!R(Oe,J,Bn,()=>Vn=!0)){if(J.nodeType===1&&window.Alpine&&(window.Alpine.cloneNode(J,Bn),J._x_teleport&&Bn._x_teleport&&Dt(J._x_teleport,Bn._x_teleport)),$(Bn)){qe(J,Bn),O(J,Bn);return}Vn||mt(J,Bn),O(J,Bn),Un(J,Bn)}}function Xe(J,Bn){return J.nodeType!=Bn.nodeType||J.nodeName!=Bn.nodeName||on(J)!=on(Bn)}function it(J,Bn){if(R(De,J))return;let Vn=Bn.cloneNode(!0);R(st,Vn)||(J.replaceWith(Vn),Fe(J),Ut(Vn))}function qe(J,Bn){let Vn=Bn.nodeValue;J.nodeValue!==Vn&&(J.nodeValue=Vn)}function mt(J,Bn){if(J._x_transitioning||J._x_isShown&&!Bn._x_isShown||!J._x_isShown&&Bn._x_isShown)return;let Vn=Array.from(J.attributes),Rn=Array.from(Bn.attributes);for(let An=Vn.length-1;An>=0;An--){let jn=Vn[An].name;Bn.hasAttribute(jn)||J.removeAttribute(jn)}for(let An=Rn.length-1;An>=0;An--){let jn=Rn[An].name,to=Rn[An].value;J.getAttribute(jn)!==to&&J.setAttribute(jn,to)}}function Un(J,Bn){let Vn=vt(J.children),Rn={},An=Q(Bn),jn=Q(J);for(;An;){re(An,jn);let mo=on(An),$t=on(jn);if(!jn)if(mo&&Rn[mo]){let Ct=Rn[mo];J.appendChild(Ct),jn=Ct}else{if(!R(st,An)){let Ct=An.cloneNode(!0);J.appendChild(Ct),Ut(Ct)}An=j(Bn,An);continue}let xe=Ct=>Ct&&Ct.nodeType===8&&Ct.textContent==="[if BLOCK]><![endif]",It=Ct=>Ct&&Ct.nodeType===8&&Ct.textContent==="[if ENDBLOCK]><![endif]";if(xe(An)&&xe(jn)){let Ct=0,yo=jn;for(;jn;){let kt=j(J,jn);if(xe(kt))Ct++;else if(It(kt)&&Ct>0)Ct--;else if(It(kt)&&Ct===0){jn=kt;break}jn=kt}let Kn=jn;Ct=0;let Jt=An;for(;An;){let kt=j(Bn,An);if(xe(kt))Ct++;else if(It(kt)&&Ct>0)Ct--;else if(It(kt)&&Ct===0){An=kt;break}An=kt}let Qt=An,Cn=new W(yo,Kn),Nn=new W(Jt,Qt);Un(Cn,Nn);continue}if(jn.nodeType===1&&ve&&!jn.isEqualNode(An)){let Ct=j(Bn,An),yo=!1;for(;!yo&&Ct;)Ct.nodeType===1&&jn.isEqualNode(Ct)&&(yo=!0,jn=an(J,An,jn),$t=on(jn)),Ct=j(Bn,Ct)}if(mo!==$t){if(!mo&&$t){Rn[$t]=jn,jn=an(J,An,jn),Rn[$t].remove(),jn=j(J,jn),An=j(Bn,An);continue}if(mo&&!$t&&Vn[mo]&&(jn.replaceWith(Vn[mo]),jn=Vn[mo]),mo&&$t){let Ct=Vn[mo];if(Ct)Rn[$t]=jn,jn.replaceWith(Ct),jn=Ct;else{Rn[$t]=jn,jn=an(J,An,jn),Rn[$t].remove(),jn=j(J,jn),An=j(Bn,An);continue}}}let Dn=jn&&j(J,jn);Dt(jn,An),An=An&&j(Bn,An),jn=Dn}let to=[];for(;jn;)R(De,jn)||to.push(jn),jn=j(J,jn);for(;to.length;){let mo=to.shift();mo.remove(),Fe(mo)}}function on(J){return J&&J.nodeType===1&&Ae(J)}function vt(J){let Bn={};for(let Vn of J){let Rn=on(Vn);Rn&&(Bn[Rn]=Vn)}return Bn}function an(J,Bn,Vn){if(!R(st,Bn)){let Rn=Bn.cloneNode(!0);return J.insertBefore(Rn,Vn),Ut(Rn),Rn}return Bn}return et(Ue),ot=typeof Ce=="string"?z(Ce):Ce,window.Alpine&&window.Alpine.closestDataStack&&!ae._x_dataStack&&(ot._x_dataStack=window.Alpine.closestDataStack(ae),ot._x_dataStack&&window.Alpine.cloneNode(ae,ot)),Dt(ae,ot),ot=void 0,ae}k.step=()=>{},k.log=()=>{};function R(ae,...Ce){let Ue=!1;return ae(...Ce,()=>Ue=!0),Ue}var V=!1;function z(ae){const Ce=document.createElement("template");return Ce.innerHTML=ae,Ce.content.firstElementChild}function $(ae){return ae.nodeType===3||ae.nodeType===8}var W=class{constructor(ae,Ce){this.startComment=ae,this.endComment=Ce}get children(){let ae=[],Ce=this.startComment.nextSibling;for(;Ce&&Ce!==this.endComment;)ae.push(Ce),Ce=Ce.nextSibling;return ae}appendChild(ae){this.endComment.before(ae)}get firstChild(){let ae=this.startComment.nextSibling;if(ae!==this.endComment)return ae}nextNode(ae){let Ce=ae.nextSibling;if(Ce!==this.endComment)return Ce}insertBefore(ae,Ce){return Ce.before(ae),ae}};function Q(ae){return ae.firstChild}function j(ae,Ce){let Ue;return ae instanceof W?Ue=ae.nextNode(Ce):Ue=Ce.nextSibling,Ue}function se(){if(V)return;V=!0;let ae=Element.prototype.setAttribute,Ce=document.createElement("div");Element.prototype.setAttribute=function(ot,Ae){if(!ot.includes("@"))return ae.call(this,ot,Ae);Ce.innerHTML=`<span ${ot}="${Ae}"></span>`;let ve=Ce.firstElementChild.getAttributeNode(ot);Ce.firstElementChild.removeAttributeNode(ve),this.setAttributeNode(ve)}}function re(ae,Ce){let Ue=Ce&&Ce._x_bindings&&Ce._x_bindings.id;Ue&&(ae.setAttribute("id",Ue),ae.id=Ue)}function Y(ae){ae.morph=k}var me=Y}}),yre=E0({"node_modules/@alpinejs/mask/dist/module.cjs.js"(l,n){var o=Object.defineProperty,i=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,h=Object.prototype.hasOwnProperty,g=(Q,j)=>{for(var se in j)o(Q,se,{get:j[se],enumerable:!0})},b=(Q,j,se,re)=>{if(j&&typeof j=="object"||typeof j=="function")for(let Y of u(j))!h.call(Q,Y)&&Y!==se&&o(Q,Y,{get:()=>j[Y],enumerable:!(re=i(j,Y))||re.enumerable});return Q},S=Q=>b(o({},"__esModule",{value:!0}),Q),T={};g(T,{default:()=>W,mask:()=>k,stripDown:()=>V}),n.exports=S(T);function k(Q){Q.directive("mask",(j,{value:se,expression:re},{effect:Y,evaluateLater:me,cleanup:ae})=>{let Ce=()=>re,Ue="";queueMicrotask(()=>{if(["function","dynamic"].includes(se)){let Oe=me(re);Y(()=>{Ce=O=>{let De;return Q.dontAutoEvaluateFunctions(()=>{Oe(Fe=>{De=typeof Fe=="function"?Fe(O):Fe},{scope:{$input:O,$money:$.bind({el:j})}})}),De},Ae(j,!1)})}else Ae(j,!1);j._x_model&&j._x_model.set(j.value)});const ot=new AbortController;ae(()=>{ot.abort()}),j.addEventListener("input",()=>Ae(j),{signal:ot.signal,capture:!0}),j.addEventListener("blur",()=>Ae(j,!1),{signal:ot.signal});function Ae(Oe,O=!0){let De=Oe.value,Fe=Ce(De);if(!Fe||Fe==="false")return!1;if(Ue.length-Oe.value.length===1)return Ue=Oe.value;let st=()=>{Ue=Oe.value=ve(De,Fe)};O?R(Oe,Fe,()=>{st()}):st()}function ve(Oe,O){if(Oe==="")return"";let De=V(O,Oe);return z(O,De)}}).before("model")}function R(Q,j,se){let re=Q.selectionStart,Y=Q.value;se();let me=Y.slice(0,re),ae=z(j,V(j,me)).length;Q.setSelectionRange(ae,ae)}function V(Q,j){let se=j,re="",Y={9:/[0-9]/,a:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},me="";for(let ae=0;ae<Q.length;ae++){if(["9","a","*"].includes(Q[ae])){me+=Q[ae];continue}for(let Ce=0;Ce<se.length;Ce++)if(se[Ce]===Q[ae]){se=se.slice(0,Ce)+se.slice(Ce+1);break}}for(let ae=0;ae<me.length;ae++){let Ce=!1;for(let Ue=0;Ue<se.length;Ue++)if(Y[me[ae]].test(se[Ue])){re+=se[Ue],se=se.slice(0,Ue)+se.slice(Ue+1),Ce=!0;break}if(!Ce)break}return re}function z(Q,j){let se=Array.from(j),re="";for(let Y=0;Y<Q.length;Y++){if(!["9","a","*"].includes(Q[Y])){re+=Q[Y];continue}if(se.length===0)break;re+=se.shift()}return re}function $(Q,j=".",se,re=2){if(Q==="-")return"-";if(/^\D+$/.test(Q))return"9";se==null&&(se=j===","?".":",");let Y=(Ue,ot)=>{let Ae="",ve=0;for(let Oe=Ue.length-1;Oe>=0;Oe--)Ue[Oe]!==ot&&(ve===3?(Ae=Ue[Oe]+ot+Ae,ve=0):Ae=Ue[Oe]+Ae,ve++);return Ae},me=Q.startsWith("-")?"-":"",ae=Q.replaceAll(new RegExp(`[^0-9\\${j}]`,"g"),""),Ce=Array.from({length:ae.split(j)[0].length}).fill("9").join("");return Ce=`${me}${Y(Ce,se)}`,re>0&&Q.includes(j)&&(Ce+=`${j}`+"9".repeat(re)),queueMicrotask(()=>{this.el.value.endsWith(j)||this.el.value[this.el.selectionStart-1]===j&&this.el.setSelectionRange(this.el.selectionStart-1,this.el.selectionStart-1)}),Ce}var W=k}}),wre=class{constructor(){this.arrays={}}add(l,n){this.arrays[l]||(this.arrays[l]=[]),this.arrays[l].push(n)}remove(l){this.arrays[l]&&delete this.arrays[l]}get(l){return this.arrays[l]||[]}each(l,n){return this.get(l).forEach(n)}},zK=class{constructor(){this.arrays=new WeakMap}add(l,n){this.arrays.has(l)||this.arrays.set(l,[]),this.arrays.get(l).push(n)}remove(l){this.arrays.has(l)&&this.arrays.delete(l,[])}get(l){return this.arrays.has(l)?this.arrays.get(l):[]}each(l,n){return this.get(l).forEach(n)}};function XH(l,n,o={},i=!0){l.dispatchEvent(new CustomEvent(n,{detail:o,bubbles:i,composed:!0,cancelable:!0}))}function JH(l,n,o){return l.addEventListener(n,o),()=>l.removeEventListener(n,o)}function $V(l){return typeof l=="object"&&l!==null}function yW(l){return $V(l)&&!qU(l)}function qU(l){return Array.isArray(l)}function GK(l){return typeof l=="function"}function wW(l){return typeof l!="object"||l===null}function jw(l){return JSON.parse(JSON.stringify(l))}function ev(l,n){return n===""?l:n.split(".").reduce((o,i)=>{if(o!==void 0)return o[i]},l)}function MB(l,n,o){let i=n.split(".");if(i.length===1)return l[n]=o;let u=i.shift(),h=i.join(".");l[u]===void 0&&(l[u]={}),MB(l[u],h,o)}function HV(l,n,o={},i=""){if(l===n)return o;if(typeof l!=typeof n||yW(l)&&qU(n)||qU(l)&&yW(n)||wW(l)||wW(n))return o[i]=n,o;let u=Object.keys(l);return Object.entries(n).forEach(([h,g])=>{o={...o,...HV(l[h],n[h],o,i===""?h:`${i}.${h}`)},u=u.filter(b=>b!==h)}),u.forEach(h=>{o[`${i}.${h}`]="__rm__"}),o}function uT(l){let n=SW(l)?l[0]:l;return SW(l)&&l[1],$V(n)&&Object.entries(n).forEach(([o,i])=>{n[o]=uT(i)}),n}function SW(l){return Array.isArray(l)&&l.length===2&&typeof l[1]=="object"&&Object.keys(l[1]).includes("s")}function WK(){if(document.querySelector('meta[name="csrf-token"]'))return document.querySelector('meta[name="csrf-token"]').getAttribute("content");if(document.querySelector("[data-csrf]"))return document.querySelector("[data-csrf]").getAttribute("data-csrf");if(window.livewireScriptConfig.csrf??!1)return window.livewireScriptConfig.csrf;throw"Livewire: No CSRF token detected"}var X_;function Sre(){if(X_)return X_;if(window.livewireScriptConfig&&(window.livewireScriptConfig.nonce??!1))return X_=window.livewireScriptConfig.nonce,X_;const l=document.querySelector("style[data-livewire-style][nonce]");return l?(X_=l.nonce,X_):null}function Ere(){var l;return((l=document.querySelector("[data-update-uri]"))==null?void 0:l.getAttribute("data-update-uri"))??window.livewireScriptConfig.uri??null}function jK(l){return!!l.match(/<script>Sfdump\(".+"\)<\/script>/)}function Cre(l){let n=l.match(/.*<script>Sfdump\(".+"\)<\/script>/s);return[n,l.replace(n,"")]}var QH=new WeakMap;function dR(l){if(!QH.has(l)){let n=new Tre(l);QH.set(l,n),n.registerListeners()}return QH.get(l)}function _re(l,n,o,i){let u=dR(o),h=()=>l.dispatchEvent(new CustomEvent("livewire-upload-start",{bubbles:!0,detail:{id:o.id,property:n}})),g=()=>l.dispatchEvent(new CustomEvent("livewire-upload-finish",{bubbles:!0,detail:{id:o.id,property:n}})),b=()=>l.dispatchEvent(new CustomEvent("livewire-upload-error",{bubbles:!0,detail:{id:o.id,property:n}})),S=()=>l.dispatchEvent(new CustomEvent("livewire-upload-cancel",{bubbles:!0,detail:{id:o.id,property:n}})),T=V=>{var z=Math.round(V.loaded*100/V.total);l.dispatchEvent(new CustomEvent("livewire-upload-progress",{bubbles:!0,detail:{progress:z}}))},k=V=>{V.target.files.length!==0&&(h(),V.target.multiple?u.uploadMultiple(n,V.target.files,g,b,T,S):u.upload(n,V.target.files[0],g,b,T,S))};l.addEventListener("change",k),o.$wire.$watch(n,V=>{l.isConnected&&(V===null||V==="")&&(l.value="")});let R=()=>{l.value=null};l.addEventListener("click",R),l.addEventListener("livewire-upload-cancel",R),i(()=>{l.removeEventListener("change",k),l.removeEventListener("click",R)})}var Tre=class{constructor(l){this.component=l,this.uploadBag=new EW,this.removeBag=new EW}registerListeners(){this.component.$wire.$on("upload:generatedSignedUrl",({name:l,url:n})=>{this.component,this.handleSignedUrl(l,n)}),this.component.$wire.$on("upload:generatedSignedUrlForS3",({name:l,payload:n})=>{this.component,this.handleS3PreSignedUrl(l,n)}),this.component.$wire.$on("upload:finished",({name:l,tmpFilenames:n})=>this.markUploadFinished(l,n)),this.component.$wire.$on("upload:errored",({name:l})=>this.markUploadErrored(l)),this.component.$wire.$on("upload:removed",({name:l,tmpFilename:n})=>this.removeBag.shift(l).finishCallback(n))}upload(l,n,o,i,u,h){this.setUpload(l,{files:[n],multiple:!1,finishCallback:o,errorCallback:i,progressCallback:u,cancelledCallback:h})}uploadMultiple(l,n,o,i,u,h){this.setUpload(l,{files:Array.from(n),multiple:!0,finishCallback:o,errorCallback:i,progressCallback:u,cancelledCallback:h})}removeUpload(l,n,o){this.removeBag.push(l,{tmpFilename:n,finishCallback:o}),this.component.$wire.call("_removeUpload",l,n)}setUpload(l,n){this.uploadBag.add(l,n),this.uploadBag.get(l).length===1&&this.startUpload(l,n)}handleSignedUrl(l,n){let o=new FormData;Array.from(this.uploadBag.first(l).files).forEach(h=>o.append("files[]",h,h.name));let i={Accept:"application/json"},u=WK();u&&(i["X-CSRF-TOKEN"]=u),this.makeRequest(l,o,"post",n,i,h=>h.paths)}handleS3PreSignedUrl(l,n){let o=this.uploadBag.first(l).files[0],i=n.headers;"Host"in i&&delete i.Host;let u=n.url;this.makeRequest(l,o,"put",u,i,h=>[n.path])}makeRequest(l,n,o,i,u,h){let g=new XMLHttpRequest;g.open(o,i),Object.entries(u).forEach(([b,S])=>{g.setRequestHeader(b,S)}),g.upload.addEventListener("progress",b=>{b.detail={},b.detail.progress=Math.floor(b.loaded*100/b.total),this.uploadBag.first(l).progressCallback(b)}),g.addEventListener("load",()=>{if((g.status+"")[0]==="2"){let S=h(g.response&&JSON.parse(g.response));this.component.$wire.call("_finishUpload",l,S,this.uploadBag.first(l).multiple);return}let b=null;g.status===422&&(b=g.response),this.component.$wire.call("_uploadErrored",l,b,this.uploadBag.first(l).multiple)}),this.uploadBag.first(l).request=g,g.send(n)}startUpload(l,n){let o=n.files.map(i=>({name:i.name,size:i.size,type:i.type}));this.component.$wire.call("_startUpload",l,o,n.multiple),this.component}markUploadFinished(l,n){this.component;let o=this.uploadBag.shift(l);o.finishCallback(o.multiple?n:n[0]),this.uploadBag.get(l).length>0&&this.startUpload(l,this.uploadBag.last(l))}markUploadErrored(l){this.component,this.uploadBag.shift(l).errorCallback(),this.uploadBag.get(l).length>0&&this.startUpload(l,this.uploadBag.last(l))}cancelUpload(l,n=null){this.component;let o=this.uploadBag.first(l);o&&(o.request&&o.request.abort(),this.uploadBag.shift(l).cancelledCallback(),n&&n())}},EW=class{constructor(){this.bag={}}add(l,n){this.bag[l]||(this.bag[l]=[]),this.bag[l].push(n)}push(l,n){this.add(l,n)}first(l){return this.bag[l]?this.bag[l][0]:null}last(l){return this.bag[l].slice(-1)[0]}get(l){return this.bag[l]}shift(l){return this.bag[l].shift()}call(l,...n){(this.listeners[l]||[]).forEach(o=>{o(...n)})}has(l){return Object.keys(this.listeners).includes(l)}};function Dre(l,n,o,i=()=>{},u=()=>{},h=()=>{},g=()=>{}){dR(l).upload(n,o,i,u,h,g)}function kre(l,n,o,i=()=>{},u=()=>{},h=()=>{},g=()=>{}){dR(l).uploadMultiple(n,o,i,u,h,g)}function Are(l,n,o,i=()=>{},u=()=>{}){dR(l).removeUpload(n,o,i,u)}function Lre(l,n,o=()=>{}){dR(l).cancelUpload(n,o)}var CW=Ja(td());function KK(l,n){return n||(n=()=>{}),(o,i=!1)=>{let u=i,h=o,g=l.$wire,b=g.get(h);return CW.default.interceptor((T,k,R,V,z)=>{if(typeof b>"u"){console.error(`Livewire Entangle Error: Livewire property ['${h}'] cannot be found on component: ['${l.name}']`);return}let $=CW.default.entangle({get(){return g.get(o)},set(W){g.set(o,W,u)}},{get(){return k()},set(W){R(W)}});return n(()=>$()),Rre(g.get(o))},T=>{Object.defineProperty(T,"live",{get(){return u=!0,T}})})(b)}}function Rre(l){return typeof l=="object"?JSON.parse(JSON.stringify(l)):l}var tS=[];function Yi(l,n){return tS[l]||(tS[l]=[]),tS[l].push(n),()=>{tS[l]=tS[l].filter(o=>o!==n)}}function Jl(l,...n){let o=tS[l]||[],i=[];for(let u=0;u<o.length;u++){let h=o[u](...n);GK(h)&&i.push(h)}return u=>qK(i,u)}async function ZK(l,...n){let o=tS[l]||[],i=[];for(let u=0;u<o.length;u++){let h=await o[u](...n);GK(h)&&i.push(h)}return u=>qK(i,u)}function qK(l,n){let o=n;for(let i=0;i<l.length;i++){let u=l[i](o);u!==void 0&&(o=u)}return o}function YK(l){let n=document.createElement("html");n.innerHTML=l,n.querySelectorAll("a").forEach(u=>u.setAttribute("target","_top"));let o=document.getElementById("livewire-error");typeof o<"u"&&o!=null?o.innerHTML="":(o=document.createElement("div"),o.id="livewire-error",o.style.position="fixed",o.style.width="100vw",o.style.height="100vh",o.style.padding="50px",o.style.backgroundColor="rgba(0, 0, 0, .6)",o.style.zIndex=2e5);let i=document.createElement("iframe");i.style.backgroundColor="#17161A",i.style.borderRadius="5px",i.style.width="100%",i.style.height="100%",o.appendChild(i),document.body.prepend(o),document.body.style.overflow="hidden",i.contentWindow.document.open(),i.contentWindow.document.write(n.outerHTML),i.contentWindow.document.close(),o.addEventListener("click",()=>_W(o)),o.setAttribute("tabindex",0),o.addEventListener("keydown",u=>{u.key==="Escape"&&_W(o)}),o.focus()}function _W(l){l.outerHTML="",document.body.style.overflow="visible"}var Ore=class{constructor(){this.commits=new Set}add(l){this.commits.add(l)}delete(l){this.commits.delete(l)}hasCommitFor(l){return!!this.findCommitByComponent(l)}findCommitByComponent(l){for(let[n,o]of this.commits.entries())if(o.component===l)return o}shouldHoldCommit(l){return!l.isolate}empty(){return this.commits.size===0}async send(){this.prepare(),await Fre(this)}prepare(){this.commits.forEach(l=>l.prepare())}payload(){let l=[],n=[],o=[];return this.commits.forEach(h=>{let[g,b,S]=h.toRequestPayload();l.push(g),n.push(b),o.push(S)}),[l,h=>n.forEach(g=>g(h.shift())),()=>o.forEach(h=>h())]}},Ire=class{constructor(l){this.component=l,this.isolate=!1,this.calls=[],this.receivers=[],this.resolvers=[]}addResolver(l){this.resolvers.push(l)}addCall(l,n,o){this.calls.push({path:"",method:l,params:n,handleReturn(i){o(i)}})}prepare(){Jl("commit.prepare",{component:this.component})}toRequestPayload(){let l=HV(this.component.canonical,this.component.ephemeral),n=this.component.mergeQueuedUpdates(l),o={snapshot:this.component.snapshotEncoded,updates:n,calls:this.calls.map(V=>({path:V.path,method:V.method,params:V.params}))},i=[],u=[],h=[],g=V=>i.forEach(z=>z(V)),b=()=>u.forEach(V=>V()),S=()=>h.forEach(V=>V()),T=Jl("commit",{component:this.component,commit:o,succeed:V=>{i.push(V)},fail:V=>{u.push(V)},respond:V=>{h.push(V)}});return[o,V=>{let{snapshot:z,effects:$}=V;if(S(),this.component.mergeNewSnapshot(z,$,n),this.component.processEffects(this.component.effects),$.returns){let Q=$.returns;this.calls.map(({handleReturn:se})=>se).forEach((se,re)=>{se(Q[re])})}let W=JSON.parse(z);T({snapshot:W,effects:$}),this.resolvers.forEach(Q=>Q()),g(V)},()=>{S(),b()}]}},Pre=class{constructor(){this.commits=new Set,this.pools=new Set}add(l){let n=this.findCommitOr(l,()=>{let o=new Ire(l);return this.commits.add(o),o});return Mre(n,()=>{this.findPoolWithComponent(n.component)||this.createAndSendNewPool()}),n}findCommitOr(l,n){for(let[o,i]of this.commits.entries())if(i.component===l)return i;return n()}findPoolWithComponent(l){for(let[n,o]of this.pools.entries())if(o.hasCommitFor(l))return o}createAndSendNewPool(){Jl("commit.pooling",{commits:this.commits});let l=this.corraleCommitsIntoPools();this.commits.clear(),Jl("commit.pooled",{pools:l}),l.forEach(n=>{n.empty()||(this.pools.add(n),n.send().then(()=>{this.pools.delete(n),this.sendAnyQueuedCommits()}))})}corraleCommitsIntoPools(){let l=new Set;for(let[n,o]of this.commits.entries()){let i=!1;if(l.forEach(u=>{u.shouldHoldCommit(o)&&(u.add(o),i=!0)}),!i){let u=new Ore;u.add(o),l.add(u)}}return l}sendAnyQueuedCommits(){this.commits.size>0&&this.createAndSendNewPool()}},eU=new WeakMap;function Mre(l,n){eU.has(l)||eU.set(l,setTimeout(()=>{n(),eU.delete(l)},5))}var XK=new Pre;async function JK(l){let n=XK.add(l),o=new Promise(i=>{n.addResolver(i)});return o.commit=n,o}async function Nre(l,n,o){let i=XK.add(l),u=new Promise(h=>{i.addCall(n,o,g=>h(g))});return u.commit=i,u}async function Fre(l){let[n,o,i]=l.payload(),u={method:"POST",body:JSON.stringify({_token:WK(),components:n}),headers:{"Content-type":"application/json","X-Livewire":""}},h=[],g=[],b=[],S=se=>h.forEach(re=>re(se)),T=se=>g.forEach(re=>re(se)),k=se=>b.forEach(re=>re(se)),R=Jl("request.profile",u),V=Ere();Jl("request",{url:V,options:u,payload:u.body,respond:se=>b.push(se),succeed:se=>h.push(se),fail:se=>g.push(se)});let z;try{z=await fetch(V,u)}catch{R({content:"{}",failed:!0}),i(),T({status:503,content:null,preventDefault:()=>{}});return}let $={status:z.status,response:z};k($),z=$.response;let W=await z.text();if(!z.ok){R({content:"{}",failed:!0});let se=!1;return i(),T({status:z.status,content:W,preventDefault:()=>se=!0}),se?void 0:(z.status===419&&Bre(),$re(W))}if(z.redirected&&(window.location.href=z.url),jK(W)){let se;[se,W]=Cre(W),YK(se),R({content:"{}",failed:!0})}else R({content:W,failed:!1});let{components:Q,assets:j}=JSON.parse(W);await ZK("payload.intercept",{components:Q,assets:j}),await o(Q),S({status:z.status,json:JSON.parse(W)})}function Bre(){confirm(`This page has expired.
Would you like to refresh the page?`)&&window.location.reload()}function $re(l){YK(l)}var QK=Ja(td()),UV={},eZ;function Pc(l,n,o=null){UV[l]=n}function Hre(l){eZ=l}var TW={on:"$on",el:"$el",id:"$id",get:"$get",set:"$set",call:"$call",commit:"$commit",watch:"$watch",entangle:"$entangle",dispatch:"$dispatch",dispatchTo:"$dispatchTo",dispatchSelf:"$dispatchSelf",upload:"$upload",uploadMultiple:"$uploadMultiple",removeUpload:"$removeUpload",cancelUpload:"$cancelUpload"};function Ure(l,n){return new Proxy({},{get(o,i){if(i==="__instance")return l;if(i in TW)return DW(l,TW[i]);if(i in UV)return DW(l,i);if(i in n)return n[i];if(!["then"].includes(i))return Vre(l)(i)},set(o,i,u){return i in n&&(n[i]=u),!0}})}function DW(l,n){return UV[n](l)}function Vre(l){return eZ(l)}QK.default.magic("wire",(l,{cleanup:n})=>{let o;return new Proxy({},{get(i,u){return o||(o=h1(l)),["$entangle","entangle"].includes(u)?KK(o,n):o.$wire[u]},set(i,u,h){return o||(o=h1(l)),o.$wire[u]=h,!0}})});Pc("__instance",l=>l);Pc("$get",l=>(n,o=!0)=>ev(o?l.reactive:l.ephemeral,n));Pc("$el",l=>l.el);Pc("$id",l=>l.id);Pc("$set",l=>async(n,o,i=!0)=>(MB(l.reactive,n,o),i?(l.queueUpdate(n,o),await JK(l)):Promise.resolve()));Pc("$call",l=>async(n,...o)=>await l.$wire[n](...o));Pc("$entangle",l=>(n,o=!1)=>KK(l)(n,o));Pc("$toggle",l=>(n,o=!0)=>l.$wire.set(n,!l.$wire.get(n),o));Pc("$watch",l=>(n,o)=>{let i=()=>ev(l.reactive,n),u=QK.default.watch(i,o);l.addCleanup(u)});Pc("$refresh",l=>l.$wire.$commit);Pc("$commit",l=>async()=>await JK(l));Pc("$on",l=>(...n)=>Qre(l,...n));Pc("$dispatch",l=>(...n)=>nZ(l,...n));Pc("$dispatchSelf",l=>(...n)=>mT(l,...n));Pc("$dispatchTo",()=>(...l)=>VV(...l));Pc("$upload",l=>(...n)=>Dre(l,...n));Pc("$uploadMultiple",l=>(...n)=>kre(l,...n));Pc("$removeUpload",l=>(...n)=>Are(l,...n));Pc("$cancelUpload",l=>(...n)=>Lre(l,...n));var tU=new WeakMap;Pc("$parent",l=>{if(tU.has(l))return tU.get(l).$wire;let n=l.parent;return tU.set(l,n),n.$wire});var hT=new WeakMap;function zre(l,n,o){hT.has(l)||hT.set(l,{});let i=hT.get(l);i[n]=o,hT.set(l,i)}Hre(l=>n=>async(...o)=>{if(o.length===1&&o[0]instanceof Event&&(o=[]),hT.has(l)){let i=hT.get(l);if(typeof i[n]=="function")return i[n](o)}return await Nre(l,n,o)});var Gre=class{constructor(l){if(l.__livewire)throw"Component already initialized";if(l.__livewire=this,this.el=l,this.id=l.getAttribute("wire:id"),this.__livewireId=this.id,this.snapshotEncoded=l.getAttribute("wire:snapshot"),this.snapshot=JSON.parse(this.snapshotEncoded),!this.snapshot)throw"Snapshot missing on Livewire component with id: "+this.id;this.name=this.snapshot.memo.name,this.effects=JSON.parse(l.getAttribute("wire:effects")),this.originalEffects=jw(this.effects),this.canonical=uT(jw(this.snapshot.data)),this.ephemeral=uT(jw(this.snapshot.data)),this.reactive=Alpine.reactive(this.ephemeral),this.queuedUpdates={},this.$wire=Ure(this,this.reactive),this.cleanups=[],this.processEffects(this.effects)}mergeNewSnapshot(l,n,o={}){let i=JSON.parse(l),u=jw(this.canonical),h=this.applyUpdates(u,o),g=uT(jw(i.data)),b=HV(h,g);this.snapshotEncoded=l,this.snapshot=i,this.effects=n,this.canonical=uT(jw(i.data));let S=uT(jw(i.data));return Object.entries(b).forEach(([T,k])=>{let R=T.split(".")[0];this.reactive[R]=S[R]}),b}queueUpdate(l,n){this.queuedUpdates[l]=n}mergeQueuedUpdates(l){return Object.entries(this.queuedUpdates).forEach(([n,o])=>{Object.entries(l).forEach(([i,u])=>{i.startsWith(o)&&delete l[i]}),l[n]=o}),this.queuedUpdates=[],l}applyUpdates(l,n){for(let o in n)MB(l,o,n[o]);return l}replayUpdate(l,n){let o={...this.effects,html:n};this.mergeNewSnapshot(JSON.stringify(l),o),this.processEffects({html:n})}processEffects(l){Jl("effects",this,l),Jl("effect",{component:this,effects:l,cleanup:n=>this.addCleanup(n)})}get children(){let l=this.snapshot.memo;return Object.values(l.children).map(o=>o[1]).map(o=>Kre(o))}get parent(){return h1(this.el.parentElement)}inscribeSnapshotAndEffectsOnElement(){let l=this.el;l.setAttribute("wire:snapshot",this.snapshotEncoded);let n=this.originalEffects.listeners?{listeners:this.originalEffects.listeners}:{};this.originalEffects.url&&(n.url=this.originalEffects.url),this.originalEffects.scripts&&(n.scripts=this.originalEffects.scripts),l.setAttribute("wire:effects",JSON.stringify(n))}addCleanup(l){this.cleanups.push(l)}cleanup(){for(delete this.el.__livewire;this.cleanups.length>0;)this.cleanups.pop()()}},sv={};function Wre(l){let n=new Gre(l);if(sv[n.id])throw"Component already registered";return Jl("component.init",{component:n,cleanup:i=>n.addCleanup(i)}),sv[n.id]=n,n}function jre(l){let n=sv[l];n&&(n.cleanup(),delete sv[l])}function Kre(l){let n=sv[l];if(!n)throw"Component not found: "+l;return n}function h1(l,n=!0){let o=Alpine.findClosest(l,i=>i.__livewire);if(!o){if(n)throw"Could not find Livewire component in DOM tree";return}return o.__livewire}function tZ(l){return Object.values(sv).filter(n=>l==n.name)}function Zre(l){return tZ(l).map(n=>n.$wire)}function qre(l){let n=sv[l];return n&&n.$wire}function Yre(){return Object.values(sv)[0].$wire}function Xre(){return Object.values(sv)}function nZ(l,n,o){NB(l.el,n,o)}function Jre(l,n){NB(window,l,n)}function mT(l,n,o){NB(l.el,n,o,!1)}function VV(l,n,o){tZ(l).forEach(u=>{NB(u.el,n,o,!1)})}function Qre(l,n,o){l.el.addEventListener(n,i=>{o(i.detail)})}function eie(l,n){let o=i=>{i.__livewire&&n(i.detail)};return window.addEventListener(l,o),()=>{window.removeEventListener(l,o)}}function NB(l,n,o,i=!0){let u=new CustomEvent(n,{bubbles:i,detail:o});u.__livewire={name:n,params:o,receivedBy:[]},l.dispatchEvent(u)}var YU=new Set;function NL(l){return l.match(new RegExp("wire:"))}function XU(l,n){let[o,...i]=n.replace(new RegExp("wire:"),"").split(".");return new oie(o,i,n,l)}function Nm(l,n){YU.has(l)||(YU.add(l),Yi("directive.init",({el:o,component:i,directive:u,cleanup:h})=>{u.value===l&&n({el:o,directive:u,component:i,$wire:i.$wire,cleanup:h})}))}function zV(l){return new nie(l)}function tie(l){return YU.has(l)}var nie=class{constructor(l){this.el=l,this.directives=this.extractTypeModifiersAndValue()}all(){return this.directives}has(l){return this.directives.map(n=>n.value).includes(l)}missing(l){return!this.has(l)}get(l){return this.directives.find(n=>n.value===l)}extractTypeModifiersAndValue(){return Array.from(this.el.getAttributeNames().filter(l=>NL(l)).map(l=>XU(this.el,l)))}},oie=class{constructor(l,n,o,i){this.rawName=this.raw=o,this.el=i,this.eventContext,this.value=l,this.modifiers=n,this.expression=this.el.getAttribute(this.rawName)}get method(){const{method:l}=this.parseOutMethodAndParams(this.expression);return l}get params(){const{params:l}=this.parseOutMethodAndParams(this.expression);return l}parseOutMethodAndParams(l){let n=l,o=[];const i=n.match(/(.*?)\((.*)\)/s);return i&&(n=i[1],o=new Function("$event",`return (function () {
                for (var l=arguments.length, p=new Array(l), k=0; k<l; k++) {
                    p[k] = arguments[k];
                }
                return [].concat(p);
            })(${i[2]})`)(this.eventContext)),{method:n,params:o}}},sie=Ja(fre()),rie=Ja(hre()),iie=Ja(mre()),aie=Ja(pre()),lie=Ja(gre()),cie=Ja(bre()),JU=class{constructor(l,n){this.url=l,this.html=n}},h0={currentKey:null,currentUrl:null,keys:[],lookup:{},limit:10,has(l){return this.lookup[l]!==void 0},retrieve(l){let n=this.lookup[l];if(n===void 0)throw"No back button cache found for current location: "+l;return n},replace(l,n){this.has(l)?this.lookup[l]=n:this.push(l,n)},push(l,n){this.lookup[l]=n;let o=this.keys.indexOf(l);o>-1&&this.keys.splice(o,1),this.keys.unshift(l),this.trim()},trim(){for(let l of this.keys.splice(this.limit))delete this.lookup[l]}};function uie(){let l=new URL(window.location.href,document.baseURI);oZ(l,document.documentElement.outerHTML)}function die(l,n){let o=document.documentElement.outerHTML;h0.replace(l,new JU(n,o))}function fie(l,n){let o;l(i=>o=i),window.addEventListener("popstate",i=>{let u=i.state||{},h=u.alpine||{};if(Object.keys(u).length!==0&&h.snapshotIdx)if(h0.has(h.snapshotIdx)){let g=h0.retrieve(h.snapshotIdx);n(g.html,g.url,h0.currentUrl,h0.currentKey)}else o(h.url)})}function hie(l,n){mie(n,l)}function mie(l,n){sZ("pushState",l,n)}function oZ(l,n){sZ("replaceState",l,n)}function sZ(l,n,o){let i=n.toString()+"-"+Math.random();l==="pushState"?h0.push(i,new JU(n,o)):h0.replace(i=h0.currentKey??i,new JU(n,o));let u=history.state||{};u.alpine||(u.alpine={}),u.alpine.snapshotIdx=i,u.alpine.url=n.toString();try{history[l](u,JSON.stringify(document.title),n),h0.currentKey=i,h0.currentUrl=n}catch(h){h instanceof DOMException&&h.name==="SecurityError"&&console.error("Livewire: You can't use wire:navigate with a link to a different root domain: "+n),console.error(h)}}function pie(l,n){let o=h=>!h.isTrusted,i=h=>h.which>1||h.altKey||h.ctrlKey||h.metaKey||h.shiftKey,u=h=>h.which!==13||h.altKey||h.ctrlKey||h.metaKey||h.shiftKey;l.addEventListener("click",h=>{if(o(h)){h.preventDefault(),n(g=>g());return}i(h)||h.preventDefault()}),l.addEventListener("mousedown",h=>{i(h)||(h.preventDefault(),n(g=>{let b=S=>{S.preventDefault(),g(),l.removeEventListener("mouseup",b)};l.addEventListener("mouseup",b)}))}),l.addEventListener("keydown",h=>{u(h)||(h.preventDefault(),n(g=>g()))})}function gie(l,n=60,o){l.addEventListener("mouseenter",i=>{let u=setTimeout(()=>{o(i)},n),h=()=>{clearTimeout(u),l.removeEventListener("mouseleave",h)};l.addEventListener("mouseleave",h)})}function kW(l){return yT(l.getAttribute("href"))}function yT(l){return l!==null&&new URL(l,document.baseURI)}function FB(l){return l.pathname+l.search+l.hash}function bie(l,n){let o=FB(l);rZ(o,(i,u)=>{n(i,u)})}function rZ(l,n){let o={headers:{"X-Livewire-Navigate":""}};Jl("navigate.request",{url:l,options:o});let i;fetch(l,o).then(u=>{let h=yT(l);return i=yT(u.url),h.pathname+h.search===i.pathname+i.search&&(i.hash=h.hash),u.text()}).then(u=>{n(u,i)})}var km={};function AW(l,n){let o=FB(l);km[o]||(km[o]={finished:!1,html:null,whenFinished:()=>{}},rZ(o,(i,u)=>{n(i,u)}))}function LW(l,n,o){let i=km[FB(n)];i.html=l,i.finished=!0,i.finalDestination=o,i.whenFinished()}function vie(l,n,o){let i=FB(l);if(!km[i])return o();if(km[i].finished){let u=km[i].html,h=km[i].finalDestination;return delete km[i],n(u,h)}else km[i].whenFinished=()=>{let u=km[i].html,h=km[i].finalDestination;delete km[i],n(u,h)}}var GV=Ja(td());function RW(l){GV.default.mutateDom(()=>{l.querySelectorAll("[data-teleport-template]").forEach(n=>n._x_teleport.remove())})}function OW(l){GV.default.mutateDom(()=>{l.querySelectorAll("[data-teleport-target]").forEach(n=>n.remove())})}function IW(l){GV.default.walk(l,(n,o)=>{n._x_teleport&&(n._x_teleportPutBack(),o())})}function xie(l){return l.hasAttribute("data-teleport-target")}function PW(){document.body.setAttribute("data-scroll-x",document.body.scrollLeft),document.body.setAttribute("data-scroll-y",document.body.scrollTop),document.querySelectorAll(["[x-navigate\\:scroll]","[wire\\:scroll]"]).forEach(l=>{l.setAttribute("data-scroll-x",l.scrollLeft),l.setAttribute("data-scroll-y",l.scrollTop)})}function MW(){let l=n=>{n.hasAttribute("data-scroll-x")?(n.scrollTo({top:Number(n.getAttribute("data-scroll-y")),left:Number(n.getAttribute("data-scroll-x")),behavior:"instant"}),n.removeAttribute("data-scroll-x"),n.removeAttribute("data-scroll-y")):window.scrollTo({top:0,left:0,behavior:"instant"})};queueMicrotask(()=>{l(document.body),document.querySelectorAll(["[x-navigate\\:scroll]","[wire\\:scroll]"]).forEach(l)})}var QU=Ja(td()),zL={};function NW(l){zL={},document.querySelectorAll("[x-persist]").forEach(n=>{zL[n.getAttribute("x-persist")]=n,l(n),QU.default.mutateDom(()=>{n.remove()})})}function FW(l){let n=[];document.querySelectorAll("[x-persist]").forEach(o=>{let i=zL[o.getAttribute("x-persist")];i&&(n.push(o.getAttribute("x-persist")),i._x_wasPersisted=!0,l(i,o),QU.default.mutateDom(()=>{o.replaceWith(i)}))}),Object.entries(zL).forEach(([o,i])=>{n.includes(o)||QU.default.destroyTree(i)}),zL={}}function yie(l){return l.hasAttribute("x-persist")}var BB=Ja(vre());BB.default.configure({minimum:.1,trickleSpeed:200,showSpinner:!1,parent:"body"});Cie();var eV=!1;function wie(){eV=!0,setTimeout(()=>{eV&&BB.default.start()},150)}function Sie(){eV=!1,BB.default.done()}function Eie(){BB.default.remove()}function Cie(){let l=document.createElement("style");l.innerHTML=`/* Make clicks pass-through */

    #nprogress {
      pointer-events: none;
    }

    #nprogress .bar {
      background: var(--livewire-progress-bar-color, #29d);

      position: fixed;
      z-index: 1031;
      top: 0;
      left: 0;

      width: 100%;
      height: 2px;
    }

    /* Fancy blur effect */
    #nprogress .peg {
      display: block;
      position: absolute;
      right: 0px;
      width: 100px;
      height: 100%;
      box-shadow: 0 0 10px var(--livewire-progress-bar-color, #29d), 0 0 5px var(--livewire-progress-bar-color, #29d);
      opacity: 1.0;

      -webkit-transform: rotate(3deg) translate(0px, -4px);
          -ms-transform: rotate(3deg) translate(0px, -4px);
              transform: rotate(3deg) translate(0px, -4px);
    }

    /* Remove these to get rid of the spinner */
    #nprogress .spinner {
      display: block;
      position: fixed;
      z-index: 1031;
      top: 15px;
      right: 15px;
    }

    #nprogress .spinner-icon {
      width: 18px;
      height: 18px;
      box-sizing: border-box;

      border: solid 2px transparent;
      border-top-color: var(--livewire-progress-bar-color, #29d);
      border-left-color: var(--livewire-progress-bar-color, #29d);
      border-radius: 50%;

      -webkit-animation: nprogress-spinner 400ms linear infinite;
              animation: nprogress-spinner 400ms linear infinite;
    }

    .nprogress-custom-parent {
      overflow: hidden;
      position: relative;
    }

    .nprogress-custom-parent #nprogress .spinner,
    .nprogress-custom-parent #nprogress .bar {
      position: absolute;
    }

    @-webkit-keyframes nprogress-spinner {
      0%   { -webkit-transform: rotate(0deg); }
      100% { -webkit-transform: rotate(360deg); }
    }
    @keyframes nprogress-spinner {
      0%   { transform: rotate(0deg); }
      100% { transform: rotate(360deg); }
    }
    `;let n=Sre();n&&(l.nonce=n),document.head.appendChild(l)}var nU=[],iZ=["data-csrf","aria-hidden"];function BW(l,n){let o=new DOMParser().parseFromString(l,"text/html"),i=document.adoptNode(o.body),u=document.adoptNode(o.head);nU=nU.concat(Array.from(document.body.querySelectorAll("script")).map(b=>uZ(dZ(b.outerHTML,iZ))));let h=()=>{};Tie(u).finally(()=>{h()}),_ie(i,nU);let g=document.body;document.body.replaceWith(i),Alpine.destroyTree(g),n(b=>h=b)}function _ie(l,n){l.querySelectorAll("script").forEach(o=>{if(o.hasAttribute("data-navigate-once")){let i=uZ(dZ(o.outerHTML,iZ));if(n.includes(i))return}o.replaceWith(aZ(o))})}function Tie(l){let n=Array.from(document.head.children),o=n.map(h=>h.outerHTML),i=document.createDocumentFragment(),u=[];for(let h of Array.from(l.children))if(HW(h))if(o.includes(h.outerHTML))i.appendChild(h);else if(lZ(h)&&kie(h,n)&&setTimeout(()=>window.location.reload()),cZ(h))try{u.push(Die(aZ(h)))}catch{}else document.head.appendChild(h);for(let h of Array.from(document.head.children))HW(h)||h.remove();for(let h of Array.from(l.children))document.head.appendChild(h);return Promise.all(u)}async function Die(l){return new Promise((n,o)=>{l.src?(l.onload=()=>n(),l.onerror=()=>o()):n(),document.head.appendChild(l)})}function aZ(l){let n=document.createElement("script");n.textContent=l.textContent,n.async=l.async;for(let o of l.attributes)n.setAttribute(o.name,o.value);return n}function lZ(l){return l.hasAttribute("data-navigate-track")}function kie(l,n){let[o,i]=$W(l);return n.some(u=>{if(!lZ(u))return!1;let[h,g]=$W(u);if(h===o&&i!==g)return!0})}function $W(l){return(cZ(l)?l.src:l.href).split("?")}function HW(l){return l.tagName.toLowerCase()==="link"&&l.getAttribute("rel").toLowerCase()==="stylesheet"||l.tagName.toLowerCase()==="style"||l.tagName.toLowerCase()==="script"}function cZ(l){return l.tagName.toLowerCase()==="script"}function uZ(l){return l.split("").reduce((n,o)=>(n=(n<<5)-n+o.charCodeAt(0),n&n),0)}function dZ(l,n){let o=l;return n.forEach(i=>{const u=new RegExp(`${i}="[^"]*"|${i}='[^']*'`,"g");o=o.replace(u,"")}),o=o.replaceAll(" ",""),o.trim()}var oU=!0;function Aie(l){l.navigate=o=>{let i=yT(o);Kb("alpine:navigate",{url:i,history:!1,cached:!1})||n(i)},l.navigate.disableProgressBar=()=>{oU=!1},l.addInitSelector(()=>`[${l.prefixed("navigate")}]`),l.directive("navigate",(o,{modifiers:i})=>{i.includes("hover")&&gie(o,60,()=>{let h=kW(o);h&&AW(h,(g,b)=>{LW(g,h,b)})}),pie(o,h=>{let g=kW(o);g&&(AW(g,(b,S)=>{LW(b,g,S)}),h(()=>{Kb("alpine:navigate",{url:g,history:!1,cached:!1})||n(g)}))})});function n(o,i=!0){oU&&wie(),Lie(o,(u,h)=>{Kb("alpine:navigating"),PW(),oU&&Sie(),Rie(),uie(),UW(l,g=>{NW(b=>{RW(b)}),i?hie(u,h):oZ(h,u),BW(u,b=>{OW(document.body),FW((S,T)=>{IW(S)}),MW(),b(()=>{g(()=>{setTimeout(()=>{}),VW(l),Kb("alpine:navigated")})})})})})}fie(o=>{o(i=>{let u=yT(i);if(Kb("alpine:navigate",{url:u,history:!0,cached:!1}))return;n(u,!1)})},(o,i,u,h)=>{let g=yT(i);Kb("alpine:navigate",{url:g,history:!0,cached:!0})||(PW(),Kb("alpine:navigating"),die(u,h),UW(l,S=>{NW(T=>{RW(T)}),BW(o,()=>{Eie(),OW(document.body),FW((T,k)=>{IW(T)}),MW(),S(()=>{VW(l),Kb("alpine:navigated")})})}))}),setTimeout(()=>{Kb("alpine:navigated")})}function Lie(l,n){vie(l,n,()=>{bie(l,n)})}function UW(l,n){l.stopObservingMutations(),n(o=>{l.startObservingMutations(),queueMicrotask(()=>{o()})})}function Kb(l,n){let o=new CustomEvent(l,{cancelable:!0,bubbles:!0,detail:n});return document.dispatchEvent(o),o.defaultPrevented}function VW(l){l.initTree(document.body,void 0,(n,o)=>{n._x_wasPersisted&&o()})}function Rie(){let l=function(n,o){Alpine.walk(n,(i,u)=>{yie(i)&&u(),xie(i)?u():o(i,u)})};Alpine.destroyTree(document.body,l)}function Oie(l){l.magic("queryString",(n,{interceptor:o})=>{let i,u=!1,h=!1;return o((g,b,S,T,k)=>{let R=i||T,{initial:V,replace:z,push:$,pop:W}=tV(R,g,u);return S(V),h?(l.effect(()=>$(b())),W(async Q=>{S(Q),await Promise.resolve()})):l.effect(()=>z(b())),V},g=>{g.alwaysShow=()=>(u=!0,g),g.usePush=()=>(h=!0,g),g.as=b=>(i=b,g)})}),l.history={track:tV}}function tV(l,n,o=!1,i=null){let{has:u,get:h,set:g,remove:b}=Pie(),S=new URL(window.location.href),T=u(S,l),k=T?h(S,l):n,R=JSON.stringify(k),V=[!1,null,void 0].includes(i)?n:JSON.stringify(i),z=j=>JSON.stringify(j)===R,$=j=>JSON.stringify(j)===V;o&&(S=g(S,l,k)),zW(S,l,{value:k});let W=!1,Q=(j,se)=>{if(W)return;let re=new URL(window.location.href);!o&&!T&&z(se)||se===void 0||!o&&$(se)?re=b(re,l):re=g(re,l,se),j(re,l,{value:se})};return{initial:k,replace(j){Q(zW,j)},push(j){Q(Iie,j)},pop(j){let se=re=>{!re.state||!re.state.alpine||Object.entries(re.state.alpine).forEach(([Y,{value:me}])=>{if(Y!==l)return;W=!0;let ae=j(me);ae instanceof Promise?ae.finally(()=>W=!1):W=!1})};return window.addEventListener("popstate",se),()=>window.removeEventListener("popstate",se)}}}function zW(l,n,o){let i=window.history.state||{};i.alpine||(i.alpine={}),i.alpine[n]=WV(o),window.history.replaceState(i,"",l.toString())}function Iie(l,n,o){let i=window.history.state||{};i.alpine||(i.alpine={}),i={alpine:{...i.alpine,[n]:WV(o)}},window.history.pushState(i,"",l.toString())}function WV(l){if(l!==void 0)return JSON.parse(JSON.stringify(l))}function Pie(){return{has(l,n){let o=l.search;if(!o)return!1;let i=h4(o);return Object.keys(i).includes(n)},get(l,n){let o=l.search;return o?h4(o)[n]:!1},set(l,n,o){let i=h4(l.search);return i[n]=fZ(WV(o)),l.search=GW(i),l},remove(l,n){let o=h4(l.search);return delete o[n],l.search=GW(o),l}}}function fZ(l){if(!$V(l))return l;for(let n in l)l[n]===null?delete l[n]:l[n]=fZ(l[n]);return l}function GW(l){let n=u=>typeof u=="object"&&u!==null,o=(u,h={},g="")=>(Object.entries(u).forEach(([b,S])=>{let T=g===""?b:`${g}[${b}]`;S===null?h[T]="":n(S)?h={...h,...o(S,h,T)}:h[T]=encodeURIComponent(S).replaceAll("%20","+").replaceAll("%2C",",")}),h),i=o(l);return Object.entries(i).map(([u,h])=>`${u}=${h}`).join("&")}function h4(l){if(l=l.replace("?",""),l==="")return{};let n=(u,h,g)=>{let[b,S,...T]=u.split(".");if(!S)return g[u]=h;g[b]===void 0&&(g[b]=isNaN(S)?{}:[]),n([S,...T].join("."),h,g[b])},o=l.split("&").map(u=>u.split("=")),i=Object.create(null);return o.forEach(([u,h])=>{if(!(typeof h>"u"))if(h=decodeURIComponent(h.replaceAll("+","%20")),!u.includes("["))i[u]=h;else{let g=u.replaceAll("[",".").replaceAll("]","");n(g,h,i)}}),i}var Mie=Ja(xre()),Nie=Ja(yre()),vu=Ja(td());function Fie(){setTimeout(()=>Bie()),XH(document,"livewire:init"),XH(document,"livewire:initializing"),vu.default.plugin(Mie.default),vu.default.plugin(Oie),vu.default.plugin(aie.default),vu.default.plugin(lie.default),vu.default.plugin(sie.default),vu.default.plugin(cie.default),vu.default.plugin(rie.default),vu.default.plugin(iie.default),vu.default.plugin(Aie),vu.default.plugin(Nie.default),vu.default.addRootSelector(()=>"[wire\\:id]"),vu.default.onAttributesAdded((l,n)=>{if(!Array.from(n).some(i=>NL(i.name)))return;let o=h1(l,!1);o&&n.forEach(i=>{if(!NL(i.name))return;let u=XU(l,i.name);Jl("directive.init",{el:l,component:o,directive:u,cleanup:h=>{vu.default.onAttributeRemoved(l,u.raw,h)}})})}),vu.default.interceptInit(vu.default.skipDuringClone(l=>{if(!Array.from(l.attributes).some(o=>NL(o.name)))return;if(l.hasAttribute("wire:id")){let o=Wre(l);vu.default.onAttributeRemoved(l,"wire:id",()=>{jre(o.id)})}let n=h1(l,!1);n&&(Jl("element.init",{el:l,component:n}),Array.from(l.getAttributeNames()).filter(i=>NL(i)).map(i=>XU(l,i)).forEach(i=>{Jl("directive.init",{el:l,component:n,directive:i,cleanup:u=>{vu.default.onAttributeRemoved(l,i.raw,u)}})}))})),vu.default.start(),setTimeout(()=>window.Livewire.initialRenderIsFinished=!0),XH(document,"livewire:initialized")}function Bie(){let l=document.querySelector("script[data-update-uri][data-csrf]");if(!l)return;let n=l.closest("[wire\\:id]");n&&console.warn("Livewire: missing closing tags found. Ensure your template elements contain matching closing tags.",n)}var jV=Ja(td());Yi("effect",({component:l,effects:n})=>{$ie(l,n.listeners||[])});function $ie(l,n){n.forEach(o=>{let i=u=>{u.__livewire&&u.__livewire.receivedBy.push(l),l.$wire.call("__dispatch",o,u.detail||{})};window.addEventListener(o,i),l.addCleanup(()=>window.removeEventListener(o,i)),l.el.addEventListener(o,u=>{u.__livewire&&(u.bubbles||(u.__livewire&&u.__livewire.receivedBy.push(l.id),l.$wire.call("__dispatch",o,u.detail||{})))})})}var WW=Ja(td()),J_=new WeakMap,uB=new Set;Yi("payload.intercept",async({assets:l})=>{if(l)for(let[n,o]of Object.entries(l))await Vie(n,async()=>{await zie(o)})});Yi("component.init",({component:l})=>{let n=l.snapshot.memo.assets;n&&n.forEach(o=>{uB.has(o)||uB.add(o)})});Yi("effect",({component:l,effects:n})=>{let o=n.scripts;o&&Object.entries(o).forEach(([i,u])=>{Hie(l,i,()=>{let h=Uie(u);WW.default.dontAutoEvaluateFunctions(()=>{WW.default.evaluate(l.el,h,{$wire:l.$wire})})})})});function Hie(l,n,o){if(J_.has(l)&&J_.get(l).includes(n))return;o(),J_.has(l)||J_.set(l,[]);let i=J_.get(l);i.push(n),J_.set(l,i)}function Uie(l){let o=/<script\b[^>]*>([\s\S]*?)<\/script>/gm.exec(l);return o&&o[1]?o[1].trim():""}async function Vie(l,n){uB.has(l)||(await n(),uB.add(l))}async function zie(l){let n=new DOMParser().parseFromString(l,"text/html"),o=document.adoptNode(n.head);for(let i of o.children)try{await Gie(i)}catch{}}async function Gie(l){return new Promise((n,o)=>{if(Wie(l)){let i=jie(l);i.src?(i.onload=()=>n(),i.onerror=()=>o()):n(),document.head.appendChild(i)}else document.head.appendChild(l),n()})}function Wie(l){return l.tagName.toLowerCase()==="script"}function jie(l){let n=document.createElement("script");n.textContent=l.textContent,n.async=l.async;for(let o of l.attributes)n.setAttribute(o.name,o.value);return n}var jW=Ja(td());Yi("effect",({component:l,effects:n})=>{let o=n.js,i=n.xjs;o&&Object.entries(o).forEach(([u,h])=>{zre(l,u,()=>{jW.default.evaluate(l.el,h)})}),i&&i.forEach(u=>{jW.default.evaluate(l.el,u)})});var Kie=Ja(td());function Zie(l,n,o){let i=n.parentElement?n.parentElement.tagName.toLowerCase():"div",u=document.createElement(i);u.innerHTML=o;let h;try{h=h1(n.parentElement)}catch{}h&&(u.__livewire=h);let g=u.firstElementChild;g.__livewire=l,Jl("morph",{el:n,toEl:g,component:l}),Kie.default.morph(n,g,{updating:(b,S,T,k)=>{if(!Q_(b)){if(Jl("morph.updating",{el:b,toEl:S,component:l,skip:k,childrenOnly:T}),b.__livewire_replace===!0&&(b.innerHTML=S.innerHTML),b.__livewire_replace_self===!0)return b.outerHTML=S.outerHTML,k();if(b.__livewire_ignore===!0||(b.__livewire_ignore_self===!0&&T(),KW(b)&&b.getAttribute("wire:id")!==l.id))return k();KW(b)&&(S.__livewire=l)}},updated:b=>{Q_(b)||Jl("morph.updated",{el:b,component:l})},removing:(b,S)=>{Q_(b)||Jl("morph.removing",{el:b,component:l,skip:S})},removed:b=>{Q_(b)||Jl("morph.removed",{el:b,component:l})},adding:b=>{Jl("morph.adding",{el:b,component:l})},added:b=>{Q_(b)||(h1(b).id,Jl("morph.added",{el:b}))},key:b=>{if(!Q_(b))return b.hasAttribute("wire:key")?b.getAttribute("wire:key"):b.hasAttribute("wire:id")?b.getAttribute("wire:id"):b.id},lookahead:!1})}function Q_(l){return typeof l.hasAttribute!="function"}function KW(l){return l.hasAttribute("wire:id")}Yi("effect",({component:l,effects:n})=>{let o=n.html;o&&queueMicrotask(()=>{queueMicrotask(()=>{Zie(l,l.el,o)})})});Yi("effect",({component:l,effects:n})=>{qie(l,n.dispatches||[])});function qie(l,n){n.forEach(({name:o,params:i={},self:u=!1,to:h})=>{u?mT(l,o,i):h?VV(h,o,i):nZ(l,o,i)})}var Yie=Ja(td()),nV=new wre;Yi("directive.init",({el:l,directive:n,cleanup:o,component:i})=>setTimeout(()=>{n.value==="submit"&&l.addEventListener("submit",()=>{let u=n.expression.startsWith("$parent")?i.parent.id:i.id,h=Xie(l);nV.add(u,h)})}));Yi("commit",({component:l,respond:n})=>{n(()=>{nV.each(l.id,o=>o()),nV.remove(l.id)})});function Xie(l){let n=[];return Yie.default.walk(l,(o,i)=>{if(l.contains(o)){if(o.hasAttribute("wire:ignore"))return i();Jie(o)?n.push(eae(o)):Qie(o)&&n.push(tae(o))}}),()=>{for(;n.length>0;)n.shift()()}}function Jie(l){let n=l.tagName.toLowerCase();return n==="select"||n==="button"&&l.type==="submit"||n==="input"&&(l.type==="checkbox"||l.type==="radio")}function Qie(l){return["input","textarea"].includes(l.tagName.toLowerCase())}function eae(l){let n=l.disabled?()=>{}:()=>l.disabled=!1;return l.disabled=!0,n}function tae(l){let n=l.readOnly?()=>{}:()=>l.readOnly=!1;return l.readOnly=!0,n}Yi("commit.pooling",({commits:l})=>{l.forEach(n=>{let o=n.component;hZ(o,i=>{i.$wire.$commit()})})});Yi("commit.pooled",({pools:l})=>{nae(l).forEach(o=>{let i=o.component;hZ(i,u=>{oae(l,i,u)})})});function nae(l){let n=[];return l.forEach(o=>{o.commits.forEach(i=>{n.push(i)})}),n}function oae(l,n,o){let i=ZW(l,n),u=ZW(l,o),h=u.findCommitByComponent(o);u.delete(h),i.add(h),l.forEach(g=>{g.empty()&&l.delete(g)})}function ZW(l,n){for(let[o,i]of l.entries())if(i.hasCommitFor(n))return i}function hZ(l,n){mZ(l,o=>{(sae(o)||rae(o))&&n(o)})}function sae(l){return!!l.snapshot.memo.props}function rae(l){return!!l.snapshot.memo.bindings}function mZ(l,n){l.children.forEach(o=>{n(o),mZ(o,n)})}Yi("commit",({succeed:l})=>{l(({effects:n})=>{let o=n.download;if(!o)return;let i=window.webkitURL||window.URL,u=i.createObjectURL(iae(o.content,o.contentType)),h=document.createElement("a");h.style.display="none",h.href=u,h.download=o.name,document.body.appendChild(h),h.click(),setTimeout(function(){i.revokeObjectURL(u)},0)})});function iae(l,n="",o=512){const i=atob(l),u=[];n===null&&(n="");for(let h=0;h<i.length;h+=o){let g=i.slice(h,h+o),b=new Array(g.length);for(let T=0;T<g.length;T++)b[T]=g.charCodeAt(T);let S=new Uint8Array(b);u.push(S)}return new Blob(u,{type:n})}var oV=new WeakSet,sV=new WeakSet;Yi("component.init",({component:l})=>{let n=l.snapshot.memo;n.lazyLoaded!==void 0&&(sV.add(l),n.lazyIsolated!==void 0&&n.lazyIsolated===!1&&oV.add(l))});Yi("commit.pooling",({commits:l})=>{l.forEach(n=>{sV.has(n.component)&&(oV.has(n.component)?(n.isolate=!1,oV.delete(n.component)):n.isolate=!0,sV.delete(n.component))})});var qW=Ja(td());Yi("effect",({component:l,effects:n,cleanup:o})=>{let i=n.url;i&&Object.entries(i).forEach(([u,h])=>{let{name:g,as:b,use:S,alwaysShow:T,except:k}=aae(u,h);b||(b=g);let R=[!1,null,void 0].includes(k)?ev(l.ephemeral,g):k,{replace:V,push:z,pop:$}=tV(b,R,T,k);if(S==="replace"){let W=qW.default.effect(()=>{V(ev(l.reactive,g))});o(()=>qW.default.release(W))}else if(S==="push"){let W=Yi("commit",({component:j,succeed:se})=>{if(l!==j)return;let re=ev(l.canonical,g);se(()=>{let Y=ev(l.canonical,g);JSON.stringify(re)!==JSON.stringify(Y)&&z(Y)})}),Q=$(async j=>{await l.$wire.set(g,j),document.querySelectorAll("input").forEach(se=>{se._x_forceModelUpdate&&se._x_forceModelUpdate(se._x_model.get())})});o(()=>{W(),Q()})}})});function aae(l,n){let o={use:"replace",alwaysShow:!1};return typeof n=="string"?{...o,name:n,as:n}:{...{...o,name:l,as:l},...n}}Yi("request",({options:l})=>{window.Echo&&(l.headers["X-Socket-ID"]=window.Echo.socketId())});Yi("effect",({component:l,effects:n})=>{(n.listeners||[]).forEach(i=>{if(i.startsWith("echo")){if(typeof window.Echo>"u"){console.warn("Laravel Echo cannot be found");return}let u=i.split(/(echo:|echo-)|:|,/);u[1]=="echo:"&&u.splice(2,0,"channel",void 0),u[2]=="notification"&&u.push(void 0,void 0);let[h,g,b,S,T,k,R]=u;if(["channel","private","encryptedPrivate"].includes(b)){let V=z=>mT(l,i,[z]);window.Echo[b](T).listen(R,V),l.addCleanup(()=>{window.Echo[b](T).stopListening(R,V)})}else if(b=="presence")if(["here","joining","leaving"].includes(R))window.Echo.join(T)[R](V=>{mT(l,i,[V])});else{let V=z=>mT(l,i,[z]);window.Echo.join(T).listen(R,V),l.addCleanup(()=>{window.Echo.leaveChannel(T)})}else b=="notification"?window.Echo.private(T).notification(V=>{mT(l,i,[V])}):console.warn("Echo channel type not yet supported")}})});var pZ=new WeakSet;Yi("component.init",({component:l})=>{l.snapshot.memo.isolate===!0&&pZ.add(l)});Yi("commit.pooling",({commits:l})=>{l.forEach(n=>{pZ.has(n.component)&&(n.isolate=!0)})});cae()&&Alpine.navigate.disableProgressBar();document.addEventListener("alpine:navigate",l=>KV("livewire:navigate",l));document.addEventListener("alpine:navigating",l=>KV("livewire:navigating",l));document.addEventListener("alpine:navigated",l=>KV("livewire:navigated",l));function KV(l,n){let o=new CustomEvent(l,{cancelable:!0,bubbles:!0,detail:n.detail});document.dispatchEvent(o),o.defaultPrevented&&n.preventDefault()}function lae(l,n,o){l.redirectUsingNavigate?Alpine.navigate(n):o()}function cae(){return!!(document.querySelector("[data-no-progress-bar]")||window.livewireScriptConfig&&window.livewireScriptConfig.progressBar===!1)}Yi("effect",({effects:l})=>{if(!l.redirect)return;let n=l.redirect;lae(l,n,()=>{window.location.href=n})});var YW=Ja(td());Yi("morph.added",({el:l})=>{l.__addedByMorph=!0});Nm("transition",({el:l,directive:n,component:o,cleanup:i})=>{let u=YW.default.reactive({state:!l.__addedByMorph});YW.default.bind(l,{[n.rawName.replace("wire:","x-")]:"","x-show"(){return u.state}}),l.__addedByMorph&&setTimeout(()=>u.state=!0);let h=[];h.push(Yi("morph.removing",({el:g,skip:b})=>{b(),g.addEventListener("transitionend",()=>{g.remove()}),u.state=!1,h.push(Yi("morph",({component:S})=>{S===o&&(g.remove(),h.forEach(T=>T()))}))})),i(()=>h.forEach(g=>g()))});var uae=new zK;function dae(l,n){uae.each(l,o=>{o.callback(),o.callback=()=>{}}),n()}var XW=Ja(td());Yi("directive.init",({el:l,directive:n,cleanup:o,component:i})=>{if(["snapshot","effects","model","init","loading","poll","ignore","id","data","key","target","dirty"].includes(n.value)||tie(n.value))return;let u=n.rawName.replace("wire:","x-on:");n.value==="submit"&&!n.modifiers.includes("prevent")&&(u=u+".prevent");let h=XW.default.bind(l,{[u](g){let b=()=>{dae(i,()=>{XW.default.evaluate(l,"$wire."+n.expression,{scope:{$event:g}})})};l.__livewire_confirm?l.__livewire_confirm(()=>{b()},()=>{g.stopImmediatePropagation()}):b()}});o(h)});var pT=Ja(td());pT.default.addInitSelector(()=>"[wire\\:navigate]");pT.default.addInitSelector(()=>"[wire\\:navigate\\.hover]");pT.default.interceptInit(pT.default.skipDuringClone(l=>{l.hasAttribute("wire:navigate")?pT.default.bind(l,{"x-navigate":!0}):l.hasAttribute("wire:navigate.hover")&&pT.default.bind(l,{"x-navigate.hover":!0})}));document.addEventListener("alpine:navigating",()=>{Livewire.all().forEach(l=>{l.inscribeSnapshotAndEffectsOnElement()})});Nm("confirm",({el:l,directive:n})=>{let o=n.expression,i=n.modifiers.includes("prompt");o=o.replaceAll("\\n",`
`),o===""&&(o="Are you sure?"),l.__livewire_confirm=(u,h)=>{if(i){let[g,b]=o.split("|");b?prompt(g)===b?u():h():console.warn("Livewire: Must provide expectation with wire:confirm.prompt")}else confirm(o)?u():h()}});function sS(l,n,o,i=null){if(o=n.modifiers.includes("remove")?!o:o,n.modifiers.includes("class")){let u=n.expression.split(" ").filter(String);o?l.classList.add(...u):l.classList.remove(...u)}else if(n.modifiers.includes("attr"))o?l.setAttribute(n.expression,!0):l.removeAttribute(n.expression);else{let u=i??window.getComputedStyle(l,null).getPropertyValue("display"),h=["inline","block","table","flex","grid","inline-flex"].filter(g=>n.modifiers.includes(g))[0]||"inline-block";h=n.modifiers.includes("remove")&&!o?u:h,l.style.display=o?h:"none"}}var rV=new Set,iV=new Set;window.addEventListener("offline",()=>rV.forEach(l=>l()));window.addEventListener("online",()=>iV.forEach(l=>l()));Nm("offline",({el:l,directive:n,cleanup:o})=>{let i=()=>sS(l,n,!0),u=()=>sS(l,n,!1);rV.add(i),iV.add(u),o(()=>{rV.delete(i),iV.delete(u)})});Nm("loading",({el:l,directive:n,component:o,cleanup:i})=>{let{targets:u,inverted:h}=gae(l),[g,b]=fae(n),S=hae(o,u,h,[()=>g(()=>sS(l,n,!0)),()=>b(()=>sS(l,n,!1))]),T=mae(o,u,[()=>g(()=>sS(l,n,!0)),()=>b(()=>sS(l,n,!1))]);i(()=>{S(),T()})});function fae(l){if(!l.modifiers.includes("delay")||l.modifiers.includes("none"))return[h=>h(),h=>h()];let n=200,o={shortest:50,shorter:100,short:150,default:200,long:300,longer:500,longest:1e3};Object.keys(o).some(h=>{if(l.modifiers.includes(h))return n=o[h],!0});let i,u=!1;return[h=>{i=setTimeout(()=>{h(),u=!0},n)},async h=>{u?(await h(),u=!1):clearTimeout(i)}]}function hae(l,n,o,[i,u]){return Yi("commit",({component:h,commit:g,respond:b})=>{h===l&&(n.length>0&&pae(g,n)===o||(i(),b(()=>{u()})))})}function mae(l,n,[o,i]){let u=S=>{let{id:T,property:k}=S.detail;return T!==l.id||n.length>0&&!n.map(R=>R.target).includes(k)},h=JH(window,"livewire-upload-start",S=>{u(S)||o()}),g=JH(window,"livewire-upload-finish",S=>{u(S)||i()}),b=JH(window,"livewire-upload-error",S=>{u(S)||i()});return()=>{h(),g(),b()}}function pae(l,n){let{updates:o,calls:i}=l;return n.some(({target:u,params:h})=>{if(h)return i.some(({method:b,params:S})=>u===b&&h===gZ(JSON.stringify(S)));if(Object.keys(o).some(b=>b.includes(".")&&b.split(".")[0]===u?!0:b===u)||i.map(b=>b.method).includes(u))return!0})}function gae(l){let n=zV(l),o=[],i=!1;if(n.has("target")){let u=n.get("target"),h=u.expression;u.modifiers.includes("except")&&(i=!0),h.includes("(")&&h.includes(")")?o.push({target:u.method,params:gZ(JSON.stringify(u.params))}):h.includes(",")?h.split(",").map(g=>g.trim()).forEach(g=>{o.push({target:g})}):o.push({target:h})}else{let u=["init","dirty","offline","target","loading","poll","ignore","key","id"];n.all().filter(h=>!u.includes(h.value)).map(h=>h.expression.split("(")[0]).forEach(h=>o.push({target:h}))}return{targets:o,inverted:i}}function gZ(l){return btoa(encodeURIComponent(l))}Nm("stream",({el:l,directive:n,cleanup:o})=>{let{expression:i,modifiers:u}=n,h=Yi("stream",({name:g,content:b,replace:S})=>{g===i&&(u.includes("replace")||S?l.innerHTML=b:l.innerHTML=l.innerHTML+b)});o(h)});Yi("request",({respond:l})=>{l(n=>{let o=n.response;o.headers.has("X-Livewire-Stream")&&(n.response={ok:!0,redirected:!1,status:200,async text(){let i=await bae(o,u=>{Jl("stream",u)});return jK(i)&&(this.ok=!1),i}})})});async function bae(l,n){let o=l.body.getReader(),i="";for(;;){let{done:u,value:h}=await o.read(),b=new TextDecoder().decode(h),[S,T]=vae(i+b);if(S.forEach(k=>{n(k)}),i=T,u)return i}}function vae(l){let n=/({"stream":true.*?"endStream":true})/g,o=l.match(n),i=[];if(o)for(let h=0;h<o.length;h++)i.push(JSON.parse(o[h]).body);let u=l.replace(n,"");return[i,u]}Nm("replace",({el:l,directive:n})=>{n.modifiers.includes("self")?l.__livewire_replace_self=!0:l.__livewire_replace=!0});Nm("ignore",({el:l,directive:n})=>{n.modifiers.includes("self")?l.__livewire_ignore_self=!0:l.__livewire_ignore=!0});var bZ=new zK;Yi("commit",({component:l,respond:n})=>{n(()=>{setTimeout(()=>{bZ.each(l,o=>o(!1))})})});Nm("dirty",({el:l,directive:n,component:o})=>{let i=xae(l);Alpine.reactive({state:!1});let u=!1,h=l.style.display,g=b=>{sS(l,n,b,h),u=b};bZ.add(o,g),Alpine.effect(()=>{let b=!1;if(i.length===0)b=JSON.stringify(o.canonical)!==JSON.stringify(o.reactive);else for(let S=0;S<i.length&&!b;S++){let T=i[S];b=JSON.stringify(ev(o.canonical,T))!==JSON.stringify(ev(o.reactive,T))}u!==b&&g(b),u=b})});function xae(l){let n=zV(l),o=[];return n.has("model")&&o.push(n.get("model").expression),n.has("target")&&(o=o.concat(n.get("target").expression.split(",").map(i=>i.trim()))),o}var yae=Ja(td());Nm("model",({el:l,directive:n,component:o,cleanup:i})=>{let{expression:u,modifiers:h}=n;if(!u)return console.warn("Livewire: [wire:model] is missing a value.",l);if(vZ(o,u))return console.warn('Livewire: [wire:model="'+u+'"] property does not exist on component: ['+o.name+"]",l);if(l.type&&l.type.toLowerCase()==="file")return _re(l,u,o,i);let g=h.includes("live"),b=h.includes("lazy")||h.includes("change"),S=h.includes("blur"),T=h.includes("debounce"),k=u.startsWith("$parent")?()=>o.$wire.$parent.$commit():()=>o.$wire.$commit(),R=Sae(l)&&!T&&g?Eae(k,150):k;yae.default.bind(l,{"@change"(){b&&k()},"@blur"(){S&&k()},["x-model"+wae(h)](){return{get(){return ev(o.$wire,u)},set(V){MB(o.$wire,u,V),g&&!b&&!S&&R()}}}})});function wae(l){return l=l.filter(n=>!["lazy","defer"].includes(n)),l.length===0?"":"."+l.join(".")}function Sae(l){return["INPUT","TEXTAREA"].includes(l.tagName.toUpperCase())&&!["checkbox","radio"].includes(l.type)}function vZ(l,n){if(n.startsWith("$parent")){let i=h1(l.el.parentElement,!1);return i?vZ(i,n.split("$parent.")[1]):!0}let o=n.split(".")[0];return!Object.keys(l.canonical).includes(o)}function Eae(l,n){var o;return function(){var i=this,u=arguments,h=function(){o=null,l.apply(i,u)};clearTimeout(o),o=setTimeout(h,n)}}var Cae=Ja(td());Nm("init",({el:l,directive:n})=>{let o=n.expression??"$refresh";Cae.default.evaluate(l,`$wire.${o}`)});var _ae=Ja(td());Nm("poll",({el:l,directive:n})=>{let o=Nae(n.modifiers,2e3),{start:i,pauseWhile:u,throttleWhile:h,stopWhen:g}=Dae(()=>{Tae(l,n)},o);i(),h(()=>Lae()&&Oae(n)),u(()=>Iae(n)&&Pae(l)),u(()=>Rae(l)),u(()=>Aae()),g(()=>Mae(l))});function Tae(l,n){_ae.default.evaluate(l,n.expression?"$wire."+n.expression:"$wire.$commit()")}function Dae(l,n=2e3){let o=[],i=[],u=[];return{start(){let h=kae(n,()=>{if(u.some(g=>g()))return h();o.some(g=>g())||i.some(g=>g())&&Math.random()<.95||l()})},pauseWhile(h){o.push(h)},throttleWhile(h){i.push(h)},stopWhen(h){u.push(h)}}}var Kw=[];function kae(l,n){if(!Kw[l]){let o={timer:setInterval(()=>o.callbacks.forEach(i=>i()),l),callbacks:new Set};Kw[l]=o}return Kw[l].callbacks.add(n),()=>{Kw[l].callbacks.delete(n),Kw[l].callbacks.size===0&&(clearInterval(Kw[l].timer),delete Kw[l])}}var ZV=!1;window.addEventListener("offline",()=>ZV=!0);window.addEventListener("online",()=>ZV=!1);function Aae(){return ZV}var xZ=!1;document.addEventListener("visibilitychange",()=>{xZ=document.hidden},!1);function Lae(){return xZ}function Rae(l){return!zV(l).has("poll")}function Oae(l){return!l.modifiers.includes("keep-alive")}function Iae(l){return l.modifiers.includes("visible")}function Pae(l){let n=l.getBoundingClientRect();return!(n.top<(window.innerHeight||document.documentElement.clientHeight)&&n.left<(window.innerWidth||document.documentElement.clientWidth)&&n.bottom>0&&n.right>0)}function Mae(l){return l.isConnected===!1}function Nae(l,n){let o,i=l.find(h=>h.match(/([0-9]+)ms/)),u=l.find(h=>h.match(/([0-9]+)s/));return i?o=Number(i.replace("ms","")):u&&(o=Number(u.replace("s",""))*1e3),o||n}var qV={directive:Nm,dispatchTo:VV,start:Fie,first:Yre,find:qre,getByName:Zre,all:Xre,hook:Yi,trigger:Jl,triggerAsync:ZK,dispatch:Jre,on:eie,get navigate(){return jV.default.navigate}},YV=l=>console.warn(`Detected multiple instances of ${l} running`);window.Livewire&&YV("Livewire");window.Alpine&&YV("Alpine");window.Livewire=qV;window.Alpine=jV.default;window.livewireScriptConfig===void 0&&(window.Alpine.__fromLivewire=!0,document.addEventListener("DOMContentLoaded",()=>{window.Alpine.__fromLivewire===void 0&&YV("Alpine"),qV.start()}));var Fae=jV.default;/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
 * @license MIT *//*! Bundled license information:

tabbable/dist/index.js:
  (*!
  * tabbable 5.3.3
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
  *)

focus-trap/dist/focus-trap.js:
  (*!
  * focus-trap 6.9.4
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
  *)
*/function JW(l,n){var o=Object.keys(l);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(l);n&&(i=i.filter(function(u){return Object.getOwnPropertyDescriptor(l,u).enumerable})),o.push.apply(o,i)}return o}function w0(l){for(var n=1;n<arguments.length;n++){var o=arguments[n]!=null?arguments[n]:{};n%2?JW(Object(o),!0).forEach(function(i){Bae(l,i,o[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(o)):JW(Object(o)).forEach(function(i){Object.defineProperty(l,i,Object.getOwnPropertyDescriptor(o,i))})}return l}function V4(l){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?V4=function(n){return typeof n}:V4=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},V4(l)}function Bae(l,n,o){return n in l?Object.defineProperty(l,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):l[n]=o,l}function rv(){return rv=Object.assign||function(l){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(l[i]=o[i])}return l},rv.apply(this,arguments)}function $ae(l,n){if(l==null)return{};var o={},i=Object.keys(l),u,h;for(h=0;h<i.length;h++)u=i[h],!(n.indexOf(u)>=0)&&(o[u]=l[u]);return o}function Hae(l,n){if(l==null)return{};var o=$ae(l,n),i,u;if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(l);for(u=0;u<h.length;u++)i=h[u],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(l,i)&&(o[i]=l[i])}return o}var Uae="1.15.2";function ov(l){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(l)}var iv=ov(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),fR=ov(/Edge/i),QW=ov(/firefox/i),GL=ov(/safari/i)&&!ov(/chrome/i)&&!ov(/android/i),yZ=ov(/iP(ad|od|hone)/i),wZ=ov(/chrome/i)&&ov(/android/i),SZ={capture:!1,passive:!1};function qi(l,n,o){l.addEventListener(n,o,!iv&&SZ)}function Li(l,n,o){l.removeEventListener(n,o,!iv&&SZ)}function dB(l,n){if(n){if(n[0]===">"&&(n=n.substring(1)),l)try{if(l.matches)return l.matches(n);if(l.msMatchesSelector)return l.msMatchesSelector(n);if(l.webkitMatchesSelector)return l.webkitMatchesSelector(n)}catch{return!1}return!1}}function Vae(l){return l.host&&l!==document&&l.host.nodeType?l.host:l.parentNode}function Gp(l,n,o,i){if(l){o=o||document;do{if(n!=null&&(n[0]===">"?l.parentNode===o&&dB(l,n):dB(l,n))||i&&l===o)return l;if(l===o)break}while(l=Vae(l))}return null}var ej=/\s+/g;function Ch(l,n,o){if(l&&n)if(l.classList)l.classList[o?"add":"remove"](n);else{var i=(" "+l.className+" ").replace(ej," ").replace(" "+n+" "," ");l.className=(i+(o?" "+n:"")).replace(ej," ")}}function Qs(l,n,o){var i=l&&l.style;if(i){if(o===void 0)return document.defaultView&&document.defaultView.getComputedStyle?o=document.defaultView.getComputedStyle(l,""):l.currentStyle&&(o=l.currentStyle),n===void 0?o:o[n];!(n in i)&&n.indexOf("webkit")===-1&&(n="-webkit-"+n),i[n]=o+(typeof o=="string"?"":"px")}}function wT(l,n){var o="";if(typeof l=="string")o=l;else do{var i=Qs(l,"transform");i&&i!=="none"&&(o=i+" "+o)}while(!n&&(l=l.parentNode));var u=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return u&&new u(o)}function EZ(l,n,o){if(l){var i=l.getElementsByTagName(n),u=0,h=i.length;if(o)for(;u<h;u++)o(i[u],u);return i}return[]}function v0(){var l=document.scrollingElement;return l||document.documentElement}function Rc(l,n,o,i,u){if(!(!l.getBoundingClientRect&&l!==window)){var h,g,b,S,T,k,R;if(l!==window&&l.parentNode&&l!==v0()?(h=l.getBoundingClientRect(),g=h.top,b=h.left,S=h.bottom,T=h.right,k=h.height,R=h.width):(g=0,b=0,S=window.innerHeight,T=window.innerWidth,k=window.innerHeight,R=window.innerWidth),(n||o)&&l!==window&&(u=u||l.parentNode,!iv))do if(u&&u.getBoundingClientRect&&(Qs(u,"transform")!=="none"||o&&Qs(u,"position")!=="static")){var V=u.getBoundingClientRect();g-=V.top+parseInt(Qs(u,"border-top-width")),b-=V.left+parseInt(Qs(u,"border-left-width")),S=g+h.height,T=b+h.width;break}while(u=u.parentNode);if(i&&l!==window){var z=wT(u||l),$=z&&z.a,W=z&&z.d;z&&(g/=W,b/=$,R/=$,k/=W,S=g+k,T=b+R)}return{top:g,left:b,bottom:S,right:T,width:R,height:k}}}function tj(l,n,o){for(var i=l1(l,!0),u=Rc(l)[n];i;){var h=Rc(i)[o],g=void 0;if(o==="top"||o==="left"?g=u>=h:g=u<=h,!g)return i;if(i===v0())break;i=l1(i,!1)}return!1}function DT(l,n,o,i){for(var u=0,h=0,g=l.children;h<g.length;){if(g[h].style.display!=="none"&&g[h]!==er.ghost&&(i||g[h]!==er.dragged)&&Gp(g[h],o.draggable,l,!1)){if(u===n)return g[h];u++}h++}return null}function XV(l,n){for(var o=l.lastElementChild;o&&(o===er.ghost||Qs(o,"display")==="none"||n&&!dB(o,n));)o=o.previousElementSibling;return o||null}function Am(l,n){var o=0;if(!l||!l.parentNode)return-1;for(;l=l.previousElementSibling;)l.nodeName.toUpperCase()!=="TEMPLATE"&&l!==er.clone&&(!n||dB(l,n))&&o++;return o}function nj(l){var n=0,o=0,i=v0();if(l)do{var u=wT(l),h=u.a,g=u.d;n+=l.scrollLeft*h,o+=l.scrollTop*g}while(l!==i&&(l=l.parentNode));return[n,o]}function zae(l,n){for(var o in l)if(l.hasOwnProperty(o)){for(var i in n)if(n.hasOwnProperty(i)&&n[i]===l[o][i])return Number(o)}return-1}function l1(l,n){if(!l||!l.getBoundingClientRect)return v0();var o=l,i=!1;do if(o.clientWidth<o.scrollWidth||o.clientHeight<o.scrollHeight){var u=Qs(o);if(o.clientWidth<o.scrollWidth&&(u.overflowX=="auto"||u.overflowX=="scroll")||o.clientHeight<o.scrollHeight&&(u.overflowY=="auto"||u.overflowY=="scroll")){if(!o.getBoundingClientRect||o===document.body)return v0();if(i||n)return o;i=!0}}while(o=o.parentNode);return v0()}function Gae(l,n){if(l&&n)for(var o in n)n.hasOwnProperty(o)&&(l[o]=n[o]);return l}function sU(l,n){return Math.round(l.top)===Math.round(n.top)&&Math.round(l.left)===Math.round(n.left)&&Math.round(l.height)===Math.round(n.height)&&Math.round(l.width)===Math.round(n.width)}var WL;function CZ(l,n){return function(){if(!WL){var o=arguments,i=this;o.length===1?l.call(i,o[0]):l.apply(i,o),WL=setTimeout(function(){WL=void 0},n)}}}function Wae(){clearTimeout(WL),WL=void 0}function _Z(l,n,o){l.scrollLeft+=n,l.scrollTop+=o}function TZ(l){var n=window.Polymer,o=window.jQuery||window.Zepto;return n&&n.dom?n.dom(l).cloneNode(!0):o?o(l).clone(!0)[0]:l.cloneNode(!0)}function DZ(l,n,o){var i={};return Array.from(l.children).forEach(function(u){var h,g,b,S;if(!(!Gp(u,n.draggable,l,!1)||u.animated||u===o)){var T=Rc(u);i.left=Math.min((h=i.left)!==null&&h!==void 0?h:1/0,T.left),i.top=Math.min((g=i.top)!==null&&g!==void 0?g:1/0,T.top),i.right=Math.max((b=i.right)!==null&&b!==void 0?b:-1/0,T.right),i.bottom=Math.max((S=i.bottom)!==null&&S!==void 0?S:-1/0,T.bottom)}}),i.width=i.right-i.left,i.height=i.bottom-i.top,i.x=i.left,i.y=i.top,i}var kh="Sortable"+new Date().getTime();function jae(){var l=[],n;return{captureAnimationState:function(){if(l=[],!!this.options.animation){var i=[].slice.call(this.el.children);i.forEach(function(u){if(!(Qs(u,"display")==="none"||u===er.ghost)){l.push({target:u,rect:Rc(u)});var h=w0({},l[l.length-1].rect);if(u.thisAnimationDuration){var g=wT(u,!0);g&&(h.top-=g.f,h.left-=g.e)}u.fromRect=h}})}},addAnimationState:function(i){l.push(i)},removeAnimationState:function(i){l.splice(zae(l,{target:i}),1)},animateAll:function(i){var u=this;if(!this.options.animation){clearTimeout(n),typeof i=="function"&&i();return}var h=!1,g=0;l.forEach(function(b){var S=0,T=b.target,k=T.fromRect,R=Rc(T),V=T.prevFromRect,z=T.prevToRect,$=b.rect,W=wT(T,!0);W&&(R.top-=W.f,R.left-=W.e),T.toRect=R,T.thisAnimationDuration&&sU(V,R)&&!sU(k,R)&&($.top-R.top)/($.left-R.left)===(k.top-R.top)/(k.left-R.left)&&(S=Zae($,V,z,u.options)),sU(R,k)||(T.prevFromRect=k,T.prevToRect=R,S||(S=u.options.animation),u.animate(T,$,R,S)),S&&(h=!0,g=Math.max(g,S),clearTimeout(T.animationResetTimer),T.animationResetTimer=setTimeout(function(){T.animationTime=0,T.prevFromRect=null,T.fromRect=null,T.prevToRect=null,T.thisAnimationDuration=null},S),T.thisAnimationDuration=S)}),clearTimeout(n),h?n=setTimeout(function(){typeof i=="function"&&i()},g):typeof i=="function"&&i(),l=[]},animate:function(i,u,h,g){if(g){Qs(i,"transition",""),Qs(i,"transform","");var b=wT(this.el),S=b&&b.a,T=b&&b.d,k=(u.left-h.left)/(S||1),R=(u.top-h.top)/(T||1);i.animatingX=!!k,i.animatingY=!!R,Qs(i,"transform","translate3d("+k+"px,"+R+"px,0)"),this.forRepaintDummy=Kae(i),Qs(i,"transition","transform "+g+"ms"+(this.options.easing?" "+this.options.easing:"")),Qs(i,"transform","translate3d(0,0,0)"),typeof i.animated=="number"&&clearTimeout(i.animated),i.animated=setTimeout(function(){Qs(i,"transition",""),Qs(i,"transform",""),i.animated=!1,i.animatingX=!1,i.animatingY=!1},g)}}}}function Kae(l){return l.offsetWidth}function Zae(l,n,o,i){return Math.sqrt(Math.pow(n.top-l.top,2)+Math.pow(n.left-l.left,2))/Math.sqrt(Math.pow(n.top-o.top,2)+Math.pow(n.left-o.left,2))*i.animation}var eT=[],rU={initializeByDefault:!0},hR={mount:function(n){for(var o in rU)rU.hasOwnProperty(o)&&!(o in n)&&(n[o]=rU[o]);eT.forEach(function(i){if(i.pluginName===n.pluginName)throw"Sortable: Cannot mount plugin ".concat(n.pluginName," more than once")}),eT.push(n)},pluginEvent:function(n,o,i){var u=this;this.eventCanceled=!1,i.cancel=function(){u.eventCanceled=!0};var h=n+"Global";eT.forEach(function(g){o[g.pluginName]&&(o[g.pluginName][h]&&o[g.pluginName][h](w0({sortable:o},i)),o.options[g.pluginName]&&o[g.pluginName][n]&&o[g.pluginName][n](w0({sortable:o},i)))})},initializePlugins:function(n,o,i,u){eT.forEach(function(b){var S=b.pluginName;if(!(!n.options[S]&&!b.initializeByDefault)){var T=new b(n,o,n.options);T.sortable=n,T.options=n.options,n[S]=T,rv(i,T.defaults)}});for(var h in n.options)if(n.options.hasOwnProperty(h)){var g=this.modifyOption(n,h,n.options[h]);typeof g<"u"&&(n.options[h]=g)}},getEventProperties:function(n,o){var i={};return eT.forEach(function(u){typeof u.eventProperties=="function"&&rv(i,u.eventProperties.call(o[u.pluginName],n))}),i},modifyOption:function(n,o,i){var u;return eT.forEach(function(h){n[h.pluginName]&&h.optionListeners&&typeof h.optionListeners[o]=="function"&&(u=h.optionListeners[o].call(n[h.pluginName],i))}),u}};function qae(l){var n=l.sortable,o=l.rootEl,i=l.name,u=l.targetEl,h=l.cloneEl,g=l.toEl,b=l.fromEl,S=l.oldIndex,T=l.newIndex,k=l.oldDraggableIndex,R=l.newDraggableIndex,V=l.originalEvent,z=l.putSortable,$=l.extraEventProperties;if(n=n||o&&o[kh],!!n){var W,Q=n.options,j="on"+i.charAt(0).toUpperCase()+i.substr(1);window.CustomEvent&&!iv&&!fR?W=new CustomEvent(i,{bubbles:!0,cancelable:!0}):(W=document.createEvent("Event"),W.initEvent(i,!0,!0)),W.to=g||o,W.from=b||o,W.item=u||o,W.clone=h,W.oldIndex=S,W.newIndex=T,W.oldDraggableIndex=k,W.newDraggableIndex=R,W.originalEvent=V,W.pullMode=z?z.lastPutMode:void 0;var se=w0(w0({},$),hR.getEventProperties(i,n));for(var re in se)W[re]=se[re];o&&o.dispatchEvent(W),Q[j]&&Q[j].call(n,W)}}var Yae=["evt"],Ff=function(n,o){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},u=i.evt,h=Hae(i,Yae);hR.pluginEvent.bind(er)(n,o,w0({dragEl:Ao,parentEl:Zl,ghostEl:br,rootEl:yl,nextEl:Xw,lastDownEl:z4,cloneEl:Nl,cloneHidden:i1,dragStarted:FL,putSortable:Xu,activeSortable:er.active,originalEvent:u,oldIndex:gT,oldDraggableIndex:jL,newIndex:_h,newDraggableIndex:o1,hideGhostForTarget:RZ,unhideGhostForTarget:OZ,cloneNowHidden:function(){i1=!0},cloneNowShown:function(){i1=!1},dispatchSortableEvent:function(b){tf({sortable:o,name:b,originalEvent:u})}},h))};function tf(l){qae(w0({putSortable:Xu,cloneEl:Nl,targetEl:Ao,rootEl:yl,oldIndex:gT,oldDraggableIndex:jL,newIndex:_h,newDraggableIndex:o1},l))}var Ao,Zl,br,yl,Xw,z4,Nl,i1,gT,_h,jL,o1,m4,Xu,dT=!1,fB=!1,hB=[],Zw,Hp,iU,aU,oj,sj,FL,tT,KL,ZL=!1,p4=!1,G4,kd,lU=[],aV=!1,mB=[],$B=typeof document<"u",g4=yZ,rj=fR||iv?"cssFloat":"float",Xae=$B&&!wZ&&!yZ&&"draggable"in document.createElement("div"),kZ=function(){if($B){if(iv)return!1;var l=document.createElement("x");return l.style.cssText="pointer-events:auto",l.style.pointerEvents==="auto"}}(),AZ=function(n,o){var i=Qs(n),u=parseInt(i.width)-parseInt(i.paddingLeft)-parseInt(i.paddingRight)-parseInt(i.borderLeftWidth)-parseInt(i.borderRightWidth),h=DT(n,0,o),g=DT(n,1,o),b=h&&Qs(h),S=g&&Qs(g),T=b&&parseInt(b.marginLeft)+parseInt(b.marginRight)+Rc(h).width,k=S&&parseInt(S.marginLeft)+parseInt(S.marginRight)+Rc(g).width;if(i.display==="flex")return i.flexDirection==="column"||i.flexDirection==="column-reverse"?"vertical":"horizontal";if(i.display==="grid")return i.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(h&&b.float&&b.float!=="none"){var R=b.float==="left"?"left":"right";return g&&(S.clear==="both"||S.clear===R)?"vertical":"horizontal"}return h&&(b.display==="block"||b.display==="flex"||b.display==="table"||b.display==="grid"||T>=u&&i[rj]==="none"||g&&i[rj]==="none"&&T+k>u)?"vertical":"horizontal"},Jae=function(n,o,i){var u=i?n.left:n.top,h=i?n.right:n.bottom,g=i?n.width:n.height,b=i?o.left:o.top,S=i?o.right:o.bottom,T=i?o.width:o.height;return u===b||h===S||u+g/2===b+T/2},Qae=function(n,o){var i;return hB.some(function(u){var h=u[kh].options.emptyInsertThreshold;if(!(!h||XV(u))){var g=Rc(u),b=n>=g.left-h&&n<=g.right+h,S=o>=g.top-h&&o<=g.bottom+h;if(b&&S)return i=u}}),i},LZ=function(n){function o(h,g){return function(b,S,T,k){var R=b.options.group.name&&S.options.group.name&&b.options.group.name===S.options.group.name;if(h==null&&(g||R))return!0;if(h==null||h===!1)return!1;if(g&&h==="clone")return h;if(typeof h=="function")return o(h(b,S,T,k),g)(b,S,T,k);var V=(g?b:S).options.group.name;return h===!0||typeof h=="string"&&h===V||h.join&&h.indexOf(V)>-1}}var i={},u=n.group;(!u||V4(u)!="object")&&(u={name:u}),i.name=u.name,i.checkPull=o(u.pull,!0),i.checkPut=o(u.put),i.revertClone=u.revertClone,n.group=i},RZ=function(){!kZ&&br&&Qs(br,"display","none")},OZ=function(){!kZ&&br&&Qs(br,"display","")};$B&&!wZ&&document.addEventListener("click",function(l){if(fB)return l.preventDefault(),l.stopPropagation&&l.stopPropagation(),l.stopImmediatePropagation&&l.stopImmediatePropagation(),fB=!1,!1},!0);var qw=function(n){if(Ao){n=n.touches?n.touches[0]:n;var o=Qae(n.clientX,n.clientY);if(o){var i={};for(var u in n)n.hasOwnProperty(u)&&(i[u]=n[u]);i.target=i.rootEl=o,i.preventDefault=void 0,i.stopPropagation=void 0,o[kh]._onDragOver(i)}}},ele=function(n){Ao&&Ao.parentNode[kh]._isOutsideThisEl(n.target)};function er(l,n){if(!(l&&l.nodeType&&l.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(l));this.el=l,this.options=n=rv({},n),l[kh]=this;var o={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(l.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return AZ(l,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(g,b){g.setData("Text",b.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:er.supportPointer!==!1&&"PointerEvent"in window&&!GL,emptyInsertThreshold:5};hR.initializePlugins(this,l,o);for(var i in o)!(i in n)&&(n[i]=o[i]);LZ(n);for(var u in this)u.charAt(0)==="_"&&typeof this[u]=="function"&&(this[u]=this[u].bind(this));this.nativeDraggable=n.forceFallback?!1:Xae,this.nativeDraggable&&(this.options.touchStartThreshold=1),n.supportPointer?qi(l,"pointerdown",this._onTapStart):(qi(l,"mousedown",this._onTapStart),qi(l,"touchstart",this._onTapStart)),this.nativeDraggable&&(qi(l,"dragover",this),qi(l,"dragenter",this)),hB.push(this.el),n.store&&n.store.get&&this.sort(n.store.get(this)||[]),rv(this,jae())}er.prototype={constructor:er,_isOutsideThisEl:function(n){!this.el.contains(n)&&n!==this.el&&(tT=null)},_getDirection:function(n,o){return typeof this.options.direction=="function"?this.options.direction.call(this,n,o,Ao):this.options.direction},_onTapStart:function(n){if(n.cancelable){var o=this,i=this.el,u=this.options,h=u.preventOnFilter,g=n.type,b=n.touches&&n.touches[0]||n.pointerType&&n.pointerType==="touch"&&n,S=(b||n).target,T=n.target.shadowRoot&&(n.path&&n.path[0]||n.composedPath&&n.composedPath()[0])||S,k=u.filter;if(lle(i),!Ao&&!(/mousedown|pointerdown/.test(g)&&n.button!==0||u.disabled)&&!T.isContentEditable&&!(!this.nativeDraggable&&GL&&S&&S.tagName.toUpperCase()==="SELECT")&&(S=Gp(S,u.draggable,i,!1),!(S&&S.animated)&&z4!==S)){if(gT=Am(S),jL=Am(S,u.draggable),typeof k=="function"){if(k.call(this,n,S,this)){tf({sortable:o,rootEl:T,name:"filter",targetEl:S,toEl:i,fromEl:i}),Ff("filter",o,{evt:n}),h&&n.cancelable&&n.preventDefault();return}}else if(k&&(k=k.split(",").some(function(R){if(R=Gp(T,R.trim(),i,!1),R)return tf({sortable:o,rootEl:R,name:"filter",targetEl:S,fromEl:i,toEl:i}),Ff("filter",o,{evt:n}),!0}),k)){h&&n.cancelable&&n.preventDefault();return}u.handle&&!Gp(T,u.handle,i,!1)||this._prepareDragStart(n,b,S)}}},_prepareDragStart:function(n,o,i){var u=this,h=u.el,g=u.options,b=h.ownerDocument,S;if(i&&!Ao&&i.parentNode===h){var T=Rc(i);if(yl=h,Ao=i,Zl=Ao.parentNode,Xw=Ao.nextSibling,z4=i,m4=g.group,er.dragged=Ao,Zw={target:Ao,clientX:(o||n).clientX,clientY:(o||n).clientY},oj=Zw.clientX-T.left,sj=Zw.clientY-T.top,this._lastX=(o||n).clientX,this._lastY=(o||n).clientY,Ao.style["will-change"]="all",S=function(){if(Ff("delayEnded",u,{evt:n}),er.eventCanceled){u._onDrop();return}u._disableDelayedDragEvents(),!QW&&u.nativeDraggable&&(Ao.draggable=!0),u._triggerDragStart(n,o),tf({sortable:u,name:"choose",originalEvent:n}),Ch(Ao,g.chosenClass,!0)},g.ignore.split(",").forEach(function(k){EZ(Ao,k.trim(),cU)}),qi(b,"dragover",qw),qi(b,"mousemove",qw),qi(b,"touchmove",qw),qi(b,"mouseup",u._onDrop),qi(b,"touchend",u._onDrop),qi(b,"touchcancel",u._onDrop),QW&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Ao.draggable=!0),Ff("delayStart",this,{evt:n}),g.delay&&(!g.delayOnTouchOnly||o)&&(!this.nativeDraggable||!(fR||iv))){if(er.eventCanceled){this._onDrop();return}qi(b,"mouseup",u._disableDelayedDrag),qi(b,"touchend",u._disableDelayedDrag),qi(b,"touchcancel",u._disableDelayedDrag),qi(b,"mousemove",u._delayedDragTouchMoveHandler),qi(b,"touchmove",u._delayedDragTouchMoveHandler),g.supportPointer&&qi(b,"pointermove",u._delayedDragTouchMoveHandler),u._dragStartTimer=setTimeout(S,g.delay)}else S()}},_delayedDragTouchMoveHandler:function(n){var o=n.touches?n.touches[0]:n;Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Ao&&cU(Ao),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var n=this.el.ownerDocument;Li(n,"mouseup",this._disableDelayedDrag),Li(n,"touchend",this._disableDelayedDrag),Li(n,"touchcancel",this._disableDelayedDrag),Li(n,"mousemove",this._delayedDragTouchMoveHandler),Li(n,"touchmove",this._delayedDragTouchMoveHandler),Li(n,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(n,o){o=o||n.pointerType=="touch"&&n,!this.nativeDraggable||o?this.options.supportPointer?qi(document,"pointermove",this._onTouchMove):o?qi(document,"touchmove",this._onTouchMove):qi(document,"mousemove",this._onTouchMove):(qi(Ao,"dragend",this),qi(yl,"dragstart",this._onDragStart));try{document.selection?W4(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(n,o){if(dT=!1,yl&&Ao){Ff("dragStarted",this,{evt:o}),this.nativeDraggable&&qi(document,"dragover",ele);var i=this.options;!n&&Ch(Ao,i.dragClass,!1),Ch(Ao,i.ghostClass,!0),er.active=this,n&&this._appendGhost(),tf({sortable:this,name:"start",originalEvent:o})}else this._nulling()},_emulateDragOver:function(){if(Hp){this._lastX=Hp.clientX,this._lastY=Hp.clientY,RZ();for(var n=document.elementFromPoint(Hp.clientX,Hp.clientY),o=n;n&&n.shadowRoot&&(n=n.shadowRoot.elementFromPoint(Hp.clientX,Hp.clientY),n!==o);)o=n;if(Ao.parentNode[kh]._isOutsideThisEl(n),o)do{if(o[kh]){var i=void 0;if(i=o[kh]._onDragOver({clientX:Hp.clientX,clientY:Hp.clientY,target:n,rootEl:o}),i&&!this.options.dragoverBubble)break}n=o}while(o=o.parentNode);OZ()}},_onTouchMove:function(n){if(Zw){var o=this.options,i=o.fallbackTolerance,u=o.fallbackOffset,h=n.touches?n.touches[0]:n,g=br&&wT(br,!0),b=br&&g&&g.a,S=br&&g&&g.d,T=g4&&kd&&nj(kd),k=(h.clientX-Zw.clientX+u.x)/(b||1)+(T?T[0]-lU[0]:0)/(b||1),R=(h.clientY-Zw.clientY+u.y)/(S||1)+(T?T[1]-lU[1]:0)/(S||1);if(!er.active&&!dT){if(i&&Math.max(Math.abs(h.clientX-this._lastX),Math.abs(h.clientY-this._lastY))<i)return;this._onDragStart(n,!0)}if(br){g?(g.e+=k-(iU||0),g.f+=R-(aU||0)):g={a:1,b:0,c:0,d:1,e:k,f:R};var V="matrix(".concat(g.a,",").concat(g.b,",").concat(g.c,",").concat(g.d,",").concat(g.e,",").concat(g.f,")");Qs(br,"webkitTransform",V),Qs(br,"mozTransform",V),Qs(br,"msTransform",V),Qs(br,"transform",V),iU=k,aU=R,Hp=h}n.cancelable&&n.preventDefault()}},_appendGhost:function(){if(!br){var n=this.options.fallbackOnBody?document.body:yl,o=Rc(Ao,!0,g4,!0,n),i=this.options;if(g4){for(kd=n;Qs(kd,"position")==="static"&&Qs(kd,"transform")==="none"&&kd!==document;)kd=kd.parentNode;kd!==document.body&&kd!==document.documentElement?(kd===document&&(kd=v0()),o.top+=kd.scrollTop,o.left+=kd.scrollLeft):kd=v0(),lU=nj(kd)}br=Ao.cloneNode(!0),Ch(br,i.ghostClass,!1),Ch(br,i.fallbackClass,!0),Ch(br,i.dragClass,!0),Qs(br,"transition",""),Qs(br,"transform",""),Qs(br,"box-sizing","border-box"),Qs(br,"margin",0),Qs(br,"top",o.top),Qs(br,"left",o.left),Qs(br,"width",o.width),Qs(br,"height",o.height),Qs(br,"opacity","0.8"),Qs(br,"position",g4?"absolute":"fixed"),Qs(br,"zIndex","100000"),Qs(br,"pointerEvents","none"),er.ghost=br,n.appendChild(br),Qs(br,"transform-origin",oj/parseInt(br.style.width)*100+"% "+sj/parseInt(br.style.height)*100+"%")}},_onDragStart:function(n,o){var i=this,u=n.dataTransfer,h=i.options;if(Ff("dragStart",this,{evt:n}),er.eventCanceled){this._onDrop();return}Ff("setupClone",this),er.eventCanceled||(Nl=TZ(Ao),Nl.removeAttribute("id"),Nl.draggable=!1,Nl.style["will-change"]="",this._hideClone(),Ch(Nl,this.options.chosenClass,!1),er.clone=Nl),i.cloneId=W4(function(){Ff("clone",i),!er.eventCanceled&&(i.options.removeCloneOnHide||yl.insertBefore(Nl,Ao),i._hideClone(),tf({sortable:i,name:"clone"}))}),!o&&Ch(Ao,h.dragClass,!0),o?(fB=!0,i._loopId=setInterval(i._emulateDragOver,50)):(Li(document,"mouseup",i._onDrop),Li(document,"touchend",i._onDrop),Li(document,"touchcancel",i._onDrop),u&&(u.effectAllowed="move",h.setData&&h.setData.call(i,u,Ao)),qi(document,"drop",i),Qs(Ao,"transform","translateZ(0)")),dT=!0,i._dragStartId=W4(i._dragStarted.bind(i,o,n)),qi(document,"selectstart",i),FL=!0,GL&&Qs(document.body,"user-select","none")},_onDragOver:function(n){var o=this.el,i=n.target,u,h,g,b=this.options,S=b.group,T=er.active,k=m4===S,R=b.sort,V=Xu||T,z,$=this,W=!1;if(aV)return;function Q(et,Dt){Ff(et,$,w0({evt:n,isOwner:k,axis:z?"vertical":"horizontal",revert:g,dragRect:u,targetRect:h,canSort:R,fromSortable:V,target:i,completed:se,onMove:function(it,qe){return b4(yl,o,Ao,u,it,Rc(it),n,qe)},changed:re},Dt))}function j(){Q("dragOverAnimationCapture"),$.captureAnimationState(),$!==V&&V.captureAnimationState()}function se(et){return Q("dragOverCompleted",{insertion:et}),et&&(k?T._hideClone():T._showClone($),$!==V&&(Ch(Ao,Xu?Xu.options.ghostClass:T.options.ghostClass,!1),Ch(Ao,b.ghostClass,!0)),Xu!==$&&$!==er.active?Xu=$:$===er.active&&Xu&&(Xu=null),V===$&&($._ignoreWhileAnimating=i),$.animateAll(function(){Q("dragOverAnimationComplete"),$._ignoreWhileAnimating=null}),$!==V&&(V.animateAll(),V._ignoreWhileAnimating=null)),(i===Ao&&!Ao.animated||i===o&&!i.animated)&&(tT=null),!b.dragoverBubble&&!n.rootEl&&i!==document&&(Ao.parentNode[kh]._isOutsideThisEl(n.target),!et&&qw(n)),!b.dragoverBubble&&n.stopPropagation&&n.stopPropagation(),W=!0}function re(){_h=Am(Ao),o1=Am(Ao,b.draggable),tf({sortable:$,name:"change",toEl:o,newIndex:_h,newDraggableIndex:o1,originalEvent:n})}if(n.preventDefault!==void 0&&n.cancelable&&n.preventDefault(),i=Gp(i,b.draggable,o,!0),Q("dragOver"),er.eventCanceled)return W;if(Ao.contains(n.target)||i.animated&&i.animatingX&&i.animatingY||$._ignoreWhileAnimating===i)return se(!1);if(fB=!1,T&&!b.disabled&&(k?R||(g=Zl!==yl):Xu===this||(this.lastPutMode=m4.checkPull(this,T,Ao,n))&&S.checkPut(this,T,Ao,n))){if(z=this._getDirection(n,i)==="vertical",u=Rc(Ao),Q("dragOverValid"),er.eventCanceled)return W;if(g)return Zl=yl,j(),this._hideClone(),Q("revert"),er.eventCanceled||(Xw?yl.insertBefore(Ao,Xw):yl.appendChild(Ao)),se(!0);var Y=XV(o,b.draggable);if(!Y||sle(n,z,this)&&!Y.animated){if(Y===Ao)return se(!1);if(Y&&o===n.target&&(i=Y),i&&(h=Rc(i)),b4(yl,o,Ao,u,i,h,n,!!i)!==!1)return j(),Y&&Y.nextSibling?o.insertBefore(Ao,Y.nextSibling):o.appendChild(Ao),Zl=o,re(),se(!0)}else if(Y&&ole(n,z,this)){var me=DT(o,0,b,!0);if(me===Ao)return se(!1);if(i=me,h=Rc(i),b4(yl,o,Ao,u,i,h,n,!1)!==!1)return j(),o.insertBefore(Ao,me),Zl=o,re(),se(!0)}else if(i.parentNode===o){h=Rc(i);var ae=0,Ce,Ue=Ao.parentNode!==o,ot=!Jae(Ao.animated&&Ao.toRect||u,i.animated&&i.toRect||h,z),Ae=z?"top":"left",ve=tj(i,"top","top")||tj(Ao,"top","top"),Oe=ve?ve.scrollTop:void 0;tT!==i&&(Ce=h[Ae],ZL=!1,p4=!ot&&b.invertSwap||Ue),ae=rle(n,i,h,z,ot?1:b.swapThreshold,b.invertedSwapThreshold==null?b.swapThreshold:b.invertedSwapThreshold,p4,tT===i);var O;if(ae!==0){var De=Am(Ao);do De-=ae,O=Zl.children[De];while(O&&(Qs(O,"display")==="none"||O===br))}if(ae===0||O===i)return se(!1);tT=i,KL=ae;var Fe=i.nextElementSibling,st=!1;st=ae===1;var Ut=b4(yl,o,Ao,u,i,h,n,st);if(Ut!==!1)return(Ut===1||Ut===-1)&&(st=Ut===1),aV=!0,setTimeout(nle,30),j(),st&&!Fe?o.appendChild(Ao):i.parentNode.insertBefore(Ao,st?Fe:i),ve&&_Z(ve,0,Oe-ve.scrollTop),Zl=Ao.parentNode,Ce!==void 0&&!p4&&(G4=Math.abs(Ce-Rc(i)[Ae])),re(),se(!0)}if(o.contains(Ao))return se(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){Li(document,"mousemove",this._onTouchMove),Li(document,"touchmove",this._onTouchMove),Li(document,"pointermove",this._onTouchMove),Li(document,"dragover",qw),Li(document,"mousemove",qw),Li(document,"touchmove",qw)},_offUpEvents:function(){var n=this.el.ownerDocument;Li(n,"mouseup",this._onDrop),Li(n,"touchend",this._onDrop),Li(n,"pointerup",this._onDrop),Li(n,"touchcancel",this._onDrop),Li(document,"selectstart",this)},_onDrop:function(n){var o=this.el,i=this.options;if(_h=Am(Ao),o1=Am(Ao,i.draggable),Ff("drop",this,{evt:n}),Zl=Ao&&Ao.parentNode,_h=Am(Ao),o1=Am(Ao,i.draggable),er.eventCanceled){this._nulling();return}dT=!1,p4=!1,ZL=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),lV(this.cloneId),lV(this._dragStartId),this.nativeDraggable&&(Li(document,"drop",this),Li(o,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),GL&&Qs(document.body,"user-select",""),Qs(Ao,"transform",""),n&&(FL&&(n.cancelable&&n.preventDefault(),!i.dropBubble&&n.stopPropagation()),br&&br.parentNode&&br.parentNode.removeChild(br),(yl===Zl||Xu&&Xu.lastPutMode!=="clone")&&Nl&&Nl.parentNode&&Nl.parentNode.removeChild(Nl),Ao&&(this.nativeDraggable&&Li(Ao,"dragend",this),cU(Ao),Ao.style["will-change"]="",FL&&!dT&&Ch(Ao,Xu?Xu.options.ghostClass:this.options.ghostClass,!1),Ch(Ao,this.options.chosenClass,!1),tf({sortable:this,name:"unchoose",toEl:Zl,newIndex:null,newDraggableIndex:null,originalEvent:n}),yl!==Zl?(_h>=0&&(tf({rootEl:Zl,name:"add",toEl:Zl,fromEl:yl,originalEvent:n}),tf({sortable:this,name:"remove",toEl:Zl,originalEvent:n}),tf({rootEl:Zl,name:"sort",toEl:Zl,fromEl:yl,originalEvent:n}),tf({sortable:this,name:"sort",toEl:Zl,originalEvent:n})),Xu&&Xu.save()):_h!==gT&&_h>=0&&(tf({sortable:this,name:"update",toEl:Zl,originalEvent:n}),tf({sortable:this,name:"sort",toEl:Zl,originalEvent:n})),er.active&&((_h==null||_h===-1)&&(_h=gT,o1=jL),tf({sortable:this,name:"end",toEl:Zl,originalEvent:n}),this.save()))),this._nulling()},_nulling:function(){Ff("nulling",this),yl=Ao=Zl=br=Xw=Nl=z4=i1=Zw=Hp=FL=_h=o1=gT=jL=tT=KL=Xu=m4=er.dragged=er.ghost=er.clone=er.active=null,mB.forEach(function(n){n.checked=!0}),mB.length=iU=aU=0},handleEvent:function(n){switch(n.type){case"drop":case"dragend":this._onDrop(n);break;case"dragenter":case"dragover":Ao&&(this._onDragOver(n),tle(n));break;case"selectstart":n.preventDefault();break}},toArray:function(){for(var n=[],o,i=this.el.children,u=0,h=i.length,g=this.options;u<h;u++)o=i[u],Gp(o,g.draggable,this.el,!1)&&n.push(o.getAttribute(g.dataIdAttr)||ale(o));return n},sort:function(n,o){var i={},u=this.el;this.toArray().forEach(function(h,g){var b=u.children[g];Gp(b,this.options.draggable,u,!1)&&(i[h]=b)},this),o&&this.captureAnimationState(),n.forEach(function(h){i[h]&&(u.removeChild(i[h]),u.appendChild(i[h]))}),o&&this.animateAll()},save:function(){var n=this.options.store;n&&n.set&&n.set(this)},closest:function(n,o){return Gp(n,o||this.options.draggable,this.el,!1)},option:function(n,o){var i=this.options;if(o===void 0)return i[n];var u=hR.modifyOption(this,n,o);typeof u<"u"?i[n]=u:i[n]=o,n==="group"&&LZ(i)},destroy:function(){Ff("destroy",this);var n=this.el;n[kh]=null,Li(n,"mousedown",this._onTapStart),Li(n,"touchstart",this._onTapStart),Li(n,"pointerdown",this._onTapStart),this.nativeDraggable&&(Li(n,"dragover",this),Li(n,"dragenter",this)),Array.prototype.forEach.call(n.querySelectorAll("[draggable]"),function(o){o.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),hB.splice(hB.indexOf(this.el),1),this.el=n=null},_hideClone:function(){if(!i1){if(Ff("hideClone",this),er.eventCanceled)return;Qs(Nl,"display","none"),this.options.removeCloneOnHide&&Nl.parentNode&&Nl.parentNode.removeChild(Nl),i1=!0}},_showClone:function(n){if(n.lastPutMode!=="clone"){this._hideClone();return}if(i1){if(Ff("showClone",this),er.eventCanceled)return;Ao.parentNode==yl&&!this.options.group.revertClone?yl.insertBefore(Nl,Ao):Xw?yl.insertBefore(Nl,Xw):yl.appendChild(Nl),this.options.group.revertClone&&this.animate(Ao,Nl),Qs(Nl,"display",""),i1=!1}}};function tle(l){l.dataTransfer&&(l.dataTransfer.dropEffect="move"),l.cancelable&&l.preventDefault()}function b4(l,n,o,i,u,h,g,b){var S,T=l[kh],k=T.options.onMove,R;return window.CustomEvent&&!iv&&!fR?S=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(S=document.createEvent("Event"),S.initEvent("move",!0,!0)),S.to=n,S.from=l,S.dragged=o,S.draggedRect=i,S.related=u||n,S.relatedRect=h||Rc(n),S.willInsertAfter=b,S.originalEvent=g,l.dispatchEvent(S),k&&(R=k.call(T,S,g)),R}function cU(l){l.draggable=!1}function nle(){aV=!1}function ole(l,n,o){var i=Rc(DT(o.el,0,o.options,!0)),u=DZ(o.el,o.options,br),h=10;return n?l.clientX<u.left-h||l.clientY<i.top&&l.clientX<i.right:l.clientY<u.top-h||l.clientY<i.bottom&&l.clientX<i.left}function sle(l,n,o){var i=Rc(XV(o.el,o.options.draggable)),u=DZ(o.el,o.options,br),h=10;return n?l.clientX>u.right+h||l.clientY>i.bottom&&l.clientX>i.left:l.clientY>u.bottom+h||l.clientX>i.right&&l.clientY>i.top}function rle(l,n,o,i,u,h,g,b){var S=i?l.clientY:l.clientX,T=i?o.height:o.width,k=i?o.top:o.left,R=i?o.bottom:o.right,V=!1;if(!g){if(b&&G4<T*u){if(!ZL&&(KL===1?S>k+T*h/2:S<R-T*h/2)&&(ZL=!0),ZL)V=!0;else if(KL===1?S<k+G4:S>R-G4)return-KL}else if(S>k+T*(1-u)/2&&S<R-T*(1-u)/2)return ile(n)}return V=V||g,V&&(S<k+T*h/2||S>R-T*h/2)?S>k+T/2?1:-1:0}function ile(l){return Am(Ao)<Am(l)?1:-1}function ale(l){for(var n=l.tagName+l.className+l.src+l.href+l.textContent,o=n.length,i=0;o--;)i+=n.charCodeAt(o);return i.toString(36)}function lle(l){mB.length=0;for(var n=l.getElementsByTagName("input"),o=n.length;o--;){var i=n[o];i.checked&&mB.push(i)}}function W4(l){return setTimeout(l,0)}function lV(l){return clearTimeout(l)}$B&&qi(document,"touchmove",function(l){(er.active||dT)&&l.cancelable&&l.preventDefault()});er.utils={on:qi,off:Li,css:Qs,find:EZ,is:function(n,o){return!!Gp(n,o,n,!1)},extend:Gae,throttle:CZ,closest:Gp,toggleClass:Ch,clone:TZ,index:Am,nextTick:W4,cancelNextTick:lV,detectDirection:AZ,getChild:DT};er.get=function(l){return l[kh]};er.mount=function(){for(var l=arguments.length,n=new Array(l),o=0;o<l;o++)n[o]=arguments[o];n[0].constructor===Array&&(n=n[0]),n.forEach(function(i){if(!i.prototype||!i.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(i));i.utils&&(er.utils=w0(w0({},er.utils),i.utils)),hR.mount(i)})};er.create=function(l,n){return new er(l,n)};er.version=Uae;var Ac=[],BL,cV,uV=!1,uU,dU,pB,$L;function cle(){function l(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var n in this)n.charAt(0)==="_"&&typeof this[n]=="function"&&(this[n]=this[n].bind(this))}return l.prototype={dragStarted:function(o){var i=o.originalEvent;this.sortable.nativeDraggable?qi(document,"dragover",this._handleAutoScroll):this.options.supportPointer?qi(document,"pointermove",this._handleFallbackAutoScroll):i.touches?qi(document,"touchmove",this._handleFallbackAutoScroll):qi(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(o){var i=o.originalEvent;!this.options.dragOverBubble&&!i.rootEl&&this._handleAutoScroll(i)},drop:function(){this.sortable.nativeDraggable?Li(document,"dragover",this._handleAutoScroll):(Li(document,"pointermove",this._handleFallbackAutoScroll),Li(document,"touchmove",this._handleFallbackAutoScroll),Li(document,"mousemove",this._handleFallbackAutoScroll)),ij(),j4(),Wae()},nulling:function(){pB=cV=BL=uV=$L=uU=dU=null,Ac.length=0},_handleFallbackAutoScroll:function(o){this._handleAutoScroll(o,!0)},_handleAutoScroll:function(o,i){var u=this,h=(o.touches?o.touches[0]:o).clientX,g=(o.touches?o.touches[0]:o).clientY,b=document.elementFromPoint(h,g);if(pB=o,i||this.options.forceAutoScrollFallback||fR||iv||GL){fU(o,this.options,b,i);var S=l1(b,!0);uV&&(!$L||h!==uU||g!==dU)&&($L&&ij(),$L=setInterval(function(){var T=l1(document.elementFromPoint(h,g),!0);T!==S&&(S=T,j4()),fU(o,u.options,T,i)},10),uU=h,dU=g)}else{if(!this.options.bubbleScroll||l1(b,!0)===v0()){j4();return}fU(o,this.options,l1(b,!1),!1)}}},rv(l,{pluginName:"scroll",initializeByDefault:!0})}function j4(){Ac.forEach(function(l){clearInterval(l.pid)}),Ac=[]}function ij(){clearInterval($L)}var fU=CZ(function(l,n,o,i){if(n.scroll){var u=(l.touches?l.touches[0]:l).clientX,h=(l.touches?l.touches[0]:l).clientY,g=n.scrollSensitivity,b=n.scrollSpeed,S=v0(),T=!1,k;cV!==o&&(cV=o,j4(),BL=n.scroll,k=n.scrollFn,BL===!0&&(BL=l1(o,!0)));var R=0,V=BL;do{var z=V,$=Rc(z),W=$.top,Q=$.bottom,j=$.left,se=$.right,re=$.width,Y=$.height,me=void 0,ae=void 0,Ce=z.scrollWidth,Ue=z.scrollHeight,ot=Qs(z),Ae=z.scrollLeft,ve=z.scrollTop;z===S?(me=re<Ce&&(ot.overflowX==="auto"||ot.overflowX==="scroll"||ot.overflowX==="visible"),ae=Y<Ue&&(ot.overflowY==="auto"||ot.overflowY==="scroll"||ot.overflowY==="visible")):(me=re<Ce&&(ot.overflowX==="auto"||ot.overflowX==="scroll"),ae=Y<Ue&&(ot.overflowY==="auto"||ot.overflowY==="scroll"));var Oe=me&&(Math.abs(se-u)<=g&&Ae+re<Ce)-(Math.abs(j-u)<=g&&!!Ae),O=ae&&(Math.abs(Q-h)<=g&&ve+Y<Ue)-(Math.abs(W-h)<=g&&!!ve);if(!Ac[R])for(var De=0;De<=R;De++)Ac[De]||(Ac[De]={});(Ac[R].vx!=Oe||Ac[R].vy!=O||Ac[R].el!==z)&&(Ac[R].el=z,Ac[R].vx=Oe,Ac[R].vy=O,clearInterval(Ac[R].pid),(Oe!=0||O!=0)&&(T=!0,Ac[R].pid=setInterval((function(){i&&this.layer===0&&er.active._onTouchMove(pB);var Fe=Ac[this.layer].vy?Ac[this.layer].vy*b:0,st=Ac[this.layer].vx?Ac[this.layer].vx*b:0;typeof k=="function"&&k.call(er.dragged.parentNode[kh],st,Fe,l,pB,Ac[this.layer].el)!=="continue"||_Z(Ac[this.layer].el,st,Fe)}).bind({layer:R}),24))),R++}while(n.bubbleScroll&&V!==S&&(V=l1(V,!1)));uV=T}},30),IZ=function(n){var o=n.originalEvent,i=n.putSortable,u=n.dragEl,h=n.activeSortable,g=n.dispatchSortableEvent,b=n.hideGhostForTarget,S=n.unhideGhostForTarget;if(o){var T=i||h;b();var k=o.changedTouches&&o.changedTouches.length?o.changedTouches[0]:o,R=document.elementFromPoint(k.clientX,k.clientY);S(),T&&!T.el.contains(R)&&(g("spill"),this.onSpill({dragEl:u,putSortable:i}))}};function JV(){}JV.prototype={startIndex:null,dragStart:function(n){var o=n.oldDraggableIndex;this.startIndex=o},onSpill:function(n){var o=n.dragEl,i=n.putSortable;this.sortable.captureAnimationState(),i&&i.captureAnimationState();var u=DT(this.sortable.el,this.startIndex,this.options);u?this.sortable.el.insertBefore(o,u):this.sortable.el.appendChild(o),this.sortable.animateAll(),i&&i.animateAll()},drop:IZ};rv(JV,{pluginName:"revertOnSpill"});function QV(){}QV.prototype={onSpill:function(n){var o=n.dragEl,i=n.putSortable,u=i||this.sortable;u.captureAnimationState(),o.parentNode&&o.parentNode.removeChild(o),u.animateAll()},drop:IZ};rv(QV,{pluginName:"removeOnSpill"});er.mount(new cle);er.mount(QV,JV);var ule=er;function dle(l){l.directive("sort",(n,{value:o,modifiers:i,expression:u},{effect:h,evaluate:g,evaluateLater:b,cleanup:S})=>{if(o==="config"||o==="handle"||o==="group")return;if(o==="key"||o==="item"){if([void 0,null,""].includes(u))return;n._x_sort_key=g(u);return}let T={hideGhost:!i.includes("ghost"),useHandles:!!n.querySelector("[x-sort\\:handle]"),group:gle(n,i)},k=fle(u,b),R=hle(n,i,g),V=mle(n,R,T,(z,$)=>{k(z,$)});S(()=>V.destroy())})}function fle(l,n){if([void 0,null,""].includes(l))return()=>{};let o=n(l);return(i,u)=>{Alpine.dontAutoEvaluateFunctions(()=>{o(h=>{typeof h=="function"&&h(i,u)},{scope:{$key:i,$item:i,$position:u}})})}}function hle(l,n,o){return l.hasAttribute("x-sort:config")?o(l.getAttribute("x-sort:config")):{}}function mle(l,n,o,i){let u,h={animation:150,handle:o.useHandles?"[x-sort\\:handle]":null,group:o.group,filter(g){return l.querySelector("[x-sort\\:item]")?!g.target.closest("[x-sort\\:item]"):!1},onSort(g){if(g.from!==g.to&&g.to!==g.target)return;let b=g.item._x_sort_key,S=g.newIndex;(b!==void 0||b!==null)&&i(b,S)},onStart(){document.body.classList.add("sorting"),u=document.querySelector(".sortable-ghost"),o.hideGhost&&u&&(u.style.opacity="0")},onEnd(){document.body.classList.remove("sorting"),o.hideGhost&&u&&(u.style.opacity="1"),u=void 0,ple(l)}};return new ule(l,{...h,...n})}function ple(l){let n=l.firstChild;for(;n.nextSibling;){if(n.textContent.trim()==="[if ENDBLOCK]><![endif]"){l.append(n);break}n=n.nextSibling}}function gle(l,n){return l.hasAttribute("x-sort:group")?l.getAttribute("x-sort:group"):n.indexOf("group")!==-1?n[n.indexOf("group")+1]:null}var ble=dle;/*! Bundled license information:

sortablejs/modular/sortable.esm.js:
  (**!
   * Sortable 1.15.2
   * @author	RubaXa   <trash@rubaxa.org>
   * @author	owenm    <owen23355@gmail.com>
   * @license MIT
   *)
*/function aj(l){return l!==null&&typeof l=="object"&&"constructor"in l&&l.constructor===Object}function ez(l,n){l===void 0&&(l={}),n===void 0&&(n={}),Object.keys(n).forEach(o=>{typeof l[o]>"u"?l[o]=n[o]:aj(n[o])&&aj(l[o])&&Object.keys(n[o]).length>0&&ez(l[o],n[o])})}const PZ={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector(){return null},querySelectorAll(){return[]},getElementById(){return null},createEvent(){return{initEvent(){}}},createElement(){return{children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName(){return[]}}},createElementNS(){return{}},importNode(){return null},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function IT(){const l=typeof document<"u"?document:{};return ez(l,PZ),l}const vle={document:PZ,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle(){return{getPropertyValue(){return""}}},Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia(){return{}},requestAnimationFrame(l){return typeof setTimeout>"u"?(l(),null):setTimeout(l,0)},cancelAnimationFrame(l){typeof setTimeout>"u"||clearTimeout(l)}};function Lh(){const l=typeof window<"u"?window:{};return ez(l,vle),l}function xle(l){return l===void 0&&(l=""),l.trim().split(" ").filter(n=>!!n.trim())}function yle(l){const n=l;Object.keys(n).forEach(o=>{try{n[o]=null}catch{}try{delete n[o]}catch{}})}function dV(l,n){return n===void 0&&(n=0),setTimeout(l,n)}function gB(){return Date.now()}function wle(l){const n=Lh();let o;return n.getComputedStyle&&(o=n.getComputedStyle(l,null)),!o&&l.currentStyle&&(o=l.currentStyle),o||(o=l.style),o}function Sle(l,n){n===void 0&&(n="x");const o=Lh();let i,u,h;const g=wle(l);return o.WebKitCSSMatrix?(u=g.transform||g.webkitTransform,u.split(",").length>6&&(u=u.split(", ").map(b=>b.replace(",",".")).join(", ")),h=new o.WebKitCSSMatrix(u==="none"?"":u)):(h=g.MozTransform||g.OTransform||g.MsTransform||g.msTransform||g.transform||g.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),i=h.toString().split(",")),n==="x"&&(o.WebKitCSSMatrix?u=h.m41:i.length===16?u=parseFloat(i[12]):u=parseFloat(i[4])),n==="y"&&(o.WebKitCSSMatrix?u=h.m42:i.length===16?u=parseFloat(i[13]):u=parseFloat(i[5])),u||0}function v4(l){return typeof l=="object"&&l!==null&&l.constructor&&Object.prototype.toString.call(l).slice(8,-1)==="Object"}function Ele(l){return typeof window<"u"&&typeof window.HTMLElement<"u"?l instanceof HTMLElement:l&&(l.nodeType===1||l.nodeType===11)}function Dh(){const l=Object(arguments.length<=0?void 0:arguments[0]),n=["__proto__","constructor","prototype"];for(let o=1;o<arguments.length;o+=1){const i=o<0||arguments.length<=o?void 0:arguments[o];if(i!=null&&!Ele(i)){const u=Object.keys(Object(i)).filter(h=>n.indexOf(h)<0);for(let h=0,g=u.length;h<g;h+=1){const b=u[h],S=Object.getOwnPropertyDescriptor(i,b);S!==void 0&&S.enumerable&&(v4(l[b])&&v4(i[b])?i[b].__swiper__?l[b]=i[b]:Dh(l[b],i[b]):!v4(l[b])&&v4(i[b])?(l[b]={},i[b].__swiper__?l[b]=i[b]:Dh(l[b],i[b])):l[b]=i[b])}}}return l}function x4(l,n,o){l.style.setProperty(n,o)}function MZ(l){let{swiper:n,targetPosition:o,side:i}=l;const u=Lh(),h=-n.translate;let g=null,b;const S=n.params.speed;n.wrapperEl.style.scrollSnapType="none",u.cancelAnimationFrame(n.cssModeFrameID);const T=o>h?"next":"prev",k=(V,z)=>T==="next"&&V>=z||T==="prev"&&V<=z,R=()=>{b=new Date().getTime(),g===null&&(g=b);const V=Math.max(Math.min((b-g)/S,1),0),z=.5-Math.cos(V*Math.PI)/2;let $=h+z*(o-h);if(k($,o)&&($=o),n.wrapperEl.scrollTo({[i]:$}),k($,o)){n.wrapperEl.style.overflow="hidden",n.wrapperEl.style.scrollSnapType="",setTimeout(()=>{n.wrapperEl.style.overflow="",n.wrapperEl.scrollTo({[i]:$})}),u.cancelAnimationFrame(n.cssModeFrameID);return}n.cssModeFrameID=u.requestAnimationFrame(R)};R()}function p0(l,n){return n===void 0&&(n=""),[...l.children].filter(o=>o.matches(n))}function bB(l){try{console.warn(l);return}catch{}}function vB(l,n){n===void 0&&(n=[]);const o=document.createElement(l);return o.classList.add(...Array.isArray(n)?n:xle(n)),o}function Cle(l,n){const o=[];for(;l.previousElementSibling;){const i=l.previousElementSibling;n?i.matches(n)&&o.push(i):o.push(i),l=i}return o}function _le(l,n){const o=[];for(;l.nextElementSibling;){const i=l.nextElementSibling;n?i.matches(n)&&o.push(i):o.push(i),l=i}return o}function c1(l,n){return Lh().getComputedStyle(l,null).getPropertyValue(n)}function xB(l){let n=l,o;if(n){for(o=0;(n=n.previousSibling)!==null;)n.nodeType===1&&(o+=1);return o}}function NZ(l,n){const o=[];let i=l.parentElement;for(;i;)n?i.matches(n)&&o.push(i):o.push(i),i=i.parentElement;return o}function fV(l,n,o){const i=Lh();return o?l[n==="width"?"offsetWidth":"offsetHeight"]+parseFloat(i.getComputedStyle(l,null).getPropertyValue(n==="width"?"margin-right":"margin-top"))+parseFloat(i.getComputedStyle(l,null).getPropertyValue(n==="width"?"margin-left":"margin-bottom")):l.offsetWidth}function wu(l){return(Array.isArray(l)?l:[l]).filter(n=>!!n)}let hU;function Tle(){const l=Lh(),n=IT();return{smoothScroll:n.documentElement&&n.documentElement.style&&"scrollBehavior"in n.documentElement.style,touch:!!("ontouchstart"in l||l.DocumentTouch&&n instanceof l.DocumentTouch)}}function FZ(){return hU||(hU=Tle()),hU}let mU;function Dle(l){let{userAgent:n}=l===void 0?{}:l;const o=FZ(),i=Lh(),u=i.navigator.platform,h=n||i.navigator.userAgent,g={ios:!1,android:!1},b=i.screen.width,S=i.screen.height,T=h.match(/(Android);?[\s\/]+([\d.]+)?/);let k=h.match(/(iPad).*OS\s([\d_]+)/);const R=h.match(/(iPod)(.*OS\s([\d_]+))?/),V=!k&&h.match(/(iPhone\sOS|iOS)\s([\d_]+)/),z=u==="Win32";let $=u==="MacIntel";const W=["1024x1366","1366x1024","834x1194","1194x834","834x1112","1112x834","768x1024","1024x768","820x1180","1180x820","810x1080","1080x810"];return!k&&$&&o.touch&&W.indexOf(`${b}x${S}`)>=0&&(k=h.match(/(Version)\/([\d.]+)/),k||(k=[0,1,"13_0_0"]),$=!1),T&&!z&&(g.os="android",g.android=!0),(k||V||R)&&(g.os="ios",g.ios=!0),g}function BZ(l){return l===void 0&&(l={}),mU||(mU=Dle(l)),mU}let pU;function kle(){const l=Lh(),n=BZ();let o=!1;function i(){const b=l.navigator.userAgent.toLowerCase();return b.indexOf("safari")>=0&&b.indexOf("chrome")<0&&b.indexOf("android")<0}if(i()){const b=String(l.navigator.userAgent);if(b.includes("Version/")){const[S,T]=b.split("Version/")[1].split(" ")[0].split(".").map(k=>Number(k));o=S<16||S===16&&T<2}}const u=/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(l.navigator.userAgent),h=i(),g=h||u&&n.ios;return{isSafari:o||h,needPerspectiveFix:o,need3dFix:g,isWebView:u}}function Ale(){return pU||(pU=kle()),pU}function Lle(l){let{swiper:n,on:o,emit:i}=l;const u=Lh();let h=null,g=null;const b=()=>{!n||n.destroyed||!n.initialized||(i("beforeResize"),i("resize"))},S=()=>{!n||n.destroyed||!n.initialized||(h=new ResizeObserver(R=>{g=u.requestAnimationFrame(()=>{const{width:V,height:z}=n;let $=V,W=z;R.forEach(Q=>{let{contentBoxSize:j,contentRect:se,target:re}=Q;re&&re!==n.el||($=se?se.width:(j[0]||j).inlineSize,W=se?se.height:(j[0]||j).blockSize)}),($!==V||W!==z)&&b()})}),h.observe(n.el))},T=()=>{g&&u.cancelAnimationFrame(g),h&&h.unobserve&&n.el&&(h.unobserve(n.el),h=null)},k=()=>{!n||n.destroyed||!n.initialized||i("orientationchange")};o("init",()=>{if(n.params.resizeObserver&&typeof u.ResizeObserver<"u"){S();return}u.addEventListener("resize",b),u.addEventListener("orientationchange",k)}),o("destroy",()=>{T(),u.removeEventListener("resize",b),u.removeEventListener("orientationchange",k)})}function Rle(l){let{swiper:n,extendParams:o,on:i,emit:u}=l;const h=[],g=Lh(),b=function(k,R){R===void 0&&(R={});const V=g.MutationObserver||g.WebkitMutationObserver,z=new V($=>{if(n.__preventObserver__)return;if($.length===1){u("observerUpdate",$[0]);return}const W=function(){u("observerUpdate",$[0])};g.requestAnimationFrame?g.requestAnimationFrame(W):g.setTimeout(W,0)});z.observe(k,{attributes:typeof R.attributes>"u"?!0:R.attributes,childList:typeof R.childList>"u"?!0:R.childList,characterData:typeof R.characterData>"u"?!0:R.characterData}),h.push(z)},S=()=>{if(n.params.observer){if(n.params.observeParents){const k=NZ(n.hostEl);for(let R=0;R<k.length;R+=1)b(k[R])}b(n.hostEl,{childList:n.params.observeSlideChildren}),b(n.wrapperEl,{attributes:!1})}},T=()=>{h.forEach(k=>{k.disconnect()}),h.splice(0,h.length)};o({observer:!1,observeParents:!1,observeSlideChildren:!1}),i("init",S),i("destroy",T)}var Ole={on(l,n,o){const i=this;if(!i.eventsListeners||i.destroyed||typeof n!="function")return i;const u=o?"unshift":"push";return l.split(" ").forEach(h=>{i.eventsListeners[h]||(i.eventsListeners[h]=[]),i.eventsListeners[h][u](n)}),i},once(l,n,o){const i=this;if(!i.eventsListeners||i.destroyed||typeof n!="function")return i;function u(){i.off(l,u),u.__emitterProxy&&delete u.__emitterProxy;for(var h=arguments.length,g=new Array(h),b=0;b<h;b++)g[b]=arguments[b];n.apply(i,g)}return u.__emitterProxy=n,i.on(l,u,o)},onAny(l,n){const o=this;if(!o.eventsListeners||o.destroyed||typeof l!="function")return o;const i=n?"unshift":"push";return o.eventsAnyListeners.indexOf(l)<0&&o.eventsAnyListeners[i](l),o},offAny(l){const n=this;if(!n.eventsListeners||n.destroyed||!n.eventsAnyListeners)return n;const o=n.eventsAnyListeners.indexOf(l);return o>=0&&n.eventsAnyListeners.splice(o,1),n},off(l,n){const o=this;return!o.eventsListeners||o.destroyed||!o.eventsListeners||l.split(" ").forEach(i=>{typeof n>"u"?o.eventsListeners[i]=[]:o.eventsListeners[i]&&o.eventsListeners[i].forEach((u,h)=>{(u===n||u.__emitterProxy&&u.__emitterProxy===n)&&o.eventsListeners[i].splice(h,1)})}),o},emit(){const l=this;if(!l.eventsListeners||l.destroyed||!l.eventsListeners)return l;let n,o,i;for(var u=arguments.length,h=new Array(u),g=0;g<u;g++)h[g]=arguments[g];return typeof h[0]=="string"||Array.isArray(h[0])?(n=h[0],o=h.slice(1,h.length),i=l):(n=h[0].events,o=h[0].data,i=h[0].context||l),o.unshift(i),(Array.isArray(n)?n:n.split(" ")).forEach(S=>{l.eventsAnyListeners&&l.eventsAnyListeners.length&&l.eventsAnyListeners.forEach(T=>{T.apply(i,[S,...o])}),l.eventsListeners&&l.eventsListeners[S]&&l.eventsListeners[S].forEach(T=>{T.apply(i,o)})}),l}};function Ile(){const l=this;let n,o;const i=l.el;typeof l.params.width<"u"&&l.params.width!==null?n=l.params.width:n=i.clientWidth,typeof l.params.height<"u"&&l.params.height!==null?o=l.params.height:o=i.clientHeight,!(n===0&&l.isHorizontal()||o===0&&l.isVertical())&&(n=n-parseInt(c1(i,"padding-left")||0,10)-parseInt(c1(i,"padding-right")||0,10),o=o-parseInt(c1(i,"padding-top")||0,10)-parseInt(c1(i,"padding-bottom")||0,10),Number.isNaN(n)&&(n=0),Number.isNaN(o)&&(o=0),Object.assign(l,{width:n,height:o,size:l.isHorizontal()?n:o}))}function Ple(){const l=this;function n(Ae,ve){return parseFloat(Ae.getPropertyValue(l.getDirectionLabel(ve))||0)}const o=l.params,{wrapperEl:i,slidesEl:u,size:h,rtlTranslate:g,wrongRTL:b}=l,S=l.virtual&&o.virtual.enabled,T=S?l.virtual.slides.length:l.slides.length,k=p0(u,`.${l.params.slideClass}, swiper-slide`),R=S?l.virtual.slides.length:k.length;let V=[];const z=[],$=[];let W=o.slidesOffsetBefore;typeof W=="function"&&(W=o.slidesOffsetBefore.call(l));let Q=o.slidesOffsetAfter;typeof Q=="function"&&(Q=o.slidesOffsetAfter.call(l));const j=l.snapGrid.length,se=l.slidesGrid.length;let re=o.spaceBetween,Y=-W,me=0,ae=0;if(typeof h>"u")return;typeof re=="string"&&re.indexOf("%")>=0?re=parseFloat(re.replace("%",""))/100*h:typeof re=="string"&&(re=parseFloat(re)),l.virtualSize=-re,k.forEach(Ae=>{g?Ae.style.marginLeft="":Ae.style.marginRight="",Ae.style.marginBottom="",Ae.style.marginTop=""}),o.centeredSlides&&o.cssMode&&(x4(i,"--swiper-centered-offset-before",""),x4(i,"--swiper-centered-offset-after",""));const Ce=o.grid&&o.grid.rows>1&&l.grid;Ce?l.grid.initSlides(k):l.grid&&l.grid.unsetSlides();let Ue;const ot=o.slidesPerView==="auto"&&o.breakpoints&&Object.keys(o.breakpoints).filter(Ae=>typeof o.breakpoints[Ae].slidesPerView<"u").length>0;for(let Ae=0;Ae<R;Ae+=1){Ue=0;let ve;if(k[Ae]&&(ve=k[Ae]),Ce&&l.grid.updateSlide(Ae,ve,k),!(k[Ae]&&c1(ve,"display")==="none")){if(o.slidesPerView==="auto"){ot&&(k[Ae].style[l.getDirectionLabel("width")]="");const Oe=getComputedStyle(ve),O=ve.style.transform,De=ve.style.webkitTransform;if(O&&(ve.style.transform="none"),De&&(ve.style.webkitTransform="none"),o.roundLengths)Ue=l.isHorizontal()?fV(ve,"width",!0):fV(ve,"height",!0);else{const Fe=n(Oe,"width"),st=n(Oe,"padding-left"),Ut=n(Oe,"padding-right"),et=n(Oe,"margin-left"),Dt=n(Oe,"margin-right"),Xe=Oe.getPropertyValue("box-sizing");if(Xe&&Xe==="border-box")Ue=Fe+et+Dt;else{const{clientWidth:it,offsetWidth:qe}=ve;Ue=Fe+st+Ut+et+Dt+(qe-it)}}O&&(ve.style.transform=O),De&&(ve.style.webkitTransform=De),o.roundLengths&&(Ue=Math.floor(Ue))}else Ue=(h-(o.slidesPerView-1)*re)/o.slidesPerView,o.roundLengths&&(Ue=Math.floor(Ue)),k[Ae]&&(k[Ae].style[l.getDirectionLabel("width")]=`${Ue}px`);k[Ae]&&(k[Ae].swiperSlideSize=Ue),$.push(Ue),o.centeredSlides?(Y=Y+Ue/2+me/2+re,me===0&&Ae!==0&&(Y=Y-h/2-re),Ae===0&&(Y=Y-h/2-re),Math.abs(Y)<1/1e3&&(Y=0),o.roundLengths&&(Y=Math.floor(Y)),ae%o.slidesPerGroup===0&&V.push(Y),z.push(Y)):(o.roundLengths&&(Y=Math.floor(Y)),(ae-Math.min(l.params.slidesPerGroupSkip,ae))%l.params.slidesPerGroup===0&&V.push(Y),z.push(Y),Y=Y+Ue+re),l.virtualSize+=Ue+re,me=Ue,ae+=1}}if(l.virtualSize=Math.max(l.virtualSize,h)+Q,g&&b&&(o.effect==="slide"||o.effect==="coverflow")&&(i.style.width=`${l.virtualSize+re}px`),o.setWrapperSize&&(i.style[l.getDirectionLabel("width")]=`${l.virtualSize+re}px`),Ce&&l.grid.updateWrapperSize(Ue,V),!o.centeredSlides){const Ae=[];for(let ve=0;ve<V.length;ve+=1){let Oe=V[ve];o.roundLengths&&(Oe=Math.floor(Oe)),V[ve]<=l.virtualSize-h&&Ae.push(Oe)}V=Ae,Math.floor(l.virtualSize-h)-Math.floor(V[V.length-1])>1&&V.push(l.virtualSize-h)}if(S&&o.loop){const Ae=$[0]+re;if(o.slidesPerGroup>1){const ve=Math.ceil((l.virtual.slidesBefore+l.virtual.slidesAfter)/o.slidesPerGroup),Oe=Ae*o.slidesPerGroup;for(let O=0;O<ve;O+=1)V.push(V[V.length-1]+Oe)}for(let ve=0;ve<l.virtual.slidesBefore+l.virtual.slidesAfter;ve+=1)o.slidesPerGroup===1&&V.push(V[V.length-1]+Ae),z.push(z[z.length-1]+Ae),l.virtualSize+=Ae}if(V.length===0&&(V=[0]),re!==0){const Ae=l.isHorizontal()&&g?"marginLeft":l.getDirectionLabel("marginRight");k.filter((ve,Oe)=>!o.cssMode||o.loop?!0:Oe!==k.length-1).forEach(ve=>{ve.style[Ae]=`${re}px`})}if(o.centeredSlides&&o.centeredSlidesBounds){let Ae=0;$.forEach(Oe=>{Ae+=Oe+(re||0)}),Ae-=re;const ve=Ae-h;V=V.map(Oe=>Oe<=0?-W:Oe>ve?ve+Q:Oe)}if(o.centerInsufficientSlides){let Ae=0;$.forEach(Oe=>{Ae+=Oe+(re||0)}),Ae-=re;const ve=(o.slidesOffsetBefore||0)+(o.slidesOffsetAfter||0);if(Ae+ve<h){const Oe=(h-Ae-ve)/2;V.forEach((O,De)=>{V[De]=O-Oe}),z.forEach((O,De)=>{z[De]=O+Oe})}}if(Object.assign(l,{slides:k,snapGrid:V,slidesGrid:z,slidesSizesGrid:$}),o.centeredSlides&&o.cssMode&&!o.centeredSlidesBounds){x4(i,"--swiper-centered-offset-before",`${-V[0]}px`),x4(i,"--swiper-centered-offset-after",`${l.size/2-$[$.length-1]/2}px`);const Ae=-l.snapGrid[0],ve=-l.slidesGrid[0];l.snapGrid=l.snapGrid.map(Oe=>Oe+Ae),l.slidesGrid=l.slidesGrid.map(Oe=>Oe+ve)}if(R!==T&&l.emit("slidesLengthChange"),V.length!==j&&(l.params.watchOverflow&&l.checkOverflow(),l.emit("snapGridLengthChange")),z.length!==se&&l.emit("slidesGridLengthChange"),o.watchSlidesProgress&&l.updateSlidesOffset(),l.emit("slidesUpdated"),!S&&!o.cssMode&&(o.effect==="slide"||o.effect==="fade")){const Ae=`${o.containerModifierClass}backface-hidden`,ve=l.el.classList.contains(Ae);R<=o.maxBackfaceHiddenSlides?ve||l.el.classList.add(Ae):ve&&l.el.classList.remove(Ae)}}function Mle(l){const n=this,o=[],i=n.virtual&&n.params.virtual.enabled;let u=0,h;typeof l=="number"?n.setTransition(l):l===!0&&n.setTransition(n.params.speed);const g=b=>i?n.slides[n.getSlideIndexByData(b)]:n.slides[b];if(n.params.slidesPerView!=="auto"&&n.params.slidesPerView>1)if(n.params.centeredSlides)(n.visibleSlides||[]).forEach(b=>{o.push(b)});else for(h=0;h<Math.ceil(n.params.slidesPerView);h+=1){const b=n.activeIndex+h;if(b>n.slides.length&&!i)break;o.push(g(b))}else o.push(g(n.activeIndex));for(h=0;h<o.length;h+=1)if(typeof o[h]<"u"){const b=o[h].offsetHeight;u=b>u?b:u}(u||u===0)&&(n.wrapperEl.style.height=`${u}px`)}function Nle(){const l=this,n=l.slides,o=l.isElement?l.isHorizontal()?l.wrapperEl.offsetLeft:l.wrapperEl.offsetTop:0;for(let i=0;i<n.length;i+=1)n[i].swiperSlideOffset=(l.isHorizontal()?n[i].offsetLeft:n[i].offsetTop)-o-l.cssOverflowAdjustment()}const lj=(l,n,o)=>{n&&!l.classList.contains(o)?l.classList.add(o):!n&&l.classList.contains(o)&&l.classList.remove(o)};function Fle(l){l===void 0&&(l=this&&this.translate||0);const n=this,o=n.params,{slides:i,rtlTranslate:u,snapGrid:h}=n;if(i.length===0)return;typeof i[0].swiperSlideOffset>"u"&&n.updateSlidesOffset();let g=-l;u&&(g=l),n.visibleSlidesIndexes=[],n.visibleSlides=[];let b=o.spaceBetween;typeof b=="string"&&b.indexOf("%")>=0?b=parseFloat(b.replace("%",""))/100*n.size:typeof b=="string"&&(b=parseFloat(b));for(let S=0;S<i.length;S+=1){const T=i[S];let k=T.swiperSlideOffset;o.cssMode&&o.centeredSlides&&(k-=i[0].swiperSlideOffset);const R=(g+(o.centeredSlides?n.minTranslate():0)-k)/(T.swiperSlideSize+b),V=(g-h[0]+(o.centeredSlides?n.minTranslate():0)-k)/(T.swiperSlideSize+b),z=-(g-k),$=z+n.slidesSizesGrid[S],W=z>=0&&z<=n.size-n.slidesSizesGrid[S],Q=z>=0&&z<n.size-1||$>1&&$<=n.size||z<=0&&$>=n.size;Q&&(n.visibleSlides.push(T),n.visibleSlidesIndexes.push(S)),lj(T,Q,o.slideVisibleClass),lj(T,W,o.slideFullyVisibleClass),T.progress=u?-R:R,T.originalProgress=u?-V:V}}function Ble(l){const n=this;if(typeof l>"u"){const k=n.rtlTranslate?-1:1;l=n&&n.translate&&n.translate*k||0}const o=n.params,i=n.maxTranslate()-n.minTranslate();let{progress:u,isBeginning:h,isEnd:g,progressLoop:b}=n;const S=h,T=g;if(i===0)u=0,h=!0,g=!0;else{u=(l-n.minTranslate())/i;const k=Math.abs(l-n.minTranslate())<1,R=Math.abs(l-n.maxTranslate())<1;h=k||u<=0,g=R||u>=1,k&&(u=0),R&&(u=1)}if(o.loop){const k=n.getSlideIndexByData(0),R=n.getSlideIndexByData(n.slides.length-1),V=n.slidesGrid[k],z=n.slidesGrid[R],$=n.slidesGrid[n.slidesGrid.length-1],W=Math.abs(l);W>=V?b=(W-V)/$:b=(W+$-z)/$,b>1&&(b-=1)}Object.assign(n,{progress:u,progressLoop:b,isBeginning:h,isEnd:g}),(o.watchSlidesProgress||o.centeredSlides&&o.autoHeight)&&n.updateSlidesProgress(l),h&&!S&&n.emit("reachBeginning toEdge"),g&&!T&&n.emit("reachEnd toEdge"),(S&&!h||T&&!g)&&n.emit("fromEdge"),n.emit("progress",u)}const gU=(l,n,o)=>{n&&!l.classList.contains(o)?l.classList.add(o):!n&&l.classList.contains(o)&&l.classList.remove(o)};function $le(){const l=this,{slides:n,params:o,slidesEl:i,activeIndex:u}=l,h=l.virtual&&o.virtual.enabled,g=l.grid&&o.grid&&o.grid.rows>1,b=R=>p0(i,`.${o.slideClass}${R}, swiper-slide${R}`)[0];let S,T,k;if(h)if(o.loop){let R=u-l.virtual.slidesBefore;R<0&&(R=l.virtual.slides.length+R),R>=l.virtual.slides.length&&(R-=l.virtual.slides.length),S=b(`[data-swiper-slide-index="${R}"]`)}else S=b(`[data-swiper-slide-index="${u}"]`);else g?(S=n.filter(R=>R.column===u)[0],k=n.filter(R=>R.column===u+1)[0],T=n.filter(R=>R.column===u-1)[0]):S=n[u];S&&(g||(k=_le(S,`.${o.slideClass}, swiper-slide`)[0],o.loop&&!k&&(k=n[0]),T=Cle(S,`.${o.slideClass}, swiper-slide`)[0],o.loop&&!T===0&&(T=n[n.length-1]))),n.forEach(R=>{gU(R,R===S,o.slideActiveClass),gU(R,R===k,o.slideNextClass),gU(R,R===T,o.slidePrevClass)}),l.emitSlidesClasses()}const K4=(l,n)=>{if(!l||l.destroyed||!l.params)return;const o=()=>l.isElement?"swiper-slide":`.${l.params.slideClass}`,i=n.closest(o());if(i){let u=i.querySelector(`.${l.params.lazyPreloaderClass}`);!u&&l.isElement&&(i.shadowRoot?u=i.shadowRoot.querySelector(`.${l.params.lazyPreloaderClass}`):requestAnimationFrame(()=>{i.shadowRoot&&(u=i.shadowRoot.querySelector(`.${l.params.lazyPreloaderClass}`),u&&u.remove())})),u&&u.remove()}},bU=(l,n)=>{if(!l.slides[n])return;const o=l.slides[n].querySelector('[loading="lazy"]');o&&o.removeAttribute("loading")},hV=l=>{if(!l||l.destroyed||!l.params)return;let n=l.params.lazyPreloadPrevNext;const o=l.slides.length;if(!o||!n||n<0)return;n=Math.min(n,o);const i=l.params.slidesPerView==="auto"?l.slidesPerViewDynamic():Math.ceil(l.params.slidesPerView),u=l.activeIndex;if(l.params.grid&&l.params.grid.rows>1){const g=u,b=[g-n];b.push(...Array.from({length:n}).map((S,T)=>g+i+T)),l.slides.forEach((S,T)=>{b.includes(S.column)&&bU(l,T)});return}const h=u+i-1;if(l.params.rewind||l.params.loop)for(let g=u-n;g<=h+n;g+=1){const b=(g%o+o)%o;(b<u||b>h)&&bU(l,b)}else for(let g=Math.max(u-n,0);g<=Math.min(h+n,o-1);g+=1)g!==u&&(g>h||g<u)&&bU(l,g)};function Hle(l){const{slidesGrid:n,params:o}=l,i=l.rtlTranslate?l.translate:-l.translate;let u;for(let h=0;h<n.length;h+=1)typeof n[h+1]<"u"?i>=n[h]&&i<n[h+1]-(n[h+1]-n[h])/2?u=h:i>=n[h]&&i<n[h+1]&&(u=h+1):i>=n[h]&&(u=h);return o.normalizeSlideIndex&&(u<0||typeof u>"u")&&(u=0),u}function Ule(l){const n=this,o=n.rtlTranslate?n.translate:-n.translate,{snapGrid:i,params:u,activeIndex:h,realIndex:g,snapIndex:b}=n;let S=l,T;const k=z=>{let $=z-n.virtual.slidesBefore;return $<0&&($=n.virtual.slides.length+$),$>=n.virtual.slides.length&&($-=n.virtual.slides.length),$};if(typeof S>"u"&&(S=Hle(n)),i.indexOf(o)>=0)T=i.indexOf(o);else{const z=Math.min(u.slidesPerGroupSkip,S);T=z+Math.floor((S-z)/u.slidesPerGroup)}if(T>=i.length&&(T=i.length-1),S===h&&!n.params.loop){T!==b&&(n.snapIndex=T,n.emit("snapIndexChange"));return}if(S===h&&n.params.loop&&n.virtual&&n.params.virtual.enabled){n.realIndex=k(S);return}const R=n.grid&&u.grid&&u.grid.rows>1;let V;if(n.virtual&&u.virtual.enabled&&u.loop)V=k(S);else if(R){const z=n.slides.filter(W=>W.column===S)[0];let $=parseInt(z.getAttribute("data-swiper-slide-index"),10);Number.isNaN($)&&($=Math.max(n.slides.indexOf(z),0)),V=Math.floor($/u.grid.rows)}else if(n.slides[S]){const z=n.slides[S].getAttribute("data-swiper-slide-index");z?V=parseInt(z,10):V=S}else V=S;Object.assign(n,{previousSnapIndex:b,snapIndex:T,previousRealIndex:g,realIndex:V,previousIndex:h,activeIndex:S}),n.initialized&&hV(n),n.emit("activeIndexChange"),n.emit("snapIndexChange"),(n.initialized||n.params.runCallbacksOnInit)&&(g!==V&&n.emit("realIndexChange"),n.emit("slideChange"))}function Vle(l,n){const o=this,i=o.params;let u=l.closest(`.${i.slideClass}, swiper-slide`);!u&&o.isElement&&n&&n.length>1&&n.includes(l)&&[...n.slice(n.indexOf(l)+1,n.length)].forEach(b=>{!u&&b.matches&&b.matches(`.${i.slideClass}, swiper-slide`)&&(u=b)});let h=!1,g;if(u){for(let b=0;b<o.slides.length;b+=1)if(o.slides[b]===u){h=!0,g=b;break}}if(u&&h)o.clickedSlide=u,o.virtual&&o.params.virtual.enabled?o.clickedIndex=parseInt(u.getAttribute("data-swiper-slide-index"),10):o.clickedIndex=g;else{o.clickedSlide=void 0,o.clickedIndex=void 0;return}i.slideToClickedSlide&&o.clickedIndex!==void 0&&o.clickedIndex!==o.activeIndex&&o.slideToClickedSlide()}var zle={updateSize:Ile,updateSlides:Ple,updateAutoHeight:Mle,updateSlidesOffset:Nle,updateSlidesProgress:Fle,updateProgress:Ble,updateSlidesClasses:$le,updateActiveIndex:Ule,updateClickedSlide:Vle};function Gle(l){l===void 0&&(l=this.isHorizontal()?"x":"y");const n=this,{params:o,rtlTranslate:i,translate:u,wrapperEl:h}=n;if(o.virtualTranslate)return i?-u:u;if(o.cssMode)return u;let g=Sle(h,l);return g+=n.cssOverflowAdjustment(),i&&(g=-g),g||0}function Wle(l,n){const o=this,{rtlTranslate:i,params:u,wrapperEl:h,progress:g}=o;let b=0,S=0;const T=0;o.isHorizontal()?b=i?-l:l:S=l,u.roundLengths&&(b=Math.floor(b),S=Math.floor(S)),o.previousTranslate=o.translate,o.translate=o.isHorizontal()?b:S,u.cssMode?h[o.isHorizontal()?"scrollLeft":"scrollTop"]=o.isHorizontal()?-b:-S:u.virtualTranslate||(o.isHorizontal()?b-=o.cssOverflowAdjustment():S-=o.cssOverflowAdjustment(),h.style.transform=`translate3d(${b}px, ${S}px, ${T}px)`);let k;const R=o.maxTranslate()-o.minTranslate();R===0?k=0:k=(l-o.minTranslate())/R,k!==g&&o.updateProgress(l),o.emit("setTranslate",o.translate,n)}function jle(){return-this.snapGrid[0]}function Kle(){return-this.snapGrid[this.snapGrid.length-1]}function Zle(l,n,o,i,u){l===void 0&&(l=0),n===void 0&&(n=this.params.speed),o===void 0&&(o=!0),i===void 0&&(i=!0);const h=this,{params:g,wrapperEl:b}=h;if(h.animating&&g.preventInteractionOnTransition)return!1;const S=h.minTranslate(),T=h.maxTranslate();let k;if(i&&l>S?k=S:i&&l<T?k=T:k=l,h.updateProgress(k),g.cssMode){const R=h.isHorizontal();if(n===0)b[R?"scrollLeft":"scrollTop"]=-k;else{if(!h.support.smoothScroll)return MZ({swiper:h,targetPosition:-k,side:R?"left":"top"}),!0;b.scrollTo({[R?"left":"top"]:-k,behavior:"smooth"})}return!0}return n===0?(h.setTransition(0),h.setTranslate(k),o&&(h.emit("beforeTransitionStart",n,u),h.emit("transitionEnd"))):(h.setTransition(n),h.setTranslate(k),o&&(h.emit("beforeTransitionStart",n,u),h.emit("transitionStart")),h.animating||(h.animating=!0,h.onTranslateToWrapperTransitionEnd||(h.onTranslateToWrapperTransitionEnd=function(V){!h||h.destroyed||V.target===this&&(h.wrapperEl.removeEventListener("transitionend",h.onTranslateToWrapperTransitionEnd),h.onTranslateToWrapperTransitionEnd=null,delete h.onTranslateToWrapperTransitionEnd,h.animating=!1,o&&h.emit("transitionEnd"))}),h.wrapperEl.addEventListener("transitionend",h.onTranslateToWrapperTransitionEnd))),!0}var qle={getTranslate:Gle,setTranslate:Wle,minTranslate:jle,maxTranslate:Kle,translateTo:Zle};function Yle(l,n){const o=this;o.params.cssMode||(o.wrapperEl.style.transitionDuration=`${l}ms`,o.wrapperEl.style.transitionDelay=l===0?"0ms":""),o.emit("setTransition",l,n)}function $Z(l){let{swiper:n,runCallbacks:o,direction:i,step:u}=l;const{activeIndex:h,previousIndex:g}=n;let b=i;if(b||(h>g?b="next":h<g?b="prev":b="reset"),n.emit(`transition${u}`),o&&h!==g){if(b==="reset"){n.emit(`slideResetTransition${u}`);return}n.emit(`slideChangeTransition${u}`),b==="next"?n.emit(`slideNextTransition${u}`):n.emit(`slidePrevTransition${u}`)}}function Xle(l,n){l===void 0&&(l=!0);const o=this,{params:i}=o;i.cssMode||(i.autoHeight&&o.updateAutoHeight(),$Z({swiper:o,runCallbacks:l,direction:n,step:"Start"}))}function Jle(l,n){l===void 0&&(l=!0);const o=this,{params:i}=o;o.animating=!1,!i.cssMode&&(o.setTransition(0),$Z({swiper:o,runCallbacks:l,direction:n,step:"End"}))}var Qle={setTransition:Yle,transitionStart:Xle,transitionEnd:Jle};function ece(l,n,o,i,u){l===void 0&&(l=0),o===void 0&&(o=!0),typeof l=="string"&&(l=parseInt(l,10));const h=this;let g=l;g<0&&(g=0);const{params:b,snapGrid:S,slidesGrid:T,previousIndex:k,activeIndex:R,rtlTranslate:V,wrapperEl:z,enabled:$}=h;if(!$&&!i&&!u||h.destroyed||h.animating&&b.preventInteractionOnTransition)return!1;typeof n>"u"&&(n=h.params.speed);const W=Math.min(h.params.slidesPerGroupSkip,g);let Q=W+Math.floor((g-W)/h.params.slidesPerGroup);Q>=S.length&&(Q=S.length-1);const j=-S[Q];if(b.normalizeSlideIndex)for(let re=0;re<T.length;re+=1){const Y=-Math.floor(j*100),me=Math.floor(T[re]*100),ae=Math.floor(T[re+1]*100);typeof T[re+1]<"u"?Y>=me&&Y<ae-(ae-me)/2?g=re:Y>=me&&Y<ae&&(g=re+1):Y>=me&&(g=re)}if(h.initialized&&g!==R&&(!h.allowSlideNext&&(V?j>h.translate&&j>h.minTranslate():j<h.translate&&j<h.minTranslate())||!h.allowSlidePrev&&j>h.translate&&j>h.maxTranslate()&&(R||0)!==g))return!1;g!==(k||0)&&o&&h.emit("beforeSlideChangeStart"),h.updateProgress(j);let se;if(g>R?se="next":g<R?se="prev":se="reset",V&&-j===h.translate||!V&&j===h.translate)return h.updateActiveIndex(g),b.autoHeight&&h.updateAutoHeight(),h.updateSlidesClasses(),b.effect!=="slide"&&h.setTranslate(j),se!=="reset"&&(h.transitionStart(o,se),h.transitionEnd(o,se)),!1;if(b.cssMode){const re=h.isHorizontal(),Y=V?j:-j;if(n===0){const me=h.virtual&&h.params.virtual.enabled;me&&(h.wrapperEl.style.scrollSnapType="none",h._immediateVirtual=!0),me&&!h._cssModeVirtualInitialSet&&h.params.initialSlide>0?(h._cssModeVirtualInitialSet=!0,requestAnimationFrame(()=>{z[re?"scrollLeft":"scrollTop"]=Y})):z[re?"scrollLeft":"scrollTop"]=Y,me&&requestAnimationFrame(()=>{h.wrapperEl.style.scrollSnapType="",h._immediateVirtual=!1})}else{if(!h.support.smoothScroll)return MZ({swiper:h,targetPosition:Y,side:re?"left":"top"}),!0;z.scrollTo({[re?"left":"top"]:Y,behavior:"smooth"})}return!0}return h.setTransition(n),h.setTranslate(j),h.updateActiveIndex(g),h.updateSlidesClasses(),h.emit("beforeTransitionStart",n,i),h.transitionStart(o,se),n===0?h.transitionEnd(o,se):h.animating||(h.animating=!0,h.onSlideToWrapperTransitionEnd||(h.onSlideToWrapperTransitionEnd=function(Y){!h||h.destroyed||Y.target===this&&(h.wrapperEl.removeEventListener("transitionend",h.onSlideToWrapperTransitionEnd),h.onSlideToWrapperTransitionEnd=null,delete h.onSlideToWrapperTransitionEnd,h.transitionEnd(o,se))}),h.wrapperEl.addEventListener("transitionend",h.onSlideToWrapperTransitionEnd)),!0}function tce(l,n,o,i){l===void 0&&(l=0),o===void 0&&(o=!0),typeof l=="string"&&(l=parseInt(l,10));const u=this;if(u.destroyed)return;typeof n>"u"&&(n=u.params.speed);const h=u.grid&&u.params.grid&&u.params.grid.rows>1;let g=l;if(u.params.loop)if(u.virtual&&u.params.virtual.enabled)g=g+u.virtual.slidesBefore;else{let b;if(h){const V=g*u.params.grid.rows;b=u.slides.filter(z=>z.getAttribute("data-swiper-slide-index")*1===V)[0].column}else b=u.getSlideIndexByData(g);const S=h?Math.ceil(u.slides.length/u.params.grid.rows):u.slides.length,{centeredSlides:T}=u.params;let k=u.params.slidesPerView;k==="auto"?k=u.slidesPerViewDynamic():(k=Math.ceil(parseFloat(u.params.slidesPerView,10)),T&&k%2===0&&(k=k+1));let R=S-b<k;if(T&&(R=R||b<Math.ceil(k/2)),i&&T&&u.params.slidesPerView!=="auto"&&!h&&(R=!1),R){const V=T?b<u.activeIndex?"prev":"next":b-u.activeIndex-1<u.params.slidesPerView?"next":"prev";u.loopFix({direction:V,slideTo:!0,activeSlideIndex:V==="next"?b+1:b-S+1,slideRealIndex:V==="next"?u.realIndex:void 0})}if(h){const V=g*u.params.grid.rows;g=u.slides.filter(z=>z.getAttribute("data-swiper-slide-index")*1===V)[0].column}else g=u.getSlideIndexByData(g)}return requestAnimationFrame(()=>{u.slideTo(g,n,o,i)}),u}function nce(l,n,o){n===void 0&&(n=!0);const i=this,{enabled:u,params:h,animating:g}=i;if(!u||i.destroyed)return i;typeof l>"u"&&(l=i.params.speed);let b=h.slidesPerGroup;h.slidesPerView==="auto"&&h.slidesPerGroup===1&&h.slidesPerGroupAuto&&(b=Math.max(i.slidesPerViewDynamic("current",!0),1));const S=i.activeIndex<h.slidesPerGroupSkip?1:b,T=i.virtual&&h.virtual.enabled;if(h.loop){if(g&&!T&&h.loopPreventsSliding)return!1;if(i.loopFix({direction:"next"}),i._clientLeft=i.wrapperEl.clientLeft,i.activeIndex===i.slides.length-1&&h.cssMode)return requestAnimationFrame(()=>{i.slideTo(i.activeIndex+S,l,n,o)}),!0}return h.rewind&&i.isEnd?i.slideTo(0,l,n,o):i.slideTo(i.activeIndex+S,l,n,o)}function oce(l,n,o){n===void 0&&(n=!0);const i=this,{params:u,snapGrid:h,slidesGrid:g,rtlTranslate:b,enabled:S,animating:T}=i;if(!S||i.destroyed)return i;typeof l>"u"&&(l=i.params.speed);const k=i.virtual&&u.virtual.enabled;if(u.loop){if(T&&!k&&u.loopPreventsSliding)return!1;i.loopFix({direction:"prev"}),i._clientLeft=i.wrapperEl.clientLeft}const R=b?i.translate:-i.translate;function V(j){return j<0?-Math.floor(Math.abs(j)):Math.floor(j)}const z=V(R),$=h.map(j=>V(j));let W=h[$.indexOf(z)-1];if(typeof W>"u"&&u.cssMode){let j;h.forEach((se,re)=>{z>=se&&(j=re)}),typeof j<"u"&&(W=h[j>0?j-1:j])}let Q=0;if(typeof W<"u"&&(Q=g.indexOf(W),Q<0&&(Q=i.activeIndex-1),u.slidesPerView==="auto"&&u.slidesPerGroup===1&&u.slidesPerGroupAuto&&(Q=Q-i.slidesPerViewDynamic("previous",!0)+1,Q=Math.max(Q,0))),u.rewind&&i.isBeginning){const j=i.params.virtual&&i.params.virtual.enabled&&i.virtual?i.virtual.slides.length-1:i.slides.length-1;return i.slideTo(j,l,n,o)}else if(u.loop&&i.activeIndex===0&&u.cssMode)return requestAnimationFrame(()=>{i.slideTo(Q,l,n,o)}),!0;return i.slideTo(Q,l,n,o)}function sce(l,n,o){n===void 0&&(n=!0);const i=this;if(!i.destroyed)return typeof l>"u"&&(l=i.params.speed),i.slideTo(i.activeIndex,l,n,o)}function rce(l,n,o,i){n===void 0&&(n=!0),i===void 0&&(i=.5);const u=this;if(u.destroyed)return;typeof l>"u"&&(l=u.params.speed);let h=u.activeIndex;const g=Math.min(u.params.slidesPerGroupSkip,h),b=g+Math.floor((h-g)/u.params.slidesPerGroup),S=u.rtlTranslate?u.translate:-u.translate;if(S>=u.snapGrid[b]){const T=u.snapGrid[b],k=u.snapGrid[b+1];S-T>(k-T)*i&&(h+=u.params.slidesPerGroup)}else{const T=u.snapGrid[b-1],k=u.snapGrid[b];S-T<=(k-T)*i&&(h-=u.params.slidesPerGroup)}return h=Math.max(h,0),h=Math.min(h,u.slidesGrid.length-1),u.slideTo(h,l,n,o)}function ice(){const l=this;if(l.destroyed)return;const{params:n,slidesEl:o}=l,i=n.slidesPerView==="auto"?l.slidesPerViewDynamic():n.slidesPerView;let u=l.clickedIndex,h;const g=l.isElement?"swiper-slide":`.${n.slideClass}`;if(n.loop){if(l.animating)return;h=parseInt(l.clickedSlide.getAttribute("data-swiper-slide-index"),10),n.centeredSlides?u<l.loopedSlides-i/2||u>l.slides.length-l.loopedSlides+i/2?(l.loopFix(),u=l.getSlideIndex(p0(o,`${g}[data-swiper-slide-index="${h}"]`)[0]),dV(()=>{l.slideTo(u)})):l.slideTo(u):u>l.slides.length-i?(l.loopFix(),u=l.getSlideIndex(p0(o,`${g}[data-swiper-slide-index="${h}"]`)[0]),dV(()=>{l.slideTo(u)})):l.slideTo(u)}else l.slideTo(u)}var ace={slideTo:ece,slideToLoop:tce,slideNext:nce,slidePrev:oce,slideReset:sce,slideToClosest:rce,slideToClickedSlide:ice};function lce(l){const n=this,{params:o,slidesEl:i}=n;if(!o.loop||n.virtual&&n.params.virtual.enabled)return;const u=()=>{p0(i,`.${o.slideClass}, swiper-slide`).forEach((R,V)=>{R.setAttribute("data-swiper-slide-index",V)})},h=n.grid&&o.grid&&o.grid.rows>1,g=o.slidesPerGroup*(h?o.grid.rows:1),b=n.slides.length%g!==0,S=h&&n.slides.length%o.grid.rows!==0,T=k=>{for(let R=0;R<k;R+=1){const V=n.isElement?vB("swiper-slide",[o.slideBlankClass]):vB("div",[o.slideClass,o.slideBlankClass]);n.slidesEl.append(V)}};if(b){if(o.loopAddBlankSlides){const k=g-n.slides.length%g;T(k),n.recalcSlides(),n.updateSlides()}else bB("Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)");u()}else if(S){if(o.loopAddBlankSlides){const k=o.grid.rows-n.slides.length%o.grid.rows;T(k),n.recalcSlides(),n.updateSlides()}else bB("Swiper Loop Warning: The number of slides is not even to grid.rows, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)");u()}else u();n.loopFix({slideRealIndex:l,direction:o.centeredSlides?void 0:"next"})}function cce(l){let{slideRealIndex:n,slideTo:o=!0,direction:i,setTranslate:u,activeSlideIndex:h,byController:g,byMousewheel:b}=l===void 0?{}:l;const S=this;if(!S.params.loop)return;S.emit("beforeLoopFix");const{slides:T,allowSlidePrev:k,allowSlideNext:R,slidesEl:V,params:z}=S,{centeredSlides:$}=z;if(S.allowSlidePrev=!0,S.allowSlideNext=!0,S.virtual&&z.virtual.enabled){o&&(!z.centeredSlides&&S.snapIndex===0?S.slideTo(S.virtual.slides.length,0,!1,!0):z.centeredSlides&&S.snapIndex<z.slidesPerView?S.slideTo(S.virtual.slides.length+S.snapIndex,0,!1,!0):S.snapIndex===S.snapGrid.length-1&&S.slideTo(S.virtual.slidesBefore,0,!1,!0)),S.allowSlidePrev=k,S.allowSlideNext=R,S.emit("loopFix");return}let W=z.slidesPerView;W==="auto"?W=S.slidesPerViewDynamic():(W=Math.ceil(parseFloat(z.slidesPerView,10)),$&&W%2===0&&(W=W+1));const Q=z.slidesPerGroupAuto?W:z.slidesPerGroup;let j=Q;j%Q!==0&&(j+=Q-j%Q),j+=z.loopAdditionalSlides,S.loopedSlides=j;const se=S.grid&&z.grid&&z.grid.rows>1;T.length<W+j?bB("Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled and not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters"):se&&z.grid.fill==="row"&&bB("Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`");const re=[],Y=[];let me=S.activeIndex;typeof h>"u"?h=S.getSlideIndex(T.filter(O=>O.classList.contains(z.slideActiveClass))[0]):me=h;const ae=i==="next"||!i,Ce=i==="prev"||!i;let Ue=0,ot=0;const Ae=se?Math.ceil(T.length/z.grid.rows):T.length,Oe=(se?T[h].column:h)+($&&typeof u>"u"?-W/2+.5:0);if(Oe<j){Ue=Math.max(j-Oe,Q);for(let O=0;O<j-Oe;O+=1){const De=O-Math.floor(O/Ae)*Ae;if(se){const Fe=Ae-De-1;for(let st=T.length-1;st>=0;st-=1)T[st].column===Fe&&re.push(st)}else re.push(Ae-De-1)}}else if(Oe+W>Ae-j){ot=Math.max(Oe-(Ae-j*2),Q);for(let O=0;O<ot;O+=1){const De=O-Math.floor(O/Ae)*Ae;se?T.forEach((Fe,st)=>{Fe.column===De&&Y.push(st)}):Y.push(De)}}if(S.__preventObserver__=!0,requestAnimationFrame(()=>{S.__preventObserver__=!1}),Ce&&re.forEach(O=>{T[O].swiperLoopMoveDOM=!0,V.prepend(T[O]),T[O].swiperLoopMoveDOM=!1}),ae&&Y.forEach(O=>{T[O].swiperLoopMoveDOM=!0,V.append(T[O]),T[O].swiperLoopMoveDOM=!1}),S.recalcSlides(),z.slidesPerView==="auto"?S.updateSlides():se&&(re.length>0&&Ce||Y.length>0&&ae)&&S.slides.forEach((O,De)=>{S.grid.updateSlide(De,O,S.slides)}),z.watchSlidesProgress&&S.updateSlidesOffset(),o){if(re.length>0&&Ce){if(typeof n>"u"){const O=S.slidesGrid[me],Fe=S.slidesGrid[me+Ue]-O;b?S.setTranslate(S.translate-Fe):(S.slideTo(me+Math.ceil(Ue),0,!1,!0),u&&(S.touchEventsData.startTranslate=S.touchEventsData.startTranslate-Fe,S.touchEventsData.currentTranslate=S.touchEventsData.currentTranslate-Fe))}else if(u){const O=se?re.length/z.grid.rows:re.length;S.slideTo(S.activeIndex+O,0,!1,!0),S.touchEventsData.currentTranslate=S.translate}}else if(Y.length>0&&ae)if(typeof n>"u"){const O=S.slidesGrid[me],Fe=S.slidesGrid[me-ot]-O;b?S.setTranslate(S.translate-Fe):(S.slideTo(me-ot,0,!1,!0),u&&(S.touchEventsData.startTranslate=S.touchEventsData.startTranslate-Fe,S.touchEventsData.currentTranslate=S.touchEventsData.currentTranslate-Fe))}else{const O=se?Y.length/z.grid.rows:Y.length;S.slideTo(S.activeIndex-O,0,!1,!0)}}if(S.allowSlidePrev=k,S.allowSlideNext=R,S.controller&&S.controller.control&&!g){const O={slideRealIndex:n,direction:i,setTranslate:u,activeSlideIndex:h,byController:!0};Array.isArray(S.controller.control)?S.controller.control.forEach(De=>{!De.destroyed&&De.params.loop&&De.loopFix({...O,slideTo:De.params.slidesPerView===z.slidesPerView?o:!1})}):S.controller.control instanceof S.constructor&&S.controller.control.params.loop&&S.controller.control.loopFix({...O,slideTo:S.controller.control.params.slidesPerView===z.slidesPerView?o:!1})}S.emit("loopFix")}function uce(){const l=this,{params:n,slidesEl:o}=l;if(!n.loop||l.virtual&&l.params.virtual.enabled)return;l.recalcSlides();const i=[];l.slides.forEach(u=>{const h=typeof u.swiperSlideIndex>"u"?u.getAttribute("data-swiper-slide-index")*1:u.swiperSlideIndex;i[h]=u}),l.slides.forEach(u=>{u.removeAttribute("data-swiper-slide-index")}),i.forEach(u=>{o.append(u)}),l.recalcSlides(),l.slideTo(l.realIndex,0)}var dce={loopCreate:lce,loopFix:cce,loopDestroy:uce};function fce(l){const n=this;if(!n.params.simulateTouch||n.params.watchOverflow&&n.isLocked||n.params.cssMode)return;const o=n.params.touchEventsTarget==="container"?n.el:n.wrapperEl;n.isElement&&(n.__preventObserver__=!0),o.style.cursor="move",o.style.cursor=l?"grabbing":"grab",n.isElement&&requestAnimationFrame(()=>{n.__preventObserver__=!1})}function hce(){const l=this;l.params.watchOverflow&&l.isLocked||l.params.cssMode||(l.isElement&&(l.__preventObserver__=!0),l[l.params.touchEventsTarget==="container"?"el":"wrapperEl"].style.cursor="",l.isElement&&requestAnimationFrame(()=>{l.__preventObserver__=!1}))}var mce={setGrabCursor:fce,unsetGrabCursor:hce};function pce(l,n){n===void 0&&(n=this);function o(i){if(!i||i===IT()||i===Lh())return null;i.assignedSlot&&(i=i.assignedSlot);const u=i.closest(l);return!u&&!i.getRootNode?null:u||o(i.getRootNode().host)}return o(n)}function cj(l,n,o){const i=Lh(),{params:u}=l,h=u.edgeSwipeDetection,g=u.edgeSwipeThreshold;return h&&(o<=g||o>=i.innerWidth-g)?h==="prevent"?(n.preventDefault(),!0):!1:!0}function gce(l){const n=this,o=IT();let i=l;i.originalEvent&&(i=i.originalEvent);const u=n.touchEventsData;if(i.type==="pointerdown"){if(u.pointerId!==null&&u.pointerId!==i.pointerId)return;u.pointerId=i.pointerId}else i.type==="touchstart"&&i.targetTouches.length===1&&(u.touchId=i.targetTouches[0].identifier);if(i.type==="touchstart"){cj(n,i,i.targetTouches[0].pageX);return}const{params:h,touches:g,enabled:b}=n;if(!b||!h.simulateTouch&&i.pointerType==="mouse"||n.animating&&h.preventInteractionOnTransition)return;!n.animating&&h.cssMode&&h.loop&&n.loopFix();let S=i.target;if(h.touchEventsTarget==="wrapper"&&!n.wrapperEl.contains(S)||"which"in i&&i.which===3||"button"in i&&i.button>0||u.isTouched&&u.isMoved)return;const T=!!h.noSwipingClass&&h.noSwipingClass!=="",k=i.composedPath?i.composedPath():i.path;T&&i.target&&i.target.shadowRoot&&k&&(S=k[0]);const R=h.noSwipingSelector?h.noSwipingSelector:`.${h.noSwipingClass}`,V=!!(i.target&&i.target.shadowRoot);if(h.noSwiping&&(V?pce(R,S):S.closest(R))){n.allowClick=!0;return}if(h.swipeHandler&&!S.closest(h.swipeHandler))return;g.currentX=i.pageX,g.currentY=i.pageY;const z=g.currentX,$=g.currentY;if(!cj(n,i,z))return;Object.assign(u,{isTouched:!0,isMoved:!1,allowTouchCallbacks:!0,isScrolling:void 0,startMoving:void 0}),g.startX=z,g.startY=$,u.touchStartTime=gB(),n.allowClick=!0,n.updateSize(),n.swipeDirection=void 0,h.threshold>0&&(u.allowThresholdMove=!1);let W=!0;S.matches(u.focusableElements)&&(W=!1,S.nodeName==="SELECT"&&(u.isTouched=!1)),o.activeElement&&o.activeElement.matches(u.focusableElements)&&o.activeElement!==S&&o.activeElement.blur();const Q=W&&n.allowTouchMove&&h.touchStartPreventDefault;(h.touchStartForcePreventDefault||Q)&&!S.isContentEditable&&i.preventDefault(),h.freeMode&&h.freeMode.enabled&&n.freeMode&&n.animating&&!h.cssMode&&n.freeMode.onTouchStart(),n.emit("touchStart",i)}function bce(l){const n=IT(),o=this,i=o.touchEventsData,{params:u,touches:h,rtlTranslate:g,enabled:b}=o;if(!b||!u.simulateTouch&&l.pointerType==="mouse")return;let S=l;if(S.originalEvent&&(S=S.originalEvent),S.type==="pointermove"&&(i.touchId!==null||S.pointerId!==i.pointerId))return;let T;if(S.type==="touchmove"){if(T=[...S.changedTouches].filter(ae=>ae.identifier===i.touchId)[0],!T||T.identifier!==i.touchId)return}else T=S;if(!i.isTouched){i.startMoving&&i.isScrolling&&o.emit("touchMoveOpposite",S);return}const k=T.pageX,R=T.pageY;if(S.preventedByNestedSwiper){h.startX=k,h.startY=R;return}if(!o.allowTouchMove){S.target.matches(i.focusableElements)||(o.allowClick=!1),i.isTouched&&(Object.assign(h,{startX:k,startY:R,currentX:k,currentY:R}),i.touchStartTime=gB());return}if(u.touchReleaseOnEdges&&!u.loop){if(o.isVertical()){if(R<h.startY&&o.translate<=o.maxTranslate()||R>h.startY&&o.translate>=o.minTranslate()){i.isTouched=!1,i.isMoved=!1;return}}else if(k<h.startX&&o.translate<=o.maxTranslate()||k>h.startX&&o.translate>=o.minTranslate())return}if(n.activeElement&&S.target===n.activeElement&&S.target.matches(i.focusableElements)){i.isMoved=!0,o.allowClick=!1;return}i.allowTouchCallbacks&&o.emit("touchMove",S),h.previousX=h.currentX,h.previousY=h.currentY,h.currentX=k,h.currentY=R;const V=h.currentX-h.startX,z=h.currentY-h.startY;if(o.params.threshold&&Math.sqrt(V**2+z**2)<o.params.threshold)return;if(typeof i.isScrolling>"u"){let ae;o.isHorizontal()&&h.currentY===h.startY||o.isVertical()&&h.currentX===h.startX?i.isScrolling=!1:V*V+z*z>=25&&(ae=Math.atan2(Math.abs(z),Math.abs(V))*180/Math.PI,i.isScrolling=o.isHorizontal()?ae>u.touchAngle:90-ae>u.touchAngle)}if(i.isScrolling&&o.emit("touchMoveOpposite",S),typeof i.startMoving>"u"&&(h.currentX!==h.startX||h.currentY!==h.startY)&&(i.startMoving=!0),i.isScrolling||S.type==="touchmove"&&i.preventTouchMoveFromPointerMove){i.isTouched=!1;return}if(!i.startMoving)return;o.allowClick=!1,!u.cssMode&&S.cancelable&&S.preventDefault(),u.touchMoveStopPropagation&&!u.nested&&S.stopPropagation();let $=o.isHorizontal()?V:z,W=o.isHorizontal()?h.currentX-h.previousX:h.currentY-h.previousY;u.oneWayMovement&&($=Math.abs($)*(g?1:-1),W=Math.abs(W)*(g?1:-1)),h.diff=$,$*=u.touchRatio,g&&($=-$,W=-W);const Q=o.touchesDirection;o.swipeDirection=$>0?"prev":"next",o.touchesDirection=W>0?"prev":"next";const j=o.params.loop&&!u.cssMode,se=o.touchesDirection==="next"&&o.allowSlideNext||o.touchesDirection==="prev"&&o.allowSlidePrev;if(!i.isMoved){if(j&&se&&o.loopFix({direction:o.swipeDirection}),i.startTranslate=o.getTranslate(),o.setTransition(0),o.animating){const ae=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0,detail:{bySwiperTouchMove:!0}});o.wrapperEl.dispatchEvent(ae)}i.allowMomentumBounce=!1,u.grabCursor&&(o.allowSlideNext===!0||o.allowSlidePrev===!0)&&o.setGrabCursor(!0),o.emit("sliderFirstMove",S)}let re;if(new Date().getTime(),i.isMoved&&i.allowThresholdMove&&Q!==o.touchesDirection&&j&&se&&Math.abs($)>=1){Object.assign(h,{startX:k,startY:R,currentX:k,currentY:R,startTranslate:i.currentTranslate}),i.loopSwapReset=!0,i.startTranslate=i.currentTranslate;return}o.emit("sliderMove",S),i.isMoved=!0,i.currentTranslate=$+i.startTranslate;let Y=!0,me=u.resistanceRatio;if(u.touchReleaseOnEdges&&(me=0),$>0?(j&&se&&!re&&i.allowThresholdMove&&i.currentTranslate>(u.centeredSlides?o.minTranslate()-o.slidesSizesGrid[o.activeIndex+1]:o.minTranslate())&&o.loopFix({direction:"prev",setTranslate:!0,activeSlideIndex:0}),i.currentTranslate>o.minTranslate()&&(Y=!1,u.resistance&&(i.currentTranslate=o.minTranslate()-1+(-o.minTranslate()+i.startTranslate+$)**me))):$<0&&(j&&se&&!re&&i.allowThresholdMove&&i.currentTranslate<(u.centeredSlides?o.maxTranslate()+o.slidesSizesGrid[o.slidesSizesGrid.length-1]:o.maxTranslate())&&o.loopFix({direction:"next",setTranslate:!0,activeSlideIndex:o.slides.length-(u.slidesPerView==="auto"?o.slidesPerViewDynamic():Math.ceil(parseFloat(u.slidesPerView,10)))}),i.currentTranslate<o.maxTranslate()&&(Y=!1,u.resistance&&(i.currentTranslate=o.maxTranslate()+1-(o.maxTranslate()-i.startTranslate-$)**me))),Y&&(S.preventedByNestedSwiper=!0),!o.allowSlideNext&&o.swipeDirection==="next"&&i.currentTranslate<i.startTranslate&&(i.currentTranslate=i.startTranslate),!o.allowSlidePrev&&o.swipeDirection==="prev"&&i.currentTranslate>i.startTranslate&&(i.currentTranslate=i.startTranslate),!o.allowSlidePrev&&!o.allowSlideNext&&(i.currentTranslate=i.startTranslate),u.threshold>0)if(Math.abs($)>u.threshold||i.allowThresholdMove){if(!i.allowThresholdMove){i.allowThresholdMove=!0,h.startX=h.currentX,h.startY=h.currentY,i.currentTranslate=i.startTranslate,h.diff=o.isHorizontal()?h.currentX-h.startX:h.currentY-h.startY;return}}else{i.currentTranslate=i.startTranslate;return}!u.followFinger||u.cssMode||((u.freeMode&&u.freeMode.enabled&&o.freeMode||u.watchSlidesProgress)&&(o.updateActiveIndex(),o.updateSlidesClasses()),u.freeMode&&u.freeMode.enabled&&o.freeMode&&o.freeMode.onTouchMove(),o.updateProgress(i.currentTranslate),o.setTranslate(i.currentTranslate))}function vce(l){const n=this,o=n.touchEventsData;let i=l;i.originalEvent&&(i=i.originalEvent);let u;if(i.type==="touchend"||i.type==="touchcancel"){if(u=[...i.changedTouches].filter(me=>me.identifier===o.touchId)[0],!u||u.identifier!==o.touchId)return}else{if(o.touchId!==null||i.pointerId!==o.pointerId)return;u=i}if(["pointercancel","pointerout","pointerleave","contextmenu"].includes(i.type)&&!(["pointercancel","contextmenu"].includes(i.type)&&(n.browser.isSafari||n.browser.isWebView)))return;o.pointerId=null,o.touchId=null;const{params:g,touches:b,rtlTranslate:S,slidesGrid:T,enabled:k}=n;if(!k||!g.simulateTouch&&i.pointerType==="mouse")return;if(o.allowTouchCallbacks&&n.emit("touchEnd",i),o.allowTouchCallbacks=!1,!o.isTouched){o.isMoved&&g.grabCursor&&n.setGrabCursor(!1),o.isMoved=!1,o.startMoving=!1;return}g.grabCursor&&o.isMoved&&o.isTouched&&(n.allowSlideNext===!0||n.allowSlidePrev===!0)&&n.setGrabCursor(!1);const R=gB(),V=R-o.touchStartTime;if(n.allowClick){const me=i.path||i.composedPath&&i.composedPath();n.updateClickedSlide(me&&me[0]||i.target,me),n.emit("tap click",i),V<300&&R-o.lastClickTime<300&&n.emit("doubleTap doubleClick",i)}if(o.lastClickTime=gB(),dV(()=>{n.destroyed||(n.allowClick=!0)}),!o.isTouched||!o.isMoved||!n.swipeDirection||b.diff===0&&!o.loopSwapReset||o.currentTranslate===o.startTranslate&&!o.loopSwapReset){o.isTouched=!1,o.isMoved=!1,o.startMoving=!1;return}o.isTouched=!1,o.isMoved=!1,o.startMoving=!1;let z;if(g.followFinger?z=S?n.translate:-n.translate:z=-o.currentTranslate,g.cssMode)return;if(g.freeMode&&g.freeMode.enabled){n.freeMode.onTouchEnd({currentPos:z});return}const $=z>=-n.maxTranslate()&&!n.params.loop;let W=0,Q=n.slidesSizesGrid[0];for(let me=0;me<T.length;me+=me<g.slidesPerGroupSkip?1:g.slidesPerGroup){const ae=me<g.slidesPerGroupSkip-1?1:g.slidesPerGroup;typeof T[me+ae]<"u"?($||z>=T[me]&&z<T[me+ae])&&(W=me,Q=T[me+ae]-T[me]):($||z>=T[me])&&(W=me,Q=T[T.length-1]-T[T.length-2])}let j=null,se=null;g.rewind&&(n.isBeginning?se=g.virtual&&g.virtual.enabled&&n.virtual?n.virtual.slides.length-1:n.slides.length-1:n.isEnd&&(j=0));const re=(z-T[W])/Q,Y=W<g.slidesPerGroupSkip-1?1:g.slidesPerGroup;if(V>g.longSwipesMs){if(!g.longSwipes){n.slideTo(n.activeIndex);return}n.swipeDirection==="next"&&(re>=g.longSwipesRatio?n.slideTo(g.rewind&&n.isEnd?j:W+Y):n.slideTo(W)),n.swipeDirection==="prev"&&(re>1-g.longSwipesRatio?n.slideTo(W+Y):se!==null&&re<0&&Math.abs(re)>g.longSwipesRatio?n.slideTo(se):n.slideTo(W))}else{if(!g.shortSwipes){n.slideTo(n.activeIndex);return}n.navigation&&(i.target===n.navigation.nextEl||i.target===n.navigation.prevEl)?i.target===n.navigation.nextEl?n.slideTo(W+Y):n.slideTo(W):(n.swipeDirection==="next"&&n.slideTo(j!==null?j:W+Y),n.swipeDirection==="prev"&&n.slideTo(se!==null?se:W))}}function uj(){const l=this,{params:n,el:o}=l;if(o&&o.offsetWidth===0)return;n.breakpoints&&l.setBreakpoint();const{allowSlideNext:i,allowSlidePrev:u,snapGrid:h}=l,g=l.virtual&&l.params.virtual.enabled;l.allowSlideNext=!0,l.allowSlidePrev=!0,l.updateSize(),l.updateSlides(),l.updateSlidesClasses();const b=g&&n.loop;(n.slidesPerView==="auto"||n.slidesPerView>1)&&l.isEnd&&!l.isBeginning&&!l.params.centeredSlides&&!b?l.slideTo(l.slides.length-1,0,!1,!0):l.params.loop&&!g?l.slideToLoop(l.realIndex,0,!1,!0):l.slideTo(l.activeIndex,0,!1,!0),l.autoplay&&l.autoplay.running&&l.autoplay.paused&&(clearTimeout(l.autoplay.resizeTimeout),l.autoplay.resizeTimeout=setTimeout(()=>{l.autoplay&&l.autoplay.running&&l.autoplay.paused&&l.autoplay.resume()},500)),l.allowSlidePrev=u,l.allowSlideNext=i,l.params.watchOverflow&&h!==l.snapGrid&&l.checkOverflow()}function xce(l){const n=this;n.enabled&&(n.allowClick||(n.params.preventClicks&&l.preventDefault(),n.params.preventClicksPropagation&&n.animating&&(l.stopPropagation(),l.stopImmediatePropagation())))}function yce(){const l=this,{wrapperEl:n,rtlTranslate:o,enabled:i}=l;if(!i)return;l.previousTranslate=l.translate,l.isHorizontal()?l.translate=-n.scrollLeft:l.translate=-n.scrollTop,l.translate===0&&(l.translate=0),l.updateActiveIndex(),l.updateSlidesClasses();let u;const h=l.maxTranslate()-l.minTranslate();h===0?u=0:u=(l.translate-l.minTranslate())/h,u!==l.progress&&l.updateProgress(o?-l.translate:l.translate),l.emit("setTranslate",l.translate,!1)}function wce(l){const n=this;K4(n,l.target),!(n.params.cssMode||n.params.slidesPerView!=="auto"&&!n.params.autoHeight)&&n.update()}function Sce(){const l=this;l.documentTouchHandlerProceeded||(l.documentTouchHandlerProceeded=!0,l.params.touchReleaseOnEdges&&(l.el.style.touchAction="auto"))}const HZ=(l,n)=>{const o=IT(),{params:i,el:u,wrapperEl:h,device:g}=l,b=!!i.nested,S=n==="on"?"addEventListener":"removeEventListener",T=n;!u||typeof u=="string"||(o[S]("touchstart",l.onDocumentTouchStart,{passive:!1,capture:b}),u[S]("touchstart",l.onTouchStart,{passive:!1}),u[S]("pointerdown",l.onTouchStart,{passive:!1}),o[S]("touchmove",l.onTouchMove,{passive:!1,capture:b}),o[S]("pointermove",l.onTouchMove,{passive:!1,capture:b}),o[S]("touchend",l.onTouchEnd,{passive:!0}),o[S]("pointerup",l.onTouchEnd,{passive:!0}),o[S]("pointercancel",l.onTouchEnd,{passive:!0}),o[S]("touchcancel",l.onTouchEnd,{passive:!0}),o[S]("pointerout",l.onTouchEnd,{passive:!0}),o[S]("pointerleave",l.onTouchEnd,{passive:!0}),o[S]("contextmenu",l.onTouchEnd,{passive:!0}),(i.preventClicks||i.preventClicksPropagation)&&u[S]("click",l.onClick,!0),i.cssMode&&h[S]("scroll",l.onScroll),i.updateOnWindowResize?l[T](g.ios||g.android?"resize orientationchange observerUpdate":"resize observerUpdate",uj,!0):l[T]("observerUpdate",uj,!0),u[S]("load",l.onLoad,{capture:!0}))};function Ece(){const l=this,{params:n}=l;l.onTouchStart=gce.bind(l),l.onTouchMove=bce.bind(l),l.onTouchEnd=vce.bind(l),l.onDocumentTouchStart=Sce.bind(l),n.cssMode&&(l.onScroll=yce.bind(l)),l.onClick=xce.bind(l),l.onLoad=wce.bind(l),HZ(l,"on")}function Cce(){HZ(this,"off")}var _ce={attachEvents:Ece,detachEvents:Cce};const dj=(l,n)=>l.grid&&n.grid&&n.grid.rows>1;function Tce(){const l=this,{realIndex:n,initialized:o,params:i,el:u}=l,h=i.breakpoints;if(!h||h&&Object.keys(h).length===0)return;const g=l.getBreakpoint(h,l.params.breakpointsBase,l.el);if(!g||l.currentBreakpoint===g)return;const S=(g in h?h[g]:void 0)||l.originalParams,T=dj(l,i),k=dj(l,S),R=l.params.grabCursor,V=S.grabCursor,z=i.enabled;T&&!k?(u.classList.remove(`${i.containerModifierClass}grid`,`${i.containerModifierClass}grid-column`),l.emitContainerClasses()):!T&&k&&(u.classList.add(`${i.containerModifierClass}grid`),(S.grid.fill&&S.grid.fill==="column"||!S.grid.fill&&i.grid.fill==="column")&&u.classList.add(`${i.containerModifierClass}grid-column`),l.emitContainerClasses()),R&&!V?l.unsetGrabCursor():!R&&V&&l.setGrabCursor(),["navigation","pagination","scrollbar"].forEach(re=>{if(typeof S[re]>"u")return;const Y=i[re]&&i[re].enabled,me=S[re]&&S[re].enabled;Y&&!me&&l[re].disable(),!Y&&me&&l[re].enable()});const $=S.direction&&S.direction!==i.direction,W=i.loop&&(S.slidesPerView!==i.slidesPerView||$),Q=i.loop;$&&o&&l.changeDirection(),Dh(l.params,S);const j=l.params.enabled,se=l.params.loop;Object.assign(l,{allowTouchMove:l.params.allowTouchMove,allowSlideNext:l.params.allowSlideNext,allowSlidePrev:l.params.allowSlidePrev}),z&&!j?l.disable():!z&&j&&l.enable(),l.currentBreakpoint=g,l.emit("_beforeBreakpoint",S),o&&(W?(l.loopDestroy(),l.loopCreate(n),l.updateSlides()):!Q&&se?(l.loopCreate(n),l.updateSlides()):Q&&!se&&l.loopDestroy()),l.emit("breakpoint",S)}function Dce(l,n,o){if(n===void 0&&(n="window"),!l||n==="container"&&!o)return;let i=!1;const u=Lh(),h=n==="window"?u.innerHeight:o.clientHeight,g=Object.keys(l).map(b=>{if(typeof b=="string"&&b.indexOf("@")===0){const S=parseFloat(b.substr(1));return{value:h*S,point:b}}return{value:b,point:b}});g.sort((b,S)=>parseInt(b.value,10)-parseInt(S.value,10));for(let b=0;b<g.length;b+=1){const{point:S,value:T}=g[b];n==="window"?u.matchMedia(`(min-width: ${T}px)`).matches&&(i=S):T<=o.clientWidth&&(i=S)}return i||"max"}var kce={setBreakpoint:Tce,getBreakpoint:Dce};function Ace(l,n){const o=[];return l.forEach(i=>{typeof i=="object"?Object.keys(i).forEach(u=>{i[u]&&o.push(n+u)}):typeof i=="string"&&o.push(n+i)}),o}function Lce(){const l=this,{classNames:n,params:o,rtl:i,el:u,device:h}=l,g=Ace(["initialized",o.direction,{"free-mode":l.params.freeMode&&o.freeMode.enabled},{autoheight:o.autoHeight},{rtl:i},{grid:o.grid&&o.grid.rows>1},{"grid-column":o.grid&&o.grid.rows>1&&o.grid.fill==="column"},{android:h.android},{ios:h.ios},{"css-mode":o.cssMode},{centered:o.cssMode&&o.centeredSlides},{"watch-progress":o.watchSlidesProgress}],o.containerModifierClass);n.push(...g),u.classList.add(...n),l.emitContainerClasses()}function Rce(){const l=this,{el:n,classNames:o}=l;!n||typeof n=="string"||(n.classList.remove(...o),l.emitContainerClasses())}var Oce={addClasses:Lce,removeClasses:Rce};function Ice(){const l=this,{isLocked:n,params:o}=l,{slidesOffsetBefore:i}=o;if(i){const u=l.slides.length-1,h=l.slidesGrid[u]+l.slidesSizesGrid[u]+i*2;l.isLocked=l.size>h}else l.isLocked=l.snapGrid.length===1;o.allowSlideNext===!0&&(l.allowSlideNext=!l.isLocked),o.allowSlidePrev===!0&&(l.allowSlidePrev=!l.isLocked),n&&n!==l.isLocked&&(l.isEnd=!1),n!==l.isLocked&&l.emit(l.isLocked?"lock":"unlock")}var Pce={checkOverflow:Ice},fj={init:!0,direction:"horizontal",oneWayMovement:!1,swiperElementNodeName:"SWIPER-CONTAINER",touchEventsTarget:"wrapper",initialSlide:0,speed:300,cssMode:!1,updateOnWindowResize:!0,resizeObserver:!0,nested:!1,createElements:!1,eventsPrefix:"swiper",enabled:!0,focusableElements:"input, select, option, textarea, button, video, label",width:null,height:null,preventInteractionOnTransition:!1,userAgent:null,url:null,edgeSwipeDetection:!1,edgeSwipeThreshold:20,autoHeight:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",breakpoints:void 0,breakpointsBase:"window",spaceBetween:0,slidesPerView:1,slidesPerGroup:1,slidesPerGroupSkip:0,slidesPerGroupAuto:!1,centeredSlides:!1,centeredSlidesBounds:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,normalizeSlideIndex:!0,centerInsufficientSlides:!1,watchOverflow:!0,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,allowTouchMove:!0,threshold:5,touchMoveStopPropagation:!1,touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchReleaseOnEdges:!1,uniqueNavElements:!0,resistance:!0,resistanceRatio:.85,watchSlidesProgress:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,loop:!1,loopAddBlankSlides:!0,loopAdditionalSlides:0,loopPreventsSliding:!0,rewind:!1,allowSlidePrev:!0,allowSlideNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:null,passiveListeners:!0,maxBackfaceHiddenSlides:10,containerModifierClass:"swiper-",slideClass:"swiper-slide",slideBlankClass:"swiper-slide-blank",slideActiveClass:"swiper-slide-active",slideVisibleClass:"swiper-slide-visible",slideFullyVisibleClass:"swiper-slide-fully-visible",slideNextClass:"swiper-slide-next",slidePrevClass:"swiper-slide-prev",wrapperClass:"swiper-wrapper",lazyPreloaderClass:"swiper-lazy-preloader",lazyPreloadPrevNext:0,runCallbacksOnInit:!0,_emitClasses:!1};function Mce(l,n){return function(i){i===void 0&&(i={});const u=Object.keys(i)[0],h=i[u];if(typeof h!="object"||h===null){Dh(n,i);return}if(l[u]===!0&&(l[u]={enabled:!0}),u==="navigation"&&l[u]&&l[u].enabled&&!l[u].prevEl&&!l[u].nextEl&&(l[u].auto=!0),["pagination","scrollbar"].indexOf(u)>=0&&l[u]&&l[u].enabled&&!l[u].el&&(l[u].auto=!0),!(u in l&&"enabled"in h)){Dh(n,i);return}typeof l[u]=="object"&&!("enabled"in l[u])&&(l[u].enabled=!0),l[u]||(l[u]={enabled:!1}),Dh(n,i)}}const vU={eventsEmitter:Ole,update:zle,translate:qle,transition:Qle,slide:ace,loop:dce,grabCursor:mce,events:_ce,breakpoints:kce,checkOverflow:Pce,classes:Oce},xU={};class Th{constructor(){let n,o;for(var i=arguments.length,u=new Array(i),h=0;h<i;h++)u[h]=arguments[h];u.length===1&&u[0].constructor&&Object.prototype.toString.call(u[0]).slice(8,-1)==="Object"?o=u[0]:[n,o]=u,o||(o={}),o=Dh({},o),n&&!o.el&&(o.el=n);const g=IT();if(o.el&&typeof o.el=="string"&&g.querySelectorAll(o.el).length>1){const k=[];return g.querySelectorAll(o.el).forEach(R=>{const V=Dh({},o,{el:R});k.push(new Th(V))}),k}const b=this;b.__swiper__=!0,b.support=FZ(),b.device=BZ({userAgent:o.userAgent}),b.browser=Ale(),b.eventsListeners={},b.eventsAnyListeners=[],b.modules=[...b.__modules__],o.modules&&Array.isArray(o.modules)&&b.modules.push(...o.modules);const S={};b.modules.forEach(k=>{k({params:o,swiper:b,extendParams:Mce(o,S),on:b.on.bind(b),once:b.once.bind(b),off:b.off.bind(b),emit:b.emit.bind(b)})});const T=Dh({},fj,S);return b.params=Dh({},T,xU,o),b.originalParams=Dh({},b.params),b.passedParams=Dh({},o),b.params&&b.params.on&&Object.keys(b.params.on).forEach(k=>{b.on(k,b.params.on[k])}),b.params&&b.params.onAny&&b.onAny(b.params.onAny),Object.assign(b,{enabled:b.params.enabled,el:n,classNames:[],slides:[],slidesGrid:[],snapGrid:[],slidesSizesGrid:[],isHorizontal(){return b.params.direction==="horizontal"},isVertical(){return b.params.direction==="vertical"},activeIndex:0,realIndex:0,isBeginning:!0,isEnd:!1,translate:0,previousTranslate:0,progress:0,velocity:0,animating:!1,cssOverflowAdjustment(){return Math.trunc(this.translate/2**23)*2**23},allowSlideNext:b.params.allowSlideNext,allowSlidePrev:b.params.allowSlidePrev,touchEventsData:{isTouched:void 0,isMoved:void 0,allowTouchCallbacks:void 0,touchStartTime:void 0,isScrolling:void 0,currentTranslate:void 0,startTranslate:void 0,allowThresholdMove:void 0,focusableElements:b.params.focusableElements,lastClickTime:0,clickTimeout:void 0,velocities:[],allowMomentumBounce:void 0,startMoving:void 0,pointerId:null,touchId:null},allowClick:!0,allowTouchMove:b.params.allowTouchMove,touches:{startX:0,startY:0,currentX:0,currentY:0,diff:0},imagesToLoad:[],imagesLoaded:0}),b.emit("_swiper"),b.params.init&&b.init(),b}getDirectionLabel(n){return this.isHorizontal()?n:{width:"height","margin-top":"margin-left","margin-bottom ":"margin-right","margin-left":"margin-top","margin-right":"margin-bottom","padding-left":"padding-top","padding-right":"padding-bottom",marginRight:"marginBottom"}[n]}getSlideIndex(n){const{slidesEl:o,params:i}=this,u=p0(o,`.${i.slideClass}, swiper-slide`),h=xB(u[0]);return xB(n)-h}getSlideIndexByData(n){return this.getSlideIndex(this.slides.filter(o=>o.getAttribute("data-swiper-slide-index")*1===n)[0])}recalcSlides(){const n=this,{slidesEl:o,params:i}=n;n.slides=p0(o,`.${i.slideClass}, swiper-slide`)}enable(){const n=this;n.enabled||(n.enabled=!0,n.params.grabCursor&&n.setGrabCursor(),n.emit("enable"))}disable(){const n=this;n.enabled&&(n.enabled=!1,n.params.grabCursor&&n.unsetGrabCursor(),n.emit("disable"))}setProgress(n,o){const i=this;n=Math.min(Math.max(n,0),1);const u=i.minTranslate(),g=(i.maxTranslate()-u)*n+u;i.translateTo(g,typeof o>"u"?0:o),i.updateActiveIndex(),i.updateSlidesClasses()}emitContainerClasses(){const n=this;if(!n.params._emitClasses||!n.el)return;const o=n.el.className.split(" ").filter(i=>i.indexOf("swiper")===0||i.indexOf(n.params.containerModifierClass)===0);n.emit("_containerClasses",o.join(" "))}getSlideClasses(n){const o=this;return o.destroyed?"":n.className.split(" ").filter(i=>i.indexOf("swiper-slide")===0||i.indexOf(o.params.slideClass)===0).join(" ")}emitSlidesClasses(){const n=this;if(!n.params._emitClasses||!n.el)return;const o=[];n.slides.forEach(i=>{const u=n.getSlideClasses(i);o.push({slideEl:i,classNames:u}),n.emit("_slideClass",i,u)}),n.emit("_slideClasses",o)}slidesPerViewDynamic(n,o){n===void 0&&(n="current"),o===void 0&&(o=!1);const i=this,{params:u,slides:h,slidesGrid:g,slidesSizesGrid:b,size:S,activeIndex:T}=i;let k=1;if(typeof u.slidesPerView=="number")return u.slidesPerView;if(u.centeredSlides){let R=h[T]?Math.ceil(h[T].swiperSlideSize):0,V;for(let z=T+1;z<h.length;z+=1)h[z]&&!V&&(R+=Math.ceil(h[z].swiperSlideSize),k+=1,R>S&&(V=!0));for(let z=T-1;z>=0;z-=1)h[z]&&!V&&(R+=h[z].swiperSlideSize,k+=1,R>S&&(V=!0))}else if(n==="current")for(let R=T+1;R<h.length;R+=1)(o?g[R]+b[R]-g[T]<S:g[R]-g[T]<S)&&(k+=1);else for(let R=T-1;R>=0;R-=1)g[T]-g[R]<S&&(k+=1);return k}update(){const n=this;if(!n||n.destroyed)return;const{snapGrid:o,params:i}=n;i.breakpoints&&n.setBreakpoint(),[...n.el.querySelectorAll('[loading="lazy"]')].forEach(g=>{g.complete&&K4(n,g)}),n.updateSize(),n.updateSlides(),n.updateProgress(),n.updateSlidesClasses();function u(){const g=n.rtlTranslate?n.translate*-1:n.translate,b=Math.min(Math.max(g,n.maxTranslate()),n.minTranslate());n.setTranslate(b),n.updateActiveIndex(),n.updateSlidesClasses()}let h;if(i.freeMode&&i.freeMode.enabled&&!i.cssMode)u(),i.autoHeight&&n.updateAutoHeight();else{if((i.slidesPerView==="auto"||i.slidesPerView>1)&&n.isEnd&&!i.centeredSlides){const g=n.virtual&&i.virtual.enabled?n.virtual.slides:n.slides;h=n.slideTo(g.length-1,0,!1,!0)}else h=n.slideTo(n.activeIndex,0,!1,!0);h||u()}i.watchOverflow&&o!==n.snapGrid&&n.checkOverflow(),n.emit("update")}changeDirection(n,o){o===void 0&&(o=!0);const i=this,u=i.params.direction;return n||(n=u==="horizontal"?"vertical":"horizontal"),n===u||n!=="horizontal"&&n!=="vertical"||(i.el.classList.remove(`${i.params.containerModifierClass}${u}`),i.el.classList.add(`${i.params.containerModifierClass}${n}`),i.emitContainerClasses(),i.params.direction=n,i.slides.forEach(h=>{n==="vertical"?h.style.width="":h.style.height=""}),i.emit("changeDirection"),o&&i.update()),i}changeLanguageDirection(n){const o=this;o.rtl&&n==="rtl"||!o.rtl&&n==="ltr"||(o.rtl=n==="rtl",o.rtlTranslate=o.params.direction==="horizontal"&&o.rtl,o.rtl?(o.el.classList.add(`${o.params.containerModifierClass}rtl`),o.el.dir="rtl"):(o.el.classList.remove(`${o.params.containerModifierClass}rtl`),o.el.dir="ltr"),o.update())}mount(n){const o=this;if(o.mounted)return!0;let i=n||o.params.el;if(typeof i=="string"&&(i=document.querySelector(i)),!i)return!1;i.swiper=o,i.parentNode&&i.parentNode.host&&i.parentNode.host.nodeName===o.params.swiperElementNodeName.toUpperCase()&&(o.isElement=!0);const u=()=>`.${(o.params.wrapperClass||"").trim().split(" ").join(".")}`;let g=i&&i.shadowRoot&&i.shadowRoot.querySelector?i.shadowRoot.querySelector(u()):p0(i,u())[0];return!g&&o.params.createElements&&(g=vB("div",o.params.wrapperClass),i.append(g),p0(i,`.${o.params.slideClass}`).forEach(b=>{g.append(b)})),Object.assign(o,{el:i,wrapperEl:g,slidesEl:o.isElement&&!i.parentNode.host.slideSlots?i.parentNode.host:g,hostEl:o.isElement?i.parentNode.host:i,mounted:!0,rtl:i.dir.toLowerCase()==="rtl"||c1(i,"direction")==="rtl",rtlTranslate:o.params.direction==="horizontal"&&(i.dir.toLowerCase()==="rtl"||c1(i,"direction")==="rtl"),wrongRTL:c1(g,"display")==="-webkit-box"}),!0}init(n){const o=this;if(o.initialized||o.mount(n)===!1)return o;o.emit("beforeInit"),o.params.breakpoints&&o.setBreakpoint(),o.addClasses(),o.updateSize(),o.updateSlides(),o.params.watchOverflow&&o.checkOverflow(),o.params.grabCursor&&o.enabled&&o.setGrabCursor(),o.params.loop&&o.virtual&&o.params.virtual.enabled?o.slideTo(o.params.initialSlide+o.virtual.slidesBefore,0,o.params.runCallbacksOnInit,!1,!0):o.slideTo(o.params.initialSlide,0,o.params.runCallbacksOnInit,!1,!0),o.params.loop&&o.loopCreate(),o.attachEvents();const u=[...o.el.querySelectorAll('[loading="lazy"]')];return o.isElement&&u.push(...o.hostEl.querySelectorAll('[loading="lazy"]')),u.forEach(h=>{h.complete?K4(o,h):h.addEventListener("load",g=>{K4(o,g.target)})}),hV(o),o.initialized=!0,hV(o),o.emit("init"),o.emit("afterInit"),o}destroy(n,o){n===void 0&&(n=!0),o===void 0&&(o=!0);const i=this,{params:u,el:h,wrapperEl:g,slides:b}=i;return typeof i.params>"u"||i.destroyed||(i.emit("beforeDestroy"),i.initialized=!1,i.detachEvents(),u.loop&&i.loopDestroy(),o&&(i.removeClasses(),h&&typeof h!="string"&&h.removeAttribute("style"),g&&g.removeAttribute("style"),b&&b.length&&b.forEach(S=>{S.classList.remove(u.slideVisibleClass,u.slideFullyVisibleClass,u.slideActiveClass,u.slideNextClass,u.slidePrevClass),S.removeAttribute("style"),S.removeAttribute("data-swiper-slide-index")})),i.emit("destroy"),Object.keys(i.eventsListeners).forEach(S=>{i.off(S)}),n!==!1&&(i.el&&typeof i.el!="string"&&(i.el.swiper=null),yle(i)),i.destroyed=!0),null}static extendDefaults(n){Dh(xU,n)}static get extendedDefaults(){return xU}static get defaults(){return fj}static installModule(n){Th.prototype.__modules__||(Th.prototype.__modules__=[]);const o=Th.prototype.__modules__;typeof n=="function"&&o.indexOf(n)<0&&o.push(n)}static use(n){return Array.isArray(n)?(n.forEach(o=>Th.installModule(o)),Th):(Th.installModule(n),Th)}}Object.keys(vU).forEach(l=>{Object.keys(vU[l]).forEach(n=>{Th.prototype[n]=vU[l][n]})});Th.use([Lle,Rle]);function UZ(l,n,o,i){return l.params.createElements&&Object.keys(i).forEach(u=>{if(!o[u]&&o.auto===!0){let h=p0(l.el,`.${i[u]}`)[0];h||(h=vB("div",i[u]),h.className=i[u],l.el.append(h)),o[u]=h,n[u]=h}}),o}function VZ(l){let{swiper:n,extendParams:o,on:i,emit:u}=l;o({navigation:{nextEl:null,prevEl:null,hideOnClick:!1,disabledClass:"swiper-button-disabled",hiddenClass:"swiper-button-hidden",lockClass:"swiper-button-lock",navigationDisabledClass:"swiper-navigation-disabled"}}),n.navigation={nextEl:null,prevEl:null};function h($){let W;return $&&typeof $=="string"&&n.isElement&&(W=n.el.querySelector($),W)?W:($&&(typeof $=="string"&&(W=[...document.querySelectorAll($)]),n.params.uniqueNavElements&&typeof $=="string"&&W&&W.length>1&&n.el.querySelectorAll($).length===1?W=n.el.querySelector($):W&&W.length===1&&(W=W[0])),$&&!W?$:W)}function g($,W){const Q=n.params.navigation;$=wu($),$.forEach(j=>{j&&(j.classList[W?"add":"remove"](...Q.disabledClass.split(" ")),j.tagName==="BUTTON"&&(j.disabled=W),n.params.watchOverflow&&n.enabled&&j.classList[n.isLocked?"add":"remove"](Q.lockClass))})}function b(){const{nextEl:$,prevEl:W}=n.navigation;if(n.params.loop){g(W,!1),g($,!1);return}g(W,n.isBeginning&&!n.params.rewind),g($,n.isEnd&&!n.params.rewind)}function S($){$.preventDefault(),!(n.isBeginning&&!n.params.loop&&!n.params.rewind)&&(n.slidePrev(),u("navigationPrev"))}function T($){$.preventDefault(),!(n.isEnd&&!n.params.loop&&!n.params.rewind)&&(n.slideNext(),u("navigationNext"))}function k(){const $=n.params.navigation;if(n.params.navigation=UZ(n,n.originalParams.navigation,n.params.navigation,{nextEl:"swiper-button-next",prevEl:"swiper-button-prev"}),!($.nextEl||$.prevEl))return;let W=h($.nextEl),Q=h($.prevEl);Object.assign(n.navigation,{nextEl:W,prevEl:Q}),W=wu(W),Q=wu(Q);const j=(se,re)=>{se&&se.addEventListener("click",re==="next"?T:S),!n.enabled&&se&&se.classList.add(...$.lockClass.split(" "))};W.forEach(se=>j(se,"next")),Q.forEach(se=>j(se,"prev"))}function R(){let{nextEl:$,prevEl:W}=n.navigation;$=wu($),W=wu(W);const Q=(j,se)=>{j.removeEventListener("click",se==="next"?T:S),j.classList.remove(...n.params.navigation.disabledClass.split(" "))};$.forEach(j=>Q(j,"next")),W.forEach(j=>Q(j,"prev"))}i("init",()=>{n.params.navigation.enabled===!1?z():(k(),b())}),i("toEdge fromEdge lock unlock",()=>{b()}),i("destroy",()=>{R()}),i("enable disable",()=>{let{nextEl:$,prevEl:W}=n.navigation;if($=wu($),W=wu(W),n.enabled){b();return}[...$,...W].filter(Q=>!!Q).forEach(Q=>Q.classList.add(n.params.navigation.lockClass))}),i("click",($,W)=>{let{nextEl:Q,prevEl:j}=n.navigation;Q=wu(Q),j=wu(j);const se=W.target;let re=j.includes(se)||Q.includes(se);if(n.isElement&&!re){const Y=W.path||W.composedPath&&W.composedPath();Y&&(re=Y.find(me=>Q.includes(me)||j.includes(me)))}if(n.params.navigation.hideOnClick&&!re){if(n.pagination&&n.params.pagination&&n.params.pagination.clickable&&(n.pagination.el===se||n.pagination.el.contains(se)))return;let Y;Q.length?Y=Q[0].classList.contains(n.params.navigation.hiddenClass):j.length&&(Y=j[0].classList.contains(n.params.navigation.hiddenClass)),u(Y===!0?"navigationShow":"navigationHide"),[...Q,...j].filter(me=>!!me).forEach(me=>me.classList.toggle(n.params.navigation.hiddenClass))}});const V=()=>{n.el.classList.remove(...n.params.navigation.navigationDisabledClass.split(" ")),k(),b()},z=()=>{n.el.classList.add(...n.params.navigation.navigationDisabledClass.split(" ")),R()};Object.assign(n.navigation,{enable:V,disable:z,update:b,init:k,destroy:R})}function LL(l){return l===void 0&&(l=""),`.${l.trim().replace(/([\.:!+\/])/g,"\\$1").replace(/ /g,".")}`}function Nce(l){let{swiper:n,extendParams:o,on:i,emit:u}=l;const h="swiper-pagination";o({pagination:{el:null,bulletElement:"span",clickable:!1,hideOnClick:!1,renderBullet:null,renderProgressbar:null,renderFraction:null,renderCustom:null,progressbarOpposite:!1,type:"bullets",dynamicBullets:!1,dynamicMainBullets:1,formatFractionCurrent:j=>j,formatFractionTotal:j=>j,bulletClass:`${h}-bullet`,bulletActiveClass:`${h}-bullet-active`,modifierClass:`${h}-`,currentClass:`${h}-current`,totalClass:`${h}-total`,hiddenClass:`${h}-hidden`,progressbarFillClass:`${h}-progressbar-fill`,progressbarOppositeClass:`${h}-progressbar-opposite`,clickableClass:`${h}-clickable`,lockClass:`${h}-lock`,horizontalClass:`${h}-horizontal`,verticalClass:`${h}-vertical`,paginationDisabledClass:`${h}-disabled`}}),n.pagination={el:null,bullets:[]};let g,b=0;function S(){return!n.params.pagination.el||!n.pagination.el||Array.isArray(n.pagination.el)&&n.pagination.el.length===0}function T(j,se){const{bulletActiveClass:re}=n.params.pagination;j&&(j=j[`${se==="prev"?"previous":"next"}ElementSibling`],j&&(j.classList.add(`${re}-${se}`),j=j[`${se==="prev"?"previous":"next"}ElementSibling`],j&&j.classList.add(`${re}-${se}-${se}`)))}function k(j){const se=j.target.closest(LL(n.params.pagination.bulletClass));if(!se)return;j.preventDefault();const re=xB(se)*n.params.slidesPerGroup;if(n.params.loop){if(n.realIndex===re)return;n.slideToLoop(re)}else n.slideTo(re)}function R(){const j=n.rtl,se=n.params.pagination;if(S())return;let re=n.pagination.el;re=wu(re);let Y,me;const ae=n.virtual&&n.params.virtual.enabled?n.virtual.slides.length:n.slides.length,Ce=n.params.loop?Math.ceil(ae/n.params.slidesPerGroup):n.snapGrid.length;if(n.params.loop?(me=n.previousRealIndex||0,Y=n.params.slidesPerGroup>1?Math.floor(n.realIndex/n.params.slidesPerGroup):n.realIndex):typeof n.snapIndex<"u"?(Y=n.snapIndex,me=n.previousSnapIndex):(me=n.previousIndex||0,Y=n.activeIndex||0),se.type==="bullets"&&n.pagination.bullets&&n.pagination.bullets.length>0){const Ue=n.pagination.bullets;let ot,Ae,ve;if(se.dynamicBullets&&(g=fV(Ue[0],n.isHorizontal()?"width":"height",!0),re.forEach(Oe=>{Oe.style[n.isHorizontal()?"width":"height"]=`${g*(se.dynamicMainBullets+4)}px`}),se.dynamicMainBullets>1&&me!==void 0&&(b+=Y-(me||0),b>se.dynamicMainBullets-1?b=se.dynamicMainBullets-1:b<0&&(b=0)),ot=Math.max(Y-b,0),Ae=ot+(Math.min(Ue.length,se.dynamicMainBullets)-1),ve=(Ae+ot)/2),Ue.forEach(Oe=>{const O=[...["","-next","-next-next","-prev","-prev-prev","-main"].map(De=>`${se.bulletActiveClass}${De}`)].map(De=>typeof De=="string"&&De.includes(" ")?De.split(" "):De).flat();Oe.classList.remove(...O)}),re.length>1)Ue.forEach(Oe=>{const O=xB(Oe);O===Y?Oe.classList.add(...se.bulletActiveClass.split(" ")):n.isElement&&Oe.setAttribute("part","bullet"),se.dynamicBullets&&(O>=ot&&O<=Ae&&Oe.classList.add(...`${se.bulletActiveClass}-main`.split(" ")),O===ot&&T(Oe,"prev"),O===Ae&&T(Oe,"next"))});else{const Oe=Ue[Y];if(Oe&&Oe.classList.add(...se.bulletActiveClass.split(" ")),n.isElement&&Ue.forEach((O,De)=>{O.setAttribute("part",De===Y?"bullet-active":"bullet")}),se.dynamicBullets){const O=Ue[ot],De=Ue[Ae];for(let Fe=ot;Fe<=Ae;Fe+=1)Ue[Fe]&&Ue[Fe].classList.add(...`${se.bulletActiveClass}-main`.split(" "));T(O,"prev"),T(De,"next")}}if(se.dynamicBullets){const Oe=Math.min(Ue.length,se.dynamicMainBullets+4),O=(g*Oe-g)/2-ve*g,De=j?"right":"left";Ue.forEach(Fe=>{Fe.style[n.isHorizontal()?De:"top"]=`${O}px`})}}re.forEach((Ue,ot)=>{if(se.type==="fraction"&&(Ue.querySelectorAll(LL(se.currentClass)).forEach(Ae=>{Ae.textContent=se.formatFractionCurrent(Y+1)}),Ue.querySelectorAll(LL(se.totalClass)).forEach(Ae=>{Ae.textContent=se.formatFractionTotal(Ce)})),se.type==="progressbar"){let Ae;se.progressbarOpposite?Ae=n.isHorizontal()?"vertical":"horizontal":Ae=n.isHorizontal()?"horizontal":"vertical";const ve=(Y+1)/Ce;let Oe=1,O=1;Ae==="horizontal"?Oe=ve:O=ve,Ue.querySelectorAll(LL(se.progressbarFillClass)).forEach(De=>{De.style.transform=`translate3d(0,0,0) scaleX(${Oe}) scaleY(${O})`,De.style.transitionDuration=`${n.params.speed}ms`})}se.type==="custom"&&se.renderCustom?(Ue.innerHTML=se.renderCustom(n,Y+1,Ce),ot===0&&u("paginationRender",Ue)):(ot===0&&u("paginationRender",Ue),u("paginationUpdate",Ue)),n.params.watchOverflow&&n.enabled&&Ue.classList[n.isLocked?"add":"remove"](se.lockClass)})}function V(){const j=n.params.pagination;if(S())return;const se=n.virtual&&n.params.virtual.enabled?n.virtual.slides.length:n.grid&&n.params.grid.rows>1?n.slides.length/Math.ceil(n.params.grid.rows):n.slides.length;let re=n.pagination.el;re=wu(re);let Y="";if(j.type==="bullets"){let me=n.params.loop?Math.ceil(se/n.params.slidesPerGroup):n.snapGrid.length;n.params.freeMode&&n.params.freeMode.enabled&&me>se&&(me=se);for(let ae=0;ae<me;ae+=1)j.renderBullet?Y+=j.renderBullet.call(n,ae,j.bulletClass):Y+=`<${j.bulletElement} ${n.isElement?'part="bullet"':""} class="${j.bulletClass}"></${j.bulletElement}>`}j.type==="fraction"&&(j.renderFraction?Y=j.renderFraction.call(n,j.currentClass,j.totalClass):Y=`<span class="${j.currentClass}"></span> / <span class="${j.totalClass}"></span>`),j.type==="progressbar"&&(j.renderProgressbar?Y=j.renderProgressbar.call(n,j.progressbarFillClass):Y=`<span class="${j.progressbarFillClass}"></span>`),n.pagination.bullets=[],re.forEach(me=>{j.type!=="custom"&&(me.innerHTML=Y||""),j.type==="bullets"&&n.pagination.bullets.push(...me.querySelectorAll(LL(j.bulletClass)))}),j.type!=="custom"&&u("paginationRender",re[0])}function z(){n.params.pagination=UZ(n,n.originalParams.pagination,n.params.pagination,{el:"swiper-pagination"});const j=n.params.pagination;if(!j.el)return;let se;typeof j.el=="string"&&n.isElement&&(se=n.el.querySelector(j.el)),!se&&typeof j.el=="string"&&(se=[...document.querySelectorAll(j.el)]),se||(se=j.el),!(!se||se.length===0)&&(n.params.uniqueNavElements&&typeof j.el=="string"&&Array.isArray(se)&&se.length>1&&(se=[...n.el.querySelectorAll(j.el)],se.length>1&&(se=se.filter(re=>NZ(re,".swiper")[0]===n.el)[0])),Array.isArray(se)&&se.length===1&&(se=se[0]),Object.assign(n.pagination,{el:se}),se=wu(se),se.forEach(re=>{j.type==="bullets"&&j.clickable&&re.classList.add(...(j.clickableClass||"").split(" ")),re.classList.add(j.modifierClass+j.type),re.classList.add(n.isHorizontal()?j.horizontalClass:j.verticalClass),j.type==="bullets"&&j.dynamicBullets&&(re.classList.add(`${j.modifierClass}${j.type}-dynamic`),b=0,j.dynamicMainBullets<1&&(j.dynamicMainBullets=1)),j.type==="progressbar"&&j.progressbarOpposite&&re.classList.add(j.progressbarOppositeClass),j.clickable&&re.addEventListener("click",k),n.enabled||re.classList.add(j.lockClass)}))}function $(){const j=n.params.pagination;if(S())return;let se=n.pagination.el;se&&(se=wu(se),se.forEach(re=>{re.classList.remove(j.hiddenClass),re.classList.remove(j.modifierClass+j.type),re.classList.remove(n.isHorizontal()?j.horizontalClass:j.verticalClass),j.clickable&&(re.classList.remove(...(j.clickableClass||"").split(" ")),re.removeEventListener("click",k))})),n.pagination.bullets&&n.pagination.bullets.forEach(re=>re.classList.remove(...j.bulletActiveClass.split(" ")))}i("changeDirection",()=>{if(!n.pagination||!n.pagination.el)return;const j=n.params.pagination;let{el:se}=n.pagination;se=wu(se),se.forEach(re=>{re.classList.remove(j.horizontalClass,j.verticalClass),re.classList.add(n.isHorizontal()?j.horizontalClass:j.verticalClass)})}),i("init",()=>{n.params.pagination.enabled===!1?Q():(z(),V(),R())}),i("activeIndexChange",()=>{typeof n.snapIndex>"u"&&R()}),i("snapIndexChange",()=>{R()}),i("snapGridLengthChange",()=>{V(),R()}),i("destroy",()=>{$()}),i("enable disable",()=>{let{el:j}=n.pagination;j&&(j=wu(j),j.forEach(se=>se.classList[n.enabled?"remove":"add"](n.params.pagination.lockClass)))}),i("lock unlock",()=>{R()}),i("click",(j,se)=>{const re=se.target,Y=wu(n.pagination.el);if(n.params.pagination.el&&n.params.pagination.hideOnClick&&Y&&Y.length>0&&!re.classList.contains(n.params.pagination.bulletClass)){if(n.navigation&&(n.navigation.nextEl&&re===n.navigation.nextEl||n.navigation.prevEl&&re===n.navigation.prevEl))return;const me=Y[0].classList.contains(n.params.pagination.hiddenClass);u(me===!0?"paginationShow":"paginationHide"),Y.forEach(ae=>ae.classList.toggle(n.params.pagination.hiddenClass))}});const W=()=>{n.el.classList.remove(n.params.pagination.paginationDisabledClass);let{el:j}=n.pagination;j&&(j=wu(j),j.forEach(se=>se.classList.remove(n.params.pagination.paginationDisabledClass))),z(),V(),R()},Q=()=>{n.el.classList.add(n.params.pagination.paginationDisabledClass);let{el:j}=n.pagination;j&&(j=wu(j),j.forEach(se=>se.classList.add(n.params.pagination.paginationDisabledClass))),$()};Object.assign(n.pagination,{enable:W,disable:Q,render:V,update:R,init:z,destroy:$})}class Fce{constructor(){this.init()}init(){this.bindContentCarousels(),this.bindPhotoCarousels()}bindContentCarousels(){document.querySelectorAll("[data-sb-content-carousel]").forEach(o=>{new $ce(o)})}bindPhotoCarousels(){document.querySelectorAll(".js-carousel").forEach(o=>{new Bce(o)})}}class Bce{constructor(n){this.element=n,this.init()}init(){this.initCarousel()}initCarousel(){this.swiper=new Th(this.element,{modules:[VZ,Nce],direction:"horizontal",loop:!0,navigation:{nextEl:".js-carousel-button-next",prevEl:".js-carousel-button-prev"}})}}class $ce{constructor(n){this.element=n,this.threshold=1024,this.init()}init(){this.initCarousel(),this.handleResize(),window.addEventListener("resize",this.handleResize.bind(this))}initCarousel(){console.log(window.innerWidth),window.innerWidth<this.threshold&&(this.swiper=new Th(this.element,{modules:[VZ],direction:"horizontal",loop:!1,navigation:{nextEl:".js-carousel-button-next",prevEl:".js-carousel-button-prev"},slidesOffsetBefore:20,slidesOffsetAfter:20,slidesPerView:1.2,spaceBetween:20,breakpoints:{400:{slidesPerView:2.4,spaceBetween:20}}}))}handleResize(){window.innerWidth<this.threshold?this.swiper||this.initCarousel():this.swiper&&(this.swiper.destroy(!0,!0),this.swiper=null)}}class Hce{constructor(){this.init()}init(){this.bindFaqs()}bindFaqs(){document.querySelectorAll(".js-faqs").forEach(o=>{new Uce(o)})}}class Uce{constructor(n){this.element=n,this.openFaq=null,this.init()}init(){this.bindFaqs()}bindFaqs(){this.element.querySelectorAll(".js-faq").forEach(o=>{new Vce(o,this)})}closeOpenFaq(){this.openFaq&&(this.openFaq.closeFaq(),this.openFaq=null)}}class Vce{constructor(n,o){this.element=n,this.question=this.element.querySelector(".js-question"),this.answer=this.element.querySelector(".js-answer"),this.isOpen=!1,this.faqSectionInstance=o,this.init()}init(){console.log("init faq",this.element),this.initFaq(),this.bindEvents()}initFaq(){a1.set(this.answer,{height:0,overflow:"hidden"})}bindEvents(){a1.set(this.answer,{height:this.element.dataset.open==="true"?"auto":0,overflow:"hidden"})}toggleFaq(){console.log("toggleFaq"),this.isOpen?this.closeFaq():(this.faqSectionInstance.closeOpenFaq(),this.openFaq(),this.faqSectionInstance.openFaq=this)}openFaq(){a1.to(this.answer,{height:"auto",duration:.3,ease:"power2.inOut"}),this.isOpen=!0}closeFaq(){a1.to(this.answer,{height:0,duration:.3,ease:"power2.inOut"}),this.isOpen=!1}}var zce=Object.defineProperty,Gce=(l,n,o)=>n in l?zce(l,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):l[n]=o,ra=(l,n,o)=>(Gce(l,typeof n!="symbol"?n+"":n,o),o);const Wce=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,jce=/^-?[0-9]\d*$/,Kce=/^(?=.*[A-Za-z])(?=.*\d).{8,}$/,Zce=/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/,qce=l=>{let n=l;return typeof l=="string"&&(n=l.trim()),!n},Yce=l=>Wce.test(l),Xce=(l,n)=>l.length>n,Jce=(l,n)=>l.length<n,Qce=l=>typeof l!="string"?!1:!isNaN(+l)&&!isNaN(parseFloat(l)),eue=l=>jce.test(l),tue=l=>Kce.test(l),nue=l=>Zce.test(l),oue=(l,n)=>l>n,sue=(l,n)=>l<n,Zb=l=>typeof l!="string"||l==="";var gi=(l=>(l.Required="required",l.Email="email",l.MinLength="minLength",l.MaxLength="maxLength",l.Password="password",l.Number="number",l.Integer="integer",l.MaxNumber="maxNumber",l.MinNumber="minNumber",l.StrongPassword="strongPassword",l.CustomRegexp="customRegexp",l.MinFilesCount="minFilesCount",l.MaxFilesCount="maxFilesCount",l.Files="files",l))(gi||{}),mV=(l=>(l.Required="required",l))(mV||{}),zZ=(l=>(l.Label="label",l.LabelArrow="labelArrow",l))(zZ||{});const hj=[{key:gi.Required,dict:{en:"The field is required"}},{key:gi.Email,dict:{en:"Email has invalid format"}},{key:gi.MaxLength,dict:{en:"The field must contain a maximum of :value characters"}},{key:gi.MinLength,dict:{en:"The field must contain a minimum of :value characters"}},{key:gi.Password,dict:{en:"Password must contain minimum eight characters, at least one letter and one number"}},{key:gi.StrongPassword,dict:{en:"Password should contain minimum eight characters, at least one uppercase letter, one lowercase letter, one number and one special character"}},{key:gi.Number,dict:{en:"Value should be a number"}},{key:gi.MaxNumber,dict:{en:"Number should be less or equal than :value"}},{key:gi.MinNumber,dict:{en:"Number should be more or equal than :value"}},{key:gi.MinFilesCount,dict:{en:"Files count should be more or equal than :value"}},{key:gi.MaxFilesCount,dict:{en:"Files count should be less or equal than :value"}},{key:gi.Files,dict:{en:"Uploaded files have one or several invalid properties (extension/size/type etc)."}}],rue="Value is incorrect",RL=l=>typeof l=="object"&&l!==null&&"then"in l&&typeof l.then=="function",iue=l=>{let n=l;const o=[];for(;n;)o.unshift(n),n=n.parentNode;return o},aue=(l,n)=>{const o=[...n].reverse();for(let i=0,u=o.length;i<u;++i){const h=o[i];for(const g in l){const b=l[g];if(b.groupElem===h)return[g,b]}}return null},l0=l=>Array.isArray(l)?l.filter(n=>n.length>0):typeof l=="string"&&l.trim()?[...l.split(" ").filter(n=>n.length>0)]:[],OL=l=>l instanceof Element||l instanceof HTMLDocument,lue=".just-validate-error-label[data-tooltip=true]{position:fixed;padding:4px 8px;background:#423f3f;color:#fff;white-space:nowrap;z-index:10;border-radius:4px;transform:translateY(-5px)}.just-validate-error-label[data-tooltip=true]:before{content:'';width:0;height:0;border-left:solid 5px transparent;border-right:solid 5px transparent;border-bottom:solid 5px #423f3f;position:absolute;z-index:3;display:block;bottom:-5px;transform:rotate(180deg);left:calc(50% - 5px)}.just-validate-error-label[data-tooltip=true][data-direction=left]{transform:translateX(-5px)}.just-validate-error-label[data-tooltip=true][data-direction=left]:before{right:-7px;bottom:auto;left:auto;top:calc(50% - 2px);transform:rotate(90deg)}.just-validate-error-label[data-tooltip=true][data-direction=right]{transform:translateX(5px)}.just-validate-error-label[data-tooltip=true][data-direction=right]:before{right:auto;bottom:auto;left:-7px;top:calc(50% - 2px);transform:rotate(-90deg)}.just-validate-error-label[data-tooltip=true][data-direction=bottom]{transform:translateY(5px)}.just-validate-error-label[data-tooltip=true][data-direction=bottom]:before{right:auto;bottom:auto;left:calc(50% - 5px);top:-5px;transform:rotate(0)}",y4=5,yU={errorFieldStyle:{color:"#b81111",border:"1px solid #B81111"},errorFieldCssClass:"just-validate-error-field",successFieldCssClass:"just-validate-success-field",errorLabelStyle:{color:"#b81111"},errorLabelCssClass:"just-validate-error-label",successLabelCssClass:"just-validate-success-label",focusInvalidField:!0,lockForm:!0,testingMode:!1,validateBeforeSubmitting:!1,submitFormAutomatically:!1};class cue{constructor(n,o,i){ra(this,"form",null),ra(this,"fields",{}),ra(this,"groupFields",{}),ra(this,"errors",{}),ra(this,"isValid",!1),ra(this,"isSubmitted",!1),ra(this,"globalConfig",yU),ra(this,"errorLabels",{}),ra(this,"successLabels",{}),ra(this,"eventListeners",[]),ra(this,"dictLocale",hj),ra(this,"currentLocale","en"),ra(this,"customStyleTags",{}),ra(this,"onSuccessCallback"),ra(this,"onFailCallback"),ra(this,"onValidateCallback"),ra(this,"tooltips",[]),ra(this,"lastScrollPosition"),ra(this,"isScrollTick"),ra(this,"fieldIds",new Map),ra(this,"getKeyByFieldSelector",u=>this.fieldIds.get(u)),ra(this,"getFieldSelectorByKey",u=>{for(const[h,g]of this.fieldIds)if(u===g)return h}),ra(this,"getCompatibleFields",()=>{const u={};return Object.keys(this.fields).forEach(h=>{let g=h;const b=this.getFieldSelectorByKey(h);typeof b=="string"&&(g=b),u[g]={...this.fields[h]}}),u}),ra(this,"setKeyByFieldSelector",u=>{if(this.fieldIds.has(u))return this.fieldIds.get(u);const h=String(this.fieldIds.size+1);return this.fieldIds.set(u,h),h}),ra(this,"refreshAllTooltips",()=>{this.tooltips.forEach(u=>{u.refresh()})}),ra(this,"handleDocumentScroll",()=>{this.lastScrollPosition=window.scrollY,this.isScrollTick||(window.requestAnimationFrame(()=>{this.refreshAllTooltips(),this.isScrollTick=!1}),this.isScrollTick=!0)}),ra(this,"formSubmitHandler",u=>{u.preventDefault(),this.isSubmitted=!0,this.validateHandler(u)}),ra(this,"handleFieldChange",u=>{let h;for(const g in this.fields)if(this.fields[g].elem===u){h=g;break}h&&(this.fields[h].touched=!0,this.validateField(h,!0))}),ra(this,"handleGroupChange",u=>{let h;for(const g in this.groupFields)if(this.groupFields[g].elems.find(S=>S===u)){h=g;break}h&&(this.groupFields[h].touched=!0,this.validateGroup(h,!0))}),ra(this,"handlerChange",u=>{u.target&&(this.handleFieldChange(u.target),this.handleGroupChange(u.target),this.renderErrors())}),this.initialize(n,o,i)}initialize(n,o,i){if(this.form=null,this.errors={},this.isValid=!1,this.isSubmitted=!1,this.globalConfig=yU,this.errorLabels={},this.successLabels={},this.eventListeners=[],this.customStyleTags={},this.tooltips=[],this.currentLocale="en",typeof n=="string"){const u=document.querySelector(n);if(!u)throw Error(`Form with ${n} selector not found! Please check the form selector`);this.setForm(u)}else if(n instanceof HTMLFormElement)this.setForm(n);else throw Error("Form selector is not valid. Please specify a string selector or a DOM element.");if(this.globalConfig={...yU,...o},i&&(this.dictLocale=[...i,...hj]),this.isTooltip()){const u=document.createElement("style");u.textContent=lue,this.customStyleTags[zZ.Label]=document.head.appendChild(u),this.addListener("scroll",document,this.handleDocumentScroll)}}getLocalisedString(n,o,i){var u;const h=i??n;let g=(u=this.dictLocale.find(b=>b.key===h))==null?void 0:u.dict[this.currentLocale];if(g||i&&(g=i),g&&o!==void 0)switch(n){case gi.MaxLength:case gi.MinLength:case gi.MaxNumber:case gi.MinNumber:case gi.MinFilesCount:case gi.MaxFilesCount:g=g.replace(":value",String(o))}return g||i||rue}getFieldErrorMessage(n,o){const i=typeof n.errorMessage=="function"?n.errorMessage(this.getElemValue(o),this.fields):n.errorMessage;return this.getLocalisedString(n.rule,n.value,i)}getFieldSuccessMessage(n,o){const i=typeof n=="function"?n(this.getElemValue(o),this.fields):n;return this.getLocalisedString(void 0,void 0,i)}getGroupErrorMessage(n){return this.getLocalisedString(n.rule,void 0,n.errorMessage)}getGroupSuccessMessage(n){if(n.successMessage)return this.getLocalisedString(void 0,void 0,n.successMessage)}setFieldInvalid(n,o){this.fields[n].isValid=!1,this.fields[n].errorMessage=this.getFieldErrorMessage(o,this.fields[n].elem)}setFieldValid(n,o){this.fields[n].isValid=!0,o!==void 0&&(this.fields[n].successMessage=this.getFieldSuccessMessage(o,this.fields[n].elem))}setGroupInvalid(n,o){this.groupFields[n].isValid=!1,this.groupFields[n].errorMessage=this.getGroupErrorMessage(o)}setGroupValid(n,o){this.groupFields[n].isValid=!0,this.groupFields[n].successMessage=this.getGroupSuccessMessage(o)}getElemValue(n){switch(n.type){case"checkbox":return n.checked;case"file":return n.files;default:return n.value}}validateGroupRule(n,o,i){switch(i.rule){case mV.Required:o.every(u=>!u.checked)?this.setGroupInvalid(n,i):this.setGroupValid(n,i)}}validateFieldRule(n,o,i,u=!1){const h=i.value,g=this.getElemValue(o);if(i.plugin){i.plugin(g,this.getCompatibleFields())||this.setFieldInvalid(n,i);return}switch(i.rule){case gi.Required:{qce(g)&&this.setFieldInvalid(n,i);break}case gi.Email:{if(Zb(g))break;Yce(g)||this.setFieldInvalid(n,i);break}case gi.MaxLength:{if(h===void 0){console.error(`Value for ${i.rule} rule for [${n}] field is not defined. The field will be always invalid.`),this.setFieldInvalid(n,i);break}if(typeof h!="number"){console.error(`Value for ${i.rule} rule for [${n}] should be a number. The field will be always invalid.`),this.setFieldInvalid(n,i);break}if(Zb(g))break;Xce(g,h)&&this.setFieldInvalid(n,i);break}case gi.MinLength:{if(h===void 0){console.error(`Value for ${i.rule} rule for [${n}] field is not defined. The field will be always invalid.`),this.setFieldInvalid(n,i);break}if(typeof h!="number"){console.error(`Value for ${i.rule} rule for [${n}] should be a number. The field will be always invalid.`),this.setFieldInvalid(n,i);break}if(Zb(g))break;Jce(g,h)&&this.setFieldInvalid(n,i);break}case gi.Password:{if(Zb(g))break;tue(g)||this.setFieldInvalid(n,i);break}case gi.StrongPassword:{if(Zb(g))break;nue(g)||this.setFieldInvalid(n,i);break}case gi.Number:{if(Zb(g))break;Qce(g)||this.setFieldInvalid(n,i);break}case gi.Integer:{if(Zb(g))break;eue(g)||this.setFieldInvalid(n,i);break}case gi.MaxNumber:{if(h===void 0){console.error(`Value for ${i.rule} rule for [${n}] field is not defined. The field will be always invalid.`),this.setFieldInvalid(n,i);break}if(typeof h!="number"){console.error(`Value for ${i.rule} rule for [${n}] field should be a number. The field will be always invalid.`),this.setFieldInvalid(n,i);break}if(Zb(g))break;const b=+g;(Number.isNaN(b)||oue(b,h))&&this.setFieldInvalid(n,i);break}case gi.MinNumber:{if(h===void 0){console.error(`Value for ${i.rule} rule for [${n}] field is not defined. The field will be always invalid.`),this.setFieldInvalid(n,i);break}if(typeof h!="number"){console.error(`Value for ${i.rule} rule for [${n}] field should be a number. The field will be always invalid.`),this.setFieldInvalid(n,i);break}if(Zb(g))break;const b=+g;(Number.isNaN(b)||sue(b,h))&&this.setFieldInvalid(n,i);break}case gi.CustomRegexp:{if(h===void 0){console.error(`Value for ${i.rule} rule for [${n}] field is not defined. This field will be always invalid.`),this.setFieldInvalid(n,i);return}let b;try{b=new RegExp(h)}catch{console.error(`Value for ${i.rule} rule for [${n}] should be a valid regexp. This field will be always invalid.`),this.setFieldInvalid(n,i);break}const S=String(g);S!==""&&!b.test(S)&&this.setFieldInvalid(n,i);break}case gi.MinFilesCount:{if(h===void 0){console.error(`Value for ${i.rule} rule for [${n}] field is not defined. This field will be always invalid.`),this.setFieldInvalid(n,i);break}if(typeof h!="number"){console.error(`Value for ${i.rule} rule for [${n}] field should be a number. The field will be always invalid.`),this.setFieldInvalid(n,i);break}if(Number.isFinite(g==null?void 0:g.length)&&g.length<h){this.setFieldInvalid(n,i);break}break}case gi.MaxFilesCount:{if(h===void 0){console.error(`Value for ${i.rule} rule for [${n}] field is not defined. This field will be always invalid.`),this.setFieldInvalid(n,i);break}if(typeof h!="number"){console.error(`Value for ${i.rule} rule for [${n}] field should be a number. The field will be always invalid.`),this.setFieldInvalid(n,i);break}if(Number.isFinite(g==null?void 0:g.length)&&g.length>h){this.setFieldInvalid(n,i);break}break}case gi.Files:{if(h===void 0){console.error(`Value for ${i.rule} rule for [${n}] field is not defined. This field will be always invalid.`),this.setFieldInvalid(n,i);return}if(typeof h!="object"){console.error(`Value for ${i.rule} rule for [${n}] field should be an object. This field will be always invalid.`),this.setFieldInvalid(n,i);return}const b=h.files;if(typeof b!="object"){console.error(`Value for ${i.rule} rule for [${n}] field should be an object with files array. This field will be always invalid.`),this.setFieldInvalid(n,i);return}const S=(T,k)=>{const R=Number.isFinite(k.minSize)&&T.size<k.minSize,V=Number.isFinite(k.maxSize)&&T.size>k.maxSize,z=Array.isArray(k.names)&&!k.names.includes(T.name),$=Array.isArray(k.extensions)&&!k.extensions.includes(T.name.split(".")[T.name.split(".").length-1]),W=Array.isArray(k.types)&&!k.types.includes(T.type);return R||V||z||$||W};if(typeof g=="object"&&g!==null)for(let T=0,k=g.length;T<k;++T){const R=g.item(T);if(!R){this.setFieldInvalid(n,i);break}if(S(R,b)){this.setFieldInvalid(n,i);break}}break}default:{if(typeof i.validator!="function"){console.error(`Validator for custom rule for [${n}] field should be a function. This field will be always invalid.`),this.setFieldInvalid(n,i);return}const b=i.validator(g,this.getCompatibleFields());if(typeof b!="boolean"&&typeof b!="function"&&console.error(`Validator return value for [${n}] field should be boolean or function. It will be cast to boolean.`),typeof b=="function")if(u)this.fields[n].asyncCheckPending=!0;else{this.fields[n].asyncCheckPending=!1;const S=b();if(!RL(S)){console.error(`Validator function for custom rule for [${n}] field should return a Promise. This field will be always invalid.`),this.setFieldInvalid(n,i);return}return S.then(T=>{T||this.setFieldInvalid(n,i)}).catch(()=>{this.setFieldInvalid(n,i)})}b||this.setFieldInvalid(n,i)}}}isFormValid(){let n=!0;for(let o=0,i=Object.values(this.fields).length;o<i;++o){const u=Object.values(this.fields)[o];if(u.isValid===void 0){n=void 0;break}if(u.isValid===!1){n=!1;break}}for(let o=0,i=Object.values(this.groupFields).length;o<i;++o){const u=Object.values(this.groupFields)[o];if(u.isValid===void 0){n=void 0;break}if(u.isValid===!1){n=!1;break}}return n}validateField(n,o=!1){var i;const u=this.fields[n];u.isValid=!0;const h=[];return[...u.rules].reverse().forEach(g=>{const b=this.validateFieldRule(n,u.elem,g,o);RL(b)&&h.push(b)}),u.isValid&&this.setFieldValid(n,(i=u.config)==null?void 0:i.successMessage),Promise.allSettled(h).finally(()=>{var g;o&&((g=this.onValidateCallback)==null||g.call(this,{isValid:this.isFormValid(),isSubmitted:this.isSubmitted,fields:this.getCompatibleFields(),groups:{...this.groupFields}}))})}revalidateField(n){if(typeof n!="string"&&!OL(n))throw Error("Field selector is not valid. Please specify a string selector or a valid DOM element.");const o=this.getKeyByFieldSelector(n);return!o||!this.fields[o]?(console.error("Field not found. Check the field selector."),Promise.reject()):new Promise(i=>{this.validateField(o,!0).finally(()=>{this.clearFieldStyle(o),this.clearFieldLabel(o),this.renderFieldError(o,!0),i(!!this.fields[o].isValid)})})}revalidateGroup(n){if(typeof n!="string"&&!OL(n))throw Error("Group selector is not valid. Please specify a string selector or a valid DOM element.");const o=this.getKeyByFieldSelector(n);return!o||!this.groupFields[o]?(console.error("Group not found. Check the group selector."),Promise.reject()):new Promise(i=>{this.validateGroup(o).finally(()=>{this.clearFieldLabel(o),this.renderGroupError(o,!0),i(!!this.groupFields[o].isValid)})})}validateGroup(n,o=!1){const i=this.groupFields[n],u=[];return[...i.rules].reverse().forEach(h=>{const g=this.validateGroupRule(n,i.elems,h);RL(g)&&u.push(g)}),Promise.allSettled(u).finally(()=>{var h;o&&((h=this.onValidateCallback)==null||h.call(this,{isValid:this.isFormValid(),isSubmitted:this.isSubmitted,fields:this.getCompatibleFields(),groups:{...this.groupFields}}))})}focusInvalidField(){for(const n in this.fields){const o=this.fields[n];if(!o.isValid){setTimeout(()=>o.elem.focus(),0);break}}}afterSubmitValidation(n=!1){this.renderErrors(n),this.globalConfig.focusInvalidField&&this.focusInvalidField()}validate(n=!1){return new Promise(o=>{const i=[];Object.keys(this.fields).forEach(u=>{const h=this.validateField(u);RL(h)&&i.push(h)}),Object.keys(this.groupFields).forEach(u=>{const h=this.validateGroup(u);RL(h)&&i.push(h)}),Promise.allSettled(i).then(()=>{var u;this.afterSubmitValidation(n),(u=this.onValidateCallback)==null||u.call(this,{isValid:this.isFormValid(),isSubmitted:this.isSubmitted,fields:this.getCompatibleFields(),groups:{...this.groupFields}}),o(!!i.length)})})}revalidate(){return new Promise(n=>{this.validateHandler(void 0,!0).finally(()=>{this.globalConfig.focusInvalidField&&this.focusInvalidField(),n(this.isValid)})})}validateHandler(n,o=!1){return this.globalConfig.lockForm&&this.lockForm(),this.validate(o).finally(()=>{var i,u,h;this.globalConfig.lockForm&&this.unlockForm(),this.isValid?((i=this.onSuccessCallback)==null||i.call(this,n),this.globalConfig.submitFormAutomatically&&((u=n==null?void 0:n.currentTarget)==null||u.submit())):(h=this.onFailCallback)==null||h.call(this,this.getCompatibleFields(),this.groupFields)})}setForm(n){this.form=n,this.form.setAttribute("novalidate","novalidate"),this.removeListener("submit",this.form,this.formSubmitHandler),this.addListener("submit",this.form,this.formSubmitHandler)}addListener(n,o,i){o.addEventListener(n,i),this.eventListeners.push({type:n,elem:o,func:i})}removeListener(n,o,i){o.removeEventListener(n,i),this.eventListeners=this.eventListeners.filter(u=>u.type!==n||u.elem!==o)}addField(n,o,i){if(typeof n!="string"&&!OL(n))throw Error("Field selector is not valid. Please specify a string selector or a valid DOM element.");let u;if(typeof n=="string"?u=this.form.querySelector(n):u=n,!u)throw Error("Field doesn't exist in the DOM! Please check the field selector.");if(!Array.isArray(o)||!o.length)throw Error("Rules argument should be an array and should contain at least 1 element.");o.forEach(g=>{if(!("rule"in g||"validator"in g||"plugin"in g))throw Error("Rules argument must contain at least one rule or validator property.");if(!g.validator&&!g.plugin&&(!g.rule||!Object.values(gi).includes(g.rule)))throw Error(`Rule should be one of these types: ${Object.values(gi).join(", ")}. Provided value: ${g.rule}`)});const h=this.setKeyByFieldSelector(n);return this.fields[h]={elem:u,rules:o,isValid:void 0,touched:!1,config:i},this.setListeners(u),(this.isSubmitted||this.globalConfig.validateBeforeSubmitting)&&this.validateField(h),this}removeField(n){if(typeof n!="string"&&!OL(n))throw Error("Field selector is not valid. Please specify a string selector or a valid DOM element.");const o=this.getKeyByFieldSelector(n);if(!o||!this.fields[o])return console.error("Field not found. Check the field selector."),this;const i=this.getListenerType(this.fields[o].elem.type);return this.removeListener(i,this.fields[o].elem,this.handlerChange),this.clearErrors(),delete this.fields[o],this}removeGroup(n){if(typeof n!="string")throw Error("Group selector is not valid. Please specify a string selector.");const o=this.getKeyByFieldSelector(n);return!o||!this.groupFields[o]?(console.error("Group not found. Check the group selector."),this):(this.groupFields[o].elems.forEach(i=>{const u=this.getListenerType(i.type);this.removeListener(u,i,this.handlerChange)}),this.clearErrors(),delete this.groupFields[o],this)}addRequiredGroup(n,o,i,u){if(typeof n!="string"&&!OL(n))throw Error("Group selector is not valid. Please specify a string selector or a valid DOM element.");let h;if(typeof n=="string"?h=this.form.querySelector(n):h=n,!h)throw Error("Group selector not found! Please check the group selector.");const g=h.querySelectorAll("input"),b=Array.from(g).filter(T=>{const k=aue(this.groupFields,iue(T));return k?k[1].elems.find(R=>R!==T):!0}),S=this.setKeyByFieldSelector(n);return this.groupFields[S]={rules:[{rule:mV.Required,errorMessage:o,successMessage:u}],groupElem:h,elems:b,touched:!1,isValid:void 0,config:i},g.forEach(T=>{this.setListeners(T)}),this}getListenerType(n){switch(n){case"checkbox":case"select-one":case"file":case"radio":return"change";default:return"input"}}setListeners(n){const o=this.getListenerType(n.type);this.removeListener(o,n,this.handlerChange),this.addListener(o,n,this.handlerChange)}clearFieldLabel(n){var o,i;(o=this.errorLabels[n])==null||o.remove(),(i=this.successLabels[n])==null||i.remove()}clearFieldStyle(n){var o,i,u,h;const g=this.fields[n],b=((o=g.config)==null?void 0:o.errorFieldStyle)||this.globalConfig.errorFieldStyle;Object.keys(b).forEach(T=>{g.elem.style[T]=""});const S=((i=g.config)==null?void 0:i.successFieldStyle)||this.globalConfig.successFieldStyle||{};Object.keys(S).forEach(T=>{g.elem.style[T]=""}),g.elem.classList.remove(...l0(((u=g.config)==null?void 0:u.errorFieldCssClass)||this.globalConfig.errorFieldCssClass),...l0(((h=g.config)==null?void 0:h.successFieldCssClass)||this.globalConfig.successFieldCssClass))}clearErrors(){var n,o;Object.keys(this.errorLabels).forEach(i=>this.errorLabels[i].remove()),Object.keys(this.successLabels).forEach(i=>this.successLabels[i].remove());for(const i in this.fields)this.clearFieldStyle(i);for(const i in this.groupFields){const u=this.groupFields[i],h=((n=u.config)==null?void 0:n.errorFieldStyle)||this.globalConfig.errorFieldStyle;Object.keys(h).forEach(b=>{u.elems.forEach(S=>{var T;S.style[b]="",S.classList.remove(...l0(((T=u.config)==null?void 0:T.errorFieldCssClass)||this.globalConfig.errorFieldCssClass))})});const g=((o=u.config)==null?void 0:o.successFieldStyle)||this.globalConfig.successFieldStyle||{};Object.keys(g).forEach(b=>{u.elems.forEach(S=>{var T;S.style[b]="",S.classList.remove(...l0(((T=u.config)==null?void 0:T.successFieldCssClass)||this.globalConfig.successFieldCssClass))})})}this.tooltips=[]}isTooltip(){return!!this.globalConfig.tooltip}lockForm(){const n=this.form.querySelectorAll("input, textarea, button, select");for(let o=0,i=n.length;o<i;++o)n[o].setAttribute("data-just-validate-fallback-disabled",n[o].disabled?"true":"false"),n[o].setAttribute("disabled","disabled"),n[o].style.pointerEvents="none",n[o].style.webkitFilter="grayscale(100%)",n[o].style.filter="grayscale(100%)"}unlockForm(){const n=this.form.querySelectorAll("input, textarea, button, select");for(let o=0,i=n.length;o<i;++o)n[o].getAttribute("data-just-validate-fallback-disabled")!=="true"&&n[o].removeAttribute("disabled"),n[o].style.pointerEvents="",n[o].style.webkitFilter="",n[o].style.filter=""}renderTooltip(n,o,i){var u;const{top:h,left:g,width:b,height:S}=n.getBoundingClientRect(),T=o.getBoundingClientRect(),k=i||((u=this.globalConfig.tooltip)==null?void 0:u.position);switch(k){case"left":{o.style.top=`${h+S/2-T.height/2}px`,o.style.left=`${g-T.width-y4}px`;break}case"top":{o.style.top=`${h-T.height-y4}px`,o.style.left=`${g+b/2-T.width/2}px`;break}case"right":{o.style.top=`${h+S/2-T.height/2}px`,o.style.left=`${g+b+y4}px`;break}case"bottom":{o.style.top=`${h+S+y4}px`,o.style.left=`${g+b/2-T.width/2}px`;break}}return o.dataset.direction=k,{refresh:()=>{this.renderTooltip(n,o,i)}}}createErrorLabelElem(n,o,i){const u=document.createElement("div");u.innerHTML=o;const h=this.isTooltip()?i==null?void 0:i.errorLabelStyle:(i==null?void 0:i.errorLabelStyle)||this.globalConfig.errorLabelStyle;return Object.assign(u.style,h),u.classList.add(...l0((i==null?void 0:i.errorLabelCssClass)||this.globalConfig.errorLabelCssClass),"just-validate-error-label"),this.isTooltip()&&(u.dataset.tooltip="true"),this.globalConfig.testingMode&&(u.dataset.testId=`error-label-${n}`),this.errorLabels[n]=u,u}createSuccessLabelElem(n,o,i){if(o===void 0)return null;const u=document.createElement("div");u.innerHTML=o;const h=(i==null?void 0:i.successLabelStyle)||this.globalConfig.successLabelStyle;return Object.assign(u.style,h),u.classList.add(...l0((i==null?void 0:i.successLabelCssClass)||this.globalConfig.successLabelCssClass),"just-validate-success-label"),this.globalConfig.testingMode&&(u.dataset.testId=`success-label-${n}`),this.successLabels[n]=u,u}renderErrorsContainer(n,o){const i=o||this.globalConfig.errorsContainer;if(typeof i=="string"){const u=this.form.querySelector(i);if(u)return u.appendChild(n),!0;console.error(`Error container with ${i} selector not found. Errors will be rendered as usual`)}return i instanceof Element?(i.appendChild(n),!0):(i!==void 0&&console.error("Error container not found. It should be a string or existing Element. Errors will be rendered as usual"),!1)}renderGroupLabel(n,o,i,u){!u&&this.renderErrorsContainer(o,i)||n.appendChild(o)}renderFieldLabel(n,o,i,u){var h,g,b,S,T,k,R;if(!(!u&&this.renderErrorsContainer(o,i)))if(n.type==="checkbox"||n.type==="radio"){const V=document.querySelector(`label[for="${n.getAttribute("id")}"]`);((g=(h=n.parentElement)==null?void 0:h.tagName)==null?void 0:g.toLowerCase())==="label"?(S=(b=n.parentElement)==null?void 0:b.parentElement)==null||S.appendChild(o):V?(T=V.parentElement)==null||T.appendChild(o):(k=n.parentElement)==null||k.appendChild(o)}else(R=n.parentElement)==null||R.appendChild(o)}showLabels(n,o){Object.keys(n).forEach((i,u)=>{const h=n[i],g=this.getKeyByFieldSelector(i);if(!g||!this.fields[g]){console.error("Field not found. Check the field selector.");return}const b=this.fields[g];b.isValid=!o,this.clearFieldStyle(g),this.clearFieldLabel(g),this.renderFieldError(g,!1,h),u===0&&this.globalConfig.focusInvalidField&&setTimeout(()=>b.elem.focus(),0)})}showErrors(n){if(typeof n!="object")throw Error("[showErrors]: Errors should be an object with key: value format");this.showLabels(n,!0)}showSuccessLabels(n){if(typeof n!="object")throw Error("[showSuccessLabels]: Labels should be an object with key: value format");this.showLabels(n,!1)}renderFieldError(n,o=!1,i){var u,h,g,b,S,T;const k=this.fields[n];if(k.isValid===!1&&(this.isValid=!1),k.isValid===void 0||!o&&!this.isSubmitted&&!k.touched&&i===void 0)return;if(k.isValid){if(!k.asyncCheckPending){const V=this.createSuccessLabelElem(n,i!==void 0?i:k.successMessage,k.config);V&&this.renderFieldLabel(k.elem,V,(u=k.config)==null?void 0:u.errorsContainer,!0),k.elem.classList.add(...l0(((h=k.config)==null?void 0:h.successFieldCssClass)||this.globalConfig.successFieldCssClass))}return}k.elem.classList.add(...l0(((g=k.config)==null?void 0:g.errorFieldCssClass)||this.globalConfig.errorFieldCssClass));const R=this.createErrorLabelElem(n,i!==void 0?i:k.errorMessage,k.config);this.renderFieldLabel(k.elem,R,(b=k.config)==null?void 0:b.errorsContainer),this.isTooltip()&&this.tooltips.push(this.renderTooltip(k.elem,R,(T=(S=k.config)==null?void 0:S.tooltip)==null?void 0:T.position))}renderGroupError(n,o=!0){var i,u,h,g;const b=this.groupFields[n];if(b.isValid===!1&&(this.isValid=!1),b.isValid===void 0||!o&&!this.isSubmitted&&!b.touched)return;if(b.isValid){b.elems.forEach(k=>{var R,V;Object.assign(k.style,((R=b.config)==null?void 0:R.successFieldStyle)||this.globalConfig.successFieldStyle),k.classList.add(...l0(((V=b.config)==null?void 0:V.successFieldCssClass)||this.globalConfig.successFieldCssClass))});const T=this.createSuccessLabelElem(n,b.successMessage,b.config);T&&this.renderGroupLabel(b.groupElem,T,(i=b.config)==null?void 0:i.errorsContainer,!0);return}this.isValid=!1,b.elems.forEach(T=>{var k,R;Object.assign(T.style,((k=b.config)==null?void 0:k.errorFieldStyle)||this.globalConfig.errorFieldStyle),T.classList.add(...l0(((R=b.config)==null?void 0:R.errorFieldCssClass)||this.globalConfig.errorFieldCssClass))});const S=this.createErrorLabelElem(n,b.errorMessage,b.config);this.renderGroupLabel(b.groupElem,S,(u=b.config)==null?void 0:u.errorsContainer),this.isTooltip()&&this.tooltips.push(this.renderTooltip(b.groupElem,S,(g=(h=b.config)==null?void 0:h.tooltip)==null?void 0:g.position))}renderErrors(n=!1){if(!(!this.isSubmitted&&!n&&!this.globalConfig.validateBeforeSubmitting)){this.clearErrors(),this.isValid=!0;for(const o in this.groupFields)this.renderGroupError(o);for(const o in this.fields)this.renderFieldError(o)}}destroy(){this.eventListeners.forEach(n=>{this.removeListener(n.type,n.elem,n.func)}),Object.keys(this.customStyleTags).forEach(n=>{this.customStyleTags[n].remove()}),this.clearErrors(),this.globalConfig.lockForm&&this.unlockForm()}refresh(){this.destroy(),this.form?(this.initialize(this.form,this.globalConfig),Object.keys(this.fields).forEach(n=>{const o=this.getFieldSelectorByKey(n);o&&this.addField(o,[...this.fields[n].rules],this.fields[n].config)})):console.error("Cannot initialize the library! Form is not defined")}setCurrentLocale(n){if(typeof n!="string"&&n!==void 0){console.error("Current locale should be a string");return}this.currentLocale=n,this.isSubmitted&&this.validate()}onSuccess(n){return this.onSuccessCallback=n,this}onFail(n){return this.onFailCallback=n,this}onValidate(n){return this.onValidateCallback=n,this}}class uue{constructor(){this.init()}init(){this.bindForms()}bindForms(){document.querySelectorAll(".js-form").forEach(o=>{new due(o)})}}class due{constructor(n){this.element=n,this.init()}init(){this.initForm()}initForm(){this.validator=new cue(this.element,void 0,[{key:"Field is required",dict:{nl:"Veld is verplicht",en:"Field is required"}}]);const n=(sitebite==null?void 0:sitebite.language)??"en";this.validator.setCurrentLocale(n),this.addValidationRules(),this.validator.onSuccess(o=>{this.submitForm()})}addValidationRules(){this.element.querySelectorAll("input, textarea, select").forEach(o=>{const i=`#${o.id}`;let u=[];o.hasAttribute("required")&&u.push({rule:"required",errorMessage:"Field is required"}),u.length>0&&this.validator.addField(i,u)})}async submitForm(){const n=new FormData(this.element),o=Object.fromEntries(n.entries());try{const i=await fetch(`${this.element.dataset.action}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(i.ok){const u=await i.json();this.element.reset(),this.showSuccessMessage()}else console.error("Form submission failed:",i.status,i.statusText)}catch(i){console.error("Error submitting form:",i)}}showSuccessMessage(){alert("Form submitted successfully!")}}function mj(l,n){for(var o=0;o<n.length;o++){var i=n[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(l,i.key,i)}}function fue(l,n,o){return n&&mj(l.prototype,n),o&&mj(l,o),l}/*!
 * Observer 3.10.4
 * https://greensock.com
 *
 * @license Copyright 2008-2022, GreenSock. All rights reserved.
 * Subject to the terms at https://greensock.com/standard-license or for
 * Club GreenSock members, the agreement issued with that membership.
 * @author: Jack Doyle, jack@greensock.com
*/var af,pV,Ah,rS,iS,ST,GZ,Jw,qL,WZ,tv,Up,jZ=function(){return af||typeof window<"u"&&(af=window.gsap)&&af.registerPlugin&&af},KZ=1,bT=[],ia=[],x0=[],YL=Date.now,gV=function(n,o){return o},hue=function(){var n=qL.core,o=n.bridge||{},i=n._scrollers,u=n._proxies;i.push.apply(i,ia),u.push.apply(u,x0),ia=i,x0=u,gV=function(g,b){return o[g](b)}},f1=function(n,o){return~x0.indexOf(n)&&x0[x0.indexOf(n)+1][o]},Z4=function(n){return!!~WZ.indexOf(n)},Bf=function(n,o,i,u,h){return n.addEventListener(o,i,{passive:!u,capture:!!h})},ef=function(n,o,i,u){return n.removeEventListener(o,i,!!u)},w4="scrollLeft",S4="scrollTop",pj=function(){return tv&&tv.isPressed||ia.cache++},yB=function(n,o){var i=function u(h){if(h||h===0){KZ&&(Ah.history.scrollRestoration="manual");var g=tv&&tv.isPressed;h=u.v=Math.round(h)||(tv&&tv.iOS?1:0),n(h),u.cacheID=ia.cache,g&&gV("ss",h)}else(o||ia.cache!==u.cacheID||gV("ref"))&&(u.cacheID=ia.cache,u.v=n());return u.v+u.offset};return i.offset=0,n&&i},rf={s:w4,p:"left",p2:"Left",os:"right",os2:"Right",d:"width",d2:"Width",a:"x",sc:yB(function(l){return arguments.length?Ah.scrollTo(l,Jc.sc()):Ah.pageXOffset||rS[w4]||iS[w4]||ST[w4]||0})},Jc={s:S4,p:"top",p2:"Top",os:"bottom",os2:"Bottom",d:"height",d2:"Height",a:"y",op:rf,sc:yB(function(l){return arguments.length?Ah.scrollTo(rf.sc(),l):Ah.pageYOffset||rS[S4]||iS[S4]||ST[S4]||0})},Hf=function(n){return af.utils.toArray(n)[0]||(typeof n=="string"&&af.config().nullTargetWarn!==!1?console.warn("Element not found:",n):null)},m1=function(n,o){var i=o.s,u=o.sc,h=ia.indexOf(n),g=u===Jc.sc?1:2;return!~h&&(h=ia.push(n)-1),ia[h+g]||(ia[h+g]=yB(f1(n,i),!0)||(Z4(n)?u:yB(function(b){return arguments.length?n[i]=b:n[i]})))},bV=function(n,o,i){var u=n,h=n,g=YL(),b=g,S=o||50,T=Math.max(500,S*3),k=function($,W){var Q=YL();W||Q-g>S?(h=u,u=$,b=g,g=Q):i?u+=$:u=h+($-h)/(Q-b)*(g-b)},R=function(){h=u=i?0:u,b=g=0},V=function($){var W=b,Q=h,j=YL();return($||$===0)&&$!==u&&k($),g===b||j-b>T?0:(u+(i?Q:-Q))/((i?j:g)-W)*1e3};return{update:k,reset:R,getVelocity:V}},IL=function(n,o){return o&&!n._gsapAllow&&n.preventDefault(),n.changedTouches?n.changedTouches[0]:n},gj=function(n){var o=Math.max.apply(Math,n),i=Math.min.apply(Math,n);return Math.abs(o)>=Math.abs(i)?o:i},ZZ=function(){qL=af.core.globals().ScrollTrigger,qL&&qL.core&&hue()},qZ=function(n){return af=n||jZ(),af&&typeof document<"u"&&document.body&&(Ah=window,rS=document,iS=rS.documentElement,ST=rS.body,WZ=[Ah,rS,iS,ST],af.utils.clamp,Jw="onpointerenter"in ST?"pointer":"mouse",GZ=Oc.isTouch=Ah.matchMedia&&Ah.matchMedia("(hover: none), (pointer: coarse)").matches?1:"ontouchstart"in Ah||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0?2:0,Up=Oc.eventTypes=("ontouchstart"in iS?"touchstart,touchmove,touchcancel,touchend":"onpointerdown"in iS?"pointerdown,pointermove,pointercancel,pointerup":"mousedown,mousemove,mouseup,mouseup").split(","),setTimeout(function(){return KZ=0},500),ZZ(),pV=1),pV};rf.op=Jc;ia.cache=0;var Oc=function(){function l(o){this.init(o)}var n=l.prototype;return n.init=function(i){pV||qZ(af)||console.warn("Please gsap.registerPlugin(Observer)"),qL||ZZ();var u=i.tolerance,h=i.dragMinimum,g=i.type,b=i.target,S=i.lineHeight,T=i.debounce,k=i.preventDefault,R=i.onStop,V=i.onStopDelay,z=i.ignore,$=i.wheelSpeed,W=i.event,Q=i.onDragStart,j=i.onDragEnd,se=i.onDrag,re=i.onPress,Y=i.onRelease,me=i.onRight,ae=i.onLeft,Ce=i.onUp,Ue=i.onDown,ot=i.onChangeX,Ae=i.onChangeY,ve=i.onChange,Oe=i.onToggleX,O=i.onToggleY,De=i.onHover,Fe=i.onHoverEnd,st=i.onMove,Ut=i.ignoreCheck,et=i.isNormalizer,Dt=i.onGestureStart,Xe=i.onGestureEnd,it=i.onWheel,qe=i.onEnable,mt=i.onDisable,Un=i.onClick,on=i.scrollSpeed,vt=i.capture,an=i.allowClicks,J=i.lockAxis,Bn=i.onLockAxis;this.target=b=Hf(b)||iS,this.vars=i,z&&(z=af.utils.toArray(z)),u=u||0,h=h||0,$=$||1,on=on||1,g=g||"wheel,touch,pointer",T=T!==!1,S||(S=parseFloat(Ah.getComputedStyle(ST).lineHeight)||22);var Vn,Rn,An,jn,to,mo,$t,xe=this,It=0,Dn=0,Ct=m1(b,rf),yo=m1(b,Jc),Kn=Ct(),Jt=yo(),Qt=~g.indexOf("touch")&&!~g.indexOf("pointer")&&Up[0]==="pointerdown",Cn=Z4(b),Nn=b.ownerDocument||rS,kt=[0,0,0],jo=[0,0,0],ms=0,as=function(){return ms=YL()},xt=function(dn,vo){return(xe.event=dn)&&z&&~z.indexOf(dn.target)||vo&&Qt&&dn.pointerType!=="touch"||Ut&&Ut(dn,vo)},Pt=function(){xe._vx.reset(),xe._vy.reset(),Rn.pause(),R&&R(xe)},gn=function(){var dn=xe.deltaX=gj(kt),vo=xe.deltaY=gj(jo),Gn=Math.abs(dn)>=u,yn=Math.abs(vo)>=u;ve&&(Gn||yn)&&ve(xe,dn,vo,kt,jo),Gn&&(me&&xe.deltaX>0&&me(xe),ae&&xe.deltaX<0&&ae(xe),ot&&ot(xe),Oe&&xe.deltaX<0!=It<0&&Oe(xe),It=xe.deltaX,kt[0]=kt[1]=kt[2]=0),yn&&(Ue&&xe.deltaY>0&&Ue(xe),Ce&&xe.deltaY<0&&Ce(xe),Ae&&Ae(xe),O&&xe.deltaY<0!=Dn<0&&O(xe),Dn=xe.deltaY,jo[0]=jo[1]=jo[2]=0),(jn||An)&&(st&&st(xe),Bn&&mo&&Bn(xe),An&&(se(xe),An=!1),jn=mo=!1),to&&(it(xe),to=!1),Vn=0},At=function(dn,vo,Gn){kt[Gn]+=dn,jo[Gn]+=vo,xe._vx.update(dn),xe._vy.update(vo),T?Vn||(Vn=requestAnimationFrame(gn)):gn()},On=function(dn,vo){$t!=="y"&&(kt[2]+=dn,xe._vx.update(dn,!0)),$t!=="x"&&(jo[2]+=vo,xe._vy.update(vo,!0)),J&&!$t&&(xe.axis=$t=Math.abs(dn)>Math.abs(vo)?"x":"y",mo=!0),T?Vn||(Vn=requestAnimationFrame(gn)):gn()},In=function(dn){if(!xt(dn,1)){dn=IL(dn,k);var vo=dn.clientX,Gn=dn.clientY,yn=vo-xe.x,vr=Gn-xe.y,ao=xe.isDragging;xe.x=vo,xe.y=Gn,(ao||Math.abs(xe.startX-vo)>=h||Math.abs(xe.startY-Gn)>=h)&&(se&&(An=!0),ao||(xe.isDragging=!0),On(yn,vr),ao||Q&&Q(xe))}},Is=xe.onPress=function(ps){xt(ps,1)||(xe.axis=$t=null,Rn.pause(),xe.isPressed=!0,ps=IL(ps),It=Dn=0,xe.startX=xe.x=ps.clientX,xe.startY=xe.y=ps.clientY,xe._vx.reset(),xe._vy.reset(),Bf(et?b:Nn,Up[1],In,k,!0),xe.deltaX=xe.deltaY=0,re&&re(xe))},kr=function(dn){if(!xt(dn,1)){ef(et?b:Nn,Up[1],In,!0);var vo=xe.isDragging&&(Math.abs(xe.x-xe.startX)>3||Math.abs(xe.y-xe.startY)>3),Gn=IL(dn);vo||(xe._vx.reset(),xe._vy.reset(),k&&an&&af.delayedCall(.08,function(){if(YL()-ms>300&&!dn.defaultPrevented){if(dn.target.click)dn.target.click();else if(Nn.createEvent){var yn=Nn.createEvent("MouseEvents");yn.initMouseEvent("click",!0,!0,Ah,1,Gn.screenX,Gn.screenY,Gn.clientX,Gn.clientY,!1,!1,!1,!1,0,null),dn.target.dispatchEvent(yn)}}})),xe.isDragging=xe.isGesturing=xe.isPressed=!1,R&&!et&&Rn.restart(!0),j&&vo&&j(xe),Y&&Y(xe,vo)}},Yt=function(dn){return dn.touches&&dn.touches.length>1&&(xe.isGesturing=!0)&&Dt(dn,xe.isDragging)},Ps=function(){return(xe.isGesturing=!1)||Xe(xe)},qo=function(dn){if(!xt(dn)){var vo=Ct(),Gn=yo();At((vo-Kn)*on,(Gn-Jt)*on,1),Kn=vo,Jt=Gn,R&&Rn.restart(!0)}},_i=function(dn){if(!xt(dn)){dn=IL(dn,k),it&&(to=!0);var vo=(dn.deltaMode===1?S:dn.deltaMode===2?Ah.innerHeight:1)*$;At(dn.deltaX*vo,dn.deltaY*vo,0),R&&!et&&Rn.restart(!0)}},bs=function(dn){if(!xt(dn)){var vo=dn.clientX,Gn=dn.clientY,yn=vo-xe.x,vr=Gn-xe.y;xe.x=vo,xe.y=Gn,jn=!0,(yn||vr)&&On(yn,vr)}},Ar=function(dn){xe.event=dn,De(xe)},Bl=function(dn){xe.event=dn,Fe(xe)},aa=function(dn){return xt(dn)||IL(dn,k)&&Un(xe)};Rn=xe._dc=af.delayedCall(V||.25,Pt).pause(),xe.deltaX=xe.deltaY=0,xe._vx=bV(0,50,!0),xe._vy=bV(0,50,!0),xe.scrollX=Ct,xe.scrollY=yo,xe.isDragging=xe.isGesturing=xe.isPressed=!1,xe.enable=function(ps){return xe.isEnabled||(Bf(Cn?Nn:b,"scroll",pj),g.indexOf("scroll")>=0&&Bf(Cn?Nn:b,"scroll",qo,k,vt),g.indexOf("wheel")>=0&&Bf(b,"wheel",_i,k,vt),(g.indexOf("touch")>=0&&GZ||g.indexOf("pointer")>=0)&&(Bf(b,Up[0],Is,k,vt),Bf(Nn,Up[2],kr),Bf(Nn,Up[3],kr),an&&Bf(b,"click",as,!1,!0),Un&&Bf(b,"click",aa),Dt&&Bf(Nn,"gesturestart",Yt),Xe&&Bf(Nn,"gestureend",Ps),De&&Bf(b,Jw+"enter",Ar),Fe&&Bf(b,Jw+"leave",Bl),st&&Bf(b,Jw+"move",bs)),xe.isEnabled=!0,ps&&ps.type&&Is(ps),qe&&qe(xe)),xe},xe.disable=function(){xe.isEnabled&&(bT.filter(function(ps){return ps!==xe&&Z4(ps.target)}).length||ef(Cn?Nn:b,"scroll",pj),xe.isPressed&&(xe._vx.reset(),xe._vy.reset(),ef(et?b:Nn,Up[1],In,!0)),ef(Cn?Nn:b,"scroll",qo,vt),ef(b,"wheel",_i,vt),ef(b,Up[0],Is,vt),ef(Nn,Up[2],kr),ef(Nn,Up[3],kr),ef(b,"click",as,!0),ef(b,"click",aa),ef(Nn,"gesturestart",Yt),ef(Nn,"gestureend",Ps),ef(b,Jw+"enter",Ar),ef(b,Jw+"leave",Bl),ef(b,Jw+"move",bs),xe.isEnabled=xe.isPressed=xe.isDragging=!1,mt&&mt(xe))},xe.kill=function(){xe.disable();var ps=bT.indexOf(xe);ps>=0&&bT.splice(ps,1),tv===xe&&(tv=0)},bT.push(xe),et&&Z4(b)&&(tv=xe),xe.enable(W)},fue(l,[{key:"velocityX",get:function(){return this._vx.getVelocity()}},{key:"velocityY",get:function(){return this._vy.getVelocity()}}]),l}();Oc.version="3.10.4";Oc.create=function(l){return new Oc(l)};Oc.register=qZ;Oc.getAll=function(){return bT.slice()};Oc.getById=function(l){return bT.filter(function(n){return n.vars.id===l})[0]};jZ()&&af.registerPlugin(Oc);/*!
 * ScrollTrigger 3.10.4
 * https://greensock.com
 *
 * @license Copyright 2008-2022, GreenSock. All rights reserved.
 * Subject to the terms at https://greensock.com/standard-license or for
 * Club GreenSock members, the agreement issued with that membership.
 * @author: Jack Doyle, jack@greensock.com
*/var ar,nS,bi,ql,nv,Yl,YZ,wB,SB,vT,q4,E4,Ju,HB,vV,of,bj,vj,fT,XZ,wU,JZ,Lm,QZ,eq,tq,Qw,SU,HL=1,sf=Date.now,EU=sf(),Pm=0,C4=0,xj=function(){return HB=1},yj=function(){return HB=0},s1=function(n){return n},oR=function(n){return Math.round(n*1e5)/1e5||0},nq=function(){return typeof window<"u"},oq=function(){return ar||nq()&&(ar=window.gsap)&&ar.registerPlugin&&ar},dS=function(n){return!!~YZ.indexOf(n)},sq=function(n){return f1(n,"getBoundingClientRect")||(dS(n)?function(){return nB.width=bi.innerWidth,nB.height=bi.innerHeight,nB}:function(){return Qb(n)})},mue=function(n,o,i){var u=i.d,h=i.d2,g=i.a;return(g=f1(n,"getBoundingClientRect"))?function(){return g()[u]}:function(){return(o?bi["inner"+h]:n["client"+h])||0}},pue=function(n,o){return!o||~x0.indexOf(n)?sq(n):function(){return nB}},u1=function(n,o){var i=o.s,u=o.d2,h=o.d,g=o.a;return(i="scroll"+u)&&(g=f1(n,i))?g()-sq(n)()[h]:dS(n)?(nv[i]||Yl[i])-(bi["inner"+u]||nv["client"+u]||Yl["client"+u]):n[i]-n["offset"+u]},_4=function(n,o){for(var i=0;i<fT.length;i+=3)(!o||~o.indexOf(fT[i+1]))&&n(fT[i],fT[i+1],fT[i+2])},u0=function(n){return typeof n=="string"},jp=function(n){return typeof n=="function"},UL=function(n){return typeof n=="number"},Y4=function(n){return typeof n=="object"},T4=function(n){return jp(n)&&n()},wj=function(n,o){return function(){var i=T4(n),u=T4(o);return function(){T4(i),T4(u)}}},PL=function(n,o,i){return n&&n.progress(o?0:1)&&i&&n.pause()},CU=function(n,o){if(n.enabled){var i=o(n);i&&i.totalTime&&(n.callbackAnimation=i)}},nT=Math.abs,rq="left",iq="top",tz="right",nz="bottom",lS="width",cS="height",XL="Right",JL="Left",QL="Top",eR="Bottom",Lc="padding",Im="margin",kT="Width",oz="Height",nf="px",m0=function(n){return bi.getComputedStyle(n)},gue=function(n){var o=m0(n).position;n.style.position=o==="absolute"||o==="fixed"?o:"relative"},Sj=function(n,o){for(var i in o)i in n||(n[i]=o[i]);return n},Qb=function(n,o){var i=o&&m0(n)[vV]!=="matrix(1, 0, 0, 1, 0, 0)"&&ar.to(n,{x:0,y:0,xPercent:0,yPercent:0,rotation:0,rotationX:0,rotationY:0,scale:1,skewX:0,skewY:0}).progress(1),u=n.getBoundingClientRect();return i&&i.progress(0).kill(),u},xV=function(n,o){var i=o.d2;return n["offset"+i]||n["client"+i]||0},aq=function(n){var o=[],i=n.labels,u=n.duration(),h;for(h in i)o.push(i[h]/u);return o},bue=function(n){return function(o){return ar.utils.snap(aq(n),o)}},sz=function(n){var o=ar.utils.snap(n),i=Array.isArray(n)&&n.slice(0).sort(function(u,h){return u-h});return i?function(u,h,g){g===void 0&&(g=.001);var b;if(!h)return o(u);if(h>0){for(u-=g,b=0;b<i.length;b++)if(i[b]>=u)return i[b];return i[b-1]}else for(b=i.length,u+=g;b--;)if(i[b]<=u)return i[b];return i[0]}:function(u,h,g){g===void 0&&(g=.001);var b=o(u);return!h||Math.abs(b-u)<g||b-u<0==h<0?b:o(h<0?u-n:u+n)}},vue=function(n){return function(o,i){return sz(aq(n))(o,i.direction)}},D4=function(n,o,i,u){return i.split(",").forEach(function(h){return n(o,h,u)})},Qu=function(n,o,i,u,h){return n.addEventListener(o,i,{passive:!u,capture:!!h})},yu=function(n,o,i,u){return n.removeEventListener(o,i,!!u)},k4=function(n,o,i){return i&&i.wheelHandler&&n(o,"wheel",i)},Ej={startColor:"green",endColor:"red",indent:0,fontSize:"16px",fontWeight:"normal"},A4={toggleActions:"play",anticipatePin:0},EB={top:0,left:0,center:.5,bottom:1,right:1},X4=function(n,o){if(u0(n)){var i=n.indexOf("="),u=~i?+(n.charAt(i-1)+1)*parseFloat(n.substr(i+1)):0;~i&&(n.indexOf("%")>i&&(u*=o/100),n=n.substr(0,i-1)),n=u+(n in EB?EB[n]*o:~n.indexOf("%")?parseFloat(n)*o/100:parseFloat(n)||0)}return n},L4=function(n,o,i,u,h,g,b,S){var T=h.startColor,k=h.endColor,R=h.fontSize,V=h.indent,z=h.fontWeight,$=ql.createElement("div"),W=dS(i)||f1(i,"pinType")==="fixed",Q=n.indexOf("scroller")!==-1,j=W?Yl:i,se=n.indexOf("start")!==-1,re=se?T:k,Y="border-color:"+re+";font-size:"+R+";color:"+re+";font-weight:"+z+";pointer-events:none;white-space:nowrap;font-family:sans-serif,Arial;z-index:1000;padding:4px 8px;border-width:0;border-style:solid;";return Y+="position:"+((Q||S)&&W?"fixed;":"absolute;"),(Q||S||!W)&&(Y+=(u===Jc?tz:nz)+":"+(g+parseFloat(V))+"px;"),b&&(Y+="box-sizing:border-box;text-align:left;width:"+b.offsetWidth+"px;"),$._isStart=se,$.setAttribute("class","gsap-marker-"+n+(o?" marker-"+o:"")),$.style.cssText=Y,$.innerText=o||o===0?n+"-"+o:n,j.children[0]?j.insertBefore($,j.children[0]):j.appendChild($),$._offset=$["offset"+u.op.d2],J4($,0,u,se),$},J4=function(n,o,i,u){var h={display:"block"},g=i[u?"os2":"p2"],b=i[u?"p2":"os2"];n._isFlipped=u,h[i.a+"Percent"]=u?-100:0,h[i.a]=u?"1px":0,h["border"+g+kT]=1,h["border"+b+kT]=0,h[i.p]=o+"px",ar.set(n,h)},Ri=[],yV={},wV,Cj=function(){return sf()-Pm>34&&iR()},oT=function(){(!Lm||!Lm.isPressed||Lm.startX>Yl.clientWidth)&&(ia.cache++,wV||(wV=requestAnimationFrame(iR)),Pm||fS("scrollStart"),Pm=sf())},_j=function(){tq=bi.innerWidth,eq=bi.innerHeight},VL=function(){ia.cache++,!Ju&&!JZ&&!ql.fullscreenElement&&!ql.webkitFullscreenElement&&(!QZ||tq!==bi.innerWidth||Math.abs(bi.innerHeight-eq)>bi.innerHeight*.25)&&wB.restart(!0)},sR={},xue=[],Xl=[],ET,Tj,Dj=function(n){var o=ar.ticker.frame,i=[],u=0,h;if(Tj!==o||HL){for(CB();u<Xl.length;u+=4)h=bi.matchMedia(Xl[u]).matches,h!==Xl[u+3]&&(Xl[u+3]=h,h?i.push(u):CB(1,Xl[u])||jp(Xl[u+2])&&Xl[u+2]());for(cq(),u=0;u<i.length;u++)h=i[u],ET=Xl[h],Xl[h+2]=Xl[h+1](n);ET=0,nS&&CT(0,1),Tj=o,fS("matchMedia")}},lq=function l(){return yu($i,"scrollEnd",l)||CT(!0)},fS=function(n){return sR[n]&&sR[n].map(function(o){return o()})||xue},Rm=[],cq=function(n){for(var o=0;o<Rm.length;o+=5)(!n||Rm[o+4]===n)&&(Rm[o].style.cssText=Rm[o+1],Rm[o].getBBox&&Rm[o].setAttribute("transform",Rm[o+2]||""),Rm[o+3].uncache=1)},CB=function(n,o){var i;for(of=0;of<Ri.length;of++)i=Ri[of],(!o||i.media===o)&&(n?i.kill(1):i.revert());o&&cq(o),o||fS("revert")},uq=function(){return ia.cache++&&ia.forEach(function(n){return typeof n=="function"&&(n.rec=0)})},rR,Q4=0,CT=function(n,o){if(Pm&&!n){Qu($i,"scrollEnd",lq);return}rR=!0;var i=fS("refreshInit");XZ&&$i.sort(),o||CB(),Ri.slice(0).forEach(function(u){return u.refresh()}),Ri.forEach(function(u){return u.vars.end==="max"&&u.setPositions(u.start,u1(u.scroller,u._dir))}),i.forEach(function(u){return u&&u.render&&u.render(-1)}),uq(),wB.pause(),Q4++,rR=!1,fS("refresh")},kj=0,eB=1,oS,iR=function(){if(!rR){$i.isUpdating=!0,oS&&oS.update(0);var n=Ri.length,o=sf(),i=o-EU>=50,u=n&&Ri[0].scroll();if(eB=kj>u?-1:1,kj=u,i&&(Pm&&!HB&&o-Pm>200&&(Pm=0,fS("scrollEnd")),q4=EU,EU=o),eB<0){for(of=n;of-- >0;)Ri[of]&&Ri[of].update(0,i);eB=1}else for(of=0;of<n;of++)Ri[of]&&Ri[of].update(0,i);$i.isUpdating=!1}wV=0},SV=[rq,iq,nz,tz,Im+eR,Im+XL,Im+QL,Im+JL,"display","flexShrink","float","zIndex","gridColumnStart","gridColumnEnd","gridRowStart","gridRowEnd","gridArea","justifySelf","alignSelf","placeSelf","order"],tB=SV.concat([lS,cS,"boxSizing","max"+kT,"max"+oz,"position",Im,Lc,Lc+QL,Lc+XL,Lc+eR,Lc+JL]),yue=function(n,o,i){aR(i);var u=n._gsap;if(u.spacerIsNative)aR(u.spacerState);else if(n.parentNode===o){var h=o.parentNode;h&&(h.insertBefore(n,o),h.removeChild(o))}},_U=function(n,o,i,u){if(n.parentNode!==o){for(var h=SV.length,g=o.style,b=n.style,S;h--;)S=SV[h],g[S]=i[S];g.position=i.position==="absolute"?"absolute":"relative",i.display==="inline"&&(g.display="inline-block"),b[nz]=b[tz]=g.flexBasis="auto",g.overflow="visible",g.boxSizing="border-box",g[lS]=xV(n,rf)+nf,g[cS]=xV(n,Jc)+nf,g[Lc]=b[Im]=b[iq]=b[rq]="0",aR(u),b[lS]=b["max"+kT]=i[lS],b[cS]=b["max"+oz]=i[cS],b[Lc]=i[Lc],n.parentNode.insertBefore(o,n),o.appendChild(n)}},wue=/([A-Z])/g,aR=function(n){if(n){var o=n.t.style,i=n.length,u=0,h,g;for((n.t._gsap||ar.core.getCache(n.t)).uncache=1;u<i;u+=2)g=n[u+1],h=n[u],g?o[h]=g:o[h]&&o.removeProperty(h.replace(wue,"-$1").toLowerCase())}},R4=function(n){for(var o=tB.length,i=n.style,u=[],h=0;h<o;h++)u.push(tB[h],i[tB[h]]);return u.t=n,u},Sue=function(n,o,i){for(var u=[],h=n.length,g=i?8:0,b;g<h;g+=2)b=n[g],u.push(b,b in o?o[b]:n[g+1]);return u.t=n.t,u},nB={left:0,top:0},Aj=function(n,o,i,u,h,g,b,S,T,k,R,V,z){jp(n)&&(n=n(S)),u0(n)&&n.substr(0,3)==="max"&&(n=V+(n.charAt(4)==="="?X4("0"+n.substr(3),i):0));var $=z?z.time():0,W,Q,j;if(z&&z.seek(0),UL(n))b&&J4(b,i,u,!0);else{jp(o)&&(o=o(S));var se=n.split(" "),re,Y,me,ae;j=Hf(o)||Yl,re=Qb(j)||{},(!re||!re.left&&!re.top)&&m0(j).display==="none"&&(ae=j.style.display,j.style.display="block",re=Qb(j),ae?j.style.display=ae:j.style.removeProperty("display")),Y=X4(se[0],re[u.d]),me=X4(se[1]||"0",i),n=re[u.p]-T[u.p]-k+Y+h-me,b&&J4(b,me,u,i-me<20||b._isStart&&me>20),i-=i-me}if(g){var Ce=n+i,Ue=g._isStart;W="scroll"+u.d2,J4(g,Ce,u,Ue&&Ce>20||!Ue&&(R?Math.max(Yl[W],nv[W]):g.parentNode[W])<=Ce+1),R&&(T=Qb(b),R&&(g.style[u.op.p]=T[u.op.p]-u.op.m-g._offset+nf))}return z&&j&&(W=Qb(j),z.seek(V),Q=Qb(j),z._caScrollDist=W[u.p]-Q[u.p],n=n/z._caScrollDist*V),z&&z.seek($),z?n:Math.round(n)},Eue=/(webkit|moz|length|cssText|inset)/i,Lj=function(n,o,i,u){if(n.parentNode!==o){var h=n.style,g,b;if(o===Yl){n._stOrig=h.cssText,b=m0(n);for(g in b)!+g&&!Eue.test(g)&&b[g]&&typeof h[g]=="string"&&g!=="0"&&(h[g]=b[g]);h.top=i,h.left=u}else h.cssText=n._stOrig;ar.core.getCache(n).uncache=1,o.appendChild(n)}},Rj=function(n,o){var i=m1(n,o),u="_scroll"+o.p2,h,g,b=function S(T,k,R,V,z){var $=S.tween,W=k.onComplete,Q={};return R=R||i(),z=V&&z||0,V=V||T-R,$&&$.kill(),h=Math.round(R),k[u]=T,k.modifiers=Q,Q[u]=function(j){return j=oR(i()),j!==h&&j!==g&&Math.abs(j-h)>2&&Math.abs(j-g)>2?($.kill(),S.tween=0):j=R+V*$.ratio+z*$.ratio*$.ratio,g=h,h=oR(j)},k.onComplete=function(){S.tween=0,W&&W.call($)},$=S.tween=ar.to(n,k),$};return n[u]=i,i.wheelHandler=function(){return b.tween&&b.tween.kill()&&(b.tween=0)},Qu(n,"wheel",i.wheelHandler),b},$i=function(){function l(o,i){nS||l.register(ar)||console.warn("Please gsap.registerPlugin(ScrollTrigger)"),this.init(o,i)}var n=l.prototype;return n.init=function(i,u){if(this.progress=this.start=0,this.vars&&this.kill(!0,!0),!C4){this.update=this.refresh=this.kill=s1;return}i=Sj(u0(i)||UL(i)||i.nodeType?{trigger:i}:i,A4);var h=i,g=h.onUpdate,b=h.toggleClass,S=h.id,T=h.onToggle,k=h.onRefresh,R=h.scrub,V=h.trigger,z=h.pin,$=h.pinSpacing,W=h.invalidateOnRefresh,Q=h.anticipatePin,j=h.onScrubComplete,se=h.onSnapComplete,re=h.once,Y=h.snap,me=h.pinReparent,ae=h.pinSpacer,Ce=h.containerAnimation,Ue=h.fastScrollEnd,ot=h.preventOverlaps,Ae=i.horizontal||i.containerAnimation&&i.horizontal!==!1?rf:Jc,ve=!R&&R!==0,Oe=Hf(i.scroller||bi),O=ar.core.getCache(Oe),De=dS(Oe),Fe=("pinType"in i?i.pinType:f1(Oe,"pinType")||De&&"fixed")==="fixed",st=[i.onEnter,i.onLeave,i.onEnterBack,i.onLeaveBack],Ut=ve&&i.toggleActions.split(" "),et="markers"in i?i.markers:A4.markers,Dt=De?0:parseFloat(m0(Oe)["border"+Ae.p2+kT])||0,Xe=this,it=i.onRefreshInit&&function(){return i.onRefreshInit(Xe)},qe=mue(Oe,De,Ae),mt=pue(Oe,De),Un=0,on=0,vt=m1(Oe,Ae),an,J,Bn,Vn,Rn,An,jn,to,mo,$t,xe,It,Dn,Ct,yo,Kn,Jt,Qt,Cn,Nn,kt,jo,ms,as,xt,Pt,gn,At,On,In,Is,kr,Yt,Ps,qo,_i,bs,Ar;if(Xe.media=ET,Xe._dir=Ae,Q*=45,Xe.scroller=Oe,Xe.scroll=Ce?Ce.time.bind(Ce):vt,Vn=vt(),Xe.vars=i,u=u||i.animation,"refreshPriority"in i&&(XZ=1,i.refreshPriority===-9999&&(oS=Xe)),O.tweenScroll=O.tweenScroll||{top:Rj(Oe,Jc),left:Rj(Oe,rf)},Xe.tweenTo=an=O.tweenScroll[Ae.p],Xe.scrubDuration=function(dn){Is=UL(dn)&&dn,Is?In?In.duration(dn):In=ar.to(u,{ease:"expo",totalProgress:"+=0.001",duration:Is,paused:!0,onComplete:function(){return j&&j(Xe)}}):(In&&In.progress(1).kill(),In=0)},u&&(u.vars.lazy=!1,u._initted||u.vars.immediateRender!==!1&&i.immediateRender!==!1&&u.render(0,!0,!0),Xe.animation=u.pause(),u.scrollTrigger=Xe,Xe.scrubDuration(R),At=0,S||(S=u.vars.id)),Ri.push(Xe),Y&&((!Y4(Y)||Y.push)&&(Y={snapTo:Y}),"scrollBehavior"in Yl.style&&ar.set(De?[Yl,nv]:Oe,{scrollBehavior:"auto"}),Bn=jp(Y.snapTo)?Y.snapTo:Y.snapTo==="labels"?bue(u):Y.snapTo==="labelsDirectional"?vue(u):Y.directional!==!1?function(dn,vo){return sz(Y.snapTo)(dn,sf()-on<500?0:vo.direction)}:ar.utils.snap(Y.snapTo),kr=Y.duration||{min:.1,max:2},kr=Y4(kr)?vT(kr.min,kr.max):vT(kr,kr),Yt=ar.delayedCall(Y.delay||Is/2||.1,function(){var dn=vt(),vo=sf()-on<500,Gn=an.tween;if((vo||Math.abs(Xe.getVelocity())<10)&&!Gn&&!HB&&Un!==dn){var yn=(dn-An)/Dn,vr=u&&!ve?u.totalProgress():yn,ao=vo?0:(vr-On)/(sf()-q4)*1e3||0,ze=ar.utils.clamp(-yn,1-yn,nT(ao/2)*ao/.185),Ie=yn+(Y.inertia===!1?0:ze),Ot=vT(0,1,Bn(Ie,Xe)),_t=Math.round(An+Ot*Dn),Nt=Y,_n=Nt.onStart,sn=Nt.onInterrupt,Tn=Nt.onComplete;if(dn<=jn&&dn>=An&&_t!==dn){if(Gn&&!Gn._initted&&Gn.data<=nT(_t-dn))return;Y.inertia===!1&&(ze=Ot-yn),an(_t,{duration:kr(nT(Math.max(nT(Ie-vr),nT(Ot-vr))*.185/ao/.05||0)),ease:Y.ease||"power3",data:nT(_t-dn),onInterrupt:function(){return Yt.restart(!0)&&sn&&sn(Xe)},onComplete:function(){Xe.update(),Un=vt(),At=On=u&&!ve?u.totalProgress():Xe.progress,se&&se(Xe),Tn&&Tn(Xe)}},dn,ze*Dn,_t-dn-ze*Dn),_n&&_n(Xe,an.tween)}}else Xe.isActive&&Un!==dn&&Yt.restart(!0)}).pause()),S&&(yV[S]=Xe),V=Xe.trigger=Hf(V||z),Ar=V&&V._gsap&&V._gsap.stRevert,Ar&&(Ar=Ar(Xe)),z=z===!0?V:Hf(z),u0(b)&&(b={targets:V,className:b}),z&&($===!1||$===Im||($=!$&&m0(z.parentNode).display==="flex"?!1:Lc),Xe.pin=z,i.force3D!==!1&&ar.set(z,{force3D:!0}),J=ar.core.getCache(z),J.spacer?Ct=J.pinState:(ae&&(ae=Hf(ae),ae&&!ae.nodeType&&(ae=ae.current||ae.nativeElement),J.spacerIsNative=!!ae,ae&&(J.spacerState=R4(ae))),J.spacer=Jt=ae||ql.createElement("div"),Jt.classList.add("pin-spacer"),S&&Jt.classList.add("pin-spacer-"+S),J.pinState=Ct=R4(z)),Xe.spacer=Jt=J.spacer,gn=m0(z),ms=gn[$+Ae.os2],Cn=ar.getProperty(z),Nn=ar.quickSetter(z,Ae.a,nf),_U(z,Jt,gn),Kn=R4(z)),et){It=Y4(et)?Sj(et,Ej):Ej,$t=L4("scroller-start",S,Oe,Ae,It,0),xe=L4("scroller-end",S,Oe,Ae,It,0,$t),Qt=$t["offset"+Ae.op.d2];var Bl=Hf(f1(Oe,"content")||Oe);to=this.markerStart=L4("start",S,Bl,Ae,It,Qt,0,Ce),mo=this.markerEnd=L4("end",S,Bl,Ae,It,Qt,0,Ce),Ce&&(bs=ar.quickSetter([to,mo],Ae.a,nf)),!Fe&&!(x0.length&&f1(Oe,"fixedMarkers")===!0)&&(gue(De?Yl:Oe),ar.set([$t,xe],{force3D:!0}),xt=ar.quickSetter($t,Ae.a,nf),Pt=ar.quickSetter(xe,Ae.a,nf))}if(Ce){var aa=Ce.vars.onUpdate,ps=Ce.vars.onUpdateParams;Ce.eventCallback("onUpdate",function(){Xe.update(0,0,1),aa&&aa.apply(ps||[])})}Xe.previous=function(){return Ri[Ri.indexOf(Xe)-1]},Xe.next=function(){return Ri[Ri.indexOf(Xe)+1]},Xe.revert=function(dn){var vo=dn!==!1||!Xe.enabled,Gn=Ju;vo!==Xe.isReverted&&(vo&&(Xe.scroll.rec||!Ju||!rR||(Xe.scroll.rec=vt()),qo=Math.max(vt(),Xe.scroll.rec||0),Ps=Xe.progress,_i=u&&u.progress()),to&&[to,mo,$t,xe].forEach(function(yn){return yn.style.display=vo?"none":"block"}),vo&&(Ju=1),Xe.update(vo),Ju=Gn,z&&(vo?yue(z,Jt,Ct):(!me||!Xe.isActive)&&_U(z,Jt,m0(z),as)),Xe.isReverted=vo)},Xe.refresh=function(dn,vo){if(!((Ju||!Xe.enabled)&&!vo)){if(z&&dn&&Pm){Qu(l,"scrollEnd",lq);return}!rR&&it&&it(Xe),Ju=1,on=sf(),an.tween&&(an.tween.kill(),an.tween=0),In&&In.pause(),W&&u&&u.time(-.01,!0).invalidate(),Xe.isReverted||Xe.revert();for(var Gn=qe(),yn=mt(),vr=Ce?Ce.duration():u1(Oe,Ae),ao=0,ze=0,Ie=i.end,Ot=i.endTrigger||V,_t=i.start||(i.start===0||!V?0:z?"0 0":"0 100%"),Nt=Xe.pinnedContainer=i.pinnedContainer&&Hf(i.pinnedContainer),_n=V&&Math.max(0,Ri.indexOf(Xe))||0,sn=_n,Tn,Xn,zn,Ko,To,Yo,Lo,es,Ms,hr;sn--;)Yo=Ri[sn],Yo.end||Yo.refresh(0,1)||(Ju=1),Lo=Yo.pin,Lo&&(Lo===V||Lo===z)&&!Yo.isReverted&&(hr||(hr=[]),hr.unshift(Yo),Yo.revert()),Yo!==Ri[sn]&&(_n--,sn--);for(jp(_t)&&(_t=_t(Xe)),An=Aj(_t,V,Gn,Ae,vt(),to,$t,Xe,yn,Dt,Fe,vr,Ce)||(z?-.001:0),jp(Ie)&&(Ie=Ie(Xe)),u0(Ie)&&!Ie.indexOf("+=")&&(~Ie.indexOf(" ")?Ie=(u0(_t)?_t.split(" ")[0]:"")+Ie:(ao=X4(Ie.substr(2),Gn),Ie=u0(_t)?_t:An+ao,Ot=V)),jn=Math.max(An,Aj(Ie||(Ot?"100% 0":vr),Ot,Gn,Ae,vt()+ao,mo,xe,Xe,yn,Dt,Fe,vr,Ce))||-.001,Dn=jn-An||(An-=.01)&&.001,ao=0,sn=_n;sn--;)Yo=Ri[sn],Lo=Yo.pin,Lo&&Yo.start-Yo._pinPush<An&&!Ce&&Yo.end>0&&(Tn=Yo.end-Yo.start,(Lo===V||Lo===Nt)&&!UL(_t)&&(ao+=Tn*(1-Yo.progress)),Lo===z&&(ze+=Tn));if(An+=ao,jn+=ao,Xe._pinPush=ze,to&&ao&&(Tn={},Tn[Ae.a]="+="+ao,Nt&&(Tn[Ae.p]="-="+vt()),ar.set([to,mo],Tn)),z)Tn=m0(z),Ko=Ae===Jc,zn=vt(),kt=parseFloat(Cn(Ae.a))+ze,!vr&&jn>1&&((De?Yl:Oe).style["overflow-"+Ae.a]="scroll"),_U(z,Jt,Tn),Kn=R4(z),Xn=Qb(z,!0),es=Fe&&m1(Oe,Ko?rf:Jc)(),$&&(as=[$+Ae.os2,Dn+ze+nf],as.t=Jt,sn=$===Lc?xV(z,Ae)+Dn+ze:0,sn&&as.push(Ae.d,sn+nf),aR(as),Fe&&vt(qo)),Fe&&(To={top:Xn.top+(Ko?zn-An:es)+nf,left:Xn.left+(Ko?es:zn-An)+nf,boxSizing:"border-box",position:"fixed"},To[lS]=To["max"+kT]=Math.ceil(Xn.width)+nf,To[cS]=To["max"+oz]=Math.ceil(Xn.height)+nf,To[Im]=To[Im+QL]=To[Im+XL]=To[Im+eR]=To[Im+JL]="0",To[Lc]=Tn[Lc],To[Lc+QL]=Tn[Lc+QL],To[Lc+XL]=Tn[Lc+XL],To[Lc+eR]=Tn[Lc+eR],To[Lc+JL]=Tn[Lc+JL],yo=Sue(Ct,To,me)),u?(Ms=u._initted,wU(1),u.render(u.duration(),!0,!0),jo=Cn(Ae.a)-kt+Dn+ze,Dn!==jo&&Fe&&yo.splice(yo.length-2,2),u.render(0,!0,!0),Ms||u.invalidate(),wU(0)):jo=Dn;else if(V&&vt()&&!Ce)for(Xn=V.parentNode;Xn&&Xn!==Yl;)Xn._pinOffset&&(An-=Xn._pinOffset,jn-=Xn._pinOffset),Xn=Xn.parentNode;hr&&hr.forEach(function(po){return po.revert(!1)}),Xe.start=An,Xe.end=jn,Vn=Rn=vt(),Ce||(Vn<qo&&vt(qo),Xe.scroll.rec=0),Xe.revert(!1),Yt&&(Un=-1,Xe.isActive&&vt(An+Dn*Ps),Yt.restart(!0)),Ju=0,u&&ve&&(u._initted||_i)&&u.progress()!==_i&&u.progress(_i,!0).render(u.time(),!0,!0),(Ps!==Xe.progress||Ce)&&(u&&!ve&&u.totalProgress(Ps,!0),Xe.progress=Ps,Xe.update(0,0,1)),z&&$&&(Jt._pinOffset=Math.round(Xe.progress*jo)),k&&k(Xe)}},Xe.getVelocity=function(){return(vt()-Rn)/(sf()-q4)*1e3||0},Xe.endAnimation=function(){PL(Xe.callbackAnimation),u&&(In?In.progress(1):u.paused()?ve||PL(u,Xe.direction<0,1):PL(u,u.reversed()))},Xe.labelToScroll=function(dn){return u&&u.labels&&(An||Xe.refresh()||An)+u.labels[dn]/u.duration()*Dn||0},Xe.getTrailing=function(dn){var vo=Ri.indexOf(Xe),Gn=Xe.direction>0?Ri.slice(0,vo).reverse():Ri.slice(vo+1);return(u0(dn)?Gn.filter(function(yn){return yn.vars.preventOverlaps===dn}):Gn).filter(function(yn){return Xe.direction>0?yn.end<=An:yn.start>=jn})},Xe.update=function(dn,vo,Gn){if(!(Ce&&!Gn&&!dn)){var yn=Xe.scroll(),vr=dn?0:(yn-An)/Dn,ao=vr<0?0:vr>1?1:vr||0,ze=Xe.progress,Ie,Ot,_t,Nt,_n,sn,Tn,Xn;if(vo&&(Rn=Vn,Vn=Ce?vt():yn,Y&&(On=At,At=u&&!ve?u.totalProgress():ao)),Q&&!ao&&z&&!Ju&&!HL&&Pm&&An<yn+(yn-Rn)/(sf()-q4)*Q&&(ao=1e-4),ao!==ze&&Xe.enabled){if(Ie=Xe.isActive=!!ao&&ao<1,Ot=!!ze&&ze<1,sn=Ie!==Ot,_n=sn||!!ao!=!!ze,Xe.direction=ao>ze?1:-1,Xe.progress=ao,_n&&!Ju&&(_t=ao&&!ze?0:ao===1?1:ze===1?2:3,ve&&(Nt=!sn&&Ut[_t+1]!=="none"&&Ut[_t+1]||Ut[_t],Xn=u&&(Nt==="complete"||Nt==="reset"||Nt in u))),ot&&(sn||Xn)&&(Xn||R||!u)&&(jp(ot)?ot(Xe):Xe.getTrailing(ot).forEach(function(Yo){return Yo.endAnimation()})),ve||(In&&!Ju&&!HL?((Ce||oS&&oS!==Xe)&&In.render(In._dp._time-In._start),In.resetTo?In.resetTo("totalProgress",ao,u._tTime/u._tDur):(In.vars.totalProgress=ao,In.invalidate().restart())):u&&u.totalProgress(ao,!!Ju)),z){if(dn&&$&&(Jt.style[$+Ae.os2]=ms),!Fe)Nn(oR(kt+jo*ao));else if(_n){if(Tn=!dn&&ao>ze&&jn+1>yn&&yn+1>=u1(Oe,Ae),me)if(!dn&&(Ie||Tn)){var zn=Qb(z,!0),Ko=yn-An;Lj(z,Yl,zn.top+(Ae===Jc?Ko:0)+nf,zn.left+(Ae===Jc?0:Ko)+nf)}else Lj(z,Jt);aR(Ie||Tn?yo:Kn),jo!==Dn&&ao<1&&Ie||Nn(kt+(ao===1&&!Tn?jo:0))}}Y&&!an.tween&&!Ju&&!HL&&Yt.restart(!0),b&&(sn||re&&ao&&(ao<1||!SU))&&SB(b.targets).forEach(function(Yo){return Yo.classList[Ie||re?"add":"remove"](b.className)}),g&&!ve&&!dn&&g(Xe),_n&&!Ju?(ve&&(Xn&&(Nt==="complete"?u.pause().totalProgress(1):Nt==="reset"?u.restart(!0).pause():Nt==="restart"?u.restart(!0):u[Nt]()),g&&g(Xe)),(sn||!SU)&&(T&&sn&&CU(Xe,T),st[_t]&&CU(Xe,st[_t]),re&&(ao===1?Xe.kill(!1,1):st[_t]=0),sn||(_t=ao===1?1:3,st[_t]&&CU(Xe,st[_t]))),Ue&&!Ie&&Math.abs(Xe.getVelocity())>(UL(Ue)?Ue:2500)&&(PL(Xe.callbackAnimation),In?In.progress(1):PL(u,!ao,1))):ve&&g&&!Ju&&g(Xe)}if(Pt){var To=Ce?yn/Ce.duration()*(Ce._caScrollDist||0):yn;xt(To+($t._isFlipped?1:0)),Pt(To)}bs&&bs(-yn/Ce.duration()*(Ce._caScrollDist||0))}},Xe.enable=function(dn,vo){Xe.enabled||(Xe.enabled=!0,Qu(Oe,"resize",VL),Qu(De?ql:Oe,"scroll",oT),it&&Qu(l,"refreshInit",it),dn!==!1&&(Xe.progress=Ps=0,Vn=Rn=Un=vt()),vo!==!1&&Xe.refresh())},Xe.getTween=function(dn){return dn&&an?an.tween:In},Xe.setPositions=function(dn,vo){z&&(kt+=dn-An,jo+=vo-dn-Dn),Xe.start=An=dn,Xe.end=jn=vo,Dn=vo-dn,Xe.update()},Xe.disable=function(dn,vo){if(Xe.enabled&&(dn!==!1&&Xe.revert(),Xe.enabled=Xe.isActive=!1,vo||In&&In.pause(),qo=0,J&&(J.uncache=1),it&&yu(l,"refreshInit",it),Yt&&(Yt.pause(),an.tween&&an.tween.kill()&&(an.tween=0)),!De)){for(var Gn=Ri.length;Gn--;)if(Ri[Gn].scroller===Oe&&Ri[Gn]!==Xe)return;yu(Oe,"resize",VL),yu(Oe,"scroll",oT)}},Xe.kill=function(dn,vo){Xe.disable(dn,vo),In&&!vo&&In.kill(),S&&delete yV[S];var Gn=Ri.indexOf(Xe);Gn>=0&&Ri.splice(Gn,1),Gn===of&&eB>0&&of--,Gn=0,Ri.forEach(function(yn){return yn.scroller===Xe.scroller&&(Gn=1)}),Gn||(Xe.scroll.rec=0),u&&(u.scrollTrigger=null,dn&&u.render(-1),vo||u.kill()),to&&[to,mo,$t,xe].forEach(function(yn){return yn.parentNode&&yn.parentNode.removeChild(yn)}),oS===Xe&&(oS=0),z&&(J&&(J.uncache=1),Gn=0,Ri.forEach(function(yn){return yn.pin===z&&Gn++}),Gn||(J.spacer=0)),i.onKill&&i.onKill(Xe)},Xe.enable(!1,!1),Ar&&Ar(Xe),!u||!u.add||Dn?Xe.refresh():ar.delayedCall(.01,function(){return An||jn||Xe.refresh()})&&(Dn=.01)&&(An=jn=0)},l.register=function(i){return nS||(ar=i||oq(),nq()&&window.document&&l.enable(),nS=C4),nS},l.defaults=function(i){if(i)for(var u in i)A4[u]=i[u];return A4},l.disable=function(i,u){C4=0,Ri.forEach(function(g){return g[u?"kill":"disable"](i)}),yu(bi,"wheel",oT),yu(ql,"scroll",oT),clearInterval(E4),yu(ql,"touchcancel",s1),yu(Yl,"touchstart",s1),D4(yu,ql,"pointerdown,touchstart,mousedown",xj),D4(yu,ql,"pointerup,touchend,mouseup",yj),wB.kill(),_4(yu);for(var h=0;h<ia.length;h+=3)k4(yu,ia[h],ia[h+1]),k4(yu,ia[h],ia[h+2])},l.enable=function(){if(bi=window,ql=document,nv=ql.documentElement,Yl=ql.body,ar&&(SB=ar.utils.toArray,vT=ar.utils.clamp,wU=ar.core.suppressOverwrites||s1,ar.core.globals("ScrollTrigger",l),Yl)){C4=1,Oc.register(ar),l.isTouch=Oc.isTouch,Qw=Oc.isTouch&&/(iPad|iPhone|iPod|Mac)/g.test(navigator.userAgent),Qu(bi,"wheel",oT),YZ=[bi,ql,nv,Yl],l.matchMedia({"(orientation: portrait)":function(){return _j(),_j}}),Qu(ql,"scroll",oT);var i=Yl.style,u=i.borderTopStyle,h,g;for(i.borderTopStyle="solid",h=Qb(Yl),Jc.m=Math.round(h.top+Jc.sc())||0,rf.m=Math.round(h.left+rf.sc())||0,u?i.borderTopStyle=u:i.removeProperty("border-top-style"),E4=setInterval(Cj,250),ar.delayedCall(.5,function(){return HL=0}),Qu(ql,"touchcancel",s1),Qu(Yl,"touchstart",s1),D4(Qu,ql,"pointerdown,touchstart,mousedown",xj),D4(Qu,ql,"pointerup,touchend,mouseup",yj),vV=ar.utils.checkPrefix("transform"),tB.push(vV),nS=sf(),wB=ar.delayedCall(.2,CT).pause(),fT=[ql,"visibilitychange",function(){var b=bi.innerWidth,S=bi.innerHeight;ql.hidden?(bj=b,vj=S):(bj!==b||vj!==S)&&VL()},ql,"DOMContentLoaded",CT,bi,"load",CT,bi,"resize",VL],_4(Qu),Ri.forEach(function(b){return b.enable(0,1)}),g=0;g<ia.length;g+=3)k4(yu,ia[g],ia[g+1]),k4(yu,ia[g],ia[g+2])}},l.config=function(i){"limitCallbacks"in i&&(SU=!!i.limitCallbacks);var u=i.syncInterval;u&&clearInterval(E4)||(E4=u)&&setInterval(Cj,u),"ignoreMobileResize"in i&&(QZ=l.isTouch===1&&i.ignoreMobileResize),"autoRefreshEvents"in i&&(_4(yu)||_4(Qu,i.autoRefreshEvents||"none"),JZ=(i.autoRefreshEvents+"").indexOf("resize")===-1)},l.scrollerProxy=function(i,u){var h=Hf(i),g=ia.indexOf(h),b=dS(h);~g&&ia.splice(g,b?6:2),u&&(b?x0.unshift(bi,u,Yl,u,nv,u):x0.unshift(h,u))},l.matchMedia=function(i){var u,h,g,b,S;for(h in i)g=Xl.indexOf(h),b=i[h],ET=h,h==="all"?b():(u=bi.matchMedia(h),u&&(u.matches&&(S=b()),~g?(Xl[g+1]=wj(Xl[g+1],b),Xl[g+2]=wj(Xl[g+2],S)):(g=Xl.length,Xl.push(h,b,S),u.addListener?u.addListener(Dj):u.addEventListener("change",Dj)),Xl[g+3]=u.matches)),ET=0;return Xl},l.clearMatchMedia=function(i){i||(Xl.length=0),i=Xl.indexOf(i),i>=0&&Xl.splice(i,4)},l.isInViewport=function(i,u,h){var g=(u0(i)?Hf(i):i).getBoundingClientRect(),b=g[h?lS:cS]*u||0;return h?g.right-b>0&&g.left+b<bi.innerWidth:g.bottom-b>0&&g.top+b<bi.innerHeight},l.positionInViewport=function(i,u,h){u0(i)&&(i=Hf(i));var g=i.getBoundingClientRect(),b=g[h?lS:cS],S=u==null?b/2:u in EB?EB[u]*b:~u.indexOf("%")?parseFloat(u)*b/100:parseFloat(u)||0;return h?(g.left+S)/bi.innerWidth:(g.top+S)/bi.innerHeight},l}();$i.version="3.10.4";$i.saveStyles=function(l){return l?SB(l).forEach(function(n){if(n&&n.style){var o=Rm.indexOf(n);o>=0&&Rm.splice(o,5),Rm.push(n,n.style.cssText,n.getBBox&&n.getAttribute("transform"),ar.core.getCache(n),ET)}}):Rm};$i.revert=function(l,n){return CB(!l,n)};$i.create=function(l,n){return new $i(l,n)};$i.refresh=function(l){return l?VL():(nS||$i.register())&&CT(!0)};$i.update=iR;$i.clearScrollMemory=uq;$i.maxScroll=function(l,n){return u1(l,n?rf:Jc)};$i.getScrollFunc=function(l,n){return m1(Hf(l),n?rf:Jc)};$i.getById=function(l){return yV[l]};$i.getAll=function(){return Ri.filter(function(l){return l.vars.id!=="ScrollSmoother"})};$i.isScrolling=function(){return!!Pm};$i.snapDirectional=sz;$i.addEventListener=function(l,n){var o=sR[l]||(sR[l]=[]);~o.indexOf(n)||o.push(n)};$i.removeEventListener=function(l,n){var o=sR[l],i=o&&o.indexOf(n);i>=0&&o.splice(i,1)};$i.batch=function(l,n){var o=[],i={},u=n.interval||.016,h=n.batchMax||1e9,g=function(T,k){var R=[],V=[],z=ar.delayedCall(u,function(){k(R,V),R=[],V=[]}).pause();return function($){R.length||z.restart(!0),R.push($.trigger),V.push($),h<=R.length&&z.progress(1)}},b;for(b in n)i[b]=b.substr(0,2)==="on"&&jp(n[b])&&b!=="onRefreshInit"?g(b,n[b]):n[b];return jp(h)&&(h=h(),Qu($i,"refresh",function(){return h=n.batchMax()})),SB(l).forEach(function(S){var T={};for(b in i)T[b]=i[b];T.trigger=S,o.push($i.create(T))}),o};var Oj=function(n,o,i,u){return o>u?n(u):o<0&&n(0),i>u?(u-o)/(i-o):i<0?o/(o-i):1},TU=function l(n,o){o===!0?n.style.removeProperty("touch-action"):n.style.touchAction=o===!0?"auto":o?"pan-"+o+(Oc.isTouch?" pinch-zoom":""):"none",n===nv&&l(Yl,o)},Ij={auto:1,scroll:1},Cue=function(n){var o=n.event,i=n.target,u=n.axis,h=(o.changedTouches?o.changedTouches[0]:o).target,g=h._gsap||ar.core.getCache(h),b=sf(),S;if(!g._isScrollT||b-g._isScrollT>2e3){for(;h&&h.scrollHeight<=h.clientHeight;)h=h.parentNode;g._isScroll=h&&!dS(h)&&h!==i&&(Ij[(S=m0(h)).overflowY]||Ij[S.overflowX]),g._isScrollT=b}(g._isScroll||u==="x")&&(o._gsapAllow=!0)},dq=function(n,o,i,u){return Oc.create({target:n,capture:!0,debounce:!1,lockAxis:!0,type:o,onWheel:u=u&&Cue,onPress:u,onDrag:u,onScroll:u,onEnable:function(){return i&&Qu(ql,Oc.eventTypes[0],Mj,!1,!0)},onDisable:function(){return yu(ql,Oc.eventTypes[0],Mj,!0)}})},_ue=/(input|label|select|textarea)/i,Pj,Mj=function(n){var o=_ue.test(n.target.tagName);(o||Pj)&&(n._gsapAllow=!0,Pj=o)},Tue=function(n){Y4(n)||(n={}),n.preventDefault=n.isNormalizer=n.allowClicks=!0,n.type||(n.type="wheel,touch"),n.debounce=!!n.debounce,n.id=n.id||"normalizer";var o=n,i=o.normalizeScrollX,u=o.momentum,h=o.allowNestedScroll,g,b,S=Hf(n.target)||nv,T=ar.core.globals().ScrollSmoother,k=Qw&&(n.content&&Hf(n.content)||T&&T.get()&&T.get().content()),R=m1(S,Jc),V=m1(S,rf),z=1,$=(Oc.isTouch&&bi.visualViewport?bi.visualViewport.scale*bi.visualViewport.width:bi.outerWidth)/bi.innerWidth,W=0,Q=jp(u)?function(){return u(g)}:function(){return u||2.8},j,se,re=dq(S,n.type,!0,h),Y=function(){return j=!1},me=s1,ae=s1,Ce=function(){b=u1(S,Jc),ae=vT(Qw?1:0,b),i&&(me=vT(0,u1(S,rf))),se=Q4},Ue=function(){if(j){requestAnimationFrame(Y);var Fe=oR(g.deltaY/2),st=ae(R.v-Fe);return k&&st!==R.v+R.offset&&(R.offset=st-R.v,k.style.transform="translateY("+-R.offset+"px)",k._gsap&&(k._gsap.y=-R.offset+"px"),R.cacheID=ia.cache,iR()),!0}k&&(k.style.transform="translateY(0px)",R.offset=R.cacheID=0,k._gsap&&(k._gsap.y="0px")),j=!0},ot,Ae,ve,Oe,O=function(){Ce(),ot.isActive()&&ot.vars.scrollY>b&&(R()>b?ot.progress(1)&&R(b):ot.resetTo("scrollY",b))};return n.ignoreCheck=function(De){return Qw&&De.type==="touchmove"&&Ue()||z>1.05&&De.type!=="touchstart"||g.isGesturing||De.touches&&De.touches.length>1},n.onPress=function(){var De=z;z=oR((bi.visualViewport&&bi.visualViewport.scale||1)/$),ot.pause(),De!==z&&TU(S,z>1.01?!0:i?!1:"x"),j=!1,Ae=V(),ve=R(),Ce(),se=Q4},n.onRelease=n.onGestureStart=function(De,Fe){if(k&&(k.style.transform="translateY(0px)",R.offset=R.cacheID=0,k._gsap&&(k._gsap.y="0px")),!Fe)Oe.restart(!0);else{ia.cache++;var st=Q(),Ut,et;i&&(Ut=V(),et=Ut+st*.05*-De.velocityX/.227,st*=Oj(V,Ut,et,u1(S,rf)),ot.vars.scrollX=me(et)),Ut=R(),et=Ut+st*.05*-De.velocityY/.227,st*=Oj(R,Ut,et,u1(S,Jc)),ot.vars.scrollY=ae(et),ot.invalidate().duration(st).play(.01),(Qw&&ot.vars.scrollY>=b||Ut>=b-1)&&ar.to({},{onUpdate:O,duration:st})}},n.onWheel=function(){ot._ts&&ot.pause(),sf()-W>1e3&&(se=0,W=sf())},n.onChange=function(De,Fe,st,Ut,et){Q4!==se&&Ce(),Fe&&i&&V(me(Ut[2]===Fe?Ae+(De.startX-De.x):V()+Fe-Ut[1])),st&&R(ae(et[2]===st?ve+(De.startY-De.y):R()+st-et[1])),iR()},n.onEnable=function(){TU(S,i?!1:"x"),Qu(bi,"resize",O),re.enable()},n.onDisable=function(){TU(S,!0),yu(bi,"resize",O),re.kill()},g=new Oc(n),g.iOS=Qw,Qw&&!R()&&R(1),Oe=g._dc,ot=ar.to(g,{ease:"power4",paused:!0,scrollX:i?"+=0.1":"+=0",scrollY:"+=0.1",onComplete:Oe.vars.onComplete}),g};$i.sort=function(l){return Ri.sort(l||function(n,o){return(n.vars.refreshPriority||0)*-1e6+n.start-(o.start+(o.vars.refreshPriority||0)*-1e6)})};$i.observe=function(l){return new Oc(l)};$i.normalizeScroll=function(l){if(typeof l>"u")return Lm;if(l===!0&&Lm)return Lm.enable();if(l===!1)return Lm&&Lm.kill();var n=l instanceof Oc?l:Tue(l);return Lm&&Lm.target===n.target&&Lm.kill(),dS(n.target)&&(Lm=n),n};$i.core={_getVelocityProp:bV,_inputObserver:dq,_scrollers:ia,_proxies:x0,bridge:{ss:function(){Pm||fS("scrollStart"),Pm=sf()},ref:function(){return Ju}}};oq()&&ar.registerPlugin($i);a1.registerPlugin($i);class Due{constructor(){this.init()}init(){this.pageView()}pageView(){this.event({domain:window.location.host,event:"page_view",value:window.location.href})}event(n){HK.post("/insights",n)}}class kue{constructor(){this.init()}init(){this.marquees=document.querySelectorAll(".js-marquee"),this.marquees.forEach(n=>new Aue(n))}}class Aue{constructor(n){f4(this,"init",()=>{this.createTimelines()});f4(this,"createTimelines",()=>{this.createTickerTimeline()});f4(this,"createTickerTimeline",()=>{this.move=a1.timeline({onComplete:()=>this.move.restart(),onReverseComplete:()=>this.move.reverse(0)}),this.move.to(this.ticker,{x:-this.ticker.offsetWidth,ease:"none",duration:this.duration},"a").to(this.tickerClone,{x:-this.tickerClone.offsetWidth,ease:"none",duration:this.duration},"a")});if(this.tickerContainer=n,!this.tickerContainer)return!1;this.velocity=1,this.ticker=this.tickerContainer.querySelector(".js-ticker"),this.tickerClone=this.tickerContainer.querySelector(".js-ticker-clone"),this.duration=15/window.innerWidth*this.ticker.getBoundingClientRect().width,this.timescaleOffset=1,this.init()}}class Lue{constructor(){this.treshold=50,this.bodyClass="tiny-header",this.bodyEl=document.getElementsByTagName("body")[0],this.init()}scroll(){return window.scrollY>this.treshold?this.bodyEl.classList.add(this.bodyClass):this.bodyEl.classList.remove(this.bodyClass)}bind(){window.addEventListener("scroll",()=>{this.scroll()},{passive:!0})}init(){this.bind()}}class Rue{constructor(){this.navPanel=document.getElementById("nav-panel"),this.navToggle=document.getElementById("nav-toggle"),this.init()}bind(){if(!this.navPanel||!this.navToggle)return;this.navToggle.addEventListener("click",()=>{this.toggle()}),this.navPanel.querySelectorAll("a").forEach(o=>{o.addEventListener("click",()=>{this.toggle()})})}toggle(){this.navPanel.classList.contains("hidden")?this.navPanel.classList.remove("hidden"):this.navPanel.classList.add("hidden"),this.navPanel.classList.contains("flex")?this.navPanel.classList.remove("flex"):this.navPanel.classList.add("flex")}init(){this.bind()}}class Oue{constructor(){this.toggleOnesieInfo=document.querySelectorAll(".js-toggle-onesie-info"),this.onesieInfo=document.querySelector(".js-onesie-info"),this.init()}bind(){this.toggleOnesieInfo.length&&this.onesieInfo&&this.toggleOnesieInfo.forEach(n=>{n.addEventListener("click",()=>{this.toggle()})})}toggle(){this.onesieInfo.classList.toggle("lg:hidden",!this.onesieInfo.classList.contains("lg:hidden"))}init(){this.bind()}}var EV={exports:{}};(function(l,n){(function(o,i){i(n)})(sre,function(o){var i=/([\uD800-\uDBFF][\uDC00-\uDFFF](?:[\u200D\uFE0F][\uD800-\uDBFF][\uDC00-\uDFFF]){2,}|\uD83D\uDC69(?:\u200D(?:(?:\uD83D\uDC69\u200D)?\uD83D\uDC67|(?:\uD83D\uDC69\u200D)?\uD83D\uDC66)|\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D(?:\uD83D\uDC69\u200D)?\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D(?:\uD83D\uDC69\u200D)?\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]\uFE0F|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC6F\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3C-\uDD3E\uDDD6-\uDDDF])\u200D[\u2640\u2642]\uFE0F|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F\u200D[\u2640\u2642]|(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642])\uFE0F|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\uD83D\uDC69\u200D[\u2695\u2696\u2708]|\uD83D\uDC68(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708]))\uFE0F|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83D\uDC69\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|\uD83D\uDC68(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC66\u200D\uD83D\uDC66|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92])|(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]))|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDD1-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\u200D(?:(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC67|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC66)|\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC69\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDDD1-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])?|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDEEB\uDEEC\uDEF4-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267B\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])\uFE0F)/;function u(Oe){var O=Oe.nodeType,De="";if(O===1||O===9||O===11){if(typeof Oe.textContent=="string")return Oe.textContent;for(Oe=Oe.firstChild;Oe;Oe=Oe.nextSibling)De+=u(Oe)}else if(O===3||O===4)return Oe.nodeValue;return De}/*!
 * SplitText: 3.10.4
 * https://greensock.com
 *
 * @license Copyright 2008-2022, GreenSock. All rights reserved.
 * Subject to the terms at https://greensock.com/standard-license or for
 * Club GreenSock members, the agreement issued with that membership.
 * @author: Jack Doyle, jack@greensock.com
*/var h,g,b,S=/(?:\r|\n|\t\t)/g,T=/(?:\s\s+)/g,k=function(){h=document,g=window,b=1},R=function(O){return g.getComputedStyle(O)},V=Array.isArray,z=[].slice,$=function(O,De){var Fe;return V(O)?O:(Fe=typeof O)=="string"&&!De&&O?z.call(h.querySelectorAll(O),0):O&&Fe==="object"&&"length"in O?z.call(O,0):O?[O]:[]},W=function(O){return O.position==="absolute"||O.absolute===!0},Q=function(O,De){for(var Fe=De.length,st;--Fe>-1;)if(st=De[Fe],O.substr(0,st.length)===st)return st.length},j=" style='position:relative;display:inline-block;'",se=function(O,De){O===void 0&&(O="");var Fe=~O.indexOf("++"),st=1;return Fe&&(O=O.split("++").join("")),function(){return"<"+De+j+(O?" class='"+O+(Fe?st++:"")+"'>":">")}},re=function Oe(O,De,Fe){var st=O.nodeType;if(st===1||st===9||st===11)for(O=O.firstChild;O;O=O.nextSibling)Oe(O,De,Fe);else(st===3||st===4)&&(O.nodeValue=O.nodeValue.split(De).join(Fe))},Y=function(O,De){for(var Fe=De.length;--Fe>-1;)O.push(De[Fe])},me=function(O,De,Fe){for(var st;O&&O!==De;){if(st=O._next||O.nextSibling,st)return st.textContent.charAt(0)===Fe;O=O.parentNode||O._parent}},ae=function Oe(O){var De=$(O.childNodes),Fe=De.length,st,Ut;for(st=0;st<Fe;st++)Ut=De[st],Ut._isSplit?Oe(Ut):st&&Ut.previousSibling&&Ut.previousSibling.nodeType===3?(Ut.previousSibling.nodeValue+=Ut.nodeType===3?Ut.nodeValue:Ut.firstChild.nodeValue,O.removeChild(Ut)):Ut.nodeType!==3&&(O.insertBefore(Ut.firstChild,Ut),O.removeChild(Ut))},Ce=function(O,De){return parseFloat(De[O])||0},Ue=function(O,De,Fe,st,Ut,et,Dt){var Xe=R(O),it=Ce("paddingLeft",Xe),qe=-999,mt=Ce("borderBottomWidth",Xe)+Ce("borderTopWidth",Xe),Un=Ce("borderLeftWidth",Xe)+Ce("borderRightWidth",Xe),on=Ce("paddingTop",Xe)+Ce("paddingBottom",Xe),vt=Ce("paddingLeft",Xe)+Ce("paddingRight",Xe),an=Ce("fontSize",Xe)*(De.lineThreshold||.2),J=Xe.textAlign,Bn=[],Vn=[],Rn=[],An=De.wordDelimiter||" ",jn=De.tag?De.tag:De.span?"span":"div",to=De.type||De.split||"chars,words,lines",mo=Ut&&~to.indexOf("lines")?[]:null,$t=~to.indexOf("words"),xe=~to.indexOf("chars"),It=W(De),Dn=De.linesClass,Ct=~(Dn||"").indexOf("++"),yo=[],Kn=Xe.display==="flex",Jt=O.style.display,Qt,Cn,Nn,kt,jo,ms,as,xt,Pt,gn,At,On;for(Ct&&(Dn=Dn.split("++").join("")),Kn&&(O.style.display="block"),Cn=O.getElementsByTagName("*"),Nn=Cn.length,jo=[],Qt=0;Qt<Nn;Qt++)jo[Qt]=Cn[Qt];if(mo||It)for(Qt=0;Qt<Nn;Qt++)kt=jo[Qt],ms=kt.parentNode===O,(ms||It||xe&&!$t)&&(On=kt.offsetTop,mo&&ms&&Math.abs(On-qe)>an&&(kt.nodeName!=="BR"||Qt===0)&&(as=[],mo.push(as),qe=On),It&&(kt._x=kt.offsetLeft,kt._y=On,kt._w=kt.offsetWidth,kt._h=kt.offsetHeight),mo&&((kt._isSplit&&ms||!xe&&ms||$t&&ms||!$t&&kt.parentNode.parentNode===O&&!kt.parentNode._isSplit)&&(as.push(kt),kt._x-=it,me(kt,O,An)&&(kt._wordEnd=!0)),kt.nodeName==="BR"&&(kt.nextSibling&&kt.nextSibling.nodeName==="BR"||Qt===0)&&mo.push([])));for(Qt=0;Qt<Nn;Qt++){if(kt=jo[Qt],ms=kt.parentNode===O,kt.nodeName==="BR"){mo||It?(kt.parentNode&&kt.parentNode.removeChild(kt),jo.splice(Qt--,1),Nn--):$t||O.appendChild(kt);continue}if(It&&(Pt=kt.style,!$t&&!ms&&(kt._x+=kt.parentNode._x,kt._y+=kt.parentNode._y),Pt.left=kt._x+"px",Pt.top=kt._y+"px",Pt.position="absolute",Pt.display="block",Pt.width=kt._w+1+"px",Pt.height=kt._h+"px"),!$t&&xe)if(kt._isSplit)for(kt._next=Cn=kt.nextSibling,kt.parentNode.appendChild(kt);Cn&&Cn.nodeType===3&&Cn.textContent===" ";)kt._next=Cn.nextSibling,kt.parentNode.appendChild(Cn),Cn=Cn.nextSibling;else kt.parentNode._isSplit?(kt._parent=kt.parentNode,!kt.previousSibling&&kt.firstChild&&(kt.firstChild._isFirst=!0),kt.nextSibling&&kt.nextSibling.textContent===" "&&!kt.nextSibling.nextSibling&&yo.push(kt.nextSibling),kt._next=kt.nextSibling&&kt.nextSibling._isFirst?null:kt.nextSibling,kt.parentNode.removeChild(kt),jo.splice(Qt--,1),Nn--):ms||(On=!kt.nextSibling&&me(kt.parentNode,O,An),kt.parentNode._parent&&kt.parentNode._parent.appendChild(kt),On&&kt.parentNode.appendChild(h.createTextNode(" ")),jn==="span"&&(kt.style.display="inline"),Bn.push(kt));else kt.parentNode._isSplit&&!kt._isSplit&&kt.innerHTML!==""?Vn.push(kt):xe&&!kt._isSplit&&(jn==="span"&&(kt.style.display="inline"),Bn.push(kt))}for(Qt=yo.length;--Qt>-1;)yo[Qt].parentNode.removeChild(yo[Qt]);if(mo){for(It&&(gn=h.createElement(jn),O.appendChild(gn),At=gn.offsetWidth+"px",On=gn.offsetParent===O?0:O.offsetLeft,O.removeChild(gn)),Pt=O.style.cssText,O.style.cssText="display:none;";O.firstChild;)O.removeChild(O.firstChild);for(xt=An===" "&&(!It||!$t&&!xe),Qt=0;Qt<mo.length;Qt++){for(as=mo[Qt],gn=h.createElement(jn),gn.style.cssText="display:block;text-align:"+J+";position:"+(It?"absolute;":"relative;"),Dn&&(gn.className=Dn+(Ct?Qt+1:"")),Rn.push(gn),Nn=as.length,Cn=0;Cn<Nn;Cn++)as[Cn].nodeName!=="BR"&&(kt=as[Cn],gn.appendChild(kt),xt&&kt._wordEnd&&gn.appendChild(h.createTextNode(" ")),It&&(Cn===0&&(gn.style.top=kt._y+"px",gn.style.left=it+On+"px"),kt.style.top="0px",On&&(kt.style.left=kt._x-On+"px")));Nn===0?gn.innerHTML="&nbsp;":!$t&&!xe&&(ae(gn),re(gn," "," ")),It&&(gn.style.width=At,gn.style.height=kt._h+"px"),O.appendChild(gn)}O.style.cssText=Pt}It&&(Dt>O.clientHeight&&(O.style.height=Dt-on+"px",O.clientHeight<Dt&&(O.style.height=Dt+mt+"px")),et>O.clientWidth&&(O.style.width=et-vt+"px",O.clientWidth<et&&(O.style.width=et+Un+"px"))),Kn&&(Jt?O.style.display=Jt:O.style.removeProperty("display")),Y(Fe,Bn),$t&&Y(st,Vn),Y(Ut,Rn)},ot=function(O,De,Fe,st){var Ut=De.tag?De.tag:De.span?"span":"div",et=De.type||De.split||"chars,words,lines",Dt=~et.indexOf("chars"),Xe=W(De),it=De.wordDelimiter||" ",qe=it!==" "?"":Xe?"&#173; ":" ",mt="</"+Ut+">",Un=1,on=De.specialChars?typeof De.specialChars=="function"?De.specialChars:Q:null,vt,an,J,Bn,Vn,Rn,An,jn,to=h.createElement("div"),mo=O.parentNode;for(mo.insertBefore(to,O),to.textContent=O.nodeValue,mo.removeChild(O),O=to,vt=u(O),An=vt.indexOf("<")!==-1,De.reduceWhiteSpace!==!1&&(vt=vt.replace(T," ").replace(S,"")),An&&(vt=vt.split("<").join("{{LT}}")),Vn=vt.length,an=(vt.charAt(0)===" "?qe:"")+Fe(),J=0;J<Vn;J++)if(Rn=vt.charAt(J),on&&(jn=on(vt.substr(J),De.specialChars)))Rn=vt.substr(J,jn||1),an+=Dt&&Rn!==" "?st()+Rn+"</"+Ut+">":Rn,J+=jn-1;else if(Rn===it&&vt.charAt(J-1)!==it&&J){for(an+=Un?mt:"",Un=0;vt.charAt(J+1)===it;)an+=qe,J++;J===Vn-1?an+=qe:vt.charAt(J+1)!==")"&&(an+=qe+Fe(),Un=1)}else Rn==="{"&&vt.substr(J,6)==="{{LT}}"?(an+=Dt?st()+"{{LT}}</"+Ut+">":"{{LT}}",J+=5):Rn.charCodeAt(0)>=55296&&Rn.charCodeAt(0)<=56319||vt.charCodeAt(J+1)>=65024&&vt.charCodeAt(J+1)<=65039?(Bn=((vt.substr(J,12).split(i)||[])[1]||"").length||2,an+=Dt&&Rn!==" "?st()+vt.substr(J,Bn)+"</"+Ut+">":vt.substr(J,Bn),J+=Bn-1):an+=Dt&&Rn!==" "?st()+Rn+"</"+Ut+">":Rn;O.outerHTML=an+(Un?mt:""),An&&re(mo,"{{LT}}","<")},Ae=function Oe(O,De,Fe,st){var Ut=$(O.childNodes),et=Ut.length,Dt=W(De),Xe,it;if(O.nodeType!==3||et>1){for(De.absolute=!1,Xe=0;Xe<et;Xe++)it=Ut[Xe],it._next=it._isFirst=it._parent=it._wordEnd=null,(it.nodeType!==3||/\S+/.test(it.nodeValue))&&(Dt&&it.nodeType!==3&&R(it).display==="inline"&&(it.style.display="inline-block",it.style.position="relative"),it._isSplit=!0,Oe(it,De,Fe,st));De.absolute=Dt,O._isSplit=!0;return}ot(O,De,Fe,st)},ve=function(){function Oe(De,Fe){b||k(),this.elements=$(De),this.chars=[],this.words=[],this.lines=[],this._originals=[],this.vars=Fe||{},this.split(Fe)}var O=Oe.prototype;return O.split=function(Fe){this.isSplit&&this.revert(),this.vars=Fe=Fe||this.vars,this._originals.length=this.chars.length=this.words.length=this.lines.length=0;for(var st=this.elements.length,Ut=Fe.tag?Fe.tag:Fe.span?"span":"div",et=se(Fe.wordsClass,Ut),Dt=se(Fe.charsClass,Ut),Xe,it,qe;--st>-1;)qe=this.elements[st],this._originals[st]=qe.innerHTML,Xe=qe.clientHeight,it=qe.clientWidth,Ae(qe,Fe,et,Dt),Ue(qe,Fe,this.chars,this.words,this.lines,it,Xe);return this.chars.reverse(),this.words.reverse(),this.lines.reverse(),this.isSplit=!0,this},O.revert=function(){var Fe=this._originals;if(!Fe)throw"revert() call wasn't scoped properly.";return this.elements.forEach(function(st,Ut){return st.innerHTML=Fe[Ut]}),this.chars=[],this.words=[],this.lines=[],this.isSplit=!1,this},Oe.create=function(Fe,st){return new Oe(Fe,st)},Oe}();ve.version="3.10.4",o.SplitText=ve,o.default=ve,Object.defineProperty(o,"__esModule",{value:!0})})})(EV,EV.exports);var Iue=EV.exports;a1.registerPlugin($i);a1.registerPlugin(Iue.SplitText);function Pue(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var fq={exports:{}};(function(l,n){(function(o){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,u=/^(?=([^\/?#]*))\1([^]*)$/,h=/(?:\/|^)\.(?=\/)/g,g=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,b={buildAbsoluteURL:function(S,T,k){if(k=k||{},S=S.trim(),T=T.trim(),!T){if(!k.alwaysNormalize)return S;var R=b.parseURL(S);if(!R)throw new Error("Error trying to parse base URL.");return R.path=b.normalizePath(R.path),b.buildURLFromParts(R)}var V=b.parseURL(T);if(!V)throw new Error("Error trying to parse relative URL.");if(V.scheme)return k.alwaysNormalize?(V.path=b.normalizePath(V.path),b.buildURLFromParts(V)):T;var z=b.parseURL(S);if(!z)throw new Error("Error trying to parse base URL.");if(!z.netLoc&&z.path&&z.path[0]!=="/"){var $=u.exec(z.path);z.netLoc=$[1],z.path=$[2]}z.netLoc&&!z.path&&(z.path="/");var W={scheme:z.scheme,netLoc:V.netLoc,path:null,params:V.params,query:V.query,fragment:V.fragment};if(!V.netLoc&&(W.netLoc=z.netLoc,V.path[0]!=="/"))if(!V.path)W.path=z.path,V.params||(W.params=z.params,V.query||(W.query=z.query));else{var Q=z.path,j=Q.substring(0,Q.lastIndexOf("/")+1)+V.path;W.path=b.normalizePath(j)}return W.path===null&&(W.path=k.alwaysNormalize?b.normalizePath(V.path):V.path),b.buildURLFromParts(W)},parseURL:function(S){var T=i.exec(S);return T?{scheme:T[1]||"",netLoc:T[2]||"",path:T[3]||"",params:T[4]||"",query:T[5]||"",fragment:T[6]||""}:null},normalizePath:function(S){for(S=S.split("").reverse().join("").replace(h,"");S.length!==(S=S.replace(g,"")).length;);return S.split("").reverse().join("")},buildURLFromParts:function(S){return S.scheme+S.netLoc+S.path+S.params+S.query+S.fragment}};l.exports=b})()})(fq);var rz=fq.exports;function Nj(l,n){var o=Object.keys(l);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(l);n&&(i=i.filter(function(u){return Object.getOwnPropertyDescriptor(l,u).enumerable})),o.push.apply(o,i)}return o}function Eu(l){for(var n=1;n<arguments.length;n++){var o=arguments[n]!=null?arguments[n]:{};n%2?Nj(Object(o),!0).forEach(function(i){Fue(l,i,o[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(o)):Nj(Object(o)).forEach(function(i){Object.defineProperty(l,i,Object.getOwnPropertyDescriptor(o,i))})}return l}function Mue(l,n){if(typeof l!="object"||!l)return l;var o=l[Symbol.toPrimitive];if(o!==void 0){var i=o.call(l,n||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(l)}function Nue(l){var n=Mue(l,"string");return typeof n=="symbol"?n:String(n)}function Fue(l,n,o){return n=Nue(n),n in l?Object.defineProperty(l,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):l[n]=o,l}function Ic(){return Ic=Object.assign?Object.assign.bind():function(l){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(l[i]=o[i])}return l},Ic.apply(this,arguments)}const Xo=Number.isFinite||function(l){return typeof l=="number"&&isFinite(l)},Bue=Number.isSafeInteger||function(l){return typeof l=="number"&&Math.abs(l)<=$ue},$ue=Number.MAX_SAFE_INTEGER||9007199254740991;let we=function(l){return l.MEDIA_ATTACHING="hlsMediaAttaching",l.MEDIA_ATTACHED="hlsMediaAttached",l.MEDIA_DETACHING="hlsMediaDetaching",l.MEDIA_DETACHED="hlsMediaDetached",l.BUFFER_RESET="hlsBufferReset",l.BUFFER_CODECS="hlsBufferCodecs",l.BUFFER_CREATED="hlsBufferCreated",l.BUFFER_APPENDING="hlsBufferAppending",l.BUFFER_APPENDED="hlsBufferAppended",l.BUFFER_EOS="hlsBufferEos",l.BUFFER_FLUSHING="hlsBufferFlushing",l.BUFFER_FLUSHED="hlsBufferFlushed",l.MANIFEST_LOADING="hlsManifestLoading",l.MANIFEST_LOADED="hlsManifestLoaded",l.MANIFEST_PARSED="hlsManifestParsed",l.LEVEL_SWITCHING="hlsLevelSwitching",l.LEVEL_SWITCHED="hlsLevelSwitched",l.LEVEL_LOADING="hlsLevelLoading",l.LEVEL_LOADED="hlsLevelLoaded",l.LEVEL_UPDATED="hlsLevelUpdated",l.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",l.LEVELS_UPDATED="hlsLevelsUpdated",l.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",l.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",l.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",l.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",l.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",l.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",l.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",l.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",l.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",l.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",l.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",l.CUES_PARSED="hlsCuesParsed",l.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",l.INIT_PTS_FOUND="hlsInitPtsFound",l.FRAG_LOADING="hlsFragLoading",l.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",l.FRAG_LOADED="hlsFragLoaded",l.FRAG_DECRYPTED="hlsFragDecrypted",l.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",l.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",l.FRAG_PARSING_METADATA="hlsFragParsingMetadata",l.FRAG_PARSED="hlsFragParsed",l.FRAG_BUFFERED="hlsFragBuffered",l.FRAG_CHANGED="hlsFragChanged",l.FPS_DROP="hlsFpsDrop",l.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",l.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",l.ERROR="hlsError",l.DESTROYING="hlsDestroying",l.KEY_LOADING="hlsKeyLoading",l.KEY_LOADED="hlsKeyLoaded",l.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",l.BACK_BUFFER_REACHED="hlsBackBufferReached",l.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",l}({}),Gs=function(l){return l.NETWORK_ERROR="networkError",l.MEDIA_ERROR="mediaError",l.KEY_SYSTEM_ERROR="keySystemError",l.MUX_ERROR="muxError",l.OTHER_ERROR="otherError",l}({}),nn=function(l){return l.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",l.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",l.KEY_SYSTEM_NO_SESSION="keySystemNoSession",l.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",l.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",l.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",l.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",l.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",l.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",l.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",l.MANIFEST_LOAD_ERROR="manifestLoadError",l.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",l.MANIFEST_PARSING_ERROR="manifestParsingError",l.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",l.LEVEL_EMPTY_ERROR="levelEmptyError",l.LEVEL_LOAD_ERROR="levelLoadError",l.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",l.LEVEL_PARSING_ERROR="levelParsingError",l.LEVEL_SWITCH_ERROR="levelSwitchError",l.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",l.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",l.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",l.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",l.FRAG_LOAD_ERROR="fragLoadError",l.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",l.FRAG_DECRYPT_ERROR="fragDecryptError",l.FRAG_PARSING_ERROR="fragParsingError",l.FRAG_GAP="fragGap",l.REMUX_ALLOC_ERROR="remuxAllocError",l.KEY_LOAD_ERROR="keyLoadError",l.KEY_LOAD_TIMEOUT="keyLoadTimeOut",l.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",l.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",l.BUFFER_APPEND_ERROR="bufferAppendError",l.BUFFER_APPENDING_ERROR="bufferAppendingError",l.BUFFER_STALLED_ERROR="bufferStalledError",l.BUFFER_FULL_ERROR="bufferFullError",l.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",l.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",l.INTERNAL_EXCEPTION="internalException",l.INTERNAL_ABORTED="aborted",l.UNKNOWN="unknown",l}({});const eS=function(){},CV={trace:eS,debug:eS,log:eS,warn:eS,info:eS,error:eS};let tR=CV;function Hue(l){const n=self.console[l];return n?n.bind(self.console,`[${l}] >`):eS}function Uue(l,...n){n.forEach(function(o){tR[o]=l[o]?l[o].bind(l):Hue(o)})}function Vue(l,n){if(typeof console=="object"&&l===!0||typeof l=="object"){Uue(l,"debug","log","info","warn","error");try{tR.log(`Debug logs enabled for "${n}" in hls.js version 1.5.7`)}catch{tR=CV}}else tR=CV}const Mt=tR,zue=/^(\d+)x(\d+)$/,Fj=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Fl{constructor(n){typeof n=="string"&&(n=Fl.parseAttrList(n)),Ic(this,n)}get clientAttrs(){return Object.keys(this).filter(n=>n.substring(0,2)==="X-")}decimalInteger(n){const o=parseInt(this[n],10);return o>Number.MAX_SAFE_INTEGER?1/0:o}hexadecimalInteger(n){if(this[n]){let o=(this[n]||"0x").slice(2);o=(o.length&1?"0":"")+o;const i=new Uint8Array(o.length/2);for(let u=0;u<o.length/2;u++)i[u]=parseInt(o.slice(u*2,u*2+2),16);return i}else return null}hexadecimalIntegerAsNumber(n){const o=parseInt(this[n],16);return o>Number.MAX_SAFE_INTEGER?1/0:o}decimalFloatingPoint(n){return parseFloat(this[n])}optionalFloat(n,o){const i=this[n];return i?parseFloat(i):o}enumeratedString(n){return this[n]}bool(n){return this[n]==="YES"}decimalResolution(n){const o=zue.exec(this[n]);if(o!==null)return{width:parseInt(o[1],10),height:parseInt(o[2],10)}}static parseAttrList(n){let o;const i={},u='"';for(Fj.lastIndex=0;(o=Fj.exec(n))!==null;){let h=o[2];h.indexOf(u)===0&&h.lastIndexOf(u)===h.length-1&&(h=h.slice(1,-1));const g=o[1].trim();i[g]=h}return i}}function Gue(l){return l!=="ID"&&l!=="CLASS"&&l!=="START-DATE"&&l!=="DURATION"&&l!=="END-DATE"&&l!=="END-ON-NEXT"}function Wue(l){return l==="SCTE35-OUT"||l==="SCTE35-IN"}class hq{constructor(n,o){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,o){const i=o.attr;for(const u in i)if(Object.prototype.hasOwnProperty.call(n,u)&&n[u]!==i[u]){Mt.warn(`DATERANGE tag attribute: "${u}" does not match for tags with ID: "${n.ID}"`),this._badValueForSameId=u;break}n=Ic(new Fl({}),i,n)}if(this.attr=n,this._startDate=new Date(n["START-DATE"]),"END-DATE"in this.attr){const i=new Date(this.attr["END-DATE"]);Xo(i.getTime())&&(this._endDate=i)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const n=this.duration;return n!==null?new Date(this._startDate.getTime()+n*1e3):null}get duration(){if("DURATION"in this.attr){const n=this.attr.decimalFloatingPoint("DURATION");if(Xo(n))return n}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&Xo(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class UB{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var ya={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class mq{constructor(n){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[ya.AUDIO]:null,[ya.VIDEO]:null,[ya.AUDIOVIDEO]:null},this.baseurl=n}setByteRange(n,o){const i=n.split("@",2);let u;i.length===1?u=(o==null?void 0:o.byteRangeEndOffset)||0:u=parseInt(i[1]),this._byteRange=[u,parseInt(i[0])+u]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=rz.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(n){this._url=n}}class DU extends mq{constructor(n,o){super(o),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new UB,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=n}get decryptdata(){const{levelkeys:n}=this;if(!n&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const o=this.levelkeys.identity;if(o)this._decryptdata=o.getDecryptData(this.sn);else{const i=Object.keys(this.levelkeys);if(i.length===1)return this._decryptdata=this.levelkeys[i[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!Xo(this.programDateTime))return null;const n=Xo(this.duration)?this.duration:0;return this.programDateTime+n*1e3}get encrypted(){var n;if((n=this._decryptdata)!=null&&n.encrypted)return!0;if(this.levelkeys){const o=Object.keys(this.levelkeys),i=o.length;if(i>1||i===1&&this.levelkeys[o[0]].encrypted)return!0}return!1}setKeyFormat(n){if(this.levelkeys){const o=this.levelkeys[n];o&&!this._decryptdata&&(this._decryptdata=o.getDecryptData(this.sn))}}abortRequests(){var n,o;(n=this.loader)==null||n.abort(),(o=this.keyLoader)==null||o.abort()}setElementaryStreamInfo(n,o,i,u,h,g=!1){const{elementaryStreams:b}=this,S=b[n];if(!S){b[n]={startPTS:o,endPTS:i,startDTS:u,endDTS:h,partial:g};return}S.startPTS=Math.min(S.startPTS,o),S.endPTS=Math.max(S.endPTS,i),S.startDTS=Math.min(S.startDTS,u),S.endDTS=Math.max(S.endDTS,h)}clearElementaryStreamInfo(){const{elementaryStreams:n}=this;n[ya.AUDIO]=null,n[ya.VIDEO]=null,n[ya.AUDIOVIDEO]=null}}class jue extends mq{constructor(n,o,i,u,h){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new UB,this.duration=n.decimalFloatingPoint("DURATION"),this.gap=n.bool("GAP"),this.independent=n.bool("INDEPENDENT"),this.relurl=n.enumeratedString("URI"),this.fragment=o,this.index=u;const g=n.enumeratedString("BYTERANGE");g&&this.setByteRange(g,h),h&&(this.fragOffset=h.fragOffset+h.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:n}=this;return!!(n.audio||n.video||n.audiovideo)}}const Kue=10;class Zue{constructor(n){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=n}reloaded(n){if(!n){this.advanced=!0,this.updated=!0;return}const o=this.lastPartSn-n.lastPartSn,i=this.lastPartIndex-n.lastPartIndex;this.updated=this.endSN!==n.endSN||!!i||!!o||!this.live,this.advanced=this.endSN>n.endSN||o>0||o===0&&i>0,this.updated||this.advanced?this.misses=Math.floor(n.misses*.6):this.misses=n.misses+1,this.availabilityDelay=n.availabilityDelay}get hasProgramDateTime(){return this.fragments.length?Xo(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||Kue}get drift(){const n=this.driftEndTime-this.driftStartTime;return n>0?(this.driftEnd-this.driftStart)*1e3/n:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var n;return(n=this.partList)!=null&&n.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var n;return(n=this.fragments)!=null&&n.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var n;return(n=this.partList)!=null&&n.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var n;return(n=this.partList)!=null&&n.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function iz(l){return Uint8Array.from(atob(l),n=>n.charCodeAt(0))}function que(l){const n=_V(l).subarray(0,16),o=new Uint8Array(16);return o.set(n,16-n.length),o}function Yue(l){const n=function(i,u,h){const g=i[u];i[u]=i[h],i[h]=g};n(l,0,3),n(l,1,2),n(l,4,5),n(l,6,7)}function Xue(l){const n=l.split(":");let o=null;if(n[0]==="data"&&n.length===2){const i=n[1].split(";"),u=i[i.length-1].split(",");if(u.length===2){const h=u[0]==="base64",g=u[1];h?(i.splice(-1,1),o=iz(g)):o=que(g)}}return o}function _V(l){return Uint8Array.from(unescape(encodeURIComponent(l)),n=>n.charCodeAt(0))}const AT=typeof self<"u"?self:void 0;var wl={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Uf={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Bj(l){switch(l){case Uf.FAIRPLAY:return wl.FAIRPLAY;case Uf.PLAYREADY:return wl.PLAYREADY;case Uf.WIDEVINE:return wl.WIDEVINE;case Uf.CLEARKEY:return wl.CLEARKEY}}var pq={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function Jue(l){if(l===pq.WIDEVINE)return wl.WIDEVINE}function $j(l){switch(l){case wl.FAIRPLAY:return Uf.FAIRPLAY;case wl.PLAYREADY:return Uf.PLAYREADY;case wl.WIDEVINE:return Uf.WIDEVINE;case wl.CLEARKEY:return Uf.CLEARKEY}}function kU(l){const{drmSystems:n,widevineLicenseUrl:o}=l,i=n?[wl.FAIRPLAY,wl.WIDEVINE,wl.PLAYREADY,wl.CLEARKEY].filter(u=>!!n[u]):[];return!i[wl.WIDEVINE]&&o&&i.push(wl.WIDEVINE),i}const gq=function(l){return AT!=null&&(l=AT.navigator)!=null&&l.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function Que(l,n,o,i){let u;switch(l){case wl.FAIRPLAY:u=["cenc","sinf"];break;case wl.WIDEVINE:case wl.PLAYREADY:u=["cenc"];break;case wl.CLEARKEY:u=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${l}`)}return ede(u,n,o,i)}function ede(l,n,o,i){return[{initDataTypes:l,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:n.map(h=>({contentType:`audio/mp4; codecs="${h}"`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:o.map(h=>({contentType:`video/mp4; codecs="${h}"`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function uS(l,n,o){return Uint8Array.prototype.slice?l.slice(n,o):new Uint8Array(Array.prototype.slice.call(l,n,o))}const az=(l,n)=>n+10<=l.length&&l[n]===73&&l[n+1]===68&&l[n+2]===51&&l[n+3]<255&&l[n+4]<255&&l[n+6]<128&&l[n+7]<128&&l[n+8]<128&&l[n+9]<128,bq=(l,n)=>n+10<=l.length&&l[n]===51&&l[n+1]===68&&l[n+2]===73&&l[n+3]<255&&l[n+4]<255&&l[n+6]<128&&l[n+7]<128&&l[n+8]<128&&l[n+9]<128,lR=(l,n)=>{const o=n;let i=0;for(;az(l,n);){i+=10;const u=VB(l,n+6);i+=u,bq(l,n+10)&&(i+=10),n+=i}if(i>0)return l.subarray(o,o+i)},VB=(l,n)=>{let o=0;return o=(l[n]&127)<<21,o|=(l[n+1]&127)<<14,o|=(l[n+2]&127)<<7,o|=l[n+3]&127,o},tde=(l,n)=>az(l,n)&&VB(l,n+6)+10<=l.length-n,lz=l=>{const n=xq(l);for(let o=0;o<n.length;o++){const i=n[o];if(vq(i))return ade(i)}},vq=l=>l&&l.key==="PRIV"&&l.info==="com.apple.streaming.transportStreamTimestamp",nde=l=>{const n=String.fromCharCode(l[0],l[1],l[2],l[3]),o=VB(l,4),i=10;return{type:n,size:o,data:l.subarray(i,i+o)}},xq=l=>{let n=0;const o=[];for(;az(l,n);){const i=VB(l,n+6);n+=10;const u=n+i;for(;n+8<u;){const h=nde(l.subarray(n)),g=ode(h);g&&o.push(g),n+=h.size+10}bq(l,n)&&(n+=10)}return o},ode=l=>l.type==="PRIV"?sde(l):l.type[0]==="W"?ide(l):rde(l),sde=l=>{if(l.size<2)return;const n=y0(l.data,!0),o=new Uint8Array(l.data.subarray(n.length+1));return{key:l.type,info:n,data:o.buffer}},rde=l=>{if(l.size<2)return;if(l.type==="TXXX"){let o=1;const i=y0(l.data.subarray(o),!0);o+=i.length+1;const u=y0(l.data.subarray(o));return{key:l.type,info:i,data:u}}const n=y0(l.data.subarray(1));return{key:l.type,data:n}},ide=l=>{if(l.type==="WXXX"){if(l.size<2)return;let o=1;const i=y0(l.data.subarray(o),!0);o+=i.length+1;const u=y0(l.data.subarray(o));return{key:l.type,info:i,data:u}}const n=y0(l.data);return{key:l.type,data:n}},ade=l=>{if(l.data.byteLength===8){const n=new Uint8Array(l.data),o=n[3]&1;let i=(n[4]<<23)+(n[5]<<15)+(n[6]<<7)+n[7];return i/=45,o&&(i+=4772185884e-2),Math.round(i)}},y0=(l,n=!1)=>{const o=lde();if(o){const T=o.decode(l);if(n){const k=T.indexOf("\0");return k!==-1?T.substring(0,k):T}return T.replace(/\0/g,"")}const i=l.length;let u,h,g,b="",S=0;for(;S<i;){if(u=l[S++],u===0&&n)return b;if(u===0||u===3)continue;switch(u>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:b+=String.fromCharCode(u);break;case 12:case 13:h=l[S++],b+=String.fromCharCode((u&31)<<6|h&63);break;case 14:h=l[S++],g=l[S++],b+=String.fromCharCode((u&15)<<12|(h&63)<<6|(g&63)<<0);break}}return b};let AU;function lde(){if(!navigator.userAgent.includes("PlayStation 4"))return!AU&&typeof self.TextDecoder<"u"&&(AU=new self.TextDecoder("utf-8")),AU}const d0={hexDump:function(l){let n="";for(let o=0;o<l.length;o++){let i=l[o].toString(16);i.length<2&&(i="0"+i),n+=i}return n}},_B=Math.pow(2,32)-1,cde=[].push,yq={video:1,audio:2,id3:3,text:4};function Xc(l){return String.fromCharCode.apply(null,l)}function wq(l,n){const o=l[n]<<8|l[n+1];return o<0?65536+o:o}function Bs(l,n){const o=Sq(l,n);return o<0?4294967296+o:o}function Hj(l,n){let o=Bs(l,n);return o*=Math.pow(2,32),o+=Bs(l,n+4),o}function Sq(l,n){return l[n]<<24|l[n+1]<<16|l[n+2]<<8|l[n+3]}function LU(l,n,o){l[n]=o>>24,l[n+1]=o>>16&255,l[n+2]=o>>8&255,l[n+3]=o&255}function ude(l){const n=l.byteLength;for(let o=0;o<n;){const i=Bs(l,o);if(i>8&&l[o+4]===109&&l[o+5]===111&&l[o+6]===111&&l[o+7]===102)return!0;o=i>1?o+i:n}return!1}function Dr(l,n){const o=[];if(!n.length)return o;const i=l.byteLength;for(let u=0;u<i;){const h=Bs(l,u),g=Xc(l.subarray(u+4,u+8)),b=h>1?u+h:i;if(g===n[0])if(n.length===1)o.push(l.subarray(u+8,b));else{const S=Dr(l.subarray(u+8,b),n.slice(1));S.length&&cde.apply(o,S)}u=b}return o}function dde(l){const n=[],o=l[0];let i=8;const u=Bs(l,i);i+=4;let h=0,g=0;o===0?(h=Bs(l,i),g=Bs(l,i+4),i+=8):(h=Hj(l,i),g=Hj(l,i+8),i+=16),i+=2;let b=l.length+g;const S=wq(l,i);i+=2;for(let T=0;T<S;T++){let k=i;const R=Bs(l,k);k+=4;const V=R&2147483647;if((R&2147483648)>>>31===1)return Mt.warn("SIDX has hierarchical references (not supported)"),null;const $=Bs(l,k);k+=4,n.push({referenceSize:V,subsegmentDuration:$,info:{duration:$/u,start:b,end:b+V-1}}),b+=V,k+=4,i=k}return{earliestPresentationTime:h,timescale:u,version:o,referencesCount:S,references:n}}function Eq(l){const n=[],o=Dr(l,["moov","trak"]);for(let u=0;u<o.length;u++){const h=o[u],g=Dr(h,["tkhd"])[0];if(g){let b=g[0];const S=Bs(g,b===0?12:20),T=Dr(h,["mdia","mdhd"])[0];if(T){b=T[0];const k=Bs(T,b===0?12:20),R=Dr(h,["mdia","hdlr"])[0];if(R){const V=Xc(R.subarray(8,12)),z={soun:ya.AUDIO,vide:ya.VIDEO}[V];if(z){const $=Dr(h,["mdia","minf","stbl","stsd"])[0],W=fde($);n[S]={timescale:k,type:z},n[z]=Eu({timescale:k,id:S},W)}}}}}return Dr(l,["moov","mvex","trex"]).forEach(u=>{const h=Bs(u,4),g=n[h];g&&(g.default={duration:Bs(u,12),flags:Bs(u,20)})}),n}function fde(l){const n=l.subarray(8),o=n.subarray(86),i=Xc(n.subarray(4,8));let u=i;const h=i==="enca"||i==="encv";if(h){const b=Dr(n,[i])[0].subarray(i==="enca"?28:78);Dr(b,["sinf"]).forEach(T=>{const k=Dr(T,["schm"])[0];if(k){const R=Xc(k.subarray(4,8));if(R==="cbcs"||R==="cenc"){const V=Dr(T,["frma"])[0];V&&(u=Xc(V))}}})}switch(u){case"avc1":case"avc2":case"avc3":case"avc4":{const g=Dr(o,["avcC"])[0];u+="."+O4(g[1])+O4(g[2])+O4(g[3]);break}case"mp4a":{const g=Dr(n,[i])[0],b=Dr(g.subarray(28),["esds"])[0];if(b&&b.length>12){let S=4;if(b[S++]!==3)break;S=RU(b,S),S+=2;const T=b[S++];if(T&128&&(S+=2),T&64&&(S+=b[S++]),b[S++]!==4)break;S=RU(b,S);const k=b[S++];if(k===64)u+="."+O4(k);else break;if(S+=12,b[S++]!==5)break;S=RU(b,S);const R=b[S++];let V=(R&248)>>3;V===31&&(V+=1+((R&7)<<3)+((b[S]&224)>>5)),u+="."+V}break}case"hvc1":case"hev1":{const g=Dr(o,["hvcC"])[0],b=g[1],S=["","A","B","C"][b>>6],T=b&31,k=Bs(g,2),R=(b&32)>>5?"H":"L",V=g[12],z=g.subarray(6,12);u+="."+S+T,u+="."+k.toString(16).toUpperCase(),u+="."+R+V;let $="";for(let W=z.length;W--;){const Q=z[W];(Q||$)&&($="."+Q.toString(16).toUpperCase()+$)}u+=$;break}case"dvh1":case"dvhe":{const g=Dr(o,["dvcC"])[0],b=g[2]>>1&127,S=g[2]<<5&32|g[3]>>3&31;u+="."+c0(b)+"."+c0(S);break}case"vp09":{const g=Dr(o,["vpcC"])[0],b=g[4],S=g[5],T=g[6]>>4&15;u+="."+c0(b)+"."+c0(S)+"."+c0(T);break}case"av01":{const g=Dr(o,["av1C"])[0],b=g[1]>>>5,S=g[1]&31,T=g[2]>>>7?"H":"M",k=(g[2]&64)>>6,R=(g[2]&32)>>5,V=b===2&&k?R?12:10:k?10:8,z=(g[2]&16)>>4,$=(g[2]&8)>>3,W=(g[2]&4)>>2,Q=g[2]&3;u+="."+b+"."+c0(S)+T+"."+c0(V)+"."+z+"."+$+W+Q+"."+c0(1)+"."+c0(1)+"."+c0(1)+"."+0;break}}return{codec:u,encrypted:h}}function RU(l,n){const o=n+5;for(;l[n++]&128&&n<o;);return n}function O4(l){return("0"+l.toString(16).toUpperCase()).slice(-2)}function c0(l){return(l<10?"0":"")+l}function hde(l,n){if(!l||!n)return l;const o=n.keyId;return o&&n.isCommonEncryption&&Dr(l,["moov","trak"]).forEach(u=>{const g=Dr(u,["mdia","minf","stbl","stsd"])[0].subarray(8);let b=Dr(g,["enca"]);const S=b.length>0;S||(b=Dr(g,["encv"])),b.forEach(T=>{const k=S?T.subarray(28):T.subarray(78);Dr(k,["sinf"]).forEach(V=>{const z=Cq(V);if(z){const $=z.subarray(8,24);$.some(W=>W!==0)||(Mt.log(`[eme] Patching keyId in 'enc${S?"a":"v"}>sinf>>tenc' box: ${d0.hexDump($)} -> ${d0.hexDump(o)}`),z.set(o,8))}})})}),l}function Cq(l){const n=Dr(l,["schm"])[0];if(n){const o=Xc(n.subarray(4,8));if(o==="cbcs"||o==="cenc")return Dr(l,["schi","tenc"])[0]}return Mt.error("[eme] missing 'schm' box"),null}function mde(l,n){return Dr(n,["moof","traf"]).reduce((o,i)=>{const u=Dr(i,["tfdt"])[0],h=u[0],g=Dr(i,["tfhd"]).reduce((b,S)=>{const T=Bs(S,4),k=l[T];if(k){let R=Bs(u,4);if(h===1){if(R===_B)return Mt.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),b;R*=_B+1,R+=Bs(u,8)}const V=k.timescale||9e4,z=R/V;if(Xo(z)&&(b===null||z<b))return z}return b},null);return g!==null&&Xo(g)&&(o===null||g<o)?g:o},null)}function pde(l,n){let o=0,i=0,u=0;const h=Dr(l,["moof","traf"]);for(let g=0;g<h.length;g++){const b=h[g],S=Dr(b,["tfhd"])[0],T=Bs(S,4),k=n[T];if(!k)continue;const R=k.default,V=Bs(S,0)|(R==null?void 0:R.flags);let z=R==null?void 0:R.duration;V&8&&(V&2?z=Bs(S,12):z=Bs(S,8));const $=k.timescale||9e4,W=Dr(b,["trun"]);for(let Q=0;Q<W.length;Q++){if(o=gde(W[Q]),!o&&z){const j=Bs(W[Q],4);o=z*j}k.type===ya.VIDEO?i+=o/$:k.type===ya.AUDIO&&(u+=o/$)}}if(i===0&&u===0){let g=1/0,b=0,S=0;const T=Dr(l,["sidx"]);for(let k=0;k<T.length;k++){const R=dde(T[k]);if(R!=null&&R.references){g=Math.min(g,R.earliestPresentationTime/R.timescale);const V=R.references.reduce((z,$)=>z+$.info.duration||0,0);b=Math.max(b,V+R.earliestPresentationTime/R.timescale),S=b-g}}if(S&&Xo(S))return S}return i||u}function gde(l){const n=Bs(l,0);let o=8;n&1&&(o+=4),n&4&&(o+=4);let i=0;const u=Bs(l,4);for(let h=0;h<u;h++){if(n&256){const g=Bs(l,o);i+=g,o+=4}n&512&&(o+=4),n&1024&&(o+=4),n&2048&&(o+=4)}return i}function bde(l,n,o){Dr(n,["moof","traf"]).forEach(i=>{Dr(i,["tfhd"]).forEach(u=>{const h=Bs(u,4),g=l[h];if(!g)return;const b=g.timescale||9e4;Dr(i,["tfdt"]).forEach(S=>{const T=S[0],k=o*b;if(k){let R=Bs(S,4);if(T===0)R-=k,R=Math.max(R,0),LU(S,4,R);else{R*=Math.pow(2,32),R+=Bs(S,8),R-=k,R=Math.max(R,0);const V=Math.floor(R/(_B+1)),z=Math.floor(R%(_B+1));LU(S,4,V),LU(S,8,z)}}})})})}function vde(l){const n={valid:null,remainder:null},o=Dr(l,["moof"]);if(o.length<2)return n.remainder=l,n;const i=o[o.length-1];return n.valid=uS(l,0,i.byteOffset-8),n.remainder=uS(l,i.byteOffset-8),n}function Mm(l,n){const o=new Uint8Array(l.length+n.length);return o.set(l),o.set(n,l.length),o}function Uj(l,n){const o=[],i=n.samples,u=n.timescale,h=n.id;let g=!1;return Dr(i,["moof"]).map(S=>{const T=S.byteOffset-8;Dr(S,["traf"]).map(R=>{const V=Dr(R,["tfdt"]).map(z=>{const $=z[0];let W=Bs(z,4);return $===1&&(W*=Math.pow(2,32),W+=Bs(z,8)),W/u})[0];return V!==void 0&&(l=V),Dr(R,["tfhd"]).map(z=>{const $=Bs(z,4),W=Bs(z,0)&16777215,Q=(W&1)!==0,j=(W&2)!==0,se=(W&8)!==0;let re=0;const Y=(W&16)!==0;let me=0;const ae=(W&32)!==0;let Ce=8;$===h&&(Q&&(Ce+=8),j&&(Ce+=4),se&&(re=Bs(z,Ce),Ce+=4),Y&&(me=Bs(z,Ce),Ce+=4),ae&&(Ce+=4),n.type==="video"&&(g=xde(n.codec)),Dr(R,["trun"]).map(Ue=>{const ot=Ue[0],Ae=Bs(Ue,0)&16777215,ve=(Ae&1)!==0;let Oe=0;const O=(Ae&4)!==0,De=(Ae&256)!==0;let Fe=0;const st=(Ae&512)!==0;let Ut=0;const et=(Ae&1024)!==0,Dt=(Ae&2048)!==0;let Xe=0;const it=Bs(Ue,4);let qe=8;ve&&(Oe=Bs(Ue,qe),qe+=4),O&&(qe+=4);let mt=Oe+T;for(let Un=0;Un<it;Un++){if(De?(Fe=Bs(Ue,qe),qe+=4):Fe=re,st?(Ut=Bs(Ue,qe),qe+=4):Ut=me,et&&(qe+=4),Dt&&(ot===0?Xe=Bs(Ue,qe):Xe=Sq(Ue,qe),qe+=4),n.type===ya.VIDEO){let on=0;for(;on<Ut;){const vt=Bs(i,mt);if(mt+=4,yde(g,i[mt])){const an=i.subarray(mt,mt+vt);_q(an,g?2:1,l+Xe/u,o)}mt+=vt,on+=vt+4}}l+=Fe/u}}))})})}),o}function xde(l){if(!l)return!1;const n=l.indexOf("."),o=n<0?l:l.substring(0,n);return o==="hvc1"||o==="hev1"||o==="dvh1"||o==="dvhe"}function yde(l,n){if(l){const o=n>>1&63;return o===39||o===40}else return(n&31)===6}function _q(l,n,o,i){const u=Tq(l);let h=0;h+=n;let g=0,b=0,S=0;for(;h<u.length;){g=0;do{if(h>=u.length)break;S=u[h++],g+=S}while(S===255);b=0;do{if(h>=u.length)break;S=u[h++],b+=S}while(S===255);const T=u.length-h;let k=h;if(b<T)h+=b;else if(b>T){Mt.error(`Malformed SEI payload. ${b} is too small, only ${T} bytes left to parse.`);break}if(g===4){if(u[k++]===181){const V=wq(u,k);if(k+=2,V===49){const z=Bs(u,k);if(k+=4,z===1195456820){const $=u[k++];if($===3){const W=u[k++],Q=31&W,j=64&W,se=j?2+Q*3:0,re=new Uint8Array(se);if(j){re[0]=W;for(let Y=1;Y<se;Y++)re[Y]=u[k++]}i.push({type:$,payloadType:g,pts:o,bytes:re})}}}}}else if(g===5&&b>16){const R=[];for(let $=0;$<16;$++){const W=u[k++].toString(16);R.push(W.length==1?"0"+W:W),($===3||$===5||$===7||$===9)&&R.push("-")}const V=b-16,z=new Uint8Array(V);for(let $=0;$<V;$++)z[$]=u[k++];i.push({payloadType:g,pts:o,uuid:R.join(""),userData:y0(z),userDataBytes:z})}}}function Tq(l){const n=l.byteLength,o=[];let i=1;for(;i<n-2;)l[i]===0&&l[i+1]===0&&l[i+2]===3?(o.push(i+2),i+=2):i++;if(o.length===0)return l;const u=n-o.length,h=new Uint8Array(u);let g=0;for(i=0;i<u;g++,i++)g===o[0]&&(g++,o.shift()),h[i]=l[g];return h}function wde(l){const n=l[0];let o="",i="",u=0,h=0,g=0,b=0,S=0,T=0;if(n===0){for(;Xc(l.subarray(T,T+1))!=="\0";)o+=Xc(l.subarray(T,T+1)),T+=1;for(o+=Xc(l.subarray(T,T+1)),T+=1;Xc(l.subarray(T,T+1))!=="\0";)i+=Xc(l.subarray(T,T+1)),T+=1;i+=Xc(l.subarray(T,T+1)),T+=1,u=Bs(l,12),h=Bs(l,16),b=Bs(l,20),S=Bs(l,24),T=28}else if(n===1){T+=4,u=Bs(l,T),T+=4;const R=Bs(l,T);T+=4;const V=Bs(l,T);for(T+=4,g=2**32*R+V,Bue(g)||(g=Number.MAX_SAFE_INTEGER,Mt.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),b=Bs(l,T),T+=4,S=Bs(l,T),T+=4;Xc(l.subarray(T,T+1))!=="\0";)o+=Xc(l.subarray(T,T+1)),T+=1;for(o+=Xc(l.subarray(T,T+1)),T+=1;Xc(l.subarray(T,T+1))!=="\0";)i+=Xc(l.subarray(T,T+1)),T+=1;i+=Xc(l.subarray(T,T+1)),T+=1}const k=l.subarray(T,l.byteLength);return{schemeIdUri:o,value:i,timeScale:u,presentationTime:g,presentationTimeDelta:h,eventDuration:b,id:S,payload:k}}function Sde(l,...n){const o=n.length;let i=8,u=o;for(;u--;)i+=n[u].byteLength;const h=new Uint8Array(i);for(h[0]=i>>24&255,h[1]=i>>16&255,h[2]=i>>8&255,h[3]=i&255,h.set(l,4),u=0,i=8;u<o;u++)h.set(n[u],i),i+=n[u].byteLength;return h}function Ede(l,n,o){if(l.byteLength!==16)throw new RangeError("Invalid system id");let i,u;if(n){i=1,u=new Uint8Array(n.length*16);for(let b=0;b<n.length;b++){const S=n[b];if(S.byteLength!==16)throw new RangeError("Invalid key");u.set(S,b*16)}}else i=0,u=new Uint8Array;let h;i>0?(h=new Uint8Array(4),n.length>0&&new DataView(h.buffer).setUint32(0,n.length,!1)):h=new Uint8Array;const g=new Uint8Array(4);return o&&o.byteLength>0&&new DataView(g.buffer).setUint32(0,o.byteLength,!1),Sde([112,115,115,104],new Uint8Array([i,0,0,0]),l,h,u,g,o||new Uint8Array)}function Cde(l){if(!(l instanceof ArrayBuffer)||l.byteLength<32)return null;const n={version:0,systemId:"",kids:null,data:null},o=new DataView(l),i=o.getUint32(0);if(l.byteLength!==i&&i>44||o.getUint32(4)!==1886614376||(n.version=o.getUint32(8)>>>24,n.version>1))return null;n.systemId=d0.hexDump(new Uint8Array(l,12,16));const h=o.getUint32(28);if(n.version===0){if(i-32<h)return null;n.data=new Uint8Array(l,32,h)}else if(n.version===1){n.kids=[];for(let g=0;g<h;g++)n.kids.push(new Uint8Array(l,32+g*16,16))}return n}let I4={};class cR{static clearKeyUriToKeyIdMap(){I4={}}constructor(n,o,i,u=[1],h=null){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=n,this.uri=o,this.keyFormat=i,this.keyFormatVersions=u,this.iv=h,this.encrypted=n?n!=="NONE":!1,this.isCommonEncryption=this.encrypted&&n!=="AES-128"}isSupported(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Uf.FAIRPLAY:case Uf.WIDEVINE:case Uf.PLAYREADY:case Uf.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(n){if(!this.encrypted||!this.uri)return null;if(this.method==="AES-128"&&this.uri&&!this.iv){typeof n!="number"&&(this.method==="AES-128"&&!this.iv&&Mt.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),n=0);const i=_de(n);return new cR(this.method,this.uri,"identity",this.keyFormatVersions,i)}const o=Xue(this.uri);if(o)switch(this.keyFormat){case Uf.WIDEVINE:this.pssh=o,o.length>=22&&(this.keyId=o.subarray(o.length-22,o.length-6));break;case Uf.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Ede(i,null,o);const u=new Uint16Array(o.buffer,o.byteOffset,o.byteLength/2),h=String.fromCharCode.apply(null,Array.from(u)),g=h.substring(h.indexOf("<"),h.length),T=new DOMParser().parseFromString(g,"text/xml").getElementsByTagName("KID")[0];if(T){const k=T.childNodes[0]?T.childNodes[0].nodeValue:T.getAttribute("VALUE");if(k){const R=iz(k).subarray(0,16);Yue(R),this.keyId=R}}break}default:{let i=o.subarray(0,16);if(i.length!==16){const u=new Uint8Array(16);u.set(i,16-i.length),i=u}this.keyId=i;break}}if(!this.keyId||this.keyId.byteLength!==16){let i=I4[this.uri];if(!i){const u=Object.keys(I4).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,u),I4[this.uri]=i}this.keyId=i}return this}}function _de(l){const n=new Uint8Array(16);for(let o=12;o<16;o++)n[o]=l>>8*(15-o)&255;return n}const Dq=/\{\$([a-zA-Z0-9-_]+)\}/g;function Vj(l){return Dq.test(l)}function $f(l,n,o){if(l.variableList!==null||l.hasVariableRefs)for(let i=o.length;i--;){const u=o[i],h=n[u];h&&(n[u]=TV(l,h))}}function TV(l,n){if(l.variableList!==null||l.hasVariableRefs){const o=l.variableList;return n.replace(Dq,i=>{const u=i.substring(2,i.length-1),h=o==null?void 0:o[u];return h===void 0?(l.playlistParsingError||(l.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${u}"`)),i):h})}return n}function zj(l,n,o){let i=l.variableList;i||(l.variableList=i={});let u,h;if("QUERYPARAM"in n){u=n.QUERYPARAM;try{const g=new self.URL(o).searchParams;if(g.has(u))h=g.get(u);else throw new Error(`"${u}" does not match any query parameter in URI: "${o}"`)}catch(g){l.playlistParsingError||(l.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${g.message}`))}}else u=n.NAME,h=n.VALUE;u in i?l.playlistParsingError||(l.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${u}"`)):i[u]=h||""}function Tde(l,n,o){const i=n.IMPORT;if(o&&i in o){let u=l.variableList;u||(l.variableList=u={}),u[i]=o[i]}else l.playlistParsingError||(l.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}function PT(l=!0){return typeof self>"u"?void 0:(l||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}const TB={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Dde(l,n){const o=TB[n];return!!o&&!!o[l.slice(0,4)]}function OU(l,n,o=!0){return!l.split(",").some(i=>!kq(i,n,o))}function kq(l,n,o=!0){var i;const u=PT(o);return(i=u==null?void 0:u.isTypeSupported(uR(l,n)))!=null?i:!1}function uR(l,n){return`${n}/mp4;codecs="${l}"`}function Gj(l){if(l){const n=l.substring(0,4);return TB.video[n]}return 2}function DB(l){return l.split(",").reduce((n,o)=>{const i=TB.video[o];return i?(i*2+n)/(n?3:2):(TB.audio[o]+n)/(n?2:1)},0)}const IU={};function kde(l,n=!0){if(IU[l])return IU[l];const o={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[l];for(let i=0;i<o.length;i++)if(kq(o[i],"audio",n))return IU[l]=o[i],o[i];return l}const Ade=/flac|opus/i;function kB(l,n=!0){return l.replace(Ade,o=>kde(o.toLowerCase(),n))}function Wj(l,n){return l&&l!=="mp4a"?l:n}function Lde(l){const n=l.split(".");if(n.length>2){let o=n.shift()+".";return o+=parseInt(n.shift()).toString(16),o+=("000"+parseInt(n.shift()).toString(16)).slice(-4),o}return l}const jj=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,Kj=/#EXT-X-MEDIA:(.*)/g,Rde=/^#EXT(?:INF|-X-TARGETDURATION):/m,Zj=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),Ode=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class g0{static findGroup(n,o){for(let i=0;i<n.length;i++){const u=n[i];if(u.id===o)return u}}static resolve(n,o){return rz.buildAbsoluteURL(o,n,{alwaysNormalize:!0})}static isMediaPlaylist(n){return Rde.test(n)}static parseMasterPlaylist(n,o){const i=Vj(n),u={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},h=[];jj.lastIndex=0;let g;for(;(g=jj.exec(n))!=null;)if(g[1]){var b;const T=new Fl(g[1]);$f(u,T,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const k=TV(u,g[2]),R={attrs:T,bitrate:T.decimalInteger("BANDWIDTH")||T.decimalInteger("AVERAGE-BANDWIDTH"),name:T.NAME,url:g0.resolve(k,o)},V=T.decimalResolution("RESOLUTION");V&&(R.width=V.width,R.height=V.height),Ide(T.CODECS,R),(b=R.unknownCodecs)!=null&&b.length||h.push(R),u.levels.push(R)}else if(g[3]){const T=g[3],k=g[4];switch(T){case"SESSION-DATA":{const R=new Fl(k);$f(u,R,["DATA-ID","LANGUAGE","VALUE","URI"]);const V=R["DATA-ID"];V&&(u.sessionData===null&&(u.sessionData={}),u.sessionData[V]=R);break}case"SESSION-KEY":{const R=qj(k,o,u);R.encrypted&&R.isSupported()?(u.sessionKeys===null&&(u.sessionKeys=[]),u.sessionKeys.push(R)):Mt.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${k}"`);break}case"DEFINE":{{const R=new Fl(k);$f(u,R,["NAME","VALUE","QUERYPARAM"]),zj(u,R,o)}break}case"CONTENT-STEERING":{const R=new Fl(k);$f(u,R,["SERVER-URI","PATHWAY-ID"]),u.contentSteering={uri:g0.resolve(R["SERVER-URI"],o),pathwayId:R["PATHWAY-ID"]||"."};break}case"START":{u.startTimeOffset=Yj(k);break}}}const S=h.length>0&&h.length<u.levels.length;return u.levels=S?h:u.levels,u.levels.length===0&&(u.playlistParsingError=new Error("no levels found in manifest")),u}static parseMasterPlaylistMedia(n,o,i){let u;const h={},g=i.levels,b={AUDIO:g.map(T=>({id:T.attrs.AUDIO,audioCodec:T.audioCodec})),SUBTITLES:g.map(T=>({id:T.attrs.SUBTITLES,textCodec:T.textCodec})),"CLOSED-CAPTIONS":[]};let S=0;for(Kj.lastIndex=0;(u=Kj.exec(n))!==null;){const T=new Fl(u[1]),k=T.TYPE;if(k){const R=b[k],V=h[k]||[];h[k]=V,$f(i,T,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const z=T.LANGUAGE,$=T["ASSOC-LANGUAGE"],W=T.CHANNELS,Q=T.CHARACTERISTICS,j=T["INSTREAM-ID"],se={attrs:T,bitrate:0,id:S++,groupId:T["GROUP-ID"]||"",name:T.NAME||z||"",type:k,default:T.bool("DEFAULT"),autoselect:T.bool("AUTOSELECT"),forced:T.bool("FORCED"),lang:z,url:T.URI?g0.resolve(T.URI,o):""};if($&&(se.assocLang=$),W&&(se.channels=W),Q&&(se.characteristics=Q),j&&(se.instreamId=j),R!=null&&R.length){const re=g0.findGroup(R,se.groupId)||R[0];Xj(se,re,"audioCodec"),Xj(se,re,"textCodec")}V.push(se)}}return h}static parseLevelPlaylist(n,o,i,u,h,g){const b=new Zue(o),S=b.fragments;let T=null,k=0,R=0,V=0,z=0,$=null,W=new DU(u,o),Q,j,se,re=-1,Y=!1,me=null;for(Zj.lastIndex=0,b.m3u8=n,b.hasVariableRefs=Vj(n);(Q=Zj.exec(n))!==null;){Y&&(Y=!1,W=new DU(u,o),W.start=V,W.sn=k,W.cc=z,W.level=i,T&&(W.initSegment=T,W.rawProgramDateTime=T.rawProgramDateTime,T.rawProgramDateTime=null,me&&(W.setByteRange(me),me=null)));const ot=Q[1];if(ot){W.duration=parseFloat(ot);const Ae=(" "+Q[2]).slice(1);W.title=Ae||null,W.tagList.push(Ae?["INF",ot,Ae]:["INF",ot])}else if(Q[3]){if(Xo(W.duration)){W.start=V,se&&eK(W,se,b),W.sn=k,W.level=i,W.cc=z,S.push(W);const Ae=(" "+Q[3]).slice(1);W.relurl=TV(b,Ae),Jj(W,$),$=W,V+=W.duration,k++,R=0,Y=!0}}else if(Q[4]){const Ae=(" "+Q[4]).slice(1);$?W.setByteRange(Ae,$):W.setByteRange(Ae)}else if(Q[5])W.rawProgramDateTime=(" "+Q[5]).slice(1),W.tagList.push(["PROGRAM-DATE-TIME",W.rawProgramDateTime]),re===-1&&(re=S.length);else{if(Q=Q[0].match(Ode),!Q){Mt.warn("No matches on slow regex match for level playlist!");continue}for(j=1;j<Q.length&&!(typeof Q[j]<"u");j++);const Ae=(" "+Q[j]).slice(1),ve=(" "+Q[j+1]).slice(1),Oe=Q[j+2]?(" "+Q[j+2]).slice(1):"";switch(Ae){case"PLAYLIST-TYPE":b.type=ve.toUpperCase();break;case"MEDIA-SEQUENCE":k=b.startSN=parseInt(ve);break;case"SKIP":{const O=new Fl(ve);$f(b,O,["RECENTLY-REMOVED-DATERANGES"]);const De=O.decimalInteger("SKIPPED-SEGMENTS");if(Xo(De)){b.skippedSegments=De;for(let st=De;st--;)S.unshift(null);k+=De}const Fe=O.enumeratedString("RECENTLY-REMOVED-DATERANGES");Fe&&(b.recentlyRemovedDateranges=Fe.split("	"));break}case"TARGETDURATION":b.targetduration=Math.max(parseInt(ve),1);break;case"VERSION":b.version=parseInt(ve);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":b.live=!1;break;case"#":(ve||Oe)&&W.tagList.push(Oe?[ve,Oe]:[ve]);break;case"DISCONTINUITY":z++,W.tagList.push(["DIS"]);break;case"GAP":W.gap=!0,W.tagList.push([Ae]);break;case"BITRATE":W.tagList.push([Ae,ve]);break;case"DATERANGE":{const O=new Fl(ve);$f(b,O,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),$f(b,O,O.clientAttrs);const De=new hq(O,b.dateRanges[O.ID]);De.isValid||b.skippedSegments?b.dateRanges[De.id]=De:Mt.warn(`Ignoring invalid DATERANGE tag: "${ve}"`),W.tagList.push(["EXT-X-DATERANGE",ve]);break}case"DEFINE":{{const O=new Fl(ve);$f(b,O,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in O?Tde(b,O,g):zj(b,O,o)}break}case"DISCONTINUITY-SEQUENCE":z=parseInt(ve);break;case"KEY":{const O=qj(ve,o,b);if(O.isSupported()){if(O.method==="NONE"){se=void 0;break}se||(se={}),se[O.keyFormat]&&(se=Ic({},se)),se[O.keyFormat]=O}else Mt.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${ve}"`);break}case"START":b.startTimeOffset=Yj(ve);break;case"MAP":{const O=new Fl(ve);if($f(b,O,["BYTERANGE","URI"]),W.duration){const De=new DU(u,o);Qj(De,O,i,se),T=De,W.initSegment=T,T.rawProgramDateTime&&!W.rawProgramDateTime&&(W.rawProgramDateTime=T.rawProgramDateTime)}else{const De=W.byteRangeEndOffset;if(De){const Fe=W.byteRangeStartOffset;me=`${De-Fe}@${Fe}`}else me=null;Qj(W,O,i,se),T=W,Y=!0}break}case"SERVER-CONTROL":{const O=new Fl(ve);b.canBlockReload=O.bool("CAN-BLOCK-RELOAD"),b.canSkipUntil=O.optionalFloat("CAN-SKIP-UNTIL",0),b.canSkipDateRanges=b.canSkipUntil>0&&O.bool("CAN-SKIP-DATERANGES"),b.partHoldBack=O.optionalFloat("PART-HOLD-BACK",0),b.holdBack=O.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const O=new Fl(ve);b.partTarget=O.decimalFloatingPoint("PART-TARGET");break}case"PART":{let O=b.partList;O||(O=b.partList=[]);const De=R>0?O[O.length-1]:void 0,Fe=R++,st=new Fl(ve);$f(b,st,["BYTERANGE","URI"]);const Ut=new jue(st,W,o,Fe,De);O.push(Ut),W.duration+=Ut.duration;break}case"PRELOAD-HINT":{const O=new Fl(ve);$f(b,O,["URI"]),b.preloadHint=O;break}case"RENDITION-REPORT":{const O=new Fl(ve);$f(b,O,["URI"]),b.renditionReports=b.renditionReports||[],b.renditionReports.push(O);break}default:Mt.warn(`line parsed but not handled: ${Q}`);break}}}$&&!$.relurl?(S.pop(),V-=$.duration,b.partList&&(b.fragmentHint=$)):b.partList&&(Jj(W,$),W.cc=z,b.fragmentHint=W,se&&eK(W,se,b));const ae=S.length,Ce=S[0],Ue=S[ae-1];if(V+=b.skippedSegments*b.targetduration,V>0&&ae&&Ue){b.averagetargetduration=V/ae;const ot=Ue.sn;b.endSN=ot!=="initSegment"?ot:0,b.live||(Ue.endList=!0),Ce&&(b.startCC=Ce.cc)}else b.endSN=0,b.startCC=0;return b.fragmentHint&&(V+=b.fragmentHint.duration),b.totalduration=V,b.endCC=z,re>0&&Pde(S,re),b}}function qj(l,n,o){var i,u;const h=new Fl(l);$f(o,h,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const g=(i=h.METHOD)!=null?i:"",b=h.URI,S=h.hexadecimalInteger("IV"),T=h.KEYFORMATVERSIONS,k=(u=h.KEYFORMAT)!=null?u:"identity";b&&h.IV&&!S&&Mt.error(`Invalid IV: ${h.IV}`);const R=b?g0.resolve(b,n):"",V=(T||"1").split("/").map(Number).filter(Number.isFinite);return new cR(g,R,k,V,S)}function Yj(l){const o=new Fl(l).decimalFloatingPoint("TIME-OFFSET");return Xo(o)?o:null}function Ide(l,n){let o=(l||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const u=o.filter(h=>Dde(h,i));u.length&&(n[`${i}Codec`]=u.join(","),o=o.filter(h=>u.indexOf(h)===-1))}),n.unknownCodecs=o}function Xj(l,n,o){const i=n[o];i&&(l[o]=i)}function Pde(l,n){let o=l[n];for(let i=n;i--;){const u=l[i];if(!u)return;u.programDateTime=o.programDateTime-u.duration*1e3,o=u}}function Jj(l,n){l.rawProgramDateTime?l.programDateTime=Date.parse(l.rawProgramDateTime):n!=null&&n.programDateTime&&(l.programDateTime=n.endProgramDateTime),Xo(l.programDateTime)||(l.programDateTime=null,l.rawProgramDateTime=null)}function Qj(l,n,o,i){l.relurl=n.URI,n.BYTERANGE&&l.setByteRange(n.BYTERANGE),l.level=o,l.sn="initSegment",i&&(l.levelkeys=i),l.initSegment=null}function eK(l,n,o){l.levelkeys=n;const{encryptedFragments:i}=o;(!i.length||i[i.length-1].levelkeys!==n)&&Object.keys(n).some(u=>n[u].isCommonEncryption)&&i.push(l)}var Ci={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},Us={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function tK(l){const{type:n}=l;switch(n){case Ci.AUDIO_TRACK:return Us.AUDIO;case Ci.SUBTITLE_TRACK:return Us.SUBTITLE;default:return Us.MAIN}}function PU(l,n){let o=l.url;return(o===void 0||o.indexOf("data:")===0)&&(o=n.url),o}class Mde{constructor(n){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=n,this.registerListeners()}startLoad(n){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:n}=this;n.on(we.MANIFEST_LOADING,this.onManifestLoading,this),n.on(we.LEVEL_LOADING,this.onLevelLoading,this),n.on(we.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),n.on(we.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:n}=this;n.off(we.MANIFEST_LOADING,this.onManifestLoading,this),n.off(we.LEVEL_LOADING,this.onLevelLoading,this),n.off(we.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),n.off(we.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(n){const o=this.hls.config,i=o.pLoader,u=o.loader,h=i||u,g=new h(o);return this.loaders[n.type]=g,g}getInternalLoader(n){return this.loaders[n.type]}resetInternalLoader(n){this.loaders[n]&&delete this.loaders[n]}destroyInternalLoaders(){for(const n in this.loaders){const o=this.loaders[n];o&&o.destroy(),this.resetInternalLoader(n)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(n,o){const{url:i}=o;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Ci.MANIFEST,url:i,deliveryDirectives:null})}onLevelLoading(n,o){const{id:i,level:u,pathwayId:h,url:g,deliveryDirectives:b}=o;this.load({id:i,level:u,pathwayId:h,responseType:"text",type:Ci.LEVEL,url:g,deliveryDirectives:b})}onAudioTrackLoading(n,o){const{id:i,groupId:u,url:h,deliveryDirectives:g}=o;this.load({id:i,groupId:u,level:null,responseType:"text",type:Ci.AUDIO_TRACK,url:h,deliveryDirectives:g})}onSubtitleTrackLoading(n,o){const{id:i,groupId:u,url:h,deliveryDirectives:g}=o;this.load({id:i,groupId:u,level:null,responseType:"text",type:Ci.SUBTITLE_TRACK,url:h,deliveryDirectives:g})}load(n){var o;const i=this.hls.config;let u=this.getInternalLoader(n);if(u){const T=u.context;if(T&&T.url===n.url&&T.level===n.level){Mt.trace("[playlist-loader]: playlist request ongoing");return}Mt.log(`[playlist-loader]: aborting previous loader for type: ${n.type}`),u.abort()}let h;if(n.type===Ci.MANIFEST?h=i.manifestLoadPolicy.default:h=Ic({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),u=this.createInternalLoader(n),Xo((o=n.deliveryDirectives)==null?void 0:o.part)){let T;if(n.type===Ci.LEVEL&&n.level!==null?T=this.hls.levels[n.level].details:n.type===Ci.AUDIO_TRACK&&n.id!==null?T=this.hls.audioTracks[n.id].details:n.type===Ci.SUBTITLE_TRACK&&n.id!==null&&(T=this.hls.subtitleTracks[n.id].details),T){const k=T.partTarget,R=T.targetduration;if(k&&R){const V=Math.max(k*3,R*.8)*1e3;h=Ic({},h,{maxTimeToFirstByteMs:Math.min(V,h.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(V,h.maxTimeToFirstByteMs)})}}}const g=h.errorRetry||h.timeoutRetry||{},b={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:g.maxNumRetry||0,retryDelay:g.retryDelayMs||0,maxRetryDelay:g.maxRetryDelayMs||0},S={onSuccess:(T,k,R,V)=>{const z=this.getInternalLoader(R);this.resetInternalLoader(R.type);const $=T.data;if($.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(T,R,new Error("no EXTM3U delimiter"),V||null,k);return}k.parsing.start=performance.now(),g0.isMediaPlaylist($)?this.handleTrackOrLevelPlaylist(T,k,R,V||null,z):this.handleMasterPlaylist(T,k,R,V)},onError:(T,k,R,V)=>{this.handleNetworkError(k,R,!1,T,V)},onTimeout:(T,k,R)=>{this.handleNetworkError(k,R,!0,void 0,T)}};u.load(n,b,S)}handleMasterPlaylist(n,o,i,u){const h=this.hls,g=n.data,b=PU(n,i),S=g0.parseMasterPlaylist(g,b);if(S.playlistParsingError){this.handleManifestParsingError(n,i,S.playlistParsingError,u,o);return}const{contentSteering:T,levels:k,sessionData:R,sessionKeys:V,startTimeOffset:z,variableList:$}=S;this.variableList=$;const{AUDIO:W=[],SUBTITLES:Q,"CLOSED-CAPTIONS":j}=g0.parseMasterPlaylistMedia(g,b,S);W.length&&!W.some(re=>!re.url)&&k[0].audioCodec&&!k[0].attrs.AUDIO&&(Mt.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),W.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Fl({}),bitrate:0,url:""})),h.trigger(we.MANIFEST_LOADED,{levels:k,audioTracks:W,subtitles:Q,captions:j,contentSteering:T,url:b,stats:o,networkDetails:u,sessionData:R,sessionKeys:V,startTimeOffset:z,variableList:$})}handleTrackOrLevelPlaylist(n,o,i,u,h){const g=this.hls,{id:b,level:S,type:T}=i,k=PU(n,i),R=0,V=Xo(S)?S:Xo(b)?b:0,z=tK(i),$=g0.parseLevelPlaylist(n.data,k,V,z,R,this.variableList);if(T===Ci.MANIFEST){const W={attrs:new Fl({}),bitrate:0,details:$,name:"",url:k};g.trigger(we.MANIFEST_LOADED,{levels:[W],audioTracks:[],url:k,stats:o,networkDetails:u,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}o.parsing.end=performance.now(),i.levelDetails=$,this.handlePlaylistLoaded($,n,o,i,u,h)}handleManifestParsingError(n,o,i,u,h){this.hls.trigger(we.ERROR,{type:Gs.NETWORK_ERROR,details:nn.MANIFEST_PARSING_ERROR,fatal:o.type===Ci.MANIFEST,url:n.url,err:i,error:i,reason:i.message,response:n,context:o,networkDetails:u,stats:h})}handleNetworkError(n,o,i=!1,u,h){let g=`A network ${i?"timeout":"error"+(u?" (status "+u.code+")":"")} occurred while loading ${n.type}`;n.type===Ci.LEVEL?g+=`: ${n.level} id: ${n.id}`:(n.type===Ci.AUDIO_TRACK||n.type===Ci.SUBTITLE_TRACK)&&(g+=` id: ${n.id} group-id: "${n.groupId}"`);const b=new Error(g);Mt.warn(`[playlist-loader]: ${g}`);let S=nn.UNKNOWN,T=!1;const k=this.getInternalLoader(n);switch(n.type){case Ci.MANIFEST:S=i?nn.MANIFEST_LOAD_TIMEOUT:nn.MANIFEST_LOAD_ERROR,T=!0;break;case Ci.LEVEL:S=i?nn.LEVEL_LOAD_TIMEOUT:nn.LEVEL_LOAD_ERROR,T=!1;break;case Ci.AUDIO_TRACK:S=i?nn.AUDIO_TRACK_LOAD_TIMEOUT:nn.AUDIO_TRACK_LOAD_ERROR,T=!1;break;case Ci.SUBTITLE_TRACK:S=i?nn.SUBTITLE_TRACK_LOAD_TIMEOUT:nn.SUBTITLE_LOAD_ERROR,T=!1;break}k&&this.resetInternalLoader(n.type);const R={type:Gs.NETWORK_ERROR,details:S,fatal:T,url:n.url,loader:k,context:n,error:b,networkDetails:o,stats:h};if(u){const V=(o==null?void 0:o.url)||n.url;R.response=Eu({url:V,data:void 0},u)}this.hls.trigger(we.ERROR,R)}handlePlaylistLoaded(n,o,i,u,h,g){const b=this.hls,{type:S,level:T,id:k,groupId:R,deliveryDirectives:V}=u,z=PU(o,u),$=tK(u),W=typeof u.level=="number"&&$===Us.MAIN?T:void 0;if(!n.fragments.length){const j=new Error("No Segments found in Playlist");b.trigger(we.ERROR,{type:Gs.NETWORK_ERROR,details:nn.LEVEL_EMPTY_ERROR,fatal:!1,url:z,error:j,reason:j.message,response:o,context:u,level:W,parent:$,networkDetails:h,stats:i});return}n.targetduration||(n.playlistParsingError=new Error("Missing Target Duration"));const Q=n.playlistParsingError;if(Q){b.trigger(we.ERROR,{type:Gs.NETWORK_ERROR,details:nn.LEVEL_PARSING_ERROR,fatal:!1,url:z,error:Q,reason:Q.message,response:o,context:u,level:W,parent:$,networkDetails:h,stats:i});return}switch(n.live&&g&&(g.getCacheAge&&(n.ageHeader=g.getCacheAge()||0),(!g.getCacheAge||isNaN(n.ageHeader))&&(n.ageHeader=0)),S){case Ci.MANIFEST:case Ci.LEVEL:b.trigger(we.LEVEL_LOADED,{details:n,level:W||0,id:k||0,stats:i,networkDetails:h,deliveryDirectives:V});break;case Ci.AUDIO_TRACK:b.trigger(we.AUDIO_TRACK_LOADED,{details:n,id:k||0,groupId:R||"",stats:i,networkDetails:h,deliveryDirectives:V});break;case Ci.SUBTITLE_TRACK:b.trigger(we.SUBTITLE_TRACK_LOADED,{details:n,id:k||0,groupId:R||"",stats:i,networkDetails:h,deliveryDirectives:V});break}}}function Aq(l,n){let o;try{o=new Event("addtrack")}catch{o=document.createEvent("Event"),o.initEvent("addtrack",!1,!1)}o.track=l,n.dispatchEvent(o)}function Lq(l,n){const o=l.mode;if(o==="disabled"&&(l.mode="hidden"),l.cues&&!l.cues.getCueById(n.id))try{if(l.addCue(n),!l.cues.getCueById(n.id))throw new Error(`addCue is failed for: ${n}`)}catch(i){Mt.debug(`[texttrack-utils]: ${i}`);try{const u=new self.TextTrackCue(n.startTime,n.endTime,n.text);u.id=n.id,l.addCue(u)}catch(u){Mt.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${u}`)}}o==="disabled"&&(l.mode=o)}function xT(l){const n=l.mode;if(n==="disabled"&&(l.mode="hidden"),l.cues)for(let o=l.cues.length;o--;)l.removeCue(l.cues[o]);n==="disabled"&&(l.mode=n)}function DV(l,n,o,i){const u=l.mode;if(u==="disabled"&&(l.mode="hidden"),l.cues&&l.cues.length>0){const h=Fde(l.cues,n,o);for(let g=0;g<h.length;g++)(!i||i(h[g]))&&l.removeCue(h[g])}u==="disabled"&&(l.mode=u)}function Nde(l,n){if(n<l[0].startTime)return 0;const o=l.length-1;if(n>l[o].endTime)return-1;let i=0,u=o;for(;i<=u;){const h=Math.floor((u+i)/2);if(n<l[h].startTime)u=h-1;else if(n>l[h].startTime&&i<o)i=h+1;else return h}return l[i].startTime-n<n-l[u].startTime?i:u}function Fde(l,n,o){const i=[],u=Nde(l,n);if(u>-1)for(let h=u,g=l.length;h<g;h++){const b=l[h];if(b.startTime>=n&&b.endTime<=o)i.push(b);else if(b.startTime>o)return i}return i}function oB(l){const n=[];for(let o=0;o<l.length;o++){const i=l[o];(i.kind==="subtitles"||i.kind==="captions")&&i.label&&n.push(l[o])}return n}var Wp={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const Bde=.25;function kV(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function nK(l,n,o,i,u){let h=new l(n,o,"");try{h.value=i,u&&(h.type=u)}catch{h=new l(n,o,JSON.stringify(u?Eu({type:u},i):i))}return h}const P4=(()=>{const l=kV();try{l&&new l(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function MU(l,n){return l.getTime()/1e3-n}function $de(l){return Uint8Array.from(l.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class Hde{constructor(n){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=n,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:n}=this;n.on(we.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(we.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(we.MANIFEST_LOADING,this.onManifestLoading,this),n.on(we.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),n.on(we.BUFFER_FLUSHING,this.onBufferFlushing,this),n.on(we.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:n}=this;n.off(we.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(we.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(we.MANIFEST_LOADING,this.onManifestLoading,this),n.off(we.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),n.off(we.BUFFER_FLUSHING,this.onBufferFlushing,this),n.off(we.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(n,o){this.media=o.media}onMediaDetaching(){this.id3Track&&(xT(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(n){const o=this.getID3Track(n.textTracks);return o.mode="hidden",o}getID3Track(n){if(this.media){for(let o=0;o<n.length;o++){const i=n[o];if(i.kind==="metadata"&&i.label==="id3")return Aq(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(n,o){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:i,enableID3MetadataCues:u}}}=this;if(!i&&!u)return;const{samples:h}=o;this.id3Track||(this.id3Track=this.createTrack(this.media));const g=kV();if(g)for(let b=0;b<h.length;b++){const S=h[b].type;if(S===Wp.emsg&&!i||!u)continue;const T=xq(h[b].data);if(T){const k=h[b].pts;let R=k+h[b].duration;R>P4&&(R=P4),R-k<=0&&(R=k+Bde);for(let z=0;z<T.length;z++){const $=T[z];if(!vq($)){this.updateId3CueEnds(k,S);const W=nK(g,k,R,$,S);W&&this.id3Track.addCue(W)}}}}}updateId3CueEnds(n,o){var i;const u=(i=this.id3Track)==null?void 0:i.cues;if(u)for(let h=u.length;h--;){const g=u[h];g.type===o&&g.startTime<n&&g.endTime===P4&&(g.endTime=n)}}onBufferFlushing(n,{startOffset:o,endOffset:i,type:u}){const{id3Track:h,hls:g}=this;if(!g)return;const{config:{enableEmsgMetadataCues:b,enableID3MetadataCues:S}}=g;if(h&&(b||S)){let T;u==="audio"?T=k=>k.type===Wp.audioId3&&S:u==="video"?T=k=>k.type===Wp.emsg&&b:T=k=>k.type===Wp.audioId3&&S||k.type===Wp.emsg&&b,DV(h,o,i,T)}}onLevelUpdated(n,{details:o}){if(!this.media||!o.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:i,id3Track:u}=this,{dateRanges:h}=o,g=Object.keys(h);if(u){const k=Object.keys(i).filter(R=>!g.includes(R));for(let R=k.length;R--;){const V=k[R];Object.keys(i[V].cues).forEach(z=>{u.removeCue(i[V].cues[z])}),delete i[V]}}const b=o.fragments[o.fragments.length-1];if(g.length===0||!Xo(b==null?void 0:b.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const S=b.programDateTime/1e3-b.start,T=kV();for(let k=0;k<g.length;k++){const R=g[k],V=h[R],z=MU(V.startDate,S),$=i[R],W=($==null?void 0:$.cues)||{};let Q=($==null?void 0:$.durationKnown)||!1,j=P4;const se=V.endDate;if(se)j=MU(se,S),Q=!0;else if(V.endOnNext&&!Q){const Y=g.reduce((me,ae)=>{if(ae!==V.id){const Ce=h[ae];if(Ce.class===V.class&&Ce.startDate>V.startDate&&(!me||V.startDate<me.startDate))return Ce}return me},null);Y&&(j=MU(Y.startDate,S),Q=!0)}const re=Object.keys(V.attr);for(let Y=0;Y<re.length;Y++){const me=re[Y];if(!Gue(me))continue;const ae=W[me];if(ae)Q&&!$.durationKnown&&(ae.endTime=j);else if(T){let Ce=V.attr[me];Wue(me)&&(Ce=$de(Ce));const Ue=nK(T,z,j,{key:me,data:Ce},Wp.dateRange);Ue&&(Ue.id=R,this.id3Track.addCue(Ue),W[me]=Ue)}}i[R]={cues:W,dateRange:V,durationKnown:Q}}}}class Ude{constructor(n){this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=()=>this.timeupdate(),this.hls=n,this.config=n.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:n,levelDetails:o}=this;return n.liveMaxLatencyDuration!==void 0?n.liveMaxLatencyDuration:o?n.liveMaxLatencyDurationCount*o.targetduration:0}get targetLatency(){const{levelDetails:n}=this;if(n===null)return null;const{holdBack:o,partHoldBack:i,targetduration:u}=n,{liveSyncDuration:h,liveSyncDurationCount:g,lowLatencyMode:b}=this.config,S=this.hls.userConfig;let T=b&&i||o;(S.liveSyncDuration||S.liveSyncDurationCount||T===0)&&(T=h!==void 0?h:g*u);const k=u;return T+Math.min(this.stallCount*1,k)}get liveSyncPosition(){const n=this.estimateLiveEdge(),o=this.targetLatency,i=this.levelDetails;if(n===null||o===null||i===null)return null;const u=i.edge,h=n-o-this.edgeStalled,g=u-i.totalduration,b=u-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(g,h),b)}get drift(){const{levelDetails:n}=this;return n===null?1:n.drift}get edgeStalled(){const{levelDetails:n}=this;if(n===null)return 0;const o=(this.config.lowLatencyMode&&n.partTarget||n.targetduration)*3;return Math.max(n.age-o,0)}get forwardBufferLength(){const{media:n,levelDetails:o}=this;if(!n||!o)return 0;const i=n.buffered.length;return(i?n.buffered.end(i-1):o.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(we.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(we.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(we.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(we.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(we.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(we.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(we.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(we.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(we.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(we.ERROR,this.onError,this)}onMediaAttached(n,o){this.media=o.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(n,{details:o}){this.levelDetails=o,o.advanced&&this.timeupdate(),!o.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(n,o){var i;o.details===nn.BUFFER_STALLED_ERROR&&(this.stallCount++,(i=this.levelDetails)!=null&&i.live&&Mt.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:n,levelDetails:o}=this;if(!n||!o)return;this.currentTime=n.currentTime;const i=this.computeLatency();if(i===null)return;this._latency=i;const{lowLatencyMode:u,maxLiveSyncPlaybackRate:h}=this.config;if(!u||h===1||!o.live)return;const g=this.targetLatency;if(g===null)return;const b=i-g,S=Math.min(this.maxLatency,g+o.targetduration);if(b<S&&b>.05&&this.forwardBufferLength>1){const k=Math.min(2,Math.max(1,h)),R=Math.round(2/(1+Math.exp(-.75*b-this.edgeStalled))*20)/20;n.playbackRate=Math.min(k,Math.max(1,R))}else n.playbackRate!==1&&n.playbackRate!==0&&(n.playbackRate=1)}estimateLiveEdge(){const{levelDetails:n}=this;return n===null?null:n.edge+n.age}computeLatency(){const n=this.estimateLiveEdge();return n===null?null:n-this.currentTime}}const AV=["NONE","TYPE-0","TYPE-1",null];function Vde(l){return AV.indexOf(l)>-1}const AB=["SDR","PQ","HLG"];function zde(l){return!!l&&AB.indexOf(l)>-1}var nR={No:"",Yes:"YES",v2:"v2"};function Gde(l,n){const{canSkipUntil:o,canSkipDateRanges:i,endSN:u}=l,h=n!==void 0?n-u:0;return o&&h<o?i?nR.v2:nR.Yes:nR.No}class oK{constructor(n,o,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=n,this.part=o,this.skip=i}addDirectives(n){const o=new self.URL(n);return this.msn!==void 0&&o.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&o.searchParams.set("_HLS_part",this.part.toString()),this.skip&&o.searchParams.set("_HLS_skip",this.skip),o.href}}class LT{constructor(n){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[n.url],this._attrs=[n.attrs],this.bitrate=n.bitrate,n.details&&(this.details=n.details),this.id=n.id||0,this.name=n.name,this.width=n.width||0,this.height=n.height||0,this.frameRate=n.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=n.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=n.audioCodec,this.videoCodec=n.videoCodec,this.codecSet=[n.videoCodec,n.audioCodec].filter(o=>!!o).map(o=>o.substring(0,4)).join(","),this.addGroupId("audio",n.attrs.AUDIO),this.addGroupId("text",n.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(n){return sK(this._audioGroups,n)}hasSubtitleGroup(n){return sK(this._subtitleGroups,n)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(n,o){if(o){if(n==="audio"){let i=this._audioGroups;i||(i=this._audioGroups=[]),i.indexOf(o)===-1&&i.push(o)}else if(n==="text"){let i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),i.indexOf(o)===-1&&i.push(o)}}}get urlId(){return 0}set urlId(n){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var n;return(n=this.audioGroups)==null?void 0:n[0]}get textGroupId(){var n;return(n=this.subtitleGroups)==null?void 0:n[0]}addFallback(){}}function sK(l,n){return!n||!l?!1:l.indexOf(n)!==-1}function NU(l,n){const o=n.startPTS;if(Xo(o)){let i=0,u;n.sn>l.sn?(i=o-l.start,u=l):(i=l.start-o,u=n),u.duration!==i&&(u.duration=i)}else n.sn>l.sn?l.cc===n.cc&&l.minEndPTS?n.start=l.start+(l.minEndPTS-l.start):n.start=l.start+l.duration:n.start=Math.max(l.start-n.duration,0)}function Rq(l,n,o,i,u,h){i-o<=0&&(Mt.warn("Fragment should have a positive duration",n),i=o+n.duration,h=u+n.duration);let b=o,S=i;const T=n.startPTS,k=n.endPTS;if(Xo(T)){const Q=Math.abs(T-o);Xo(n.deltaPTS)?n.deltaPTS=Math.max(Q,n.deltaPTS):n.deltaPTS=Q,b=Math.max(o,T),o=Math.min(o,T),u=Math.min(u,n.startDTS),S=Math.min(i,k),i=Math.max(i,k),h=Math.max(h,n.endDTS)}const R=o-n.start;n.start!==0&&(n.start=o),n.duration=i-n.start,n.startPTS=o,n.maxStartPTS=b,n.startDTS=u,n.endPTS=i,n.minEndPTS=S,n.endDTS=h;const V=n.sn;if(!l||V<l.startSN||V>l.endSN)return 0;let z;const $=V-l.startSN,W=l.fragments;for(W[$]=n,z=$;z>0;z--)NU(W[z],W[z-1]);for(z=$;z<W.length-1;z++)NU(W[z],W[z+1]);return l.fragmentHint&&NU(W[W.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,R}function Wde(l,n){let o=null;const i=l.fragments;for(let S=i.length-1;S>=0;S--){const T=i[S].initSegment;if(T){o=T;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;let u=0,h;if(Zde(l,n,(S,T)=>{S.relurl&&(u=S.cc-T.cc),Xo(S.startPTS)&&Xo(S.endPTS)&&(T.start=T.startPTS=S.startPTS,T.startDTS=S.startDTS,T.maxStartPTS=S.maxStartPTS,T.endPTS=S.endPTS,T.endDTS=S.endDTS,T.minEndPTS=S.minEndPTS,T.duration=S.endPTS-S.startPTS,T.duration&&(h=T),n.PTSKnown=n.alignedSliding=!0),T.elementaryStreams=S.elementaryStreams,T.loader=S.loader,T.stats=S.stats,S.initSegment&&(T.initSegment=S.initSegment,o=S.initSegment)}),o&&(n.fragmentHint?n.fragments.concat(n.fragmentHint):n.fragments).forEach(T=>{var k;T&&(!T.initSegment||T.initSegment.relurl===((k=o)==null?void 0:k.relurl))&&(T.initSegment=o)}),n.skippedSegments)if(n.deltaUpdateFailed=n.fragments.some(S=>!S),n.deltaUpdateFailed){Mt.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let S=n.skippedSegments;S--;)n.fragments.shift();n.startSN=n.fragments[0].sn,n.startCC=n.fragments[0].cc}else n.canSkipDateRanges&&(n.dateRanges=jde(l.dateRanges,n.dateRanges,n.recentlyRemovedDateranges));const g=n.fragments;if(u){Mt.warn("discontinuity sliding from playlist, take drift into account");for(let S=0;S<g.length;S++)g[S].cc+=u}n.skippedSegments&&(n.startCC=n.fragments[0].cc),Kde(l.partList,n.partList,(S,T)=>{T.elementaryStreams=S.elementaryStreams,T.stats=S.stats}),h?Rq(n,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):Oq(l,n),g.length&&(n.totalduration=n.edge-g[0].start),n.driftStartTime=l.driftStartTime,n.driftStart=l.driftStart;const b=n.advancedDateTime;if(n.advanced&&b){const S=n.edge;n.driftStart||(n.driftStartTime=b,n.driftStart=S),n.driftEndTime=b,n.driftEnd=S}else n.driftEndTime=l.driftEndTime,n.driftEnd=l.driftEnd,n.advancedDateTime=l.advancedDateTime}function jde(l,n,o){const i=Ic({},l);return o&&o.forEach(u=>{delete i[u]}),Object.keys(n).forEach(u=>{const h=new hq(n[u].attr,i[u]);h.isValid?i[u]=h:Mt.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(n[u].attr)}"`)}),i}function Kde(l,n,o){if(l&&n){let i=0;for(let u=0,h=l.length;u<=h;u++){const g=l[u],b=n[u+i];g&&b&&g.index===b.index&&g.fragment.sn===b.fragment.sn?o(g,b):i--}}}function Zde(l,n,o){const i=n.skippedSegments,u=Math.max(l.startSN,n.startSN)-n.startSN,h=(l.fragmentHint?1:0)+(i?n.endSN:Math.min(l.endSN,n.endSN))-n.startSN,g=n.startSN-l.startSN,b=n.fragmentHint?n.fragments.concat(n.fragmentHint):n.fragments,S=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments;for(let T=u;T<=h;T++){const k=S[g+T];let R=b[T];i&&!R&&T<i&&(R=n.fragments[T]=k),k&&R&&o(k,R)}}function Oq(l,n){const o=n.startSN+n.skippedSegments-l.startSN,i=l.fragments;o<0||o>=i.length||LV(n,i[o].start)}function LV(l,n){if(n){const o=l.fragments;for(let i=l.skippedSegments;i<o.length;i++)o[i].start+=n;l.fragmentHint&&(l.fragmentHint.start+=n)}}function qde(l,n=1/0){let o=1e3*l.targetduration;if(l.updated){const i=l.fragments;if(i.length&&o*4>n){const h=i[i.length-1].duration*1e3;h<o&&(o=h)}}else o/=2;return Math.round(o)}function Yde(l,n,o){if(!(l!=null&&l.details))return null;const i=l.details;let u=i.fragments[n-i.startSN];return u||(u=i.fragmentHint,u&&u.sn===n)?u:n<i.startSN&&o&&o.sn===n?o:null}function rK(l,n,o){var i;return l!=null&&l.details?Iq((i=l.details)==null?void 0:i.partList,n,o):null}function Iq(l,n,o){if(l)for(let i=l.length;i--;){const u=l[i];if(u.index===o&&u.fragment.sn===n)return u}return null}function Pq(l){l.forEach((n,o)=>{const{details:i}=n;i!=null&&i.fragments&&i.fragments.forEach(u=>{u.level=o})})}function LB(l){switch(l.details){case nn.FRAG_LOAD_TIMEOUT:case nn.KEY_LOAD_TIMEOUT:case nn.LEVEL_LOAD_TIMEOUT:case nn.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function iK(l,n){const o=LB(n);return l.default[`${o?"timeout":"error"}Retry`]}function cz(l,n){const o=l.backoff==="linear"?1:Math.pow(2,n);return Math.min(o*l.retryDelayMs,l.maxRetryDelayMs)}function aK(l){return Eu(Eu({},l),{errorRetry:null,timeoutRetry:null})}function RB(l,n,o,i){if(!l)return!1;const u=i==null?void 0:i.code,h=n<l.maxNumRetry&&(Xde(u)||!!o);return l.shouldRetry?l.shouldRetry(l,n,o,i,h):h}function Xde(l){return l===0&&navigator.onLine===!1||!!l&&(l<400||l>499)}const Mq={search:function(l,n){let o=0,i=l.length-1,u=null,h=null;for(;o<=i;){u=(o+i)/2|0,h=l[u];const g=n(h);if(g>0)o=u+1;else if(g<0)i=u-1;else return h}return null}};function Jde(l,n,o){if(n===null||!Array.isArray(l)||!l.length||!Xo(n))return null;const i=l[0].programDateTime;if(n<(i||0))return null;const u=l[l.length-1].endProgramDateTime;if(n>=(u||0))return null;o=o||0;for(let h=0;h<l.length;++h){const g=l[h];if(Qde(n,o,g))return g}return null}function OB(l,n,o=0,i=0){let u=null;if(l){u=n[l.sn-n[0].sn+1]||null;const g=l.endDTS-o;g>0&&g<15e-7&&(o+=15e-7)}else o===0&&n[0].start===0&&(u=n[0]);if(u&&(!l||l.level===u.level)&&RV(o,i,u)===0)return u;const h=Mq.search(n,RV.bind(null,o,i));return h&&(h!==l||!u)?h:u}function RV(l=0,n=0,o){if(o.start<=l&&o.start+o.duration>l)return 0;const i=Math.min(n,o.duration+(o.deltaPTS?o.deltaPTS:0));return o.start+o.duration-i<=l?1:o.start-i>l&&o.start?-1:0}function Qde(l,n,o){const i=Math.min(n,o.duration+(o.deltaPTS?o.deltaPTS:0))*1e3;return(o.endProgramDateTime||0)-i>l}function efe(l,n){return Mq.search(l,o=>o.cc<n?1:o.cc>n?-1:0)}var ed={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Vp={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class tfe{constructor(n){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=n,this.log=Mt.log.bind(Mt,"[info]:"),this.warn=Mt.warn.bind(Mt,"[warning]:"),this.error=Mt.error.bind(Mt,"[error]:"),this.registerListeners()}registerListeners(){const n=this.hls;n.on(we.ERROR,this.onError,this),n.on(we.MANIFEST_LOADING,this.onManifestLoading,this),n.on(we.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const n=this.hls;n&&(n.off(we.ERROR,this.onError,this),n.off(we.ERROR,this.onErrorOut,this),n.off(we.MANIFEST_LOADING,this.onManifestLoading,this),n.off(we.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(n){}stopLoad(){this.playlistError=0}getVariantLevelIndex(n){return(n==null?void 0:n.type)===Us.MAIN?n.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(n,o){var i,u;if(o.fatal)return;const h=this.hls,g=o.context;switch(o.details){case nn.FRAG_LOAD_ERROR:case nn.FRAG_LOAD_TIMEOUT:case nn.KEY_LOAD_ERROR:case nn.KEY_LOAD_TIMEOUT:o.errorAction=this.getFragRetryOrSwitchAction(o);return;case nn.FRAG_PARSING_ERROR:if((i=o.frag)!=null&&i.gap){o.errorAction={action:ed.DoNothing,flags:Vp.None};return}case nn.FRAG_GAP:case nn.FRAG_DECRYPT_ERROR:{o.errorAction=this.getFragRetryOrSwitchAction(o),o.errorAction.action=ed.SendAlternateToPenaltyBox;return}case nn.LEVEL_EMPTY_ERROR:case nn.LEVEL_PARSING_ERROR:{var b,S;const T=o.parent===Us.MAIN?o.level:h.loadLevel;o.details===nn.LEVEL_EMPTY_ERROR&&((b=o.context)!=null&&(S=b.levelDetails)!=null&&S.live)?o.errorAction=this.getPlaylistRetryOrSwitchAction(o,T):(o.levelRetry=!1,o.errorAction=this.getLevelSwitchAction(o,T))}return;case nn.LEVEL_LOAD_ERROR:case nn.LEVEL_LOAD_TIMEOUT:typeof(g==null?void 0:g.level)=="number"&&(o.errorAction=this.getPlaylistRetryOrSwitchAction(o,g.level));return;case nn.AUDIO_TRACK_LOAD_ERROR:case nn.AUDIO_TRACK_LOAD_TIMEOUT:case nn.SUBTITLE_LOAD_ERROR:case nn.SUBTITLE_TRACK_LOAD_TIMEOUT:if(g){const T=h.levels[h.loadLevel];if(T&&(g.type===Ci.AUDIO_TRACK&&T.hasAudioGroup(g.groupId)||g.type===Ci.SUBTITLE_TRACK&&T.hasSubtitleGroup(g.groupId))){o.errorAction=this.getPlaylistRetryOrSwitchAction(o,h.loadLevel),o.errorAction.action=ed.SendAlternateToPenaltyBox,o.errorAction.flags=Vp.MoveAllAlternatesMatchingHost;return}}return;case nn.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const T=h.levels[h.loadLevel],k=T==null?void 0:T.attrs["HDCP-LEVEL"];k?o.errorAction={action:ed.SendAlternateToPenaltyBox,flags:Vp.MoveAllAlternatesMatchingHDCP,hdcpLevel:k}:this.keySystemError(o)}return;case nn.BUFFER_ADD_CODEC_ERROR:case nn.REMUX_ALLOC_ERROR:case nn.BUFFER_APPEND_ERROR:o.errorAction=this.getLevelSwitchAction(o,(u=o.level)!=null?u:h.loadLevel);return;case nn.INTERNAL_EXCEPTION:case nn.BUFFER_APPENDING_ERROR:case nn.BUFFER_FULL_ERROR:case nn.LEVEL_SWITCH_ERROR:case nn.BUFFER_STALLED_ERROR:case nn.BUFFER_SEEK_OVER_HOLE:case nn.BUFFER_NUDGE_ON_STALL:o.errorAction={action:ed.DoNothing,flags:Vp.None};return}o.type===Gs.KEY_SYSTEM_ERROR&&this.keySystemError(o)}keySystemError(n){const o=this.getVariantLevelIndex(n.frag);n.levelRetry=!1,n.errorAction=this.getLevelSwitchAction(n,o)}getPlaylistRetryOrSwitchAction(n,o){const i=this.hls,u=iK(i.config.playlistLoadPolicy,n),h=this.playlistError++;if(RB(u,h,LB(n),n.response))return{action:ed.RetryRequest,flags:Vp.None,retryConfig:u,retryCount:h};const b=this.getLevelSwitchAction(n,o);return u&&(b.retryConfig=u,b.retryCount=h),b}getFragRetryOrSwitchAction(n){const o=this.hls,i=this.getVariantLevelIndex(n.frag),u=o.levels[i],{fragLoadPolicy:h,keyLoadPolicy:g}=o.config,b=iK(n.details.startsWith("key")?g:h,n),S=o.levels.reduce((k,R)=>k+R.fragmentError,0);if(u&&(n.details!==nn.FRAG_GAP&&u.fragmentError++,RB(b,S,LB(n),n.response)))return{action:ed.RetryRequest,flags:Vp.None,retryConfig:b,retryCount:S};const T=this.getLevelSwitchAction(n,i);return b&&(T.retryConfig=b,T.retryCount=S),T}getLevelSwitchAction(n,o){const i=this.hls;o==null&&(o=i.loadLevel);const u=this.hls.levels[o];if(u){var h,g;const T=n.details;u.loadError++,T===nn.BUFFER_APPEND_ERROR&&u.fragmentError++;let k=-1;const{levels:R,loadLevel:V,minAutoLevel:z,maxAutoLevel:$}=i;i.autoLevelEnabled||(i.loadLevel=-1);const W=(h=n.frag)==null?void 0:h.type,j=(W===Us.AUDIO&&T===nn.FRAG_PARSING_ERROR||n.sourceBufferName==="audio"&&(T===nn.BUFFER_ADD_CODEC_ERROR||T===nn.BUFFER_APPEND_ERROR))&&R.some(({audioCodec:ae})=>u.audioCodec!==ae),re=n.sourceBufferName==="video"&&(T===nn.BUFFER_ADD_CODEC_ERROR||T===nn.BUFFER_APPEND_ERROR)&&R.some(({codecSet:ae,audioCodec:Ce})=>u.codecSet!==ae&&u.audioCodec===Ce),{type:Y,groupId:me}=(g=n.context)!=null?g:{};for(let ae=R.length;ae--;){const Ce=(ae+V)%R.length;if(Ce!==V&&Ce>=z&&Ce<=$&&R[Ce].loadError===0){var b,S;const Ue=R[Ce];if(T===nn.FRAG_GAP&&n.frag){const ot=R[Ce].details;if(ot){const Ae=OB(n.frag,ot.fragments,n.frag.start);if(Ae!=null&&Ae.gap)continue}}else{if(Y===Ci.AUDIO_TRACK&&Ue.hasAudioGroup(me)||Y===Ci.SUBTITLE_TRACK&&Ue.hasSubtitleGroup(me))continue;if(W===Us.AUDIO&&(b=u.audioGroups)!=null&&b.some(ot=>Ue.hasAudioGroup(ot))||W===Us.SUBTITLE&&(S=u.subtitleGroups)!=null&&S.some(ot=>Ue.hasSubtitleGroup(ot))||j&&u.audioCodec===Ue.audioCodec||!j&&u.audioCodec!==Ue.audioCodec||re&&u.codecSet===Ue.codecSet)continue}k=Ce;break}}if(k>-1&&i.loadLevel!==k)return n.levelRetry=!0,this.playlistError=0,{action:ed.SendAlternateToPenaltyBox,flags:Vp.None,nextAutoLevel:k}}return{action:ed.SendAlternateToPenaltyBox,flags:Vp.MoveAllAlternatesMatchingHost}}onErrorOut(n,o){var i;switch((i=o.errorAction)==null?void 0:i.action){case ed.DoNothing:break;case ed.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(o),!o.errorAction.resolved&&o.details!==nn.FRAG_GAP?o.fatal=!0:/MediaSource readyState: ended/.test(o.error.message)&&(this.warn(`MediaSource ended after "${o.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(o.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(n){const o=this.hls,i=n.errorAction;if(!i)return;const{flags:u,hdcpLevel:h,nextAutoLevel:g}=i;switch(u){case Vp.None:this.switchLevel(n,g);break;case Vp.MoveAllAlternatesMatchingHDCP:h&&(o.maxHdcpLevel=AV[AV.indexOf(h)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${o.maxHdcpLevel}" or lower`);break}i.resolved||this.switchLevel(n,g)}switchLevel(n,o){o!==void 0&&n.errorAction&&(this.warn(`switching to level ${o} after ${n.details}`),this.hls.nextAutoLevel=o,n.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}}class uz{constructor(n,o){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=Mt.log.bind(Mt,`${o}:`),this.warn=Mt.warn.bind(Mt,`${o}:`),this.hls=n}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(n,o){const i=o==null?void 0:o.renditionReports;if(i){let u=-1;for(let h=0;h<i.length;h++){const g=i[h];let b;try{b=new self.URL(g.URI,o.url).href}catch(S){Mt.warn(`Could not construct new URL for Rendition Report: ${S}`),b=g.URI||""}if(b===n){u=h;break}else b===n.substring(0,b.length)&&(u=h)}if(u!==-1){const h=i[u],g=parseInt(h["LAST-MSN"])||(o==null?void 0:o.lastPartSn);let b=parseInt(h["LAST-PART"])||(o==null?void 0:o.lastPartIndex);if(this.hls.config.lowLatencyMode){const S=Math.min(o.age-o.partTarget,o.targetduration);b>=0&&S>o.partTarget&&(b+=1)}return new oK(g,b>=0?b:void 0,nR.No)}}}loadPlaylist(n){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(n){return this.canLoad&&!!n&&!!n.url&&(!n.details||n.details.live)}shouldReloadPlaylist(n){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(n)}playlistLoaded(n,o,i){const{details:u,stats:h}=o,g=self.performance.now(),b=h.loading.first?Math.max(0,g-h.loading.first):0;if(u.advancedDateTime=Date.now()-b,u.live||i!=null&&i.live){if(u.reloaded(i),i&&this.log(`live playlist ${n} ${u.advanced?"REFRESHED "+u.lastPartSn+"-"+u.lastPartIndex:u.updated?"UPDATED":"MISSED"}`),i&&u.fragments.length>0&&Wde(i,u),!this.canLoad||!u.live)return;let S,T,k;if(u.canBlockReload&&u.endSN&&u.advanced){const Q=this.hls.config.lowLatencyMode,j=u.lastPartSn,se=u.endSN,re=u.lastPartIndex,Y=re!==-1,me=j===se,ae=Q?0:re;Y?(T=me?se+1:j,k=me?ae:re+1):T=se+1;const Ce=u.age,Ue=Ce+u.ageHeader;let ot=Math.min(Ue-u.partTarget,u.targetduration*1.5);if(ot>0){if(i&&ot>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${ot} with playlist age: ${u.age}`),ot=0;else{const Ae=Math.floor(ot/u.targetduration);if(T+=Ae,k!==void 0){const ve=Math.round(ot%u.targetduration/u.partTarget);k+=ve}this.log(`CDN Tune-in age: ${u.ageHeader}s last advanced ${Ce.toFixed(2)}s goal: ${ot} skip sn ${Ae} to part ${k}`)}u.tuneInGoal=ot}if(S=this.getDeliveryDirectives(u,o.deliveryDirectives,T,k),Q||!me){this.loadPlaylist(S);return}}else(u.canBlockReload||u.canSkipUntil)&&(S=this.getDeliveryDirectives(u,o.deliveryDirectives,T,k));const R=this.hls.mainForwardBufferInfo,V=R?R.end-R.len:0,z=(u.edge-V)*1e3,$=qde(u,z);u.updated&&g>this.requestScheduled+$&&(this.requestScheduled=h.loading.start),T!==void 0&&u.canBlockReload?this.requestScheduled=h.loading.first+$-(u.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+$<g?this.requestScheduled=g:this.requestScheduled-g<=0&&(this.requestScheduled+=$);let W=this.requestScheduled-g;W=Math.max(0,W),this.log(`reload live playlist ${n} in ${Math.round(W)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(S),W)}else this.clearTimer()}getDeliveryDirectives(n,o,i,u){let h=Gde(n,i);return o!=null&&o.skip&&n.deltaUpdateFailed&&(i=o.msn,u=o.part,h=nR.No),new oK(i,u,h)}checkRetry(n){const o=n.details,i=LB(n),u=n.errorAction,{action:h,retryCount:g=0,retryConfig:b}=u||{},S=!!u&&!!b&&(h===ed.RetryRequest||!u.resolved&&h===ed.SendAlternateToPenaltyBox);if(S){var T;if(this.requestScheduled=-1,g>=b.maxNumRetry)return!1;if(i&&(T=n.context)!=null&&T.deliveryDirectives)this.warn(`Retrying playlist loading ${g+1}/${b.maxNumRetry} after "${o}" without delivery-directives`),this.loadPlaylist();else{const k=cz(b,g);this.timer=self.setTimeout(()=>this.loadPlaylist(),k),this.warn(`Retrying playlist loading ${g+1}/${b.maxNumRetry} after "${o}" in ${k}ms`)}n.levelRetry=!0,u.resolved=!0}return S}}class sT{constructor(n,o=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=n,this.alpha_=n?Math.exp(Math.log(.5)/n):0,this.estimate_=o,this.totalWeight_=i}sample(n,o){const i=Math.pow(this.alpha_,n);this.estimate_=o*(1-i)+i*this.estimate_,this.totalWeight_+=n}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const n=1-Math.pow(this.alpha_,this.totalWeight_);if(n)return this.estimate_/n}return this.estimate_}}class nfe{constructor(n,o,i,u=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new sT(n),this.fast_=new sT(o),this.defaultTTFB_=u,this.ttfb_=new sT(n)}update(n,o){const{slow_:i,fast_:u,ttfb_:h}=this;i.halfLife!==n&&(this.slow_=new sT(n,i.getEstimate(),i.getTotalWeight())),u.halfLife!==o&&(this.fast_=new sT(o,u.getEstimate(),u.getTotalWeight())),h.halfLife!==n&&(this.ttfb_=new sT(n,h.getEstimate(),h.getTotalWeight()))}sample(n,o){n=Math.max(n,this.minDelayMs_);const i=8*o,u=n/1e3,h=i/u;this.fast_.sample(u,h),this.slow_.sample(u,h)}sampleTTFB(n){const o=n/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(o,2)/2);this.ttfb_.sample(i,Math.max(n,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const Nq={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},lK={};function ofe(l,n,o,i,u,h){const g=l.audioCodec?l.audioGroups:null,b=h==null?void 0:h.audioCodec,S=h==null?void 0:h.channels,T=S?parseInt(S):b?1/0:2;let k=null;if(g!=null&&g.length)try{g.length===1&&g[0]?k=n.groups[g[0]].channels:k=g.reduce((R,V)=>{if(V){const z=n.groups[V];if(!z)throw new Error(`Audio track group ${V} not found`);Object.keys(z.channels).forEach($=>{R[$]=(R[$]||0)+z.channels[$]})}return R},{2:0})}catch{return!0}return l.videoCodec!==void 0&&(l.width>1920&&l.height>1088||l.height>1920&&l.width>1088||l.frameRate>Math.max(i,30)||l.videoRange!=="SDR"&&l.videoRange!==o||l.bitrate>Math.max(u,8e6))||!!k&&Xo(T)&&Object.keys(k).some(R=>parseInt(R)>T)}function sfe(l,n,o){const i=l.videoCodec,u=l.audioCodec;if(!i||!u||!o)return Promise.resolve(Nq);const h={width:l.width,height:l.height,bitrate:Math.ceil(Math.max(l.bitrate*.9,l.averageBitrate)),framerate:l.frameRate||30},g=l.videoRange;g!=="SDR"&&(h.transferFunction=g.toLowerCase());const b=i.split(",").map(S=>({type:"media-source",video:Eu(Eu({},h),{},{contentType:uR(S,"video")})}));return u&&l.audioGroups&&l.audioGroups.forEach(S=>{var T;S&&((T=n.groups[S])==null||T.tracks.forEach(k=>{if(k.groupId===S){const R=k.channels||"",V=parseFloat(R);Xo(V)&&V>2&&b.push.apply(b,u.split(",").map(z=>({type:"media-source",audio:{contentType:uR(z,"audio"),channels:""+V}})))}}))}),Promise.all(b.map(S=>{const T=rfe(S);return lK[T]||(lK[T]=o.decodingInfo(S))})).then(S=>({supported:!S.some(T=>!T.supported),configurations:b,decodingInfoResults:S})).catch(S=>({supported:!1,configurations:b,decodingInfoResults:[],error:S}))}function rfe(l){const{audio:n,video:o}=l,i=o||n;if(i){const u=i.contentType.split('"')[1];if(o)return`r${o.height}x${o.width}f${Math.ceil(o.framerate)}${o.transferFunction||"sd"}_${u}_${Math.ceil(o.bitrate/1e5)}`;if(n)return`c${n.channels}${n.spatialRendering?"s":"n"}_${u}`}return""}function ife(){if(typeof matchMedia=="function"){const l=matchMedia("(dynamic-range: high)"),n=matchMedia("bad query");if(l.media!==n.media)return l.matches===!0}return!1}function afe(l,n){let o=!1,i=[];return l&&(o=l!=="SDR",i=[l]),n&&(i=n.allowedVideoRanges||AB.slice(0),o=n.preferHDR!==void 0?n.preferHDR:ife(),o?i=i.filter(u=>u!=="SDR"):i=["SDR"]),{preferHDR:o,allowedVideoRanges:i}}function lfe(l,n,o,i,u){const h=Object.keys(l),g=i==null?void 0:i.channels,b=i==null?void 0:i.audioCodec,S=g&&parseInt(g)===2;let T=!0,k=!1,R=1/0,V=1/0,z=1/0,$=0,W=[];const{preferHDR:Q,allowedVideoRanges:j}=afe(n,u);for(let me=h.length;me--;){const ae=l[h[me]];T=ae.channels[2]>0,R=Math.min(R,ae.minHeight),V=Math.min(V,ae.minFramerate),z=Math.min(z,ae.minBitrate);const Ce=j.filter(Ue=>ae.videoRanges[Ue]>0);Ce.length>0&&(k=!0,W=Ce)}R=Xo(R)?R:0,V=Xo(V)?V:0;const se=Math.max(1080,R),re=Math.max(30,V);return z=Xo(z)?z:o,o=Math.max(z,o),k||(n=void 0,W=[]),{codecSet:h.reduce((me,ae)=>{const Ce=l[ae];if(ae===me)return me;if(Ce.minBitrate>o)return qb(ae,`min bitrate of ${Ce.minBitrate} > current estimate of ${o}`),me;if(!Ce.hasDefaultAudio)return qb(ae,"no renditions with default or auto-select sound found"),me;if(b&&ae.indexOf(b.substring(0,4))%5!==0)return qb(ae,`audio codec preference "${b}" not found`),me;if(g&&!S){if(!Ce.channels[g])return qb(ae,`no renditions with ${g} channel sound found (channels options: ${Object.keys(Ce.channels)})`),me}else if((!b||S)&&T&&Ce.channels[2]===0)return qb(ae,"no renditions with stereo sound found"),me;return Ce.minHeight>se?(qb(ae,`min resolution of ${Ce.minHeight} > maximum of ${se}`),me):Ce.minFramerate>re?(qb(ae,`min framerate of ${Ce.minFramerate} > maximum of ${re}`),me):W.some(Ue=>Ce.videoRanges[Ue]>0)?Ce.maxScore<$?(qb(ae,`max score of ${Ce.maxScore} < selected max of ${$}`),me):me&&(DB(ae)>=DB(me)||Ce.fragmentError>l[me].fragmentError)?me:($=Ce.maxScore,ae):(qb(ae,`no variants with VIDEO-RANGE of ${JSON.stringify(W)} found`),me)},void 0),videoRanges:W,preferHDR:Q,minFramerate:V,minBitrate:z}}function qb(l,n){Mt.log(`[abr] start candidates with "${l}" ignored because ${n}`)}function cfe(l){return l.reduce((n,o)=>{let i=n.groups[o.groupId];i||(i=n.groups[o.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(o);const u=o.channels||"2";return i.channels[u]=(i.channels[u]||0)+1,i.hasDefault=i.hasDefault||o.default,i.hasAutoSelect=i.hasAutoSelect||o.autoselect,i.hasDefault&&(n.hasDefaultAudio=!0),i.hasAutoSelect&&(n.hasAutoSelectAudio=!0),n},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function ufe(l,n,o,i){return l.slice(o,i+1).reduce((u,h)=>{if(!h.codecSet)return u;const g=h.audioGroups;let b=u[h.codecSet];b||(u[h.codecSet]=b={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!g,fragmentError:0}),b.minBitrate=Math.min(b.minBitrate,h.bitrate);const S=Math.min(h.height,h.width);return b.minHeight=Math.min(b.minHeight,S),b.minFramerate=Math.min(b.minFramerate,h.frameRate),b.maxScore=Math.max(b.maxScore,h.score),b.fragmentError+=h.fragmentError,b.videoRanges[h.videoRange]=(b.videoRanges[h.videoRange]||0)+1,g&&g.forEach(T=>{if(!T)return;const k=n.groups[T];b.hasDefaultAudio=b.hasDefaultAudio||n.hasDefaultAudio?k.hasDefault:k.hasAutoSelect||!n.hasDefaultAudio&&!n.hasAutoSelectAudio,Object.keys(k.channels).forEach(R=>{b.channels[R]=(b.channels[R]||0)+k.channels[R]})}),u},{})}function b0(l,n,o){if("attrs"in l){const i=n.indexOf(l);if(i!==-1)return i}for(let i=0;i<n.length;i++){const u=n[i];if(_T(l,u,o))return i}return-1}function _T(l,n,o){const{groupId:i,name:u,lang:h,assocLang:g,characteristics:b,default:S}=l,T=l.forced;return(i===void 0||n.groupId===i)&&(u===void 0||n.name===u)&&(h===void 0||n.lang===h)&&(h===void 0||n.assocLang===g)&&(S===void 0||n.default===S)&&(T===void 0||n.forced===T)&&(b===void 0||dfe(b,n.characteristics))&&(o===void 0||o(l,n))}function dfe(l,n=""){const o=l.split(","),i=n.split(",");return o.length===i.length&&!o.some(u=>i.indexOf(u)===-1)}function rT(l,n){const{audioCodec:o,channels:i}=l;return(o===void 0||(n.audioCodec||"").substring(0,4)===o.substring(0,4))&&(i===void 0||i===(n.channels||"2"))}function ffe(l,n,o,i,u){const h=n[i],b=n.reduce((V,z,$)=>{const W=z.uri;return(V[W]||(V[W]=[])).push($),V},{})[h.uri];b.length>1&&(i=Math.max.apply(Math,b));const S=h.videoRange,T=h.frameRate,k=h.codecSet.substring(0,4),R=cK(n,i,V=>{if(V.videoRange!==S||V.frameRate!==T||V.codecSet.substring(0,4)!==k)return!1;const z=V.audioGroups,$=o.filter(W=>!z||z.indexOf(W.groupId)!==-1);return b0(l,$,u)>-1});return R>-1?R:cK(n,i,V=>{const z=V.audioGroups,$=o.filter(W=>!z||z.indexOf(W.groupId)!==-1);return b0(l,$,u)>-1})}function cK(l,n,o){for(let i=n;i;i--)if(o(l[i]))return i;for(let i=n+1;i<l.length;i++)if(o(l[i]))return i;return-1}class hfe{constructor(n){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:o,partCurrent:i,hls:u}=this,{autoLevelEnabled:h,media:g}=u;if(!o||!g)return;const b=performance.now(),S=i?i.stats:o.stats,T=i?i.duration:o.duration,k=b-S.loading.start,R=u.minAutoLevel;if(S.aborted||S.loaded&&S.loaded===S.total||o.level<=R){this.clearTimer(),this._nextAutoLevel=-1;return}if(!h||g.paused||!g.playbackRate||!g.readyState)return;const V=u.mainForwardBufferInfo;if(V===null)return;const z=this.bwEstimator.getEstimateTTFB(),$=Math.abs(g.playbackRate);if(k<=Math.max(z,1e3*(T/($*2))))return;const W=V.len/$,Q=S.loading.first?S.loading.first-S.loading.start:-1,j=S.loaded&&Q>-1,se=this.getBwEstimate(),re=u.levels,Y=re[o.level],me=S.total||Math.max(S.loaded,Math.round(T*Y.averageBitrate/8));let ae=j?k-Q:k;ae<1&&j&&(ae=Math.min(k,S.loaded*8/se));const Ce=j?S.loaded*1e3/ae:0,Ue=Ce?(me-S.loaded)/Ce:me*8/se+z/1e3;if(Ue<=W)return;const ot=Ce?Ce*8:se;let Ae=Number.POSITIVE_INFINITY,ve;for(ve=o.level-1;ve>R;ve--){const O=re[ve].maxBitrate;if(Ae=this.getTimeToLoadFrag(z/1e3,ot,T*O,!re[ve].details),Ae<W)break}if(Ae>=Ue||Ae>T*10)return;u.nextLoadLevel=u.nextAutoLevel=ve,j?this.bwEstimator.sample(k-Math.min(z,Q),S.loaded):this.bwEstimator.sampleTTFB(k);const Oe=re[ve].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>Oe&&this.resetEstimator(Oe),this.clearTimer(),Mt.warn(`[abr] Fragment ${o.sn}${i?" part "+i.index:""} of level ${o.level} is loading too slowly;
      Time to underbuffer: ${W.toFixed(3)} s
      Estimated load time for current fragment: ${Ue.toFixed(3)} s
      Estimated load time for down switch fragment: ${Ae.toFixed(3)} s
      TTFB estimate: ${Q|0} ms
      Current BW estimate: ${Xo(se)?se|0:"Unknown"} bps
      New BW estimate: ${this.getBwEstimate()|0} bps
      Switching to level ${ve} @ ${Oe|0} bps`),u.trigger(we.FRAG_LOAD_EMERGENCY_ABORTED,{frag:o,part:i,stats:S})},this.hls=n,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(n){n&&(Mt.log(`setting initial bwe to ${n}`),this.hls.config.abrEwmaDefaultEstimate=n),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const n=this.hls.config;return new nfe(n.abrEwmaSlowVoD,n.abrEwmaFastVoD,n.abrEwmaDefaultEstimate)}registerListeners(){const{hls:n}=this;n.on(we.MANIFEST_LOADING,this.onManifestLoading,this),n.on(we.FRAG_LOADING,this.onFragLoading,this),n.on(we.FRAG_LOADED,this.onFragLoaded,this),n.on(we.FRAG_BUFFERED,this.onFragBuffered,this),n.on(we.LEVEL_SWITCHING,this.onLevelSwitching,this),n.on(we.LEVEL_LOADED,this.onLevelLoaded,this),n.on(we.LEVELS_UPDATED,this.onLevelsUpdated,this),n.on(we.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),n.on(we.ERROR,this.onError,this)}unregisterListeners(){const{hls:n}=this;n&&(n.off(we.MANIFEST_LOADING,this.onManifestLoading,this),n.off(we.FRAG_LOADING,this.onFragLoading,this),n.off(we.FRAG_LOADED,this.onFragLoaded,this),n.off(we.FRAG_BUFFERED,this.onFragBuffered,this),n.off(we.LEVEL_SWITCHING,this.onLevelSwitching,this),n.off(we.LEVEL_LOADED,this.onLevelLoaded,this),n.off(we.LEVELS_UPDATED,this.onLevelsUpdated,this),n.off(we.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),n.off(we.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(n,o){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(n,o){const i=o.frag;if(!this.ignoreFragment(i)){if(!i.bitrateTest){var u;this.fragCurrent=i,this.partCurrent=(u=o.part)!=null?u:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(n,o){this.clearTimer()}onError(n,o){if(!o.fatal)switch(o.details){case nn.BUFFER_ADD_CODEC_ERROR:case nn.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case nn.FRAG_LOAD_TIMEOUT:{const i=o.frag,{fragCurrent:u,partCurrent:h}=this;if(i&&u&&i.sn===u.sn&&i.level===u.level){const g=performance.now(),b=h?h.stats:i.stats,S=g-b.loading.start,T=b.loading.first?b.loading.first-b.loading.start:-1;if(b.loaded&&T>-1){const R=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(S-Math.min(R,T),b.loaded)}else this.bwEstimator.sampleTTFB(S)}break}}}getTimeToLoadFrag(n,o,i,u){const h=n+i/o,g=u?this.lastLevelLoadSec:0;return h+g}onLevelLoaded(n,o){const i=this.hls.config,{loading:u}=o.stats,h=u.end-u.start;Xo(h)&&(this.lastLevelLoadSec=h/1e3),o.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)}onFragLoaded(n,{frag:o,part:i}){const u=i?i.stats:o.stats;if(o.type===Us.MAIN&&this.bwEstimator.sampleTTFB(u.loading.first-u.loading.start),!this.ignoreFragment(o)){if(this.clearTimer(),o.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const h=i?i.duration:o.duration,g=this.hls.levels[o.level],b=(g.loaded?g.loaded.bytes:0)+u.loaded,S=(g.loaded?g.loaded.duration:0)+h;g.loaded={bytes:b,duration:S},g.realBitrate=Math.round(8*b/S)}if(o.bitrateTest){const h={stats:u,frag:o,part:i,id:o.type};this.onFragBuffered(we.FRAG_BUFFERED,h),o.bitrateTest=!1}else this.lastLoadedFragLevel=o.level}}onFragBuffered(n,o){const{frag:i,part:u}=o,h=u!=null&&u.stats.loaded?u.stats:i.stats;if(h.aborted||this.ignoreFragment(i))return;const g=h.parsing.end-h.loading.start-Math.min(h.loading.first-h.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(g,h.loaded),h.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=g/1e3:this.bitrateTestDelay=0}ignoreFragment(n){return n.type!==Us.MAIN||n.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:n,minAutoLevel:o}=this.hls,i=this.getBwEstimate(),u=this.hls.config.maxStarvationDelay,h=this.findBestLevel(i,o,n,0,u,1,1);if(h>-1)return h;const g=this.hls.firstLevel,b=Math.min(Math.max(g,o),n);return Mt.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${g} clamped to ${b}`),b}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const n=this.forcedAutoLevel,i=this.bwEstimator.canEstimate(),u=this.lastLoadedFragLevel>-1;if(n!==-1&&(!i||!u||this.nextAutoLevelKey===this.getAutoLevelKey()))return n;const h=i&&u?this.getNextABRAutoLevel():this.firstAutoLevel;if(n!==-1){const g=this.hls.levels;if(g.length>Math.max(n,h)&&g[n].loadError<=g[h].loadError)return n}return this._nextAutoLevel=h,this.nextAutoLevelKey=this.getAutoLevelKey(),h}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:n,partCurrent:o,hls:i}=this,{maxAutoLevel:u,config:h,minAutoLevel:g}=i,b=o?o.duration:n?n.duration:0,S=this.getBwEstimate(),T=this.getStarvationDelay();let k=h.abrBandWidthFactor,R=h.abrBandWidthUpFactor;if(T){const Q=this.findBestLevel(S,g,u,T,0,k,R);if(Q>=0)return Q}let V=b?Math.min(b,h.maxStarvationDelay):h.maxStarvationDelay;if(!T){const Q=this.bitrateTestDelay;Q&&(V=(b?Math.min(b,h.maxLoadingDelay):h.maxLoadingDelay)-Q,Mt.info(`[abr] bitrate test took ${Math.round(1e3*Q)}ms, set first fragment max fetchDuration to ${Math.round(1e3*V)} ms`),k=R=1)}const z=this.findBestLevel(S,g,u,T,V,k,R);if(Mt.info(`[abr] ${T?"rebuffering expected":"buffer is empty"}, optimal quality level ${z}`),z>-1)return z;const $=i.levels[g],W=i.levels[i.loadLevel];return($==null?void 0:$.bitrate)<(W==null?void 0:W.bitrate)?g:i.loadLevel}getStarvationDelay(){const n=this.hls,o=n.media;if(!o)return 1/0;const i=o&&o.playbackRate!==0?Math.abs(o.playbackRate):1,u=n.mainForwardBufferInfo;return(u?u.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(n,o,i,u,h,g,b){var S;const T=u+h,k=this.lastLoadedFragLevel,R=k===-1?this.hls.firstLevel:k,{fragCurrent:V,partCurrent:z}=this,{levels:$,allAudioTracks:W,loadLevel:Q,config:j}=this.hls;if($.length===1)return 0;const se=$[R],re=!!(se!=null&&(S=se.details)!=null&&S.live),Y=Q===-1||k===-1;let me,ae="SDR",Ce=(se==null?void 0:se.frameRate)||0;const{audioPreference:Ue,videoPreference:ot}=j,Ae=this.audioTracksByGroup||(this.audioTracksByGroup=cfe(W));if(Y){if(this.firstSelection!==-1)return this.firstSelection;const Fe=this.codecTiers||(this.codecTiers=ufe($,Ae,o,i)),st=lfe(Fe,ae,n,Ue,ot),{codecSet:Ut,videoRanges:et,minFramerate:Dt,minBitrate:Xe,preferHDR:it}=st;me=Ut,ae=it?et[et.length-1]:et[0],Ce=Dt,n=Math.max(n,Xe),Mt.log(`[abr] picked start tier ${JSON.stringify(st)}`)}else me=se==null?void 0:se.codecSet,ae=se==null?void 0:se.videoRange;const ve=z?z.duration:V?V.duration:0,Oe=this.bwEstimator.getEstimateTTFB()/1e3,O=[];for(let Fe=i;Fe>=o;Fe--){var De;const st=$[Fe],Ut=Fe>R;if(!st)continue;if(j.useMediaCapabilities&&!st.supportedResult&&!st.supportedPromise){const Un=navigator.mediaCapabilities;typeof(Un==null?void 0:Un.decodingInfo)=="function"&&ofe(st,Ae,ae,Ce,n,Ue)?(st.supportedPromise=sfe(st,Ae,Un),st.supportedPromise.then(on=>{if(!this.hls)return;st.supportedResult=on;const vt=this.hls.levels,an=vt.indexOf(st);on.error?Mt.warn(`[abr] MediaCapabilities decodingInfo error: "${on.error}" for level ${an} ${JSON.stringify(on)}`):on.supported||(Mt.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${an} ${JSON.stringify(on)}`),an>-1&&vt.length>1&&(Mt.log(`[abr] Removing unsupported level ${an}`),this.hls.removeLevel(an)))})):st.supportedResult=Nq}if(me&&st.codecSet!==me||ae&&st.videoRange!==ae||Ut&&Ce>st.frameRate||!Ut&&Ce>0&&Ce<st.frameRate||st.supportedResult&&!((De=st.supportedResult.decodingInfoResults)!=null&&De[0].smooth)){O.push(Fe);continue}const et=st.details,Dt=(z?et==null?void 0:et.partTarget:et==null?void 0:et.averagetargetduration)||ve;let Xe;Ut?Xe=b*n:Xe=g*n;const it=ve&&u>=ve*2&&h===0?$[Fe].averageBitrate:$[Fe].maxBitrate,qe=this.getTimeToLoadFrag(Oe,Xe,it*Dt,et===void 0);if(Xe>=it&&(Fe===k||st.loadError===0&&st.fragmentError===0)&&(qe<=Oe||!Xo(qe)||re&&!this.bitrateTestDelay||qe<T)){const Un=this.forcedAutoLevel;return Fe!==Q&&(Un===-1||Un!==Q)&&(O.length&&Mt.trace(`[abr] Skipped level(s) ${O.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${$[O[0]].codecs}" ${$[O[0]].videoRange}; not compatible with "${se.codecs}" ${ae}`),Mt.info(`[abr] switch candidate:${R}->${Fe} adjustedbw(${Math.round(Xe)})-bitrate=${Math.round(Xe-it)} ttfb:${Oe.toFixed(1)} avgDuration:${Dt.toFixed(1)} maxFetchDuration:${T.toFixed(1)} fetchDuration:${qe.toFixed(1)} firstSelection:${Y} codecSet:${me} videoRange:${ae} hls.loadLevel:${Q}`)),Y&&(this.firstSelection=Fe),Fe}}return-1}set nextAutoLevel(n){const{maxAutoLevel:o,minAutoLevel:i}=this.hls,u=Math.min(Math.max(n,i),o);this._nextAutoLevel!==u&&(this.nextAutoLevelKey="",this._nextAutoLevel=u)}}class mfe{constructor(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(n){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,n),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}var Su={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class pfe{constructor(n){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=n,this._registerListeners()}_registerListeners(){const{hls:n}=this;n.on(we.BUFFER_APPENDED,this.onBufferAppended,this),n.on(we.FRAG_BUFFERED,this.onFragBuffered,this),n.on(we.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:n}=this;n.off(we.BUFFER_APPENDED,this.onBufferAppended,this),n.off(we.FRAG_BUFFERED,this.onFragBuffered,this),n.off(we.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(n,o){const i=this.activePartLists[o];if(i)for(let u=i.length;u--;){const h=i[u];if(!h)break;const g=h.end;if(h.start<=n&&g!==null&&n<=g)return h}return this.getBufferedFrag(n,o)}getBufferedFrag(n,o){const{fragments:i}=this,u=Object.keys(i);for(let h=u.length;h--;){const g=i[u[h]];if((g==null?void 0:g.body.type)===o&&g.buffered){const b=g.body;if(b.start<=n&&n<=b.end)return b}}return null}detectEvictedFragments(n,o,i,u){this.timeRanges&&(this.timeRanges[n]=o);const h=(u==null?void 0:u.fragment.sn)||-1;Object.keys(this.fragments).forEach(g=>{const b=this.fragments[g];if(!b||h>=b.body.sn)return;if(!b.buffered&&!b.loaded){b.body.type===i&&this.removeFragment(b.body);return}const S=b.range[n];S&&S.time.some(T=>{const k=!this.isTimeBuffered(T.startPTS,T.endPTS,o);return k&&this.removeFragment(b.body),k})})}detectPartialFragments(n){const o=this.timeRanges,{frag:i,part:u}=n;if(!o||i.sn==="initSegment")return;const h=iT(i),g=this.fragments[h];if(!g||g.buffered&&i.gap)return;const b=!i.relurl;Object.keys(o).forEach(S=>{const T=i.elementaryStreams[S];if(!T)return;const k=o[S],R=b||T.partial===!0;g.range[S]=this.getBufferedTimes(i,u,R,k)}),g.loaded=null,Object.keys(g.range).length?(g.buffered=!0,(g.body.endList=i.endList||g.body.endList)&&(this.endListFragments[g.body.type]=g),M4(g)||this.removeParts(i.sn-1,i.type)):this.removeFragment(g.body)}removeParts(n,o){const i=this.activePartLists[o];i&&(this.activePartLists[o]=i.filter(u=>u.fragment.sn>=n))}fragBuffered(n,o){const i=iT(n);let u=this.fragments[i];!u&&o&&(u=this.fragments[i]={body:n,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},n.gap&&(this.hasGaps=!0)),u&&(u.loaded=null,u.buffered=!0)}getBufferedTimes(n,o,i,u){const h={time:[],partial:i},g=n.start,b=n.end,S=n.minEndPTS||b,T=n.maxStartPTS||g;for(let k=0;k<u.length;k++){const R=u.start(k)-this.bufferPadding,V=u.end(k)+this.bufferPadding;if(T>=R&&S<=V){h.time.push({startPTS:Math.max(g,u.start(k)),endPTS:Math.min(b,u.end(k))});break}else if(g<V&&b>R){const z=Math.max(g,u.start(k)),$=Math.min(b,u.end(k));$>z&&(h.partial=!0,h.time.push({startPTS:z,endPTS:$}))}else if(b<=R)break}return h}getPartialFragment(n){let o=null,i,u,h,g=0;const{bufferPadding:b,fragments:S}=this;return Object.keys(S).forEach(T=>{const k=S[T];k&&M4(k)&&(u=k.body.start-b,h=k.body.end+b,n>=u&&n<=h&&(i=Math.min(n-u,h-n),g<=i&&(o=k.body,g=i)))}),o}isEndListAppended(n){const o=this.endListFragments[n];return o!==void 0&&(o.buffered||M4(o))}getState(n){const o=iT(n),i=this.fragments[o];return i?i.buffered?M4(i)?Su.PARTIAL:Su.OK:Su.APPENDING:Su.NOT_LOADED}isTimeBuffered(n,o,i){let u,h;for(let g=0;g<i.length;g++){if(u=i.start(g)-this.bufferPadding,h=i.end(g)+this.bufferPadding,n>=u&&o<=h)return!0;if(o<=u)return!1}return!1}onFragLoaded(n,o){const{frag:i,part:u}=o;if(i.sn==="initSegment"||i.bitrateTest)return;const h=u?null:o,g=iT(i);this.fragments[g]={body:i,appendedPTS:null,loaded:h,buffered:!1,range:Object.create(null)}}onBufferAppended(n,o){const{frag:i,part:u,timeRanges:h}=o;if(i.sn==="initSegment")return;const g=i.type;if(u){let b=this.activePartLists[g];b||(this.activePartLists[g]=b=[]),b.push(u)}this.timeRanges=h,Object.keys(h).forEach(b=>{const S=h[b];this.detectEvictedFragments(b,S,g,u)})}onFragBuffered(n,o){this.detectPartialFragments(o)}hasFragment(n){const o=iT(n);return!!this.fragments[o]}hasParts(n){var o;return!!((o=this.activePartLists[n])!=null&&o.length)}removeFragmentsInRange(n,o,i,u,h){u&&!this.hasGaps||Object.keys(this.fragments).forEach(g=>{const b=this.fragments[g];if(!b)return;const S=b.body;S.type!==i||u&&!S.gap||S.start<o&&S.end>n&&(b.buffered||h)&&this.removeFragment(S)})}removeFragment(n){const o=iT(n);n.stats.loaded=0,n.clearElementaryStreamInfo();const i=this.activePartLists[n.type];if(i){const u=n.sn;this.activePartLists[n.type]=i.filter(h=>h.fragment.sn!==u)}delete this.fragments[o],n.endList&&delete this.endListFragments[n.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function M4(l){var n,o,i;return l.buffered&&(l.body.gap||((n=l.range.video)==null?void 0:n.partial)||((o=l.range.audio)==null?void 0:o.partial)||((i=l.range.audiovideo)==null?void 0:i.partial))}function iT(l){return`${l.type}_${l.level}_${l.sn}`}const gfe={length:0,start:()=>0,end:()=>0};class Xa{static isBuffered(n,o){try{if(n){const i=Xa.getBuffered(n);for(let u=0;u<i.length;u++)if(o>=i.start(u)&&o<=i.end(u))return!0}}catch{}return!1}static bufferInfo(n,o,i){try{if(n){const u=Xa.getBuffered(n),h=[];let g;for(g=0;g<u.length;g++)h.push({start:u.start(g),end:u.end(g)});return this.bufferedInfo(h,o,i)}}catch{}return{len:0,start:o,end:o,nextStart:void 0}}static bufferedInfo(n,o,i){o=Math.max(0,o),n.sort(function(T,k){const R=T.start-k.start;return R||k.end-T.end});let u=[];if(i)for(let T=0;T<n.length;T++){const k=u.length;if(k){const R=u[k-1].end;n[T].start-R<i?n[T].end>R&&(u[k-1].end=n[T].end):u.push(n[T])}else u.push(n[T])}else u=n;let h=0,g,b=o,S=o;for(let T=0;T<u.length;T++){const k=u[T].start,R=u[T].end;if(o+i>=k&&o<R)b=k,S=R,h=S-o;else if(o+i<k){g=k;break}}return{len:h,start:b||0,end:S||0,nextStart:g}}static getBuffered(n){try{return n.buffered}catch(o){return Mt.log("failed to get media.buffered",o),gfe}}}class dz{constructor(n,o,i,u=0,h=-1,g=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=N4(),this.buffering={audio:N4(),video:N4(),audiovideo:N4()},this.level=n,this.sn=o,this.id=i,this.size=u,this.part=h,this.partial=g}}function N4(){return{start:0,executeStart:0,executeEnd:0,end:0}}function sB(l,n){for(let i=0,u=l.length;i<u;i++){var o;if(((o=l[i])==null?void 0:o.cc)===n)return l[i]}return null}function bfe(l,n,o){return!!(n&&(o.endCC>o.startCC||l&&l.cc<o.startCC))}function vfe(l,n){const o=l.fragments,i=n.fragments;if(!i.length||!o.length){Mt.log("No fragments to align");return}const u=sB(o,i[0].cc);if(!u||u&&!u.startPTS){Mt.log("No frag in previous level to align on");return}return u}function uK(l,n){if(l){const o=l.start+n;l.start=l.startPTS=o,l.endPTS=o+l.duration}}function Fq(l,n){const o=n.fragments;for(let i=0,u=o.length;i<u;i++)uK(o[i],l);n.fragmentHint&&uK(n.fragmentHint,l),n.alignedSliding=!0}function xfe(l,n,o){n&&(yfe(l,o,n),!o.alignedSliding&&n&&IB(o,n),!o.alignedSliding&&n&&!o.skippedSegments&&Oq(n,o))}function yfe(l,n,o){if(bfe(l,o,n)){const i=vfe(o,n);i&&Xo(i.start)&&(Mt.log(`Adjusting PTS using last level due to CC increase within current level ${n.url}`),Fq(i.start,n))}}function IB(l,n){if(!l.hasProgramDateTime||!n.hasProgramDateTime)return;const o=l.fragments,i=n.fragments;if(!o.length||!i.length)return;let u,h;const g=Math.min(n.endCC,l.endCC);n.startCC<g&&l.startCC<g&&(u=sB(i,g),h=sB(o,g)),(!u||!h)&&(u=i[Math.floor(i.length/2)],h=sB(o,u.cc)||o[Math.floor(o.length/2)]);const b=u.programDateTime,S=h.programDateTime;if(!b||!S)return;const T=(S-b)/1e3-(h.start-u.start);Fq(T,l)}const dK=Math.pow(2,17);class wfe{constructor(n){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=n}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(n,o){const i=n.url;if(!i)return Promise.reject(new Xb({type:Gs.NETWORK_ERROR,details:nn.FRAG_LOAD_ERROR,fatal:!1,frag:n,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const u=this.config,h=u.fLoader,g=u.loader;return new Promise((b,S)=>{if(this.loader&&this.loader.destroy(),n.gap)if(n.tagList.some(z=>z[0]==="GAP")){S(hK(n));return}else n.gap=!1;const T=this.loader=n.loader=h?new h(u):new g(u),k=fK(n),R=aK(u.fragLoadPolicy.default),V={loadPolicy:R,timeout:R.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:n.sn==="initSegment"?1/0:dK};n.stats=T.stats,T.load(k,V,{onSuccess:(z,$,W,Q)=>{this.resetLoader(n,T);let j=z.data;W.resetIV&&n.decryptdata&&(n.decryptdata.iv=new Uint8Array(j.slice(0,16)),j=j.slice(16)),b({frag:n,part:null,payload:j,networkDetails:Q})},onError:(z,$,W,Q)=>{this.resetLoader(n,T),S(new Xb({type:Gs.NETWORK_ERROR,details:nn.FRAG_LOAD_ERROR,fatal:!1,frag:n,response:Eu({url:i,data:void 0},z),error:new Error(`HTTP Error ${z.code} ${z.text}`),networkDetails:W,stats:Q}))},onAbort:(z,$,W)=>{this.resetLoader(n,T),S(new Xb({type:Gs.NETWORK_ERROR,details:nn.INTERNAL_ABORTED,fatal:!1,frag:n,error:new Error("Aborted"),networkDetails:W,stats:z}))},onTimeout:(z,$,W)=>{this.resetLoader(n,T),S(new Xb({type:Gs.NETWORK_ERROR,details:nn.FRAG_LOAD_TIMEOUT,fatal:!1,frag:n,error:new Error(`Timeout after ${V.timeout}ms`),networkDetails:W,stats:z}))},onProgress:(z,$,W,Q)=>{o&&o({frag:n,part:null,payload:W,networkDetails:Q})}})})}loadPart(n,o,i){this.abort();const u=this.config,h=u.fLoader,g=u.loader;return new Promise((b,S)=>{if(this.loader&&this.loader.destroy(),n.gap||o.gap){S(hK(n,o));return}const T=this.loader=n.loader=h?new h(u):new g(u),k=fK(n,o),R=aK(u.fragLoadPolicy.default),V={loadPolicy:R,timeout:R.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:dK};o.stats=T.stats,T.load(k,V,{onSuccess:(z,$,W,Q)=>{this.resetLoader(n,T),this.updateStatsFromPart(n,o);const j={frag:n,part:o,payload:z.data,networkDetails:Q};i(j),b(j)},onError:(z,$,W,Q)=>{this.resetLoader(n,T),S(new Xb({type:Gs.NETWORK_ERROR,details:nn.FRAG_LOAD_ERROR,fatal:!1,frag:n,part:o,response:Eu({url:k.url,data:void 0},z),error:new Error(`HTTP Error ${z.code} ${z.text}`),networkDetails:W,stats:Q}))},onAbort:(z,$,W)=>{n.stats.aborted=o.stats.aborted,this.resetLoader(n,T),S(new Xb({type:Gs.NETWORK_ERROR,details:nn.INTERNAL_ABORTED,fatal:!1,frag:n,part:o,error:new Error("Aborted"),networkDetails:W,stats:z}))},onTimeout:(z,$,W)=>{this.resetLoader(n,T),S(new Xb({type:Gs.NETWORK_ERROR,details:nn.FRAG_LOAD_TIMEOUT,fatal:!1,frag:n,part:o,error:new Error(`Timeout after ${V.timeout}ms`),networkDetails:W,stats:z}))}})})}updateStatsFromPart(n,o){const i=n.stats,u=o.stats,h=u.total;if(i.loaded+=u.loaded,h){const S=Math.round(n.duration/o.duration),T=Math.min(Math.round(i.loaded/h),S),R=(S-T)*Math.round(i.loaded/T);i.total=i.loaded+R}else i.total=Math.max(i.loaded,i.total);const g=i.loading,b=u.loading;g.start?g.first+=b.first-b.start:(g.start=b.start,g.first=b.first),g.end=b.end}resetLoader(n,o){n.loader=null,this.loader===o&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),o.destroy()}}function fK(l,n=null){const o=n||l,i={frag:l,part:n,responseType:"arraybuffer",url:o.url,headers:{},rangeStart:0,rangeEnd:0},u=o.byteRangeStartOffset,h=o.byteRangeEndOffset;if(Xo(u)&&Xo(h)){var g;let b=u,S=h;if(l.sn==="initSegment"&&((g=l.decryptdata)==null?void 0:g.method)==="AES-128"){const T=h-u;T%16&&(S=h+(16-T%16)),u!==0&&(i.resetIV=!0,b=u-16)}i.rangeStart=b,i.rangeEnd=S}return i}function hK(l,n){const o=new Error(`GAP ${l.gap?"tag":"attribute"} found`),i={type:Gs.MEDIA_ERROR,details:nn.FRAG_GAP,fatal:!1,frag:l,error:o,networkDetails:null};return n&&(i.part=n),(n||l).stats.aborted=!0,new Xb(i)}class Xb extends Error{constructor(n){super(n.error.message),this.data=void 0,this.data=n}}class Sfe{constructor(n,o){this.subtle=void 0,this.aesIV=void 0,this.subtle=n,this.aesIV=o}decrypt(n,o){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},o,n)}}class Efe{constructor(n,o){this.subtle=void 0,this.key=void 0,this.subtle=n,this.key=o}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}function Cfe(l){const n=l.byteLength,o=n&&new DataView(l.buffer).getUint8(n-1);return o?uS(l,0,n-o):l}class _fe{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(n){const o=new DataView(n),i=new Uint32Array(4);for(let u=0;u<4;u++)i[u]=o.getUint32(u*4);return i}initTable(){const n=this.sBox,o=this.invSBox,i=this.subMix,u=i[0],h=i[1],g=i[2],b=i[3],S=this.invSubMix,T=S[0],k=S[1],R=S[2],V=S[3],z=new Uint32Array(256);let $=0,W=0,Q=0;for(Q=0;Q<256;Q++)Q<128?z[Q]=Q<<1:z[Q]=Q<<1^283;for(Q=0;Q<256;Q++){let j=W^W<<1^W<<2^W<<3^W<<4;j=j>>>8^j&255^99,n[$]=j,o[j]=$;const se=z[$],re=z[se],Y=z[re];let me=z[j]*257^j*16843008;u[$]=me<<24|me>>>8,h[$]=me<<16|me>>>16,g[$]=me<<8|me>>>24,b[$]=me,me=Y*16843009^re*65537^se*257^$*16843008,T[j]=me<<24|me>>>8,k[j]=me<<16|me>>>16,R[j]=me<<8|me>>>24,V[j]=me,$?($=se^z[z[z[Y^se]]],W^=z[z[W]]):$=W=1}}expandKey(n){const o=this.uint8ArrayToUint32Array_(n);let i=!0,u=0;for(;u<o.length&&i;)i=o[u]===this.key[u],u++;if(i)return;this.key=o;const h=this.keySize=o.length;if(h!==4&&h!==6&&h!==8)throw new Error("Invalid aes key size="+h);const g=this.ksRows=(h+6+1)*4;let b,S;const T=this.keySchedule=new Uint32Array(g),k=this.invKeySchedule=new Uint32Array(g),R=this.sBox,V=this.rcon,z=this.invSubMix,$=z[0],W=z[1],Q=z[2],j=z[3];let se,re;for(b=0;b<g;b++){if(b<h){se=T[b]=o[b];continue}re=se,b%h===0?(re=re<<8|re>>>24,re=R[re>>>24]<<24|R[re>>>16&255]<<16|R[re>>>8&255]<<8|R[re&255],re^=V[b/h|0]<<24):h>6&&b%h===4&&(re=R[re>>>24]<<24|R[re>>>16&255]<<16|R[re>>>8&255]<<8|R[re&255]),T[b]=se=(T[b-h]^re)>>>0}for(S=0;S<g;S++)b=g-S,S&3?re=T[b]:re=T[b-4],S<4||b<=4?k[S]=re:k[S]=$[R[re>>>24]]^W[R[re>>>16&255]]^Q[R[re>>>8&255]]^j[R[re&255]],k[S]=k[S]>>>0}networkToHostOrderSwap(n){return n<<24|(n&65280)<<8|(n&16711680)>>8|n>>>24}decrypt(n,o,i){const u=this.keySize+6,h=this.invKeySchedule,g=this.invSBox,b=this.invSubMix,S=b[0],T=b[1],k=b[2],R=b[3],V=this.uint8ArrayToUint32Array_(i);let z=V[0],$=V[1],W=V[2],Q=V[3];const j=new Int32Array(n),se=new Int32Array(j.length);let re,Y,me,ae,Ce,Ue,ot,Ae,ve,Oe,O,De,Fe,st;const Ut=this.networkToHostOrderSwap;for(;o<j.length;){for(ve=Ut(j[o]),Oe=Ut(j[o+1]),O=Ut(j[o+2]),De=Ut(j[o+3]),Ce=ve^h[0],Ue=De^h[1],ot=O^h[2],Ae=Oe^h[3],Fe=4,st=1;st<u;st++)re=S[Ce>>>24]^T[Ue>>16&255]^k[ot>>8&255]^R[Ae&255]^h[Fe],Y=S[Ue>>>24]^T[ot>>16&255]^k[Ae>>8&255]^R[Ce&255]^h[Fe+1],me=S[ot>>>24]^T[Ae>>16&255]^k[Ce>>8&255]^R[Ue&255]^h[Fe+2],ae=S[Ae>>>24]^T[Ce>>16&255]^k[Ue>>8&255]^R[ot&255]^h[Fe+3],Ce=re,Ue=Y,ot=me,Ae=ae,Fe=Fe+4;re=g[Ce>>>24]<<24^g[Ue>>16&255]<<16^g[ot>>8&255]<<8^g[Ae&255]^h[Fe],Y=g[Ue>>>24]<<24^g[ot>>16&255]<<16^g[Ae>>8&255]<<8^g[Ce&255]^h[Fe+1],me=g[ot>>>24]<<24^g[Ae>>16&255]<<16^g[Ce>>8&255]<<8^g[Ue&255]^h[Fe+2],ae=g[Ae>>>24]<<24^g[Ce>>16&255]<<16^g[Ue>>8&255]<<8^g[ot&255]^h[Fe+3],se[o]=Ut(re^z),se[o+1]=Ut(ae^$),se[o+2]=Ut(me^W),se[o+3]=Ut(Y^Q),z=ve,$=Oe,W=O,Q=De,o=o+4}return se.buffer}}const Tfe=16;class fz{constructor(n,{removePKCS7Padding:o=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.useSoftware=n.enableSoftwareAES,this.removePKCS7Padding=o,o)try{const i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch{}this.subtle===null&&(this.useSoftware=!0)}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:n,remainderData:o}=this;if(!n||o)return this.reset(),null;const i=new Uint8Array(n);return this.reset(),this.removePKCS7Padding?Cfe(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(n,o,i){return this.useSoftware?new Promise((u,h)=>{this.softwareDecrypt(new Uint8Array(n),o,i);const g=this.flush();g?u(g.buffer):h(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(n),o,i)}softwareDecrypt(n,o,i){const{currentIV:u,currentResult:h,remainderData:g}=this;this.logOnce("JS AES decrypt"),g&&(n=Mm(g,n),this.remainderData=null);const b=this.getValidChunk(n);if(!b.length)return null;u&&(i=u);let S=this.softwareDecrypter;S||(S=this.softwareDecrypter=new _fe),S.expandKey(o);const T=h;return this.currentResult=S.decrypt(b.buffer,0,i),this.currentIV=uS(b,-16).buffer,T||null}webCryptoDecrypt(n,o,i){const u=this.subtle;return(this.key!==o||!this.fastAesKey)&&(this.key=o,this.fastAesKey=new Efe(u,o)),this.fastAesKey.expandKey().then(h=>u?(this.logOnce("WebCrypto AES decrypt"),new Sfe(u,new Uint8Array(i)).decrypt(n.buffer,h)):Promise.reject(new Error("web crypto not initialized"))).catch(h=>(Mt.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${h.name}: ${h.message}`),this.onWebCryptoError(n,o,i)))}onWebCryptoError(n,o,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(n,o,i);const u=this.flush();if(u)return u.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(n){let o=n;const i=n.length-n.length%Tfe;return i!==n.length&&(o=uS(n,0,i),this.remainderData=uS(n,i)),o}logOnce(n){this.logEnabled&&(Mt.log(`[decrypter]: ${n}`),this.logEnabled=!1)}}const Dfe={toString:function(l){let n="";const o=l.length;for(let i=0;i<o;i++)n+=`[${l.start(i).toFixed(3)}-${l.end(i).toFixed(3)}]`;return n}},Hn={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class hz extends mfe{constructor(n,o,i,u,h){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=Hn.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.loadedmetadata=!1,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=h,this.logPrefix=u,this.log=Mt.log.bind(Mt,`${u}:`),this.warn=Mt.warn.bind(Mt,`${u}:`),this.hls=n,this.fragmentLoader=new wfe(n.config),this.keyLoader=i,this.fragmentTracker=o,this.config=n.config,this.decrypter=new fz(n.config),n.on(we.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(n){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const n=this.fragCurrent;n!=null&&n.loader&&(n.abortRequests(),this.fragmentTracker.removeFragment(n)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=Hn.STOPPED}_streamEnded(n,o){if(o.live||n.nextStart||!n.end||!this.media)return!1;const i=o.partList;if(i!=null&&i.length){const h=i[i.length-1];return Xa.isBuffered(this.media,h.start+h.duration/2)}const u=o.fragments[o.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(u)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var n;return(n=this.levelLastLoaded)==null?void 0:n.details}}onMediaAttached(n,o){const i=this.media=this.mediaBuffer=o.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),i.addEventListener("seeking",this.onvseeking),i.addEventListener("ended",this.onvended);const u=this.config;this.levels&&u.autoStartLoad&&this.state===Hn.STOPPED&&this.startLoad(u.startPosition)}onMediaDetaching(){const n=this.media;n!=null&&n.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),n&&this.onvseeking&&this.onvended&&(n.removeEventListener("seeking",this.onvseeking),n.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:n,fragCurrent:o,media:i,mediaBuffer:u,state:h}=this,g=i?i.currentTime:0,b=Xa.bufferInfo(u||i,g,n.maxBufferHole);if(this.log(`media seeking to ${Xo(g)?g.toFixed(3):g}, state: ${h}`),this.state===Hn.ENDED)this.resetLoadingState();else if(o){const S=n.maxFragLookUpTolerance,T=o.start-S,k=o.start+o.duration+S;if(!b.len||k<b.start||T>b.end){const R=g>k;(g<T||R)&&(R&&o.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),o.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}i&&(this.fragmentTracker.removeFragmentsInRange(g,1/0,this.playlistType,!0),this.lastCurrentTime=g),!this.loadedmetadata&&!b.len&&(this.nextLoadPosition=this.startPosition=g),this.tickImmediate()}onMediaEnded(){this.startPosition=this.lastCurrentTime=0}onManifestLoaded(n,o){this.startTimeOffset=o.startTimeOffset,this.initPTS=[]}onHandlerDestroying(){this.hls.off(we.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),super.onHandlerDestroying(),this.hls=null}onHandlerDestroyed(){this.state=Hn.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(n,o,i){this._loadFragForPlayback(n,o,i)}_loadFragForPlayback(n,o,i){const u=h=>{if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${h.part?" p: "+h.part.index:""} of level ${n.level} was dropped during download.`),this.fragmentTracker.removeFragment(n);return}n.stats.chunkCount++,this._handleFragmentLoadProgress(h)};this._doFragLoad(n,o,i,u).then(h=>{if(!h)return;const g=this.state;if(this.fragContextChanged(n)){(g===Hn.FRAG_LOADING||!this.fragCurrent&&g===Hn.PARSING)&&(this.fragmentTracker.removeFragment(n),this.state=Hn.IDLE);return}"payload"in h&&(this.log(`Loaded fragment ${n.sn} of level ${n.level}`),this.hls.trigger(we.FRAG_LOADED,h)),this._handleFragmentLoadComplete(h)}).catch(h=>{this.state===Hn.STOPPED||this.state===Hn.ERROR||(this.warn(h),this.resetFragmentLoading(n))})}clearTrackerIfNeeded(n){var o;const{fragmentTracker:i}=this;if(i.getState(n)===Su.APPENDING){const h=n.type,g=this.getFwdBufferInfo(this.mediaBuffer,h),b=Math.max(n.duration,g?g.len:this.config.maxBufferLength);this.reduceMaxBufferLength(b)&&i.removeFragment(n)}else((o=this.mediaBuffer)==null?void 0:o.buffered.length)===0?i.removeAllFragments():i.hasParts(n.type)&&(i.detectPartialFragments({frag:n,part:null,stats:n.stats,id:n.type}),i.getState(n)===Su.PARTIAL&&i.removeFragment(n))}checkLiveUpdate(n){if(n.updated&&!n.live){const o=n.fragments[n.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:o,part:null,stats:o.stats,id:o.type})}n.fragments[0]||(n.deltaUpdateFailed=!0)}flushMainBuffer(n,o,i=null){if(!(n-o))return;const u={startOffset:n,endOffset:o,type:i};this.hls.trigger(we.BUFFER_FLUSHING,u)}_loadInitSegment(n,o){this._doFragLoad(n,o).then(i=>{if(!i||this.fragContextChanged(n)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:u}=this,{payload:h}=i,g=n.decryptdata;if(h&&h.byteLength>0&&g!=null&&g.key&&g.iv&&g.method==="AES-128"){const b=self.performance.now();return this.decrypter.decrypt(new Uint8Array(h),g.key.buffer,g.iv.buffer).catch(S=>{throw u.trigger(we.ERROR,{type:Gs.MEDIA_ERROR,details:nn.FRAG_DECRYPT_ERROR,fatal:!1,error:S,reason:S.message,frag:n}),S}).then(S=>{const T=self.performance.now();return u.trigger(we.FRAG_DECRYPTED,{frag:n,payload:S,stats:{tstart:b,tdecrypt:T}}),i.payload=S,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===Hn.STOPPED||this.state===Hn.ERROR||(this.warn(i),this.resetFragmentLoading(n))})}completeInitSegmentLoad(n){const{levels:o}=this;if(!o)throw new Error("init load aborted, missing levels");const i=n.frag.stats;this.state=Hn.IDLE,n.frag.data=new Uint8Array(n.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}fragContextChanged(n){const{fragCurrent:o}=this;return!n||!o||n.sn!==o.sn||n.level!==o.level}fragBufferedComplete(n,o){var i,u,h,g;const b=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${n.type} sn: ${n.sn}${o?" part: "+o.index:""} of ${this.playlistType===Us.MAIN?"level":"track"} ${n.level} (frag:[${((i=n.startPTS)!=null?i:NaN).toFixed(3)}-${((u=n.endPTS)!=null?u:NaN).toFixed(3)}] > buffer:${b?Dfe.toString(Xa.getBuffered(b)):"(detached)"})`),n.sn!=="initSegment"){var S;if(n.type!==Us.SUBTITLE){const k=n.elementaryStreams;if(!Object.keys(k).some(R=>!!k[R])){this.state=Hn.IDLE;return}}const T=(S=this.levels)==null?void 0:S[n.level];T!=null&&T.fragmentError&&(this.log(`Resetting level fragment error count of ${T.fragmentError} on frag buffered`),T.fragmentError=0)}this.state=Hn.IDLE,b&&(!this.loadedmetadata&&n.type==Us.MAIN&&b.buffered.length&&((h=this.fragCurrent)==null?void 0:h.sn)===((g=this.fragPrevious)==null?void 0:g.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(n){const{transmuxer:o}=this;if(!o)return;const{frag:i,part:u,partsLoaded:h}=n,g=!h||h.length===0||h.some(S=>!S),b=new dz(i.level,i.sn,i.stats.chunkCount+1,0,u?u.index:-1,!g);o.flush(b)}_handleFragmentLoadProgress(n){}_doFragLoad(n,o,i=null,u){var h;const g=o==null?void 0:o.details;if(!this.levels||!g)throw new Error(`frag load aborted, missing level${g?"":" detail"}s`);let b=null;if(n.encrypted&&!((h=n.decryptdata)!=null&&h.key)?(this.log(`Loading key for ${n.sn} of [${g.startSN}-${g.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${n.level}`),this.state=Hn.KEY_LOADING,this.fragCurrent=n,b=this.keyLoader.load(n).then(k=>{if(!this.fragContextChanged(k.frag))return this.hls.trigger(we.KEY_LOADED,k),this.state===Hn.KEY_LOADING&&(this.state=Hn.IDLE),k}),this.hls.trigger(we.KEY_LOADING,{frag:n}),this.fragCurrent===null&&(b=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!n.encrypted&&g.encryptedFragments.length&&this.keyLoader.loadClear(n,g.encryptedFragments),i=Math.max(n.start,i||0),this.config.lowLatencyMode&&n.sn!=="initSegment"){const k=g.partList;if(k&&u){i>n.end&&g.fragmentHint&&(n=g.fragmentHint);const R=this.getNextPart(k,n,i);if(R>-1){const V=k[R];this.log(`Loading part sn: ${n.sn} p: ${V.index} cc: ${n.cc} of playlist [${g.startSN}-${g.endSN}] parts [0-${R}-${k.length-1}] ${this.logPrefix==="[stream-controller]"?"level":"track"}: ${n.level}, target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=V.start+V.duration,this.state=Hn.FRAG_LOADING;let z;return b?z=b.then($=>!$||this.fragContextChanged($.frag)?null:this.doFragPartsLoad(n,V,o,u)).catch($=>this.handleFragLoadError($)):z=this.doFragPartsLoad(n,V,o,u).catch($=>this.handleFragLoadError($)),this.hls.trigger(we.FRAG_LOADING,{frag:n,part:V,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):z}else if(!n.url||this.loadedEndOfParts(k,i))return Promise.resolve(null)}}this.log(`Loading fragment ${n.sn} cc: ${n.cc} ${g?"of ["+g.startSN+"-"+g.endSN+"] ":""}${this.logPrefix==="[stream-controller]"?"level":"track"}: ${n.level}, target: ${parseFloat(i.toFixed(3))}`),Xo(n.sn)&&!this.bitrateTest&&(this.nextLoadPosition=n.start+n.duration),this.state=Hn.FRAG_LOADING;const S=this.config.progressive;let T;return S&&b?T=b.then(k=>!k||this.fragContextChanged(k==null?void 0:k.frag)?null:this.fragmentLoader.load(n,u)).catch(k=>this.handleFragLoadError(k)):T=Promise.all([this.fragmentLoader.load(n,S?u:void 0),b]).then(([k])=>(!S&&k&&u&&u(k),k)).catch(k=>this.handleFragLoadError(k)),this.hls.trigger(we.FRAG_LOADING,{frag:n,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):T}doFragPartsLoad(n,o,i,u){return new Promise((h,g)=>{var b;const S=[],T=(b=i.details)==null?void 0:b.partList,k=R=>{this.fragmentLoader.loadPart(n,R,u).then(V=>{S[R.index]=V;const z=V.part;this.hls.trigger(we.FRAG_LOADED,V);const $=rK(i,n.sn,R.index+1)||Iq(T,n.sn,R.index+1);if($)k($);else return h({frag:n,part:z,partsLoaded:S})}).catch(g)};k(o)})}handleFragLoadError(n){if("data"in n){const o=n.data;n.data&&o.details===nn.INTERNAL_ABORTED?this.handleFragLoadAborted(o.frag,o.part):this.hls.trigger(we.ERROR,o)}else this.hls.trigger(we.ERROR,{type:Gs.OTHER_ERROR,details:nn.INTERNAL_EXCEPTION,err:n,error:n,fatal:!0});return null}_handleTransmuxerFlush(n){const o=this.getCurrentContext(n);if(!o||this.state!==Hn.PARSING){!this.fragCurrent&&this.state!==Hn.STOPPED&&this.state!==Hn.ERROR&&(this.state=Hn.IDLE);return}const{frag:i,part:u,level:h}=o,g=self.performance.now();i.stats.parsing.end=g,u&&(u.stats.parsing.end=g),this.updateLevelTiming(i,u,h,n.partial)}getCurrentContext(n){const{levels:o,fragCurrent:i}=this,{level:u,sn:h,part:g}=n;if(!(o!=null&&o[u]))return this.warn(`Levels object was unset while buffering fragment ${h} of level ${u}. The current chunk will not be buffered.`),null;const b=o[u],S=g>-1?rK(b,h,g):null,T=S?S.fragment:Yde(b,h,i);return T?(i&&i!==T&&(T.stats=i.stats),{frag:T,part:S,level:b}):null}bufferFragmentData(n,o,i,u,h){var g;if(!n||this.state!==Hn.PARSING)return;const{data1:b,data2:S}=n;let T=b;if(b&&S&&(T=Mm(b,S)),!((g=T)!=null&&g.length))return;const k={type:n.type,frag:o,part:i,chunkMeta:u,parent:o.type,data:T};if(this.hls.trigger(we.BUFFER_APPENDING,k),n.dropped&&n.independent&&!i){if(h)return;this.flushBufferGap(o)}}flushBufferGap(n){const o=this.media;if(!o)return;if(!Xa.isBuffered(o,o.currentTime)){this.flushMainBuffer(0,n.start);return}const i=o.currentTime,u=Xa.bufferInfo(o,i,0),h=n.duration,g=Math.min(this.config.maxFragLookUpTolerance*2,h*.25),b=Math.max(Math.min(n.start-g,u.end-g),i+g);n.start-b>g&&this.flushMainBuffer(b,n.start)}getFwdBufferInfo(n,o){const i=this.getLoadPosition();return Xo(i)?this.getFwdBufferInfoAtPos(n,i,o):null}getFwdBufferInfoAtPos(n,o,i){const{config:{maxBufferHole:u}}=this,h=Xa.bufferInfo(n,o,u);if(h.len===0&&h.nextStart!==void 0){const g=this.fragmentTracker.getBufferedFrag(o,i);if(g&&h.nextStart<g.end)return Xa.bufferInfo(n,o,Math.max(h.nextStart,u))}return h}getMaxBufferLength(n){const{config:o}=this;let i;return n?i=Math.max(8*o.maxBufferSize/n,o.maxBufferLength):i=o.maxBufferLength,Math.min(i,o.maxMaxBufferLength)}reduceMaxBufferLength(n){const o=this.config,i=n||o.maxBufferLength;return o.maxMaxBufferLength>=i?(o.maxMaxBufferLength/=2,this.warn(`Reduce max buffer length to ${o.maxMaxBufferLength}s`),!0):!1}getAppendedFrag(n,o=Us.MAIN){const i=this.fragmentTracker.getAppendedFrag(n,Us.MAIN);return i&&"fragment"in i?i.fragment:i}getNextFragment(n,o){const i=o.fragments,u=i.length;if(!u)return null;const{config:h}=this,g=i[0].start;let b;if(o.live){const S=h.initialLiveManifestSize;if(u<S)return this.warn(`Not enough fragments to start playback (have: ${u}, need: ${S})`),null;(!o.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||n<g)&&(b=this.getInitialLiveFragment(o,i),this.startPosition=this.nextLoadPosition=b?this.hls.liveSyncPosition||b.start:n)}else n<=g&&(b=i[0]);if(!b){const S=h.lowLatencyMode?o.partEnd:o.fragmentEnd;b=this.getFragmentAtPosition(n,S,o)}return this.mapToInitFragWhenRequired(b)}isLoopLoading(n,o){const i=this.fragmentTracker.getState(n);return(i===Su.OK||i===Su.PARTIAL&&!!n.gap)&&this.nextLoadPosition>o}getNextFragmentLoopLoading(n,o,i,u,h){const g=n.gap,b=this.getNextFragment(this.nextLoadPosition,o);if(b===null)return b;if(n=b,g&&n&&!n.gap&&i.nextStart){const S=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,u);if(S!==null&&i.len+S.len>=h)return this.log(`buffer full after gaps in "${u}" playlist starting at sn: ${n.sn}`),null}return n}mapToInitFragWhenRequired(n){return n!=null&&n.initSegment&&!(n!=null&&n.initSegment.data)&&!this.bitrateTest?n.initSegment:n}getNextPart(n,o,i){let u=-1,h=!1,g=!0;for(let b=0,S=n.length;b<S;b++){const T=n[b];if(g=g&&!T.independent,u>-1&&i<T.start)break;const k=T.loaded;k?u=-1:(h||T.independent||g)&&T.fragment===o&&(u=b),h=k}return u}loadedEndOfParts(n,o){const i=n[n.length-1];return i&&o>i.start&&i.loaded}getInitialLiveFragment(n,o){const i=this.fragPrevious;let u=null;if(i){if(n.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),u=Jde(o,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!u){const h=i.sn+1;if(h>=n.startSN&&h<=n.endSN){const g=o[h-n.startSN];i.cc===g.cc&&(u=g,this.log(`Live playlist, switching playlist, load frag with next SN: ${u.sn}`))}u||(u=efe(o,i.cc),u&&this.log(`Live playlist, switching playlist, load frag with same CC: ${u.sn}`))}}else{const h=this.hls.liveSyncPosition;h!==null&&(u=this.getFragmentAtPosition(h,this.bitrateTest?n.fragmentEnd:n.edge,n))}return u}getFragmentAtPosition(n,o,i){const{config:u}=this;let{fragPrevious:h}=this,{fragments:g,endSN:b}=i;const{fragmentHint:S}=i,T=u.maxFragLookUpTolerance,k=i.partList,R=!!(u.lowLatencyMode&&k!=null&&k.length&&S);R&&S&&!this.bitrateTest&&(g=g.concat(S),b=S.sn);let V;if(n<o){const z=n>o-T?0:T;V=OB(h,g,n,z)}else V=g[g.length-1];if(V){const z=V.sn-i.startSN,$=this.fragmentTracker.getState(V);if(($===Su.OK||$===Su.PARTIAL&&V.gap)&&(h=V),h&&V.sn===h.sn&&(!R||k[0].fragment.sn>V.sn)&&h&&V.level===h.level){const Q=g[z+1];V.sn<b&&this.fragmentTracker.getState(Q)!==Su.OK?V=Q:V=null}}return V}synchronizeToLiveEdge(n){const{config:o,media:i}=this;if(!i)return;const u=this.hls.liveSyncPosition,h=i.currentTime,g=n.fragments[0].start,b=n.edge,S=h>=g-o.maxFragLookUpTolerance&&h<=b;if(u!==null&&i.duration>u&&(h<u||!S)){const T=o.liveMaxLatencyDuration!==void 0?o.liveMaxLatencyDuration:o.liveMaxLatencyDurationCount*n.targetduration;(!S&&i.readyState<4||h<b-T)&&(this.loadedmetadata||(this.nextLoadPosition=u),i.readyState&&(this.warn(`Playback: ${h.toFixed(3)} is located too far from the end of live sliding playlist: ${b}, reset currentTime to : ${u.toFixed(3)}`),i.currentTime=u))}}alignPlaylists(n,o,i){const u=n.fragments.length;if(!u)return this.warn("No fragments in live playlist"),0;const h=n.fragments[0].start,g=!o,b=n.alignedSliding&&Xo(h);if(g||!b&&!h){const{fragPrevious:S}=this;xfe(S,i,n);const T=n.fragments[0].start;return this.log(`Live playlist sliding: ${T.toFixed(2)} start-sn: ${o?o.startSN:"na"}->${n.startSN} prev-sn: ${S?S.sn:"na"} fragments: ${u}`),T}return h}waitForCdnTuneIn(n){return n.live&&n.canBlockReload&&n.partTarget&&n.tuneInGoal>Math.max(n.partHoldBack,n.partTarget*3)}setStartPosition(n,o){let i=this.startPosition;if(i<o&&(i=-1),i===-1||this.lastCurrentTime===-1){const u=this.startTimeOffset!==null,h=u?this.startTimeOffset:n.startTimeOffset;h!==null&&Xo(h)?(i=o+h,h<0&&(i+=n.totalduration),i=Math.min(Math.max(o,i),o+n.totalduration),this.log(`Start time offset ${h} found in ${u?"multivariant":"media"} playlist, adjust startPosition to ${i}`),this.startPosition=i):n.live?i=this.hls.liveSyncPosition||o:this.startPosition=i=0,this.lastCurrentTime=i}this.nextLoadPosition=i}getLoadPosition(){const{media:n}=this;let o=0;return this.loadedmetadata&&n?o=n.currentTime:this.nextLoadPosition&&(o=this.nextLoadPosition),o}handleFragLoadAborted(n,o){this.transmuxer&&n.sn!=="initSegment"&&n.stats.aborted&&(this.warn(`Fragment ${n.sn}${o?" part "+o.index:""} of level ${n.level} was aborted`),this.resetFragmentLoading(n))}resetFragmentLoading(n){(!this.fragCurrent||!this.fragContextChanged(n)&&this.state!==Hn.FRAG_LOADING_WAITING_RETRY)&&(this.state=Hn.IDLE)}onFragmentOrKeyLoadError(n,o){if(o.chunkMeta&&!o.frag){const k=this.getCurrentContext(o.chunkMeta);k&&(o.frag=k.frag)}const i=o.frag;if(!i||i.type!==n||!this.levels)return;if(this.fragContextChanged(i)){var u;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(u=this.fragCurrent)==null?void 0:u.url}`);return}const h=o.details===nn.FRAG_GAP;h&&this.fragmentTracker.fragBuffered(i,!0);const g=o.errorAction,{action:b,retryCount:S=0,retryConfig:T}=g||{};if(g&&b===ed.RetryRequest&&T){this.resetStartWhenNotLoaded(this.levelLastLoaded);const k=cz(T,S);this.warn(`Fragment ${i.sn} of ${n} ${i.level} errored with ${o.details}, retrying loading ${S+1}/${T.maxNumRetry} in ${k}ms`),g.resolved=!0,this.retryDate=self.performance.now()+k,this.state=Hn.FRAG_LOADING_WAITING_RETRY}else if(T&&g)if(this.resetFragmentErrors(n),S<T.maxNumRetry)!h&&b!==ed.RemoveAlternatePermanently&&(g.resolved=!0);else{Mt.warn(`${o.details} reached or exceeded max retry (${S})`);return}else(g==null?void 0:g.action)===ed.SendAlternateToPenaltyBox?this.state=Hn.WAITING_LEVEL:this.state=Hn.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(n){if(this.state===Hn.PARSING||this.state===Hn.PARSED){const o=n.parent,i=this.getFwdBufferInfo(this.mediaBuffer,o),u=i&&i.len>.5;u&&this.reduceMaxBufferLength(i.len);const h=!u;return h&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${o} buffer`),n.frag&&(this.fragmentTracker.removeFragment(n.frag),this.nextLoadPosition=n.frag.start),this.resetLoadingState(),h}return!1}resetFragmentErrors(n){n===Us.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==Hn.STOPPED&&(this.state=Hn.IDLE)}afterBufferFlushed(n,o,i){if(!n)return;const u=Xa.getBuffered(n);this.fragmentTracker.detectEvictedFragments(o,u,i),this.state===Hn.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=Hn.IDLE}resetStartWhenNotLoaded(n){if(!this.loadedmetadata){this.startFragRequested=!1;const o=n?n.details:null;o!=null&&o.live?(this.startPosition=-1,this.setStartPosition(o,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(n){this.warn(`The loading context changed while buffering fragment ${n.sn} of level ${n.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(n=0){this.fragmentTracker.removeFragmentsInRange(n,1/0,this.playlistType,!1,!0)}updateLevelTiming(n,o,i,u){var h;const g=i.details;if(!g){this.warn("level.details undefined");return}if(!Object.keys(n.elementaryStreams).reduce((S,T)=>{const k=n.elementaryStreams[T];if(k){const R=k.endPTS-k.startPTS;if(R<=0)return this.warn(`Could not parse fragment ${n.sn} ${T} duration reliably (${R})`),S||!1;const V=u?0:Rq(g,n,k.startPTS,k.endPTS,k.startDTS,k.endDTS);return this.hls.trigger(we.LEVEL_PTS_UPDATED,{details:g,level:i,drift:V,type:T,frag:n,start:k.startPTS,end:k.endPTS}),!0}return S},!1)&&((h=this.transmuxer)==null?void 0:h.error)===null){const S=new Error(`Found no media in fragment ${n.sn} of level ${n.level} resetting transmuxer to fallback to playlist timing`);if(i.fragmentError===0&&(i.fragmentError++,n.gap=!0,this.fragmentTracker.removeFragment(n),this.fragmentTracker.fragBuffered(n,!0)),this.warn(S.message),this.hls.trigger(we.ERROR,{type:Gs.MEDIA_ERROR,details:nn.FRAG_PARSING_ERROR,fatal:!1,error:S,frag:n,reason:`Found no media in msn ${n.sn} of level "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=Hn.PARSED,this.hls.trigger(we.FRAG_PARSED,{frag:n,part:o})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(n){n.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(n){const o=this._state;o!==n&&(this._state=n,this.log(`${o}->${n}`))}get state(){return this._state}}class Bq{constructor(){this.chunks=[],this.dataLength=0}push(n){this.chunks.push(n),this.dataLength+=n.length}flush(){const{chunks:n,dataLength:o}=this;let i;if(n.length)n.length===1?i=n[0]:i=kfe(n,o);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function kfe(l,n){const o=new Uint8Array(n);let i=0;for(let u=0;u<l.length;u++){const h=l[u];o.set(h,i),i+=h.length}return o}function Afe(){return typeof __HLS_WORKER_BUNDLE__=="function"}function Lfe(){const l=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),n=self.URL.createObjectURL(l);return{worker:new self.Worker(n),objectURL:n}}function Rfe(l){const n=new self.URL(l,self.location.href).href;return{worker:new self.Worker(n),scriptURL:n}}function f0(l="",n=9e4){return{type:l,id:-1,pid:-1,inputTimeScale:n,sequenceNumber:-1,samples:[],dropped:0}}class mz{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(n,o,i,u){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(n){this.initPTS=n,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(n,o){return!1}appendFrame(n,o,i){}demux(n,o){this.cachedData&&(n=Mm(this.cachedData,n),this.cachedData=null);let i=lR(n,0),u=i?i.length:0,h;const g=this._audioTrack,b=this._id3Track,S=i?lz(i):void 0,T=n.length;for((this.basePTS===null||this.frameIndex===0&&Xo(S))&&(this.basePTS=Ofe(S,o,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),i&&i.length>0&&b.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Wp.audioId3,duration:Number.POSITIVE_INFINITY});u<T;){if(this.canParse(n,u)){const k=this.appendFrame(g,n,u);k?(this.frameIndex++,this.lastPTS=k.sample.pts,u+=k.length,h=u):u=T}else tde(n,u)?(i=lR(n,u),b.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Wp.audioId3,duration:Number.POSITIVE_INFINITY}),u+=i.length,h=u):u++;if(u===T&&h!==T){const k=uS(n,h);this.cachedData?this.cachedData=Mm(this.cachedData,k):this.cachedData=k}}return{audioTrack:g,videoTrack:f0(),id3Track:b,textTrack:f0()}}demuxSampleAes(n,o,i){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(n){const o=this.cachedData;return o&&(this.cachedData=null,this.demux(o,0)),{audioTrack:this._audioTrack,videoTrack:f0(),id3Track:this._id3Track,textTrack:f0()}}destroy(){}}const Ofe=(l,n,o)=>{if(Xo(l))return l*90;const i=o?o.baseTime*9e4/o.timescale:0;return n*9e4+i};function Ife(l,n,o,i){let u,h,g,b;const S=navigator.userAgent.toLowerCase(),T=i,k=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];u=((n[o+2]&192)>>>6)+1;const R=(n[o+2]&60)>>>2;if(R>k.length-1){const V=new Error(`invalid ADTS sampling index:${R}`);l.emit(we.ERROR,we.ERROR,{type:Gs.MEDIA_ERROR,details:nn.FRAG_PARSING_ERROR,fatal:!0,error:V,reason:V.message});return}return g=(n[o+2]&1)<<2,g|=(n[o+3]&192)>>>6,Mt.log(`manifest codec:${i}, ADTS type:${u}, samplingIndex:${R}`),/firefox/i.test(S)?R>=6?(u=5,b=new Array(4),h=R-3):(u=2,b=new Array(2),h=R):S.indexOf("android")!==-1?(u=2,b=new Array(2),h=R):(u=5,b=new Array(4),i&&(i.indexOf("mp4a.40.29")!==-1||i.indexOf("mp4a.40.5")!==-1)||!i&&R>=6?h=R-3:((i&&i.indexOf("mp4a.40.2")!==-1&&(R>=6&&g===1||/vivaldi/i.test(S))||!i&&g===1)&&(u=2,b=new Array(2)),h=R)),b[0]=u<<3,b[0]|=(R&14)>>1,b[1]|=(R&1)<<7,b[1]|=g<<3,u===5&&(b[1]|=(h&14)>>1,b[2]=(h&1)<<7,b[2]|=8,b[3]=0),{config:b,samplerate:k[R],channelCount:g,codec:"mp4a.40."+u,manifestCodec:T}}function $q(l,n){return l[n]===255&&(l[n+1]&246)===240}function Hq(l,n){return l[n+1]&1?7:9}function pz(l,n){return(l[n+3]&3)<<11|l[n+4]<<3|(l[n+5]&224)>>>5}function Pfe(l,n){return n+5<l.length}function PB(l,n){return n+1<l.length&&$q(l,n)}function Mfe(l,n){return Pfe(l,n)&&$q(l,n)&&pz(l,n)<=l.length-n}function Nfe(l,n){if(PB(l,n)){const o=Hq(l,n);if(n+o>=l.length)return!1;const i=pz(l,n);if(i<=o)return!1;const u=n+i;return u===l.length||PB(l,u)}return!1}function Uq(l,n,o,i,u){if(!l.samplerate){const h=Ife(n,o,i,u);if(!h)return;l.config=h.config,l.samplerate=h.samplerate,l.channelCount=h.channelCount,l.codec=h.codec,l.manifestCodec=h.manifestCodec,Mt.log(`parsed codec:${l.codec}, rate:${h.samplerate}, channels:${h.channelCount}`)}}function Vq(l){return 1024*9e4/l}function Ffe(l,n){const o=Hq(l,n);if(n+o<=l.length){const i=pz(l,n)-o;if(i>0)return{headerLength:o,frameLength:i}}}function zq(l,n,o,i,u){const h=Vq(l.samplerate),g=i+u*h,b=Ffe(n,o);let S;if(b){const{frameLength:R,headerLength:V}=b,z=V+R,$=Math.max(0,o+z-n.length);$?(S=new Uint8Array(z-V),S.set(n.subarray(o+V,n.length),0)):S=n.subarray(o+V,o+z);const W={unit:S,pts:g};return $||l.samples.push(W),{sample:W,length:z,missing:$}}const T=n.length-o;return S=new Uint8Array(T),S.set(n.subarray(o,n.length),0),{sample:{unit:S,pts:g},length:T,missing:-1}}let F4=null;const Bfe=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],$fe=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Hfe=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Ufe=[0,1,1,4];function Gq(l,n,o,i,u){if(o+24>n.length)return;const h=Wq(n,o);if(h&&o+h.frameLength<=n.length){const g=h.samplesPerFrame*9e4/h.sampleRate,b=i+u*g,S={unit:n.subarray(o,o+h.frameLength),pts:b,dts:b};return l.config=[],l.channelCount=h.channelCount,l.samplerate=h.sampleRate,l.samples.push(S),{sample:S,length:h.frameLength,missing:0}}}function Wq(l,n){const o=l[n+1]>>3&3,i=l[n+1]>>1&3,u=l[n+2]>>4&15,h=l[n+2]>>2&3;if(o!==1&&u!==0&&u!==15&&h!==3){const g=l[n+2]>>1&1,b=l[n+3]>>6,S=o===3?3-i:i===3?3:4,T=Bfe[S*14+u-1]*1e3,R=$fe[(o===3?0:o===2?1:2)*3+h],V=b===3?1:2,z=Hfe[o][i],$=Ufe[i],W=z*8*$,Q=Math.floor(z*T/R+g)*$;if(F4===null){const re=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);F4=re?parseInt(re[1]):0}return!!F4&&F4<=87&&i===2&&T>=224e3&&b===0&&(l[n+3]=l[n+3]|128),{sampleRate:R,channelCount:V,frameLength:Q,samplesPerFrame:W}}}function gz(l,n){return l[n]===255&&(l[n+1]&224)===224&&(l[n+1]&6)!==0}function jq(l,n){return n+1<l.length&&gz(l,n)}function Vfe(l,n){return gz(l,n)&&4<=l.length-n}function Kq(l,n){if(n+1<l.length&&gz(l,n)){const i=Wq(l,n);let u=4;i!=null&&i.frameLength&&(u=i.frameLength);const h=n+u;return h===l.length||jq(l,h)}return!1}class zfe extends mz{constructor(n,o){super(),this.observer=void 0,this.config=void 0,this.observer=n,this.config=o}resetInitSegment(n,o,i,u){super.resetInitSegment(n,o,i,u),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:o,duration:u,inputTimeScale:9e4,dropped:0}}static probe(n){if(!n)return!1;const o=lR(n,0);let i=(o==null?void 0:o.length)||0;if(Kq(n,i))return!1;for(let u=n.length;i<u;i++)if(Nfe(n,i))return Mt.log("ADTS sync word found !"),!0;return!1}canParse(n,o){return Mfe(n,o)}appendFrame(n,o,i){Uq(n,this.observer,o,i,n.manifestCodec);const u=zq(n,o,i,this.basePTS,this.frameIndex);if(u&&u.missing===0)return u}}const Gfe=/\/emsg[-/]ID3/i;class Wfe{constructor(n,o){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=o}resetTimeStamp(){}resetInitSegment(n,o,i,u){const h=this.videoTrack=f0("video",1),g=this.audioTrack=f0("audio",1),b=this.txtTrack=f0("text",1);if(this.id3Track=f0("id3",1),this.timeOffset=0,!(n!=null&&n.byteLength))return;const S=Eq(n);if(S.video){const{id:T,timescale:k,codec:R}=S.video;h.id=T,h.timescale=b.timescale=k,h.codec=R}if(S.audio){const{id:T,timescale:k,codec:R}=S.audio;g.id=T,g.timescale=k,g.codec=R}b.id=yq.text,h.sampleDuration=0,h.duration=g.duration=u}resetContiguity(){this.remainderData=null}static probe(n){return ude(n)}demux(n,o){this.timeOffset=o;let i=n;const u=this.videoTrack,h=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Mm(this.remainderData,n));const b=vde(i);this.remainderData=b.remainder,u.samples=b.valid||new Uint8Array}else u.samples=i;const g=this.extractID3Track(u,o);return h.samples=Uj(o,u),{videoTrack:u,audioTrack:this.audioTrack,id3Track:g,textTrack:this.txtTrack}}flush(){const n=this.timeOffset,o=this.videoTrack,i=this.txtTrack;o.samples=this.remainderData||new Uint8Array,this.remainderData=null;const u=this.extractID3Track(o,this.timeOffset);return i.samples=Uj(n,o),{videoTrack:o,audioTrack:f0(),id3Track:u,textTrack:f0()}}extractID3Track(n,o){const i=this.id3Track;if(n.samples.length){const u=Dr(n.samples,["emsg"]);u&&u.forEach(h=>{const g=wde(h);if(Gfe.test(g.schemeIdUri)){const b=Xo(g.presentationTime)?g.presentationTime/g.timeScale:o+g.presentationTimeDelta/g.timeScale;let S=g.eventDuration===4294967295?Number.POSITIVE_INFINITY:g.eventDuration/g.timeScale;S<=.001&&(S=Number.POSITIVE_INFINITY);const T=g.payload;i.samples.push({data:T,len:T.byteLength,dts:b,pts:b,type:Wp.emsg,duration:S})}})}return i}demuxSampleAes(n,o,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}const Zq=(l,n)=>{let o=0,i=5;n+=i;const u=new Uint32Array(1),h=new Uint32Array(1),g=new Uint8Array(1);for(;i>0;){g[0]=l[n];const b=Math.min(i,8),S=8-b;h[0]=4278190080>>>24+S<<S,u[0]=(g[0]&h[0])>>S,o=o?o<<b|u[0]:u[0],n+=1,i-=b}return o};class jfe extends mz{constructor(n){super(),this.observer=void 0,this.observer=n}resetInitSegment(n,o,i,u){super.resetInitSegment(n,o,i,u),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:o,duration:u,inputTimeScale:9e4,dropped:0}}canParse(n,o){return o+64<n.length}appendFrame(n,o,i){const u=qq(n,o,i,this.basePTS,this.frameIndex);if(u!==-1)return{sample:n.samples[n.samples.length-1],length:u,missing:0}}static probe(n){if(!n)return!1;const o=lR(n,0);if(!o)return!1;const i=o.length;return n[i]===11&&n[i+1]===119&&lz(o)!==void 0&&Zq(n,i)<16}}function qq(l,n,o,i,u){if(o+8>n.length||n[o]!==11||n[o+1]!==119)return-1;const h=n[o+4]>>6;if(h>=3)return-1;const b=[48e3,44100,32e3][h],S=n[o+4]&63,k=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][S*3+h]*2;if(o+k>n.length)return-1;const R=n[o+6]>>5;let V=0;R===2?V+=2:(R&1&&R!==1&&(V+=2),R&4&&(V+=2));const z=(n[o+6]<<8|n[o+7])>>12-V&1,W=[2,1,2,3,3,4,4,5][R]+z,Q=n[o+5]>>3,j=n[o+5]&7,se=new Uint8Array([h<<6|Q<<1|j>>2,(j&3)<<6|R<<3|z<<2|S>>4,S<<4&224]),re=1536/b*9e4,Y=i+u*re,me=n.subarray(o,o+k);return l.config=se,l.channelCount=W,l.samplerate=b,l.samples.push({unit:me,pts:Y}),k}class Kfe{constructor(){this.VideoSample=null}createVideoSample(n,o,i,u){return{key:n,frame:!1,pts:o,dts:i,units:[],debug:u,length:0}}getLastNalUnit(n){var o;let i=this.VideoSample,u;if((!i||i.units.length===0)&&(i=n[n.length-1]),(o=i)!=null&&o.units){const h=i.units;u=h[h.length-1]}return u}pushAccessUnit(n,o){if(n.units.length&&n.frame){if(n.pts===void 0){const i=o.samples,u=i.length;if(u){const h=i[u-1];n.pts=h.pts,n.dts=h.dts}else{o.dropped++;return}}o.samples.push(n)}n.debug.length&&Mt.log(n.pts+"/"+n.dts+":"+n.debug)}}class mK{constructor(n){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=n,this.bytesAvailable=n.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const n=this.data,o=this.bytesAvailable,i=n.byteLength-o,u=new Uint8Array(4),h=Math.min(4,o);if(h===0)throw new Error("no bytes available");u.set(n.subarray(i,i+h)),this.word=new DataView(u.buffer).getUint32(0),this.bitsAvailable=h*8,this.bytesAvailable-=h}skipBits(n){let o;n=Math.min(n,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>n?(this.word<<=n,this.bitsAvailable-=n):(n-=this.bitsAvailable,o=n>>3,n-=o<<3,this.bytesAvailable-=o,this.loadWord(),this.word<<=n,this.bitsAvailable-=n)}readBits(n){let o=Math.min(this.bitsAvailable,n);const i=this.word>>>32-o;if(n>32&&Mt.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=o,this.bitsAvailable>0)this.word<<=o;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return o=n-o,o>0&&this.bitsAvailable?i<<o|this.readBits(o):i}skipLZ(){let n;for(n=0;n<this.bitsAvailable;++n)if(this.word&2147483648>>>n)return this.word<<=n,this.bitsAvailable-=n,n;return this.loadWord(),n+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const n=this.skipLZ();return this.readBits(n+1)-1}readEG(){const n=this.readUEG();return 1&n?1+n>>>1:-1*(n>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(n){let o=8,i=8,u;for(let h=0;h<n;h++)i!==0&&(u=this.readEG(),i=(o+u+256)%256),o=i===0?o:i}readSPS(){let n=0,o=0,i=0,u=0,h,g,b;const S=this.readUByte.bind(this),T=this.readBits.bind(this),k=this.readUEG.bind(this),R=this.readBoolean.bind(this),V=this.skipBits.bind(this),z=this.skipEG.bind(this),$=this.skipUEG.bind(this),W=this.skipScalingList.bind(this);S();const Q=S();if(T(5),V(3),S(),$(),Q===100||Q===110||Q===122||Q===244||Q===44||Q===83||Q===86||Q===118||Q===128){const ae=k();if(ae===3&&V(1),$(),$(),V(1),R())for(g=ae!==3?8:12,b=0;b<g;b++)R()&&(b<6?W(16):W(64))}$();const j=k();if(j===0)k();else if(j===1)for(V(1),z(),z(),h=k(),b=0;b<h;b++)z();$(),V(1);const se=k(),re=k(),Y=T(1);Y===0&&V(1),V(1),R()&&(n=k(),o=k(),i=k(),u=k());let me=[1,1];if(R()&&R())switch(S()){case 1:me=[1,1];break;case 2:me=[12,11];break;case 3:me=[10,11];break;case 4:me=[16,11];break;case 5:me=[40,33];break;case 6:me=[24,11];break;case 7:me=[20,11];break;case 8:me=[32,11];break;case 9:me=[80,33];break;case 10:me=[18,11];break;case 11:me=[15,11];break;case 12:me=[64,33];break;case 13:me=[160,99];break;case 14:me=[4,3];break;case 15:me=[3,2];break;case 16:me=[2,1];break;case 255:{me=[S()<<8|S(),S()<<8|S()];break}}return{width:Math.ceil((se+1)*16-n*2-o*2),height:(2-Y)*(re+1)*16-(Y?2:4)*(i+u),pixelRatio:me}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class Zfe extends Kfe{parseAVCPES(n,o,i,u,h){const g=this.parseAVCNALu(n,i.data);let b=this.VideoSample,S,T=!1;i.data=null,b&&g.length&&!n.audFound&&(this.pushAccessUnit(b,n),b=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"")),g.forEach(k=>{var R;switch(k.type){case 1:{let W=!1;S=!0;const Q=k.data;if(T&&Q.length>4){const j=new mK(Q).readSliceType();(j===2||j===4||j===7||j===9)&&(W=!0)}if(W){var V;(V=b)!=null&&V.frame&&!b.key&&(this.pushAccessUnit(b,n),b=this.VideoSample=null)}b||(b=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),b.frame=!0,b.key=W;break}case 5:S=!0,(R=b)!=null&&R.frame&&!b.key&&(this.pushAccessUnit(b,n),b=this.VideoSample=null),b||(b=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),b.key=!0,b.frame=!0;break;case 6:{S=!0,_q(k.data,1,i.pts,o.samples);break}case 7:{var z,$;S=!0,T=!0;const W=k.data,j=new mK(W).readSPS();if(!n.sps||n.width!==j.width||n.height!==j.height||((z=n.pixelRatio)==null?void 0:z[0])!==j.pixelRatio[0]||(($=n.pixelRatio)==null?void 0:$[1])!==j.pixelRatio[1]){n.width=j.width,n.height=j.height,n.pixelRatio=j.pixelRatio,n.sps=[W],n.duration=h;const se=W.subarray(1,4);let re="avc1.";for(let Y=0;Y<3;Y++){let me=se[Y].toString(16);me.length<2&&(me="0"+me),re+=me}n.codec=re}break}case 8:S=!0,n.pps=[k.data];break;case 9:S=!0,n.audFound=!0,b&&this.pushAccessUnit(b,n),b=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"");break;case 12:S=!0;break;default:S=!1,b&&(b.debug+="unknown NAL "+k.type+" ");break}b&&S&&b.units.push(k)}),u&&b&&(this.pushAccessUnit(b,n),this.VideoSample=null)}parseAVCNALu(n,o){const i=o.byteLength;let u=n.naluState||0;const h=u,g=[];let b=0,S,T,k,R=-1,V=0;for(u===-1&&(R=0,V=o[0]&31,u=0,b=1);b<i;){if(S=o[b++],!u){u=S?0:1;continue}if(u===1){u=S?0:2;continue}if(!S)u=3;else if(S===1){if(T=b-u-1,R>=0){const z={data:o.subarray(R,T),type:V};g.push(z)}else{const z=this.getLastNalUnit(n.samples);z&&(h&&b<=4-h&&z.state&&(z.data=z.data.subarray(0,z.data.byteLength-h)),T>0&&(z.data=Mm(z.data,o.subarray(0,T)),z.state=0))}b<i?(k=o[b]&31,R=b,V=k,u=0):u=-1}else u=0}if(R>=0&&u>=0){const z={data:o.subarray(R,i),type:V,state:u};g.push(z)}if(g.length===0){const z=this.getLastNalUnit(n.samples);z&&(z.data=Mm(z.data,o))}return n.naluState=u,g}}class qfe{constructor(n,o,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new fz(o,{removePKCS7Padding:!1})}decryptBuffer(n){return this.decrypter.decrypt(n,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(n,o,i){const u=n[o].unit;if(u.length<=16)return;const h=u.subarray(16,u.length-u.length%16),g=h.buffer.slice(h.byteOffset,h.byteOffset+h.length);this.decryptBuffer(g).then(b=>{const S=new Uint8Array(b);u.set(S,16),this.decrypter.isSync()||this.decryptAacSamples(n,o+1,i)})}decryptAacSamples(n,o,i){for(;;o++){if(o>=n.length){i();return}if(!(n[o].unit.length<32)&&(this.decryptAacSample(n,o,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(n){const o=Math.floor((n.length-48)/160)*16+16,i=new Int8Array(o);let u=0;for(let h=32;h<n.length-16;h+=160,u+=16)i.set(n.subarray(h,h+16),u);return i}getAvcDecryptedUnit(n,o){const i=new Uint8Array(o);let u=0;for(let h=32;h<n.length-16;h+=160,u+=16)n.set(i.subarray(u,u+16),h);return n}decryptAvcSample(n,o,i,u,h){const g=Tq(h.data),b=this.getAvcEncryptedData(g);this.decryptBuffer(b.buffer).then(S=>{h.data=this.getAvcDecryptedUnit(g,S),this.decrypter.isSync()||this.decryptAvcSamples(n,o,i+1,u)})}decryptAvcSamples(n,o,i,u){if(n instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;o++,i=0){if(o>=n.length){u();return}const h=n[o].units;for(;!(i>=h.length);i++){const g=h[i];if(!(g.data.length<=48||g.type!==1&&g.type!==5)&&(this.decryptAvcSample(n,o,i,u,g),!this.decrypter.isSync()))return}}}}const xu=188;class r1{constructor(n,o,i){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=n,this.config=o,this.typeSupported=i,this.videoParser=new Zfe}static probe(n){const o=r1.syncOffset(n);return o>0&&Mt.warn(`MPEG2-TS detected but first sync word found @ offset ${o}`),o!==-1}static syncOffset(n){const o=n.length;let i=Math.min(xu*5,o-xu)+1,u=0;for(;u<i;){let h=!1,g=-1,b=0;for(let S=u;S<o;S+=xu)if(n[S]===71&&(o-S===xu||n[S+xu]===71)){if(b++,g===-1&&(g=S,g!==0&&(i=Math.min(g+xu*99,n.length-xu)+1)),h||(h=OV(n,S)===0),h&&b>1&&(g===0&&b>2||S+xu>i))return g}else{if(b)return-1;break}u++}return-1}static createTrack(n,o){return{container:n==="video"||n==="audio"?"video/mp2t":void 0,type:n,id:yq[n],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:n==="audio"?o:void 0}}resetInitSegment(n,o,i,u){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=r1.createTrack("video"),this._audioTrack=r1.createTrack("audio",u),this._id3Track=r1.createTrack("id3"),this._txtTrack=r1.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=o,this.videoCodec=i,this._duration=u}resetTimeStamp(){}resetContiguity(){const{_audioTrack:n,_videoTrack:o,_id3Track:i}=this;n&&(n.pesData=null),o&&(o.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(n,o,i=!1,u=!1){i||(this.sampleAes=null);let h;const g=this._videoTrack,b=this._audioTrack,S=this._id3Track,T=this._txtTrack;let k=g.pid,R=g.pesData,V=b.pid,z=S.pid,$=b.pesData,W=S.pesData,Q=null,j=this.pmtParsed,se=this._pmtId,re=n.length;if(this.remainderData&&(n=Mm(this.remainderData,n),re=n.length,this.remainderData=null),re<xu&&!u)return this.remainderData=n,{audioTrack:b,videoTrack:g,id3Track:S,textTrack:T};const Y=Math.max(0,r1.syncOffset(n));re-=(re-Y)%xu,re<n.byteLength&&!u&&(this.remainderData=new Uint8Array(n.buffer,re,n.buffer.byteLength-re));let me=0;for(let Ce=Y;Ce<re;Ce+=xu)if(n[Ce]===71){const Ue=!!(n[Ce+1]&64),ot=OV(n,Ce),Ae=(n[Ce+3]&48)>>4;let ve;if(Ae>1){if(ve=Ce+5+n[Ce+4],ve===Ce+xu)continue}else ve=Ce+4;switch(ot){case k:Ue&&(R&&(h=aT(R))&&this.videoParser.parseAVCPES(g,T,h,!1,this._duration),R={data:[],size:0}),R&&(R.data.push(n.subarray(ve,Ce+xu)),R.size+=Ce+xu-ve);break;case V:if(Ue){if($&&(h=aT($)))switch(b.segmentCodec){case"aac":this.parseAACPES(b,h);break;case"mp3":this.parseMPEGPES(b,h);break;case"ac3":this.parseAC3PES(b,h);break}$={data:[],size:0}}$&&($.data.push(n.subarray(ve,Ce+xu)),$.size+=Ce+xu-ve);break;case z:Ue&&(W&&(h=aT(W))&&this.parseID3PES(S,h),W={data:[],size:0}),W&&(W.data.push(n.subarray(ve,Ce+xu)),W.size+=Ce+xu-ve);break;case 0:Ue&&(ve+=n[ve]+1),se=this._pmtId=Yfe(n,ve);break;case se:{Ue&&(ve+=n[ve]+1);const Oe=Xfe(n,ve,this.typeSupported,i);k=Oe.videoPid,k>0&&(g.pid=k,g.segmentCodec=Oe.segmentVideoCodec),V=Oe.audioPid,V>0&&(b.pid=V,b.segmentCodec=Oe.segmentAudioCodec),z=Oe.id3Pid,z>0&&(S.pid=z),Q!==null&&!j&&(Mt.warn(`MPEG-TS PMT found at ${Ce} after unknown PID '${Q}'. Backtracking to sync byte @${Y} to parse all TS packets.`),Q=null,Ce=Y-188),j=this.pmtParsed=!0;break}case 17:case 8191:break;default:Q=ot;break}}else me++;if(me>0){const Ce=new Error(`Found ${me} TS packet/s that do not start with 0x47`);this.observer.emit(we.ERROR,we.ERROR,{type:Gs.MEDIA_ERROR,details:nn.FRAG_PARSING_ERROR,fatal:!1,error:Ce,reason:Ce.message})}g.pesData=R,b.pesData=$,S.pesData=W;const ae={audioTrack:b,videoTrack:g,id3Track:S,textTrack:T};return u&&this.extractRemainingSamples(ae),ae}flush(){const{remainderData:n}=this;this.remainderData=null;let o;return n?o=this.demux(n,-1,!1,!0):o={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(o),this.sampleAes?this.decrypt(o,this.sampleAes):o}extractRemainingSamples(n){const{audioTrack:o,videoTrack:i,id3Track:u,textTrack:h}=n,g=i.pesData,b=o.pesData,S=u.pesData;let T;if(g&&(T=aT(g))?(this.videoParser.parseAVCPES(i,h,T,!0,this._duration),i.pesData=null):i.pesData=g,b&&(T=aT(b))){switch(o.segmentCodec){case"aac":this.parseAACPES(o,T);break;case"mp3":this.parseMPEGPES(o,T);break;case"ac3":this.parseAC3PES(o,T);break}o.pesData=null}else b!=null&&b.size&&Mt.log("last AAC PES packet truncated,might overlap between fragments"),o.pesData=b;S&&(T=aT(S))?(this.parseID3PES(u,T),u.pesData=null):u.pesData=S}demuxSampleAes(n,o,i){const u=this.demux(n,i,!0,!this.config.progressive),h=this.sampleAes=new qfe(this.observer,this.config,o);return this.decrypt(u,h)}decrypt(n,o){return new Promise(i=>{const{audioTrack:u,videoTrack:h}=n;u.samples&&u.segmentCodec==="aac"?o.decryptAacSamples(u.samples,0,()=>{h.samples?o.decryptAvcSamples(h.samples,0,0,()=>{i(n)}):i(n)}):h.samples&&o.decryptAvcSamples(h.samples,0,0,()=>{i(n)})})}destroy(){this._duration=0}parseAACPES(n,o){let i=0;const u=this.aacOverFlow;let h=o.data;if(u){this.aacOverFlow=null;const R=u.missing,V=u.sample.unit.byteLength;if(R===-1)h=Mm(u.sample.unit,h);else{const z=V-R;u.sample.unit.set(h.subarray(0,R),z),n.samples.push(u.sample),i=u.missing}}let g,b;for(g=i,b=h.length;g<b-1&&!PB(h,g);g++);if(g!==i){let R;const V=g<b-1;V?R=`AAC PES did not start with ADTS header,offset:${g}`:R="No ADTS header found in AAC PES";const z=new Error(R);if(Mt.warn(`parsing error: ${R}`),this.observer.emit(we.ERROR,we.ERROR,{type:Gs.MEDIA_ERROR,details:nn.FRAG_PARSING_ERROR,fatal:!1,levelRetry:V,error:z,reason:R}),!V)return}Uq(n,this.observer,h,g,this.audioCodec);let S;if(o.pts!==void 0)S=o.pts;else if(u){const R=Vq(n.samplerate);S=u.sample.pts+R}else{Mt.warn("[tsdemuxer]: AAC PES unknown PTS");return}let T=0,k;for(;g<b;)if(k=zq(n,h,g,S,T),g+=k.length,k.missing){this.aacOverFlow=k;break}else for(T++;g<b-1&&!PB(h,g);g++);}parseMPEGPES(n,o){const i=o.data,u=i.length;let h=0,g=0;const b=o.pts;if(b===void 0){Mt.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;g<u;)if(jq(i,g)){const S=Gq(n,i,g,b,h);if(S)g+=S.length,h++;else break}else g++}parseAC3PES(n,o){{const i=o.data,u=o.pts;if(u===void 0){Mt.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const h=i.length;let g=0,b=0,S;for(;b<h&&(S=qq(n,i,b,u,g++))>0;)b+=S}}parseID3PES(n,o){if(o.pts===void 0){Mt.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=Ic({},o,{type:this._videoTrack?Wp.emsg:Wp.audioId3,duration:Number.POSITIVE_INFINITY});n.samples.push(i)}}function OV(l,n){return((l[n+1]&31)<<8)+l[n+2]}function Yfe(l,n){return(l[n+10]&31)<<8|l[n+11]}function Xfe(l,n,o,i){const u={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},h=(l[n+1]&15)<<8|l[n+2],g=n+3+h-4,b=(l[n+10]&15)<<8|l[n+11];for(n+=12+b;n<g;){const S=OV(l,n),T=(l[n+3]&15)<<8|l[n+4];switch(l[n]){case 207:if(!i){FU("ADTS AAC");break}case 15:u.audioPid===-1&&(u.audioPid=S);break;case 21:u.id3Pid===-1&&(u.id3Pid=S);break;case 219:if(!i){FU("H.264");break}case 27:u.videoPid===-1&&(u.videoPid=S,u.segmentVideoCodec="avc");break;case 3:case 4:!o.mpeg&&!o.mp3?Mt.log("MPEG audio found, not supported in this browser"):u.audioPid===-1&&(u.audioPid=S,u.segmentAudioCodec="mp3");break;case 193:if(!i){FU("AC-3");break}case 129:o.ac3?u.audioPid===-1&&(u.audioPid=S,u.segmentAudioCodec="ac3"):Mt.log("AC-3 audio found, not supported in this browser");break;case 6:if(u.audioPid===-1&&T>0){let k=n+5,R=T;for(;R>2;){switch(l[k]){case 106:o.ac3!==!0?Mt.log("AC-3 audio found, not supported in this browser for now"):(u.audioPid=S,u.segmentAudioCodec="ac3");break}const z=l[k+1]+2;k+=z,R-=z}}break;case 194:case 135:Mt.warn("Unsupported EC-3 in M2TS found");break;case 36:Mt.warn("Unsupported HEVC in M2TS found");break}n+=T+5}return u}function FU(l){Mt.log(`${l} with AES-128-CBC encryption found in unencrypted stream`)}function aT(l){let n=0,o,i,u,h,g;const b=l.data;if(!l||l.size===0)return null;for(;b[0].length<19&&b.length>1;)b[0]=Mm(b[0],b[1]),b.splice(1,1);if(o=b[0],(o[0]<<16)+(o[1]<<8)+o[2]===1){if(i=(o[4]<<8)+o[5],i&&i>l.size-6)return null;const T=o[7];T&192&&(h=(o[9]&14)*536870912+(o[10]&255)*4194304+(o[11]&254)*16384+(o[12]&255)*128+(o[13]&254)/2,T&64?(g=(o[14]&14)*536870912+(o[15]&255)*4194304+(o[16]&254)*16384+(o[17]&255)*128+(o[18]&254)/2,h-g>60*9e4&&(Mt.warn(`${Math.round((h-g)/9e4)}s delta between PTS and DTS, align them`),h=g)):g=h),u=o[8];let k=u+9;if(l.size<=k)return null;l.size-=k;const R=new Uint8Array(l.size);for(let V=0,z=b.length;V<z;V++){o=b[V];let $=o.byteLength;if(k)if(k>$){k-=$;continue}else o=o.subarray(k),$-=k,k=0;R.set(o,n),n+=$}return i&&(i-=u+3),{data:R,pts:h,dts:g,len:i}}return null}class Jfe extends mz{resetInitSegment(n,o,i,u){super.resetInitSegment(n,o,i,u),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:o,duration:u,inputTimeScale:9e4,dropped:0}}static probe(n){if(!n)return!1;const o=lR(n,0);let i=(o==null?void 0:o.length)||0;if(o&&n[i]===11&&n[i+1]===119&&lz(o)!==void 0&&Zq(n,i)<=16)return!1;for(let u=n.length;i<u;i++)if(Kq(n,i))return Mt.log("MPEG Audio sync word found !"),!0;return!1}canParse(n,o){return Vfe(n,o)}appendFrame(n,o,i){if(this.basePTS!==null)return Gq(n,o,i,this.basePTS,this.frameIndex)}}class pK{static getSilentFrame(n,o){switch(n){case"mp4a.40.2":if(o===1)return new Uint8Array([0,200,0,128,35,128]);if(o===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(o===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(o===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(o===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(o===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(o===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(o===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(o===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const n1=Math.pow(2,32)-1;class Zt{static init(){Zt.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let n;for(n in Zt.types)Zt.types.hasOwnProperty(n)&&(Zt.types[n]=[n.charCodeAt(0),n.charCodeAt(1),n.charCodeAt(2),n.charCodeAt(3)]);const o=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);Zt.HDLR_TYPES={video:o,audio:i};const u=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),h=new Uint8Array([0,0,0,0,0,0,0,0]);Zt.STTS=Zt.STSC=Zt.STCO=h,Zt.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Zt.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Zt.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),Zt.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const g=new Uint8Array([105,115,111,109]),b=new Uint8Array([97,118,99,49]),S=new Uint8Array([0,0,0,1]);Zt.FTYP=Zt.box(Zt.types.ftyp,g,S,g,b),Zt.DINF=Zt.box(Zt.types.dinf,Zt.box(Zt.types.dref,u))}static box(n,...o){let i=8,u=o.length;const h=u;for(;u--;)i+=o[u].byteLength;const g=new Uint8Array(i);for(g[0]=i>>24&255,g[1]=i>>16&255,g[2]=i>>8&255,g[3]=i&255,g.set(n,4),u=0,i=8;u<h;u++)g.set(o[u],i),i+=o[u].byteLength;return g}static hdlr(n){return Zt.box(Zt.types.hdlr,Zt.HDLR_TYPES[n])}static mdat(n){return Zt.box(Zt.types.mdat,n)}static mdhd(n,o){o*=n;const i=Math.floor(o/(n1+1)),u=Math.floor(o%(n1+1));return Zt.box(Zt.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,n>>24&255,n>>16&255,n>>8&255,n&255,i>>24,i>>16&255,i>>8&255,i&255,u>>24,u>>16&255,u>>8&255,u&255,85,196,0,0]))}static mdia(n){return Zt.box(Zt.types.mdia,Zt.mdhd(n.timescale,n.duration),Zt.hdlr(n.type),Zt.minf(n))}static mfhd(n){return Zt.box(Zt.types.mfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255]))}static minf(n){return n.type==="audio"?Zt.box(Zt.types.minf,Zt.box(Zt.types.smhd,Zt.SMHD),Zt.DINF,Zt.stbl(n)):Zt.box(Zt.types.minf,Zt.box(Zt.types.vmhd,Zt.VMHD),Zt.DINF,Zt.stbl(n))}static moof(n,o,i){return Zt.box(Zt.types.moof,Zt.mfhd(n),Zt.traf(i,o))}static moov(n){let o=n.length;const i=[];for(;o--;)i[o]=Zt.trak(n[o]);return Zt.box.apply(null,[Zt.types.moov,Zt.mvhd(n[0].timescale,n[0].duration)].concat(i).concat(Zt.mvex(n)))}static mvex(n){let o=n.length;const i=[];for(;o--;)i[o]=Zt.trex(n[o]);return Zt.box.apply(null,[Zt.types.mvex,...i])}static mvhd(n,o){o*=n;const i=Math.floor(o/(n1+1)),u=Math.floor(o%(n1+1)),h=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,n>>24&255,n>>16&255,n>>8&255,n&255,i>>24,i>>16&255,i>>8&255,i&255,u>>24,u>>16&255,u>>8&255,u&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return Zt.box(Zt.types.mvhd,h)}static sdtp(n){const o=n.samples||[],i=new Uint8Array(4+o.length);let u,h;for(u=0;u<o.length;u++)h=o[u].flags,i[u+4]=h.dependsOn<<4|h.isDependedOn<<2|h.hasRedundancy;return Zt.box(Zt.types.sdtp,i)}static stbl(n){return Zt.box(Zt.types.stbl,Zt.stsd(n),Zt.box(Zt.types.stts,Zt.STTS),Zt.box(Zt.types.stsc,Zt.STSC),Zt.box(Zt.types.stsz,Zt.STSZ),Zt.box(Zt.types.stco,Zt.STCO))}static avc1(n){let o=[],i=[],u,h,g;for(u=0;u<n.sps.length;u++)h=n.sps[u],g=h.byteLength,o.push(g>>>8&255),o.push(g&255),o=o.concat(Array.prototype.slice.call(h));for(u=0;u<n.pps.length;u++)h=n.pps[u],g=h.byteLength,i.push(g>>>8&255),i.push(g&255),i=i.concat(Array.prototype.slice.call(h));const b=Zt.box(Zt.types.avcC,new Uint8Array([1,o[3],o[4],o[5],255,224|n.sps.length].concat(o).concat([n.pps.length]).concat(i))),S=n.width,T=n.height,k=n.pixelRatio[0],R=n.pixelRatio[1];return Zt.box(Zt.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,S>>8&255,S&255,T>>8&255,T&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),b,Zt.box(Zt.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Zt.box(Zt.types.pasp,new Uint8Array([k>>24,k>>16&255,k>>8&255,k&255,R>>24,R>>16&255,R>>8&255,R&255])))}static esds(n){const o=n.config.length;return new Uint8Array([0,0,0,0,3,23+o,0,1,0,4,15+o,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([o]).concat(n.config).concat([6,1,2]))}static audioStsd(n){const o=n.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n.channelCount,0,16,0,0,0,0,o>>8&255,o&255,0,0])}static mp4a(n){return Zt.box(Zt.types.mp4a,Zt.audioStsd(n),Zt.box(Zt.types.esds,Zt.esds(n)))}static mp3(n){return Zt.box(Zt.types[".mp3"],Zt.audioStsd(n))}static ac3(n){return Zt.box(Zt.types["ac-3"],Zt.audioStsd(n),Zt.box(Zt.types.dac3,n.config))}static stsd(n){return n.type==="audio"?n.segmentCodec==="mp3"&&n.codec==="mp3"?Zt.box(Zt.types.stsd,Zt.STSD,Zt.mp3(n)):n.segmentCodec==="ac3"?Zt.box(Zt.types.stsd,Zt.STSD,Zt.ac3(n)):Zt.box(Zt.types.stsd,Zt.STSD,Zt.mp4a(n)):Zt.box(Zt.types.stsd,Zt.STSD,Zt.avc1(n))}static tkhd(n){const o=n.id,i=n.duration*n.timescale,u=n.width,h=n.height,g=Math.floor(i/(n1+1)),b=Math.floor(i%(n1+1));return Zt.box(Zt.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,o>>24&255,o>>16&255,o>>8&255,o&255,0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255,b>>24,b>>16&255,b>>8&255,b&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,u>>8&255,u&255,0,0,h>>8&255,h&255,0,0]))}static traf(n,o){const i=Zt.sdtp(n),u=n.id,h=Math.floor(o/(n1+1)),g=Math.floor(o%(n1+1));return Zt.box(Zt.types.traf,Zt.box(Zt.types.tfhd,new Uint8Array([0,0,0,0,u>>24,u>>16&255,u>>8&255,u&255])),Zt.box(Zt.types.tfdt,new Uint8Array([1,0,0,0,h>>24,h>>16&255,h>>8&255,h&255,g>>24,g>>16&255,g>>8&255,g&255])),Zt.trun(n,i.length+16+20+8+16+8+8),i)}static trak(n){return n.duration=n.duration||4294967295,Zt.box(Zt.types.trak,Zt.tkhd(n),Zt.mdia(n))}static trex(n){const o=n.id;return Zt.box(Zt.types.trex,new Uint8Array([0,0,0,0,o>>24,o>>16&255,o>>8&255,o&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(n,o){const i=n.samples||[],u=i.length,h=12+16*u,g=new Uint8Array(h);let b,S,T,k,R,V;for(o+=8+h,g.set([n.type==="video"?1:0,0,15,1,u>>>24&255,u>>>16&255,u>>>8&255,u&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255],0),b=0;b<u;b++)S=i[b],T=S.duration,k=S.size,R=S.flags,V=S.cts,g.set([T>>>24&255,T>>>16&255,T>>>8&255,T&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255,R.isLeading<<2|R.dependsOn,R.isDependedOn<<6|R.hasRedundancy<<4|R.paddingValue<<1|R.isNonSync,R.degradPrio&61440,R.degradPrio&15,V>>>24&255,V>>>16&255,V>>>8&255,V&255],12+16*b);return Zt.box(Zt.types.trun,g)}static initSegment(n){Zt.types||Zt.init();const o=Zt.moov(n);return Mm(Zt.FTYP,o)}}Zt.types=void 0;Zt.HDLR_TYPES=void 0;Zt.STTS=void 0;Zt.STSC=void 0;Zt.STCO=void 0;Zt.STSZ=void 0;Zt.VMHD=void 0;Zt.SMHD=void 0;Zt.STSD=void 0;Zt.FTYP=void 0;Zt.DINF=void 0;const Yq=9e4;function bz(l,n,o=1,i=!1){const u=l*n*o;return i?Math.round(u):u}function Qfe(l,n,o=1,i=!1){return bz(l,n,1/o,i)}function ML(l,n=!1){return bz(l,1e3,1/Yq,n)}function ehe(l,n=1){return bz(l,Yq,1/n)}const the=10*1e3,gK=1024,nhe=1152,ohe=1536;let lT=null,BU=null;class rB{constructor(n,o,i,u=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=n,this.config=o,this.typeSupported=i,this.ISGenerated=!1,lT===null){const g=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);lT=g?parseInt(g[1]):0}if(BU===null){const h=navigator.userAgent.match(/Safari\/(\d+)/i);BU=h?parseInt(h[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(n){Mt.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=n}resetNextTimestamp(){Mt.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){Mt.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(n){let o=!1;const i=n.reduce((u,h)=>{const g=h.pts-u;return g<-4294967296?(o=!0,Om(u,h.pts)):g>0?u:h.pts},n[0].pts);return o&&Mt.debug("PTS rollover detected"),i}remux(n,o,i,u,h,g,b,S){let T,k,R,V,z,$,W=h,Q=h;const j=n.pid>-1,se=o.pid>-1,re=o.samples.length,Y=n.samples.length>0,me=b&&re>0||re>1;if((!j||Y)&&(!se||me)||this.ISGenerated||b){if(this.ISGenerated){var Ce,Ue,ot,Ae;const De=this.videoTrackConfig;De&&(o.width!==De.width||o.height!==De.height||((Ce=o.pixelRatio)==null?void 0:Ce[0])!==((Ue=De.pixelRatio)==null?void 0:Ue[0])||((ot=o.pixelRatio)==null?void 0:ot[1])!==((Ae=De.pixelRatio)==null?void 0:Ae[1]))&&this.resetInitSegment()}else R=this.generateIS(n,o,h,g);const ve=this.isVideoContiguous;let Oe=-1,O;if(me&&(Oe=she(o.samples),!ve&&this.config.forceKeyFrameOnDiscontinuity))if($=!0,Oe>0){Mt.warn(`[mp4-remuxer]: Dropped ${Oe} out of ${re} video samples due to a missing keyframe`);const De=this.getVideoStartPts(o.samples);o.samples=o.samples.slice(Oe),o.dropped+=Oe,Q+=(o.samples[0].pts-De)/o.inputTimeScale,O=Q}else Oe===-1&&(Mt.warn(`[mp4-remuxer]: No keyframe found out of ${re} video samples`),$=!1);if(this.ISGenerated){if(Y&&me){const De=this.getVideoStartPts(o.samples),st=(Om(n.samples[0].pts,De)-De)/o.inputTimeScale;W+=Math.max(0,st),Q+=Math.max(0,-st)}if(Y){if(n.samplerate||(Mt.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),R=this.generateIS(n,o,h,g)),k=this.remuxAudio(n,W,this.isAudioContiguous,g,se||me||S===Us.AUDIO?Q:void 0),me){const De=k?k.endPTS-k.startPTS:0;o.inputTimeScale||(Mt.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),R=this.generateIS(n,o,h,g)),T=this.remuxVideo(o,Q,ve,De)}}else me&&(T=this.remuxVideo(o,Q,ve,0));T&&(T.firstKeyFrame=Oe,T.independent=Oe!==-1,T.firstKeyFramePTS=O)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(z=Xq(i,h,this._initPTS,this._initDTS)),u.samples.length&&(V=Jq(u,h,this._initPTS))),{audio:k,video:T,initSegment:R,independent:$,text:V,id3:z}}generateIS(n,o,i,u){const h=n.samples,g=o.samples,b=this.typeSupported,S={},T=this._initPTS;let k=!T||u,R="audio/mp4",V,z,$;if(k&&(V=z=1/0),n.config&&h.length){switch(n.timescale=n.samplerate,n.segmentCodec){case"mp3":b.mpeg?(R="audio/mpeg",n.codec=""):b.mp3&&(n.codec="mp3");break;case"ac3":n.codec="ac-3";break}S.audio={id:"audio",container:R,codec:n.codec,initSegment:n.segmentCodec==="mp3"&&b.mpeg?new Uint8Array(0):Zt.initSegment([n]),metadata:{channelCount:n.channelCount}},k&&($=n.inputTimeScale,!T||$!==T.timescale?V=z=h[0].pts-Math.round($*i):k=!1)}if(o.sps&&o.pps&&g.length){if(o.timescale=o.inputTimeScale,S.video={id:"main",container:"video/mp4",codec:o.codec,initSegment:Zt.initSegment([o]),metadata:{width:o.width,height:o.height}},k)if($=o.inputTimeScale,!T||$!==T.timescale){const W=this.getVideoStartPts(g),Q=Math.round($*i);z=Math.min(z,Om(g[0].dts,W)-Q),V=Math.min(V,W-Q)}else k=!1;this.videoTrackConfig={width:o.width,height:o.height,pixelRatio:o.pixelRatio}}if(Object.keys(S).length)return this.ISGenerated=!0,k?(this._initPTS={baseTime:V,timescale:$},this._initDTS={baseTime:z,timescale:$}):V=$=void 0,{tracks:S,initPTS:V,timescale:$}}remuxVideo(n,o,i,u){const h=n.inputTimeScale,g=n.samples,b=[],S=g.length,T=this._initPTS;let k=this.nextAvcDts,R=8,V=this.videoSampleDuration,z,$,W=Number.POSITIVE_INFINITY,Q=Number.NEGATIVE_INFINITY,j=!1;if(!i||k===null){const Dt=o*h,Xe=g[0].pts-Om(g[0].dts,g[0].pts);lT&&k!==null&&Math.abs(Dt-Xe-k)<15e3?i=!0:k=Dt-Xe}const se=T.baseTime*h/T.timescale;for(let Dt=0;Dt<S;Dt++){const Xe=g[Dt];Xe.pts=Om(Xe.pts-se,k),Xe.dts=Om(Xe.dts-se,k),Xe.dts<g[Dt>0?Dt-1:Dt].dts&&(j=!0)}j&&g.sort(function(Dt,Xe){const it=Dt.dts-Xe.dts,qe=Dt.pts-Xe.pts;return it||qe}),z=g[0].dts,$=g[g.length-1].dts;const re=$-z,Y=re?Math.round(re/(S-1)):V||n.inputTimeScale/30;if(i){const Dt=z-k,Xe=Dt>Y,it=Dt<-1;if((Xe||it)&&(Xe?Mt.warn(`AVC: ${ML(Dt,!0)} ms (${Dt}dts) hole between fragments detected at ${o.toFixed(3)}`):Mt.warn(`AVC: ${ML(-Dt,!0)} ms (${Dt}dts) overlapping between fragments detected at ${o.toFixed(3)}`),!it||k>=g[0].pts||lT)){z=k;const qe=g[0].pts-Dt;if(Xe)g[0].dts=z,g[0].pts=qe;else for(let mt=0;mt<g.length&&!(g[mt].dts>qe);mt++)g[mt].dts-=Dt,g[mt].pts-=Dt;Mt.log(`Video: Initial PTS/DTS adjusted: ${ML(qe,!0)}/${ML(z,!0)}, delta: ${ML(Dt,!0)} ms`)}}z=Math.max(0,z);let me=0,ae=0,Ce=z;for(let Dt=0;Dt<S;Dt++){const Xe=g[Dt],it=Xe.units,qe=it.length;let mt=0;for(let Un=0;Un<qe;Un++)mt+=it[Un].data.length;ae+=mt,me+=qe,Xe.length=mt,Xe.dts<Ce?(Xe.dts=Ce,Ce+=Y/4|0||1):Ce=Xe.dts,W=Math.min(Xe.pts,W),Q=Math.max(Xe.pts,Q)}$=g[S-1].dts;const Ue=ae+4*me+8;let ot;try{ot=new Uint8Array(Ue)}catch(Dt){this.observer.emit(we.ERROR,we.ERROR,{type:Gs.MUX_ERROR,details:nn.REMUX_ALLOC_ERROR,fatal:!1,error:Dt,bytes:Ue,reason:`fail allocating video mdat ${Ue}`});return}const Ae=new DataView(ot.buffer);Ae.setUint32(0,Ue),ot.set(Zt.types.mdat,4);let ve=!1,Oe=Number.POSITIVE_INFINITY,O=Number.POSITIVE_INFINITY,De=Number.NEGATIVE_INFINITY,Fe=Number.NEGATIVE_INFINITY;for(let Dt=0;Dt<S;Dt++){const Xe=g[Dt],it=Xe.units;let qe=0;for(let on=0,vt=it.length;on<vt;on++){const an=it[on],J=an.data,Bn=an.data.byteLength;Ae.setUint32(R,Bn),R+=4,ot.set(J,R),R+=Bn,qe+=4+Bn}let mt;if(Dt<S-1)V=g[Dt+1].dts-Xe.dts,mt=g[Dt+1].pts-Xe.pts;else{const on=this.config,vt=Dt>0?Xe.dts-g[Dt-1].dts:Y;if(mt=Dt>0?Xe.pts-g[Dt-1].pts:Y,on.stretchShortVideoTrack&&this.nextAudioPts!==null){const an=Math.floor(on.maxBufferHole*h),J=(u?W+u*h:this.nextAudioPts)-Xe.pts;J>an?(V=J-vt,V<0?V=vt:ve=!0,Mt.log(`[mp4-remuxer]: It is approximately ${J/90} ms to the next segment; using duration ${V/90} ms for the last video frame.`)):V=vt}else V=vt}const Un=Math.round(Xe.pts-Xe.dts);Oe=Math.min(Oe,V),De=Math.max(De,V),O=Math.min(O,mt),Fe=Math.max(Fe,mt),b.push(new bK(Xe.key,V,qe,Un))}if(b.length){if(lT){if(lT<70){const Dt=b[0].flags;Dt.dependsOn=2,Dt.isNonSync=0}}else if(BU&&Fe-O<De-Oe&&Y/De<.025&&b[0].cts===0){Mt.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let Dt=z;for(let Xe=0,it=b.length;Xe<it;Xe++){const qe=Dt+b[Xe].duration,mt=Dt+b[Xe].cts;if(Xe<it-1){const Un=qe+b[Xe+1].cts;b[Xe].duration=Un-mt}else b[Xe].duration=Xe?b[Xe-1].duration:Y;b[Xe].cts=0,Dt=qe}}}V=ve||!V?Y:V,this.nextAvcDts=k=$+V,this.videoSampleDuration=V,this.isVideoContiguous=!0;const et={data1:Zt.moof(n.sequenceNumber++,z,Ic({},n,{samples:b})),data2:ot,startPTS:W/h,endPTS:(Q+V)/h,startDTS:z/h,endDTS:k/h,type:"video",hasAudio:!1,hasVideo:!0,nb:b.length,dropped:n.dropped};return n.samples=[],n.dropped=0,et}getSamplesPerFrame(n){switch(n.segmentCodec){case"mp3":return nhe;case"ac3":return ohe;default:return gK}}remuxAudio(n,o,i,u,h){const g=n.inputTimeScale,b=n.samplerate?n.samplerate:g,S=g/b,T=this.getSamplesPerFrame(n),k=T*S,R=this._initPTS,V=n.segmentCodec==="mp3"&&this.typeSupported.mpeg,z=[],$=h!==void 0;let W=n.samples,Q=V?0:8,j=this.nextAudioPts||-1;const se=o*g,re=R.baseTime*g/R.timescale;if(this.isAudioContiguous=i=i||W.length&&j>0&&(u&&Math.abs(se-j)<9e3||Math.abs(Om(W[0].pts-re,se)-j)<20*k),W.forEach(function(st){st.pts=Om(st.pts-re,se)}),!i||j<0){if(W=W.filter(st=>st.pts>=0),!W.length)return;h===0?j=0:u&&!$?j=Math.max(0,se):j=W[0].pts}if(n.segmentCodec==="aac"){const st=this.config.maxAudioFramesDrift;for(let Ut=0,et=j;Ut<W.length;Ut++){const Dt=W[Ut],Xe=Dt.pts,it=Xe-et,qe=Math.abs(1e3*it/g);if(it<=-st*k&&$)Ut===0&&(Mt.warn(`Audio frame @ ${(Xe/g).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*it/g)} ms.`),this.nextAudioPts=j=et=Xe);else if(it>=st*k&&qe<the&&$){let mt=Math.round(it/k);et=Xe-mt*k,et<0&&(mt--,et+=k),Ut===0&&(this.nextAudioPts=j=et),Mt.warn(`[mp4-remuxer]: Injecting ${mt} audio frame @ ${(et/g).toFixed(3)}s due to ${Math.round(1e3*it/g)} ms gap.`);for(let Un=0;Un<mt;Un++){const on=Math.max(et,0);let vt=pK.getSilentFrame(n.manifestCodec||n.codec,n.channelCount);vt||(Mt.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),vt=Dt.unit.subarray()),W.splice(Ut,0,{unit:vt,pts:on}),et+=k,Ut++}}Dt.pts=et,et+=k}}let Y=null,me=null,ae,Ce=0,Ue=W.length;for(;Ue--;)Ce+=W[Ue].unit.byteLength;for(let st=0,Ut=W.length;st<Ut;st++){const et=W[st],Dt=et.unit;let Xe=et.pts;if(me!==null){const qe=z[st-1];qe.duration=Math.round((Xe-me)/S)}else if(i&&n.segmentCodec==="aac"&&(Xe=j),Y=Xe,Ce>0){Ce+=Q;try{ae=new Uint8Array(Ce)}catch(qe){this.observer.emit(we.ERROR,we.ERROR,{type:Gs.MUX_ERROR,details:nn.REMUX_ALLOC_ERROR,fatal:!1,error:qe,bytes:Ce,reason:`fail allocating audio mdat ${Ce}`});return}V||(new DataView(ae.buffer).setUint32(0,Ce),ae.set(Zt.types.mdat,4))}else return;ae.set(Dt,Q);const it=Dt.byteLength;Q+=it,z.push(new bK(!0,T,it,0)),me=Xe}const ot=z.length;if(!ot)return;const Ae=z[z.length-1];this.nextAudioPts=j=me+S*Ae.duration;const ve=V?new Uint8Array(0):Zt.moof(n.sequenceNumber++,Y/S,Ic({},n,{samples:z}));n.samples=[];const Oe=Y/g,O=j/g,Fe={data1:ve,data2:ae,startPTS:Oe,endPTS:O,startDTS:Oe,endDTS:O,type:"audio",hasAudio:!0,hasVideo:!1,nb:ot};return this.isAudioContiguous=!0,Fe}remuxEmptyAudio(n,o,i,u){const h=n.inputTimeScale,g=n.samplerate?n.samplerate:h,b=h/g,S=this.nextAudioPts,T=this._initDTS,k=T.baseTime*9e4/T.timescale,R=(S!==null?S:u.startDTS*h)+k,V=u.endDTS*h+k,z=b*gK,$=Math.ceil((V-R)/z),W=pK.getSilentFrame(n.manifestCodec||n.codec,n.channelCount);if(Mt.warn("[mp4-remuxer]: remux empty Audio"),!W){Mt.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const Q=[];for(let j=0;j<$;j++){const se=R+j*z;Q.push({unit:W,pts:se,dts:se})}return n.samples=Q,this.remuxAudio(n,o,i,!1)}}function Om(l,n){let o;if(n===null)return l;for(n<l?o=-8589934592:o=8589934592;Math.abs(l-n)>4294967296;)l+=o;return l}function she(l){for(let n=0;n<l.length;n++)if(l[n].key)return n;return-1}function Xq(l,n,o,i){const u=l.samples.length;if(!u)return;const h=l.inputTimeScale;for(let b=0;b<u;b++){const S=l.samples[b];S.pts=Om(S.pts-o.baseTime*h/o.timescale,n*h)/h,S.dts=Om(S.dts-i.baseTime*h/i.timescale,n*h)/h}const g=l.samples;return l.samples=[],{samples:g}}function Jq(l,n,o){const i=l.samples.length;if(!i)return;const u=l.inputTimeScale;for(let g=0;g<i;g++){const b=l.samples[g];b.pts=Om(b.pts-o.baseTime*u/o.timescale,n*u)/u}l.samples.sort((g,b)=>g.pts-b.pts);const h=l.samples;return l.samples=[],{samples:h}}class bK{constructor(n,o,i,u){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=o,this.size=i,this.cts=u,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:n?2:1,isNonSync:n?0:1}}}class rhe{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(n){this.initPTS=n,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(n,o,i,u){this.audioCodec=o,this.videoCodec=i,this.generateInitSegment(hde(n,u)),this.emitInitSegment=!0}generateInitSegment(n){let{audioCodec:o,videoCodec:i}=this;if(!(n!=null&&n.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const u=this.initData=Eq(n);u.audio&&(o=vK(u.audio,ya.AUDIO)),u.video&&(i=vK(u.video,ya.VIDEO));const h={};u.audio&&u.video?h.audiovideo={container:"video/mp4",codec:o+","+i,initSegment:n,id:"main"}:u.audio?h.audio={container:"audio/mp4",codec:o,initSegment:n,id:"audio"}:u.video?h.video={container:"video/mp4",codec:i,initSegment:n,id:"main"}:Mt.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=h}remux(n,o,i,u,h,g){var b,S;let{initPTS:T,lastEndTime:k}=this;const R={audio:void 0,video:void 0,text:u,id3:i,initSegment:void 0};Xo(k)||(k=this.lastEndTime=h||0);const V=o.samples;if(!(V!=null&&V.length))return R;const z={initPTS:void 0,timescale:1};let $=this.initData;if((b=$)!=null&&b.length||(this.generateInitSegment(V),$=this.initData),!((S=$)!=null&&S.length))return Mt.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),R;this.emitInitSegment&&(z.tracks=this.initTracks,this.emitInitSegment=!1);const W=pde(V,$),Q=mde($,V),j=Q===null?h:Q;(ihe(T,j,h,W)||z.timescale!==T.timescale&&g)&&(z.initPTS=j-h,T&&T.timescale===1&&Mt.warn(`Adjusting initPTS by ${z.initPTS-T.baseTime}`),this.initPTS=T={baseTime:z.initPTS,timescale:1});const se=n?j-T.baseTime/T.timescale:k,re=se+W;bde($,V,T.baseTime/T.timescale),W>0?this.lastEndTime=re:(Mt.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const Y=!!$.audio,me=!!$.video;let ae="";Y&&(ae+="audio"),me&&(ae+="video");const Ce={data1:V,startPTS:se,startDTS:se,endPTS:re,endDTS:re,type:ae,hasAudio:Y,hasVideo:me,nb:1,dropped:0};return R.audio=Ce.type==="audio"?Ce:void 0,R.video=Ce.type!=="audio"?Ce:void 0,R.initSegment=z,R.id3=Xq(i,h,T,T),u.samples.length&&(R.text=Jq(u,h,T)),R}}function ihe(l,n,o,i){if(l===null)return!0;const u=Math.max(i,1),h=n-l.baseTime/l.timescale;return Math.abs(h-o)>u}function vK(l,n){const o=l==null?void 0:l.codec;if(o&&o.length>4)return o;if(n===ya.AUDIO){if(o==="ec-3"||o==="ac-3"||o==="alac")return o;if(o==="fLaC"||o==="Opus")return kB(o,!1);const i="mp4a.40.5";return Mt.info(`Parsed audio codec "${o}" or audio object type not handled. Using "${i}"`),i}return Mt.warn(`Unhandled video codec "${o}"`),o==="hvc1"||o==="hev1"?"hvc1.1.6.L120.90":o==="av01"?"av01.0.04M.08":"avc1.42e01e"}let Jb;try{Jb=self.performance.now.bind(self.performance)}catch{Mt.debug("Unable to use Performance API on this environment"),Jb=AT==null?void 0:AT.Date.now}const iB=[{demux:Wfe,remux:rhe},{demux:r1,remux:rB},{demux:zfe,remux:rB},{demux:Jfe,remux:rB}];iB.splice(2,0,{demux:jfe,remux:rB});class xK{constructor(n,o,i,u,h){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=n,this.typeSupported=o,this.config=i,this.vendor=u,this.id=h}configure(n){this.transmuxConfig=n,this.decrypter&&this.decrypter.reset()}push(n,o,i,u){const h=i.transmuxing;h.executeStart=Jb();let g=new Uint8Array(n);const{currentTransmuxState:b,transmuxConfig:S}=this;u&&(this.currentTransmuxState=u);const{contiguous:T,discontinuity:k,trackSwitch:R,accurateTimeOffset:V,timeOffset:z,initSegmentChange:$}=u||b,{audioCodec:W,videoCodec:Q,defaultInitPts:j,duration:se,initSegmentData:re}=S,Y=ahe(g,o);if(Y&&Y.method==="AES-128"){const Ue=this.getDecrypter();if(Ue.isSync()){let ot=Ue.softwareDecrypt(g,Y.key.buffer,Y.iv.buffer);if(i.part>-1&&(ot=Ue.flush()),!ot)return h.executeEnd=Jb(),$U(i);g=new Uint8Array(ot)}else return this.decryptionPromise=Ue.webCryptoDecrypt(g,Y.key.buffer,Y.iv.buffer).then(ot=>{const Ae=this.push(ot,null,i);return this.decryptionPromise=null,Ae}),this.decryptionPromise}const me=this.needsProbing(k,R);if(me){const Ue=this.configureTransmuxer(g);if(Ue)return Mt.warn(`[transmuxer] ${Ue.message}`),this.observer.emit(we.ERROR,we.ERROR,{type:Gs.MEDIA_ERROR,details:nn.FRAG_PARSING_ERROR,fatal:!1,error:Ue,reason:Ue.message}),h.executeEnd=Jb(),$U(i)}(k||R||$||me)&&this.resetInitSegment(re,W,Q,se,o),(k||$||me)&&this.resetInitialTimestamp(j),T||this.resetContiguity();const ae=this.transmux(g,Y,z,V,i),Ce=this.currentTransmuxState;return Ce.contiguous=!0,Ce.discontinuity=!1,Ce.trackSwitch=!1,h.executeEnd=Jb(),ae}flush(n){const o=n.transmuxing;o.executeStart=Jb();const{decrypter:i,currentTransmuxState:u,decryptionPromise:h}=this;if(h)return h.then(()=>this.flush(n));const g=[],{timeOffset:b}=u;if(i){const R=i.flush();R&&g.push(this.push(R,null,n))}const{demuxer:S,remuxer:T}=this;if(!S||!T)return o.executeEnd=Jb(),[$U(n)];const k=S.flush(b);return aB(k)?k.then(R=>(this.flushRemux(g,R,n),g)):(this.flushRemux(g,k,n),g)}flushRemux(n,o,i){const{audioTrack:u,videoTrack:h,id3Track:g,textTrack:b}=o,{accurateTimeOffset:S,timeOffset:T}=this.currentTransmuxState;Mt.log(`[transmuxer.ts]: Flushed fragment ${i.sn}${i.part>-1?" p: "+i.part:""} of level ${i.level}`);const k=this.remuxer.remux(u,h,g,b,T,S,!0,this.id);n.push({remuxResult:k,chunkMeta:i}),i.transmuxing.executeEnd=Jb()}resetInitialTimestamp(n){const{demuxer:o,remuxer:i}=this;!o||!i||(o.resetTimeStamp(n),i.resetTimeStamp(n))}resetContiguity(){const{demuxer:n,remuxer:o}=this;!n||!o||(n.resetContiguity(),o.resetNextTimestamp())}resetInitSegment(n,o,i,u,h){const{demuxer:g,remuxer:b}=this;!g||!b||(g.resetInitSegment(n,o,i,u),b.resetInitSegment(n,o,i,h))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(n,o,i,u,h){let g;return o&&o.method==="SAMPLE-AES"?g=this.transmuxSampleAes(n,o,i,u,h):g=this.transmuxUnencrypted(n,i,u,h),g}transmuxUnencrypted(n,o,i,u){const{audioTrack:h,videoTrack:g,id3Track:b,textTrack:S}=this.demuxer.demux(n,o,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(h,g,b,S,o,i,!1,this.id),chunkMeta:u}}transmuxSampleAes(n,o,i,u,h){return this.demuxer.demuxSampleAes(n,o,i).then(g=>({remuxResult:this.remuxer.remux(g.audioTrack,g.videoTrack,g.id3Track,g.textTrack,i,u,!1,this.id),chunkMeta:h}))}configureTransmuxer(n){const{config:o,observer:i,typeSupported:u,vendor:h}=this;let g;for(let V=0,z=iB.length;V<z;V++){var b;if((b=iB[V].demux)!=null&&b.probe(n)){g=iB[V];break}}if(!g)return new Error("Failed to find demuxer by probing fragment data");const S=this.demuxer,T=this.remuxer,k=g.remux,R=g.demux;(!T||!(T instanceof k))&&(this.remuxer=new k(i,o,u,h)),(!S||!(S instanceof R))&&(this.demuxer=new R(i,o,u),this.probe=R.probe)}needsProbing(n,o){return!this.demuxer||!this.remuxer||n||o}getDecrypter(){let n=this.decrypter;return n||(n=this.decrypter=new fz(this.config)),n}}function ahe(l,n){let o=null;return l.byteLength>0&&(n==null?void 0:n.key)!=null&&n.iv!==null&&n.method!=null&&(o=n),o}const $U=l=>({remuxResult:{},chunkMeta:l});function aB(l){return"then"in l&&l.then instanceof Function}class lhe{constructor(n,o,i,u,h){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=n,this.videoCodec=o,this.initSegmentData=i,this.duration=u,this.defaultInitPts=h||null}}class che{constructor(n,o,i,u,h,g){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=n,this.contiguous=o,this.accurateTimeOffset=i,this.trackSwitch=u,this.timeOffset=h,this.initSegmentChange=g}}var Qq={exports:{}};(function(l){var n=Object.prototype.hasOwnProperty,o="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(o=!1));function u(S,T,k){this.fn=S,this.context=T,this.once=k||!1}function h(S,T,k,R,V){if(typeof k!="function")throw new TypeError("The listener must be a function");var z=new u(k,R||S,V),$=o?o+T:T;return S._events[$]?S._events[$].fn?S._events[$]=[S._events[$],z]:S._events[$].push(z):(S._events[$]=z,S._eventsCount++),S}function g(S,T){--S._eventsCount===0?S._events=new i:delete S._events[T]}function b(){this._events=new i,this._eventsCount=0}b.prototype.eventNames=function(){var T=[],k,R;if(this._eventsCount===0)return T;for(R in k=this._events)n.call(k,R)&&T.push(o?R.slice(1):R);return Object.getOwnPropertySymbols?T.concat(Object.getOwnPropertySymbols(k)):T},b.prototype.listeners=function(T){var k=o?o+T:T,R=this._events[k];if(!R)return[];if(R.fn)return[R.fn];for(var V=0,z=R.length,$=new Array(z);V<z;V++)$[V]=R[V].fn;return $},b.prototype.listenerCount=function(T){var k=o?o+T:T,R=this._events[k];return R?R.fn?1:R.length:0},b.prototype.emit=function(T,k,R,V,z,$){var W=o?o+T:T;if(!this._events[W])return!1;var Q=this._events[W],j=arguments.length,se,re;if(Q.fn){switch(Q.once&&this.removeListener(T,Q.fn,void 0,!0),j){case 1:return Q.fn.call(Q.context),!0;case 2:return Q.fn.call(Q.context,k),!0;case 3:return Q.fn.call(Q.context,k,R),!0;case 4:return Q.fn.call(Q.context,k,R,V),!0;case 5:return Q.fn.call(Q.context,k,R,V,z),!0;case 6:return Q.fn.call(Q.context,k,R,V,z,$),!0}for(re=1,se=new Array(j-1);re<j;re++)se[re-1]=arguments[re];Q.fn.apply(Q.context,se)}else{var Y=Q.length,me;for(re=0;re<Y;re++)switch(Q[re].once&&this.removeListener(T,Q[re].fn,void 0,!0),j){case 1:Q[re].fn.call(Q[re].context);break;case 2:Q[re].fn.call(Q[re].context,k);break;case 3:Q[re].fn.call(Q[re].context,k,R);break;case 4:Q[re].fn.call(Q[re].context,k,R,V);break;default:if(!se)for(me=1,se=new Array(j-1);me<j;me++)se[me-1]=arguments[me];Q[re].fn.apply(Q[re].context,se)}}return!0},b.prototype.on=function(T,k,R){return h(this,T,k,R,!1)},b.prototype.once=function(T,k,R){return h(this,T,k,R,!0)},b.prototype.removeListener=function(T,k,R,V){var z=o?o+T:T;if(!this._events[z])return this;if(!k)return g(this,z),this;var $=this._events[z];if($.fn)$.fn===k&&(!V||$.once)&&(!R||$.context===R)&&g(this,z);else{for(var W=0,Q=[],j=$.length;W<j;W++)($[W].fn!==k||V&&!$[W].once||R&&$[W].context!==R)&&Q.push($[W]);Q.length?this._events[z]=Q.length===1?Q[0]:Q:g(this,z)}return this},b.prototype.removeAllListeners=function(T){var k;return T?(k=o?o+T:T,this._events[k]&&g(this,k)):(this._events=new i,this._eventsCount=0),this},b.prototype.off=b.prototype.removeListener,b.prototype.addListener=b.prototype.on,b.prefixed=o,b.EventEmitter=b,l.exports=b})(Qq);var uhe=Qq.exports,vz=Pue(uhe);class eY{constructor(n,o,i,u){this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;const h=n.config;this.hls=n,this.id=o,this.useWorker=!!h.enableWorker,this.onTransmuxComplete=i,this.onFlush=u;const g=(k,R)=>{R=R||{},R.frag=this.frag,R.id=this.id,k===we.ERROR&&(this.error=R.error),this.hls.trigger(k,R)};this.observer=new vz,this.observer.on(we.FRAG_DECRYPTED,g),this.observer.on(we.ERROR,g);const b=PT(h.preferManagedMediaSource)||{isTypeSupported:()=>!1},S={mpeg:b.isTypeSupported("audio/mpeg"),mp3:b.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:b.isTypeSupported('audio/mp4; codecs="ac-3"')},T=navigator.vendor;if(this.useWorker&&typeof Worker<"u"&&(h.workerPath||Afe())){try{h.workerPath?(Mt.log(`loading Web Worker ${h.workerPath} for "${o}"`),this.workerContext=Rfe(h.workerPath)):(Mt.log(`injecting Web Worker for "${o}"`),this.workerContext=Lfe()),this.onwmsg=V=>this.onWorkerMessage(V);const{worker:R}=this.workerContext;R.addEventListener("message",this.onwmsg),R.onerror=V=>{const z=new Error(`${V.message}  (${V.filename}:${V.lineno})`);h.enableWorker=!1,Mt.warn(`Error in "${o}" Web Worker, fallback to inline`),this.hls.trigger(we.ERROR,{type:Gs.OTHER_ERROR,details:nn.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:z})},R.postMessage({cmd:"init",typeSupported:S,vendor:T,id:o,config:JSON.stringify(h)})}catch(R){Mt.warn(`Error setting up "${o}" Web Worker, fallback to inline`,R),this.resetWorker(),this.error=null,this.transmuxer=new xK(this.observer,S,h,T,o)}return}this.transmuxer=new xK(this.observer,S,h,T,o)}resetWorker(){if(this.workerContext){const{worker:n,objectURL:o}=this.workerContext;o&&self.URL.revokeObjectURL(o),n.removeEventListener("message",this.onwmsg),n.onerror=null,n.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const o=this.transmuxer;o&&(o.destroy(),this.transmuxer=null)}const n=this.observer;n&&n.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(n,o,i,u,h,g,b,S,T,k){var R,V;T.transmuxing.start=self.performance.now();const{transmuxer:z}=this,$=g?g.start:h.start,W=h.decryptdata,Q=this.frag,j=!(Q&&h.cc===Q.cc),se=!(Q&&T.level===Q.level),re=Q?T.sn-Q.sn:-1,Y=this.part?T.part-this.part.index:-1,me=re===0&&T.id>1&&T.id===(Q==null?void 0:Q.stats.chunkCount),ae=!se&&(re===1||re===0&&(Y===1||me&&Y<=0)),Ce=self.performance.now();(se||re||h.stats.parsing.start===0)&&(h.stats.parsing.start=Ce),g&&(Y||!ae)&&(g.stats.parsing.start=Ce);const Ue=!(Q&&((R=h.initSegment)==null?void 0:R.url)===((V=Q.initSegment)==null?void 0:V.url)),ot=new che(j,ae,S,se,$,Ue);if(!ae||j||Ue){Mt.log(`[transmuxer-interface, ${h.type}]: Starting new transmux session for sn: ${T.sn} p: ${T.part} level: ${T.level} id: ${T.id}
        discontinuity: ${j}
        trackSwitch: ${se}
        contiguous: ${ae}
        accurateTimeOffset: ${S}
        timeOffset: ${$}
        initSegmentChange: ${Ue}`);const Ae=new lhe(i,u,o,b,k);this.configureTransmuxer(Ae)}if(this.frag=h,this.part=g,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:n,decryptdata:W,chunkMeta:T,state:ot},n instanceof ArrayBuffer?[n]:[]);else if(z){const Ae=z.push(n,W,T,ot);aB(Ae)?(z.async=!0,Ae.then(ve=>{this.handleTransmuxComplete(ve)}).catch(ve=>{this.transmuxerError(ve,T,"transmuxer-interface push error")})):(z.async=!1,this.handleTransmuxComplete(Ae))}}flush(n){n.transmuxing.start=self.performance.now();const{transmuxer:o}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:n});else if(o){let i=o.flush(n);aB(i)||o.async?(aB(i)||(i=Promise.resolve(i)),i.then(h=>{this.handleFlushResult(h,n)}).catch(h=>{this.transmuxerError(h,n,"transmuxer-interface flush error")})):this.handleFlushResult(i,n)}}transmuxerError(n,o,i){this.hls&&(this.error=n,this.hls.trigger(we.ERROR,{type:Gs.MEDIA_ERROR,details:nn.FRAG_PARSING_ERROR,chunkMeta:o,fatal:!1,error:n,err:n,reason:i}))}handleFlushResult(n,o){n.forEach(i=>{this.handleTransmuxComplete(i)}),this.onFlush(o)}onWorkerMessage(n){const o=n.data,i=this.hls;switch(o.event){case"init":{var u;const h=(u=this.workerContext)==null?void 0:u.objectURL;h&&self.URL.revokeObjectURL(h);break}case"transmuxComplete":{this.handleTransmuxComplete(o.data);break}case"flush":{this.onFlush(o.data);break}case"workerLog":Mt[o.data.logType]&&Mt[o.data.logType](o.data.message);break;default:{o.data=o.data||{},o.data.frag=this.frag,o.data.id=this.id,i.trigger(o.event,o.data);break}}}configureTransmuxer(n){const{transmuxer:o}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:n}):o&&o.configure(n)}handleTransmuxComplete(n){n.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(n)}}function tY(l,n){if(l.length!==n.length)return!1;for(let o=0;o<l.length;o++)if(!RT(l[o].attrs,n[o].attrs))return!1;return!0}function RT(l,n,o){const i=l["STABLE-RENDITION-ID"];return i&&!o?i===n["STABLE-RENDITION-ID"]:!(o||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(u=>l[u]!==n[u])}function IV(l,n){return n.label.toLowerCase()===l.name.toLowerCase()&&(!n.language||n.language.toLowerCase()===(l.lang||"").toLowerCase())}const yK=100;class dhe extends hz{constructor(n,o,i){super(n,o,i,"[audio-stream-controller]",Us.AUDIO),this.videoBuffer=null,this.videoTrackCC=-1,this.waitingVideoCC=-1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:n}=this;n.on(we.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(we.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(we.MANIFEST_LOADING,this.onManifestLoading,this),n.on(we.LEVEL_LOADED,this.onLevelLoaded,this),n.on(we.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),n.on(we.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),n.on(we.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),n.on(we.ERROR,this.onError,this),n.on(we.BUFFER_RESET,this.onBufferReset,this),n.on(we.BUFFER_CREATED,this.onBufferCreated,this),n.on(we.BUFFER_FLUSHING,this.onBufferFlushing,this),n.on(we.BUFFER_FLUSHED,this.onBufferFlushed,this),n.on(we.INIT_PTS_FOUND,this.onInitPtsFound,this),n.on(we.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:n}=this;n.off(we.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(we.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(we.MANIFEST_LOADING,this.onManifestLoading,this),n.off(we.LEVEL_LOADED,this.onLevelLoaded,this),n.off(we.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),n.off(we.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),n.off(we.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),n.off(we.ERROR,this.onError,this),n.off(we.BUFFER_RESET,this.onBufferReset,this),n.off(we.BUFFER_CREATED,this.onBufferCreated,this),n.off(we.BUFFER_FLUSHING,this.onBufferFlushing,this),n.off(we.BUFFER_FLUSHED,this.onBufferFlushed,this),n.off(we.INIT_PTS_FOUND,this.onInitPtsFound,this),n.off(we.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(n,{frag:o,id:i,initPTS:u,timescale:h}){if(i==="main"){const g=o.cc;this.initPTS[o.cc]={baseTime:u,timescale:h},this.log(`InitPTS for cc: ${g} found from main: ${u}`),this.videoTrackCC=g,this.state===Hn.WAITING_INIT_PTS&&this.tick()}}startLoad(n){if(!this.levels){this.startPosition=n,this.state=Hn.STOPPED;return}const o=this.lastCurrentTime;this.stopLoad(),this.setInterval(yK),o>0&&n===-1?(this.log(`Override startPosition with lastCurrentTime @${o.toFixed(3)}`),n=o,this.state=Hn.IDLE):(this.loadedmetadata=!1,this.state=Hn.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=n,this.tick()}doTick(){switch(this.state){case Hn.IDLE:this.doTickIdle();break;case Hn.WAITING_TRACK:{var n;const{levels:i,trackId:u}=this,h=i==null||(n=i[u])==null?void 0:n.details;if(h){if(this.waitForCdnTuneIn(h))break;this.state=Hn.WAITING_INIT_PTS}break}case Hn.FRAG_LOADING_WAITING_RETRY:{var o;const i=performance.now(),u=this.retryDate;if(!u||i>=u||(o=this.media)!=null&&o.seeking){const{levels:h,trackId:g}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((h==null?void 0:h[g])||null),this.state=Hn.IDLE}break}case Hn.WAITING_INIT_PTS:{const i=this.waitingData;if(i){const{frag:u,part:h,cache:g,complete:b}=i;if(this.initPTS[u.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=Hn.FRAG_LOADING;const S=g.flush(),T={frag:u,part:h,payload:S,networkDetails:null};this._handleFragmentLoadProgress(T),b&&super._handleFragmentLoadComplete(T)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${u.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const S=this.getLoadPosition(),T=Xa.bufferInfo(this.mediaBuffer,S,this.config.maxBufferHole);RV(T.end,this.config.maxFragLookUpTolerance,u)<0&&(this.log(`Waiting fragment cc (${u.cc}) @ ${u.start} cancelled because another fragment at ${T.end} is needed`),this.clearWaitingFragment())}}else this.state=Hn.IDLE}}this.onTickEnd()}clearWaitingFragment(){const n=this.waitingData;n&&(this.fragmentTracker.removeFragment(n.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=Hn.IDLE)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:n}=this;n!=null&&n.readyState&&(this.lastCurrentTime=n.currentTime)}doTickIdle(){const{hls:n,levels:o,media:i,trackId:u}=this,h=n.config;if(!i&&(this.startFragRequested||!h.startFragPrefetch)||!(o!=null&&o[u]))return;const g=o[u],b=g.details;if(!b||b.live&&this.levelLastLoaded!==g||this.waitForCdnTuneIn(b)){this.state=Hn.WAITING_TRACK;return}const S=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&S&&(this.bufferFlushed=!1,this.afterBufferFlushed(S,ya.AUDIO,Us.AUDIO));const T=this.getFwdBufferInfo(S,Us.AUDIO);if(T===null)return;const{bufferedTrack:k,switchingTrack:R}=this;if(!R&&this._streamEnded(T,b)){n.trigger(we.BUFFER_EOS,{type:"audio"}),this.state=Hn.ENDED;return}const V=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,Us.MAIN),z=T.len,$=this.getMaxBufferLength(V==null?void 0:V.len),W=b.fragments,Q=W[0].start;let j=this.flushing?this.getLoadPosition():T.end;if(R&&i){const me=this.getLoadPosition();k&&!RT(R.attrs,k.attrs)&&(j=me),b.PTSKnown&&me<Q&&(T.end>Q||T.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=Q+.05)}if(z>=$&&!R&&j<W[W.length-1].start)return;let se=this.getNextFragment(j,b),re=!1;if(se&&this.isLoopLoading(se,j)&&(re=!!se.gap,se=this.getNextFragmentLoopLoading(se,b,T,Us.MAIN,$)),!se){this.bufferFlushed=!0;return}const Y=V&&se.start>V.end+b.targetduration;if(Y||!(V!=null&&V.len)&&T.len){const me=this.getAppendedFrag(se.start,Us.MAIN);if(me===null||(re||(re=!!me.gap||!!Y&&V.len===0),Y&&!re||re&&T.nextStart&&T.nextStart<me.end))return}this.loadFragment(se,g,j)}getMaxBufferLength(n){const o=super.getMaxBufferLength();return n?Math.min(Math.max(o,n),this.config.maxMaxBufferLength):o}onMediaDetaching(){this.videoBuffer=null,this.bufferFlushed=this.flushing=!1,super.onMediaDetaching()}onAudioTracksUpdated(n,{audioTracks:o}){this.resetTransmuxer(),this.levels=o.map(i=>new LT(i))}onAudioTrackSwitching(n,o){const i=!!o.url;this.trackId=o.id;const{fragCurrent:u}=this;u&&(u.abortRequests(),this.removeUnbufferedFrags(u.start)),this.resetLoadingState(),i?this.setInterval(yK):this.resetTransmuxer(),i?(this.switchingTrack=o,this.state=Hn.IDLE,this.flushAudioIfNeeded(o)):(this.switchingTrack=null,this.bufferedTrack=o,this.state=Hn.STOPPED),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(n,o){this.mainDetails=o.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(we.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(n,o){var i;if(this.mainDetails==null){this.cachedTrackLoadedData=o;return}const{levels:u}=this,{details:h,id:g}=o;if(!u){this.warn(`Audio tracks were reset while loading level ${g}`);return}this.log(`Audio track ${g} loaded [${h.startSN},${h.endSN}]${h.lastPartSn?`[part-${h.lastPartSn}-${h.lastPartIndex}]`:""},duration:${h.totalduration}`);const b=u[g];let S=0;if(h.live||(i=b.details)!=null&&i.live){this.checkLiveUpdate(h);const k=this.mainDetails;if(h.deltaUpdateFailed||!k)return;if(!b.details&&h.hasProgramDateTime&&k.hasProgramDateTime)IB(h,k),S=h.fragments[0].start;else{var T;S=this.alignPlaylists(h,b.details,(T=this.levelLastLoaded)==null?void 0:T.details)}}b.details=h,this.levelLastLoaded=b,!this.startFragRequested&&(this.mainDetails||!h.live)&&this.setStartPosition(this.mainDetails||h,S),this.state===Hn.WAITING_TRACK&&!this.waitForCdnTuneIn(h)&&(this.state=Hn.IDLE),this.tick()}_handleFragmentLoadProgress(n){var o;const{frag:i,part:u,payload:h}=n,{config:g,trackId:b,levels:S}=this;if(!S){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const T=S[b];if(!T){this.warn("Audio track is undefined on fragment load progress");return}const k=T.details;if(!k){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const R=g.defaultAudioCodec||T.audioCodec||"mp4a.40.2";let V=this.transmuxer;V||(V=this.transmuxer=new eY(this.hls,Us.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const z=this.initPTS[i.cc],$=(o=i.initSegment)==null?void 0:o.data;if(z!==void 0){const Q=u?u.index:-1,j=Q!==-1,se=new dz(i.level,i.sn,i.stats.chunkCount,h.byteLength,Q,j);V.push(h,$,R,"",i,u,k.totalduration,!1,se,z)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${k.startSN} ,${k.endSN}],track ${b}`);const{cache:W}=this.waitingData=this.waitingData||{frag:i,part:u,cache:new Bq,complete:!1};W.push(new Uint8Array(h)),this.waitingVideoCC=this.videoTrackCC,this.state=Hn.WAITING_INIT_PTS}}_handleFragmentLoadComplete(n){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(n)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(n,o){const i=o.tracks.audio;i&&(this.mediaBuffer=i.buffer||null),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer||null)}onFragBuffered(n,o){const{frag:i,part:u}=o;if(i.type!==Us.AUDIO){if(!this.loadedmetadata&&i.type===Us.MAIN){const h=this.videoBuffer||this.media;h&&Xa.getBuffered(h).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${u?" p: "+u.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(i.sn!=="initSegment"){this.fragPrevious=i;const h=this.switchingTrack;h&&(this.bufferedTrack=h,this.switchingTrack=null,this.hls.trigger(we.AUDIO_TRACK_SWITCHED,Eu({},h)))}this.fragBufferedComplete(i,u)}onError(n,o){var i;if(o.fatal){this.state=Hn.ERROR;return}switch(o.details){case nn.FRAG_GAP:case nn.FRAG_PARSING_ERROR:case nn.FRAG_DECRYPT_ERROR:case nn.FRAG_LOAD_ERROR:case nn.FRAG_LOAD_TIMEOUT:case nn.KEY_LOAD_ERROR:case nn.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Us.AUDIO,o);break;case nn.AUDIO_TRACK_LOAD_ERROR:case nn.AUDIO_TRACK_LOAD_TIMEOUT:case nn.LEVEL_PARSING_ERROR:!o.levelRetry&&this.state===Hn.WAITING_TRACK&&((i=o.context)==null?void 0:i.type)===Ci.AUDIO_TRACK&&(this.state=Hn.IDLE);break;case nn.BUFFER_APPEND_ERROR:case nn.BUFFER_FULL_ERROR:if(!o.parent||o.parent!=="audio")return;if(o.details===nn.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(o)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case nn.INTERNAL_EXCEPTION:this.recoverWorkerError(o);break}}onBufferFlushing(n,{type:o}){o!==ya.VIDEO&&(this.flushing=!0)}onBufferFlushed(n,{type:o}){if(o!==ya.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===Hn.ENDED&&(this.state=Hn.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,o,Us.AUDIO),this.tick())}}_handleTransmuxComplete(n){var o;const i="audio",{hls:u}=this,{remuxResult:h,chunkMeta:g}=n,b=this.getCurrentContext(g);if(!b){this.resetWhenMissingContext(g);return}const{frag:S,part:T,level:k}=b,{details:R}=k,{audio:V,text:z,id3:$,initSegment:W}=h;if(this.fragContextChanged(S)||!R){this.fragmentTracker.removeFragment(S);return}if(this.state=Hn.PARSING,this.switchingTrack&&V&&this.completeAudioSwitch(this.switchingTrack),W!=null&&W.tracks){const Q=S.initSegment||S;this._bufferInitSegment(k,W.tracks,Q,g),u.trigger(we.FRAG_PARSING_INIT_SEGMENT,{frag:Q,id:i,tracks:W.tracks})}if(V){const{startPTS:Q,endPTS:j,startDTS:se,endDTS:re}=V;T&&(T.elementaryStreams[ya.AUDIO]={startPTS:Q,endPTS:j,startDTS:se,endDTS:re}),S.setElementaryStreamInfo(ya.AUDIO,Q,j,se,re),this.bufferFragmentData(V,S,T,g)}if($!=null&&(o=$.samples)!=null&&o.length){const Q=Ic({id:i,frag:S,details:R},$);u.trigger(we.FRAG_PARSING_METADATA,Q)}if(z){const Q=Ic({id:i,frag:S,details:R},z);u.trigger(we.FRAG_PARSING_USERDATA,Q)}}_bufferInitSegment(n,o,i,u){if(this.state!==Hn.PARSING)return;o.video&&delete o.video;const h=o.audio;if(!h)return;h.id="audio";const g=n.audioCodec;this.log(`Init audio buffer, container:${h.container}, codecs[level/parsed]=[${g}/${h.codec}]`),g&&g.split(",").length===1&&(h.levelCodec=g),this.hls.trigger(we.BUFFER_CODECS,o);const b=h.initSegment;if(b!=null&&b.byteLength){const S={type:"audio",frag:i,part:null,chunkMeta:u,parent:i.type,data:b};this.hls.trigger(we.BUFFER_APPENDING,S)}this.tickImmediate()}loadFragment(n,o,i){const u=this.fragmentTracker.getState(n);if(this.fragCurrent=n,this.switchingTrack||u===Su.NOT_LOADED||u===Su.PARTIAL){var h;if(n.sn==="initSegment")this._loadInitSegment(n,o);else if((h=o.details)!=null&&h.live&&!this.initPTS[n.cc]){this.log(`Waiting for video PTS in continuity counter ${n.cc} of live stream before loading audio fragment ${n.sn} of level ${this.trackId}`),this.state=Hn.WAITING_INIT_PTS;const g=this.mainDetails;g&&g.fragments[0].start!==o.details.fragments[0].start&&IB(o.details,g)}else this.startFragRequested=!0,super.loadFragment(n,o,i)}else this.clearTrackerIfNeeded(n)}flushAudioIfNeeded(n){const{media:o,bufferedTrack:i}=this,u=i==null?void 0:i.attrs,h=n.attrs;o&&u&&(u.CHANNELS!==h.CHANNELS||i.name!==n.name||i.lang!==n.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(n){const{hls:o}=this;this.flushAudioIfNeeded(n),this.bufferedTrack=n,this.switchingTrack=null,o.trigger(we.AUDIO_TRACK_SWITCHED,Eu({},n))}}class fhe extends uz{constructor(n){super(n,"[audio-track-controller]"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:n}=this;n.on(we.MANIFEST_LOADING,this.onManifestLoading,this),n.on(we.MANIFEST_PARSED,this.onManifestParsed,this),n.on(we.LEVEL_LOADING,this.onLevelLoading,this),n.on(we.LEVEL_SWITCHING,this.onLevelSwitching,this),n.on(we.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),n.on(we.ERROR,this.onError,this)}unregisterListeners(){const{hls:n}=this;n.off(we.MANIFEST_LOADING,this.onManifestLoading,this),n.off(we.MANIFEST_PARSED,this.onManifestParsed,this),n.off(we.LEVEL_LOADING,this.onLevelLoading,this),n.off(we.LEVEL_SWITCHING,this.onLevelSwitching,this),n.off(we.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),n.off(we.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(n,o){this.tracks=o.audioTracks||[]}onAudioTrackLoaded(n,o){const{id:i,groupId:u,details:h}=o,g=this.tracksInGroup[i];if(!g||g.groupId!==u){this.warn(`Audio track with id:${i} and group:${u} not found in active group ${g==null?void 0:g.groupId}`);return}const b=g.details;g.details=o.details,this.log(`Audio track ${i} "${g.name}" lang:${g.lang} group:${u} loaded [${h.startSN}-${h.endSN}]`),i===this.trackId&&this.playlistLoaded(i,o,b)}onLevelLoading(n,o){this.switchLevel(o.level)}onLevelSwitching(n,o){this.switchLevel(o.level)}switchLevel(n){const o=this.hls.levels[n];if(!o)return;const i=o.audioGroups||null,u=this.groupIds;let h=this.currentTrack;if(!i||(u==null?void 0:u.length)!==(i==null?void 0:i.length)||i!=null&&i.some(b=>(u==null?void 0:u.indexOf(b))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const b=this.tracks.filter(V=>!i||i.indexOf(V.groupId)!==-1);if(b.length)this.selectDefaultTrack&&!b.some(V=>V.default)&&(this.selectDefaultTrack=!1),b.forEach((V,z)=>{V.id=z});else if(!h&&!this.tracksInGroup.length)return;this.tracksInGroup=b;const S=this.hls.config.audioPreference;if(!h&&S){const V=b0(S,b,rT);if(V>-1)h=b[V];else{const z=b0(S,this.tracks);h=this.tracks[z]}}let T=this.findTrackId(h);T===-1&&h&&(T=this.findTrackId(null));const k={audioTracks:b};this.log(`Updating audio tracks, ${b.length} track(s) found in group(s): ${i==null?void 0:i.join(",")}`),this.hls.trigger(we.AUDIO_TRACKS_UPDATED,k);const R=this.trackId;if(T!==-1&&R===-1)this.setAudioTrack(T);else if(b.length&&R===-1){var g;const V=new Error(`No audio track selected for current audio group-ID(s): ${(g=this.groupIds)==null?void 0:g.join(",")} track count: ${b.length}`);this.warn(V.message),this.hls.trigger(we.ERROR,{type:Gs.MEDIA_ERROR,details:nn.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:V})}}else this.shouldReloadPlaylist(h)&&this.setAudioTrack(this.trackId)}onError(n,o){o.fatal||!o.context||o.context.type===Ci.AUDIO_TRACK&&o.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(o.context.groupId)!==-1)&&(this.requestScheduled=-1,this.checkRetry(o))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(n){this.selectDefaultTrack=!1,this.setAudioTrack(n)}setAudioOption(n){const o=this.hls;if(o.config.audioPreference=n,n){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const u=this.currentTrack;if(u&&_T(n,u,rT))return u;const h=b0(n,this.tracksInGroup,rT);if(h>-1){const g=this.tracksInGroup[h];return this.setAudioTrack(h),g}else if(u){let g=o.loadLevel;g===-1&&(g=o.firstAutoLevel);const b=ffe(n,o.levels,i,g,rT);if(b===-1)return null;o.nextLoadLevel=b}if(n.channels||n.audioCodec){const g=b0(n,i);if(g>-1)return i[g]}}}return null}setAudioTrack(n){const o=this.tracksInGroup;if(n<0||n>=o.length){this.warn(`Invalid audio track id: ${n}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,u=o[n],h=u.details&&!u.details.live;if(n===this.trackId&&u===i&&h||(this.log(`Switching to audio-track ${n} "${u.name}" lang:${u.lang} group:${u.groupId} channels:${u.channels}`),this.trackId=n,this.currentTrack=u,this.hls.trigger(we.AUDIO_TRACK_SWITCHING,Eu({},u)),h))return;const g=this.switchParams(u.url,i==null?void 0:i.details);this.loadPlaylist(g)}findTrackId(n){const o=this.tracksInGroup;for(let i=0;i<o.length;i++){const u=o[i];if(!(this.selectDefaultTrack&&!u.default)&&(!n||_T(n,u,rT)))return i}if(n){const{name:i,lang:u,assocLang:h,characteristics:g,audioCodec:b,channels:S}=n;for(let T=0;T<o.length;T++){const k=o[T];if(_T({name:i,lang:u,assocLang:h,characteristics:g,audioCodec:b,channels:S},k,rT))return T}for(let T=0;T<o.length;T++){const k=o[T];if(RT(n.attrs,k.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return T}for(let T=0;T<o.length;T++){const k=o[T];if(RT(n.attrs,k.attrs,["LANGUAGE"]))return T}}return-1}loadPlaylist(n){const o=this.currentTrack;if(this.shouldLoadPlaylist(o)&&o){super.loadPlaylist();const i=o.id,u=o.groupId;let h=o.url;if(n)try{h=n.addDirectives(h)}catch(g){this.warn(`Could not construct new URL with HLS Delivery Directives: ${g}`)}this.log(`loading audio-track playlist ${i} "${o.name}" lang:${o.lang} group:${u}`),this.clearTimer(),this.hls.trigger(we.AUDIO_TRACK_LOADING,{url:h,id:i,groupId:u,deliveryDirectives:n||null})}}}const wK=500;class hhe extends hz{constructor(n,o,i){super(n,o,i,"[subtitle-stream-controller]",Us.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:n}=this;n.on(we.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(we.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(we.MANIFEST_LOADING,this.onManifestLoading,this),n.on(we.LEVEL_LOADED,this.onLevelLoaded,this),n.on(we.ERROR,this.onError,this),n.on(we.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),n.on(we.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),n.on(we.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),n.on(we.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),n.on(we.BUFFER_FLUSHING,this.onBufferFlushing,this),n.on(we.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:n}=this;n.off(we.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(we.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(we.MANIFEST_LOADING,this.onManifestLoading,this),n.off(we.LEVEL_LOADED,this.onLevelLoaded,this),n.off(we.ERROR,this.onError,this),n.off(we.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),n.off(we.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),n.off(we.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),n.off(we.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),n.off(we.BUFFER_FLUSHING,this.onBufferFlushing,this),n.off(we.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(n){this.stopLoad(),this.state=Hn.IDLE,this.setInterval(wK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=n,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(n,o){this.mainDetails=o.details}onSubtitleFragProcessed(n,o){const{frag:i,success:u}=o;if(this.fragPrevious=i,this.state=Hn.IDLE,!u)return;const h=this.tracksBuffered[this.currentTrackId];if(!h)return;let g;const b=i.start;for(let T=0;T<h.length;T++)if(b>=h[T].start&&b<=h[T].end){g=h[T];break}const S=i.start+i.duration;g?g.end=S:(g={start:b,end:S},h.push(g)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null)}onBufferFlushing(n,o){const{startOffset:i,endOffset:u}=o;if(i===0&&u!==Number.POSITIVE_INFINITY){const h=u-1;if(h<=0)return;o.endOffsetSubtitles=Math.max(0,h),this.tracksBuffered.forEach(g=>{for(let b=0;b<g.length;){if(g[b].end<=h){g.shift();continue}else if(g[b].start<h)g[b].start=h;else break;b++}}),this.fragmentTracker.removeFragmentsInRange(i,h,Us.SUBTITLE)}}onFragBuffered(n,o){if(!this.loadedmetadata&&o.frag.type===Us.MAIN){var i;(i=this.media)!=null&&i.buffered.length&&(this.loadedmetadata=!0)}}onError(n,o){const i=o.frag;(i==null?void 0:i.type)===Us.SUBTITLE&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Hn.STOPPED&&(this.state=Hn.IDLE))}onSubtitleTracksUpdated(n,{subtitleTracks:o}){if(this.levels&&tY(this.levels,o)){this.levels=o.map(i=>new LT(i));return}this.tracksBuffered=[],this.levels=o.map(i=>{const u=new LT(i);return this.tracksBuffered[u.id]=[],u}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Us.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(n,o){var i;if(this.currentTrackId=o.id,!((i=this.levels)!=null&&i.length)||this.currentTrackId===-1){this.clearInterval();return}const u=this.levels[this.currentTrackId];u!=null&&u.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,u&&this.setInterval(wK)}onSubtitleTrackLoaded(n,o){var i;const{currentTrackId:u,levels:h}=this,{details:g,id:b}=o;if(!h){this.warn(`Subtitle tracks were reset while loading level ${b}`);return}const S=h[u];if(b>=h.length||b!==u||!S)return;this.log(`Subtitle track ${b} loaded [${g.startSN},${g.endSN}]${g.lastPartSn?`[part-${g.lastPartSn}-${g.lastPartIndex}]`:""},duration:${g.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let T=0;if(g.live||(i=S.details)!=null&&i.live){const R=this.mainDetails;if(g.deltaUpdateFailed||!R)return;const V=R.fragments[0];if(!S.details)g.hasProgramDateTime&&R.hasProgramDateTime?(IB(g,R),T=g.fragments[0].start):V&&(T=V.start,LV(g,T));else{var k;T=this.alignPlaylists(g,S.details,(k=this.levelLastLoaded)==null?void 0:k.details),T===0&&V&&(T=V.start,LV(g,T))}}S.details=g,this.levelLastLoaded=S,!this.startFragRequested&&(this.mainDetails||!g.live)&&this.setStartPosition(this.mainDetails||g,T),this.tick(),g.live&&!this.fragCurrent&&this.media&&this.state===Hn.IDLE&&(OB(null,g.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),S.details=void 0))}_handleFragmentLoadComplete(n){const{frag:o,payload:i}=n,u=o.decryptdata,h=this.hls;if(!this.fragContextChanged(o)&&i&&i.byteLength>0&&u!=null&&u.key&&u.iv&&u.method==="AES-128"){const g=performance.now();this.decrypter.decrypt(new Uint8Array(i),u.key.buffer,u.iv.buffer).catch(b=>{throw h.trigger(we.ERROR,{type:Gs.MEDIA_ERROR,details:nn.FRAG_DECRYPT_ERROR,fatal:!1,error:b,reason:b.message,frag:o}),b}).then(b=>{const S=performance.now();h.trigger(we.FRAG_DECRYPTED,{frag:o,payload:b,stats:{tstart:g,tdecrypt:S}})}).catch(b=>{this.warn(`${b.name}: ${b.message}`),this.state=Hn.IDLE})}}doTick(){if(!this.media){this.state=Hn.IDLE;return}if(this.state===Hn.IDLE){const{currentTrackId:n,levels:o}=this,i=o==null?void 0:o[n];if(!i||!o.length||!i.details)return;const{config:u}=this,h=this.getLoadPosition(),g=Xa.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],h,u.maxBufferHole),{end:b,len:S}=g,T=this.getFwdBufferInfo(this.media,Us.MAIN),k=i.details,R=this.getMaxBufferLength(T==null?void 0:T.len)+k.levelTargetDuration;if(S>R)return;const V=k.fragments,z=V.length,$=k.edge;let W=null;const Q=this.fragPrevious;if(b<$){const j=u.maxFragLookUpTolerance,se=b>$-j?0:j;W=OB(Q,V,Math.max(V[0].start,b),se),!W&&Q&&Q.start<V[0].start&&(W=V[0])}else W=V[z-1];if(!W)return;if(W=this.mapToInitFragWhenRequired(W),W.sn!=="initSegment"){const j=W.sn-k.startSN,se=V[j-1];se&&se.cc===W.cc&&this.fragmentTracker.getState(se)===Su.NOT_LOADED&&(W=se)}this.fragmentTracker.getState(W)===Su.NOT_LOADED&&this.loadFragment(W,i,b)}}getMaxBufferLength(n){const o=super.getMaxBufferLength();return n?Math.max(o,n):o}loadFragment(n,o,i){this.fragCurrent=n,n.sn==="initSegment"?this._loadInitSegment(n,o):(this.startFragRequested=!0,super.loadFragment(n,o,i))}get mediaBufferTimeRanges(){return new mhe(this.tracksBuffered[this.currentTrackId]||[])}}class mhe{constructor(n){this.buffered=void 0;const o=(i,u,h)=>{if(u=u>>>0,u>h-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${u}) is greater than the maximum bound (${h})`);return n[u][i]};this.buffered={get length(){return n.length},end(i){return o("end",i,n.length)},start(i){return o("start",i,n.length)}}}}class phe extends uz{constructor(n){super(n,"[subtitle-track-controller]"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let o=null;const i=oB(this.media.textTracks);for(let h=0;h<i.length;h++)if(i[h].mode==="hidden")o=i[h];else if(i[h].mode==="showing"){o=i[h];break}const u=this.findTrackForTextTrack(o);this.subtitleTrack!==u&&this.setSubtitleTrack(u)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(n){this._subtitleDisplay=n,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:n}=this;n.on(we.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(we.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(we.MANIFEST_LOADING,this.onManifestLoading,this),n.on(we.MANIFEST_PARSED,this.onManifestParsed,this),n.on(we.LEVEL_LOADING,this.onLevelLoading,this),n.on(we.LEVEL_SWITCHING,this.onLevelSwitching,this),n.on(we.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),n.on(we.ERROR,this.onError,this)}unregisterListeners(){const{hls:n}=this;n.off(we.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(we.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(we.MANIFEST_LOADING,this.onManifestLoading,this),n.off(we.MANIFEST_PARSED,this.onManifestParsed,this),n.off(we.LEVEL_LOADING,this.onLevelLoading,this),n.off(we.LEVEL_SWITCHING,this.onLevelSwitching,this),n.off(we.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),n.off(we.ERROR,this.onError,this)}onMediaAttached(n,o){this.media=o.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(n){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,n)}onMediaDetaching(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),oB(this.media.textTracks).forEach(o=>{xT(o)}),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(n,o){this.tracks=o.subtitleTracks}onSubtitleTrackLoaded(n,o){const{id:i,groupId:u,details:h}=o,g=this.tracksInGroup[i];if(!g||g.groupId!==u){this.warn(`Subtitle track with id:${i} and group:${u} not found in active group ${g==null?void 0:g.groupId}`);return}const b=g.details;g.details=o.details,this.log(`Subtitle track ${i} "${g.name}" lang:${g.lang} group:${u} loaded [${h.startSN}-${h.endSN}]`),i===this.trackId&&this.playlistLoaded(i,o,b)}onLevelLoading(n,o){this.switchLevel(o.level)}onLevelSwitching(n,o){this.switchLevel(o.level)}switchLevel(n){const o=this.hls.levels[n];if(!o)return;const i=o.subtitleGroups||null,u=this.groupIds;let h=this.currentTrack;if(!i||(u==null?void 0:u.length)!==(i==null?void 0:i.length)||i!=null&&i.some(g=>(u==null?void 0:u.indexOf(g))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const g=this.tracks.filter(k=>!i||i.indexOf(k.groupId)!==-1);if(g.length)this.selectDefaultTrack&&!g.some(k=>k.default)&&(this.selectDefaultTrack=!1),g.forEach((k,R)=>{k.id=R});else if(!h&&!this.tracksInGroup.length)return;this.tracksInGroup=g;const b=this.hls.config.subtitlePreference;if(!h&&b){this.selectDefaultTrack=!1;const k=b0(b,g);if(k>-1)h=g[k];else{const R=b0(b,this.tracks);h=this.tracks[R]}}let S=this.findTrackId(h);S===-1&&h&&(S=this.findTrackId(null));const T={subtitleTracks:g};this.log(`Updating subtitle tracks, ${g.length} track(s) found in "${i==null?void 0:i.join(",")}" group-id`),this.hls.trigger(we.SUBTITLE_TRACKS_UPDATED,T),S!==-1&&this.trackId===-1&&this.setSubtitleTrack(S)}else this.shouldReloadPlaylist(h)&&this.setSubtitleTrack(this.trackId)}findTrackId(n){const o=this.tracksInGroup,i=this.selectDefaultTrack;for(let u=0;u<o.length;u++){const h=o[u];if(!(i&&!h.default||!i&&!n)&&(!n||_T(h,n)))return u}if(n){for(let u=0;u<o.length;u++){const h=o[u];if(RT(n.attrs,h.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<o.length;u++){const h=o[u];if(RT(n.attrs,h.attrs,["LANGUAGE"]))return u}}return-1}findTrackForTextTrack(n){if(n){const o=this.tracksInGroup;for(let i=0;i<o.length;i++){const u=o[i];if(IV(u,n))return i}}return-1}onError(n,o){o.fatal||!o.context||o.context.type===Ci.SUBTITLE_TRACK&&o.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(o.context.groupId)!==-1)&&this.checkRetry(o)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(n){this.selectDefaultTrack=!1,this.setSubtitleTrack(n)}setSubtitleOption(n){if(this.hls.config.subtitlePreference=n,n){const o=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,o.length){const i=this.currentTrack;if(i&&_T(n,i))return i;const u=b0(n,this.tracksInGroup);if(u>-1){const h=this.tracksInGroup[u];return this.setSubtitleTrack(u),h}else{if(i)return null;{const h=b0(n,o);if(h>-1)return o[h]}}}}return null}loadPlaylist(n){super.loadPlaylist();const o=this.currentTrack;if(this.shouldLoadPlaylist(o)&&o){const i=o.id,u=o.groupId;let h=o.url;if(n)try{h=n.addDirectives(h)}catch(g){this.warn(`Could not construct new URL with HLS Delivery Directives: ${g}`)}this.log(`Loading subtitle playlist for id ${i}`),this.hls.trigger(we.SUBTITLE_TRACK_LOADING,{url:h,id:i,groupId:u,deliveryDirectives:n||null})}}toggleTrackModes(){const{media:n}=this;if(!n)return;const o=oB(n.textTracks),i=this.currentTrack;let u;if(i&&(u=o.filter(h=>IV(i,h))[0],u||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(o).forEach(h=>{h.mode!=="disabled"&&h!==u&&(h.mode="disabled")}),u){const h=this.subtitleDisplay?"showing":"hidden";u.mode!==h&&(u.mode=h)}}setSubtitleTrack(n){const o=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=n;return}if(n<-1||n>=o.length||!Xo(n)){this.warn(`Invalid subtitle track id: ${n}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,u=o[n]||null;if(this.trackId=n,this.currentTrack=u,this.toggleTrackModes(),!u){this.hls.trigger(we.SUBTITLE_TRACK_SWITCH,{id:n});return}const h=!!u.details&&!u.details.live;if(n===this.trackId&&u===i&&h)return;this.log(`Switching to subtitle-track ${n}`+(u?` "${u.name}" lang:${u.lang} group:${u.groupId}`:""));const{id:g,groupId:b="",name:S,type:T,url:k}=u;this.hls.trigger(we.SUBTITLE_TRACK_SWITCH,{id:g,groupId:b,name:S,type:T,url:k});const R=this.switchParams(u.url,i==null?void 0:i.details);this.loadPlaylist(R)}}class ghe{constructor(n){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=n}append(n,o,i){const u=this.queues[o];u.push(n),u.length===1&&!i&&this.executeNext(o)}insertAbort(n,o){this.queues[o].unshift(n),this.executeNext(o)}appendBlocker(n){let o;const i=new Promise(h=>{o=h}),u={execute:o,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(u,n),i}executeNext(n){const o=this.queues[n];if(o.length){const i=o[0];try{i.execute()}catch(u){Mt.warn(`[buffer-operation-queue]: Exception executing "${n}" SourceBuffer operation: ${u}`),i.onError(u);const h=this.buffers[n];h!=null&&h.updating||this.shiftAndExecuteNext(n)}}}shiftAndExecuteNext(n){this.queues[n].shift(),this.executeNext(n)}current(n){return this.queues[n][0]}}const SK=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class bhe{constructor(n){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=i=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=i=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:i,mediaSource:u}=this;this.log("Media source opened"),i&&(i.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(we.MEDIA_ATTACHED,{media:i,mediaSource:u})),u&&u.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:i,_objectUrl:u}=this;i!==u&&Mt.error(`Media element src was set while attaching MediaSource (${u} > ${i})`)},this.hls=n;const o="[buffer-controller]";this.appendSource=n.config.preferManagedMediaSource&&typeof self<"u"&&self.ManagedMediaSource,this.log=Mt.log.bind(Mt,o),this.warn=Mt.warn.bind(Mt,o),this.error=Mt.error.bind(Mt,o),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:n}=this;n.on(we.MEDIA_ATTACHING,this.onMediaAttaching,this),n.on(we.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(we.MANIFEST_LOADING,this.onManifestLoading,this),n.on(we.MANIFEST_PARSED,this.onManifestParsed,this),n.on(we.BUFFER_RESET,this.onBufferReset,this),n.on(we.BUFFER_APPENDING,this.onBufferAppending,this),n.on(we.BUFFER_CODECS,this.onBufferCodecs,this),n.on(we.BUFFER_EOS,this.onBufferEos,this),n.on(we.BUFFER_FLUSHING,this.onBufferFlushing,this),n.on(we.LEVEL_UPDATED,this.onLevelUpdated,this),n.on(we.FRAG_PARSED,this.onFragParsed,this),n.on(we.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:n}=this;n.off(we.MEDIA_ATTACHING,this.onMediaAttaching,this),n.off(we.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(we.MANIFEST_LOADING,this.onManifestLoading,this),n.off(we.MANIFEST_PARSED,this.onManifestParsed,this),n.off(we.BUFFER_RESET,this.onBufferReset,this),n.off(we.BUFFER_APPENDING,this.onBufferAppending,this),n.off(we.BUFFER_CODECS,this.onBufferCodecs,this),n.off(we.BUFFER_EOS,this.onBufferEos,this),n.off(we.BUFFER_FLUSHING,this.onBufferFlushing,this),n.off(we.LEVEL_UPDATED,this.onLevelUpdated,this),n.off(we.FRAG_PARSED,this.onFragParsed,this),n.off(we.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new ghe(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(n,o){let i=2;(o.audio&&!o.video||!o.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(n,o){const i=this.media=o.media,u=PT(this.appendSource);if(i&&u){var h;const g=this.mediaSource=new u;this.log(`created media source: ${(h=g.constructor)==null?void 0:h.name}`),g.addEventListener("sourceopen",this._onMediaSourceOpen),g.addEventListener("sourceended",this._onMediaSourceEnded),g.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(g.addEventListener("startstreaming",this._onStartStreaming),g.addEventListener("endstreaming",this._onEndStreaming));const b=this._objectUrl=self.URL.createObjectURL(g);if(this.appendSource)try{i.removeAttribute("src");const S=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||S&&g instanceof S,EK(i),vhe(i,b),i.load()}catch{i.src=b}else i.src=b;i.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:n,mediaSource:o,_objectUrl:i}=this;if(o){if(this.log("media source detaching"),o.readyState==="open")try{o.endOfStream()}catch(u){this.warn(`onMediaDetaching: ${u.message} while calling endOfStream`)}this.onBufferReset(),o.removeEventListener("sourceopen",this._onMediaSourceOpen),o.removeEventListener("sourceended",this._onMediaSourceEnded),o.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(o.removeEventListener("startstreaming",this._onStartStreaming),o.removeEventListener("endstreaming",this._onEndStreaming)),n&&(n.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),this.mediaSrc===i?(n.removeAttribute("src"),this.appendSource&&EK(n),n.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(we.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach(n=>{this.resetBuffer(n)}),this._initSourceBuffer()}resetBuffer(n){const o=this.sourceBuffer[n];try{if(o){var i;this.removeBufferListeners(n),this.sourceBuffer[n]=void 0,(i=this.mediaSource)!=null&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(o)}}catch(u){this.warn(`onBufferReset ${n}`,u)}}onBufferCodecs(n,o){const i=this.getSourceBufferTypes().length,u=Object.keys(o);if(u.forEach(g=>{if(i){const S=this.tracks[g];if(S&&typeof S.buffer.changeType=="function"){var b;const{id:T,codec:k,levelCodec:R,container:V,metadata:z}=o[g],$=Wj(S.codec,S.levelCodec),W=$==null?void 0:$.replace(SK,"$1");let Q=Wj(k,R);const j=(b=Q)==null?void 0:b.replace(SK,"$1");if(Q&&W!==j){g.slice(0,5)==="audio"&&(Q=kB(Q,this.appendSource));const se=`${V};codecs=${Q}`;this.appendChangeType(g,se),this.log(`switching codec ${$} to ${Q}`),this.tracks[g]={buffer:S.buffer,codec:k,container:V,levelCodec:R,metadata:z,id:T}}}}else this.pendingTracks[g]=o[g]}),i)return;const h=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==h&&(this.log(`${h} bufferCodec event(s) expected ${u.join(",")}`),this.bufferCodecEventsExpected=h),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()}appendChangeType(n,o){const{operationQueue:i}=this,u={execute:()=>{const h=this.sourceBuffer[n];h&&(this.log(`changing ${n} sourceBuffer type to ${o}`),h.changeType(o)),i.shiftAndExecuteNext(n)},onStart:()=>{},onComplete:()=>{},onError:h=>{this.warn(`Failed to change ${n} SourceBuffer type`,h)}};i.append(u,n,!!this.pendingTracks[n])}onBufferAppending(n,o){const{hls:i,operationQueue:u,tracks:h}=this,{data:g,type:b,frag:S,part:T,chunkMeta:k}=o,R=k.buffering[b],V=self.performance.now();R.start=V;const z=S.stats.buffering,$=T?T.stats.buffering:null;z.start===0&&(z.start=V),$&&$.start===0&&($.start=V);const W=h.audio;let Q=!1;b==="audio"&&(W==null?void 0:W.container)==="audio/mpeg"&&(Q=!this.lastMpegAudioChunk||k.id===1||this.lastMpegAudioChunk.sn!==k.sn,this.lastMpegAudioChunk=k);const j=S.start,se={execute:()=>{if(R.executeStart=self.performance.now(),Q){const re=this.sourceBuffer[b];if(re){const Y=j-re.timestampOffset;Math.abs(Y)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${j} (delta: ${Y}) sn: ${S.sn})`),re.timestampOffset=j)}}this.appendExecutor(g,b)},onStart:()=>{},onComplete:()=>{const re=self.performance.now();R.executeEnd=R.end=re,z.first===0&&(z.first=re),$&&$.first===0&&($.first=re);const{sourceBuffer:Y}=this,me={};for(const ae in Y)me[ae]=Xa.getBuffered(Y[ae]);this.appendErrors[b]=0,b==="audio"||b==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(we.BUFFER_APPENDED,{type:b,frag:S,part:T,chunkMeta:k,parent:S.type,timeRanges:me})},onError:re=>{const Y={type:Gs.MEDIA_ERROR,parent:S.type,details:nn.BUFFER_APPEND_ERROR,sourceBufferName:b,frag:S,part:T,chunkMeta:k,error:re,err:re,fatal:!1};if(re.code===DOMException.QUOTA_EXCEEDED_ERR)Y.details=nn.BUFFER_FULL_ERROR;else{const me=++this.appendErrors[b];Y.details=nn.BUFFER_APPEND_ERROR,this.warn(`Failed ${me}/${i.config.appendErrorMaxRetry} times to append segment in "${b}" sourceBuffer`),me>=i.config.appendErrorMaxRetry&&(Y.fatal=!0)}i.trigger(we.ERROR,Y)}};u.append(se,b,!!this.pendingTracks[b])}onBufferFlushing(n,o){const{operationQueue:i}=this,u=h=>({execute:this.removeExecutor.bind(this,h,o.startOffset,o.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(we.BUFFER_FLUSHED,{type:h})},onError:g=>{this.warn(`Failed to remove from ${h} SourceBuffer`,g)}});o.type?i.append(u(o.type),o.type):this.getSourceBufferTypes().forEach(h=>{i.append(u(h),h)})}onFragParsed(n,o){const{frag:i,part:u}=o,h=[],g=u?u.elementaryStreams:i.elementaryStreams;g[ya.AUDIOVIDEO]?h.push("audiovideo"):(g[ya.AUDIO]&&h.push("audio"),g[ya.VIDEO]&&h.push("video"));const b=()=>{const S=self.performance.now();i.stats.buffering.end=S,u&&(u.stats.buffering.end=S);const T=u?u.stats:i.stats;this.hls.trigger(we.FRAG_BUFFERED,{frag:i,part:u,stats:T,id:i.type})};h.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(b,h)}onFragChanged(n,o){this.trimBuffers()}onBufferEos(n,o){this.getSourceBufferTypes().reduce((u,h)=>{const g=this.sourceBuffer[h];return g&&(!o.type||o.type===h)&&(g.ending=!0,g.ended||(g.ended=!0,this.log(`${h} sourceBuffer now EOS`))),u&&!!(!g||g.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(h=>{const g=this.sourceBuffer[h];g&&(g.ending=!1)});const{mediaSource:u}=this;if(!u||u.readyState!=="open"){u&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${u.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),u.endOfStream()}))}onLevelUpdated(n,{details:o}){o.fragments.length&&(this.details=o,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:n,details:o,media:i}=this;if(!i||o===null||!this.getSourceBufferTypes().length)return;const h=n.config,g=i.currentTime,b=o.levelTargetDuration,S=o.live&&h.liveBackBufferLength!==null?h.liveBackBufferLength:h.backBufferLength;if(Xo(S)&&S>0){const T=Math.max(S,b),k=Math.floor(g/b)*b-T;this.flushBackBuffer(g,b,k)}if(Xo(h.frontBufferFlushThreshold)&&h.frontBufferFlushThreshold>0){const T=Math.max(h.maxBufferLength,h.frontBufferFlushThreshold),k=Math.max(T,b),R=Math.floor(g/b)*b+k;this.flushFrontBuffer(g,b,R)}}flushBackBuffer(n,o,i){const{details:u,sourceBuffer:h}=this;this.getSourceBufferTypes().forEach(b=>{const S=h[b];if(S){const T=Xa.getBuffered(S);if(T.length>0&&i>T.start(0)){if(this.hls.trigger(we.BACK_BUFFER_REACHED,{bufferEnd:i}),u!=null&&u.live)this.hls.trigger(we.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(S.ended&&T.end(T.length-1)-n<o*2){this.log(`Cannot flush ${b} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(we.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:b})}}})}flushFrontBuffer(n,o,i){const{sourceBuffer:u}=this;this.getSourceBufferTypes().forEach(g=>{const b=u[g];if(b){const S=Xa.getBuffered(b),T=S.length;if(T<2)return;const k=S.start(T-1),R=S.end(T-1);if(i>k||n>=k&&n<=R)return;if(b.ended&&n-R<2*o){this.log(`Cannot flush ${g} front buffer while SourceBuffer is in ended state`);return}this.hls.trigger(we.BUFFER_FLUSHING,{startOffset:k,endOffset:1/0,type:g})}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;const{details:n,hls:o,media:i,mediaSource:u}=this,h=n.fragments[0].start+n.totalduration,g=i.duration,b=Xo(u.duration)?u.duration:0;n.live&&o.config.liveDurationInfinity?(u.duration=1/0,this.updateSeekableRange(n)):(h>b&&h>g||!Xo(g))&&(this.log(`Updating Media Source duration to ${h.toFixed(3)}`),u.duration=h)}updateSeekableRange(n){const o=this.mediaSource,i=n.fragments;if(i.length&&n.live&&o!=null&&o.setLiveSeekableRange){const h=Math.max(0,i[0].start),g=Math.max(h,h+n.totalduration);this.log(`Media Source duration is set to ${o.duration}. Setting seekable range to ${h}-${g}.`),o.setLiveSeekableRange(h,g)}}checkPendingTracks(){const{bufferCodecEventsExpected:n,operationQueue:o,pendingTracks:i}=this,u=Object.keys(i).length;if(u&&(!n||u===2||"audiovideo"in i)){this.createSourceBuffers(i),this.pendingTracks={};const h=this.getSourceBufferTypes();if(h.length)this.hls.trigger(we.BUFFER_CREATED,{tracks:this.tracks}),h.forEach(g=>{o.executeNext(g)});else{const g=new Error("could not create source buffer for media codec(s)");this.hls.trigger(we.ERROR,{type:Gs.MEDIA_ERROR,details:nn.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:g,reason:g.message})}}}createSourceBuffers(n){const{sourceBuffer:o,mediaSource:i}=this;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(const u in n)if(!o[u]){const h=n[u];if(!h)throw Error(`source buffer exists for track ${u}, however track does not`);let g=h.levelCodec||h.codec;g&&u.slice(0,5)==="audio"&&(g=kB(g,this.appendSource));const b=`${h.container};codecs=${g}`;this.log(`creating sourceBuffer(${b})`);try{const S=o[u]=i.addSourceBuffer(b),T=u;this.addBufferListener(T,"updatestart",this._onSBUpdateStart),this.addBufferListener(T,"updateend",this._onSBUpdateEnd),this.addBufferListener(T,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(T,"bufferedchange",(k,R)=>{const V=R.removedRanges;V!=null&&V.length&&this.hls.trigger(we.BUFFER_FLUSHED,{type:u})}),this.tracks[u]={buffer:S,codec:g,container:h.container,levelCodec:h.levelCodec,metadata:h.metadata,id:h.id}}catch(S){this.error(`error while trying to add sourceBuffer: ${S.message}`),this.hls.trigger(we.ERROR,{type:Gs.MEDIA_ERROR,details:nn.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:S,sourceBufferName:u,mimeType:b})}}}get mediaSrc(){var n;const o=((n=this.media)==null?void 0:n.firstChild)||this.media;return o==null?void 0:o.src}_onSBUpdateStart(n){const{operationQueue:o}=this;o.current(n).onStart()}_onSBUpdateEnd(n){var o;if(((o=this.mediaSource)==null?void 0:o.readyState)==="closed"){this.resetBuffer(n);return}const{operationQueue:i}=this;i.current(n).onComplete(),i.shiftAndExecuteNext(n)}_onSBUpdateError(n,o){var i;const u=new Error(`${n} SourceBuffer error. MediaSource readyState: ${(i=this.mediaSource)==null?void 0:i.readyState}`);this.error(`${u}`,o),this.hls.trigger(we.ERROR,{type:Gs.MEDIA_ERROR,details:nn.BUFFER_APPENDING_ERROR,sourceBufferName:n,error:u,fatal:!1});const h=this.operationQueue.current(n);h&&h.onError(u)}removeExecutor(n,o,i){const{media:u,mediaSource:h,operationQueue:g,sourceBuffer:b}=this,S=b[n];if(!u||!h||!S){this.warn(`Attempting to remove from the ${n} SourceBuffer, but it does not exist`),g.shiftAndExecuteNext(n);return}const T=Xo(u.duration)?u.duration:1/0,k=Xo(h.duration)?h.duration:1/0,R=Math.max(0,o),V=Math.min(i,T,k);V>R&&(!S.ending||S.ended)?(S.ended=!1,this.log(`Removing [${R},${V}] from the ${n} SourceBuffer`),S.remove(R,V)):g.shiftAndExecuteNext(n)}appendExecutor(n,o){const i=this.sourceBuffer[o];if(!i){if(!this.pendingTracks[o])throw new Error(`Attempting to append to the ${o} SourceBuffer, but it does not exist`);return}i.ended=!1,i.appendBuffer(n)}blockBuffers(n,o=this.getSourceBufferTypes()){if(!o.length){this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(n);return}const{operationQueue:i}=this,u=o.map(h=>i.appendBlocker(h));Promise.all(u).then(()=>{n(),o.forEach(h=>{const g=this.sourceBuffer[h];g!=null&&g.updating||i.shiftAndExecuteNext(h)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(n,o,i){const u=this.sourceBuffer[n];if(!u)return;const h=i.bind(this,n);this.listeners[n].push({event:o,listener:h}),u.addEventListener(o,h)}removeBufferListeners(n){const o=this.sourceBuffer[n];o&&this.listeners[n].forEach(i=>{o.removeEventListener(i.event,i.listener)})}}function EK(l){const n=l.querySelectorAll("source");[].slice.call(n).forEach(o=>{l.removeChild(o)})}function vhe(l,n){const o=self.document.createElement("source");o.type="video/mp4",o.src=n,l.appendChild(o)}const CK={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},nY=function(n){let o=n;return CK.hasOwnProperty(n)&&(o=CK[n]),String.fromCharCode(o)},zp=15,Yb=100,xhe={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},yhe={17:2,18:4,21:6,22:8,23:10,19:13,20:15},whe={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},She={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Ehe=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Che{constructor(){this.time=null,this.verboseLevel=0}log(n,o){if(this.verboseLevel>=n){const i=typeof o=="function"?o():o;Mt.log(`${this.time} [${n}] ${i}`)}}}const Yw=function(n){const o=[];for(let i=0;i<n.length;i++)o.push(n[i].toString(16));return o};class oY{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(n){const o=["foreground","underline","italics","background","flash"];for(let i=0;i<o.length;i++){const u=o[i];n.hasOwnProperty(u)&&(this[u]=n[u])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(n){return this.foreground===n.foreground&&this.underline===n.underline&&this.italics===n.italics&&this.background===n.background&&this.flash===n.flash}copy(n){this.foreground=n.foreground,this.underline=n.underline,this.italics=n.italics,this.background=n.background,this.flash=n.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class _he{constructor(){this.uchar=" ",this.penState=new oY}reset(){this.uchar=" ",this.penState.reset()}setChar(n,o){this.uchar=n,this.penState.copy(o)}setPenState(n){this.penState.copy(n)}equals(n){return this.uchar===n.uchar&&this.penState.equals(n.penState)}copy(n){this.uchar=n.uchar,this.penState.copy(n.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class The{constructor(n){this.chars=[],this.pos=0,this.currPenState=new oY,this.cueStartTime=null,this.logger=void 0;for(let o=0;o<Yb;o++)this.chars.push(new _he);this.logger=n}equals(n){for(let o=0;o<Yb;o++)if(!this.chars[o].equals(n.chars[o]))return!1;return!0}copy(n){for(let o=0;o<Yb;o++)this.chars[o].copy(n.chars[o])}isEmpty(){let n=!0;for(let o=0;o<Yb;o++)if(!this.chars[o].isEmpty()){n=!1;break}return n}setCursor(n){this.pos!==n&&(this.pos=n),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>Yb&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Yb)}moveCursor(n){const o=this.pos+n;if(n>1)for(let i=this.pos+1;i<o+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(o)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(n){n>=144&&this.backSpace();const o=nY(n);if(this.pos>=Yb){this.logger.log(0,()=>"Cannot insert "+n.toString(16)+" ("+o+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(o,this.currPenState),this.moveCursor(1)}clearFromPos(n){let o;for(o=n;o<Yb;o++)this.chars[o].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const n=[];let o=!0;for(let i=0;i<Yb;i++){const u=this.chars[i].uchar;u!==" "&&(o=!1),n.push(u)}return o?"":n.join("")}setPenStyles(n){this.currPenState.setStyles(n),this.chars[this.pos].setPenState(this.currPenState)}}class HU{constructor(n){this.rows=[],this.currRow=zp-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let o=0;o<zp;o++)this.rows.push(new The(n));this.logger=n}reset(){for(let n=0;n<zp;n++)this.rows[n].clear();this.currRow=zp-1}equals(n){let o=!0;for(let i=0;i<zp;i++)if(!this.rows[i].equals(n.rows[i])){o=!1;break}return o}copy(n){for(let o=0;o<zp;o++)this.rows[o].copy(n.rows[o])}isEmpty(){let n=!0;for(let o=0;o<zp;o++)if(!this.rows[o].isEmpty()){n=!1;break}return n}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(n){this.rows[this.currRow].insertChar(n)}setPen(n){this.rows[this.currRow].setPenStyles(n)}moveCursor(n){this.rows[this.currRow].moveCursor(n)}setCursor(n){this.logger.log(2,"setCursor: "+n),this.rows[this.currRow].setCursor(n)}setPAC(n){this.logger.log(2,()=>"pacData = "+JSON.stringify(n));let o=n.row-1;if(this.nrRollUpRows&&o<this.nrRollUpRows-1&&(o=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==o){for(let b=0;b<zp;b++)this.rows[b].clear();const h=this.currRow+1-this.nrRollUpRows,g=this.lastOutputScreen;if(g){const b=g.rows[h].cueStartTime,S=this.logger.time;if(b!==null&&S!==null&&b<S)for(let T=0;T<this.nrRollUpRows;T++)this.rows[o-this.nrRollUpRows+T+1].copy(g.rows[h+T])}}this.currRow=o;const i=this.rows[this.currRow];if(n.indent!==null){const h=n.indent,g=Math.max(h-1,0);i.setCursor(n.indent),n.color=i.chars[g].penState.foreground}const u={foreground:n.color,underline:n.underline,italics:n.italics,background:"black",flash:!1};this.setPen(u)}setBkgData(n){this.logger.log(2,()=>"bkgData = "+JSON.stringify(n)),this.backSpace(),this.setPen(n),this.insertChar(32)}setRollUpRows(n){this.nrRollUpRows=n}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const n=this.currRow+1-this.nrRollUpRows,o=this.rows.splice(n,1)[0];o.clear(),this.rows.splice(this.currRow,0,o),this.logger.log(2,"Rolling up")}getDisplayText(n){n=n||!1;const o=[];let i="",u=-1;for(let h=0;h<zp;h++){const g=this.rows[h].getTextString();g&&(u=h+1,n?o.push("Row "+u+": '"+g+"'"):o.push(g.trim()))}return o.length>0&&(n?i="["+o.join(" | ")+"]":i=o.join(`
`)),i}getTextAndFormat(){return this.rows}}class _K{constructor(n,o,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=n,this.outputFilter=o,this.mode=null,this.verbose=0,this.displayedMemory=new HU(i),this.nonDisplayedMemory=new HU(i),this.lastOutputScreen=new HU(i),this.currRollUpRow=this.displayedMemory.rows[zp-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[zp-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(n){this.outputFilter=n}setPAC(n){this.writeScreen.setPAC(n)}setBkgData(n){this.writeScreen.setBkgData(n)}setMode(n){n!==this.mode&&(this.mode=n,this.logger.log(2,()=>"MODE="+n),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=n)}insertChars(n){for(let i=0;i<n.length;i++)this.writeScreen.insertChar(n[i]);const o=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>o+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(n){this.logger.log(2,"RU("+n+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(n)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const n=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=n,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(n){this.logger.log(2,"TO("+n+") - Tab Offset"),this.writeScreen.moveCursor(n)}ccMIDROW(n){const o={flash:!1};if(o.underline=n%2===1,o.italics=n>=46,o.italics)o.foreground="white";else{const i=Math.floor(n/2)-16,u=["white","green","blue","cyan","red","yellow","magenta"];o.foreground=u[i]}this.logger.log(2,"MIDROW: "+JSON.stringify(o)),this.writeScreen.setPen(o)}outputDataUpdate(n=!1){const o=this.logger.time;o!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=o:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,o,this.lastOutputScreen),n&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:o),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(n){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,n,this.displayedMemory),this.cueStartTime=n))}}class TK{constructor(n,o,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=kK(),this.logger=void 0;const u=this.logger=new Che;this.channels=[null,new _K(n,o,u),new _K(n+1,i,u)]}getHandler(n){return this.channels[n].getHandler()}setHandler(n,o){this.channels[n].setHandler(o)}addData(n,o){let i,u,h,g=!1;this.logger.time=n;for(let b=0;b<o.length;b+=2)if(u=o[b]&127,h=o[b+1]&127,!(u===0&&h===0)){if(this.logger.log(3,"["+Yw([o[b],o[b+1]])+"] -> ("+Yw([u,h])+")"),i=this.parseCmd(u,h),i||(i=this.parseMidrow(u,h)),i||(i=this.parsePAC(u,h)),i||(i=this.parseBackgroundAttributes(u,h)),!i&&(g=this.parseChars(u,h),g)){const S=this.currentChannel;S&&S>0?this.channels[S].insertChars(g):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!i&&!g&&this.logger.log(2,"Couldn't parse cleaned data "+Yw([u,h])+" orig: "+Yw([o[b],o[b+1]]))}}parseCmd(n,o){const{cmdHistory:i}=this,u=(n===20||n===28||n===21||n===29)&&o>=32&&o<=47,h=(n===23||n===31)&&o>=33&&o<=35;if(!(u||h))return!1;if(DK(n,o,i))return cT(null,null,i),this.logger.log(3,"Repeated command ("+Yw([n,o])+") is dropped"),!0;const g=n===20||n===21||n===23?1:2,b=this.channels[g];return n===20||n===21||n===28||n===29?o===32?b.ccRCL():o===33?b.ccBS():o===34?b.ccAOF():o===35?b.ccAON():o===36?b.ccDER():o===37?b.ccRU(2):o===38?b.ccRU(3):o===39?b.ccRU(4):o===40?b.ccFON():o===41?b.ccRDC():o===42?b.ccTR():o===43?b.ccRTD():o===44?b.ccEDM():o===45?b.ccCR():o===46?b.ccENM():o===47&&b.ccEOC():b.ccTO(o-32),cT(n,o,i),this.currentChannel=g,!0}parseMidrow(n,o){let i=0;if((n===17||n===25)&&o>=32&&o<=47){if(n===17?i=1:i=2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const u=this.channels[i];return u?(u.ccMIDROW(o),this.logger.log(3,"MIDROW ("+Yw([n,o])+")"),!0):!1}return!1}parsePAC(n,o){let i;const u=this.cmdHistory,h=(n>=17&&n<=23||n>=25&&n<=31)&&o>=64&&o<=127,g=(n===16||n===24)&&o>=64&&o<=95;if(!(h||g))return!1;if(DK(n,o,u))return cT(null,null,u),!0;const b=n<=23?1:2;o>=64&&o<=95?i=b===1?xhe[n]:whe[n]:i=b===1?yhe[n]:She[n];const S=this.channels[b];return S?(S.setPAC(this.interpretPAC(i,o)),cT(n,o,u),this.currentChannel=b,!0):!1}interpretPAC(n,o){let i;const u={color:null,italics:!1,indent:null,underline:!1,row:n};return o>95?i=o-96:i=o-64,u.underline=(i&1)===1,i<=13?u.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(u.italics=!0,u.color="white"):u.indent=Math.floor((i-16)/2)*4,u}parseChars(n,o){let i,u=null,h=null;if(n>=25?(i=2,h=n-8):(i=1,h=n),h>=17&&h<=19){let g;h===17?g=o+80:h===18?g=o+112:g=o+144,this.logger.log(2,"Special char '"+nY(g)+"' in channel "+i),u=[g]}else n>=32&&n<=127&&(u=o===0?[n]:[n,o]);if(u){const g=Yw(u);this.logger.log(3,"Char codes =  "+g.join(",")),cT(n,o,this.cmdHistory)}return u}parseBackgroundAttributes(n,o){const i=(n===16||n===24)&&o>=32&&o<=47,u=(n===23||n===31)&&o>=45&&o<=47;if(!(i||u))return!1;let h;const g={};n===16||n===24?(h=Math.floor((o-32)/2),g.background=Ehe[h],o%2===1&&(g.background=g.background+"_semi")):o===45?g.background="transparent":(g.foreground="black",o===47&&(g.underline=!0));const b=n<=23?1:2;return this.channels[b].setBkgData(g),cT(n,o,this.cmdHistory),!0}reset(){for(let n=0;n<Object.keys(this.channels).length;n++){const o=this.channels[n];o&&o.reset()}this.cmdHistory=kK()}cueSplitAtTime(n){for(let o=0;o<this.channels.length;o++){const i=this.channels[o];i&&i.cueSplitAtTime(n)}}}function cT(l,n,o){o.a=l,o.b=n}function DK(l,n,o){return o.a===l&&o.b===n}function kK(){return{a:null,b:null}}class B4{constructor(n,o){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=n,this.trackName=o}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(n,o,i){(this.startTime===null||this.startTime>n)&&(this.startTime=n),this.endTime=o,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var xz=function(){if(AT!=null&&AT.VTTCue)return self.VTTCue;const l=["","lr","rl"],n=["start","middle","end","left","right"];function o(b,S){if(typeof S!="string"||!Array.isArray(b))return!1;const T=S.toLowerCase();return~b.indexOf(T)?T:!1}function i(b){return o(l,b)}function u(b){return o(n,b)}function h(b,...S){let T=1;for(;T<arguments.length;T++){const k=arguments[T];for(const R in k)b[R]=k[R]}return b}function g(b,S,T){const k=this,R={enumerable:!0};k.hasBeenReset=!1;let V="",z=!1,$=b,W=S,Q=T,j=null,se="",re=!0,Y="auto",me="start",ae=50,Ce="middle",Ue=50,ot="middle";Object.defineProperty(k,"id",h({},R,{get:function(){return V},set:function(Ae){V=""+Ae}})),Object.defineProperty(k,"pauseOnExit",h({},R,{get:function(){return z},set:function(Ae){z=!!Ae}})),Object.defineProperty(k,"startTime",h({},R,{get:function(){return $},set:function(Ae){if(typeof Ae!="number")throw new TypeError("Start time must be set to a number.");$=Ae,this.hasBeenReset=!0}})),Object.defineProperty(k,"endTime",h({},R,{get:function(){return W},set:function(Ae){if(typeof Ae!="number")throw new TypeError("End time must be set to a number.");W=Ae,this.hasBeenReset=!0}})),Object.defineProperty(k,"text",h({},R,{get:function(){return Q},set:function(Ae){Q=""+Ae,this.hasBeenReset=!0}})),Object.defineProperty(k,"region",h({},R,{get:function(){return j},set:function(Ae){j=Ae,this.hasBeenReset=!0}})),Object.defineProperty(k,"vertical",h({},R,{get:function(){return se},set:function(Ae){const ve=i(Ae);if(ve===!1)throw new SyntaxError("An invalid or illegal string was specified.");se=ve,this.hasBeenReset=!0}})),Object.defineProperty(k,"snapToLines",h({},R,{get:function(){return re},set:function(Ae){re=!!Ae,this.hasBeenReset=!0}})),Object.defineProperty(k,"line",h({},R,{get:function(){return Y},set:function(Ae){if(typeof Ae!="number"&&Ae!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");Y=Ae,this.hasBeenReset=!0}})),Object.defineProperty(k,"lineAlign",h({},R,{get:function(){return me},set:function(Ae){const ve=u(Ae);if(!ve)throw new SyntaxError("An invalid or illegal string was specified.");me=ve,this.hasBeenReset=!0}})),Object.defineProperty(k,"position",h({},R,{get:function(){return ae},set:function(Ae){if(Ae<0||Ae>100)throw new Error("Position must be between 0 and 100.");ae=Ae,this.hasBeenReset=!0}})),Object.defineProperty(k,"positionAlign",h({},R,{get:function(){return Ce},set:function(Ae){const ve=u(Ae);if(!ve)throw new SyntaxError("An invalid or illegal string was specified.");Ce=ve,this.hasBeenReset=!0}})),Object.defineProperty(k,"size",h({},R,{get:function(){return Ue},set:function(Ae){if(Ae<0||Ae>100)throw new Error("Size must be between 0 and 100.");Ue=Ae,this.hasBeenReset=!0}})),Object.defineProperty(k,"align",h({},R,{get:function(){return ot},set:function(Ae){const ve=u(Ae);if(!ve)throw new SyntaxError("An invalid or illegal string was specified.");ot=ve,this.hasBeenReset=!0}})),k.displayState=void 0}return g.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},g}();class Dhe{decode(n,o){if(!n)return"";if(typeof n!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(n))}}function sY(l){function n(i,u,h,g){return(i|0)*3600+(u|0)*60+(h|0)+parseFloat(g||0)}const o=l.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return o?parseFloat(o[2])>59?n(o[2],o[3],0,o[4]):n(o[1],o[2],o[3],o[4]):null}class khe{constructor(){this.values=Object.create(null)}set(n,o){!this.get(n)&&o!==""&&(this.values[n]=o)}get(n,o,i){return i?this.has(n)?this.values[n]:o[i]:this.has(n)?this.values[n]:o}has(n){return n in this.values}alt(n,o,i){for(let u=0;u<i.length;++u)if(o===i[u]){this.set(n,o);break}}integer(n,o){/^-?\d+$/.test(o)&&this.set(n,parseInt(o,10))}percent(n,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){const i=parseFloat(o);if(i>=0&&i<=100)return this.set(n,i),!0}return!1}}function rY(l,n,o,i){const u=i?l.split(i):[l];for(const h in u){if(typeof u[h]!="string")continue;const g=u[h].split(o);if(g.length!==2)continue;const b=g[0],S=g[1];n(b,S)}}const PV=new xz(0,0,""),$4=PV.align==="middle"?"middle":"center";function Ahe(l,n,o){const i=l;function u(){const b=sY(l);if(b===null)throw new Error("Malformed timestamp: "+i);return l=l.replace(/^[^\sa-zA-Z-]+/,""),b}function h(b,S){const T=new khe;rY(b,function(V,z){let $;switch(V){case"region":for(let W=o.length-1;W>=0;W--)if(o[W].id===z){T.set(V,o[W].region);break}break;case"vertical":T.alt(V,z,["rl","lr"]);break;case"line":$=z.split(","),T.integer(V,$[0]),T.percent(V,$[0])&&T.set("snapToLines",!1),T.alt(V,$[0],["auto"]),$.length===2&&T.alt("lineAlign",$[1],["start",$4,"end"]);break;case"position":$=z.split(","),T.percent(V,$[0]),$.length===2&&T.alt("positionAlign",$[1],["start",$4,"end","line-left","line-right","auto"]);break;case"size":T.percent(V,z);break;case"align":T.alt(V,z,["start",$4,"end","left","right"]);break}},/:/,/\s/),S.region=T.get("region",null),S.vertical=T.get("vertical","");let k=T.get("line","auto");k==="auto"&&PV.line===-1&&(k=-1),S.line=k,S.lineAlign=T.get("lineAlign","start"),S.snapToLines=T.get("snapToLines",!0),S.size=T.get("size",100),S.align=T.get("align",$4);let R=T.get("position","auto");R==="auto"&&PV.position===50&&(R=S.align==="start"||S.align==="left"?0:S.align==="end"||S.align==="right"?100:50),S.position=R}function g(){l=l.replace(/^\s+/,"")}if(g(),n.startTime=u(),g(),l.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);l=l.slice(3),g(),n.endTime=u(),g(),h(l,n)}function iY(l){return l.replace(/<br(?: \/)?>/gi,`
`)}class Lhe{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Dhe,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(n){const o=this;n&&(o.buffer+=o.decoder.decode(n,{stream:!0}));function i(){let h=o.buffer,g=0;for(h=iY(h);g<h.length&&h[g]!=="\r"&&h[g]!==`
`;)++g;const b=h.slice(0,g);return h[g]==="\r"&&++g,h[g]===`
`&&++g,o.buffer=h.slice(g),b}function u(h){rY(h,function(g,b){},/:/)}try{let h="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;h=i();const b=h.match(/^(ï»¿)?WEBVTT([ \t].*)?$/);if(!(b!=null&&b[0]))throw new Error("Malformed WebVTT signature.");o.state="HEADER"}let g=!1;for(;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;switch(g?g=!1:h=i(),o.state){case"HEADER":/:/.test(h)?u(h):h||(o.state="ID");continue;case"NOTE":h||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(h)){o.state="NOTE";break}if(!h)continue;if(o.cue=new xz(0,0,""),o.state="CUE",h.indexOf("-->")===-1){o.cue.id=h;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{Ahe(h,o.cue,o.regionList)}catch{o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{const b=h.indexOf("-->")!==-1;if(!h||b&&(g=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
`),o.cue.text+=h}continue;case"BADCUE":h||(o.state="ID")}}}catch{o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const n=this;try{if((n.cue||n.state==="HEADER")&&(n.buffer+=`

`,n.parse()),n.state==="INITIAL"||n.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){n.onparsingerror&&n.onparsingerror(o)}return n.onflush&&n.onflush(),this}}const Rhe=/\r\n|\n\r|\n|\r/g,UU=function(n,o,i=0){return n.slice(i,i+o.length)===o},Ohe=function(n){let o=parseInt(n.slice(-3));const i=parseInt(n.slice(-6,-4)),u=parseInt(n.slice(-9,-7)),h=n.length>9?parseInt(n.substring(0,n.indexOf(":"))):0;if(!Xo(o)||!Xo(i)||!Xo(u)||!Xo(h))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${n}`);return o+=1e3*i,o+=60*1e3*u,o+=60*60*1e3*h,o},VU=function(n){let o=5381,i=n.length;for(;i;)o=o*33^n.charCodeAt(--i);return(o>>>0).toString()};function yz(l,n,o){return VU(l.toString())+VU(n.toString())+VU(o)}const Ihe=function(n,o,i){let u=n[o],h=n[u.prevCC];if(!h||!h.new&&u.new){n.ccOffset=n.presentationOffset=u.start,u.new=!1;return}for(;(g=h)!=null&&g.new;){var g;n.ccOffset+=u.start-h.start,u.new=!1,u=h,h=n[u.prevCC]}n.presentationOffset=i};function Phe(l,n,o,i,u,h,g){const b=new Lhe,S=y0(new Uint8Array(l)).trim().replace(Rhe,`
`).split(`
`),T=[],k=n?ehe(n.baseTime,n.timescale):0;let R="00:00.000",V=0,z=0,$,W=!0;b.oncue=function(Q){const j=o[i];let se=o.ccOffset;const re=(V-k)/9e4;if(j!=null&&j.new&&(z!==void 0?se=o.ccOffset=j.start:Ihe(o,i,re)),re){if(!n){$=new Error("Missing initPTS for VTT MPEGTS");return}se=re-o.presentationOffset}const Y=Q.endTime-Q.startTime,me=Om((Q.startTime+se-z)*9e4,u*9e4)/9e4;Q.startTime=Math.max(me,0),Q.endTime=Math.max(me+Y,0);const ae=Q.text.trim();Q.text=decodeURIComponent(encodeURIComponent(ae)),Q.id||(Q.id=yz(Q.startTime,Q.endTime,ae)),Q.endTime>0&&T.push(Q)},b.onparsingerror=function(Q){$=Q},b.onflush=function(){if($){g($);return}h(T)},S.forEach(Q=>{if(W)if(UU(Q,"X-TIMESTAMP-MAP=")){W=!1,Q.slice(16).split(",").forEach(j=>{UU(j,"LOCAL:")?R=j.slice(6):UU(j,"MPEGTS:")&&(V=parseInt(j.slice(7)))});try{z=Ohe(R)/1e3}catch(j){$=j}return}else Q===""&&(W=!1);b.parse(Q+`
`)}),b.flush()}const zU="stpp.ttml.im1t",aY=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,lY=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Mhe={left:"start",center:"center",right:"end",start:"start",end:"end"};function AK(l,n,o,i){const u=Dr(new Uint8Array(l),["mdat"]);if(u.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const h=u.map(b=>y0(b)),g=Qfe(n.baseTime,1,n.timescale);try{h.forEach(b=>o(Nhe(b,g)))}catch(b){i(b)}}function Nhe(l,n){const u=new DOMParser().parseFromString(l,"text/xml").getElementsByTagName("tt")[0];if(!u)throw new Error("Invalid ttml");const h={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},g=Object.keys(h).reduce((R,V)=>(R[V]=u.getAttribute(`ttp:${V}`)||h[V],R),{}),b=u.getAttribute("xml:space")!=="preserve",S=LK(GU(u,"styling","style")),T=LK(GU(u,"layout","region")),k=GU(u,"body","[begin]");return[].map.call(k,R=>{const V=cY(R,b);if(!V||!R.hasAttribute("begin"))return null;const z=jU(R.getAttribute("begin"),g),$=jU(R.getAttribute("dur"),g);let W=jU(R.getAttribute("end"),g);if(z===null)throw RK(R);if(W===null){if($===null)throw RK(R);W=z+$}const Q=new xz(z-n,W-n,V);Q.id=yz(Q.startTime,Q.endTime,Q.text);const j=T[R.getAttribute("region")],se=S[R.getAttribute("style")],re=Fhe(j,se,S),{textAlign:Y}=re;if(Y){const me=Mhe[Y];me&&(Q.lineAlign=me),Q.align=Y}return Ic(Q,re),Q}).filter(R=>R!==null)}function GU(l,n,o){const i=l.getElementsByTagName(n)[0];return i?[].slice.call(i.querySelectorAll(o)):[]}function LK(l){return l.reduce((n,o)=>{const i=o.getAttribute("xml:id");return i&&(n[i]=o),n},{})}function cY(l,n){return[].slice.call(l.childNodes).reduce((o,i,u)=>{var h;return i.nodeName==="br"&&u?o+`
`:(h=i.childNodes)!=null&&h.length?cY(i,n):n?o+i.textContent.trim().replace(/\s+/g," "):o+i.textContent},"")}function Fhe(l,n,o){const i="http://www.w3.org/ns/ttml#styling";let u=null;const h=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],g=l!=null&&l.hasAttribute("style")?l.getAttribute("style"):null;return g&&o.hasOwnProperty(g)&&(u=o[g]),h.reduce((b,S)=>{const T=WU(n,i,S)||WU(l,i,S)||WU(u,i,S);return T&&(b[S]=T),b},{})}function WU(l,n,o){return l&&l.hasAttributeNS(n,o)?l.getAttributeNS(n,o):null}function RK(l){return new Error(`Could not parse ttml timestamp ${l}`)}function jU(l,n){if(!l)return null;let o=sY(l);return o===null&&(aY.test(l)?o=Bhe(l,n):lY.test(l)&&(o=$he(l,n))),o}function Bhe(l,n){const o=aY.exec(l),i=(o[4]|0)+(o[5]|0)/n.subFrameRate;return(o[1]|0)*3600+(o[2]|0)*60+(o[3]|0)+i/n.frameRate}function $he(l,n){const o=lY.exec(l),i=Number(o[1]);switch(o[2]){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/n.frameRate;case"t":return i/n.tickRate}return i}class Hhe{constructor(n){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=IK(),this.captionsProperties=void 0,this.hls=n,this.config=n.config,this.Cues=n.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},n.on(we.MEDIA_ATTACHING,this.onMediaAttaching,this),n.on(we.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(we.MANIFEST_LOADING,this.onManifestLoading,this),n.on(we.MANIFEST_LOADED,this.onManifestLoaded,this),n.on(we.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),n.on(we.FRAG_LOADING,this.onFragLoading,this),n.on(we.FRAG_LOADED,this.onFragLoaded,this),n.on(we.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),n.on(we.FRAG_DECRYPTED,this.onFragDecrypted,this),n.on(we.INIT_PTS_FOUND,this.onInitPtsFound,this),n.on(we.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),n.on(we.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:n}=this;n.off(we.MEDIA_ATTACHING,this.onMediaAttaching,this),n.off(we.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(we.MANIFEST_LOADING,this.onManifestLoading,this),n.off(we.MANIFEST_LOADED,this.onManifestLoaded,this),n.off(we.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),n.off(we.FRAG_LOADING,this.onFragLoading,this),n.off(we.FRAG_LOADED,this.onFragLoaded,this),n.off(we.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),n.off(we.FRAG_DECRYPTED,this.onFragDecrypted,this),n.off(we.INIT_PTS_FOUND,this.onInitPtsFound,this),n.off(we.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),n.off(we.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const n=new B4(this,"textTrack1"),o=new B4(this,"textTrack2"),i=new B4(this,"textTrack3"),u=new B4(this,"textTrack4");this.cea608Parser1=new TK(1,n,o),this.cea608Parser2=new TK(3,i,u)}}addCues(n,o,i,u,h){let g=!1;for(let b=h.length;b--;){const S=h[b],T=Uhe(S[0],S[1],o,i);if(T>=0&&(S[0]=Math.min(S[0],o),S[1]=Math.max(S[1],i),g=!0,T/(i-o)>.5))return}if(g||h.push([o,i]),this.config.renderTextTracksNatively){const b=this.captionsTracks[n];this.Cues.newCue(b,o,i,u)}else{const b=this.Cues.newCue(null,o,i,u);this.hls.trigger(we.CUES_PARSED,{type:"captions",cues:b,track:n})}}onInitPtsFound(n,{frag:o,id:i,initPTS:u,timescale:h}){const{unparsedVttFrags:g}=this;i==="main"&&(this.initPTS[o.cc]={baseTime:u,timescale:h}),g.length&&(this.unparsedVttFrags=[],g.forEach(b=>{this.onFragLoaded(we.FRAG_LOADED,b)}))}getExistingTrack(n,o){const{media:i}=this;if(i)for(let u=0;u<i.textTracks.length;u++){const h=i.textTracks[u];if(OK(h,{name:n,lang:o,attrs:{}}))return h}return null}createCaptionsTrack(n){this.config.renderTextTracksNatively?this.createNativeTrack(n):this.createNonNativeTrack(n)}createNativeTrack(n){if(this.captionsTracks[n])return;const{captionsProperties:o,captionsTracks:i,media:u}=this,{label:h,languageCode:g}=o[n],b=this.getExistingTrack(h,g);if(b)i[n]=b,xT(i[n]),Aq(i[n],u);else{const S=this.createTextTrack("captions",h,g);S&&(S[n]=!0,i[n]=S)}}createNonNativeTrack(n){if(this.nonNativeCaptionsTracks[n])return;const o=this.captionsProperties[n];if(!o)return;const i=o.label,u={_id:n,label:i,kind:"captions",default:o.media?!!o.media.default:!1,closedCaptions:o.media};this.nonNativeCaptionsTracks[n]=u,this.hls.trigger(we.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[u]})}createTextTrack(n,o,i){const u=this.media;if(u)return u.addTextTrack(n,o,i)}onMediaAttaching(n,o){this.media=o.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:n}=this;Object.keys(n).forEach(o=>{xT(n[o]),delete n[o]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=IK(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:n}=this;if(!n)return;const o=n.textTracks;if(o)for(let i=0;i<o.length;i++)xT(o[i])}onSubtitleTracksUpdated(n,o){const i=o.subtitleTracks||[],u=i.some(h=>h.textCodec===zU);if(this.config.enableWebVTT||u&&this.config.enableIMSC1){if(tY(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const g=this.media,b=g?oB(g.textTracks):null;if(this.tracks.forEach((S,T)=>{let k;if(b){let R=null;for(let V=0;V<b.length;V++)if(b[V]&&OK(b[V],S)){R=b[V],b[V]=null;break}R&&(k=R)}if(k)xT(k);else{const R=uY(S);k=this.createTextTrack(R,S.name,S.lang),k&&(k.mode="disabled")}k&&this.textTracks.push(k)}),b!=null&&b.length){const S=b.filter(T=>T!==null).map(T=>T.label);S.length&&Mt.warn(`Media element contains unused subtitle tracks: ${S.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const g=this.tracks.map(b=>({label:b.name,kind:b.type.toLowerCase(),default:b.default,subtitleTrack:b}));this.hls.trigger(we.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:g})}}}onManifestLoaded(n,o){this.config.enableCEA708Captions&&o.captions&&o.captions.forEach(i=>{const u=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!u)return;const h=`textTrack${u[1]}`,g=this.captionsProperties[h];g&&(g.label=i.name,i.lang&&(g.languageCode=i.lang),g.media=i)})}closedCaptionsForLevel(n){const o=this.hls.levels[n.level];return o==null?void 0:o.attrs["CLOSED-CAPTIONS"]}onFragLoading(n,o){this.initCea608Parsers();const{cea608Parser1:i,cea608Parser2:u,lastCc:h,lastSn:g,lastPartIndex:b}=this;if(!(!this.enabled||!i||!u)&&o.frag.type===Us.MAIN){var S,T;const{cc:k,sn:R}=o.frag,V=(S=o==null||(T=o.part)==null?void 0:T.index)!=null?S:-1;R===g+1||R===g&&V===b+1||k===h||(i.reset(),u.reset()),this.lastCc=k,this.lastSn=R,this.lastPartIndex=V}}onFragLoaded(n,o){const{frag:i,payload:u}=o;if(i.type===Us.SUBTITLE)if(u.byteLength){const h=i.decryptdata,g="stats"in o;if(h==null||!h.encrypted||g){const b=this.tracks[i.level],S=this.vttCCs;S[i.cc]||(S[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),b&&b.textCodec===zU?this._parseIMSC1(i,u):this._parseVTTs(o)}}else this.hls.trigger(we.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(n,o){const i=this.hls;AK(o,this.initPTS[n.cc],u=>{this._appendCues(u,n.level),i.trigger(we.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},u=>{Mt.log(`Failed to parse IMSC1: ${u}`),i.trigger(we.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:u})})}_parseVTTs(n){var o;const{frag:i,payload:u}=n,{initPTS:h,unparsedVttFrags:g}=this,b=h.length-1;if(!h[i.cc]&&b===-1){g.push(n);return}const S=this.hls,T=(o=i.initSegment)!=null&&o.data?Mm(i.initSegment.data,new Uint8Array(u)):u;Phe(T,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,k=>{this._appendCues(k,i.level),S.trigger(we.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},k=>{const R=k.message==="Missing initPTS for VTT MPEGTS";R?g.push(n):this._fallbackToIMSC1(i,u),Mt.log(`Failed to parse VTT cue: ${k}`),!(R&&b>i.cc)&&S.trigger(we.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:k})})}_fallbackToIMSC1(n,o){const i=this.tracks[n.level];i.textCodec||AK(o,this.initPTS[n.cc],()=>{i.textCodec=zU,this._parseIMSC1(n,o)},()=>{i.textCodec="wvtt"})}_appendCues(n,o){const i=this.hls;if(this.config.renderTextTracksNatively){const u=this.textTracks[o];if(!u||u.mode==="disabled")return;n.forEach(h=>Lq(u,h))}else{const u=this.tracks[o];if(!u)return;const h=u.default?"default":"subtitles"+o;i.trigger(we.CUES_PARSED,{type:"subtitles",cues:n,track:h})}}onFragDecrypted(n,o){const{frag:i}=o;i.type===Us.SUBTITLE&&this.onFragLoaded(we.FRAG_LOADED,o)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(n,o){this.initCea608Parsers();const{cea608Parser1:i,cea608Parser2:u}=this;if(!this.enabled||!i||!u)return;const{frag:h,samples:g}=o;if(!(h.type===Us.MAIN&&this.closedCaptionsForLevel(h)==="NONE"))for(let b=0;b<g.length;b++){const S=g[b].bytes;if(S){const T=this.extractCea608Data(S);i.addData(g[b].pts,T[0]),u.addData(g[b].pts,T[1])}}}onBufferFlushing(n,{startOffset:o,endOffset:i,endOffsetSubtitles:u,type:h}){const{media:g}=this;if(!(!g||g.currentTime<i)){if(!h||h==="video"){const{captionsTracks:b}=this;Object.keys(b).forEach(S=>DV(b[S],o,i))}if(this.config.renderTextTracksNatively&&o===0&&u!==void 0){const{textTracks:b}=this;Object.keys(b).forEach(S=>DV(b[S],o,u))}}}extractCea608Data(n){const o=[[],[]],i=n[0]&31;let u=2;for(let h=0;h<i;h++){const g=n[u++],b=127&n[u++],S=127&n[u++];if(b===0&&S===0)continue;if((4&g)!==0){const k=3&g;(k===0||k===1)&&(o[k].push(b),o[k].push(S))}}return o}}function uY(l){return l.characteristics&&/transcribes-spoken-dialog/gi.test(l.characteristics)&&/describes-music-and-sound/gi.test(l.characteristics)?"captions":"subtitles"}function OK(l,n){return!!l&&l.kind===uY(n)&&IV(n,l)}function Uhe(l,n,o,i){return Math.min(n,i)-Math.max(l,o)}function IK(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class wz{constructor(n){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=n,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(n){this.streamController=n}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:n}=this;n.on(we.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),n.on(we.MEDIA_ATTACHING,this.onMediaAttaching,this),n.on(we.MANIFEST_PARSED,this.onManifestParsed,this),n.on(we.LEVELS_UPDATED,this.onLevelsUpdated,this),n.on(we.BUFFER_CODECS,this.onBufferCodecs,this),n.on(we.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:n}=this;n.off(we.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),n.off(we.MEDIA_ATTACHING,this.onMediaAttaching,this),n.off(we.MANIFEST_PARSED,this.onManifestParsed,this),n.off(we.LEVELS_UPDATED,this.onLevelsUpdated,this),n.off(we.BUFFER_CODECS,this.onBufferCodecs,this),n.off(we.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(n,o){const i=this.hls.levels[o.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(n,o){this.media=o.media instanceof HTMLVideoElement?o.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(n,o){const i=this.hls;this.restrictedLevels=[],this.firstLevel=o.firstLevel,i.config.capLevelToPlayerSize&&o.video&&this.startCapping()}onLevelsUpdated(n,o){this.timer&&Xo(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(n,o){this.hls.config.capLevelToPlayerSize&&o.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const n=this.hls.levels;if(n.length){const o=this.hls,i=this.getMaxLevel(n.length-1);i!==this.autoLevelCapping&&Mt.log(`Setting autoLevelCapping to ${i}: ${n[i].height}p@${n[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),o.autoLevelCapping=i,o.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=o.autoLevelCapping}}}getMaxLevel(n){const o=this.hls.levels;if(!o.length)return-1;const i=o.filter((u,h)=>this.isLevelAllowed(u)&&h<=n);return this.clientRect=null,wz.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const n=this.media,o={width:0,height:0};if(n){const i=n.getBoundingClientRect();o.width=i.width,o.height=i.height,!o.width&&!o.height&&(o.width=i.right-i.left||n.width||0,o.height=i.bottom-i.top||n.height||0)}return this.clientRect=o,o}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let n=1;if(!this.hls.config.ignoreDevicePixelRatio)try{n=self.devicePixelRatio}catch{}return n}isLevelAllowed(n){return!this.restrictedLevels.some(i=>n.bitrate===i.bitrate&&n.width===i.width&&n.height===i.height)}static getMaxLevelByMediaSize(n,o,i){if(!(n!=null&&n.length))return-1;const u=(b,S)=>S?b.width!==S.width||b.height!==S.height:!0;let h=n.length-1;const g=Math.max(o,i);for(let b=0;b<n.length;b+=1){const S=n[b];if((S.width>=g||S.height>=g)&&u(S,n[b+1])){h=b;break}}return h}}class Vhe{constructor(n){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=n,this.registerListeners()}setStreamController(n){this.streamController=n}registerListeners(){this.hls.on(we.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(we.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(n,o){const i=this.hls.config;if(i.capLevelOnFPSDrop){const u=o.media instanceof self.HTMLVideoElement?o.media:null;this.media=u,u&&typeof u.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}checkFPS(n,o,i){const u=performance.now();if(o){if(this.lastTime){const h=u-this.lastTime,g=i-this.lastDroppedFrames,b=o-this.lastDecodedFrames,S=1e3*g/h,T=this.hls;if(T.trigger(we.FPS_DROP,{currentDropped:g,currentDecoded:b,totalDroppedFrames:i}),S>0&&g>T.config.fpsDroppedMonitoringThreshold*b){let k=T.currentLevel;Mt.warn("drop FPS ratio greater than max allowed value for currentLevel: "+k),k>0&&(T.autoLevelCapping===-1||T.autoLevelCapping>=k)&&(k=k-1,T.trigger(we.FPS_DROP_LEVEL_CAPPING,{level:k,droppedLevel:T.currentLevel}),T.autoLevelCapping=k,this.streamController.nextLevelSwitch())}}this.lastTime=u,this.lastDroppedFrames=i,this.lastDecodedFrames=o}}checkFPSInterval(){const n=this.media;if(n)if(this.isVideoPlaybackQualityAvailable){const o=n.getVideoPlaybackQuality();this.checkFPS(n,o.totalVideoFrames,o.droppedVideoFrames)}else this.checkFPS(n,n.webkitDecodedFrameCount,n.webkitDroppedFrameCount)}}const H4="[eme]";class TT{constructor(n){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=TT.CDMCleanupPromise?[TT.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=Mt.debug.bind(Mt,H4),this.log=Mt.log.bind(Mt,H4),this.warn=Mt.warn.bind(Mt,H4),this.error=Mt.error.bind(Mt,H4),this.hls=n,this.config=n.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const n=this.config;n.requestMediaKeySystemAccessFunc=null,n.licenseXhrSetup=n.licenseResponseCallback=void 0,n.drmSystems=n.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(we.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(we.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(we.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(we.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(we.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(we.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(we.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(we.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(n){const{drmSystems:o,widevineLicenseUrl:i}=this.config,u=o[n];if(u)return u.licenseUrl;if(n===wl.WIDEVINE&&i)return i;throw new Error(`no license server URL configured for key-system "${n}"`)}getServerCertificateUrl(n){const{drmSystems:o}=this.config,i=o[n];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${n}"]`)}attemptKeySystemAccess(n){const o=this.hls.levels,i=(g,b,S)=>!!g&&S.indexOf(g)===b,u=o.map(g=>g.audioCodec).filter(i),h=o.map(g=>g.videoCodec).filter(i);return u.length+h.length===0&&h.push("avc1.42e01e"),new Promise((g,b)=>{const S=T=>{const k=T.shift();this.getMediaKeysPromise(k,u,h).then(R=>g({keySystem:k,mediaKeys:R})).catch(R=>{T.length?S(T):R instanceof Dm?b(R):b(new Dm({type:Gs.KEY_SYSTEM_ERROR,details:nn.KEY_SYSTEM_NO_ACCESS,error:R,fatal:!0},R.message))})};S(n)})}requestMediaKeySystemAccess(n,o){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let u=`Configured requestMediaKeySystemAccess is not a function ${i}`;return gq===null&&self.location.protocol==="http:"&&(u=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(u))}return i(n,o)}getMediaKeysPromise(n,o,i){const u=Que(n,o,i,this.config.drmSystemOptions),h=this.keySystemAccessPromises[n];let g=h==null?void 0:h.keySystemAccess;if(!g){this.log(`Requesting encrypted media "${n}" key-system access with config: ${JSON.stringify(u)}`),g=this.requestMediaKeySystemAccess(n,u);const b=this.keySystemAccessPromises[n]={keySystemAccess:g};return g.catch(S=>{this.log(`Failed to obtain access to key-system "${n}": ${S}`)}),g.then(S=>{this.log(`Access for key-system "${S.keySystem}" obtained`);const T=this.fetchServerCertificate(n);return this.log(`Create media-keys for "${n}"`),b.mediaKeys=S.createMediaKeys().then(k=>(this.log(`Media-keys created for "${n}"`),T.then(R=>R?this.setMediaKeysServerCertificate(k,n,R):k))),b.mediaKeys.catch(k=>{this.error(`Failed to create media-keys for "${n}"}: ${k}`)}),b.mediaKeys})}return g.then(()=>h.mediaKeys)}createMediaKeySessionContext({decryptdata:n,keySystem:o,mediaKeys:i}){this.log(`Creating key-system session "${o}" keyId: ${d0.hexDump(n.keyId||[])}`);const u=i.createSession(),h={decryptdata:n,keySystem:o,mediaKeys:i,mediaKeysSession:u,keyStatus:"status-pending"};return this.mediaKeySessions.push(h),h}renewKeySession(n){const o=n.decryptdata;if(o.pssh){const i=this.createMediaKeySessionContext(n),u=this.getKeyIdString(o),h="cenc";this.keyIdToKeySessionPromise[u]=this.generateRequestWithPreferredKeySession(i,h,o.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(n)}getKeyIdString(n){if(!n)throw new Error("Could not read keyId of undefined decryptdata");if(n.keyId===null)throw new Error("keyId is null");return d0.hexDump(n.keyId)}updateKeySession(n,o){var i;const u=n.mediaKeysSession;return this.log(`Updating key-session "${u.sessionId}" for keyID ${d0.hexDump(((i=n.decryptdata)==null?void 0:i.keyId)||[])}
      } (data length: ${o&&o.byteLength})`),u.update(o)}selectKeySystemFormat(n){const o=Object.keys(n.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${n.sn} ${n.type}: ${n.level}) key formats ${o.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(o)),this.keyFormatPromise}getKeyFormatPromise(n){return new Promise((o,i)=>{const u=kU(this.config),h=n.map(Bj).filter(g=>!!g&&u.indexOf(g)!==-1);return this.getKeySystemSelectionPromise(h).then(({keySystem:g})=>{const b=$j(g);b?o(b):i(new Error(`Unable to find format for key-system "${g}"`))}).catch(i)})}loadKey(n){const o=n.keyInfo.decryptdata,i=this.getKeyIdString(o),u=`(keyId: ${i} format: "${o.keyFormat}" method: ${o.method} uri: ${o.uri})`;this.log(`Starting session for key ${u}`);let h=this.keyIdToKeySessionPromise[i];return h||(h=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(o).then(({keySystem:g,mediaKeys:b})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${n.frag.sn} ${n.frag.type}: ${n.frag.level} using key ${u}`),this.attemptSetMediaKeys(g,b).then(()=>{this.throwIfDestroyed();const S=this.createMediaKeySessionContext({keySystem:g,mediaKeys:b,decryptdata:o});return this.generateRequestWithPreferredKeySession(S,"cenc",o.pssh,"playlist-key")}))),h.catch(g=>this.handleError(g))),h}throwIfDestroyed(n="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(n){this.hls&&(this.error(n.message),n instanceof Dm?this.hls.trigger(we.ERROR,n.data):this.hls.trigger(we.ERROR,{type:Gs.KEY_SYSTEM_ERROR,details:nn.KEY_SYSTEM_NO_KEYS,error:n,fatal:!0}))}getKeySystemForKeyPromise(n){const o=this.getKeyIdString(n),i=this.keyIdToKeySessionPromise[o];if(!i){const u=Bj(n.keyFormat),h=u?[u]:kU(this.config);return this.attemptKeySystemAccess(h)}return i}getKeySystemSelectionPromise(n){if(n.length||(n=kU(this.config)),n.length===0)throw new Dm({type:Gs.KEY_SYSTEM_ERROR,details:nn.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(n)}_onMediaEncrypted(n){const{initDataType:o,initData:i}=n;if(this.debug(`"${n.type}" event: init data type: "${o}"`),i===null)return;let u,h;if(o==="sinf"&&this.config.drmSystems[wl.FAIRPLAY]){const k=Xc(new Uint8Array(i));try{const R=iz(JSON.parse(k).sinf),V=Cq(new Uint8Array(R));if(!V)return;u=V.subarray(8,24),h=wl.FAIRPLAY}catch{this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{const k=Cde(i);if(k===null)return;k.version===0&&k.systemId===pq.WIDEVINE&&k.data&&(u=k.data.subarray(8,24)),h=Jue(k.systemId)}if(!h||!u)return;const g=d0.hexDump(u),{keyIdToKeySessionPromise:b,mediaKeySessions:S}=this;let T=b[g];for(let k=0;k<S.length;k++){const R=S[k],V=R.decryptdata;if(V.pssh||!V.keyId)continue;const z=d0.hexDump(V.keyId);if(g===z||V.uri.replace(/-/g,"").indexOf(g)!==-1){T=b[z],delete b[z],V.pssh=new Uint8Array(i),V.keyId=u,T=b[g]=T.then(()=>this.generateRequestWithPreferredKeySession(R,o,i,"encrypted-event-key-match"));break}}T||(T=b[g]=this.getKeySystemSelectionPromise([h]).then(({keySystem:k,mediaKeys:R})=>{var V;this.throwIfDestroyed();const z=new cR("ISO-23001-7",g,(V=$j(k))!=null?V:"");return z.pssh=new Uint8Array(i),z.keyId=u,this.attemptSetMediaKeys(k,R).then(()=>{this.throwIfDestroyed();const $=this.createMediaKeySessionContext({decryptdata:z,keySystem:k,mediaKeys:R});return this.generateRequestWithPreferredKeySession($,o,i,"encrypted-event-no-match")})})),T.catch(k=>this.handleError(k))}_onWaitingForKey(n){this.log(`"${n.type}" event`)}attemptSetMediaKeys(n,o){const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${n}"`);const u=Promise.all(i).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(o)});return this.setMediaKeysQueue.push(u),u.then(()=>{this.log(`Media-keys set for "${n}"`),i.push(u),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(h=>i.indexOf(h)===-1)})}generateRequestWithPreferredKeySession(n,o,i,u){var h,g;const b=(h=this.config.drmSystems)==null||(g=h[n.keySystem])==null?void 0:g.generateRequest;if(b)try{const $=b.call(this.hls,o,i,n);if(!$)throw new Error("Invalid response from configured generateRequest filter");o=$.initDataType,i=n.decryptdata.pssh=$.initData?new Uint8Array($.initData):null}catch($){var S;if(this.warn($.message),(S=this.hls)!=null&&S.config.debug)throw $}if(i===null)return this.log(`Skipping key-session request for "${u}" (no initData)`),Promise.resolve(n);const T=this.getKeyIdString(n.decryptdata);this.log(`Generating key-session request for "${u}": ${T} (init data type: ${o} length: ${i?i.byteLength:null})`);const k=new vz,R=n._onmessage=$=>{const W=n.mediaKeysSession;if(!W){k.emit("error",new Error("invalid state"));return}const{messageType:Q,message:j}=$;this.log(`"${Q}" message event for session "${W.sessionId}" message size: ${j.byteLength}`),Q==="license-request"||Q==="license-renewal"?this.renewLicense(n,j).catch(se=>{this.handleError(se),k.emit("error",se)}):Q==="license-release"?n.keySystem===wl.FAIRPLAY&&(this.updateKeySession(n,_V("acknowledged")),this.removeSession(n)):this.warn(`unhandled media key message type "${Q}"`)},V=n._onkeystatuseschange=$=>{if(!n.mediaKeysSession){k.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(n);const Q=n.keyStatus;k.emit("keyStatus",Q),Q==="expired"&&(this.warn(`${n.keySystem} expired for key ${T}`),this.renewKeySession(n))};n.mediaKeysSession.addEventListener("message",R),n.mediaKeysSession.addEventListener("keystatuseschange",V);const z=new Promise(($,W)=>{k.on("error",W),k.on("keyStatus",Q=>{Q.startsWith("usable")?$():Q==="output-restricted"?W(new Dm({type:Gs.KEY_SYSTEM_ERROR,details:nn.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):Q==="internal-error"?W(new Dm({type:Gs.KEY_SYSTEM_ERROR,details:nn.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${Q}"`)):Q==="expired"?W(new Error("key expired while generating request")):this.warn(`unhandled key status change "${Q}"`)})});return n.mediaKeysSession.generateRequest(o,i).then(()=>{var $;this.log(`Request generated for key-session "${($=n.mediaKeysSession)==null?void 0:$.sessionId}" keyId: ${T}`)}).catch($=>{throw new Dm({type:Gs.KEY_SYSTEM_ERROR,details:nn.KEY_SYSTEM_NO_SESSION,error:$,fatal:!1},`Error generating key-session request: ${$}`)}).then(()=>z).catch($=>{throw k.removeAllListeners(),this.removeSession(n),$}).then(()=>(k.removeAllListeners(),n))}onKeyStatusChange(n){n.mediaKeysSession.keyStatuses.forEach((o,i)=>{this.log(`key status change "${o}" for keyStatuses keyId: ${d0.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${d0.hexDump(new Uint8Array(n.decryptdata.keyId||[]))} uri: ${n.decryptdata.uri}`),n.keyStatus=o})}fetchServerCertificate(n){const o=this.config,i=o.loader,u=new i(o),h=this.getServerCertificateUrl(n);return h?(this.log(`Fetching server certificate for "${n}"`),new Promise((g,b)=>{const S={responseType:"arraybuffer",url:h},T=o.certLoadPolicy.default,k={loadPolicy:T,timeout:T.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},R={onSuccess:(V,z,$,W)=>{g(V.data)},onError:(V,z,$,W)=>{b(new Dm({type:Gs.KEY_SYSTEM_ERROR,details:nn.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:$,response:Eu({url:S.url,data:void 0},V)},`"${n}" certificate request failed (${h}). Status: ${V.code} (${V.text})`))},onTimeout:(V,z,$)=>{b(new Dm({type:Gs.KEY_SYSTEM_ERROR,details:nn.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:$,response:{url:S.url,data:void 0}},`"${n}" certificate request timed out (${h})`))},onAbort:(V,z,$)=>{b(new Error("aborted"))}};u.load(S,k,R)})):Promise.resolve()}setMediaKeysServerCertificate(n,o,i){return new Promise((u,h)=>{n.setServerCertificate(i).then(g=>{this.log(`setServerCertificate ${g?"success":"not supported by CDM"} (${i==null?void 0:i.byteLength}) on "${o}"`),u(n)}).catch(g=>{h(new Dm({type:Gs.KEY_SYSTEM_ERROR,details:nn.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:g,fatal:!0},g.message))})})}renewLicense(n,o){return this.requestLicense(n,new Uint8Array(o)).then(i=>this.updateKeySession(n,new Uint8Array(i)).catch(u=>{throw new Dm({type:Gs.KEY_SYSTEM_ERROR,details:nn.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:u,fatal:!0},u.message)}))}unpackPlayReadyKeyMessage(n,o){const i=String.fromCharCode.apply(null,new Uint16Array(o.buffer));if(!i.includes("PlayReadyKeyMessage"))return n.setRequestHeader("Content-Type","text/xml; charset=utf-8"),o;const u=new DOMParser().parseFromString(i,"application/xml"),h=u.querySelectorAll("HttpHeader");if(h.length>0){let k;for(let R=0,V=h.length;R<V;R++){var g,b;k=h[R];const z=(g=k.querySelector("name"))==null?void 0:g.textContent,$=(b=k.querySelector("value"))==null?void 0:b.textContent;z&&$&&n.setRequestHeader(z,$)}}const S=u.querySelector("Challenge"),T=S==null?void 0:S.textContent;if(!T)throw new Error("Cannot find <Challenge> in key message");return _V(atob(T))}setupLicenseXHR(n,o,i,u){const h=this.config.licenseXhrSetup;return h?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return h.call(this.hls,n,o,i,u)}).catch(g=>{if(!i.decryptdata)throw g;return n.open("POST",o,!0),h.call(this.hls,n,o,i,u)}).then(g=>(n.readyState||n.open("POST",o,!0),{xhr:n,licenseChallenge:g||u})):(n.open("POST",o,!0),Promise.resolve({xhr:n,licenseChallenge:u}))}requestLicense(n,o){const i=this.config.keyLoadPolicy.default;return new Promise((u,h)=>{const g=this.getLicenseServerUrl(n.keySystem);this.log(`Sending license request to URL: ${g}`);const b=new XMLHttpRequest;b.responseType="arraybuffer",b.onreadystatechange=()=>{if(!this.hls||!n.mediaKeysSession)return h(new Error("invalid state"));if(b.readyState===4)if(b.status===200){this._requestLicenseFailureCount=0;let S=b.response;this.log(`License received ${S instanceof ArrayBuffer?S.byteLength:S}`);const T=this.config.licenseResponseCallback;if(T)try{S=T.call(this.hls,b,g,n)}catch(k){this.error(k)}u(S)}else{const S=i.errorRetry,T=S?S.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>T||b.status>=400&&b.status<500)h(new Dm({type:Gs.KEY_SYSTEM_ERROR,details:nn.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:b,response:{url:g,data:void 0,code:b.status,text:b.statusText}},`License Request XHR failed (${g}). Status: ${b.status} (${b.statusText})`));else{const k=T-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${k} attempts left`),this.requestLicense(n,o).then(u,h)}}},n.licenseXhr&&n.licenseXhr.readyState!==XMLHttpRequest.DONE&&n.licenseXhr.abort(),n.licenseXhr=b,this.setupLicenseXHR(b,g,n,o).then(({xhr:S,licenseChallenge:T})=>{n.keySystem==wl.PLAYREADY&&(T=this.unpackPlayReadyKeyMessage(S,T)),S.send(T)})})}onMediaAttached(n,o){if(!this.config.emeEnabled)return;const i=o.media;this.media=i,i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const n=this.media,o=this.mediaKeySessions;n&&(n.removeEventListener("encrypted",this.onMediaEncrypted),n.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},cR.clearKeyUriToKeyIdMap();const i=o.length;TT.CDMCleanupPromise=Promise.all(o.map(u=>this.removeSession(u)).concat(n==null?void 0:n.setMediaKeys(null).catch(u=>{this.log(`Could not clear media keys: ${u}`)}))).then(()=>{i&&(this.log("finished closing key sessions and clearing media keys"),o.length=0)}).catch(u=>{this.log(`Could not close sessions and clear media keys: ${u}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(n,{sessionKeys:o}){if(!(!o||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=o.reduce((u,h)=>(u.indexOf(h.keyFormat)===-1&&u.push(h.keyFormat),u),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(n){const{mediaKeysSession:o,licenseXhr:i}=n;if(o){this.log(`Remove licenses and keys and close session ${o.sessionId}`),n._onmessage&&(o.removeEventListener("message",n._onmessage),n._onmessage=void 0),n._onkeystatuseschange&&(o.removeEventListener("keystatuseschange",n._onkeystatuseschange),n._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),n.mediaKeysSession=n.decryptdata=n.licenseXhr=void 0;const u=this.mediaKeySessions.indexOf(n);return u>-1&&this.mediaKeySessions.splice(u,1),o.remove().catch(h=>{this.log(`Could not remove session: ${h}`)}).then(()=>o.close()).catch(h=>{this.log(`Could not close session: ${h}`)})}}}TT.CDMCleanupPromise=void 0;class Dm extends Error{constructor(n,o){super(o),this.data=void 0,n.error||(n.error=new Error(o)),this.data=n,n.err=n.error}}var Ad;(function(l){l.MANIFEST="m",l.AUDIO="a",l.VIDEO="v",l.MUXED="av",l.INIT="i",l.CAPTION="c",l.TIMED_TEXT="tt",l.KEY="k",l.OTHER="o"})(Ad||(Ad={}));var MV;(function(l){l.DASH="d",l.HLS="h",l.SMOOTH="s",l.OTHER="o"})(MV||(MV={}));var aS;(function(l){l.OBJECT="CMCD-Object",l.REQUEST="CMCD-Request",l.SESSION="CMCD-Session",l.STATUS="CMCD-Status"})(aS||(aS={}));const zhe={[aS.OBJECT]:["br","d","ot","tb"],[aS.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[aS.SESSION]:["cid","pr","sf","sid","st","v"],[aS.STATUS]:["bs","rtp"]};class OT{constructor(n,o){this.value=void 0,this.params=void 0,Array.isArray(n)&&(n=n.map(i=>i instanceof OT?i:new OT(i))),this.value=n,this.params=o}}class dY{constructor(n){this.description=void 0,this.description=n}}const Ghe="Dict";function Whe(l){return Array.isArray(l)?JSON.stringify(l):l instanceof Map?"Map{}":l instanceof Set?"Set{}":typeof l=="object"?JSON.stringify(l):String(l)}function jhe(l,n,o,i){return new Error(`failed to ${l} "${Whe(n)}" as ${o}`,{cause:i})}const PK="Bare Item",Khe="Boolean",Zhe="Byte Sequence",qhe="Decimal",Yhe="Integer";function Xhe(l){return l<-999999999999999||999999999999999<l}const Jhe=/[\x00-\x1f\x7f]+/,Qhe="Token",eme="Key";function S0(l,n,o){return jhe("serialize",l,n,o)}function tme(l){if(typeof l!="boolean")throw S0(l,Khe);return l?"?1":"?0"}function nme(l){return btoa(String.fromCharCode(...l))}function ome(l){if(ArrayBuffer.isView(l)===!1)throw S0(l,Zhe);return`:${nme(l)}:`}function fY(l){if(Xhe(l))throw S0(l,Yhe);return l.toString()}function sme(l){return`@${fY(l.getTime()/1e3)}`}function hY(l,n){if(l<0)return-hY(-l,n);const o=Math.pow(10,n);if(Math.abs(l*o%1-.5)<Number.EPSILON){const u=Math.floor(l*o);return(u%2===0?u:u+1)/o}else return Math.round(l*o)/o}function rme(l){const n=hY(l,3);if(Math.floor(Math.abs(n)).toString().length>12)throw S0(l,qhe);const o=n.toString();return o.includes(".")?o:`${o}.0`}const ime="String";function ame(l){if(Jhe.test(l))throw S0(l,ime);return`"${l.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function lme(l){return l.description||l.toString().slice(7,-1)}function MK(l){const n=lme(l);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(n)===!1)throw S0(n,Qhe);return n}function NV(l){switch(typeof l){case"number":if(!Xo(l))throw S0(l,PK);return Number.isInteger(l)?fY(l):rme(l);case"string":return ame(l);case"symbol":return MK(l);case"boolean":return tme(l);case"object":if(l instanceof Date)return sme(l);if(l instanceof Uint8Array)return ome(l);if(l instanceof dY)return MK(l);default:throw S0(l,PK)}}function FV(l){if(/^[a-z*][a-z0-9\-_.*]*$/.test(l)===!1)throw S0(l,eme);return l}function Sz(l){return l==null?"":Object.entries(l).map(([n,o])=>o===!0?`;${FV(n)}`:`;${FV(n)}=${NV(o)}`).join("")}function mY(l){return l instanceof OT?`${NV(l.value)}${Sz(l.params)}`:NV(l)}function cme(l){return`(${l.value.map(mY).join(" ")})${Sz(l.params)}`}function ume(l,n={whitespace:!0}){if(typeof l!="object")throw S0(l,Ghe);const o=l instanceof Map?l.entries():Object.entries(l),i=n!=null&&n.whitespace?" ":"";return Array.from(o).map(([u,h])=>{h instanceof OT||(h=new OT(h));let g=FV(u);return h.value===!0?g+=Sz(h.params):(g+="=",Array.isArray(h.value)?g+=cme(h):g+=mY(h)),g}).join(`,${i}`)}function dme(l,n){return ume(l,n)}const fme=l=>l==="ot"||l==="sf"||l==="st",hme=l=>typeof l=="number"?Xo(l):l!=null&&l!==""&&l!==!1;function mme(l,n){const o=new URL(l),i=new URL(n);if(o.origin!==i.origin)return l;const u=o.pathname.split("/").slice(1),h=i.pathname.split("/").slice(1,-1);for(;u[0]===h[0];)u.shift(),h.shift();for(;h.length;)h.shift(),u.unshift("..");return u.join("/")}function pme(){try{return crypto.randomUUID()}catch{try{const n=URL.createObjectURL(new Blob),o=n.toString();return URL.revokeObjectURL(n),o.slice(o.lastIndexOf("/")+1)}catch{let o=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,u=>{const h=(o+Math.random()*16)%16|0;return o=Math.floor(o/16),(u=="x"?h:h&3|8).toString(16)})}}}const lB=l=>Math.round(l),gme=(l,n)=>(n!=null&&n.baseUrl&&(l=mme(l,n.baseUrl)),encodeURIComponent(l)),U4=l=>lB(l/100)*100,bme={br:lB,d:lB,bl:U4,dl:U4,mtp:U4,nor:gme,rtp:U4,tb:lB};function vme(l,n){const o={};if(l==null||typeof l!="object")return o;const i=Object.keys(l).sort(),u=Ic({},bme,n==null?void 0:n.formatters),h=n==null?void 0:n.filter;return i.forEach(g=>{if(h!=null&&h(g))return;let b=l[g];const S=u[g];S&&(b=S(b,n)),!(g==="v"&&b===1)&&(g=="pr"&&b===1||hme(b)&&(fme(g)&&typeof b=="string"&&(b=new dY(b)),o[g]=b))}),o}function pY(l,n={}){return l?dme(vme(l,n),Ic({whitespace:!1},n)):""}function xme(l,n={}){if(!l)return{};const o=Object.entries(l),i=Object.entries(zhe).concat(Object.entries((n==null?void 0:n.customHeaderMap)||{})),u=o.reduce((h,g)=>{var b,S;const[T,k]=g,R=((b=i.find(V=>V[1].includes(T)))==null?void 0:b[0])||aS.REQUEST;return(S=h[R])!=null||(h[R]={}),h[R][T]=k,h},{});return Object.entries(u).reduce((h,[g,b])=>(h[g]=pY(b,n),h),{})}function yme(l,n,o){return Ic(l,xme(n,o))}const wme="CMCD";function Sme(l,n={}){if(!l)return"";const o=pY(l,n);return`${wme}=${encodeURIComponent(o)}`}const NK=/CMCD=[^&#]+/;function Eme(l,n,o){const i=Sme(n,o);if(!i)return l;if(NK.test(l))return l.replace(NK,i);const u=l.includes("?")?"&":"?";return`${l}${u}${i}`}class Cme{constructor(n){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=u=>{try{this.apply(u,{ot:Ad.MANIFEST,su:!this.initialized})}catch(h){Mt.warn("Could not generate manifest CMCD data.",h)}},this.applyFragmentData=u=>{try{const h=u.frag,g=this.hls.levels[h.level],b=this.getObjectType(h),S={d:h.duration*1e3,ot:b};(b===Ad.VIDEO||b===Ad.AUDIO||b==Ad.MUXED)&&(S.br=g.bitrate/1e3,S.tb=this.getTopBandwidth(b)/1e3,S.bl=this.getBufferLength(b)),this.apply(u,S)}catch(h){Mt.warn("Could not generate segment CMCD data.",h)}},this.hls=n;const o=this.config=n.config,{cmcd:i}=o;i!=null&&(o.pLoader=this.createPlaylistLoader(),o.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||pme(),this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const n=this.hls;n.on(we.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(we.MEDIA_DETACHED,this.onMediaDetached,this),n.on(we.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const n=this.hls;n.off(we.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(we.MEDIA_DETACHED,this.onMediaDetached,this),n.off(we.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(n,o){this.media=o.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(n,o){var i,u;this.audioBuffer=(i=o.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(u=o.tracks.video)==null?void 0:u.buffer}createData(){var n;return{v:1,sf:MV.HLS,sid:this.sid,cid:this.cid,pr:(n=this.media)==null?void 0:n.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(n,o={}){Ic(o,this.createData());const i=o.ot===Ad.INIT||o.ot===Ad.VIDEO||o.ot===Ad.MUXED;this.starved&&i&&(o.bs=!0,o.su=!0,this.starved=!1),o.su==null&&(o.su=this.buffering);const{includeKeys:u}=this;u&&(o=Object.keys(o).reduce((h,g)=>(u.includes(g)&&(h[g]=o[g]),h),{})),this.useHeaders?(n.headers||(n.headers={}),yme(n.headers,o)):n.url=Eme(n.url,o)}getObjectType(n){const{type:o}=n;if(o==="subtitle")return Ad.TIMED_TEXT;if(n.sn==="initSegment")return Ad.INIT;if(o==="audio")return Ad.AUDIO;if(o==="main")return this.hls.audioTracks.length?Ad.VIDEO:Ad.MUXED}getTopBandwidth(n){let o=0,i;const u=this.hls;if(n===Ad.AUDIO)i=u.audioTracks;else{const h=u.maxAutoLevel,g=h>-1?h+1:u.levels.length;i=u.levels.slice(0,g)}for(const h of i)h.bitrate>o&&(o=h.bitrate);return o>0?o:NaN}getBufferLength(n){const o=this.hls.media,i=n===Ad.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!o?NaN:Xa.bufferInfo(i,o.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:n}=this.config,o=this.applyPlaylistData,i=n||this.config.loader;return class{constructor(h){this.loader=void 0,this.loader=new i(h)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(h,g,b){o(h),this.loader.load(h,g,b)}}}createFragmentLoader(){const{fLoader:n}=this.config,o=this.applyFragmentData,i=n||this.config.loader;return class{constructor(h){this.loader=void 0,this.loader=new i(h)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(h,g,b){o(h),this.loader.load(h,g,b)}}}}const _me=3e5;class Tme{constructor(n){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=n,this.log=Mt.log.bind(Mt,"[content-steering]:"),this.registerListeners()}registerListeners(){const n=this.hls;n.on(we.MANIFEST_LOADING,this.onManifestLoading,this),n.on(we.MANIFEST_LOADED,this.onManifestLoaded,this),n.on(we.MANIFEST_PARSED,this.onManifestParsed,this),n.on(we.ERROR,this.onError,this)}unregisterListeners(){const n=this.hls;n&&(n.off(we.MANIFEST_LOADING,this.onManifestLoading,this),n.off(we.MANIFEST_LOADED,this.onManifestLoaded,this),n.off(we.MANIFEST_PARSED,this.onManifestParsed,this),n.off(we.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const n=this.timeToLoad*1e3-(performance.now()-this.updated);if(n>0){this.scheduleRefresh(this.uri,n);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(n){const o=this.levels;o&&(this.levels=o.filter(i=>i!==n))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(n,o){const{contentSteering:i}=o;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(n,o){this.audioTracks=o.audioTracks,this.subtitleTracks=o.subtitleTracks}onError(n,o){const{errorAction:i}=o;if((i==null?void 0:i.action)===ed.SendAlternateToPenaltyBox&&i.flags===Vp.MoveAllAlternatesMatchingHost){const u=this.levels;let h=this.pathwayPriority,g=this.pathwayId;if(o.context){const{groupId:b,pathwayId:S,type:T}=o.context;b&&u?g=this.getPathwayForGroupId(b,T,g):S&&(g=S)}g in this.penalizedPathways||(this.penalizedPathways[g]=performance.now()),!h&&u&&(h=u.reduce((b,S)=>(b.indexOf(S.pathwayId)===-1&&b.push(S.pathwayId),b),[])),h&&h.length>1&&(this.updatePathwayPriority(h),i.resolved=this.pathwayId!==g),i.resolved||Mt.warn(`Could not resolve ${o.details} ("${o.error.message}") with content-steering for Pathway: ${g} levels: ${u&&u.length} priorities: ${JSON.stringify(h)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(n){this.levels=n;let o=this.getLevelsForPathway(this.pathwayId);if(o.length===0){const i=n[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),o=this.getLevelsForPathway(i),this.pathwayId=i}return o.length!==n.length?(this.log(`Found ${o.length}/${n.length} levels in Pathway "${this.pathwayId}"`),o):n}getLevelsForPathway(n){return this.levels===null?[]:this.levels.filter(o=>n===o.pathwayId)}updatePathwayPriority(n){this.pathwayPriority=n;let o;const i=this.penalizedPathways,u=performance.now();Object.keys(i).forEach(h=>{u-i[h]>_me&&delete i[h]});for(let h=0;h<n.length;h++){const g=n[h];if(g in i)continue;if(g===this.pathwayId)return;const b=this.hls.nextLoadLevel,S=this.hls.levels[b];if(o=this.getLevelsForPathway(g),o.length>0){this.log(`Setting Pathway to "${g}"`),this.pathwayId=g,Pq(o),this.hls.trigger(we.LEVELS_UPDATED,{levels:o});const T=this.hls.levels[b];S&&T&&this.levels&&(T.attrs["STABLE-VARIANT-ID"]!==S.attrs["STABLE-VARIANT-ID"]&&T.bitrate!==S.bitrate&&this.log(`Unstable Pathways change from bitrate ${S.bitrate} to ${T.bitrate}`),this.hls.nextLoadLevel=b);break}}}getPathwayForGroupId(n,o,i){const u=this.getLevelsForPathway(i).concat(this.levels||[]);for(let h=0;h<u.length;h++)if(o===Ci.AUDIO_TRACK&&u[h].hasAudioGroup(n)||o===Ci.SUBTITLE_TRACK&&u[h].hasSubtitleGroup(n))return u[h].pathwayId;return i}clonePathways(n){const o=this.levels;if(!o)return;const i={},u={};n.forEach(h=>{const{ID:g,"BASE-ID":b,"URI-REPLACEMENT":S}=h;if(o.some(k=>k.pathwayId===g))return;const T=this.getLevelsForPathway(b).map(k=>{const R=new Fl(k.attrs);R["PATHWAY-ID"]=g;const V=R.AUDIO&&`${R.AUDIO}_clone_${g}`,z=R.SUBTITLES&&`${R.SUBTITLES}_clone_${g}`;V&&(i[R.AUDIO]=V,R.AUDIO=V),z&&(u[R.SUBTITLES]=z,R.SUBTITLES=z);const $=gY(k.uri,R["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",S),W=new LT({attrs:R,audioCodec:k.audioCodec,bitrate:k.bitrate,height:k.height,name:k.name,url:$,videoCodec:k.videoCodec,width:k.width});if(k.audioGroups)for(let Q=1;Q<k.audioGroups.length;Q++)W.addGroupId("audio",`${k.audioGroups[Q]}_clone_${g}`);if(k.subtitleGroups)for(let Q=1;Q<k.subtitleGroups.length;Q++)W.addGroupId("text",`${k.subtitleGroups[Q]}_clone_${g}`);return W});o.push(...T),FK(this.audioTracks,i,S,g),FK(this.subtitleTracks,u,S,g)})}loadSteeringManifest(n){const o=this.hls.config,i=o.loader;this.loader&&this.loader.destroy(),this.loader=new i(o);let u;try{u=new self.URL(n)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${n}`);return}if(u.protocol!=="data:"){const k=(this.hls.bandwidthEstimate||o.abrEwmaDefaultEstimate)|0;u.searchParams.set("_HLS_pathway",this.pathwayId),u.searchParams.set("_HLS_throughput",""+k)}const h={responseType:"json",url:u.href},g=o.steeringManifestLoadPolicy.default,b=g.errorRetry||g.timeoutRetry||{},S={loadPolicy:g,timeout:g.maxLoadTimeMs,maxRetry:b.maxNumRetry||0,retryDelay:b.retryDelayMs||0,maxRetryDelay:b.maxRetryDelayMs||0},T={onSuccess:(k,R,V,z)=>{this.log(`Loaded steering manifest: "${u}"`);const $=k.data;if($.VERSION!==1){this.log(`Steering VERSION ${$.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=$.TTL;const{"RELOAD-URI":W,"PATHWAY-CLONES":Q,"PATHWAY-PRIORITY":j}=$;if(W)try{this.uri=new self.URL(W,u).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${W}`);return}this.scheduleRefresh(this.uri||V.url),Q&&this.clonePathways(Q);const se={steeringManifest:$,url:u.toString()};this.hls.trigger(we.STEERING_MANIFEST_LOADED,se),j&&this.updatePathwayPriority(j)},onError:(k,R,V,z)=>{if(this.log(`Error loading steering manifest: ${k.code} ${k.text} (${R.url})`),this.stopLoad(),k.code===410){this.enabled=!1,this.log(`Steering manifest ${R.url} no longer available`);return}let $=this.timeToLoad*1e3;if(k.code===429){const W=this.loader;if(typeof(W==null?void 0:W.getResponseHeader)=="function"){const Q=W.getResponseHeader("Retry-After");Q&&($=parseFloat(Q)*1e3)}this.log(`Steering manifest ${R.url} rate limited`);return}this.scheduleRefresh(this.uri||R.url,$)},onTimeout:(k,R,V)=>{this.log(`Timeout loading steering manifest (${R.url})`),this.scheduleRefresh(this.uri||R.url)}};this.log(`Requesting steering manifest: ${u}`),this.loader.load(h,S,T)}scheduleRefresh(n,o=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var i;const u=(i=this.hls)==null?void 0:i.media;if(u&&!u.ended){this.loadSteeringManifest(n);return}this.scheduleRefresh(n,this.timeToLoad*1e3)},o)}}function FK(l,n,o,i){l&&Object.keys(n).forEach(u=>{const h=l.filter(g=>g.groupId===u).map(g=>{const b=Ic({},g);return b.details=void 0,b.attrs=new Fl(b.attrs),b.url=b.attrs.URI=gY(g.url,g.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",o),b.groupId=b.attrs["GROUP-ID"]=n[u],b.attrs["PATHWAY-ID"]=i,b});l.push(...h)})}function gY(l,n,o,i){const{HOST:u,PARAMS:h,[o]:g}=i;let b;n&&(b=g==null?void 0:g[n],b&&(l=b));const S=new self.URL(l);return u&&!b&&(S.host=u),h&&Object.keys(h).sort().forEach(T=>{T&&S.searchParams.set(T,h[T])}),S.href}const Dme=/^age:\s*[\d.]+\s*$/im;class bY{constructor(n){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=n&&n.xhrSetup||null,this.stats=new UB,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null,this.stats=null}abortInternal(){const n=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),n&&(n.onreadystatechange=null,n.onprogress=null,n.readyState!==4&&(this.stats.aborted=!0,n.abort()))}abort(){var n;this.abortInternal(),(n=this.callbacks)!=null&&n.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(n,o,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=n,this.config=o,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:n,context:o}=this;if(!n||!o)return;const i=this.loader=new self.XMLHttpRequest,u=this.stats;u.loading.first=0,u.loaded=0,u.aborted=!1;const h=this.xhrSetup;h?Promise.resolve().then(()=>{if(!this.stats.aborted)return h(i,o.url)}).catch(g=>(i.open("GET",o.url,!0),h(i,o.url))).then(()=>{this.stats.aborted||this.openAndSendXhr(i,o,n)}).catch(g=>{this.callbacks.onError({code:i.status,text:g.message},o,i,u)}):this.openAndSendXhr(i,o,n)}openAndSendXhr(n,o,i){n.readyState||n.open("GET",o.url,!0);const u=o.headers,{maxTimeToFirstByteMs:h,maxLoadTimeMs:g}=i.loadPolicy;if(u)for(const b in u)n.setRequestHeader(b,u[b]);o.rangeEnd&&n.setRequestHeader("Range","bytes="+o.rangeStart+"-"+(o.rangeEnd-1)),n.onreadystatechange=this.readystatechange.bind(this),n.onprogress=this.loadprogress.bind(this),n.responseType=o.responseType,self.clearTimeout(this.requestTimeout),i.timeout=h&&Xo(h)?h:g,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),n.send()}readystatechange(){const{context:n,loader:o,stats:i}=this;if(!n||!o)return;const u=o.readyState,h=this.config;if(!i.aborted&&u>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),h.timeout!==h.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),h.timeout=h.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),h.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),u===4)){self.clearTimeout(this.requestTimeout),o.onreadystatechange=null,o.onprogress=null;const g=o.status,b=o.responseType!=="text";if(g>=200&&g<300&&(b&&o.response||o.responseText!==null)){i.loading.end=Math.max(self.performance.now(),i.loading.first);const S=b?o.response:o.responseText,T=o.responseType==="arraybuffer"?S.byteLength:S.length;if(i.loaded=i.total=T,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first),!this.callbacks)return;const k=this.callbacks.onProgress;if(k&&k(i,n,S,o),!this.callbacks)return;const R={url:o.responseURL,data:S,code:g};this.callbacks.onSuccess(R,i,n,o)}else{const S=h.loadPolicy.errorRetry,T=i.retry,k={url:n.url,data:void 0,code:g};RB(S,T,!1,k)?this.retry(S):(Mt.error(`${g} while loading ${n.url}`),this.callbacks.onError({code:g,text:o.statusText},n,o,i))}}}loadtimeout(){var n;const o=(n=this.config)==null?void 0:n.loadPolicy.timeoutRetry,i=this.stats.retry;if(RB(o,i,!0))this.retry(o);else{var u;Mt.warn(`timeout while loading ${(u=this.context)==null?void 0:u.url}`);const h=this.callbacks;h&&(this.abortInternal(),h.onTimeout(this.stats,this.context,this.loader))}}retry(n){const{context:o,stats:i}=this;this.retryDelay=cz(n,i.retry),i.retry++,Mt.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${o==null?void 0:o.url}, retrying ${i.retry}/${n.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(n){const o=this.stats;o.loaded=n.loaded,n.lengthComputable&&(o.total=n.total)}getCacheAge(){let n=null;if(this.loader&&Dme.test(this.loader.getAllResponseHeaders())){const o=this.loader.getResponseHeader("age");n=o?parseFloat(o):null}return n}getResponseHeader(n){return this.loader&&new RegExp(`^${n}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(n):null}}function kme(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const Ame=/(\d+)-(\d+)\/(\d+)/;class BK{constructor(n){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=n.fetchSetup||Ime,this.controller=new self.AbortController,this.stats=new UB}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var n;this.abortInternal(),(n=this.callbacks)!=null&&n.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(n,o,i){const u=this.stats;if(u.loading.start)throw new Error("Loader can only be used once.");u.loading.start=self.performance.now();const h=Lme(n,this.controller.signal),g=i.onProgress,b=n.responseType==="arraybuffer",S=b?"byteLength":"length",{maxTimeToFirstByteMs:T,maxLoadTimeMs:k}=o.loadPolicy;this.context=n,this.config=o,this.callbacks=i,this.request=this.fetchSetup(n,h),self.clearTimeout(this.requestTimeout),o.timeout=T&&Xo(T)?T:k,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(u,n,this.response)},o.timeout),self.fetch(this.request).then(R=>{this.response=this.loader=R;const V=Math.max(self.performance.now(),u.loading.start);if(self.clearTimeout(this.requestTimeout),o.timeout=k,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(u,n,this.response)},k-(V-u.loading.start)),!R.ok){const{status:z,statusText:$}=R;throw new Pme($||"fetch, bad network response",z,R)}return u.loading.first=V,u.total=Ome(R.headers)||u.total,g&&Xo(o.highWaterMark)?this.loadProgressively(R,u,n,o.highWaterMark,g):b?R.arrayBuffer():n.responseType==="json"?R.json():R.text()}).then(R=>{const V=this.response;if(!V)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),u.loading.end=Math.max(self.performance.now(),u.loading.first);const z=R[S];z&&(u.loaded=u.total=z);const $={url:V.url,data:R,code:V.status};g&&!Xo(o.highWaterMark)&&g(u,n,R,V),i.onSuccess($,u,n,V)}).catch(R=>{if(self.clearTimeout(this.requestTimeout),u.aborted)return;const V=R&&R.code||0,z=R?R.message:null;i.onError({code:V,text:z},n,R?R.details:null,u)})}getCacheAge(){let n=null;if(this.response){const o=this.response.headers.get("age");n=o?parseFloat(o):null}return n}getResponseHeader(n){return this.response?this.response.headers.get(n):null}loadProgressively(n,o,i,u=0,h){const g=new Bq,b=n.body.getReader(),S=()=>b.read().then(T=>{if(T.done)return g.dataLength&&h(o,i,g.flush(),n),Promise.resolve(new ArrayBuffer(0));const k=T.value,R=k.length;return o.loaded+=R,R<u||g.dataLength?(g.push(k),g.dataLength>=u&&h(o,i,g.flush(),n)):h(o,i,k,n),S()}).catch(()=>Promise.reject());return S()}}function Lme(l,n){const o={method:"GET",mode:"cors",credentials:"same-origin",signal:n,headers:new self.Headers(Ic({},l.headers))};return l.rangeEnd&&o.headers.set("Range","bytes="+l.rangeStart+"-"+String(l.rangeEnd-1)),o}function Rme(l){const n=Ame.exec(l);if(n)return parseInt(n[2])-parseInt(n[1])+1}function Ome(l){const n=l.get("Content-Range");if(n){const i=Rme(n);if(Xo(i))return i}const o=l.get("Content-Length");if(o)return parseInt(o)}function Ime(l,n){return new self.Request(l.url,n)}class Pme extends Error{constructor(n,o,i){super(n),this.code=void 0,this.details=void 0,this.code=o,this.details=i}}const Mme=/\s/,Nme={newCue(l,n,o,i){const u=[];let h,g,b,S,T;const k=self.VTTCue||self.TextTrackCue;for(let V=0;V<i.rows.length;V++)if(h=i.rows[V],b=!0,S=0,T="",!h.isEmpty()){var R;for(let W=0;W<h.chars.length;W++)Mme.test(h.chars[W].uchar)&&b?S++:(T+=h.chars[W].uchar,b=!1);h.cueStartTime=n,n===o&&(o+=1e-4),S>=16?S--:S++;const z=iY(T.trim()),$=yz(n,o,z);l!=null&&(R=l.cues)!=null&&R.getCueById($)||(g=new k(n,o,z),g.id=$,g.line=V+1,g.align="left",g.position=10+Math.min(80,Math.floor(S*8/32)*10),u.push(g))}return l&&u.length&&(u.sort((V,z)=>V.line==="auto"||z.line==="auto"?0:V.line>8&&z.line>8?z.line-V.line:V.line-z.line),u.forEach(V=>Lq(l,V))),u}},Fme={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},vY=Eu(Eu({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:bY,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:hfe,bufferController:bhe,capLevelController:wz,errorController:tfe,fpsController:Vhe,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:gq,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:Fme},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},Bme()),{},{subtitleStreamController:hhe,subtitleTrackController:phe,timelineController:Hhe,audioStreamController:dhe,audioTrackController:fhe,emeController:TT,cmcdController:Cme,contentSteeringController:Tme});function Bme(){return{cueHandler:Nme,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function $me(l,n){if((n.liveSyncDurationCount||n.liveMaxLatencyDurationCount)&&(n.liveSyncDuration||n.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(n.liveMaxLatencyDurationCount!==void 0&&(n.liveSyncDurationCount===void 0||n.liveMaxLatencyDurationCount<=n.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(n.liveMaxLatencyDuration!==void 0&&(n.liveSyncDuration===void 0||n.liveMaxLatencyDuration<=n.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const o=BV(l),i=["manifest","level","frag"],u=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return i.forEach(h=>{const g=`${h==="level"?"playlist":h}LoadPolicy`,b=n[g]===void 0,S=[];u.forEach(T=>{const k=`${h}Loading${T}`,R=n[k];if(R!==void 0&&b){S.push(k);const V=o[g].default;switch(n[g]={default:V},T){case"TimeOut":V.maxLoadTimeMs=R,V.maxTimeToFirstByteMs=R;break;case"MaxRetry":V.errorRetry.maxNumRetry=R,V.timeoutRetry.maxNumRetry=R;break;case"RetryDelay":V.errorRetry.retryDelayMs=R,V.timeoutRetry.retryDelayMs=R;break;case"MaxRetryTimeout":V.errorRetry.maxRetryDelayMs=R,V.timeoutRetry.maxRetryDelayMs=R;break}}}),S.length&&Mt.warn(`hls.js config: "${S.join('", "')}" setting(s) are deprecated, use "${g}": ${JSON.stringify(n[g])}`)}),Eu(Eu({},o),n)}function BV(l){return l&&typeof l=="object"?Array.isArray(l)?l.map(BV):Object.keys(l).reduce((n,o)=>(n[o]=BV(l[o]),n),{}):l}function Hme(l){const n=l.loader;n!==BK&&n!==bY?(Mt.log("[config]: Custom loader detected, cannot enable progressive streaming"),l.progressive=!1):kme()&&(l.loader=BK,l.progressive=!0,l.enableSoftwareAES=!0,Mt.log("[config]: Progressive streaming enabled, using FetchLoader"))}let KU;class Ume extends uz{constructor(n,o){super(n,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=o,this._registerListeners()}_registerListeners(){const{hls:n}=this;n.on(we.MANIFEST_LOADING,this.onManifestLoading,this),n.on(we.MANIFEST_LOADED,this.onManifestLoaded,this),n.on(we.LEVEL_LOADED,this.onLevelLoaded,this),n.on(we.LEVELS_UPDATED,this.onLevelsUpdated,this),n.on(we.FRAG_BUFFERED,this.onFragBuffered,this),n.on(we.ERROR,this.onError,this)}_unregisterListeners(){const{hls:n}=this;n.off(we.MANIFEST_LOADING,this.onManifestLoading,this),n.off(we.MANIFEST_LOADED,this.onManifestLoaded,this),n.off(we.LEVEL_LOADED,this.onLevelLoaded,this),n.off(we.LEVELS_UPDATED,this.onLevelsUpdated,this),n.off(we.FRAG_BUFFERED,this.onFragBuffered,this),n.off(we.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(o=>{o.loadError=0,o.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(n,o){this.resetLevels()}onManifestLoaded(n,o){const i=this.hls.config.preferManagedMediaSource,u=[],h={},g={};let b=!1,S=!1,T=!1;o.levels.forEach(k=>{var R,V;const z=k.attrs;let{audioCodec:$,videoCodec:W}=k;((R=$)==null?void 0:R.indexOf("mp4a.40.34"))!==-1&&(KU||(KU=/chrome|firefox/i.test(navigator.userAgent)),KU&&(k.audioCodec=$=void 0)),$&&(k.audioCodec=$=kB($,i)),((V=W)==null?void 0:V.indexOf("avc1"))===0&&(W=k.videoCodec=Lde(W));const{width:Q,height:j,unknownCodecs:se}=k;if(b||(b=!!(Q&&j)),S||(S=!!W),T||(T=!!$),se!=null&&se.length||$&&!OU($,"audio",i)||W&&!OU(W,"video",i))return;const{CODECS:re,"FRAME-RATE":Y,"HDCP-LEVEL":me,"PATHWAY-ID":ae,RESOLUTION:Ce,"VIDEO-RANGE":Ue}=z,Ae=`${`${ae||"."}-`}${k.bitrate}-${Ce}-${Y}-${re}-${Ue}-${me}`;if(h[Ae])if(h[Ae].uri!==k.url&&!k.attrs["PATHWAY-ID"]){const ve=g[Ae]+=1;k.attrs["PATHWAY-ID"]=new Array(ve+1).join(".");const Oe=new LT(k);h[Ae]=Oe,u.push(Oe)}else h[Ae].addGroupId("audio",z.AUDIO),h[Ae].addGroupId("text",z.SUBTITLES);else{const ve=new LT(k);h[Ae]=ve,g[Ae]=1,u.push(ve)}}),this.filterAndSortMediaOptions(u,o,b,S,T)}filterAndSortMediaOptions(n,o,i,u,h){let g=[],b=[],S=n;if((i||u)&&h&&(S=S.filter(({videoCodec:$,videoRange:W,width:Q,height:j})=>(!!$||!!(Q&&j))&&zde(W))),S.length===0){Promise.resolve().then(()=>{if(this.hls){o.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(o.levels[0].attrs)}`);const $=new Error("no level with compatible codecs found in manifest");this.hls.trigger(we.ERROR,{type:Gs.MEDIA_ERROR,details:nn.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:o.url,error:$,reason:$.message})}});return}if(o.audioTracks){const{preferManagedMediaSource:$}=this.hls.config;g=o.audioTracks.filter(W=>!W.audioCodec||OU(W.audioCodec,"audio",$)),$K(g)}o.subtitles&&(b=o.subtitles,$K(b));const T=S.slice(0);S.sort(($,W)=>{if($.attrs["HDCP-LEVEL"]!==W.attrs["HDCP-LEVEL"])return($.attrs["HDCP-LEVEL"]||"")>(W.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&$.height!==W.height)return $.height-W.height;if($.frameRate!==W.frameRate)return $.frameRate-W.frameRate;if($.videoRange!==W.videoRange)return AB.indexOf($.videoRange)-AB.indexOf(W.videoRange);if($.videoCodec!==W.videoCodec){const Q=Gj($.videoCodec),j=Gj(W.videoCodec);if(Q!==j)return j-Q}if($.uri===W.uri&&$.codecSet!==W.codecSet){const Q=DB($.codecSet),j=DB(W.codecSet);if(Q!==j)return j-Q}return $.averageBitrate!==W.averageBitrate?$.averageBitrate-W.averageBitrate:0});let k=T[0];if(this.steering&&(S=this.steering.filterParsedLevels(S),S.length!==T.length)){for(let $=0;$<T.length;$++)if(T[$].pathwayId===S[0].pathwayId){k=T[$];break}}this._levels=S;for(let $=0;$<S.length;$++)if(S[$]===k){var R;this._firstLevel=$;const W=k.bitrate,Q=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${S.length} level(s) found, first bitrate: ${W}`),((R=this.hls.userConfig)==null?void 0:R.abrEwmaDefaultEstimate)===void 0){const j=Math.min(W,this.hls.config.abrEwmaDefaultEstimateMax);j>Q&&Q===vY.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=j)}break}const V=h&&!u,z={levels:S,audioTracks:g,subtitleTracks:b,sessionData:o.sessionData,sessionKeys:o.sessionKeys,firstLevel:this._firstLevel,stats:o.stats,audio:h,video:u,altAudio:!V&&g.some($=>!!$.url)};this.hls.trigger(we.MANIFEST_PARSED,z),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return this._levels.length===0?null:this._levels}get level(){return this.currentLevelIndex}set level(n){const o=this._levels;if(o.length===0)return;if(n<0||n>=o.length){const k=new Error("invalid level idx"),R=n<0;if(this.hls.trigger(we.ERROR,{type:Gs.OTHER_ERROR,details:nn.LEVEL_SWITCH_ERROR,level:n,fatal:R,error:k,reason:k.message}),R)return;n=Math.min(n,o.length-1)}const i=this.currentLevelIndex,u=this.currentLevel,h=u?u.attrs["PATHWAY-ID"]:void 0,g=o[n],b=g.attrs["PATHWAY-ID"];if(this.currentLevelIndex=n,this.currentLevel=g,i===n&&g.details&&u&&h===b)return;this.log(`Switching to level ${n} (${g.height?g.height+"p ":""}${g.videoRange?g.videoRange+" ":""}${g.codecSet?g.codecSet+" ":""}@${g.bitrate})${b?" with Pathway "+b:""} from level ${i}${h?" with Pathway "+h:""}`);const S={level:n,attrs:g.attrs,details:g.details,bitrate:g.bitrate,averageBitrate:g.averageBitrate,maxBitrate:g.maxBitrate,realBitrate:g.realBitrate,width:g.width,height:g.height,codecSet:g.codecSet,audioCodec:g.audioCodec,videoCodec:g.videoCodec,audioGroups:g.audioGroups,subtitleGroups:g.subtitleGroups,loaded:g.loaded,loadError:g.loadError,fragmentError:g.fragmentError,name:g.name,id:g.id,uri:g.uri,url:g.url,urlId:0,audioGroupIds:g.audioGroupIds,textGroupIds:g.textGroupIds};this.hls.trigger(we.LEVEL_SWITCHING,S);const T=g.details;if(!T||T.live){const k=this.switchParams(g.uri,u==null?void 0:u.details);this.loadPlaylist(k)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(n){this.manualLevelIndex=n,this._startLevel===void 0&&(this._startLevel=n),n!==-1&&(this.level=n)}get firstLevel(){return this._firstLevel}set firstLevel(n){this._firstLevel=n}get startLevel(){if(this._startLevel===void 0){const n=this.hls.config.startLevel;return n!==void 0?n:this.hls.firstAutoLevel}return this._startLevel}set startLevel(n){this._startLevel=n}onError(n,o){o.fatal||!o.context||o.context.type===Ci.LEVEL&&o.context.level===this.level&&this.checkRetry(o)}onFragBuffered(n,{frag:o}){if(o!==void 0&&o.type===Us.MAIN){const i=o.elementaryStreams;if(!Object.keys(i).some(h=>!!i[h]))return;const u=this._levels[o.level];u!=null&&u.loadError&&(this.log(`Resetting level error count of ${u.loadError} on frag buffered`),u.loadError=0)}}onLevelLoaded(n,o){var i;const{level:u,details:h}=o,g=this._levels[u];if(!g){var b;this.warn(`Invalid level index ${u}`),(b=o.deliveryDirectives)!=null&&b.skip&&(h.deltaUpdateFailed=!0);return}u===this.currentLevelIndex?(g.fragmentError===0&&(g.loadError=0),this.playlistLoaded(u,o,g.details)):(i=o.deliveryDirectives)!=null&&i.skip&&(h.deltaUpdateFailed=!0)}loadPlaylist(n){super.loadPlaylist();const o=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){let u=i.uri;if(n)try{u=n.addDirectives(u)}catch(g){this.warn(`Could not construct new URL with HLS Delivery Directives: ${g}`)}const h=i.attrs["PATHWAY-ID"];this.log(`Loading level index ${o}${(n==null?void 0:n.msn)!==void 0?" at sn "+n.msn+" part "+n.part:""} with${h?" Pathway "+h:""} ${u}`),this.clearTimer(),this.hls.trigger(we.LEVEL_LOADING,{url:u,level:o,pathwayId:i.attrs["PATHWAY-ID"],id:0,deliveryDirectives:n||null})}}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(n){this.level=n,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=n)}removeLevel(n){var o;const i=this._levels.filter((u,h)=>h!==n?!0:(this.steering&&this.steering.removeLevel(u),u===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,u.details&&u.details.fragments.forEach(g=>g.level=-1)),!1));Pq(i),this._levels=i,this.currentLevelIndex>-1&&(o=this.currentLevel)!=null&&o.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(we.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(n,{levels:o}){this._levels=o}checkMaxAutoUpdated(){const{autoLevelCapping:n,maxAutoLevel:o,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==o&&(this._maxAutoLevel=o,this.hls.trigger(we.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:n,levels:this.levels,maxAutoLevel:o,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function $K(l){const n={};l.forEach(o=>{const i=o.groupId||"";o.id=n[i]=n[i]||0,n[i]++})}class Vme{constructor(n){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=n}abort(n){for(const i in this.keyUriToKeyInfo){const u=this.keyUriToKeyInfo[i].loader;if(u){var o;if(n&&n!==((o=u.context)==null?void 0:o.frag.type))return;u.abort()}}}detach(){for(const n in this.keyUriToKeyInfo){const o=this.keyUriToKeyInfo[n];(o.mediaKeySessionContext||o.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[n]}}destroy(){this.detach();for(const n in this.keyUriToKeyInfo){const o=this.keyUriToKeyInfo[n].loader;o&&o.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(n,o=nn.KEY_LOAD_ERROR,i,u,h){return new Xb({type:Gs.NETWORK_ERROR,details:o,fatal:!1,frag:n,response:h,error:i,networkDetails:u})}loadClear(n,o){if(this.emeController&&this.config.emeEnabled){const{sn:i,cc:u}=n;for(let h=0;h<o.length;h++){const g=o[h];if(u<=g.cc&&(i==="initSegment"||g.sn==="initSegment"||i<g.sn)){this.emeController.selectKeySystemFormat(g).then(b=>{g.setKeyFormat(b)});break}}}}load(n){return!n.decryptdata&&n.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(n).then(o=>this.loadInternal(n,o)):this.loadInternal(n)}loadInternal(n,o){var i,u;o&&n.setKeyFormat(o);const h=n.decryptdata;if(!h){const T=new Error(o?`Expected frag.decryptdata to be defined after setting format ${o}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(n,nn.KEY_LOAD_ERROR,T))}const g=h.uri;if(!g)return Promise.reject(this.createKeyLoadError(n,nn.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${g}"`)));let b=this.keyUriToKeyInfo[g];if((i=b)!=null&&i.decryptdata.key)return h.key=b.decryptdata.key,Promise.resolve({frag:n,keyInfo:b});if((u=b)!=null&&u.keyLoadPromise){var S;switch((S=b.mediaKeySessionContext)==null?void 0:S.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return b.keyLoadPromise.then(T=>(h.key=T.keyInfo.decryptdata.key,{frag:n,keyInfo:b}))}}switch(b=this.keyUriToKeyInfo[g]={decryptdata:h,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},h.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return h.keyFormat==="identity"?this.loadKeyHTTP(b,n):this.loadKeyEME(b,n);case"AES-128":return this.loadKeyHTTP(b,n);default:return Promise.reject(this.createKeyLoadError(n,nn.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${h.method}"`)))}}loadKeyEME(n,o){const i={frag:o,keyInfo:n};if(this.emeController&&this.config.emeEnabled){const u=this.emeController.loadKey(i);if(u)return(n.keyLoadPromise=u.then(h=>(n.mediaKeySessionContext=h,i))).catch(h=>{throw n.keyLoadPromise=null,h})}return Promise.resolve(i)}loadKeyHTTP(n,o){const i=this.config,u=i.loader,h=new u(i);return o.keyLoader=n.loader=h,n.keyLoadPromise=new Promise((g,b)=>{const S={keyInfo:n,frag:o,responseType:"arraybuffer",url:n.decryptdata.uri},T=i.keyLoadPolicy.default,k={loadPolicy:T,timeout:T.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},R={onSuccess:(V,z,$,W)=>{const{frag:Q,keyInfo:j,url:se}=$;if(!Q.decryptdata||j!==this.keyUriToKeyInfo[se])return b(this.createKeyLoadError(Q,nn.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),W));j.decryptdata.key=Q.decryptdata.key=new Uint8Array(V.data),Q.keyLoader=null,j.loader=null,g({frag:Q,keyInfo:j})},onError:(V,z,$,W)=>{this.resetLoader(z),b(this.createKeyLoadError(o,nn.KEY_LOAD_ERROR,new Error(`HTTP Error ${V.code} loading key ${V.text}`),$,Eu({url:S.url,data:void 0},V)))},onTimeout:(V,z,$)=>{this.resetLoader(z),b(this.createKeyLoadError(o,nn.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),$))},onAbort:(V,z,$)=>{this.resetLoader(z),b(this.createKeyLoadError(o,nn.INTERNAL_ABORTED,new Error("key loading aborted"),$))}};h.load(S,k,R)})}resetLoader(n){const{frag:o,keyInfo:i,url:u}=n,h=i.loader;o.keyLoader===h&&(o.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[u],h&&h.destroy()}}function xY(){return self.SourceBuffer||self.WebKitSourceBuffer}function yY(){if(!PT())return!1;const n=xY();return!n||n.prototype&&typeof n.prototype.appendBuffer=="function"&&typeof n.prototype.remove=="function"}function zme(){if(!yY())return!1;const l=PT();return typeof(l==null?void 0:l.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(n=>l.isTypeSupported(uR(n,"video")))||["mp4a.40.2","fLaC"].some(n=>l.isTypeSupported(uR(n,"audio"))))}function Gme(){var l;const n=xY();return typeof(n==null||(l=n.prototype)==null?void 0:l.changeType)=="function"}const Wme=250,cB=2,jme=.1,Kme=.05;class Zme{constructor(n,o,i,u){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=n,this.media=o,this.fragmentTracker=i,this.hls=u}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(n,o){const{config:i,media:u,stalled:h}=this;if(u===null)return;const{currentTime:g,seeking:b}=u,S=this.seeking&&!b,T=!this.seeking&&b;if(this.seeking=b,g!==n){if(this.moved=!0,b||(this.nudgeRetry=0),h!==null){if(this.stallReported){const Q=self.performance.now()-h;Mt.warn(`playback not stuck anymore @${g}, after ${Math.round(Q)}ms`),this.stallReported=!1}this.stalled=null}return}if(T||S){this.stalled=null;return}if(u.paused&&!b||u.ended||u.playbackRate===0||!Xa.getBuffered(u).length){this.nudgeRetry=0;return}const k=Xa.bufferInfo(u,g,0),R=k.nextStart||0;if(b){const Q=k.len>cB,j=!R||o&&o.start<=g||R-g>cB&&!this.fragmentTracker.getPartialFragment(g);if(Q||j)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var V;if(!(k.len>0)&&!R)return;const j=Math.max(R,k.start||0)-g,se=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,Y=(se==null||(V=se.details)==null?void 0:V.live)?se.details.targetduration*2:cB,me=this.fragmentTracker.getPartialFragment(g);if(j>0&&(j<=Y||me)){u.paused||this._trySkipBufferHole(me);return}}const z=self.performance.now();if(h===null){this.stalled=z;return}const $=z-h;if(!b&&$>=Wme&&(this._reportStall(k),!this.media))return;const W=Xa.bufferInfo(u,g,i.maxBufferHole);this._tryFixBufferStall(W,$)}_tryFixBufferStall(n,o){const{config:i,fragmentTracker:u,media:h}=this;if(h===null)return;const g=h.currentTime,b=u.getPartialFragment(g);b&&(this._trySkipBufferHole(b)||!this.media)||(n.len>i.maxBufferHole||n.nextStart&&n.nextStart-g<i.maxBufferHole)&&o>i.highBufferWatchdogPeriod*1e3&&(Mt.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(n){const{hls:o,media:i,stallReported:u}=this;if(!u&&i){this.stallReported=!0;const h=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${JSON.stringify(n)})`);Mt.warn(h.message),o.trigger(we.ERROR,{type:Gs.MEDIA_ERROR,details:nn.BUFFER_STALLED_ERROR,fatal:!1,error:h,buffer:n.len})}}_trySkipBufferHole(n){const{config:o,hls:i,media:u}=this;if(u===null)return 0;const h=u.currentTime,g=Xa.bufferInfo(u,h,0),b=h<g.start?g.start:g.nextStart;if(b){const S=g.len<=o.maxBufferHole,T=g.len>0&&g.len<1&&u.readyState<3,k=b-h;if(k>0&&(S||T)){if(k>o.maxBufferHole){const{fragmentTracker:V}=this;let z=!1;if(h===0){const $=V.getAppendedFrag(0,Us.MAIN);$&&b<$.end&&(z=!0)}if(!z){const $=n||V.getAppendedFrag(h,Us.MAIN);if($){let W=!1,Q=$.end;for(;Q<b;){const j=V.getPartialFragment(Q);if(j)Q+=j.duration;else{W=!0;break}}if(W)return 0}}}const R=Math.max(b+Kme,h+jme);if(Mt.warn(`skipping hole, adjusting currentTime from ${h} to ${R}`),this.moved=!0,this.stalled=null,u.currentTime=R,n&&!n.gap){const V=new Error(`fragment loaded with buffer holes, seeking from ${h} to ${R}`);i.trigger(we.ERROR,{type:Gs.MEDIA_ERROR,details:nn.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:V,reason:V.message,frag:n})}return R}}return 0}_tryNudgeBuffer(){const{config:n,hls:o,media:i,nudgeRetry:u}=this;if(i===null)return;const h=i.currentTime;if(this.nudgeRetry++,u<n.nudgeMaxRetry){const g=h+(u+1)*n.nudgeOffset,b=new Error(`Nudging 'currentTime' from ${h} to ${g}`);Mt.warn(b.message),i.currentTime=g,o.trigger(we.ERROR,{type:Gs.MEDIA_ERROR,details:nn.BUFFER_NUDGE_ON_STALL,error:b,fatal:!1})}else{const g=new Error(`Playhead still not moving while enough data buffered @${h} after ${n.nudgeMaxRetry} nudges`);Mt.error(g.message),o.trigger(we.ERROR,{type:Gs.MEDIA_ERROR,details:nn.BUFFER_STALLED_ERROR,error:g,fatal:!0})}}}const qme=100;class Yme extends hz{constructor(n,o,i){super(n,o,i,"[stream-controller]",Us.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:n}=this;n.on(we.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(we.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(we.MANIFEST_LOADING,this.onManifestLoading,this),n.on(we.MANIFEST_PARSED,this.onManifestParsed,this),n.on(we.LEVEL_LOADING,this.onLevelLoading,this),n.on(we.LEVEL_LOADED,this.onLevelLoaded,this),n.on(we.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),n.on(we.ERROR,this.onError,this),n.on(we.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),n.on(we.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),n.on(we.BUFFER_CREATED,this.onBufferCreated,this),n.on(we.BUFFER_FLUSHED,this.onBufferFlushed,this),n.on(we.LEVELS_UPDATED,this.onLevelsUpdated,this),n.on(we.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:n}=this;n.off(we.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(we.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(we.MANIFEST_LOADING,this.onManifestLoading,this),n.off(we.MANIFEST_PARSED,this.onManifestParsed,this),n.off(we.LEVEL_LOADED,this.onLevelLoaded,this),n.off(we.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),n.off(we.ERROR,this.onError,this),n.off(we.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),n.off(we.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),n.off(we.BUFFER_CREATED,this.onBufferCreated,this),n.off(we.BUFFER_FLUSHED,this.onBufferFlushed,this),n.off(we.LEVELS_UPDATED,this.onLevelsUpdated,this),n.off(we.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(n){if(this.levels){const{lastCurrentTime:o,hls:i}=this;if(this.stopLoad(),this.setInterval(qme),this.level=-1,!this.startFragRequested){let u=i.startLevel;u===-1&&(i.config.testBandwidth&&this.levels.length>1?(u=0,this.bitrateTest=!0):u=i.firstAutoLevel),i.nextLoadLevel=u,this.level=i.loadLevel,this.loadedmetadata=!1}o>0&&n===-1&&(this.log(`Override startPosition with lastCurrentTime @${o.toFixed(3)}`),n=o),this.state=Hn.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=n,this.tick()}else this._forceStartLoad=!0,this.state=Hn.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Hn.WAITING_LEVEL:{const{levels:o,level:i}=this,u=o==null?void 0:o[i],h=u==null?void 0:u.details;if(h&&(!h.live||this.levelLastLoaded===u)){if(this.waitForCdnTuneIn(h))break;this.state=Hn.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=Hn.IDLE;break}break}case Hn.FRAG_LOADING_WAITING_RETRY:{var n;const o=self.performance.now(),i=this.retryDate;if(!i||o>=i||(n=this.media)!=null&&n.seeking){const{levels:u,level:h}=this,g=u==null?void 0:u[h];this.resetStartWhenNotLoaded(g||null),this.state=Hn.IDLE}}break}this.state===Hn.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:n,levelLastLoaded:o,levels:i,media:u}=this;if(o===null||!u&&(this.startFragRequested||!n.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const h=n.nextLoadLevel;if(!(i!=null&&i[h]))return;const g=i[h],b=this.getMainFwdBufferInfo();if(b===null)return;const S=this.getLevelDetails();if(S&&this._streamEnded(b,S)){const W={};this.altAudio&&(W.type="video"),this.hls.trigger(we.BUFFER_EOS,W),this.state=Hn.ENDED;return}n.loadLevel!==h&&n.manualLevel===-1&&this.log(`Adapting to level ${h} from level ${this.level}`),this.level=n.nextLoadLevel=h;const T=g.details;if(!T||this.state===Hn.WAITING_LEVEL||T.live&&this.levelLastLoaded!==g){this.level=h,this.state=Hn.WAITING_LEVEL;return}const k=b.len,R=this.getMaxBufferLength(g.maxBitrate);if(k>=R)return;this.backtrackFragment&&this.backtrackFragment.start>b.end&&(this.backtrackFragment=null);const V=this.backtrackFragment?this.backtrackFragment.start:b.end;let z=this.getNextFragment(V,T);if(this.couldBacktrack&&!this.fragPrevious&&z&&z.sn!=="initSegment"&&this.fragmentTracker.getState(z)!==Su.OK){var $;const Q=(($=this.backtrackFragment)!=null?$:z).sn-T.startSN,j=T.fragments[Q-1];j&&z.cc===j.cc&&(z=j,this.fragmentTracker.removeFragment(j))}else this.backtrackFragment&&b.len&&(this.backtrackFragment=null);if(z&&this.isLoopLoading(z,V)){if(!z.gap){const Q=this.audioOnly&&!this.altAudio?ya.AUDIO:ya.VIDEO,j=(Q===ya.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;j&&this.afterBufferFlushed(j,Q,Us.MAIN)}z=this.getNextFragmentLoopLoading(z,T,b,Us.MAIN,R)}z&&(z.initSegment&&!z.initSegment.data&&!this.bitrateTest&&(z=z.initSegment),this.loadFragment(z,g,V))}loadFragment(n,o,i){const u=this.fragmentTracker.getState(n);this.fragCurrent=n,u===Su.NOT_LOADED||u===Su.PARTIAL?n.sn==="initSegment"?this._loadInitSegment(n,o):this.bitrateTest?(this.log(`Fragment ${n.sn} of level ${n.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(n,o)):(this.startFragRequested=!0,super.loadFragment(n,o,i)):this.clearTrackerIfNeeded(n)}getBufferedFrag(n){return this.fragmentTracker.getBufferedFrag(n,Us.MAIN)}followingBufferedFrag(n){return n?this.getBufferedFrag(n.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:n,media:o}=this;if(o!=null&&o.readyState){let i;const u=this.getAppendedFrag(o.currentTime);u&&u.start>1&&this.flushMainBuffer(0,u.start-1);const h=this.getLevelDetails();if(h!=null&&h.live){const b=this.getMainFwdBufferInfo();if(!b||b.len<h.targetduration*2)return}if(!o.paused&&n){const b=this.hls.nextLoadLevel,S=n[b],T=this.fragLastKbps;T&&this.fragCurrent?i=this.fragCurrent.duration*S.maxBitrate/(1e3*T)+1:i=0}else i=0;const g=this.getBufferedFrag(o.currentTime+i);if(g){const b=this.followingBufferedFrag(g);if(b){this.abortCurrentFrag();const S=b.maxStartPTS?b.maxStartPTS:b.start,T=b.duration,k=Math.max(g.end,S+Math.min(Math.max(T-this.config.maxFragLookUpTolerance,T*(this.couldBacktrack?.5:.125)),T*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(k,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const n=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,n&&(n.abortRequests(),this.fragmentTracker.removeFragment(n)),this.state){case Hn.KEY_LOADING:case Hn.FRAG_LOADING:case Hn.FRAG_LOADING_WAITING_RETRY:case Hn.PARSING:case Hn.PARSED:this.state=Hn.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(n,o){super.flushMainBuffer(n,o,this.altAudio?"video":null)}onMediaAttached(n,o){super.onMediaAttached(n,o);const i=o.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new Zme(this.config,i,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:n}=this;n&&this.onvplaying&&this.onvseeked&&(n.removeEventListener("playing",this.onvplaying),n.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const n=this.media,o=n?n.currentTime:null;Xo(o)&&this.log(`Media seeked to ${o.toFixed(3)}`);const i=this.getMainFwdBufferInfo();if(i===null||i.len===0){this.warn(`Main forward buffer length on "seeked" event ${i?i.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(we.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(n,o){let i=!1,u=!1;o.levels.forEach(h=>{const g=h.audioCodec;g&&(i=i||g.indexOf("mp4a.40.2")!==-1,u=u||g.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=i&&u&&!Gme(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=o.levels,this.startFragRequested=!1}onLevelLoading(n,o){const{levels:i}=this;if(!i||this.state!==Hn.IDLE)return;const u=i[o.level];(!u.details||u.details.live&&this.levelLastLoaded!==u||this.waitForCdnTuneIn(u.details))&&(this.state=Hn.WAITING_LEVEL)}onLevelLoaded(n,o){var i;const{levels:u}=this,h=o.level,g=o.details,b=g.totalduration;if(!u){this.warn(`Levels were reset while loading level ${h}`);return}this.log(`Level ${h} loaded [${g.startSN},${g.endSN}]${g.lastPartSn?`[part-${g.lastPartSn}-${g.lastPartIndex}]`:""}, cc [${g.startCC}, ${g.endCC}] duration:${b}`);const S=u[h],T=this.fragCurrent;T&&(this.state===Hn.FRAG_LOADING||this.state===Hn.FRAG_LOADING_WAITING_RETRY)&&T.level!==o.level&&T.loader&&this.abortCurrentFrag();let k=0;if(g.live||(i=S.details)!=null&&i.live){var R;if(this.checkLiveUpdate(g),g.deltaUpdateFailed)return;k=this.alignPlaylists(g,S.details,(R=this.levelLastLoaded)==null?void 0:R.details)}if(S.details=g,this.levelLastLoaded=S,this.hls.trigger(we.LEVEL_UPDATED,{details:g,level:h}),this.state===Hn.WAITING_LEVEL){if(this.waitForCdnTuneIn(g))return;this.state=Hn.IDLE}this.startFragRequested?g.live&&this.synchronizeToLiveEdge(g):this.setStartPosition(g,k),this.tick()}_handleFragmentLoadProgress(n){var o;const{frag:i,part:u,payload:h}=n,{levels:g}=this;if(!g){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const b=g[i.level],S=b.details;if(!S){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const T=b.videoCodec,k=S.PTSKnown||!S.live,R=(o=i.initSegment)==null?void 0:o.data,V=this._getAudioCodec(b),z=this.transmuxer=this.transmuxer||new eY(this.hls,Us.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),$=u?u.index:-1,W=$!==-1,Q=new dz(i.level,i.sn,i.stats.chunkCount,h.byteLength,$,W),j=this.initPTS[i.cc];z.push(h,R,V,T,i,u,S.totalduration,k,Q,j)}onAudioTrackSwitching(n,o){const i=this.altAudio;if(!!!o.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const g=this.fragCurrent;g&&(this.log("Switching to main audio track, cancel main fragment load"),g.abortRequests(),this.fragmentTracker.removeFragment(g)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const h=this.hls;i&&(h.trigger(we.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),h.trigger(we.AUDIO_TRACK_SWITCHED,o)}}onAudioTrackSwitched(n,o){const i=o.id,u=!!this.hls.audioTracks[i].url;if(u){const h=this.videoBuffer;h&&this.mediaBuffer!==h&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=h)}this.altAudio=u,this.tick()}onBufferCreated(n,o){const i=o.tracks;let u,h,g=!1;for(const b in i){const S=i[b];if(S.id==="main"){if(h=b,u=S,b==="video"){const T=i[b];T&&(this.videoBuffer=T.buffer)}}else g=!0}g&&u?(this.log(`Alternate track found, use ${h}.buffered to schedule main fragment loading`),this.mediaBuffer=u.buffer):this.mediaBuffer=this.media}onFragBuffered(n,o){const{frag:i,part:u}=o;if(i&&i.type!==Us.MAIN)return;if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${u?" p: "+u.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===Hn.PARSED&&(this.state=Hn.IDLE);return}const h=u?u.stats:i.stats;this.fragLastKbps=Math.round(8*h.total/(h.buffering.end-h.loading.first)),i.sn!=="initSegment"&&(this.fragPrevious=i),this.fragBufferedComplete(i,u)}onError(n,o){var i;if(o.fatal){this.state=Hn.ERROR;return}switch(o.details){case nn.FRAG_GAP:case nn.FRAG_PARSING_ERROR:case nn.FRAG_DECRYPT_ERROR:case nn.FRAG_LOAD_ERROR:case nn.FRAG_LOAD_TIMEOUT:case nn.KEY_LOAD_ERROR:case nn.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Us.MAIN,o);break;case nn.LEVEL_LOAD_ERROR:case nn.LEVEL_LOAD_TIMEOUT:case nn.LEVEL_PARSING_ERROR:!o.levelRetry&&this.state===Hn.WAITING_LEVEL&&((i=o.context)==null?void 0:i.type)===Ci.LEVEL&&(this.state=Hn.IDLE);break;case nn.BUFFER_APPEND_ERROR:case nn.BUFFER_FULL_ERROR:if(!o.parent||o.parent!=="main")return;if(o.details===nn.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(o)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case nn.INTERNAL_EXCEPTION:this.recoverWorkerError(o);break}}checkBuffer(){const{media:n,gapController:o}=this;if(!(!n||!o||!n.readyState)){if(this.loadedmetadata||!Xa.getBuffered(n).length){const i=this.state!==Hn.IDLE?this.fragCurrent:null;o.poll(this.lastCurrentTime,i)}this.lastCurrentTime=n.currentTime}}onFragLoadEmergencyAborted(){this.state=Hn.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(n,{type:o}){if(o!==ya.AUDIO||this.audioOnly&&!this.altAudio){const i=(o===ya.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(i,o,Us.MAIN),this.tick()}}onLevelsUpdated(n,o){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=o.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:n}=this;if(!n)return;const o=n.currentTime;let i=this.startPosition;if(i>=0&&o<i){if(n.seeking){this.log(`could not seek to ${i}, already seeking at ${o}`);return}const u=Xa.getBuffered(n),g=(u.length?u.start(0):0)-i;g>0&&(g<this.config.maxBufferHole||g<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${g} to match buffer start`),i+=g,this.startPosition=i),this.log(`seek to target start position ${i} from current time ${o}`),n.currentTime=i}}_getAudioCodec(n){let o=this.config.defaultAudioCodec||n.audioCodec;return this.audioCodecSwap&&o&&(this.log("Swapping audio codec"),o.indexOf("mp4a.40.5")!==-1?o="mp4a.40.2":o="mp4a.40.5"),o}_loadBitrateTestFrag(n,o){n.bitrateTest=!0,this._doFragLoad(n,o).then(i=>{const{hls:u}=this;if(!i||this.fragContextChanged(n))return;o.fragmentError=0,this.state=Hn.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const h=n.stats;h.parsing.start=h.parsing.end=h.buffering.start=h.buffering.end=self.performance.now(),u.trigger(we.FRAG_LOADED,i),n.bitrateTest=!1})}_handleTransmuxComplete(n){var o;const i="main",{hls:u}=this,{remuxResult:h,chunkMeta:g}=n,b=this.getCurrentContext(g);if(!b){this.resetWhenMissingContext(g);return}const{frag:S,part:T,level:k}=b,{video:R,text:V,id3:z,initSegment:$}=h,{details:W}=k,Q=this.altAudio?void 0:h.audio;if(this.fragContextChanged(S)){this.fragmentTracker.removeFragment(S);return}if(this.state=Hn.PARSING,$){if($!=null&&$.tracks){const re=S.initSegment||S;this._bufferInitSegment(k,$.tracks,re,g),u.trigger(we.FRAG_PARSING_INIT_SEGMENT,{frag:re,id:i,tracks:$.tracks})}const j=$.initPTS,se=$.timescale;Xo(j)&&(this.initPTS[S.cc]={baseTime:j,timescale:se},u.trigger(we.INIT_PTS_FOUND,{frag:S,id:i,initPTS:j,timescale:se}))}if(R&&W&&S.sn!=="initSegment"){const j=W.fragments[S.sn-1-W.startSN],se=S.sn===W.startSN,re=!j||S.cc>j.cc;if(h.independent!==!1){const{startPTS:Y,endPTS:me,startDTS:ae,endDTS:Ce}=R;if(T)T.elementaryStreams[R.type]={startPTS:Y,endPTS:me,startDTS:ae,endDTS:Ce};else if(R.firstKeyFrame&&R.independent&&g.id===1&&!re&&(this.couldBacktrack=!0),R.dropped&&R.independent){const Ue=this.getMainFwdBufferInfo(),ot=(Ue?Ue.end:this.getLoadPosition())+this.config.maxBufferHole,Ae=R.firstKeyFramePTS?R.firstKeyFramePTS:Y;if(!se&&ot<Ae-this.config.maxBufferHole&&!re){this.backtrack(S);return}else re&&(S.gap=!0);S.setElementaryStreamInfo(R.type,S.start,me,S.start,Ce,!0)}else se&&Y>cB&&(S.gap=!0);S.setElementaryStreamInfo(R.type,Y,me,ae,Ce),this.backtrackFragment&&(this.backtrackFragment=S),this.bufferFragmentData(R,S,T,g,se||re)}else if(se||re)S.gap=!0;else{this.backtrack(S);return}}if(Q){const{startPTS:j,endPTS:se,startDTS:re,endDTS:Y}=Q;T&&(T.elementaryStreams[ya.AUDIO]={startPTS:j,endPTS:se,startDTS:re,endDTS:Y}),S.setElementaryStreamInfo(ya.AUDIO,j,se,re,Y),this.bufferFragmentData(Q,S,T,g)}if(W&&z!=null&&(o=z.samples)!=null&&o.length){const j={id:i,frag:S,details:W,samples:z.samples};u.trigger(we.FRAG_PARSING_METADATA,j)}if(W&&V){const j={id:i,frag:S,details:W,samples:V.samples};u.trigger(we.FRAG_PARSING_USERDATA,j)}}_bufferInitSegment(n,o,i,u){if(this.state!==Hn.PARSING)return;this.audioOnly=!!o.audio&&!o.video,this.altAudio&&!this.audioOnly&&delete o.audio;const{audio:h,video:g,audiovideo:b}=o;if(h){let S=n.audioCodec;const T=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(S&&(S.indexOf("mp4a.40.5")!==-1?S="mp4a.40.2":S="mp4a.40.5"),h.metadata.channelCount!==1&&T.indexOf("firefox")===-1&&(S="mp4a.40.5")),S&&S.indexOf("mp4a.40.5")!==-1&&T.indexOf("android")!==-1&&h.container!=="audio/mpeg"&&(S="mp4a.40.2",this.log(`Android: force audio codec to ${S}`)),n.audioCodec&&n.audioCodec!==S&&this.log(`Swapping manifest audio codec "${n.audioCodec}" for "${S}"`),h.levelCodec=S,h.id="main",this.log(`Init audio buffer, container:${h.container}, codecs[selected/level/parsed]=[${S||""}/${n.audioCodec||""}/${h.codec}]`)}g&&(g.levelCodec=n.videoCodec,g.id="main",this.log(`Init video buffer, container:${g.container}, codecs[level/parsed]=[${n.videoCodec||""}/${g.codec}]`)),b&&this.log(`Init audiovideo buffer, container:${b.container}, codecs[level/parsed]=[${n.codecs}/${b.codec}]`),this.hls.trigger(we.BUFFER_CODECS,o),Object.keys(o).forEach(S=>{const k=o[S].initSegment;k!=null&&k.byteLength&&this.hls.trigger(we.BUFFER_APPENDING,{type:S,data:k,frag:i,part:null,chunkMeta:u,parent:i.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,Us.MAIN)}backtrack(n){this.couldBacktrack=!0,this.backtrackFragment=n,this.resetTransmuxer(),this.flushBufferGap(n),this.fragmentTracker.removeFragment(n),this.fragPrevious=null,this.nextLoadPosition=n.start,this.state=Hn.IDLE}checkFragmentChanged(){const n=this.media;let o=null;if(n&&n.readyState>1&&n.seeking===!1){const i=n.currentTime;if(Xa.isBuffered(n,i)?o=this.getAppendedFrag(i):Xa.isBuffered(n,i+.1)&&(o=this.getAppendedFrag(i+.1)),o){this.backtrackFragment=null;const u=this.fragPlaying,h=o.level;(!u||o.sn!==u.sn||u.level!==h)&&(this.fragPlaying=o,this.hls.trigger(we.FRAG_CHANGED,{frag:o}),(!u||u.level!==h)&&this.hls.trigger(we.LEVEL_SWITCHED,{level:h}))}}}get nextLevel(){const n=this.nextBufferedFrag;return n?n.level:-1}get currentFrag(){const n=this.media;return n?this.fragPlaying||this.getAppendedFrag(n.currentTime):null}get currentProgramDateTime(){const n=this.media;if(n){const o=n.currentTime,i=this.currentFrag;if(i&&Xo(o)&&Xo(i.programDateTime)){const u=i.programDateTime+(o-i.start)*1e3;return new Date(u)}}return null}get currentLevel(){const n=this.currentFrag;return n?n.level:-1}get nextBufferedFrag(){const n=this.currentFrag;return n?this.followingBufferedFrag(n):null}get forceStartLoad(){return this._forceStartLoad}}class d1{static get version(){return"1.5.7"}static isMSESupported(){return yY()}static isSupported(){return zme()}static getMediaSource(){return PT()}static get Events(){return we}static get ErrorTypes(){return Gs}static get ErrorDetails(){return nn}static get DefaultConfig(){return d1.defaultConfig?d1.defaultConfig:vY}static set DefaultConfig(n){d1.defaultConfig=n}constructor(n={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new vz,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,Vue(n.debug||!1,"Hls instance");const o=this.config=$me(d1.DefaultConfig,n);this.userConfig=n,o.progressive&&Hme(o);const{abrController:i,bufferController:u,capLevelController:h,errorController:g,fpsController:b}=o,S=new g(this),T=this.abrController=new i(this),k=this.bufferController=new u(this),R=this.capLevelController=new h(this),V=new b(this),z=new Mde(this),$=new Hde(this),W=o.contentSteeringController,Q=W?new W(this):null,j=this.levelController=new Ume(this,Q),se=new pfe(this),re=new Vme(this.config),Y=this.streamController=new Yme(this,se,re);R.setStreamController(Y),V.setStreamController(Y);const me=[z,j,Y];Q&&me.splice(1,0,Q),this.networkControllers=me;const ae=[T,k,R,V,$,se];this.audioTrackController=this.createController(o.audioTrackController,me);const Ce=o.audioStreamController;Ce&&me.push(new Ce(this,se,re)),this.subtitleTrackController=this.createController(o.subtitleTrackController,me);const Ue=o.subtitleStreamController;Ue&&me.push(new Ue(this,se,re)),this.createController(o.timelineController,ae),re.emeController=this.emeController=this.createController(o.emeController,ae),this.cmcdController=this.createController(o.cmcdController,ae),this.latencyController=this.createController(Ude,ae),this.coreComponents=ae,me.push(S);const ot=S.onErrorOut;typeof ot=="function"&&this.on(we.ERROR,ot,S)}createController(n,o){if(n){const i=new n(this);return o&&o.push(i),i}return null}on(n,o,i=this){this._emitter.on(n,o,i)}once(n,o,i=this){this._emitter.once(n,o,i)}removeAllListeners(n){this._emitter.removeAllListeners(n)}off(n,o,i=this,u){this._emitter.off(n,o,i,u)}listeners(n){return this._emitter.listeners(n)}emit(n,o,i){return this._emitter.emit(n,o,i)}trigger(n,o){if(this.config.debug)return this.emit(n,n,o);try{return this.emit(n,n,o)}catch(i){if(Mt.error("An internal error happened while handling event "+n+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const u=n===we.ERROR;this.trigger(we.ERROR,{type:Gs.OTHER_ERROR,details:nn.INTERNAL_EXCEPTION,fatal:u,event:n,error:i}),this.triggeringException=!1}}return!1}listenerCount(n){return this._emitter.listenerCount(n)}destroy(){Mt.log("destroy"),this.trigger(we.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(o=>o.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(o=>o.destroy()),this.coreComponents.length=0;const n=this.config;n.xhrSetup=n.fetchSetup=void 0,this.userConfig=null}attachMedia(n){Mt.log("attachMedia"),this._media=n,this.trigger(we.MEDIA_ATTACHING,{media:n})}detachMedia(){Mt.log("detachMedia"),this.trigger(we.MEDIA_DETACHING,void 0),this._media=null}loadSource(n){this.stopLoad();const o=this.media,i=this.url,u=this.url=rz.buildAbsoluteURL(self.location.href,n,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,Mt.log(`loadSource:${u}`),o&&i&&(i!==u||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(o)),this.trigger(we.MANIFEST_LOADING,{url:n})}startLoad(n=-1){Mt.log(`startLoad(${n})`),this.started=!0,this.networkControllers.forEach(o=>{o.startLoad(n)})}stopLoad(){Mt.log("stopLoad"),this.started=!1,this.networkControllers.forEach(n=>{n.stopLoad()})}resumeBuffering(){this.started&&this.networkControllers.forEach(n=>{"fragmentLoader"in n&&n.startLoad(-1)})}pauseBuffering(){this.networkControllers.forEach(n=>{"fragmentLoader"in n&&n.stopLoad()})}swapAudioCodec(){Mt.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){Mt.log("recoverMediaError");const n=this._media;this.detachMedia(),n&&this.attachMedia(n)}removeLevel(n){this.levelController.removeLevel(n)}get levels(){const n=this.levelController.levels;return n||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(n){Mt.log(`set currentLevel:${n}`),this.levelController.manualLevel=n,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(n){Mt.log(`set nextLevel:${n}`),this.levelController.manualLevel=n,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(n){Mt.log(`set loadLevel:${n}`),this.levelController.manualLevel=n}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(n){this.levelController.nextLoadLevel=n}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(n){Mt.log(`set firstLevel:${n}`),this.levelController.firstLevel=n}get startLevel(){const n=this.levelController.startLevel;return n===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:n}set startLevel(n){Mt.log(`set startLevel:${n}`),n!==-1&&(n=Math.max(n,this.minAutoLevel)),this.levelController.startLevel=n}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(n){const o=!!n;o!==this.config.capLevelToPlayerSize&&(o?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=o)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:n}=this.abrController;return n?n.getEstimate():NaN}set bandwidthEstimate(n){this.abrController.resetEstimator(n)}get ttfbEstimate(){const{bwEstimator:n}=this.abrController;return n?n.getEstimateTTFB():NaN}set autoLevelCapping(n){this._autoLevelCapping!==n&&(Mt.log(`set autoLevelCapping:${n}`),this._autoLevelCapping=n,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(n){Vde(n)&&this._maxHdcpLevel!==n&&(this._maxHdcpLevel=n,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:n,config:{minAutoBitrate:o}}=this;if(!n)return 0;const i=n.length;for(let u=0;u<i;u++)if(n[u].maxBitrate>=o)return u;return 0}get maxAutoLevel(){const{levels:n,autoLevelCapping:o,maxHdcpLevel:i}=this;let u;if(o===-1&&n!=null&&n.length?u=n.length-1:u=o,i)for(let h=u;h--;){const g=n[h].attrs["HDCP-LEVEL"];if(g&&g<=i)return h}return u}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(n){this.abrController.nextAutoLevel=n}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(n){var o;return(o=this.audioTrackController)==null?void 0:o.setAudioOption(n)}setSubtitleOption(n){var o;return(o=this.subtitleTrackController)==null||o.setSubtitleOption(n),null}get allAudioTracks(){const n=this.audioTrackController;return n?n.allAudioTracks:[]}get audioTracks(){const n=this.audioTrackController;return n?n.audioTracks:[]}get audioTrack(){const n=this.audioTrackController;return n?n.audioTrack:-1}set audioTrack(n){const o=this.audioTrackController;o&&(o.audioTrack=n)}get allSubtitleTracks(){const n=this.subtitleTrackController;return n?n.allSubtitleTracks:[]}get subtitleTracks(){const n=this.subtitleTrackController;return n?n.subtitleTracks:[]}get subtitleTrack(){const n=this.subtitleTrackController;return n?n.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(n){const o=this.subtitleTrackController;o&&(o.subtitleTrack=n)}get subtitleDisplay(){const n=this.subtitleTrackController;return n?n.subtitleDisplay:!1}set subtitleDisplay(n){const o=this.subtitleTrackController;o&&(o.subtitleDisplay=n)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(n){this.config.lowLatencyMode=n}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}d1.defaultConfig=void 0;class Xme{constructor(){this.init()}init(){this.bindVideos()}bindVideos(){const n=document.querySelectorAll(".js-video"),o={root:null,rootMargin:"0px",threshold:.1},i=new IntersectionObserver((u,h)=>{u.forEach(g=>{g.isIntersecting&&(new Jme(g.target),h.unobserve(g.target))})},o);n.forEach(u=>{i.observe(u)})}}class Jme{constructor(n){this.element=n,this.init()}init(){this.initVideo()}initVideo(){this.video=document.createElement("video"),this.video.classList.add("w-full"),this.video.setAttribute("playsinline",""),this.video.setAttribute("muted",""),this.video.setAttribute("loop",""),this.video.setAttribute("autoplay",""),this.element.dataset.controls&&this.video.setAttribute("controls",""),this.element.dataset.cover&&(this.video.classList.add("w-full"),this.video.classList.add("h-full"),this.video.classList.add("object-cover")),this.element.appendChild(this.video);const n=this.element.dataset.video_url;let o="";n.includes(".m3u8")&&(o="m3u8"),n.includes(".mp4")&&(o="mp4"),n.includes("vimeo.com")&&(o="vimeo"),n.includes("youtube.com")&&(o="youtube"),o==="m3u8"?d1.isSupported()?(this.hls=new d1({maxMaxBufferLength:4,startLevel:3}),this.hls.loadSource(n),this.hls.attachMedia(this.video),this.video.muted=!0):this.video.canPlayType("application/vnd.apple.mpegurl")&&(this.video.src=n,this.video.muted=!0):o==="mp4"&&(this.video.src=n,this.video.muted=!0)}}var wY={exports:{}};(function(l){(function(){var n=function(e){if(e===null)return"null";if(e===void 0)return"undefined";var t=typeof e;return t==="object"&&(Array.prototype.isPrototypeOf(e)||e.constructor&&e.constructor.name==="Array")?"array":t==="object"&&(String.prototype.isPrototypeOf(e)||e.constructor&&e.constructor.name==="String")?"string":t},o=function(e){return["undefined","boolean","number","string","function","xml","null"].indexOf(e)!==-1},i=function(e,t){var s=Array.prototype.slice.call(e);return s.sort(t)},u=function(e,t){return h(function(s,a){return e.eq(t(s),t(a))})},h=function(e){return{eq:e}},g=h(function(e,t){return e===t}),b=g,S=function(e){return h(function(t,s){if(t.length!==s.length)return!1;for(var a=t.length,d=0;d<a;d++)if(!e.eq(t[d],s[d]))return!1;return!0})},T=function(e,t){return u(S(e),function(s){return i(s,t)})},k=function(e){return h(function(t,s){var a=Object.keys(t),d=Object.keys(s);if(!T(b).eq(a,d))return!1;for(var p=a.length,v=0;v<p;v++){var C=a[v];if(!e.eq(t[C],s[C]))return!1}return!0})},R=h(function(e,t){if(e===t)return!0;var s=n(e),a=n(t);return s!==a?!1:o(s)?e===t:s==="array"?S(R).eq(e,t):s==="object"?k(R).eq(e,t):!1});const V=Object.getPrototypeOf,z=(e,t,s)=>{var a;return s(e,t.prototype)?!0:((a=e.constructor)===null||a===void 0?void 0:a.name)===t.name},$=e=>{const t=typeof e;return e===null?"null":t==="object"&&Array.isArray(e)?"array":t==="object"&&z(e,String,(s,a)=>a.isPrototypeOf(s))?"string":t},W=e=>t=>$(t)===e,Q=e=>t=>typeof t===e,j=e=>t=>e===t,se=(e,t)=>Y(e)&&z(e,t,(s,a)=>V(s)===a),re=W("string"),Y=W("object"),me=e=>se(e,Object),ae=W("array"),Ce=j(null),Ue=Q("boolean"),ot=j(void 0),Ae=e=>e==null,ve=e=>!Ae(e),Oe=Q("function"),O=Q("number"),De=(e,t)=>{if(ae(e)){for(let s=0,a=e.length;s<a;++s)if(!t(e[s]))return!1;return!0}return!1},Fe=()=>{},st=(e,t)=>(...s)=>e(t.apply(null,s)),Ut=(e,t)=>s=>e(t(s)),et=e=>()=>e,Dt=e=>e,Xe=(e,t)=>e===t;function it(e,...t){return(...s)=>{const a=t.concat(s);return e.apply(null,a)}}const qe=e=>t=>!e(t),mt=e=>()=>{throw new Error(e)},Un=e=>e(),on=e=>{e()},vt=et(!1),an=et(!0);class J{constructor(t,s){this.tag=t,this.value=s}static some(t){return new J(!0,t)}static none(){return J.singletonNone}fold(t,s){return this.tag?s(this.value):t()}isSome(){return this.tag}isNone(){return!this.tag}map(t){return this.tag?J.some(t(this.value)):J.none()}bind(t){return this.tag?t(this.value):J.none()}exists(t){return this.tag&&t(this.value)}forall(t){return!this.tag||t(this.value)}filter(t){return!this.tag||t(this.value)?this:J.none()}getOr(t){return this.tag?this.value:t}or(t){return this.tag?this:t}getOrThunk(t){return this.tag?this.value:t()}orThunk(t){return this.tag?this:t()}getOrDie(t){if(this.tag)return this.value;throw new Error(t??"Called getOrDie on None")}static from(t){return ve(t)?J.some(t):J.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(t){this.tag&&t(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}J.singletonNone=new J(!1);const Bn=Array.prototype.slice,Vn=Array.prototype.indexOf,Rn=Array.prototype.push,An=(e,t)=>Vn.call(e,t),jn=(e,t)=>{const s=An(e,t);return s===-1?J.none():J.some(s)},to=(e,t)=>An(e,t)>-1,mo=(e,t)=>{for(let s=0,a=e.length;s<a;s++){const d=e[s];if(t(d,s))return!0}return!1},$t=(e,t)=>{const s=e.length,a=new Array(s);for(let d=0;d<s;d++){const p=e[d];a[d]=t(p,d)}return a},xe=(e,t)=>{for(let s=0,a=e.length;s<a;s++){const d=e[s];t(d,s)}},It=(e,t)=>{for(let s=e.length-1;s>=0;s--){const a=e[s];t(a,s)}},Dn=(e,t)=>{const s=[],a=[];for(let d=0,p=e.length;d<p;d++){const v=e[d];(t(v,d)?s:a).push(v)}return{pass:s,fail:a}},Ct=(e,t)=>{const s=[];for(let a=0,d=e.length;a<d;a++){const p=e[a];t(p,a)&&s.push(p)}return s},yo=(e,t,s)=>(It(e,(a,d)=>{s=t(s,a,d)}),s),Kn=(e,t,s)=>(xe(e,(a,d)=>{s=t(s,a,d)}),s),Jt=(e,t,s)=>{for(let a=0,d=e.length;a<d;a++){const p=e[a];if(t(p,a))return J.some(p);if(s(p,a))break}return J.none()},Qt=(e,t)=>Jt(e,t,vt),Cn=(e,t)=>{for(let s=0,a=e.length;s<a;s++){const d=e[s];if(t(d,s))return J.some(s)}return J.none()},Nn=e=>{const t=[];for(let s=0,a=e.length;s<a;++s){if(!ae(e[s]))throw new Error("Arr.flatten item "+s+" was not an array, input: "+e);Rn.apply(t,e[s])}return t},kt=(e,t)=>Nn($t(e,t)),jo=(e,t)=>{for(let s=0,a=e.length;s<a;++s){const d=e[s];if(t(d,s)!==!0)return!1}return!0},ms=e=>{const t=Bn.call(e,0);return t.reverse(),t},as=(e,t)=>Ct(e,s=>!to(t,s)),xt=(e,t)=>{const s={};for(let a=0,d=e.length;a<d;a++){const p=e[a];s[String(p)]=t(p,a)}return s},Pt=(e,t)=>{const s=Bn.call(e,0);return s.sort(t),s},gn=(e,t)=>t>=0&&t<e.length?J.some(e[t]):J.none(),At=e=>gn(e,0),On=e=>gn(e,e.length-1),In=Oe(Array.from)?Array.from:e=>Bn.call(e),Is=(e,t)=>{for(let s=0;s<e.length;s++){const a=t(e[s],s);if(a.isSome())return a}return J.none()},kr=(e,t)=>{const s=[],a=Oe(t)?d=>mo(s,p=>t(p,d)):d=>to(s,d);for(let d=0,p=e.length;d<p;d++){const v=e[d];a(v)||s.push(v)}return s},Yt=Object.keys,Ps=Object.hasOwnProperty,qo=(e,t)=>{const s=Yt(e);for(let a=0,d=s.length;a<d;a++){const p=s[a],v=e[p];t(v,p)}},_i=(e,t)=>bs(e,(s,a)=>({k:a,v:t(s,a)})),bs=(e,t)=>{const s={};return qo(e,(a,d)=>{const p=t(a,d);s[p.k]=p.v}),s},Ar=e=>(t,s)=>{e[s]=t},Bl=(e,t,s,a)=>{qo(e,(d,p)=>{(t(d,p)?s:a)(d,p)})},aa=(e,t)=>{const s={},a={};return Bl(e,t,Ar(s),Ar(a)),{t:s,f:a}},ps=(e,t)=>{const s={};return Bl(e,t,Ar(s),Fe),s},dn=(e,t)=>{const s=[];return qo(e,(a,d)=>{s.push(t(a,d))}),s},vo=e=>dn(e,Dt),Gn=(e,t)=>yn(e,t)?J.from(e[t]):J.none(),yn=(e,t)=>Ps.call(e,t),vr=(e,t)=>yn(e,t)&&e[t]!==void 0&&e[t]!==null,ao=(e,t,s=R)=>k(s).eq(e,t),ze=e=>{const t={};return xe(e,s=>{t[s]={}}),Yt(t)},Ie=e=>e.length!==void 0,Ot=Array.isArray,_t=e=>{if(Ot(e))return e;{const t=[];for(let s=0,a=e.length;s<a;s++)t[s]=e[s];return t}},Nt=(e,t,s)=>{if(!e)return!1;if(s=s||e,Ie(e)){for(let a=0,d=e.length;a<d;a++)if(t.call(s,e[a],a,e)===!1)return!1}else for(const a in e)if(yn(e,a)&&t.call(s,e[a],a,e)===!1)return!1;return!0},_n=(e,t)=>{const s=[];return Nt(e,(a,d)=>{s.push(t(a,d,e))}),s},sn=(e,t)=>{const s=[];return Nt(e,(a,d)=>{(!t||t(a,d,e))&&s.push(a)}),s},Tn=(e,t)=>{if(e){for(let s=0,a=e.length;s<a;s++)if(e[s]===t)return s}return-1},Xn=(e,t,s,a)=>{let d=ot(s)?e[0]:s;for(let p=0;p<e.length;p++)d=t.call(a,d,e[p],p);return d},zn=(e,t,s)=>{for(let a=0,d=e.length;a<d;a++)if(t.call(s,e[a],a,e))return a;return-1},Ko=e=>e[e.length-1],To=e=>{let t=!1,s;return(...a)=>(t||(t=!0,s=e.apply(null,a)),s)},Yo=(e,t,s,a)=>{const d=e.isiOS()&&/ipad/i.test(s)===!0,p=e.isiOS()&&!d,v=e.isiOS()||e.isAndroid(),C=v||a("(pointer:coarse)"),L=d||!p&&v&&a("(min-device-width:768px)"),G=p||v&&!L,ee=t.isSafari()&&e.isiOS()&&/safari/i.test(s)===!1,te=!G&&!L&&!ee;return{isiPad:et(d),isiPhone:et(p),isTablet:et(L),isPhone:et(G),isTouch:et(C),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:et(ee),isDesktop:et(te)}},Lo=(e,t)=>{for(let s=0;s<e.length;s++){const a=e[s];if(a.test(t))return a}},es=(e,t)=>{const s=Lo(e,t);if(!s)return{major:0,minor:0};const a=d=>Number(t.replace(s,"$"+d));return po(a(1),a(2))},Ms=(e,t)=>{const s=String(t).toLowerCase();return e.length===0?hr():es(e,s)},hr=()=>po(0,0),po=(e,t)=>({major:e,minor:t}),ts={nu:po,detect:Ms,unknown:hr},tr=(e,t)=>Is(t.brands,s=>{const a=s.brand.toLowerCase();return Qt(e,d=>{var p;return a===((p=d.brand)===null||p===void 0?void 0:p.toLowerCase())}).map(d=>({current:d.name,version:ts.nu(parseInt(s.version,10),0)}))}),ai=(e,t)=>{const s=String(t).toLowerCase();return Qt(e,a=>a.search(s))},Ur=(e,t)=>ai(e,t).map(s=>{const a=ts.detect(s.versionRegexes,t);return{current:s.name,version:a}}),Ti=(e,t)=>ai(e,t).map(s=>{const a=ts.detect(s.versionRegexes,t);return{current:s.name,version:a}}),la=(e,t)=>e.substring(t),li=(e,t,s)=>t===""||e.length>=t.length&&e.substr(s,s+t.length)===t,Qc=(e,t)=>qs(e,t)?la(e,t.length):e,xr=(e,t,s=0,a)=>{const d=e.indexOf(t,s);return d!==-1?ot(a)?!0:d+t.length<=a:!1},qs=(e,t)=>li(e,t,0),Hi=(e,t)=>li(e,t,e.length-t.length),Aa=e=>t=>t.replace(e,""),Qa=Aa(/^\s+|\s+$/g),La=Aa(/^\s+/g),Na=Aa(/\s+$/g),vi=e=>e.length>0,jr=e=>!vi(e),ca=(e,t)=>t<=0?"":new Array(t+1).join(e),yr=(e,t=10)=>{const s=parseInt(e,t);return isNaN(s)?J.none():J.some(s)},Ql=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Nr=e=>t=>xr(t,e),Fa=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>xr(e,"edge/")&&xr(e,"chrome")&&xr(e,"safari")&&xr(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Ql],search:e=>xr(e,"chrome")&&!xr(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>xr(e,"msie")||xr(e,"trident")},{name:"Opera",versionRegexes:[Ql,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Nr("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Nr("firefox")},{name:"Safari",versionRegexes:[Ql,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(xr(e,"safari")||xr(e,"mobile/"))&&xr(e,"applewebkit")}],Ra=[{name:"Windows",search:Nr("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>xr(e,"iphone")||xr(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Nr("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:Nr("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Nr("linux"),versionRegexes:[]},{name:"Solaris",search:Nr("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Nr("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:Nr("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],ua={browsers:et(Fa),oses:et(Ra)},Eo="Edge",Mc="Chromium",xi="IE",Di="Opera",Ba="Firefox",Lr="Safari",ei=()=>ec({current:void 0,version:ts.unknown()}),ec=e=>{const t=e.current,s=e.version,a=d=>()=>t===d;return{current:t,version:s,isEdge:a(Eo),isChromium:a(Mc),isIE:a(xi),isOpera:a(Di),isFirefox:a(Ba),isSafari:a(Lr)}},Ro={unknown:ei,nu:ec,edge:et(Eo),chromium:et(Mc),ie:et(xi),opera:et(Di),firefox:et(Ba),safari:et(Lr)},tc="Windows",rl="iOS",Fr="Android",il="Linux",yi="macOS",Cu="Solaris",_u="FreeBSD",us="ChromeOS",al=()=>pe({current:void 0,version:ts.unknown()}),pe=e=>{const t=e.current,s=e.version,a=d=>()=>t===d;return{current:t,version:s,isWindows:a(tc),isiOS:a(rl),isAndroid:a(Fr),isMacOS:a(yi),isLinux:a(il),isSolaris:a(Cu),isFreeBSD:a(_u),isChromeOS:a(us)}},Ge={unknown:al,nu:pe,windows:et(tc),ios:et(rl),android:et(Fr),linux:et(il),macos:et(yi),solaris:et(Cu),freebsd:et(_u),chromeos:et(us)},Tt={detect:(e,t,s)=>{const a=ua.browsers(),d=ua.oses(),p=t.bind(L=>tr(a,L)).orThunk(()=>Ur(a,e)).fold(Ro.unknown,Ro.nu),v=Ti(d,e).fold(Ge.unknown,Ge.nu),C=Yo(v,p,e,s);return{browser:p,os:v,deviceType:C}}},pn=e=>window.matchMedia(e).matches;let Sn=To(()=>Tt.detect(navigator.userAgent,J.from(navigator.userAgentData),pn));const Cs=()=>Sn(),wr=navigator.userAgent,Ds=Cs(),lr=Ds.browser,ds=Ds.os,Zr=Ds.deviceType,Nc=wr.indexOf("Windows Phone")!==-1,gs={transparentSrc:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",documentMode:lr.isIE()?document.documentMode||7:10,cacheSuffix:null,container:null,canHaveCSP:!lr.isIE(),windowsPhone:Nc,browser:{current:lr.current,version:lr.version,isChromium:lr.isChromium,isEdge:lr.isEdge,isFirefox:lr.isFirefox,isIE:lr.isIE,isOpera:lr.isOpera,isSafari:lr.isSafari},os:{current:ds.current,version:ds.version,isAndroid:ds.isAndroid,isChromeOS:ds.isChromeOS,isFreeBSD:ds.isFreeBSD,isiOS:ds.isiOS,isLinux:ds.isLinux,isMacOS:ds.isMacOS,isSolaris:ds.isSolaris,isWindows:ds.isWindows},deviceType:{isDesktop:Zr.isDesktop,isiPad:Zr.isiPad,isiPhone:Zr.isiPhone,isPhone:Zr.isPhone,isTablet:Zr.isTablet,isTouch:Zr.isTouch,isWebView:Zr.isWebView}},nd=/^\s*|\s*$/g,Ld=e=>Ae(e)?"":(""+e).replace(nd,""),lf=(e,t)=>t?t==="array"&&Ot(e)?!0:typeof e===t:e!==void 0,Fc=(e,t,s={})=>{const a=re(e)?e.split(t||","):e||[];let d=a.length;for(;d--;)s[a[d]]={};return s},Bc=yn,Kp=(e,...t)=>{for(let s=0;s<t.length;s++){const a=t[s];for(const d in a)if(yn(a,d)){const p=a[d];p!==void 0&&(e[d]=p)}}return e},eu=function(e,t,s,a){a=a||this,e&&(s&&(e=e[s]),Nt(e,(d,p)=>t.call(a,d,p,s)===!1?!1:(eu(d,t,s,a),!0)))},hn={trim:Ld,isArray:Ot,is:lf,toArray:_t,makeMap:Fc,each:Nt,map:_n,grep:sn,inArray:Tn,hasOwn:Bc,extend:Kp,walk:eu,resolve:(e,t=window)=>{const s=e.split(".");for(let a=0,d=s.length;a<d&&(t=t[s[a]],!!t);a++);return t},explode:(e,t)=>ae(e)?e:e===""?[]:_n(e.split(t||","),Ld),_addCacheSuffix:e=>{const t=gs.cacheSuffix;return t&&(e+=(e.indexOf("?")===-1?"?":"&")+t),e}},Rd=(e,t,s=Xe)=>e.exists(a=>s(a,t)),Rh=(e,t,s=Xe)=>wa(e,t,s).getOr(e.isNone()&&t.isNone()),Od=e=>{const t=[],s=a=>{t.push(a)};for(let a=0;a<e.length;a++)e[a].each(s);return t},wa=(e,t,s)=>e.isSome()&&t.isSome()?J.some(s(e.getOrDie(),t.getOrDie())):J.none(),Oh=(e,t,s,a)=>e.isSome()&&t.isSome()&&s.isSome()?J.some(a(e.getOrDie(),t.getOrDie(),s.getOrDie())):J.none(),cf=(e,t)=>e?J.some(t):J.none(),uc=typeof window<"u"?window:Function("return this;")(),Fm=(e,t)=>{let s=t??uc;for(let a=0;a<e.length&&s!==void 0&&s!==null;++a)s=s[e[a]];return s},Bm=(e,t)=>{const s=e.split(".");return Fm(s,t)},Id=(e,t)=>Bm(e,t),_0=(e,t)=>{const s=Id(e,t);if(s==null)throw new Error(e+" not available on this browser");return s},qp=Object.getPrototypeOf,Yp=e=>_0("HTMLElement",e),Xp=e=>{const t=Bm("ownerDocument.defaultView",e);return Y(e)&&(Yp(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(qp(e).constructor.name))},$m=8,Jp=9,Ih=11,tu=1,da=3,ls=e=>e.dom.nodeName.toLowerCase(),$c=e=>e.dom.nodeType,$l=e=>t=>$c(t)===e,Tu=e=>$c(e)===$m||ls(e)==="#comment",uf=e=>ll(e)&&Xp(e.dom),ll=$l(tu),ti=$l(da),Ph=$l(Jp),Hl=$l(Ih),ci=e=>t=>ll(t)&&ls(t)===e,ui=(e,t,s)=>{if(re(s)||Ue(s)||O(s))e.setAttribute(t,s+"");else throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",s,":: Element ",e),new Error("Attribute value was not simple")},$s=(e,t,s)=>{ui(e.dom,t,s)},Hc=(e,t)=>{const s=e.dom;qo(t,(a,d)=>{ui(s,d,a)})},Oa=(e,t)=>{const s=e.dom.getAttribute(t);return s===null?void 0:s},Ul=(e,t)=>J.from(Oa(e,t)),dc=(e,t)=>{const s=e.dom;return s&&s.hasAttribute?s.hasAttribute(t):!1},Xi=(e,t)=>{e.dom.removeAttribute(t)},Vf=e=>{const t=e.dom.attributes;return t==null||t.length===0},Oi=e=>Kn(e.dom.attributes,(t,s)=>(t[s.name]=s.value,t),{}),Ys=(e,t)=>{const s=Oa(e,t);return s===void 0||s===""?[]:s.split(" ")},fc=(e,t,s)=>{const d=Ys(e,t).concat([s]);return $s(e,t,d.join(" ")),!0},hc=(e,t,s)=>{const a=Ct(Ys(e,t),d=>d!==s);return a.length>0?$s(e,t,a.join(" ")):Xi(e,t),!1},Ii=e=>e.dom.classList!==void 0,ho=e=>Ys(e,"class"),Pd=(e,t)=>fc(e,"class",t),mc=(e,t)=>hc(e,"class",t),nr=(e,t)=>to(ho(e),t)?mc(e,t):Pd(e,t),od=(e,t)=>{Ii(e)?e.dom.classList.add(t):Pd(e,t)},zf=e=>{(Ii(e)?e.dom.classList:ho(e)).length===0&&Xi(e,"class")},nu=(e,t)=>{Ii(e)?e.dom.classList.remove(t):mc(e,t),zf(e)},os=(e,t)=>{const s=Ii(e)?e.dom.classList.toggle(t):nr(e,t);return zf(e),s},cl=(e,t)=>Ii(e)&&e.dom.classList.contains(t),Mh=(e,t)=>{const a=(t||document).createElement("div");if(a.innerHTML=e,!a.hasChildNodes()||a.childNodes.length>1){const d="HTML does not have a single root node";throw console.error(d,e),new Error(d)}return pc(a.childNodes[0])},df=(e,t)=>{const a=(t||document).createElement(e);return pc(a)},Md=(e,t)=>{const a=(t||document).createTextNode(e);return pc(a)},pc=e=>{if(e==null)throw new Error("Node cannot be null or undefined");return{dom:e}},M={fromHtml:Mh,fromTag:df,fromText:Md,fromDom:pc,fromPoint:(e,t,s)=>J.from(e.dom.elementFromPoint(t,s)).map(pc)},Ee=(e,t)=>{const s=[],a=p=>(s.push(p),t(p));let d=t(e);do d=d.bind(a);while(d.isSome());return s},Ve=(e,t)=>{const s=e.dom;if(s.nodeType!==tu)return!1;{const a=s;if(a.matches!==void 0)return a.matches(t);if(a.msMatchesSelector!==void 0)return a.msMatchesSelector(t);if(a.webkitMatchesSelector!==void 0)return a.webkitMatchesSelector(t);if(a.mozMatchesSelector!==void 0)return a.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},tt=e=>e.nodeType!==tu&&e.nodeType!==Jp&&e.nodeType!==Ih||e.childElementCount===0,Ze=(e,t)=>{const s=t===void 0?document:t.dom;return tt(s)?[]:$t(s.querySelectorAll(e),M.fromDom)},pt=(e,t)=>{const s=t===void 0?document:t.dom;return tt(s)?J.none():J.from(s.querySelector(e)).map(M.fromDom)},gt=(e,t)=>e.dom===t.dom,ln=(e,t)=>{const s=e.dom,a=t.dom;return s===a?!1:s.contains(a)},Io=e=>M.fromDom(e.dom.ownerDocument),ss=e=>Ph(e)?e:Io(e),Sr=e=>M.fromDom(ss(e).dom.documentElement),vs=e=>M.fromDom(ss(e).dom.defaultView),_s=e=>J.from(e.dom.parentNode).map(M.fromDom),ki=e=>J.from(e.dom.parentElement).map(M.fromDom),Sl=(e,t)=>{const s=Oe(t)?t:vt;let a=e.dom;const d=[];for(;a.parentNode!==null&&a.parentNode!==void 0;){const p=a.parentNode,v=M.fromDom(p);if(d.push(v),s(v)===!0)break;a=p}return d},ns=e=>{const t=s=>Ct(s,a=>!gt(e,a));return _s(e).map(cr).map(t).getOr([])},Vs=e=>J.from(e.dom.previousSibling).map(M.fromDom),xs=e=>J.from(e.dom.nextSibling).map(M.fromDom),ks=e=>ms(Ee(e,Vs)),Wn=e=>Ee(e,xs),cr=e=>$t(e.dom.childNodes,M.fromDom),el=(e,t)=>{const s=e.dom.childNodes;return J.from(s[t]).map(M.fromDom)},sd=e=>el(e,0),ou=e=>el(e,e.dom.childNodes.length-1),Sa=e=>e.dom.childNodes.length,su=e=>e.dom.hasChildNodes(),rd=e=>{const t=e.dom.head;if(t==null)throw new Error("Head is not available yet");return M.fromDom(t)},ni=e=>Hl(e)&&ve(e.dom.host),ru=Oe(Element.prototype.attachShadow)&&Oe(Node.prototype.getRootNode),gc=et(ru),bc=ru?e=>M.fromDom(e.dom.getRootNode()):ss,ff=e=>ni(e)?e:rd(ss(e)),Du=e=>ni(e)?e:M.fromDom(ss(e).dom.body),vc=e=>{const t=bc(e);return ni(t)?J.some(t):J.none()},hf=e=>M.fromDom(e.dom.host),Rr=e=>{if(gc()&&ve(e.target)){const t=M.fromDom(e.target);if(ll(t)&&Vl(t)&&e.composed&&e.composedPath){const s=e.composedPath();if(s)return At(s)}}return J.from(e.target)},Vl=e=>ve(e.dom.shadowRoot),Ui=e=>{const t=ti(e)?e.dom.parentNode:e.dom;if(t==null||t.ownerDocument===null)return!1;const s=t.ownerDocument;return vc(M.fromDom(t)).fold(()=>s.body.contains(t),Ut(Ui,hf))};var xc=(e,t,s,a,d)=>e(s,a)?J.some(s):Oe(d)&&d(s)?J.none():t(s,a,d);const Kr=(e,t,s)=>{let a=e.dom;const d=Oe(s)?s:vt;for(;a.parentNode;){a=a.parentNode;const p=M.fromDom(a);if(t(p))return J.some(p);if(d(p))break}return J.none()},El=(e,t,s)=>xc((d,p)=>p(d),Kr,e,t,s),wi=(e,t)=>{const s=e.dom;return s.parentNode?Pi(M.fromDom(s.parentNode),a=>!gt(e,a)&&t(a)):J.none()},Pi=(e,t)=>{const s=d=>t(M.fromDom(d));return Qt(e.dom.childNodes,s).map(M.fromDom)},Uc=(e,t)=>{const s=a=>{for(let d=0;d<a.childNodes.length;d++){const p=M.fromDom(a.childNodes[d]);if(t(p))return J.some(p);const v=s(a.childNodes[d]);if(v.isSome())return v}return J.none()};return s(e.dom)},Rt=(e,t,s)=>Kr(e,a=>Ve(a,t),s),fa=(e,t)=>pt(t,e),iu=(e,t,s)=>xc((d,p)=>Ve(d,p),Rt,e,t,s),qr=e=>iu(e,"[contenteditable]"),$a=(e,t=!1)=>Ui(e)?e.dom.isContentEditable:qr(e).fold(et(t),s=>Ji(s)==="true"),Ji=e=>e.dom.contentEditable,Ha=e=>e.style!==void 0&&Oe(e.style.getPropertyValue),Cl=(e,t,s)=>{if(!re(s))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",s,":: Element ",e),new Error("CSS value must be a string: "+s);Ha(e)&&e.style.setProperty(t,s)},ha=(e,t)=>{Ha(e)&&e.style.removeProperty(t)},ys=(e,t,s)=>{const a=e.dom;Cl(a,t,s)},ma=(e,t)=>{const s=e.dom;qo(t,(a,d)=>{Cl(s,d,a)})},Vi=(e,t)=>{const s=e.dom,d=window.getComputedStyle(s).getPropertyValue(t);return d===""&&!Ui(e)?oi(s,t):d},oi=(e,t)=>Ha(e)?e.style.getPropertyValue(t):"",Vc=(e,t)=>{const s=e.dom,a=oi(s,t);return J.from(a).filter(d=>d.length>0)},_l=e=>{const t={},s=e.dom;if(Ha(s))for(let a=0;a<s.style.length;a++){const d=s.style.item(a);t[d]=s.style[d]}return t},yc=(e,t)=>{const s=e.dom;ha(s,t),Rd(Ul(e,"style").map(Qa),"")&&Xi(e,"style")},ul=e=>e.dom.offsetWidth,lt=(e,t)=>{_s(e).each(a=>{a.dom.insertBefore(t.dom,e.dom)})},Si=(e,t)=>{xs(e).fold(()=>{_s(e).each(d=>{rr(d,t)})},a=>{lt(a,t)})},au=(e,t)=>{sd(e).fold(()=>{rr(e,t)},a=>{e.dom.insertBefore(t.dom,a.dom)})},rr=(e,t)=>{e.dom.appendChild(t.dom)},Tl=(e,t)=>{lt(e,t),rr(t,e)},pa=(e,t)=>{xe(t,(s,a)=>{const d=a===0?e:t[a-1];Si(d,s)})},Or=(e,t)=>{xe(t,s=>{rr(e,s)})},Ua=e=>{e.dom.textContent="",xe(cr(e),t=>{Xs(t)})},Xs=e=>{const t=e.dom;t.parentNode!==null&&t.parentNode.removeChild(t)},di=e=>{const t=cr(e);t.length>0&&pa(e,t),Xs(e)},nc=(e,t)=>{const a=(t||document).createElement("div");return a.innerHTML=e,cr(M.fromDom(a))},wc=e=>$t(e,M.fromDom),ku=e=>e.dom.innerHTML,zc=(e,t)=>{const a=Io(e).dom,d=M.fromDom(a.createDocumentFragment()),p=nc(t,a);Or(d,p),Ua(e),rr(e,d)},Gc=e=>{const t=M.fromTag("div"),s=M.fromDom(e.dom.cloneNode(!0));return rr(t,s),ku(t)},mf=(e,t,s,a,d,p,v)=>({target:e,x:t,y:s,stop:a,prevent:d,kill:p,raw:v}),Bt=e=>{const t=M.fromDom(Rr(e).getOr(e.target)),s=()=>e.stopPropagation(),a=()=>e.preventDefault(),d=st(a,s);return mf(t,e.clientX,e.clientY,s,a,d,e)},io=(e,t)=>s=>{e(s)&&t(Bt(s))},Qn=(e,t,s,a,d)=>{const p=io(s,a);return e.dom.addEventListener(t,p,d),{unbind:it(Js,e,t,p,d)}},Po=(e,t,s,a)=>Qn(e,t,s,a,!1),Js=(e,t,s,a)=>{e.dom.removeEventListener(t,s,a)},N=(e,t)=>({left:e,top:t,translate:(a,d)=>N(e+a,t+d)}),X=N,ce=e=>{const t=e.getBoundingClientRect();return X(t.left,t.top)},Ne=(e,t)=>e!==void 0?e:t!==void 0?t:0,We=e=>{const t=e.dom.ownerDocument,s=t.body,a=t.defaultView,d=t.documentElement;if(s===e.dom)return X(s.offsetLeft,s.offsetTop);const p=Ne(a==null?void 0:a.pageYOffset,d.scrollTop),v=Ne(a==null?void 0:a.pageXOffset,d.scrollLeft),C=Ne(d.clientTop,s.clientTop),L=Ne(d.clientLeft,s.clientLeft);return Kt(e).translate(v-L,p-C)},Kt=e=>{const t=e.dom,a=t.ownerDocument.body;return a===t?X(a.offsetLeft,a.offsetTop):Ui(e)?ce(t):X(0,0)},Yn=e=>{const t=e!==void 0?e.dom:document,s=t.body.scrollLeft||t.documentElement.scrollLeft,a=t.body.scrollTop||t.documentElement.scrollTop;return X(s,a)},Co=(e,t,s)=>{const d=(s!==void 0?s.dom:document).defaultView;d&&d.scrollTo(e,t)},$o=(e,t)=>{Cs().browser.isSafari()&&Oe(e.dom.scrollIntoViewIfNeeded)?e.dom.scrollIntoViewIfNeeded(!1):e.dom.scrollIntoView(t)},Jn=e=>{const t=e===void 0?window:e;return Cs().browser.isFirefox()?J.none():J.from(t.visualViewport)},mr=(e,t,s,a)=>({x:e,y:t,width:s,height:a,right:e+s,bottom:t+a}),Vr=e=>{const t=e===void 0?window:e,s=t.document,a=Yn(M.fromDom(s));return Jn(t).fold(()=>{const d=t.document.documentElement,p=d.clientWidth,v=d.clientHeight;return mr(a.left,a.top,p,v)},d=>mr(Math.max(d.pageLeft,a.left),Math.max(d.pageTop,a.top),d.width,d.height))},Va=(e,t)=>Ct(cr(e),t),Dl=(e,t)=>{let s=[];return xe(cr(e),a=>{t(a)&&(s=s.concat([a])),s=s.concat(Dl(a,t))}),s},$e=(e,t)=>Ze(t,e),cn=(e,t,s)=>Kr(e,t,s).isSome(),Ln=(e,t)=>wi(e,t).isSome(),Wo=(e,t)=>Uc(e,t).isSome();class bn{constructor(t,s){this.node=t,this.rootNode=s,this.current=this.current.bind(this),this.next=this.next.bind(this),this.prev=this.prev.bind(this),this.prev2=this.prev2.bind(this)}current(){return this.node}next(t){return this.node=this.findSibling(this.node,"firstChild","nextSibling",t),this.node}prev(t){return this.node=this.findSibling(this.node,"lastChild","previousSibling",t),this.node}prev2(t){return this.node=this.findPreviousNode(this.node,t),this.node}findSibling(t,s,a,d){if(t){if(!d&&t[s])return t[s];if(t!==this.rootNode){let p=t[a];if(p)return p;for(let v=t.parentNode;v&&v!==this.rootNode;v=v.parentNode)if(p=v[a],p)return p}}}findPreviousNode(t,s){if(t){const a=t.previousSibling;if(this.rootNode&&a===this.rootNode)return;if(a){if(!s){for(let p=a.lastChild;p;p=p.lastChild)if(!p.lastChild)return p}return a}const d=t.parentNode;if(d&&d!==this.rootNode)return d}}}const Jo="\uFEFF",Vo=" ",Yr=e=>e===Jo,za=e=>e.replace(/\uFEFF/g,""),Au=/^[ \t\r\n]*$/,pr=e=>Au.test(e),dl=e=>{for(const t of e)if(!Yr(t))return!1;return!0},Gf=e=>" \f	\v".indexOf(e)!==-1,T0=e=>e===`
`||e==="\r",lv=(e,t)=>t<e.length&&t>=0?T0(e[t]):!1,cv=(e,t=4,s=!0,a=!0)=>{const d=ca(" ",t),p=e.replace(/\t/g,d);return Kn(p,(C,L)=>Gf(L)||L===Vo?C.pcIsSpace||C.str===""&&s||C.str.length===p.length-1&&a||lv(p,C.str.length+1)?{pcIsSpace:!1,str:C.str+Vo}:{pcIsSpace:!0,str:C.str+" "}:{pcIsSpace:T0(L),str:C.str+L},{pcIsSpace:!1,str:""}).str},Nd=e=>t=>!!t&&t.nodeType===e,Qp=e=>!!e&&!Object.getPrototypeOf(e),oo=Nd(1),lu=e=>oo(e)&&uf(M.fromDom(e)),eg=e=>oo(e)&&e.namespaceURI==="http://www.w3.org/2000/svg",Sc=e=>{const t=e.toLowerCase();return s=>ve(s)&&s.nodeName.toLowerCase()===t},kl=e=>{const t=e.map(s=>s.toLowerCase());return s=>{if(s&&s.nodeName){const a=s.nodeName.toLowerCase();return to(t,a)}return!1}},Fd=(e,t)=>{const s=t.toLowerCase().split(" ");return a=>{if(oo(a)){const d=a.ownerDocument.defaultView;if(d)for(let p=0;p<s.length;p++){const v=d.getComputedStyle(a,null);if((v?v.getPropertyValue(e):null)===s[p])return!0}}return!1}},hS=e=>t=>oo(t)&&t.hasAttribute(e),Bd=e=>oo(e)&&e.hasAttribute("data-mce-bogus"),p1=e=>oo(e)&&e.getAttribute("data-mce-bogus")==="all",$d=e=>oo(e)&&e.tagName==="TABLE",tg=e=>t=>!!(lu(t)&&(t.contentEditable===e||t.getAttribute("data-mce-contenteditable")===e)),ng=kl(["textarea","input"]),rn=Nd(3),g1=Nd(4),rs=Nd(7),so=Nd(8),id=Nd(9),D0=Nd(11),fi=Sc("br"),ad=Sc("img"),Ws=tg("true"),Ir=tg("false"),og=kl(["td","th"]),Ft=kl(["td","th","caption"]),Lu=kl(["video","audio","object","embed"]),uv=Sc("li"),Nh=Sc("details"),b1=Sc("summary"),Hd={skipBogus:!0,includeZwsp:!1,checkRootAsContent:!1},mS=(e,t,s)=>{const a=M.fromDom(t),d=M.fromDom(e),p=s.getWhitespaceElements();return cn(d,C=>yn(p,ls(C)),it(gt,a))},Hm=e=>oo(e)&&e.nodeName==="A"&&!e.hasAttribute("href")&&(e.hasAttribute("name")||e.hasAttribute("id")),zr=(e,t)=>oo(e)&&yn(t.getNonEmptyElements(),e.nodeName),pf=hS("data-mce-bookmark"),pS=e=>ki(M.fromDom(e)).exists(t=>!$a(t)),Ud=(e,t,s)=>pr(e.data)&&!mS(e,t,s),sg=(e,t,s,a)=>rn(e)&&!Ud(e,t,s)&&(!a.includeZwsp||!dl(e.data)),Fh=(e,t,s,a)=>Oe(a.isContent)&&a.isContent(t)||zr(t,e)||pf(t)||Hm(t)||sg(t,s,e,a)||Ir(t)||Ws(t)&&pS(t),Ga=(e,t,s)=>{const a={...Hd,...s};if(a.checkRootAsContent&&Fh(e,t,t,a))return!1;let d=t.firstChild,p=0;if(!d)return!0;const v=new bn(d,t);do{if(a.skipBogus&&oo(d)){const C=d.getAttribute("data-mce-bogus");if(C){d=v.next(C==="all");continue}}if(so(d)){d=v.next(!0);continue}if(fi(d)){p++,d=v.next();continue}if(Fh(e,d,t,a))return!1;d=v.next()}while(d);return p<=1},fl=(e,t,s)=>Ga(e,t.dom,{checkRootAsContent:!0,...s}),v1=(e,t,s)=>Fh(e,t,t,{includeZwsp:Hd.includeZwsp,...s}),Ea=e=>{let t=e;return{get:()=>t,set:d=>{t=d}}},Ru=e=>{const t=Ea(J.none()),s=()=>t.get().each(e);return{clear:()=>{s(),t.set(J.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:C=>{s(),t.set(J.some(C))}}},Ec=e=>{const t=Ea(J.none()),s=()=>t.get().each(C=>clearInterval(C));return{clear:()=>{s(),t.set(J.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:C=>{s(),t.set(J.some(setInterval(C,e)))}}},tn=()=>{const e=Ru(Fe);return{...e,on:s=>e.get().each(s)}},x1=e=>{const t=e.toLowerCase();return t==="svg"?"svg":t==="math"?"math":"html"},Mi=e=>x1(e)!=="html",y1=e=>Mi(e.nodeName),w1=e=>x1(e.nodeName),MT=["svg","math"],S1=()=>{const e=tn(),t=()=>e.get().map(w1).getOr("html");return{track:d=>(y1(d)?e.set(d):e.get().exists(p=>!p.contains(d))&&e.clear(),t()),current:t,reset:()=>{e.clear()}}},Ou="data-mce-block",dv=e=>Ct(Yt(e),t=>!/[A-Z]/.test(t)),fv=e=>$t(dv(e),t=>{const s=CSS.escape(t);return`${s}:`+$t(MT,a=>`not(${a} ${s})`).join(":")}).join(","),hv=(e,t)=>ve(t.querySelector(e))?(t.setAttribute(Ou,"true"),t.getAttribute("data-mce-selected")==="inline-boundary"&&t.removeAttribute("data-mce-selected"),!0):(t.removeAttribute(Ou),!1),zi=(e,t)=>{const s=fv(e.getTransparentElements()),a=fv(e.getBlockElements());return Ct(t.querySelectorAll(s),d=>hv(a,d))},Um=(e,t,s)=>{var a;const d=s?"lastChild":"firstChild";for(let p=t[d];p;p=p[d])if(Ga(e,p,{checkRootAsContent:!0})){(a=p.parentNode)===null||a===void 0||a.removeChild(p);return}},hi=(e,t,s)=>{const a=document.createRange(),d=t.parentNode;if(d){a.setStartBefore(t),a.setEndBefore(s);const p=a.extractContents();Um(e,p,!0),a.setStartAfter(s),a.setEndAfter(t);const v=a.extractContents();Um(e,v,!1),Ga(e,p,{checkRootAsContent:!0})||d.insertBefore(p,t),Ga(e,s,{checkRootAsContent:!0})||d.insertBefore(s,t),Ga(e,v,{checkRootAsContent:!0})||d.insertBefore(v,t),d.removeChild(t)}},zl=(e,t,s)=>{const a=e.getBlockElements(),d=M.fromDom(t),p=C=>ls(C)in a,v=C=>gt(C,d);xe(wc(s),C=>{Kr(C,p,v).each(L=>{const G=Va(C,ee=>p(ee)&&!e.isValidChild(ls(L),ls(ee)));if(G.length>0){const ee=ki(L);xe(G,te=>{Kr(te,p,v).each(ie=>{hi(e,ie.dom,te.dom)})}),ee.each(te=>zi(e,te.dom))}})})},Wf=(e,t,s)=>{xe([...s,...Bh(e,t)?[t]:[]],a=>xe($e(M.fromDom(a),a.nodeName.toLowerCase()),d=>{gS(e,d.dom)&&di(d)}))},Xr=(e,t)=>{const s=zi(e,t);zl(e,t,s),Wf(e,t,s)},mv=(e,t)=>{if(k0(e,t)){const s=fv(e.getBlockElements());hv(s,t)}},hl=(e,t,s)=>{const a=p=>gt(p,M.fromDom(t)),d=Sl(M.fromDom(s),a);gn(d,d.length-2).filter(ll).fold(()=>Xr(e,t),p=>Xr(e,p.dom))},ld=e=>e.hasAttribute(Ou),rg=(e,t)=>yn(e.getTransparentElements(),t),k0=(e,t)=>oo(t)&&rg(e,t.nodeName),Bh=(e,t)=>k0(e,t)&&ld(t),gS=(e,t)=>k0(e,t)&&!ld(t),Vm=(e,t)=>t.type===1&&rg(e,t.name)&&re(t.attr(Ou)),E1=Cs().browser,A0=e=>Qt(e,ll),L0=e=>E1.isFirefox()&&ls(e)==="table"?A0(cr(e)).filter(t=>ls(t)==="caption").bind(t=>A0(Wn(t)).map(s=>{const a=s.dom.offsetTop,d=t.dom.offsetTop,p=t.dom.offsetHeight;return a<=d?-p:0})).getOr(0):0,pv=(e,t)=>e.children&&to(e.children,t),C1=(e,t,s)=>{let a=0,d=0;const p=e.ownerDocument;if(s=s||e,t){if(s===e&&t.getBoundingClientRect&&Vi(M.fromDom(e),"position")==="static"){const C=t.getBoundingClientRect();return a=C.left+(p.documentElement.scrollLeft||e.scrollLeft)-p.documentElement.clientLeft,d=C.top+(p.documentElement.scrollTop||e.scrollTop)-p.documentElement.clientTop,{x:a,y:d}}let v=t;for(;v&&v!==s&&v.nodeType&&!pv(v,s);){const C=v;a+=C.offsetLeft||0,d+=C.offsetTop||0,v=C.offsetParent}for(v=t.parentNode;v&&v!==s&&v.nodeType&&!pv(v,s);)a-=v.scrollLeft||0,d-=v.scrollTop||0,v=v.parentNode;d+=L0(M.fromDom(t))}return{x:a,y:d}},zm=(e,t={})=>{let s=0;const a={},d=M.fromDom(e),p=ss(d),v=Je=>{t.referrerPolicy=Je},C=Je=>{t.contentCssCors=Je},L=Je=>{rr(ff(d),Je)},G=Je=>{const nt=ff(d);fa(nt,"#"+Je).each(Xs)},ee=Je=>Gn(a,Je).getOrThunk(()=>({id:"mce-u"+s++,passed:[],failed:[],count:0})),te=Je=>new Promise((nt,rt)=>{let ft;const Xt=hn._addCacheSuffix(Je),mn=ee(Xt);a[Xt]=mn,mn.count++;const Fn=(no,So)=>{xe(no,on),mn.status=So,mn.passed=[],mn.failed=[],ft&&(ft.onload=null,ft.onerror=null,ft=null)},Lt=()=>Fn(mn.passed,2),yt=()=>Fn(mn.failed,3);if(nt&&mn.passed.push(nt),rt&&mn.failed.push(rt),mn.status===1)return;if(mn.status===2){Lt();return}if(mn.status===3){yt();return}mn.status=1;const qt=M.fromTag("link",p.dom);Hc(qt,{rel:"stylesheet",type:"text/css",id:mn.id}),t.contentCssCors&&$s(qt,"crossOrigin","anonymous"),t.referrerPolicy&&$s(qt,"referrerpolicy",t.referrerPolicy),ft=qt.dom,ft.onload=Lt,ft.onerror=yt,L(qt),$s(qt,"href",Xt)}),ie=(Je,nt)=>{const rt=ee(Je);a[Je]=rt,rt.count++;const ft=M.fromTag("style",p.dom);Hc(ft,{rel:"stylesheet",type:"text/css",id:rt.id}),ft.dom.innerHTML=nt,L(ft)},ye=Je=>Promise.allSettled($t(Je,rt=>te(rt).then(et(rt)))).then(rt=>{const ft=Dn(rt,Xt=>Xt.status==="fulfilled");return ft.fail.length>0?Promise.reject($t(ft.fail,Xt=>Xt.reason)):$t(ft.pass,Xt=>Xt.value)}),Re=Je=>{const nt=hn._addCacheSuffix(Je);Gn(a,nt).each(rt=>{--rt.count===0&&(delete a[nt],G(rt.id))})};return{load:te,loadRawCss:ie,loadAll:ye,unload:Re,unloadRawCss:Je=>{Gn(a,Je).each(nt=>{--nt.count===0&&(delete a[Je],G(nt.id))})},unloadAll:Je=>{xe(Je,nt=>{Re(nt)})},_setReferrerPolicy:v,_setContentCssCors:C}},R0=(()=>{const e=new WeakMap;return{forElement:(s,a)=>{const p=bc(s).dom;return J.from(e.get(p)).getOrThunk(()=>{const v=zm(p,a);return e.set(p,v),v})}}})(),bS=e=>e.nodeName.toLowerCase()==="span",gv=(e,t)=>ve(e)&&(v1(t,e)||t.isInline(e.nodeName.toLowerCase())),bv=(e,t,s)=>{const a=new bn(e,t).prev(!1),d=new bn(e,t).next(!1),p=ot(a)||gv(a,s),v=ot(d)||gv(d,s);return p&&v},vv=e=>bS(e)&&e.getAttribute("data-mce-type")==="bookmark",_1=(e,t,s)=>rn(e)&&e.data.length>0&&bv(e,t,s),O0=e=>oo(e)?e.childNodes.length>0:!1,T1=e=>D0(e)||id(e),ig=(e,t,s,a)=>{var d;const p=a||t;if(oo(t)&&vv(t))return t;const v=t.childNodes;for(let C=v.length-1;C>=0;C--)ig(e,v[C],s,p);if(oo(t)){const C=t.childNodes;C.length===1&&vv(C[0])&&((d=t.parentNode)===null||d===void 0||d.insertBefore(C[0],t))}return!T1(t)&&!v1(s,t)&&!O0(t)&&!_1(t,p,s)&&e.remove(t),t},vS=hn.makeMap,I0=/[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ag=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Gm=/[<>&\"\']/g,lg=/&#([a-z0-9]+);?|&([a-z0-9]+);/gi,P0={128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"},Iu={'"':"&quot;","'":"&#39;","<":"&lt;",">":"&gt;","&":"&amp;","`":"&#96;"},D1={"&lt;":"<","&gt;":">","&amp;":"&","&quot;":'"',"&apos;":"'"},Pu=e=>{const t=M.fromTag("div").dom;return t.innerHTML=e,t.textContent||t.innerText||e},$h=(e,t)=>{const s={};if(e){const a=e.split(",");t=t||10;for(let d=0;d<a.length;d+=2){const p=String.fromCharCode(parseInt(a[d],t));if(!Iu[p]){const v="&"+a[d+1]+";";s[p]=v,s[v]=p}}return s}else return},cg=$h("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32),k1=(e,t)=>e.replace(t?I0:ag,s=>Iu[s]||s),A1=e=>(""+e).replace(Gm,t=>Iu[t]||t),L1=(e,t)=>e.replace(t?I0:ag,s=>s.length>1?"&#"+((s.charCodeAt(0)-55296)*1024+(s.charCodeAt(1)-56320)+65536)+";":Iu[s]||"&#"+s.charCodeAt(0)+";"),cu=(e,t,s)=>{const a=s||cg;return e.replace(t?I0:ag,d=>Iu[d]||a[d]||d)},Hh={encodeRaw:k1,encodeAllRaw:A1,encodeNumeric:L1,encodeNamed:cu,getEncodeFunc:(e,t)=>{const s=$h(t)||cg,a=(v,C)=>v.replace(C?I0:ag,L=>Iu[L]!==void 0?Iu[L]:s[L]!==void 0?s[L]:L.length>1?"&#"+((L.charCodeAt(0)-55296)*1024+(L.charCodeAt(1)-56320)+65536)+";":"&#"+L.charCodeAt(0)+";"),d=(v,C)=>cu(v,C,s),p=vS(e.replace(/\+/g,","));return p.named&&p.numeric?a:p.named?t?d:cu:p.numeric?L1:k1},decode:e=>e.replace(lg,(t,s)=>s?(s.charAt(0).toLowerCase()==="x"?s=parseInt(s.substr(1),16):s=parseInt(s,10),s>65535?(s-=65536,String.fromCharCode(55296+(s>>10),56320+(s&1023))):P0[s]||String.fromCharCode(s)):D1[t]||cg[t]||Pu(t))},Ca=(e,t)=>(e=hn.trim(e),e?e.split(t||" "):[]),gf=e=>new RegExp("^"+e.replace(/([?+*])/g,".$1")+"$"),xv=e=>Y(e)&&e.source&&Object.prototype.toString.call(e)==="[object RegExp]",Rs=e=>{const t=s=>ae(s)?$t(s,t):xv(s)?new RegExp(s.source,s.flags):Y(s)?_i(s,t):s;return t(e)},Cc=e=>{const t=/^(~)?(.+)$/;return kt(Ca(e,","),s=>{const a=t.exec(s);if(a){const p=a[1]==="~"?"span":"div",v=a[2];return[{cloneName:p,name:v}]}else return[]})},jf=e=>Object.freeze(["id","accesskey","class","dir","lang","style","tabindex","title","role",...e!=="html4"?["contenteditable","contextmenu","draggable","dropzone","hidden","spellcheck","translate","itemprop","itemscope","itemtype"]:[],...e!=="html5-strict"?["xml:lang"]:[]]),Wm=e=>{let t,s;t="address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul",s="a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd label map noscript object q s samp script select small span strong sub sup textarea u var #text #comment",e!=="html4"&&(t+=" article aside details dialog figure main header footer hgroup section nav "+"a ins del canvas map",s+=" audio canvas command data datalist mark meter output picture progress time wbr video ruby bdi keygen svg"),e!=="html5-strict"&&(s=[s,"acronym applet basefont big font strike tt"].join(" "),t=[t,"center dir isindex noframes"].join(" "));const a=[t,s].join(" ");return{blockContent:t,phrasingContent:s,flowContent:a}},As=e=>{const{blockContent:t,phrasingContent:s,flowContent:a}=Wm(e),d=p=>Object.freeze(p.split(" "));return Object.freeze({blockContent:d(t),phrasingContent:d(s),flowContent:d(a)})},M0={html4:To(()=>As("html4")),html5:To(()=>As("html5")),"html5-strict":To(()=>As("html5-strict"))},N0=(e,t)=>{const{blockContent:s,phrasingContent:a,flowContent:d}=M0[e]();return t==="blocks"?J.some(s):t==="phrasing"?J.some(a):t==="flow"?J.some(d):J.none()},BT=e=>{const t=jf(e),{phrasingContent:s,flowContent:a}=Wm(e),d={},p=(L,G,ee)=>{d[L]={attributes:xt(G,et({})),attributesOrder:G,children:xt(ee,et({}))}},v=(L,G="",ee="")=>{const te=Ca(ee),ie=Ca(L);let ye=ie.length;const Re=[...t,...Ca(G)];for(;ye--;)p(ie[ye],Re.slice(),te)},C=(L,G)=>{const ee=Ca(L),te=Ca(G);let ie=ee.length;for(;ie--;){const ye=d[ee[ie]];for(let Re=0,Se=te.length;Re<Se;Re++)ye.attributes[te[Re]]={},ye.attributesOrder.push(te[Re])}};return e!=="html5-strict"&&(xe(Ca("acronym applet basefont big font strike tt"),ee=>{v(ee,"",s)}),xe(Ca("center dir isindex noframes"),ee=>{v(ee,"",a)})),v("html","manifest","head body"),v("head","","base command link meta noscript script style title"),v("title hr noscript br"),v("base","href target"),v("link","href rel media hreflang type sizes hreflang"),v("meta","name http-equiv content charset"),v("style","media type scoped"),v("script","src async defer type charset"),v("body","onafterprint onbeforeprint onbeforeunload onblur onerror onfocus onhashchange onload onmessage onoffline ononline onpagehide onpageshow onpopstate onresize onscroll onstorage onunload",a),v("dd div","",a),v("address dt caption","",e==="html4"?s:a),v("h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn","",s),v("blockquote","cite",a),v("ol","reversed start type","li"),v("ul","","li"),v("li","value",a),v("dl","","dt dd"),v("a","href target rel media hreflang type",e==="html4"?s:a),v("q","cite",s),v("ins del","cite datetime",a),v("img","src sizes srcset alt usemap ismap width height"),v("iframe","src name width height",a),v("embed","src type width height"),v("object","data type typemustmatch name usemap form width height",[a,"param"].join(" ")),v("param","name value"),v("map","name",[a,"area"].join(" ")),v("area","alt coords shape href target rel media hreflang type"),v("table","border","caption colgroup thead tfoot tbody tr"+(e==="html4"?" col":"")),v("colgroup","span","col"),v("col","span"),v("tbody thead tfoot","","tr"),v("tr","","td th"),v("td","colspan rowspan headers",a),v("th","colspan rowspan headers scope abbr",a),v("form","accept-charset action autocomplete enctype method name novalidate target",a),v("fieldset","disabled form name",[a,"legend"].join(" ")),v("label","form for",s),v("input","accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate formtarget height list max maxlength min multiple name pattern readonly required size src step type value width"),v("button","disabled form formaction formenctype formmethod formnovalidate formtarget name type value",e==="html4"?a:s),v("select","disabled form multiple name required size","option optgroup"),v("optgroup","disabled label","option"),v("option","disabled label selected value"),v("textarea","cols dirname disabled form maxlength name readonly required rows wrap"),v("menu","type label",[a,"li"].join(" ")),v("noscript","",a),e!=="html4"&&(v("wbr"),v("ruby","",[s,"rt rp"].join(" ")),v("figcaption","",a),v("mark rt rp bdi","",s),v("summary","",[s,"h1 h2 h3 h4 h5 h6"].join(" ")),v("canvas","width height",a),v("data","value",s),v("video","src crossorigin poster preload autoplay mediagroup loop muted controls width height buffered",[a,"track source"].join(" ")),v("audio","src crossorigin preload autoplay mediagroup loop muted controls buffered volume",[a,"track source"].join(" ")),v("picture","","img source"),v("source","src srcset type media sizes"),v("track","kind src srclang label default"),v("datalist","",[s,"option"].join(" ")),v("article section nav aside main header footer","",a),v("hgroup","","h1 h2 h3 h4 h5 h6"),v("figure","",[a,"figcaption"].join(" ")),v("time","datetime",s),v("dialog","open",a),v("command","type label icon disabled checked radiogroup command"),v("output","for form name",s),v("progress","value max",s),v("meter","value min max low high optimum",s),v("details","open",[a,"summary"].join(" ")),v("keygen","autofocus challenge disabled form keytype name"),p("svg","id tabindex lang xml:space class style x y width height viewBox preserveAspectRatio zoomAndPan transform".split(" "),[])),e!=="html5-strict"&&(C("script","language xml:space"),C("style","xml:space"),C("object","declare classid code codebase codetype archive standby align border hspace vspace"),C("embed","align name hspace vspace"),C("param","valuetype type"),C("a","charset name rev shape coords"),C("br","clear"),C("applet","codebase archive code object alt name width height align hspace vspace"),C("img","name longdesc align border hspace vspace"),C("iframe","longdesc frameborder marginwidth marginheight scrolling align"),C("font basefont","size color face"),C("input","usemap align"),C("select"),C("textarea"),C("h1 h2 h3 h4 h5 h6 div p legend caption","align"),C("ul","type compact"),C("li","type"),C("ol dl menu dir","compact"),C("pre","width xml:space"),C("hr","align noshade size width"),C("isindex","prompt"),C("table","summary width frame rules cellspacing cellpadding align bgcolor"),C("col","width align char charoff valign"),C("colgroup","width align char charoff valign"),C("thead","align char charoff valign"),C("tr","align char charoff valign bgcolor"),C("th","axis align char charoff valign nowrap bgcolor width height"),C("form","accept"),C("td","abbr axis scope align char charoff valign nowrap bgcolor width height"),C("tfoot","align char charoff valign"),C("tbody","align char charoff valign"),C("area","nohref"),C("body","background bgcolor text link vlink alink")),e!=="html4"&&(C("input button select textarea","autofocus"),C("input textarea","placeholder"),C("a","download"),C("link script img","crossorigin"),C("img","loading"),C("iframe","sandbox seamless allow allowfullscreen loading")),e!=="html4"&&xe([d.video,d.audio],L=>{delete L.children.audio,delete L.children.video}),xe(Ca("a form meter progress dfn"),L=>{d[L]&&delete d[L].children[L]}),delete d.caption.children.table,delete d.script,d},mi=e=>e==="-"?"remove":"add",O1=e=>{const t=/^(@?)([A-Za-z0-9_\-.\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]+)$/;return J.from(t.exec(e)).map(s=>({preset:s[1]==="@",name:s[2]}))},yv=e=>{const t=/^([+\-]?)([A-Za-z0-9_\-.\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]+)\[([^\]]+)]$/;return kt(Ca(e,","),s=>{const a=t.exec(s);if(a){const d=a[1],p=d?mi(d):"replace",v=a[2],C=kt(Ca(a[3],"|"),L=>O1(L).toArray());return[{operation:p,name:v,validChildren:C}]}else return[]})},wv=(e,t)=>{const s=/^([!\-])?(\w+[\\:]:\w+|[^=~<]+)?(?:([=~<])(.*))?$/,a=/[*?+]/,{attributes:d,attributesOrder:p}=t;return xe(Ca(e,"|"),v=>{const C=s.exec(v);if(C){const L={},G=C[1],ee=C[2].replace(/[\\:]:/g,":"),te=C[3],ie=C[4];if(G==="!"&&(t.attributesRequired=t.attributesRequired||[],t.attributesRequired.push(ee),L.required=!0),G==="-"){delete d[ee],p.splice(hn.inArray(p,ee),1);return}if(te&&(te==="="?(t.attributesDefault=t.attributesDefault||[],t.attributesDefault.push({name:ee,value:ie}),L.defaultValue=ie):te==="~"?(t.attributesForced=t.attributesForced||[],t.attributesForced.push({name:ee,value:ie}),L.forcedValue=ie):te==="<"&&(L.validValues=hn.makeMap(ie,"?"))),a.test(ee)){const ye=L;t.attributePatterns=t.attributePatterns||[],ye.pattern=gf(ee),t.attributePatterns.push(ye)}else d[ee]||p.push(ee),d[ee]=L}})},Zn=(e,t)=>{qo(e.attributes,(s,a)=>{t.attributes[a]=s}),t.attributesOrder.push(...e.attributesOrder)},xS=(e,t)=>{const s=/^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)])?$/;return kt(Ca(t,","),a=>{const d=s.exec(a);if(d){const p=d[1],v=d[2],C=d[3],L=d[4],G=d[5],ee={attributes:{},attributesOrder:[]};if(e.each(te=>Zn(te,ee)),p==="#"?ee.paddEmpty=!0:p==="-"&&(ee.removeEmpty=!0),L==="!"&&(ee.removeEmptyAttrs=!0),G&&wv(G,ee),C&&(ee.outputName=v),v==="@")if(e.isNone())e=J.some(ee);else return[];return[C?{name:v,element:ee,aliasName:C}:{name:v,element:ee}]}else return[]})},F0={},ug=hn.makeMap,Mu=hn.each,B0=hn.extend,Uh=hn.explode,bf=(e,t={})=>{const s=ug(e," ",ug(e.toUpperCase()," "));return B0(s,t)},yS=e=>bf("td th li dt dd figcaption caption details summary",e.getTextBlockElements()),dg=(e,t)=>{if(e){const s={};return re(e)&&(e={"*":e}),Mu(e,(a,d)=>{s[d]=s[d.toUpperCase()]=t==="map"?ug(a,/[, ]/):Uh(a,/[, ]/)}),s}else return},Vh=(e={})=>{var t;const s={},a={};let d=[];const p={},v={},C=(bo,Fs,Fi)=>{const xa=e[bo];if(xa)return ug(xa,/[, ]/,ug(xa.toUpperCase(),/[, ]/));{let Ya=F0[bo];return Ya||(Ya=bf(Fs,Fi),F0[bo]=Ya),Ya}},L=(t=e.schema)!==null&&t!==void 0?t:"html5",G=BT(L);e.verify_html===!1&&(e.valid_elements="*[*]");const ee=dg(e.valid_styles),te=dg(e.invalid_styles,"map"),ie=dg(e.valid_classes,"map"),ye=C("whitespace_elements","pre script noscript style textarea video audio iframe object code"),Re=C("self_closing_elements","colgroup dd dt li option p td tfoot th thead tr"),Se=C("void_elements","area base basefont br col frame hr img input isindex link meta param embed source wbr track"),Pe=C("boolean_attributes","checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls allowfullscreen"),Je="td th iframe video audio object script code",nt=C("non_empty_elements",Je+" pre svg textarea summary",Se),rt=C("move_caret_before_on_enter_elements",Je+" table",Se),ft="h1 h2 h3 h4 h5 h6",Xt=C("text_block_elements",ft+" p div address pre form blockquote center dir fieldset header footer article section hgroup aside main nav figure"),mn=C("block_elements","hr table tbody thead tfoot th tr td li ol ul caption dl dt dd noscript menu isindex option datalist select optgroup figcaption details summary html body multicol listing",Xt),Fn=C("text_inline_elements","span strong b em i font s strike u var cite dfn code mark q sup sub samp"),Lt=C("transparent_elements","a ins del canvas map"),yt=C("wrap_block_elements","pre "+ft);Mu("script noscript iframe noframes noembed title style textarea xmp plaintext".split(" "),bo=>{v[bo]=new RegExp("</"+bo+"[^>]*>","gi")});const qt=bo=>{const Fs=J.from(s["@"]),Fi=/[*?+]/;xe(xS(Fs,bo??""),({name:xa,element:Ya,aliasName:Kl})=>{if(Kl&&(s[Kl]=Ya),Fi.test(xa)){const Pa=Ya;Pa.pattern=gf(xa),d.push(Pa)}else s[xa]=Ya})},no=bo=>{d=[],xe(Yt(s),Fs=>{delete s[Fs]}),qt(bo)},So=(bo,Fs)=>{var Fi,xa;delete F0.text_block_elements,delete F0.block_elements;const Ya=Fs.extends?!Jd(Fs.extends):!1,Kl=Fs.extends;if(a[bo]=Kl?a[Kl]:{},p[bo]=Kl??bo,nt[bo.toUpperCase()]={},nt[bo]={},Ya||(mn[bo.toUpperCase()]={},mn[bo]={}),Kl&&!s[bo]&&s[Kl]){const Pa=Rs(s[Kl]);delete Pa.removeEmptyAttrs,delete Pa.removeEmpty,s[bo]=Pa}else s[bo]={attributesOrder:[],attributes:{}};if(ae(Fs.attributes)){const Pa=gu=>{Ma.attributesOrder.push(gu),Ma.attributes[gu]={}},Ma=(Fi=s[bo])!==null&&Fi!==void 0?Fi:{};delete Ma.attributesDefault,delete Ma.attributesForced,delete Ma.attributePatterns,delete Ma.attributesRequired,Ma.attributesOrder=[],Ma.attributes={},xe(Fs.attributes,gu=>{const wm=jf(L);O1(gu).each(({preset:Sm,name:Em})=>{Sm?Em==="global"&&xe(wm,Pa):Pa(Em)})}),s[bo]=Ma}if(Ue(Fs.padEmpty)){const Pa=(xa=s[bo])!==null&&xa!==void 0?xa:{};Pa.paddEmpty=Fs.padEmpty,s[bo]=Pa}if(ae(Fs.children)){const Pa={},Ma=wm=>{Pa[wm]={}},gu=wm=>{N0(L,wm).each(Sm=>{xe(Sm,Ma)})};xe(Fs.children,wm=>{O1(wm).each(({preset:Sm,name:Em})=>{Sm?gu(Em):Ma(Em)})}),a[bo]=Pa}Kl&&qo(a,(Pa,Ma)=>{Pa[Kl]&&(a[Ma]=Pa=B0({},a[Ma]),Pa[bo]=Pa[Kl])})},fs=bo=>{xe(Cc(bo??""),({name:Fs,cloneName:Fi})=>{So(Fs,{extends:Fi})})},Ts=bo=>{Y(bo)?qo(bo,(Fs,Fi)=>So(Fi,Fs)):re(bo)&&fs(bo)},_r=bo=>{xe(yv(bo??""),({operation:Fs,name:Fi,validChildren:xa})=>{const Ya=Fs==="replace"?{"#comment":{}}:a[Fi],Kl=Ma=>{Fs==="remove"?delete Ya[Ma]:Ya[Ma]={}},Pa=Ma=>{N0(L,Ma).each(gu=>{xe(gu,Kl)})};xe(xa,({preset:Ma,name:gu})=>{Ma?Pa(gu):Kl(gu)}),a[Fi]=Ya})},$r=bo=>{const Fs=s[bo];if(Fs)return Fs;let Fi=d.length;for(;Fi--;){const xa=d[Fi];if(xa.pattern.test(bo))return xa}},sa=()=>{e.valid_elements?(no(e.valid_elements),Mu(G,(bo,Fs)=>{a[Fs]=bo.children})):(Mu(G,(bo,Fs)=>{s[Fs]={attributes:bo.attributes,attributesOrder:bo.attributesOrder},a[Fs]=bo.children}),Mu(Ca("strong/b em/i"),bo=>{const Fs=Ca(bo,"/");s[Fs[1]].outputName=Fs[0]}),Mu(Fn,(bo,Fs)=>{s[Fs]&&(e.padd_empty_block_inline_children&&(s[Fs].paddInEmptyBlock=!0),s[Fs].removeEmpty=!0)}),Mu(Ca("ol ul blockquote a table tbody"),bo=>{s[bo]&&(s[bo].removeEmpty=!0)}),Mu(Ca("p h1 h2 h3 h4 h5 h6 th td pre div address caption li summary"),bo=>{s[bo]&&(s[bo].paddEmpty=!0)}),Mu(Ca("span"),bo=>{s[bo].removeEmptyAttrs=!0})),delete s.svg,Ts(e.custom_elements),_r(e.valid_children),qt(e.extended_valid_elements),_r("+ol[ul|ol],+ul[ul|ol]"),Mu({dd:"dl",dt:"dl",li:"ul ol",td:"tr",th:"tr",tr:"tbody thead tfoot",tbody:"table",thead:"table",tfoot:"table",legend:"fieldset",area:"map",param:"video audio object"},(bo,Fs)=>{s[Fs]&&(s[Fs].parentsRequired=Ca(bo))}),e.invalid_elements&&Mu(Uh(e.invalid_elements),bo=>{s[bo]&&delete s[bo]}),$r("span")||qt("span[!data-mce-type|*]")},cc=et(ee),Hr=et(te),En=et(ie),fo=et(Pe),Zs=et(mn),kn=et(Xt),ko=et(Fn),hs=et(Object.seal(Se)),Mn=et(Re),cs=et(nt),Ss=et(rt),xl=et(ye),Tr=et(Lt),sl=et(yt),yh=et(Object.seal(v)),$p=(bo,Fs)=>{const Fi=a[bo.toLowerCase()];return!!(Fi&&Fi[Fs.toLowerCase()])},pu=(bo,Fs)=>{const Fi=$r(bo);if(Fi)if(Fs){if(Fi.attributes[Fs])return!0;const xa=Fi.attributePatterns;if(xa){let Ya=xa.length;for(;Ya--;)if(xa[Ya].pattern.test(Fs))return!0}}else return!0;return!1},Jd=bo=>yn(Zs(),bo),wh=bo=>!qs(bo,"#")&&pu(bo)&&!Jd(bo),Qd=bo=>yn(sl(),bo)||wh(bo),Sh=et(p);return sa(),{type:L,children:a,elements:s,getValidStyles:cc,getValidClasses:En,getBlockElements:Zs,getInvalidStyles:Hr,getVoidElements:hs,getTextBlockElements:kn,getTextInlineElements:ko,getBoolAttrs:fo,getElementRule:$r,getSelfClosingElements:Mn,getNonEmptyElements:cs,getMoveCaretBeforeOnEnterElements:Ss,getWhitespaceElements:xl,getTransparentElements:Tr,getSpecialElements:yh,isValidChild:$p,isValid:pu,isBlock:Jd,isInline:wh,isWrapper:Qd,getCustomElements:Sh,addValidElements:qt,setValidElements:no,addCustomElements:Ts,addValidChildren:_r}},Sv=e=>({value:wS(e)}),wS=e=>Qc(e,"#").toUpperCase(),Ev=e=>{const t=e.toString(16);return(t.length===1?"0"+t:t).toUpperCase()},Cv=e=>{const t=Ev(e.red)+Ev(e.green)+Ev(e.blue);return Sv(t)},I1=/^\s*rgb\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*\)\s*$/i,_v=/^\s*rgba\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*((?:\d?\.\d+|\d+)%?)\s*\)\s*$/i,$T=(e,t,s,a)=>({red:e,green:t,blue:s,alpha:a}),SS=(e,t,s,a)=>{const d=parseInt(e,10),p=parseInt(t,10),v=parseInt(s,10),C=parseFloat(a);return $T(d,p,v,C)},HT=e=>I1.test(e)?"rgb":_v.test(e)?"rgba":"other",ES=e=>{const t=I1.exec(e);if(t!==null)return J.some(SS(t[1],t[2],t[3],"1"));const s=_v.exec(e);return s!==null?J.some(SS(s[1],s[2],s[3],s[4])):J.none()},jm=e=>`rgba(${e.red},${e.green},${e.blue},${e.alpha})`,$0=e=>ES(e).map(Cv).map(t=>"#"+t.value).getOr(e),P1=(e={},t)=>{const s=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,a=/\s*([^:]+):\s*([^;]+);?/g,d=/\s+$/,p={};let v,C;const L=Jo;t&&(v=t.getValidStyles(),C=t.getInvalidStyles());const G=(`\\" \\' \\; \\: ; : `+L).split(" ");for(let te=0;te<G.length;te++)p[G[te]]=L+te,p[L+te]=G[te];const ee={parse:te=>{const ie={};let ye=!1;const Re=e.url_converter,Se=e.url_converter_scope||ee,Pe=(Lt,yt,qt)=>{const no=ie[Lt+"-top"+yt];if(!no)return;const So=ie[Lt+"-right"+yt];if(!So)return;const fs=ie[Lt+"-bottom"+yt];if(!fs)return;const Ts=ie[Lt+"-left"+yt];if(!Ts)return;const _r=[no,So,fs,Ts];let $r=_r.length-1;for(;$r--&&_r[$r]===_r[$r+1];);$r>-1&&qt||(ie[Lt+yt]=$r===-1?_r[0]:_r.join(" "),delete ie[Lt+"-top"+yt],delete ie[Lt+"-right"+yt],delete ie[Lt+"-bottom"+yt],delete ie[Lt+"-left"+yt])},Je=Lt=>{const yt=ie[Lt];if(!yt)return;const qt=yt.indexOf(",")>-1?[yt]:yt.split(" ");let no=qt.length;for(;no--;)if(qt[no]!==qt[0])return!1;return ie[Lt]=qt[0],!0},nt=(Lt,yt,qt,no)=>{Je(yt)&&Je(qt)&&Je(no)&&(ie[Lt]=ie[yt]+" "+ie[qt]+" "+ie[no],delete ie[yt],delete ie[qt],delete ie[no])},rt=Lt=>(ye=!0,p[Lt]),ft=(Lt,yt)=>(ye&&(Lt=Lt.replace(/\uFEFF[0-9]/g,qt=>p[qt])),yt||(Lt=Lt.replace(/\\([\'\";:])/g,"$1")),Lt),Xt=Lt=>String.fromCharCode(parseInt(Lt.slice(1),16)),mn=Lt=>Lt.replace(/\\[0-9a-f]+/gi,Xt),Fn=(Lt,yt,qt,no,So,fs)=>{if(So=So||fs,So)return So=ft(So),"'"+So.replace(/\'/g,"\\'")+"'";if(yt=ft(yt||qt||no||""),!e.allow_script_urls){const Ts=yt.replace(/[\s\r\n]+/g,"");if(/(java|vb)script:/i.test(Ts)||!e.allow_svg_data_urls&&/^data:image\/svg/i.test(Ts))return""}return Re&&(yt=Re.call(Se,yt,"style")),"url('"+yt.replace(/\'/g,"\\'")+"')"};if(te){te=te.replace(/[\u0000-\u001F]/g,""),te=te.replace(/\\[\"\';:\uFEFF]/g,rt).replace(/\"[^\"]+\"|\'[^\']+\'/g,yt=>yt.replace(/[;:]/g,rt));let Lt;for(;Lt=a.exec(te);){a.lastIndex=Lt.index+Lt[0].length;let yt=Lt[1].replace(d,"").toLowerCase(),qt=Lt[2].replace(d,"");if(yt&&qt){if(yt=mn(yt),qt=mn(qt),yt.indexOf(L)!==-1||yt.indexOf('"')!==-1||!e.allow_script_urls&&(yt==="behavior"||/expression\s*\(|\/\*|\*\//.test(qt)))continue;yt==="font-weight"&&qt==="700"?qt="bold":(yt==="color"||yt==="background-color")&&(qt=qt.toLowerCase()),HT(qt)==="rgb"&&ES(qt).each(no=>{qt=$0(jm(no)).toLowerCase()}),qt=qt.replace(s,Fn),ie[yt]=ye?ft(qt,!0):qt}}Pe("border","",!0),Pe("border","-width"),Pe("border","-color"),Pe("border","-style"),Pe("padding",""),Pe("margin",""),nt("border","border-width","border-style","border-color"),ie.border==="medium none"&&delete ie.border,ie["border-image"]==="none"&&delete ie["border-image"]}return ie},serialize:(te,ie)=>{let ye="";const Re=(Pe,Je)=>{const nt=Je[Pe];if(nt)for(let rt=0,ft=nt.length;rt<ft;rt++){const Xt=nt[rt],mn=te[Xt];mn&&(ye+=(ye.length>0?" ":"")+Xt+": "+mn+";")}},Se=(Pe,Je)=>{if(!C||!Je)return!0;let nt=C["*"];return nt&&nt[Pe]?!1:(nt=C[Je],!(nt&&nt[Pe]))};return ie&&v?(Re("*",v),Re(ie,v)):qo(te,(Pe,Je)=>{Pe&&Se(Je,ie)&&(ye+=(ye.length>0?" ":"")+Je+": "+Pe+";")}),ye}};return ee},Kf={keyLocation:!0,layerX:!0,layerY:!0,returnValue:!0,webkitMovementX:!0,webkitMovementY:!0,keyIdentifier:!0,mozPressure:!0},Km=e=>e instanceof Event||Oe(e.initEvent),CS=e=>e.isDefaultPrevented===an||e.isDefaultPrevented===vt,_S=e=>Ae(e.preventDefault)||Km(e),M1=(e,t)=>{const s=t??{};for(const a in e)yn(Kf,a)||(s[a]=e[a]);return ve(e.composedPath)&&(s.composedPath=()=>e.composedPath()),ve(e.getModifierState)&&(s.getModifierState=a=>e.getModifierState(a)),ve(e.getTargetRanges)&&(s.getTargetRanges=()=>e.getTargetRanges()),s},Tv=(e,t,s,a)=>{var d;const p=M1(t,a);return p.type=e,Ae(p.target)&&(p.target=(d=p.srcElement)!==null&&d!==void 0?d:s),_S(t)&&(p.preventDefault=()=>{p.defaultPrevented=!0,p.isDefaultPrevented=an,Oe(t.preventDefault)&&t.preventDefault()},p.stopPropagation=()=>{p.cancelBubble=!0,p.isPropagationStopped=an,Oe(t.stopPropagation)&&t.stopPropagation()},p.stopImmediatePropagation=()=>{p.isImmediatePropagationStopped=an,p.stopPropagation()},CS(p)||(p.isDefaultPrevented=p.defaultPrevented===!0?an:vt,p.isPropagationStopped=p.cancelBubble===!0?an:vt,p.isImmediatePropagationStopped=vt)),p},UT="mce-data-",TS=/^(?:mouse|contextmenu)|click/,Dv=(e,t,s,a)=>{e.addEventListener(t,s,a||!1)},Pr=(e,t,s,a)=>{e.removeEventListener(t,s,a||!1)},H0=e=>ve(e)&&TS.test(e.type),ga=(e,t)=>{const s=Tv(e.type,e,document,t);if(H0(e)&&ot(e.pageX)&&!ot(e.clientX)){const a=s.target.ownerDocument||document,d=a.documentElement,p=a.body,v=s;v.pageX=e.clientX+(d&&d.scrollLeft||p&&p.scrollLeft||0)-(d&&d.clientLeft||p&&p.clientLeft||0),v.pageY=e.clientY+(d&&d.scrollTop||p&&p.scrollTop||0)-(d&&d.clientTop||p&&p.clientTop||0)}return s},N1=(e,t,s)=>{const a=e.document,d={type:"ready"};if(s.domLoaded){t(d);return}const p=()=>a.readyState==="complete"||a.readyState==="interactive"&&a.body,v=()=>{Pr(e,"DOMContentLoaded",v),Pr(e,"load",v),s.domLoaded||(s.domLoaded=!0,t(d)),e=null};p()?v():Dv(e,"DOMContentLoaded",v),s.domLoaded||Dv(e,"load",v)};class Qi{constructor(){this.domLoaded=!1,this.events={},this.count=1,this.expando=UT+(+new Date).toString(32),this.hasFocusIn="onfocusin"in document.documentElement,this.count=1}bind(t,s,a,d){const p=this;let v;const C=window,L=ie=>{p.executeHandlers(ga(ie||C.event),G)};if(!t||rn(t)||so(t))return a;let G;t[p.expando]?G=t[p.expando]:(G=p.count++,t[p.expando]=G,p.events[G]={}),d=d||t;const ee=s.split(" ");let te=ee.length;for(;te--;){let ie=ee[te],ye=L,Re=!1,Se=!1;if(ie==="DOMContentLoaded"&&(ie="ready"),p.domLoaded&&ie==="ready"&&t.readyState==="complete"){a.call(d,ga({type:ie}));continue}!p.hasFocusIn&&(ie==="focusin"||ie==="focusout")&&(Re=!0,Se=ie==="focusin"?"focus":"blur",ye=Pe=>{const Je=ga(Pe||C.event);Je.type=Je.type==="focus"?"focusin":"focusout",p.executeHandlers(Je,G)}),v=p.events[G][ie],v?ie==="ready"&&p.domLoaded?a(ga({type:ie})):v.push({func:a,scope:d}):(p.events[G][ie]=v=[{func:a,scope:d}],v.fakeName=Se,v.capture=Re,v.nativeHandler=ye,ie==="ready"?N1(t,ye,p):Dv(t,Se||ie,ye,Re))}return t=v=null,a}unbind(t,s,a){if(!t||rn(t)||so(t))return this;const d=t[this.expando];if(d){let p=this.events[d];if(s){const v=s.split(" ");let C=v.length;for(;C--;){const L=v[C],G=p[L];if(G){if(a){let ee=G.length;for(;ee--;)if(G[ee].func===a){const te=G.nativeHandler,ie=G.fakeName,ye=G.capture,Re=G.slice(0,ee).concat(G.slice(ee+1));Re.nativeHandler=te,Re.fakeName=ie,Re.capture=ye,p[L]=Re}}(!a||G.length===0)&&(delete p[L],Pr(t,G.fakeName||L,G.nativeHandler,G.capture))}}}else qo(p,(v,C)=>{Pr(t,v.fakeName||C,v.nativeHandler,v.capture)}),p={};for(const v in p)if(yn(p,v))return this;delete this.events[d];try{delete t[this.expando]}catch{t[this.expando]=null}}return this}fire(t,s,a){return this.dispatch(t,s,a)}dispatch(t,s,a){if(!t||rn(t)||so(t))return this;const d=ga({type:s,target:t},a);do{const p=t[this.expando];p&&this.executeHandlers(d,p),t=t.parentNode||t.ownerDocument||t.defaultView||t.parentWindow}while(t&&!d.isPropagationStopped());return this}clean(t){if(!t||rn(t)||so(t))return this;if(t[this.expando]&&this.unbind(t),t.getElementsByTagName||(t=t.document),t&&t.getElementsByTagName){this.unbind(t);const s=t.getElementsByTagName("*");let a=s.length;for(;a--;)t=s[a],t[this.expando]&&this.unbind(t)}return this}destroy(){this.events={}}cancel(t){return t&&(t.preventDefault(),t.stopImmediatePropagation()),!1}executeHandlers(t,s){const a=this.events[s],d=a&&a[t.type];if(d)for(let p=0,v=d.length;p<v;p++){const C=d[p];if(C&&C.func.call(C.scope,t)===!1&&t.preventDefault(),t.isImmediatePropagationStopped())return}}}Qi.Event=new Qi;const _c=hn.each,F1=hn.grep,U0="data-mce-style",fg=hn.makeMap("fill-opacity font-weight line-height opacity orphans widows z-index zoom"," "),Zm=(e,t,s)=>{Ae(s)||s===""?Xi(e,t):$s(e,t,s)},Zf=e=>e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase()),zh=(e,t)=>{let s=0;if(e)for(let a=e.nodeType,d=e.previousSibling;d;d=d.previousSibling){const p=d.nodeType;t&&rn(d)&&(p===a||!d.data.length)||(s++,a=p)}return s},vf=(e,t)=>{const s=Oa(t,"style"),a=e.serialize(e.parse(s),ls(t));Zm(t,U0,a)},VT=(e,t)=>O(e)?yn(fg,t)?e+"":e+"px":e,kv=(e,t,s)=>{const a=Zf(t);Ae(s)||s===""?yc(e,a):ys(e,a,VT(s,a))},si=(e,t,s)=>{const a=t.keep_values,d={set:(v,C,L)=>{const G=M.fromDom(v);Oe(t.url_converter)&&ve(C)&&(C=t.url_converter.call(t.url_converter_scope||s(),String(C),L,v));const ee="data-mce-"+L;Zm(G,ee,C),Zm(G,L,C)},get:(v,C)=>{const L=M.fromDom(v);return Oa(L,"data-mce-"+C)||Oa(L,C)}},p={style:{set:(v,C)=>{const L=M.fromDom(v);a&&Zm(L,U0,C),Xi(L,"style"),re(C)&&ma(L,e.parse(C))},get:v=>{const C=M.fromDom(v),L=Oa(C,U0)||Oa(C,"style");return e.serialize(e.parse(L),ls(C))}}};return a&&(p.href=p.src=d),p},js=(e,t={})=>{const s={},a=window,d={};let p=0;const v=!0,C=!0,L=R0.forElement(M.fromDom(e),{contentCssCors:t.contentCssCors,referrerPolicy:t.referrerPolicy}),G=[],ee=t.schema?t.schema:Vh({}),te=P1({url_converter:t.url_converter,url_converter_scope:t.url_converter_scope},t.schema),ie=t.ownEvents?new Qi:Qi.Event,ye=ee.getBlockElements(),Re=bt=>re(bt)?yn(ye,bt):oo(bt)&&(yn(ye,bt.nodeName)||Bh(ee,bt)),Se=bt=>bt&&e&&re(bt)?e.getElementById(bt):bt,Pe=bt=>{const wt=Se(bt);return ve(wt)?M.fromDom(wt):null},Je=(bt,wt,wn="")=>{let fn;const Fo=Pe(bt);if(ve(Fo)&&ll(Fo)){const Ls=AL[wt];Ls&&Ls.get?fn=Ls.get(Fo.dom,wt):fn=Oa(Fo,wt)}return ve(fn)?fn:wn},nt=bt=>{const wt=Se(bt);return Ae(wt)?[]:wt.attributes},rt=(bt,wt,wn)=>{fo(bt,fn=>{if(oo(fn)){const Fo=M.fromDom(fn),Ls=wn===""?null:wn,Bi=Oa(Fo,wt),Cm=AL[wt];Cm&&Cm.set?Cm.set(Fo.dom,Ls,wt):Zm(Fo,wt,Ls),Bi!==Ls&&t.onSetAttrib&&t.onSetAttrib({attrElm:Fo.dom,attrName:wt,attrValue:Ls})}})},ft=(bt,wt)=>bt.cloneNode(wt),Xt=()=>t.root_element||e.body,mn=bt=>{const wt=Vr(bt);return{x:wt.x,y:wt.y,w:wt.width,h:wt.height}},Fn=(bt,wt)=>C1(e.body,Se(bt),wt),Lt=(bt,wt,wn)=>{fo(bt,fn=>{const Fo=M.fromDom(fn);kv(Fo,wt,wn),t.update_styles&&vf(te,Fo)})},yt=(bt,wt)=>{fo(bt,wn=>{const fn=M.fromDom(wn);qo(wt,(Fo,Ls)=>{kv(fn,Ls,Fo)}),t.update_styles&&vf(te,fn)})},qt=(bt,wt,wn)=>{const fn=Se(bt);if(!(Ae(fn)||!lu(fn)&&!eg(fn)))return wn?Vi(M.fromDom(fn),Zf(wt)):(wt=wt.replace(/-(\D)/g,(Fo,Ls)=>Ls.toUpperCase()),wt==="float"&&(wt="cssFloat"),fn.style?fn.style[wt]:void 0)},no=bt=>{const wt=Se(bt);if(!wt)return{w:0,h:0};let wn=qt(wt,"width"),fn=qt(wt,"height");return(!wn||wn.indexOf("px")===-1)&&(wn="0"),(!fn||fn.indexOf("px")===-1)&&(fn="0"),{w:parseInt(wn,10)||wt.offsetWidth||wt.clientWidth,h:parseInt(fn,10)||wt.offsetHeight||wt.clientHeight}},So=bt=>{const wt=Se(bt),wn=Fn(wt),fn=no(wt);return{x:wn.x,y:wn.y,w:fn.w,h:fn.h}},fs=(bt,wt)=>{if(!bt)return!1;const wn=ae(bt)?bt:[bt];return mo(wn,fn=>Ve(M.fromDom(fn),wt))},Ts=(bt,wt,wn,fn)=>{const Fo=[];let Ls=Se(bt);fn=fn===void 0;const Bi=wn||(Xt().nodeName!=="BODY"?Xt().parentNode:null);if(re(wt))if(wt==="*")wt=oo;else{const Cm=wt;wt=u4=>fs(u4,Cm)}for(;Ls&&!(Ls===Bi||Ae(Ls.nodeType)||id(Ls)||D0(Ls));){if(!wt||wt(Ls))if(fn)Fo.push(Ls);else return[Ls];Ls=Ls.parentNode}return fn?Fo:null},_r=(bt,wt,wn)=>{const fn=Ts(bt,wt,wn,!1);return fn&&fn.length>0?fn[0]:null},$r=(bt,wt,wn)=>{let fn=wt;if(bt){re(wt)&&(fn=Fo=>fs(Fo,wt));for(let Fo=bt[wn];Fo;Fo=Fo[wn])if(Oe(fn)&&fn(Fo))return Fo}return null},sa=(bt,wt)=>$r(bt,wt,"nextSibling"),cc=(bt,wt)=>$r(bt,wt,"previousSibling"),Hr=bt=>Oe(bt.querySelectorAll),En=(bt,wt)=>{var wn,fn;const Fo=(fn=(wn=Se(wt))!==null&&wn!==void 0?wn:t.root_element)!==null&&fn!==void 0?fn:e;return Hr(Fo)?In(Fo.querySelectorAll(bt)):[]},fo=function(bt,wt,wn){const fn=wn??this;if(ae(bt)){const Fo=[];return _c(bt,(Ls,Bi)=>{const Cm=Se(Ls);Cm&&Fo.push(wt.call(fn,Cm,Bi))}),Fo}else{const Fo=Se(bt);return Fo?wt.call(fn,Fo):!1}},Zs=(bt,wt)=>{fo(bt,wn=>{qo(wt,(fn,Fo)=>{rt(wn,Fo,fn)})})},kn=(bt,wt)=>{fo(bt,wn=>{const fn=M.fromDom(wn);zc(fn,wt)})},ko=(bt,wt,wn,fn,Fo)=>fo(bt,Ls=>{const Bi=re(wt)?e.createElement(wt):wt;return ve(wn)&&Zs(Bi,wn),fn&&(!re(fn)&&fn.nodeType?Bi.appendChild(fn):re(fn)&&kn(Bi,fn)),Fo?Bi:Ls.appendChild(Bi)}),hs=(bt,wt,wn)=>ko(e.createElement(bt),bt,wt,wn,!0),Mn=Hh.decode,cs=Hh.encodeAllRaw,Ss=(bt,wt,wn="")=>{let fn="<"+bt;for(const Fo in wt)vr(wt,Fo)&&(fn+=" "+Fo+'="'+cs(wt[Fo])+'"');return jr(wn)&&yn(ee.getVoidElements(),bt)?fn+" />":fn+">"+wn+"</"+bt+">"},xl=bt=>{const wt=e.createElement("div"),wn=e.createDocumentFragment();wn.appendChild(wt),bt&&(wt.innerHTML=bt);let fn;for(;fn=wt.firstChild;)wn.appendChild(fn);return wn.removeChild(wt),wn},Tr=(bt,wt)=>fo(bt,wn=>{const fn=M.fromDom(wn);return wt&&xe(cr(fn),Fo=>{ti(Fo)&&Fo.dom.length===0?Xs(Fo):lt(fn,Fo)}),Xs(fn),fn.dom}),sl=bt=>fo(bt,wt=>{const wn=wt.attributes;for(let fn=wn.length-1;fn>=0;fn--)wt.removeAttributeNode(wn.item(fn))}),yh=bt=>te.parse(bt),$p=(bt,wt)=>te.serialize(bt,wt),pu=bt=>{if(a0!==js.DOM&&e===document){if(s[bt])return;s[bt]=!0}let wt=e.getElementById("mceDefaultStyles");if(!wt){wt=e.createElement("style"),wt.id="mceDefaultStyles",wt.type="text/css";const wn=e.head;wn.firstChild?wn.insertBefore(wt,wn.firstChild):wn.appendChild(wt)}wt.styleSheet?wt.styleSheet.cssText+=bt:wt.appendChild(e.createTextNode(bt))},Jd=bt=>{bt||(bt=""),xe(bt.split(","),wt=>{d[wt]=!0,L.load(wt).catch(Fe)})},wh=(bt,wt,wn)=>{fo(bt,fn=>{if(oo(fn)){const Fo=M.fromDom(fn),Ls=wt.split(" ");xe(Ls,Bi=>{ve(wn)?(wn?od:nu)(Fo,Bi):os(Fo,Bi)})}})},Qd=(bt,wt)=>{wh(bt,wt,!0)},Sh=(bt,wt)=>{wh(bt,wt,!1)},bo=(bt,wt)=>{const wn=Pe(bt),fn=wt.split(" ");return ve(wn)&&jo(fn,Fo=>cl(wn,Fo))},Fs=bt=>{fo(bt,wt=>yc(M.fromDom(wt),"display"))},Fi=bt=>{fo(bt,wt=>ys(M.fromDom(wt),"display","none"))},xa=bt=>{const wt=Pe(bt);return ve(wt)&&Rd(Vc(wt,"display"),"none")},Ya=bt=>(bt||"mce_")+p++,Kl=bt=>{const wt=Pe(bt);return ve(wt)?oo(wt.dom)?wt.dom.outerHTML:Gc(wt):""},Pa=(bt,wt)=>{fo(bt,wn=>{oo(wn)&&(wn.outerHTML=wt)})},Ma=(bt,wt)=>{const wn=Se(wt);return fo(bt,fn=>{const Fo=wn==null?void 0:wn.parentNode,Ls=wn==null?void 0:wn.nextSibling;return Fo&&(Ls?Fo.insertBefore(fn,Ls):Fo.appendChild(fn)),fn})},gu=(bt,wt,wn)=>fo(wt,fn=>{var Fo;const Ls=ae(wt)?bt.cloneNode(!0):bt;return wn&&_c(F1(fn.childNodes),Bi=>{Ls.appendChild(Bi)}),(Fo=fn.parentNode)===null||Fo===void 0||Fo.replaceChild(Ls,fn),fn}),wm=(bt,wt)=>{if(bt.nodeName!==wt.toUpperCase()){const wn=hs(wt);return _c(nt(bt),fn=>{rt(wn,fn.nodeName,Je(bt,fn.nodeName))}),gu(wn,bt,!0),wn}else return bt},Sm=(bt,wt)=>{let wn=bt;for(;wn;){let fn=wt;for(;fn&&wn!==fn;)fn=fn.parentNode;if(wn===fn)break;wn=wn.parentNode}return!wn&&bt.ownerDocument?bt.ownerDocument.documentElement:wn},Em=(bt,wt,wn)=>me(wt)?Ga(ee,bt,{...wn,isContent:Fo=>{const Ls=Fo.nodeName.toLowerCase();return!!wt[Ls]}}):Ga(ee,bt,wn),Eh=()=>e.createRange(),t1=(bt,wt,wn)=>{let fn=Eh(),Fo,Ls;if(bt&&wt&&bt.parentNode&&wt.parentNode){const Bi=bt.parentNode;return fn.setStart(Bi,zh(bt)),fn.setEnd(wt.parentNode,zh(wt)),Fo=fn.extractContents(),fn=Eh(),fn.setStart(wt.parentNode,zh(wt)+1),fn.setEnd(Bi,zh(bt)+1),Ls=fn.extractContents(),Bi.insertBefore(ig(a0,Fo,ee),bt),wn?Bi.insertBefore(wn,bt):Bi.insertBefore(wt,bt),Bi.insertBefore(ig(a0,Ls,ee),bt),Tr(bt),wn||wt}else return},q_=(bt,wt,wn,fn)=>{if(ae(bt)){let Fo=bt.length;const Ls=[];for(;Fo--;)Ls[Fo]=q_(bt[Fo],wt,wn,fn);return Ls}else return t.collect&&(bt===e||bt===a)&&G.push([bt,wt,wn,fn]),ie.bind(bt,wt,wn,fn||a0)},Y_=(bt,wt,wn)=>{if(ae(bt)){let fn=bt.length;const Fo=[];for(;fn--;)Fo[fn]=Y_(bt[fn],wt,wn);return Fo}else{if(G.length>0&&(bt===e||bt===a)){let fn=G.length;for(;fn--;){const[Fo,Ls,Bi]=G[fn];bt===Fo&&(!wt||wt===Ls)&&(!wn||wn===Bi)&&ie.unbind(Fo,Ls,Bi)}}return ie.unbind(bt,wt,wn)}},ZH=(bt,wt,wn)=>ie.dispatch(bt,wt,wn),Wb=(bt,wt,wn)=>ie.dispatch(bt,wt,wn),c4=bt=>{if(bt&&lu(bt)){const wt=bt.getAttribute("data-mce-contenteditable");return wt&&wt!=="inherit"?wt:bt.contentEditable!=="inherit"?bt.contentEditable:null}else return null},a0={doc:e,settings:t,win:a,files:d,stdMode:v,boxModel:C,styleSheetLoader:L,boundEvents:G,styles:te,schema:ee,events:ie,isBlock:Re,root:null,clone:ft,getRoot:Xt,getViewPort:mn,getRect:So,getSize:no,getParent:_r,getParents:Ts,get:Se,getNext:sa,getPrev:cc,select:En,is:fs,add:ko,create:hs,createHTML:Ss,createFragment:xl,remove:Tr,setStyle:Lt,getStyle:qt,setStyles:yt,removeAllAttribs:sl,setAttrib:rt,setAttribs:Zs,getAttrib:Je,getPos:Fn,parseStyle:yh,serializeStyle:$p,addStyle:pu,loadCSS:Jd,addClass:Qd,removeClass:Sh,hasClass:bo,toggleClass:wh,show:Fs,hide:Fi,isHidden:xa,uniqueId:Ya,setHTML:kn,getOuterHTML:Kl,setOuterHTML:Pa,decode:Mn,encode:cs,insertAfter:Ma,replace:gu,rename:wm,findCommonAncestor:Sm,run:fo,getAttribs:nt,isEmpty:Em,createRng:Eh,nodeIndex:zh,split:t1,bind:q_,unbind:Y_,fire:Wb,dispatch:ZH,getContentEditable:c4,getContentEditableParent:bt=>{const wt=Xt();let wn=null;for(let fn=bt;fn&&fn!==wt&&(wn=c4(fn),wn===null);fn=fn.parentNode);return wn},isEditable:bt=>{if(ve(bt)){const wt=oo(bt)?bt:bt.parentElement;return ve(wt)&&lu(wt)&&$a(M.fromDom(wt))}else return!1},destroy:()=>{if(G.length>0){let bt=G.length;for(;bt--;){const[wt,wn,fn]=G[bt];ie.unbind(wt,wn,fn)}}qo(d,(bt,wt)=>{L.unload(wt),delete d[wt]})},isChildOf:(bt,wt)=>bt===wt||wt.contains(bt),dumpRng:bt=>"startContainer: "+bt.startContainer.nodeName+", startOffset: "+bt.startOffset+", endContainer: "+bt.endContainer.nodeName+", endOffset: "+bt.endOffset},AL=si(te,t,et(a0));return a0};js.DOM=js(document),js.nodeIndex=zh;const hg=js.DOM,B1=0,Gh=1,Gi=2,Nu=3;class uu{constructor(t={}){this.states={},this.queue=[],this.scriptLoadedCallbacks={},this.queueLoadedCallbacks=[],this.loading=!1,this.settings=t}_setReferrerPolicy(t){this.settings.referrerPolicy=t}loadScript(t){return new Promise((s,a)=>{const d=hg;let p;const v=()=>{d.remove(G),p&&(p.onerror=p.onload=p=null)},C=()=>{v(),s()},L=()=>{v(),a("Failed to load script: "+t)},G=d.uniqueId();p=document.createElement("script"),p.id=G,p.type="text/javascript",p.src=hn._addCacheSuffix(t),this.settings.referrerPolicy&&d.setAttrib(p,"referrerpolicy",this.settings.referrerPolicy),p.onload=C,p.onerror=L,(document.getElementsByTagName("head")[0]||document.body).appendChild(p)})}isDone(t){return this.states[t]===Gi}markDone(t){this.states[t]=Gi}add(t){const s=this;return s.queue.push(t),s.states[t]===void 0&&(s.states[t]=B1),new Promise((d,p)=>{s.scriptLoadedCallbacks[t]||(s.scriptLoadedCallbacks[t]=[]),s.scriptLoadedCallbacks[t].push({resolve:d,reject:p})})}load(t){return this.add(t)}remove(t){delete this.states[t],delete this.scriptLoadedCallbacks[t]}loadQueue(){const t=this.queue;return this.queue=[],this.loadScripts(t)}loadScripts(t){const s=this,a=(L,G)=>{Gn(s.scriptLoadedCallbacks,G).each(ee=>{xe(ee,te=>te[L](G))}),delete s.scriptLoadedCallbacks[G]},d=L=>{const G=Ct(L,ee=>ee.status==="rejected");return G.length>0?Promise.reject(kt(G,({reason:ee})=>ae(ee)?ee:[ee])):Promise.resolve()},p=L=>Promise.allSettled($t(L,G=>s.states[G]===Gi?(a("resolve",G),Promise.resolve()):s.states[G]===Nu?(a("reject",G),Promise.reject(G)):(s.states[G]=Gh,s.loadScript(G).then(()=>{s.states[G]=Gi,a("resolve",G);const ee=s.queue;return ee.length>0?(s.queue=[],p(ee).then(d)):Promise.resolve()},()=>(s.states[G]=Nu,a("reject",G),Promise.reject(G)))))),v=L=>(s.loading=!0,p(L).then(G=>{s.loading=!1;const ee=s.queueLoadedCallbacks.shift();return J.from(ee).each(on),d(G)})),C=ze(t);return s.loading?new Promise((L,G)=>{s.queueLoadedCallbacks.push(()=>{v(C).then(L,G)})}):v(C)}}uu.ScriptLoader=new uu;const Av=(e,t)=>{const s=e.indexOf(t);return s!==-1&&e.indexOf(t,s+1)>s},$1=e=>Y(e)&&yn(e,"raw"),Lv=e=>ae(e)&&e.length>1,mg={},Rv=Ea("en"),pg=()=>Gn(mg,Rv.get()),Bu={getData:()=>_i(mg,e=>({...e})),setCode:e=>{e&&Rv.set(e)},getCode:()=>Rv.get(),add:(e,t)=>{let s=mg[e];s||(mg[e]=s={});const a=$t(Yt(t),d=>d.toLowerCase());qo(t,(d,p)=>{const v=p.toLowerCase();v!==p&&Av(a,v)?(yn(t,v)||(s[v]=d),s[p]=d):s[v]=d})},translate:e=>{const t=pg().getOr({}),s=v=>Oe(v)?Object.prototype.toString.call(v):a(v)?"":""+v,a=v=>v===""||v===null||v===void 0,d=v=>{const C=s(v);return yn(t,C)?s(t[C]):Gn(t,C.toLowerCase()).map(s).getOr(C)},p=v=>v.replace(/{context:\w+}$/,"");if(a(e))return"";if($1(e))return s(e.raw);if(Lv(e)){const v=e.slice(1),C=d(e[0]).replace(/\{([0-9]+)\}/g,(L,G)=>yn(v,G)?s(v[G]):L);return p(C)}return p(d(e))},isRtl:()=>pg().bind(e=>Gn(e,"_dir")).exists(e=>e==="rtl"),hasCode:e=>yn(mg,e)},Al=()=>{const e=[],t={},s={},a=[],d=(Se,Pe)=>{const Je=Ct(a,nt=>nt.name===Se&&nt.state===Pe);xe(Je,nt=>nt.resolve())},p=Se=>yn(t,Se),v=Se=>yn(s,Se),C=Se=>{if(s[Se])return s[Se].instance},L=(Se,Pe)=>{const Je=Bu.getCode(),nt=","+(Pe||"")+",";!Je||Pe&&nt.indexOf(","+Je+",")===-1||uu.ScriptLoader.add(t[Se]+"/langs/"+Je+".js")},G=(Se,Pe)=>{Al.languageLoad!==!1&&(p(Se)?L(Se,Pe):Re(Se,"loaded").then(()=>L(Se,Pe)))},ee=(Se,Pe)=>(e.push(Pe),s[Se]={instance:Pe},d(Se,"added"),Pe),te=Se=>{delete t[Se],delete s[Se]},ie=(Se,Pe)=>re(Pe)?re(Se)?{prefix:"",resource:Pe,suffix:""}:{prefix:Se.prefix,resource:Pe,suffix:Se.suffix}:Pe,ye=(Se,Pe)=>{if(t[Se])return Promise.resolve();let Je=re(Pe)?Pe:Pe.prefix+Pe.resource+Pe.suffix;Je.indexOf("/")!==0&&Je.indexOf("://")===-1&&(Je=Al.baseURL+"/"+Je),t[Se]=Je.substring(0,Je.lastIndexOf("/"));const nt=()=>(d(Se,"loaded"),Promise.resolve());return s[Se]?nt():uu.ScriptLoader.add(Je).then(nt)},Re=(Se,Pe="added")=>Pe==="added"&&v(Se)||Pe==="loaded"&&p(Se)?Promise.resolve():new Promise(Je=>{a.push({name:Se,state:Pe,resolve:Je})});return{items:e,urls:t,lookup:s,get:C,requireLangPack:G,add:ee,remove:te,createUrl:ie,load:ye,waitFor:Re}};Al.languageLoad=!0,Al.baseURL="",Al.PluginManager=Al(),Al.ThemeManager=Al(),Al.ModelManager=Al();const Ym=(e,t)=>{let s=null;return{cancel:()=>{Ce(s)||(clearTimeout(s),s=null)},throttle:(...p)=>{Ce(s)&&(s=setTimeout(()=>{s=null,e.apply(null,p)},t))}}},V0=(e,t)=>{let s=null;const a=()=>{Ce(s)||(clearTimeout(s),s=null)};return{cancel:a,throttle:(...p)=>{a(),s=setTimeout(()=>{s=null,e.apply(null,p)},t)}}},_a=(e,t,s)=>Rt(e,t,s).isSome(),Ei=et("mce-annotation"),ea=et("data-mce-annotation"),Wi=et("data-mce-annotation-uid"),ir=et("data-mce-annotation-active"),Jr=et("data-mce-annotation-classes"),Xm=et("data-mce-annotation-attrs"),Ov=e=>t=>gt(t,e),H1=(e,t)=>{const s=e.selection.getRng(),a=M.fromDom(s.startContainer),d=M.fromDom(e.getBody()),p=t.fold(()=>"."+Ei(),L=>`[${ea()}="${L}"]`),v=el(a,s.startOffset).getOr(a);return iu(v,p,Ov(d)).bind(L=>Ul(L,`${Wi()}`).bind(G=>Ul(L,`${ea()}`).map(ee=>{const te=V1(e,G);return{uid:G,name:ee,elements:te}})))},U1=e=>ll(e)&&cl(e,Ei()),z0=(e,t)=>dc(e,"data-mce-bogus")||_a(e,'[data-mce-bogus="all"]',Ov(t)),V1=(e,t)=>{const s=M.fromDom(e.getBody()),a=$e(s,`[${Wi()}="${t}"]`);return Ct(a,d=>!z0(d,s))},Wh=(e,t)=>{const s=M.fromDom(e.getBody()),a=$e(s,`[${ea()}="${t}"]`),d={};return xe(a,p=>{if(!z0(p,s)){const v=Oa(p,Wi()),C=Gn(d,v).getOr([]);d[v]=C.concat([p])}}),d},Iv=(e,t)=>{const s=Ea({}),a=()=>({listeners:[],previous:tn()}),d=(te,ie)=>{p(te,ye=>(ie(ye),ye))},p=(te,ie)=>{const ye=s.get(),Re=Gn(ye,te).getOrThunk(a),Se=ie(Re);ye[te]=Se,s.set(ye)},v=(te,ie,ye)=>{d(te,Re=>{xe(Re.listeners,Se=>Se(!0,te,{uid:ie,nodes:$t(ye,Pe=>Pe.dom)}))})},C=te=>{d(te,ie=>{xe(ie.listeners,ye=>ye(!1,te))})},L=(te,ie)=>{xe(V1(e,te),ye=>{ie?$s(ye,ir(),"true"):Xi(ye,ir())})},G=V0(()=>{const te=Pt(t.getNames());xe(te,ie=>{p(ie,ye=>{const Re=ye.previous.get();return H1(e,J.some(ie)).fold(()=>{Re.each(Se=>{C(ie),ye.previous.clear(),L(Se,!1)})},({uid:Se,name:Pe,elements:Je})=>{Rd(Re,Se)||(Re.each(nt=>L(nt,!1)),v(Pe,Se,Je),ye.previous.set(Se),L(Se,!0))}),{previous:ye.previous,listeners:ye.listeners}})})},30);return e.on("remove",()=>{G.cancel()}),e.on("NodeChange",()=>{G.throttle()}),{addListener:(te,ie)=>{p(te,ye=>({previous:ye.previous,listeners:ye.listeners.concat([ie])}))}}},LS=(e,t)=>{const s=ea(),a=p=>J.from(p.attr(s)).bind(t.lookup),d=p=>{var v,C;p.attr(Wi(),null),p.attr(ea(),null),p.attr(ir(),null);const L=J.from(p.attr(Xm())).map(ie=>ie.split(",")).getOr([]),G=J.from(p.attr(Jr())).map(ie=>ie.split(",")).getOr([]);xe(L,ie=>p.attr(ie,null));const ee=(C=(v=p.attr("class"))===null||v===void 0?void 0:v.split(" "))!==null&&C!==void 0?C:[],te=as(ee,[Ei()].concat(G));p.attr("class",te.length>0?te.join(" "):null),p.attr(Jr(),null),p.attr(Xm(),null)};e.serializer.addTempAttr(ir()),e.serializer.addAttributeFilter(s,p=>{for(const v of p)a(v).each(C=>{C.persistent===!1&&(v.name==="span"?v.unwrap():d(v))})})},z1=()=>{const e={};return{register:(d,p)=>{e[d]={name:d,settings:p}},lookup:d=>Gn(e,d).map(p=>p.settings),getNames:()=>Yt(e)}};let pl=0;const gg=e=>{const s=new Date().getTime(),a=Math.floor(Math.random()*1e9);return pl++,e+"_"+a+pl+String(s)},$u=(e,t)=>{xe(t,s=>{od(e,s)})},Jm=(e,t)=>{xe(t,s=>{nu(e,s)})},Qm=(e,t)=>M.fromDom(e.dom.cloneNode(t)),Gl=e=>Qm(e,!1),Ll=e=>Qm(e,!0),jh=(e,t)=>{const s=M.fromTag(t),a=Oi(e);return Hc(s,a),s},ep=(e,t)=>{const s=jh(e,t);Si(e,s);const a=cr(e);return Or(s,a),Xs(e),s},G1=(e,t,s=vt)=>{const a=new bn(e,t),d=p=>{let v;do v=a[p]();while(v&&!rn(v)&&!s(v));return J.from(v).filter(rn)};return{current:()=>J.from(a.current()).filter(rn),next:()=>d("next"),prev:()=>d("prev"),prev2:()=>d("prev2")}},Yf=(e,t)=>{const s=t||(v=>e.isBlock(v)||fi(v)||Ir(v)),a=(v,C,L,G)=>{if(rn(v)){const ee=G(v,C,v.data);if(ee!==-1)return J.some({container:v,offset:ee})}return L().bind(ee=>a(ee.container,ee.offset,L,G))};return{backwards:(v,C,L,G)=>{const ee=G1(v,G??e.getRoot(),s);return a(v,C,()=>ee.prev().map(te=>({container:te,offset:te.length})),L).getOrNull()},forwards:(v,C,L,G)=>{const ee=G1(v,G??e.getRoot(),s);return a(v,C,()=>ee.next().map(te=>({container:te,offset:0})),L).getOrNull()}}},Mv=((e,t)=>{const s=p=>{if(!e(p))throw new Error("Can only get "+t+" value of a "+t+" node");return a(p).getOr("")},a=p=>e(p)?J.from(p.dom.nodeValue):J.none();return{get:s,getOption:a,set:(p,v)=>{if(!e(p))throw new Error("Can only set raw "+t+" value of a "+t+" node");p.dom.nodeValue=v}}})(ti,"text"),bg=e=>Mv.get(e),RS=e=>Mv.getOption(e),Nv=(e,t)=>Mv.set(e,t),Fv=["td","th"],W1=["thead","tbody","tfoot"],tp=["h1","h2","h3","h4","h5","h6","p","div","address","pre","form","blockquote","center","dir","fieldset","header","footer","article","section","hgroup","aside","nav","figure"],zT=["li","dd","dt"],np=["ul","ol","dl"],Rl=["pre","script","textarea","style"],xf=e=>{let t;return s=>(t=t||xt(e,an),yn(t,ls(s)))},OS=e=>ls(e)==="table",Vd=e=>ll(e)&&ls(e)==="br",Kh=xf(tp),Bv=xf(np),yf=xf(zT),j1=xf(W1),zd=xf(Fv),vg=xf(Rl),Zh=e=>{const t=[];let s=e.dom;for(;s;)t.push(M.fromDom(s)),s=s.lastChild;return t},IS=e=>{const t=$e(e,"br"),s=Ct(Zh(e).slice(-1),Vd);t.length===s.length&&xe(s,Xs)},Tc=()=>{const e=M.fromTag("br");return $s(e,"data-mce-bogus","1"),e},Hu=e=>{Ua(e),rr(e,Tc())},G0=(e,t)=>{ou(e).each(s=>{Vs(s).each(a=>{t.isBlock(ls(e))&&Vd(s)&&t.isBlock(ls(a))&&Xs(s)})})},ta=Jo,$v=Yr,Ta=za,Hv=e=>e.insertContent(ta,{preserve_zwsp:!0}),PS=oo,Uu=rn,wf=e=>(Uu(e)&&(e=e.parentNode),PS(e)&&e.hasAttribute("data-mce-caret")),Xf=e=>Uu(e)&&$v(e.data),Vu=e=>wf(e)||Xf(e),K1=e=>e.firstChild!==e.lastChild||!fi(e.firstChild),MS=(e,t)=>{var s;const d=((s=e.ownerDocument)!==null&&s!==void 0?s:document).createTextNode(ta),p=e.parentNode;if(t){const v=e.previousSibling;if(Uu(v)){if(Vu(v))return v;if(j0(v))return v.splitText(v.data.length-1)}p==null||p.insertBefore(d,e)}else{const v=e.nextSibling;if(Uu(v)){if(Vu(v))return v;if(Uv(v))return v.splitText(1),v}e.nextSibling?p==null||p.insertBefore(d,e.nextSibling):p==null||p.appendChild(d)}return d},W0=e=>{const t=e.container();return rn(t)?t.data.charAt(e.offset())===ta||e.isAtStart()&&Xf(t.previousSibling):!1},op=e=>{const t=e.container();return rn(t)?t.data.charAt(e.offset()-1)===ta||e.isAtEnd()&&Xf(t.nextSibling):!1},Z1=(e,t,s)=>{var a;const p=((a=t.ownerDocument)!==null&&a!==void 0?a:document).createElement(e);p.setAttribute("data-mce-caret",s?"before":"after"),p.setAttribute("data-mce-bogus","all"),p.appendChild(Tc().dom);const v=t.parentNode;return s?v==null||v.insertBefore(p,t):t.nextSibling?v==null||v.insertBefore(p,t.nextSibling):v==null||v.appendChild(p),p},Uv=e=>Uu(e)&&e.data[0]===ta,j0=e=>Uu(e)&&e.data[e.data.length-1]===ta,q1=e=>{var t;const s=e.getElementsByTagName("br"),a=s[s.length-1];Bd(a)&&((t=a.parentNode)===null||t===void 0||t.removeChild(a))},Sf=e=>e&&e.hasAttribute("data-mce-caret")?(q1(e),e.removeAttribute("data-mce-caret"),e.removeAttribute("data-mce-bogus"),e.removeAttribute("style"),e.removeAttribute("data-mce-style"),e.removeAttribute("_moz_abspos"),e):null,K0=e=>wf(e.startContainer),Jf=Math.round,Wc=e=>e?{left:Jf(e.left),top:Jf(e.top),bottom:Jf(e.bottom),right:Jf(e.right),width:Jf(e.width),height:Jf(e.height)}:{left:0,top:0,bottom:0,right:0,width:0,height:0},Vv=(e,t)=>(e=Wc(e),t||(e.left=e.left+e.width),e.right=e.left,e.width=0,e),GT=(e,t)=>e.left===t.left&&e.top===t.top&&e.bottom===t.bottom&&e.right===t.right,qh=(e,t,s)=>e>=0&&e<=Math.min(t.height,s.height)/2,du=(e,t)=>{const s=Math.min(t.height/2,e.height/2);return e.bottom-s<t.top?!0:e.top>t.bottom?!1:qh(t.top-e.bottom,e,t)},xg=(e,t)=>e.top>t.bottom?!0:e.bottom<t.top?!1:qh(t.bottom-e.top,e,t),Z0=(e,t,s)=>t>=e.left&&t<=e.right&&s>=e.top&&s<=e.bottom,q0=e=>Kn(e,(t,s)=>t.fold(()=>J.some(s),a=>{const d=Math.min(s.left,a.left),p=Math.min(s.top,a.top),v=Math.max(s.right,a.right),C=Math.max(s.bottom,a.bottom);return J.some({top:p,right:v,bottom:C,left:d,width:v-d,height:C-p})}),J.none()),sp=(e,t,s)=>{const a=Math.max(Math.min(t,e.left+e.width),e.left),d=Math.max(Math.min(s,e.top+e.height),e.top);return Math.sqrt((t-a)*(t-a)+(s-d)*(s-d))},zv=(e,t)=>Math.max(0,Math.min(e.bottom,t.bottom)-Math.max(e.top,t.top)),Y1=(e,t,s)=>Math.min(Math.max(e,t),s),yg=e=>{const t=e.startContainer,s=e.startOffset;return t===e.endContainer&&t.hasChildNodes()&&e.endOffset===s+1?t.childNodes[s]:null},ba=(e,t)=>{if(oo(e)&&e.hasChildNodes()){const s=e.childNodes,a=Y1(t,0,s.length-1);return s[a]}else return e},X1=(e,t)=>{if(!(t<0&&oo(e)&&e.hasChildNodes()))return ba(e,t)},WT=new RegExp("[̀-ͯ҃-҇҈-҉֑-ֽֿׁ-ׂׄ-ׇׅؐ-ًؚ-ٰٟۖ-ۜ۟-ۤۧ-۪ۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣣ-ंऺ़ु-ै्॑-ॗॢ-ॣঁ়াু-ৄ্ৗৢ-ৣਁ-ਂ਼ੁ-ੂੇ-ੈੋ-੍ੑੰ-ੱੵઁ-ં઼ુ-ૅે-ૈ્ૢ-ૣଁ଼ାିୁ-ୄ୍ୖୗୢ-ୣஂாீ்ௗఀా-ీె-ైొ-్ౕ-ౖౢ-ౣಁ಼ಿೂೆೌ-್ೕ-ೖೢ-ೣഁാു-ൄ്ൗൢ-ൣ්ාි-ුූෟัิ-ฺ็-๎ັິ-ູົ-ຼ່-ໍ༘-ཱ༹༙༵༷-ཾྀ-྄྆-྇ྍ-ྗྙ-ྼ࿆ိ-ူဲ-့္-်ွ-ှၘ-ၙၞ-ၠၱ-ၴႂႅ-ႆႍႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒ-ᝓᝲ-ᝳ឴-឵ិ-ួំ៉-៓៝᠋-᠍ᢩᤠ-ᤢᤧ-ᤨᤲ᤹-᤻ᨗ-ᨘᨛᩖᩘ-ᩞ᩠ᩢᩥ-ᩬᩳ-᩿᩼᪰-᪽᪾ᬀ-ᬃ᬴ᬶ-ᬺᬼᭂ᭫-᭳ᮀ-ᮁᮢ-ᮥᮨ-ᮩ᮫-ᮭ᯦ᯨ-ᯩᯭᯯ-ᯱᰬ-ᰳᰶ-᰷᳐-᳔᳒-᳢᳠-᳨᳭᳴᳸-᳹᷀-᷵᷼-᷿‌-‍⃐-⃜⃝-⃠⃡⃢-⃤⃥-⃰⳯-⵿⳱ⷠ-〪ⷿ-〭〮-゙〯-゚꙯꙰-꙲ꙴ-꙽ꚞ-ꚟ꛰-꛱ꠂ꠆ꠋꠥ-ꠦ꣄꣠-꣱ꤦ-꤭ꥇ-ꥑꦀ-ꦂ꦳ꦶ-ꦹꦼꧥꨩ-ꨮꨱ-ꨲꨵ-ꨶꩃꩌꩼꪰꪲ-ꪴꪷ-ꪸꪾ-꪿꫁ꫬ-ꫭ꫶ꯥꯨ꯭ﬞ︀-️︠-︯ﾞ-ﾟ]"),Gv=e=>re(e)&&e.charCodeAt(0)>=768&&WT.test(e),NS=(...e)=>t=>{for(let s=0;s<e.length;s++)if(e[s](t))return!0;return!1},wg=(...e)=>t=>{for(let s=0;s<e.length;s++)if(!e[s](t))return!1;return!0},Yh=Ws,Wv=Ir,jv=fi,FS=rn,Kv=kl(["script","style","textarea"]),Xh=kl(["img","input","textarea","hr","iframe","video","audio","object","embed"]),Zv=kl(["table"]),BS=Vu,cd=e=>BS(e)?!1:FS(e)?!Kv(e.parentNode):Xh(e)||jv(e)||Zv(e)||Y0(e),$S=e=>oo(e)&&e.getAttribute("unselectable")==="true",Y0=e=>!$S(e)&&Wv(e),HS=(e,t)=>{for(let s=e.parentNode;s&&s!==t;s=s.parentNode){if(Y0(s))return!1;if(Yh(s))return!0}return!0},US=e=>Y0(e)?!Kn(In(e.getElementsByTagName("*")),(t,s)=>t||Yh(s),!1):!1,rp=e=>Xh(e)||US(e),ip=(e,t)=>cd(e)&&HS(e,t),qv=oo,jT=cd,zu=Fd("display","block table"),ap=Fd("float","left right"),Qf=wg(qv,jT,qe(ap)),VS=qe(Fd("white-space","pre pre-line pre-wrap")),lp=rn,tl=fi,Yv=js.nodeIndex,Jh=X1,cp=e=>e?e.createRange():js.DOM.createRng(),X0=e=>re(e)&&/[\r\n\t ]/.test(e),J0=e=>!!e.setStart&&!!e.setEnd,Xv=e=>{const t=e.startContainer,s=e.startOffset;if(X0(e.toString())&&VS(t.parentNode)&&rn(t)){const a=t.data;if(X0(a[s-1])||X0(a[s+1]))return!0}return!1},Ef=e=>{const t=e.ownerDocument,s=cp(t),a=t.createTextNode(Vo),d=e.parentNode;d.insertBefore(a,e),s.setStart(a,0),s.setEnd(a,1);const p=Wc(s.getBoundingClientRect());return d.removeChild(a),p},Jv=e=>{const t=e.startContainer,s=e.endContainer,a=e.startOffset,d=e.endOffset;if(t===s&&rn(s)&&a===0&&d===1){const p=e.cloneRange();return p.setEndAfter(s),oc(p)}else return null},Qv=e=>e.left===0&&e.right===0&&e.top===0&&e.bottom===0,oc=e=>{var t;let s;const a=e.getClientRects();return a.length>0?s=Wc(a[0]):s=Wc(e.getBoundingClientRect()),!J0(e)&&tl(e)&&Qv(s)?Ef(e):Qv(s)&&J0(e)&&(t=Jv(e))!==null&&t!==void 0?t:s},Cf=(e,t)=>{const s=Vv(e,t);return s.width=1,s.right=s.left+1,s},ex=e=>{const t=[],s=v=>{v.height!==0&&(t.length>0&&GT(v,t[t.length-1])||t.push(v))},a=(v,C)=>{const L=cp(v.ownerDocument);if(C<v.data.length){if(Gv(v.data[C]))return;if(Gv(v.data[C-1])&&(L.setStart(v,C),L.setEnd(v,C+1),!Xv(L))){s(Cf(oc(L),!1));return}}C>0&&(L.setStart(v,C-1),L.setEnd(v,C),Xv(L)||s(Cf(oc(L),!1))),C<v.data.length&&(L.setStart(v,C),L.setEnd(v,C+1),Xv(L)||s(Cf(oc(L),!0)))},d=e.container(),p=e.offset();if(lp(d))return a(d,p),t;if(qv(d))if(e.isAtEnd()){const v=Jh(d,p);lp(v)&&a(v,v.data.length),Qf(v)&&!tl(v)&&s(Cf(oc(v),!1))}else{const v=Jh(d,p);if(lp(v)&&a(v,0),Qf(v)&&e.isAtEnd())return s(Cf(oc(v),!1)),t;const C=Jh(e.container(),e.offset()-1);Qf(C)&&!tl(C)&&(zu(C)||zu(v)||!Qf(v))&&s(Cf(oc(C),!1)),Qf(v)&&s(Cf(oc(v),!0))}return t},Et=(e,t,s)=>{const a=()=>(lp(e),t===0),d=()=>lp(e)?t>=e.data.length:t>=e.childNodes.length,p=()=>{const ee=cp(e.ownerDocument);return ee.setStart(e,t),ee.setEnd(e,t),ee},v=()=>(s||(s=ex(Et(e,t))),s),C=()=>v().length>0,L=ee=>ee&&e===ee.container()&&t===ee.offset(),G=ee=>Jh(e,ee?t-1:t);return{container:et(e),offset:et(t),toRange:p,getClientRects:v,isVisible:C,isAtStart:a,isAtEnd:d,isEqual:L,getNode:G}};Et.fromRangeStart=e=>Et(e.startContainer,e.startOffset),Et.fromRangeEnd=e=>Et(e.endContainer,e.endOffset),Et.after=e=>Et(e.parentNode,Yv(e)+1),Et.before=e=>Et(e.parentNode,Yv(e)),Et.isAbove=(e,t)=>wa(At(t.getClientRects()),On(e.getClientRects()),du).getOr(!1),Et.isBelow=(e,t)=>wa(On(t.getClientRects()),At(e.getClientRects()),xg).getOr(!1),Et.isAtStart=e=>e?e.isAtStart():!1,Et.isAtEnd=e=>e?e.isAtEnd():!1,Et.isTextPosition=e=>e?rn(e.container()):!1,Et.isElementPosition=e=>!Et.isTextPosition(e);const up=(e,t)=>{rn(t)&&t.data.length===0&&e.remove(t)},zS=(e,t,s)=>{t.insertNode(s),up(e,s.previousSibling),up(e,s.nextSibling)},GS=(e,t,s)=>{const a=J.from(s.firstChild),d=J.from(s.lastChild);t.insertNode(s),a.each(p=>up(e,p.previousSibling)),d.each(p=>up(e,p.nextSibling))},tx=(e,t,s)=>{D0(s)?GS(e,t,s):zS(e,t,s)},ud=rn,J1=Bd,nx=js.nodeIndex,Q0=e=>{const t=e.parentNode;return J1(t)?Q0(t):t},Q1=e=>e?Xn(e.childNodes,(t,s)=>(J1(s)&&s.nodeName!=="BR"?t=t.concat(Q1(s)):t.push(s),t),[]):[],KT=(e,t)=>{let s=e;for(;(s=s.previousSibling)&&ud(s);)t+=s.data.length;return t},WS=e=>t=>e===t,w=e=>{let t,s;t=Q1(Q0(e)),s=zn(t,WS(e),e),t=t.slice(0,s+1);const a=Xn(t,(d,p,v)=>(ud(p)&&ud(t[v-1])&&d++,d),0);return t=sn(t,kl([e.nodeName])),s=zn(t,WS(e),e),s-a},_=e=>(ud(e)?"text()":e.nodeName.toLowerCase())+"["+w(e)+"]",I=(e,t,s)=>{const a=[];for(let d=t.parentNode;d&&d!==e&&!(s&&s(d));d=d.parentNode)a.push(d);return a},H=(e,t)=>{let s=[],a=t.container(),d=t.offset(),p;if(ud(a))p=KT(a,d);else{const C=a.childNodes;d>=C.length?(p="after",d=C.length-1):p="before",a=C[d]}s.push(_(a));let v=I(e,a);return v=sn(v,qe(Bd)),s=s.concat(_n(v,C=>_(C))),s.reverse().join("/")+","+p},Z=(e,t,s)=>{let a=Q1(e);return a=sn(a,(d,p)=>!ud(d)||!ud(a[p-1])),a=sn(a,kl([t])),a[s]},q=(e,t)=>{let s=e,a=0;for(;ud(s);){const d=s.data.length;if(t>=a&&t<=a+d){e=s,t=t-a;break}if(!ud(s.nextSibling)){e=s,t=d;break}a+=d,s=s.nextSibling}return ud(e)&&t>e.data.length&&(t=e.data.length),Et(e,t)},le=(e,t)=>{if(!t)return null;const s=t.split(","),a=s[0].split("/"),d=s.length>1?s[1]:"before",p=Xn(a,(v,C)=>{const L=/([\w\-\(\)]+)\[([0-9]+)\]/.exec(C);return L?(L[1]==="text()"&&(L[1]="#text"),Z(v,L[1],parseInt(L[2],10))):null},e);if(!p)return null;if(!ud(p)&&p.parentNode){let v;return d==="after"?v=nx(p)+1:v=nx(p),Et(p.parentNode,v)}return q(p,parseInt(d,10))},ue=Ir,_e=(e,t,s)=>{let a=e(t.data.slice(0,s)).length;for(let d=t.previousSibling;d&&rn(d);d=d.previousSibling)a+=e(d.data).length;return a},Be=(e,t,s,a,d)=>{const p=d?a.startContainer:a.endContainer;let v=d?a.startOffset:a.endOffset;const C=[],L=e.getRoot();if(rn(p))C.push(s?_e(t,p,v):v);else{let G=0;const ee=p.childNodes;v>=ee.length&&ee.length&&(G=1,v=Math.max(0,ee.length-1)),C.push(e.nodeIndex(ee[v],s)+G)}for(let G=p;G&&G!==L;G=G.parentNode)C.push(e.nodeIndex(G,s));return C},Ye=(e,t,s,a)=>{const d=t.dom,p=Be(d,e,s,a,!0),v=t.isForward(),C=K0(a)?{isFakeCaret:!0}:{};if(t.isCollapsed())return{start:p,forward:v,...C};{const L=Be(d,e,s,a,!1);return{start:p,end:L,forward:v,...C}}},Me=(e,t,s)=>{let a=0;return hn.each(e.select(t),d=>{if(d.getAttribute("data-mce-bogus")!=="all"){if(d===s)return!1;a++;return}}),a},He=(e,t)=>{let s=t?e.startContainer:e.endContainer,a=t?e.startOffset:e.endOffset;if(oo(s)&&s.nodeName==="TR"){const d=s.childNodes;s=d[Math.min(t?a:a-1,d.length-1)],s&&(a=t?0:s.childNodes.length,t?e.setStart(s,a):e.setEnd(s,a))}},je=e=>(He(e,!0),He(e,!1),e),ct=(e,t)=>{if(oo(e)&&(e=ba(e,t),ue(e)))return e;if(Vu(e)){rn(e)&&wf(e)&&(e=e.parentNode);let s=e.previousSibling;if(ue(s)||(s=e.nextSibling,ue(s)))return s}},ut=e=>ct(e.startContainer,e.startOffset)||ct(e.endContainer,e.endOffset),Ht=(e,t,s)=>{const a=s.getNode(),d=s.getRng();if(a.nodeName==="IMG"||ue(a)){const v=a.nodeName;return{name:v,index:Me(s.dom,v,a)}}const p=ut(d);if(p){const v=p.tagName;return{name:v,index:Me(s.dom,v,p)}}return Ye(e,s,t,d)},Gt=e=>{const t=e.getRng();return{start:H(e.dom.getRoot(),Et.fromRangeStart(t)),end:H(e.dom.getRoot(),Et.fromRangeEnd(t)),forward:e.isForward()}},Vt=e=>({rng:e.getRng(),forward:e.isForward()}),jt=(e,t,s)=>{const a={"data-mce-type":"bookmark",id:t,style:"overflow:hidden;line-height:0px"};return s?e.create("span",a,"&#xFEFF;"):e.create("span",a)},un=(e,t)=>{const s=e.dom;let a=e.getRng();const d=s.uniqueId(),p=e.isCollapsed(),v=e.getNode(),C=v.nodeName,L=e.isForward();if(C==="IMG")return{name:C,index:Me(s,C,v)};const G=je(a.cloneRange());if(!p){G.collapse(!1);const te=jt(s,d+"_end",t);tx(s,G,te)}a=je(a),a.collapse(!0);const ee=jt(s,d+"_start",t);return tx(s,a,ee),e.moveToBookmark({id:d,keep:!0,forward:L}),{id:d,forward:L}},at=(e,t,s=!1)=>t===2?Ht(Ta,s,e):t===3?Gt(e):t?Vt(e):un(e,!1),vn=it(Ht,Dt,!0),go=e=>{const t=p=>p(e),s=et(e),a=()=>d,d={tag:!0,inner:e,fold:(p,v)=>v(e),isValue:an,isError:vt,map:p=>lo.value(p(e)),mapError:a,bind:t,exists:t,forall:t,getOr:s,or:a,getOrThunk:s,orThunk:a,getOrDie:s,each:p=>{p(e)},toOptional:()=>J.some(e)};return d},eo=e=>{const t=()=>s,s={tag:!1,inner:e,fold:(a,d)=>a(e),isValue:vt,isError:an,map:t,mapError:a=>lo.error(a(e)),bind:t,exists:vt,forall:an,getOr:Dt,or:Dt,getOrThunk:Un,orThunk:Un,getOrDie:mt(String(e)),each:Fe,toOptional:J.none};return s},lo={value:go,error:eo,fromOption:(e,t)=>e.fold(()=>eo(t),go)},Oo={generate:e=>{if(!ae(e))throw new Error("cases must be an array");if(e.length===0)throw new Error("there must be at least one case");const t=[],s={};return xe(e,(a,d)=>{const p=Yt(a);if(p.length!==1)throw new Error("one and only one name per case");const v=p[0],C=a[v];if(s[v]!==void 0)throw new Error("duplicate key detected:"+v);if(v==="cata")throw new Error("cannot have a case named cata (sorry)");if(!ae(C))throw new Error("case arguments must be an array");t.push(v),s[v]=(...L)=>{const G=L.length;if(G!==C.length)throw new Error("Wrong number of arguments to case "+v+". Expected "+C.length+" ("+C+"), got "+G);return{fold:(...te)=>{if(te.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+te.length);return te[d].apply(null,L)},match:te=>{const ie=Yt(te);if(t.length!==ie.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+`
Actual: `+ie.join(","));if(!jo(t,Re=>to(ie,Re)))throw new Error("Not all branches were specified when using match. Specified: "+ie.join(", ")+`
Required: `+t.join(", "));return te[v].apply(null,L)},log:te=>{console.log(te,{constructors:t,constructor:v,params:L})}}}}),s}};Oo.generate([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const ur=e=>{const t=[],s=[];return xe(e,a=>{a.fold(d=>{t.push(d)},d=>{s.push(d)})}),{errors:t,values:s}},na=e=>e.type==="inline-command"||e.type==="inline-format",gl=e=>e.type==="block-command"||e.type==="block-format",Wa=(e,t)=>(e.type==="block-command"||e.type==="block-format")&&e.trigger===t,jc=e=>{var t;const s=d=>lo.error({message:d,pattern:e}),a=(d,p,v)=>{if(e.format!==void 0){let C;if(ae(e.format)){if(!jo(e.format,re))return s(d+" pattern has non-string items in the `format` array");C=e.format}else if(re(e.format))C=[e.format];else return s(d+" pattern has non-string `format` parameter");return lo.value(p(C))}else return e.cmd!==void 0?re(e.cmd)?lo.value(v(e.cmd,e.value)):s(d+" pattern has non-string `cmd` parameter"):s(d+" pattern is missing both `format` and `cmd` parameters")};if(!Y(e))return s("Raw pattern is not an object");if(!re(e.start))return s("Raw pattern is missing `start` parameter");if(e.end!==void 0){if(!re(e.end))return s("Inline pattern has non-string `end` parameter");if(e.start.length===0&&e.end.length===0)return s("Inline pattern has empty `start` and `end` parameters");let d=e.start,p=e.end;return p.length===0&&(p=d,d=""),a("Inline",v=>({type:"inline-format",start:d,end:p,format:v}),(v,C)=>({type:"inline-command",start:d,end:p,cmd:v,value:C}))}else{if(e.replacement!==void 0)return re(e.replacement)?e.start.length===0?s("Replacement pattern has empty `start` parameter"):lo.value({type:"inline-command",start:"",end:e.start,cmd:"mceInsertContent",value:e.replacement}):s("Replacement pattern has non-string `replacement` parameter");{const d=(t=e.trigger)!==null&&t!==void 0?t:"space";return e.start.length===0?s("Block pattern has empty `start` parameter"):a("Block",p=>({type:"block-format",start:e.start,format:p[0],trigger:d}),(p,v)=>({type:"block-command",start:e.start,cmd:p,value:v,trigger:d}))}}},Gd=e=>Ct(e,gl),bl=e=>Ct(e,na),eh=(e,t)=>({inlinePatterns:bl(e),blockPatterns:Gd(e),dynamicPatternsLookup:t}),th=(e,t)=>({...e,blockPatterns:Ct(e.blockPatterns,s=>Wa(s,t))}),dp=e=>{const t=ur($t(e,jc));return xe(t.errors,s=>console.error(s.message,s.pattern)),t.values},ey=e=>t=>{const s=e(t);return dp(s)},nh=Cs().deviceType,fp=nh.isTouch(),zB=js.DOM,GB=e=>{const t=e.indexOf("=")>0?e.split(/[;,](?![^=;,]*(?:[;,]|$))/):e.split(",");return Kn(t,(s,a)=>{const d=a.split("="),p=d[0],v=d.length>1?d[1]:p;return s[Qa(p)]=Qa(v),s},{})},mR=e=>se(e,RegExp),qn=e=>t=>t.options.get(e),ty=e=>re(e)||Y(e),ZT=(e,t="")=>s=>{const a=re(s);if(a)if(s.indexOf("=")!==-1){const d=GB(s);return{value:Gn(d,e.id).getOr(t),valid:a}}else return{value:s,valid:a};else return{valid:!1,message:"Must be a string."}},jS=e=>{const t=e.options.register;t("id",{processor:"string",default:e.id}),t("selector",{processor:"string"}),t("target",{processor:"object"}),t("suffix",{processor:"string"}),t("cache_suffix",{processor:"string"}),t("base_url",{processor:"string"}),t("referrer_policy",{processor:"string",default:""}),t("language_load",{processor:"boolean",default:!0}),t("inline",{processor:"boolean",default:!1}),t("iframe_attrs",{processor:"object",default:{}}),t("doctype",{processor:"string",default:"<!DOCTYPE html>"}),t("document_base_url",{processor:"string",default:e.documentBaseUrl}),t("body_id",{processor:ZT(e,"tinymce"),default:"tinymce"}),t("body_class",{processor:ZT(e),default:""}),t("content_security_policy",{processor:"string",default:""}),t("br_in_pre",{processor:"boolean",default:!0}),t("forced_root_block",{processor:s=>{const a=re(s)&&vi(s);return a?{value:s,valid:a}:{valid:!1,message:"Must be a non-empty string."}},default:"p"}),t("forced_root_block_attrs",{processor:"object",default:{}}),t("newline_behavior",{processor:s=>{const a=to(["block","linebreak","invert","default"],s);return a?{value:s,valid:a}:{valid:!1,message:"Must be one of: block, linebreak, invert or default."}},default:"default"}),t("br_newline_selector",{processor:"string",default:".mce-toc h2,figcaption,caption"}),t("no_newline_selector",{processor:"string",default:""}),t("keep_styles",{processor:"boolean",default:!0}),t("end_container_on_empty_block",{processor:s=>Ue(s)?{valid:!0,value:s}:re(s)?{valid:!0,value:s}:{valid:!1,message:"Must be boolean or a string"},default:"blockquote"}),t("font_size_style_values",{processor:"string",default:"xx-small,x-small,small,medium,large,x-large,xx-large"}),t("font_size_legacy_values",{processor:"string",default:"xx-small,small,medium,large,x-large,xx-large,300%"}),t("font_size_classes",{processor:"string",default:""}),t("automatic_uploads",{processor:"boolean",default:!0}),t("images_reuse_filename",{processor:"boolean",default:!1}),t("images_replace_blob_uris",{processor:"boolean",default:!0}),t("icons",{processor:"string",default:""}),t("icons_url",{processor:"string",default:""}),t("images_upload_url",{processor:"string",default:""}),t("images_upload_base_path",{processor:"string",default:""}),t("images_upload_credentials",{processor:"boolean",default:!1}),t("images_upload_handler",{processor:"function"}),t("language",{processor:"string",default:"en"}),t("language_url",{processor:"string",default:""}),t("entity_encoding",{processor:"string",default:"named"}),t("indent",{processor:"boolean",default:!0}),t("indent_before",{processor:"string",default:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,details,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist"}),t("indent_after",{processor:"string",default:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,details,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist"}),t("indent_use_margin",{processor:"boolean",default:!1}),t("indentation",{processor:"string",default:"40px"}),t("content_css",{processor:s=>{const a=s===!1||re(s)||De(s,re);return a?re(s)?{value:$t(s.split(","),Qa),valid:a}:ae(s)?{value:s,valid:a}:s===!1?{value:[],valid:a}:{value:s,valid:a}:{valid:!1,message:"Must be false, a string or an array of strings."}},default:eb(e)?[]:["default"]}),t("content_style",{processor:"string"}),t("content_css_cors",{processor:"boolean",default:!1}),t("font_css",{processor:s=>{const a=re(s)||De(s,re);return a?{value:ae(s)?s:$t(s.split(","),Qa),valid:a}:{valid:!1,message:"Must be a string or an array of strings."}},default:[]}),t("inline_boundaries",{processor:"boolean",default:!0}),t("inline_boundaries_selector",{processor:"string",default:"a[href],code,span.mce-annotation"}),t("object_resizing",{processor:s=>{const a=Ue(s)||re(s);return a?s===!1||nh.isiPhone()||nh.isiPad()?{value:"",valid:a}:{value:s===!0?"table,img,figure.image,div,video,iframe":s,valid:a}:{valid:!1,message:"Must be boolean or a string"}},default:!fp}),t("resize_img_proportional",{processor:"boolean",default:!0}),t("event_root",{processor:"string"}),t("service_message",{processor:"string"}),t("theme",{processor:s=>s===!1||re(s)||Oe(s),default:"silver"}),t("theme_url",{processor:"string"}),t("formats",{processor:"object"}),t("format_empty_lines",{processor:"boolean",default:!1}),t("format_noneditable_selector",{processor:"string",default:""}),t("preview_styles",{processor:s=>{const a=s===!1||re(s);return a?{value:s===!1?"":s,valid:a}:{valid:!1,message:"Must be false or a string"}},default:"font-family font-size font-weight font-style text-decoration text-transform color background-color border border-radius outline text-shadow"}),t("custom_ui_selector",{processor:"string",default:""}),t("hidden_input",{processor:"boolean",default:!0}),t("submit_patch",{processor:"boolean",default:!0}),t("encoding",{processor:"string"}),t("add_form_submit_trigger",{processor:"boolean",default:!0}),t("add_unload_trigger",{processor:"boolean",default:!0}),t("custom_undo_redo_levels",{processor:"number",default:0}),t("disable_nodechange",{processor:"boolean",default:!1}),t("readonly",{processor:"boolean",default:!1}),t("editable_root",{processor:"boolean",default:!0}),t("plugins",{processor:"string[]",default:[]}),t("external_plugins",{processor:"object"}),t("forced_plugins",{processor:"string[]"}),t("model",{processor:"string",default:e.hasPlugin("rtc")?"plugin":"dom"}),t("model_url",{processor:"string"}),t("block_unsupported_drop",{processor:"boolean",default:!0}),t("visual",{processor:"boolean",default:!0}),t("visual_table_class",{processor:"string",default:"mce-item-table"}),t("visual_anchor_class",{processor:"string",default:"mce-item-anchor"}),t("iframe_aria_text",{processor:"string",default:"Rich Text Area. Press ALT-0 for help."}),t("setup",{processor:"function"}),t("init_instance_callback",{processor:"function"}),t("url_converter",{processor:"function",default:e.convertURL}),t("url_converter_scope",{processor:"object",default:e}),t("urlconverter_callback",{processor:"function"}),t("allow_conditional_comments",{processor:"boolean",default:!1}),t("allow_html_data_urls",{processor:"boolean",default:!1}),t("allow_svg_data_urls",{processor:"boolean"}),t("allow_html_in_named_anchor",{processor:"boolean",default:!1}),t("allow_script_urls",{processor:"boolean",default:!1}),t("allow_unsafe_link_target",{processor:"boolean",default:!1}),t("convert_fonts_to_spans",{processor:"boolean",default:!0,deprecated:!0}),t("fix_list_elements",{processor:"boolean",default:!1}),t("preserve_cdata",{processor:"boolean",default:!1}),t("remove_trailing_brs",{processor:"boolean",default:!0}),t("pad_empty_with_br",{processor:"boolean",default:!1}),t("inline_styles",{processor:"boolean",default:!0,deprecated:!0}),t("element_format",{processor:"string",default:"html"}),t("entities",{processor:"string"}),t("schema",{processor:"string",default:"html5"}),t("convert_urls",{processor:"boolean",default:!0}),t("relative_urls",{processor:"boolean",default:!0}),t("remove_script_host",{processor:"boolean",default:!0}),t("custom_elements",{processor:ty}),t("extended_valid_elements",{processor:"string"}),t("invalid_elements",{processor:"string"}),t("invalid_styles",{processor:ty}),t("valid_children",{processor:"string"}),t("valid_classes",{processor:ty}),t("valid_elements",{processor:"string"}),t("valid_styles",{processor:ty}),t("verify_html",{processor:"boolean",default:!0}),t("auto_focus",{processor:s=>re(s)||s===!0}),t("browser_spellcheck",{processor:"boolean",default:!1}),t("protect",{processor:"array"}),t("images_file_types",{processor:"string",default:"jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp"}),t("deprecation_warnings",{processor:"boolean",default:!0}),t("a11y_advanced_options",{processor:"boolean",default:!1}),t("api_key",{processor:"string"}),t("license_key",{processor:"string"}),t("paste_block_drop",{processor:"boolean",default:!1}),t("paste_data_images",{processor:"boolean",default:!0}),t("paste_preprocess",{processor:"function"}),t("paste_postprocess",{processor:"function"}),t("paste_webkit_styles",{processor:"string",default:"none"}),t("paste_remove_styles_if_webkit",{processor:"boolean",default:!0}),t("paste_merge_formats",{processor:"boolean",default:!0}),t("smart_paste",{processor:"boolean",default:!0}),t("paste_as_text",{processor:"boolean",default:!1}),t("paste_tab_spaces",{processor:"number",default:4}),t("text_patterns",{processor:s=>De(s,Y)||s===!1?{value:dp(s===!1?[]:s),valid:!0}:{valid:!1,message:"Must be an array of objects or false."},default:[{start:"*",end:"*",format:"italic"},{start:"**",end:"**",format:"bold"},{start:"#",format:"h1",trigger:"space"},{start:"##",format:"h2",trigger:"space"},{start:"###",format:"h3",trigger:"space"},{start:"####",format:"h4",trigger:"space"},{start:"#####",format:"h5",trigger:"space"},{start:"######",format:"h6",trigger:"space"},{start:"1.",cmd:"InsertOrderedList",trigger:"space"},{start:"*",cmd:"InsertUnorderedList",trigger:"space"},{start:"-",cmd:"InsertUnorderedList",trigger:"space"},{start:">",cmd:"mceBlockQuote",trigger:"space"},{start:"---",cmd:"InsertHorizontalRule",trigger:"space"}]}),t("text_patterns_lookup",{processor:s=>Oe(s)?{value:ey(s),valid:!0}:{valid:!1,message:"Must be a single function"},default:s=>[]}),t("noneditable_class",{processor:"string",default:"mceNonEditable"}),t("editable_class",{processor:"string",default:"mceEditable"}),t("noneditable_regexp",{processor:s=>De(s,mR)?{value:s,valid:!0}:mR(s)?{value:[s],valid:!0}:{valid:!1,message:"Must be a RegExp or an array of RegExp."},default:[]}),t("table_tab_navigation",{processor:"boolean",default:!0}),t("highlight_on_focus",{processor:"boolean",default:!0}),t("xss_sanitization",{processor:"boolean",default:!0}),t("details_initial_state",{processor:s=>{const a=to(["inherited","collapsed","expanded"],s);return a?{value:s,valid:a}:{valid:!1,message:"Must be one of: inherited, collapsed, or expanded."}},default:"inherited"}),t("details_serialized_state",{processor:s=>{const a=to(["inherited","collapsed","expanded"],s);return a?{value:s,valid:a}:{valid:!1,message:"Must be one of: inherited, collapsed, or expanded."}},default:"inherited"}),t("init_content_sync",{processor:"boolean",default:!1}),t("newdocument_content",{processor:"string",default:""}),t("sandbox_iframes",{processor:"boolean",default:!0}),t("sandbox_iframes_exclusions",{processor:"string[]",default:["youtube.com","youtu.be","vimeo.com","player.vimeo.com","dailymotion.com","embed.music.apple.com","open.spotify.com","giphy.com","dai.ly","codepen.io"]}),t("convert_unsafe_embeds",{processor:"boolean",default:!0}),e.on("ScriptsLoaded",()=>{t("directionality",{processor:"string",default:Bu.isRtl()?"rtl":void 0}),t("placeholder",{processor:"string",default:zB.getAttrib(e.getElement(),"placeholder")})})},sc=qn("iframe_attrs"),_f=qn("doctype"),dd=qn("document_base_url"),KS=qn("body_id"),qT=qn("body_class"),pR=qn("content_security_policy"),YT=qn("br_in_pre"),Wl=qn("forced_root_block"),ny=qn("forced_root_block_attrs"),XT=qn("newline_behavior"),gR=qn("br_newline_selector"),bR=qn("no_newline_selector"),JT=qn("keep_styles"),QT=qn("end_container_on_empty_block"),Br=qn("automatic_uploads"),hp=qn("images_reuse_filename"),vR=qn("images_replace_blob_uris"),e2=qn("icons"),xR=qn("icons_url"),t2=qn("images_upload_url"),yR=qn("images_upload_base_path"),n2=qn("images_upload_credentials"),WB=qn("images_upload_handler"),wR=qn("content_css_cors"),oy=qn("referrer_policy"),o2=qn("language"),jB=qn("language_url"),SR=qn("indent_use_margin"),fd=qn("indentation"),Dc=qn("content_css"),ox=qn("content_style"),ER=qn("font_css"),KB=qn("directionality"),Os=qn("inline_boundaries_selector"),CR=qn("object_resizing"),_R=qn("resize_img_proportional"),s2=qn("placeholder"),TR=qn("event_root"),ZB=qn("service_message"),sx=qn("theme"),qB=qn("theme_url"),sy=qn("model"),r2=qn("model_url"),rx=qn("inline_boundaries"),YB=qn("formats"),XB=qn("preview_styles"),JB=qn("format_empty_lines"),Ho=qn("format_noneditable_selector"),DR=qn("custom_ui_selector"),eb=qn("inline"),i2=qn("hidden_input"),kR=qn("submit_patch"),AR=qn("add_form_submit_trigger"),LR=qn("add_unload_trigger"),RR=qn("custom_undo_redo_levels"),QB=qn("disable_nodechange"),OR=qn("readonly"),or=qn("editable_root"),IR=qn("content_css_cors"),Tf=qn("plugins"),Qh=qn("external_plugins"),ZS=qn("block_unsupported_drop"),Gu=qn("visual"),qS=qn("visual_table_class"),ix=qn("visual_anchor_class"),ry=qn("iframe_aria_text"),ax=qn("setup"),e5=qn("init_instance_callback"),t5=qn("urlconverter_callback"),n5=qn("auto_focus"),o5=qn("browser_spellcheck"),Ns=qn("protect"),oh=qn("paste_block_drop"),em=qn("paste_data_images"),s5=qn("paste_preprocess"),iy=qn("paste_postprocess"),zs=qn("newdocument_content"),PR=qn("paste_webkit_styles"),a2=qn("paste_remove_styles_if_webkit"),r5=qn("paste_merge_formats"),tb=qn("smart_paste"),nb=qn("paste_as_text"),MR=qn("paste_tab_spaces"),i5=qn("allow_html_data_urls"),a5=qn("text_patterns"),ay=qn("text_patterns_lookup"),ob=qn("noneditable_class"),l5=qn("editable_class"),NR=qn("noneditable_regexp"),c5=qn("preserve_cdata"),FR=qn("highlight_on_focus"),BR=qn("xss_sanitization"),$R=qn("init_content_sync"),l2=e=>e.options.isSet("text_patterns_lookup"),c2=e=>hn.explode(e.options.get("font_size_style_values")),u2=e=>hn.explode(e.options.get("font_size_classes")),HR=e=>e.options.get("encoding")==="xml",d2=e=>hn.explode(e.options.get("images_file_types")),UR=qn("table_tab_navigation"),YS=qn("details_initial_state"),VR=qn("details_serialized_state"),f2=qn("sandbox_iframes"),XS=e=>e.options.get("sandbox_iframes_exclusions"),zR=qn("convert_unsafe_embeds"),GR=qn("license_key"),WR=qn("api_key"),u5=oo,jR=rn,ly=e=>{const t=e.parentNode;t&&t.removeChild(e)},h2=e=>{const t=Ta(e);return{count:e.length-t.length,text:t}},m2=e=>{let t;for(;(t=e.data.lastIndexOf(ta))!==-1;)e.deleteData(t,1)},p2=(e,t)=>(Sg(e),t),d5=(e,t)=>{const s=h2(e.data.substr(0,t.offset())),a=h2(e.data.substr(t.offset()));return(s.text+a.text).length>0?(m2(e),Et(e,t.offset()-s.count)):t},f5=(e,t)=>{const s=t.container(),a=jn(In(s.childNodes),e).map(d=>d<t.offset()?Et(s,t.offset()-1):t).getOr(t);return Sg(e),a},h5=(e,t)=>jR(e)&&t.container()===e?d5(e,t):p2(e,t),m5=(e,t)=>t.container()===e.parentNode?f5(e,t):p2(e,t),p5=(e,t)=>Et.isTextPosition(t)?h5(e,t):m5(e,t),Sg=e=>{u5(e)&&Vu(e)&&(K1(e)?e.removeAttribute("data-mce-caret"):ly(e)),jR(e)&&(m2(e),e.data.length===0&&ly(e))},KR=Ir,JS=Lu,g5=og,g2="*[contentEditable=false],video,audio,embed,object",ZR=(e,t,s)=>{const a=Vv(t.getBoundingClientRect(),s);let d,p;if(e.tagName==="BODY"){const C=e.ownerDocument.documentElement;d=e.scrollLeft||C.scrollLeft,p=e.scrollTop||C.scrollTop}else{const C=e.getBoundingClientRect();d=e.scrollLeft-C.left,p=e.scrollTop-C.top}a.left+=d,a.right+=d,a.top+=p,a.bottom+=p,a.width=1;let v=t.offsetWidth-t.clientWidth;return v>0&&(s&&(v*=-1),a.left+=v,a.right+=v),a},qR=e=>{var t,s;const a=$e(M.fromDom(e),g2);for(let d=0;d<a.length;d++){const p=a[d].dom;let v=p.previousSibling;if(j0(v)){const C=v.data;C.length===1?(t=v.parentNode)===null||t===void 0||t.removeChild(v):v.deleteData(C.length-1,1)}v=p.nextSibling,Uv(v)&&(v.data.length===1?(s=v.parentNode)===null||s===void 0||s.removeChild(v):v.deleteData(0,1))}},YR=(e,t,s,a)=>{const d=tn();let p,v;const C=Wl(e),L=e.dom,G=(Se,Pe)=>{let Je;if(ee(),g5(Pe))return null;if(s(Pe)){const nt=Z1(C,Pe,Se),rt=ZR(t,Pe,Se);L.setStyle(nt,"top",rt.top),L.setStyle(nt,"caret-color","transparent"),v=nt;const ft=L.create("div",{class:"mce-visual-caret","data-mce-bogus":"all"});L.setStyles(ft,{...rt}),L.add(t,ft),d.set({caret:ft,element:Pe,before:Se}),Se&&L.addClass(ft,"mce-visual-caret-before"),te(),Je=Pe.ownerDocument.createRange(),Je.setStart(nt,0),Je.setEnd(nt,0)}else return v=MS(Pe,Se),Je=Pe.ownerDocument.createRange(),cy(v.nextSibling)?(Je.setStart(v,0),Je.setEnd(v,0)):(Je.setStart(v,1),Je.setEnd(v,1)),Je;return Je},ee=()=>{qR(t),v&&(Sg(v),v=null),d.on(Se=>{L.remove(Se.caret),d.clear()}),p&&(clearInterval(p),p=void 0)},te=()=>{p=setInterval(()=>{d.on(Se=>{a()?L.toggleClass(Se.caret,"mce-visual-caret-hidden"):L.addClass(Se.caret,"mce-visual-caret-hidden")})},500)};return{show:G,hide:ee,getCss:()=>".mce-visual-caret {position: absolute;background-color: black;background-color: currentcolor;}.mce-visual-caret-hidden {display: none;}*[data-mce-caret] {position: absolute;left: -1000px;right: auto;top: 0;margin: 0;padding: 0;}",reposition:()=>{d.on(Se=>{const Pe=ZR(t,Se.element,Se.before);L.setStyles(Se.caret,{...Pe})})},destroy:()=>clearInterval(p)}},b2=()=>gs.browser.isFirefox(),cy=e=>KR(e)||JS(e),uy=e=>(cy(e)||$d(e)&&b2())&&ki(M.fromDom(e)).exists($a),QS=Ws,eE=Ir,XR=Lu,v2=Fd("display","block table table-cell table-caption list-item"),x2=Vu,JR=wf,b5=oo,tE=rn,QR=cd,sb=e=>e>0,rb=e=>e<0,nE=(e,t)=>{let s;for(;s=e(t);)if(!JR(s))return s;return null},dy=(e,t,s,a,d)=>{const p=new bn(e,a),v=eE(e)||JR(e);let C;if(rb(t)){if(v&&(C=nE(p.prev.bind(p),!0),s(C)))return C;for(;C=nE(p.prev.bind(p),d);)if(s(C))return C}if(sb(t)){if(v&&(C=nE(p.next.bind(p),!0),s(C)))return C;for(;C=nE(p.next.bind(p),d);)if(s(C))return C}return null},v5=(e,t)=>{const s=d=>QS(d.dom),a=d=>d.dom===t;return Kr(M.fromDom(e),s,a).map(d=>d.dom).getOr(t)},Eg=(e,t)=>{for(;e&&e!==t;){if(v2(e))return e;e=e.parentNode}return null},tm=(e,t,s)=>Eg(e.container(),s)===Eg(t.container(),s),oE=(e,t)=>{if(!t)return J.none();const s=t.container(),a=t.offset();return b5(s)?J.from(s.childNodes[a+e]):J.none()},eO=(e,t)=>{var s;const d=((s=t.ownerDocument)!==null&&s!==void 0?s:document).createRange();return e?(d.setStartBefore(t),d.setEndBefore(t)):(d.setStartAfter(t),d.setEndAfter(t)),d},tO=(e,t,s)=>Eg(t,e)===Eg(s,e),y2=(e,t,s)=>{const a=e?"previousSibling":"nextSibling";let d=s;for(;d&&d!==t;){let p=d[a];if(p&&x2(p)&&(p=p[a]),eE(p)||XR(p)){if(tO(t,p,d))return p;break}if(QR(p))break;d=d.parentNode}return null},fy=it(eO,!0),hy=it(eO,!1),w2=(e,t,s)=>{let a;const d=it(y2,!0,t),p=it(y2,!1,t),v=s.startContainer,C=s.startOffset;if(wf(v)){const L=tE(v)?v.parentNode:v,G=L.getAttribute("data-mce-caret");if(G==="before"&&(a=L.nextSibling,uy(a)))return fy(a);if(G==="after"&&(a=L.previousSibling,uy(a)))return hy(a)}if(!s.collapsed)return s;if(rn(v)){if(x2(v)){if(e===1){if(a=p(v),a)return fy(a);if(a=d(v),a)return hy(a)}if(e===-1){if(a=d(v),a)return hy(a);if(a=p(v),a)return fy(a)}return s}if(j0(v)&&C>=v.data.length-1)return e===1&&(a=p(v),a)?fy(a):s;if(Uv(v)&&C<=1)return e===-1&&(a=d(v),a)?hy(a):s;if(C===v.data.length)return a=p(v),a?fy(a):s;if(C===0)return a=d(v),a?hy(a):s}return s},nO=(e,t)=>oE(e?0:-1,t).filter(eE),my=(e,t,s)=>{const a=w2(e,t,s);return e===-1?Et.fromRangeStart(a):Et.fromRangeEnd(a)},sE=e=>J.from(e.getNode()).map(M.fromDom),x5=e=>J.from(e.getNode(!0)).map(M.fromDom),S2=(e,t)=>{let s=t;for(;s=e(s);)if(s.isVisible())return s;return s},rE=(e,t)=>{const s=tm(e,t);return!s&&fi(e.getNode())?!0:s};var Ol;(function(e){e[e.Backwards=-1]="Backwards",e[e.Forwards=1]="Forwards"})(Ol||(Ol={}));const y5=Ir,nm=rn,oO=oo,uo=fi,ib=cd,E2=rp,iE=ip,C2=(e,t)=>{const s=[];let a=e;for(;a&&a!==t;)s.push(a),a=a.parentNode;return s},sO=(e,t)=>e.hasChildNodes()&&t<e.childNodes.length?e.childNodes[t]:null,py=(e,t)=>{if(sb(e)){if(ib(t.previousSibling)&&!nm(t.previousSibling))return Et.before(t);if(nm(t))return Et(t,0)}if(rb(e)){if(ib(t.nextSibling)&&!nm(t.nextSibling))return Et.after(t);if(nm(t))return Et(t,t.data.length)}return rb(e)?uo(t)?Et.before(t):Et.after(t):Et.before(t)},rO=(e,t)=>{const s=t.nextSibling;return s&&ib(s)?nm(s)?Et(s,0):Et.before(s):_2(Ol.Forwards,Et.after(t),e)},_2=(e,t,s)=>{let a,d,p,v;if(!oO(s)||!t)return null;if(t.isEqual(Et.after(s))&&s.lastChild){if(v=Et.after(s.lastChild),rb(e)&&ib(s.lastChild)&&oO(s.lastChild))return uo(s.lastChild)?Et.before(s.lastChild):v}else v=t;const C=v.container();let L=v.offset();if(nm(C)){if(rb(e)&&L>0)return Et(C,--L);if(sb(e)&&L<C.length)return Et(C,++L);a=C}else{if(rb(e)&&L>0&&(d=sO(C,L-1),ib(d)))return!E2(d)&&(p=dy(d,e,iE,d),p)?nm(p)?Et(p,p.data.length):Et.after(p):nm(d)?Et(d,d.data.length):Et.before(d);if(sb(e)&&L<C.childNodes.length&&(d=sO(C,L),ib(d)))return uo(d)?rO(s,d):!E2(d)&&(p=dy(d,e,iE,d),p)?nm(p)?Et(p,0):Et.before(p):nm(d)?Et(d,0):Et.after(d);a=d||v.getNode()}if(a&&(sb(e)&&v.isAtEnd()||rb(e)&&v.isAtStart())&&(a=dy(a,e,an,s,!0),iE(a,s)))return py(e,a);d=a&&dy(a,e,iE,s);const G=Ko(Ct(C2(C,s),y5));return G&&(!d||!G.contains(d))?(sb(e)?v=Et.after(G):v=Et.before(G),v):d?py(e,d):null},Do=e=>({next:t=>_2(Ol.Forwards,t,e),prev:t=>_2(Ol.Backwards,t,e)}),Qo=(e,t,s)=>{const a=e?Et.before(s):Et.after(s);return hd(e,t,a)},iO=e=>fi(e)?Et.before(e):Et.after(e),aO=e=>Et.isTextPosition(e)?e.offset()===0:cd(e.getNode()),lO=e=>{if(Et.isTextPosition(e)){const t=e.container();return e.offset()===t.data.length}else return cd(e.getNode(!0))},cO=(e,t)=>!Et.isTextPosition(e)&&!Et.isTextPosition(t)&&e.getNode()===t.getNode(!0),Bo=e=>!Et.isTextPosition(e)&&fi(e.getNode()),gy=(e,t,s)=>e?!cO(t,s)&&!Bo(t)&&lO(t)&&aO(s):!cO(s,t)&&aO(t)&&lO(s),hd=(e,t,s)=>{const a=Do(t);return J.from(e?a.next(s):a.prev(s))},ab=(e,t,s)=>hd(e,t,s).bind(a=>tm(s,a,t)&&gy(e,s,a)?hd(e,t,a):J.some(a)),uO=(e,t,s,a)=>ab(e,t,s).bind(d=>a(d)?uO(e,t,d,a):J.some(d)),lx=(e,t)=>{const s=e?t.firstChild:t.lastChild;return rn(s)?J.some(Et(s,e?0:s.data.length)):s?cd(s)?J.some(e?Et.before(s):iO(s)):Qo(e,t,s):J.none()},Kc=it(hd,!0),Wu=it(hd,!1),Mo=it(lx,!0),Wd=it(lx,!1),cx="_mce_caret",md=e=>oo(e)&&e.id===cx,Cg=(e,t)=>{let s=t;for(;s&&s!==e;){if(md(s))return s;s=s.parentNode}return null},dO=e=>re(e.start),fO=e=>yn(e,"rng"),hO=e=>yn(e,"id"),T2=e=>yn(e,"name"),mO=e=>hn.isArray(e.start),aE=e=>!T2(e)&&Ue(e.forward)?e.forward:!0,pO=(e,t)=>(oo(t)&&e.isBlock(t)&&!t.innerHTML&&(t.innerHTML='<br data-mce-bogus="1" />'),t),w5=(e,t)=>{const s=J.from(le(e.getRoot(),t.start)),a=J.from(le(e.getRoot(),t.end));return wa(s,a,(d,p)=>{const v=e.createRng();return v.setStart(d.container(),d.offset()),v.setEnd(p.container(),p.offset()),{range:v,forward:aE(t)}})},S5=(e,t)=>{var s;const d=((s=e.ownerDocument)!==null&&s!==void 0?s:document).createTextNode(ta);e.appendChild(d),t.setStart(d,0),t.setEnd(d,0)},D2=e=>!e.hasChildNodes(),k2=(e,t)=>Wd(e).fold(vt,s=>(t.setStart(s.container(),s.offset()),t.setEnd(s.container(),s.offset()),!0)),gO=(e,t,s)=>D2(t)&&Cg(e,t)?(S5(t,s),!0):!1,bO=(e,t,s,a)=>{const d=s[t?"start":"end"],p=e.getRoot();if(d){let v=p,C=d[0];for(let L=d.length-1;v&&L>=1;L--){const G=v.childNodes;if(gO(p,v,a))return!0;if(d[L]>G.length-1)return gO(p,v,a)?!0:k2(v,a);v=G[d[L]]}rn(v)&&(C=Math.min(d[0],v.data.length)),oo(v)&&(C=Math.min(d[0],v.childNodes.length)),t?a.setStart(v,C):a.setEnd(v,C)}return!0},A2=e=>rn(e)&&e.data.length>0,vO=(e,t,s)=>{const a=e.get(s.id+"_"+t),d=a==null?void 0:a.parentNode,p=s.keep;if(a&&d){let v,C;if(t==="start"?p?a.hasChildNodes()?(v=a.firstChild,C=1):A2(a.nextSibling)?(v=a.nextSibling,C=0):A2(a.previousSibling)?(v=a.previousSibling,C=a.previousSibling.data.length):(v=d,C=e.nodeIndex(a)+1):(v=d,C=e.nodeIndex(a)):p?a.hasChildNodes()?(v=a.firstChild,C=1):A2(a.previousSibling)?(v=a.previousSibling,C=a.previousSibling.data.length):(v=d,C=e.nodeIndex(a)):(v=d,C=e.nodeIndex(a)),!p){const L=a.previousSibling,G=a.nextSibling;hn.each(hn.grep(a.childNodes),te=>{rn(te)&&(te.data=te.data.replace(/\uFEFF/g,""))});let ee;for(;ee=e.get(s.id+"_"+t);)e.remove(ee,!0);if(rn(G)&&rn(L)&&!gs.browser.isOpera()){const te=L.data.length;L.appendData(G.data),e.remove(G),v=L,C=te}}return J.some(Et(v,C))}else return J.none()},xO=(e,t)=>{const s=e.createRng();return bO(e,!0,t,s)&&bO(e,!1,t,s)?J.some({range:s,forward:aE(t)}):J.none()},lb=(e,t)=>{const s=vO(e,"start",t),a=vO(e,"end",t);return wa(s,a.or(s),(d,p)=>{const v=e.createRng();return v.setStart(pO(e,d.container()),d.offset()),v.setEnd(pO(e,p.container()),p.offset()),{range:v,forward:aE(t)}})},yO=(e,t)=>J.from(e.select(t.name)[t.index]).map(s=>{const a=e.createRng();return a.selectNode(s),{range:a,forward:!0}}),wO=(e,t)=>{const s=e.dom;if(t){if(mO(t))return xO(s,t);if(dO(t))return w5(s,t);if(hO(t))return lb(s,t);if(T2(t))return yO(s,t);if(fO(t))return J.some({range:t.rng,forward:aE(t)})}return J.none()},E5=(e,t,s)=>at(e,t,s),C5=(e,t)=>{wO(e,t).each(({range:s,forward:a})=>{e.setRng(s,a)})},pd=e=>oo(e)&&e.tagName==="SPAN"&&e.getAttribute("data-mce-type")==="bookmark",jl=(e=>t=>e===t)(Vo),ux=e=>e!==""&&` \f
\r	\v`.indexOf(e)!==-1,mp=e=>!ux(e)&&!jl(e)&&!Yr(e),ri=e=>{const t=[];if(e)for(let s=0;s<e.rangeCount;s++)t.push(e.getRangeAt(s));return t},jd=e=>kt(e,t=>{const s=yg(t);return s?[M.fromDom(s)]:[]}),by=e=>ri(e).length>1,lE=e=>Ct(jd(e),zd),dx=e=>$e(e,"td[data-mce-selected],th[data-mce-selected]"),SO=(e,t)=>{const s=dx(t);return s.length>0?s:lE(e)},sh=e=>SO(ri(e.selection.getSel()),M.fromDom(e.getBody())),gr=(e,t)=>Rt(e,"table",t),vy=e=>{const t=e.startContainer,s=e.startOffset;return rn(t)?s===0?J.some(M.fromDom(t)):J.none():J.from(t.childNodes[s]).map(M.fromDom)},EO=e=>{const t=e.endContainer,s=e.endOffset;return rn(t)?s===t.data.length?J.some(M.fromDom(t)):J.none():J.from(t.childNodes[s-1]).map(M.fromDom)},L2=e=>sd(e).fold(et([e]),t=>[e].concat(L2(t))),xy=e=>ou(e).fold(et([e]),t=>ls(t)==="br"?Vs(t).map(s=>[e].concat(xy(s))).getOr([]):[e].concat(xy(t))),yy=(e,t)=>wa(vy(t),EO(t),(s,a)=>{const d=Qt(L2(e),it(gt,s)),p=Qt(xy(e),it(gt,a));return d.isSome()&&p.isSome()}).getOr(!1),wy=(e,t,s,a)=>{const d=s,p=new bn(s,d),v=ps(e.schema.getMoveCaretBeforeOnEnterElements(),(L,G)=>!to(["td","th","table"],G.toLowerCase()));let C=s;do{if(rn(C)&&hn.trim(C.data).length!==0){a?t.setStart(C,0):t.setEnd(C,C.data.length);return}if(v[C.nodeName]){a?t.setStartBefore(C):C.nodeName==="BR"?t.setEndBefore(C):t.setEndAfter(C);return}}while(C=a?p.next():p.prev());d.nodeName==="BODY"&&(a?t.setStart(d,0):t.setEnd(d,d.childNodes.length))},fx=e=>{const t=e.selection.getSel();return ve(t)&&t.rangeCount>0},hx=(e,t)=>{const s=sh(e);s.length>0?xe(s,a=>{const d=a.dom,p=e.dom.createRng();p.setStartBefore(d),p.setEndAfter(d),t(p,!0)}):t(e.selection.getRng(),!1)},cE=(e,t,s)=>{const a=un(e,t);s(a),e.moveToBookmark(a)},mx=e=>O(e==null?void 0:e.nodeType),uE=e=>oo(e)&&!pd(e)&&!md(e)&&!Bd(e),CO=(e,t)=>{if(uE(t)&&!/^(TD|TH)$/.test(t.nodeName)){const s=e.getAttrib(t,"data-mce-selected"),a=parseInt(s,10);return!isNaN(a)&&a>0}else return!1},R2=(e,t,s)=>{const{selection:a,dom:d}=e,p=a.getNode(),v=Ir(p);cE(a,!0,()=>{t()}),v&&Ir(p)&&d.isChildOf(p,e.getBody())?e.selection.select(p):s(a.getStart())&&_O(d,a)},_O=(e,t)=>{var s,a;const d=t.getRng(),{startContainer:p,startOffset:v}=d,C=t.getNode();if(!CO(e,C)&&oo(p)){const L=p.childNodes,G=e.getRoot();let ee;if(v<L.length){const te=L[v];ee=new bn(te,(s=e.getParent(te,e.isBlock))!==null&&s!==void 0?s:G)}else{const te=L[L.length-1];ee=new bn(te,(a=e.getParent(te,e.isBlock))!==null&&a!==void 0?a:G),ee.next(!0)}for(let te=ee.current();te;te=ee.next()){if(e.getContentEditable(te)==="false")return;if(rn(te)&&!O2(te)){d.setStart(te,0),t.setRng(d);return}}}},cb=(e,t,s)=>{if(e){const a=t?"nextSibling":"previousSibling";for(e=s?e:e[a];e;e=e[a])if(oo(e)||!O2(e))return e}},dE=(e,t)=>!!e.getTextBlockElements()[t.nodeName.toLowerCase()]||Bh(e,t),_g=(e,t,s)=>e.schema.isValidChild(t,s),O2=(e,t=!1)=>{if(ve(e)&&rn(e)){const s=t?e.data.replace(/ /g," "):e.data;return pr(s)}else return!1},T5=e=>ve(e)&&rn(e)&&e.length===0,TO=(e,t)=>{const s="[data-mce-cef-wrappable]",a=Ho(e),d=jr(a)?s:`${s},${a}`;return Ve(M.fromDom(t),d)},I2=(e,t)=>{const s=e.dom;return uE(t)&&s.getContentEditable(t)==="false"&&TO(e,t)&&s.select('[contenteditable="true"]',t).length===0},pp=(e,t)=>Oe(e)?e(t):(ve(t)&&(e=e.replace(/%(\w+)/g,(s,a)=>t[a]||s)),e),px=(e,t)=>(e=e||"",t=t||"",e=""+(e.nodeName||e),t=""+(t.nodeName||t),e.toLowerCase()===t.toLowerCase()),fE=(e,t)=>{if(Ae(e))return null;{let s=String(e);return(t==="color"||t==="backgroundColor")&&(s=$0(s)),t==="fontWeight"&&e===700&&(s="bold"),t==="fontFamily"&&(s=s.replace(/[\'\"]/g,"").replace(/,\s+/g,",")),s}},Sy=(e,t,s)=>{const a=e.getStyle(t,s);return fE(a,s)},P2=(e,t)=>{let s;return e.getParent(t,a=>oo(a)?(s=e.getStyle(a,"text-decoration"),!!s&&s!=="none"):!1),s},Ey=(e,t,s)=>e.getParents(t,s,e.getRoot()),hE=(e,t,s)=>{const a=e.formatter.get(t);return ve(a)&&mo(a,s)},DO=(e,t)=>hE(e,t,a=>{const d=p=>Oe(p)||p.length>1&&p.charAt(0)==="%";return mo(["styles","attributes"],p=>Gn(a,p).exists(v=>{const C=ae(v)?v:vo(v);return mo(C,d)}))}),kO=(e,t,s)=>{const a=["inline","block","selector","attributes","styles","classes"],d=p=>ps(p,(v,C)=>mo(a,L=>L===C));return hE(e,t,p=>{const v=d(p);return hE(e,s,C=>{const L=d(C);return ao(v,L)})})},rh=e=>vr(e,"block"),AO=e=>rh(e)&&e.wrapper===!0,LO=e=>rh(e)&&e.wrapper!==!0,ju=e=>vr(e,"selector"),nl=e=>vr(e,"inline"),RO=e=>ju(e)&&nl(e)&&Rd(Gn(e,"mixed"),!0),mE=e=>ju(e)&&e.expand!==!1&&!nl(e),OO=e=>{const t=[];let s=e;for(;s;){if(rn(s)&&s.data!==ta||s.childNodes.length>1)return[];oo(s)&&t.push(s),s=s.firstChild}return t},M2=e=>OO(e).length>0,pE=e=>md(e.dom)&&M2(e.dom),Tg=pd,Cy=Ey,gE=O2,bE=dE,IO=e=>fi(e)&&e.getAttribute("data-mce-bogus")&&!e.nextSibling,_y=(e,t)=>{let s=t;for(;s;){if(oo(s)&&e.getContentEditable(s))return e.getContentEditable(s)==="false"?s:t;s=s.parentNode}return t},vE=(e,t,s,a)=>{const d=t.data;if(e){for(let p=s;p>0;p--)if(a(d.charAt(p-1)))return p}else for(let p=s;p<d.length;p++)if(a(d.charAt(p)))return p;return-1},Ty=(e,t,s)=>vE(e,t,s,a=>jl(a)||ux(a)),N2=(e,t,s)=>vE(e,t,s,mp),F2=(e,t,s,a,d,p)=>{let v;const C=e.getParent(s,e.isBlock)||t,L=(ee,te,ie)=>{const ye=Yf(e),Re=d?ye.backwards:ye.forwards;return J.from(Re(ee,te,(Se,Pe)=>Tg(Se.parentNode)?-1:(v=Se,ie(d,Se,Pe)),C))};return L(s,a,Ty).bind(ee=>p?L(ee.container,ee.offset+(d?-1:0),N2):J.some(ee)).orThunk(()=>v?J.some({container:v,offset:d?0:v.length}):J.none())},ub=(e,t,s,a,d)=>{const p=a[d];rn(a)&&jr(a.data)&&p&&(a=p);const v=Cy(e,a);for(let C=0;C<v.length;C++)for(let L=0;L<t.length;L++){const G=t[L];if(!(ve(G.collapsed)&&G.collapsed!==s.collapsed)&&ju(G)&&e.is(v[C],G.selector))return v[C]}return a},xE=(e,t,s,a)=>{var d;let p=s;const v=e.getRoot(),C=t[0];if(rh(C)&&(p=C.wrapper?null:e.getParent(s,C.block,v)),!p){const L=(d=e.getParent(s,"LI,TD,TH,SUMMARY"))!==null&&d!==void 0?d:v;p=e.getParent(rn(s)?s.parentNode:s,G=>G!==v&&bE(e.schema,G),L)}if(p&&rh(C)&&C.wrapper&&(p=Cy(e,p,"ul,ol").reverse()[0]||p),!p)for(p=s;p&&p[a]&&!e.isBlock(p[a])&&(p=p[a],!px(p,"br")););return p||s},yE=(e,t,s,a)=>{const d=s.parentNode;return ve(s[a])?!1:d===t||Ae(d)||e.isBlock(d)?!0:yE(e,t,d,a)},gp=(e,t,s,a,d)=>{let p=s;const v=d?"previousSibling":"nextSibling",C=e.getRoot();if(rn(s)&&!gE(s)&&(d?a>0:a<s.data.length))return s;for(;p;){if(!t[0].block_expand&&e.isBlock(p))return p;for(let L=p[v];L;L=L[v]){const G=rn(L)&&!yE(e,C,L,v);if(!Tg(L)&&!IO(L)&&!gE(L,G))return p}if(p===C||p.parentNode===C){s=p;break}p=p.parentNode}return s},bp=e=>Tg(e.parentNode)||Tg(e),Dg=(e,t,s,a=!1)=>{let{startContainer:d,startOffset:p,endContainer:v,endOffset:C}=t;const L=s[0];return oo(d)&&d.hasChildNodes()&&(d=ba(d,p),rn(d)&&(p=0)),oo(v)&&v.hasChildNodes()&&(v=ba(v,t.collapsed?C:C-1),rn(v)&&(C=v.data.length)),d=_y(e,d),v=_y(e,v),bp(d)&&(d=Tg(d)?d:d.parentNode,t.collapsed?d=d.previousSibling||d:d=d.nextSibling||d,rn(d)&&(p=t.collapsed?d.length:0)),bp(v)&&(v=Tg(v)?v:v.parentNode,t.collapsed?v=v.nextSibling||v:v=v.previousSibling||v,rn(v)&&(C=t.collapsed?0:v.length)),t.collapsed&&(F2(e,e.getRoot(),d,p,!0,a).each(({container:te,offset:ie})=>{d=te,p=ie}),F2(e,e.getRoot(),v,C,!1,a).each(({container:te,offset:ie})=>{v=te,C=ie})),(nl(L)||L.block_expand)&&((!nl(L)||!rn(d)||p===0)&&(d=gp(e,s,d,p,!0)),(!nl(L)||!rn(v)||C===v.data.length)&&(v=gp(e,s,v,C,!1))),mE(L)&&(d=ub(e,s,t,d,"previousSibling"),v=ub(e,s,t,v,"nextSibling")),(rh(L)||ju(L))&&(d=xE(e,s,d,"previousSibling"),v=xE(e,s,v,"nextSibling"),rh(L)&&(e.isBlock(d)||(d=gp(e,s,d,p,!0),rn(d)&&(p=0)),e.isBlock(v)||(v=gp(e,s,v,C,!1),rn(v)&&(C=v.data.length)))),oo(d)&&d.parentNode&&(p=e.nodeIndex(d),d=d.parentNode),oo(v)&&v.parentNode&&(C=e.nodeIndex(v)+1,v=v.parentNode),{startContainer:d,startOffset:p,endContainer:v,endOffset:C}},Dy=(e,t,s)=>{var a;const d=t.startOffset,p=ba(t.startContainer,d),v=t.endOffset,C=ba(t.endContainer,v-1),L=Pe=>{const Je=Pe[0];rn(Je)&&Je===p&&d>=Je.data.length&&Pe.splice(0,1);const nt=Pe[Pe.length-1];return v===0&&Pe.length>0&&nt===C&&rn(nt)&&Pe.splice(Pe.length-1,1),Pe},G=(Pe,Je,nt)=>{const rt=[];for(;Pe&&Pe!==nt;Pe=Pe[Je])rt.push(Pe);return rt},ee=(Pe,Je)=>e.getParent(Pe,nt=>nt.parentNode===Je,Je),te=(Pe,Je,nt)=>{const rt=nt?"nextSibling":"previousSibling";for(let ft=Pe,Xt=ft.parentNode;ft&&ft!==Je;ft=Xt){Xt=ft.parentNode;const mn=G(ft===Pe?ft:ft[rt],rt);mn.length&&(nt||mn.reverse(),s(L(mn)))}};if(p===C)return s(L([p]));const ie=(a=e.findCommonAncestor(p,C))!==null&&a!==void 0?a:e.getRoot();if(e.isChildOf(p,C))return te(p,ie,!0);if(e.isChildOf(C,p))return te(C,ie);const ye=ee(p,ie)||p,Re=ee(C,ie)||C;te(p,ye,!0);const Se=G(ye===p?ye:ye.nextSibling,"nextSibling",Re===C?Re.nextSibling:Re);Se.length&&s(L(Se)),te(C,Re)},D5=['pre[class*=language-][contenteditable="false"]',"figure.image","div[data-ephox-embed-iri]","div.tiny-pageembed","div.mce-toc","div[data-mce-toc]"],PO=e=>ti(e)&&bg(e)===ta,MO=(e,t,s,a)=>_s(t).fold(()=>"skipping",d=>a==="br"||PO(t)?"valid":U1(t)?"existing":md(t.dom)?"caret":mo(D5,p=>Ve(t,p))?"valid-block":!_g(e,s,a)||!_g(e,ls(d),s)?"invalid-child":"valid"),kg=(e,t)=>{const s=Dg(e.dom,t,[{inline:"span"}]);t.setStart(s.startContainer,s.startOffset),t.setEnd(s.endContainer,s.endOffset),e.selection.setRng(t)},Ag=(e,t,s,a,d,p)=>{const{uid:v=t,...C}=s;od(e,Ei()),$s(e,`${Wi()}`,v),$s(e,`${ea()}`,a);const{attributes:L={},classes:G=[]}=d(v,C);if(Hc(e,L),$u(e,G),p){G.length>0&&$s(e,`${Jr()}`,G.join(","));const ee=Yt(L);ee.length>0&&$s(e,`${Xm()}`,ee.join(","))}},Il=e=>{nu(e,Ei()),Xi(e,`${Wi()}`),Xi(e,`${ea()}`),Xi(e,`${ir()}`);const t=Ul(e,`${Xm()}`).map(a=>a.split(",")).getOr([]),s=Ul(e,`${Jr()}`).map(a=>a.split(",")).getOr([]);xe(t,a=>Xi(e,a)),Jm(e,s),Xi(e,`${Jr()}`),Xi(e,`${Xm()}`)},om=(e,t,s,a,d)=>{const p=M.fromTag("span",e);return Ag(p,t,s,a,d,!1),p},dr=(e,t,s,a,d,p)=>{const v=[],C=om(e.getDoc(),s,p,a,d),L=tn(),G=()=>{L.clear()},ee=()=>L.get().getOrThunk(()=>{const Re=Gl(C);return v.push(Re),L.set(Re),Re}),te=Re=>{xe(Re,ie)},ie=Re=>{switch(MO(e,Re,"span",ls(Re))){case"invalid-child":{G();const Pe=cr(Re);te(Pe),G();break}case"valid-block":{G(),Ag(Re,s,p,a,d,!0);break}case"valid":{const Pe=ee();Tl(Re,Pe);break}}},ye=Re=>{const Se=$t(Re,M.fromDom);te(Se)};return Dy(e.dom,t,Re=>{G(),ye(Re)}),v},k5=(e,t,s,a)=>{e.undoManager.transact(()=>{const d=e.selection,p=d.getRng(),v=sh(e).length>0,C=gg("mce-annotation");if(p.collapsed&&!v&&kg(e,p),d.getRng().collapsed&&!v){const L=om(e.getDoc(),C,a,t,s.decorate);zc(L,Vo),d.getRng().insertNode(L.dom),d.select(L.dom)}else cE(d,!1,()=>{hx(e,L=>{dr(e,L,C,t,s.decorate,a)})})})},NO=e=>{const t=z1();LS(e,t);const s=Iv(e,t),a=ci("span"),d=p=>{xe(p,v=>{a(v)?di(v):Il(v)})};return{register:(p,v)=>{t.register(p,v)},annotate:(p,v)=>{t.lookup(p).each(C=>{k5(e,p,C,v)})},annotationChanged:(p,v)=>{s.addListener(p,v)},remove:p=>{H1(e,J.some(p)).each(({elements:v})=>{const C=e.selection.getBookmark();d(v),e.selection.moveToBookmark(C)})},removeAll:p=>{const v=e.selection.getBookmark();qo(Wh(e,p),(C,L)=>{d(C)}),e.selection.moveToBookmark(v)},getAll:p=>{const v=Wh(e,p);return _i(v,C=>$t(C,L=>L.dom))}}},Mr=e=>({getBookmark:it(E5,e),moveToBookmark:it(C5,e)});Mr.isBookmarkNode=pd;const B2=(e,t,s)=>s.collapsed?!1:mo(s.getClientRects(),a=>Z0(a,e,t)),ky=(e,t)=>e.dispatch("PreProcess",t),Ay=(e,t)=>e.dispatch("PostProcess",t),wE=e=>{e.dispatch("remove")},SE=e=>{e.dispatch("detach")},FO=(e,t)=>{e.dispatch("SwitchMode",{mode:t})},A5=(e,t,s,a,d)=>{e.dispatch("ObjectResizeStart",{target:t,width:s,height:a,origin:d})},L5=(e,t,s,a,d)=>{e.dispatch("ObjectResized",{target:t,width:s,height:a,origin:d})},R5=e=>{e.dispatch("PreInit")},O5=e=>{e.dispatch("PostRender")},Pl=e=>{e.dispatch("Init")},BO=(e,t)=>{e.dispatch("PlaceholderToggle",{state:t})},$2=(e,t,s)=>{e.dispatch(t,s)},$O=(e,t,s,a)=>{e.dispatch("FormatApply",{format:t,node:s,vars:a})},HO=(e,t,s,a)=>{e.dispatch("FormatRemove",{format:t,node:s,vars:a})},I5=(e,t)=>e.dispatch("BeforeSetContent",t),fu=(e,t)=>e.dispatch("SetContent",t),ih=(e,t)=>e.dispatch("BeforeGetContent",t),UO=(e,t)=>e.dispatch("GetContent",t),H2=(e,t)=>{e.dispatch("AutocompleterStart",t)},U2=(e,t)=>{e.dispatch("AutocompleterUpdate",t)},V2=(e,t)=>{e.dispatch("AutocompleterUpdateActiveRange",t)},P5=e=>{e.dispatch("AutocompleterEnd")},Ly=(e,t,s)=>e.dispatch("PastePreProcess",{content:t,internal:s}),EE=(e,t,s)=>e.dispatch("PastePostProcess",{node:t,internal:s}),CE=(e,t)=>e.dispatch("PastePlainTextToggle",{state:t}),M5=(e,t)=>e.dispatch("EditableRootStateChange",{state:t}),Pn={BACKSPACE:8,DELETE:46,DOWN:40,ENTER:13,ESC:27,LEFT:37,RIGHT:39,SPACEBAR:32,TAB:9,UP:38,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,modifierPressed:e=>e.shiftKey||e.ctrlKey||e.altKey||Pn.metaKeyPressed(e),metaKeyPressed:e=>gs.os.isMacOS()||gs.os.isiOS()?e.metaKey:e.ctrlKey&&!e.altKey},db="data-mce-selected",N5="table,img,figure.image,hr,video,span.mce-preview-object,details",gd=Math.abs,Lg=Math.round,_E={nw:[0,0,-1,-1],ne:[1,0,1,-1],se:[1,1,1,1],sw:[0,1,-1,1]},Df=e=>e.type==="longpress"||e.type.indexOf("touch")===0,Er=(e,t)=>{const s=t.dom,a=t.getDoc(),d=document,p=t.getBody();let v,C,L,G,ee,te,ie,ye,Re,Se,Pe,Je,nt,rt,ft,Xt,mn;const Fn=Mn=>ve(Mn)&&(ad(Mn)||s.is(Mn,"figure.image")),Lt=Mn=>Lu(Mn)||s.hasClass(Mn,"mce-preview-object"),yt=(Mn,cs)=>{if(Df(Mn)){const Ss=Mn.touches[0];return Fn(Mn.target)&&!B2(Ss.clientX,Ss.clientY,cs)}else return Fn(Mn.target)&&!B2(Mn.clientX,Mn.clientY,cs)},qt=Mn=>{const cs=Mn.target;yt(Mn,t.selection.getRng())&&!Mn.isDefaultPrevented()&&t.selection.select(cs)},no=Mn=>s.hasClass(Mn,"mce-preview-object")&&ve(Mn.firstElementChild)?[Mn,Mn.firstElementChild]:s.is(Mn,"figure.image")?[Mn.querySelector("img")]:[Mn],So=Mn=>{const cs=CR(t);return!cs||Mn.getAttribute("data-mce-resize")==="false"||Mn===t.getBody()?!1:s.hasClass(Mn,"mce-preview-object")&&ve(Mn.firstElementChild)?Ve(M.fromDom(Mn.firstElementChild),cs):Ve(M.fromDom(Mn),cs)},fs=(Mn,cs)=>{if(Lt(cs))return Mn.create("img",{src:gs.transparentSrc});if($d(cs)){const xl=qs(G.name,"n")?At:On,Tr=cs.cloneNode(!0);return xl(Mn.select("tr",Tr)).each(sl=>{const yh=Mn.select("td,th",sl);Mn.setStyle(sl,"height",null),xe(yh,$p=>Mn.setStyle($p,"height",null))}),Tr}else return cs.cloneNode(!0)},Ts=(Mn,cs,Ss)=>{if(ve(Ss)){const xl=no(Mn);xe(xl,Tr=>{Tr.style[cs]||!t.schema.isValid(Tr.nodeName.toLowerCase(),cs)?s.setStyle(Tr,cs,Ss):s.setAttrib(Tr,cs,""+Ss)})}},_r=(Mn,cs,Ss)=>{Ts(Mn,"width",cs),Ts(Mn,"height",Ss)},$r=Mn=>{let cs,Ss,xl,Tr,sl;cs=Mn.screenX-te,Ss=Mn.screenY-ie,rt=cs*G[2]+Se,ft=Ss*G[3]+Pe,rt=rt<5?5:rt,ft=ft<5?5:ft,(Fn(v)||Lt(v))&&_R(t)!==!1?xl=!Pn.modifierPressed(Mn):xl=Pn.modifierPressed(Mn),xl&&(gd(cs)>gd(Ss)?(ft=Lg(rt*Je),rt=Lg(ft/Je)):(rt=Lg(ft/Je),ft=Lg(rt*Je))),_r(C,rt,ft),Tr=G.startPos.x+cs,sl=G.startPos.y+Ss,Tr=Tr>0?Tr:0,sl=sl>0?sl:0,s.setStyles(L,{left:Tr,top:sl,display:"block"}),L.innerHTML=rt+" &times; "+ft,G[2]<0&&C.clientWidth<=rt&&s.setStyle(C,"left",ye+(Se-rt)),G[3]<0&&C.clientHeight<=ft&&s.setStyle(C,"top",Re+(Pe-ft)),cs=p.scrollWidth-Xt,Ss=p.scrollHeight-mn,cs+Ss!==0&&s.setStyles(L,{left:Tr-cs,top:sl-Ss}),nt||(A5(t,v,Se,Pe,"corner-"+G.name),nt=!0)},sa=()=>{const Mn=nt;nt=!1,Mn&&(Ts(v,"width",rt),Ts(v,"height",ft)),s.unbind(a,"mousemove",$r),s.unbind(a,"mouseup",sa),d!==a&&(s.unbind(d,"mousemove",$r),s.unbind(d,"mouseup",sa)),s.remove(C),s.remove(L),s.remove(ee),cc(v),Mn&&(L5(t,v,rt,ft,"corner-"+G.name),s.setAttrib(v,"style",s.getAttrib(v,"style"))),t.nodeChanged()},cc=Mn=>{kn();const cs=s.getPos(Mn,p),Ss=cs.x,xl=cs.y,Tr=Mn.getBoundingClientRect(),sl=Tr.width||Tr.right-Tr.left,yh=Tr.height||Tr.bottom-Tr.top;v!==Mn&&(En(),v=Mn,rt=ft=0);const $p=t.dispatch("ObjectSelected",{target:Mn});So(Mn)&&!$p.isDefaultPrevented()?qo(_E,(pu,Jd)=>{const wh=Sh=>{const bo=no(v)[0];te=Sh.screenX,ie=Sh.screenY,Se=bo.clientWidth,Pe=bo.clientHeight,Je=Pe/Se,G=pu,G.name=Jd,G.startPos={x:sl*pu[0]+Ss,y:yh*pu[1]+xl},Xt=p.scrollWidth,mn=p.scrollHeight,ee=s.add(p,"div",{class:"mce-resize-backdrop","data-mce-bogus":"all"}),s.setStyles(ee,{position:"fixed",left:"0",top:"0",width:"100%",height:"100%"}),C=fs(s,v),s.addClass(C,"mce-clonedresizable"),s.setAttrib(C,"data-mce-bogus","all"),C.contentEditable="false",s.setStyles(C,{left:Ss,top:xl,margin:0}),_r(C,sl,yh),C.removeAttribute(db),p.appendChild(C),s.bind(a,"mousemove",$r),s.bind(a,"mouseup",sa),d!==a&&(s.bind(d,"mousemove",$r),s.bind(d,"mouseup",sa)),L=s.add(p,"div",{class:"mce-resize-helper","data-mce-bogus":"all"},Se+" &times; "+Pe)};let Qd=s.get("mceResizeHandle"+Jd);Qd&&s.remove(Qd),Qd=s.add(p,"div",{id:"mceResizeHandle"+Jd,"data-mce-bogus":"all",class:"mce-resizehandle",unselectable:!0,style:"cursor:"+Jd+"-resize; margin:0; padding:0"}),s.bind(Qd,"mousedown",Sh=>{Sh.stopImmediatePropagation(),Sh.preventDefault(),wh(Sh)}),pu.elm=Qd,s.setStyles(Qd,{left:sl*pu[0]+Ss-Qd.offsetWidth/2,top:yh*pu[1]+xl-Qd.offsetHeight/2})}):En(!1)},Hr=Ym(cc,0),En=(Mn=!0)=>{Hr.cancel(),kn(),v&&Mn&&v.removeAttribute(db),qo(_E,(cs,Ss)=>{const xl=s.get("mceResizeHandle"+Ss);xl&&(s.unbind(xl),s.remove(xl))})},fo=(Mn,cs)=>s.isChildOf(Mn,cs),Zs=Mn=>{if(nt||t.removed||t.composing)return;const cs=Mn.type==="mousedown"?Mn.target:e.getNode(),Ss=iu(M.fromDom(cs),N5).map(Tr=>Tr.dom).filter(Tr=>s.isEditable(Tr.parentElement)||Tr.nodeName==="IMG"&&s.isEditable(Tr)).getOrUndefined(),xl=ve(Ss)?s.getAttrib(Ss,db,"1"):"1";if(xe(s.select(`img[${db}],hr[${db}]`),Tr=>{Tr.removeAttribute(db)}),ve(Ss)&&fo(Ss,p)&&t.hasFocus()){ko();const Tr=e.getStart(!0);if(fo(Tr,Ss)&&fo(e.getEnd(!0),Ss)){s.setAttrib(Ss,db,xl),Hr.throttle(Ss);return}}En()},kn=()=>{qo(_E,Mn=>{Mn.elm&&(s.unbind(Mn.elm),delete Mn.elm)})},ko=()=>{try{t.getDoc().execCommand("enableObjectResizing",!1,"false")}catch{}};return t.on("init",()=>{ko(),t.on("NodeChange ResizeEditor ResizeWindow ResizeContent drop",Zs),t.on("keyup compositionend",Mn=>{v&&v.nodeName==="TABLE"&&Zs(Mn)}),t.on("hide blur",En),t.on("contextmenu longpress",qt,!0)}),t.on("remove",kn),{isResizable:So,showResizeRect:cc,hideResizeRect:En,updateResizeRect:Zs,destroy:()=>{Hr.cancel(),v=C=ee=null}}},gx=(e,t)=>{t.fold(s=>{e.setStartBefore(s.dom)},(s,a)=>{e.setStart(s.dom,a)},s=>{e.setStartAfter(s.dom)})},TE=(e,t)=>{t.fold(s=>{e.setEndBefore(s.dom)},(s,a)=>{e.setEnd(s.dom,a)},s=>{e.setEndAfter(s.dom)})},z2=(e,t,s)=>{const a=e.document.createRange();return gx(a,t),TE(a,s),a},Ry=(e,t,s,a,d)=>{const p=e.document.createRange();return p.setStart(t.dom,s),p.setEnd(a.dom,d),p},fb=Oo.generate([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),VO=(e,t,s)=>t(M.fromDom(s.startContainer),s.startOffset,M.fromDom(s.endContainer),s.endOffset),G2=(e,t)=>t.match({domRange:s=>({ltr:et(s),rtl:J.none}),relative:(s,a)=>({ltr:To(()=>z2(e,s,a)),rtl:To(()=>J.some(z2(e,a,s)))}),exact:(s,a,d,p)=>({ltr:To(()=>Ry(e,s,a,d,p)),rtl:To(()=>J.some(Ry(e,d,p,s,a)))})}),F5=(e,t)=>{const s=t.ltr();return s.collapsed?t.rtl().filter(d=>d.collapsed===!1).map(d=>fb.rtl(M.fromDom(d.endContainer),d.endOffset,M.fromDom(d.startContainer),d.startOffset)).getOrThunk(()=>VO(e,fb.ltr,s)):VO(e,fb.ltr,s)},zO=(e,t)=>{const s=G2(e,t);return F5(e,s)};fb.ltr,fb.rtl;const DE={create:(e,t,s,a)=>({start:e,soffset:t,finish:s,foffset:a})},GO=(e,t,s)=>{var a,d;return J.from((d=(a=e.dom).caretPositionFromPoint)===null||d===void 0?void 0:d.call(a,t,s)).bind(p=>{if(p.offsetNode===null)return J.none();const v=e.dom.createRange();return v.setStart(p.offsetNode,p.offset),v.collapse(),J.some(v)})},kE=(e,t,s)=>{var a,d;return J.from((d=(a=e.dom).caretRangeFromPoint)===null||d===void 0?void 0:d.call(a,t,s))},$5=document.caretPositionFromPoint?GO:document.caretRangeFromPoint?kE:J.none,H5=(e,t,s)=>{const a=M.fromDom(e.document);return $5(a,t,s).map(d=>DE.create(M.fromDom(d.startContainer),d.startOffset,M.fromDom(d.endContainer),d.endOffset))},W2=Oo.generate([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),U5=(e,t,s,a)=>e.fold(t,s,a),V5=e=>e.fold(Dt,Dt,Dt),WO=W2.before,z5=W2.on,G5=W2.after,sm={before:WO,on:z5,after:G5,cata:U5,getStart:V5},Oy=Oo.generate([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),W5=e=>Oy.exact(e.start,e.soffset,e.finish,e.foffset),j5=e=>e.match({domRange:t=>M.fromDom(t.startContainer),relative:(t,s)=>sm.getStart(t),exact:(t,s,a,d)=>t}),jO=Oy.domRange,bd=Oy.relative,K5=Oy.exact,KO=e=>{const t=j5(e);return vs(t)},j2=DE.create,Rg={domRange:jO,relative:bd,exact:K5,exactFromRange:W5,getWin:KO,range:j2},Iy=(e,t)=>{const s=ls(e);return s==="input"?sm.after(e):to(["br","img"],s)?t===0?sm.before(e):sm.after(e):sm.on(e,t)},ZO=(e,t)=>{const s=e.fold(sm.before,Iy,sm.after),a=t.fold(sm.before,Iy,sm.after);return Rg.relative(s,a)},AE=(e,t,s,a)=>{const d=Iy(e,t),p=Iy(s,a);return Rg.relative(d,p)},qO=e=>e.match({domRange:t=>{const s=M.fromDom(t.startContainer),a=M.fromDom(t.endContainer);return AE(s,t.startOffset,a,t.endOffset)},relative:ZO,exact:AE}),vd=(e,t)=>{const a=(t||document).createDocumentFragment();return xe(e,d=>{a.appendChild(d.dom)}),M.fromDom(a)},Z5=e=>{const t=Rg.getWin(e).dom,s=(d,p,v,C)=>Ry(t,d,p,v,C),a=qO(e);return zO(t,a).match({ltr:s,rtl:s})},K2=(e,t,s)=>H5(e,t,s),YO=(e,t,s)=>{const a=vs(M.fromDom(s));return K2(a.dom,e,t).map(d=>{const p=s.createRange();return p.setStart(d.start.dom,d.soffset),p.setEnd(d.finish.dom,d.foffset),p}).getOrUndefined()},Py=(e,t)=>ve(e)&&ve(t)&&e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset,ah=(e,t,s)=>{let a=e;for(;a&&a!==t;){if(s(a))return a;a=a.parentNode}return null},LE=(e,t,s)=>ah(e,t,s)!==null,RE=(e,t,s)=>LE(e,t,a=>a.nodeName===s),XO=(e,t)=>Vu(e)&&!LE(e,t,md),JO=(e,t,s)=>{const a=t.parentNode;if(a){const d=new bn(t,e.getParent(a,e.isBlock)||e.getRoot());let p;for(;p=d[s?"prev":"next"]();)if(fi(p))return!0}return!1},QO=(e,t)=>{var s;return((s=e.previousSibling)===null||s===void 0?void 0:s.nodeName)===t},eI=(e,t)=>{let s=t;for(;s&&s!==e;){if(Ir(s))return!0;s=s.parentNode}return!1},My=(e,t,s,a,d)=>{const p=e.getRoot(),v=e.schema.getNonEmptyElements(),C=d.parentNode;let L,G;if(!C)return J.none();const ee=e.getParent(C,e.isBlock)||p;if(a&&fi(d)&&t&&e.isEmpty(ee))return J.some(Et(C,e.nodeIndex(d)));const te=new bn(d,ee);for(;G=te[a?"prev":"next"]();){if(e.getContentEditableParent(G)==="false"||XO(G,p))return J.none();if(rn(G)&&G.data.length>0)return RE(G,p,"A")?J.none():J.some(Et(G,a?G.data.length:0));if(e.isBlock(G)||v[G.nodeName.toLowerCase()])return J.none();L=G}return so(L)?J.none():s&&L?J.some(Et(L,0)):J.none()},Z2=(e,t,s,a)=>{const d=e.getRoot();let p,v=!1,C=s?a.startContainer:a.endContainer,L=s?a.startOffset:a.endOffset;const G=oo(C)&&L===C.childNodes.length,ee=e.schema.getNonEmptyElements();let te=s;if(Vu(C))return J.none();if(oo(C)&&L>C.childNodes.length-1&&(te=!1),id(C)&&(C=d,L=0),C===d){if(te&&(p=C.childNodes[L>0?L-1:0],p&&(Vu(p)||ee[p.nodeName]||$d(p))))return J.none();if(C.hasChildNodes()){if(L=Math.min(!te&&L>0?L-1:L,C.childNodes.length-1),C=C.childNodes[L],L=rn(C)&&G?C.data.length:0,!t&&C===d.lastChild&&$d(C)||eI(d,C)||Vu(C)||Nh(C))return J.none();if(C.hasChildNodes()&&!$d(C)){p=C;const ie=new bn(C,d);do{if(Ir(p)||Vu(p)){v=!1;break}if(rn(p)&&p.data.length>0){L=te?0:p.data.length,C=p,v=!0;break}if(ee[p.nodeName.toLowerCase()]&&!Ft(p)){L=e.nodeIndex(p),C=p.parentNode,te||L++,v=!0;break}}while(p=te?ie.next():ie.prev())}}}return t&&(rn(C)&&L===0&&My(e,G,t,!0,C).each(ie=>{C=ie.container(),L=ie.offset(),v=!0}),oo(C)&&(p=C.childNodes[L],p||(p=C.childNodes[L-1]),p&&fi(p)&&!QO(p,"A")&&!JO(e,p,!1)&&!JO(e,p,!0)&&My(e,G,t,!0,p).each(ie=>{C=ie.container(),L=ie.offset(),v=!0}))),te&&!t&&rn(C)&&L===C.data.length&&My(e,G,t,!1,C).each(ie=>{C=ie.container(),L=ie.offset(),v=!0}),v&&C?J.some(Et(C,L)):J.none()},rm=(e,t)=>{const s=t.collapsed,a=t.cloneRange(),d=Et.fromRangeStart(t);return Z2(e,s,!0,a).each(p=>{(!s||!Et.isAbove(d,p))&&a.setStart(p.container(),p.offset())}),s||Z2(e,s,!1,a).each(p=>{a.setEnd(p.container(),p.offset())}),s&&a.collapse(!0),Py(t,a)?J.none():J.some(a)},Ny=(e,t)=>e.splitText(t),Fy=e=>{let t=e.startContainer,s=e.startOffset,a=e.endContainer,d=e.endOffset;if(t===a&&rn(t)){if(s>0&&s<t.data.length)if(a=Ny(t,s),t=a.previousSibling,d>s){d=d-s;const p=Ny(a,d).previousSibling;t=a=p,d=p.data.length,s=0}else d=0}else if(rn(t)&&s>0&&s<t.data.length&&(t=Ny(t,s),s=0),rn(a)&&d>0&&d<a.data.length){const p=Ny(a,d).previousSibling;a=p,d=p.data.length}return{startContainer:t,startOffset:s,endContainer:a,endOffset:d}},Og=e=>({walk:(p,v)=>Dy(e,p,v),split:Fy,expand:(p,v={type:"word"})=>{if(v.type==="word"){const C=Dg(e,p,[{inline:"span"}]),L=e.createRng();return L.setStart(C.startContainer,C.startOffset),L.setEnd(C.endContainer,C.endOffset),L}return p},normalize:p=>rm(e,p).fold(vt,v=>(p.setStart(v.startContainer,v.startOffset),p.setEnd(v.endContainer,v.endOffset),!0))});Og.compareRanges=Py,Og.getCaretRangeFromPoint=YO,Og.getSelectedNode=yg,Og.getNode=ba;const q2=((e,t)=>{const s=(C,L)=>{if(!O(L)&&!L.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+L);const G=C.dom;Ha(G)&&(G.style[e]=L+"px")},a=C=>{const L=t(C);if(L<=0||L===null){const G=Vi(C,e);return parseFloat(G)||0}return L},d=a,p=(C,L)=>Kn(L,(G,ee)=>{const te=Vi(C,ee),ie=te===void 0?0:parseInt(te,10);return isNaN(ie)?G:G+ie},0);return{set:s,get:a,getOuter:d,aggregate:p,max:(C,L,G)=>{const ee=p(C,G);return L>ee?L-ee:0}}})("height",e=>{const t=e.dom;return Ui(e)?t.getBoundingClientRect().height:t.offsetHeight}),hb=e=>q2.get(e),tI=()=>M.fromDom(document),nI=(e,t)=>e.view(t).fold(et([]),a=>{const d=e.owner(a),p=nI(e,d);return[a].concat(p)}),OE=(e,t)=>{const s=t.owner(e);return nI(t,s)};var X5=Object.freeze({__proto__:null,view:e=>{var t;return(e.dom===document?J.none():J.from((t=e.dom.defaultView)===null||t===void 0?void 0:t.frameElement)).map(M.fromDom)},owner:e=>ss(e)});const oI=e=>{const t=tI(),s=Yn(t),a=OE(e,X5),d=Kt(e),p=yo(a,(v,C)=>{const L=Kt(C);return{left:v.left+L.left,top:v.top+L.top}},{left:0,top:0});return X(p.left+d.left+s.left,p.top+d.top+s.top)},vp=e=>ls(e)==="textarea",sI=(e,t)=>e.dispatch("ScrollIntoView",t).isDefaultPrevented(),rI=(e,t)=>{e.dispatch("AfterScrollIntoView",t)},iI=(e,t)=>{const s=cr(e);if(s.length===0||vp(e))return{element:e,offset:t};if(t<s.length&&!vp(s[t]))return{element:s[t],offset:0};{const a=s[s.length-1];return vp(a)?{element:e,offset:t}:ls(a)==="img"?{element:a,offset:1}:ti(a)?{element:a,offset:bg(a).length}:{element:a,offset:cr(a).length}}},By=(e,t)=>{const s=We(e),a=hb(e);return{element:e,bottom:s.top+a,height:a,pos:s,cleanup:t}},aI=(e,t)=>{const s=iI(e,t),a=M.fromHtml('<span data-mce-bogus="all" style="display: inline-block;">'+ta+"</span>");return lt(s.element,a),By(a,()=>Xs(a))},lI=e=>By(M.fromDom(e),Fe),cI=(e,t,s,a)=>{dI(e,(d,p)=>uI(e,t,s,a),s)},$y=(e,t,s,a,d)=>{const p={elm:a.element.dom,alignToTop:d};if(sI(e,p))return;const v=Yn(t).top;s(e,t,v,a,d),rI(e,p)},uI=(e,t,s,a)=>{const d=M.fromDom(e.getBody()),p=M.fromDom(e.getDoc());ul(d);const v=aI(M.fromDom(s.startContainer),s.startOffset);$y(e,p,t,v,a),v.cleanup()},IE=(e,t,s,a)=>{const d=M.fromDom(e.getDoc());$y(e,d,s,lI(t),a)},dI=(e,t,s)=>{const a=s.startContainer,d=s.startOffset,p=s.endContainer,v=s.endOffset;t(M.fromDom(a),M.fromDom(p));const C=e.dom.createRng();C.setStart(a,d),C.setEnd(p,v),e.selection.setRng(s)},Hy=(e,t,s,a,d)=>{const p=t.pos;if(a)Co(p.left,p.top,d);else{const v=p.top-s+t.height;Co(-e.getBody().getBoundingClientRect().left,v,d)}},Y2=(e,t,s,a,d,p)=>{const v=a+s,C=d.pos.top,L=d.bottom,G=L-C>=a;C<s?Hy(e,d,a,p!==!1,t):C>v?Hy(e,d,a,G?p!==!1:p===!0,t):L>v&&!G&&Hy(e,d,a,p===!0,t)},Uy=(e,t,s,a,d)=>{const p=vs(t).dom.innerHeight;Y2(e,t,s,p,a,d)},im=(e,t,s,a,d)=>{const p=vs(t).dom.innerHeight;Y2(e,t,s,p,a,d);const v=oI(a.element),C=Vr(window);v.top<C.y?$o(a.element,d!==!1):v.top>C.bottom&&$o(a.element,d===!0)},J5=(e,t,s)=>cI(e,Uy,t,s),X2=(e,t,s)=>IE(e,t,Uy,s),va=(e,t,s)=>cI(e,im,t,s),J2=(e,t,s)=>IE(e,t,im,s),Q2=(e,t,s)=>{(e.inline?X2:J2)(e,t,s)},Kd=(e,t,s)=>{(e.inline?J5:va)(e,t,s)},eD=(e,t=!1)=>e.dom.focus({preventScroll:t}),tD=e=>{const t=bc(e).dom;return e.dom===t.activeElement},mb=(e=tI())=>J.from(e.dom.activeElement).map(M.fromDom),Q5=e=>mb(bc(e)).filter(t=>e.dom.contains(t.dom)),fI=(e,t)=>{const s=ti(t)?bg(t).length:cr(t).length+1;return e>s?s:e<0?0:e},bx=e=>Rg.range(e.start,fI(e.soffset,e.start),e.finish,fI(e.foffset,e.finish)),hI=(e,t)=>!Qp(t.dom)&&(ln(e,t)||gt(e,t)),Ig=e=>t=>hI(e,t.start)&&hI(e,t.finish),e6=e=>e.inline||gs.browser.isFirefox(),Pg=e=>Rg.range(M.fromDom(e.startContainer),e.startOffset,M.fromDom(e.endContainer),e.endOffset),Zd=e=>{const t=e.getSelection();return(!t||t.rangeCount===0?J.none():J.from(t.getRangeAt(0))).map(Pg)},Vy=e=>{const t=vs(e);return Zd(t.dom).filter(Ig(e))},nD=(e,t)=>J.from(t).filter(Ig(e)).map(bx),oD=e=>{const t=document.createRange();try{return t.setStart(e.start.dom,e.soffset),t.setEnd(e.finish.dom,e.foffset),J.some(t)}catch{return J.none()}},PE=e=>{const t=e6(e)?Vy(M.fromDom(e.getBody())):J.none();e.bookmark=t.isSome()?t:e.bookmark},vx=e=>(e.bookmark?e.bookmark:J.none()).bind(s=>nD(M.fromDom(e.getBody()),s)).bind(oD),t6=e=>{vx(e).each(t=>e.selection.setRng(t))},zy={isEditorUIElement:e=>{const t=e.className.toString();return t.indexOf("tox-")!==-1||t.indexOf("mce-")!==-1}},mI=(e,t)=>(O(t)||(t=0),setTimeout(e,t)),sD=(e,t)=>(O(t)||(t=0),setInterval(e,t)),Ku={setEditorTimeout:(e,t,s)=>mI(()=>{e.removed||t()},s),setEditorInterval:(e,t,s)=>{const a=sD(()=>{e.removed?clearInterval(a):t()},s);return a}},pb=e=>e.type==="nodechange"&&e.selectionChange,rD=(e,t)=>{const s=()=>{t.throttle()};js.DOM.bind(document,"mouseup",s),e.on("remove",()=>{js.DOM.unbind(document,"mouseup",s)})},pI=(e,t)=>{e.on("mouseup touchend",s=>{t.throttle()})},n6=(e,t)=>{pI(e,t),e.on("keyup NodeChange AfterSetSelectionRange",s=>{pb(s)||PE(e)})},Gy=e=>{const t=Ym(()=>{PE(e)},0);e.on("init",()=>{e.inline&&rD(e,t),n6(e,t)}),e.on("remove",()=>{t.cancel()})};let xx;const ME=js.DOM,iD=e=>oo(e)&&zy.isEditorUIElement(e),aD=e=>{const t=e.classList;return t!==void 0?t.contains("tox-edit-area")||t.contains("tox-edit-area__iframe")||t.contains("mce-content-body"):!1},Wy=(e,t)=>{const s=DR(e);return ME.getParent(t,d=>iD(d)||(s?e.dom.is(d,s):!1))!==null},NE=e=>{try{const t=bc(M.fromDom(e.getElement()));return mb(t).fold(()=>document.body,s=>s.dom)}catch{return document.body}},o6=(e,t)=>{const s=t.editor;Gy(s);const a=(d,p)=>{if(FR(d)&&d.inline!==!0){const v=M.fromDom(d.getContainer());p(v,"tox-edit-focus")}};s.on("focusin",()=>{const d=e.focusedEditor;aD(NE(s))&&a(s,od),d!==s&&(d&&d.dispatch("blur",{focusedEditor:s}),e.setActive(s),e.focusedEditor=s,s.dispatch("focus",{blurredEditor:d}),s.focus(!0))}),s.on("focusout",()=>{Ku.setEditorTimeout(s,()=>{const d=e.focusedEditor;(!aD(NE(s))||d!==s)&&a(s,nu),!Wy(s,NE(s))&&d===s&&(s.dispatch("blur",{focusedEditor:null}),e.focusedEditor=null)})}),xx||(xx=d=>{const p=e.activeEditor;p&&Rr(d).each(v=>{const C=v;C.ownerDocument===document&&C!==document.body&&!Wy(p,C)&&e.focusedEditor===p&&(p.dispatch("blur",{focusedEditor:null}),e.focusedEditor=null)})},ME.bind(document,"focusin",xx))},s6=(e,t)=>{e.focusedEditor===t.editor&&(e.focusedEditor=null),!e.activeEditor&&xx&&(ME.unbind(document,"focusin",xx),xx=null)},r6=e=>{e.on("AddEditor",it(o6,e)),e.on("RemoveEditor",it(s6,e))},i6=(e,t)=>e.dom.getParent(t,s=>e.dom.getContentEditable(s)==="true"),a6=e=>e.collapsed?J.from(ba(e.startContainer,e.startOffset)).map(M.fromDom):J.none(),l6=(e,t)=>a6(t).bind(s=>j1(s)?J.some(s):ln(e,s)?J.none():J.some(e)),gI=(e,t)=>{l6(M.fromDom(e.getBody()),t).bind(s=>Mo(s.dom)).fold(()=>{e.selection.normalize()},s=>e.selection.setRng(s.toRange()))},lD=e=>{if(e.setActive)try{e.setActive()}catch{e.focus()}else e.focus()},c6=e=>tD(e)||Q5(e).isSome(),u6=e=>ve(e.iframeElement)&&tD(M.fromDom(e.iframeElement)),d6=e=>{const t=e.getBody();return t&&c6(M.fromDom(t))},bI=e=>{const t=bc(M.fromDom(e.getElement()));return mb(t).filter(s=>!aD(s.dom)&&Wy(e,s.dom)).isSome()},gb=e=>e.inline?d6(e):u6(e),bb=e=>gb(e)||bI(e),f6=e=>{const t=e.selection,s=e.getBody();let a=t.getRng();e.quirks.refreshContentEditable(),ve(e.bookmark)&&!gb(e)&&vx(e).each(p=>{e.selection.setRng(p),a=p});const d=i6(e,t.getNode());if(d&&e.dom.isChildOf(d,s)){lD(d),gI(e,a),cD(e);return}e.inline||(gs.browser.isOpera()||lD(s),e.getWin().focus()),(gs.browser.isFirefox()||e.inline)&&(lD(s),gI(e,a)),cD(e)},cD=e=>e.editorManager.setActive(e),vI=(e,t)=>{e.removed||(t?cD(e):f6(e))},xI=(e,t)=>t.collapsed?e.isEditable(t.startContainer):e.isEditable(t.startContainer)&&e.isEditable(t.endContainer),yI=(e,t,s,a,d)=>{const p=s?t.startContainer:t.endContainer,v=s?t.startOffset:t.endOffset;return J.from(p).map(M.fromDom).map(C=>!a||!t.collapsed?el(C,d(C,v)).getOr(C):C).bind(C=>ll(C)?J.some(C):_s(C).filter(ll)).map(C=>C.dom).getOr(e)},wI=(e,t,s=!1)=>yI(e,t,!0,s,(a,d)=>Math.min(Sa(a),d)),SI=(e,t,s=!1)=>yI(e,t,!1,s,(a,d)=>d>0?d-1:d),EI=(e,t)=>{const s=e;for(;e&&rn(e)&&e.length===0;)e=t?e.nextSibling:e.previousSibling;return e||s},h6=(e,t)=>{if(!t)return e;let s=t.startContainer,a=t.endContainer;const d=t.startOffset,p=t.endOffset;let v=t.commonAncestorContainer;t.collapsed||(s===a&&p-d<2&&s.hasChildNodes()&&(v=s.childNodes[d]),rn(s)&&rn(a)&&(s.length===d?s=EI(s.nextSibling,!0):s=s.parentNode,p===0?a=EI(a.previousSibling,!1):a=a.parentNode,s&&s===a&&(v=s)));const C=rn(v)?v.parentNode:v;return lu(C)?C:e},uD=(e,t,s,a)=>{const d=[],p=e.getRoot(),v=e.getParent(s||wI(p,t,t.collapsed),e.isBlock),C=e.getParent(a||SI(p,t,t.collapsed),e.isBlock);if(v&&v!==p&&d.push(v),v&&C&&v!==C){let L;const G=new bn(v,p);for(;(L=G.next())&&L!==C;)e.isBlock(L)&&d.push(L)}return C&&v!==C&&C!==p&&d.push(C),d},jy=(e,t,s)=>J.from(t).bind(a=>J.from(a.parentNode).map(d=>{const p=e.nodeIndex(a),v=e.createRng();return v.setStart(d,p),v.setEnd(d,p+1),s&&(wy(e,v,a,!0),wy(e,v,a,!1)),v})),FE=(e,t)=>$t(t,s=>{const a=e.dispatch("GetSelectionRange",{range:s});return a.range!==s?a.range:s}),m6={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11},vb=(e,t,s)=>{const a=s?"lastChild":"firstChild",d=s?"prev":"next";if(e[a])return e[a];if(e!==t){let p=e[d];if(p)return p;for(let v=e.parent;v&&v!==t;v=v.parent)if(p=v[d],p)return p}},CI=e=>{var t;const s=(t=e.value)!==null&&t!==void 0?t:"";if(!pr(s))return!1;const a=e.parent;return!(a&&(a.name!=="span"||a.attr("style"))&&/^[ ]+$/.test(s))},Ia=e=>{const t=e.name==="a"&&!e.attr("href")&&e.attr("id");return e.attr("name")||e.attr("id")&&!e.firstChild||e.attr("data-mce-bookmark")||t};class vl{static create(t,s){const a=new vl(t,m6[t]||1);return s&&qo(s,(d,p)=>{a.attr(p,d)}),a}constructor(t,s){this.name=t,this.type=s,s===1&&(this.attributes=[],this.attributes.map={})}replace(t){const s=this;return t.parent&&t.remove(),s.insert(t,s),s.remove(),s}attr(t,s){const a=this;if(!re(t))return ve(t)&&qo(t,(p,v)=>{a.attr(v,p)}),a;const d=a.attributes;if(d){if(s!==void 0){if(s===null){if(t in d.map){delete d.map[t];let p=d.length;for(;p--;)if(d[p].name===t)return d.splice(p,1),a}return a}if(t in d.map){let p=d.length;for(;p--;)if(d[p].name===t){d[p].value=s;break}}else d.push({name:t,value:s});return d.map[t]=s,a}return d.map[t]}}clone(){const t=this,s=new vl(t.name,t.type),a=t.attributes;if(a){const d=[];d.map={};for(let p=0,v=a.length;p<v;p++){const C=a[p];C.name!=="id"&&(d[d.length]={name:C.name,value:C.value},d.map[C.name]=C.value)}s.attributes=d}return s.value=t.value,s}wrap(t){const s=this;return s.parent&&(s.parent.insert(t,s),t.append(s)),s}unwrap(){const t=this;for(let s=t.firstChild;s;){const a=s.next;t.insert(s,t,!0),s=a}t.remove()}remove(){const t=this,s=t.parent,a=t.next,d=t.prev;return s&&(s.firstChild===t?(s.firstChild=a,a&&(a.prev=null)):d&&(d.next=a),s.lastChild===t?(s.lastChild=d,d&&(d.next=null)):a&&(a.prev=d),t.parent=t.next=t.prev=null),t}append(t){const s=this;t.parent&&t.remove();const a=s.lastChild;return a?(a.next=t,t.prev=a,s.lastChild=t):s.lastChild=s.firstChild=t,t.parent=s,t}insert(t,s,a){t.parent&&t.remove();const d=s.parent||this;return a?(s===d.firstChild?d.firstChild=t:s.prev&&(s.prev.next=t),t.prev=s.prev,t.next=s,s.prev=t):(s===d.lastChild?d.lastChild=t:s.next&&(s.next.prev=t),t.next=s.next,t.prev=s,s.next=t),t.parent=d,t}getAll(t){const s=this,a=[];for(let d=s.firstChild;d;d=vb(d,s))d.name===t&&a.push(d);return a}children(){const t=this,s=[];for(let a=t.firstChild;a;a=a.next)s.push(a);return s}empty(){const t=this;if(t.firstChild){const s=[];for(let d=t.firstChild;d;d=vb(d,t))s.push(d);let a=s.length;for(;a--;){const d=s[a];d.parent=d.firstChild=d.lastChild=d.next=d.prev=null}}return t.firstChild=t.lastChild=null,t}isEmpty(t,s={},a){var d;const p=this;let v=p.firstChild;if(Ia(p))return!1;if(v)do{if(v.type===1){if(v.attr("data-mce-bogus"))continue;if(t[v.name]||Ia(v))return!1}if(v.type===8||v.type===3&&!CI(v)||v.type===3&&v.parent&&s[v.parent.name]&&pr((d=v.value)!==null&&d!==void 0?d:"")||a&&a(v))return!1}while(v=vb(v,p));return!0}walk(t){return vb(this,null,t)}}const _I=hn.makeMap("NOSCRIPT STYLE SCRIPT XMP IFRAME NOEMBED NOFRAMES PLAINTEXT"," "),BE=e=>re(e.nodeValue)&&e.nodeValue.includes(ta),Ky=e=>`${e.length===0?"":`${$t(e,t=>`[${t}]`).join(",")},`}[data-mce-bogus="all"]`,Mg=(e,t)=>t.querySelectorAll(Ky(e)),xp=e=>document.createTreeWalker(e,NodeFilter.SHOW_COMMENT,t=>BE(t)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP),TI=e=>document.createTreeWalker(e,NodeFilter.SHOW_TEXT,t=>{if(BE(t)){const s=t.parentNode;return s&&yn(_I,s.nodeName)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}else return NodeFilter.FILTER_SKIP}),p6=e=>xp(e).nextNode()!==null,yx=e=>TI(e).nextNode()!==null,wx=(e,t)=>t.querySelector(Ky(e))!==null,Sx=(e,t)=>{xe(Mg(e,t),s=>{const a=M.fromDom(s);Oa(a,"data-mce-bogus")==="all"?Xs(a):xe(e,d=>{dc(a,d)&&Xi(a,d)})})},$E=e=>{let t=e.nextNode();for(;t!==null;)t.nodeValue=null,t=e.nextNode()},dD=st($E,xp),DI=st($E,TI),fD=(e,t)=>{const s=[{condition:it(wx,t),action:it(Sx,t)},{condition:p6,action:dD},{condition:yx,action:DI}];let a=e,d=!1;return xe(s,({condition:p,action:v})=>{p(a)&&(d||(a=e.cloneNode(!0),d=!0),v(a))}),a},kI=e=>{const t=$e(e,"[data-mce-bogus]");xe(t,s=>{Oa(s,"data-mce-bogus")==="all"?Xs(s):Vd(s)?(lt(s,M.fromText(Jo)),Xs(s)):di(s)})},AI=e=>{const t=$e(e,"input");xe(t,s=>{Xi(s,"name")})},LI=(e,t)=>{const s=Wl(e),a=new RegExp(`^(<${s}[^>]*>(&nbsp;|&#160;|\\s| |<br \\/>|)<\\/${s}>[\r
]*|<br \\/>[\r
]*)$`);return t.replace(a,"")},RI=(e,t)=>{const s=e.getDoc(),a=bc(M.fromDom(e.getBody())),d=M.fromTag("div",s);$s(d,"data-mce-bogus","all"),ma(d,{position:"fixed",left:"-9999999px",top:"0"}),zc(d,t.innerHTML),kI(d),AI(d);const p=Du(a);rr(p,d);const v=Ta(d.dom.innerText);return Xs(d),v},Zy=(e,t,s)=>{let a;return t.format==="raw"?a=hn.trim(Ta(fD(s,e.serializer.getTempAttrs()).innerHTML)):t.format==="text"?a=RI(e,s):t.format==="tree"?a=e.serializer.serialize(s,t):a=LI(e,e.serializer.serialize(s,t)),t.format!=="text"&&!vg(M.fromDom(s))&&re(a)?hn.trim(a):a},OI=(e,t)=>J.from(e.getBody()).fold(et(t.format==="tree"?new vl("body",11):""),s=>Zy(e,t,s)),hD=hn.makeMap,mD=e=>{const t=[];e=e||{};const s=e.indent,a=hD(e.indent_before||""),d=hD(e.indent_after||""),p=Hh.getEncodeFunc(e.entity_encoding||"raw",e.entities),v=e.element_format!=="xhtml";return{start:(C,L,G)=>{if(s&&a[C]&&t.length>0){const ee=t[t.length-1];ee.length>0&&ee!==`
`&&t.push(`
`)}if(t.push("<",C),L)for(let ee=0,te=L.length;ee<te;ee++){const ie=L[ee];t.push(" ",ie.name,'="',p(ie.value,!0),'"')}if(!G||v?t[t.length]=">":t[t.length]=" />",G&&s&&d[C]&&t.length>0){const ee=t[t.length-1];ee.length>0&&ee!==`
`&&t.push(`
`)}},end:C=>{let L;t.push("</",C,">"),s&&d[C]&&t.length>0&&(L=t[t.length-1],L.length>0&&L!==`
`&&t.push(`
`))},text:(C,L)=>{C.length>0&&(t[t.length]=L?C:p(C))},cdata:C=>{t.push("<![CDATA[",C,"]]>")},comment:C=>{t.push("<!--",C,"-->")},pi:(C,L)=>{L?t.push("<?",C," ",p(L),"?>"):t.push("<?",C,"?>"),s&&t.push(`
`)},doctype:C=>{t.push("<!DOCTYPE",C,">",s?`
`:"")},reset:()=>{t.length=0},getContent:()=>t.join("").replace(/\n$/,"")}},yp=(e={},t=Vh())=>{const s=mD(e);return e.validate="validate"in e?e.validate:!0,{serialize:d=>{const p=e.validate,v={3:L=>{var G;s.text((G=L.value)!==null&&G!==void 0?G:"",L.raw)},8:L=>{var G;s.comment((G=L.value)!==null&&G!==void 0?G:"")},7:L=>{s.pi(L.name,L.value)},10:L=>{var G;s.doctype((G=L.value)!==null&&G!==void 0?G:"")},4:L=>{var G;s.cdata((G=L.value)!==null&&G!==void 0?G:"")},11:L=>{let G=L;if(G=G.firstChild)do C(G);while(G=G.next)}};s.reset();const C=L=>{var G;const ee=v[L.type];if(ee)ee(L);else{const te=L.name,ie=te in t.getVoidElements();let ye=L.attributes;if(p&&ye&&ye.length>1){const Re=[];Re.map={};const Se=t.getElementRule(L.name);if(Se){for(let Pe=0,Je=Se.attributesOrder.length;Pe<Je;Pe++){const nt=Se.attributesOrder[Pe];if(nt in ye.map){const rt=ye.map[nt];Re.map[nt]=rt,Re.push({name:nt,value:rt})}}for(let Pe=0,Je=ye.length;Pe<Je;Pe++){const nt=ye[Pe].name;if(!(nt in Re.map)){const rt=ye.map[nt];Re.map[nt]=rt,Re.push({name:nt,value:rt})}}ye=Re}}if(s.start(te,ye,ie),Mi(te))re(L.value)&&s.text(L.value,!0),s.end(te);else if(!ie){let Re=L.firstChild;if(Re){(te==="pre"||te==="textarea")&&Re.type===3&&((G=Re.value)===null||G===void 0?void 0:G[0])===`
`&&s.text(`
`,!0);do C(Re);while(Re=Re.next)}s.end(te)}}};return d.type===1&&!e.inner?C(d):d.type===3?v[3](d):v[11](d),s.getContent()}}},pD=new Set;xe(["margin","margin-left","margin-right","margin-top","margin-bottom","padding","padding-left","padding-right","padding-top","padding-bottom","border","border-width","border-style","border-color","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","float","position","left","right","top","bottom","z-index","display","transform","width","max-width","min-width","height","max-height","min-height","overflow","overflow-x","overflow-y","text-overflow","vertical-align","transition","transition-delay","transition-duration","transition-property","transition-timing-function"],t=>{pD.add(t)});const gD=["font","text-decoration","text-emphasis"],HE=(e,t)=>Yt(e.parseStyle(e.getAttrib(t,"style"))),II=e=>pD.has(e),PI=(e,t)=>jo(HE(e,t),s=>!II(s)),bD=e=>Ct(e,t=>mo(gD,s=>qs(t,s))),qy=(e,t,s)=>{const a=HE(e,t),d=HE(e,s),p=v=>{var C,L;const G=(C=e.getStyle(t,v))!==null&&C!==void 0?C:"",ee=(L=e.getStyle(s,v))!==null&&L!==void 0?L:"";return vi(G)&&vi(ee)&&G!==ee};return mo(a,v=>{const C=L=>mo(L,G=>G===v);if(!C(d)&&C(gD)){const L=bD(d);return mo(L,p)}else return p(v)})},vD=(e,t,s)=>J.from(s.container()).filter(rn).exists(a=>{const d=e?0:-1;return t(a.data.charAt(s.offset()+d))}),UE=it(vD,!0,ux),Ex=it(vD,!1,ux),g6=e=>{const t=e.container();return rn(t)&&(t.data.length===0||$v(t.data)&&Mr.isBookmarkNode(t.parentNode))},Ng=(e,t)=>s=>oE(e?0:-1,s).filter(t).isSome(),Fg=e=>ad(e)&&Vi(M.fromDom(e),"display")==="block",VE=e=>Ir(e)&&!p1(e),MI=Ng(!0,Fg),Yy=Ng(!1,Fg),Cx=Ng(!0,Lu),xb=Ng(!1,Lu),xD=Ng(!0,$d),yD=Ng(!1,$d),am=Ng(!0,VE),wp=Ng(!1,VE),b6=e=>e.slice(0,-1),zE=(e,t,s)=>ln(t,e)?b6(Sl(e,a=>s(a)||gt(a,t))):[],rc=(e,t)=>zE(e,t,vt),kf=(e,t)=>[e].concat(rc(e,t)),Sp=(e,t,s)=>uO(e,t,s,g6),NI=e=>t=>e.isBlock(ls(t)),hu=(e,t,s)=>Qt(kf(M.fromDom(t.container()),e),NI(s)),Bg=(e,t,s,a)=>Sp(e,t.dom,s).forall(d=>hu(t,s,a).fold(()=>!tm(d,s,t.dom),p=>!tm(d,s,t.dom)&&ln(p,M.fromDom(d.container())))),wD=(e,t,s,a)=>hu(t,s,a).fold(()=>Sp(e,t.dom,s).forall(d=>!tm(d,s,t.dom)),d=>Sp(e,d.dom,s).isNone()),GE=it(wD,!1),SD=it(wD,!0),Xy=it(Bg,!1),ED=it(Bg,!0),FI=e=>sE(e).exists(Vd),WE=(e,t,s,a)=>{const d=Ct(kf(M.fromDom(s.container()),t),v=>a.isBlock(ls(v))),p=At(d).getOr(t);return hd(e,p.dom,s).filter(FI)},Jy=(e,t,s)=>sE(t).exists(Vd)||WE(!0,e,t,s).isSome(),Qy=(e,t,s)=>x5(t).exists(Vd)||WE(!1,e,t,s).isSome(),v6=it(WE,!1),lm=it(WE,!0),jE=e=>Et.isTextPosition(e)&&!e.isAtStart()&&!e.isAtEnd(),ew=(e,t,s)=>{const a=Ct(kf(M.fromDom(t.container()),e),d=>s.isBlock(ls(d)));return At(a).getOr(e)},KE=(e,t,s)=>jE(t)?Ex(t):Ex(t)||Wu(ew(e,t,s).dom,t).exists(Ex),CD=(e,t,s)=>jE(t)?UE(t):UE(t)||Kc(ew(e,t,s).dom,t).exists(UE),BI=e=>to(["pre","pre-wrap"],e),ZE=e=>sE(e).bind(t=>El(t,ll)).exists(t=>BI(Vi(t,"white-space"))),x6=(e,t)=>Wu(e.dom,t).isNone(),y6=(e,t)=>Kc(e.dom,t).isNone(),$I=(e,t,s)=>x6(e,t)||y6(e,t)||GE(e,t,s)||SD(e,t,s)||Qy(e,t,s)||Jy(e,t,s),HI=e=>ve(e)&&Ir(e)&&v2(e),qE=(e,t)=>s=>HI(new bn(s,e)[t]()),_D=(e,t)=>{const s=Kc(e.dom,t).getOr(t),a=qE(e.dom,"next");return t.isAtEnd()&&(a(t.container())||a(s.container()))},UI=(e,t)=>{const s=Wu(e.dom,t).getOr(t),a=qE(e.dom,"prev");return t.isAtStart()&&(a(t.container())||a(s.container()))},YE=(e,t,s)=>ZE(t)?!1:$I(e,t,s)||KE(e,t,s)||CD(e,t,s),_x=(e,t,s)=>ZE(t)?!1:GE(e,t,s)||Xy(e,t,s)||Qy(e,t,s)||KE(e,t,s)||UI(e,t),VI=e=>{const t=e.container(),s=e.offset();return rn(t)&&s<t.data.length?Et(t,s+1):e},yb=(e,t,s)=>ZE(t)?!1:SD(e,t,s)||ED(e,t,s)||Jy(e,t,s)||CD(e,t,s)||_D(e,t),XE=(e,t,s)=>_x(e,t,s)||yb(e,VI(t),s),TD=(e,t)=>jl(e.charAt(t)),DD=(e,t)=>ux(e.charAt(t)),kD=e=>{const t=e.container();return rn(t)&&xr(t.data,Vo)},w6=e=>{const t=e.split("");return $t(t,(s,a)=>jl(s)&&a>0&&a<t.length-1&&mp(t[a-1])&&mp(t[a+1])?" ":s).join("")},tw=(e,t,s,a)=>{const d=t.data,p=Et(t,0);return!s&&TD(d,0)&&!XE(e,p,a)?(t.data=" "+d.slice(1),!0):s&&DD(d,0)&&_x(e,p,a)?(t.data=Vo+d.slice(1),!0):!1},zI=e=>{const t=e.data,s=w6(t);return s!==t?(e.data=s,!0):!1},AD=(e,t,s,a)=>{const d=t.data,p=Et(t,d.length-1);return!s&&TD(d,d.length-1)&&!XE(e,p,a)?(t.data=d.slice(0,-1)+" ",!0):s&&DD(d,d.length-1)&&yb(e,p,a)?(t.data=d.slice(0,-1)+Vo,!0):!1},S6=(e,t,s)=>{const a=t.container();if(!rn(a))return J.none();if(kD(t)){const d=tw(e,a,!1,s)||zI(a)||AD(e,a,!1,s);return cf(d,t)}else if(XE(e,t,s)){const d=tw(e,a,!0,s)||AD(e,a,!0,s);return cf(d,t)}else return J.none()},E6=e=>{const t=M.fromDom(e.getBody());e.selection.isCollapsed()&&S6(t,Et.fromRangeStart(e.selection.getRng()),e.schema).each(s=>{e.selection.setRng(s.toRange())})},LD=(e,t,s,a)=>{if(s===0)return;const d=M.fromDom(e),p=Kr(d,G=>a.isBlock(ls(G))).getOr(d),v=e.data.slice(t,t+s),C=t+s>=e.data.length&&yb(p,Et(e,e.data.length),a),L=t===0&&_x(p,Et(e,0),a);e.replaceData(t,s,cv(v,4,L,C))},JE=(e,t,s)=>{const a=e.data.slice(t),d=a.length-La(a).length;LD(e,t,d,s)},QE=(e,t,s)=>{const a=e.data.slice(0,t),d=a.length-Na(a).length;LD(e,t-d,d,s)},RD=(e,t,s,a,d=!0)=>{const p=Na(e.data).length,v=d?e:t,C=d?t:e;return d?v.appendData(C.data):v.insertData(0,C.data),Xs(M.fromDom(C)),a&&JE(v,p,s),v},C6=(e,t)=>{const s=e.container(),a=e.offset();return!Et.isTextPosition(e)&&s===t.parentNode&&a>Et.before(t).offset()},_6=(e,t)=>C6(t,e)?Et(t.container(),t.offset()-1):t,ji=e=>rn(e)?Et(e,0):Et.before(e),OD=e=>rn(e)?Et(e,e.data.length):Et.after(e),GI=e=>cd(e.previousSibling)?J.some(OD(e.previousSibling)):e.previousSibling?Wd(e.previousSibling):J.none(),WI=e=>cd(e.nextSibling)?J.some(ji(e.nextSibling)):e.nextSibling?Mo(e.nextSibling):J.none(),Tx=(e,t)=>J.from(t.previousSibling?t.previousSibling:t.parentNode).bind(s=>Wu(e,Et.before(s))).orThunk(()=>Kc(e,Et.after(t))),$g=(e,t)=>Kc(e,Et.after(t)).orThunk(()=>Wu(e,Et.before(t))),Ep=(e,t)=>GI(t).orThunk(()=>WI(t)).orThunk(()=>Tx(e,t)),jI=(e,t)=>WI(t).orThunk(()=>GI(t)).orThunk(()=>$g(e,t)),KI=(e,t,s)=>e?jI(t,s):Ep(t,s),ZI=(e,t,s)=>KI(e,t,s).map(it(_6,s)),nw=(e,t,s)=>{s.fold(()=>{e.focus()},a=>{e.selection.setRng(a.toRange(),t)})},T6=e=>t=>t.dom===e,ID=(e,t)=>t&&yn(e.schema.getBlockElements(),ls(t)),qI=(e,t,s)=>{if(fl(e,t)){const a=M.fromHtml('<br data-mce-bogus="1">');return s?xe(cr(t),d=>{pE(d)||Xs(d)}):Ua(t),rr(t,a),J.some(Et.before(a.dom))}else return J.none()},YI=(e,t,s,a)=>{const d=Vs(e).filter(ti),p=xs(e).filter(ti);return Xs(e),Oh(d,p,t,(v,C,L)=>{const G=v.dom,ee=C.dom,te=G.data.length;return RD(G,ee,s,a),L.container()===ee?Et(G,te):L}).orThunk(()=>(a&&(d.each(v=>QE(v.dom,v.dom.length,s)),p.each(v=>JE(v.dom,0,s))),t))},PD=(e,t)=>yn(e.schema.getTextInlineElements(),ls(t)),Hg=(e,t,s,a=!0,d=!1)=>{const p=ZI(t,e.getBody(),s.dom),v=Kr(s,it(ID,e),T6(e.getBody())),C=YI(s,p,e.schema,PD(e,s));e.dom.isEmpty(e.getBody())?(e.setContent(""),e.selection.setCursorLocation()):v.bind(L=>qI(e.schema,L,d)).fold(()=>{a&&nw(e,t,C)},L=>{a&&nw(e,t,J.some(L))})},MD=/[\u0591-\u07FF\uFB1D-\uFDFF\uFE70-\uFEFC]/,D6=e=>MD.test(e),wb=(e,t)=>Ve(M.fromDom(t),Os(e))&&!Bh(e.schema,t)&&e.dom.isEditable(t),xd=e=>{var t;return js.DOM.getStyle(e,"direction",!0)==="rtl"||D6((t=e.textContent)!==null&&t!==void 0?t:"")},XI=(e,t,s)=>Ct(js.DOM.getParents(s.container(),"*",t),e),Ug=(e,t,s)=>{const a=XI(e,t,s);return J.from(a[a.length-1])},k6=(e,t,s)=>{const a=Eg(t,e),d=Eg(s,e);return ve(a)&&a===d},eC=e=>W0(e)||op(e),qd=(e,t)=>{const s=t.container(),a=t.offset();return e?Xf(s)?rn(s.nextSibling)?Et(s.nextSibling,0):Et.after(s):W0(t)?Et(s,a+1):t:Xf(s)?rn(s.previousSibling)?Et(s.previousSibling,s.previousSibling.data.length):Et.before(s):op(t)?Et(s,a-1):t},JI=it(qd,!0),ND=it(qd,!1),tC=(e,t)=>{const s=a=>a.stopImmediatePropagation();e.on("beforeinput input",s,!0),e.getDoc().execCommand(t),e.off("beforeinput input",s)},A6=e=>{e.execCommand("delete")},FD=e=>tC(e,"Delete"),ow=e=>tC(e,"ForwardDelete"),QI=e=>t=>Rd(_s(t),e,gt),eP=e=>Kh(e)||yf(e),nC=(e,t)=>ln(e,t)?El(t,eP,QI(e)):J.none(),oC=(e,t=!0)=>{e.dom.isEmpty(e.getBody())&&e.setContent("",{no_selection:!t})},Dx=(e,t,s)=>wa(Mo(s),Wd(s),(a,d)=>{const p=qd(!0,a),v=qd(!1,d),C=qd(!1,t);return e?Kc(s,C).exists(L=>L.isEqual(v)&&t.isEqual(p)):Wu(s,C).exists(L=>L.isEqual(p)&&t.isEqual(v))}).getOr(!0),BD=e=>(Tu(e)?Vs(e):ou(e)).bind(BD).orThunk(()=>J.some(e)),$D=(e,t,s,a=!0)=>{var d;t.deleteContents();const p=BD(s).getOr(s),v=M.fromDom((d=e.dom.getParent(p.dom,e.dom.isBlock))!==null&&d!==void 0?d:s.dom);if(v.dom===e.getBody()?oC(e,a):fl(e.schema,v,{checkRootAsContent:!1})&&(Hu(v),a&&e.selection.setCursorLocation(v.dom,0)),!gt(s,v)){const C=Rd(_s(v),s)?[]:ns(v);xe(C.concat(cr(s)),L=>{!gt(L,v)&&!ln(L,v)&&fl(e.schema,L)&&Xs(L)})}},tP=e=>t=>gt(e,t),HD=e=>$e(e,"td,th"),Af=(e,t)=>gr(M.fromDom(e),t),UD=e=>wa(e.startTable,e.endTable,(t,s)=>{const a=Wo(t,p=>gt(p,s)),d=Wo(s,p=>gt(p,t));return!a&&!d?e:{...e,startTable:a?J.none():e.startTable,endTable:d?J.none():e.endTable,isSameTable:!1,isMultiTable:!1}}).getOr(e),L6=e=>UD(e),R6=(e,t)=>{const s=Af(e.startContainer,t),a=Af(e.endContainer,t),d=s.isSome(),p=a.isSome(),v=wa(s,a,gt).getOr(!1);return L6({startTable:s,endTable:a,isStartInTable:d,isEndInTable:p,isSameTable:v,isMultiTable:!v&&d&&p})},sr=(e,t)=>({start:e,end:t}),O6=(e,t,s)=>({rng:e,table:t,cells:s}),Cp=Oo.generate([{singleCellTable:["rng","cell"]},{fullTable:["table"]},{partialTable:["cells","outsideDetails"]},{multiTable:["startTableCells","endTableCells","betweenRng"]}]),sC=(e,t)=>iu(M.fromDom(e),"td,th",t),VD=e=>!gt(e.start,e.end),_p=(e,t)=>gr(e.start,t).bind(s=>gr(e.end,t).bind(a=>cf(gt(s,a),s))),Zu=(e,t)=>!VD(e)&&_p(e,t).exists(s=>{const a=s.dom.rows;return a.length===1&&a[0].cells.length===1}),sw=(e,t)=>{const s=sC(e.startContainer,t),a=sC(e.endContainer,t);return wa(s,a,sr)},Vg=e=>t=>gr(t,e).bind(s=>On(HD(s)).map(a=>sr(t,a))),cm=e=>t=>gr(t,e).bind(s=>At(HD(s)).map(a=>sr(a,t))),Sb=e=>t=>_p(t,e).map(s=>O6(t,s,HD(s))),rC=(e,t,s,a)=>{if(s.collapsed||!e.forall(VD))return J.none();if(t.isSameTable){const d=e.bind(Sb(a));return J.some({start:d,end:d})}else{const d=sC(s.startContainer,a),p=sC(s.endContainer,a),v=d.bind(Vg(a)).bind(Sb(a)),C=p.bind(cm(a)).bind(Sb(a));return J.some({start:v,end:C})}},iC=(e,t)=>Cn(e,s=>gt(s,t)),aC=e=>wa(iC(e.cells,e.rng.start),iC(e.cells,e.rng.end),(t,s)=>e.cells.slice(t,s+1)),nP=(e,t,s)=>e.exists(a=>Zu(a,s)&&yy(a.start,t)),oP=(e,t)=>{const{startTable:s,endTable:a}=t,d=e.cloneRange();return s.each(p=>d.setStartAfter(p.dom)),a.each(p=>d.setEndBefore(p.dom)),d},I6=(e,t,s,a)=>rC(e,t,s,a).bind(({start:d,end:p})=>d.or(p)).bind(d=>{const{isSameTable:p}=t,v=aC(d).getOr([]);if(p&&d.cells.length===v.length)return J.some(Cp.fullTable(d.table));if(v.length>0){if(p)return J.some(Cp.partialTable(v,J.none()));{const C=oP(s,t);return J.some(Cp.partialTable(v,J.some({...t,rng:C})))}}else return J.none()}),sP=(e,t,s,a)=>rC(e,t,s,a).bind(({start:d,end:p})=>{const v=d.bind(aC).getOr([]),C=p.bind(aC).getOr([]);if(v.length>0&&C.length>0){const L=oP(s,t);return J.some(Cp.multiTable(v,C,L))}else return J.none()}),rP=(e,t)=>{const s=tP(e),a=sw(t,s),d=R6(t,s);return nP(a,t,s)?a.map(p=>Cp.singleCellTable(t,p.start)):d.isMultiTable?sP(a,d,t,s):I6(a,d,t,s)},zD=e=>xe(e,t=>{Xi(t,"contenteditable"),Hu(t)}),iP=(e,t)=>J.from(e.dom.getParent(t,e.dom.isBlock)).map(M.fromDom),GD=(e,t,s)=>{s.each(a=>{t?Xs(a):(Hu(a),e.selection.setCursorLocation(a.dom,0))})},WD=(e,t,s,a)=>{const d=s.cloneRange();a?(d.setStart(s.startContainer,s.startOffset),d.setEndAfter(t.dom.lastChild)):(d.setStartBefore(t.dom.firstChild),d.setEnd(s.endContainer,s.endOffset)),Eb(e,d,t,!1).each(p=>p())},aP=e=>{const t=sh(e),s=M.fromDom(e.selection.getNode());og(s.dom)&&fl(e.schema,s)?e.selection.setCursorLocation(s.dom,0):e.selection.collapse(!0),t.length>1&&mo(t,a=>gt(a,s))&&$s(s,"data-mce-selected","1")},lP=(e,t,s)=>J.some(()=>{const a=e.selection.getRng(),d=s.bind(({rng:p,isStartInTable:v})=>{const C=iP(e,v?p.endContainer:p.startContainer);p.deleteContents(),GD(e,v,C.filter(it(fl,e.schema)));const L=v?t[0]:t[t.length-1];return WD(e,L,a,v),fl(e.schema,L)?J.none():J.some(v?t.slice(1):t.slice(0,-1))}).getOr(t);zD(d),aP(e)}),um=(e,t,s,a)=>J.some(()=>{const d=e.selection.getRng(),p=t[0],v=s[s.length-1];WD(e,p,d,!0),WD(e,v,d,!1);const C=fl(e.schema,p)?t:t.slice(1),L=fl(e.schema,v)?s:s.slice(0,-1);zD(C.concat(L)),a.deleteContents(),aP(e)}),Eb=(e,t,s,a=!0)=>J.some(()=>{$D(e,t,s,a)}),cP=(e,t)=>J.some(()=>Hg(e,!1,t)),uP=(e,t,s)=>rP(t,s).bind(a=>a.fold(it(Eb,e),it(cP,e),it(lP,e),it(um,e))),dP=(e,t)=>lC(e,t),P6=(e,t,s,a)=>jD(t,a).fold(()=>uP(e,t,s),d=>dP(e,d)),zg=(e,t,s)=>{const a=M.fromDom(e.getBody()),d=e.selection.getRng();return s.length!==0?lP(e,s,J.none()):P6(e,a,d,t)},fP=(e,t)=>Qt(kf(t,e),zd),jD=(e,t)=>Qt(kf(t,e),ci("caption")),M6=(e,t,s,a,d)=>ab(s,e.getBody(),d).bind(p=>fP(t,M.fromDom(p.getNode())).bind(v=>gt(v,a)?J.none():J.some(Fe))),lC=(e,t)=>J.some(()=>{Hu(t),e.selection.setCursorLocation(t.dom,0)}),N6=(e,t,s,a)=>Mo(e.dom).bind(d=>Wd(e.dom).map(p=>t?s.isEqual(d)&&a.isEqual(p):s.isEqual(p)&&a.isEqual(d))).getOr(!0),F6=(e,t)=>lC(e,t),B6=(e,t,s)=>jD(e,M.fromDom(s.getNode())).fold(()=>J.some(Fe),a=>cf(!gt(a,t),Fe)),$6=(e,t,s,a,d)=>ab(s,e.getBody(),d).fold(()=>J.some(Fe),p=>N6(a,s,d,p)?F6(e,a):B6(t,a,p)),H6=(e,t,s,a)=>{const d=Et.fromRangeStart(e.selection.getRng());return fP(s,a).bind(p=>fl(e.schema,p,{checkRootAsContent:!1})?lC(e,p):M6(e,s,t,p,d))},cC=(e,t,s,a)=>{const d=Et.fromRangeStart(e.selection.getRng());return fl(e.schema,a)?lC(e,a):$6(e,s,t,a,d)},hP=(e,t)=>e?xD(t):yD(t),rw=(e,t)=>{const s=Et.fromRangeStart(e.selection.getRng());return hP(t,s)||hd(t,e.getBody(),s).exists(a=>hP(t,a))},KD=(e,t,s)=>{const a=M.fromDom(e.getBody());return jD(a,s).fold(()=>H6(e,t,a,s).orThunk(()=>cf(rw(e,t),Fe)),d=>cC(e,t,a,d))},Tp=(e,t)=>{const s=M.fromDom(e.selection.getStart(!0)),a=sh(e);return e.selection.isCollapsed()&&a.length===0?KD(e,t,s):zg(e,s,a)},Yd=(e,t)=>{let s=t;for(;s&&s!==e;){if(Ws(s)||Ir(s))return s;s=s.parentNode}return null},uC=["data-ephox-","data-mce-","data-alloy-","data-snooker-","_"],dC=hn.each,Dp=e=>{const t=e.dom,s=new Set(e.serializer.getTempAttrs()),a=(p,v)=>{if(p.nodeName!==v.nodeName||p.nodeType!==v.nodeType)return!1;const C=G=>{const ee={};return dC(t.getAttribs(G),te=>{const ie=te.nodeName.toLowerCase();ie!=="style"&&!d(ie)&&(ee[ie]=t.getAttrib(G,ie))}),ee},L=(G,ee)=>{for(const te in G)if(yn(G,te)){const ie=ee[te];if(ot(ie)||G[te]!==ie)return!1;delete ee[te]}for(const te in ee)if(yn(ee,te))return!1;return!0};return oo(p)&&oo(v)&&(!L(C(p),C(v))||!L(t.parseStyle(t.getAttrib(p,"style")),t.parseStyle(t.getAttrib(v,"style"))))?!1:!pd(p)&&!pd(v)},d=p=>mo(uC,v=>qs(p,v))||s.has(p);return{compare:a,isAttributeInternal:d}},Gg=e=>["h1","h2","h3","h4","h5","h6"].includes(e.name),fC=e=>e.name==="summary",hC=(e,t)=>{let s=e;for(;s=s.walk();)t(s)},ZD=(e,t,s,a)=>{const d=s.name;for(let p=0,v=e.length;p<v;p++){const C=e[p];if(C.name===d){const L=a.nodes[d];L?L.nodes.push(s):a.nodes[d]={filter:C,nodes:[s]}}}if(s.attributes)for(let p=0,v=t.length;p<v;p++){const C=t[p],L=C.name;if(L in s.attributes.map){const G=a.attributes[L];G?G.nodes.push(s):a.attributes[L]={filter:C,nodes:[s]}}}},qD=(e,t,s)=>{const a={nodes:{},attributes:{}};return s.firstChild&&hC(s,d=>{ZD(e,t,d,a)}),a},mC=(e,t)=>{const s=(a,d)=>{qo(a,p=>{const v=In(p.nodes);xe(p.filter.callbacks,C=>{for(let L=v.length-1;L>=0;L--){const G=v[L];(!(d?G.attr(p.filter.name)!==void 0:G.name===p.filter.name)||Ae(G.parent))&&v.splice(L,1)}v.length>0&&C(v,p.filter.name,t)})})};s(e.nodes,!1),s(e.attributes,!0)},YD=(e,t,s,a={})=>{const d=qD(e,t,s);mC(d,a)},pC=(e,t,s,a)=>{if((e.pad_empty_with_br||t.insert)&&s(a)){const p=new vl("br",1);t.insert&&p.attr("data-mce-bogus","1"),a.empty().append(p)}else a.empty().append(new vl("#text",3)).value=Vo},kx=e=>{var t;return XD(e,"#text")&&((t=e==null?void 0:e.firstChild)===null||t===void 0?void 0:t.value)===Vo},XD=(e,t)=>{const s=e==null?void 0:e.firstChild;return ve(s)&&s===e.lastChild&&s.name===t},mP=(e,t)=>{const s=e.getElementRule(t.name);return(s==null?void 0:s.paddEmpty)===!0},Ax=(e,t,s,a)=>a.isEmpty(t,s,d=>mP(e,d)),gC=(e,t)=>ve(e)&&(t(e)||e.name==="br"),pP=e=>{let t;for(let s=e;s;s=s.parent){const a=s.attr("contenteditable");if(a==="false")break;a==="true"&&(t=s)}return J.from(t)},bC=(e,t,s=e.parent)=>{if(t.getSpecialElements()[e.name])e.empty().remove();else{const a=e.children();for(const d of a)s&&!t.isValidChild(s.name,d.name)&&bC(d,t,s);e.unwrap()}},vC=(e,t,s,a=Fe)=>{const d=t.getTextBlockElements(),p=t.getNonEmptyElements(),v=t.getWhitespaceElements(),C=hn.makeMap("tr,td,th,tbody,thead,tfoot,table,summary"),L=new Set,G=ee=>ee!==s&&!C[ee.name];for(let ee=0;ee<e.length;ee++){const te=e[ee];let ie,ye,Re;if(!te.parent||L.has(te))continue;if(d[te.name]&&te.parent.name==="li"){let Pe=te.next;for(;Pe&&d[Pe.name];){Pe.name="li",L.add(Pe),te.parent.insert(Pe,te.parent);Pe=Pe.next}te.unwrap();continue}const Se=[te];for(ie=te.parent;ie&&!t.isValidChild(ie.name,te.name)&&G(ie);ie=ie.parent)Se.push(ie);if(ie&&Se.length>1)if(ch(t,te,ie))bC(te,t);else{Se.reverse(),ye=Se[0].clone(),a(ye);let Pe=ye;for(let Je=0;Je<Se.length-1;Je++){t.isValidChild(Pe.name,Se[Je].name)&&Je>0?(Re=Se[Je].clone(),a(Re),Pe.append(Re)):Re=Pe;for(let nt=Se[Je].firstChild;nt&&nt!==Se[Je+1];){const rt=nt.next;Re.append(nt),nt=rt}Pe=Re}Ax(t,p,v,ye)?ie.insert(te,Se[0],!0):(ie.insert(ye,Se[0],!0),ie.insert(te,ye)),ie=Se[0],(Ax(t,p,v,ie)||XD(ie,"br"))&&ie.empty().remove()}else if(te.parent){if(te.name==="li"){let Pe=te.prev;if(Pe&&(Pe.name==="ul"||Pe.name==="ol")){Pe.append(te);continue}if(Pe=te.next,Pe&&(Pe.name==="ul"||Pe.name==="ol")&&Pe.firstChild){Pe.insert(te,Pe.firstChild,!0);continue}const Je=new vl("ul",1);a(Je),te.wrap(Je);continue}if(t.isValidChild(te.parent.name,"div")&&t.isValidChild("div",te.name)){const Pe=new vl("div",1);a(Pe),te.wrap(Pe)}else bC(te,t)}}},gP=(e,t)=>{let s=e;for(;s;){if(s.name===t)return!0;s=s.parent}return!1},ch=(e,t,s=t.parent)=>s?e.children[t.name]&&!e.isValidChild(s.name,t.name)||t.name==="a"&&gP(s,"a")?!0:fC(s)&&Gg(t)?!((s==null?void 0:s.firstChild)===t&&(s==null?void 0:s.lastChild)===t):!1:!1,Wg=(e,t,s,a)=>{const d=document.createRange();return d.setStart(e,t),d.setEnd(s,a),d},Lf=e=>{const t=Et.fromRangeStart(e),s=Et.fromRangeEnd(e),a=e.commonAncestorContainer;return hd(!1,a,s).map(d=>!tm(t,s,a)&&tm(t,d,a)?Wg(t.container(),t.offset(),d.container(),d.offset()):e).getOr(e)},iw=e=>e.collapsed?e:Lf(e),JD=e=>ve(e.firstChild)&&e.firstChild===e.lastChild,bP=e=>e.name==="br"||e.value===Vo,vP=(e,t)=>e.getBlockElements()[t.name]&&JD(t)&&bP(t.firstChild),xP=(e,t)=>{const s=e.getNonEmptyElements();return ve(t)&&(t.isEmpty(s)||vP(e,t))},QD=(e,t)=>{let s=t.firstChild,a=t.lastChild;return s&&s.name==="meta"&&(s=s.next),a&&a.attr("id")==="mce_marker"&&(a=a.prev),xP(e,a)&&(a=a==null?void 0:a.prev),!s||s!==a?!1:s.name==="ul"||s.name==="ol"},yP=e=>{var t,s;const a=e.firstChild,d=e.lastChild;return a&&a.nodeName==="META"&&((t=a.parentNode)===null||t===void 0||t.removeChild(a)),d&&d.id==="mce_marker"&&((s=d.parentNode)===null||s===void 0||s.removeChild(d)),e},wP=(e,t,s)=>{const a=t.serialize(s),d=e.createFragment(a);return yP(d)},ek=e=>{var t;return Ct((t=e==null?void 0:e.childNodes)!==null&&t!==void 0?t:[],s=>s.nodeName==="LI")},dm=e=>e.data===Vo||fi(e),Rf=e=>ve(e==null?void 0:e.firstChild)&&e.firstChild===e.lastChild&&dm(e.firstChild),xC=e=>!e.firstChild||Rf(e),SP=e=>e.length>0&&xC(e[e.length-1])?e.slice(0,-1):e,Lx=(e,t)=>{const s=e.getParent(t,e.isBlock);return s&&s.nodeName==="LI"?s:null},EP=(e,t)=>!!Lx(e,t),CP=(e,t)=>{const s=t.cloneRange(),a=t.cloneRange();return s.setStartBefore(e),a.setEndAfter(e),[s.cloneContents(),a.cloneContents()]},_P=(e,t)=>{const s=Et.before(e),d=Do(t).next(s);return d?d.toRange():null},tk=(e,t)=>{const s=Et.after(e),d=Do(t).prev(s);return d?d.toRange():null},TP=(e,t,s,a)=>{const d=CP(e,a),p=e.parentNode;return p&&(p.insertBefore(d[0],e),hn.each(t,v=>{p.insertBefore(v,e)}),p.insertBefore(d[1],e),p.removeChild(e)),tk(t[t.length-1],s)},DP=(e,t,s)=>{const a=e.parentNode;return a&&hn.each(t,d=>{a.insertBefore(d,e)}),_P(e,s)},yC=(e,t,s,a)=>(a.insertAfter(t.reverse(),e),tk(t[0],s)),nk=(e,t,s,a)=>{const d=wP(t,e,a),p=Lx(t,s.startContainer),v=SP(ek(d.firstChild)),C=1,L=2,G=t.getRoot(),ee=te=>{const ie=Et.fromRangeStart(s),ye=Do(t.getRoot()),Re=te===C?ye.prev(ie):ye.next(ie),Se=Re==null?void 0:Re.getNode();return Se?Lx(t,Se)!==p:!0};return p?ee(C)?DP(p,v,G):ee(L)?yC(p,v,G,t):TP(p,v,G,s):null},kP=["pre"],ok=(e,t,s,a)=>{var d;const p=t.firstChild,v=t.lastChild,C=v.attr("data-mce-type")==="bookmark"?v.prev:v,L=p===C,G=to(kP,p.name);if(L&&G){const ee=p.attr("contenteditable")!=="false",te=((d=e.getParent(s,e.isBlock))===null||d===void 0?void 0:d.nodeName.toLowerCase())===p.name,ie=J.from(Yd(a,s)).forall(Ws);return ee&&te&&ie}else return!1},sk=og,U6=(e,t,s)=>{if(ve(s)){const a=e.getParent(t.endContainer,sk);return s===a&&yy(M.fromDom(s),t)}else return!1},V6=(e,t,s)=>{var a;if(s.getAttribute("data-mce-bogus")==="all")(a=s.parentNode)===null||a===void 0||a.insertBefore(e.dom.createFragment(t),s);else{const d=s.firstChild,p=s.lastChild;!d||d===p&&d.nodeName==="BR"?e.dom.setHTML(s,t):e.selection.setContent(t,{no_events:!0})}},z6=(e,t,s)=>{J.from(e.getParent(t,"td,th")).map(M.fromDom).each(a=>G0(a,s))},G6=(e,t)=>{const s=e.schema.getTextInlineElements(),a=e.dom;if(t){const d=e.getBody(),p=Dp(e);hn.each(a.select("*[data-mce-fragment]"),v=>{if(ve(s[v.nodeName.toLowerCase()])&&PI(a,v)){for(let L=v.parentElement;ve(L)&&L!==d&&!qy(a,v,L);L=L.parentElement)if(p.compare(L,v)){a.remove(v,!0);break}}})}},W6=e=>{let t=e;for(;t=t.walk();)t.type===1&&t.attr("data-mce-fragment","1")},wC=e=>{hn.each(e.getElementsByTagName("*"),t=>{t.removeAttribute("data-mce-fragment")})},rk=e=>!!e.getAttribute("data-mce-fragment"),AP=(e,t)=>ve(t)&&!e.schema.getVoidElements()[t.nodeName],ik=(e,t)=>{var s,a,d;let p;const v=e.dom,C=e.selection;if(!t)return;C.scrollIntoView(t);const L=Yd(e.getBody(),t);if(L&&v.getContentEditable(L)==="false"){v.remove(t),C.select(L);return}let G=v.createRng();const ee=t.previousSibling;if(rn(ee)){G.setStart(ee,(a=(s=ee.nodeValue)===null||s===void 0?void 0:s.length)!==null&&a!==void 0?a:0);const ye=t.nextSibling;rn(ye)&&(ee.appendData(ye.data),(d=ye.parentNode)===null||d===void 0||d.removeChild(ye))}else G.setStartBefore(t),G.setEndBefore(t);const te=ye=>{let Re=Et.fromRangeStart(ye);return Re=Do(e.getBody()).next(Re),Re==null?void 0:Re.toRange()},ie=v.getParent(t,v.isBlock);if(v.remove(t),ie&&v.isEmpty(ie)){const ye=sk(ie);Ua(M.fromDom(ie)),G.setStart(ie,0),G.setEnd(ie,0),!ye&&!rk(ie)&&(p=te(G))?(G=p,v.remove(ie)):v.add(ie,v.create("br",ye?{}:{"data-mce-bogus":"1"}))}C.setRng(G)},j6=e=>{const t=e.dom,s=iw(e.selection.getRng());e.selection.setRng(s);const a=t.getParent(s.startContainer,sk);U6(t,s,a)?Eb(e,s,M.fromDom(a)):s.startContainer===s.endContainer&&s.endOffset-s.startOffset===1&&rn(s.startContainer.childNodes[s.startOffset])?s.deleteContents():e.getDoc().execCommand("Delete",!1)},K6=e=>{for(let t=e;t;t=t.walk())if(t.attr("id")==="mce_marker")return J.some(t);return J.none()},Z6=(e,t,s)=>{var a;return mo(s.children(),Gg)&&((a=e.getParent(t,e.isBlock))===null||a===void 0?void 0:a.nodeName)==="SUMMARY"},q6=(e,t,s)=>{var a,d;const p=e.selection,v=e.dom,C=e.parser,L=s.merge,G=yp({validate:!0},e.schema),ee='<span id="mce_marker" data-mce-type="bookmark">&#xFEFF;</span>';s.preserve_zwsp||(t=Ta(t)),t.indexOf("{$caret}")===-1&&(t+="{$caret}"),t=t.replace(/\{\$caret\}/,ee);let te=p.getRng();const ie=te.startContainer,ye=e.getBody();ie===ye&&p.isCollapsed()&&v.isBlock(ye.firstChild)&&AP(e,ye.firstChild)&&v.isEmpty(ye.firstChild)&&(te=v.createRng(),te.setStart(ye.firstChild,0),te.setEnd(ye.firstChild,0),p.setRng(te)),p.isCollapsed()||j6(e);const Re=p.getNode(),Se={context:Re.nodeName.toLowerCase(),data:s.data,insert:!0},Pe=C.parse(t,Se);if(s.paste===!0&&QD(e.schema,Pe)&&EP(v,Re))return te=nk(G,v,p.getRng(),Pe),te&&p.setRng(te),t;s.paste===!0&&ok(v,Pe,Re,e.getBody())&&((a=Pe.firstChild)===null||a===void 0||a.unwrap()),W6(Pe);let Je=Pe.lastChild;if(Je&&Je.attr("id")==="mce_marker"){const nt=Je;for(Je=Je.prev;Je;Je=Je.walk(!0))if(Je.type===3||!v.isBlock(Je.name)){Je.parent&&e.schema.isValidChild(Je.parent.name,"span")&&Je.parent.insert(nt,Je,Je.name==="br");break}}if(e._selectionOverrides.showBlockCaretContainer(Re),!Se.invalid&&!Z6(v,Re,Pe))t=G.serialize(Pe),V6(e,t,Re);else{e.selection.setContent(ee);let nt=p.getNode(),rt;const ft=e.getBody();for(id(nt)?nt=rt=ft:rt=nt;rt&&rt!==ft;)nt=rt,rt=rt.parentNode;t=nt===ft?ft.innerHTML:v.getOuterHTML(nt);const Xt=C.parse(t),mn=K6(Xt),Fn=mn.bind(pP).getOr(Xt);mn.each(no=>no.replace(Pe));const Lt=Pe.children(),yt=(d=Pe.parent)!==null&&d!==void 0?d:Xt;Pe.unwrap();const qt=Ct(Lt,no=>ch(e.schema,no,yt));vC(qt,e.schema,Fn),YD(C.getNodeFilters(),C.getAttributeFilters(),Xt),t=G.serialize(Xt),nt===ft?v.setHTML(ft,t):v.setOuterHTML(nt,t)}return G6(e,L),ik(e,v.get("mce_marker")),wC(e.getBody()),z6(v,p.getStart(),e.schema),hl(e.schema,e.getBody(),p.getStart()),t},SC=e=>e instanceof vl,Y6=e=>{gb(e)&&Mo(e.getBody()).each(t=>{const s=t.getNode(),a=$d(s)?Mo(s).getOr(t):t;e.selection.setRng(a.toRange())})},Rx=(e,t,s)=>{e.dom.setHTML(e.getBody(),t),s!==!0&&Y6(e)},EC=(e,t,s,a)=>{if(s=Ta(s),s.length===0||/^\s+$/.test(s)){const d='<br data-mce-bogus="1">';t.nodeName==="TABLE"?s="<tr><td>"+d+"</td></tr>":/^(UL|OL)$/.test(t.nodeName)&&(s="<li>"+d+"</li>");const p=Wl(e);return e.schema.isValidChild(t.nodeName.toLowerCase(),p.toLowerCase())?(s=d,s=e.dom.createHTML(p,ny(e),s)):s||(s=d),Rx(e,s,a.no_selection),{content:s,html:s}}else{a.format!=="raw"&&(s=yp({validate:!1},e.schema).serialize(e.parser.parse(s,{isRootContent:!0,insert:!0})));const d=vg(M.fromDom(t))?s:hn.trim(s);return Rx(e,d,a.no_selection),{content:d,html:d}}},CC=(e,t,s,a)=>{YD(e.parser.getNodeFilters(),e.parser.getAttributeFilters(),s);const d=yp({validate:!1},e.schema).serialize(s),p=Ta(vg(M.fromDom(t))?d:hn.trim(d));return Rx(e,p,a.no_selection),{content:s,html:p}},X6=(e,t,s)=>J.from(e.getBody()).map(a=>SC(t)?CC(e,a,t,s):EC(e,a,t,s)).getOr({content:t,html:SC(s.content)?"":s.content}),LP=e=>Oe(e)?e:vt,J6=(e,t,s)=>{let a=e.dom;const d=LP(s);for(;a.parentNode;){a=a.parentNode;const p=M.fromDom(a),v=t(p);if(v.isSome())return v;if(d(p))break}return J.none()},ak=(e,t,s)=>{const a=t(e),d=LP(s);return a.orThunk(()=>d(e)?J.none():J6(e,t,d))},lk=px,RP=(e,t,s)=>{const a=e.formatter.get(s);if(a)for(let d=0;d<a.length;d++){const p=a[d];if(ju(p)&&p.inherit===!1&&e.dom.is(t,p.selector))return!0}return!1},yd=(e,t,s,a,d)=>{const p=e.dom.getRoot();if(t===p)return!1;const v=e.dom.getParent(t,C=>RP(e,C,s)?!0:C.parentNode===p||!!uh(e,C,s,a,!0));return!!uh(e,v,s,a,d)},Ox=(e,t,s)=>nl(s)&&lk(t,s.inline)||rh(s)&&lk(t,s.block)?!0:ju(s)?oo(t)&&e.is(t,s.selector):!1,ck=(e,t,s,a,d,p)=>{const v=s[a],C=a==="attributes";if(Oe(s.onmatch))return s.onmatch(t,s,a);if(v){if(Ie(v)){for(let L=0;L<v.length;L++)if(C?e.getAttrib(t,v[L]):Sy(e,t,v[L]))return!0}else for(const L in v)if(yn(v,L)){const G=C?e.getAttrib(t,L):Sy(e,t,L),ee=pp(v[L],p),te=Ae(G)||jr(G);if(te&&Ae(ee))continue;if(d&&te&&!s.exact||(!d||s.exact)&&!lk(G,fE(ee,L)))return!1}}return!0},uh=(e,t,s,a,d)=>{const p=e.formatter.get(s),v=e.dom;if(p&&oo(t))for(let C=0;C<p.length;C++){const L=p[C];if(Ox(e.dom,t,L)&&ck(v,t,L,"attributes",d,a)&&ck(v,t,L,"styles",d,a)){const G=L.classes;if(G){for(let ee=0;ee<G.length;ee++)if(!e.dom.hasClass(t,pp(G[ee],a)))return}return L}}},_C=(e,t,s,a,d)=>{if(a)return yd(e,a,t,s,d);if(a=e.selection.getNode(),yd(e,a,t,s,d))return!0;const p=e.selection.getStart();return!!(p!==a&&yd(e,p,t,s,d))},Q6=(e,t,s)=>{const a=[],d={},p=e.selection.getStart();return e.dom.getParent(p,v=>{for(let C=0;C<t.length;C++){const L=t[C];!d[L]&&uh(e,v,L,s)&&(d[L]=!0,a.push(L))}},e.dom.getRoot()),a},OP=(e,t)=>{const s=d=>gt(d,M.fromDom(e.getBody())),a=(d,p)=>uh(e,d.dom,p)?J.some(p):J.none();return J.from(e.selection.getStart(!0)).bind(d=>ak(M.fromDom(d),p=>Is(t,v=>a(p,v)),s)).getOrNull()},e8=(e,t)=>{const s=e.formatter.get(t),a=e.dom;if(s&&e.selection.isEditable()){const d=e.selection.getStart(),p=Ey(a,d);for(let v=s.length-1;v>=0;v--){const C=s[v];if(!ju(C))return!0;for(let L=p.length-1;L>=0;L--)if(a.is(p[L],C.selector))return!0}}return!1},Ix=(e,t,s)=>Kn(s,(a,d)=>{const p=DO(e,d);return e.formatter.matchNode(t,d,{},p)?a.concat([d]):a},[]),Px=ta,IP=(e,t)=>e.importNode(t,!0),uk=e=>{if(e){const t=new bn(e,e);for(let s=t.current();s;s=t.next())if(rn(s))return s}return null},aw=e=>{const t=M.fromTag("span");return Hc(t,{id:cx,"data-mce-bogus":"1","data-mce-type":"format-caret"}),e&&rr(t,M.fromText(Px)),t},t8=e=>{const t=uk(e);return t&&t.data.charAt(0)===Px&&t.deleteData(0,1),t},dk=(e,t,s)=>{const a=e.dom,d=e.selection;if(M2(t))Hg(e,!1,M.fromDom(t),s,!0);else{const p=d.getRng(),v=a.getParent(t,a.isBlock),C=p.startContainer,L=p.startOffset,G=p.endContainer,ee=p.endOffset,te=t8(t);a.remove(t,!0),C===te&&L>0&&p.setStart(te,L-1),G===te&&ee>0&&p.setEnd(te,ee-1),v&&a.isEmpty(v)&&Hu(M.fromDom(v)),d.setRng(p)}},fm=(e,t,s)=>{const a=e.dom,d=e.selection;if(t)dk(e,t,s);else if(t=Cg(e.getBody(),d.getStart()),!t)for(;t=a.get(cx);)dk(e,t,s)},fk=(e,t,s)=>{var a,d;const p=e.dom,v=p.getParent(s,it(dE,e.schema));v&&p.isEmpty(v)?(a=s.parentNode)===null||a===void 0||a.replaceChild(t,s):(IS(M.fromDom(s)),p.isEmpty(s)?(d=s.parentNode)===null||d===void 0||d.replaceChild(t,s):p.insertAfter(t,s))},PP=(e,t)=>(e.appendChild(t),t),MP=(e,t)=>{var s;const a=yo(e,(p,v)=>PP(p,v.cloneNode(!1)),t),d=(s=a.ownerDocument)!==null&&s!==void 0?s:document;return PP(a,d.createTextNode(Px))},Cb=(e,t,s,a,d,p)=>{const v=e.formatter,C=e.dom,L=Ct(Yt(v.get()),te=>te!==a&&!xr(te,"removeformat")),G=Ix(e,s,L);if(Ct(G,te=>!kO(e,te,a)).length>0){const te=s.cloneNode(!1);return C.add(t,te),v.remove(a,d,te,p),C.remove(te),J.some(te)}else return J.none()},NP=(e,t,s)=>{let a;const d=e.selection,p=e.formatter.get(t);if(!p)return;const v=d.getRng();let C=v.startOffset;const G=v.startContainer.nodeValue;a=Cg(e.getBody(),d.getStart());const ee=/[^\s\u00a0\u00ad\u200b\ufeff]/;if(G&&C>0&&C<G.length&&ee.test(G.charAt(C))&&ee.test(G.charAt(C-1))){const te=d.getBookmark();v.collapse(!0);let ie=Dg(e.dom,v,p);ie=Fy(ie),e.formatter.apply(t,s,ie),d.moveToBookmark(te)}else{let te=a?uk(a):null;(!a||(te==null?void 0:te.data)!==Px)&&(a=IP(e.getDoc(),aw(!0).dom),te=a.firstChild,v.insertNode(a),C=1),e.formatter.apply(t,s,a),d.setCursorLocation(te,C)}},TC=(e,t,s,a)=>{const d=e.dom,p=e.selection;let v=!1;const C=e.formatter.get(t);if(!C)return;const L=p.getRng(),G=L.startContainer,ee=L.startOffset;let te=G;rn(G)&&(ee!==G.data.length&&(v=!0),te=te.parentNode);const ie=[];let ye;for(;te;){if(uh(e,te,t,s,a)){ye=te;break}te.nextSibling&&(v=!0),ie.push(te),te=te.parentNode}if(ye)if(v){const Re=p.getBookmark();L.collapse(!0);let Se=Dg(d,L,C,!0);Se=Fy(Se),e.formatter.remove(t,s,Se,a),p.moveToBookmark(Re)}else{const Re=Cg(e.getBody(),ye),Se=ve(Re)?d.getParents(ye.parentNode,an,Re):[],Pe=aw(!1).dom;fk(e,Pe,Re??ye);const Je=Cb(e,Pe,ye,t,s,a),nt=MP([...ie,...Je.toArray(),...Se],Pe);Re&&dk(e,Re,ve(Re)),p.setCursorLocation(nt,1),d.isEmpty(ye)&&d.remove(ye)}},n8=(e,t,s)=>{const a=e.selection,d=e.getBody();fm(e,null,s),(t===8||t===46)&&a.isCollapsed()&&a.getStart().innerHTML===Px&&fm(e,Cg(d,a.getStart()),!0),(t===37||t===39)&&fm(e,Cg(d,a.getStart()),!0)},o8=e=>rn(e)&&Hi(e.data,Vo),FP=e=>{e.on("mouseup keydown",t=>{n8(e,t.keyCode,o8(e.selection.getRng().endContainer))})},hm=e=>{const t=aw(!1),s=MP(e,t.dom);return{caretContainer:t,caretPosition:Et(s,0)}},DC=(e,t)=>{const{caretContainer:s,caretPosition:a}=hm(t);return lt(M.fromDom(e),s),Xs(M.fromDom(e)),a},hk=(e,t)=>{const{caretContainer:s,caretPosition:a}=hm(t);return e.insertNode(s.dom),a},kC=(e,t)=>{if(md(t.dom))return!1;const s=e.schema.getTextInlineElements();return yn(s,ls(t))&&!md(t.dom)&&!Bd(t.dom)},Mx={},mk=kl(["pre"]),BP=(e,t)=>{Mx[e]||(Mx[e]=[]),Mx[e].push(t)},s8=(e,t)=>{yn(Mx,e)&&xe(Mx[e],s=>{s(t)})};BP("pre",e=>{const t=e.selection.getRng(),s=d=>p=>{const v=p.previousSibling;return mk(v)&&to(d,v)},a=(d,p)=>{const v=M.fromDom(p),C=ss(v).dom;Xs(v),Or(M.fromDom(d),[M.fromTag("br",C),M.fromTag("br",C),...cr(v)])};if(!t.collapsed){const d=e.selection.getSelectedBlocks(),p=Ct(Ct(d,mk),s(d));xe(p,v=>{a(v.previousSibling,v)})}});const Nx=["fontWeight","fontStyle","color","fontSize","fontFamily"],AC=e=>Y(e.styles)&&mo(Yt(e.styles),t=>to(Nx,t)),$P=e=>Qt(e,t=>nl(t)&&t.inline==="span"&&AC(t)),pk=(e,t)=>{const s=e.get(t);return ae(s)?$P(s):J.none()},gk=(e,t)=>Wu(t,Et.fromRangeStart(e)).isNone(),bk=(e,t)=>Kc(t,Et.fromRangeEnd(e)).exists(s=>!fi(s.getNode())||Kc(t,s).isSome())===!1,lw=e=>t=>uv(t)&&e.isEditable(t),vk=e=>{const t=e.getSelectedBlocks(),s=e.getRng();if(e.isCollapsed())return[];if(t.length===1)return gk(s,t[0])&&bk(s,t[0])?t:[];{const a=At(t).filter(v=>gk(s,v)).toArray(),d=On(t).filter(v=>bk(s,v)).toArray(),p=t.slice(1,-1);return a.concat(p).concat(d)}},cw=e=>Ct(vk(e),lw(e.dom)),HP=e=>Ct(e.getSelectedBlocks(),lw(e.dom)),LC=hn.each,xk=e=>oo(e)&&!pd(e)&&!md(e)&&!Bd(e),UP=(e,t)=>{for(let s=e;s;s=s[t]){if(rn(s)&&vi(s.data))return e;if(oo(s)&&!pd(s))return s}return e},yk=(e,t,s)=>{const a=Dp(e),d=lu(t)&&e.dom.isEditable(t),p=lu(s)&&e.dom.isEditable(s);if(d&&p){const v=UP(t,"previousSibling"),C=UP(s,"nextSibling");if(a.compare(v,C)){for(let L=v.nextSibling;L&&L!==C;){const G=L;L=L.nextSibling,v.appendChild(G)}return e.dom.remove(C),hn.each(hn.grep(C.childNodes),L=>{v.appendChild(L)}),v}}return s},wk=(e,t,s,a)=>{var d;if(a&&t.merge_siblings!==!1){const p=(d=yk(e,cb(a),a))!==null&&d!==void 0?d:a;yk(e,p,cb(p,!0))}},r8=(e,t,s)=>{if(t.clear_child_styles){const a=t.links?"*:not(a)":"*";LC(e.select(a,s),d=>{xk(d)&&e.isEditable(d)&&LC(t.styles,(p,v)=>{e.setStyle(d,v,"")})})}},RC=(e,t,s)=>{LC(e.childNodes,a=>{xk(a)&&(t(a)&&s(a),a.hasChildNodes()&&RC(a,t,s))})},_b=(e,t)=>{t.nodeName==="SPAN"&&e.getAttribs(t).length===0&&e.remove(t,!0)},Sk=(e,t)=>s=>!!(s&&Sy(e,s,t)),OC=(e,t,s)=>a=>{e.setStyle(a,t,s),a.getAttribute("style")===""&&a.removeAttribute("style"),_b(e,a)},jg=Oo.generate([{keep:[]},{rename:["name"]},{removed:[]}]),Ek=/^(src|href|style)$/,mm=hn.each,uw=px,Xd=e=>/^(TR|TH|TD)$/.test(e.nodeName),Kg=(e,t,s)=>e.isChildOf(t,s)&&t!==s&&!e.isBlock(s),IC=(e,t,s)=>{let a=t[s?"startContainer":"endContainer"],d=t[s?"startOffset":"endOffset"];if(oo(a)){const p=a.childNodes.length-1;!s&&d&&d--,a=a.childNodes[d>p?p:d]}return rn(a)&&s&&d>=a.data.length&&(a=new bn(a,e.getBody()).next()||a),rn(a)&&!s&&d===0&&(a=new bn(a,e.getBody()).prev()||a),a},Ck=(e,t)=>{const s=t?"firstChild":"lastChild",a=e[s];return Xd(e)&&a?e.nodeName==="TR"&&a[s]||a:e},_k=(e,t,s,a)=>{var d;const p=e.create(s,a);return(d=t.parentNode)===null||d===void 0||d.insertBefore(p,t),p.appendChild(t),p},Tk=(e,t,s,a,d)=>{const p=M.fromDom(t),v=M.fromDom(e.create(a,d)),C=s?Wn(p):ks(p);return Or(v,C),s?(lt(p,v),au(v,p)):(Si(p,v),rr(v,p)),v.dom},Fx=(e,t)=>t.links&&e.nodeName==="A",PC=(e,t,s)=>{const a=t.parentNode;let d;const p=e.dom,v=Wl(e);rh(s)&&a===p.getRoot()&&(!s.list_block||!uw(t,s.list_block))&&xe(In(t.childNodes),C=>{_g(e,v,C.nodeName.toLowerCase())?d?d.appendChild(C):(d=_k(p,C,v),p.setAttribs(d,ny(e))):d=null}),!(RO(s)&&!uw(s.inline,t))&&p.remove(t,!0)},Dk=(e,t,s)=>O(e)?{name:t,value:null}:{name:e,value:pp(t,s)},kk=(e,t)=>{e.getAttrib(t,"style")===""&&(t.removeAttribute("style"),t.removeAttribute("data-mce-style"))},MC=(e,t,s,a,d)=>{let p=!1;mm(s.styles,(v,C)=>{const{name:L,value:G}=Dk(C,v,a),ee=fE(G,L);(s.remove_similar||Ce(G)||!oo(d)||uw(Sy(e,d,L),ee))&&e.setStyle(t,L,""),p=!0}),p&&kk(e,t)},i8=(e,t,s)=>{t==="removeformat"?xe(HP(e.selection),a=>{xe(Nx,d=>e.dom.setStyle(a,d,"")),kk(e.dom,a)}):pk(e.formatter,t).each(a=>{xe(HP(e.selection),d=>MC(e.dom,d,a,s,null))})},VP=(e,t,s,a,d)=>{const p=e.dom,v=Dp(e),C=e.schema;if(nl(t)&&rg(C,t.inline)&&Bh(C,a)&&a.parentElement===e.getBody())return PC(e,a,t),jg.removed();if(!t.ceFalseOverride&&a&&p.getContentEditableParent(a)==="false"||a&&!Ox(p,a,t)&&!Fx(a,t))return jg.keep();const L=a,G=t.preserve_attributes;if(nl(t)&&t.remove==="all"&&ae(G)){const ee=Ct(p.getAttribs(L),te=>to(G,te.name.toLowerCase()));if(p.removeAllAttribs(L),xe(ee,te=>p.setAttrib(L,te.name,te.value)),ee.length>0)return jg.rename("span")}if(t.remove!=="all"){MC(p,L,t,s,d),mm(t.attributes,(te,ie)=>{const{name:ye,value:Re}=Dk(ie,te,s);if(t.remove_similar||Ce(Re)||!oo(d)||uw(p.getAttrib(d,ye),Re)){if(ye==="class"){const Se=p.getAttrib(L,ye);if(Se){let Pe="";if(xe(Se.split(/\s+/),Je=>{/mce\-\w+/.test(Je)&&(Pe+=(Pe?" ":"")+Je)}),Pe){p.setAttrib(L,ye,Pe);return}}}if(Ek.test(ye)&&L.removeAttribute("data-mce-"+ye),ye==="style"&&kl(["li"])(L)&&p.getStyle(L,"list-style-type")==="none"){L.removeAttribute(ye),p.setStyle(L,"list-style-type","none");return}ye==="class"&&L.removeAttribute("className"),L.removeAttribute(ye)}}),mm(t.classes,te=>{te=pp(te,s),(!oo(d)||p.hasClass(d,te))&&p.removeClass(L,te)});const ee=p.getAttribs(L);for(let te=0;te<ee.length;te++){const ie=ee[te].nodeName;if(!v.isAttributeInternal(ie))return jg.keep()}}return t.remove!=="none"?(PC(e,L,t),jg.removed()):jg.keep()},zP=(e,t,s,a,d)=>{let p;return t.parentNode&&xe(Ey(e.dom,t.parentNode).reverse(),v=>{if(!p&&oo(v)&&v.id!=="_start"&&v.id!=="_end"){const C=uh(e,v,s,a,d);C&&C.split!==!1&&(p=v)}}),p},a8=(e,t,s,a)=>VP(e,t,s,a,a).fold(et(a),d=>(e.dom.createFragment().appendChild(a),e.dom.rename(a,d)),et(null)),wd=(e,t,s,a,d,p,v,C)=>{var L,G;let ee,te;const ie=e.dom;if(s){const ye=s.parentNode;for(let Re=a.parentNode;Re&&Re!==ye;Re=Re.parentNode){let Se=ie.clone(Re,!1);for(let Pe=0;Pe<t.length&&(Se=a8(e,t[Pe],C,Se),Se!==null);Pe++);Se&&(ee&&Se.appendChild(ee),te||(te=Se),ee=Se)}p&&(!v.mixed||!ie.isBlock(s))&&(a=(L=ie.split(s,a))!==null&&L!==void 0?L:a),ee&&te&&((G=d.parentNode)===null||G===void 0||G.insertBefore(ee,d),te.appendChild(d),nl(v)&&wk(e,v,C,ee))}return a},Ak=(e,t,s,a,d)=>{const p=e.formatter.get(t),v=p[0],C=e.dom,L=e.selection,G=Se=>{const Pe=zP(e,Se,t,s,d);return wd(e,p,Pe,Se,Se,!0,v,s)},ee=Se=>pd(Se)&&oo(Se)&&(Se.id==="_start"||Se.id==="_end"),te=Se=>mo(p,Pe=>Tb(e,Pe,s,Se,Se)),ie=Se=>{const Pe=In(Se.childNodes),nt=te(Se)||mo(p,Xt=>Ox(C,Se,Xt)),rt=Se.parentNode;if(!nt&&ve(rt)&&mE(v)&&te(rt),v.deep&&Pe.length)for(let Xt=0;Xt<Pe.length;Xt++)ie(Pe[Xt]);xe(["underline","line-through","overline"],Xt=>{oo(Se)&&e.dom.getStyle(Se,"text-decoration")===Xt&&Se.parentNode&&P2(C,Se.parentNode)===Xt&&Tb(e,{deep:!1,exact:!0,inline:"span",styles:{textDecoration:Xt}},void 0,Se)})},ye=Se=>{const Pe=C.get(Se?"_start":"_end");if(Pe){let Je=Pe[Se?"firstChild":"lastChild"];return ee(Je)&&(Je=Je[Se?"firstChild":"lastChild"]),rn(Je)&&Je.data.length===0&&(Je=Se?Pe.previousSibling||Pe.nextSibling:Pe.nextSibling||Pe.previousSibling),C.remove(Pe,!0),Je}else return null},Re=Se=>{let Pe,Je,nt=Dg(C,Se,p,Se.collapsed);if(v.split){if(nt=Fy(nt),Pe=IC(e,nt,!0),Je=IC(e,nt),Pe!==Je){if(Pe=Ck(Pe,!0),Je=Ck(Je,!1),Kg(C,Pe,Je)){const ft=J.from(Pe.firstChild).getOr(Pe);G(Tk(C,ft,!0,"span",{id:"_start","data-mce-type":"bookmark"})),ye(!0);return}if(Kg(C,Je,Pe)){const ft=J.from(Je.lastChild).getOr(Je);G(Tk(C,ft,!1,"span",{id:"_end","data-mce-type":"bookmark"})),ye(!1);return}Pe=_k(C,Pe,"span",{id:"_start","data-mce-type":"bookmark"}),Je=_k(C,Je,"span",{id:"_end","data-mce-type":"bookmark"});const rt=C.createRng();rt.setStartAfter(Pe),rt.setEndBefore(Je),Dy(C,rt,ft=>{xe(ft,Xt=>{!pd(Xt)&&!pd(Xt.parentNode)&&G(Xt)})}),G(Pe),G(Je),Pe=ye(!0),Je=ye()}else Pe=Je=G(Pe);nt.startContainer=Pe.parentNode?Pe.parentNode:Pe,nt.startOffset=C.nodeIndex(Pe),nt.endContainer=Je.parentNode?Je.parentNode:Je,nt.endOffset=C.nodeIndex(Je)+1}Dy(C,nt,rt=>{xe(rt,ie)})};if(a){if(mx(a)){const Se=C.createRng();Se.setStartBefore(a),Se.setEndAfter(a),Re(Se)}else Re(a);HO(e,t,a,s);return}!L.isCollapsed()||!nl(v)||sh(e).length?(R2(e,()=>hx(e,Re),Se=>nl(v)&&_C(e,t,s,Se)),e.nodeChanged()):TC(e,t,s,d),i8(e,t,s),HO(e,t,a,s)},Lk=(e,t,s,a,d)=>{(a||e.selection.isEditable())&&Ak(e,t,s,a,d)},Tb=(e,t,s,a,d)=>VP(e,t,s,a,d).fold(vt,p=>(e.dom.rename(a,p),!0),an),Rk=hn.each,dw=(e,t,s,a)=>{const d=p=>{if(lu(p)&&oo(p.parentNode)&&e.isEditable(p)){const v=P2(e,p.parentNode);e.getStyle(p,"color")&&v?e.setStyle(p,"text-decoration",v):e.getStyle(p,"text-decoration")===v&&e.setStyle(p,"text-decoration",null)}};t.styles&&(t.styles.color||t.styles.textDecoration)&&(hn.walk(a,d,"childNodes"),d(a))},kp=(e,t,s,a)=>{if(t.styles&&t.styles.backgroundColor){const d=Sk(e,"fontSize");RC(a,p=>d(p)&&e.isEditable(p),OC(e,"backgroundColor",pp(t.styles.backgroundColor,s)))}},Db=(e,t,s,a)=>{if(nl(t)&&(t.inline==="sub"||t.inline==="sup")){const d=Sk(e,"fontSize");RC(a,v=>d(v)&&e.isEditable(v),OC(e,"fontSize",""));const p=Ct(e.select(t.inline==="sup"?"sub":"sup",a),e.isEditable);e.remove(p,!0)}},NC=(e,t,s,a)=>{Rk(t,d=>{nl(d)&&Rk(e.dom.select(d.inline,a),p=>{xk(p)&&Tb(e,d,s,p,d.exact?p:null)}),r8(e.dom,d,a)})},Ok=(e,t,s,a,d)=>{const p=d.parentNode;uh(e,p,s,a)&&Tb(e,t,a,d)||t.merge_with_parents&&p&&e.dom.getParent(p,v=>uh(e,v,s,a)?(Tb(e,t,a,d),!0):!1)},Bx=hn.each,GP=(e,t,s,a)=>{if(JB(e)&&nl(t)&&s.parentNode){const d=yS(e.schema),p=Ln(M.fromDom(s),v=>md(v.dom));return vr(d,a)&&Ga(e.schema,s.parentNode,{skipBogus:!1,includeZwsp:!0})&&!p}else return!1},WP=(e,t,s,a)=>{if(Bx(s.styles,(d,p)=>{e.setStyle(t,p,pp(d,a))}),s.styles){const d=e.getAttrib(t,"style");d&&e.setAttrib(t,"data-mce-style",d)}},jP=(e,t,s,a)=>{const d=e.formatter.get(t),p=d[0],v=!a&&e.selection.isCollapsed(),C=e.dom,L=e.selection,G=(Re,Se=p)=>{Oe(Se.onformat)&&Se.onformat(Re,Se,s,a),WP(C,Re,Se,s),Bx(Se.attributes,(Pe,Je)=>{C.setAttrib(Re,Je,pp(Pe,s))}),Bx(Se.classes,Pe=>{const Je=pp(Pe,s);C.hasClass(Re,Je)||C.addClass(Re,Je)})},ee=(Re,Se)=>{let Pe=!1;return Bx(Re,Je=>ju(Je)?C.getContentEditable(Se)==="false"&&!Je.ceFalseOverride||ve(Je.collapsed)&&Je.collapsed!==v?!0:C.is(Se,Je.selector)&&!md(Se)?(G(Se,Je),Pe=!0,!1):!0:!1),Pe},te=Re=>{if(re(Re)){const Se=C.create(Re);return G(Se),Se}else return null},ie=(Re,Se,Pe)=>{const Je=[];let nt=!0;const rt=p.inline||p.block,ft=te(rt),Xt=Lt=>AO(p)&&uh(e,Lt,t,s),mn=(Lt,yt,qt)=>{const no=LO(p)&&dE(e.schema,Lt)&&_g(e,yt,rt);return qt&&no},Fn=(Lt,yt,qt,no)=>{const So=Lt.nodeName.toLowerCase(),fs=_g(e,rt,So)&&_g(e,yt,rt),Ts=!Pe&&rn(Lt)&&$v(Lt.data),_r=md(Lt),$r=!nl(p)||!Re.isBlock(Lt);return(qt||no)&&fs&&!Ts&&!_r&&$r};Dy(Re,Se,Lt=>{let yt;const qt=no=>{let So=!1,fs=nt,Ts=!1;const _r=no.parentNode,$r=_r.nodeName.toLowerCase(),sa=Re.getContentEditable(no);ve(sa)&&(fs=nt,nt=sa==="true",So=!0,Ts=I2(e,no));const cc=nt&&!So;if(fi(no)&&!GP(e,p,no,$r)){yt=null,rh(p)&&Re.remove(no);return}if(Xt(no)){yt=null;return}if(mn(no,$r,cc)){const Hr=Re.rename(no,rt);G(Hr),Je.push(Hr),yt=null;return}if(ju(p)){let Hr=ee(d,no);if(!Hr&&ve(_r)&&mE(p)&&(Hr=ee(d,_r)),!nl(p)||Hr){yt=null;return}}ve(ft)&&Fn(no,$r,cc,Ts)?(yt||(yt=Re.clone(ft,!1),_r.insertBefore(yt,no),Je.push(yt)),Ts&&So&&(nt=fs),yt.appendChild(no)):(yt=null,xe(In(no.childNodes),qt),So&&(nt=fs),yt=null)};xe(Lt,qt)}),p.links===!0&&xe(Je,Lt=>{const yt=qt=>{qt.nodeName==="A"&&G(qt,p),xe(In(qt.childNodes),yt)};yt(Lt)}),xe(Je,Lt=>{const yt=So=>{let fs=0;return xe(So.childNodes,Ts=>{!T5(Ts)&&!pd(Ts)&&fs++}),fs},qt=So=>Qt(So.childNodes,uE).filter(Ts=>Re.getContentEditable(Ts)!=="false"&&Ox(Re,Ts,p)).map(Ts=>{const _r=Re.clone(Ts,!1);return G(_r),Re.replace(_r,So,!0),Re.remove(Ts,!0),_r}).getOr(So),no=yt(Lt);if((Je.length>1||!Re.isBlock(Lt))&&no===0){Re.remove(Lt,!0);return}(nl(p)||rh(p)&&p.wrapper)&&(!p.exact&&no===1&&(Lt=qt(Lt)),NC(e,d,s,Lt),Ok(e,p,t,s,Lt),kp(Re,p,s,Lt),dw(Re,p,s,Lt),Db(Re,p,s,Lt),wk(e,p,s,Lt))})},ye=mx(a)?a:L.getNode();if(C.getContentEditable(ye)==="false"&&!I2(e,ye)){a=ye,ee(d,a),$O(e,t,a,s);return}if(p){if(a)if(mx(a)){if(!ee(d,a)){const Re=C.createRng();Re.setStartBefore(a),Re.setEndAfter(a),ie(C,Dg(C,Re,d),!0)}}else ie(C,a,!0);else!v||!nl(p)||sh(e).length?(L.setRng(iw(L.getRng())),R2(e,()=>{hx(e,(Re,Se)=>{const Pe=Se?Re:Dg(C,Re,d);ie(C,Pe,!1)})},an),e.nodeChanged()):NP(e,t,s),pk(e.formatter,t).each(Re=>{xe(cw(e.selection),Se=>WP(C,Se,Re,s))});s8(t,e)}$O(e,t,a,s)},Ik=(e,t,s,a)=>{(a||e.selection.isEditable())&&jP(e,t,s,a)},Pk=e=>yn(e,"vars"),KP=(e,t)=>{e.set({}),t.on("NodeChange",s=>{Zc(t,s.element,e.get())}),t.on("FormatApply FormatRemove",s=>{const a=J.from(s.node).map(d=>mx(d)?d:d.startContainer).bind(d=>oo(d)?J.some(d):J.from(d.parentElement)).getOrThunk(()=>ZP(t));Zc(t,a,e.get())})},ZP=e=>e.selection.getStart(),qP=(e,t,s,a,d)=>Jt(t,C=>{const L=e.formatter.matchNode(C,s,d??{},a);return!ot(L)},C=>RP(e,C,s)?!0:a?!1:ve(e.formatter.matchNode(C,s,d,!0))),YP=(e,t)=>{const s=t??ZP(e);return Ct(Ey(e.dom,s),a=>oo(a)&&!Bd(a))},Zc=(e,t,s)=>{const a=YP(e,t);qo(s,(d,p)=>{const v=C=>{const L=qP(e,a,p,C.similar,Pk(C)?C.vars:void 0),G=L.isSome();if(C.state.get()!==G){C.state.set(G);const ee=L.getOr(t);Pk(C)?C.callback(G,{node:ee,format:p,parents:a}):xe(C.callbacks,te=>te(G,{node:ee,format:p,parents:a}))}};xe([d.withSimilar,d.withoutSimilar],v),xe(d.withVars,v)})},XP=(e,t,s,a,d,p)=>{const v=t.get();xe(s.split(","),C=>{const L=Gn(v,C).getOrThunk(()=>{const ee={withSimilar:{state:Ea(!1),similar:!0,callbacks:[]},withoutSimilar:{state:Ea(!1),similar:!1,callbacks:[]},withVars:[]};return v[C]=ee,ee}),G=()=>{const ee=YP(e);return qP(e,ee,C,d,p).isSome()};if(ot(p)){const ee=d?L.withSimilar:L.withoutSimilar;ee.callbacks.push(a),ee.callbacks.length===1&&ee.state.set(G())}else L.withVars.push({state:Ea(G()),similar:d,vars:p,callback:a})}),t.set(v)},fw=(e,t,s)=>{const a=e.get();xe(t.split(","),d=>Gn(a,d).each(p=>{a[d]={withSimilar:{...p.withSimilar,callbacks:Ct(p.withSimilar.callbacks,v=>v!==s)},withoutSimilar:{...p.withoutSimilar,callbacks:Ct(p.withoutSimilar.callbacks,v=>v!==s)},withVars:Ct(p.withVars,v=>v.callback!==s)}})),e.set(a)},l8=(e,t,s,a,d,p)=>(XP(e,t,s,a,d,p),{unbind:()=>fw(t,s,a)}),JP=(e,t,s,a)=>{const d=e.formatter.get(t);d&&(_C(e,t,s,a)&&(!("toggle"in d[0])||d[0].toggle)?Lk(e,t,s,a):Ik(e,t,s,a))},Mk=hn.explode,FC=()=>{const e={};return{addFilter:(d,p)=>{xe(Mk(d),v=>{yn(e,v)||(e[v]={name:v,callbacks:[]}),e[v].callbacks.push(p)})},getFilters:()=>vo(e),removeFilter:(d,p)=>{xe(Mk(d),v=>{if(yn(e,v))if(ve(p)){const C=e[v],L=Ct(C.callbacks,G=>G!==p);L.length>0?C.callbacks=L:delete e[v]}else delete e[v]})}}},QP=(e,t)=>{xe(t,s=>{e.attr(s,null)})},c8=(e,t,s)=>{e.addNodeFilter("font",a=>{xe(a,d=>{const p=t.parse(d.attr("style")),v=d.attr("color"),C=d.attr("face"),L=d.attr("size");v&&(p.color=v),C&&(p["font-family"]=C),L&&yr(L).each(G=>{p["font-size"]=s[G-1]}),d.name="span",d.attr("style",t.serialize(p)),QP(d,["color","face","size"])})})},u8=(e,t,s)=>{e.addNodeFilter("strike",a=>{const d=t.type!=="html4";xe(a,p=>{if(d)p.name="s";else{const v=s.parse(p.attr("style"));v["text-decoration"]="line-through",p.name="span",p.attr("style",s.serialize(v))}})})},d8=(e,t,s)=>{var a;const d=P1();t.convert_fonts_to_spans&&c8(e,d,hn.explode((a=t.font_size_legacy_values)!==null&&a!==void 0?a:"")),u8(e,s,d)},Nk=(e,t,s)=>{t.inline_styles&&d8(e,t,s)},f8=e=>fetch(e).then(t=>t.ok?t.blob():Promise.reject()).catch(()=>Promise.reject({message:`Cannot convert ${e} to Blob. Resource might not exist or is inaccessible.`,uriType:"blob"})),h8=e=>{const t=/([a-z0-9+\/=\s]+)/i.exec(e);return t?t[1]:""},BC=e=>{const[t,...s]=e.split(","),a=s.join(","),d=/data:([^/]+\/[^;]+)(;.+)?/.exec(t);if(d){const p=d[2]===";base64",v=p?h8(a):decodeURIComponent(a);return J.some({type:d[1],data:v,base64Encoded:p})}else return J.none()},eM=(e,t,s=!0)=>{let a=t;if(s)try{a=atob(t)}catch{return J.none()}const d=new Uint8Array(a.length);for(let p=0;p<d.length;p++)d[p]=a.charCodeAt(p);return J.some(new Blob([d],{type:e}))},m8=e=>new Promise((t,s)=>{BC(e).bind(({type:a,data:d,base64Encoded:p})=>eM(a,d,p)).fold(()=>s("Invalid data URI"),t)}),Fk=e=>qs(e,"blob:")?f8(e):qs(e,"data:")?m8(e):Promise.reject("Unknown URI format"),hw=e=>new Promise((t,s)=>{const a=new FileReader;a.onloadend=()=>{t(a.result)},a.onerror=()=>{var d;s((d=a.error)===null||d===void 0?void 0:d.message)},a.readAsDataURL(e)});let tM=0;const nM=e=>(e||"blobid")+tM++,$C=(e,t,s)=>BC(e).bind(({data:a,type:d,base64Encoded:p})=>{if(t&&!p)return J.none();{const v=p?a:btoa(a);return s(v,d)}}),oM=(e,t,s)=>{const a=e.create(nM(),t,s);return e.add(a),a},sM=(e,t,s=!1)=>$C(t,s,(a,d)=>J.from(e.getByData(a,d)).orThunk(()=>eM(d,a).map(p=>oM(e,p,a)))),p8=(e,t)=>{const s=()=>Promise.reject("Invalid data URI");if(qs(t,"blob:")){const a=e.getByUri(t);return ve(a)?Promise.resolve(a):Fk(t).then(d=>hw(d).then(p=>$C(p,!1,v=>J.some(oM(e,d,v))).getOrThunk(s)))}else return qs(t,"data:")?sM(e,t).fold(s,a=>Promise.resolve(a)):Promise.reject("Unknown image data format")},kb=/^(?:(?:(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)([A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*))(?::\d+)?(?:\/(?:[-.~*+=!;:'%@$(),\/\w]*[-~*+=%@$()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+)?)?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+)?)?)$/,g8=e=>J.from(e.match(kb)).bind(t=>gn(t,1)).map(t=>qs(t,"www.")?t.substring(4):t),mw=(e,t)=>{J.from(e.attr("src")).bind(g8).forall(s=>!to(t,s))&&e.attr("sandbox","")},Bk=(e,t)=>qs(e,`${t}/`),$k=e=>ot(e)?"iframe":Bk(e,"image")?"img":Bk(e,"video")?"video":Bk(e,"audio")?"audio":"iframe",rM=({type:e,src:t,width:s,height:a}={},d,p)=>{const v=$k(e),C=new vl(v,1);return C.attr(v==="audio"?{src:t}:{src:t,width:s,height:a}),(v==="audio"||v==="video")&&C.attr("controls",""),v==="iframe"&&d&&mw(C,p),C},iM=e=>ve(e.attr("data-mce-bogus")),aM=e=>e.attr("src")===gs.transparentSrc||ve(e.attr("data-mce-placeholder")),HC=(e,t)=>{const{blob_cache:s}=t;if(s){const a=d=>{const p=d.attr("src");aM(d)||iM(d)||Ae(p)||sM(s,p,!0).each(v=>{d.attr("src",v.blobUri())})};e.addAttributeFilter("src",d=>xe(d,a))}},b8=(e,t)=>{var s,a;const d=e.schema;e.addAttributeFilter("href",L=>{let G=L.length;const ee=ie=>ie.split(" ").filter(Re=>Re.length>0).concat(["noopener"]).sort().join(" "),te=ie=>{const ye=ie?hn.trim(ie):"";return/\b(noopener)\b/g.test(ye)?ye:ee(ye)};if(!t.allow_unsafe_link_target)for(;G--;){const ie=L[G];ie.name==="a"&&ie.attr("target")==="_blank"&&ie.attr("rel",te(ie.attr("rel")))}}),t.allow_html_in_named_anchor||e.addAttributeFilter("id,name",L=>{let G=L.length,ee,te,ie,ye;for(;G--;)if(ye=L[G],ye.name==="a"&&ye.firstChild&&!ye.attr("href"))for(ie=ye.parent,ee=ye.lastChild;ee&&ie;)te=ee.prev,ie.insert(ee,ye),ee=te}),t.fix_list_elements&&e.addNodeFilter("ul,ol",L=>{let G=L.length,ee,te;for(;G--;)if(ee=L[G],te=ee.parent,te&&(te.name==="ul"||te.name==="ol"))if(ee.prev&&ee.prev.name==="li")ee.prev.append(ee);else{const ie=new vl("li",1);ie.attr("style","list-style-type: none"),ee.wrap(ie)}});const p=d.getValidClasses();t.validate&&p&&e.addAttributeFilter("class",L=>{var G;let ee=L.length;for(;ee--;){const te=L[ee],ie=(G=te.attr("class"))!==null&&G!==void 0?G:"",ye=hn.explode(ie," ");let Re="";for(let Se=0;Se<ye.length;Se++){const Pe=ye[Se];let Je=!1,nt=p["*"];nt&&nt[Pe]&&(Je=!0),nt=p[te.name],!Je&&nt&&nt[Pe]&&(Je=!0),Je&&(Re&&(Re+=" "),Re+=Pe)}Re.length||(Re=null),te.attr("class",Re)}}),HC(e,t);const v=(s=t.sandbox_iframes)!==null&&s!==void 0?s:!1,C=kr((a=t.sandbox_iframes_exclusions)!==null&&a!==void 0?a:[]);t.convert_unsafe_embeds&&e.addNodeFilter("object,embed",L=>xe(L,G=>{G.replace(rM({type:G.attr("type"),src:G.name==="object"?G.attr("data"):G.attr("src"),width:G.attr("width"),height:G.attr("height")},v,C))})),v&&e.addNodeFilter("iframe",L=>xe(L,G=>mw(G,C)))},{entries:lM,setPrototypeOf:UC,isFrozen:cM,getPrototypeOf:v8,getOwnPropertyDescriptor:x8}=Object;let{freeze:qu,seal:dh,create:Hk}=Object,{apply:VC,construct:Uk}=typeof Reflect<"u"&&Reflect;VC||(VC=function(t,s,a){return t.apply(s,a)}),qu||(qu=function(t){return t}),dh||(dh=function(t){return t}),Uk||(Uk=function(t,s){return new t(...s)});const y8=Ed(Array.prototype.forEach),ja=Ed(Array.prototype.pop),pw=Ed(Array.prototype.push),zC=Ed(String.prototype.toLowerCase),GC=Ed(String.prototype.toString),Vk=Ed(String.prototype.match),Of=Ed(String.prototype.replace),Zg=Ed(String.prototype.indexOf),zk=Ed(String.prototype.trim),Sd=Ed(RegExp.prototype.test),Ab=Gk(TypeError);function Ed(e){return function(t){for(var s=arguments.length,a=new Array(s>1?s-1:0),d=1;d<s;d++)a[d-1]=arguments[d];return VC(e,t,a)}}function Gk(e){return function(){for(var t=arguments.length,s=new Array(t),a=0;a<t;a++)s[a]=arguments[a];return Uk(e,s)}}function Cr(e,t,s){var a;s=(a=s)!==null&&a!==void 0?a:zC,UC&&UC(e,null);let d=t.length;for(;d--;){let p=t[d];if(typeof p=="string"){const v=s(p);v!==p&&(cM(t)||(t[d]=v),p=v)}e[p]=!0}return e}function Ap(e){const t=Hk(null);for(const[s,a]of lM(e))t[s]=a;return t}function Lb(e,t){for(;e!==null;){const a=x8(e,t);if(a){if(a.get)return Ed(a.get);if(typeof a.value=="function")return Ed(a.value)}e=v8(e)}function s(a){return console.warn("fallback value for",a),null}return s}const $x=qu(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Rb=qu(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Cd=qu(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),gw=qu(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),WC=qu(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),uM=qu(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),dM=qu(["#text"]),Wk=qu(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),jk=qu(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),fM=qu(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),qg=qu(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),w8=dh(/\{\{[\w\W]*|[\w\W]*\}\}/gm),S8=dh(/<%[\w\W]*|[\w\W]*%>/gm),E8=dh(/\${[\w\W]*}/gm),C8=dh(/^data-[\-\w.\u00B7-\uFFFF]/),_8=dh(/^aria-[\-\w]+$/),hM=dh(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),T8=dh(/^(?:\w+script|data):/i),D8=dh(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),mM=dh(/^html$/i);var pM=Object.freeze({__proto__:null,MUSTACHE_EXPR:w8,ERB_EXPR:S8,TMPLIT_EXPR:E8,DATA_ATTR:C8,ARIA_ATTR:_8,IS_ALLOWED_URI:hM,IS_SCRIPT_OR_DATA:T8,ATTR_WHITESPACE:D8,DOCTYPE_NAME:mM});const k8=()=>typeof window>"u"?null:window,gM=function(t,s){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let a=null;const d="data-tt-policy-suffix";s&&s.hasAttribute(d)&&(a=s.getAttribute(d));const p="dompurify"+(a?"#"+a:"");try{return t.createPolicy(p,{createHTML(v){return v},createScriptURL(v){return v}})}catch{return console.warn("TrustedTypes policy "+p+" could not be created."),null}};function Kk(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:k8();const t=Es=>Kk(Es);if(t.version="3.0.5",t.removed=[],!e||!e.document||e.document.nodeType!==9)return t.isSupported=!1,t;const s=e.document,a=s.currentScript;let{document:d}=e;const{DocumentFragment:p,HTMLTemplateElement:v,Node:C,Element:L,NodeFilter:G,NamedNodeMap:ee=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:te,DOMParser:ie,trustedTypes:ye}=e,Re=L.prototype,Se=Lb(Re,"cloneNode"),Pe=Lb(Re,"nextSibling"),Je=Lb(Re,"childNodes"),nt=Lb(Re,"parentNode");if(typeof v=="function"){const Es=d.createElement("template");Es.content&&Es.content.ownerDocument&&(d=Es.content.ownerDocument)}let rt,ft="";const{implementation:Xt,createNodeIterator:mn,createDocumentFragment:Fn,getElementsByTagName:Lt}=d,{importNode:yt}=s;let qt={};t.isSupported=typeof lM=="function"&&typeof nt=="function"&&Xt&&Xt.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:no,ERB_EXPR:So,TMPLIT_EXPR:fs,DATA_ATTR:Ts,ARIA_ATTR:_r,IS_SCRIPT_OR_DATA:$r,ATTR_WHITESPACE:sa}=pM;let{IS_ALLOWED_URI:cc}=pM,Hr=null;const En=Cr({},[...$x,...Rb,...Cd,...WC,...dM]);let fo=null;const Zs=Cr({},[...Wk,...jk,...fM,...qg]);let kn=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ko=null,hs=null,Mn=!0,cs=!0,Ss=!1,xl=!0,Tr=!1,sl=!1,yh=!1,$p=!1,pu=!1,Jd=!1,wh=!1,Qd=!0,Sh=!1;const bo="user-content-";let Fs=!0,Fi=!1,xa={},Ya=null;const Kl=Cr({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Pa=null;const Ma=Cr({},["audio","video","img","source","image","track"]);let gu=null;const wm=Cr({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Sm="http://www.w3.org/1998/Math/MathML",Em="http://www.w3.org/2000/svg",Eh="http://www.w3.org/1999/xhtml";let t1=Eh,q_=!1,Y_=null;const ZH=Cr({},[Sm,Em,Eh],GC);let Wb;const c4=["application/xhtml+xml","text/html"],hW="text/html";let Yc,Ww=null;const mW=d.createElement("form"),qH=function(St){return St instanceof RegExp||St instanceof Function},a0=function(St){if(!(Ww&&Ww===St)){if((!St||typeof St!="object")&&(St={}),St=Ap(St),Wb=c4.indexOf(St.PARSER_MEDIA_TYPE)===-1?Wb=hW:Wb=St.PARSER_MEDIA_TYPE,Yc=Wb==="application/xhtml+xml"?GC:zC,Hr="ALLOWED_TAGS"in St?Cr({},St.ALLOWED_TAGS,Yc):En,fo="ALLOWED_ATTR"in St?Cr({},St.ALLOWED_ATTR,Yc):Zs,Y_="ALLOWED_NAMESPACES"in St?Cr({},St.ALLOWED_NAMESPACES,GC):ZH,gu="ADD_URI_SAFE_ATTR"in St?Cr(Ap(wm),St.ADD_URI_SAFE_ATTR,Yc):wm,Pa="ADD_DATA_URI_TAGS"in St?Cr(Ap(Ma),St.ADD_DATA_URI_TAGS,Yc):Ma,Ya="FORBID_CONTENTS"in St?Cr({},St.FORBID_CONTENTS,Yc):Kl,ko="FORBID_TAGS"in St?Cr({},St.FORBID_TAGS,Yc):{},hs="FORBID_ATTR"in St?Cr({},St.FORBID_ATTR,Yc):{},xa="USE_PROFILES"in St?St.USE_PROFILES:!1,Mn=St.ALLOW_ARIA_ATTR!==!1,cs=St.ALLOW_DATA_ATTR!==!1,Ss=St.ALLOW_UNKNOWN_PROTOCOLS||!1,xl=St.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Tr=St.SAFE_FOR_TEMPLATES||!1,sl=St.WHOLE_DOCUMENT||!1,pu=St.RETURN_DOM||!1,Jd=St.RETURN_DOM_FRAGMENT||!1,wh=St.RETURN_TRUSTED_TYPE||!1,$p=St.FORCE_BODY||!1,Qd=St.SANITIZE_DOM!==!1,Sh=St.SANITIZE_NAMED_PROPS||!1,Fs=St.KEEP_CONTENT!==!1,Fi=St.IN_PLACE||!1,cc=St.ALLOWED_URI_REGEXP||hM,t1=St.NAMESPACE||Eh,kn=St.CUSTOM_ELEMENT_HANDLING||{},St.CUSTOM_ELEMENT_HANDLING&&qH(St.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(kn.tagNameCheck=St.CUSTOM_ELEMENT_HANDLING.tagNameCheck),St.CUSTOM_ELEMENT_HANDLING&&qH(St.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(kn.attributeNameCheck=St.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),St.CUSTOM_ELEMENT_HANDLING&&typeof St.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(kn.allowCustomizedBuiltInElements=St.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Tr&&(cs=!1),Jd&&(pu=!0),xa&&(Hr=Cr({},[...dM]),fo=[],xa.html===!0&&(Cr(Hr,$x),Cr(fo,Wk)),xa.svg===!0&&(Cr(Hr,Rb),Cr(fo,jk),Cr(fo,qg)),xa.svgFilters===!0&&(Cr(Hr,Cd),Cr(fo,jk),Cr(fo,qg)),xa.mathMl===!0&&(Cr(Hr,WC),Cr(fo,fM),Cr(fo,qg))),St.ADD_TAGS&&(Hr===En&&(Hr=Ap(Hr)),Cr(Hr,St.ADD_TAGS,Yc)),St.ADD_ATTR&&(fo===Zs&&(fo=Ap(fo)),Cr(fo,St.ADD_ATTR,Yc)),St.ADD_URI_SAFE_ATTR&&Cr(gu,St.ADD_URI_SAFE_ATTR,Yc),St.FORBID_CONTENTS&&(Ya===Kl&&(Ya=Ap(Ya)),Cr(Ya,St.FORBID_CONTENTS,Yc)),Fs&&(Hr["#text"]=!0),sl&&Cr(Hr,["html","head","body"]),Hr.table&&(Cr(Hr,["tbody"]),delete ko.tbody),St.TRUSTED_TYPES_POLICY){if(typeof St.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ab('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof St.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ab('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');rt=St.TRUSTED_TYPES_POLICY,ft=rt.createHTML("")}else rt===void 0&&(rt=gM(ye,a)),rt!==null&&typeof ft=="string"&&(ft=rt.createHTML(""));qu&&qu(St),Ww=St}},AL=Cr({},["mi","mo","mn","ms","mtext"]),bt=Cr({},["foreignobject","desc","title","annotation-xml"]),wt=Cr({},["title","style","font","a","script"]),wn=Cr({},Rb);Cr(wn,Cd),Cr(wn,gw);const fn=Cr({},WC);Cr(fn,uM);const Fo=function(St){let co=nt(St);(!co||!co.tagName)&&(co={namespaceURI:t1,tagName:"template"});const Go=zC(St.tagName),ka=zC(co.tagName);return Y_[St.namespaceURI]?St.namespaceURI===Em?co.namespaceURI===Eh?Go==="svg":co.namespaceURI===Sm?Go==="svg"&&(ka==="annotation-xml"||AL[ka]):!!wn[Go]:St.namespaceURI===Sm?co.namespaceURI===Eh?Go==="math":co.namespaceURI===Em?Go==="math"&&bt[ka]:!!fn[Go]:St.namespaceURI===Eh?co.namespaceURI===Em&&!bt[ka]||co.namespaceURI===Sm&&!AL[ka]?!1:!fn[Go]&&(wt[Go]||!wn[Go]):!!(Wb==="application/xhtml+xml"&&Y_[St.namespaceURI]):!1},Ls=function(St){pw(t.removed,{element:St});try{St.parentNode.removeChild(St)}catch{St.remove()}},Bi=function(St,co){try{pw(t.removed,{attribute:co.getAttributeNode(St),from:co})}catch{pw(t.removed,{attribute:null,from:co})}if(co.removeAttribute(St),St==="is"&&!fo[St])if(pu||Jd)try{Ls(co)}catch{}else try{co.setAttribute(St,"")}catch{}},Cm=function(St){let co,Go;if($p)St="<remove></remove>"+St;else{const _m=Vk(St,/^[\r\n\t ]+/);Go=_m&&_m[0]}Wb==="application/xhtml+xml"&&t1===Eh&&(St='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+St+"</body></html>");const ka=rt?rt.createHTML(St):St;if(t1===Eh)try{co=new ie().parseFromString(ka,Wb)}catch{}if(!co||!co.documentElement){co=Xt.createDocument(t1,"template",null);try{co.documentElement.innerHTML=q_?ft:ka}catch{}}const bu=co.body||co.documentElement;return St&&Go&&bu.insertBefore(d.createTextNode(Go),bu.childNodes[0]||null),t1===Eh?Lt.call(co,sl?"html":"body")[0]:sl?co.documentElement:bu},u4=function(St){return mn.call(St.ownerDocument||St,St,G.SHOW_ELEMENT|G.SHOW_COMMENT|G.SHOW_TEXT,null,!1)},Qse=function(St){return St instanceof te&&(typeof St.nodeName!="string"||typeof St.textContent!="string"||typeof St.removeChild!="function"||!(St.attributes instanceof ee)||typeof St.removeAttribute!="function"||typeof St.setAttribute!="function"||typeof St.namespaceURI!="string"||typeof St.insertBefore!="function"||typeof St.hasChildNodes!="function")},d4=function(St){return typeof C=="object"?St instanceof C:St&&typeof St=="object"&&typeof St.nodeType=="number"&&typeof St.nodeName=="string"},jb=function(St,co,Go){qt[St]&&y8(qt[St],ka=>{ka.call(t,co,Go,Ww)})},pW=function(St){let co;if(jb("beforeSanitizeElements",St,null),Qse(St))return Ls(St),!0;const Go=Yc(St.nodeName);if(jb("uponSanitizeElement",St,{tagName:Go,allowedTags:Hr}),St.hasChildNodes()&&!d4(St.firstElementChild)&&(!d4(St.content)||!d4(St.content.firstElementChild))&&Sd(/<[/\w]/g,St.innerHTML)&&Sd(/<[/\w]/g,St.textContent))return Ls(St),!0;if(!Hr[Go]||ko[Go]){if(!ko[Go]&&bW(Go)&&(kn.tagNameCheck instanceof RegExp&&Sd(kn.tagNameCheck,Go)||kn.tagNameCheck instanceof Function&&kn.tagNameCheck(Go)))return!1;if(Fs&&!Ya[Go]){const ka=nt(St)||St.parentNode,bu=Je(St)||St.childNodes;if(bu&&ka){const _m=bu.length;for(let Ml=_m-1;Ml>=0;--Ml)ka.insertBefore(Se(bu[Ml],!0),Pe(St))}}return Ls(St),!0}return St instanceof L&&!Fo(St)||(Go==="noscript"||Go==="noembed"||Go==="noframes")&&Sd(/<\/no(script|embed|frames)/i,St.innerHTML)?(Ls(St),!0):(Tr&&St.nodeType===3&&(co=St.textContent,co=Of(co,no," "),co=Of(co,So," "),co=Of(co,fs," "),St.textContent!==co&&(pw(t.removed,{element:St.cloneNode()}),St.textContent=co)),jb("afterSanitizeElements",St,null),!1)},gW=function(St,co,Go){if(Qd&&(co==="id"||co==="name")&&(Go in d||Go in mW))return!1;if(!(cs&&!hs[co]&&Sd(Ts,co))){if(!(Mn&&Sd(_r,co))){if(!fo[co]||hs[co]){if(!(bW(St)&&(kn.tagNameCheck instanceof RegExp&&Sd(kn.tagNameCheck,St)||kn.tagNameCheck instanceof Function&&kn.tagNameCheck(St))&&(kn.attributeNameCheck instanceof RegExp&&Sd(kn.attributeNameCheck,co)||kn.attributeNameCheck instanceof Function&&kn.attributeNameCheck(co))||co==="is"&&kn.allowCustomizedBuiltInElements&&(kn.tagNameCheck instanceof RegExp&&Sd(kn.tagNameCheck,Go)||kn.tagNameCheck instanceof Function&&kn.tagNameCheck(Go))))return!1}else if(!gu[co]){if(!Sd(cc,Of(Go,sa,""))){if(!((co==="src"||co==="xlink:href"||co==="href")&&St!=="script"&&Zg(Go,"data:")===0&&Pa[St])){if(!(Ss&&!Sd($r,Of(Go,sa,"")))){if(Go)return!1}}}}}}return!0},bW=function(St){return St.indexOf("-")>0},vW=function(St){let co,Go,ka,bu;jb("beforeSanitizeAttributes",St,null);const{attributes:_m}=St;if(!_m)return;const Ml={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:fo};for(bu=_m.length;bu--;){co=_m[bu];const{name:Tm,namespaceURI:YH}=co;Go=Tm==="value"?co.value:zk(co.value);const tre=Go;if(ka=Yc(Tm),Ml.attrName=ka,Ml.attrValue=Go,Ml.keepAttr=!0,Ml.forceKeepAttr=void 0,jb("uponSanitizeAttribute",St,Ml),Go=Ml.attrValue,Ml.forceKeepAttr)continue;if(!Ml.keepAttr){Bi(Tm,St);continue}if(!xl&&Sd(/\/>/i,Go)){Bi(Tm,St);continue}Tr&&(Go=Of(Go,no," "),Go=Of(Go,So," "),Go=Of(Go,fs," "));const xW=Yc(St.nodeName);if(!gW(xW,ka,Go)){Bi(Tm,St);continue}if(Sh&&(ka==="id"||ka==="name")&&(Bi(Tm,St),Go=bo+Go),rt&&typeof ye=="object"&&typeof ye.getAttributeType=="function"&&!YH)switch(ye.getAttributeType(xW,ka)){case"TrustedHTML":{Go=rt.createHTML(Go);break}case"TrustedScriptURL":{Go=rt.createScriptURL(Go);break}}if(Go!==tre)try{YH?St.setAttributeNS(YH,Tm,Go):St.setAttribute(Tm,Go)}catch{Bi(Tm,St)}}jb("afterSanitizeAttributes",St,null)},ere=function Es(St){let co;const Go=u4(St);for(jb("beforeSanitizeShadowDOM",St,null);co=Go.nextNode();)jb("uponSanitizeShadowNode",co,null),!pW(co)&&(co.content instanceof p&&Es(co.content),vW(co));jb("afterSanitizeShadowDOM",St,null)};return t.sanitize=function(Es){let St=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},co,Go,ka,bu;if(q_=!Es,q_&&(Es="<!-->"),typeof Es!="string"&&!d4(Es))if(typeof Es.toString=="function"){if(Es=Es.toString(),typeof Es!="string")throw Ab("dirty is not a string, aborting")}else throw Ab("toString is not a function");if(!t.isSupported)return Es;if(yh||a0(St),t.removed=[],typeof Es=="string"&&(Fi=!1),Fi){if(Es.nodeName){const Tm=Yc(Es.nodeName);if(!Hr[Tm]||ko[Tm])throw Ab("root node is forbidden and cannot be sanitized in-place")}}else if(Es instanceof C)co=Cm("<!---->"),Go=co.ownerDocument.importNode(Es,!0),Go.nodeType===1&&Go.nodeName==="BODY"||Go.nodeName==="HTML"?co=Go:co.appendChild(Go);else{if(!pu&&!Tr&&!sl&&Es.indexOf("<")===-1)return rt&&wh?rt.createHTML(Es):Es;if(co=Cm(Es),!co)return pu?null:wh?ft:""}co&&$p&&Ls(co.firstChild);const _m=u4(Fi?Es:co);for(;ka=_m.nextNode();)pW(ka)||(ka.content instanceof p&&ere(ka.content),vW(ka));if(Fi)return Es;if(pu){if(Jd)for(bu=Fn.call(co.ownerDocument);co.firstChild;)bu.appendChild(co.firstChild);else bu=co;return(fo.shadowroot||fo.shadowrootmode)&&(bu=yt.call(s,bu,!0)),bu}let Ml=sl?co.outerHTML:co.innerHTML;return sl&&Hr["!doctype"]&&co.ownerDocument&&co.ownerDocument.doctype&&co.ownerDocument.doctype.name&&Sd(mM,co.ownerDocument.doctype.name)&&(Ml="<!DOCTYPE "+co.ownerDocument.doctype.name+`>
`+Ml),Tr&&(Ml=Of(Ml,no," "),Ml=Of(Ml,So," "),Ml=Of(Ml,fs," ")),rt&&wh?rt.createHTML(Ml):Ml},t.setConfig=function(Es){a0(Es),yh=!0},t.clearConfig=function(){Ww=null,yh=!1},t.isValidAttribute=function(Es,St,co){Ww||a0({});const Go=Yc(Es),ka=Yc(St);return gW(Go,ka,co)},t.addHook=function(Es,St){typeof St=="function"&&(qt[Es]=qt[Es]||[],pw(qt[Es],St))},t.removeHook=function(Es){if(qt[Es])return ja(qt[Es])},t.removeHooks=function(Es){qt[Es]&&(qt[Es]=[])},t.removeAllHooks=function(){qt={}},t}var jC=Kk();const Zk=hn.each,bM=hn.trim,vM=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],xM={ftp:21,http:80,https:443,mailto:25},A8=["img","video"],L8=(e,t)=>ve(e)?!e:ve(t)?!to(A8,t):!0,yM=e=>{try{return decodeURIComponent(e)}catch{return unescape(e)}},wM=(e,t,s)=>{const a=yM(t).replace(/\s/g,"");return e.allow_script_urls?!1:/((java|vb)script|mhtml):/i.test(a)?!0:e.allow_html_data_urls?!1:/^data:image\//i.test(a)?L8(e.allow_svg_data_urls,s)&&/^data:image\/svg\+xml/i.test(a):/^data:/i.test(a)};class If{static parseDataUri(t){let s;const a=decodeURIComponent(t).split(","),d=/data:([^;]+)/.exec(a[0]);return d&&(s=d[1]),{type:s,data:a[1]}}static isDomSafe(t,s,a={}){if(a.allow_script_urls)return!0;{const d=Hh.decode(t).replace(/[\s\u0000-\u001F]+/g,"");return!wM(a,d,s)}}static getDocumentBaseUrl(t){var s;let a;return t.protocol.indexOf("http")!==0&&t.protocol!=="file:"?a=(s=t.href)!==null&&s!==void 0?s:"":a=t.protocol+"//"+t.host+t.pathname,/^[^:]+:\/\/\/?[^\/]+\//.test(a)&&(a=a.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(a)||(a+="/")),a}constructor(t,s={}){this.path="",this.directory="",t=bM(t),this.settings=s;const a=s.base_uri,d=this;if(/^([\w\-]+):([^\/]{2})/i.test(t)||/^\s*#/.test(t)){d.source=t;return}const p=t.indexOf("//")===0;if(t.indexOf("/")===0&&!p&&(t=(a&&a.protocol||"http")+"://mce_host"+t),!/^[\w\-]*:?\/\//.test(t)){const C=a?a.path:new If(document.location.href).directory;if((a==null?void 0:a.protocol)==="")t="//mce_host"+d.toAbsPath(C,t);else{const L=/([^#?]*)([#?]?.*)/.exec(t);L&&(t=(a&&a.protocol||"http")+"://mce_host"+d.toAbsPath(C,L[1])+L[2])}}t=t.replace(/@@/g,"(mce_at)");const v=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?(\[[a-zA-Z0-9:.%]+\]|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(t);v&&Zk(vM,(C,L)=>{let G=v[L];G&&(G=G.replace(/\(mce_at\)/g,"@@")),d[C]=G}),a&&(d.protocol||(d.protocol=a.protocol),d.userInfo||(d.userInfo=a.userInfo),!d.port&&d.host==="mce_host"&&(d.port=a.port),(!d.host||d.host==="mce_host")&&(d.host=a.host),d.source=""),p&&(d.protocol="")}setPath(t){const s=/^(.*?)\/?(\w+)?$/.exec(t);s&&(this.path=s[0],this.directory=s[1],this.file=s[2]),this.source="",this.getURI()}toRelative(t){if(t==="./")return t;const s=new If(t,{base_uri:this});if(s.host!=="mce_host"&&this.host!==s.host&&s.host||this.port!==s.port||this.protocol!==s.protocol&&s.protocol!=="")return s.getURI();const a=this.getURI(),d=s.getURI();if(a===d||a.charAt(a.length-1)==="/"&&a.substr(0,a.length-1)===d)return a;let p=this.toRelPath(this.path,s.path);return s.query&&(p+="?"+s.query),s.anchor&&(p+="#"+s.anchor),p}toAbsolute(t,s){const a=new If(t,{base_uri:this});return a.getURI(s&&this.isSameOrigin(a))}isSameOrigin(t){if(this.host==t.host&&this.protocol==t.protocol){if(this.port==t.port)return!0;const s=this.protocol?xM[this.protocol]:null;if(s&&(this.port||s)==(t.port||s))return!0}return!1}toRelPath(t,s){let a=0,d="",p,v;const C=t.substring(0,t.lastIndexOf("/")).split("/"),L=s.split("/");if(C.length>=L.length){for(p=0,v=C.length;p<v;p++)if(p>=L.length||C[p]!==L[p]){a=p+1;break}}if(C.length<L.length){for(p=0,v=L.length;p<v;p++)if(p>=C.length||C[p]!==L[p]){a=p+1;break}}if(a===1)return s;for(p=0,v=C.length-(a-1);p<v;p++)d+="../";for(p=a-1,v=L.length;p<v;p++)p!==a-1?d+="/"+L[p]:d+=L[p];return d}toAbsPath(t,s){let a=0;const d=/\/$/.test(s)?"/":"",p=t.split("/"),v=s.split("/"),C=[];Zk(p,te=>{te&&C.push(te)});const L=[];for(let te=v.length-1;te>=0;te--)if(!(v[te].length===0||v[te]===".")){if(v[te]===".."){a++;continue}if(a>0){a--;continue}L.push(v[te])}const G=C.length-a;let ee;return G<=0?ee=ms(L).join("/"):ee=C.slice(0,G).join("/")+"/"+ms(L).join("/"),ee.indexOf("/")!==0&&(ee="/"+ee),d&&ee.lastIndexOf("/")!==ee.length-1&&(ee+=d),ee}getURI(t=!1){let s;return(!this.source||t)&&(s="",t||(this.protocol?s+=this.protocol+"://":s+="//",this.userInfo&&(s+=this.userInfo+"@"),this.host&&(s+=this.host),this.port&&(s+=":"+this.port)),this.path&&(s+=this.path),this.query&&(s+="?"+this.query),this.anchor&&(s+="#"+this.anchor),this.source=s),this.source}}const SM=hn.makeMap("src,href,data,background,action,formaction,poster,xlink:href"),KC="data-mce-type";let EM=0;const qk=(e,t,s,a,d)=>{var p,v,C,L;const G=t.validate,ee=s.getSpecialElements();e.nodeType===$m&&!t.allow_conditional_comments&&/^\[if/i.test((p=e.nodeValue)!==null&&p!==void 0?p:"")&&(e.nodeValue=" "+e.nodeValue);const te=(v=d==null?void 0:d.tagName)!==null&&v!==void 0?v:e.nodeName.toLowerCase();if(a!=="html"&&s.isValid(a)){ve(d)&&(d.allowedTags[te]=!0);return}if(e.nodeType!==tu||te==="body")return;const ie=M.fromDom(e),ye=dc(ie,KC),Re=Oa(ie,"data-mce-bogus");if(!ye&&re(Re)){Re==="all"?Xs(ie):di(ie);return}const Se=s.getElementRule(te);if(G&&!Se){yn(ee,te)?Xs(ie):di(ie);return}else ve(d)&&(d.allowedTags[te]=!0);if(G&&Se&&!ye){if(xe((C=Se.attributesForced)!==null&&C!==void 0?C:[],Pe=>{$s(ie,Pe.name,Pe.value==="{$uid}"?`mce_${EM++}`:Pe.value)}),xe((L=Se.attributesDefault)!==null&&L!==void 0?L:[],Pe=>{dc(ie,Pe.name)||$s(ie,Pe.name,Pe.value==="{$uid}"?`mce_${EM++}`:Pe.value)}),Se.attributesRequired&&!mo(Se.attributesRequired,Pe=>dc(ie,Pe))){di(ie);return}if(Se.removeEmptyAttrs&&Vf(ie)){di(ie);return}Se.outputName&&Se.outputName!==te&&ep(ie,Se.outputName)}},CM=(e,t,s,a,d)=>{const p=e.tagName.toLowerCase(),{attrName:v,attrValue:C}=d;d.keepAttr=_M(t,s,a,p,v,C),d.keepAttr?(d.allowedAttributes[v]=!0,DM(v,s)&&(d.attrValue=v),t.allow_svg_data_urls&&qs(C,"data:image/svg+xml")&&(d.forceKeepAttr=!0)):TM(e,v)&&(d.forceKeepAttr=!0)},_M=(e,t,s,a,d,p)=>s!=="html"&&!Mi(a)?!0:!(d in SM&&wM(e,p,a))&&(!e.validate||t.isValid(a,d)||qs(d,"data-")||qs(d,"aria-")),TM=(e,t)=>e.hasAttribute(KC)&&(t==="id"||t==="class"||t==="style"),DM=(e,t)=>e in t.getBoolAttrs(),R8=(e,t,s,a)=>{const{attributes:d}=e;for(let p=d.length-1;p>=0;p--){const v=d[p],C=v.name,L=v.value;!_M(t,s,a,e.tagName.toLowerCase(),C,L)&&!TM(e,C)?e.removeAttribute(C):DM(C,s)&&e.setAttribute(C,C)}},O8=(e,t,s)=>{const a=jC();return a.addHook("uponSanitizeElement",(d,p)=>{qk(d,e,t,s.track(d),p)}),a.addHook("uponSanitizeAttribute",(d,p)=>{CM(d,e,t,s.current(),p)}),a},ZC=(e,t)=>{const a={...{IN_PLACE:!0,ALLOW_UNKNOWN_PROTOCOLS:!0,ALLOWED_TAGS:["#comment","#cdata-section","body"],ALLOWED_ATTR:[]}};return a.PARSER_MEDIA_TYPE=t,e.allow_script_urls?a.ALLOWED_URI_REGEXP=/.*/:e.allow_html_data_urls&&(a.ALLOWED_URI_REGEXP=/^(?!(\w+script|mhtml):)/i),a},kM=e=>{const t=w1(e);if(t==="svg"){const s=["type","href","role","arcrole","title","show","actuate","label","from","to"].map(d=>`xlink:${d}`),a={IN_PLACE:!0,USE_PROFILES:{html:!0,svg:!0,svgFilters:!0},ALLOWED_ATTR:s};jC().sanitize(e,a)}else if(t==="math"){const s={IN_PLACE:!0,USE_PROFILES:{mathMl:!0}};jC().sanitize(e,s)}else throw new Error("Not a namespace element")},AM=(e,t)=>{const s=S1();if(e.sanitize){const a=O8(e,t,s);return{sanitizeHtmlElement:(p,v)=>{a.sanitize(p,ZC(e,v)),a.removed=[],s.reset()},sanitizeNamespaceElement:kM}}else return{sanitizeHtmlElement:(p,v)=>{const C=document.createNodeIterator(p,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT);let L;for(;L=C.nextNode();){const G=s.track(L);qk(L,e,t,G),oo(L)&&R8(L,e,t,G)}s.reset()},sanitizeNamespaceElement:Fe}},Yk=hn.makeMap,LM=hn.extend,RM=(e,t,s,a)=>{const d=e.name,p=d in s&&d!=="title"&&d!=="textarea",v=t.childNodes;for(let C=0,L=v.length;C<L;C++){const G=v[C],ee=new vl(G.nodeName.toLowerCase(),G.nodeType);if(oo(G)){const te=G.attributes;for(let ie=0,ye=te.length;ie<ye;ie++){const Re=te[ie];ee.attr(Re.name,Re.value)}Mi(ee.name)&&(a(G),ee.value=G.innerHTML)}else rn(G)?(ee.value=G.data,p&&(ee.raw=!0)):(so(G)||g1(G)||rs(G))&&(ee.value=G.data);Mi(ee.name)||RM(ee,G,s,a),e.append(ee)}},OM=(e,t,s)=>{const a=[];for(let d=e,p=d;d;p=d,d=d.walk()){const v=d;xe(t,C=>C(v)),Ae(v.parent)&&v!==e?d=p:a.push(v)}for(let d=a.length-1;d>=0;d--){const p=a[d];xe(s,v=>v(p))}},I8=(e,t,s,a)=>{const d=s.validate,p=t.getNonEmptyElements(),v=t.getWhitespaceElements(),C=LM(Yk("script,style,head,html,body,title,meta,param"),t.getBlockElements()),L=yS(t),G=/[ \t\r\n]+/g,ee=/^[ \t\r\n]+/,te=/[ \t\r\n]+$/,ie=nt=>{let rt=nt.parent;for(;ve(rt);){if(rt.name in v)return!0;rt=rt.parent}return!1},ye=nt=>{let rt=nt;for(;ve(rt);){if(rt.name in L)return Ax(t,p,v,rt);rt=rt.parent}return!1},Re=nt=>nt.name in C||Vm(t,nt)||Mi(nt.name)&&nt.parent===e,Se=(nt,rt)=>{const ft=rt?nt.prev:nt.next;return ve(ft)||Ae(nt.parent)?!1:Re(nt.parent)&&(nt.parent!==e||a.isRootContent===!0)};return[nt=>{var rt;if(nt.type===3&&!ie(nt)){let ft=(rt=nt.value)!==null&&rt!==void 0?rt:"";ft=ft.replace(G," "),(gC(nt.prev,Re)||Se(nt,!0))&&(ft=ft.replace(ee,"")),ft.length===0?nt.remove():nt.value=ft}},nt=>{var rt;if(nt.type===1){const ft=t.getElementRule(nt.name);if(d&&ft){const Xt=Ax(t,p,v,nt);ft.paddInEmptyBlock&&Xt&&ye(nt)?pC(s,a,Re,nt):ft.removeEmpty&&Xt?Re(nt)?nt.remove():nt.unwrap():ft.paddEmpty&&(Xt||kx(nt))&&pC(s,a,Re,nt)}}else if(nt.type===3&&!ie(nt)){let ft=(rt=nt.value)!==null&&rt!==void 0?rt:"";(nt.next&&Re(nt.next)||Se(nt,!1))&&(ft=ft.replace(te,"")),ft.length===0?nt.remove():nt.value=ft}}]},Xk=(e,t)=>{var s;const a=(s=t.forced_root_block)!==null&&s!==void 0?s:e.forced_root_block;return a===!1?"":a===!0?"p":a},Ob=(e={},t=Vh())=>{const s=FC(),a=FC(),d={validate:!0,root_name:"body",sanitize:!0,...e},p=new DOMParser,v=AM(d,t),C=(rt,ft,Xt="html")=>{const mn=Xt==="xhtml"?"application/xhtml+xml":"text/html",Fn=yn(t.getSpecialElements(),ft.toLowerCase()),Lt=Fn?`<${ft}>${rt}</${ft}>`:rt,yt=Xt==="xhtml"?`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>${Lt}</body></html>`:`<body>${Lt}</body>`,qt=p.parseFromString(yt,mn).body;return v.sanitizeHtmlElement(qt,mn),Fn?qt.firstChild:qt},L=s.addFilter,G=s.getFilters,ee=s.removeFilter,te=a.addFilter,ie=a.getFilters,ye=a.removeFilter,Re=(rt,ft)=>{ch(t,rt)&&ft.push(rt)},Se=(rt,ft)=>{const Xt=re(ft.attr(KC)),mn=ft.type===1&&!yn(rt,ft.name)&&!Vm(t,ft)&&!Mi(ft.name);return ft.type===3||mn&&!Xt},Pe=(rt,ft)=>{const Xt=LM(Yk("script,style,head,html,body,title,meta,param"),t.getBlockElements()),mn=/^[ \t\r\n]+/,Fn=/[ \t\r\n]+$/;let Lt=rt.firstChild,yt=null;const qt=no=>{var So,fs;no&&(Lt=no.firstChild,Lt&&Lt.type===3&&(Lt.value=(So=Lt.value)===null||So===void 0?void 0:So.replace(mn,"")),Lt=no.lastChild,Lt&&Lt.type===3&&(Lt.value=(fs=Lt.value)===null||fs===void 0?void 0:fs.replace(Fn,"")))};if(t.isValidChild(rt.name,ft.toLowerCase())){for(;Lt;){const no=Lt.next;Se(Xt,Lt)?(yt||(yt=new vl(ft,1),yt.attr(d.forced_root_block_attrs),rt.insert(yt,Lt)),yt.append(Lt)):(qt(yt),yt=null),Lt=no}qt(yt)}},nt={schema:t,addAttributeFilter:te,getAttributeFilters:ie,removeAttributeFilter:ye,addNodeFilter:L,getNodeFilters:G,removeNodeFilter:ee,parse:(rt,ft={})=>{var Xt;const mn=d.validate,Fn=(Xt=ft.context)!==null&&Xt!==void 0?Xt:d.root_name,Lt=C(rt,Fn,ft.format);Xr(t,Lt);const yt=new vl(Fn,11);RM(yt,Lt,t.getSpecialElements(),v.sanitizeNamespaceElement),Lt.innerHTML="";const[qt,no]=I8(yt,t,d,ft),So=[],fs=mn?sa=>Re(sa,So):Fe,Ts={nodes:{},attributes:{}},_r=sa=>ZD(G(),ie(),sa,Ts);if(OM(yt,[qt,_r],[no,fs]),So.reverse(),mn&&So.length>0)if(ft.context){const{pass:sa,fail:cc}=Dn(So,Hr=>Hr.parent===yt);vC(cc,t,yt,_r),ft.invalid=sa.length>0}else vC(So,t,yt,_r);const $r=Xk(d,ft);return $r&&(yt.name==="body"||ft.isRootContent)&&Pe(yt,$r),ft.invalid||mC(Ts,ft),yt}};return b8(nt,d),Nk(nt,d,t),nt},P8=e=>SC(e)?yp({validate:!1}).serialize(e):e,Ka=(e,t,s)=>{const a=P8(e),d=t(a);if(d.isDefaultPrevented())return d;if(SC(e))if(d.content!==a){const p=Ob({validate:!1,forced_root_block:!1,...s}).parse(d.content,{context:e.name});return{...d,content:p}}else return{...d,content:e};else return d},fh=e=>({sanitize:BR(e),sandbox_iframes:f2(e),sandbox_iframes_exclusions:XS(e)}),IM=(e,t)=>{if(t.no_events)return lo.value(t);{const s=ih(e,t);return s.isDefaultPrevented()?lo.error(UO(e,{content:"",...s}).content):lo.value(s)}},PM=(e,t,s)=>s.no_events?t:Ka(t,d=>UO(e,{...s,content:d}),fh(e)).content,Jk=(e,t)=>{if(t.no_events)return lo.value(t);{const s=Ka(t.content,a=>I5(e,{...t,content:a}),fh(e));return s.isDefaultPrevented()?(fu(e,s),lo.error(void 0)):lo.value(s)}},qC=(e,t,s)=>{s.no_events||fu(e,{...s,content:t})},Yg=(e,t,s)=>({element:e,width:t,rows:s}),MM=(e,t)=>({element:e,cells:t}),hh=(e,t)=>({x:e,y:t}),NM=(e,t)=>Ul(e,t).bind(yr).getOr(1),M8=(e,t,s,a,d)=>{const p=NM(d,"rowspan"),v=NM(d,"colspan"),C=e.rows;for(let L=s;L<s+p;L++){C[L]||(C[L]=MM(Ll(a),[]));for(let G=t;G<t+v;G++){const ee=C[L].cells;ee[G]=L===s&&G===t?d:Gl(d)}}},FM=(e,t,s)=>{const a=e.rows;return!!(a[s]?a[s].cells:[])[t]},BM=(e,t,s)=>{for(;FM(e,t,s);)t++;return t},$M=e=>Kn(e,(t,s)=>s.cells.length>t?s.cells.length:t,0),YC=(e,t)=>{const s=e.rows;for(let a=0;a<s.length;a++){const d=s[a].cells;for(let p=0;p<d.length;p++)if(gt(d[p],t))return J.some(hh(p,a))}return J.none()},mh=(e,t,s,a,d)=>{const p=[],v=e.rows;for(let C=s;C<=d;C++){const L=v[C].cells,G=t<a?L.slice(t,a+1):L.slice(a,t+1);p.push(MM(v[C].element,G))}return p},HM=(e,t,s)=>{const a=t.x,d=t.y,p=s.x,v=s.y,C=d<v?mh(e,a,d,p,v):mh(e,a,v,p,d);return Yg(e.element,$M(C),C)},UM=(e,t)=>{const s=Gl(e.element),a=M.fromTag("tbody");return Or(a,t),rr(s,a),s},XC=e=>$t(e.rows,t=>{const s=$t(t.cells,d=>{const p=Ll(d);return Xi(p,"colspan"),Xi(p,"rowspan"),p}),a=Gl(t.element);return Or(a,s),a}),Qk=e=>{const t=Yg(Gl(e),0,[]);return xe($e(e,"tr"),(s,a)=>{xe($e(s,"td,th"),(d,p)=>{M8(t,BM(t,p,a),a,s,d)})}),Yg(t.element,$M(t.rows),t.rows)},VM=e=>UM(e,XC(e)),zM=(e,t,s)=>YC(e,t).bind(a=>YC(e,s).map(d=>HM(e,a,d))),GM=e=>Qt(e,t=>ls(t)==="ul"||ls(t)==="ol"),N8=(e,t)=>Qt(e,s=>ls(s)==="li"&&yy(s,t)).fold(et([]),s=>GM(e).map(a=>{const d=M.fromTag(ls(a)),p=ps(_l(a),(v,C)=>qs(C,"list-style"));return ma(d,p),[M.fromTag("li"),d]}).getOr([])),F8=(e,t)=>{const s=Kn(t,(a,d)=>(rr(d,a),d),e);return t.length>0?vd([s]):s},B8=e=>yf(e)?_s(e).filter(Bv).fold(et([]),t=>[e,t]):Bv(e)?[e]:[],WM=(e,t,s)=>{const a=M.fromDom(t.commonAncestorContainer),d=kf(a,e),p=Ct(d,L=>s.isWrapper(ls(L))),v=N8(d,t),C=p.concat(v.length?v:B8(a));return $t(C,Gl)},eA=()=>vd([]),$8=(e,t,s)=>F8(M.fromDom(t.cloneContents()),WM(e,t,s)),tA=(e,t)=>Rt(t,"table",it(gt,e)),jM=(e,t)=>tA(e,t[0]).bind(s=>{const a=t[0],d=t[t.length-1],p=Qk(s);return zM(p,a,d).map(v=>vd([VM(v)]))}).getOrThunk(eA),H8=(e,t,s)=>t.length>0&&t[0].collapsed?eA():$8(e,t[0],s),KM=(e,t,s)=>{const a=SO(t,e);return a.length>0?jM(e,a):H8(e,t,s)},JC=(e,t)=>t>=0&&t<e.length&&ux(e.charAt(t)),ZM=e=>Ta(e.innerText),ic=e=>e.map(t=>t.nodeName).getOr("div").toLowerCase(),U8=e=>J.from(e.selection.getRng()).map(t=>{var s;const a=J.from(e.dom.getParent(t.commonAncestorContainer,e.dom.isBlock)),d=e.getBody(),p=ic(a),v=M.fromDom(t.cloneContents());kI(v),AI(v);const C=e.dom.add(d,p,{"data-mce-bogus":"all",style:"overflow: hidden; opacity: 0;"},v.dom),L=ZM(C),G=Ta((s=C.textContent)!==null&&s!==void 0?s:"");if(e.dom.remove(C),JC(G,0)||JC(G,G.length-1)){const ee=a.getOr(d),te=ZM(ee),ie=te.indexOf(L);if(ie===-1)return L;{const ye=JC(te,ie-1),Re=JC(te,ie+L.length);return(ye?" ":"")+L+(Re?" ":"")}}else return L}).getOr(""),V8=(e,t)=>{const s=e.selection.getRng(),a=e.dom.create("body"),d=e.selection.getSel(),p=FE(e,ri(d)),v=t.contextual?KM(M.fromDom(e.getBody()),p,e.schema).dom:s.cloneContents();return v&&a.appendChild(v),e.selection.serializer.serialize(a,t)},z8=(e,t)=>{if(t.format==="text")return U8(e);{const s=V8(e,t);return t.format==="tree"?s:e.selection.isCollapsed()?"":s}},G8=(e,t)=>({...e,format:t,get:!0,selection:!0,getInner:!0}),QC=(e,t,s={})=>{const a=G8(s,t);return IM(e,a).fold(Dt,d=>{const p=z8(e,d);return PM(e,p,d)})},nA=0,e_=1,t_=2,W8=(e,t)=>{const s=e.length+t.length+2,a=new Array(s),d=new Array(s),p=(ee,te,ie)=>({start:ee,end:te,diag:ie}),v=(ee,te,ie,ye,Re)=>{const Se=L(ee,te,ie,ye);if(Se===null||Se.start===te&&Se.diag===te-ye||Se.end===ee&&Se.diag===ee-ie){let Pe=ee,Je=ie;for(;Pe<te||Je<ye;)Pe<te&&Je<ye&&e[Pe]===t[Je]?(Re.push([nA,e[Pe]]),++Pe,++Je):te-ee>ye-ie?(Re.push([t_,e[Pe]]),++Pe):(Re.push([e_,t[Je]]),++Je)}else{v(ee,Se.start,ie,Se.start-Se.diag,Re);for(let Pe=Se.start;Pe<Se.end;++Pe)Re.push([nA,e[Pe]]);v(Se.end,te,Se.end-Se.diag,ye,Re)}},C=(ee,te,ie,ye)=>{let Re=ee;for(;Re-te<ye&&Re<ie&&e[Re]===t[Re-te];)++Re;return p(ee,Re,te)},L=(ee,te,ie,ye)=>{const Re=te-ee,Se=ye-ie;if(Re===0||Se===0)return null;const Pe=Re-Se,Je=Se+Re,nt=(Je%2===0?Je:Je+1)/2;a[1+nt]=ee,d[1+nt]=te+1;let rt,ft,Xt,mn,Fn;for(rt=0;rt<=nt;++rt){for(ft=-rt;ft<=rt;ft+=2){for(Xt=ft+nt,ft===-rt||ft!==rt&&a[Xt-1]<a[Xt+1]?a[Xt]=a[Xt+1]:a[Xt]=a[Xt-1]+1,mn=a[Xt],Fn=mn-ee+ie-ft;mn<te&&Fn<ye&&e[mn]===t[Fn];)a[Xt]=++mn,++Fn;if(Pe%2!==0&&Pe-rt<=ft&&ft<=Pe+rt&&d[Xt-Pe]<=a[Xt])return C(d[Xt-Pe],ft+ee-ie,te,ye)}for(ft=Pe-rt;ft<=Pe+rt;ft+=2){for(Xt=ft+nt-Pe,ft===Pe-rt||ft!==Pe+rt&&d[Xt+1]<=d[Xt-1]?d[Xt]=d[Xt+1]-1:d[Xt]=d[Xt-1],mn=d[Xt]-1,Fn=mn-ee+ie-ft;mn>=ee&&Fn>=ie&&e[mn]===t[Fn];)d[Xt]=mn--,Fn--;if(Pe%2===0&&-rt<=ft&&ft<=rt&&d[Xt]<=a[Xt+Pe])return C(d[Xt],ft+ee-ie,te,ye)}}return null},G=[];return v(0,e.length,0,t.length,G),G},oA=e=>oo(e)?e.outerHTML:rn(e)?Hh.encodeRaw(e.data,!1):so(e)?"<!--"+e.data+"-->":"",ph=e=>{let t;const s=document.createElement("div"),a=document.createDocumentFragment();for(e&&(s.innerHTML=e);t=s.firstChild;)a.appendChild(t);return a},qM=(e,t,s)=>{const a=ph(t);if(e.hasChildNodes()&&s<e.childNodes.length){const d=e.childNodes[s];e.insertBefore(a,d)}else e.appendChild(a)},j8=(e,t)=>{if(e.hasChildNodes()&&t<e.childNodes.length){const s=e.childNodes[t];e.removeChild(s)}},sA=(e,t)=>{let s=0;xe(e,a=>{a[0]===nA?s++:a[0]===e_?(qM(t,a[1],s),s++):a[0]===t_&&j8(t,s)})},YM=(e,t)=>Ct($t(In(e.childNodes),t?st(Ta,oA):oA),s=>s.length>0),n_=(e,t)=>{const s=$t(In(t.childNodes),oA);return sA(W8(s,e),t),t},XM=To(()=>document.implementation.createHTMLDocument("undo")),JM=e=>e.querySelector("iframe")!==null,QM=e=>({type:"fragmented",fragments:e,content:"",bookmark:null,beforeBookmark:null}),K8=e=>({type:"complete",fragments:null,content:e,bookmark:null,beforeBookmark:null}),o_=e=>{const t=e.serializer.getTempAttrs(),s=fD(e.getBody(),t);return JM(s)?QM(YM(s,!0)):K8(Ta(s.innerHTML))},bw=(e,t,s)=>{const a=s?t.beforeBookmark:t.bookmark;t.type==="fragmented"?n_(t.fragments,e.getBody()):e.setContent(t.content,{format:"raw",no_selection:ve(a)&&mO(a)?!a.isFakeCaret:!0}),a&&(e.selection.moveToBookmark(a),e.selection.scrollIntoView())},rA=e=>e.type==="fragmented"?e.fragments.join(""):e.content,eN=e=>{const t=M.fromTag("body",XM());return zc(t,rA(e)),xe($e(t,"*[data-mce-bogus]"),di),ku(t)},s_=(e,t)=>rA(e)===rA(t),iA=(e,t)=>eN(e)===eN(t),vw=(e,t)=>!e||!t?!1:s_(e,t)?!0:iA(e,t),r_=e=>e.get()===0,gh=(e,t,s)=>{r_(s)&&(e.typing=t)},tN=(e,t)=>{e.typing&&(gh(e,!1,t),e.add())},Z8=e=>{e.typing&&(e.typing=!1,e.add())},i_=(e,t,s)=>{r_(t)&&s.set(vn(e.selection))},nN=(e,t,s,a,d,p,v)=>{const C=o_(e),L=hn.extend(p||{},C);if(!r_(a)||e.removed)return null;const G=t.data[s.get()];if(e.dispatch("BeforeAddUndo",{level:L,lastLevel:G,originalEvent:v}).isDefaultPrevented()||G&&vw(G,L))return null;t.data[s.get()]&&d.get().each(ie=>{t.data[s.get()].beforeBookmark=ie});const ee=RR(e);if(ee&&t.data.length>ee){for(let ie=0;ie<t.data.length-1;ie++)t.data[ie]=t.data[ie+1];t.data.length--,s.set(t.data.length)}L.bookmark=vn(e.selection),s.get()<t.data.length-1&&(t.data.length=s.get()+1),t.data.push(L),s.set(t.data.length-1);const te={level:L,lastLevel:G,originalEvent:v};return s.get()>0?(e.setDirty(!0),e.dispatch("AddUndo",te),e.dispatch("change",te)):e.dispatch("AddUndo",te),L},oN=(e,t,s)=>{t.data=[],s.set(0),t.typing=!1,e.dispatch("ClearUndos")},sN=(e,t,s,a,d)=>{if(t.transact(a)){const p=t.data[s.get()].bookmark,v=t.data[s.get()-1];bw(e,v,!0),t.transact(d)&&(t.data[s.get()-1].beforeBookmark=p)}},q8=(e,t,s)=>{let a;return t.get()<s.length-1&&(t.set(t.get()+1),a=s[t.get()],bw(e,a,!1),e.setDirty(!0),e.dispatch("Redo",{level:a})),a},Y8=(e,t,s,a)=>{let d;return t.typing&&(t.add(),t.typing=!1,gh(t,!1,s)),a.get()>0&&(a.set(a.get()-1),d=t.data[a.get()],bw(e,d,!0),e.setDirty(!0),e.dispatch("Undo",{level:d})),d},aA=e=>{e.clear(),e.add()},lA=(e,t,s)=>s.get()>0||t.typing&&t.data[0]&&!vw(o_(e),t.data[0]),cA=(e,t)=>t.get()<e.data.length-1&&!e.typing,rN=(e,t,s)=>(tN(e,t),e.beforeChange(),e.ignore(s),e.add()),a_=(e,t)=>{try{e.set(e.get()+1),t()}finally{e.set(e.get()-1)}},iN=(e,t)=>{const s=e.dom,a=ve(t)?t:e.getBody();xe(s.select("table,a",a),d=>{switch(d.nodeName){case"TABLE":const p=qS(e),v=s.getAttrib(d,"border");(!v||v==="0")&&e.hasVisual?s.addClass(d,p):s.removeClass(d,p);break;case"A":if(!s.getAttrib(d,"href")){const C=s.getAttrib(d,"name")||d.id,L=ix(e);C&&e.hasVisual?s.addClass(d,L):s.removeClass(d,L)}break}}),e.dispatch("VisualAid",{element:t,hasVisual:e.hasVisual})},uA=e=>({init:{bindEvents:Fe},undoManager:{beforeChange:(t,s)=>i_(e,t,s),add:(t,s,a,d,p,v)=>nN(e,t,s,a,d,p,v),undo:(t,s,a)=>Y8(e,t,s,a),redo:(t,s)=>q8(e,t,s),clear:(t,s)=>oN(e,t,s),reset:t=>aA(t),hasUndo:(t,s)=>lA(e,t,s),hasRedo:(t,s)=>cA(t,s),transact:(t,s,a)=>rN(t,s,a),ignore:(t,s)=>a_(t,s),extra:(t,s,a,d)=>sN(e,t,s,a,d)},formatter:{match:(t,s,a,d)=>_C(e,t,s,a,d),matchAll:(t,s)=>Q6(e,t,s),matchNode:(t,s,a,d)=>uh(e,t,s,a,d),canApply:t=>e8(e,t),closest:t=>OP(e,t),apply:(t,s,a)=>Ik(e,t,s,a),remove:(t,s,a,d)=>Lk(e,t,s,a,d),toggle:(t,s,a)=>JP(e,t,s,a),formatChanged:(t,s,a,d,p)=>l8(e,t,s,a,d,p)},editor:{getContent:t=>OI(e,t),setContent:(t,s)=>X6(e,t,s),insertContent:(t,s)=>q6(e,t,s),addVisual:t=>iN(e,t)},selection:{getContent:(t,s)=>QC(e,t,s)},autocompleter:{addDecoration:Fe,removeDecoration:Fe},raw:{getModel:()=>J.none()}}),X8=e=>{const t=G=>Y(G)?G:{},{init:s,undoManager:a,formatter:d,editor:p,selection:v,autocompleter:C,raw:L}=e;return{init:{bindEvents:s.bindEvents},undoManager:{beforeChange:a.beforeChange,add:a.add,undo:a.undo,redo:a.redo,clear:a.clear,reset:a.reset,hasUndo:a.hasUndo,hasRedo:a.hasRedo,transact:(G,ee,te)=>a.transact(te),ignore:(G,ee)=>a.ignore(ee),extra:(G,ee,te,ie)=>a.extra(te,ie)},formatter:{match:(G,ee,te,ie)=>d.match(G,t(ee),ie),matchAll:d.matchAll,matchNode:d.matchNode,canApply:G=>d.canApply(G),closest:G=>d.closest(G),apply:(G,ee,te)=>d.apply(G,t(ee)),remove:(G,ee,te,ie)=>d.remove(G,t(ee)),toggle:(G,ee,te)=>d.toggle(G,t(ee)),formatChanged:(G,ee,te,ie,ye)=>d.formatChanged(ee,te,ie,ye)},editor:{getContent:G=>p.getContent(G),setContent:(G,ee)=>({content:p.setContent(G,ee),html:""}),insertContent:(G,ee)=>(p.insertContent(G),""),addVisual:p.addVisual},selection:{getContent:(G,ee)=>v.getContent(ee)},autocompleter:{addDecoration:C.addDecoration,removeDecoration:C.removeDecoration},raw:{getModel:()=>J.some(L.getRawModel())}}},J8=()=>{const e=et(null),t=et("");return{init:{bindEvents:Fe},undoManager:{beforeChange:Fe,add:e,undo:e,redo:e,clear:Fe,reset:Fe,hasUndo:vt,hasRedo:vt,transact:e,ignore:Fe,extra:Fe},formatter:{match:vt,matchAll:et([]),matchNode:et(void 0),canApply:vt,closest:t,apply:Fe,remove:Fe,toggle:Fe,formatChanged:et({unbind:Fe})},editor:{getContent:t,setContent:et({content:"",html:""}),insertContent:et(""),addVisual:Fe},selection:{getContent:t},autocompleter:{addDecoration:Fe,removeDecoration:Fe},raw:{getModel:et(J.none())}}},Pf=e=>yn(e.plugins,"rtc"),aN=e=>Gn(e.plugins,"rtc").bind(t=>J.from(t.setup)),lN=e=>{const t=e;return aN(e).fold(()=>(t.rtcInstance=uA(e),J.none()),s=>(t.rtcInstance=J8(),J.some(()=>s().then(a=>(t.rtcInstance=X8(a),a.rtc.isRemote)))))},dA=e=>e.rtcInstance?e.rtcInstance:uA(e),ol=e=>{const t=e.rtcInstance;if(t)return t;throw new Error("Failed to get RTC instance not yet initialized.")},Q8=(e,t,s)=>{ol(e).undoManager.beforeChange(t,s)},cN=(e,t,s,a,d,p,v)=>ol(e).undoManager.add(t,s,a,d,p,v),uN=(e,t,s,a)=>ol(e).undoManager.undo(t,s,a),e$=(e,t,s)=>ol(e).undoManager.redo(t,s),t$=(e,t,s)=>{ol(e).undoManager.clear(t,s)},Hx=(e,t)=>{ol(e).undoManager.reset(t)},n$=(e,t,s)=>ol(e).undoManager.hasUndo(t,s),o$=(e,t,s)=>ol(e).undoManager.hasRedo(t,s),dN=(e,t,s,a)=>ol(e).undoManager.transact(t,s,a),fN=(e,t,s)=>{ol(e).undoManager.ignore(t,s)},l_=(e,t,s,a,d)=>{ol(e).undoManager.extra(t,s,a,d)},s$=(e,t,s,a,d)=>ol(e).formatter.match(t,s,a,d),r$=(e,t,s)=>ol(e).formatter.matchAll(t,s),i$=(e,t,s,a,d)=>ol(e).formatter.matchNode(t,s,a,d),a$=(e,t)=>ol(e).formatter.canApply(t),l$=(e,t)=>ol(e).formatter.closest(t),c$=(e,t,s,a)=>{ol(e).formatter.apply(t,s,a)},u$=(e,t,s,a,d)=>{ol(e).formatter.remove(t,s,a,d)},d$=(e,t,s,a)=>{ol(e).formatter.toggle(t,s,a)},f$=(e,t,s,a,d,p)=>ol(e).formatter.formatChanged(t,s,a,d,p),h$=(e,t)=>dA(e).editor.getContent(t),Gr=(e,t,s)=>dA(e).editor.setContent(t,s),hN=(e,t,s)=>dA(e).editor.insertContent(t,s),fA=(e,t,s)=>ol(e).selection.getContent(t,s),mN=(e,t)=>ol(e).editor.addVisual(t),hA=e=>ol(e).init.bindEvents(),mA=(e,t={})=>{const s=t.format?t.format:"html";return fA(e,s,t)},pN=e=>e.dom.length===0?(Xs(e),J.none()):J.some(e),m$=(e,t)=>e.filter(s=>Mr.isBookmarkNode(s.dom)).bind(t?xs:Vs),gN=(e,t,s,a,d)=>{const p=e.dom,v=t.dom,C=a?p.length:v.length;a?(RD(p,v,d,!1,!a),s.setStart(v,C)):(RD(v,p,d,!1,!a),s.setEnd(v,C))},p$=(e,t,s)=>{_s(e).each(a=>{const d=e.dom;t&&_x(a,Et(d,0),s)?JE(d,0,s):!t&&yb(a,Et(d,d.length),s)&&QE(d,d.length,s)})},bN=(e,t,s,a,d)=>{e.bind(p=>((a?QE:JE)(p.dom,a?p.dom.length:0,d),t.filter(ti).map(C=>gN(p,C,s,a,d)))).orThunk(()=>m$(t,a).or(t).filter(ti).map(v=>p$(v,a,d)))},Ux=(e,t,s)=>{const a=J.from(t.firstChild).map(M.fromDom),d=J.from(t.lastChild).map(M.fromDom);e.deleteContents(),e.insertNode(t);const p=a.bind(Vs).filter(ti).bind(pN),v=d.bind(xs).filter(ti).bind(pN);bN(p,a,e,!0,s),bN(v,d,e,!1,s),e.collapse(!1)},g$=(e,t)=>({format:"html",...e,set:!0,selection:!0,content:t}),Vx=(e,t)=>{if(t.format!=="raw"){const s=e.selection.getRng(),a=e.dom.getParent(s.commonAncestorContainer,e.dom.isBlock),d=a?{context:a.nodeName.toLowerCase()}:{},p=e.parser.parse(t.content,{forced_root_block:!1,...d,...t});return yp({validate:!1},e.schema).serialize(p)}else return t.content},xw=(e,t,s={})=>{const a=g$(s,t);Jk(e,a).each(d=>{const p=Vx(e,d),v=e.selection.getRng();Ux(v,v.createContextualFragment(p),e.schema),e.selection.setRng(v),Kd(e,v),qC(e,p,d)})},Ib=(e,t,s)=>{if(yn(e,t)){const a=Ct(e[t],d=>d!==s);a.length===0?delete e[t]:e[t]=a}};var pA=(e,t)=>{let s,a;const d=(C,L)=>Qt(L,G=>e.is(G,C)),p=C=>e.getParents(C,void 0,e.getRoot()),v=()=>{s={},a={},t.on("NodeChange",C=>{const L=C.element,G=p(L),ee={};qo(s,(te,ie)=>{d(ie,G).each(ye=>{a[ie]||(xe(te,Re=>{Re(!0,{node:ye,selector:ie,parents:G})}),a[ie]=te),ee[ie]=te})}),qo(a,(te,ie)=>{ee[ie]||(delete a[ie],xe(te,ye=>{ye(!1,{node:L,selector:ie,parents:G})}))})})};return{selectorChangedWithUnbind:(C,L)=>(s||v(),s[C]||(s[C]=[]),s[C].push(L),d(C,p(t.selection.getStart())).each(()=>{a[C]=s[C]}),{unbind:()=>{Ib(s,C,L),Ib(a,C,L)}})}};const gA=e=>!!(e&&e.ownerDocument)&&ln(M.fromDom(e.ownerDocument),M.fromDom(e)),vN=e=>e?gA(e.startContainer)&&gA(e.endContainer):!1,c_=(e,t,s,a)=>{let d,p;const{selectorChangedWithUnbind:v}=pA(e,a),C=(En,fo)=>{const Zs=e.createRng();ve(En)&&ve(fo)?(Zs.setStart(En,fo),Zs.setEnd(En,fo),ft(Zs),Je(!1)):(wy(e,Zs,a.getBody(),!0),ft(Zs))},L=En=>mA(a,En),G=(En,fo)=>xw(a,En,fo),ee=En=>wI(a.getBody(),rt(),En),te=En=>SI(a.getBody(),rt(),En),ie=(En,fo)=>cc.getBookmark(En,fo),ye=En=>cc.moveToBookmark(En),Re=(En,fo)=>(jy(e,En,fo).each(ft),En),Se=()=>{const En=rt(),fo=nt();return!En||En.item?!1:En.compareEndPoints?En.compareEndPoints("StartToEnd",En)===0:!fo||En.collapsed},Pe=()=>{const En=rt(),fo=a.getBody().querySelectorAll('[data-mce-selected="1"]');return fo.length>0?jo(fo,Zs=>e.isEditable(Zs.parentElement)):xI(e,En)},Je=En=>{const fo=rt();fo.collapse(!!En),ft(fo)},nt=()=>t.getSelection?t.getSelection():t.document.selection,rt=()=>{let En;const fo=(kn,ko,hs)=>{try{return ko.compareBoundaryPoints(kn,hs)}catch{return-1}},Zs=t.document;if(ve(a.bookmark)&&!gb(a)){const kn=vx(a);if(kn.isSome())return kn.map(ko=>FE(a,[ko])[0]).getOr(Zs.createRange())}try{const kn=nt();kn&&!Qp(kn.anchorNode)&&(kn.rangeCount>0?En=kn.getRangeAt(0):En=Zs.createRange(),En=FE(a,[En])[0])}catch{}if(En||(En=Zs.createRange()),id(En.startContainer)&&En.collapsed){const kn=e.getRoot();En.setStart(kn,0),En.setEnd(kn,0)}return d&&p&&(fo(En.START_TO_START,En,d)===0&&fo(En.END_TO_END,En,d)===0?En=p:(d=null,p=null)),En},ft=(En,fo)=>{if(!vN(En))return;const Zs=nt();if(En=a.dispatch("SetSelectionRange",{range:En,forward:fo}).range,Zs){p=En;try{Zs.removeAllRanges(),Zs.addRange(En)}catch{}fo===!1&&Zs.extend&&(Zs.collapse(En.endContainer,En.endOffset),Zs.extend(En.startContainer,En.startOffset)),d=Zs.rangeCount>0?Zs.getRangeAt(0):null}if(!En.collapsed&&En.startContainer===En.endContainer&&(Zs!=null&&Zs.setBaseAndExtent)&&En.endOffset-En.startOffset<2&&En.startContainer.hasChildNodes()){const ko=En.startContainer.childNodes[En.startOffset];ko&&ko.nodeName==="IMG"&&(Zs.setBaseAndExtent(En.startContainer,En.startOffset,En.endContainer,En.endOffset),(Zs.anchorNode!==En.startContainer||Zs.focusNode!==En.endContainer)&&Zs.setBaseAndExtent(ko,0,ko,1))}a.dispatch("AfterSetSelectionRange",{range:En,forward:fo})},Xt=En=>(G(e.getOuterHTML(En)),En),mn=()=>h6(a.getBody(),rt()),Fn=(En,fo)=>uD(e,rt(),En,fo),Lt=()=>{const En=nt(),fo=En==null?void 0:En.anchorNode,Zs=En==null?void 0:En.focusNode;if(!En||!fo||!Zs||Qp(fo)||Qp(Zs))return!0;const kn=e.createRng(),ko=e.createRng();try{kn.setStart(fo,En.anchorOffset),kn.collapse(!0),ko.setStart(Zs,En.focusOffset),ko.collapse(!0)}catch{return!0}return kn.compareBoundaryPoints(kn.START_TO_START,ko)<=0},sa={dom:e,win:t,serializer:s,editor:a,expand:(En={type:"word"})=>ft(Og(e).expand(rt(),En)),collapse:Je,setCursorLocation:C,getContent:L,setContent:G,getBookmark:ie,moveToBookmark:ye,select:Re,isCollapsed:Se,isEditable:Pe,isForward:Lt,setNode:Xt,getNode:mn,getSel:nt,setRng:ft,getRng:rt,getStart:ee,getEnd:te,getSelectedBlocks:Fn,normalize:()=>{const En=rt(),fo=nt();if(!by(fo)&&fx(a)){const Zs=rm(e,En);return Zs.each(kn=>{ft(kn,Lt())}),Zs.getOr(En)}return En},selectorChanged:(En,fo)=>(v(En,fo),sa),selectorChangedWithUnbind:v,getScrollContainer:()=>{let En,fo=e.getRoot();for(;fo&&fo.nodeName!=="BODY";){if(fo.scrollHeight>fo.clientHeight){En=fo;break}fo=fo.parentNode}return En},scrollIntoView:(En,fo)=>{ve(En)?Q2(a,En,fo):Kd(a,rt(),fo)},placeCaretAt:(En,fo)=>ft(YO(En,fo,a.getDoc())),getBoundingClientRect:()=>{const En=rt();return En.collapsed?Et.fromRangeStart(En).getClientRects()[0]:En.getBoundingClientRect()},destroy:()=>{t=d=p=null,Hr.destroy()}},cc=Mr(sa),Hr=Er(sa,a);return sa.bookmarkManager=cc,sa.controlSelection=Hr,sa},xN=(e,t,s)=>{t.addNodeFilter("br",(a,d,p)=>{const v=hn.extend({},s.getBlockElements()),C=s.getNonEmptyElements(),L=s.getWhitespaceElements();v.body=1;const G=ee=>ee.name in v||Vm(s,ee);for(let ee=0,te=a.length;ee<te;ee++){let ie=a[ee],ye=ie.parent;if(ye&&G(ye)&&ie===ye.lastChild){let Re=ie.prev;for(;Re;){const Se=Re.name;if(Se!=="span"||Re.attr("data-mce-type")!=="bookmark"){Se==="br"&&(ie=null);break}Re=Re.prev}if(ie&&(ie.remove(),Ax(s,C,L,ye))){const Se=s.getElementRule(ye.name);Se&&(Se.removeEmpty?ye.remove():Se.paddEmpty&&pC(e,p,G,ye))}}else{let Re=ie;for(;ye&&ye.firstChild===Re&&ye.lastChild===Re&&(Re=ye,!v[ye.name]);)ye=ye.parent;if(Re===ye){const Se=new vl("#text",3);Se.value=Vo,ie.replace(Se)}}}})},yN=(e,t,s)=>{e.addAttributeFilter("data-mce-tabindex",(a,d)=>{let p=a.length;for(;p--;){const v=a[p];v.attr("tabindex",v.attr("data-mce-tabindex")),v.attr(d,null)}}),e.addAttributeFilter("src,href,style",(a,d)=>{const p="data-mce-"+d,v=t.url_converter,C=t.url_converter_scope;let L=a.length;for(;L--;){const G=a[L];let ee=G.attr(p);ee!==void 0?(G.attr(d,ee.length>0?ee:null),G.attr(p,null)):(ee=G.attr(d),d==="style"?ee=s.serializeStyle(s.parseStyle(ee),G.name):v&&(ee=v.call(C,ee,d,G.name)),G.attr(d,ee.length>0?ee:null))}}),e.addAttributeFilter("class",a=>{let d=a.length;for(;d--;){const p=a[d];let v=p.attr("class");v&&(v=v.replace(/(?:^|\s)mce-item-\w+(?!\S)/g,""),p.attr("class",v.length>0?v:null))}}),e.addAttributeFilter("data-mce-type",(a,d,p)=>{let v=a.length;for(;v--;){const C=a[v];C.attr("data-mce-type")==="bookmark"&&!p.cleanup&&(J.from(C.firstChild).exists(G=>{var ee;return!$v((ee=G.value)!==null&&ee!==void 0?ee:"")})?C.unwrap():C.remove())}}),e.addNodeFilter("noscript",a=>{var d;let p=a.length;for(;p--;){const v=a[p].firstChild;v&&(v.value=Hh.decode((d=v.value)!==null&&d!==void 0?d:""))}}),e.addNodeFilter("script,style",(a,d)=>{var p;const v=L=>L.replace(/(<!--\[CDATA\[|\]\]-->)/g,`
`).replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*((<!--)?(\s*\/\/)?\s*<!\[CDATA\[|(<!--\s*)?\/\*\s*<!\[CDATA\[\s*\*\/|(\/\/)?\s*<!--|\/\*\s*<!--\s*\*\/)\s*[\r\n]*/gi,"").replace(/\s*(\/\*\s*\]\]>\s*\*\/(-->)?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"");let C=a.length;for(;C--;){const L=a[C],G=L.firstChild,ee=(p=G==null?void 0:G.value)!==null&&p!==void 0?p:"";if(d==="script"){const te=L.attr("type");te&&L.attr("type",te==="mce-no/type"?null:te.replace(/^mce\-/,"")),t.element_format==="xhtml"&&G&&ee.length>0&&(G.value=`// <![CDATA[
`+v(ee)+`
// ]]>`)}else t.element_format==="xhtml"&&G&&ee.length>0&&(G.value=`<!--
`+v(ee)+`
-->`)}}),e.addNodeFilter("#comment",a=>{let d=a.length;for(;d--;){const p=a[d],v=p.value;t.preserve_cdata&&(v==null?void 0:v.indexOf("[CDATA["))===0?(p.name="#cdata",p.type=4,p.value=s.decode(v.replace(/^\[CDATA\[|\]\]$/g,""))):(v==null?void 0:v.indexOf("mce:protected "))===0&&(p.name="#text",p.type=3,p.raw=!0,p.value=unescape(v).substr(14))}}),e.addNodeFilter("xml:namespace,input",(a,d)=>{let p=a.length;for(;p--;){const v=a[p];v.type===7?v.remove():v.type===1&&d==="input"&&!v.attr("type")&&v.attr("type","text")}}),e.addAttributeFilter("data-mce-type",a=>{xe(a,d=>{d.attr("data-mce-type")==="format-caret"&&(d.isEmpty(e.schema.getNonEmptyElements())?d.remove():d.unwrap())})}),e.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style,data-mce-selected,data-mce-expando,data-mce-block,data-mce-type,data-mce-resize,data-mce-placeholder",(a,d)=>{let p=a.length;for(;p--;)a[p].attr(d,null)}),t.remove_trailing_brs&&xN(t,e,e.schema)},wN=e=>{const t=a=>(a==null?void 0:a.name)==="br",s=e.lastChild;if(t(s)){const a=s.prev;t(a)&&(s.remove(),a.remove())}},bA=(e,t,s)=>{let a;const d=e.dom;let p=t.cloneNode(!0);const v=document.implementation;if(v.createHTMLDocument){const C=v.createHTMLDocument("");hn.each(p.nodeName==="BODY"?p.childNodes:[p],L=>{C.body.appendChild(C.importNode(L,!0))}),p.nodeName!=="BODY"?p=C.body.firstChild:p=C.body,a=d.doc,d.doc=C}return ky(e,{...s,node:p}),a&&(d.doc=a),p},SN=(e,t)=>ve(e)&&e.hasEventListeners("PreProcess")&&!t.no_events,EN=(e,t,s)=>SN(e,s)?bA(e,t,s):t,vA=(e,t,s)=>{hn.inArray(t,s)===-1&&(e.addAttributeFilter(s,(a,d)=>{let p=a.length;for(;p--;)a[p].attr(d,null)}),t.push(s))},b$=(e,t,s)=>!t.no_events&&e?Ay(e,{...t,content:s}).content:s,CN=(e,t,s)=>{const a=Ta(s.getInner?t.innerHTML:e.getOuterHTML(t));return s.selection||vg(M.fromDom(t))?a:hn.trim(a)},_N=(e,t,s)=>{const a=s.selection?{forced_root_block:!1,...s}:s,d=e.parse(t,a);return wN(d),d},TN=(e,t,s)=>yp(e,t).serialize(s),v$=(e,t,s,a,d)=>{const p=TN(t,s,a);return b$(e,d,p)},x$=(e,t)=>{const s=["data-mce-selected"],a={entity_encoding:"named",remove_trailing_brs:!0,pad_empty_with_br:!1,...e},d=t&&t.dom?t.dom:js.DOM,p=t&&t.schema?t.schema:Vh(a),v=Ob(a,p);yN(v,a,d);const C=(L,G={})=>{const ee={format:"html",...G},te=EN(t,L,ee),ie=CN(d,te,ee),ye=_N(v,ie,ee);return ee.format==="tree"?ye:v$(t,a,p,ye,ee)};return{schema:p,addNodeFilter:v.addNodeFilter,addAttributeFilter:v.addAttributeFilter,serialize:C,addRules:p.addValidElements,setRules:p.setValidElements,addTempAttr:it(vA,v,s),getTempAttrs:et(s),getNodeFilters:v.getNodeFilters,getAttributeFilters:v.getAttributeFilters,removeNodeFilter:v.removeNodeFilter,removeAttributeFilter:v.removeAttributeFilter}},yw=(e,t)=>{const s=x$(e,t);return{schema:s.schema,addNodeFilter:s.addNodeFilter,addAttributeFilter:s.addAttributeFilter,serialize:s.serialize,addRules:s.addRules,setRules:s.setRules,addTempAttr:s.addTempAttr,getTempAttrs:s.getTempAttrs,getNodeFilters:s.getNodeFilters,getAttributeFilters:s.getAttributeFilters,removeNodeFilter:s.removeNodeFilter,removeAttributeFilter:s.removeAttributeFilter}},DN="html",kN=(e,t)=>({...e,format:t,get:!0,getInner:!0}),AN=(e,t={})=>{const s=t.format?t.format:DN,a=kN(t,s);return IM(e,a).fold(Dt,d=>{const p=h$(e,d);return PM(e,p,d)})},y$="html",w$=(e,t)=>({format:y$,...e,set:!0,content:t}),xA=(e,t,s={})=>{const a=w$(s,t);return Jk(e,a).map(d=>{const p=Gr(e,d.content,d);return qC(e,p.html,d),p.content}).getOr(t)},S$="autoresize_on_init,content_editable_state,padd_empty_with_br,block_elements,boolean_attributes,editor_deselector,editor_selector,elements,file_browser_callback_types,filepicker_validator_handler,force_hex_style_colors,force_p_newlines,gecko_spellcheck,images_dataimg_filter,media_scripts,mode,move_caret_before_on_enter_elements,non_empty_elements,self_closing_elements,short_ended_elements,special,spellchecker_select_languages,spellchecker_whitelist,tab_focus,tabfocus_elements,table_responsive_width,text_block_elements,text_inline_elements,toolbar_drawer,types,validate,whitespace_elements,paste_enable_default_filters,paste_filter_drop,paste_word_valid_elements,paste_retain_style_properties,paste_convert_word_fake_lists,template_cdate_classes,template_mdate_classes,template_selected_content_classes,template_preview_replace_values,template_replace_values,templates,template_cdate_format,template_mdate_format".split(","),LN=[],RN="bbcode,colorpicker,contextmenu,fullpage,legacyoutput,spellchecker,template,textcolor,rtc".split(","),yA=[],ON=(e,t)=>{const s=Ct(t,a=>yn(e,a));return Pt(s)},E$=e=>{const t=ON(e,S$),s=e.forced_root_block;return(s===!1||s==="")&&t.push("forced_root_block (false only)"),Pt(t)},C$=e=>ON(e,LN),IN=(e,t)=>{const s=hn.makeMap(e.plugins," "),d=Ct(t,p=>yn(s,p));return Pt(d)},u_=e=>IN(e,RN),PN=e=>IN(e,yA.map(t=>t.name)),_$=(e,t)=>{const s=E$(e),a=u_(t),d=a.length>0,p=s.length>0,v=t.theme==="mobile";if(d||p||v){const C=`
- `,L=v?`

Themes:${C}mobile`:"",G=d?`

Plugins:${C}${a.join(C)}`:"",ee=p?`

Options:${C}${s.join(C)}`:"";console.warn("The following deprecated features are currently enabled and have been removed in TinyMCE 7.0. These features will no longer work and should be removed from the TinyMCE configuration. See https://www.tiny.cloud/docs/tinymce/7/migration-from-6x/ for more information."+L+G+ee)}},MN=e=>Qt(yA,t=>t.name===e).fold(()=>e,t=>t.replacedWith?`${e}, replaced by ${t.replacedWith}`:e),NN=(e,t)=>{const s=C$(e),a=PN(t),d=a.length>0,p=s.length>0;if(d||p){const v=`
- `,C=d?`

Plugins:${v}${a.map(MN).join(v)}`:"",L=p?`

Options:${v}${s.join(v)}`:"";console.warn("The following deprecated features are currently enabled but will be removed soon."+C+L)}},wA=(e,t)=>{_$(e,t),NN(e,t)},ww=js.DOM,FN=e=>{ww.setStyle(e.id,"display",e.orgDisplay)},Sw=e=>J.from(e).each(t=>t.destroy()),T$=e=>{const t=e;t.contentAreaContainer=t.formElement=t.container=t.editorContainer=null,t.bodyElement=t.contentDocument=t.contentWindow=null,t.iframeElement=t.targetElm=null;const s=e.selection;if(s){const a=s.dom;t.selection=s.win=s.dom=a.doc=null}},D$=e=>{const t=e.formElement;t&&(t._mceOldSubmit&&(t.submit=t._mceOldSubmit,delete t._mceOldSubmit),ww.unbind(t,"submit reset",e.formEventDelegate))},Ew=e=>{if(!e.removed){const{_selectionOverrides:t,editorUpload:s}=e,a=e.getBody(),d=e.getElement();a&&e.save({is_removing:!0}),e.removed=!0,e.unbindAllNativeEvents(),e.hasHiddenInput&&ve(d==null?void 0:d.nextSibling)&&ww.remove(d.nextSibling),wE(e),e.editorManager.remove(e),!e.inline&&a&&FN(e),SE(e),ww.remove(e.getContainer()),Sw(t),Sw(s),e.destroy()}},k$=(e,t)=>{const{selection:s,dom:a}=e;if(!e.destroyed){if(!t&&!e.removed){e.remove();return}t||(e.editorManager.off("beforeunload",e._beforeUnload),e.theme&&e.theme.destroy&&e.theme.destroy(),Sw(s),Sw(a)),D$(e),T$(e),e.destroyed=!0}},Pb=(()=>{const e={};return{add:(d,p)=>{e[d]=p},get:d=>e[d]?e[d]:{icons:{}},has:d=>yn(e,d)}})(),Mb=Al.ModelManager,SA=(e,t)=>t.dom[e],BN=(e,t)=>parseInt(Vi(t,e),10),L$=it(SA,"clientWidth"),$N=it(SA,"clientHeight"),EA=it(BN,"margin-top"),d_=it(BN,"margin-left"),HN=e=>e.dom.getBoundingClientRect(),CA=(e,t,s)=>{const a=L$(e),d=$N(e);return t>=0&&s>=0&&t<=a&&s<=d},UN=(e,t,s,a)=>{const d=HN(t),p=e?d.left+t.dom.clientLeft+d_(t):0,v=e?d.top+t.dom.clientTop+EA(t):0,C=s-p,L=a-v;return{x:C,y:L}},R$=(e,t,s)=>{const a=M.fromDom(e.getBody()),d=e.inline?a:Sr(a),p=UN(e.inline,d,t,s);return CA(d,p.x,p.y)},VN=e=>J.from(e).map(M.fromDom),O$=e=>{const t=e.inline?e.getBody():e.getContentAreaContainer();return VN(t).map(Ui).getOr(!1)};var zN=()=>{const e=()=>{throw new Error("Theme did not provide a NotificationManager implementation.")};return{open:e,close:e,getArgs:e}};const _A=e=>{const t=[],s=()=>{const ie=e.theme;return ie&&ie.getNotificationManagerImpl?ie.getNotificationManagerImpl():zN()},a=()=>J.from(t[0]),d=(ie,ye)=>ie.type===ye.type&&ie.text===ye.text&&!ie.progressBar&&!ie.timeout&&!ye.progressBar&&!ye.timeout,p=()=>{a().each(ie=>{ie.reposition()})},v=ie=>{t.push(ie)},C=ie=>{Cn(t,ye=>ye===ie).each(ye=>{t.splice(ye,1)})},L=(ie,ye=!0)=>e.removed||!O$(e)?{}:(ye&&e.dispatch("BeforeOpenNotification",{notification:ie}),Qt(t,Re=>d(s().getArgs(Re),ie)).getOrThunk(()=>{e.editorManager.setActive(e);const Re=s().open(ie,()=>{C(Re)},()=>bb(e));return v(Re),p(),e.dispatch("OpenNotification",{notification:{...Re}}),Re})),G=()=>{a().each(ie=>{s().close(ie),C(ie),p()})},ee=et(t);return(ie=>{ie.on("SkinLoaded",()=>{const ye=ZB(ie);ye&&L({text:ye,type:"warning",timeout:0},!1),p()}),ie.on("show ResizeEditor NodeChange",()=>{requestAnimationFrame(p)}),ie.on("remove",()=>{xe(t.slice(),ye=>{s().close(ye)})}),ie.addShortcut("alt+F12","Focus to notification",()=>a().map(ye=>M.fromDom(ye.getEl())).each(ye=>eD(ye)))})(e),{open:L,close:G,getNotifications:ee}},zx=Al.PluginManager,Xg=Al.ThemeManager;var TA=()=>{const e=()=>{throw new Error("Theme did not provide a WindowManager implementation.")};return{open:e,openUrl:e,alert:e,confirm:e,close:e}};const DA=e=>{let t=[];const s=()=>{const Se=e.theme;return Se&&Se.getWindowManagerImpl?Se.getWindowManagerImpl():TA()},a=(Se,Pe)=>(...Je)=>Pe?Pe.apply(Se,Je):void 0,d=Se=>{e.dispatch("OpenWindow",{dialog:Se})},p=Se=>{e.dispatch("CloseWindow",{dialog:Se})},v=Se=>{t.push(Se),d(Se)},C=Se=>{p(Se),t=Ct(t,Pe=>Pe!==Se),t.length===0&&e.focus()},L=()=>J.from(t[t.length-1]),G=Se=>{e.editorManager.setActive(e),PE(e),e.ui.show();const Pe=Se();return v(Pe),Pe},ee=(Se,Pe)=>G(()=>s().open(Se,Pe,C)),te=Se=>G(()=>s().openUrl(Se,C)),ie=(Se,Pe,Je)=>{const nt=s();nt.alert(Se,a(Je||nt,Pe))},ye=(Se,Pe,Je)=>{const nt=s();nt.confirm(Se,a(Je||nt,Pe))},Re=()=>{L().each(Se=>{s().close(Se),C(Se)})};return e.on("remove",()=>{xe(t,Se=>{s().close(Se)})}),{open:ee,openUrl:te,alert:ie,confirm:ye,close:Re}},kA=(e,t)=>{e.notificationManager.open({type:"error",text:t})},Cw=(e,t)=>{e._skinLoaded?kA(e,t):e.on("SkinLoaded",()=>{kA(e,t)})},GN=(e,t)=>{Cw(e,Bu.translate(["Failed to upload image: {0}",t]))},_w=(e,t,s)=>{$2(e,t,{message:s}),console.error(s)},Tw=(e,t,s)=>s?`Failed to load ${e}: ${s} from url ${t}`:`Failed to load ${e} url: ${t}`,AA=(e,t,s)=>{_w(e,"PluginLoadError",Tw("plugin",t,s))},I$=(e,t,s)=>{_w(e,"IconsLoadError",Tw("icons",t,s))},WN=(e,t,s)=>{_w(e,"LanguageLoadError",Tw("language",t,s))},jN=(e,t,s)=>{_w(e,"ThemeLoadError",Tw("theme",t,s))},LA=(e,t,s)=>{_w(e,"ModelLoadError",Tw("model",t,s))},RA=(e,t,s)=>{const a=Bu.translate(["Failed to initialize plugin: {0}",t]);$2(e,"PluginLoadError",{message:a}),Gx(a,s),Cw(e,a)},Gx=(e,...t)=>{const s=window.console;s&&(s.error?s.error(e,...t):s.log(e,...t))},P$=e=>/^[a-z0-9\-]+$/i.test(e),f_=e=>"content/"+e+"/content.css",M$=e=>tinymce.Resource.has(f_(e)),N$=e=>h_(e,Dc(e)),KN=e=>h_(e,ER(e)),h_=(e,t)=>{const s=e.editorManager.baseURL+"/skins/content",d=`content${e.editorManager.suffix}.css`;return $t(t,p=>M$(p)?p:P$(p)&&!e.inline?`${s}/${p}/${d}`:e.documentBaseURI.toAbsolute(p))},F$=e=>{e.contentCSS=e.contentCSS.concat(N$(e),KN(e))},m_=e=>e?In(e.getElementsByTagName("img")):[],B$=(e,t)=>{const s={};return{findAll:(d,p=an)=>{const v=Ct(m_(d),L=>{const G=L.src;return L.hasAttribute("data-mce-bogus")||L.hasAttribute("data-mce-placeholder")||!G||G===gs.transparentSrc?!1:qs(G,"blob:")?!e.isUploaded(G)&&p(L):qs(G,"data:")?p(L):!1}),C=$t(v,L=>{const G=L.src;if(yn(s,G))return s[G].then(ee=>re(ee)?ee:{image:L,blobInfo:ee.blobInfo});{const ee=p8(t,G).then(te=>(delete s[G],{image:L,blobInfo:te})).catch(te=>(delete s[G],te));return s[G]=ee,ee}});return Promise.all(C)}}},ZN=()=>{let s={};const a=(ie,ye)=>({status:ie,resultUri:ye}),d=ie=>ie in s;return{hasBlobUri:d,getResultUri:ie=>{const ye=s[ie];return ye?ye.resultUri:null},isPending:ie=>d(ie)?s[ie].status===1:!1,isUploaded:ie=>d(ie)?s[ie].status===2:!1,markPending:ie=>{s[ie]=a(1,null)},markUploaded:(ie,ye)=>{s[ie]=a(2,ye)},removeFailed:ie=>{delete s[ie]},destroy:()=>{s={}}}};let $$=0;const qN=()=>{const e=()=>Math.round(Math.random()*4294967295).toString(36);return"s"+new Date().getTime().toString(36)+e()+e()+e()},YN=e=>e+$$+++qN(),H$=()=>{let e=[];const t=te=>({"image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/png":"png","image/apng":"apng","image/avif":"avif","image/svg+xml":"svg","image/webp":"webp","image/bmp":"bmp","image/tiff":"tiff"})[te.toLowerCase()]||"dat",s=(te,ie,ye,Re,Se)=>{if(re(te))return a({id:te,name:Re,filename:Se,blob:ie,base64:ye});if(Y(te))return a(te);throw new Error("Unknown input type")},a=te=>{if(!te.blob||!te.base64)throw new Error("blob and base64 representations of the image are required for BlobInfo to be created");const ie=te.id||YN("blobid"),ye=te.name||ie,Re=te.blob;return{id:et(ie),name:et(ye),filename:et(te.filename||ye+"."+t(Re.type)),blob:et(Re),base64:et(te.base64),blobUri:et(te.blobUri||URL.createObjectURL(Re)),uri:et(te.uri)}},d=te=>{v(te.id())||e.push(te)},p=te=>Qt(e,te).getOrUndefined(),v=te=>p(ie=>ie.id()===te);return{create:s,add:d,get:v,getByUri:te=>p(ie=>ie.blobUri()===te),getByData:(te,ie)=>p(ye=>ye.base64()===te&&ye.blob().type===ie),findFirst:p,removeByUri:te=>{e=Ct(e,ie=>ie.blobUri()===te?(URL.revokeObjectURL(ie.blobUri()),!1):!0)},destroy:()=>{xe(e,te=>{URL.revokeObjectURL(te.blobUri())}),e=[]}}},XN=(e,t)=>{const s={},a=(Se,Pe)=>Se?Se.replace(/\/$/,"")+"/"+Pe.replace(/^\//,""):Pe,d=(Se,Pe)=>new Promise((Je,nt)=>{const rt=new XMLHttpRequest;rt.open("POST",t.url),rt.withCredentials=t.credentials,rt.upload.onprogress=Xt=>{Pe(Xt.loaded/Xt.total*100)},rt.onerror=()=>{nt("Image upload failed due to a XHR Transport error. Code: "+rt.status)},rt.onload=()=>{if(rt.status<200||rt.status>=300){nt("HTTP Error: "+rt.status);return}const Xt=JSON.parse(rt.responseText);if(!Xt||!re(Xt.location)){nt("Invalid JSON: "+rt.responseText);return}Je(a(t.basePath,Xt.location))};const ft=new FormData;ft.append("file",Se.blob(),Se.filename()),rt.send(ft)}),p=Oe(t.handler)?t.handler:d,v=()=>new Promise(Se=>{Se([])}),C=(Se,Pe)=>({url:Pe,blobInfo:Se,status:!0}),L=(Se,Pe)=>({url:"",blobInfo:Se,status:!1,error:Pe}),G=(Se,Pe)=>{hn.each(s[Se],Je=>{Je(Pe)}),delete s[Se]},ee=(Se,Pe,Je)=>(e.markPending(Se.blobUri()),new Promise(nt=>{let rt,ft;try{const Xt=()=>{rt&&(rt.close(),ft=Fe)},mn=Lt=>{Xt(),e.markUploaded(Se.blobUri(),Lt),G(Se.blobUri(),C(Se,Lt)),nt(C(Se,Lt))},Fn=Lt=>{Xt(),e.removeFailed(Se.blobUri()),G(Se.blobUri(),L(Se,Lt)),nt(L(Se,Lt))};ft=Lt=>{Lt<0||Lt>100||J.from(rt).orThunk(()=>J.from(Je).map(Un)).each(yt=>{rt=yt,yt.progressBar.value(Lt)})},Pe(Se,ft).then(mn,Lt=>{Fn(re(Lt)?{message:Lt}:Lt)})}catch(Xt){nt(L(Se,Xt))}})),te=Se=>Se===d,ie=Se=>{const Pe=Se.blobUri();return new Promise(Je=>{s[Pe]=s[Pe]||[],s[Pe].push(Je)})},ye=(Se,Pe)=>(Se=hn.grep(Se,Je=>!e.isUploaded(Je.blobUri())),Promise.all(hn.map(Se,Je=>e.isPending(Je.blobUri())?ie(Je):ee(Je,p,Pe))));return{upload:(Se,Pe)=>!t.url&&te(p)?v():ye(Se,Pe)}},Wx=e=>()=>e.notificationManager.open({text:e.translate("Image uploading..."),type:"info",timeout:-1,progressBar:!0}),OA=(e,t)=>XN(t,{url:t2(e),basePath:yR(e),credentials:n2(e),handler:WB(e)}),U$=e=>{const t=ZN(),s=OA(e,t);return{upload:(a,d=!0)=>s.upload(a,d?Wx(e):void 0)}},JN=(e,t)=>e.dom.isEmpty(t.dom)&&ve(e.schema.getTextBlockElements()[ls(t)]),QN=e=>t=>{JN(e,t)&&rr(t,M.fromHtml('<br data-mce-bogus="1" />'))},V$=e=>{const t=H$();let s,a;const d=ZN(),p=[],v=rt=>ft=>e.selection?rt(ft):[],C=rt=>rt+(rt.indexOf("?")===-1?"?":"&")+new Date().getTime(),L=(rt,ft,Xt)=>{let mn=0;do mn=rt.indexOf(ft,mn),mn!==-1&&(rt=rt.substring(0,mn)+Xt+rt.substr(mn+ft.length),mn+=Xt.length-ft.length+1);while(mn!==-1);return rt},G=(rt,ft,Xt)=>{const mn=`src="${Xt}"${Xt===gs.transparentSrc?' data-mce-placeholder="1"':""}`;return rt=L(rt,`src="${ft}"`,mn),rt=L(rt,'data-mce-src="'+ft+'"','data-mce-src="'+Xt+'"'),rt},ee=(rt,ft)=>{xe(e.undoManager.data,Xt=>{Xt.type==="fragmented"?Xt.fragments=$t(Xt.fragments,mn=>G(mn,rt,ft)):Xt.content=G(Xt.content,rt,ft)})},te=(rt,ft)=>{const Xt=e.convertURL(ft,"src");ee(rt.src,ft),Hc(M.fromDom(rt),{src:hp(e)?C(ft):ft,"data-mce-src":Xt})},ie=()=>(s||(s=OA(e,d)),Pe().then(v(rt=>{const ft=$t(rt,Xt=>Xt.blobInfo);return s.upload(ft,Wx(e)).then(v(Xt=>{const mn=[];let Fn=!1;const Lt=$t(Xt,(yt,qt)=>{const{blobInfo:no,image:So}=rt[qt];let fs=!1;return yt.status&&vR(e)?(yt.url&&!xr(So.src,yt.url)&&(Fn=!0),t.removeByUri(So.src),Pf(e)||te(So,yt.url)):yt.error&&(yt.error.remove&&(ee(So.src,gs.transparentSrc),mn.push(So),fs=!0),GN(e,yt.error.message)),{element:So,status:yt.status,uploadUri:yt.url,blobInfo:no,removed:fs}});return mn.length>0&&!Pf(e)?e.undoManager.transact(()=>{xe(wc(mn),yt=>{const qt=_s(yt);Xs(yt),qt.each(QN(e)),t.removeByUri(yt.dom.src)})}):Fn&&e.undoManager.dispatchChange(),Lt}))}))),ye=()=>Br(e)?ie():Promise.resolve([]),Re=rt=>jo(p,ft=>ft(rt)),Se=rt=>{p.push(rt)},Pe=()=>(a||(a=B$(d,t)),a.findAll(e.getBody(),Re).then(v(rt=>{const ft=Ct(rt,Xt=>re(Xt)?(Cw(e,Xt),!1):Xt.uriType!=="blob");return Pf(e)||xe(ft,Xt=>{ee(Xt.image.src,Xt.blobInfo.blobUri()),Xt.image.src=Xt.blobInfo.blobUri(),Xt.image.removeAttribute("data-mce-src")}),ft}))),Je=()=>{t.destroy(),d.destroy(),a=s=null},nt=rt=>rt.replace(/src="(blob:[^"]+)"/g,(ft,Xt)=>{const mn=d.getResultUri(Xt);if(mn)return'src="'+mn+'"';let Fn=t.getByUri(Xt);return Fn||(Fn=Kn(e.editorManager.get(),(Lt,yt)=>Lt||yt.editorUpload&&yt.editorUpload.blobCache.getByUri(Xt),void 0)),Fn?'src="data:'+Fn.blob().type+";base64,"+Fn.base64()+'"':ft});return e.on("SetContent",()=>{Br(e)?ye():Pe()}),e.on("RawSaveContent",rt=>{rt.content=nt(rt.content)}),e.on("GetContent",rt=>{rt.source_view||rt.format==="raw"||rt.format==="tree"||(rt.content=nt(rt.content))}),e.on("PostRender",()=>{e.parser.addNodeFilter("img",rt=>{xe(rt,ft=>{const Xt=ft.attr("src");if(!Xt||t.getByUri(Xt))return;const mn=d.getResultUri(Xt);mn&&ft.attr("src",mn)})})}),{blobCache:t,addFilter:Se,uploadImages:ie,uploadImagesAuto:ye,scanForImages:Pe,destroy:Je}},z$=e=>{const t=e.dom,s=e.schema.type,a={valigntop:[{selector:"td,th",styles:{verticalAlign:"top"}}],valignmiddle:[{selector:"td,th",styles:{verticalAlign:"middle"}}],valignbottom:[{selector:"td,th",styles:{verticalAlign:"bottom"}}],alignleft:[{selector:"figure.image",collapsed:!1,classes:"align-left",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"left"},inherit:!1,preview:!1},{selector:"img,audio,video",collapsed:!1,styles:{float:"left"},preview:"font-family font-size"},{selector:"table",collapsed:!1,styles:{marginLeft:"0px",marginRight:"auto"},onformat:d=>{t.setStyle(d,"float",null)},preview:"font-family font-size"},{selector:".mce-preview-object,[data-ephox-embed-iri]",ceFalseOverride:!0,styles:{float:"left"}}],aligncenter:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"center"},inherit:!1,preview:"font-family font-size"},{selector:"figure.image",collapsed:!1,classes:"align-center",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"img,audio,video",collapsed:!1,styles:{display:"block",marginLeft:"auto",marginRight:"auto"},preview:!1},{selector:"table",collapsed:!1,styles:{marginLeft:"auto",marginRight:"auto"},preview:"font-family font-size"},{selector:".mce-preview-object",ceFalseOverride:!0,styles:{display:"table",marginLeft:"auto",marginRight:"auto"},preview:!1},{selector:"[data-ephox-embed-iri]",ceFalseOverride:!0,styles:{marginLeft:"auto",marginRight:"auto"},preview:!1}],alignright:[{selector:"figure.image",collapsed:!1,classes:"align-right",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"right"},inherit:!1,preview:"font-family font-size"},{selector:"img,audio,video",collapsed:!1,styles:{float:"right"},preview:"font-family font-size"},{selector:"table",collapsed:!1,styles:{marginRight:"0px",marginLeft:"auto"},onformat:d=>{t.setStyle(d,"float",null)},preview:"font-family font-size"},{selector:".mce-preview-object,[data-ephox-embed-iri]",ceFalseOverride:!0,styles:{float:"right"},preview:!1}],alignjustify:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"justify"},inherit:!1,preview:"font-family font-size"}],bold:[{inline:"strong",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all",preserve_attributes:["class","style"]}],italic:[{inline:"em",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all",preserve_attributes:["class","style"]}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:!0},{inline:"u",remove:"all",preserve_attributes:["class","style"]}],strikethrough:(()=>{const d={inline:"span",styles:{textDecoration:"line-through"},exact:!0},p={inline:"strike",remove:"all",preserve_attributes:["class","style"]},v={inline:"s",remove:"all",preserve_attributes:["class","style"]};return s!=="html4"?[v,d,p]:[d,v,p]})(),forecolor:{inline:"span",styles:{color:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},fontname:{inline:"span",toggle:!1,styles:{fontFamily:"%value"},clear_child_styles:!0},fontsize:{inline:"span",toggle:!1,styles:{fontSize:"%value"},clear_child_styles:!0},lineheight:{selector:"h1,h2,h3,h4,h5,h6,p,li,td,th,div",styles:{lineHeight:"%value"}},fontsize_class:{inline:"span",attributes:{class:"%value"}},blockquote:{block:"blockquote",wrapper:!0,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},code:{inline:"code"},link:{inline:"a",selector:"a",remove:"all",split:!0,deep:!0,onmatch:(d,p,v)=>oo(d)&&d.hasAttribute("href"),onformat:(d,p,v)=>{hn.each(v,(C,L)=>{t.setAttrib(d,L,C)})}},lang:{inline:"span",clear_child_styles:!0,remove_similar:!0,attributes:{lang:"%value","data-mce-lang":d=>{var p;return(p=d==null?void 0:d.customValue)!==null&&p!==void 0?p:null}}},removeformat:[{selector:"b,strong,em,i,font,u,strike,s,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins,small",remove:"all",split:!0,expand:!1,block_expand:!0,deep:!0},{selector:"span",attributes:["style","class"],remove:"empty",split:!0,expand:!1,deep:!0},{selector:"*",attributes:["style","class"],split:!1,expand:!1,deep:!0}]};return hn.each("p h1 h2 h3 h4 h5 h6 div address pre dt dd samp".split(/\s/),d=>{a[d]={block:d,remove:"all"}}),a},eF={remove_similar:!0,inherit:!1},jx={selector:"td,th",...eF},tF={tablecellbackgroundcolor:{styles:{backgroundColor:"%value"},...jx},tablecellverticalalign:{styles:{"vertical-align":"%value"},...jx},tablecellbordercolor:{styles:{borderColor:"%value"},...jx},tablecellclass:{classes:["%value"],...jx},tableclass:{selector:"table",classes:["%value"],...eF},tablecellborderstyle:{styles:{borderStyle:"%value"},...jx},tablecellborderwidth:{styles:{borderWidth:"%value"},...jx}},IA=et(tF),nF=e=>{const t={},s=v=>ve(v)?t[v]:t,a=v=>yn(t,v),d=(v,C)=>{v&&(re(v)?(ae(C)||(C=[C]),xe(C,L=>{ot(L.deep)&&(L.deep=!ju(L)),ot(L.split)&&(L.split=!ju(L)||nl(L)),ot(L.remove)&&ju(L)&&!nl(L)&&(L.remove="none"),ju(L)&&nl(L)&&(L.mixed=!0,L.block_expand=!0),re(L.classes)&&(L.classes=L.classes.split(/\s+/))}),t[v]=C):qo(v,(L,G)=>{d(G,L)}))},p=v=>(v&&t[v]&&delete t[v],t);return d(z$(e)),d(IA()),d(YB(e)),{get:s,has:a,register:d,unregister:p}},Dw=hn.each,_d=js.DOM,p_=e=>ve(e)&&Y(e),oF=(e,t)=>{const s=t&&t.schema||Vh({}),a=(L,G)=>{G.classes.length>0&&_d.addClass(L,G.classes.join(" ")),_d.setAttribs(L,G.attrs)},d=L=>{const G=re(L)?{name:L,classes:[],attrs:{}}:L,ee=_d.create(G.name);return a(ee,G),ee},p=(L,G)=>{const ee=s.getElementRule(L.nodeName.toLowerCase()),te=ee==null?void 0:ee.parentsRequired;return te&&te.length?G&&to(te,G)?G:te[0]:!1},v=(L,G,ee)=>{let te;const ie=G[0],ye=p_(ie)?ie.name:void 0,Re=p(L,ye);if(Re)ye===Re?(te=ie,G=G.slice(1)):te=Re;else if(ie)te=ie,G=G.slice(1);else if(!ee)return L;const Se=te?d(te):_d.create("div");Se.appendChild(L),ee&&hn.each(ee,Je=>{const nt=d(Je);Se.insertBefore(nt,L)});const Pe=p_(te)?te.siblings:void 0;return v(Se,G,Pe)},C=_d.create("div");if(e.length>0){const L=e[0],G=d(L),ee=p_(L)?L.siblings:void 0;C.appendChild(v(G,e.slice(1),ee))}return C},PA=e=>{e=hn.trim(e);let t="div";const s={name:t,classes:[],attrs:{},selector:e};return e!=="*"&&(t=e.replace(/(?:([#\.]|::?)([\w\-]+)|(\[)([^\]]+)\]?)/g,(a,d,p,v,C)=>{switch(d){case"#":s.attrs.id=p;break;case".":s.classes.push(p);break;case":":hn.inArray("checked disabled enabled read-only required".split(" "),p)!==-1&&(s.attrs[p]=p);break}if(v==="["){const L=C.match(/([\w\-]+)(?:\=\"([^\"]+))?/);L&&(s.attrs[L[1]]=L[2])}return""})),s.name=t||"div",s},g_=e=>re(e)?(e=e.split(/\s*,\s*/)[0],e=e.replace(/\s*(~\+|~|\+|>)\s*/g,"$1"),hn.map(e.split(/(?:>|\s+(?![^\[\]]+\]))/),t=>{const s=hn.map(t.split(/(?:~\+|~|\+)/),PA),a=s.pop();return s.length&&(a.siblings=s),a}).reverse()):[],b_=(e,t)=>{let s="",a=XB(e);if(a==="")return"";const d=ie=>re(ie)?ie.replace(/%(\w+)/g,""):"",p=(ie,ye)=>_d.getStyle(ye??e.getBody(),ie,!0);if(re(t)){const ie=e.formatter.get(t);if(!ie)return"";t=ie[0]}if("preview"in t){const ie=t.preview;if(ie===!1)return"";a=ie||a}let v=t.block||t.inline||"span",C;const L=g_(t.selector);L.length>0?(L[0].name||(L[0].name=v),v=t.selector,C=oF(L,e)):C=oF([v],e);const G=_d.select(v,C)[0]||C.firstChild;Dw(t.styles,(ie,ye)=>{const Re=d(ie);Re&&_d.setStyle(G,ye,Re)}),Dw(t.attributes,(ie,ye)=>{const Re=d(ie);Re&&_d.setAttrib(G,ye,Re)}),Dw(t.classes,ie=>{const ye=d(ie);_d.hasClass(G,ye)||_d.addClass(G,ye)}),e.dispatch("PreviewFormats"),_d.setStyles(C,{position:"absolute",left:-65535}),e.getBody().appendChild(C);const ee=p("fontSize"),te=/px$/.test(ee)?parseInt(ee,10):0;return Dw(a.split(" "),ie=>{let ye=p(ie,G);if(!(ie==="background-color"&&/transparent|rgba\s*\([^)]+,\s*0\)/.test(ye)&&(ye=p(ie),$0(ye).toLowerCase()==="#ffffff"))&&!(ie==="color"&&$0(ye).toLowerCase()==="#000000")){if(ie==="font-size"&&/em|%$/.test(ye)){if(te===0)return;ye=parseFloat(ye)/(/%$/.test(ye)?100:1)*te+"px"}ie==="border"&&ye&&(s+="padding:0 2px;"),s+=ie+":"+ye+";"}}),e.dispatch("AfterPreviewFormats"),_d.remove(C),s},Lp=e=>{e.addShortcut("meta+b","","Bold"),e.addShortcut("meta+i","","Italic"),e.addShortcut("meta+u","","Underline");for(let t=1;t<=6;t++)e.addShortcut("access+"+t,"",["FormatBlock",!1,"h"+t]);e.addShortcut("access+7","",["FormatBlock",!1,"p"]),e.addShortcut("access+8","",["FormatBlock",!1,"div"]),e.addShortcut("access+9","",["FormatBlock",!1,"address"])},kw=e=>{const t=nF(e),s=Ea({});return Lp(e),FP(e),Pf(e)||KP(s,e),{get:t.get,has:t.has,register:t.register,unregister:t.unregister,apply:(a,d,p)=>{c$(e,a,d,p)},remove:(a,d,p,v)=>{u$(e,a,d,p,v)},toggle:(a,d,p)=>{d$(e,a,d,p)},match:(a,d,p,v)=>s$(e,a,d,p,v),closest:a=>l$(e,a),matchAll:(a,d)=>r$(e,a,d),matchNode:(a,d,p,v)=>i$(e,a,d,p,v),canApply:a=>a$(e,a),formatChanged:(a,d,p,v)=>f$(e,s,a,d,p,v),getCssText:it(b_,e)}},Nb=e=>{switch(e.toLowerCase()){case"undo":case"redo":case"mcefocus":return!0;default:return!1}},sF=(e,t,s)=>{const a=Ea(!1),d=L=>{gh(t,!1,s),t.add({},L)};e.on("init",()=>{t.add()}),e.on("BeforeExecCommand",L=>{const G=L.command;Nb(G)||(tN(t,s),t.beforeChange())}),e.on("ExecCommand",L=>{const G=L.command;Nb(G)||d(L)}),e.on("ObjectResizeStart cut",()=>{t.beforeChange()}),e.on("SaveContent ObjectResized blur",d),e.on("dragend",d),e.on("keyup",L=>{const G=L.keyCode;if(L.isDefaultPrevented())return;const ee=gs.os.isMacOS()&&L.key==="Meta";(G>=33&&G<=36||G>=37&&G<=40||G===45||L.ctrlKey||ee)&&(d(),e.nodeChanged()),(G===46||G===8)&&e.nodeChanged(),a.get()&&t.typing&&!vw(o_(e),t.data[0])&&(e.isDirty()||e.setDirty(!0),e.dispatch("TypingUndo"),a.set(!1),e.nodeChanged())}),e.on("keydown",L=>{const G=L.keyCode;if(L.isDefaultPrevented())return;if(G>=33&&G<=36||G>=37&&G<=40||G===45){t.typing&&d(L);return}const ee=L.ctrlKey&&!L.altKey||L.metaKey;if((G<16||G>20)&&G!==224&&G!==91&&!t.typing&&!ee){t.beforeChange(),gh(t,!0,s),t.add({},L),a.set(!0);return}(gs.os.isMacOS()?L.metaKey:L.ctrlKey&&!L.altKey)&&t.beforeChange()}),e.on("mousedown",L=>{t.typing&&d(L)});const p=L=>L.inputType==="insertReplacementText",v=L=>L.inputType==="insertText"&&L.data===null,C=L=>L.inputType==="insertFromPaste"||L.inputType==="insertFromDrop";e.on("input",L=>{L.inputType&&(p(L)||v(L)||C(L))&&d(L)}),e.on("AddUndo Undo Redo ClearUndos",L=>{L.isDefaultPrevented()||e.nodeChanged()})},rF=e=>{e.addShortcut("meta+z","","Undo"),e.addShortcut("meta+y,meta+shift+z","","Redo")},v_=e=>{const t=tn(),s=Ea(0),a=Ea(0),d={data:[],typing:!1,beforeChange:()=>{Q8(e,s,t)},add:(p,v)=>cN(e,d,a,s,t,p,v),dispatchChange:()=>{e.setDirty(!0);const p=o_(e);p.bookmark=vn(e.selection),e.dispatch("change",{level:p,lastLevel:gn(d.data,a.get()).getOrUndefined()})},undo:()=>uN(e,d,s,a),redo:()=>e$(e,a,d.data),clear:()=>{t$(e,d,a)},reset:()=>{Hx(e,d)},hasUndo:()=>n$(e,d,a),hasRedo:()=>o$(e,d,a),transact:p=>dN(e,d,s,p),ignore:p=>{fN(e,s,p)},extra:(p,v)=>{l_(e,d,a,p,v)}};return Pf(e)||sF(e,d,s),rF(e),d},x_=[9,27,Pn.HOME,Pn.END,19,20,44,144,145,33,34,45,16,17,18,91,92,93,Pn.DOWN,Pn.UP,Pn.LEFT,Pn.RIGHT].concat(gs.browser.isFirefox()?[224]:[]),Rp="data-mce-placeholder",Jg=e=>e.type==="keydown"||e.type==="keyup",MA=e=>{const t=e.keyCode;return t===Pn.BACKSPACE||t===Pn.DELETE},G$=e=>{if(Jg(e)){const t=e.keyCode;return!MA(e)&&(Pn.metaKeyPressed(e)||e.altKey||t>=112&&t<=123||to(x_,t))}else return!1},iF=e=>Jg(e)&&!(MA(e)||e.type==="keyup"&&e.keyCode===229),W$=(e,t,s)=>{if(e.isEmpty(t,void 0,{skipBogus:!1,includeZwsp:!0})){const a=t.firstElementChild;return a?e.getStyle(t.firstElementChild,"padding-left")||e.getStyle(t.firstElementChild,"padding-right")?!1:s===a.nodeName.toLowerCase():!0}else return!1},j$=e=>{var t;const s=e.dom,a=Wl(e),d=(t=s2(e))!==null&&t!==void 0?t:"",p=(v,C)=>{if(G$(v))return;const L=e.getBody(),G=iF(v)?!1:W$(s,L,a);(s.getAttrib(L,Rp)!==""!==G||C)&&(s.setAttrib(L,Rp,G?d:null),BO(e,G),e.on(G?"keydown":"keyup",p),e.off(G?"keyup":"keydown",p))};vi(d)&&e.on("init",v=>{p(v,!0),e.on("change SetContent ExecCommand",p),e.on("paste",C=>Ku.setEditorTimeout(e,()=>p(C)))})},K$=(e,t)=>({block:e,position:t}),NA=(e,t)=>({from:e,to:t}),y_=(e,t)=>{const s=M.fromDom(e),a=M.fromDom(t.container());return nC(s,a).map(d=>K$(d,t))},Z$=e=>!(ln(e.to.block,e.from.block)||ln(e.from.block,e.to.block)),aF=e=>!gt(e.from.block,e.to.block),lF=(e,t)=>El(t,d=>zd(d)||Ws(d.dom),d=>gt(d,e)).filter(ll).getOr(e),FA=(e,t)=>{const s=M.fromDom(e);return gt(lF(s,t.from.block),lF(s,t.to.block))},q$=e=>Ir(e.from.block.dom)===!1&&Ir(e.to.block.dom)===!1,cF=e=>{const t=s=>Kh(s)||ld(s.dom)||yf(s);return t(e.from.block)&&t(e.to.block)},BA=(e,t,s,a)=>fi(a.position.getNode())&&!fl(e,a.block)?lx(!1,a.block.dom).bind(d=>d.isEqual(a.position)?hd(s,t,d).bind(p=>y_(t,p)):J.some(a)).getOr(a):a,uF=(e,t,s,a)=>{const d=y_(t,Et.fromRangeStart(a)),p=d.bind(v=>hd(s,t,v.position).bind(C=>y_(t,C).map(L=>BA(e,t,s,L))));return wa(d,p,NA).filter(v=>aF(v)&&FA(t,v)&&q$(v)&&cF(v)&&Z$(v))},$A=(e,t,s,a)=>a.collapsed?uF(e,t,s,a):J.none(),Y$=(e,t)=>{const s=cr(e);return Cn(s,a=>t.isBlock(ls(a))).fold(et(s),a=>s.slice(0,a))},HA=(e,t)=>{const s=Y$(e,t);return xe(s,Xs),s},dF=(e,t,s)=>{const a=kf(s,t);return Qt(a.reverse(),d=>fl(e,d)).each(Xs)},fF=(e,t)=>Ct(ks(t),s=>!fl(e,s)).length===0,hF=(e,t,s,a,d)=>{if(fl(a,s))return Hu(s),Mo(s.dom);fF(a,d)&&fl(a,t)&&lt(d,M.fromTag("br"));const p=Wu(s.dom,Et.before(d.dom));return xe(HA(t,a),v=>{lt(d,v)}),dF(a,e,t),p},X$=(e,t)=>e.isInline(ls(t)),J$=(e,t,s,a)=>{if(fl(a,s)){if(fl(a,t)){const v=yo((C=>{const L=(G,ee)=>sd(G).fold(()=>ee,te=>X$(a,te)?L(te,ee.concat(Gl(te))):ee);return L(C,[])})(s),(C,L)=>(Tl(C,L),L),Tc());Ua(t),rr(t,v)}return Xs(s),Mo(t.dom)}const d=Wd(s.dom);return xe(HA(t,a),p=>{rr(s,p)}),dF(a,e,t),d},Q$=(e,t)=>{const s=kf(t,e);return J.from(s[s.length-1])},e7=(e,t)=>ln(t,e)?Q$(t,e):J.none(),mF=(e,t)=>{lx(e,t.dom).bind(s=>J.from(s.getNode())).map(M.fromDom).filter(Vd).each(Xs)},Qg=(e,t,s,a)=>(mF(!0,t),mF(!1,s),e7(t,s).fold(it(J$,e,t,s,a),it(hF,e,t,s,a))),UA=(e,t,s,a,d)=>t?Qg(e,a,s,d):Qg(e,s,a,d),w_=(e,t)=>{const s=M.fromDom(e.getBody());return $A(e.schema,s.dom,t,e.selection.getRng()).map(d=>()=>{UA(s,t,d.from.block,d.to.block,e.schema).each(p=>{e.selection.setRng(p.toRange())})})},pF=(e,t,s)=>{const a=t.getRng();return wa(nC(e,M.fromDom(a.startContainer)),nC(e,M.fromDom(a.endContainer)),(d,p)=>gt(d,p)?J.none():J.some(()=>{a.deleteContents(),UA(e,!0,d,p,s).each(v=>{t.setRng(v.toRange())})})).getOr(J.none())},gF=(e,t)=>{const s=M.fromDom(t),a=it(gt,e);return Kr(s,zd,a).isSome()},t7=(e,t)=>gF(e,t.startContainer)||gF(e,t.endContainer),e0=(e,t)=>{const s=Wu(e.dom,Et.fromRangeStart(t)).isNone(),a=Kc(e.dom,Et.fromRangeEnd(t)).isNone();return!t7(e,t)&&s&&a},bF=e=>J.some(()=>{e.setContent(""),e.selection.setCursorLocation()}),S_=e=>{const t=M.fromDom(e.getBody()),s=e.selection.getRng();return e0(t,s)?bF(e):pF(t,e.selection,e.schema)},VA=(e,t)=>e.selection.isCollapsed()?J.none():S_(e),pm=(e,t,s,a,d)=>J.from(t._selectionOverrides.showCaret(e,s,a,d)),n7=e=>{const t=e.ownerDocument.createRange();return t.selectNode(e),t},Aw=(e,t)=>e.dispatch("BeforeObjectSelected",{target:t}).isDefaultPrevented()?J.none():J.some(n7(t)),zA=(e,t,s)=>{const a=w2(1,e.getBody(),t),d=Et.fromRangeStart(a),p=d.getNode();if(cy(p))return pm(1,e,p,!d.isAtEnd(),!1);const v=d.getNode(!0);if(cy(v))return pm(1,e,v,!1,!1);const C=Yd(e.dom.getRoot(),d.getNode());return cy(C)?pm(1,e,C,!1,s):J.none()},GA=(e,t,s)=>t.collapsed?zA(e,t,s).getOr(t):t,Za=e=>am(e)||Cx(e),o7=e=>wp(e)||xb(e),s7=(e,t)=>{rn(t)&&t.data.length===0&&e.remove(t)},E_=(e,t,s,a,d,p)=>{pm(a,e,p.getNode(!d),d,!0).each(v=>{if(t.collapsed){const C=t.cloneRange();d?C.setEnd(v.startContainer,v.startOffset):C.setStart(v.endContainer,v.endOffset),C.deleteContents()}else t.deleteContents();e.selection.setRng(v)}),s7(e.dom,s)},vF=(e,t)=>{const s=e.selection.getRng();if(!rn(s.commonAncestorContainer))return J.none();const a=t?Ol.Forwards:Ol.Backwards,d=Do(e.getBody()),p=it(S2,t?d.next:d.prev),v=t?Za:o7,C=my(a,e.getBody(),s),L=p(C),G=L&&qd(t,L);if(!G||!rE(C,G))return J.none();if(v(G))return J.some(()=>E_(e,s,C.getNode(),a,t,G));const ee=p(G);return ee&&v(ee)&&rE(G,ee)?J.some(()=>E_(e,s,C.getNode(),a,t,ee)):J.none()},Lw=(e,t)=>vF(e,t),WA=(e,t)=>{const s=e.getBody();return t?Mo(s).filter(am):Wd(s).filter(wp)},jA=e=>{const t=e.selection.getRng();return!t.collapsed&&(WA(e,!0).exists(s=>s.isEqual(Et.fromRangeStart(t)))||WA(e,!1).exists(s=>s.isEqual(Et.fromRangeEnd(t))))},r7=e=>ve(e)&&(zd(M.fromDom(e))||yf(M.fromDom(e))),Td=Oo.generate([{remove:["element"]},{moveToElement:["element"]},{moveToPosition:["position"]}]),i7=(e,t)=>{const s=t.getNode(!e),a=e?"after":"before";return oo(s)&&s.getAttribute("data-mce-caret")===a},a7=(e,t,s,a,d)=>{const p=v=>d.isInline(v.nodeName.toLowerCase())&&!tm(s,a,e);return nO(!t,s).fold(()=>nO(t,a).fold(vt,p),p)},xF=(e,t,s,a,d)=>{const p=d.getNode(!s);return nC(M.fromDom(t),M.fromDom(a.getNode())).map(v=>fl(e,v)?Td.remove(v.dom):Td.moveToElement(p)).orThunk(()=>J.some(Td.moveToElement(p)))},Fb=(e,t,s,a)=>hd(t,e,s).bind(d=>r7(d.getNode())||a7(e,t,s,d,a)?J.none():t&&Ir(d.getNode())||!t&&Ir(d.getNode(!0))?xF(a,e,t,s,d):t&&wp(s)||!t&&am(s)?J.some(Td.moveToPosition(d)):J.none()),bh=(e,t)=>Ae(t)?J.none():e&&Ir(t.nextSibling)?J.some(Td.moveToElement(t.nextSibling)):!e&&Ir(t.previousSibling)?J.some(Td.moveToElement(t.previousSibling)):J.none(),l7=(e,t,s)=>s.fold(a=>J.some(Td.remove(a)),a=>J.some(Td.moveToElement(a)),a=>tm(t,a,e)?J.none():J.some(Td.moveToPosition(a))),c7=(e,t,s,a)=>i7(t,s)?bh(t,s.getNode(!t)).orThunk(()=>Fb(e,t,s,a)):Fb(e,t,s,a).bind(d=>l7(e,s,d)),u7=(e,t,s,a)=>{const d=w2(t?1:-1,e,s),p=Et.fromRangeStart(d),v=M.fromDom(e);return!t&&wp(p)?J.some(Td.remove(p.getNode(!0))):t&&am(p)?J.some(Td.remove(p.getNode())):!t&&am(p)&&Qy(v,p,a)?v6(v,p,a).map(C=>Td.remove(C.getNode())):t&&wp(p)&&Jy(v,p,a)?lm(v,p,a).map(C=>Td.remove(C.getNode())):c7(e,t,p,a)},d7=(e,t)=>s=>(e._selectionOverrides.hideFakeCaret(),Hg(e,t,M.fromDom(s)),!0),f7=(e,t)=>s=>{const a=t?Et.before(s):Et.after(s);return e.selection.setRng(a.toRange()),!0},h7=e=>t=>(e.selection.setRng(t.toRange()),!0),yF=(e,t)=>J.from(Yd(e.getBody(),t)),m7=(e,t)=>{const s=e.selection.getNode();return yF(e,s).filter(Ir).fold(()=>u7(e.getBody(),t,e.selection.getRng(),e.schema).map(a=>()=>a.fold(d7(e,t),f7(e,t),h7(e))),()=>J.some(Fe))},p7=e=>{xe($e(e,".mce-offscreen-selection"),Xs)},g7=(e,t)=>{const s=e.selection.getNode();return Ir(s)&&!og(s)?yF(e,s.parentNode).filter(Ir).fold(()=>J.some(()=>{p7(M.fromDom(e.getBody())),Hg(e,t,M.fromDom(e.selection.getNode())),oC(e)}),()=>J.some(Fe)):jA(e)?J.some(()=>{$D(e,e.selection.getRng(),M.fromDom(e.getBody()))}):J.none()},wF=e=>{const t=e.dom,s=e.selection,a=Yd(e.getBody(),s.getNode());if(Ws(a)&&t.isBlock(a)&&t.isEmpty(a)){const d=t.create("br",{"data-mce-bogus":"1"});t.setHTML(a,""),a.appendChild(d),s.setRng(Et.before(d).toRange())}return!0},KA=(e,t)=>e.selection.isCollapsed()?m7(e,t):g7(e,t),b7=(e,t)=>{const s=Et.fromRangeStart(e.selection.getRng());return hd(t,e.getBody(),s).filter(a=>t?MI(a):Yy(a)).bind(a=>oE(t?0:-1,a)).map(a=>()=>e.selection.select(a))},ZA=(e,t)=>e.selection.isCollapsed()?b7(e,t):J.none(),Kx=rn,SF=e=>Kx(e)&&e.data[0]===ta,EF=e=>Kx(e)&&e.data[e.data.length-1]===ta,CF=e=>{var t;return((t=e.ownerDocument)!==null&&t!==void 0?t:document).createTextNode(ta)},v7=e=>{var t;if(Kx(e.previousSibling))return EF(e.previousSibling)||e.previousSibling.appendData(ta),e.previousSibling;if(Kx(e))return SF(e)||e.insertData(0,ta),e;{const s=CF(e);return(t=e.parentNode)===null||t===void 0||t.insertBefore(s,e),s}},x7=e=>{var t,s;if(Kx(e.nextSibling))return SF(e.nextSibling)||e.nextSibling.insertData(0,ta),e.nextSibling;if(Kx(e))return EF(e)||e.appendData(ta),e;{const a=CF(e);return e.nextSibling?(t=e.parentNode)===null||t===void 0||t.insertBefore(a,e.nextSibling):(s=e.parentNode)===null||s===void 0||s.appendChild(a),a}},C_=(e,t)=>e?v7(t):x7(t),y7=it(C_,!0),w7=it(C_,!1),_F=(e,t)=>rn(e.container())?C_(t,e.container()):C_(t,e.getNode()),TF=(e,t)=>{const s=t.get();return s&&e.container()===s&&Xf(s)},qA=(e,t)=>t.fold(s=>{Sg(e.get());const a=y7(s);return e.set(a),J.some(Et(a,a.length-1))},s=>Mo(s).map(a=>{if(TF(a,e)){const d=e.get();return Et(d,1)}else{Sg(e.get());const d=_F(a,!0);return e.set(d),Et(d,1)}}),s=>Wd(s).map(a=>{if(TF(a,e)){const d=e.get();return Et(d,d.length-1)}else{Sg(e.get());const d=_F(a,!1);return e.set(d),Et(d,d.length-1)}}),s=>{Sg(e.get());const a=w7(s);return e.set(a),J.some(Et(a,1))}),DF=(e,t)=>{for(let s=0;s<e.length;s++){const a=e[s].apply(null,t);if(a.isSome())return a}return J.none()},qc=Oo.generate([{before:["element"]},{start:["element"]},{end:["element"]},{after:["element"]}]),kF=(e,t)=>{const s=Eg(t,e);return s||e},S7=(e,t,s)=>{const a=JI(s),d=kF(t,a.container());return Ug(e,d,a).fold(()=>Kc(d,a).bind(it(Ug,e,d)).map(p=>qc.before(p)),J.none)},E7=(e,t)=>Cg(e,t)===null,YA=(e,t,s)=>Ug(e,t,s).filter(it(E7,t)),C7=(e,t,s)=>{const a=ND(s);return YA(e,t,a).bind(d=>Wu(d,a).isNone()?J.some(qc.start(d)):J.none())},_7=(e,t,s)=>{const a=JI(s);return YA(e,t,a).bind(d=>Kc(d,a).isNone()?J.some(qc.end(d)):J.none())},T7=(e,t,s)=>{const a=ND(s),d=kF(t,a.container());return Ug(e,d,a).fold(()=>Wu(d,a).bind(it(Ug,e,d)).map(p=>qc.after(p)),J.none)},AF=e=>!xd(XA(e)),gm=(e,t,s)=>DF([S7,C7,_7,T7],[e,t,s]).filter(AF),XA=e=>e.fold(Dt,Dt,Dt,Dt),LF=e=>e.fold(et("before"),et("start"),et("end"),et("after")),__=e=>e.fold(qc.before,qc.before,qc.after,qc.after),T_=e=>e.fold(qc.start,qc.start,qc.end,qc.end),D7=(e,t)=>LF(e)===LF(t)&&XA(e)===XA(t),k7=(e,t,s,a,d,p)=>wa(Ug(t,s,a),Ug(t,s,d),(v,C)=>v!==C&&k6(s,v,C)?qc.after(e?v:C):p).getOr(p),A7=(e,t)=>e.fold(an,s=>!D7(s,t)),L7=(e,t,s,a,d)=>{const p=qd(e,d);return hd(e,s,p).map(it(qd,e)).fold(()=>a.map(__),L=>gm(t,s,L).map(it(k7,e,t,s,p,L)).filter(it(A7,a))).filter(AF)},R7=(e,t)=>e?t.fold(st(J.some,qc.start),J.none,st(J.some,qc.after),J.none):t.fold(J.none,st(J.some,qc.before),J.none,st(J.some,qc.end)),O7=(e,t,s,a)=>{const d=qd(e,a),p=gm(t,s,d);return gm(t,s,d).bind(it(R7,e)).orThunk(()=>L7(e,t,s,p,a))},I7=e=>Oe(e.selection.getSel().modify),RF=(e,t,s)=>{const a=e?1:-1;return t.setRng(Et(s.container(),s.offset()+a).toRange()),t.getSel().modify("move",e?"forward":"backward","word"),!0},OF=(e,t)=>{const s=t.selection.getRng(),a=e?Et.fromRangeEnd(s):Et.fromRangeStart(s);return I7(t)?e&&W0(a)?RF(!0,t.selection,a):!e&&op(a)?RF(!1,t.selection,a):!1:!1};var vh;(function(e){e[e.Br=0]="Br",e[e.Block=1]="Block",e[e.Wrap=2]="Wrap",e[e.Eol=3]="Eol"})(vh||(vh={}));const D_=(e,t)=>e===Ol.Backwards?ms(t):t,IF=(e,t,s)=>e===Ol.Forwards?t.next(s):t.prev(s),P7=(e,t,s,a)=>fi(a.getNode(t===Ol.Forwards))?vh.Br:tm(s,a)===!1?vh.Block:vh.Wrap,PF=(e,t,s,a)=>{const d=Do(s);let p=a;const v=[];for(;p;){const C=IF(t,d,p);if(!C)break;if(fi(C.getNode(!1)))return t===Ol.Forwards?{positions:D_(t,v).concat([C]),breakType:vh.Br,breakAt:J.some(C)}:{positions:D_(t,v),breakType:vh.Br,breakAt:J.some(C)};if(!C.isVisible()){p=C;continue}if(e(p,C)){const L=P7(s,t,p,C);return{positions:D_(t,v),breakType:L,breakAt:J.some(C)}}v.push(C),p=C}return{positions:D_(t,v),breakType:vh.Eol,breakAt:J.none()}},MF=(e,t,s,a)=>t(s,a).breakAt.map(d=>{const p=t(s,d).positions;return e===Ol.Backwards?p.concat(d):[d].concat(p)}).getOr([]),JA=(e,t)=>Kn(e,(s,a)=>s.fold(()=>J.some(a),d=>wa(At(d.getClientRects()),At(a.getClientRects()),(p,v)=>{const C=Math.abs(t-p.left);return Math.abs(t-v.left)<=C?a:d}).or(s)),J.none()),k_=(e,t)=>At(t.getClientRects()).bind(s=>JA(e,s.left)),Rw=it(PF,Et.isAbove,-1),Bb=it(PF,Et.isBelow,1),A_=it(MF,-1,Rw),NF=it(MF,1,Bb),QA=(e,t)=>Rw(e,t).breakAt.isNone(),FF=(e,t)=>Bb(e,t).breakAt.isNone(),M7=e=>Mo(e).map(t=>[t].concat(Bb(e,t).positions)).getOr([]),N7=e=>Wd(e).map(t=>Rw(e,t).positions.concat(t)).getOr([]),F7=(e,t)=>k_(A_(e,t),t),B7=(e,t)=>k_(NF(e,t),t),$7=Ir,BF=(e,t)=>Math.abs(e.left-t),$F=(e,t)=>Math.abs(e.right-t),eL=e=>vr(e,"node"),HF=(e,t)=>Xn(e,(s,a)=>{const d=Math.min(BF(s,t),$F(s,t)),p=Math.min(BF(a,t),$F(a,t));return p===d&&eL(a)&&$7(a.node)||p<d?a:s}),H7=e=>{const t=s=>$t(s,a=>{const d=Wc(a);return d.node=e,d});if(oo(e))return t(e.getClientRects());if(rn(e)){const s=e.ownerDocument.createRange();return s.setStart(e,0),s.setEnd(e,e.data.length),t(s.getClientRects())}else return[]},UF=e=>kt(e,H7);var Zx;(function(e){e[e.Up=-1]="Up",e[e.Down=1]="Down"})(Zx||(Zx={}));const $b=(e,t,s,a)=>{let d=a;for(;d=dy(d,e,ip,t);)if(s(d))return},VF=(e,t,s,a,d,p)=>{let v=0;const C=[],L=te=>{let ie=UF([te]);e===-1&&(ie=ie.reverse());for(let ye=0;ye<ie.length;ye++){const Re=ie[ye];if(!s(Re,G)){if(C.length>0&&t(Re,Ko(C))&&v++,Re.line=v,d(Re))return!0;C.push(Re)}}return!1},G=Ko(p.getClientRects());if(!G)return C;const ee=p.getNode();return ee&&(L(ee),$b(e,a,L,ee)),C},U7=(e,t)=>t.line>e,V7=(e,t)=>t.line===e,Yu=it(VF,Zx.Up,du,xg),zF=it(VF,Zx.Down,xg,du),GF=e=>Ko(e.getClientRects()),z7=(e,t,s,a)=>{const d=Do(t);let p,v,C,L;const G=[];let ee=0;e===1?(p=d.next,v=xg,C=du,L=Et.after(a)):(p=d.prev,v=du,C=xg,L=Et.before(a));const te=GF(L);do{if(!L.isVisible())continue;const ie=GF(L);if(C(ie,te))continue;G.length>0&&v(ie,Ko(G))&&ee++;const ye=Wc(ie);if(ye.position=L,ye.line=ee,s(ye))return G;G.push(ye)}while(L=p(L));return G},WF=e=>t=>U7(e,t),tL=e=>t=>V7(e,t),Op=(e,t)=>{e.selection.setRng(t),Kd(e,e.selection.getRng())},L_=(e,t,s)=>J.some(GA(e,t,s)),jF=(e,t,s,a,d,p)=>{const v=t===Ol.Forwards,C=Do(e.getBody()),L=it(S2,v?C.next:C.prev),G=v?a:d;if(!s.collapsed){const Re=yg(s);if(p(Re))return pm(t,e,Re,t===Ol.Backwards,!1);if(jA(e)){const Se=s.cloneRange();return Se.collapse(t===Ol.Backwards),J.from(Se)}}const ee=my(t,e.getBody(),s);if(G(ee))return Aw(e,ee.getNode(!v));let te=L(ee);const ie=K0(s);if(te)te=qd(v,te);else return ie?J.some(s):J.none();if(G(te))return pm(t,e,te.getNode(!v),v,!1);const ye=L(te);return ye&&G(ye)&&rE(te,ye)?pm(t,e,ye.getNode(!v),v,!1):ie?L_(e,te.toRange(),!1):J.none()},KF=(e,t,s,a,d,p)=>{const v=my(t,e.getBody(),s),C=Ko(v.getClientRects()),L=t===Zx.Down,G=e.getBody();if(!C)return J.none();if(jA(e)){const Pe=L?Et.fromRangeEnd(s):Et.fromRangeStart(s);return(L?B7:F7)(G,Pe).orThunk(()=>J.from(Pe)).map(nt=>nt.toRange())}const te=(L?zF:Yu)(G,WF(1),v),ie=Ct(te,tL(1)),ye=C.left,Re=HF(ie,ye);if(Re&&p(Re.node)){const Pe=Math.abs(ye-Re.left),Je=Math.abs(ye-Re.right);return pm(t,e,Re.node,Pe<Je,!1)}let Se;if(a(v)?Se=v.getNode():d(v)?Se=v.getNode(!0):Se=yg(s),Se){const Pe=z7(t,G,WF(1),Se);let Je=HF(Ct(Pe,tL(1)),ye);if(Je||(Je=Ko(Ct(Pe,tL(0))),Je))return L_(e,Je.position.toRange(),!1)}return ie.length===0?nL(e,L).filter(L?d:a).map(Pe=>GA(e,Pe.toRange(),!1)):J.none()},nL=(e,t)=>{const s=e.selection.getRng(),a=t?Et.fromRangeEnd(s):Et.fromRangeStart(s),d=v5(a.container(),e.getBody());if(t){const p=Bb(d,a);return On(p.positions)}else{const p=Rw(d,a);return At(p.positions)}},ZF=(e,t,s)=>nL(e,t).filter(s).exists(a=>(e.selection.setRng(a.toRange()),!0)),R_=(e,t)=>{const s=e.dom.createRng();s.setStart(t.container(),t.offset()),s.setEnd(t.container(),t.offset()),e.selection.setRng(s)},Hb=(e,t)=>{e?t.setAttribute("data-mce-selected","inline-boundary"):t.removeAttribute("data-mce-selected")},oL=(e,t,s)=>qA(t,s).map(a=>(R_(e,a),s)),O_=(e,t,s)=>{const a=Et.fromRangeStart(e);if(e.collapsed)return a;{const d=Et.fromRangeEnd(e);return s?Wu(t,d).getOr(d):Kc(t,a).getOr(a)}},sL=(e,t,s)=>{const a=e.getBody(),d=O_(e.selection.getRng(),a,s),p=it(wb,e);return O7(s,p,a,d).bind(C=>oL(e,t,C))},qF=(e,t,s)=>{const a=$t($e(M.fromDom(t.getRoot()),'*[data-mce-selected="inline-boundary"]'),v=>v.dom),d=Ct(a,e),p=Ct(s,e);xe(as(d,p),it(Hb,!1)),xe(as(p,d),it(Hb,!0))},YF=(e,t)=>{const s=t.get();if(e.selection.isCollapsed()&&!e.composing&&s){const a=Et.fromRangeStart(e.selection.getRng());Et.isTextPosition(a)&&!eC(a)&&(R_(e,p5(s,a)),t.set(null))}},G7=(e,t,s,a)=>{if(t.selection.isCollapsed()){const d=Ct(a,e);xe(d,p=>{const v=Et.fromRangeStart(t.selection.getRng());gm(e,t.getBody(),v).bind(C=>oL(t,s,C))})}},rL=(e,t,s)=>rx(e)?sL(e,t,s).isSome():!1,XF=(e,t,s)=>rx(t)?OF(e,t):!1,JF=e=>{const t=Ea(null),s=it(wb,e);return e.on("NodeChange",a=>{rx(e)&&(qF(s,e.dom,a.parents),YF(e,t),G7(s,e,t,a.parents))}),t},QF=it(XF,!0),e3=it(XF,!1),Ow=(e,t,s)=>{if(rx(e)){const a=nL(e,t).getOrThunk(()=>{const d=e.selection.getRng();return t?Et.fromRangeEnd(d):Et.fromRangeStart(d)});return gm(it(wb,e),e.getBody(),a).exists(d=>{const p=__(d);return qA(s,p).exists(v=>(R_(e,v),!0))})}else return!1},t3=(e,t)=>{const s=document.createRange();return s.setStart(e.container(),e.offset()),s.setEnd(t.container(),t.offset()),s},n3=e=>wa(Mo(e),Wd(e),(t,s)=>{const a=qd(!0,t),d=qd(!1,s);return Kc(e,a).forall(p=>p.isEqual(d))}).getOr(!0),I_=(e,t)=>s=>qA(t,s).map(a=>()=>R_(e,a)),iL=(e,t,s,a)=>{const d=e.getBody(),p=it(wb,e);e.undoManager.ignore(()=>{e.selection.setRng(t3(s,a)),FD(e),gm(p,d,Et.fromRangeStart(e.selection.getRng())).map(T_).bind(I_(e,t)).each(on)}),e.nodeChanged()},o3=(e,t)=>{const s=Eg(t,e);return s||e},s3=(e,t,s,a)=>{const d=o3(e.getBody(),a.container()),p=it(wb,e),v=gm(p,d,a);return v.bind(L=>s?L.fold(et(J.some(T_(L))),J.none,et(J.some(__(L))),J.none):L.fold(J.none,et(J.some(__(L))),J.none,et(J.some(T_(L))))).map(I_(e,t)).getOrThunk(()=>{const L=ab(s,d,a),G=L.bind(ee=>gm(p,d,ee));return wa(v,G,()=>Ug(p,d,a).bind(ee=>n3(ee)?J.some(()=>{Hg(e,s,M.fromDom(ee))}):J.none())).getOrThunk(()=>G.bind(()=>L.map(ee=>()=>{s?iL(e,t,a,ee):iL(e,t,ee,a)})))})},P_=(e,t,s)=>{if(e.selection.isCollapsed()&&rx(e)){const a=Et.fromRangeStart(e.selection.getRng());return s3(e,t,s,a)}return J.none()},r3=e=>Sa(e)>1,aL=(e,t)=>{const s=M.fromDom(e.getBody()),a=M.fromDom(e.selection.getStart()),d=kf(a,s);return Cn(d,t).fold(et(d),p=>d.slice(0,p))},i3=e=>Sa(e)===1,lL=e=>aL(e,t=>e.schema.isBlock(ls(t))||r3(t)),cL=e=>aL(e,t=>e.schema.isBlock(ls(t))),Iw=(e,t)=>{const s=it(kC,e);return kt(t,a=>s(a)?[a.dom]:[])},uL=e=>{const t=cL(e);return Iw(e,t)},a3=(e,t,s,a)=>{const d=Iw(t,a);if(d.length===0)Hg(t,e,s);else{const p=DC(s.dom,d);t.selection.setRng(p.toRange())}},l3=(e,t)=>{const s=Ct(lL(e),i3);return On(s).bind(a=>{const d=Et.fromRangeStart(e.selection.getRng());return Dx(t,d,a.dom)&&!pE(a)?J.some(()=>a3(t,e,a,s)):J.none()})},dL=(e,t)=>{const s=t.parentElement;return fi(t)&&!Ce(s)&&e.dom.isEmpty(s)},c3=e=>pE(M.fromDom(e)),fL=(e,t)=>{const s=e.selection.getStart(),a=dL(e,s)||c3(s)?DC(s,t):hk(e.selection.getRng(),t);e.selection.setRng(a.toRange())},u3=(e,t)=>{const s=as(t,uL(e));s.length>0&&fL(e,s)},d3=e=>rn(e.startContainer),f3=e=>e.startOffset===0&&d3(e),h3=(e,t)=>{const s=t.startContainer.parentElement;return!Ce(s)&&kC(e,M.fromDom(s))},m3=e=>{const t=e.startContainer.parentNode,s=e.endContainer.parentNode;return!Ce(t)&&!Ce(s)&&t.isEqualNode(s)},p3=e=>{const t=e.endContainer;return e.endOffset===(rn(t)?t.length:t.childNodes.length)},g3=e=>m3(e)&&p3(e),hL=e=>!e.endContainer.isEqualNode(e.commonAncestorContainer),W7=e=>g3(e)||hL(e),b3=e=>{const t=e.selection.getRng();return f3(t)&&h3(e,t)&&W7(t)},j7=e=>{if(b3(e)){const t=uL(e);return J.some(()=>{FD(e),u3(e,t)})}else return J.none()},M_=(e,t)=>e.selection.isCollapsed()?l3(e,t):j7(e),v3=(e,t)=>cn(e,s=>md(s.dom),s=>t.isBlock(ls(s))),K7=e=>v3(M.fromDom(e.selection.getStart()),e.schema),Z7=e=>{const t=e.selection.getRng();return t.collapsed&&(d3(t)||e.dom.isEmpty(t.startContainer))&&!K7(e)},r=e=>(Z7(e)&&fL(e,[]),!0),c=(e,t,s)=>ve(s)?J.some(()=>{e._selectionOverrides.hideFakeCaret(),Hg(e,t,M.fromDom(s))}):J.none(),f=(e,t)=>{const s=t?Cx:xb,a=t?Ol.Forwards:Ol.Backwards,d=my(a,e.getBody(),e.selection.getRng());return s(d)?c(e,t,d.getNode(!t)):J.from(qd(t,d)).filter(p=>s(p)&&rE(d,p)).bind(p=>c(e,t,p.getNode(!t)))},m=(e,t)=>{const s=e.selection.getNode();return Lu(s)?c(e,t,s):J.none()},x=(e,t)=>e.selection.isCollapsed()?f(e,t):m(e,t),y=e=>El(e,t=>Ws(t.dom)||Ir(t.dom)).exists(t=>Ws(t.dom)),E=e=>yr(e??"").getOr(0),D=(e,t)=>{const s=e||OS(t)?"margin":"padding",a=Vi(t,"direction")==="rtl"?"-right":"-left";return s+a},A=(e,t,s,a,d,p)=>{const v=D(s,M.fromDom(p)),C=E(e.getStyle(p,v));if(t==="outdent"){const L=Math.max(0,C-a);e.setStyle(p,v,L?L+d:"")}else{const L=C+a+d;e.setStyle(p,v,L)}},P=(e,t)=>jo(t,s=>{const a=D(SR(e),s),d=Vc(s,a).map(E).getOr(0);return e.dom.getContentEditable(s.dom)!=="false"&&d>0}),U=e=>{const t=oe(e);return!e.mode.isReadOnly()&&(t.length>1||P(e,t))},B=e=>Bv(e)||yf(e),K=e=>_s(e).exists(B),oe=e=>Ct(wc(e.selection.getSelectedBlocks()),t=>!B(t)&&!K(t)&&y(t)),ne=(e,t)=>{var s,a;const{dom:d}=e,p=fd(e),v=(a=(s=/[a-z%]+$/i.exec(p))===null||s===void 0?void 0:s[0])!==null&&a!==void 0?a:"px",C=E(p),L=SR(e);xe(oe(e),G=>{A(d,t,L,C,v,G.dom)})},ge=e=>ne(e,"indent"),he=e=>ne(e,"outdent"),Le=e=>{if(e.selection.isCollapsed()&&U(e)){const t=e.dom,s=e.selection.getRng(),a=Et.fromRangeStart(s),d=t.getParent(s.startContainer,t.isBlock);if(d!==null&&GE(M.fromDom(d),a,e.schema))return J.some(()=>he(e))}return J.none()},fe=(e,t,s)=>Is([Le,KA,Lw,(a,d)=>P_(a,t,d),w_,Tp,ZA,x,VA,M_],a=>a(e,s)).filter(a=>e.selection.isEditable()),de=(e,t)=>{fe(e,t,!1).fold(()=>{e.selection.isEditable()&&(FD(e),oC(e))},on)},be=(e,t)=>{fe(e,t,!0).fold(()=>{e.selection.isEditable()&&ow(e)},on)},Te=(e,t)=>{e.addCommand("delete",()=>{de(e,t)}),e.addCommand("forwardDelete",()=>{be(e,t)})},ke=5,Ke=400,dt=e=>e.touches===void 0||e.touches.length!==1?J.none():J.some(e.touches[0]),zt=(e,t)=>{const s=Math.abs(e.clientX-t.x),a=Math.abs(e.clientY-t.y);return s>ke||a>ke},Wt=e=>{const t=tn(),s=Ea(!1),a=V0(d=>{e.dispatch("longpress",{...d,type:"longpress"}),s.set(!0)},Ke);e.on("touchstart",d=>{dt(d).each(p=>{a.cancel();const v={x:p.clientX,y:p.clientY,target:d.target};a.throttle(d),s.set(!1),t.set(v)})},!0),e.on("touchmove",d=>{a.cancel(),dt(d).each(p=>{t.on(v=>{zt(p,v)&&(t.clear(),s.set(!1),e.dispatch("longpresscancel"))})})},!0),e.on("touchend touchcancel",d=>{a.cancel(),d.type!=="touchcancel"&&t.get().filter(p=>p.target.isEqualNode(d.target)).each(()=>{s.get()?d.preventDefault():e.dispatch("tap",{...d,type:"tap"})})},!0)},en=(e,t)=>yn(e,t.nodeName),xn=(e,t)=>rn(t)?!0:oo(t)?!en(e.getBlockElements(),t)&&!pd(t)&&!Bh(e,t)&&!y1(t):!1,$n=(e,t,s)=>mo(rc(M.fromDom(s),M.fromDom(t)),a=>en(e,a.dom)),ro=(e,t)=>{if(rn(t)){if(t.data.length===0)return!0;if(/^\s+$/.test(t.data))return!t.nextSibling||en(e,t.nextSibling)||y1(t.nextSibling)}return!1},xo=e=>e.dom.create(Wl(e),ny(e)),Zo=e=>{const t=e.dom,s=e.selection,a=e.schema,d=a.getBlockElements(),p=s.getStart(),v=e.getBody();let C,L,G=!1;const ee=Wl(e);if(!p||!oo(p))return;const te=v.nodeName.toLowerCase();if(!a.isValidChild(te,ee.toLowerCase())||$n(d,v,p))return;const ie=s.getRng(),{startContainer:ye,startOffset:Re,endContainer:Se,endOffset:Pe}=ie,Je=gb(e);let nt=v.firstChild;for(;nt;)if(oo(nt)&&mv(a,nt),xn(a,nt)){if(ro(d,nt)){L=nt,nt=nt.nextSibling,t.remove(L);continue}C||(C=xo(e),v.insertBefore(C,nt),G=!0),L=nt,nt=nt.nextSibling,C.appendChild(L)}else C=null,nt=nt.nextSibling;G&&Je&&(ie.setStart(ye,Re),ie.setEnd(Se,Pe),s.setRng(ie),e.nodeChanged())},ws=(e,t,s)=>{const a=M.fromDom(xo(e)),d=Tc();rr(a,d),s(t,a);const p=document.createRange();return p.setStartBefore(d.dom),p.setEndBefore(d.dom),p},ii=e=>{e.on("NodeChange",it(Zo,e))},pi=e=>t=>(" "+t.attr("class")+" ").indexOf(e)!==-1,_o=(e,t,s)=>function(a){const d=arguments,p=d[d.length-2],v=p>0?t.charAt(p-1):"";if(v==='"')return a;if(v===">"){const C=t.lastIndexOf("<",p);if(C!==-1&&t.substring(C,p).indexOf('contenteditable="false"')!==-1)return a}return'<span class="'+s+'" data-mce-content="'+e.dom.encode(d[0])+'">'+e.dom.encode(typeof d[1]=="string"?d[1]:d[0])+"</span>"},Ai=(e,t,s)=>{let a=t.length,d=s.content;if(s.format!=="raw"){for(;a--;)d=d.replace(t[a],_o(e,d,ob(e)));s.content=d}},No=e=>{const t="contenteditable",s=" "+hn.trim(l5(e))+" ",a=" "+hn.trim(ob(e))+" ",d=pi(s),p=pi(a),v=NR(e);v.length>0&&e.on("BeforeSetContent",C=>{Ai(e,v,C)}),e.parser.addAttributeFilter("class",C=>{let L=C.length;for(;L--;){const G=C[L];d(G)?G.attr(t,"true"):p(G)&&G.attr(t,"false")}}),e.serializer.addAttributeFilter(t,C=>{let L=C.length;for(;L--;){const G=C[L];!d(G)&&!p(G)||(v.length>0&&G.attr("data-mce-content")?(G.name="#text",G.type=3,G.raw=!0,G.value=G.attr("data-mce-content")):G.attr(t,null))}})},Qr=e=>fa(M.fromDom(e.getBody()),"*[data-mce-caret]").map(t=>t.dom).getOrNull(),fr=(e,t)=>{t.hasAttribute("data-mce-caret")&&(Sf(t),e.selection.setRng(e.selection.getRng()),e.selection.scrollIntoView(t))},ac=(e,t)=>{const s=Qr(e);if(s){if(t.type==="compositionstart"){t.preventDefault(),t.stopPropagation(),fr(e,s);return}K1(s)&&(fr(e,s),e.undoManager.add())}},Ki=e=>{e.on("keyup compositionstart",it(ac,e))},qa=Ir,mu=(e,t,s)=>jF(t,e,s,am,wp,qa),qx=(e,t,s)=>KF(t,e,s,p=>am(p)||xD(p),p=>wp(p)||yD(p),qa),Yx=e=>{const t=e.dom.create(Wl(e));return t.innerHTML='<br data-mce-bogus="1">',t},Ip=(e,t,s)=>{const a=Do(e.getBody()),d=it(S2,t===1?a.next:a.prev);if(s.collapsed){const p=e.dom.getParent(s.startContainer,"PRE");if(!p)return;if(!d(Et.fromRangeStart(s))){const C=M.fromDom(Yx(e));t===1?Si(M.fromDom(p),C):lt(M.fromDom(p),C),e.selection.select(C.dom,!0),e.selection.collapse()}}},Pp=(e,t)=>{const s=t?Ol.Forwards:Ol.Backwards,a=e.selection.getRng();return mu(s,e,a).orThunk(()=>(Ip(e,s,a),J.none()))},Pw=(e,t)=>{const s=t?1:-1,a=e.selection.getRng();return qx(s,e,a).orThunk(()=>(Ip(e,s,a),J.none()))},t0=(e,t)=>{const s=t?e.getEnd(!0):e.getStart(!0);return xd(s)?!t:t},bm=(e,t)=>Pp(e,t0(e.selection,t)).exists(s=>(Op(e,s),!0)),n0=(e,t)=>Pw(e,t).exists(s=>(Op(e,s),!0)),o0=(e,t)=>ZF(e,t,t?wp:am),s0=(e,t)=>WA(e,!t).map(s=>{const a=s.toRange(),d=e.selection.getRng();return t?a.setStart(d.startContainer,d.startOffset):a.setEnd(d.endContainer,d.endOffset),a}).exists(s=>(Op(e,s),!0)),N_=e=>to(["figcaption"],ls(e)),Mw=(e,t,s)=>{const a=it(gt,t);return El(M.fromDom(e.container()),d=>s.isBlock(ls(d)),a).filter(N_)},r0=(e,t,s)=>t?FF(e.dom,s):QA(e.dom,s),Mp=(e,t)=>{const s=M.fromDom(e.getBody()),a=Et.fromRangeStart(e.selection.getRng());return Mw(a,s,e.schema).exists(()=>{if(r0(s,t,a)){const p=ws(e,s,t?rr:au);return e.selection.setRng(p),!0}else return!1})},vm=(e,t)=>e.selection.isCollapsed()?Mp(e,t):!1,Nw=(e,t,s)=>{const a=e.selection.getRng(),d=Et.fromRangeStart(a);return e.getBody().firstChild===t&&QA(s,d)?(e.execCommand("InsertNewBlockBefore"),!0):!1},Fw=(e,t)=>{const s=e.selection.getRng(),a=Et.fromRangeStart(s);return e.getBody().lastChild===t&&FF(t,a)?(e.execCommand("InsertNewBlockAfter"),!0):!1},Ks=(e,t)=>t?J.from(e.dom.getParent(e.selection.getNode(),"details")).map(s=>Fw(e,s)).getOr(!1):J.from(e.dom.getParent(e.selection.getNode(),"summary")).bind(s=>J.from(e.dom.getParent(s,"details")).map(a=>Nw(e,a,s))).getOr(!1),xm=(e,t)=>Ks(e,t),Mf={shiftKey:!1,altKey:!1,ctrlKey:!1,metaKey:!1,keyCode:0},F_=e=>$t(e,t=>({...Mf,...t})),B_=e=>$t(e,t=>({...Mf,...t})),ym=(e,t)=>t.keyCode===e.keyCode&&t.shiftKey===e.shiftKey&&t.altKey===e.altKey&&t.ctrlKey===e.ctrlKey&&t.metaKey===e.metaKey,Xx=(e,t)=>kt(F_(e),s=>ym(s,t)?[s]:[]),mL=(e,t)=>kt(B_(e),s=>ym(s,t)?[s]:[]),Uo=(e,...t)=>()=>e.apply(null,t),Bw=(e,t)=>Qt(Xx(e,t),s=>s.action()),Ub=(e,t)=>Is(mL(e,t),s=>s.action()),x3=(e,t)=>{const s=t?Ol.Forwards:Ol.Backwards,a=e.selection.getRng();return jF(e,s,a,Cx,xb,Lu).exists(d=>(Op(e,d),!0))},lc=(e,t)=>{const s=t?1:-1,a=e.selection.getRng();return KF(e,s,a,Cx,xb,Lu).exists(d=>(Op(e,d),!0))},Vb=(e,t)=>ZF(e,t,t?xb:Cx),y3=Oo.generate([{none:["current"]},{first:["current"]},{middle:["current","target"]},{last:["current"]}]),zb={...y3,none:e=>y3.none(e)},w3=(e,t)=>pL(e,t,an),pL=(e,t,s)=>kt(cr(e),a=>Ve(a,t)?s(a)?[a]:[]:pL(a,t,s)),Y7=(e,t,s=vt)=>{if(s(t))return J.none();if(to(e,ls(t)))return J.some(t);const a=d=>Ve(d,"table")||s(d);return Rt(t,e.join(","),a)},$_=(e,t)=>Y7(["td","th"],e,t),gL=e=>w3(e,"th,td"),i0=(e,t)=>iu(e,"table",t),Gb=(e,t,s,a,d=an)=>{const p=a===1;if(!p&&s<=0)return zb.first(e[0]);if(p&&s>=e.length-1)return zb.last(e[e.length-1]);{const v=s+a,C=e[v];return d(C)?zb.middle(t,C):Gb(e,t,v,a,d)}},bL=(e,t)=>i0(e,t).bind(s=>{const a=gL(s);return Cn(a,p=>gt(e,p)).map(p=>({index:p,all:a}))}),S3=(e,t,s)=>bL(e,s).fold(()=>zb.none(e),d=>Gb(d.all,e,d.index,1,t)),H_=(e,t,s)=>bL(e,s).fold(()=>zb.none(),d=>Gb(d.all,e,d.index,-1,t)),Np=e=>RS(e).filter(t=>t.trim().length!==0||t.indexOf(Vo)>-1).isSome(),E3=e=>uf(e)&&Oa(e,"contenteditable")==="false",C3=["img","br"],_3=e=>Np(e)||to(C3,ls(e))||E3(e),T3=e=>Uc(e,_3),X7=(e,t)=>({left:e.left-t,top:e.top-t,right:e.right+t*2,bottom:e.bottom+t*2,width:e.width+t,height:e.height+t}),ht=(e,t)=>kt(t,s=>{const a=X7(Wc(s.getBoundingClientRect()),-1);return[{x:a.left,y:e(a),cell:s},{x:a.right,y:e(a),cell:s}]}),wo=(e,t,s)=>Kn(e,(a,d)=>a.fold(()=>J.some(d),p=>{const v=Math.sqrt(Math.abs(p.x-t)+Math.abs(p.y-s)),C=Math.sqrt(Math.abs(d.x-t)+Math.abs(d.y-s));return J.some(C<v?d:p)}),J.none()),zo=(e,t,s,a,d)=>{const p=$e(M.fromDom(s),"td,th,caption").map(C=>C.dom),v=Ct(ht(e,p),C=>t(C,d));return wo(v,a,d).map(C=>C.cell)},Wr=e=>e.bottom,Ni=e=>e.top,oa=(e,t)=>e.y<t,Zi=(e,t)=>e.y>t,Da=it(zo,Wr,oa),Jx=it(zo,Ni,Zi),J7=(e,t)=>At(t.getClientRects()).bind(s=>Da(e,s.left,s.top)).bind(s=>k_(N7(s),t)),D3=(e,t)=>On(t.getClientRects()).bind(s=>Jx(e,s.left,s.top)).bind(s=>k_(M7(s),t)),Cz=(e,t,s)=>s.breakAt.exists(a=>e(t,a).breakAt.isSome()),SY=e=>e.breakType===vh.Wrap&&e.positions.length===0,EY=e=>e.breakType===vh.Br&&e.positions.length===1,_z=(e,t,s)=>{const a=e(t,s);return SY(a)||!fi(s.getNode())&&EY(a)?!Cz(e,t,a):a.breakAt.isNone()},CY=it(_z,Rw),_Y=it(_z,Bb),TY=(e,t,s)=>{const a=Et.fromRangeStart(t);return lx(!e,s).exists(d=>d.isEqual(a))},DY=(e,t,s,a)=>{const d=e.selection.getRng(),p=t?1:-1;return b2()&&TY(t,d,s)?(pm(p,e,s,!t,!1).each(v=>{Op(e,v)}),!0):!1},kY=(e,t,s)=>J7(t,s).orThunk(()=>At(s.getClientRects()).bind(a=>JA(A_(e,Et.before(t)),a.left))).getOr(Et.before(t)),AY=(e,t,s)=>D3(t,s).orThunk(()=>At(s.getClientRects()).bind(a=>JA(NF(e,Et.after(t)),a.left))).getOr(Et.after(t)),Tz=(e,t)=>{const s=t.getNode(e);return $d(s)?J.some(s):J.none()},LY=(e,t,s)=>{t.undoManager.transact(()=>{const a=e?Si:lt,d=ws(t,M.fromDom(s),a);Op(t,d)})},Dz=(e,t,s)=>{const a=Tz(!!t,s),d=t===!1;a.fold(()=>Op(e,s.toRange()),p=>lx(d,e.getBody()).filter(v=>v.isEqual(s)).fold(()=>Op(e,s.toRange()),v=>LY(t,e,p)))},RY=(e,t,s,a)=>{const d=e.selection.getRng(),p=Et.fromRangeStart(d),v=e.getBody();if(!t&&CY(a,p)){const C=kY(v,s,p);return Dz(e,t,C),!0}else if(t&&_Y(a,p)){const C=AY(v,s,p);return Dz(e,t,C),!0}else return!1},kz=(e,t,s)=>J.from(e.dom.getParent(e.selection.getNode(),"td,th")).bind(a=>J.from(e.dom.getParent(a,"table")).map(d=>s(e,t,d,a))).getOr(!1),Az=(e,t)=>kz(e,t,DY),Q7=(e,t)=>kz(e,t,RY),OY=e=>{const t=Rg.exact(e,0,e,0);return Z5(t)},Lz=(e,t,s)=>s.fold(J.none,J.none,(a,d)=>T3(d).map(p=>OY(p)),a=>(e.execCommand("mceTableInsertRowAfter"),Rz(e,t,a))),Rz=(e,t,s)=>Lz(e,t,S3(s,$a)),IY=(e,t,s)=>Lz(e,t,H_(s,$a)),Oz=(e,t)=>{const s=["table","li","dl"],a=M.fromDom(e.getBody()),d=C=>{const L=ls(C);return gt(C,a)||to(s,L)},p=e.selection.getRng(),v=M.fromDom(t?p.endContainer:p.startContainer);return $_(v,d).map(C=>(i0(C,d).each(ee=>{e.model.table.clearSelectedCells(ee.dom)}),e.selection.collapse(!t),(t?Rz:IY)(e,d,C).each(ee=>{e.selection.setRng(ee)}),!0)).getOr(!1)},PY=(e,t,s)=>{const a=gs.os.isMacOS()||gs.os.isiOS();Bw([{keyCode:Pn.RIGHT,action:Uo(bm,e,!0)},{keyCode:Pn.LEFT,action:Uo(bm,e,!1)},{keyCode:Pn.UP,action:Uo(n0,e,!1)},{keyCode:Pn.DOWN,action:Uo(n0,e,!0)},...a?[{keyCode:Pn.UP,action:Uo(s0,e,!1),metaKey:!0,shiftKey:!0},{keyCode:Pn.DOWN,action:Uo(s0,e,!0),metaKey:!0,shiftKey:!0}]:[],{keyCode:Pn.RIGHT,action:Uo(Az,e,!0)},{keyCode:Pn.LEFT,action:Uo(Az,e,!1)},{keyCode:Pn.UP,action:Uo(Q7,e,!1)},{keyCode:Pn.DOWN,action:Uo(Q7,e,!0)},{keyCode:Pn.UP,action:Uo(Q7,e,!1)},{keyCode:Pn.UP,action:Uo(xm,e,!1)},{keyCode:Pn.DOWN,action:Uo(xm,e,!0)},{keyCode:Pn.RIGHT,action:Uo(x3,e,!0)},{keyCode:Pn.LEFT,action:Uo(x3,e,!1)},{keyCode:Pn.UP,action:Uo(lc,e,!1)},{keyCode:Pn.DOWN,action:Uo(lc,e,!0)},{keyCode:Pn.RIGHT,action:Uo(rL,e,t,!0)},{keyCode:Pn.LEFT,action:Uo(rL,e,t,!1)},{keyCode:Pn.RIGHT,ctrlKey:!a,altKey:a,action:Uo(QF,e,t)},{keyCode:Pn.LEFT,ctrlKey:!a,altKey:a,action:Uo(e3,e,t)},{keyCode:Pn.UP,action:Uo(vm,e,!1)},{keyCode:Pn.DOWN,action:Uo(vm,e,!0)}],s).each(d=>{s.preventDefault()})},MY=(e,t)=>{e.on("keydown",s=>{s.isDefaultPrevented()||PY(e,t,s)})},Fp=(e,t)=>({container:e,offset:t}),k3=js.DOM,A3=e=>t=>e===t?-1:0,NY=e=>t=>e.isBlock(t)||to(["BR","IMG","HR","INPUT"],t.nodeName)||e.getContentEditable(t)==="false",eH=(e,t,s)=>{if(rn(e)&&t>=0)return J.some(Fp(e,t));{const a=Yf(k3);return J.from(a.backwards(e,t,A3(e),s)).map(d=>Fp(d.container,d.container.data.length))}},FY=(e,t,s)=>{if(rn(e)&&t>=e.length)return J.some(Fp(e,t));{const a=Yf(k3);return J.from(a.forwards(e,t,A3(e),s)).map(d=>Fp(d.container,0))}},tH=(e,t,s)=>{if(!rn(e))return J.none();const a=e.data;if(t>=0&&t<=a.length)return J.some(Fp(e,t));{const d=Yf(k3);return J.from(d.backwards(e,t,A3(e),s)).bind(p=>{const v=p.container.data;return tH(p.container,t+v.length,s)})}},Iz=(e,t,s)=>{if(!rn(e))return J.none();const a=e.data;if(t<=a.length)return J.some(Fp(e,t));{const d=Yf(k3);return J.from(d.forwards(e,t,A3(e),s)).bind(p=>Iz(p.container,t-a.length,s))}},nH=(e,t,s,a,d)=>{const p=Yf(e,NY(e));return J.from(p.backwards(t,s,a,d))},BY=e=>e.collapsed&&rn(e.startContainer),$Y=e=>Ta(e.toString().replace(/\u00A0/g," ")),Pz=e=>e!==""&&`  \f
\r	\v`.indexOf(e)!==-1,HY=(e,t)=>e.substring(t.length),UY=(e,t,s,a=!1)=>{let d;const p=s.charAt(0);for(d=t-1;d>=0;d--){const v=e.charAt(d);if(!a&&Pz(v))return J.none();if(p===v&&xr(e,s,d,t))break}return J.some(d)},oH=(e,t,s,a=!1)=>{if(!BY(t))return J.none();const d={text:"",offset:0},p=(C,L,G)=>(d.text=G+d.text,d.offset+=L,UY(d.text,d.offset,s,a).getOr(L)),v=e.getParent(t.startContainer,e.isBlock)||e.getRoot();return nH(e,t.startContainer,t.startOffset,p,v).bind(C=>{const L=t.cloneRange();if(L.setStart(C.container,C.offset),L.setEnd(t.endContainer,t.endOffset),L.collapsed)return J.none();const G=$Y(L);return G.lastIndexOf(s)!==0?J.none():J.some({text:HY(G,s),range:L,trigger:s})})},VY=e=>e.nodeType===da,zY=e=>e.nodeType===tu,Mz=e=>{if(VY(e))return Fp(e,e.data.length);{const t=e.childNodes;return t.length>0?Mz(t[t.length-1]):Fp(e,t.length)}},Nz=(e,t)=>{const s=e.childNodes;return s.length>0&&t<s.length?Nz(s[t],0):s.length>0&&zY(e)&&s.length===t?Mz(s[s.length-1]):Fp(e,t)},GY=(e,t)=>{var s;const a=(s=e.getParent(t.container,e.isBlock))!==null&&s!==void 0?s:e.getRoot();return nH(e,t.container,t.offset,(d,p)=>p===0?-1:p,a).filter(d=>{const p=d.container.data.charAt(d.offset-1);return!Pz(p)}).isSome()},WY=e=>t=>{const s=Nz(t.startContainer,t.startOffset);return!GY(e,s)},jY=(e,t,s)=>Is(s.triggers,a=>oH(e,t,a)),KY=(e,t)=>{const s=t(),a=e.selection.getRng();return jY(e.dom,a,s).bind(d=>Fz(e,t,d))},Fz=(e,t,s,a={})=>{var d;const p=t(),C=(d=e.selection.getRng().startContainer.nodeValue)!==null&&d!==void 0?d:"",L=Ct(p.lookupByTrigger(s.trigger),ee=>s.text.length>=ee.minChars&&ee.matches.getOrThunk(()=>WY(e.dom))(s.range,C,s.text));if(L.length===0)return J.none();const G=Promise.all($t(L,ee=>ee.fetch(s.text,ee.maxResults,a).then(ie=>({matchText:s.text,items:ie,columns:ee.columns,onAction:ee.onAction,highlightOn:ee.highlightOn}))));return J.some({lookupData:G,context:s})};var Bp;(function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"})(Bp||(Bp={}));const sH=(e,t,s)=>e.stype===Bp.Error?t(e.serror):s(e.svalue),ZY=e=>{const t=[],s=[];return xe(e,a=>{sH(a,d=>s.push(d),d=>t.push(d))}),{values:t,errors:s}},qY=(e,t)=>e.stype===Bp.Error?{stype:Bp.Error,serror:t(e.serror)}:e,YY=(e,t)=>e.stype===Bp.Value?{stype:Bp.Value,svalue:t(e.svalue)}:e,XY=(e,t)=>e.stype===Bp.Value?t(e.svalue):e,JY=(e,t)=>e.stype===Bp.Error?t(e.serror):e,Bz=e=>({stype:Bp.Value,svalue:e}),$z=e=>({stype:Bp.Error,serror:e}),kc={fromResult:e=>e.fold($z,Bz),toResult:e=>sH(e,lo.error,lo.value),svalue:Bz,partition:ZY,serror:$z,bind:XY,bindError:JY,map:YY,mapError:qY,fold:sH},rH=e=>Y(e)&&Yt(e).length>100?" removed due to size":JSON.stringify(e,null,2),QY=e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:et("... (only showing first ten failures)")}]):e;return $t(t,s=>"Failed path: ("+s.path.join(" > ")+`)
`+s.getErrorInfo())},L3=(e,t)=>kc.serror([{path:e,getErrorInfo:t}]),eX=(e,t,s)=>L3(e,()=>'Could not find valid *required* value for "'+t+'" in '+rH(s)),tX=(e,t)=>L3(e,()=>'Choice schema did not contain choice key: "'+t+'"'),nX=(e,t,s)=>L3(e,()=>'The chosen schema: "'+s+'" did not exist in branches: '+rH(t)),oX=(e,t)=>L3(e,et(t)),sX=(e,t,s,a)=>Gn(s,a).fold(()=>nX(e,s,a),p=>p.extract(e.concat(["branch: "+a]),t)),rX=(e,t)=>({extract:(d,p)=>Gn(p,e).fold(()=>tX(d,e),C=>sX(d,p,t,C)),toString:()=>"chooseOn("+e+"). Possible values: "+Yt(t)}),iX=(e,t)=>t,aX=(e,t)=>me(e)&&me(t)?R3(e,t):t,Hz=e=>(...t)=>{if(t.length===0)throw new Error("Can't merge zero objects");const s={};for(let a=0;a<t.length;a++){const d=t[a];for(const p in d)yn(d,p)&&(s[p]=e(s[p],d[p]))}return s},R3=Hz(aX),lX=Hz(iX),Uz=()=>({tag:"required",process:{}}),cX=e=>({tag:"defaultedThunk",process:e}),Vz=e=>cX(et(e)),uX=()=>({tag:"option",process:{}}),dX=(e,t)=>e.length>0?kc.svalue(R3(t,lX.apply(void 0,e))):kc.svalue(t),zz=e=>st(kc.serror,Nn)(e),fX={consolidateObj:(e,t)=>{const s=kc.partition(e);return s.errors.length>0?zz(s.errors):dX(s.values,t)},consolidateArr:e=>{const t=kc.partition(e);return t.errors.length>0?zz(t.errors):kc.svalue(t.values)}},hX=(e,t,s,a)=>({tag:"field",key:e,newKey:t,presence:s,prop:a}),mX=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),Gz=(e,t,s)=>{switch(e.tag){case"field":return t(e.key,e.newKey,e.presence,e.prop);case"custom":return s(e.newKey,e.instantiator)}},iH=e=>{const t=(a,d)=>kc.bindError(e(d),p=>oX(a,p)),s=et("val");return{extract:t,toString:s}},pX=iH(kc.svalue),gX=(e,t,s,a)=>Gn(t,s).fold(()=>eX(e,s,t),a),Wz=(e,t,s,a)=>{const d=Gn(e,t).getOrThunk(()=>s(e));return a(d)},bX=(e,t,s)=>s(Gn(e,t)),vX=(e,t,s,a)=>{const d=Gn(e,t).map(p=>p===!0?s(e):p);return a(d)},xX=(e,t,s,a,d)=>{const p=C=>d.extract(t.concat([a]),C),v=C=>C.fold(()=>kc.svalue(J.none()),L=>{const G=d.extract(t.concat([a]),L);return kc.map(G,J.some)});switch(e.tag){case"required":return gX(t,s,a,p);case"defaultedThunk":return Wz(s,a,e.process,p);case"option":return bX(s,a,v);case"defaultedOptionThunk":return vX(s,a,e.process,v);case"mergeWithThunk":return Wz(s,a,et({}),C=>{const L=R3(e.process(s),C);return p(L)})}},yX=(e,t,s)=>{const a={},d=[];for(const p of s)Gz(p,(v,C,L,G)=>{const ee=xX(L,e,t,v,G);kc.fold(ee,te=>{d.push(...te)},te=>{a[C]=te})},(v,C)=>{a[v]=C(t)});return d.length>0?kc.serror(d):kc.svalue(a)},aH=e=>({extract:(a,d)=>yX(a,d,e),toString:()=>`obj{
`+$t(e,d=>Gz(d,(p,v,C,L)=>p+" -> "+L.toString(),(p,v)=>"state("+p+")")).join(`
`)+"}"}),jz=e=>({extract:(a,d)=>{const p=$t(d,(v,C)=>e.extract(a.concat(["["+C+"]"]),v));return fX.consolidateArr(p)},toString:()=>"array("+e.toString()+")"}),wX=e=>iH(t=>e(t).fold(kc.serror,kc.svalue)),SX=(e,t,s)=>{const a=t.extract([e],s);return kc.mapError(a,d=>({input:s,errors:d}))},EX=(e,t,s)=>kc.toResult(SX(e,t,s)),CX=e=>`Errors: 
`+QY(e.errors).join(`
`)+`

Input object: `+rH(e.input),Kz=(e,t)=>rX(e,_i(t,aH)),_X=et(pX),O3=(e,t)=>iH(s=>{const a=typeof s;return e(s)?kc.svalue(s):kc.serror(`Expected type: ${t} but got: ${a}`)}),TX=O3(O,"number"),I3=O3(re,"string"),DX=O3(Ue,"boolean"),lH=O3(Oe,"function"),vL=hX,Zz=mX,kX=e=>wX(t=>to(e,t)?lo.value(t):lo.error(`Unsupported value: "${t}", choose one of "${e.join(", ")}".`)),qz=(e,t)=>vL(e,e,Uz(),t),Yz=e=>qz(e,I3),Xz=e=>qz(e,lH),AX=(e,t)=>vL(e,e,Uz(),jz(t)),cH=(e,t)=>vL(e,e,uX(),t),P3=e=>cH(e,I3),LX=e=>cH(e,lH),RX=(e,t)=>vL(e,e,Vz(t),_X()),U_=(e,t,s)=>vL(e,e,Vz(t),s),Jz=(e,t)=>U_(e,t,TX),OX=(e,t)=>U_(e,t,I3),Qz=(e,t,s)=>U_(e,t,kX(s)),uH=(e,t)=>U_(e,t,DX),dH=(e,t)=>U_(e,t,lH),IX=(e,t,s)=>U_(e,t,jz(s)),PX=Yz("type"),MX=Xz("fetch"),fH=Xz("onAction"),NX=dH("onSetup",()=>Fe),FX=P3("text"),BX=P3("icon"),$X=P3("tooltip"),HX=P3("label"),UX=uH("active",!1),VX=uH("enabled",!0),e9=uH("primary",!1),zX=e=>RX("columns",e),xL=e=>OX("type",e),GX=aH([PX,Yz("trigger"),Jz("minChars",1),zX(1),Jz("maxResults",10),LX("matches"),MX,fH,IX("highlightOn",[],I3)]),WX=e=>EX("Autocompleter",GX,e),hH=[VX,$X,BX,FX,NX],t9=[UX].concat(hH),jX=[dH("predicate",vt),Qz("scope","node",["node","editor"]),Qz("position","selection",["node","selection","line"])],KX=hH.concat([xL("contextformbutton"),e9,fH,Zz("original",Dt)]),ZX=t9.concat([xL("contextformbutton"),e9,fH,Zz("original",Dt)]),qX=hH.concat([xL("contextformbutton")]),YX=t9.concat([xL("contextformtogglebutton")]),XX=Kz("type",{contextformbutton:KX,contextformtogglebutton:ZX});aH([xL("contextform"),dH("initValue",et("")),HX,AX("commands",XX),cH("launch",Kz("type",{contextformbutton:qX,contextformtogglebutton:YX}))].concat(jX));const JX=e=>{const t=e.ui.registry.getAll().popups,s=_i(t,v=>WX(v).fold(C=>{throw new Error(CX(C))},Dt)),a=ze(dn(s,v=>v.trigger)),d=vo(s);return{dataset:s,triggers:a,lookupByTrigger:v=>Ct(d,C=>C.trigger===v)}},QX=(e,t)=>{const s=V0(t.load,50);e.on("input",a=>{a.inputType==="insertCompositionText"&&!e.composing||s.throttle()}),e.on("keydown",a=>{const d=a.which;d===8?s.throttle():d===27?(s.cancel(),t.cancelIfNecessary()):(d===38||d===40)&&s.cancel()},!0),e.on("remove",s.cancel)},eJ=e=>{const t=tn(),s=Ea(!1),a=t.isSet,d=()=>{a()&&(P5(e),s.set(!1),t.clear())},p=te=>{a()||t.set({trigger:te.trigger,matchLength:te.text.length})},v=To(()=>JX(e)),C=te=>t.get().map(ie=>oH(e.dom,e.selection.getRng(),ie.trigger,!0).bind(ye=>Fz(e,v,ye,te))).getOrThunk(()=>KY(e,v)),L=te=>{C(te).fold(d,ie=>{p(ie.context),ie.lookupData.then(ye=>{t.get().map(Re=>{const Se=ie.context;Re.trigger===Se.trigger&&(t.set({...Re,matchLength:Se.text.length}),s.get()?(V2(e,{range:Se.range}),U2(e,{lookupData:ye})):(s.set(!0),V2(e,{range:Se.range}),H2(e,{lookupData:ye})))})})})},G=(te,ie)=>{const ye=te.compareBoundaryPoints(window.Range.START_TO_START,ie),Re=te.compareBoundaryPoints(window.Range.END_TO_END,ie);return ye>=0&&Re<=0},ee=()=>t.get().bind(({trigger:te})=>{const ie=e.selection.getRng();return oH(e.dom,ie,te,s.get()).filter(({range:ye})=>G(ie,ye)).map(({range:ye})=>ye)});e.addCommand("mceAutocompleterReload",(te,ie)=>{const ye=Y(ie)?ie.fetchOptions:{};L(ye)}),e.addCommand("mceAutocompleterClose",d),e.addCommand("mceAutocompleterRefreshActiveRange",()=>{ee().each(te=>{V2(e,{range:te})})}),e.editorCommands.addQueryStateHandler("mceAutoCompleterInRange",()=>ee().isSome()),QX(e,{cancelIfNecessary:d,load:L})},tJ=Cs().browser.isSafari(),n9=e=>Hu(M.fromDom(e)),o9=(e,t)=>{var s;return e.startOffset===0&&e.endOffset===((s=t.textContent)===null||s===void 0?void 0:s.length)},M3=(e,t)=>J.from(e.getParent(t.container(),"details")),s9=(e,t)=>M3(e,t).isSome(),nJ=(e,t)=>{const s=J.from(e.getParent(t.startContainer,"details")),a=J.from(e.getParent(t.endContainer,"details"));if(s.isSome()||a.isSome()){const d=s.bind(p=>J.from(e.select("summary",p)[0]));return J.some({startSummary:d,startDetails:s,endDetails:a})}else return J.none()},oJ=(e,t)=>Mo(t).exists(s=>s.isEqual(e)),sJ=(e,t)=>Wd(t).exists(s=>fi(s.getNode())&&Wu(t,s).exists(a=>a.isEqual(e))||s.isEqual(e)),rJ=(e,t)=>t.startSummary.exists(s=>oJ(e,s)),iJ=(e,t)=>t.startSummary.exists(s=>sJ(e,s)),aJ=(e,t)=>t.startDetails.exists(s=>Wu(s,e).forall(a=>t.startSummary.exists(d=>!d.contains(e.container())&&d.contains(a.container())))),lJ=(e,t,s)=>s.startDetails.exists(a=>Kc(e,t).forall(d=>!a.contains(d.container()))),r9=(e,t)=>{const s=t.getNode();ot(s)||e.selection.setCursorLocation(s,t.offset())},i9=(e,t,s)=>{const a=e.dom.getParent(t.container(),"details");if(a&&!a.open){const d=e.dom.select("summary",a)[0];d&&(s?Mo(d):Wd(d)).each(v=>r9(e,v))}else r9(e,t)},cJ=(e,t)=>{const s=L=>L.contains(e.startContainer),a=L=>L.contains(e.endContainer),d=t.startSummary.exists(s),p=t.startSummary.exists(a),v=t.startDetails.forall(L=>t.endDetails.forall(G=>L!==G));return(d||p)&&!(d&&p)||v},a9=(e,t,s)=>{const{dom:a,selection:d}=e,p=e.getBody();if(s==="character"){const v=Et.fromRangeStart(d.getRng()),C=a.getParent(v.container(),a.isBlock),L=M3(a,v),G=C&&a.isEmpty(C),ee=Ce(C==null?void 0:C.previousSibling),te=Ce(C==null?void 0:C.nextSibling);return G&&(t?te:ee)&&ab(!t,p,v).exists(Re=>s9(a,Re)&&!Rh(L,M3(a,Re)))?!0:ab(t,p,v).fold(vt,ie=>{const ye=M3(a,ie);if(s9(a,ie)&&!Rh(L,ye)){if(t||i9(e,ie,!1),C&&G){if(t&&ee)return!0;if(!t&&te)return!0;i9(e,ie,t),e.dom.remove(C)}return!0}else return!1})}else return!1},uJ=(e,t,s,a)=>{const p=e.selection.getRng(),v=Et.fromRangeStart(p),C=e.getBody();return a==="selection"?cJ(p,t):s?iJ(v,t)||lJ(C,v,t):rJ(v,t)||aJ(v,t)},dJ=(e,t,s)=>nJ(e.dom,e.selection.getRng()).fold(()=>a9(e,t,s),a=>uJ(e,a,t,s)||a9(e,t,s)),fJ=(e,t,s)=>{const a=e.selection,d=a.getNode(),p=a.getRng(),v=Et.fromRangeStart(p);return b1(d)?(s==="selection"&&o9(p,d)||Dx(t,v,d)?n9(d):e.undoManager.transact(()=>{const C=a.getSel();let{anchorNode:L,anchorOffset:G,focusNode:ee,focusOffset:te}=C??{};const ie=()=>{ve(L)&&ve(G)&&ve(ee)&&ve(te)&&(C==null||C.setBaseAndExtent(L,G,ee,te))},ye=()=>{L=C==null?void 0:C.anchorNode,G=C==null?void 0:C.anchorOffset,ee=C==null?void 0:C.focusNode,te=C==null?void 0:C.focusOffset},Re=(Pe,Je)=>{xe(Pe.childNodes,nt=>{mx(nt)&&Je.appendChild(nt)})},Se=e.dom.create("span",{"data-mce-bogus":"1"});Re(d,Se),d.appendChild(Se),ie(),(s==="word"||s==="line")&&(C==null||C.modify("extend",t?"right":"left",s)),!a.isCollapsed()&&o9(a.getRng(),Se)?n9(d):(e.execCommand(t?"ForwardDelete":"Delete"),ye(),Re(Se,d),ie()),e.dom.remove(Se)}),!0):!1},$w=(e,t,s)=>dJ(e,t,s)||tJ&&fJ(e,t,s)?J.some(Fe):J.none(),l9=e=>(t,s,a={})=>{const d=t.getBody(),p={bubbles:!0,composed:!0,data:null,isComposing:!1,detail:0,view:null,target:d,currentTarget:d,eventPhase:Event.AT_TARGET,originalTarget:d,explicitOriginalTarget:d,isTrusted:!1,srcElement:d,cancelable:!1,preventDefault:Fe,inputType:s},v=M1(new InputEvent(e));return t.dispatch(e,{...v,...p,...a})},yL=l9("input"),N3=l9("beforeinput"),c9=Cs(),u9=c9.os,d9=u9.isMacOS()||u9.isiOS(),hJ=c9.browser.isFirefox(),mJ=(e,t,s)=>{const a=s.keyCode===Pn.BACKSPACE?"deleteContentBackward":"deleteContentForward",d=e.selection.isCollapsed(),p=d?"character":"selection",v=C=>d?C?"word":"line":"selection";Ub([{keyCode:Pn.BACKSPACE,action:Uo(Le,e)},{keyCode:Pn.BACKSPACE,action:Uo(KA,e,!1)},{keyCode:Pn.DELETE,action:Uo(KA,e,!0)},{keyCode:Pn.BACKSPACE,action:Uo(Lw,e,!1)},{keyCode:Pn.DELETE,action:Uo(Lw,e,!0)},{keyCode:Pn.BACKSPACE,action:Uo(P_,e,t,!1)},{keyCode:Pn.DELETE,action:Uo(P_,e,t,!0)},{keyCode:Pn.BACKSPACE,action:Uo(Tp,e,!1)},{keyCode:Pn.DELETE,action:Uo(Tp,e,!0)},{keyCode:Pn.BACKSPACE,action:Uo($w,e,!1,p)},{keyCode:Pn.DELETE,action:Uo($w,e,!0,p)},...d9?[{keyCode:Pn.BACKSPACE,altKey:!0,action:Uo($w,e,!1,v(!0))},{keyCode:Pn.DELETE,altKey:!0,action:Uo($w,e,!0,v(!0))},{keyCode:Pn.BACKSPACE,metaKey:!0,action:Uo($w,e,!1,v(!1))}]:[{keyCode:Pn.BACKSPACE,ctrlKey:!0,action:Uo($w,e,!1,v(!0))},{keyCode:Pn.DELETE,ctrlKey:!0,action:Uo($w,e,!0,v(!0))}],{keyCode:Pn.BACKSPACE,action:Uo(ZA,e,!1)},{keyCode:Pn.DELETE,action:Uo(ZA,e,!0)},{keyCode:Pn.BACKSPACE,action:Uo(x,e,!1)},{keyCode:Pn.DELETE,action:Uo(x,e,!0)},{keyCode:Pn.BACKSPACE,action:Uo(VA,e,!1)},{keyCode:Pn.DELETE,action:Uo(VA,e,!0)},{keyCode:Pn.BACKSPACE,action:Uo(w_,e,!1)},{keyCode:Pn.DELETE,action:Uo(w_,e,!0)},{keyCode:Pn.BACKSPACE,action:Uo(M_,e,!1)},{keyCode:Pn.DELETE,action:Uo(M_,e,!0)}],s).filter(C=>e.selection.isEditable()).each(C=>{s.preventDefault(),N3(e,a).isDefaultPrevented()||(C(),yL(e,a))})},pJ=(e,t,s)=>Bw([{keyCode:Pn.BACKSPACE,action:Uo(wF,e)},{keyCode:Pn.DELETE,action:Uo(wF,e)},...d9?[{keyCode:Pn.BACKSPACE,altKey:!0,action:Uo(r,e)},{keyCode:Pn.DELETE,altKey:!0,action:Uo(r,e)},...s?[{keyCode:hJ?224:91,action:Uo(r,e)}]:[]]:[{keyCode:Pn.BACKSPACE,ctrlKey:!0,action:Uo(r,e)},{keyCode:Pn.DELETE,ctrlKey:!0,action:Uo(r,e)}]],t),gJ=(e,t)=>{let s=!1;e.on("keydown",a=>{s=a.keyCode===Pn.BACKSPACE,a.isDefaultPrevented()||mJ(e,t,a)}),e.on("keyup",a=>{a.isDefaultPrevented()||pJ(e,a,s),s=!1})},bJ=e=>{for(;e;){if(oo(e)||rn(e)&&e.data&&/[\r\n\s]/.test(e.data))return e;e=e.nextSibling}return null},V_=(e,t)=>{const s=e.dom,a=e.schema.getMoveCaretBeforeOnEnterElements();if(!t)return;if(/^(LI|DT|DD)$/.test(t.nodeName)){const p=bJ(t.firstChild);p&&/^(UL|OL|DL)$/.test(p.nodeName)&&t.insertBefore(s.doc.createTextNode(Vo),t.firstChild)}const d=s.createRng();if(t.normalize(),t.hasChildNodes()){const p=new bn(t,t);let v=t,C;for(;C=p.current();){if(rn(C)){d.setStart(C,0),d.setEnd(C,0);break}if(a[C.nodeName.toLowerCase()]){d.setStartBefore(C),d.setEndBefore(C);break}v=C,C=p.next()}C||(d.setStart(v,0),d.setEnd(v,0))}else fi(t)?t.nextSibling&&s.isBlock(t.nextSibling)?(d.setStartBefore(t),d.setEndBefore(t)):(d.setStartAfter(t),d.setEndAfter(t)):(d.setStart(t,0),d.setEnd(t,0));e.selection.setRng(d),Kd(e,d)},wL=(e,t)=>{const s=e.getRoot();let a,d=t;for(;d!==s&&d&&e.getContentEditable(d)!=="false";){if(e.getContentEditable(d)==="true"){a=d;break}d=d.parentNode}return d!==s?a:s},mH=e=>J.from(e.dom.getParent(e.selection.getStart(!0),e.dom.isBlock)),vJ=e=>mH(e).fold(et(""),t=>t.nodeName.toUpperCase()),xJ=e=>mH(e).filter(t=>yf(M.fromDom(t))).isSome(),pH=e=>{e.innerHTML='<br data-mce-bogus="1">'},yJ=(e,t,s)=>{const a=e.dom;J.from(s.style).map(a.parseStyle).each(L=>{const ee={..._l(M.fromDom(t)),...L};a.setStyles(t,ee)});const d=J.from(s.class).map(L=>L.split(/\s+/)),p=J.from(t.className).map(L=>Ct(L.split(/\s+/),G=>G!==""));wa(d,p,(L,G)=>{const ee=Ct(G,ie=>!to(L,ie)),te=[...L,...ee];a.setAttrib(t,"class",te.join(" "))});const v=["style","class"],C=ps(s,(L,G)=>!to(v,G));a.setAttribs(t,C)},SL=(e,t)=>{if(Wl(e).toLowerCase()===t.tagName.toLowerCase()){const a=ny(e);yJ(e,t,a)}},f9=(e,t,s,a,d=!0,p,v)=>{const C=e.dom,L=e.schema,G=Wl(e),ee=s?s.nodeName.toUpperCase():"";let te=t;const ie=L.getTextInlineElements();let ye;p||ee==="TABLE"||ee==="HR"?ye=C.create(p||G,v||{}):ye=s.cloneNode(!1);let Re=ye;if(!d)C.setAttrib(ye,"style",null),C.setAttrib(ye,"class",null);else do if(ie[te.nodeName]){if(md(te)||pd(te))continue;const Se=te.cloneNode(!1);C.setAttrib(Se,"id",""),ye.hasChildNodes()?(Se.appendChild(ye.firstChild),ye.appendChild(Se)):(Re=Se,ye.appendChild(Se))}while((te=te.parentNode)&&te!==a);return SL(e,ye),pH(Re),ye},wJ=(e,t)=>e.dom.getParent(t,Nh),SJ=(e,t,s)=>{let a=t;for(;a&&a!==e&&Ce(a.nextSibling);){const d=a.parentElement;if(!d||!s(d))return Nh(d);a=d}return!1},EJ=(e,t,s)=>!t&&s.nodeName.toLowerCase()===Wl(e)&&e.dom.isEmpty(s)&&SJ(e.getBody(),s,a=>yn(e.schema.getTextBlockElements(),a.nodeName.toLowerCase())),CJ=(e,t,s)=>{var a,d,p;const v=t(Wl(e)),C=wJ(e,s);C&&(e.dom.insertAfter(v,C),V_(e,v),((p=(d=(a=s.parentElement)===null||a===void 0?void 0:a.childNodes)===null||d===void 0?void 0:d.length)!==null&&p!==void 0?p:0)>1&&e.dom.remove(s))},_J=(e,t)=>e.firstChild&&e.firstChild.nodeName===t,TJ=e=>{var t;return((t=e.parentNode)===null||t===void 0?void 0:t.firstChild)===e},h9=(e,t)=>{const s=e==null?void 0:e.parentNode;return ve(s)&&s.nodeName===t},m9=e=>ve(e)&&/^(OL|UL|LI)$/.test(e.nodeName),gH=e=>ve(e)&&/^(LI|DT|DD)$/.test(e.nodeName),DJ=e=>m9(e)&&m9(e.parentNode),F3=e=>{const t=e.parentNode;return gH(t)?t:e},B3=(e,t,s)=>{let a=e[s?"firstChild":"lastChild"];for(;a&&!oo(a);)a=a[s?"nextSibling":"previousSibling"];return a===t},p9=e=>Kn(dn(_l(M.fromDom(e)),(t,s)=>`${s}: ${t};`),(t,s)=>t+s,""),kJ=(e,t,s,a,d)=>{const p=e.dom,v=e.selection.getRng(),C=s.parentNode;if(s===e.getBody()||!C)return;DJ(s)&&(d="LI");const L=gH(a)?p9(a):void 0;let G=gH(a)&&L?t(d,{style:p9(a)}):t(d);if(B3(s,a,!0)&&B3(s,a,!1))if(h9(s,"LI")){const ee=F3(s);p.insertAfter(G,ee),TJ(s)?p.remove(ee):p.remove(s)}else p.replace(G,s);else if(B3(s,a,!0))h9(s,"LI")?(p.insertAfter(G,F3(s)),G.appendChild(p.doc.createTextNode(" ")),G.appendChild(s)):C.insertBefore(G,s),p.remove(a);else if(B3(s,a,!1))p.insertAfter(G,F3(s)),p.remove(a);else{s=F3(s);const ee=v.cloneRange();ee.setStartAfter(a),ee.setEndAfter(s);const te=ee.extractContents();if(d==="LI"&&_J(te,"LI")){const ie=Ct($t(G.children,M.fromDom),qe(ci("br")));G=te.firstChild,p.insertAfter(te,s),xe(ie,ye=>au(M.fromDom(G),ye)),L&&G.setAttribute("style",L)}else p.insertAfter(te,s),p.insertAfter(G,s);p.remove(a)}V_(e,G)},AJ=e=>{xe(Dl(M.fromDom(e),ti),t=>{const s=t.dom;s.nodeValue=Ta(s.data)})},LJ=(e,t)=>{const s=e.dom.getParent(t,"ol,ul,dl");return s!==null&&e.dom.getContentEditableParent(s)==="false"},RJ=(e,t)=>t&&t.nodeName==="A"&&e.isEmpty(t),bH=(e,t)=>e.nodeName===t||e.previousSibling&&e.previousSibling.nodeName===t,vH=(e,t)=>ve(t)&&e.isBlock(t)&&!/^(TD|TH|CAPTION|FORM)$/.test(t.nodeName)&&!/^(fixed|absolute)/i.test(t.style.position)&&e.isEditable(t.parentNode)&&e.getContentEditable(t)!=="false",OJ=(e,t,s)=>{var a;const d=[];if(!s)return;let p=s;for(;p=p.firstChild;){if(e.isBlock(p))return;oo(p)&&!t[p.nodeName.toLowerCase()]&&d.push(p)}let v=d.length;for(;v--;)p=d[v],(!p.hasChildNodes()||p.firstChild===p.lastChild&&((a=p.firstChild)===null||a===void 0?void 0:a.nodeValue)===""||RJ(e,p))&&e.remove(p)},xH=(e,t,s)=>rn(t)?e?s===1&&t.data.charAt(s-1)===ta?0:s:s===t.data.length-1&&t.data.charAt(s)===ta?t.data.length:s:s,IJ=e=>{const t=e.cloneRange();return t.setStart(e.startContainer,xH(!0,e.startContainer,e.startOffset)),t.setEnd(e.endContainer,xH(!1,e.endContainer,e.endOffset)),t},PJ=e=>{let t=e;do rn(t)&&(t.data=t.data.replace(/^[\r\n]+/,"")),t=t.firstChild;while(t)},MJ=(e,t,s,a,d)=>{var p,v;const C=e.dom,L=(p=wL(C,a))!==null&&p!==void 0?p:C.getRoot();let G=C.getParent(a,C.isBlock);if(!G||!vH(C,G)){if(G=G||L,!G.hasChildNodes()){const ye=C.create(t);return SL(e,ye),G.appendChild(ye),s.setStart(ye,0),s.setEnd(ye,0),ye}let ee=a;for(;ee&&ee.parentNode!==G;)ee=ee.parentNode;let te;for(;ee&&!C.isBlock(ee);)te=ee,ee=ee.previousSibling;const ie=(v=te==null?void 0:te.parentElement)===null||v===void 0?void 0:v.nodeName;if(te&&ie&&e.schema.isValidChild(ie,t.toLowerCase())){const ye=te.parentNode,Re=C.create(t);for(SL(e,Re),ye.insertBefore(Re,te),ee=te;ee&&!C.isBlock(ee);){const Se=ee.nextSibling;Re.appendChild(ee),ee=Se}s.setStart(a,d),s.setEnd(a,d)}}return a},NJ=(e,t)=>{t.normalize();const s=t.lastChild;(!s||oo(s)&&/^(left|right)$/gi.test(e.getStyle(s,"float",!0)))&&e.add(t,"br")},FJ=(e,t)=>{const s=QT(e);return Ae(t)?!1:re(s)?to(hn.explode(s),t.nodeName.toLowerCase()):s},g9={insert:(e,t)=>{let s,a,d,p,v=!1;const C=e.dom,L=e.schema,G=L.getNonEmptyElements(),ee=e.selection.getRng(),te=Wl(e),ie=M.fromDom(ee.startContainer),ye=el(ie,ee.startOffset),Re=ye.exists(qt=>uf(qt)&&!$a(qt)),Se=ee.collapsed&&Re,Pe=(qt,no)=>f9(e,s,mn,Xt,JT(e),qt,no),Je=qt=>{const no=xH(qt,s,a);if(rn(s)&&(qt?no>0:no<s.data.length))return!1;if((s.parentNode===mn||s===mn)&&v&&!qt||qt&&oo(s)&&s===mn.firstChild)return!0;if(bH(s,"TABLE")||bH(s,"HR"))return v&&!qt||!v&&qt;const So=new bn(s,mn);rn(s)&&(qt&&no===0?So.prev():!qt&&no===s.data.length&&So.next());let fs;for(;fs=So.current();){if(oo(fs)){if(!fs.getAttribute("data-mce-bogus")){const Ts=fs.nodeName.toLowerCase();if(G[Ts]&&Ts!=="br")return!1}}else if(rn(fs)&&!pr(fs.data))return!1;qt?So.prev():So.next()}return!0},nt=()=>{let qt;return/^(H[1-6]|PRE|FIGURE)$/.test(d)&&Fn!=="HGROUP"?qt=Pe(te):qt=Pe(),FJ(e,p)&&vH(C,p)&&C.isEmpty(mn,void 0,{includeZwsp:!0})?qt=C.split(p,mn):C.insertAfter(qt,mn),V_(e,qt),qt};rm(C,ee).each(qt=>{ee.setStart(qt.startContainer,qt.startOffset),ee.setEnd(qt.endContainer,qt.endOffset)}),s=ee.startContainer,a=ee.startOffset;const rt=!!(t&&t.shiftKey),ft=!!(t&&t.ctrlKey);oo(s)&&s.hasChildNodes()&&!Se&&(v=a>s.childNodes.length-1,s=s.childNodes[Math.min(a,s.childNodes.length-1)]||s,v&&rn(s)?a=s.data.length:a=0);const Xt=wL(C,s);if(!Xt||LJ(e,s))return;rt||(s=MJ(e,te,ee,s,a));let mn=C.getParent(s,C.isBlock)||C.getRoot();p=ve(mn==null?void 0:mn.parentNode)?C.getParent(mn.parentNode,C.isBlock):null,d=mn?mn.nodeName.toUpperCase():"";const Fn=p?p.nodeName.toUpperCase():"";if(Fn==="LI"&&!ft){const qt=p;mn=qt,p=qt.parentNode,d=Fn}if(oo(p)&&EJ(e,rt,mn))return CJ(e,Pe,mn);if(/^(LI|DT|DD)$/.test(d)&&oo(p)&&C.isEmpty(mn)){kJ(e,Pe,p,mn,te);return}if(!Se&&(mn===e.getBody()||!vH(C,mn)))return;const Lt=mn.parentNode;let yt;if(Se)yt=Pe(te),ye.fold(()=>{rr(ie,M.fromDom(yt))},qt=>{lt(qt,M.fromDom(yt))}),e.selection.setCursorLocation(yt,0);else if(wf(mn))yt=Sf(mn),C.isEmpty(mn)&&pH(mn),SL(e,yt),V_(e,yt);else if(Je(!1))yt=nt();else if(Je(!0)&&Lt){yt=Lt.insertBefore(Pe(),mn);const qt=su(M.fromDom(ee.startContainer))&&ee.collapsed;V_(e,bH(mn,"HR")||qt?yt:mn)}else{const qt=IJ(ee).cloneRange();qt.setEndAfter(mn);const no=qt.extractContents();AJ(no),PJ(no),yt=no.firstChild,C.insertAfter(no,mn),OJ(C,G,yt),NJ(C,mn),C.isEmpty(mn)&&pH(mn),yt.normalize(),C.isEmpty(yt)?(C.remove(yt),nt()):(SL(e,yt),V_(e,yt))}C.setAttrib(yt,"id",""),e.dispatch("NewBlock",{newBlock:yt})},fakeEventName:"insertParagraph"},BJ=(e,t,s)=>{const a=new bn(t,s);let d;const p=e.getNonEmptyElements();for(;d=a.next();)if(p[d.nodeName.toLowerCase()]||rn(d)&&d.length>0)return!0;return!1},b9=(e,t,s)=>{const a=e.dom.createRng();s?(a.setStartBefore(t),a.setEndBefore(t)):(a.setStartAfter(t),a.setEndAfter(t)),e.selection.setRng(a),Kd(e,a)},$J=(e,t)=>{const s=e.selection,a=e.dom,d=s.getRng();let p,v=!1;rm(a,d).each(ye=>{d.setStart(ye.startContainer,ye.startOffset),d.setEnd(ye.endContainer,ye.endOffset)});let C=d.startOffset,L=d.startContainer;if(oo(L)&&L.hasChildNodes()){const ye=C>L.childNodes.length-1;L=L.childNodes[Math.min(C,L.childNodes.length-1)]||L,ye&&rn(L)?C=L.data.length:C=0}let G=a.getParent(L,a.isBlock);const ee=G&&G.parentNode?a.getParent(G.parentNode,a.isBlock):null,te=ee?ee.nodeName.toUpperCase():"",ie=!!(t&&t.ctrlKey);te==="LI"&&!ie&&(G=ee),rn(L)&&C>=L.data.length&&(BJ(e.schema,L,G||a.getRoot())||(p=a.create("br"),d.insertNode(p),d.setStartAfter(p),d.setEndAfter(p),v=!0)),p=a.create("br"),tx(a,d,p),b9(e,p,v),e.undoManager.add()},HJ=(e,t)=>{const s=M.fromTag("br");lt(M.fromDom(t),s),e.undoManager.add()},UJ=(e,t)=>{zJ(e.getBody(),t)||Si(M.fromDom(t),M.fromTag("br"));const s=M.fromTag("br");Si(M.fromDom(t),s),b9(e,s.dom,!1),e.undoManager.add()},VJ=e=>fi(e.getNode()),zJ=(e,t)=>VJ(Et.after(t))?!0:Kc(e,Et.after(t)).map(s=>fi(s.getNode())).getOr(!1),v9=e=>e&&e.nodeName==="A"&&"href"in e,GJ=e=>e.fold(vt,v9,v9,vt),WJ=e=>{const t=it(wb,e),s=Et.fromRangeStart(e.selection.getRng());return gm(t,e.getBody(),s).filter(GJ)},jJ=(e,t)=>{t.fold(Fe,it(HJ,e),it(UJ,e),Fe)},x9={insert:(e,t)=>{const s=WJ(e);s.isSome()?s.each(it(jJ,e)):$J(e,t)},fakeEventName:"insertLineBreak"},y9=(e,t)=>mH(e).filter(s=>t.length>0&&Ve(M.fromDom(s),t)).isSome(),KJ=e=>y9(e,gR(e)),ZJ=e=>y9(e,bR(e)),Nf=Oo.generate([{br:[]},{block:[]},{none:[]}]),qJ=(e,t)=>ZJ(e),w9=e=>(t,s)=>xJ(t)===e,S9=(e,t)=>(s,a)=>vJ(s)===e.toUpperCase()===t,YJ=e=>{const t=wL(e.dom,e.selection.getStart());return Ae(t)},EL=e=>S9("pre",e),XJ=()=>S9("summary",!0),$3=e=>(t,s)=>YT(t)===e,JJ=(e,t)=>KJ(e),H3=(e,t)=>t,QJ=e=>{const t=Wl(e),s=wL(e.dom,e.selection.getStart());return ve(s)&&e.schema.isValidChild(s.nodeName,t)},eQ=e=>{const t=e.selection.getRng(),s=M.fromDom(t.startContainer),d=el(s,t.startOffset).map(p=>uf(p)&&!$a(p));return t.collapsed&&d.getOr(!0)},xh=(e,t)=>(s,a)=>Kn(e,(p,v)=>p&&v(s,a),!0)?J.some(t):J.none(),tQ=(e,t)=>DF([xh([qJ],Nf.none()),xh([EL(!0),YJ],Nf.none()),xh([XJ()],Nf.br()),xh([EL(!0),$3(!1),H3],Nf.br()),xh([EL(!0),$3(!1)],Nf.block()),xh([EL(!0),$3(!0),H3],Nf.block()),xh([EL(!0),$3(!0)],Nf.br()),xh([w9(!0),H3],Nf.br()),xh([w9(!0)],Nf.block()),xh([JJ],Nf.br()),xh([H3],Nf.br()),xh([QJ],Nf.block()),xh([eQ],Nf.block())],[e,!!(t&&t.shiftKey)]).getOr(Nf.none()),U3=(e,t,s)=>{t.selection.isCollapsed()||A6(t),!(ve(s)&&N3(t,e.fakeEventName).isDefaultPrevented())&&(e.insert(t,s),ve(s)&&yL(t,e.fakeEventName))},E9=(e,t)=>{const s=()=>U3(x9,e,t),a=()=>U3(g9,e,t),d=tQ(e,t);switch(XT(e)){case"linebreak":d.fold(s,s,Fe);break;case"block":d.fold(a,a,Fe);break;case"invert":d.fold(a,s,Fe);break;default:d.fold(s,a,Fe);break}},C9=Cs(),nQ=C9.os.isiOS()&&C9.browser.isSafari(),_9=(e,t)=>{t.isDefaultPrevented()||(t.preventDefault(),Z8(e.undoManager),e.undoManager.transact(()=>{E9(e,t)}))},oQ=e=>{if(!e.collapsed)return!1;const t=e.startContainer;if(rn(t)){const s=/^[\uAC00-\uD7AF\u1100-\u11FF\u3130-\u318F\uA960-\uA97F\uD7B0-\uD7FF]$/,a=t.data.charAt(e.startOffset-1);return s.test(a)}else return!1},sQ=e=>{let t=J.none();const s=d=>{t=J.some(d.selection.getBookmark()),d.undoManager.add()},a=(d,p)=>{d.undoManager.undo(),t.fold(Fe,v=>d.selection.moveToBookmark(v)),_9(d,p),t=J.none()};e.on("keydown",d=>{d.keyCode===Pn.ENTER&&(nQ&&oQ(e.selection.getRng())?s(e):_9(e,d))}),e.on("keyup",d=>{d.keyCode===Pn.ENTER&&t.each(()=>a(e,d))})},rQ=(e,t,s)=>{const a=gs.os.isMacOS()||gs.os.isiOS();Bw([{keyCode:Pn.END,action:Uo(o0,e,!0)},{keyCode:Pn.HOME,action:Uo(o0,e,!1)},...a?[]:[{keyCode:Pn.HOME,action:Uo(s0,e,!1),ctrlKey:!0,shiftKey:!0},{keyCode:Pn.END,action:Uo(s0,e,!0),ctrlKey:!0,shiftKey:!0}],{keyCode:Pn.END,action:Uo(Vb,e,!0)},{keyCode:Pn.HOME,action:Uo(Vb,e,!1)},{keyCode:Pn.END,action:Uo(Ow,e,!0,t)},{keyCode:Pn.HOME,action:Uo(Ow,e,!1,t)}],s).each(d=>{s.preventDefault()})},iQ=(e,t)=>{e.on("keydown",s=>{s.isDefaultPrevented()||rQ(e,t,s)})},aQ=e=>{e.on("input",t=>{t.isComposing||E6(e)})},lQ=Cs(),cQ=(e,t,s)=>{Bw([{keyCode:Pn.PAGE_UP,action:Uo(Ow,e,!1,t)},{keyCode:Pn.PAGE_DOWN,action:Uo(Ow,e,!0,t)}],s)},T9=e=>e.stopImmediatePropagation(),D9=e=>e.keyCode===Pn.PAGE_UP||e.keyCode===Pn.PAGE_DOWN,k9=(e,t,s)=>{s&&!e.get()?t.on("NodeChange",T9,!0):!s&&e.get()&&t.off("NodeChange",T9),e.set(s)},uQ=(e,t)=>{if(lQ.os.isMacOS())return;const s=Ea(!1);e.on("keydown",a=>{D9(a)&&k9(s,e,!0)}),e.on("keyup",a=>{a.isDefaultPrevented()||cQ(e,t,a),D9(a)&&s.get()&&(k9(s,e,!1),e.nodeChanged())})},dQ=e=>{e.on("beforeinput",t=>{(!e.selection.isEditable()||mo(t.getTargetRanges(),s=>!xI(e.dom,s)))&&t.preventDefault()})},A9=(e,t)=>{const s=t.container(),a=t.offset();return rn(s)?(s.insertData(a,e),J.some(Et(s,a+e.length))):sE(t).map(d=>{const p=M.fromText(e);return t.isAtEnd()?Si(d,p):lt(d,p),Et(p.dom,e.length)})},L9=it(A9,Vo),R9=it(A9," "),fQ=(e,t,s)=>YE(e,t,s)?L9(t):R9(t),hQ=e=>t=>t.fold(s=>Wu(e.dom,Et.before(s)),s=>Mo(s),s=>Wd(s),s=>Kc(e.dom,Et.after(s))),mQ=(e,t,s)=>a=>YE(e,a,s)?L9(t):R9(t),O9=e=>t=>{e.selection.setRng(t.toRange()),e.nodeChanged()},pQ=(e,t)=>e.isEditable(e.getParent(t,"summary")),gQ=e=>{const t=Et.fromRangeStart(e.selection.getRng()),s=M.fromDom(e.getBody());if(e.selection.isCollapsed()){const a=it(wb,e),d=Et.fromRangeStart(e.selection.getRng());return gm(a,e.getBody(),d).bind(hQ(s)).map(p=>()=>mQ(s,t,e.schema)(p).each(O9(e)))}else return J.none()},bQ=e=>{const t=()=>{const s=M.fromDom(e.getBody());e.selection.isCollapsed()||e.getDoc().execCommand("Delete");const a=Et.fromRangeStart(e.selection.getRng());fQ(s,a,e.schema).each(O9(e))};return cf(gs.browser.isFirefox()&&e.selection.isEditable()&&pQ(e.dom,e.selection.getRng().startContainer),t)},vQ=(e,t)=>{Ub([{keyCode:Pn.SPACEBAR,action:Uo(gQ,e)},{keyCode:Pn.SPACEBAR,action:Uo(bQ,e)}],t).each(s=>{t.preventDefault(),N3(e,"insertText",{data:" "}).isDefaultPrevented()||(s(),yL(e,"insertText",{data:" "}))})},xQ=e=>{e.on("keydown",t=>{t.isDefaultPrevented()||vQ(e,t)})},yQ=e=>UR(e)?[{keyCode:Pn.TAB,action:Uo(Oz,e,!0)},{keyCode:Pn.TAB,shiftKey:!0,action:Uo(Oz,e,!1)}]:[],wQ=(e,t)=>{Bw([...yQ(e)],t).each(s=>{t.preventDefault()})},SQ=e=>{e.on("keydown",t=>{t.isDefaultPrevented()||wQ(e,t)})},EQ=e=>{if(e.addShortcut("Meta+P","","mcePrint"),eJ(e),Pf(e))return Ea(null);{const t=JF(e);return dQ(e),Ki(e),MY(e,t),gJ(e,t),sQ(e),xQ(e),aQ(e),SQ(e),iQ(e,t),uQ(e,t),t}};class CQ{constructor(t){this.lastPath=[],this.editor=t;let s;const a=this;"onselectionchange"in t.getDoc()||t.on("NodeChange click mouseup keyup focus",d=>{const p=t.selection.getRng(),v={startContainer:p.startContainer,startOffset:p.startOffset,endContainer:p.endContainer,endOffset:p.endOffset};(d.type==="nodechange"||!Py(v,s))&&t.dispatch("SelectionChange"),s=v}),t.on("contextmenu",()=>{PE(t),t.dispatch("SelectionChange")}),t.on("SelectionChange",()=>{const d=t.selection.getStart(!0);d&&fx(t)&&!a.isSameElementPath(d)&&t.dom.isChildOf(d,t.getBody())&&t.nodeChanged({selectionChange:!0})}),t.on("mouseup",d=>{!d.isDefaultPrevented()&&fx(t)&&(t.selection.getNode().nodeName==="IMG"?Ku.setEditorTimeout(t,()=>{t.nodeChanged()}):t.nodeChanged())})}nodeChanged(t={}){const s=this.editor.selection;let a;if(this.editor.initialized&&s&&!QB(this.editor)&&!this.editor.mode.isReadOnly()){const d=this.editor.getBody();a=s.getStart(!0)||d,(a.ownerDocument!==this.editor.getDoc()||!this.editor.dom.isChildOf(a,d))&&(a=d);const p=[];this.editor.dom.getParent(a,v=>v===d?!0:(p.push(v),!1)),this.editor.dispatch("NodeChange",{...t,element:a,parents:p})}}isSameElementPath(t){let s;const a=this.editor,d=ms(a.dom.getParents(t,an,a.getBody()));if(d.length===this.lastPath.length){for(s=d.length;s>=0&&d[s]===this.lastPath[s];s--);if(s===-1)return this.lastPath=d,!0}return this.lastPath=d,!1}}const I9=gg("image"),_Q=e=>{const t=e;return J.from(t[I9])},TQ=(e,t)=>{const s=e;s[I9]=t},yH=gg("event"),DQ=e=>{const t=e;return J.from(t[yH])},V3=e=>t=>{const s=t;s[yH]=e},kQ=(e,t)=>V3(t)(e),P9=V3(0),AQ=V3(2),LQ=V3(1),RQ=(e=>t=>{const s=t;return J.from(s[yH]).exists(a=>a===e)})(0),OQ=()=>Object.freeze({length:0,item:e=>null}),wH=gg("mode"),IQ=e=>{const t=e;return J.from(t[wH])},z3=e=>t=>{const s=t;s[wH]=e},M9=(e,t)=>z3(t)(e),N9=z3(0),SH=z3(2),PQ=z3(1),F9=e=>t=>{const s=t;return J.from(s[wH]).exists(a=>a===e)},z_=F9(0),B9=F9(1),MQ=(e,t)=>({...t,get length(){return t.length},add:(s,a)=>{if(z_(e))if(re(s)){if(!ot(a))return t.add(s,a)}else return t.add(s);return null},remove:s=>{z_(e)&&t.remove(s)},clear:()=>{z_(e)&&t.clear()}}),NQ=["none","copy","link","move"],FQ=["none","copy","copyLink","copyMove","link","linkMove","move","all","uninitialized"],EH=()=>{const e=new window.DataTransfer;let t="move",s="all";const a={get dropEffect(){return t},set dropEffect(d){to(NQ,d)&&(t=d)},get effectAllowed(){return s},set effectAllowed(d){RQ(a)&&to(FQ,d)&&(s=d)},get items(){return MQ(a,e.items)},get files(){return B9(a)?OQ():e.files},get types(){return e.types},setDragImage:(d,p,v)=>{z_(a)&&(TQ(a,{image:d,x:p,y:v}),e.setDragImage(d,p,v))},getData:d=>B9(a)?"":e.getData(d),setData:(d,p)=>{z_(a)&&e.setData(d,p)},clearData:d=>{z_(a)&&e.clearData(d)}};return N9(a),a},BQ=e=>{const t=EH(),s=IQ(e);return SH(e),P9(t),t.dropEffect=e.dropEffect,t.effectAllowed=e.effectAllowed,_Q(e).each(a=>t.setDragImage(a.image,a.x,a.y)),xe(e.types,a=>{a!=="Files"&&t.setData(a,e.getData(a))}),xe(e.files,a=>t.items.add(a)),DQ(e).each(a=>{kQ(t,a)}),s.each(a=>{M9(e,a),M9(t,a)}),t},$Q=e=>{const t=e.getData("text/html");return t===""?J.none():J.some(t)},$9=(e,t)=>e.setData("text/html",t),H9="x-tinymce/html",G3=et(H9),CH="<!-- "+H9+" -->",HQ=e=>CH+e,UQ=e=>e.replace(CH,""),U9=e=>e.indexOf(CH)!==-1,VQ=e=>!/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(e),zQ=(e,t)=>{let s="<"+e;const a=dn(t,(d,p)=>p+'="'+Hh.encodeAllRaw(d)+'"');return a.length&&(s+=" "+a.join(" ")),s+">"},GQ=(e,t,s)=>{const a=e.split(/\n\n/),d=zQ(t,s),p="</"+t+">",v=$t(a,L=>L.split(/\n/).join("<br />")),C=L=>d+L+p;return v.length===1?v[0]:$t(v,C).join("")},V9="%MCEPASTEBIN%",WQ=(e,t)=>{const{dom:s,selection:a}=e,d=e.getBody();t.set(a.getRng());const p=s.add(e.getBody(),"div",{id:"mcepastebin",class:"mce-pastebin",contentEditable:!0,"data-mce-bogus":"all",style:"position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0"},V9);gs.browser.isFirefox()&&s.setStyle(p,"left",s.getStyle(d,"direction",!0)==="rtl"?65535:-65535),s.bind(p,"beforedeactivate focusin focusout",v=>{v.stopPropagation()}),p.focus(),a.select(p,!0)},jQ=(e,t)=>{const s=e.dom;if(_H(e)){let a;const d=t.get();for(;a=_H(e);)s.remove(a),s.unbind(a);d&&e.selection.setRng(d)}t.set(null)},_H=e=>e.dom.get("mcepastebin"),KQ=e=>ve(e)&&e.id==="mcepastebin",ZQ=e=>{const t=e.dom,s=(v,C)=>{v.appendChild(C),t.remove(C,!0)},[a,...d]=Ct(e.getBody().childNodes,KQ);xe(d,v=>{s(a,v)});const p=t.select("div[id=mcepastebin]",a);for(let v=p.length-1;v>=0;v--){const C=t.create("div");a.insertBefore(C,p[v]),s(C,p[v])}return a?a.innerHTML:""},z9=e=>e===V9,qQ=e=>{const t=Ea(null);return{create:()=>WQ(e,t),remove:()=>jQ(e,t),getEl:()=>_H(e),getHtml:()=>ZQ(e),getLastRng:t.get}},G9=(e,t)=>(hn.each(t,s=>{se(s,RegExp)?e=e.replace(s,""):e=e.replace(s[0],s[1])}),e),YQ=e=>{const t=Vh(),s=Ob({},t);let a="";const d=t.getVoidElements(),p=hn.makeMap("script noscript style textarea video audio iframe object"," "),v=t.getBlockElements(),C=L=>{const G=L.name,ee=L;if(G==="br"){a+=`
`;return}if(G!=="wbr"){if(d[G]&&(a+=" "),p[G]){a+=" ";return}if(L.type===3&&(a+=L.value),!(L.name in t.getVoidElements())){let te=L.firstChild;if(te)do C(te);while(te=te.next)}v[G]&&ee.next&&(a+=`
`,G==="p"&&(a+=`
`))}};return e=G9(e,[/<!\[[^\]]+\]>/g]),C(s.parse(e)),a},W9=e=>(e=G9(e,[/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/ig,/<!--StartFragment-->|<!--EndFragment-->/g,[/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,(s,a,d)=>!a&&!d?" ":Vo],/<br class="Apple-interchange-newline">/g,/<br>$/i]),e),XQ=e=>{let t=0;return()=>e+t++},JQ=e=>{const t=e.toLowerCase(),s={jpg:"jpeg",jpe:"jpeg",jfi:"jpeg",jif:"jpeg",jfif:"jpeg",pjpeg:"jpeg",pjp:"jpeg",svg:"svg+xml"};return hn.hasOwn(s,t)?"image/"+s[t]:"image/"+t},QQ=(e,t)=>{const s=Ob({sanitize:BR(e),sandbox_iframes:f2(e),sandbox_iframes_exclusions:XS(e),convert_unsafe_embeds:zR(e)},e.schema);s.addNodeFilter("meta",d=>{hn.each(d,p=>{p.remove()})});const a=s.parse(t,{forced_root_block:!1,isRootContent:!0});return yp({validate:!0},e.schema).serialize(a)},j9=(e,t)=>({content:e,cancelled:t}),eee=(e,t,s)=>{const a=e.dom.create("div",{style:"display:none"},t),d=EE(e,a,s);return j9(d.node.innerHTML,d.isDefaultPrevented())},tee=(e,t,s)=>{const a=Ly(e,t,s),d=QQ(e,a.content);return e.hasEventListeners("PastePostProcess")&&!a.isDefaultPrevented()?eee(e,d,s):j9(d,a.isDefaultPrevented())},nee=(e,t,s)=>tee(e,t,s),TH=(e,t)=>(e.insertContent(t,{merge:r5(e),paste:!0}),!0),DH=e=>/^https?:\/\/[\w\-\/+=.,!;:&%@^~(){}?#]+$/i.test(e),oee=(e,t)=>DH(t)&&mo(d2(e),s=>Hi(t.toLowerCase(),`.${s.toLowerCase()}`)),see=(e,t,s)=>(e.undoManager.extra(()=>{s(e,t)},()=>{e.insertContent('<img src="'+t+'">')}),!0),ree=(e,t,s)=>(e.undoManager.extra(()=>{s(e,t)},()=>{e.execCommand("mceInsertLink",!1,t)}),!0),iee=(e,t,s)=>!e.selection.isCollapsed()&&DH(t)?ree(e,t,s):!1,aee=(e,t,s)=>oee(e,t)?see(e,t,s):!1,lee=(e,t)=>{hn.each([iee,aee,TH],s=>!s(e,t,TH))},cee=(e,t,s)=>{s||!tb(e)?TH(e,t):lee(e,t)},uee=XQ("mceclip"),dee=e=>{const t=EH();return $9(t,e),SH(t),t},K9=(e,t,s,a,d)=>{const p=nee(e,t,s);if(!p.cancelled){const v=p.content,C=()=>cee(e,v,a);d?N3(e,"insertFromPaste",{dataTransfer:dee(v)}).isDefaultPrevented()||(C(),yL(e,"insertFromPaste")):C()}},W3=(e,t,s,a)=>{const d=s||U9(t);K9(e,UQ(t),d,!1,a)},kH=(e,t,s)=>{const a=e.dom.encode(t).replace(/\r\n/g,`
`),d=cv(a,MR(e)),p=GQ(d,Wl(e),ny(e));K9(e,p,!1,!0,s)},Z9=e=>{const t={};if(e&&e.types)for(let s=0;s<e.types.length;s++){const a=e.types[s];try{t[a]=e.getData(a)}catch{t[a]=""}}return t},Qx=(e,t)=>t in e&&e[t].length>0,q9=e=>Qx(e,"text/html")||Qx(e,"text/plain"),fee=(e,t)=>{const s=t.match(/([\s\S]+?)(?:\.[a-z0-9.]+)$/i);return ve(s)?e.dom.encode(s[1]):void 0},hee=(e,t,s,a)=>{const d=uee(),p=hp(e)&&ve(s.name),v=p?fee(e,s.name):d,C=p?s.name:void 0,L=t.create(d,s,a,v,C);return t.add(L),L},mee=(e,t)=>{BC(t.uri).each(({data:s,type:a,base64Encoded:d})=>{const p=d?s:btoa(s),v=t.file,C=e.editorUpload.blobCache,L=C.getByData(p,a),G=L??hee(e,C,v,p);W3(e,`<img src="${G.blobUri()}">`,!1,!0)})},pee=e=>e.type==="paste",gee=e=>Promise.all($t(e,t=>hw(t).then(s=>({file:t,uri:s})))),bee=e=>{const t=d2(e);return s=>qs(s.type,"image/")&&mo(t,a=>JQ(a)===s.type)},vee=(e,t)=>{const s=t.items?kt(In(t.items),d=>d.kind==="file"?[d.getAsFile()]:[]):[],a=t.files?In(t.files):[];return Ct(s.length>0?s:a,bee(e))},Y9=(e,t,s)=>{const a=pee(t)?t.clipboardData:t.dataTransfer;if(em(e)&&a){const d=vee(e,a);if(d.length>0)return t.preventDefault(),gee(d).then(p=>{s&&e.selection.setRng(s),xe(p,v=>{mee(e,v)})}),!0}return!1},xee=e=>{var t,s;return gs.os.isAndroid()&&((s=(t=e.clipboardData)===null||t===void 0?void 0:t.items)===null||s===void 0?void 0:s.length)===0},yee=e=>Pn.metaKeyPressed(e)&&e.keyCode===86||e.shiftKey&&e.keyCode===45,AH=(e,t,s,a,d)=>{let p=W9(s);const v=Qx(t,G3())||U9(s),C=!v&&VQ(p),L=DH(p);(z9(p)||!p.length||C&&!L)&&(a=!0),(a||L)&&(Qx(t,"text/plain")&&C?p=t["text/plain"]:p=YQ(p)),!z9(p)&&(a?kH(e,p,d):W3(e,p,v,d))},wee=(e,t,s)=>{let a;const d=()=>t.getLastRng()||e.selection.getRng();e.on("keydown",p=>{yee(p)&&!p.isDefaultPrevented()&&(a=p.shiftKey&&p.keyCode===86)}),e.on("paste",p=>{if(p.isDefaultPrevented()||xee(p))return;const v=s.get()==="text"||a;a=!1;const C=Z9(p.clipboardData);!q9(C)&&Y9(e,p,d())||(Qx(C,"text/html")?(p.preventDefault(),AH(e,C,C["text/html"],v,!0)):Qx(C,"text/plain")&&Qx(C,"text/uri-list")?(p.preventDefault(),AH(e,C,C["text/plain"],v,!0)):(t.create(),Ku.setEditorTimeout(e,()=>{const L=t.getHtml();t.remove(),AH(e,C,L,v,!1)},0)))})},See=e=>{const t=d=>qs(d,"webkit-fake-url"),s=d=>qs(d,"data:"),a=d=>{var p;return((p=d.data)===null||p===void 0?void 0:p.paste)===!0};e.parser.addNodeFilter("img",(d,p,v)=>{if(!em(e)&&a(v))for(const C of d){const L=C.attr("src");re(L)&&!C.attr("data-mce-object")&&L!==gs.transparentSrc&&(t(L)||!i5(e)&&s(L))&&C.remove()}})},Eee=(e,t,s)=>{wee(e,t,s),See(e)},Cee=(e,t)=>{t.get()==="text"?(t.set("html"),CE(e,!1)):(t.set("text"),CE(e,!0)),e.focus()},_ee=(e,t)=>{e.addCommand("mceTogglePlainTextPaste",()=>{Cee(e,t)}),e.addCommand("mceInsertClipboardContent",(s,a)=>{a.html&&W3(e,a.html,a.internal,!1),a.text&&kH(e,a.text,!1)})},Tee=(e,t,s)=>{if(e)try{return e.clearData(),e.setData("text/html",t),e.setData("text/plain",s),e.setData(G3(),t),!0}catch{return!1}else return!1},X9=(e,t,s,a)=>{Tee(e.clipboardData,t.html,t.text)?(e.preventDefault(),a()):s(t.html,a)},J9=e=>(t,s)=>{const{dom:a,selection:d}=e,p=a.create("div",{contenteditable:"false","data-mce-bogus":"all"}),v=a.create("div",{contenteditable:"true"},t);a.setStyles(p,{position:"fixed",top:"0",left:"-3000px",width:"1000px",overflow:"hidden"}),p.appendChild(v),a.add(e.getBody(),p);const C=d.getRng();v.focus();const L=a.createRng();L.selectNodeContents(v),d.setRng(L),Ku.setEditorTimeout(e,()=>{d.setRng(C),a.remove(p),s()},0)},Q9=e=>({html:HQ(e.selection.getContent({contextual:!0})),text:e.selection.getContent({format:"text"})}),Dee=e=>!!e.dom.getParent(e.selection.getStart(),"td[data-mce-selected],th[data-mce-selected]",e.getBody()),eG=e=>!e.selection.isCollapsed()||Dee(e),kee=e=>t=>{!t.isDefaultPrevented()&&eG(e)&&e.selection.isEditable()&&X9(t,Q9(e),J9(e),()=>{if(gs.browser.isChromium()||gs.browser.isFirefox()){const s=e.selection.getRng();Ku.setEditorTimeout(e,()=>{e.selection.setRng(s),e.execCommand("Delete")},0)}else e.execCommand("Delete")})},Aee=e=>t=>{!t.isDefaultPrevented()&&eG(e)&&X9(t,Q9(e),J9(e),Fe)},Lee=e=>{e.on("cut",kee(e)),e.on("copy",Aee(e))},tG=(e,t)=>{var s,a;return Og.getCaretRangeFromPoint((s=t.clientX)!==null&&s!==void 0?s:0,(a=t.clientY)!==null&&a!==void 0?a:0,e.getDoc())},Ree=e=>{const t=e["text/plain"];return t?t.indexOf("file://")===0:!1},nG=(e,t)=>{e.focus(),t&&e.selection.setRng(t)},Oee=e=>mo(e.files,t=>/^image\//.test(t.type)),Iee=(e,t,s,a)=>{const d=e.getParent(s,v=>Bh(t,v));if(!Ce(e.getParent(s,"summary")))return!0;if(d&&yn(a,"text/html")){const v=new DOMParser().parseFromString(a["text/html"],"text/html").body;return!Ce(v.querySelector(d.nodeName.toLowerCase()))}else return!1},Pee=e=>{e.on("input",t=>{const s=a=>Ce(a.querySelector("summary"));if(t.inputType==="deleteByDrag"){const a=Ct(e.dom.select("details"),s);xe(a,d=>{fi(d.firstChild)&&d.firstChild.remove();const p=e.dom.create("summary");p.appendChild(Tc().dom),d.prepend(p)})}})},Mee=(e,t)=>{oh(e)&&e.on("dragend dragover draggesture dragdrop drop drag",s=>{s.preventDefault(),s.stopPropagation()}),em(e)||e.on("drop",s=>{const a=s.dataTransfer;a&&Oee(a)&&s.preventDefault()}),e.on("drop",s=>{if(s.isDefaultPrevented())return;const a=tG(e,s);if(Ae(a))return;const d=Z9(s.dataTransfer),p=Qx(d,G3());if((!q9(d)||Ree(d))&&Y9(e,s,a))return;const v=d[G3()],C=v||d["text/html"]||d["text/plain"],L=Iee(e.dom,e.schema,a.startContainer,d),G=t.get();G&&!L||C&&(s.preventDefault(),Ku.setEditorTimeout(e,()=>{e.undoManager.transact(()=>{(v||G&&L)&&e.execCommand("Delete"),nG(e,a);const ee=W9(C);d["text/html"]?W3(e,ee,p,!0):kH(e,ee,!0)})}))}),e.on("dragstart",s=>{t.set(!0)}),e.on("dragover dragend",s=>{em(e)&&!t.get()&&(s.preventDefault(),nG(e,tG(e,s))),s.type==="dragend"&&t.set(!1)}),Pee(e)},Nee=e=>{const t=d=>p=>{d(e,p)},s=s5(e);Oe(s)&&e.on("PastePreProcess",t(s));const a=iy(e);Oe(a)&&e.on("PastePostProcess",t(a))},Fee=(e,t)=>{e.on("PastePreProcess",s=>{s.content=t(e,s.content,s.internal)})},Bee=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,oG=e=>hn.trim(e).replace(Bee,$0).toLowerCase(),$ee=(e,t,s)=>{const a=PR(e);if(s||a==="all"||!a2(e))return t;const d=a?a.split(/[, ]/):[];if(d&&a!=="none"){const p=e.dom,v=e.selection.getNode();t=t.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,(C,L,G,ee)=>{const te=p.parseStyle(p.decode(G)),ie={};for(let Re=0;Re<d.length;Re++){const Se=te[d[Re]];let Pe=Se,Je=p.getStyle(v,d[Re],!0);/color/.test(d[Re])&&(Pe=oG(Pe),Je=oG(Je)),Je!==Pe&&(ie[d[Re]]=Se)}const ye=p.serializeStyle(ie,"span");return ye?L+' style="'+ye+'"'+ee:L+ee})}else t=t.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,"$1$3");return t=t.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,(p,v,C,L)=>v+' style="'+C+'"'+L),t},Hee=e=>{(gs.browser.isChromium()||gs.browser.isSafari())&&Fee(e,$ee)},Uee=e=>{const t=Ea(!1),s=Ea(nb(e)?"text":"html"),a=qQ(e);Hee(e),_ee(e,s),Nee(e),e.on("PreInit",()=>{Lee(e),Mee(e,t),Eee(e,a,s)})},Vee=e=>{e.on("click",t=>{e.dom.getParent(t.target,"details")&&t.preventDefault()})},zee=e=>{e.parser.addNodeFilter("details",t=>{const s=YS(e);xe(t,a=>{s==="expanded"?a.attr("open","open"):s==="collapsed"&&a.attr("open",null)})}),e.serializer.addNodeFilter("details",t=>{const s=VR(e);xe(t,a=>{s==="expanded"?a.attr("open","open"):s==="collapsed"&&a.attr("open",null)})})},Gee=e=>{Vee(e),zee(e)},Wee=fi,sG=rn,jee=e=>Ir(e.dom),Kee=e=>Ws(e.dom),rG=e=>t=>gt(M.fromDom(e),t),Zee=(e,t,s)=>El(M.fromDom(e),a=>Kee(a)||s.isBlock(ls(a)),rG(t)).getOr(M.fromDom(t)).dom,iG=(e,t)=>El(M.fromDom(e),jee,rG(t)),aG=(e,t,s)=>{const a=new bn(e,t),d=s?a.next.bind(a):a.prev.bind(a);let p=e;for(let v=s?e:d();v&&!Wee(v);v=d())cd(v)&&(p=v);return p},qee=(e,t,s)=>{const d=Et.fromRangeStart(e).getNode(),p=Zee(d,t,s),v=aG(d,p,!1),C=aG(d,p,!0),L=document.createRange();return iG(v,p).fold(()=>{sG(v)?L.setStart(v,0):L.setStartBefore(v)},G=>L.setStartBefore(G.dom)),iG(C,p).fold(()=>{sG(C)?L.setEnd(C,C.data.length):L.setEndAfter(C)},G=>L.setEndAfter(G.dom)),L},Yee=e=>{const t=qee(e.selection.getRng(),e.getBody(),e.schema);e.selection.setRng(iw(t))},Xee=e=>{e.on("mousedown",t=>{t.detail>=3&&(t.preventDefault(),Yee(e))})};var G_;(function(e){e.Before="before",e.After="after"})(G_||(G_={}));const Jee=(e,t)=>Math.abs(e.left-t),Qee=(e,t)=>Math.abs(e.right-t),ete=(e,t)=>e>=t.top&&e<=t.bottom,tte=(e,t)=>e.top<t.bottom&&e.bottom>t.top,nte=(e,t)=>{const s=zv(e,t)/Math.min(e.height,t.height);return tte(e,t)&&s>.5},ote=(e,t)=>{const s=Ct(e,a=>ete(t,a));return q0(s).fold(()=>[[],e],a=>{const{pass:d,fail:p}=Dn(e,v=>nte(v,a));return[d,p]})},ste=(e,t)=>({node:e.node,position:Jee(e,t)<Qee(e,t)?G_.Before:G_.After}),rte=(e,t,s)=>t>e.left&&t<e.right?0:Math.min(Math.abs(e.left-t),Math.abs(e.right-t)),LH=(e,t,s,a)=>{const d=te=>cd(te.node)?J.some(te):oo(te.node)?LH(In(te.node.childNodes),t,s,!1):J.none(),p=(te,ie,ye)=>d(ie).filter(Re=>Math.abs(ye(te,t,s)-ye(Re,t,s))<2&&rn(Re.node)),v=(te,ie)=>{const ye=Pt(te,(Re,Se)=>ie(Re,t,s)-ie(Se,t,s));return Is(ye,d).map(Re=>a&&!rn(Re.node)&&ye.length>1?p(Re,ye[1],ie).getOr(Re):Re)},[C,L]=ote(UF(e),s),{pass:G,fail:ee}=Dn(L,te=>te.top<s);return v(C,rte).orThunk(()=>v(ee,sp)).orThunk(()=>v(G,sp))},ite=(e,t,s,a)=>{const d=(p,v)=>{const C=G=>oo(G)&&G.classList.contains("mce-drag-container"),L=Ct(p.dom.childNodes,qe(C));return v.fold(()=>LH(L,s,a,!0),G=>{const ee=Ct(L,te=>te!==G.dom);return LH(ee,s,a,!0)}).orThunk(()=>(gt(p,e)?J.none():ki(p)).bind(ee=>d(ee,J.some(p))))};return d(t,J.none())},ate=(e,t,s)=>{const a=M.fromDom(e),d=ss(a),v=M.fromPoint(d,t,s).filter(C=>ln(a,C)).getOr(a);return ite(a,v,t,s)},lG=(e,t,s)=>ate(e,t,s).filter(a=>uy(a.node)).map(a=>ste(a,t)),cG=e=>{var t,s;const a=e.getBoundingClientRect(),d=e.ownerDocument,p=d.documentElement,v=d.defaultView;return{top:a.top+((t=v==null?void 0:v.scrollY)!==null&&t!==void 0?t:0)-p.clientTop,left:a.left+((s=v==null?void 0:v.scrollX)!==null&&s!==void 0?s:0)-p.clientLeft}},lte=e=>e.inline?cG(e.getBody()):{left:0,top:0},cte=e=>{const t=e.getBody();return e.inline?{left:t.scrollLeft,top:t.scrollTop}:{left:0,top:0}},ute=e=>{const t=e.getBody(),s=e.getDoc().documentElement,a={left:t.scrollLeft,top:t.scrollTop},d={left:t.scrollLeft||s.scrollLeft,top:t.scrollTop||s.scrollTop};return e.inline?a:d},dte=(e,t)=>{if(t.target.ownerDocument!==e.getDoc()){const s=cG(e.getContentAreaContainer()),a=ute(e);return{left:t.pageX-s.left+a.left,top:t.pageY-s.top+a.top}}return{left:t.pageX,top:t.pageY}},fte=(e,t,s)=>({pageX:s.left-e.left+t.left,pageY:s.top-e.top+t.top}),hte=(e,t)=>fte(lte(e),cte(e),dte(e,t)),uG=e=>({target:e,srcElement:e}),mte=(e,t,s,a)=>({...t,dataTransfer:a,type:e,...uG(s)}),pte=(e,t,s)=>{const a=mt("Function not supported on simulated event.");return{bubbles:!0,cancelBubble:!1,cancelable:!0,composed:!1,currentTarget:null,defaultPrevented:!1,eventPhase:0,isTrusted:!0,returnValue:!1,timeStamp:0,type:e,composedPath:a,initEvent:a,preventDefault:Fe,stopImmediatePropagation:Fe,stopPropagation:Fe,AT_TARGET:window.Event.AT_TARGET,BUBBLING_PHASE:window.Event.BUBBLING_PHASE,CAPTURING_PHASE:window.Event.CAPTURING_PHASE,NONE:window.Event.NONE,altKey:!1,button:0,buttons:0,clientX:0,clientY:0,ctrlKey:!1,metaKey:!1,movementX:0,movementY:0,offsetX:0,offsetY:0,pageX:0,pageY:0,relatedTarget:null,screenX:0,screenY:0,shiftKey:!1,x:0,y:0,detail:0,view:null,which:0,initUIEvent:a,initMouseEvent:a,getModifierState:a,dataTransfer:s,...uG(t)}},gte=(e,t)=>{const s=BQ(e);return t==="dragstart"?(P9(s),N9(s)):t==="drop"?(AQ(s),SH(s)):(LQ(s),PQ(s)),s},bte=(e,t,s,a)=>{const d=gte(s,e);return ot(a)?pte(e,t,d):mte(e,a,t,d)},j3=32,vte=100,K3=8,Z3=16,dG=Ir,xte=NS(dG,Ws),yte=(e,t,s)=>dG(s)&&s!==t&&e.isEditable(s.parentElement),wte=(e,t,s)=>Ae(t)||t===s||e.dom.isChildOf(t,s)?!1:e.dom.isEditable(t),Ste=(e,t,s,a)=>{const d=e.dom,p=t.cloneNode(!0);d.setStyles(p,{width:s,height:a}),d.setAttrib(p,"data-mce-selected",null);const v=d.create("div",{class:"mce-drag-container","data-mce-bogus":"all",unselectable:"on",contenteditable:"false"});return d.setStyles(v,{position:"absolute",opacity:.5,overflow:"hidden",border:0,padding:0,margin:0,width:s,height:a}),d.setStyles(p,{margin:0,boxSizing:"border-box"}),v.appendChild(p),v},Ete=(e,t)=>{e.parentNode!==t&&t.appendChild(e)},q3=(e,t)=>s=>()=>{const a=e==="left"?s.scrollX:s.scrollY;s.scroll({[e]:a+t,behavior:"smooth"})},fG=q3("left",-j3),hG=q3("left",j3),mG=q3("top",-j3),pG=q3("top",j3),Cte=(e,t,s,a,d,p,v,C,L,G,ee,te)=>{let ie=0,ye=0;e.style.left=t.pageX+"px",e.style.top=t.pageY+"px",t.pageX+s>d&&(ie=t.pageX+s-d),t.pageY+a>p&&(ye=t.pageY+a-p),e.style.width=s-ie+"px",e.style.height=a-ye+"px";const Re=L.clientHeight,Se=L.clientWidth,Pe=v+L.getBoundingClientRect().top,Je=C+L.getBoundingClientRect().left;ee.on(nt=>{nt.intervalId.clear(),nt.dragging&&te&&(v+K3>=Re?nt.intervalId.set(pG(G)):v-K3<=0?nt.intervalId.set(mG(G)):C+K3>=Se?nt.intervalId.set(hG(G)):C-K3<=0?nt.intervalId.set(fG(G)):Pe+Z3>=window.innerHeight?nt.intervalId.set(pG(window)):Pe-Z3<=0?nt.intervalId.set(mG(window)):Je+Z3>=window.innerWidth?nt.intervalId.set(hG(window)):Je-Z3<=0&&nt.intervalId.set(fG(window)))})},gG=e=>{e&&e.parentNode&&e.parentNode.removeChild(e)},_te=(e,t)=>{const s=e.getParent(t.parentNode,e.isBlock);gG(t),s&&s!==e.getRoot()&&e.isEmpty(s)&&Hu(M.fromDom(s))},Tte=e=>e.button===0,Dte=(e,t)=>({pageX:t.pageX-e.relX,pageY:t.pageY+5}),kte=(e,t)=>s=>{if(Tte(s)){const a=Qt(t.dom.getParents(s.target),xte).getOr(null);if(ve(a)&&yte(t.dom,t.getBody(),a)){const d=t.dom.getPos(a),p=t.getBody(),v=t.getDoc().documentElement;e.set({element:a,dataTransfer:EH(),dragging:!1,screenX:s.screenX,screenY:s.screenY,maxX:(t.inline?p.scrollWidth:v.offsetWidth)-2,maxY:(t.inline?p.scrollHeight:v.offsetHeight)-2,relX:s.pageX-d.x,relY:s.pageY-d.y,width:a.offsetWidth,height:a.offsetHeight,ghost:Ste(t,a,a.offsetWidth,a.offsetHeight),intervalId:Ec(vte)})}}},Ate=(e,t,s)=>{e._selectionOverrides.hideFakeCaret(),lG(e.getBody(),t,s).fold(()=>e.selection.placeCaretAt(t,s),a=>{const d=e._selectionOverrides.showCaret(1,a.node,a.position===G_.Before,!1);d?e.selection.setRng(d):e.selection.placeCaretAt(t,s)})},CL=(e,t,s,a,d)=>{t==="dragstart"&&$9(a,e.dom.getOuterHTML(s));const p=bte(t,s,a,d);return e.dispatch(t,p)},Lte=(e,t)=>{const s=Ym((d,p)=>Ate(t,d,p),0);t.on("remove",s.cancel);const a=e;return d=>e.on(p=>{const v=Math.max(Math.abs(d.screenX-p.screenX),Math.abs(d.screenY-p.screenY));if(!p.dragging&&v>10){const C=CL(t,"dragstart",p.element,p.dataTransfer,d);if(ve(C.dataTransfer)&&(p.dataTransfer=C.dataTransfer),C.isDefaultPrevented())return;p.dragging=!0,t.focus()}if(p.dragging){const C=d.currentTarget===t.getDoc().documentElement,L=Dte(p,hte(t,d));Ete(p.ghost,t.getBody()),Cte(p.ghost,L,p.width,p.height,p.maxX,p.maxY,d.clientY,d.clientX,t.getContentAreaContainer(),t.getWin(),a,C),s.throttle(d.clientX,d.clientY)}})},Rte=e=>{const t=e.getSel();if(ve(t)){const a=t.getRangeAt(0).startContainer;return rn(a)?a.parentNode:a}else return null},Ote=(e,t)=>s=>{e.on(a=>{var d;if(a.intervalId.clear(),a.dragging){if(wte(t,Rte(t.selection),a.element)){const p=(d=t.getDoc().elementFromPoint(s.clientX,s.clientY))!==null&&d!==void 0?d:t.getBody();CL(t,"drop",p,a.dataTransfer,s).isDefaultPrevented()||t.undoManager.transact(()=>{_te(t.dom,a.element),$Q(a.dataTransfer).each(C=>t.insertContent(C)),t._selectionOverrides.hideFakeCaret()})}CL(t,"dragend",t.getBody(),a.dataTransfer,s)}}),vG(e)},bG=(e,t,s)=>{e.on(a=>{a.intervalId.clear(),a.dragging&&s.fold(()=>CL(t,"dragend",a.element,a.dataTransfer),d=>CL(t,"dragend",a.element,a.dataTransfer,d))}),vG(e)},Ite=(e,t)=>s=>bG(e,t,J.some(s)),vG=e=>{e.on(t=>{t.intervalId.clear(),gG(t.ghost)}),e.clear()},Pte=e=>{const t=tn(),s=js.DOM,a=document,d=kte(t,e),p=Lte(t,e),v=Ote(t,e),C=Ite(t,e);e.on("mousedown",d),e.on("mousemove",p),e.on("mouseup",v),s.bind(a,"mousemove",p),s.bind(a,"mouseup",C),e.on("remove",()=>{s.unbind(a,"mousemove",p),s.unbind(a,"mouseup",C)}),e.on("keydown",L=>{L.keyCode===Pn.ESC&&bG(t,e,J.none())})},Mte=e=>{const t=d=>{if(!d.isDefaultPrevented()){const p=d.dataTransfer;p&&(to(p.types,"Files")||p.files.length>0)&&(d.preventDefault(),d.type==="drop"&&Cw(e,"Dropped file type is not supported"))}},s=d=>{Wy(e,d.target)&&t(d)},a=()=>{const d=js.DOM,p=e.dom,v=document,C=e.inline?e.getBody():e.getDoc(),L=["drop","dragover"];xe(L,G=>{d.bind(v,G,s),p.bind(C,G,t)}),e.on("remove",()=>{xe(L,G=>{d.unbind(v,G,s),p.unbind(C,G,t)})})};e.on("init",()=>{Ku.setEditorTimeout(e,a,0)})},Nte=e=>{Pte(e),ZS(e)&&Mte(e)},Fte=e=>{const t=Ym(()=>{if(!e.removed&&e.getBody().contains(document.activeElement)){const s=e.selection.getRng();if(s.collapsed){const a=GA(e,s,!1);e.selection.setRng(a)}}},0);e.on("focus",()=>{t.throttle()}),e.on("blur",()=>{t.cancel()})},Bte=e=>{e.on("init",()=>{e.on("focusin",t=>{const s=t.target;if(Lu(s)){const a=Yd(e.getBody(),s),d=Ir(a)?a:s;e.selection.getNode()!==d&&Aw(e,d).each(p=>e.selection.setRng(p))}})})},_L=Ir,xG=(e,t)=>Yd(e.getBody(),t),$te=e=>{const t=e.selection,s=e.dom,a=e.getBody(),d=YR(e,a,s.isBlock,()=>gb(e)),p="sel-"+s.uniqueId(),v="data-mce-selected";let C;const L=Fn=>ve(Fn)&&s.hasClass(Fn,"mce-offscreen-selection"),G=Fn=>Fn!==a&&(_L(Fn)||Lu(Fn))&&s.isChildOf(Fn,a)&&s.isEditable(Fn.parentNode),ee=Fn=>{Fn&&t.setRng(Fn)},te=(Fn,Lt,yt,qt=!0)=>e.dispatch("ShowCaret",{target:Lt,direction:Fn,before:yt}).isDefaultPrevented()?null:(qt&&t.scrollIntoView(Lt,Fn===-1),d.show(yt,Lt)),ie=Fn=>{Fn.hasAttribute("data-mce-caret")&&(Sf(Fn),t.scrollIntoView(Fn))},ye=()=>{e.on("click",Lt=>{s.isEditable(Lt.target)||(Lt.preventDefault(),e.focus())}),e.on("blur NewBlock",ft),e.on("ResizeWindow FullscreenStateChanged",d.reposition),e.on("tap",Lt=>{const yt=Lt.target,qt=xG(e,yt);_L(qt)?(Lt.preventDefault(),Aw(e,qt).each(rt)):G(yt)&&Aw(e,yt).each(rt)},!0),e.on("mousedown",Lt=>{const yt=Lt.target;if(yt!==a&&yt.nodeName!=="HTML"&&!s.isChildOf(yt,a)||!R$(e,Lt.clientX,Lt.clientY))return;ft(),mn();const qt=xG(e,yt);_L(qt)?(Lt.preventDefault(),Aw(e,qt).each(rt)):lG(a,Lt.clientX,Lt.clientY).each(no=>{Lt.preventDefault();const So=te(1,no.node,no.position===G_.Before,!1);ee(So),lu(qt)?qt.focus():e.getBody().focus()})}),e.on("keypress",Lt=>{Pn.modifierPressed(Lt)||_L(t.getNode())&&Lt.preventDefault()}),e.on("GetSelectionRange",Lt=>{let yt=Lt.range;if(C){if(!C.parentNode){C=null;return}yt=yt.cloneRange(),yt.selectNode(C),Lt.range=yt}}),e.on("SetSelectionRange",Lt=>{Lt.range=Pe(Lt.range);const yt=rt(Lt.range,Lt.forward);yt&&(Lt.range=yt)});const Fn=Lt=>oo(Lt)&&Lt.id==="mcepastebin";e.on("AfterSetSelectionRange",Lt=>{const yt=Lt.range,qt=yt.startContainer.parentElement;!Se(yt)&&!Fn(qt)&&mn(),L(qt)||ft()}),Nte(e),Fte(e),Bte(e)},Re=Fn=>Vu(Fn)||Uv(Fn)||j0(Fn),Se=Fn=>Re(Fn.startContainer)||Re(Fn.endContainer),Pe=Fn=>{const Lt=e.schema.getVoidElements(),yt=s.createRng(),qt=Fn.startContainer,no=Fn.startOffset,So=Fn.endContainer,fs=Fn.endOffset;return yn(Lt,qt.nodeName.toLowerCase())?no===0?yt.setStartBefore(qt):yt.setStartAfter(qt):yt.setStart(qt,no),yn(Lt,So.nodeName.toLowerCase())?fs===0?yt.setEndBefore(So):yt.setEndAfter(So):yt.setEnd(So,fs),yt},Je=(Fn,Lt)=>{const yt=M.fromDom(e.getBody()),qt=e.getDoc(),no=fa(yt,"#"+p).getOrThunk(()=>{const Ts=M.fromHtml('<div data-mce-bogus="all" class="mce-offscreen-selection"></div>',qt);return $s(Ts,"id",p),rr(yt,Ts),Ts}),So=s.createRng();Ua(no),Or(no,[M.fromText(Vo,qt),M.fromDom(Lt),M.fromText(Vo,qt)]),So.setStart(no.dom.firstChild,1),So.setEnd(no.dom.lastChild,0),ma(no,{top:s.getPos(Fn,e.getBody()).y+"px"}),eD(no);const fs=t.getSel();return fs&&(fs.removeAllRanges(),fs.addRange(So)),So},nt=Fn=>{const Lt=Fn.cloneNode(!0),yt=e.dispatch("ObjectSelected",{target:Fn,targetClone:Lt});if(yt.isDefaultPrevented())return null;const qt=Je(Fn,yt.targetClone),no=M.fromDom(Fn);return xe($e(M.fromDom(e.getBody()),`*[${v}]`),So=>{gt(no,So)||Xi(So,v)}),s.getAttrib(Fn,v)||Fn.setAttribute(v,"1"),C=Fn,mn(),qt},rt=(Fn,Lt)=>{if(!Fn)return null;if(Fn.collapsed){if(!Se(Fn)){const So=Lt?1:-1,fs=my(So,a,Fn),Ts=fs.getNode(!Lt);if(ve(Ts)){if(uy(Ts))return te(So,Ts,Lt?!fs.isAtEnd():!1,!1);if(Xf(Ts)&&Ir(Ts.nextSibling)){const $r=s.createRng();return $r.setStart(Ts,0),$r.setEnd(Ts,0),$r}}const _r=fs.getNode(Lt);if(ve(_r)){if(uy(_r))return te(So,_r,Lt?!1:!fs.isAtEnd(),!1);if(Xf(_r)&&Ir(_r.previousSibling)){const $r=s.createRng();return $r.setStart(_r,1),$r.setEnd(_r,1),$r}}}return null}let yt=Fn.startContainer,qt=Fn.startOffset;const no=Fn.endOffset;if(rn(yt)&&qt===0&&_L(yt.parentNode)&&(yt=yt.parentNode,qt=s.nodeIndex(yt),yt=yt.parentNode),!oo(yt))return null;if(no===qt+1&&yt===Fn.endContainer){const So=yt.childNodes[qt];if(G(So))return nt(So)}return null},ft=()=>{C&&C.removeAttribute(v),fa(M.fromDom(e.getBody()),"#"+p).each(Xs),C=null},Xt=()=>{d.destroy(),C=null},mn=()=>{d.hide()};return Pf(e)||ye(),{showCaret:te,showBlockCaretContainer:ie,hideFakeCaret:mn,destroy:Xt}},Hte=(e,t)=>{let s=t;for(let a=e.previousSibling;rn(a);a=a.previousSibling)s+=a.data.length;return s},yG=(e,t,s,a,d)=>{if(rn(s)&&(a<0||a>s.data.length))return[];const p=d&&rn(s)?[Hte(s,a)]:[a];let v=s;for(;v!==t&&v.parentNode;)p.push(e.nodeIndex(v,d)),v=v.parentNode;return v===t?p.reverse():[]},RH=(e,t,s,a,d,p,v=!1)=>{const C=yG(e,t,s,a,v),L=yG(e,t,d,p,v);return{start:C,end:L}},wG=(e,t)=>{const s=t.slice(),a=s.pop();return O(a)?Kn(s,(p,v)=>p.bind(C=>J.from(C.childNodes[v])),J.some(e)).bind(p=>rn(p)&&(a<0||a>p.data.length)?J.none():J.some({node:p,offset:a})):J.none()},SG=(e,t)=>wG(e,t.start).bind(({node:s,offset:a})=>wG(e,t.end).map(({node:d,offset:p})=>{const v=document.createRange();return v.setStart(s,a),v.setEnd(d,p),v})),Ute=(e,t,s,a=!1)=>RH(e,t,s.startContainer,s.startOffset,s.endContainer,s.endOffset,a),W_=(e,t,s)=>{if(t&&e.isEmpty(t)&&!s(t)){const a=t.parentNode;e.remove(t,rn(t.firstChild)&&pr(t.firstChild.data)),W_(e,a,s)}},Y3=(e,t,s,a=!0)=>{const d=t.startContainer.parentNode,p=t.endContainer.parentNode;t.deleteContents(),a&&!s(t.startContainer)&&(rn(t.startContainer)&&t.startContainer.data.length===0&&e.remove(t.startContainer),rn(t.endContainer)&&t.endContainer.data.length===0&&e.remove(t.endContainer),W_(e,d,s),d!==p&&W_(e,p,s))},X3=(e,t)=>J.from(e.dom.getParent(t.startContainer,e.dom.isBlock)),OH=(e,t,s)=>{const a=e.dynamicPatternsLookup({text:s,block:t});return{...e,blockPatterns:Gd(a).concat(e.blockPatterns),inlinePatterns:bl(a).concat(e.inlinePatterns)}},IH=(e,t,s,a)=>{const d=e.createRng();return d.setStart(t,0),d.setEnd(s,a),d.toString()},EG=(e,t)=>e.create("span",{"data-mce-type":"bookmark",id:t}),J3=(e,t)=>{const s=e.createRng();return s.setStartAfter(t.start),s.setEndBefore(t.end),s},CG=(e,t,s)=>{const a=SG(e.getRoot(),s).getOrDie("Unable to resolve path range"),d=a.startContainer,p=a.endContainer,v=a.endOffset===0?p:p.splitText(a.endOffset),C=a.startOffset===0?d:d.splitText(a.startOffset),L=C.parentNode,G=v.parentNode;return{prefix:t,end:G.insertBefore(EG(e,t+"-end"),v),start:L.insertBefore(EG(e,t+"-start"),C)}},_G=(e,t,s)=>{W_(e,e.get(t.prefix+"-end"),s),W_(e,e.get(t.prefix+"-start"),s)},PH=e=>e.start.length===0,Vte=e=>(t,s)=>{const d=t.data.substring(0,s),p=d.lastIndexOf(e.charAt(e.length-1)),v=d.lastIndexOf(e);return v!==-1?v+e.length:p!==-1?p+1:-1},TG=(e,t,s,a)=>{const d=t.start;return nH(e,a.container,a.offset,Vte(d),s).bind(v=>{var C,L;const G=(L=(C=s.textContent)===null||C===void 0?void 0:C.indexOf(d))!==null&&L!==void 0?L:-1;if(G!==-1&&v.offset>=G+d.length){const te=e.createRng();return te.setStart(v.container,v.offset-d.length),te.setEnd(v.container,v.offset),J.some(te)}else{const te=v.offset-d.length;return tH(v.container,te,s).map(ie=>{const ye=e.createRng();return ye.setStart(ie.container,ie.offset),ye.setEnd(v.container,v.offset),ye}).filter(ie=>ie.toString()===d).orThunk(()=>TG(e,t,s,Fp(v.container,0)))}})},zte=(e,t,s,a,d,p=!1)=>{if(t.start.length===0&&!p){const v=e.createRng();return v.setStart(s,a),v.setEnd(s,a),J.some(v)}return eH(s,a,d).bind(v=>TG(e,t,d,v).bind(L=>{var G;if(p){if(L.endContainer===v.container&&L.endOffset===v.offset)return J.none();if(v.offset===0&&((G=L.endContainer.textContent)===null||G===void 0?void 0:G.length)===L.endOffset)return J.none()}return J.some(L)}))},Gte=(e,t,s,a)=>{const d=e.dom,p=d.getRoot(),v=s.pattern,C=s.position.container,L=s.position.offset;return tH(C,L-s.pattern.end.length,t).bind(G=>{const ee=RH(d,p,G.container,G.offset,C,L,a);if(PH(v))return J.some({matches:[{pattern:v,startRng:ee,endRng:ee}],position:G});{const te=Q3(e,s.remainingPatterns,G.container,G.offset,t,a),ie=te.getOr({matches:[],position:G}),ye=ie.position;return zte(d,v,ye.container,ye.offset,t,te.isNone()).map(Se=>{const Pe=Ute(d,p,Se,a);return{matches:ie.matches.concat([{pattern:v,startRng:Pe,endRng:ee}]),position:Fp(Se.startContainer,Se.startOffset)}})}})},Q3=(e,t,s,a,d,p)=>{const v=e.dom;return eH(s,a,v.getRoot()).bind(C=>{const L=IH(v,d,s,a);for(let G=0;G<t.length;G++){const ee=t[G];if(!Hi(L,ee.end))continue;const te=t.slice();te.splice(G,1);const ie=Gte(e,d,{pattern:ee,remainingPatterns:te,position:C},p);if(ie.isNone()&&a>0)return Q3(e,t,s,a-1,d,p);if(ie.isSome())return ie}return J.none()})},DG=(e,t,s)=>{e.selection.setRng(s),t.type==="inline-format"?xe(t.format,a=>{e.formatter.apply(a)}):e.execCommand(t.cmd,!1,t.value)},Wte=(e,t,s,a)=>{const d=J3(e.dom,s);Y3(e.dom,d,a),DG(e,t,d)},jte=(e,t,s,a,d)=>{const p=e.dom,v=J3(p,a),C=J3(p,s);Y3(p,C,d),Y3(p,v,d);const L={prefix:s.prefix,start:s.end,end:a.start},G=J3(p,L);DG(e,t,G)},Kte=(e,t)=>{const s=gg("mce_textpattern"),a=yo(t,(d,p)=>{const v=CG(e,s+`_end${d.length}`,p.endRng);return d.concat([{...p,endMarker:v}])},[]);return yo(a,(d,p)=>{const v=a.length-d.length-1,C=PH(p.pattern)?p.endMarker:CG(e,s+`_start${v}`,p.startRng);return d.concat([{...p,startMarker:C}])},[])},Zte=e=>Pt(e,(t,s)=>s.end.length-t.end.length),qte=(e,t)=>{const s=jo(e,a=>mo(t,d=>a.pattern.start===d.pattern.start&&a.pattern.end===d.pattern.end));return e.length===t.length?s?e:t:e.length>t.length?e:t},kG=(e,t,s,a,d,p)=>{const v=Q3(e,d.inlinePatterns,s,a,t,p).fold(()=>[],L=>L.matches),C=Q3(e,Zte(d.inlinePatterns),s,a,t,p).fold(()=>[],L=>L.matches);return qte(v,C)},AG=(e,t)=>{if(t.length===0)return;const s=e.dom,a=e.selection.getBookmark(),d=Kte(s,t);xe(d,p=>{const v=s.getParent(p.startMarker.start,s.isBlock),C=L=>L===v;PH(p.pattern)?Wte(e,p.pattern,p.endMarker,C):jte(e,p.pattern,p.startMarker,p.endMarker,C),_G(s,p.endMarker,C),_G(s,p.startMarker,C)}),e.selection.moveToBookmark(a)},LG=(e,t,s)=>FY(t,0,t).map(a=>{const d=a.container;return Iz(d,s.start.length,t).each(p=>{const v=e.createRng();v.setStart(d,0),v.setEnd(p.container,p.offset),Y3(e,v,C=>C===t)}),d}),RG=e=>(t,s)=>{const a=t.dom,d=s.pattern,p=SG(a.getRoot(),s.range).getOrDie("Unable to resolve path range"),v=(C,L)=>{const G=L.get(C);return ae(G)&&At(G).exists(ee=>yn(ee,"block"))};return X3(t,p).each(C=>{d.type==="block-format"?v(d.format,t.formatter)&&t.undoManager.transact(()=>{e(t.dom,C,d),t.formatter.apply(d.format)}):d.type==="block-command"&&t.undoManager.transact(()=>{e(t.dom,C,d),t.execCommand(d.cmd,!1,d.value)})}),!0},Yte=e=>Pt(e,(t,s)=>s.start.length-t.start.length),OG=e=>(t,s)=>{const a=Yte(t),d=s.replace(Vo," ");return Qt(a,p=>e(p,s,d))},IG=(e,t)=>(s,a,d,p,v)=>{var C;v===void 0&&(v=(C=a.textContent)!==null&&C!==void 0?C:"");const L=s.dom,G=Wl(s);return L.is(a,G)?e(d.blockPatterns,v).map(ee=>t&&hn.trim(v).length===ee.start.length?[]:[{pattern:ee,range:RH(L,L.getRoot(),a,0,a,0,p)}]).getOr([]):[]},Xte=e=>/^\s[^\s]/.test(e),Jte=RG((e,t,s)=>{LG(e,t,s).each(a=>{const d=M.fromDom(a),p=bg(d);Xte(p)&&Nv(d,p.slice(1))})}),Qte=OG((e,t,s)=>t.indexOf(e.start)===0||s.indexOf(e.start)===0),ene=IG(Qte,!0),tne=(e,t)=>{const s=e.selection.getRng();return X3(e,s).map(a=>{var d;const p=Math.max(0,s.startOffset),v=OH(t,a,(d=a.textContent)!==null&&d!==void 0?d:""),C=kG(e,a,s.startContainer,p,v,!0),L=ene(e,a,v,!0);return{inlineMatches:C,blockMatches:L}}).filter(({inlineMatches:a,blockMatches:d})=>d.length>0||a.length>0)},nne=(e,t)=>{if(t.length===0)return;const s=e.selection.getBookmark();xe(t,a=>Jte(e,a)),e.selection.moveToBookmark(s)},one=RG(LG),sne=OG((e,t,s)=>t===e.start||s===e.start),rne=IG(sne,!1),ine=(e,t)=>{const s=e.selection.getRng();return X3(e,s).map(a=>{const d=Math.max(0,s.startOffset),p=IH(e.dom,a,s.startContainer,d),v=OH(t,a,p);return rne(e,a,v,!1,p)}).filter(a=>a.length>0)},ane=(e,t)=>{xe(t,s=>one(e,s))},lne=(e,t)=>tne(e,t).fold(vt,({inlineMatches:s,blockMatches:a})=>(e.undoManager.add(),e.undoManager.extra(()=>{e.execCommand("mceInsertNewLine")},()=>{Hv(e),AG(e,s),nne(e,a);const d=e.selection.getRng(),p=eH(d.startContainer,d.startOffset,e.dom.getRoot());e.execCommand("mceInsertNewLine"),p.each(v=>{const C=v.container;C.data.charAt(v.offset-1)===Jo&&(C.deleteData(v.offset-1,1),W_(e.dom,C.parentNode,L=>L===e.dom.getRoot()))})}),!0)),cne=(e,t)=>{const s=e.selection.getRng();X3(e,s).map(a=>{const d=Math.max(0,s.startOffset-1),p=IH(e.dom,a,s.startContainer,d),v=OH(t,a,p),C=kG(e,a,s.startContainer,d,v,!1);C.length>0&&e.undoManager.transact(()=>{AG(e,C)})})},une=(e,t)=>ine(e,t).fold(vt,s=>(e.undoManager.transact(()=>{ane(e,s)}),!0)),PG=(e,t,s)=>{for(let a=0;a<e.length;a++)if(s(e[a],t))return!0;return!1},dne=(e,t)=>PG(e,t,(s,a)=>s===a.keyCode&&!Pn.modifierPressed(a)),fne=(e,t)=>PG(e,t,(s,a)=>s.charCodeAt(0)===a.charCode),hne=e=>{const t=[",",".",";",":","!","?"],s=[32],a=()=>eh(a5(e),ay(e)),d=()=>l2(e);e.on("keydown",v=>{if(v.keyCode===13&&!Pn.modifierPressed(v)&&e.selection.isCollapsed()){const C=th(a(),"enter");(C.inlinePatterns.length>0||C.blockPatterns.length>0||d())&&lne(e,C)&&v.preventDefault()}},!0),e.on("keydown",v=>{if(v.keyCode===32&&e.selection.isCollapsed()){const C=th(a(),"space");(C.blockPatterns.length>0||d())&&une(e,C)&&v.preventDefault()}},!0);const p=()=>{if(e.selection.isCollapsed()){const v=th(a(),"space");(v.inlinePatterns.length>0||d())&&cne(e,v)}};e.on("keyup",v=>{dne(s,v)&&p()}),e.on("keypress",v=>{fne(t,v)&&Ku.setEditorTimeout(e,p)})},mne=e=>{hne(e)},pne=e=>{const t=hn.each,s=Pn.BACKSPACE,a=Pn.DELETE,d=e.dom,p=e.selection,v=e.parser,C=gs.browser,L=C.isFirefox(),G=C.isChromium()||C.isSafari(),ee=gs.deviceType.isiPhone()||gs.deviceType.isiPad(),te=gs.os.isMacOS()||gs.os.isiOS(),ie=(kn,ko)=>{try{e.getDoc().execCommand(kn,!1,String(ko))}catch{}},ye=kn=>kn.isDefaultPrevented(),Re=()=>{const kn=hs=>{const Mn=d.create("body"),cs=hs.cloneContents();return Mn.appendChild(cs),p.serializer.serialize(Mn,{format:"html"})},ko=hs=>{const Mn=kn(hs),cs=d.createRng();cs.selectNode(e.getBody());const Ss=kn(cs);return Mn===Ss};e.on("keydown",hs=>{const Mn=hs.keyCode;if(!ye(hs)&&(Mn===a||Mn===s)&&e.selection.isEditable()){const cs=e.selection.isCollapsed(),Ss=e.getBody();if(cs&&!Ga(e.schema,Ss)||!cs&&!ko(e.selection.getRng()))return;hs.preventDefault(),e.setContent(""),Ss.firstChild&&d.isBlock(Ss.firstChild)?e.selection.setCursorLocation(Ss.firstChild,0):e.selection.setCursorLocation(Ss,0),e.nodeChanged()}})},Se=()=>{e.shortcuts.add("meta+a",null,"SelectAll")},Pe=()=>{e.inline||d.bind(e.getDoc(),"mousedown mouseup",kn=>{let ko;if(kn.target===e.getDoc().documentElement)if(ko=p.getRng(),e.getBody().focus(),kn.type==="mousedown"){if(Vu(ko.startContainer))return;p.placeCaretAt(kn.clientX,kn.clientY)}else p.setRng(ko)})},Je=()=>{e.on("keydown",kn=>{if(!ye(kn)&&kn.keyCode===s){if(!e.getBody().getElementsByTagName("hr").length)return;if(p.isCollapsed()&&p.getRng().startOffset===0){const ko=p.getNode(),hs=ko.previousSibling;if(ko.nodeName==="HR"){d.remove(ko),kn.preventDefault();return}hs&&hs.nodeName&&hs.nodeName.toLowerCase()==="hr"&&(d.remove(hs),kn.preventDefault())}}})},nt=()=>{Range.prototype.getClientRects||e.on("mousedown",kn=>{if(!ye(kn)&&kn.target.nodeName==="HTML"){const ko=e.getBody();ko.blur(),Ku.setEditorTimeout(e,()=>{ko.focus()})}})},rt=()=>{const kn=ix(e);e.on("click",ko=>{const hs=ko.target;/^(IMG|HR)$/.test(hs.nodeName)&&d.isEditable(hs)&&(ko.preventDefault(),e.selection.select(hs),e.nodeChanged()),hs.nodeName==="A"&&d.hasClass(hs,kn)&&hs.childNodes.length===0&&d.isEditable(hs.parentNode)&&(ko.preventDefault(),p.select(hs))})},ft=()=>{const kn=()=>{const hs=d.getAttribs(p.getStart().cloneNode(!1));return()=>{const Mn=p.getStart();Mn!==e.getBody()&&(d.setAttrib(Mn,"style",null),t(hs,cs=>{Mn.setAttributeNode(cs.cloneNode(!0))}))}},ko=()=>!p.isCollapsed()&&d.getParent(p.getStart(),d.isBlock)!==d.getParent(p.getEnd(),d.isBlock);e.on("keypress",hs=>{let Mn;return!ye(hs)&&(hs.keyCode===8||hs.keyCode===46)&&ko()?(Mn=kn(),e.getDoc().execCommand("delete",!1),Mn(),hs.preventDefault(),!1):!0}),d.bind(e.getDoc(),"cut",hs=>{if(!ye(hs)&&ko()){const Mn=kn();Ku.setEditorTimeout(e,()=>{Mn()})}})},Xt=()=>{e.on("keydown",kn=>{if(!ye(kn)&&kn.keyCode===s&&p.isCollapsed()&&p.getRng().startOffset===0){const ko=p.getNode().previousSibling;if(ko&&ko.nodeName&&ko.nodeName.toLowerCase()==="table")return kn.preventDefault(),!1}return!0})},mn=()=>{e.on("keydown",kn=>{if(ye(kn)||kn.keyCode!==Pn.BACKSPACE)return;let ko=p.getRng();const hs=ko.startContainer,Mn=ko.startOffset,cs=d.getRoot();let Ss=hs;if(!(!ko.collapsed||Mn!==0)){for(;Ss.parentNode&&Ss.parentNode.firstChild===Ss&&Ss.parentNode!==cs;)Ss=Ss.parentNode;Ss.nodeName==="BLOCKQUOTE"&&(e.formatter.toggle("blockquote",void 0,Ss),ko=d.createRng(),ko.setStart(hs,0),ko.setEnd(hs,0),p.setRng(ko))}})},Fn=()=>{const kn=()=>{ie("StyleWithCSS",!1),ie("enableInlineTableEditing",!1),CR(e)||ie("enableObjectResizing",!1)};OR(e)||e.on("BeforeExecCommand mousedown",kn)},Lt=()=>{const kn=()=>{t(d.select("a:not([data-mce-block])"),ko=>{var hs;let Mn=ko.parentNode;const cs=d.getRoot();if((Mn==null?void 0:Mn.lastChild)===ko){for(;Mn&&!d.isBlock(Mn);){if(((hs=Mn.parentNode)===null||hs===void 0?void 0:hs.lastChild)!==Mn||Mn===cs)return;Mn=Mn.parentNode}d.add(Mn,"br",{"data-mce-bogus":1})}})};e.on("SetContent ExecCommand",ko=>{(ko.type==="setcontent"||ko.command==="mceInsertLink")&&kn()})},yt=()=>{e.on("init",()=>{ie("DefaultParagraphSeparator",Wl(e))})},qt=kn=>{const ko=kn.getBody(),hs=kn.selection.getRng();return hs.startContainer===hs.endContainer&&hs.startContainer===ko&&hs.startOffset===0&&hs.endOffset===ko.childNodes.length},no=()=>{e.on("keyup focusin mouseup",kn=>{!Pn.modifierPressed(kn)&&!qt(e)&&p.normalize()},!0)},So=()=>{e.contentStyles.push("img:-moz-broken {-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}")},fs=()=>{e.inline||e.on("keydown",()=>{document.activeElement===document.body&&e.getWin().focus()})},Ts=()=>{e.inline||(e.contentStyles.push("body {min-height: 150px}"),e.on("click",kn=>{let ko;kn.target.nodeName==="HTML"&&(ko=e.selection.getRng(),e.getBody().focus(),e.selection.setRng(ko),e.selection.normalize(),e.nodeChanged())}))},_r=()=>{te&&e.on("keydown",kn=>{Pn.metaKeyPressed(kn)&&!kn.shiftKey&&(kn.keyCode===37||kn.keyCode===39)&&(kn.preventDefault(),e.selection.getSel().modify("move",kn.keyCode===37?"backward":"forward","lineboundary"))})},$r=()=>{e.on("click",kn=>{let ko=kn.target;do if(ko.tagName==="A"){kn.preventDefault();return}while(ko=ko.parentNode)}),e.contentStyles.push(".mce-content-body {-webkit-touch-callout: none}")},sa=()=>{e.on("init",()=>{e.dom.bind(e.getBody(),"submit",kn=>{kn.preventDefault()})})},cc=()=>{v.addNodeFilter("br",kn=>{let ko=kn.length;for(;ko--;)kn[ko].attr("class")==="Apple-interchange-newline"&&kn[ko].remove()})},Hr=Fe,En=()=>{if(!L||e.removed)return!1;const kn=e.selection.getSel();return!kn||!kn.rangeCount||kn.rangeCount===0},fo=()=>{G&&(Pe(),rt(),sa(),Se(),ee&&(fs(),Ts(),$r())),L&&(nt(),Fn(),So(),_r())},Zs=()=>{mn(),Re(),gs.windowsPhone||no(),G&&(Pe(),rt(),yt(),sa(),Xt(),cc(),ee?(fs(),Ts(),$r()):Se()),L&&(Je(),nt(),ft(),Fn(),Lt(),So(),_r(),Xt())};return Pf(e)?fo():Zs(),{refreshContentEditable:Hr,isHidden:En}},gne=e=>e.toLowerCase()==="gpl",bne=e=>e.length>=64&&e.length<=255,vne=e=>gne(e)||bne(e)?"VALID":"INVALID",xne=e=>{const t=GR(e);!re(WR(e))&&(ot(t)||vne(t)==="INVALID")&&console.warn("TinyMCE is running in evaluation mode. Provide a valid license key or add license_key: 'gpl' to the init config to agree to the open source license terms. Read more at https://www.tiny.cloud/license-key/")},MH=js.DOM,yne=(e,t)=>{const s=M.fromDom(e.getBody()),a=ff(bc(s)),d=M.fromTag("style");$s(d,"type","text/css"),rr(d,M.fromText(t)),rr(a,d),e.on("remove",()=>{Xs(d)})},wne=e=>e.inline?e.getElement().nodeName.toLowerCase():void 0,NH=e=>ps(e,t=>ot(t)===!1),MG=e=>{const t=e.options.get,s=e.editorUpload.blobCache;return NH({allow_conditional_comments:t("allow_conditional_comments"),allow_html_data_urls:t("allow_html_data_urls"),allow_svg_data_urls:t("allow_svg_data_urls"),allow_html_in_named_anchor:t("allow_html_in_named_anchor"),allow_script_urls:t("allow_script_urls"),allow_unsafe_link_target:t("allow_unsafe_link_target"),convert_unsafe_embeds:t("convert_unsafe_embeds"),convert_fonts_to_spans:t("convert_fonts_to_spans"),fix_list_elements:t("fix_list_elements"),font_size_legacy_values:t("font_size_legacy_values"),forced_root_block:t("forced_root_block"),forced_root_block_attrs:t("forced_root_block_attrs"),preserve_cdata:t("preserve_cdata"),inline_styles:t("inline_styles"),root_name:wne(e),sandbox_iframes:t("sandbox_iframes"),sandbox_iframes_exclusions:XS(e),sanitize:t("xss_sanitization"),validate:!0,blob_cache:s,document:e.getDoc()})},NG=e=>{const t=e.options.get;return NH({custom_elements:t("custom_elements"),extended_valid_elements:t("extended_valid_elements"),invalid_elements:t("invalid_elements"),invalid_styles:t("invalid_styles"),schema:t("schema"),valid_children:t("valid_children"),valid_classes:t("valid_classes"),valid_elements:t("valid_elements"),valid_styles:t("valid_styles"),verify_html:t("verify_html"),padd_empty_block_inline_children:t("format_empty_lines")})},Sne=e=>{const t=e.options.get;return{...MG(e),...NG(e),...NH({remove_trailing_brs:t("remove_trailing_brs"),pad_empty_with_br:t("pad_empty_with_br"),url_converter:t("url_converter"),url_converter_scope:t("url_converter_scope"),element_format:t("element_format"),entities:t("entities"),entity_encoding:t("entity_encoding"),indent:t("indent"),indent_after:t("indent_after"),indent_before:t("indent_before")})}},Ene=e=>{const t=Ob(MG(e),e.schema);return t.addAttributeFilter("src,href,style,tabindex",(s,a)=>{const d=e.dom,p="data-mce-"+a;let v=s.length;for(;v--;){const C=s[v];let L=C.attr(a);if(L&&!C.attr(p)){if(L.indexOf("data:")===0||L.indexOf("blob:")===0)continue;a==="style"?(L=d.serializeStyle(d.parseStyle(L),C.name),L.length||(L=null),C.attr(p,L),C.attr(a,L)):a==="tabindex"?(C.attr(p,L),C.attr(a,null)):C.attr(p,e.convertURL(L,a,C.name))}}}),t.addNodeFilter("script",s=>{let a=s.length;for(;a--;){const d=s[a],p=d.attr("type")||"no/type";p.indexOf("mce-")!==0&&d.attr("type","mce-"+p)}}),c5(e)&&t.addNodeFilter("#cdata",s=>{var a;let d=s.length;for(;d--;){const p=s[d];p.type=8,p.name="#comment",p.value="[CDATA["+e.dom.encode((a=p.value)!==null&&a!==void 0?a:"")+"]]"}}),t.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",s=>{let a=s.length;const d=e.schema.getNonEmptyElements();for(;a--;){const p=s[a];p.isEmpty(d)&&p.getAll("br").length===0&&p.append(new vl("br",1))}}),t},Cne=e=>{const t=n5(e);t&&Ku.setEditorTimeout(e,()=>{let s;t===!0?s=e:s=e.editorManager.get(t),s&&!s.destroyed&&(s.focus(),s.selection.scrollIntoView())},100)},_ne=e=>{const t=e.dom.getRoot();!e.inline&&(!fx(e)||e.selection.getStart(!0)===t)&&Mo(t).each(s=>{const a=s.getNode(),d=$d(a)?Mo(a).getOr(s):s;e.selection.setRng(d.toRange())})},Tne=e=>{e.bindPendingEventDelegates(),e.initialized=!0,Pl(e),e.focus(!0),_ne(e),e.nodeChanged({initial:!0});const t=e5(e);Oe(t)&&t.call(e,e),Cne(e)},FH=e=>e.inline?e.ui.styleSheetLoader:e.dom.styleSheetLoader,Dne=(e,t,s)=>{const{pass:a,fail:d}=Dn(t,C=>tinymce.Resource.has(f_(C))),v=[...a.map(C=>{const L=tinymce.Resource.get(f_(C));return re(L)?Promise.resolve(FH(e).loadRawCss(C,L)):Promise.resolve()}),FH(e).loadAll(d)];return e.inline?v:v.concat([e.ui.styleSheetLoader.loadAll(s)])},FG=e=>{const t=FH(e),s=ER(e),a=e.contentCSS,d=()=>{t.unloadAll(a),e.inline||e.ui.styleSheetLoader.unloadAll(s)},p=()=>{e.removed?d():e.on("remove",d)};if(e.contentStyles.length>0){let L="";hn.each(e.contentStyles,G=>{L+=G+`\r
`}),e.dom.addStyle(L)}const v=Promise.all(Dne(e,a,s)).then(p).catch(p),C=ox(e);return C&&yne(e,C),v},kne=e=>{const t=e.getDoc(),s=e.getBody();R5(e),o5(e)||(t.body.spellcheck=!1,MH.setAttrib(s,"spellcheck","false")),e.quirks=pne(e),O5(e);const a=KB(e);a!==void 0&&(s.dir=a);const d=Ns(e);d&&e.on("BeforeSetContent",p=>{hn.each(d,v=>{p.content=p.content.replace(v,C=>"<!--mce:protected "+escape(C)+"-->")})}),e.on("SetContent",()=>{e.addVisual(e.getBody())}),e.on("compositionstart compositionend",p=>{e.composing=p.type==="compositionstart"})},Ane=e=>{Pf(e)||e.load({initial:!0,format:"html"}),e.startContent=e.getContent({format:"raw"})},BH=e=>{e.removed!==!0&&(Ane(e),Tne(e))},Lne=e=>{let t=!1;const s=setTimeout(()=>{t||e.setProgressState(!0)},500);return()=>{clearTimeout(s),t=!0,e.setProgressState(!1)}},BG=e=>{const t=e.getElement();let s=e.getDoc();e.inline&&(MH.addClass(t,"mce-content-body"),e.contentDocument=s=document,e.contentWindow=window,e.bodyElement=t,e.contentAreaContainer=t);const a=e.getBody();a.disabled=!0,e.readonly=OR(e),e._editableRoot=or(e),!e.readonly&&e.hasEditableRoot()&&(e.inline&&MH.getStyle(a,"position",!0)==="static"&&(a.style.position="relative"),a.contentEditable="true"),a.disabled=!1,e.editorUpload=V$(e),e.schema=Vh(NG(e)),e.dom=js(s,{keep_values:!0,url_converter:e.convertURL,url_converter_scope:e,update_styles:!0,root_element:e.inline?e.getBody():null,collect:e.inline,schema:e.schema,contentCssCors:wR(e),referrerPolicy:oy(e),onSetAttrib:v=>{e.dispatch("SetAttrib",v)}}),e.parser=Ene(e),e.serializer=yw(Sne(e),e),e.selection=c_(e.dom,e.getWin(),e.serializer,e),e.annotator=NO(e),e.formatter=kw(e),e.undoManager=v_(e),e._nodeChangeDispatcher=new CQ(e),e._selectionOverrides=$te(e),Wt(e),Gee(e),No(e),Pf(e)||(Xee(e),mne(e));const d=EQ(e);Te(e,d),ii(e),j$(e),Uee(e);const p=lN(e);kne(e),xne(e),p.fold(()=>{const v=Lne(e);FG(e).then(()=>{BH(e),v()})},v=>{e.setProgressState(!0),FG(e).then(()=>{v().then(C=>{e.setProgressState(!1),BH(e),hA(e)},C=>{e.notificationManager.open({type:"error",text:String(C)}),BH(e),hA(e)})})})},Rne=an,One=(e,t,s)=>Po(e,t,Rne,s),$H=js.DOM,Ine=(e,t,s,a)=>{const d=M.fromTag("iframe");return a.each(p=>$s(d,"tabindex",p)),Hc(d,s),Hc(d,{id:e+"_ifr",frameBorder:"0",allowTransparency:"true",title:t}),od(d,"tox-edit-area__iframe"),d},Pne=e=>{let t=_f(e)+"<html><head>";dd(e)!==e.documentBaseUrl&&(t+='<base href="'+e.documentBaseURI.getURI()+'" />'),t+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';const s=KS(e),a=qT(e),d=e.translate(ry(e));return pR(e)&&(t+='<meta http-equiv="Content-Security-Policy" content="'+pR(e)+'" />'),t+=`</head><body id="${s}" class="mce-content-body ${a}" data-id="${e.id}" aria-label="${d}"><br></body></html>`,t},Mne=(e,t)=>{const s=gs.browser.isFirefox()?ry(e):"Rich Text Area",a=e.translate(s),d=Ul(M.fromDom(e.getElement()),"tabindex").bind(yr),p=Ine(e.id,a,sc(e),d).dom;p.onload=()=>{p.onload=null,e.dispatch("load")},e.contentAreaContainer=t.iframeContainer,e.iframeElement=p,e.iframeHTML=Pne(e),$H.add(t.iframeContainer,p)},Nne=e=>{const t=e.iframeElement,s=()=>{e.contentDocument=t.contentDocument,BG(e)};if($R(e)||gs.browser.isFirefox()){const a=e.getDoc();a.open(),a.write(e.iframeHTML),a.close(),s()}else{const a=One(M.fromDom(t),"load",()=>{a.unbind(),s()});t.srcdoc=e.iframeHTML}},Fne=(e,t)=>{Mne(e,t),t.editorContainer&&(t.editorContainer.style.display=e.orgDisplay,e.hidden=$H.isHidden(t.editorContainer)),e.getElement().style.display="none",$H.setAttrib(e.id,"aria-hidden","true"),e.getElement().style.visibility=e.orgVisibility,Nne(e)},$G=js.DOM,Bne=(e,t,s)=>{const a=zx.get(s),d=zx.urls[s]||e.documentBaseUrl.replace(/\/$/,"");if(s=hn.trim(s),a&&hn.inArray(t,s)===-1){if(e.plugins[s])return;try{const p=a(e,d)||{};e.plugins[s]=p,Oe(p.init)&&(p.init(e,d),t.push(s))}catch(p){RA(e,s,p)}}},$ne=e=>e.replace(/^\-/,""),Hne=e=>{const t=[];xe(Tf(e),s=>{Bne(e,t,$ne(s))})},Une=e=>{const t=hn.trim(e2(e)),s=e.ui.registry.getAll().icons,a={...Pb.get("default").icons,...Pb.get(t).icons};qo(a,(d,p)=>{yn(s,p)||e.ui.registry.addIcon(p,d)})},Vne=e=>{const t=sx(e);if(re(t)){const s=Xg.get(t);e.theme=s(e,Xg.urls[t])||{},Oe(e.theme.init)&&e.theme.init(e,Xg.urls[t]||e.documentBaseUrl.replace(/\/$/,""))}else e.theme={}},zne=e=>{const t=sy(e),s=Mb.get(t);e.model=s(e,Mb.urls[t])},Gne=e=>{const t=e.theme.renderUI;return t?t():UG(e)},Wne=e=>{const t=e.getElement(),a=sx(e)(e,t);return a.editorContainer.nodeType&&(a.editorContainer.id=a.editorContainer.id||e.id+"_parent"),a.iframeContainer&&a.iframeContainer.nodeType&&(a.iframeContainer.id=a.iframeContainer.id||e.id+"_iframecontainer"),a.height=a.iframeHeight?a.iframeHeight:t.offsetHeight,a},HG=(e,t)=>({editorContainer:e,iframeContainer:t,api:{}}),jne=e=>{const t=$G.create("div");return $G.insertAfter(t,e),HG(t,t)},UG=e=>{const t=e.getElement();return e.inline?HG(null):jne(t)},Kne=e=>{const t=e.getElement();return e.orgDisplay=t.style.display,re(sx(e))?Gne(e):Oe(sx(e))?Wne(e):UG(e)},Zne=(e,t)=>{const s={show:J.from(t.show).getOr(Fe),hide:J.from(t.hide).getOr(Fe),isEnabled:J.from(t.isEnabled).getOr(an),setEnabled:a=>{e.mode.isReadOnly()||J.from(t.setEnabled).each(d=>d(a))}};e.ui={...e.ui,...s}},qne=async e=>{e.dispatch("ScriptsLoaded"),Une(e),Vne(e),zne(e),Hne(e);const t=await Kne(e);Zne(e,J.from(t.api).getOr({})),e.editorContainer=t.editorContainer,F$(e),e.inline?BG(e):Fne(e,{editorContainer:t.editorContainer,iframeContainer:t.iframeContainer})},Hw=js.DOM,VG=e=>e.charAt(0)==="-",Yne=(e,t)=>{const s=o2(t),a=jB(t);if(!Bu.hasCode(s)&&s!=="en"){const d=vi(a)?a:`${t.editorManager.baseURL}/langs/${s}.js`;e.add(d).catch(()=>{WN(t,d,s)})}},Xne=(e,t)=>{const s=sx(e);if(re(s)&&!VG(s)&&!yn(Xg.urls,s)){const a=qB(e),d=a?e.documentBaseURI.toAbsolute(a):`themes/${s}/theme${t}.js`;Xg.load(s,d).catch(()=>{jN(e,d,s)})}},Jne=(e,t)=>{const s=sy(e);if(s!=="plugin"&&!yn(Mb.urls,s)){const a=r2(e),d=re(a)?e.documentBaseURI.toAbsolute(a):`models/${s}/model${t}.js`;Mb.load(s,d).catch(()=>{LA(e,d,s)})}},Qne=e=>J.from(xR(e)).filter(vi).map(t=>({url:t,name:J.none()})),zG=(e,t,s)=>J.from(t).filter(a=>vi(a)&&!Pb.has(a)).map(a=>({url:`${e.editorManager.baseURL}/icons/${a}/icons${s}.js`,name:J.some(a)})),eoe=(e,t,s)=>{const a=zG(t,"default",s),d=Qne(t).orThunk(()=>zG(t,e2(t),""));xe(Od([a,d]),p=>{e.add(p.url).catch(()=>{I$(t,p.url,p.name.getOrUndefined())})})},toe=(e,t)=>{const s=(a,d)=>{zx.load(a,d).catch(()=>{AA(e,d,a)})};qo(Qh(e),(a,d)=>{s(d,a),e.options.set("plugins",Tf(e).concat(d))}),xe(Tf(e),a=>{a=hn.trim(a),a&&!zx.urls[a]&&!VG(a)&&s(a,`plugins/${a}/plugin${t}.js`)})},noe=e=>{const t=sx(e);return!re(t)||ve(Xg.get(t))},ooe=e=>{const t=sy(e);return ve(Mb.get(t))},soe=(e,t)=>{const s=uu.ScriptLoader,a=()=>{!e.removed&&noe(e)&&ooe(e)&&qne(e)};Xne(e,t),Jne(e,t),Yne(s,e),eoe(s,e,t),toe(e,t),s.loadQueue().then(a,a)},roe=(e,t)=>R0.forElement(e,{contentCssCors:IR(t),referrerPolicy:oy(t)}),ioe=e=>{const t=e.id;Bu.setCode(o2(e));const s=()=>{Hw.unbind(window,"ready",s),e.render()};if(!Qi.Event.domLoaded){Hw.bind(window,"ready",s);return}if(!e.getElement())return;const a=M.fromDom(e.getElement()),d=Oi(a);e.on("remove",()=>{It(a.dom.attributes,v=>Xi(a,v.name)),Hc(a,d)}),e.ui.styleSheetLoader=roe(a,e),eb(e)?e.inline=!0:(e.orgVisibility=e.getElement().style.visibility,e.getElement().style.visibility="hidden");const p=e.getElement().form||Hw.getParent(t,"form");p&&(e.formElement=p,i2(e)&&!ng(e.getElement())&&(Hw.insertAfter(Hw.create("input",{type:"hidden",name:t}),t),e.hasHiddenInput=!0),e.formEventDelegate=v=>{e.dispatch(v.type,v)},Hw.bind(p,"submit reset",e.formEventDelegate),e.on("reset",()=>{e.resetContent()}),kR(e)&&!p.submit.nodeType&&!p.submit.length&&!p._mceOldSubmit&&(p._mceOldSubmit=p.submit,p.submit=()=>(e.editorManager.triggerSave(),e.setDirty(!1),p._mceOldSubmit(p)))),e.windowManager=DA(e),e.notificationManager=_A(e),HR(e)&&e.on("GetContent",v=>{v.save&&(v.content=Hw.encode(v.content))}),AR(e)&&e.on("submit",()=>{e.initialized&&e.save()}),LR(e)&&(e._beforeUnload=()=>{e.initialized&&!e.destroyed&&!e.isHidden()&&e.save({format:"raw",no_events:!0,set_dirty:!1})},e.editorManager.on("BeforeUnload",e._beforeUnload)),e.editorManager.add(e),soe(e,e.suffix)},aoe=(e,t)=>{e._editableRoot!==t&&(e._editableRoot=t,e.readonly||(e.getBody().contentEditable=String(e.hasEditableRoot()),e.nodeChanged()),M5(e,t))},loe=e=>e._editableRoot,coe=(e,t)=>({sections:et(e),options:et(t)}),GG=Cs().deviceType,WG=GG.isPhone(),uoe=GG.isTablet(),TL=e=>{if(Ae(e))return[];{const t=ae(e)?e:e.split(/[ ,]/),s=$t(t,Qa);return Ct(s,vi)}},doe=(e,t)=>{const s=aa(t,(a,d)=>to(e,d));return coe(s.t,s.f)},foe=(e,t,s={})=>{const a=e.sections(),d=Gn(a,t).getOr({});return hn.extend({},s,d)},HH=(e,t)=>yn(e.sections(),t),hoe=(e,t)=>HH(e,t)?e.sections()[t]:{},moe=(e,t)=>({...{table_grid:!1,object_resizing:!1,resize:!1,toolbar_mode:Gn(e,"toolbar_mode").getOr("scrolling"),toolbar_sticky:!1},...t?{menubar:!1}:{}}),poe=(e,t)=>{var s;const a=(s=t.external_plugins)!==null&&s!==void 0?s:{};return e&&e.external_plugins?hn.extend({},e.external_plugins,a):a},goe=(e,t)=>[...TL(e),...TL(t)],boe=(e,t,s,a)=>e&&HH(t,"mobile")?a:s,voe=(e,t,s,a)=>{const d=TL(s.forced_plugins),p=TL(a.plugins),v=hoe(t,"mobile"),C=v.plugins?TL(v.plugins):p,L=boe(e,t,p,C),G=goe(d,L);return hn.extend(a,{forced_plugins:d,plugins:G})},xoe=(e,t)=>e&&HH(t,"mobile"),yoe=(e,t,s,a,d)=>{var p;const v=e?{mobile:moe((p=d.mobile)!==null&&p!==void 0?p:{},t)}:{},C=doe(["mobile"],R3(v,d)),L=hn.extend(s,a,C.options(),xoe(e,C)?foe(C,"mobile"):{},{external_plugins:poe(a,C.options())});return voe(e,C,a,L)},woe=(e,t)=>yoe(WG||uoe,WG,t,e,t),Soe=(e,t)=>mN(e,t),Eoe=e=>{const t=(a,d)=>{e.formatter.toggle(a,d),e.nodeChanged()},s=a=>()=>{xe("left,center,right,justify".split(","),d=>{a!==d&&e.formatter.remove("align"+d)}),a!=="none"&&t("align"+a)};e.editorCommands.addCommands({JustifyLeft:s("left"),JustifyCenter:s("center"),JustifyRight:s("right"),JustifyFull:s("justify"),JustifyNone:s("none")})},Coe=e=>{const t=s=>()=>{const a=e.selection,d=a.isCollapsed()?[e.dom.getParent(a.getNode(),e.dom.isBlock)]:a.getSelectedBlocks();return mo(d,p=>ve(e.formatter.matchNode(p,s)))};e.editorCommands.addCommands({JustifyLeft:t("alignleft"),JustifyCenter:t("aligncenter"),JustifyRight:t("alignright"),JustifyFull:t("alignjustify")},"state")},_oe=e=>{Eoe(e),Coe(e)},Toe=e=>{e.editorCommands.addCommands({"Cut,Copy,Paste":t=>{const s=e.getDoc();let a;try{s.execCommand(t)}catch{a=!0}if(t==="paste"&&!s.queryCommandEnabled(t)&&(a=!0),a||!s.queryCommandSupported(t)){let d=e.translate("Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.");(gs.os.isMacOS()||gs.os.isiOS())&&(d=d.replace(/Ctrl\+/g,"⌘+")),e.notificationManager.open({text:d,type:"error"})}}})},Doe=(e,t,s,a)=>{const d=M.fromDom(e.getRoot());return _x(d,Et.fromRangeStart(t),a)?s=s.replace(/^ /,"&nbsp;"):s=s.replace(/^&nbsp;/," "),yb(d,Et.fromRangeEnd(t),a)?s=s.replace(/(&nbsp;| )(<br( \/)>)?$/,"&nbsp;"):s=s.replace(/&nbsp;(<br( \/)?>)?$/," "),s},koe=e=>{if(typeof e!="string"){const t=hn.extend({paste:e.paste,data:{paste:e.paste}},e);return{content:e.content,details:t}}return{content:e,details:{}}},Aoe=(e,t)=>{const s=e.selection,a=e.dom;return/^ | $/.test(t)?Doe(a,s.getRng(),t,e.schema):t},e4=(e,t)=>{if(e.selection.isEditable()){const{content:s,details:a}=koe(t);Jk(e,{...a,content:Aoe(e,s),format:"html",set:!1,selection:!0}).each(d=>{const p=hN(e,d.content,a);qC(e,p,d),e.addVisual()})}},Loe=e=>{e.editorCommands.addCommands({mceCleanup:()=>{const t=e.selection.getBookmark();e.setContent(e.getContent()),e.selection.moveToBookmark(t)},insertImage:(t,s,a)=>{e4(e,e.dom.createHTML("img",{src:a}))},insertHorizontalRule:()=>{e.execCommand("mceInsertContent",!1,"<hr>")},insertText:(t,s,a)=>{e4(e,e.dom.encode(a))},insertHTML:(t,s,a)=>{e4(e,a)},mceInsertContent:(t,s,a)=>{e4(e,a)},mceSetContent:(t,s,a)=>{e.setContent(a)},mceReplaceContent:(t,s,a)=>{e.execCommand("mceInsertContent",!1,a.replace(/\{\$selection\}/g,e.selection.getContent({format:"text"})))},mceNewDocument:()=>{e.setContent(zs(e))}})},Roe={"font-size":"size","font-family":"face"},Ooe=ci("font"),Ioe=(e,t,s)=>{const a=p=>Vc(p,e).orThunk(()=>Ooe(p)?Gn(Roe,e).bind(v=>Ul(p,v)):J.none()),d=p=>gt(M.fromDom(t),p);return ak(M.fromDom(s),p=>a(p),d)},Poe=e=>e.replace(/[\'\"\\]/g,"").replace(/,\s+/g,","),Moe=(e,t)=>J.from(js.DOM.getStyle(t,e,!0)),jG=e=>(t,s)=>J.from(s).map(M.fromDom).filter(ll).bind(a=>Ioe(e,t,a.dom).or(Moe(e,a.dom))).getOr(""),Noe=jG("font-size"),Foe=st(Poe,jG("font-family")),Boe=e=>Mo(e.getBody()).bind(t=>{const s=t.container();return J.from(rn(s)?s.parentNode:s)}),$oe=e=>J.from(e.selection.getRng()).bind(t=>{const s=e.getBody();return t.startContainer===s&&t.startOffset===0?J.none():J.from(e.selection.getStart(!0))}),Hoe=(e,t)=>$oe(e).orThunk(it(Boe,e)).map(M.fromDom).filter(ll).bind(t),UH=(e,t)=>Hoe(e,Ut(J.some,t)),KG=(e,t)=>{if(/^[0-9.]+$/.test(t)){const s=parseInt(t,10);if(s>=1&&s<=7){const a=c2(e),d=u2(e);return d.length>0?d[s-1]||t:a[s-1]||t}else return t}else return t},Uoe=e=>{const t=e.split(/\s*,\s*/);return $t(t,s=>s.indexOf(" ")!==-1&&!(qs(s,'"')||qs(s,"'"))?`'${s}'`:s).join(",")},Voe=(e,t)=>{const s=KG(e,t);e.formatter.toggle("fontname",{value:Uoe(s)}),e.nodeChanged()},zoe=e=>UH(e,t=>Foe(e.getBody(),t.dom)).getOr(""),Goe=(e,t)=>{e.formatter.toggle("fontsize",{value:KG(e,t)}),e.nodeChanged()},Woe=e=>UH(e,t=>Noe(e.getBody(),t.dom)).getOr(""),joe=e=>UH(e,t=>{const s=M.fromDom(e.getBody()),a=ak(t,p=>Vc(p,"line-height"),it(gt,s)),d=()=>{const p=parseFloat(Vi(t,"line-height")),v=parseFloat(Vi(t,"font-size"));return String(p/v)};return a.getOrThunk(d)}).getOr(""),Koe=(e,t)=>{e.formatter.toggle("lineheight",{value:String(t)}),e.nodeChanged()},Zoe=e=>{const t=(s,a)=>{e.formatter.toggle(s,a),e.nodeChanged()};e.editorCommands.addCommands({"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":s=>{t(s)},"ForeColor,HiliteColor":(s,a,d)=>{t(s,{value:d})},BackColor:(s,a,d)=>{t("hilitecolor",{value:d})},FontName:(s,a,d)=>{Voe(e,d)},FontSize:(s,a,d)=>{Goe(e,d)},LineHeight:(s,a,d)=>{Koe(e,d)},Lang:(s,a,d)=>{var p;t(s,{value:d.code,customValue:(p=d.customCode)!==null&&p!==void 0?p:null})},RemoveFormat:s=>{e.formatter.remove(s)},mceBlockQuote:()=>{t("blockquote")},FormatBlock:(s,a,d)=>{t(re(d)?d:"p")},mceToggleFormat:(s,a,d)=>{t(d)}})},qoe=e=>{const t=s=>e.formatter.match(s);e.editorCommands.addCommands({"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":s=>t(s),mceBlockQuote:()=>t("blockquote")},"state"),e.editorCommands.addQueryValueHandler("FontName",()=>zoe(e)),e.editorCommands.addQueryValueHandler("FontSize",()=>Woe(e)),e.editorCommands.addQueryValueHandler("LineHeight",()=>joe(e))},Yoe=e=>{Zoe(e),qoe(e)},Xoe=e=>{e.editorCommands.addCommands({mceAddUndoLevel:()=>{e.undoManager.add()},mceEndUndoLevel:()=>{e.undoManager.add()},Undo:()=>{e.undoManager.undo()},Redo:()=>{e.undoManager.redo()}})},Joe=e=>{e.editorCommands.addCommands({Indent:()=>{ge(e)},Outdent:()=>{he(e)}}),e.editorCommands.addCommands({Outdent:()=>U(e)},"state")},Qoe=e=>{const t=(s,a,d)=>{const p=re(d)?{href:d}:d,v=e.dom.getParent(e.selection.getNode(),"a");Y(p)&&re(p.href)&&(p.href=p.href.replace(/ /g,"%20"),(!v||!p.href)&&e.formatter.remove("link"),p.href&&e.formatter.apply("link",p,v))};e.editorCommands.addCommands({unlink:()=>{if(e.selection.isEditable()){if(e.selection.isCollapsed()){const s=e.dom.getParent(e.selection.getStart(),"a");s&&e.dom.remove(s,!0);return}e.formatter.remove("link")}},mceInsertLink:t,createLink:t})},ese=(e,t,s,a)=>{const d=e.dom,p=C=>d.isBlock(C)&&C.parentElement===s,v=p(t)?t:d.getParent(a,p,s);return J.from(v).map(M.fromDom)},ZG=(e,t)=>{const s=e.dom,a=e.selection.getRng(),d=t?e.selection.getStart():e.selection.getEnd(),p=t?a.startContainer:a.endContainer,v=wL(s,p);if(!v||!v.isContentEditable)return;const C=t?lt:Si,L=Wl(e);ese(e,d,v,p).each(G=>{const ee=f9(e,p,G.dom,v,!1,L);C(G,M.fromDom(ee)),e.selection.setCursorLocation(ee,0),e.dispatch("NewBlock",{newBlock:ee}),yL(e,"insertParagraph")})},tse=e=>ZG(e,!0),nse=e=>ZG(e,!1),ose=e=>{e.editorCommands.addCommands({InsertNewBlockBefore:()=>{tse(e)},InsertNewBlockAfter:()=>{nse(e)}})},sse=e=>{e.editorCommands.addCommands({insertParagraph:()=>{U3(g9,e)},mceInsertNewLine:(t,s,a)=>{E9(e,a)},InsertLineBreak:(t,s,a)=>{U3(x9,e)}})},rse=e=>{e.editorCommands.addCommands({mceSelectNodeDepth:(t,s,a)=>{let d=0;e.dom.getParent(e.selection.getNode(),p=>oo(p)&&d++===a?(e.selection.select(p),!1):!0,e.getBody())},mceSelectNode:(t,s,a)=>{e.selection.select(a)},selectAll:()=>{const t=e.dom.getParent(e.selection.getStart(),Ws);if(t){const s=e.dom.createRng();s.selectNodeContents(t),e.selection.setRng(s)}}})},ise=e=>{e.editorCommands.addCommands({mceRemoveNode:(t,s,a)=>{const d=a??e.selection.getNode();if(d!==e.getBody()){const p=e.selection.getBookmark();e.dom.remove(d,!0),e.selection.moveToBookmark(p)}},mcePrint:()=>{e.getWin().print()},mceFocus:(t,s,a)=>{vI(e,a===!0)},mceToggleVisualAid:()=>{e.hasVisual=!e.hasVisual,e.addVisual()}})},ase=e=>{_oe(e),Toe(e),Xoe(e),rse(e),Loe(e),Qoe(e),Joe(e),ose(e),sse(e),Yoe(e),ise(e)},lse=["toggleview"],qG=e=>to(lse,e.toLowerCase());class YG{constructor(t){this.commands={state:{},exec:{},value:{}},this.editor=t}execCommand(t,s=!1,a,d){const p=this.editor,v=t.toLowerCase(),C=d==null?void 0:d.skip_focus;if(p.removed||(v!=="mcefocus"&&(!/^(mceAddUndoLevel|mceEndUndoLevel)$/i.test(v)&&!C?p.focus():t6(p)),p.dispatch("BeforeExecCommand",{command:t,ui:s,value:a}).isDefaultPrevented()))return!1;const G=this.commands.exec[v];return Oe(G)?(G(v,s,a),p.dispatch("ExecCommand",{command:t,ui:s,value:a}),!0):!1}queryCommandState(t){if(!qG(t)&&this.editor.quirks.isHidden()||this.editor.removed)return!1;const s=t.toLowerCase(),a=this.commands.state[s];return Oe(a)?a(s):!1}queryCommandValue(t){if(!qG(t)&&this.editor.quirks.isHidden()||this.editor.removed)return"";const s=t.toLowerCase(),a=this.commands.value[s];return Oe(a)?a(s):""}addCommands(t,s="exec"){const a=this.commands;qo(t,(d,p)=>{xe(p.toLowerCase().split(","),v=>{a[s][v]=d})})}addCommand(t,s,a){const d=t.toLowerCase();this.commands.exec[d]=(p,v,C)=>s.call(a??this.editor,v,C)}queryCommandSupported(t){const s=t.toLowerCase();return!!this.commands.exec[s]}addQueryStateHandler(t,s,a){this.commands.state[t.toLowerCase()]=()=>s.call(a??this.editor)}addQueryValueHandler(t,s,a){this.commands.value[t.toLowerCase()]=()=>s.call(a??this.editor)}}const Uw="data-mce-contenteditable",cse=(e,t,s)=>{cl(e,t)&&!s?nu(e,t):s&&od(e,t)},VH=(e,t,s)=>{try{e.getDoc().execCommand(t,!1,String(s))}catch{}},t4=(e,t)=>{e.dom.contentEditable=t?"true":"false"},use=e=>{xe($e(e,'*[contenteditable="true"]'),t=>{$s(t,Uw,"true"),t4(t,!1)})},dse=e=>{xe($e(e,`*[${Uw}="true"]`),t=>{Xi(t,Uw),t4(t,!0)})},fse=e=>{J.from(e.selection.getNode()).each(t=>{t.removeAttribute("data-mce-selected")})},hse=e=>{e.selection.setRng(e.selection.getRng())},mse=(e,t)=>{const s=M.fromDom(e.getBody());cse(s,"mce-content-readonly",t),t?(e.selection.controlSelection.hideResizeRect(),e._selectionOverrides.hideFakeCaret(),fse(e),e.readonly=!0,t4(s,!1),use(s)):(e.readonly=!1,e.hasEditableRoot()&&t4(s,!0),dse(s),VH(e,"StyleWithCSS",!1),VH(e,"enableInlineTableEditing",!1),VH(e,"enableObjectResizing",!1),bb(e)&&e.focus(),hse(e),e.nodeChanged())},Vw=e=>e.readonly,XG=e=>{e.parser.addAttributeFilter("contenteditable",t=>{Vw(e)&&xe(t,s=>{s.attr(Uw,s.attr("contenteditable")),s.attr("contenteditable","false")})}),e.serializer.addAttributeFilter(Uw,t=>{Vw(e)&&xe(t,s=>{s.attr("contenteditable",s.attr(Uw))})}),e.serializer.addTempAttr(Uw)},pse=e=>{e.serializer?XG(e):e.on("PreInit",()=>{XG(e)})},gse=e=>e.type==="click",bse=["copy"],vse=e=>to(bse,e.type),xse=(e,t)=>iu(t,"a",a=>gt(a,M.fromDom(e.getBody()))).bind(a=>Ul(a,"href")),yse=(e,t)=>{if(gse(t)&&!Pn.metaKeyPressed(t)){const s=M.fromDom(t.target);xse(e,s).each(a=>{if(t.preventDefault(),/^#/.test(a)){const d=e.dom.select(`${a},[name="${Qc(a,"#")}"]`);d.length&&e.selection.scrollIntoView(d[0],!0)}else window.open(a,"_blank","rel=noopener noreferrer,menubar=yes,toolbar=yes,location=yes,status=yes,resizable=yes,scrollbars=yes")})}else vse(t)&&e.dispatch(t.type,t)},wse=e=>{e.on("ShowCaret",t=>{Vw(e)&&t.preventDefault()}),e.on("ObjectSelected",t=>{Vw(e)&&t.preventDefault()})},Sse=hn.makeMap("focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange mouseout mouseenter mouseleave wheel keydown keypress keyup input beforeinput contextmenu dragstart dragend dragover draggesture dragdrop drop drag submit compositionstart compositionend compositionupdate touchstart touchmove touchend touchcancel"," ");class zH{static isNative(t){return!!Sse[t.toLowerCase()]}constructor(t){this.bindings={},this.settings=t||{},this.scope=this.settings.scope||this,this.toggleEvent=this.settings.toggleEvent||vt}fire(t,s){return this.dispatch(t,s)}dispatch(t,s){const a=t.toLowerCase(),d=Tv(a,s??{},this.scope);this.settings.beforeFire&&this.settings.beforeFire(d);const p=this.bindings[a];if(p)for(let v=0,C=p.length;v<C;v++){const L=p[v];if(!L.removed){if(L.once&&this.off(a,L.func),d.isImmediatePropagationStopped())return d;if(L.func.call(this.scope,d)===!1)return d.preventDefault(),d}}return d}on(t,s,a,d){if(s===!1&&(s=vt),s){const p={func:s,removed:!1};d&&hn.extend(p,d);const v=t.toLowerCase().split(" ");let C=v.length;for(;C--;){const L=v[C];let G=this.bindings[L];G||(G=[],this.toggleEvent(L,!0)),a?G=[p,...G]:G=[...G,p],this.bindings[L]=G}}return this}off(t,s){if(t){const a=t.toLowerCase().split(" ");let d=a.length;for(;d--;){const p=a[d];let v=this.bindings[p];if(!p)return qo(this.bindings,(C,L)=>{this.toggleEvent(L,!1),delete this.bindings[L]}),this;if(v){if(!s)v.length=0;else{const C=Dn(v,L=>L.func===s);v=C.fail,this.bindings[p]=v,xe(C.pass,L=>{L.removed=!0})}v.length||(this.toggleEvent(t,!1),delete this.bindings[p])}}}else qo(this.bindings,(a,d)=>{this.toggleEvent(d,!1)}),this.bindings={};return this}once(t,s,a){return this.on(t,s,a,{once:!0})}has(t){t=t.toLowerCase();const s=this.bindings[t];return!(!s||s.length===0)}}const DL=e=>(e._eventDispatcher||(e._eventDispatcher=new zH({scope:e,toggleEvent:(t,s)=>{zH.isNative(t)&&e.toggleNativeEvent&&e.toggleNativeEvent(t,s)}})),e._eventDispatcher),GH={fire(e,t,s){return this.dispatch(e,t,s)},dispatch(e,t,s){const a=this;if(a.removed&&e!=="remove"&&e!=="detach")return Tv(e.toLowerCase(),t??{},a);const d=DL(a).dispatch(e,t);if(s!==!1&&a.parent){let p=a.parent();for(;p&&!d.isPropagationStopped();)p.dispatch(e,d,!1),p=p.parent?p.parent():void 0}return d},on(e,t,s){return DL(this).on(e,t,s)},off(e,t){return DL(this).off(e,t)},once(e,t){return DL(this).once(e,t)},hasEventListeners(e){return DL(this).has(e)}},n4=js.DOM;let zw;const o4=(e,t)=>{if(t==="selectionchange")return e.getDoc();if(!e.inline&&/^(?:mouse|touch|click|contextmenu|drop|dragover|dragend)/.test(t))return e.getDoc().documentElement;const s=TR(e);return s?(e.eventRoot||(e.eventRoot=n4.select(s)[0]),e.eventRoot):e.getBody()},Ese=e=>!e.hidden&&!Vw(e),JG=(e,t,s)=>{Ese(e)?e.dispatch(t,s):Vw(e)&&yse(e,s)},QG=(e,t)=>{if(e.delegates||(e.delegates={}),e.delegates[t]||e.removed)return;const s=o4(e,t);if(TR(e)){if(zw||(zw={},e.editorManager.on("removeEditor",()=>{e.editorManager.activeEditor||zw&&(qo(zw,(d,p)=>{e.dom.unbind(o4(e,p))}),zw=null)})),zw[t])return;const a=d=>{const p=d.target,v=e.editorManager.get();let C=v.length;for(;C--;){const L=v[C].getBody();(L===p||n4.isChildOf(p,L))&&JG(v[C],t,d)}};zw[t]=a,n4.bind(s,t,a)}else{const a=d=>{JG(e,t,d)};n4.bind(s,t,a),e.delegates[t]=a}},eW={...GH,bindPendingEventDelegates(){const e=this;hn.each(e._pendingNativeEvents,t=>{QG(e,t)})},toggleNativeEvent(e,t){const s=this;e==="focus"||e==="blur"||s.removed||(t?s.initialized?QG(s,e):s._pendingNativeEvents?s._pendingNativeEvents.push(e):s._pendingNativeEvents=[e]:s.initialized&&s.delegates&&(s.dom.unbind(o4(s,e),e,s.delegates[e]),delete s.delegates[e]))},unbindAllNativeEvents(){const e=this,t=e.getBody(),s=e.dom;e.delegates&&(qo(e.delegates,(a,d)=>{e.dom.unbind(o4(e,d),d,a)}),delete e.delegates),!e.inline&&t&&s&&(t.onload=null,s.unbind(e.getWin()),s.unbind(e.getDoc())),s&&(s.unbind(t),s.unbind(e.getContainer()))}},Cse=e=>re(e)?{value:e.split(/[ ,]/),valid:!0}:De(e,re)?{value:e,valid:!0}:{valid:!1,message:"The value must be a string[] or a comma/space separated string."},_se=e=>{const t=(()=>{switch(e){case"array":return ae;case"boolean":return Ue;case"function":return Oe;case"number":return O;case"object":return Y;case"string":return re;case"string[]":return Cse;case"object[]":return s=>De(s,Y);case"regexp":return s=>se(s,RegExp);default:return an}})();return s=>WH(s,t,`The value must be a ${e}.`)},Tse=e=>re(e.processor),tW=(e,t)=>{const s=jr(t.message)?"":`. ${t.message}`;return e+s},nW=e=>e.valid,WH=(e,t,s="")=>{const a=t(e);return Ue(a)?a?{value:e,valid:!0}:{valid:!1,message:s}:a},Dse=(e,t,s)=>{if(!ot(t)){const a=WH(t,s);if(nW(a))return a.value;console.error(tW(`Invalid default value passed for the "${e}" option`,a))}},kse=(e,t)=>{const s={},a={},d=(te,ie,ye)=>{const Re=WH(ie,ye);return nW(Re)?(a[te]=Re.value,!0):(console.warn(tW(`Invalid value passed for the ${te} option`,Re)),!1)},p=(te,ie)=>{const ye=Tse(ie)?_se(ie.processor):ie.processor,Re=Dse(te,ie.default,ye);s[te]={...ie,default:Re,processor:ye},Gn(a,te).orThunk(()=>Gn(t,te)).each(Pe=>d(te,Pe,ye))},v=te=>yn(s,te);return{register:p,isRegistered:v,get:te=>Gn(a,te).orThunk(()=>Gn(s,te).map(ie=>ie.default)).getOrUndefined(),set:(te,ie)=>{if(v(te)){const ye=s[te];return ye.immutable?(console.error(`"${te}" is an immutable option and cannot be updated`),!1):d(te,ie,ye.processor)}else return console.warn(`"${te}" is not a registered option. Ensure the option has been registered before setting a value.`),!1},unset:te=>{const ie=v(te);return ie&&delete a[te],ie},isSet:te=>yn(a,te)}},Ase=["design","readonly"],oW=(e,t,s,a)=>{const d=s[t.get()],p=s[a];try{p.activate()}catch(v){console.error(`problem while activating editor mode ${a}:`,v);return}d.deactivate(),d.editorReadOnly!==p.editorReadOnly&&mse(e,p.editorReadOnly),t.set(a),FO(e,a)},Lse=(e,t,s,a)=>{if(a!==s.get()){if(!yn(t,a))throw new Error(`Editor mode '${a}' is invalid`);e.initialized?oW(e,s,t,a):e.on("init",()=>oW(e,s,t,a))}},Rse=(e,t,s)=>{if(to(Ase,t))throw new Error(`Cannot override default mode ${t}`);return{...e,[t]:{...s,deactivate:()=>{try{s.deactivate()}catch(a){console.error(`problem while deactivating editor mode ${t}:`,a)}}}}},Ose=e=>{const t=Ea("design"),s=Ea({design:{activate:Fe,deactivate:Fe,editorReadOnly:!1},readonly:{activate:Fe,deactivate:Fe,editorReadOnly:!0}});return pse(e),wse(e),{isReadOnly:()=>Vw(e),set:a=>Lse(e,s.get(),t,a),get:()=>t.get(),register:(a,d)=>{s.set(Rse(s.get(),a,d))}}},jH=hn.each,KH=hn.explode,Ise={f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123},sW=hn.makeMap("alt,ctrl,shift,meta,access"),Pse=e=>e in sW,Mse=e=>{const t={},s=gs.os.isMacOS()||gs.os.isiOS();jH(KH(e.toLowerCase(),"+"),p=>{Pse(p)?t[p]=!0:/^[0-9]{2,}$/.test(p)?t.keyCode=parseInt(p,10):(t.charCode=p.charCodeAt(0),t.keyCode=Ise[p]||p.toUpperCase().charCodeAt(0))});const a=[t.keyCode];let d;for(d in sW)t[d]?a.push(d):t[d]=!1;return t.id=a.join(","),t.access&&(t.alt=!0,s?t.ctrl=!0:t.shift=!0),t.meta&&(s?t.meta=!0:(t.ctrl=!0,t.meta=!1)),t};class rW{constructor(t){this.shortcuts={},this.pendingPatterns=[],this.editor=t;const s=this;t.on("keyup keypress keydown",a=>{(s.hasModifier(a)||s.isFunctionKey(a))&&!a.isDefaultPrevented()&&(jH(s.shortcuts,d=>{s.matchShortcut(a,d)&&(s.pendingPatterns=d.subpatterns.slice(0),a.type==="keydown"&&s.executeShortcutAction(d))}),s.matchShortcut(a,s.pendingPatterns[0])&&(s.pendingPatterns.length===1&&a.type==="keydown"&&s.executeShortcutAction(s.pendingPatterns[0]),s.pendingPatterns.shift()))})}add(t,s,a,d){const p=this,v=p.normalizeCommandFunc(a);return jH(KH(hn.trim(t)),C=>{const L=p.createShortcut(C,s,v,d);p.shortcuts[L.id]=L}),!0}remove(t){const s=this.createShortcut(t);return this.shortcuts[s.id]?(delete this.shortcuts[s.id],!0):!1}normalizeCommandFunc(t){const s=this,a=t;return typeof a=="string"?()=>{s.editor.execCommand(a,!1,null)}:hn.isArray(a)?()=>{s.editor.execCommand(a[0],a[1],a[2])}:a}createShortcut(t,s,a,d){const p=hn.map(KH(t,">"),Mse);return p[p.length-1]=hn.extend(p[p.length-1],{func:a,scope:d||this.editor}),hn.extend(p[0],{desc:this.editor.translate(s),subpatterns:p.slice(1)})}hasModifier(t){return t.altKey||t.ctrlKey||t.metaKey}isFunctionKey(t){return t.type==="keydown"&&t.keyCode>=112&&t.keyCode<=123}matchShortcut(t,s){return!s||s.ctrl!==t.ctrlKey||s.meta!==t.metaKey||s.alt!==t.altKey||s.shift!==t.shiftKey?!1:t.keyCode===s.keyCode||t.charCode&&t.charCode===s.charCode?(t.preventDefault(),!0):!1}executeShortcutAction(t){return t.func?t.func.call(t.scope):null}}const Nse=()=>{const e={},t={},s={},a={},d={},p={},v={},C={},L=(ee,te)=>(ie,ye)=>{ee[ie.toLowerCase()]={...ye,type:te}},G=(ee,te)=>a[ee.toLowerCase()]=te;return{addButton:L(e,"button"),addGroupToolbarButton:L(e,"grouptoolbarbutton"),addToggleButton:L(e,"togglebutton"),addMenuButton:L(e,"menubutton"),addSplitButton:L(e,"splitbutton"),addMenuItem:L(t,"menuitem"),addNestedMenuItem:L(t,"nestedmenuitem"),addToggleMenuItem:L(t,"togglemenuitem"),addAutocompleter:L(s,"autocompleter"),addContextMenu:L(d,"contextmenu"),addContextToolbar:L(p,"contexttoolbar"),addContextForm:L(p,"contextform"),addSidebar:L(v,"sidebar"),addView:L(C,"views"),addIcon:G,getAll:()=>({buttons:e,menuItems:t,icons:a,popups:s,contextMenus:d,contextToolbars:p,sidebars:v,views:C})}},Fse=()=>{const e=Nse();return{addAutocompleter:e.addAutocompleter,addButton:e.addButton,addContextForm:e.addContextForm,addContextMenu:e.addContextMenu,addContextToolbar:e.addContextToolbar,addIcon:e.addIcon,addMenuButton:e.addMenuButton,addMenuItem:e.addMenuItem,addNestedMenuItem:e.addNestedMenuItem,addSidebar:e.addSidebar,addSplitButton:e.addSplitButton,addToggleButton:e.addToggleButton,addGroupToolbarButton:e.addGroupToolbarButton,addToggleMenuItem:e.addToggleMenuItem,addView:e.addView,getAll:e.getAll}},Gw=js.DOM,iW=hn.extend,Bse=hn.each;class s4{constructor(t,s,a){this.plugins={},this.contentCSS=[],this.contentStyles=[],this.loadedCSS={},this.isNotDirty=!1,this.composing=!1,this.destroyed=!1,this.hasHiddenInput=!1,this.iframeElement=null,this.initialized=!1,this.readonly=!1,this.removed=!1,this.startContent="",this._pendingNativeEvents=[],this._skinLoaded=!1,this._editableRoot=!0,this.editorManager=a,this.documentBaseUrl=a.documentBaseURL,iW(this,eW);const d=this;this.id=t,this.hidden=!1;const p=woe(a.defaultOptions,s);this.options=kse(d,p),jS(d);const v=this.options.get;v("deprecation_warnings")&&wA(s,p);const C=v("suffix");C&&(a.suffix=C),this.suffix=a.suffix;const L=v("base_url");L&&a._setBaseUrl(L),this.baseUri=a.baseURI;const G=oy(d);G&&(uu.ScriptLoader._setReferrerPolicy(G),js.DOM.styleSheetLoader._setReferrerPolicy(G));const ee=IR(d);ve(ee)&&js.DOM.styleSheetLoader._setContentCssCors(ee),Al.languageLoad=v("language_load"),Al.baseURL=a.baseURL,this.setDirty(!1),this.documentBaseURI=new If(dd(d),{base_uri:this.baseUri}),this.baseURI=this.baseUri,this.inline=eb(d),this.hasVisual=Gu(d),this.shortcuts=new rW(this),this.editorCommands=new YG(this),ase(this);const te=v("cache_suffix");te&&(gs.cacheSuffix=te.replace(/^[\?\&]+/,"")),this.ui={registry:Fse(),styleSheetLoader:void 0,show:Fe,hide:Fe,setEnabled:Fe,isEnabled:an},this.mode=Ose(d),a.dispatch("SetupEditor",{editor:this});const ie=ax(d);Oe(ie)&&ie.call(d,d)}render(){ioe(this)}focus(t){this.execCommand("mceFocus",!1,t)}hasFocus(){return gb(this)}translate(t){return Bu.translate(t)}getParam(t,s,a){const d=this.options;return d.isRegistered(t)||(ve(a)?d.register(t,{processor:a,default:s}):d.register(t,{processor:an,default:s})),!d.isSet(t)&&!ot(s)?s:d.get(t)}hasPlugin(t,s){return to(Tf(this),t)?s?zx.get(t)!==void 0:!0:!1}nodeChanged(t){this._nodeChangeDispatcher.nodeChanged(t)}addCommand(t,s,a){this.editorCommands.addCommand(t,s,a)}addQueryStateHandler(t,s,a){this.editorCommands.addQueryStateHandler(t,s,a)}addQueryValueHandler(t,s,a){this.editorCommands.addQueryValueHandler(t,s,a)}addShortcut(t,s,a,d){this.shortcuts.add(t,s,a,d)}execCommand(t,s,a,d){return this.editorCommands.execCommand(t,s,a,d)}queryCommandState(t){return this.editorCommands.queryCommandState(t)}queryCommandValue(t){return this.editorCommands.queryCommandValue(t)}queryCommandSupported(t){return this.editorCommands.queryCommandSupported(t)}show(){const t=this;t.hidden&&(t.hidden=!1,t.inline?t.getBody().contentEditable="true":(Gw.show(t.getContainer()),Gw.hide(t.id)),t.load(),t.dispatch("show"))}hide(){const t=this;t.hidden||(t.save(),t.inline?(t.getBody().contentEditable="false",t===t.editorManager.focusedEditor&&(t.editorManager.focusedEditor=null)):(Gw.hide(t.getContainer()),Gw.setStyle(t.id,"display",t.orgDisplay)),t.hidden=!0,t.dispatch("hide"))}isHidden(){return this.hidden}setProgressState(t,s){this.dispatch("ProgressState",{state:t,time:s})}load(t={}){const s=this,a=s.getElement();if(s.removed)return"";if(a){const d={...t,load:!0},p=ng(a)?a.value:a.innerHTML,v=s.setContent(p,d);return d.no_events||s.dispatch("LoadContent",{...d,element:a}),v}else return""}save(t={}){const s=this;let a=s.getElement();if(!a||!s.initialized||s.removed)return"";const d={...t,save:!0,element:a};let p=s.getContent(d);const v={...d,content:p};if(v.no_events||s.dispatch("SaveContent",v),v.format==="raw"&&s.dispatch("RawSaveContent",v),p=v.content,ng(a))a.value=p;else{(t.is_removing||!s.inline)&&(a.innerHTML=p);const C=Gw.getParent(s.id,"form");C&&Bse(C.elements,L=>L.name===s.id?(L.value=p,!1):!0)}return v.element=d.element=a=null,v.set_dirty!==!1&&s.setDirty(!1),p}setContent(t,s){return xA(this,t,s)}getContent(t){return AN(this,t)}insertContent(t,s){s&&(t=iW({content:t},s)),this.execCommand("mceInsertContent",!1,t)}resetContent(t){t===void 0?xA(this,this.startContent,{format:"raw"}):xA(this,t),this.undoManager.reset(),this.setDirty(!1),this.nodeChanged()}isDirty(){return!this.isNotDirty}setDirty(t){const s=!this.isNotDirty;this.isNotDirty=!t,t&&t!==s&&this.dispatch("dirty")}getContainer(){const t=this;return t.container||(t.container=t.editorContainer||Gw.get(t.id+"_parent")),t.container}getContentAreaContainer(){return this.contentAreaContainer}getElement(){return this.targetElm||(this.targetElm=Gw.get(this.id)),this.targetElm}getWin(){const t=this;if(!t.contentWindow){const s=t.iframeElement;s&&(t.contentWindow=s.contentWindow)}return t.contentWindow}getDoc(){const t=this;if(!t.contentDocument){const s=t.getWin();s&&(t.contentDocument=s.document)}return t.contentDocument}getBody(){var t,s;const a=this.getDoc();return(s=(t=this.bodyElement)!==null&&t!==void 0?t:a==null?void 0:a.body)!==null&&s!==void 0?s:null}convertURL(t,s,a){const d=this,p=d.options.get,v=t5(d);if(Oe(v))return v.call(d,t,a,!0,s);if(!p("convert_urls")||a==="link"||Y(a)&&a.nodeName==="LINK"||t.indexOf("file:")===0||t.length===0)return t;const C=new If(t);return C.protocol!=="http"&&C.protocol!=="https"&&C.protocol!==""?t:p("relative_urls")?d.documentBaseURI.toRelative(t):(t=d.documentBaseURI.toAbsolute(t,p("remove_script_host")),t)}addVisual(t){Soe(this,t)}setEditableRoot(t){aoe(this,t)}hasEditableRoot(){return loe(this)}remove(){Ew(this)}destroy(t){k$(this,t)}uploadImages(){return this.editorUpload.uploadImages()}_scanForImages(){return this.editorUpload.scanForImages()}}const j_=js.DOM,r4=hn.each;let aW=!1,i4,Dd=[];const a4=e=>{const t=e.type;r4(e1.get(),s=>{switch(t){case"scroll":s.dispatch("ScrollWindow",e);break;case"resize":s.dispatch("ResizeWindow",e);break}})},lW=e=>{if(e!==aW){const t=js.DOM;e?(t.bind(window,"resize",a4),t.bind(window,"scroll",a4)):(t.unbind(window,"resize",a4),t.unbind(window,"scroll",a4)),aW=e}},cW=e=>{const t=Dd;return Dd=Ct(Dd,s=>e!==s),e1.activeEditor===e&&(e1.activeEditor=Dd.length>0?Dd[0]:null),e1.focusedEditor===e&&(e1.focusedEditor=null),t.length!==Dd.length},$se=e=>{e&&e.initialized&&!(e.getContainer()||e.getBody()).parentNode&&(cW(e),e.unbindAllNativeEvents(),e.destroy(!0),e.removed=!0)},Hse=document.compatMode!=="CSS1Compat",e1={...GH,baseURI:null,baseURL:null,defaultOptions:{},documentBaseURL:null,suffix:null,majorVersion:"7",minorVersion:"1.2",releaseDate:"TBD",i18n:Bu,activeEditor:null,focusedEditor:null,setup(){const e=this;let t="",s="",a=If.getDocumentBaseUrl(document.location);/^[^:]+:\/\/\/?[^\/]+\//.test(a)&&(a=a.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(a)||(a+="/"));const d=window.tinymce||window.tinyMCEPreInit;if(d)t=d.base||d.baseURL,s=d.suffix;else{const p=document.getElementsByTagName("script");for(let v=0;v<p.length;v++){const C=p[v].src||"";if(C==="")continue;const L=C.substring(C.lastIndexOf("/"));if(/tinymce(\.full|\.jquery|)(\.min|\.dev|)\.js/.test(C)){L.indexOf(".min")!==-1&&(s=".min"),t=C.substring(0,C.lastIndexOf("/"));break}}if(!t&&document.currentScript){const v=document.currentScript.src;v.indexOf(".min")!==-1&&(s=".min"),t=v.substring(0,v.lastIndexOf("/"))}}e.baseURL=new If(a).toAbsolute(t),e.documentBaseURL=a,e.baseURI=new If(e.baseURL),e.suffix=s,r6(e)},overrideDefaults(e){const t=e.base_url;t&&this._setBaseUrl(t);const s=e.suffix;s&&(this.suffix=s),this.defaultOptions=e;const a=e.plugin_base_urls;a!==void 0&&qo(a,(d,p)=>{Al.PluginManager.urls[p]=d})},init(e){const t=this;let s;const a=hn.makeMap("area base basefont br col frame hr img input isindex link meta param embed source wbr track colgroup option table tbody tfoot thead tr th td script noscript style textarea video audio iframe object menu"," "),d=(ee,te)=>ee.inline&&te.tagName.toLowerCase()in a,p=ee=>{let te=ee.id;return te||(te=Gn(ee,"name").filter(ie=>!j_.get(ie)).getOrThunk(j_.uniqueId),ee.setAttribute("id",te)),te},v=ee=>{const te=e[ee];if(te)return te.apply(t,[])},C=ee=>gs.browser.isIE()||gs.browser.isEdge()?(Gx("TinyMCE does not support the browser you are using. For a list of supported browsers please see: https://www.tiny.cloud/docs/tinymce/7/support/#supportedwebbrowsers"),[]):Hse?(Gx("Failed to initialize the editor as the document is not in standards mode. TinyMCE requires standards mode."),[]):re(ee.selector)?j_.select(ee.selector):ve(ee.target)?[ee.target]:[];let L=ee=>{s=ee};const G=()=>{let ee=0;const te=[];let ie;const ye=(Re,Se,Pe)=>{const Je=new s4(Re,Se,t);te.push(Je),Je.on("init",()=>{++ee===ie.length&&L(te)}),Je.targetElm=Je.targetElm||Pe,Je.render()};j_.unbind(window,"ready",G),v("onpageload"),ie=kr(C(e)),hn.each(ie,Re=>{$se(t.get(Re.id))}),ie=hn.grep(ie,Re=>!t.get(Re.id)),ie.length===0?L([]):r4(ie,Re=>{d(e,Re)?Gx("Could not initialize inline editor on invalid inline target element",Re):ye(p(Re),e,Re)})};return j_.bind(window,"ready",G),new Promise(ee=>{s?ee(s):L=te=>{ee(te)}})},get(e){return arguments.length===0?Dd.slice(0):re(e)?Qt(Dd,t=>t.id===e).getOr(null):O(e)&&Dd[e]?Dd[e]:null},add(e){const t=this,s=t.get(e.id);return s===e||(s===null&&Dd.push(e),lW(!0),t.activeEditor=e,t.dispatch("AddEditor",{editor:e}),i4||(i4=a=>{const d=t.dispatch("BeforeUnload");if(d.returnValue)return a.preventDefault(),a.returnValue=d.returnValue,d.returnValue},window.addEventListener("beforeunload",i4))),e},createEditor(e,t){return this.add(new s4(e,t,this))},remove(e){const t=this;let s;if(!e){for(let a=Dd.length-1;a>=0;a--)t.remove(Dd[a]);return}if(re(e)){r4(j_.select(e),a=>{s=t.get(a.id),s&&t.remove(s)});return}return s=e,Ce(t.get(s.id))?null:(cW(s)&&t.dispatch("RemoveEditor",{editor:s}),Dd.length===0&&window.removeEventListener("beforeunload",i4),s.remove(),lW(Dd.length>0),s)},execCommand(e,t,s){var a;const d=this,p=Y(s)?(a=s.id)!==null&&a!==void 0?a:s.index:s;switch(e){case"mceAddEditor":{if(!d.get(p)){const v=s.options;new s4(p,v,d).render()}return!0}case"mceRemoveEditor":{const v=d.get(p);return v&&v.remove(),!0}case"mceToggleEditor":{const v=d.get(p);return v?(v.isHidden()?v.show():v.hide(),!0):(d.execCommand("mceAddEditor",!1,s),!0)}}return d.activeEditor?d.activeEditor.execCommand(e,t,s):!1},triggerSave:()=>{r4(Dd,e=>{e.save()})},addI18n:(e,t)=>{Bu.add(e,t)},translate:e=>Bu.translate(e),setActive(e){const t=this.activeEditor;this.activeEditor!==e&&(t&&t.dispatch("deactivate",{relatedTarget:e}),e.dispatch("activate",{relatedTarget:t})),this.activeEditor=e},_setBaseUrl(e){this.baseURL=new If(this.documentBaseURL).toAbsolute(e.replace(/\/+$/,"")),this.baseURI=new If(this.baseURL)}};e1.setup();const Use=(()=>{const e=tn(),t=p=>({items:p,types:Yt(p),getType:v=>Gn(p,v).getOrUndefined()}),s=p=>{e.set(p)},a=()=>e.get().getOrUndefined(),d=e.clear;return{FakeClipboardItem:t,write:s,read:a,clear:d}})(),uW=Math.min,K_=Math.max,l4=Math.round,dW=(e,t,s)=>{let a=t.x,d=t.y;const p=e.w,v=e.h,C=t.w,L=t.h,G=(s||"").split("");return G[0]==="b"&&(d+=L),G[1]==="r"&&(a+=C),G[0]==="c"&&(d+=l4(L/2)),G[1]==="c"&&(a+=l4(C/2)),G[3]==="b"&&(d-=v),G[4]==="r"&&(a-=p),G[3]==="c"&&(d-=l4(v/2)),G[4]==="c"&&(a-=l4(p/2)),Z_(a,d,p,v)},Vse=(e,t,s,a)=>{for(let d=0;d<a.length;d++){const p=dW(e,t,a[d]);if(p.x>=s.x&&p.x+p.w<=s.w+s.x&&p.y>=s.y&&p.y+p.h<=s.h+s.y)return a[d]}return null},zse=(e,t,s)=>Z_(e.x-t,e.y-s,e.w+t*2,e.h+s*2),Gse=(e,t)=>{const s=K_(e.x,t.x),a=K_(e.y,t.y),d=uW(e.x+e.w,t.x+t.w),p=uW(e.y+e.h,t.y+t.h);return d-s<0||p-a<0?null:Z_(s,a,d-s,p-a)},Wse=(e,t,s)=>{let a=e.x,d=e.y,p=e.x+e.w,v=e.y+e.h;const C=t.x+t.w,L=t.y+t.h,G=K_(0,t.x-a),ee=K_(0,t.y-d),te=K_(0,p-C),ie=K_(0,v-L);return a+=G,d+=ee,s&&(p+=G,v+=ee,a-=te,d-=ie),p-=te,v-=ie,Z_(a,d,p-a,v-d)},Z_=(e,t,s,a)=>({x:e,y:t,w:s,h:a}),jse={inflate:zse,relativePosition:dW,findBestRelativePosition:Vse,intersect:Gse,clamp:Wse,create:Z_,fromClientRect:e=>Z_(e.left,e.top,e.width,e.height)},Kse=(e,t,s=1e3)=>{let a=!1,d=null;const p=G=>(...ee)=>{a||(a=!0,d!==null&&(clearTimeout(d),d=null),G.apply(null,ee))},v=p(e),C=p(t);return{start:(...G)=>{!a&&d===null&&(d=setTimeout(()=>C.apply(null,G),s))},resolve:v,reject:C}},Zse=(()=>{const e={},t={},s={};return{load:(L,G)=>{const ee=`Script at URL "${G}" failed to load`,te=`Script at URL "${G}" did not call \`tinymce.Resource.add('${L}', data)\` within 1 second`;if(e[L]!==void 0)return e[L];{const ie=new Promise((ye,Re)=>{const Se=Kse(ye,Re);t[L]=Se.resolve,uu.ScriptLoader.loadScript(G).then(()=>Se.start(te),()=>Se.reject(ee))});return e[L]=ie,ie}},add:(L,G)=>{t[L]!==void 0&&(t[L](G),delete t[L]),e[L]=Promise.resolve(G),s[L]=G},has:L=>L in s,get:L=>s[L],unload:L=>{delete e[L],delete s[L]}}})(),qse=()=>(()=>{let e={},t=[];const s={getItem:a=>{const d=e[a];return d||null},setItem:(a,d)=>{t.push(a),e[a]=String(d)},key:a=>t[a],removeItem:a=>{t=t.filter(d=>d===a),delete e[a]},clear:()=>{t=[],e={}},length:0};return Object.defineProperty(s,"length",{get:()=>t.length,configurable:!1,enumerable:!1}),s})();let kL;try{const e="__storage_test__";kL=window.localStorage,kL.setItem(e,e),kL.removeItem(e)}catch{kL=qse()}var Yse=kL;const Xse={geom:{Rect:jse},util:{Delay:Ku,Tools:hn,VK:Pn,URI:If,EventDispatcher:zH,Observable:GH,I18n:Bu,LocalStorage:Yse,ImageUploader:U$},dom:{EventUtils:Qi,TreeWalker:bn,TextSeeker:Yf,DOMUtils:js,ScriptLoader:uu,RangeUtils:Og,Serializer:yw,StyleSheetLoader:zm,ControlSelection:Er,BookmarkManager:Mr,Selection:c_,Event:Qi.Event},html:{Styles:P1,Entities:Hh,Node:vl,Schema:Vh,DomParser:Ob,Writer:mD,Serializer:yp},Env:gs,AddOnManager:Al,Annotator:NO,Formatter:kw,UndoManager:v_,EditorCommands:YG,WindowManager:DA,NotificationManager:_A,EditorObservable:eW,Shortcuts:rW,Editor:s4,FocusManager:zy,EditorManager:e1,DOM:js.DOM,ScriptLoader:uu.ScriptLoader,PluginManager:zx,ThemeManager:Xg,ModelManager:Mb,IconManager:Pb,Resource:Zse,FakeClipboard:Use,trim:hn.trim,isArray:hn.isArray,is:hn.is,toArray:hn.toArray,makeMap:hn.makeMap,each:hn.each,map:hn.map,grep:hn.grep,inArray:hn.inArray,extend:hn.extend,walk:hn.walk,resolve:hn.resolve,explode:hn.explode,_addCacheSuffix:hn._addCacheSuffix},fW=hn.extend(e1,Xse),Jse=e=>{try{l.exports=e}catch{}};(e=>{window.tinymce=e,window.tinyMCE=e})(fW),Jse(fW)})()})(wY);var Qme=wY.exports;const ZU=rre(Qme);tinymce.IconManager.add("default",{icons:{"accessibility-check":'<svg width="24" height="24"><path d="M12 2a2 2 0 0 1 2 2 2 2 0 0 1-2 2 2 2 0 0 1-2-2c0-1.1.9-2 2-2Zm8 7h-5v12c0 .6-.4 1-1 1a1 1 0 0 1-1-1v-5c0-.6-.4-1-1-1a1 1 0 0 0-1 1v5c0 .6-.4 1-1 1a1 1 0 0 1-1-1V9H4a1 1 0 1 1 0-2h16c.6 0 1 .4 1 1s-.4 1-1 1Z" fill-rule="nonzero"/></svg>',"accordion-toggle":'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 15c0-.6.4-1 1-1h6c.6 0 1 .4 1 1s-.4 1-1 1h-6a1 1 0 0 1-1-1Z"/><path opacity=".2" fill-rule="evenodd" clip-rule="evenodd" d="M4 15c0-.6.4-1 1-1h6c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1-1-1Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M12 19c0-.6.4-1 1-1h6c.6 0 1 .4 1 1s-.4 1-1 1h-6a1 1 0 0 1-1-1Z"/><path opacity=".2" fill-rule="evenodd" clip-rule="evenodd" d="M4 19c0-.6.4-1 1-1h6c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1-1-1Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M12.3 7.3a1 1 0 0 1 1.4 0L16 9.6l2.3-2.3a1 1 0 1 1 1.4 1.4L16 12.4l-3.7-3.7a1 1 0 0 1 0-1.4ZM4.3 11.7a1 1 0 0 1 0-1.4L6.6 8 4.3 5.7a1 1 0 0 1 1.4-1.4L9.4 8l-3.7 3.7a1 1 0 0 1-1.4 0Z"/></svg>',accordion:'<svg width="24" height="24"><rect x="12" y="7" width="10" height="2" rx="1"/><rect x="12" y="11" width="10" height="2" rx="1"/><rect x="12" y="15" width="6" height="2" rx="1"/><path fill-rule="evenodd" clip-rule="evenodd" d="M2.3 7.3a1 1 0 0 1 1.4 0L6 9.6l2.3-2.3a1 1 0 0 1 1.4 1.4L6 12.4 2.3 8.7a1 1 0 0 1 0-1.4Z"/></svg>',"action-next":'<svg width="24" height="24"><path fill-rule="nonzero" d="M5.7 7.3a1 1 0 0 0-1.4 1.4l7.7 7.7 7.7-7.7a1 1 0 1 0-1.4-1.4L12 13.6 5.7 7.3Z"/></svg>',"action-prev":'<svg width="24" height="24"><path fill-rule="nonzero" d="M18.3 15.7a1 1 0 0 0 1.4-1.4L12 6.6l-7.7 7.7a1 1 0 0 0 1.4 1.4L12 9.4l6.3 6.3Z"/></svg>',addtag:'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M15 5a2 2 0 0 1 1.6.8L21 12l-4.4 6.2a2 2 0 0 1-1.6.8h-3v-2h3l3.5-5L15 7H5v3H3V7c0-1.1.9-2 2-2h10Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M6 12a1 1 0 0 0-1 1v2H3a1 1 0 1 0 0 2h2v2a1 1 0 1 0 2 0v-2h2a1 1 0 1 0 0-2H7v-2c0-.6-.4-1-1-1Z"/></svg>',"ai-prompt":'<svg width="24" height="24"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M15 6.7a1 1 0 0 0-1.4 0l-9.9 10a1 1 0 0 0 0 1.3l2.1 2.1c.4.4 1 .4 1.4 0l10-9.9c.3-.3.3-1 0-1.4l-2.2-2Zm1.4 2.8-2-2-3 2.7 2.2 2.2 2.8-2.9Z"/><path d="m18.5 7.3-.7-1.5-1.5-.8 1.5-.7.7-1.5.7 1.5 1.5.7-1.5.8-.7 1.5ZM18.5 16.5l-.7-1.6-1.5-.7 1.5-.7.7-1.6.7 1.6 1.5.7-1.5.7-.7 1.6ZM9.7 7.3 9 5.8 7.5 5 9 4.3l.7-1.5.7 1.5L12 5l-1.5.8-.7 1.5Z"/></g><defs><clipPath id="a"><path d="M0 0h24v24H0z"/></clipPath></defs></svg>',ai:'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M5 3a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3V6a3 3 0 0 0-3-3H5Zm6.8 11.5.5 1.2a68.3 68.3 0 0 0 .7 1.1l.4.1c.3 0 .5 0 .7-.3.2-.1.3-.3.3-.6l-.3-1-2.6-6.2a20.4 20.4 0 0 0-.5-1.3l-.5-.4-.7-.2c-.2 0-.5 0-.6.2-.2 0-.4.2-.5.4l-.3.6-.3.7L5.7 15l-.2.6-.1.4c0 .3 0 .5.3.7l.6.2c.3 0 .5 0 .7-.2l.4-1 .5-1.2h3.9ZM9.8 9l1.5 4h-3l1.5-4Zm5.6-.9v7.6c0 .4 0 .7.2 1l.7.2c.3 0 .6 0 .8-.3l.2-.9V8.1c0-.4 0-.7-.2-.9a1 1 0 0 0-.8-.3c-.2 0-.5.1-.7.3l-.2 1Z"/></svg>',"align-center":'<svg width="24" height="24"><path d="M5 5h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2Zm3 4h8c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 1 1 0-2Zm0 8h8c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 0 1 0-2Zm-3-4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2Z" fill-rule="evenodd"/></svg>',"align-justify":'<svg width="24" height="24"><path d="M5 5h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2Zm0 4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2Zm0 4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2Zm0 4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2Z" fill-rule="evenodd"/></svg>',"align-left":'<svg width="24" height="24"><path d="M5 5h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2Zm0 4h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2Zm0 8h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2Zm0-4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2Z" fill-rule="evenodd"/></svg>',"align-none":'<svg width="24" height="24"><path d="M14.2 5 13 7H5a1 1 0 1 1 0-2h9.2Zm4 0h.8a1 1 0 0 1 0 2h-2l1.2-2Zm-6.4 4-1.2 2H5a1 1 0 0 1 0-2h6.8Zm4 0H19a1 1 0 0 1 0 2h-4.4l1.2-2Zm-6.4 4-1.2 2H5a1 1 0 0 1 0-2h4.4Zm4 0H19a1 1 0 0 1 0 2h-6.8l1.2-2ZM7 17l-1.2 2H5a1 1 0 0 1 0-2h2Zm4 0h8a1 1 0 0 1 0 2H9.8l1.2-2Zm5.2-13.5 1.3.7-9.7 16.3-1.3-.7 9.7-16.3Z" fill-rule="evenodd"/></svg>',"align-right":'<svg width="24" height="24"><path d="M5 5h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2Zm6 4h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0 8h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm-6-4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2Z" fill-rule="evenodd"/></svg>',"arrow-left":'<svg width="24" height="24"><path d="m5.6 13 12 6a1 1 0 0 0 1.4-1V6a1 1 0 0 0-1.4-.9l-12 6a1 1 0 0 0 0 1.8Z" fill-rule="evenodd"/></svg>',"arrow-right":'<svg width="24" height="24"><path d="m18.5 13-12 6A1 1 0 0 1 5 18V6a1 1 0 0 1 1.4-.9l12 6a1 1 0 0 1 0 1.8Z" fill-rule="evenodd"/></svg>',bold:'<svg width="24" height="24"><path d="M7.8 19c-.3 0-.5 0-.6-.2l-.2-.5V5.7c0-.2 0-.4.2-.5l.6-.2h5c1.5 0 2.7.3 3.5 1 .7.6 1.1 1.4 1.1 2.5a3 3 0 0 1-.6 1.9c-.4.6-1 1-1.6 1.2.4.1.9.3 1.3.6s.8.7 1 1.2c.4.4.5 1 .5 1.6 0 1.3-.4 2.3-1.3 3-.8.7-2.1 1-3.8 1H7.8Zm5-8.3c.6 0 1.2-.1 1.6-.5.4-.3.6-.7.6-1.3 0-1.1-.8-1.7-2.3-1.7H9.3v3.5h3.4Zm.5 6c.7 0 1.3-.1 1.7-.4.4-.4.6-.9.6-1.5s-.2-1-.7-1.4c-.4-.3-1-.4-2-.4H9.4v3.8h4Z" fill-rule="evenodd"/></svg>',bookmark:'<svg width="24" height="24"><path d="M6 4v17l6-4 6 4V4c0-.6-.4-1-1-1H7a1 1 0 0 0-1 1Z" fill-rule="nonzero"/></svg>',"border-style":'<svg width="24" height="24"><g fill-rule="evenodd"><rect width="18" height="2" x="3" y="6" rx="1"/><rect width="2.8" height="2" x="3" y="16" rx="1"/><rect width="2.8" height="2" x="6.8" y="16" rx="1"/><rect width="2.8" height="2" x="10.6" y="16" rx="1"/><rect width="2.8" height="2" x="14.4" y="16" rx="1"/><rect width="2.8" height="2" x="18.2" y="16" rx="1"/><rect width="8" height="2" x="3" y="11" rx="1"/><rect width="8" height="2" x="13" y="11" rx="1"/></g></svg>',"border-width":'<svg width="24" height="24"><g fill-rule="evenodd"><rect width="18" height="5" x="3" y="5" rx="1"/><rect width="18" height="3.5" x="3" y="11.5" rx="1"/><rect width="18" height="2" x="3" y="17" rx="1"/></g></svg>',brightness:'<svg width="24" height="24"><path d="M12 17c.3 0 .5.1.7.3.2.2.3.4.3.7v1c0 .3-.1.5-.3.7a1 1 0 0 1-.7.3 1 1 0 0 1-.7-.3 1 1 0 0 1-.3-.7v-1c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3Zm0-10a1 1 0 0 1-.7-.3A1 1 0 0 1 11 6V5c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3.3 0 .5.1.7.3.2.2.3.4.3.7v1c0 .3-.1.5-.3.7a1 1 0 0 1-.7.3Zm7 4c.3 0 .5.1.7.3.2.2.3.4.3.7 0 .3-.1.5-.3.7a1 1 0 0 1-.7.3h-1a1 1 0 0 1-.7-.3 1 1 0 0 1-.3-.7c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h1ZM7 12c0 .3-.1.5-.3.7a1 1 0 0 1-.7.3H5a1 1 0 0 1-.7-.3A1 1 0 0 1 4 12c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h1c.3 0 .5.1.7.3.2.2.3.4.3.7Zm10 3.5.7.8c.2.1.3.4.3.6 0 .3-.1.6-.3.8a1 1 0 0 1-.8.3 1 1 0 0 1-.6-.3l-.8-.7a1 1 0 0 1-.3-.8c0-.2.1-.5.3-.7a1 1 0 0 1 1.4 0Zm-10-7-.7-.8a1 1 0 0 1-.3-.6c0-.3.1-.6.3-.8.2-.2.5-.3.8-.3.2 0 .5.1.7.3l.7.7c.2.2.3.5.3.8 0 .2-.1.5-.3.7a1 1 0 0 1-.7.3 1 1 0 0 1-.8-.3Zm10 0a1 1 0 0 1-.8.3 1 1 0 0 1-.7-.3 1 1 0 0 1-.3-.7c0-.3.1-.6.3-.8l.8-.7c.1-.2.4-.3.6-.3.3 0 .6.1.8.3.2.2.3.5.3.8 0 .2-.1.5-.3.7l-.7.7Zm-10 7c.2-.2.5-.3.8-.3.2 0 .5.1.7.3a1 1 0 0 1 0 1.4l-.8.8a1 1 0 0 1-.6.3 1 1 0 0 1-.8-.3 1 1 0 0 1-.3-.8c0-.2.1-.5.3-.6l.7-.8ZM12 8a4 4 0 0 1 3.7 2.4 4 4 0 0 1 0 3.2A4 4 0 0 1 12 16a4 4 0 0 1-3.7-2.4 4 4 0 0 1 0-3.2A4 4 0 0 1 12 8Zm0 6.5c.7 0 1.3-.2 1.8-.7.5-.5.7-1.1.7-1.8s-.2-1.3-.7-1.8c-.5-.5-1.1-.7-1.8-.7s-1.3.2-1.8.7c-.5.5-.7 1.1-.7 1.8s.2 1.3.7 1.8c.5.5 1.1.7 1.8.7Z" fill-rule="evenodd"/></svg>',browse:'<svg width="24" height="24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-4v-2h4V8H5v10h4v2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 9.4-2.3 2.3a1 1 0 1 1-1.4-1.4l4-4a1 1 0 0 1 1.4 0l4 4a1 1 0 0 1-1.4 1.4L13 13.4V20a1 1 0 0 1-2 0v-6.6Z" fill-rule="nonzero"/></svg>',cancel:'<svg width="24" height="24"><path d="M12 4.6a7.4 7.4 0 1 1 0 14.8 7.4 7.4 0 0 1 0-14.8ZM12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18Zm0 8L14.8 8l1 1.1-2.7 2.8 2.7 2.7-1.1 1.1-2.7-2.7-2.7 2.7-1-1.1 2.6-2.7-2.7-2.7 1-1.1 2.8 2.7Z" fill-rule="nonzero"/></svg>',"cell-background-color":'<svg width="24" height="24"><path d="m15.7 2 1.6 1.6-2.7 2.6 5.9 5.8c.7.7.7 1.7 0 2.4l-6.3 6.1a1.7 1.7 0 0 1-2.4 0l-6.3-6.1c-.7-.7-.7-1.7 0-2.4L15.7 2ZM18 12l-4.5-4L9 12h9ZM4 16s2 2.4 2 3.8C6 21 5.1 22 4 22s-2-1-2-2.2C2 18.4 4 16 4 16Z"/></svg>',"cell-border-color":'<svg width="24" height="24"><g fill-rule="evenodd"><path fill-rule="nonzero" d="M5 13v5h2v2H5a2 2 0 0 1-2-2v-5h2zm8-7V4h6a2 2 0 0 1 2 2h-8z" opacity=".2"/><path fill-rule="nonzero" d="M13 4v2H5v7H3V6c0-1.1.9-2 2-2h8zm-2.6 14.1.1-.1.1.1.2.3.2.2.2.2c.4.6.8 1.2.8 1.7 0 .8-.7 1.5-1.5 1.5S9 21.3 9 20.5c0-.5.4-1.1.8-1.7l.2-.2.2-.2.2-.3z"/><path d="m13 11-2 2H5v-2h6V6h2z"/><path fill-rule="nonzero" d="m18.4 8 1 1-1.8 1.9 4 4c.5.4.5 1.1 0 1.6l-4.3 4.2a1.2 1.2 0 0 1-1.6 0l-4.4-4.2c-.4-.5-.4-1.2 0-1.7l7-6.8Zm1.6 7-3-3-3 3h6Z"/></g></svg>',"change-case":'<svg width="24" height="24"><path d="M18.4 18.2v-.6c-.5.8-1.3 1.2-2.4 1.2-2.2 0-3.3-1.6-3.3-4.8 0-3.1 1-4.7 3.3-4.7 1.1 0 1.8.3 2.4 1.1v-.6c0-.5.4-.8.8-.8s.8.3.8.8v8.4c0 .5-.4.8-.8.8a.8.8 0 0 1-.8-.8zm-2-7.4c-1.3 0-1.8.9-1.8 3.2 0 2.4.5 3.3 1.7 3.3 1.3 0 1.8-.9 1.8-3.2 0-2.4-.5-3.3-1.7-3.3zM10 15.7H5.5l-.8 2.6a1 1 0 0 1-1 .7h-.2a.7.7 0 0 1-.7-1l4-12a1 1 0 0 1 2 0l4 12a.7.7 0 0 1-.8 1h-.2a1 1 0 0 1-1-.7l-.8-2.6zm-.3-1.5-2-6.5-1.9 6.5h3.9z" fill-rule="evenodd"/></svg>',"character-count":'<svg width="24" height="24"><path d="M4 11.5h16v1H4v-1Zm4.8-6.8V10H7.7V5.8h-1v-1h2ZM11 8.3V9h2v1h-3V7.7l2-1v-.9h-2v-1h3v2.4l-2 1Zm6.3-3.4V10h-3.1V9h2.1V8h-2.1V6.8h2.1v-1h-2.1v-1h3.1ZM5.8 16.4c0-.5.2-.8.5-1 .2-.2.6-.3 1.2-.3l.8.1c.2 0 .4.2.5.3l.4.4v2.8l.2.3H8.2V18.7l-.6.3H7c-.4 0-.7 0-1-.2a1 1 0 0 1-.3-.9c0-.3 0-.6.3-.8.3-.2.7-.4 1.2-.4l.6-.2h.3v-.2l-.1-.2a.8.8 0 0 0-.5-.1 1 1 0 0 0-.4 0l-.3.4h-1Zm2.3.8h-.2l-.2.1-.4.1a1 1 0 0 0-.4.2l-.2.2.1.3.5.1h.4l.4-.4v-.6Zm2-3.4h1.2v1.7l.5-.3h.5c.5 0 .9.1 1.2.5.3.4.5.8.5 1.4 0 .6-.2 1.1-.5 1.5-.3.4-.7.6-1.3.6l-.6-.1-.4-.4v.4h-1.1v-5.4Zm1.1 3.3c0 .3 0 .6.2.8a.7.7 0 0 0 1.2 0l.2-.8c0-.4 0-.6-.2-.8a.7.7 0 0 0-.6-.3l-.6.3-.2.8Zm6.1-.5c0-.2 0-.3-.2-.4a.8.8 0 0 0-.5-.2c-.3 0-.5.1-.6.3l-.2.9c0 .3 0 .6.2.8.1.2.3.3.6.3.2 0 .4 0 .5-.2l.2-.4h1.1c0 .5-.3.8-.6 1.1a2 2 0 0 1-1.3.4c-.5 0-1-.2-1.3-.6a2 2 0 0 1-.5-1.4c0-.6.1-1.1.5-1.5.3-.4.8-.5 1.4-.5.5 0 1 0 1.2.3.4.3.5.7.5 1.2h-1v-.1Z" fill-rule="evenodd"/></svg>',"checklist-rtl":'<svg width="24" height="24"><path d="M5 17h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2zm14.2 11c.2-.4.6-.5.9-.3.3.2.4.6.2 1L18 20c-.2.3-.7.4-1 0l-1.3-1.3a.7.7 0 0 1 0-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8zm0-6c.2-.4.6-.5.9-.3.3.2.4.6.2 1L18 14c-.2.3-.7.4-1 0l-1.3-1.3a.7.7 0 0 1 0-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8zm0-6c.2-.4.6-.5.9-.3.3.2.4.6.2 1L18 8c-.2.3-.7.4-1 0l-1.3-1.3a.7.7 0 0 1 0-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8z" fill-rule="evenodd"/></svg>',checklist:'<svg width="24" height="24"><path d="M11 17h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0-6h8a1 1 0 0 1 0 2h-8a1 1 0 0 1 0-2ZM7.2 16c.2-.4.6-.5.9-.3.3.2.4.6.2 1L6 20c-.2.3-.7.4-1 0l-1.3-1.3a.7.7 0 0 1 0-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8Zm0-6c.2-.4.6-.5.9-.3.3.2.4.6.2 1L6 14c-.2.3-.7.4-1 0l-1.3-1.3a.7.7 0 0 1 0-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8Zm0-6c.2-.4.6-.5.9-.3.3.2.4.6.2 1L6 8c-.2.3-.7.4-1 0L3.8 6.9a.7.7 0 0 1 0-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8Z" fill-rule="evenodd"/></svg>',checkmark:'<svg width="24" height="24"><path d="M18.2 5.4a1 1 0 0 1 1.6 1.2l-8 12a1 1 0 0 1-1.5.1l-5-5a1 1 0 1 1 1.4-1.4l4.1 4.1 7.4-11Z" fill-rule="nonzero"/></svg>',"chevron-down":'<svg width="10" height="10"><path d="M8.7 2.2c.3-.3.8-.3 1 0 .4.4.4.9 0 1.2L5.7 7.8c-.3.3-.9.3-1.2 0L.2 3.4a.8.8 0 0 1 0-1.2c.3-.3.8-.3 1.1 0L5 6l3.7-3.8Z" fill-rule="nonzero"/></svg>',"chevron-left":'<svg width="10" height="10"><path d="M7.8 1.3 4 5l3.8 3.7c.3.3.3.8 0 1-.4.4-.9.4-1.2 0L2.2 5.7a.8.8 0 0 1 0-1.2L6.6.2C7 0 7.4 0 7.8.2c.3.3.3.8 0 1.1Z" fill-rule="nonzero"/></svg>',"chevron-right":'<svg width="10" height="10"><path d="M2.2 1.3a.8.8 0 0 1 0-1c.4-.4.9-.4 1.2 0l4.4 4.1c.3.4.3.9 0 1.2L3.4 9.8c-.3.3-.8.3-1.2 0a.8.8 0 0 1 0-1.1L6 5 2.2 1.3Z" fill-rule="nonzero"/></svg>',"chevron-up":'<svg width="10" height="10"><path d="M8.7 7.8 5 4 1.3 7.8c-.3.3-.8.3-1 0a.8.8 0 0 1 0-1.2l4.1-4.4c.3-.3.9-.3 1.2 0l4.2 4.4c.3.3.3.9 0 1.2-.3.3-.8.3-1.1 0Z" fill-rule="nonzero"/></svg>',close:'<svg width="24" height="24"><path d="M17.3 8.2 13.4 12l3.9 3.8a1 1 0 0 1-1.5 1.5L12 13.4l-3.8 3.9a1 1 0 0 1-1.5-1.5l3.9-3.8-3.9-3.8a1 1 0 0 1 1.5-1.5l3.8 3.9 3.8-3.9a1 1 0 0 1 1.5 1.5Z" fill-rule="evenodd"/></svg>',"code-sample":'<svg width="24" height="26"><path d="M7.1 11a2.8 2.8 0 0 1-.8 2 2.8 2.8 0 0 1 .8 2v1.7c0 .3.1.6.4.8.2.3.5.4.8.4.3 0 .4.2.4.4v.8c0 .2-.1.4-.4.4-.7 0-1.4-.3-2-.8-.5-.6-.8-1.3-.8-2V15c0-.3-.1-.6-.4-.8-.2-.3-.5-.4-.8-.4a.4.4 0 0 1-.4-.4v-.8c0-.2.2-.4.4-.4.3 0 .6-.1.8-.4.3-.2.4-.5.4-.8V9.3c0-.7.3-1.4.8-2 .6-.5 1.3-.8 2-.8.3 0 .4.2.4.4v.8c0 .2-.1.4-.4.4-.3 0-.6.1-.8.4-.3.2-.4.5-.4.8V11Zm9.8 0V9.3c0-.3-.1-.6-.4-.8-.2-.3-.5-.4-.8-.4a.4.4 0 0 1-.4-.4V7c0-.2.1-.4.4-.4.7 0 1.4.3 2 .8.5.6.8 1.3.8 2V11c0 .3.1.6.4.8.2.3.5.4.8.4.2 0 .4.2.4.4v.8c0 .2-.2.4-.4.4-.3 0-.6.1-.8.4-.3.2-.4.5-.4.8v1.7c0 .7-.3 1.4-.8 2-.6.5-1.3.8-2 .8a.4.4 0 0 1-.4-.4v-.8c0-.2.1-.4.4-.4.3 0 .6-.1.8-.4.3-.2.4-.5.4-.8V15a2.8 2.8 0 0 1 .8-2 2.8 2.8 0 0 1-.8-2Zm-3.3-.4c0 .4-.1.8-.5 1.1-.3.3-.7.5-1.1.5-.4 0-.8-.2-1.1-.5-.4-.3-.5-.7-.5-1.1 0-.5.1-.9.5-1.2.3-.3.7-.4 1.1-.4.4 0 .8.1 1.1.4.4.3.5.7.5 1.2ZM12 13c.4 0 .8.1 1.1.5.4.3.5.7.5 1.1 0 1-.1 1.6-.5 2a3 3 0 0 1-1.1 1c-.4.3-.8.4-1.1.4a.5.5 0 0 1-.5-.5V17a3 3 0 0 0 1-.2l.6-.6c-.6 0-1-.2-1.3-.5-.2-.3-.3-.7-.3-1 0-.5.1-1 .5-1.2.3-.4.7-.5 1.1-.5Z" fill-rule="evenodd"/></svg>',"color-levels":'<svg width="24" height="24"><path d="M17.5 11.4A9 9 0 0 1 18 14c0 .5 0 1-.2 1.4 0 .4-.3.9-.5 1.3a6.2 6.2 0 0 1-3.7 3 5.7 5.7 0 0 1-3.2 0A5.9 5.9 0 0 1 7.6 18a6.2 6.2 0 0 1-1.4-2.6 6.7 6.7 0 0 1 0-2.8c0-.4.1-.9.3-1.3a13.6 13.6 0 0 1 2.3-4A20 20 0 0 1 12 4a26.4 26.4 0 0 1 3.2 3.4 18.2 18.2 0 0 1 2.3 4Zm-2 4.5c.4-.7.5-1.4.5-2a7.3 7.3 0 0 0-1-3.2c.2.6.2 1.2.2 1.9a4.5 4.5 0 0 1-1.3 3 5.3 5.3 0 0 1-2.3 1.5 4.9 4.9 0 0 1-2 .1 4.3 4.3 0 0 0 2.4.8 4 4 0 0 0 2-.6 4 4 0 0 0 1.5-1.5Z" fill-rule="evenodd"/></svg>',"color-picker":'<svg width="24" height="24"><path d="M12 3a9 9 0 0 0 0 18 1.5 1.5 0 0 0 1.1-2.5c-.2-.3-.4-.6-.4-1 0-.8.7-1.5 1.5-1.5H16a5 5 0 0 0 5-5c0-4.4-4-8-9-8Zm-5.5 9a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3Zm3-4a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3Zm5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3Zm3 4a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3Z" fill-rule="nonzero"/></svg>',"color-swatch-remove-color":'<svg width="24" height="24"><path stroke="#000" stroke-width="2" d="M21 3 3 21" fill-rule="evenodd"/></svg>',"color-swatch":'<svg width="24" height="24"><rect x="3" y="3" width="18" height="18" rx="1" fill-rule="evenodd"/></svg>',"comment-add":'<svg width="24" height="24"><g fill-rule="nonzero"><path d="m9 19 3-2h7c.6 0 1-.4 1-1V6c0-.6-.4-1-1-1H5a1 1 0 0 0-1 1v10c0 .6.4 1 1 1h4v2Zm-2 4v-4H5a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3h-6.4L7 23Z"/><path d="M13 10h2a1 1 0 0 1 0 2h-2v2a1 1 0 0 1-2 0v-2H9a1 1 0 0 1 0-2h2V8a1 1 0 0 1 2 0v2Z"/></g></svg>',comment:'<svg width="24" height="24"><path fill-rule="nonzero" d="m9 19 3-2h7c.6 0 1-.4 1-1V6c0-.6-.4-1-1-1H5a1 1 0 0 0-1 1v10c0 .6.4 1 1 1h4v2Zm-2 4v-4H5a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3h-6.4L7 23Z"/></svg>',contrast:'<svg width="24" height="24"><path d="M12 4a7.8 7.8 0 0 1 5.7 2.3A8 8 0 1 1 12 4Zm-6 8a6 6 0 0 0 6 6V6a6 6 0 0 0-6 6Z" fill-rule="evenodd"/></svg>',copy:'<svg width="24" height="24"><path d="M16 3H6a2 2 0 0 0-2 2v11h2V5h10V3Zm1 4a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2V9c0-1.2.9-2 2-2h7Zm0 12V9h-7v10h7Z" fill-rule="nonzero"/></svg>',crop:'<svg width="24" height="24"><path d="M17 8v7h2c.6 0 1 .4 1 1s-.4 1-1 1h-2v2c0 .6-.4 1-1 1a1 1 0 0 1-1-1v-2H7V9H5a1 1 0 1 1 0-2h2V5c0-.6.4-1 1-1s1 .4 1 1v2h7l3-3 1 1-3 3ZM9 9v5l5-5H9Zm1 6h5v-5l-5 5Z" fill-rule="evenodd"/></svg>',"cut-column":'<svg width="24" height="24"><path fill-rule="evenodd" d="M7.2 4.5c.9 0 1.6.4 2.2 1A3.7 3.7 0 0 1 10.5 8v.5l1 1 4-4 1-.5a3.3 3.3 0 0 1 2 0c.4 0 .7.3 1 .5L17 8h4v13h-6V10l-1.5 1.5.5.5v4l-2.5-2.5-1 1v.5c0 .4 0 .8-.3 1.2-.2.5-.4.9-.8 1.2-.6.7-1.3 1-2.2 1-.8.2-1.5 0-2-.6l-.5-.8-.2-1c0-.4 0-.8.3-1.2A3.9 3.9 0 0 1 7 12.7c.5-.2 1-.3 1.5-.2l1-1-1-1c-.5 0-1 0-1.5-.2-.5-.1-1-.4-1.4-.9-.4-.3-.6-.7-.8-1.2L4.5 7c0-.4 0-.7.2-1 0-.3.3-.6.5-.8.5-.5 1.2-.8 2-.7Zm12.3 5h-3v10h3v-10ZM8 13.8h-.3l-.4.2a2.8 2.8 0 0 0-.7.4v.1a2.8 2.8 0 0 0-.6.8l-.1.4v.7l.2.5.5.2h.7a2.6 2.6 0 0 0 .8-.3 2.4 2.4 0 0 0 .7-.7 2.5 2.5 0 0 0 .3-.8 1.5 1.5 0 0 0 0-.8 1 1 0 0 0-.2-.4 1 1 0 0 0-.5-.2H8Zm3.5-3.7c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4ZM7 5.8h-.4a1 1 0 0 0-.5.3 1 1 0 0 0-.2.5v.7a2.5 2.5 0 0 0 .3.8l.2.3h.1l.4.4.4.2.4.1h.7L9 9l.2-.4a1.6 1.6 0 0 0 0-.8 2.6 2.6 0 0 0-.3-.8A2.5 2.5 0 0 0 7.7 6l-.4-.1H7Z"/></svg>',"cut-row":'<svg width="24" height="24"><path fill-rule="evenodd" d="M22 3v5H9l3 3 2-2h4l-4 4 1 1h.5c.4 0 .8 0 1.2.3.5.2.9.4 1.2.8.7.6 1 1.3 1 2.2.2.8 0 1.5-.6 2l-.8.5-1 .2c-.4 0-.8 0-1.2-.3a3.9 3.9 0 0 1-2.1-2.2c-.2-.5-.3-1-.2-1.5l-1-1-1 1c0 .5 0 1-.2 1.5-.1.5-.4 1-.9 1.4-.3.4-.7.6-1.2.8l-1.2.3c-.4 0-.7 0-1-.2-.3 0-.6-.3-.8-.5-.5-.5-.8-1.2-.7-2 0-.9.4-1.6 1-2.2A3.7 3.7 0 0 1 8.6 14H9l1-1-4-4-.5-1a3.3 3.3 0 0 1 0-2c0-.4.3-.7.5-1l2 2V3h14ZM8.5 15.3h-.3a2.6 2.6 0 0 0-.8.4 2.5 2.5 0 0 0-.9 1.1l-.1.4v.7l.2.5.5.2h.7a2.5 2.5 0 0 0 .8-.3L9 18V18l.4-.4.2-.4.1-.4v-.7a1 1 0 0 0-.2-.5 1 1 0 0 0-.4-.2h-.5Zm7 0H15a1 1 0 0 0-.4.3 1 1 0 0 0-.2.5 1.5 1.5 0 0 0 0 .7v.4a2.8 2.8 0 0 0 .5.7h.1a2.8 2.8 0 0 0 .8.6l.4.1h.7l.5-.2.2-.5v-.7a2.6 2.6 0 0 0-.3-.8 2.4 2.4 0 0 0-.7-.7 2.5 2.5 0 0 0-.8-.3h-.3ZM12 11.6c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4Zm8.5-7.1h-11v2h11v-2Z"/></svg>',cut:'<svg width="24" height="24"><path d="M18 15c.6.7 1 1.4 1 2.3 0 .8-.2 1.5-.7 2l-.8.5-1 .2c-.4 0-.8 0-1.2-.3a3.9 3.9 0 0 1-2.1-2.2c-.2-.5-.3-1-.2-1.5l-1-1-1 1c0 .5 0 1-.2 1.5-.1.5-.4 1-.9 1.4-.3.4-.7.6-1.2.8l-1.2.3c-.4 0-.7 0-1-.2-.3 0-.6-.3-.8-.5-.5-.5-.8-1.2-.7-2 0-.9.4-1.6 1-2.2A3.7 3.7 0 0 1 8.6 14H9l1-1-4-4-.5-1a3.3 3.3 0 0 1 0-2c0-.4.3-.7.5-1l6 6 6-6 .5 1a3.3 3.3 0 0 1 0 2c0 .4-.3.7-.5 1l-4 4 1 1h.5c.4 0 .8 0 1.2.3.5.2.9.4 1.2.8Zm-8.5 2.2.1-.4v-.7a1 1 0 0 0-.2-.5 1 1 0 0 0-.4-.2 1.6 1.6 0 0 0-.8 0 2.6 2.6 0 0 0-.8.3 2.5 2.5 0 0 0-.9 1.1l-.1.4v.7l.2.5.5.2h.7a2.5 2.5 0 0 0 .8-.3 2.8 2.8 0 0 0 1-1Zm2.5-2.8c.4 0 .7-.1 1-.4.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4s-.7.1-1 .4c-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4Zm5.4 4 .2-.5v-.7a2.6 2.6 0 0 0-.3-.8 2.4 2.4 0 0 0-.7-.7 2.5 2.5 0 0 0-.8-.3 1.5 1.5 0 0 0-.8 0 1 1 0 0 0-.4.2 1 1 0 0 0-.2.5 1.5 1.5 0 0 0 0 .7v.4l.3.4.3.4a2.8 2.8 0 0 0 .8.5l.4.1h.7l.5-.2Z" fill-rule="evenodd"/></svg>',"document-properties":'<svg width="24" height="24"><path d="M14.4 3H7a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h10a2 2 0 0 0 2-2V7.6L14.4 3ZM17 19H7V5h6v4h4v10Z" fill-rule="nonzero"/></svg>',drag:'<svg width="24" height="24"><path d="M13 5h2v2h-2V5Zm0 4h2v2h-2V9ZM9 9h2v2H9V9Zm4 4h2v2h-2v-2Zm-4 0h2v2H9v-2Zm0 4h2v2H9v-2Zm4 0h2v2h-2v-2ZM9 5h2v2H9V5Z" fill-rule="evenodd"/></svg>',"duplicate-column":'<svg width="24" height="24"><path d="M17 6v16h-7V6h7Zm-2 2h-3v12h3V8Zm-2-6v2H8v15H6V2h7Z"/></svg>',"duplicate-row":'<svg width="24" height="24"><path d="M22 11v7H6v-7h16Zm-2 2H8v3h12v-3Zm-1-6v2H4v5H2V7h17Z"/></svg>',duplicate:'<svg width="24" height="24"><g fill-rule="nonzero"><path d="M16 3v2H6v11H4V5c0-1.1.9-2 2-2h10Zm3 8h-2V9h-7v10h9a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2V9c0-1.2.9-2 2-2h7a2 2 0 0 1 2 2v2Z"/><path d="M17 14h1a1 1 0 0 1 0 2h-1v1a1 1 0 0 1-2 0v-1h-1a1 1 0 0 1 0-2h1v-1a1 1 0 0 1 2 0v1Z"/></g></svg>',"edit-block":'<svg width="24" height="24"><path fill-rule="nonzero" d="m19.8 8.8-9.4 9.4c-.2.2-.5.4-.9.4l-5.4 1.2 1.2-5.4.5-.8 9.4-9.4c.7-.7 1.8-.7 2.5 0l2.1 2.1c.7.7.7 1.8 0 2.5Zm-2-.2 1-.9v-.3l-2.2-2.2a.3.3 0 0 0-.3 0l-1 1L18 8.5Zm-1 1-2.5-2.4-6 6 2.5 2.5 6-6Zm-7 7.1-2.6-2.4-.3.3-.1.2-.7 3 3.1-.6h.1l.4-.5Z"/></svg>',"edit-image":'<svg width="24" height="24"><path d="M18 16h2V7a2 2 0 0 0-2-2H7v2h11v9ZM6 17h15a1 1 0 0 1 0 2h-1v1a1 1 0 0 1-2 0v-1H6a2 2 0 0 1-2-2V7H3a1 1 0 1 1 0-2h1V4a1 1 0 1 1 2 0v13Zm3-5.3 1.3 2 3-4.7 3.7 6H7l2-3.3Z" fill-rule="nonzero"/></svg>',"embed-page":'<svg width="24" height="24"><path d="M19 6V5H5v14h2A13 13 0 0 1 19 6Zm0 1.4c-.8.8-1.6 2.4-2.2 4.6H19V7.4Zm0 5.6h-2.4c-.4 1.8-.6 3.8-.6 6h3v-6Zm-4 6c0-2.2.2-4.2.6-6H13c-.7 1.8-1.1 3.8-1.1 6h3Zm-4 0c0-2.2.4-4.2 1-6H9.6A12 12 0 0 0 8 19h3ZM4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 0 1-1-1V4c0-.6.4-1 1-1Zm11.8 9c.4-1.9 1-3.4 1.8-4.5a9.2 9.2 0 0 0-4 4.5h2.2Zm-3.4 0a12 12 0 0 1 2.8-4 12 12 0 0 0-5 4h2.2Z" fill-rule="nonzero"/></svg>',embed:'<svg width="24" height="24"><path d="M4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 0 1-1-1V4c0-.6.4-1 1-1Zm1 2v14h14V5H5Zm4.8 2.6 5.6 4a.5.5 0 0 1 0 .8l-5.6 4A.5.5 0 0 1 9 16V8a.5.5 0 0 1 .8-.4Z" fill-rule="nonzero"/></svg>',emoji:'<svg width="24" height="24"><path d="M9 11c.6 0 1-.4 1-1s-.4-1-1-1a1 1 0 0 0-1 1c0 .6.4 1 1 1Zm6 0c.6 0 1-.4 1-1s-.4-1-1-1a1 1 0 0 0-1 1c0 .6.4 1 1 1Zm-3 5.5c2.1 0 4-1.5 4.4-3.5H7.6c.5 2 2.3 3.5 4.4 3.5ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm0 14.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13Z" fill-rule="nonzero"/></svg>',export:'<svg width="24" height="24"><g fill-rule="nonzero"><path d="M14.4 3 18 7v1h-5V5H7v14h9a1 1 0 0 1 2 0c0 1-.8 2-1.9 2H7c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h7.5Z"/><path d="M18.1 12c.5 0 .9.4.9 1 0 .5-.3 1-.8 1h-7.3c-.5 0-.9-.4-.9-1 0-.5.3-1 .8-1h7.3Z"/><path d="M16.4 9.2a1 1 0 0 1 1.4.2l2.4 3.6-2.4 3.6a1 1 0 0 1-1.7-1v-.2l1.7-2.4-1.6-2.4a1 1 0 0 1 .2-1.4Z"/></g></svg>',fill:'<svg width="24" height="26"><path d="m16.6 12-9-9-1.4 1.4 2.4 2.4-5.2 5.1c-.5.6-.5 1.6 0 2.2L9 19.6a1.5 1.5 0 0 0 2.2 0l5.5-5.5c.5-.6.5-1.6 0-2.2ZM5.2 13 10 8.2l4.8 4.8H5.2ZM19 14.5s-2 2.2-2 3.5c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.3-2-3.5-2-3.5Z" fill-rule="nonzero"/></svg>',"flip-horizontally":'<svg width="24" height="24"><path d="M14 19h2v-2h-2v2Zm4-8h2V9h-2v2ZM4 7v10c0 1.1.9 2 2 2h3v-2H6V7h3V5H6a2 2 0 0 0-2 2Zm14-2v2h2a2 2 0 0 0-2-2Zm-7 16h2V3h-2v18Zm7-6h2v-2h-2v2Zm-4-8h2V5h-2v2Zm4 12a2 2 0 0 0 2-2h-2v2Z" fill-rule="nonzero"/></svg>',"flip-vertically":'<svg width="24" height="24"><path d="M5 14v2h2v-2H5Zm8 4v2h2v-2h-2Zm4-14H7a2 2 0 0 0-2 2v3h2V6h10v3h2V6a2 2 0 0 0-2-2Zm2 14h-2v2a2 2 0 0 0 2-2ZM3 11v2h18v-2H3Zm6 7v2h2v-2H9Zm8-4v2h2v-2h-2ZM5 18c0 1.1.9 2 2 2v-2H5Z" fill-rule="nonzero"/></svg>',footnote:'<svg width="24" height="24"><path d="M19 13c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2h14Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M19 4v6h-1V5h-1.5V4h2.6Z"/><path d="M12 18c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2h7ZM14 8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2h9Z"/></svg>',"format-painter":'<svg width="24" height="24"><path d="M18 5V4c0-.5-.4-1-1-1H5a1 1 0 0 0-1 1v4c0 .6.5 1 1 1h12c.6 0 1-.4 1-1V7h1v4H9v9c0 .6.4 1 1 1h2c.6 0 1-.4 1-1v-7h8V5h-3Z" fill-rule="nonzero"/></svg>',format:'<svg width="24" height="24"><path fill-rule="evenodd" d="M17 5a1 1 0 0 1 0 2h-4v11a1 1 0 0 1-2 0V7H7a1 1 0 1 1 0-2h10Z"/></svg>',fullscreen:'<svg width="24" height="24"><path d="m15.3 10-1.2-1.3 2.9-3h-2.3a.9.9 0 1 1 0-1.7H19c.5 0 .9.4.9.9v4.4a.9.9 0 1 1-1.8 0V7l-2.9 3Zm0 4 3 3v-2.3a.9.9 0 1 1 1.7 0V19c0 .5-.4.9-.9.9h-4.4a.9.9 0 1 1 0-1.8H17l-3-2.9 1.3-1.2ZM10 15.4l-2.9 3h2.3a.9.9 0 1 1 0 1.7H5a.9.9 0 0 1-.9-.9v-4.4a.9.9 0 1 1 1.8 0V17l2.9-3 1.2 1.3ZM8.7 10 5.7 7v2.3a.9.9 0 0 1-1.7 0V5c0-.5.4-.9.9-.9h4.4a.9.9 0 0 1 0 1.8H7l3 2.9-1.3 1.2Z" fill-rule="nonzero"/></svg>',gallery:'<svg width="24" height="24"><path fill-rule="nonzero" d="m5 15.7 2.3-2.2c.3-.3.7-.3 1 0L11 16l5.1-5c.3-.4.8-.4 1 0l2 1.9V8H5v7.7ZM5 18V19h3l1.8-1.9-2-2L5 17.9Zm14-3-2.5-2.4-6.4 6.5H19v-4ZM4 6h16c.6 0 1 .4 1 1v13c0 .6-.4 1-1 1H4a1 1 0 0 1-1-1V7c0-.6.4-1 1-1Zm6 7a2 2 0 1 1 0-4 2 2 0 0 1 0 4ZM4.5 4h15a.5.5 0 1 1 0 1h-15a.5.5 0 0 1 0-1Zm2-2h11a.5.5 0 1 1 0 1h-11a.5.5 0 0 1 0-1Z"/></svg>',gamma:'<svg width="24" height="24"><path d="M4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 0 1-1-1V4c0-.6.4-1 1-1Zm1 2v14h14V5H5Zm6.5 11.8V14L9.2 8.7a5.1 5.1 0 0 0-.4-.8l-.1-.2H8v-1l.3-.1.3-.1h.7a1 1 0 0 1 .6.5l.1.3a8.5 8.5 0 0 1 .3.6l1.9 4.6 2-5.2a1 1 0 0 1 1-.6.5.5 0 0 1 .5.6L13 14v2.8a.7.7 0 0 1-1.4 0Z" fill-rule="nonzero"/></svg>',help:'<svg width="24" height="24"><g fill-rule="evenodd"><path d="M12 5.5a6.5 6.5 0 0 0-6 9 6.3 6.3 0 0 0 1.4 2l1 1a6.3 6.3 0 0 0 3.6 1 6.5 6.5 0 0 0 6-9 6.3 6.3 0 0 0-1.4-2l-1-1a6.3 6.3 0 0 0-3.6-1ZM12 4a7.8 7.8 0 0 1 5.7 2.3A8 8 0 1 1 12 4Z"/><path d="M9.6 9.7a.7.7 0 0 1-.7-.8c0-1.1 1.5-1.8 3.2-1.8 1.8 0 3.2.8 3.2 2.4 0 1.4-.4 2.1-1.5 2.8-.2 0-.3.1-.3.2a2 2 0 0 0-.8.8.8.8 0 0 1-1.4-.6c.3-.7.8-1 1.3-1.5l.4-.2c.7-.4.8-.6.8-1.5 0-.5-.6-.9-1.7-.9-.5 0-1 .1-1.4.3-.2 0-.3.1-.3.2v-.2c0 .4-.4.8-.8.8Z" fill-rule="nonzero"/><circle cx="12" cy="16" r="1"/></g></svg>',"highlight-bg-color":'<svg width="24" height="24"><g fill-rule="evenodd"><path class="tox-icon-highlight-bg-color__color" d="M3 18h18v3H3z"/><path fill-rule="nonzero" d="M7.7 16.7H3l3.3-3.3-.7-.8L10.2 8l4 4.1-4 4.2c-.2.2-.6.2-.8 0l-.6-.7-1.1 1.1zm5-7.5L11 7.4l3-2.9a2 2 0 0 1 2.6 0L18 6c.7.7.7 2 0 2.7l-2.9 2.9-1.8-1.8-.5-.6"/></g></svg>',home:'<svg width="24" height="24"><path fill-rule="nonzero" d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/></svg>',"horizontal-rule":'<svg width="24" height="24"><path d="M4 11h16v2H4z" fill-rule="evenodd"/></svg>',"image-options":'<svg width="24" height="24"><path d="M6 10a2 2 0 0 0-2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2 2 2 0 0 0-2-2Zm12 0a2 2 0 0 0-2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2 2 2 0 0 0-2-2Zm-6 0a2 2 0 0 0-2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2 2 2 0 0 0-2-2Z" fill-rule="nonzero"/></svg>',image:'<svg width="24" height="24"><path d="m5 15.7 3.3-3.2c.3-.3.7-.3 1 0L12 15l4.1-4c.3-.4.8-.4 1 0l2 1.9V5H5v10.7ZM5 18V19h3l2.8-2.9-2-2L5 17.9Zm14-3-2.5-2.4-6.4 6.5H19v-4ZM4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 0 1-1-1V4c0-.6.4-1 1-1Zm6 8a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z" fill-rule="nonzero"/></svg>',indent:'<svg width="24" height="24"><path d="M7 5h12c.6 0 1 .4 1 1s-.4 1-1 1H7a1 1 0 1 1 0-2Zm5 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 0 1 0-2Zm0 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 0 1 0-2Zm-5 4h12a1 1 0 0 1 0 2H7a1 1 0 0 1 0-2Zm-2.6-3.8L6.2 12l-1.8-1.2a1 1 0 0 1 1.2-1.6l3 2a1 1 0 0 1 0 1.6l-3 2a1 1 0 1 1-1.2-1.6Z" fill-rule="evenodd"/></svg>',info:'<svg width="24" height="24"><path d="M12 4a7.8 7.8 0 0 1 5.7 2.3A8 8 0 1 1 12 4Zm-1 3v2h2V7h-2Zm3 10v-1h-1v-5h-3v1h1v4h-1v1h4Z" fill-rule="evenodd"/></svg>',"insert-character":'<svg width="24" height="24"><path d="M15 18h4l1-2v4h-6v-3.3l1.4-1a6 6 0 0 0 1.8-2.9 6.3 6.3 0 0 0-.1-4.1 5.8 5.8 0 0 0-3-3.2c-.6-.3-1.3-.5-2.1-.5a5.1 5.1 0 0 0-3.9 1.8 6.3 6.3 0 0 0-1.3 6 6.2 6.2 0 0 0 1.8 3l1.4.9V20H4v-4l1 2h4v-.5l-2-1L5.4 15A6.5 6.5 0 0 1 4 11c0-1 .2-1.9.6-2.7A7 7 0 0 1 6.3 6C7.1 5.4 8 5 9 4.5c1-.3 2-.5 3.1-.5a8.8 8.8 0 0 1 5.7 2 7 7 0 0 1 1.7 2.3 6 6 0 0 1 .2 4.8c-.2.7-.6 1.3-1 1.9a7.6 7.6 0 0 1-3.6 2.5v.5Z" fill-rule="evenodd"/></svg>',"insert-time":'<svg width="24" height="24"><g fill-rule="nonzero"><path d="M12 19a7 7 0 1 0 0-14 7 7 0 0 0 0 14Zm0 2a9 9 0 1 1 0-18 9 9 0 0 1 0 18Z"/><path d="M16 12h-3V7c0-.6-.4-1-1-1a1 1 0 0 0-1 1v7h5c.6 0 1-.4 1-1s-.4-1-1-1Z"/></g></svg>',invert:'<svg width="24" height="24"><path d="M18 19.3 16.5 18a5.8 5.8 0 0 1-3.1 1.9 6.1 6.1 0 0 1-5.5-1.6A5.8 5.8 0 0 1 6 14v-.3l.1-1.2A13.9 13.9 0 0 1 7.7 9l-3-3 .7-.8 2.8 2.9 9 8.9 1.5 1.6-.7.6Zm0-5.5v.3l-.1 1.1-.4 1-1.2-1.2a4.3 4.3 0 0 0 .2-1v-.2c0-.4 0-.8-.2-1.3l-.5-1.4a14.8 14.8 0 0 0-3-4.2L12 6a26.1 26.1 0 0 0-2.2 2.5l-1-1a20.9 20.9 0 0 1 2.9-3.3L12 4l1 .8a22.2 22.2 0 0 1 4 5.4c.6 1.2 1 2.4 1 3.6Z" fill-rule="evenodd"/></svg>',italic:'<svg width="24" height="24"><path d="m16.7 4.7-.1.9h-.3c-.6 0-1 0-1.4.3-.3.3-.4.6-.5 1.1l-2.1 9.8v.6c0 .5.4.8 1.4.8h.2l-.2.8H8l.2-.8h.2c1.1 0 1.8-.5 2-1.5l2-9.8.1-.5c0-.6-.4-.8-1.4-.8h-.3l.2-.9h5.8Z" fill-rule="evenodd"/></svg>',language:'<svg width="24" height="24"><path d="M12 3a9 9 0 1 1 0 18 9 9 0 0 1 0-18Zm4.3 13.3c-.5 1-1.2 2-2 2.9a7.5 7.5 0 0 0 3.2-2.1l-.2-.2a6 6 0 0 0-1-.6Zm-8.6 0c-.5.2-.9.5-1.2.8.9 1 2 1.7 3.2 2a10 10 0 0 1-2-2.8Zm3.6-.8c-.8 0-1.6.1-2.2.3.5 1 1.2 1.9 2.1 2.7Zm1.5 0v3c.9-.8 1.6-1.7 2.1-2.7-.6-.2-1.4-.3-2.1-.3Zm-6-2.7H4.5c.2 1 .5 2.1 1 3h.3l1.3-1a10 10 0 0 1-.3-2Zm12.7 0h-2.3c0 .7-.1 1.4-.3 2l1.6 1.1c.5-1 .9-2 1-3.1Zm-3.8 0h-3V14c1 0 2 .1 2.7.4.2-.5.3-1 .3-1.6Zm-4.4 0h-3l.3 1.6c.8-.3 1.7-.4 2.7-.4v-1.3Zm-5.5-5c-.7 1-1.1 2.2-1.3 3.5h2.3c0-1 .2-1.8.5-2.6l-1.5-1Zm2.9 1.4v.1c-.2.6-.4 1.3-.4 2h3V9.4c-1 0-1.8-.1-2.6-.3Zm6.6 0h-.1l-2.4.3v1.8h3l-.5-2.1Zm3-1.4-.3.1-1.3.8c.3.8.5 1.6.5 2.6h2.3a7.5 7.5 0 0 0-1.3-3.5Zm-9 0 2 .2V5.5a9 9 0 0 0-2 2.2Zm3.5-2.3V8c.6 0 1.3 0 1.9-.2a9 9 0 0 0-2-2.3Zm-3-.7h-.1c-1.1.4-2.1 1-3 1.8l1.2.7a10 10 0 0 1 1.9-2.5Zm4.4 0 .1.1a10 10 0 0 1 1.8 2.4l1.1-.7a7.5 7.5 0 0 0-3-1.8Z"/></svg>',"line-height":'<svg width="24" height="24"><path d="M21 5a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zM7 3.6l3.7 3.7a1 1 0 0 1-1.3 1.5h-.1L8 7.3v9.2l1.3-1.3a1 1 0 0 1 1.3 0h.1c.4.4.4 1 0 1.3v.1L7 20.4l-3.7-3.7a1 1 0 0 1 1.3-1.5h.1L6 16.7V7.4L4.7 8.7a1 1 0 0 1-1.3 0h-.1a1 1 0 0 1 0-1.3v-.1L7 3.6z"/></svg>',line:'<svg width="24" height="24"><path d="m15 9-8 8H4v-3l8-8 3 3Zm1-1-3-3 1-1h1c-.2 0 0 0 0 0l2 2s0 .2 0 0v1l-1 1ZM4 18h16v2H4v-2Z" fill-rule="evenodd"/></svg>',link:'<svg width="24" height="24"><path d="M6.2 12.3a1 1 0 0 1 1.4 1.4l-2 2a2 2 0 1 0 2.6 2.8l4.8-4.8a1 1 0 0 0 0-1.4 1 1 0 1 1 1.4-1.3 2.9 2.9 0 0 1 0 4L9.6 20a3.9 3.9 0 0 1-5.5-5.5l2-2Zm11.6-.6a1 1 0 0 1-1.4-1.4l2-2a2 2 0 1 0-2.6-2.8L11 10.3a1 1 0 0 0 0 1.4A1 1 0 1 1 9.6 13a2.9 2.9 0 0 1 0-4L14.4 4a3.9 3.9 0 0 1 5.5 5.5l-2 2Z" fill-rule="nonzero"/></svg>',"list-bull-circle":'<svg width="48" height="48"><g fill-rule="evenodd"><path d="M11 16a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm0 1a3 3 0 1 1 0-6 3 3 0 0 1 0 6ZM11 26a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm0 1a3 3 0 1 1 0-6 3 3 0 0 1 0 6ZM11 36a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm0 1a3 3 0 1 1 0-6 3 3 0 0 1 0 6Z" fill-rule="nonzero"/><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/></g></svg>',"list-bull-default":'<svg width="48" height="48"><g fill-rule="evenodd"><circle cx="11" cy="14" r="3"/><circle cx="11" cy="24" r="3"/><circle cx="11" cy="34" r="3"/><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/></g></svg>',"list-bull-square":'<svg width="48" height="48"><g fill-rule="evenodd"><path d="M8 11h6v6H8zM8 21h6v6H8zM8 31h6v6H8z"/><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/></g></svg>',"list-num-default-rtl":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z"/><path d="M37.4 17v-4.8h-.1l-1.5 1v-1.1l1.6-1.1h1.2v6zM33.3 17.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zm1.7 5.7c0-1.2 1-2 2.2-2 1.3 0 2.1.8 2.1 1.8 0 .7-.3 1.2-1.3 2.2l-1.2 1v.2h2.6v1h-4.3v-.9l2-1.9c.8-.8 1-1.1 1-1.5 0-.5-.4-.8-1-.8-.5 0-.9.3-.9.9H35zm-1.7 4.3c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zm3.2 7.3v-1h.7c.6 0 1-.3 1-.8 0-.4-.4-.7-1-.7s-1 .3-1 .8H35c0-1.1 1-1.8 2.2-1.8 1.2 0 2.1.6 2.1 1.6 0 .7-.4 1.2-1 1.3v.1c.7.1 1.3.7 1.3 1.4 0 1-1 1.9-2.4 1.9-1.3 0-2.2-.8-2.3-2h1.2c0 .6.5 1 1.1 1 .6 0 1-.4 1-1 0-.5-.3-.8-1-.8h-.7zm-3.3 2.7c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .8.3.8.7 0 .4-.3.7-.8.7z"/></g></svg>',"list-num-default":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/><path d="M10 17v-4.8l-1.5 1v-1.1l1.6-1h1.2V17h-1.2Zm3.6.1c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .7.3.7.7 0 .4-.2.7-.7.7Zm-5 5.7c0-1.2.8-2 2.1-2s2.1.8 2.1 1.8c0 .7-.3 1.2-1.4 2.2l-1.1 1v.2h2.6v1H8.6v-.9l2-1.9c.8-.8 1-1.1 1-1.5 0-.5-.4-.8-1-.8-.5 0-.9.3-.9.9H8.5Zm6.3 4.3c-.5 0-.7-.3-.7-.7 0-.4.2-.7.7-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7ZM10 34.4v-1h.7c.6 0 1-.3 1-.8 0-.4-.4-.7-1-.7s-1 .3-1 .8H8.6c0-1.1 1-1.8 2.2-1.8 1.3 0 2.1.6 2.1 1.6 0 .7-.4 1.2-1 1.3v.1c.8.1 1.3.7 1.3 1.4 0 1-1 1.9-2.4 1.9-1.3 0-2.2-.8-2.3-2h1.2c0 .6.5 1 1.1 1 .7 0 1-.4 1-1 0-.5-.3-.8-1-.8h-.7Zm4.7 2.7c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .8.3.8.7 0 .4-.3.7-.8.7Z"/></g></svg>',"list-num-lower-alpha-rtl":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z"/><path d="M36.5 16c-.9 0-1.5-.5-1.5-1.3s.6-1.3 1.8-1.4h1v-.4c0-.4-.2-.6-.7-.6-.4 0-.7.1-.8.4h-1.1c0-.8.8-1.4 2-1.4S39 12 39 13V16h-1.2v-.6c-.3.4-.8.7-1.4.7Zm.4-.8c.6 0 1-.4 1-.9V14h-1c-.5.1-.7.3-.7.6 0 .4.3.6.7.6ZM33.1 16.1c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .8.3.8.7 0 .4-.3.7-.8.7ZM37.7 26c-.7 0-1.2-.2-1.5-.7v.7H35v-6.3h1.2v2.5c.3-.5.8-.9 1.5-.9 1.1 0 1.8 1 1.8 2.4 0 1.5-.7 2.4-1.8 2.4Zm-.5-3.6c-.6 0-1 .5-1 1.3s.4 1.4 1 1.4c.7 0 1-.6 1-1.4 0-.8-.3-1.3-1-1.3ZM33.2 26.1c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .8.3.8.7 0 .4-.3.7-.8.7zm6 7h-1c-.1-.5-.4-.8-1-.8s-1 .5-1 1.4c0 1 .4 1.4 1 1.4.5 0 .9-.2 1-.7h1c0 1-.8 1.7-2 1.7-1.4 0-2.2-.9-2.2-2.4s.8-2.4 2.2-2.4c1.2 0 2 .7 2 1.7zm-6.1 3c-.5 0-.7-.3-.7-.7 0-.4.2-.7.7-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7z"/></g></svg>',"list-num-lower-alpha":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/><path d="M10.3 15.2c.5 0 1-.4 1-.9V14h-1c-.5.1-.8.3-.8.6 0 .4.3.6.8.6Zm-.4.9c-1 0-1.5-.6-1.5-1.4 0-.8.6-1.3 1.7-1.4h1.1v-.4c0-.4-.2-.6-.7-.6-.5 0-.8.1-.9.4h-1c0-.8.8-1.4 2-1.4 1.1 0 1.8.6 1.8 1.6V16h-1.1v-.6h-.1c-.2.4-.7.7-1.3.7Zm4.6 0c-.5 0-.7-.3-.7-.7 0-.4.2-.7.7-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7Zm-3.2 10c-.6 0-1.2-.3-1.4-.8v.7H8.5v-6.3H10v2.5c.3-.5.8-.9 1.4-.9 1.2 0 1.9 1 1.9 2.4 0 1.5-.7 2.4-1.9 2.4Zm-.4-3.7c-.7 0-1 .5-1 1.3s.3 1.4 1 1.4c.6 0 1-.6 1-1.4 0-.8-.4-1.3-1-1.3Zm4 3.7c-.5 0-.7-.3-.7-.7 0-.4.2-.7.7-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7Zm-2.2 7h-1.2c0-.5-.4-.8-.9-.8-.6 0-1 .5-1 1.4 0 1 .4 1.4 1 1.4.5 0 .8-.2 1-.7h1c0 1-.8 1.7-2 1.7-1.4 0-2.2-.9-2.2-2.4s.8-2.4 2.2-2.4c1.2 0 2 .7 2 1.7Zm1.8 3c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7Z"/></g></svg>',"list-num-lower-greek-rtl":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z"/><path d="M37.4 16c-1.2 0-2-.8-2-2.3 0-1.5.8-2.4 2-2.4.6 0 1 .4 1.3 1v-.9H40v3.2c0 .4.1.5.4.5h.2v.9h-.6c-.6 0-1-.2-1-.7h-.2c-.2.4-.7.8-1.3.8Zm.3-1c.6 0 1-.5 1-1.3s-.4-1.3-1-1.3-1 .5-1 1.3.4 1.4 1 1.4ZM33.3 16.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7ZM36 21.9c0-1.5.8-2.3 2.1-2.3 1.2 0 2 .6 2 1.6 0 .6-.3 1-.9 1.3.9.3 1.3.8 1.3 1.7 0 1.2-.7 1.9-1.8 1.9-.6 0-1.1-.3-1.4-.8v2.2H36V22Zm1.8 1.2v-1h.3c.5 0 .9-.2.9-.7 0-.5-.3-.8-.9-.8-.5 0-.8.3-.8 1v2.2c0 .8.4 1.3 1 1.3s1-.4 1-1-.4-1-1.2-1h-.3ZM33.3 26.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7ZM37.1 34.6 34.8 30h1.4l1.7 3.5 1.7-3.5h1.1l-2.2 4.6v.1c.5.8.7 1.4.7 1.8 0 .4-.2.8-.4 1-.2.2-.6.3-1 .3-.9 0-1.3-.4-1.3-1.2 0-.5.2-1 .5-1.7l.1-.2Zm.7 1a2 2 0 0 0-.4.9c0 .3.1.4.4.4.3 0 .4-.1.4-.4 0-.2-.1-.6-.4-1ZM33.3 36.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7Z"/></g></svg>',"list-num-lower-greek":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/><path d="M10.5 15c.7 0 1-.5 1-1.3s-.3-1.3-1-1.3c-.5 0-.9.5-.9 1.3s.4 1.4 1 1.4Zm-.3 1c-1.1 0-1.8-.8-1.8-2.3 0-1.5.7-2.4 1.8-2.4.7 0 1.1.4 1.3 1h.1v-.9h1.2v3.2c0 .4.1.5.4.5h.2v.9h-.6c-.6 0-1-.2-1.1-.7h-.1c-.2.4-.7.8-1.4.8Zm5 .1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.7-.7.5 0 .8.3.8.7 0 .4-.3.7-.8.7Zm-4.9 7v-1h.3c.6 0 1-.2 1-.7 0-.5-.4-.8-1-.8-.5 0-.8.3-.8 1v2.2c0 .8.4 1.3 1.1 1.3.6 0 1-.4 1-1s-.5-1-1.3-1h-.3ZM8.6 22c0-1.5.7-2.3 2-2.3 1.2 0 2 .6 2 1.6 0 .6-.3 1-.8 1.3.8.3 1.3.8 1.3 1.7 0 1.2-.8 1.9-1.9 1.9-.6 0-1.1-.3-1.3-.8v2.2H8.5V22Zm6.2 4.2c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .7.3.7.7 0 .4-.2.7-.7.7Zm-4.5 8.5L8 30h1.4l1.7 3.5 1.7-3.5h1.1l-2.2 4.6v.1c.5.8.7 1.4.7 1.8 0 .4-.1.8-.4 1-.2.2-.6.3-1 .3-.9 0-1.3-.4-1.3-1.2 0-.5.2-1 .5-1.7l.1-.2Zm.7 1a2 2 0 0 0-.4.9c0 .3.1.4.4.4.3 0 .4-.1.4-.4 0-.2-.1-.6-.4-1Zm4.5.5c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7Z"/></g></svg>',"list-num-lower-roman-rtl":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z"/><path d="M32.9 16v-1.2h-1.3V16H33Zm0 10v-1.2h-1.3V26H33Zm0 10v-1.2h-1.3V36H33Z"/><path fill-rule="nonzero" d="M36 21h-1.5v5H36zM36 31h-1.5v5H36zM39 21h-1.5v5H39zM39 31h-1.5v5H39zM42 31h-1.5v5H42zM36 11h-1.5v5H36zM36 19h-1.5v1H36zM36 29h-1.5v1H36zM39 19h-1.5v1H39zM39 29h-1.5v1H39zM42 29h-1.5v1H42zM36 9h-1.5v1H36z"/></g></svg>',"list-num-lower-roman":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/><path d="M15.1 16v-1.2h1.3V16H15Zm0 10v-1.2h1.3V26H15Zm0 10v-1.2h1.3V36H15Z"/><path fill-rule="nonzero" d="M12 21h1.5v5H12zM12 31h1.5v5H12zM9 21h1.5v5H9zM9 31h1.5v5H9zM6 31h1.5v5H6zM12 11h1.5v5H12zM12 19h1.5v1H12zM12 29h1.5v1H12zM9 19h1.5v1H9zM9 29h1.5v1H9zM6 29h1.5v1H6zM12 9h1.5v1H12z"/></g></svg>',"list-num-upper-alpha-rtl":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z"/><path d="m39.3 17-.5-1.4h-2l-.5 1.4H35l2-6h1.6l2 6h-1.3Zm-1.6-4.7-.7 2.3h1.6l-.8-2.3ZM33.4 17c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .7.3.7.7 0 .4-.2.7-.7.7Zm4.7 9.9h-2.7v-6H38c1.2 0 1.9.6 1.9 1.5 0 .6-.5 1.2-1 1.3.7.1 1.3.7 1.3 1.5 0 1-.8 1.7-2 1.7Zm-1.4-5v1.5h1c.6 0 1-.3 1-.8 0-.4-.4-.7-1-.7h-1Zm0 4h1.1c.7 0 1.1-.3 1.1-.8 0-.6-.4-.9-1.1-.9h-1.1V26ZM33 27.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7Zm4.9 10c-1.8 0-2.8-1.1-2.8-3.1s1-3.1 2.8-3.1c1.4 0 2.5.9 2.6 2.2h-1.3c0-.7-.6-1.1-1.3-1.1-1 0-1.6.7-1.6 2s.6 2 1.6 2c.7 0 1.2-.4 1.4-1h1.2c-.1 1.3-1.2 2.2-2.6 2.2Zm-4.5 0c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7Z"/></g></svg>',"list-num-upper-alpha":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/><path d="m12.6 17-.5-1.4h-2L9.5 17H8.3l2-6H12l2 6h-1.3ZM11 12.3l-.7 2.3h1.6l-.8-2.3Zm4.7 4.8c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .7.3.7.7 0 .4-.2.7-.7.7ZM11.4 27H8.7v-6h2.6c1.2 0 1.9.6 1.9 1.5 0 .6-.5 1.2-1 1.3.7.1 1.3.7 1.3 1.5 0 1-.8 1.7-2 1.7ZM10 22v1.5h1c.6 0 1-.3 1-.8 0-.4-.4-.7-1-.7h-1Zm0 4H11c.7 0 1.1-.3 1.1-.8 0-.6-.4-.9-1.1-.9H10V26Zm5.4 1.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7Zm-4.1 10c-1.8 0-2.8-1.1-2.8-3.1s1-3.1 2.8-3.1c1.4 0 2.5.9 2.6 2.2h-1.3c0-.7-.6-1.1-1.3-1.1-1 0-1.6.7-1.6 2s.6 2 1.6 2c.7 0 1.2-.4 1.4-1h1.2c-.1 1.3-1.2 2.2-2.6 2.2Zm4.5 0c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7Z"/></g></svg>',"list-num-upper-roman-rtl":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z"/><path d="M31.6 17v-1.2H33V17h-1.3Zm0 10v-1.2H33V27h-1.3Zm0 10v-1.2H33V37h-1.3Z"/><path fill-rule="nonzero" d="M34.5 20H36v7h-1.5zM34.5 30H36v7h-1.5zM37.5 20H39v7h-1.5zM37.5 30H39v7h-1.5zM40.5 30H42v7h-1.5zM34.5 10H36v7h-1.5z"/></g></svg>',"list-num-upper-roman":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/><path d="M15.1 17v-1.2h1.3V17H15Zm0 10v-1.2h1.3V27H15Zm0 10v-1.2h1.3V37H15Z"/><path fill-rule="nonzero" d="M12 20h1.5v7H12zM12 30h1.5v7H12zM9 20h1.5v7H9zM9 30h1.5v7H9zM6 30h1.5v7H6zM12 10h1.5v7H12z"/></g></svg>',lock:'<svg width="24" height="24"><path d="M16.3 11c.2 0 .3 0 .5.2l.2.6v7.4c0 .3 0 .4-.2.6l-.6.2H7.8c-.3 0-.4 0-.6-.2a.7.7 0 0 1-.2-.6v-7.4c0-.3 0-.4.2-.6l.5-.2H8V8c0-.8.3-1.5.9-2.1.6-.6 1.3-.9 2.1-.9h2c.8 0 1.5.3 2.1.9.6.6.9 1.3.9 2.1v3h.3ZM10 8v3h4V8a1 1 0 0 0-.3-.7A1 1 0 0 0 13 7h-2a1 1 0 0 0-.7.3 1 1 0 0 0-.3.7Z" fill-rule="evenodd"/></svg>',ltr:'<svg width="24" height="24"><path d="M11 5h7a1 1 0 0 1 0 2h-1v11a1 1 0 0 1-2 0V7h-2v11a1 1 0 0 1-2 0v-6c-.5 0-1 0-1.4-.3A3.4 3.4 0 0 1 7.8 10a3.3 3.3 0 0 1 0-2.8 3.4 3.4 0 0 1 1.8-1.8L11 5ZM4.4 16.2 6.2 15l-1.8-1.2a1 1 0 0 1 1.2-1.6l3 2a1 1 0 0 1 0 1.6l-3 2a1 1 0 1 1-1.2-1.6Z" fill-rule="evenodd"/></svg>',"math-equation":'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M9 4.8c.1-.5.5-.8 1-.8h10a1 1 0 1 1 0 2h-9.2L8.3 19.2a1 1 0 0 1-1.7.4l-3.4-4.2a1 1 0 0 1 1.6-1.2l2 2.5L9 4.8Zm9.7 5.5c.4.4.4 1 0 1.4L17 13.5l1.8 1.8a1 1 0 1 1-1.4 1.4L15.5 15l-1.8 1.8a1 1 0 0 1-1.4-1.4l1.8-1.8-1.8-1.8a1 1 0 0 1 1.4-1.4l1.8 1.8 1.8-1.8a1 1 0 0 1 1.4 0Z"/></svg>',minus:'<svg width="24" height="24"><path d="M19 11a1 1 0 0 1 .1 2H5a1 1 0 0 1-.1-2H19Z"/></svg>',"more-drawer":'<svg width="24" height="24"><path d="M6 10a2 2 0 0 0-2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2 2 2 0 0 0-2-2Zm12 0a2 2 0 0 0-2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2 2 2 0 0 0-2-2Zm-6 0a2 2 0 0 0-2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2 2 2 0 0 0-2-2Z" fill-rule="nonzero"/></svg>',"new-document":'<svg width="24" height="24"><path d="M14.4 3H7a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h10a2 2 0 0 0 2-2V7.6L14.4 3ZM17 19H7V5h6v4h4v10Z" fill-rule="nonzero"/></svg>',"new-tab":'<svg width="24" height="24"><path d="m15 13 2-2v8H5V7h8l-2 2H7v8h8v-4Zm4-8v5.5l-2-2-5.6 5.5H10v-1.4L15.5 7l-2-2H19Z" fill-rule="evenodd"/></svg>',"non-breaking":'<svg width="24" height="24"><path d="M11 11H8a1 1 0 1 1 0-2h3V6c0-.6.4-1 1-1s1 .4 1 1v3h3c.6 0 1 .4 1 1s-.4 1-1 1h-3v3c0 .6-.4 1-1 1a1 1 0 0 1-1-1v-3Zm10 4v5H3v-5c0-.6.4-1 1-1s1 .4 1 1v3h14v-3c0-.6.4-1 1-1s1 .4 1 1Z" fill-rule="evenodd"/></svg>',notice:'<svg width="24" height="24"><path d="M15.5 4 20 8.5v7L15.5 20h-7L4 15.5v-7L8.5 4h7ZM13 17v-2h-2v2h2Zm0-4V7h-2v6h2Z" fill-rule="evenodd" clip-rule="evenodd"/></svg>',"ordered-list-rtl":'<svg width="24" height="24"><path d="M6 17h8a1 1 0 0 1 0 2H6a1 1 0 0 1 0-2Zm0-6h8a1 1 0 0 1 0 2H6a1 1 0 0 1 0-2Zm0-6h8a1 1 0 0 1 0 2H6a1 1 0 1 1 0-2Zm13-1v3.5a.5.5 0 1 1-1 0V5h-.5a.5.5 0 1 1 0-1H19Zm-1 8.8.2.2h1.3a.5.5 0 1 1 0 1h-1.6a1 1 0 0 1-.9-1V13c0-.4.3-.8.6-1l1.2-.4.2-.3a.2.2 0 0 0-.2-.2h-1.3a.5.5 0 0 1-.5-.5c0-.3.2-.5.5-.5h1.6c.5 0 .9.4.9 1v.1c0 .4-.3.8-.6 1l-1.2.4-.2.3Zm2 4.2v2c0 .6-.4 1-1 1h-1.5a.5.5 0 0 1 0-1h1.2a.3.3 0 1 0 0-.6h-1.3a.4.4 0 1 1 0-.8h1.3a.3.3 0 0 0 0-.6h-1.2a.5.5 0 1 1 0-1H19c.6 0 1 .4 1 1Z" fill-rule="evenodd"/></svg>',"ordered-list":'<svg width="24" height="24"><path d="M10 17h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 1 1 0-2ZM6 4v3.5c0 .3-.2.5-.5.5a.5.5 0 0 1-.5-.5V5h-.5a.5.5 0 0 1 0-1H6Zm-1 8.8.2.2h1.3c.3 0 .5.2.5.5s-.2.5-.5.5H4.9a1 1 0 0 1-.9-1V13c0-.4.3-.8.6-1l1.2-.4.2-.3a.2.2 0 0 0-.2-.2H4.5a.5.5 0 0 1-.5-.5c0-.3.2-.5.5-.5h1.6c.5 0 .9.4.9 1v.1c0 .4-.3.8-.6 1l-1.2.4-.2.3ZM7 17v2c0 .6-.4 1-1 1H4.5a.5.5 0 0 1 0-1h1.2c.2 0 .3-.1.3-.3 0-.2-.1-.3-.3-.3H4.4a.4.4 0 1 1 0-.8h1.3c.2 0 .3-.1.3-.3 0-.2-.1-.3-.3-.3H4.5a.5.5 0 1 1 0-1H6c.6 0 1 .4 1 1Z" fill-rule="evenodd"/></svg>',orientation:'<svg width="24" height="24"><path d="M7.3 6.4 1 13l6.4 6.5 6.5-6.5-6.5-6.5ZM3.7 13l3.6-3.7L11 13l-3.7 3.7-3.6-3.7ZM12 6l2.8 2.7c.3.3.3.8 0 1-.3.4-.9.4-1.2 0L9.2 5.7a.8.8 0 0 1 0-1.2L13.6.2c.3-.3.9-.3 1.2 0 .3.3.3.8 0 1.1L12 4h1a9 9 0 1 1-4.3 16.9l1.5-1.5A7 7 0 1 0 13 6h-1Z" fill-rule="nonzero"/></svg>',outdent:'<svg width="24" height="24"><path d="M7 5h12c.6 0 1 .4 1 1s-.4 1-1 1H7a1 1 0 1 1 0-2Zm5 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 0 1 0-2Zm0 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 0 1 0-2Zm-5 4h12a1 1 0 0 1 0 2H7a1 1 0 0 1 0-2Zm1.6-3.8a1 1 0 0 1-1.2 1.6l-3-2a1 1 0 0 1 0-1.6l3-2a1 1 0 0 1 1.2 1.6L6.8 12l1.8 1.2Z" fill-rule="evenodd"/></svg>',"page-break":'<svg width="24" height="24"><g fill-rule="evenodd"><path d="M5 11c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 0 1 0-2Zm3 0h1c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 0 1 0-2Zm4 0c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 0 1 0-2Zm3 0h1c.6 0 1 .4 1 1s-.4 1-1 1h-1a1 1 0 0 1 0-2Zm4 0c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 0 1 0-2ZM7 3v5h10V3c0-.6.4-1 1-1s1 .4 1 1v7H5V3c0-.6.4-1 1-1s1 .4 1 1ZM6 22a1 1 0 0 1-1-1v-7h14v7c0 .6-.4 1-1 1a1 1 0 0 1-1-1v-5H7v5c0 .6-.4 1-1 1Z"/></g></svg>',paragraph:'<svg width="24" height="24"><path fill-rule="evenodd" d="M10 5h7a1 1 0 0 1 0 2h-1v11a1 1 0 0 1-2 0V7h-2v11a1 1 0 0 1-2 0v-6c-.5 0-1 0-1.4-.3A3.4 3.4 0 0 1 6.8 10a3.3 3.3 0 0 1 0-2.8 3.4 3.4 0 0 1 1.8-1.8L10 5Z"/></svg>',"paste-column-after":'<svg width="24" height="24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h7v2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2H9.2A3 3 0 0 1 12 1Zm8 7v12h-6V8h6Zm-1.5 1.5h-3v9h3v-9ZM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z"/></svg>',"paste-column-before":'<svg width="24" height="24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V18c0 1-.8 2-1.9 2H11v-2h7V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v2H4V5c0-1 .8-2 1.9-2H9.2A3 3 0 0 1 12 1Zm-2 7v12H4V8h6ZM8.5 9.5h-3v9h3v-9ZM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z"/></svg>',"paste-row-after":'<svg width="24" height="24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V11h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h14c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2H9.2A3 3 0 0 1 12 1Zm10 11v5H8v-5h14Zm-1.5 1.5h-11v2h11v-2ZM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z"/></svg>',"paste-row-before":'<svg width="24" height="24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h12v-4h2v4c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2H9.2A3 3 0 0 1 12 1Zm10 7v5H8V8h14Zm-1.5 1.5h-11v2h11v-2ZM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z"/></svg>',"paste-text":'<svg width="24" height="24"><path d="M18 9V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h3V9h9ZM9 20H6a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h3.2A3 3 0 0 1 12 1a3 3 0 0 1 2.8 2H18a2 2 0 0 1 2 2v4h1v12H9v-1Zm1.5-9.5v9h9v-9h-9ZM12 3a1 1 0 0 0-1 1c0 .5.4 1 1 1s1-.5 1-1-.4-1-1-1Zm0 9h6v2h-.5l-.5-1h-1v4h.8v1h-3.6v-1h.8v-4h-1l-.5 1H12v-2Z" fill-rule="nonzero"/></svg>',paste:'<svg width="24" height="24"><path d="M18 9V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h3V9h9ZM9 20H6a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h3.2A3 3 0 0 1 12 1a3 3 0 0 1 2.8 2H18a2 2 0 0 1 2 2v4h1v12H9v-1Zm1.5-9.5v9h9v-9h-9ZM12 3a1 1 0 0 0-1 1c0 .5.4 1 1 1s1-.5 1-1-.4-1-1-1Z" fill-rule="nonzero"/></svg>',"permanent-pen":'<svg width="24" height="24"><path d="M10.5 17.5 8 20H3v-3l3.5-3.5a2 2 0 0 1 0-3L14 3l1 1-7.3 7.3a1 1 0 0 0 0 1.4l3.6 3.6c.4.4 1 .4 1.4 0L20 9l1 1-7.6 7.6a2 2 0 0 1-2.8 0l-.1-.1Z" fill-rule="nonzero"/></svg>',plus:'<svg width="24" height="24"><path d="M12 4c.5 0 1 .4 1 .9V11h6a1 1 0 0 1 .1 2H13v6a1 1 0 0 1-2 .1V13H5a1 1 0 0 1-.1-2H11V5c0-.6.4-1 1-1Z"/></svg>',preferences:'<svg width="24" height="24"><path d="m20.1 13.5-1.9.2a5.8 5.8 0 0 1-.6 1.5l1.2 1.5c.4.4.3 1 0 1.4l-.7.7a1 1 0 0 1-1.4 0l-1.5-1.2a6.2 6.2 0 0 1-1.5.6l-.2 1.9c0 .5-.5.9-1 .9h-1a1 1 0 0 1-1-.9l-.2-1.9a5.8 5.8 0 0 1-1.5-.6l-1.5 1.2a1 1 0 0 1-1.4 0l-.7-.7a1 1 0 0 1 0-1.4l1.2-1.5a6.2 6.2 0 0 1-.6-1.5l-1.9-.2a1 1 0 0 1-.9-1v-1c0-.5.4-1 .9-1l1.9-.2a5.8 5.8 0 0 1 .6-1.5L5.2 7.3a1 1 0 0 1 0-1.4l.7-.7a1 1 0 0 1 1.4 0l1.5 1.2a6.2 6.2 0 0 1 1.5-.6l.2-1.9c0-.5.5-.9 1-.9h1c.5 0 1 .4 1 .9l.2 1.9a5.8 5.8 0 0 1 1.5.6l1.5-1.2a1 1 0 0 1 1.4 0l.7.7c.3.4.4 1 0 1.4l-1.2 1.5a6.2 6.2 0 0 1 .6 1.5l1.9.2c.5 0 .9.5.9 1v1c0 .5-.4 1-.9 1ZM12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z" fill-rule="evenodd"/></svg>',preview:'<svg width="24" height="24"><path d="M3.5 12.5c.5.8 1.1 1.6 1.8 2.3 2 2 4.2 3.2 6.7 3.2s4.7-1.2 6.7-3.2a16.2 16.2 0 0 0 2.1-2.8 15.7 15.7 0 0 0-2.1-2.8c-2-2-4.2-3.2-6.7-3.2a9.3 9.3 0 0 0-6.7 3.2A16.2 16.2 0 0 0 3.2 12c0 .2.2.3.3.5Zm-2.4-1 .7-1.2L4 7.8C6.2 5.4 8.9 4 12 4c3 0 5.8 1.4 8.1 3.8a18.2 18.2 0 0 1 2.8 3.7v1l-.7 1.2-2.1 2.5c-2.3 2.4-5 3.8-8.1 3.8-3 0-5.8-1.4-8.1-3.8a18.2 18.2 0 0 1-2.8-3.7 1 1 0 0 1 0-1Zm12-3.3a2 2 0 1 0 2.7 2.6 4 4 0 1 1-2.6-2.6Z" fill-rule="nonzero"/></svg>',print:'<svg width="24" height="24"><path d="M18 8H6a3 3 0 0 0-3 3v6h2v3h14v-3h2v-6a3 3 0 0 0-3-3Zm-1 10H7v-4h10v4Zm.5-5c-.8 0-1.5-.7-1.5-1.5s.7-1.5 1.5-1.5 1.5.7 1.5 1.5-.7 1.5-1.5 1.5Zm.5-8H6v2h12V5Z" fill-rule="nonzero"/></svg>',quote:'<svg width="24" height="24"><path d="M7.5 17h.9c.4 0 .7-.2.9-.6L11 13V8c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v4c0 .6.4 1 1 1h2l-1.3 2.7a1 1 0 0 0 .8 1.3Zm8 0h.9c.4 0 .7-.2.9-.6L19 13V8c0-.6-.4-1-1-1h-4a1 1 0 0 0-1 1v4c0 .6.4 1 1 1h2l-1.3 2.7a1 1 0 0 0 .8 1.3Z" fill-rule="nonzero"/></svg>',redo:'<svg width="24" height="24"><path d="M17.6 10H12c-2.8 0-4.4 1.4-4.9 3.5-.4 2 .3 4 1.4 4.6a1 1 0 1 1-1 1.8c-2-1.2-2.9-4.1-2.3-6.8.6-3 3-5.1 6.8-5.1h5.6l-3.3-3.3a1 1 0 1 1 1.4-1.4l5 5a1 1 0 0 1 0 1.4l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3Z" fill-rule="nonzero"/></svg>',reload:'<svg width="24" height="24"><g fill-rule="nonzero"><path d="m5 22.1-1.2-4.7v-.2a1 1 0 0 1 1-1l5 .4a1 1 0 1 1-.2 2l-2.2-.2a7.8 7.8 0 0 0 8.4.2 7.5 7.5 0 0 0 3.5-6.4 1 1 0 1 1 2 0 9.5 9.5 0 0 1-4.5 8 9.9 9.9 0 0 1-10.2 0l.4 1.4a1 1 0 1 1-2 .5ZM13.6 7.4c0-.5.5-1 1-.9l2.8.2a8 8 0 0 0-9.5-1 7.5 7.5 0 0 0-3.6 7 1 1 0 0 1-2 0 9.5 9.5 0 0 1 4.5-8.6 10 10 0 0 1 10.9.3l-.3-1a1 1 0 0 1 2-.5l1.1 4.8a1 1 0 0 1-1 1.2l-5-.4a1 1 0 0 1-.9-1Z"/></g></svg>',"remove-formatting":'<svg width="24" height="24"><path d="M13.2 6a1 1 0 0 1 0 .2l-2.6 10a1 1 0 0 1-1 .8h-.2a.8.8 0 0 1-.8-1l2.6-10H8a1 1 0 1 1 0-2h9a1 1 0 0 1 0 2h-3.8ZM5 18h7a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Zm13 1.5L16.5 18 15 19.5a.7.7 0 0 1-1-1l1.5-1.5-1.5-1.5a.7.7 0 0 1 1-1l1.5 1.5 1.5-1.5a.7.7 0 0 1 1 1L17.5 17l1.5 1.5a.7.7 0 0 1-1 1Z" fill-rule="evenodd"/></svg>',remove:'<svg width="24" height="24"><path d="M16 7h3a1 1 0 0 1 0 2h-1v9a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V9H5a1 1 0 1 1 0-2h3V6a3 3 0 0 1 3-3h2a3 3 0 0 1 3 3v1Zm-2 0V6c0-.6-.4-1-1-1h-2a1 1 0 0 0-1 1v1h4Zm2 2H8v9c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V9Zm-7 3a1 1 0 0 1 2 0v4a1 1 0 0 1-2 0v-4Zm4 0a1 1 0 0 1 2 0v4a1 1 0 0 1-2 0v-4Z" fill-rule="nonzero"/></svg>',"resize-handle":'<svg width="10" height="10"><g fill-rule="nonzero"><path d="M8.1 1.1A.5.5 0 1 1 9 2l-7 7A.5.5 0 1 1 1 8l7-7ZM8.1 5.1A.5.5 0 1 1 9 6l-3 3A.5.5 0 1 1 5 8l3-3Z"/></g></svg>',resize:'<svg width="24" height="24"><path d="M4 5c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h6c.3 0 .5.1.7.3.2.2.3.4.3.7 0 .3-.1.5-.3.7a1 1 0 0 1-.7.3H7.4L18 16.6V13c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3.3 0 .5.1.7.3.2.2.3.4.3.7v6c0 .3-.1.5-.3.7a1 1 0 0 1-.7.3h-6a1 1 0 0 1-.7-.3 1 1 0 0 1-.3-.7c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h3.6L6 7.4V11c0 .3-.1.5-.3.7a1 1 0 0 1-.7.3 1 1 0 0 1-.7-.3A1 1 0 0 1 4 11V5Z" fill-rule="evenodd"/></svg>',"restore-draft":'<svg width="24" height="24"><g fill-rule="evenodd"><path d="M17 13c0 .6-.4 1-1 1h-4V8c0-.6.4-1 1-1s1 .4 1 1v4h2c.6 0 1 .4 1 1Z"/><path d="M4.7 10H9a1 1 0 0 1 0 2H3a1 1 0 0 1-1-1V5a1 1 0 1 1 2 0v3l2.5-2.4a9.2 9.2 0 0 1 10.8-1.5A9 9 0 0 1 13.4 21c-2.4.1-4.7-.7-6.5-2.2a1 1 0 1 1 1.3-1.5 7.2 7.2 0 0 0 11.6-3.7 7 7 0 0 0-3.5-7.7A7.2 7.2 0 0 0 8 7L4.7 10Z" fill-rule="nonzero"/></g></svg>',"revision-history":'<svg width="24" height="24"><g fill-rule="evenodd"><path d="M17 13c0 .6-.4 1-1 1h-4V8c0-.6.4-1 1-1s1 .4 1 1v4h2c.6 0 1 .4 1 1Z"/><path d="M4.7 10H9a1 1 0 0 1 0 2H3a1 1 0 0 1-1-1V5a1 1 0 1 1 2 0v3l2.5-2.4a9.2 9.2 0 0 1 10.8-1.5A9 9 0 0 1 13.4 21c-2.4.1-4.7-.7-6.5-2.2a1 1 0 1 1 1.3-1.5 7.2 7.2 0 0 0 11.6-3.7 7 7 0 0 0-3.5-7.7A7.2 7.2 0 0 0 8 7L4.7 10Z" fill-rule="nonzero"/></g></svg>',"rotate-left":'<svg width="24" height="24"><path d="M4.7 10H9a1 1 0 0 1 0 2H3a1 1 0 0 1-1-1V5a1 1 0 1 1 2 0v3l2.5-2.4a9.2 9.2 0 0 1 10.8-1.5A9 9 0 0 1 13.4 21c-2.4.1-4.7-.7-6.5-2.2a1 1 0 1 1 1.3-1.5 7.2 7.2 0 0 0 11.6-3.7 7 7 0 0 0-3.5-7.7A7.2 7.2 0 0 0 8 7L4.7 10Z" fill-rule="nonzero"/></svg>',"rotate-right":'<svg width="24" height="24"><path d="M20 8V5a1 1 0 0 1 2 0v6c0 .6-.4 1-1 1h-6a1 1 0 0 1 0-2h4.3L16 7A7.2 7.2 0 0 0 7.7 6a7 7 0 0 0 3 13.1c1.9.1 3.7-.5 5-1.7a1 1 0 0 1 1.4 1.5A9.2 9.2 0 0 1 2.2 14c-.9-3.9 1-8 4.5-9.9 3.5-1.9 8-1.3 10.8 1.5L20 8Z" fill-rule="nonzero"/></svg>',rtl:'<svg width="24" height="24"><path d="M8 5h8v2h-2v12h-2V7h-2v12H8v-7c-.5 0-1 0-1.4-.3A3.4 3.4 0 0 1 4.8 10a3.3 3.3 0 0 1 0-2.8 3.4 3.4 0 0 1 1.8-1.8L8 5Zm12 11.2a1 1 0 1 1-1 1.6l-3-2a1 1 0 0 1 0-1.6l3-2a1 1 0 1 1 1 1.6L18.4 15l1.8 1.2Z" fill-rule="evenodd"/></svg>',save:'<svg width="24" height="24"><path d="M5 16h14a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2Zm0 2v2h14v-2H5Zm10 0h2v2h-2v-2Zm-4-6.4L8.7 9.3a1 1 0 1 0-1.4 1.4l4 4c.4.4 1 .4 1.4 0l4-4a1 1 0 1 0-1.4-1.4L13 11.6V4a1 1 0 0 0-2 0v7.6Z" fill-rule="nonzero"/></svg>',search:'<svg width="24" height="24"><path d="M16 17.3a8 8 0 1 1 1.4-1.4l4.3 4.4a1 1 0 0 1-1.4 1.4l-4.4-4.3Zm-5-.3a6 6 0 1 0 0-12 6 6 0 0 0 0 12Z" fill-rule="nonzero"/></svg>',"select-all":'<svg width="24" height="24"><path d="M3 5h2V3a2 2 0 0 0-2 2Zm0 8h2v-2H3v2Zm4 8h2v-2H7v2ZM3 9h2V7H3v2Zm10-6h-2v2h2V3Zm6 0v2h2a2 2 0 0 0-2-2ZM5 21v-2H3c0 1.1.9 2 2 2Zm-2-4h2v-2H3v2ZM9 3H7v2h2V3Zm2 18h2v-2h-2v2Zm8-8h2v-2h-2v2Zm0 8a2 2 0 0 0 2-2h-2v2Zm0-12h2V7h-2v2Zm0 8h2v-2h-2v2Zm-4 4h2v-2h-2v2Zm0-16h2V3h-2v2ZM7 17h10V7H7v10Zm2-8h6v6H9V9Z" fill-rule="nonzero"/></svg>',selected:'<svg width="24" height="24"><path fill-rule="nonzero" d="M6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2Zm3.6 10.9L7 12.3a.7.7 0 0 0-1 1L9.6 17 18 8.6a.7.7 0 0 0 0-1 .7.7 0 0 0-1 0l-7.4 7.3Z"/></svg>',send:'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="m13.3 22 7-18.3-18.3 7L9 15l4.3 7ZM18 6.8l-.7-.7L9.4 14l.7.7L18 6.8Z"/></svg>',settings:'<svg width="24" height="24"><path d="M11 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8v.3c0 .2 0 .3-.2.5l-.6.2H7.8c-.3 0-.4 0-.6-.2a.7.7 0 0 1-.2-.6V8H5a1 1 0 1 1 0-2h2v-.3c0-.2 0-.3.2-.5l.5-.2h2.5c.3 0 .4 0 .6.2l.2.5V6ZM8 8h2V6H8v2Zm9 2.8v.2h2c.6 0 1 .4 1 1s-.4 1-1 1h-2v.3c0 .2 0 .3-.2.5l-.6.2h-2.4c-.3 0-.4 0-.6-.2a.7.7 0 0 1-.2-.6V13H5a1 1 0 0 1 0-2h8v-.3c0-.2 0-.3.2-.5l.6-.2h2.4c.3 0 .4 0 .6.2l.2.6ZM14 13h2v-2h-2v2Zm-3 2.8v.2h8c.6 0 1 .4 1 1s-.4 1-1 1h-8v.3c0 .2 0 .3-.2.5l-.6.2H7.8c-.3 0-.4 0-.6-.2a.7.7 0 0 1-.2-.6V18H5a1 1 0 0 1 0-2h2v-.3c0-.2 0-.3.2-.5l.5-.2h2.5c.3 0 .4 0 .6.2l.2.6ZM8 18h2v-2H8v2Z" fill-rule="evenodd"/></svg>',sharpen:'<svg width="24" height="24"><path d="m16 6 4 4-8 9-8-9 4-4h8Zm-4 10.2 5.5-6.2-.1-.1H12v-.3h5.1l-.2-.2H12V9h4.6l-.2-.2H12v-.3h4.1l-.2-.2H12V8h3.6l-.2-.2H8.7L6.5 10l.1.1H12v.3H6.9l.2.2H12v.3H7.3l.2.2H12v.3H7.7l.3.2h4v.3H8.2l.2.2H12v.3H8.6l.3.2H12v.3H9l.3.2H12v.3H9.5l.2.2H12v.3h-2l.2.2H12v.3h-1.6l.2.2H12v.3h-1.1l.2.2h.9v.3h-.7l.2.2h.5v.3h-.3l.3.2Z" fill-rule="evenodd"/></svg>',sourcecode:'<svg width="24" height="24"><g fill-rule="nonzero"><path d="M9.8 15.7c.3.3.3.8 0 1-.3.4-.9.4-1.2 0l-4.4-4.1a.8.8 0 0 1 0-1.2l4.4-4.2c.3-.3.9-.3 1.2 0 .3.3.3.8 0 1.1L6 12l3.8 3.7ZM14.2 15.7c-.3.3-.3.8 0 1 .4.4.9.4 1.2 0l4.4-4.1c.3-.3.3-.9 0-1.2l-4.4-4.2a.8.8 0 0 0-1.2 0c-.3.3-.3.8 0 1.1L18 12l-3.8 3.7Z"/></g></svg>',"spell-check":'<svg width="24" height="24"><path d="M6 8v3H5V5c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h2c.3 0 .5.1.7.3.2.2.3.4.3.7v6H8V8H6Zm0-3v2h2V5H6Zm13 0h-3v5h3v1h-3a1 1 0 0 1-.7-.3 1 1 0 0 1-.3-.7V5c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h3v1Zm-5 1.5-.1.7c-.1.2-.3.3-.6.3.3 0 .5.1.6.3l.1.7V10c0 .3-.1.5-.3.7a1 1 0 0 1-.7.3h-3V4h3c.3 0 .5.1.7.3.2.2.3.4.3.7v1.5ZM13 10V8h-2v2h2Zm0-3V5h-2v2h2Zm3 5 1 1-6.5 7L7 15.5l1.3-1 2.2 2.2L16 12Z" fill-rule="evenodd"/></svg>',"strike-through":'<svg width="24" height="24"><g fill-rule="evenodd"><path d="M15.6 8.5c-.5-.7-1-1.1-1.3-1.3-.6-.4-1.3-.6-2-.6-2.7 0-2.8 1.7-2.8 2.1 0 1.6 1.8 2 3.2 2.3 4.4.9 4.6 2.8 4.6 3.9 0 1.4-.7 4.1-5 4.1A6.2 6.2 0 0 1 7 16.4l1.5-1.1c.4.6 1.6 2 3.7 2 1.6 0 2.5-.4 3-1.2.4-.8.3-2-.8-2.6-.7-.4-1.6-.7-2.9-1-1-.2-3.9-.8-3.9-3.6C7.6 6 10.3 5 12.4 5c2.9 0 4.2 1.6 4.7 2.4l-1.5 1.1Z"/><path d="M5 11h14a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Z" fill-rule="nonzero"/></g></svg>',subscript:'<svg width="24" height="24"><path d="m10.4 10 4.6 4.6-1.4 1.4L9 11.4 4.4 16 3 14.6 7.6 10 3 5.4 4.4 4 9 8.6 13.6 4 15 5.4 10.4 10ZM21 19h-5v-1l1-.8 1.7-1.6c.3-.4.5-.8.5-1.2 0-.3 0-.6-.2-.7-.2-.2-.5-.3-.9-.3a2 2 0 0 0-.8.2l-.7.3-.4-1.1 1-.6 1.2-.2c.8 0 1.4.3 1.8.7.4.4.6.9.6 1.5s-.2 1.1-.5 1.6a8 8 0 0 1-1.3 1.3l-.6.6h2.6V19Z" fill-rule="nonzero"/></svg>',superscript:'<svg width="24" height="24"><path d="M15 9.4 10.4 14l4.6 4.6-1.4 1.4L9 15.4 4.4 20 3 18.6 7.6 14 3 9.4 4.4 8 9 12.6 13.6 8 15 9.4Zm5.9 1.6h-5v-1l1-.8 1.7-1.6c.3-.5.5-.9.5-1.3 0-.3 0-.5-.2-.7-.2-.2-.5-.3-.9-.3l-.8.2-.7.4-.4-1.2c.2-.2.5-.4 1-.5.3-.2.8-.2 1.2-.2.8 0 1.4.2 1.8.6.4.4.6 1 .6 1.6 0 .5-.2 1-.5 1.5l-1.3 1.4-.6.5h2.6V11Z" fill-rule="nonzero"/></svg>',"table-caption":'<svg width="24" height="24"><g fill-rule="nonzero"><rect width="12" height="2" x="3" y="4" rx="1"/><path d="M19 8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-8c0-1.1.9-2 2-2h14ZM5 15v3h6v-3H5Zm14 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></g></svg>',"table-cell-classes":'<svg width="24" height="24"><g fill-rule="evenodd"><path fill-rule="nonzero" d="M13 4v9H3V6c0-1.1.9-2 2-2h8Zm-2 2H5v5h6V6Z"/><path fill-rule="nonzero" d="M13 4h6a2 2 0 0 1 2 2v7h-8v-2h6V6h-6V4Z" opacity=".2"/><path d="m18 20-2.6 1.6.7-3-2.4-2 3.1-.2 1.2-2.9 1.2 2.9 3.1.2-2.4 2 .7 3z"/><path fill-rule="nonzero" d="M3 13v5c0 1.1.9 2 2 2h8v-7h-2v5H5v-5H3Z" opacity=".2"/></g></svg>',"table-cell-properties":'<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 9H5v5h6v-5Zm8 0h-6v5h6v-5Zm-8-7H5v5h6V6Z"/></svg>',"table-cell-select-all":'<svg width="24" height="24"><g fill-rule="evenodd"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm0 2H5v12h14V6Z"/><path d="M13 6v5h6v2h-6v5h-2v-5H5v-2h6V6h2Z" opacity=".2"/></g></svg>',"table-cell-select-inner":'<svg width="24" height="24"><g fill-rule="evenodd"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm0 2H5v12h14V6Z" opacity=".2"/><path d="M13 6v5h6v2h-6v5h-2v-5H5v-2h6V6h2Z"/></g></svg>',"table-classes":'<svg width="24" height="24"><g fill-rule="evenodd"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v7h-8v7H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 9H5v5h6v-5Zm8-7h-6v5h6V6Zm-8 0H5v5h6V6Z"/><path d="m18 20-2.6 1.6.7-3-2.4-2 3.1-.2 1.2-2.9 1.2 2.9 3.1.2-2.4 2 .7 3z"/></g></svg>',"table-delete-column":'<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-4 4h-2V6h-2v2H9V6H5v12h4v-2h2v2h2v-2h2v2h4V6h-4v2Zm.3.5 1 1.2-3 2.3 3 2.3-1 1.2L12 13l-3.3 2.6-1-1.2 3-2.3-3-2.3 1-1.2L12 11l3.3-2.5Z"/></svg>',"table-delete-row":'<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm0 2H5v3h2.5v2H5v2h2.5v2H5v3h14v-3h-2.5v-2H19v-2h-2.5V9H19V6Zm-4.7 1.8 1.2 1L13 12l2.6 3.3-1.2 1-2.3-3-2.3 3-1.2-1L11 12 8.5 8.7l1.2-1 2.3 3 2.3-3Z"/></svg>',"table-delete-table":'<svg width="24" height="24"><g fill-rule="nonzero"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14ZM5 6v12h14V6H5Z"/><path d="m14.4 8.6 1.1 1-2.4 2.4 2.4 2.4-1.1 1.1-2.4-2.4-2.4 2.4-1-1.1 2.3-2.4-2.3-2.4 1-1 2.4 2.3z"/></g></svg>',"table-insert-column-after":'<svg width="24" height="24"><path fill-rule="nonzero" d="M20 4c.6 0 1 .4 1 1v2a1 1 0 0 1-2 0V6h-8v12h8v-1a1 1 0 0 1 2 0v2c0 .5-.4 1-.9 1H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h15ZM9 13H5v5h4v-5Zm7-5c.5 0 1 .4 1 .9V11h2a1 1 0 0 1 .1 2H17v2a1 1 0 0 1-2 .1V13h-2a1 1 0 0 1-.1-2H15V9c0-.6.4-1 1-1ZM9 6H5v5h4V6Z"/></svg>',"table-insert-column-before":'<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a1 1 0 0 1-1-1v-2a1 1 0 0 1 2 0v1h8V6H5v1a1 1 0 1 1-2 0V5c0-.6.4-1 1-1h15Zm0 9h-4v5h4v-5ZM8 8c.5 0 1 .4 1 .9V11h2a1 1 0 0 1 .1 2H9v2a1 1 0 0 1-2 .1V13H5a1 1 0 0 1-.1-2H7V9c0-.6.4-1 1-1Zm11-2h-4v5h4V6Z"/></svg>',"table-insert-row-above":'<svg width="24" height="24"><path fill-rule="nonzero" d="M6 4a1 1 0 1 1 0 2H5v6h14V6h-1a1 1 0 0 1 0-2h2c.6 0 1 .4 1 1v13a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5c0-.6.4-1 1-1h2Zm5 10H5v4h6v-4Zm8 0h-6v4h6v-4ZM12 3c.5 0 1 .4 1 .9V6h2a1 1 0 0 1 0 2h-2v2a1 1 0 0 1-2 .1V8H9a1 1 0 0 1 0-2h2V4c0-.6.4-1 1-1Z"/></svg>',"table-insert-row-after":'<svg width="24" height="24"><path fill-rule="nonzero" d="M12 13c.5 0 1 .4 1 .9V16h2a1 1 0 0 1 .1 2H13v2a1 1 0 0 1-2 .1V18H9a1 1 0 0 1-.1-2H11v-2c0-.6.4-1 1-1Zm6 7a1 1 0 0 1 0-2h1v-6H5v6h1a1 1 0 0 1 0 2H4a1 1 0 0 1-1-1V6c0-1.1.9-2 2-2h14a2 2 0 0 1 2 2v13c0 .5-.4 1-.9 1H18ZM11 6H5v4h6V6Zm8 0h-6v4h6V6Z"/></svg>',"table-left-header":'<svg width="24" height="24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm0 9h-4v5h4v-5Zm-6 0H9v5h4v-5Zm0-7H9v5h4V6Zm6 0h-4v5h4V6Z"/></svg>',"table-merge-cells":'<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14ZM5 15.5V18h3v-2.5H5Zm14-5h-9V18h9v-7.5ZM19 6h-4v2.5h4V6ZM8 6H5v2.5h3V6Zm5 0h-3v2.5h3V6Zm-8 7.5h3v-3H5v3Z"/></svg>',"table-row-numbering-rtl":'<svg width="24" height="24"><path d="M6 4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2H6Zm0 12h8v3H6v-3Zm11 0c.6 0 1 .4 1 1v1a1 1 0 0 1-2 0v-1c0-.6.4-1 1-1ZM6 11h8v3H6v-3Zm11 0c.6 0 1 .4 1 1v1a1 1 0 0 1-2 0v-1c0-.6.4-1 1-1ZM6 6h8v3H6V6Zm11 0c.6 0 1 .4 1 1v1a1 1 0 1 1-2 0V7c0-.6.4-1 1-1Z"/></svg>',"table-row-numbering":'<svg width="24" height="24"><path d="M18 4a2 2 0 0 1 2 2v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h12Zm0 12h-8v3h8v-3ZM7 16a1 1 0 0 0-1 1v1a1 1 0 0 0 2 0v-1c0-.6-.4-1-1-1Zm11-5h-8v3h8v-3ZM7 11a1 1 0 0 0-1 1v1a1 1 0 0 0 2 0v-1c0-.6-.4-1-1-1Zm11-5h-8v3h8V6ZM7 6a1 1 0 0 0-1 1v1a1 1 0 1 0 2 0V7c0-.6-.4-1-1-1Z"/></svg>',"table-row-properties":'<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14ZM5 15v3h6v-3H5Zm14 0h-6v3h6v-3Zm0-9h-6v3h6V6ZM5 9h6V6H5v3Z"/></svg>',"table-split-cells":'<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14ZM8 15.5H5V18h3v-2.5Zm11-5h-9V18h9v-7.5Zm-2.5 1 1 1-2 2 2 2-1 1-2-2-2 2-1-1 2-2-2-2 1-1 2 2 2-2Zm-8.5-1H5v3h3v-3ZM19 6h-4v2.5h4V6ZM8 6H5v2.5h3V6Zm5 0h-3v2.5h3V6Z"/></svg>',"table-top-header":'<svg width="24" height="24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 11H5v3h6v-3Zm8 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></svg>',table:'<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14ZM5 14v4h6v-4H5Zm14 0h-6v4h6v-4Zm0-6h-6v4h6V8ZM5 12h6V8H5v4Z"/></svg>',"template-add":'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M9 12v4H5a2 2 0 0 0-2 2v3h9.3a6 6 0 0 1-.3-2H5v-1h7a6 6 0 0 1 .8-2H11v-5l-.8-.6a3 3 0 1 1 3.6 0l-.8.6v4.7a6 6 0 0 1 2-1.9V12a5 5 0 1 0-6 0Z"/><path d="M18 15c.5 0 1 .4 1 .9V18h2a1 1 0 0 1 .1 2H19v2a1 1 0 0 1-2 .1V20h-2a1 1 0 0 1-.1-2H17v-2c0-.6.4-1 1-1Z"/></svg>',template:'<svg width="24" height="24"><path d="M19 19v-1H5v1h14ZM9 16v-4a5 5 0 1 1 6 0v4h4a2 2 0 0 1 2 2v3H3v-3c0-1.1.9-2 2-2h4Zm4 0v-5l.8-.6a3 3 0 1 0-3.6 0l.8.6v5h2Z" fill-rule="nonzero"/></svg>',"temporary-placeholder":'<svg width="24" height="24"><g fill-rule="evenodd"><path d="M9 7.6V6h2.5V4.5a.5.5 0 1 1 1 0V6H15v1.6a8 8 0 1 1-6 0Zm-2.6 5.3a.5.5 0 0 0 .3.6c.3 0 .6 0 .6-.3l.1-.2a5 5 0 0 1 3.3-2.8c.3-.1.4-.4.4-.6-.1-.3-.4-.5-.6-.4a6 6 0 0 0-4.1 3.7Z"/><circle cx="14" cy="4" r="1"/><circle cx="12" cy="2" r="1"/><circle cx="10" cy="4" r="1"/></g></svg>',"text-color":'<svg width="24" height="24"><g fill-rule="evenodd"><path class="tox-icon-text-color__color" d="M3 18h18v3H3z"/><path d="M8.7 16h-.8a.5.5 0 0 1-.5-.6l2.7-9c.1-.3.3-.4.5-.4h2.8c.2 0 .4.1.5.4l2.7 9a.5.5 0 0 1-.5.6h-.8a.5.5 0 0 1-.4-.4l-.7-2.2c0-.3-.3-.4-.5-.4h-3.4c-.2 0-.4.1-.5.4l-.7 2.2c0 .3-.2.4-.4.4Zm2.6-7.6-.6 2a.5.5 0 0 0 .5.6h1.6a.5.5 0 0 0 .5-.6l-.6-2c0-.3-.3-.4-.5-.4h-.4c-.2 0-.4.1-.5.4Z"/></g></svg>',"text-size-decrease":'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M14 5a1 1 0 1 1 0 2h-4v11a1 1 0 1 1-2 0V7H4a1 1 0 0 1 0-2h10ZM14 12a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2h-6Z"/></svg>',"text-size-increase":'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M14 5a1 1 0 1 1 0 2h-4v11a1 1 0 1 1-2 0V7H4a1 1 0 0 1 0-2h10ZM17 9a1 1 0 0 0-1 1v2h-2a1 1 0 1 0 0 2h2v2a1 1 0 1 0 2 0v-2h2a1 1 0 1 0 0-2h-2v-2c0-.6-.4-1-1-1Z"/></svg>',toc:'<svg width="24" height="24"><path d="M5 5c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 1 1 0-2Zm3 0h11c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 1 1 0-2Zm-3 8c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 0 1 0-2Zm3 0h11c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 0 1 0-2Zm0-4c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 1 1 0-2Zm3 0h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm-3 8c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 0 1 0-2Zm3 0h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Z" fill-rule="evenodd"/></svg>',translate:'<svg width="24" height="24"><path d="m12.7 14.3-.3.7-.4.7-2.2-2.2-3.1 3c-.3.4-.8.4-1 0a.7.7 0 0 1 0-1l3.1-3A12.4 12.4 0 0 1 6.7 9H8a10.1 10.1 0 0 0 1.7 2.4c.5-.5 1-1.1 1.4-1.8l.9-2H4.7a.7.7 0 1 1 0-1.5h4.4v-.7c0-.4.3-.8.7-.8.4 0 .7.4.7.8v.7H15c.4 0 .8.3.8.7 0 .4-.4.8-.8.8h-1.4a12.3 12.3 0 0 1-1 2.4 13.5 13.5 0 0 1-1.7 2.3l1.9 1.8Zm4.3-3 2.7 7.3a.5.5 0 0 1-.4.7 1 1 0 0 1-1-.7l-.6-1.5h-3.4l-.6 1.5a1 1 0 0 1-1 .7.5.5 0 0 1-.4-.7l2.7-7.4a1 1 0 0 1 2 0Zm-2.2 4.4h2.4L16 12.5l-1.2 3.2Z" fill-rule="evenodd"/></svg>',typography:'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M17 5a1 1 0 1 1 0 2h-4v11a1 1 0 1 1-2 0V7H7a1 1 0 0 1 0-2h10Z"/><path d="m17.5 14 .8-1.7 1.7-.8-1.7-.8-.8-1.7-.8 1.7-1.7.8 1.7.8.8 1.7ZM7 14l1 2 2 1-2 1-1 2-1-2-2-1 2-1 1-2Z"/></svg>',underline:'<svg width="24" height="24"><path d="M16 5c.6 0 1 .4 1 1v5.5a4 4 0 0 1-.4 1.8l-1 1.4a5.3 5.3 0 0 1-5.5 1 5 5 0 0 1-1.6-1c-.5-.4-.8-.9-1.1-1.4a4 4 0 0 1-.4-1.8V6c0-.6.4-1 1-1s1 .4 1 1v5.5c0 .3 0 .6.2 1l.6.7a3.3 3.3 0 0 0 2.2.8 3.4 3.4 0 0 0 2.2-.8c.3-.2.4-.5.6-.8l.2-.9V6c0-.6.4-1 1-1ZM8 17h8c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 0 1 0-2Z" fill-rule="evenodd"/></svg>',undo:'<svg width="24" height="24"><path d="M6.4 8H12c3.7 0 6.2 2 6.8 5.1.6 2.7-.4 5.6-2.3 6.8a1 1 0 0 1-1-1.8c1.1-.6 1.8-2.7 1.4-4.6-.5-2.1-2.1-3.5-4.9-3.5H6.4l3.3 3.3a1 1 0 1 1-1.4 1.4l-5-5a1 1 0 0 1 0-1.4l5-5a1 1 0 0 1 1.4 1.4L6.4 8Z" fill-rule="nonzero"/></svg>',unlink:'<svg width="24" height="24"><path d="M6.2 12.3a1 1 0 0 1 1.4 1.4l-2 2a2 2 0 1 0 2.6 2.8l4.8-4.8a1 1 0 0 0 0-1.4 1 1 0 1 1 1.4-1.3 2.9 2.9 0 0 1 0 4L9.6 20a3.9 3.9 0 0 1-5.5-5.5l2-2Zm11.6-.6a1 1 0 0 1-1.4-1.4l2.1-2a2 2 0 1 0-2.7-2.8L11 10.3a1 1 0 0 0 0 1.4A1 1 0 1 1 9.6 13a2.9 2.9 0 0 1 0-4L14.4 4a3.9 3.9 0 0 1 5.5 5.5l-2 2ZM7.6 6.3a.8.8 0 0 1-1 1.1L3.3 4.2a.7.7 0 1 1 1-1l3.2 3.1ZM5.1 8.6a.8.8 0 0 1 0 1.5H3a.8.8 0 0 1 0-1.5H5Zm5-3.5a.8.8 0 0 1-1.5 0V3a.8.8 0 0 1 1.5 0V5Zm6 11.8a.8.8 0 0 1 1-1l3.2 3.2a.8.8 0 0 1-1 1L16 17Zm-2.2 2a.8.8 0 0 1 1.5 0V21a.8.8 0 0 1-1.5 0V19Zm5-3.5a.7.7 0 1 1 0-1.5H21a.8.8 0 0 1 0 1.5H19Z" fill-rule="nonzero"/></svg>',unlock:'<svg width="24" height="24"><path d="M16 5c.8 0 1.5.3 2.1.9.6.6.9 1.3.9 2.1v3h-2V8a1 1 0 0 0-.3-.7A1 1 0 0 0 16 7h-2a1 1 0 0 0-.7.3 1 1 0 0 0-.3.7v3h.3c.2 0 .3 0 .5.2l.2.6v7.4c0 .3 0 .4-.2.6l-.6.2H4.8c-.3 0-.4 0-.6-.2a.7.7 0 0 1-.2-.6v-7.4c0-.3 0-.4.2-.6l.5-.2H11V8c0-.8.3-1.5.9-2.1.6-.6 1.3-.9 2.1-.9h2Z" fill-rule="evenodd"/></svg>',"unordered-list":'<svg width="24" height="24"><path d="M11 5h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2ZM4.5 6c0-.4.1-.8.4-1 .3-.4.7-.5 1.1-.5.4 0 .8.1 1 .4.4.3.5.7.5 1.1 0 .4-.1.8-.4 1-.3.4-.7.5-1.1.5-.4 0-.8-.1-1-.4-.4-.3-.5-.7-.5-1.1Zm0 6c0-.4.1-.8.4-1 .3-.4.7-.5 1.1-.5.4 0 .8.1 1 .4.4.3.5.7.5 1.1 0 .4-.1.8-.4 1-.3.4-.7.5-1.1.5-.4 0-.8-.1-1-.4-.4-.3-.5-.7-.5-1.1Zm0 6c0-.4.1-.8.4-1 .3-.4.7-.5 1.1-.5.4 0 .8.1 1 .4.4.3.5.7.5 1.1 0 .4-.1.8-.4 1-.3.4-.7.5-1.1.5-.4 0-.8-.1-1-.4-.4-.3-.5-.7-.5-1.1Z" fill-rule="evenodd"/></svg>',unselected:'<svg width="24" height="24"><path fill-rule="nonzero" d="M6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2Zm0 1a1 1 0 0 0-1 1v12c0 .6.4 1 1 1h12c.6 0 1-.4 1-1V6c0-.6-.4-1-1-1H6Z"/></svg>',upload:'<svg width="24" height="24"><path d="M18 19v-2a1 1 0 0 1 2 0v3c0 .6-.4 1-1 1H5a1 1 0 0 1-1-1v-3a1 1 0 0 1 2 0v2h12ZM11 6.4 8.7 8.7a1 1 0 0 1-1.4-1.4l4-4a1 1 0 0 1 1.4 0l4 4a1 1 0 1 1-1.4 1.4L13 6.4V16a1 1 0 0 1-2 0V6.4Z" fill-rule="nonzero"/></svg>',user:'<svg width="24" height="24"><path d="M12 24a12 12 0 1 1 0-24 12 12 0 0 1 0 24Zm-8.7-5.3a11 11 0 0 0 17.4 0C19.4 16.3 14.6 15 12 15c-2.6 0-7.4 1.3-8.7 3.7ZM12 13c2.2 0 4-2 4-4.5S14.2 4 12 4 8 6 8 8.5 9.8 13 12 13Z" fill-rule="nonzero"/></svg>',"vertical-align":'<svg width="24" height="24"><g fill-rule="nonzero"><rect width="18" height="2" x="3" y="11" rx="1"/><path d="M12 2c.6 0 1 .4 1 1v4l2-1.3a1 1 0 0 1 1.2 1.5l-.1.1-4.1 3-4-3a1 1 0 0 1 1-1.7l2 1.5V3c0-.6.4-1 1-1zm0 11.8 4 2.9a1 1 0 0 1-1 1.7l-2-1.5V21c0 .5-.4 1-.9 1H12a1 1 0 0 1-1-1v-4l-2 1.3a1 1 0 0 1-1.2-.1l-.1-.1a1 1 0 0 1 .1-1.3l.1-.1 4.1-3z"/></g></svg>',visualblocks:'<svg width="24" height="24"><path d="M9 19v2H7v-2h2Zm-4 0v2a2 2 0 0 1-2-2h2Zm8 0v2h-2v-2h2Zm8 0a2 2 0 0 1-2 2v-2h2Zm-4 0v2h-2v-2h2ZM15 7a1 1 0 0 1 0 2v7a1 1 0 0 1-2 0V9h-1v7a1 1 0 0 1-2 0v-4a2.5 2.5 0 0 1-.2-5H15ZM5 15v2H3v-2h2Zm16 0v2h-2v-2h2ZM5 11v2H3v-2h2Zm16 0v2h-2v-2h2ZM5 7v2H3V7h2Zm16 0v2h-2V7h2ZM5 3v2H3c0-1.1.9-2 2-2Zm8 0v2h-2V3h2Zm6 0a2 2 0 0 1 2 2h-2V3ZM9 3v2H7V3h2Zm8 0v2h-2V3h2Z" fill-rule="evenodd"/></svg>',visualchars:'<svg width="24" height="24"><path d="M10 5h7a1 1 0 0 1 0 2h-1v11a1 1 0 0 1-2 0V7h-2v11a1 1 0 0 1-2 0v-6c-.5 0-1 0-1.4-.3A3.4 3.4 0 0 1 6.8 10a3.3 3.3 0 0 1 0-2.8 3.4 3.4 0 0 1 1.8-1.8L10 5Z" fill-rule="evenodd"/></svg>',warning:'<svg width="24" height="24"><path d="M19.8 18.3c.2.5.3.9 0 1.2-.1.3-.5.5-1 .5H5.2c-.5 0-.9-.2-1-.5-.3-.3-.2-.7 0-1.2L11 4.7l.5-.5.5-.2c.2 0 .3 0 .5.2.2 0 .3.3.5.5l6.8 13.6ZM12 18c.3 0 .5-.1.7-.3.2-.2.3-.4.3-.7a1 1 0 0 0-.3-.7 1 1 0 0 0-.7-.3 1 1 0 0 0-.7.3 1 1 0 0 0-.3.7c0 .3.1.5.3.7.2.2.4.3.7.3Zm.7-3 .3-4a1 1 0 0 0-.3-.7 1 1 0 0 0-.7-.3 1 1 0 0 0-.7.3 1 1 0 0 0-.3.7l.3 4h1.4Z" fill-rule="evenodd"/></svg>',"zoom-in":'<svg width="24" height="24"><path d="M16 17.3a8 8 0 1 1 1.4-1.4l4.3 4.4a1 1 0 0 1-1.4 1.4l-4.4-4.3Zm-5-.3a6 6 0 1 0 0-12 6 6 0 0 0 0 12Zm-1-9a1 1 0 0 1 2 0v6a1 1 0 0 1-2 0V8Zm-2 4a1 1 0 0 1 0-2h6a1 1 0 0 1 0 2H8Z" fill-rule="nonzero"/></svg>',"zoom-out":'<svg width="24" height="24"><path d="M16 17.3a8 8 0 1 1 1.4-1.4l4.3 4.4a1 1 0 0 1-1.4 1.4l-4.4-4.3Zm-5-.3a6 6 0 1 0 0-12 6 6 0 0 0 0 12Zm-3-5a1 1 0 0 1 0-2h6a1 1 0 0 1 0 2H8Z" fill-rule="nonzero"/></svg>',"export-pdf":'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V17h-2V9h-4V5H7v3H5V5c0-1.1.9-2 2-2Z"/><path d="M2.6 15.2v-1.9h1c.6 0 1-.2 1.4-.5.3-.3.5-.7.5-1.2s-.2-.9-.5-1.2a2 2 0 0 0-1.3-.4H1v5.2h1.6Zm.4-3h-.4v-1.1h.5l.6.1.2.5c0 .1 0 .3-.2.4l-.7.1Zm5.7 3 1-.1c.3 0 .5-.2.7-.4l.5-.8c.2-.3.2-.7.2-1.3v-1l-.5-.8c-.2-.3-.4-.5-.7-.6L8.7 10H6.3v5.2h2.4Zm-.4-1.1H8v-3h.4c.5 0 .8.2 1 .4l.2 1.1-.1 1-.3.3-.8.2Zm5.3 1.2V13h2v-1h-2v-1H16V10h-4v5.2h1.6Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M15 17a1 1 0 1 0-2 0v3.1l-1.4-1a1 1 0 1 0-1.2 1.7l3.6 2.4 3.6-2.4a1 1 0 0 0-1.2-1.6l-1.4 1V17Z"/></svg>',"export-word":'<svg width="24" height="24"><path d="M9.5 7A1.5 1.5 0 0 1 11 8.4v7.1A1.5 1.5 0 0 1 9.6 17H2.5A1.5 1.5 0 0 1 1 15.6V8.5A1.5 1.5 0 0 1 2.4 7h7.1Zm-1 2.8-1 2.6-1-2.5v-.1a.6.6 0 0 0-1 0l-.1.1-.9 2.5-1-2.5v-.1a.6.6 0 0 0-1 .4v.1l1.5 4v.1a.6.6 0 0 0 1 0v-.1l1-2.5.9 2.5v.1a.6.6 0 0 0 1 0H8l1.6-4v-.2a.6.6 0 0 0-1.1-.4Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V17h-2V9h-4V5H5c0-1.1.9-2 2-2ZM15 17a1 1 0 1 0-2 0v3.1l-1.4-1a1 1 0 1 0-1.2 1.7l3.6 2.4 3.6-2.4a1 1 0 0 0-1.2-1.6l-1.4 1V17Z"/></svg>',"import-word":'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V15h-2V9h-4V5H5c0-1.1.9-2 2-2Z"/><path d="M9.5 7A1.5 1.5 0 0 1 11 8.4v7.1A1.5 1.5 0 0 1 9.6 17H2.5A1.5 1.5 0 0 1 1 15.6V8.5A1.5 1.5 0 0 1 2.4 7h7.1Zm-1 2.8-1 2.6-1-2.5v-.1a.6.6 0 0 0-1 0l-.1.1-.9 2.5-1-2.5v-.1a.6.6 0 0 0-1 .4v.1l1.5 4v.1a.6.6 0 0 0 1 0v-.1l1-2.5.9 2.5v.1a.6.6 0 0 0 1 0H8l1.6-4v-.2a.6.6 0 0 0-1.1-.4Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M11.4 18.2a1 1 0 0 0 1.2 1.6l1.4-1V22a1 1 0 1 0 2 0v-3.1l1.4 1a1 1 0 0 0 1.2-1.7L15 15.8l-3.6 2.4Z"/></svg>'}});(function(){const l=Object.getPrototypeOf,n=(r,c,f)=>{var m;return!!f(r,c.prototype)||((m=r.constructor)===null||m===void 0?void 0:m.name)===c.name},o=r=>c=>(f=>{const m=typeof f;return f===null?"null":m==="object"&&Array.isArray(f)?"array":m==="object"&&n(f,String,(x,y)=>y.isPrototypeOf(x))?"string":m})(c)===r,i=r=>c=>typeof c===r,u=r=>c=>r===c,h=o("string"),g=o("object"),b=r=>((c,f)=>g(c)&&n(c,f,(m,x)=>l(m)===x))(r,Object),S=o("array"),T=u(null),k=i("boolean"),R=u(void 0),V=r=>r==null,z=r=>!V(r),$=i("function"),W=i("number"),Q=(r,c)=>{if(S(r)){for(let f=0,m=r.length;f<m;++f)if(!c(r[f]))return!1;return!0}return!1},j=()=>{},se=r=>()=>r(),re=(r,c)=>(...f)=>r(c.apply(null,f)),Y=r=>()=>r,me=r=>r,ae=(r,c)=>r===c;function Ce(r,...c){return(...f)=>{const m=c.concat(f);return r.apply(null,m)}}const Ue=r=>c=>!r(c),ot=r=>()=>{throw new Error(r)},Ae=r=>r(),ve=Y(!1),Oe=Y(!0);class O{constructor(c,f){this.tag=c,this.value=f}static some(c){return new O(!0,c)}static none(){return O.singletonNone}fold(c,f){return this.tag?f(this.value):c()}isSome(){return this.tag}isNone(){return!this.tag}map(c){return this.tag?O.some(c(this.value)):O.none()}bind(c){return this.tag?c(this.value):O.none()}exists(c){return this.tag&&c(this.value)}forall(c){return!this.tag||c(this.value)}filter(c){return!this.tag||c(this.value)?this:O.none()}getOr(c){return this.tag?this.value:c}or(c){return this.tag?this:c}getOrThunk(c){return this.tag?this.value:c()}orThunk(c){return this.tag?this:c()}getOrDie(c){if(this.tag)return this.value;throw new Error(c??"Called getOrDie on None")}static from(c){return z(c)?O.some(c):O.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(c){this.tag&&c(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}O.singletonNone=new O(!1);const De=Array.prototype.slice,Fe=Array.prototype.indexOf,st=Array.prototype.push,Ut=(r,c)=>Fe.call(r,c),et=(r,c)=>Ut(r,c)>-1,Dt=(r,c)=>{for(let f=0,m=r.length;f<m;f++)if(c(r[f],f))return!0;return!1},Xe=(r,c)=>{const f=[];for(let m=0;m<r;m++)f.push(c(m));return f},it=(r,c)=>{const f=[];for(let m=0;m<r.length;m+=c){const x=De.call(r,m,m+c);f.push(x)}return f},qe=(r,c)=>{const f=r.length,m=new Array(f);for(let x=0;x<f;x++){const y=r[x];m[x]=c(y,x)}return m},mt=(r,c)=>{for(let f=0,m=r.length;f<m;f++)c(r[f],f)},Un=(r,c)=>{const f=[],m=[];for(let x=0,y=r.length;x<y;x++){const E=r[x];(c(E,x)?f:m).push(E)}return{pass:f,fail:m}},on=(r,c)=>{const f=[];for(let m=0,x=r.length;m<x;m++){const y=r[m];c(y,m)&&f.push(y)}return f},vt=(r,c,f)=>(((m,x)=>{for(let y=m.length-1;y>=0;y--)x(m[y],y)})(r,(m,x)=>{f=c(f,m,x)}),f),an=(r,c,f)=>(mt(r,(m,x)=>{f=c(f,m,x)}),f),J=(r,c)=>((f,m,x)=>{for(let y=0,E=f.length;y<E;y++){const D=f[y];if(m(D,y))return O.some(D);if(x(D,y))break}return O.none()})(r,c,ve),Bn=(r,c)=>{for(let f=0,m=r.length;f<m;f++)if(c(r[f],f))return O.some(f);return O.none()},Vn=r=>{const c=[];for(let f=0,m=r.length;f<m;++f){if(!S(r[f]))throw new Error("Arr.flatten item "+f+" was not an array, input: "+r);st.apply(c,r[f])}return c},Rn=(r,c)=>Vn(qe(r,c)),An=(r,c)=>{for(let f=0,m=r.length;f<m;++f)if(c(r[f],f)!==!0)return!1;return!0},jn=r=>{const c=De.call(r,0);return c.reverse(),c},to=(r,c)=>on(r,f=>!et(c,f)),mo=(r,c)=>{const f={};for(let m=0,x=r.length;m<x;m++){const y=r[m];f[String(y)]=c(y,m)}return f},$t=r=>[r],xe=(r,c)=>{const f=De.call(r,0);return f.sort(c),f},It=(r,c)=>c>=0&&c<r.length?O.some(r[c]):O.none(),Dn=r=>It(r,0),Ct=r=>It(r,r.length-1),yo=$(Array.from)?Array.from:r=>De.call(r),Kn=(r,c)=>{for(let f=0;f<r.length;f++){const m=c(r[f],f);if(m.isSome())return m}return O.none()},Jt=Object.keys,Qt=Object.hasOwnProperty,Cn=(r,c)=>{const f=Jt(r);for(let m=0,x=f.length;m<x;m++){const y=f[m];c(r[y],y)}},Nn=(r,c)=>kt(r,(f,m)=>({k:m,v:c(f,m)})),kt=(r,c)=>{const f={};return Cn(r,(m,x)=>{const y=c(m,x);f[y.k]=y.v}),f},jo=r=>(c,f)=>{r[f]=c},ms=(r,c,f,m)=>{Cn(r,(x,y)=>{(c(x,y)?f:m)(x,y)})},as=(r,c)=>{const f={};return ms(r,c,jo(f),j),f},xt=(r,c)=>{const f=[];return Cn(r,(m,x)=>{f.push(c(m,x))}),f},Pt=(r,c)=>{const f=Jt(r);for(let m=0,x=f.length;m<x;m++){const y=f[m],E=r[y];if(c(E,y,r))return O.some(E)}return O.none()},gn=r=>xt(r,me),At=(r,c)=>On(r,c)?O.from(r[c]):O.none(),On=(r,c)=>Qt.call(r,c),In=(r,c)=>On(r,c)&&r[c]!==void 0&&r[c]!==null,Is=(r,c,f=ae)=>r.exists(m=>f(m,c)),kr=r=>{const c=[],f=m=>{c.push(m)};for(let m=0;m<r.length;m++)r[m].each(f);return c},Yt=(r,c,f)=>r.isSome()&&c.isSome()?O.some(f(r.getOrDie(),c.getOrDie())):O.none(),Ps=(r,c)=>r!=null?O.some(c(r)):O.none(),qo=(r,c)=>r?O.some(c):O.none(),_i=(r,c,f)=>c===""||r.length>=c.length&&r.substr(f,f+c.length)===c,bs=(r,c)=>Bl(r,c)?((f,m)=>f.substring(m))(r,c.length):r,Ar=(r,c,f=0,m)=>{const x=r.indexOf(c,f);return x!==-1&&(!!R(m)||x+c.length<=m)},Bl=(r,c)=>_i(r,c,0),aa=(r,c)=>_i(r,c,r.length-c.length),ps=(Ih=/^\s+|\s+$/g,r=>r.replace(Ih,"")),dn=r=>r.length>0,vo=r=>!dn(r),Gn=r=>r.style!==void 0&&$(r.style.getPropertyValue),yn=r=>{if(r==null)throw new Error("Node cannot be null or undefined");return{dom:r}},vr=(r,c)=>{const f=(c||document).createElement("div");if(f.innerHTML=r,!f.hasChildNodes()||f.childNodes.length>1){const m="HTML does not have a single root node";throw console.error(m,r),new Error(m)}return yn(f.childNodes[0])},ao=(r,c)=>{const f=(c||document).createElement(r);return yn(f)},ze=(r,c)=>{const f=(c||document).createTextNode(r);return yn(f)},Ie=yn,Ot=typeof window<"u"?window:Function("return this;")(),_t=(r,c)=>((f,m)=>{let x=m??Ot;for(let y=0;y<f.length&&x!=null;++y)x=x[f[y]];return x})(r.split("."),c),Nt=Object.getPrototypeOf,_n=r=>{const c=_t("ownerDocument.defaultView",r);return g(r)&&((f=>((m,x)=>{const y=((E,D)=>_t(E,D))(m,x);if(y==null)throw new Error(m+" not available on this browser");return y})("HTMLElement",f))(c).prototype.isPrototypeOf(r)||/^HTML\w*Element$/.test(Nt(r).constructor.name))},sn=r=>r.dom.nodeName.toLowerCase(),Tn=r=>c=>(f=>f.dom.nodeType)(c)===r,Xn=r=>zn(r)&&_n(r.dom),zn=Tn(1),Ko=Tn(3),To=Tn(9),Yo=Tn(11),Lo=r=>c=>zn(c)&&sn(c)===r,es=(r,c)=>{const f=r.dom;if(f.nodeType!==1)return!1;{const m=f;if(m.matches!==void 0)return m.matches(c);if(m.msMatchesSelector!==void 0)return m.msMatchesSelector(c);if(m.webkitMatchesSelector!==void 0)return m.webkitMatchesSelector(c);if(m.mozMatchesSelector!==void 0)return m.mozMatchesSelector(c);throw new Error("Browser lacks native selectors")}},Ms=r=>r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11||r.childElementCount===0,hr=(r,c)=>{const f=c===void 0?document:c.dom;return Ms(f)?O.none():O.from(f.querySelector(r)).map(Ie)},po=(r,c)=>r.dom===c.dom,ts=(r,c)=>{const f=r.dom,m=c.dom;return f!==m&&f.contains(m)},tr=r=>Ie(r.dom.ownerDocument),ai=r=>To(r)?r:tr(r),Ur=r=>Ie(ai(r).dom.documentElement),Ti=r=>Ie(ai(r).dom.defaultView),la=r=>O.from(r.dom.parentNode).map(Ie),li=r=>O.from(r.dom.parentElement).map(Ie),Qc=r=>O.from(r.dom.offsetParent).map(Ie),xr=r=>qe(r.dom.childNodes,Ie),qs=(r,c)=>{const f=r.dom.childNodes;return O.from(f[c]).map(Ie)},Hi=r=>qs(r,0),Aa=(r,c)=>({element:r,offset:c}),Qa=(r,c)=>{const f=xr(r);return f.length>0&&c<f.length?Aa(f[c],0):Aa(r,c)},La=r=>Yo(r)&&z(r.dom.host),Na=$(Element.prototype.attachShadow)&&$(Node.prototype.getRootNode),vi=Y(Na),jr=Na?r=>Ie(r.dom.getRootNode()):ai,ca=r=>La(r)?r:Ie(ai(r).dom.body),yr=r=>{const c=jr(r);return La(c)?O.some(c):O.none()},Ql=r=>Ie(r.dom.host),Nr=r=>{const c=Ko(r)?r.dom.parentNode:r.dom;if(c==null||c.ownerDocument===null)return!1;const f=c.ownerDocument;return yr(Ie(c)).fold(()=>f.body.contains(c),(m=Nr,x=Ql,y=>m(x(y))));var m,x},Fa=()=>Ra(Ie(document)),Ra=r=>{const c=r.dom.body;if(c==null)throw new Error("Body is not available yet");return Ie(c)},ua=(r,c,f)=>{if(!(h(f)||k(f)||W(f)))throw console.error("Invalid call to Attribute.set. Key ",c,":: Value ",f,":: Element ",r),new Error("Attribute value was not simple");r.setAttribute(c,f+"")},Eo=(r,c,f)=>{ua(r.dom,c,f)},Mc=(r,c)=>{const f=r.dom;Cn(c,(m,x)=>{ua(f,x,m)})},xi=(r,c)=>{const f=r.dom.getAttribute(c);return f===null?void 0:f},Di=(r,c)=>O.from(xi(r,c)),Ba=(r,c)=>{const f=r.dom;return!(!f||!f.hasAttribute)&&f.hasAttribute(c)},Lr=(r,c)=>{r.dom.removeAttribute(c)},ei=(r,c,f)=>{if(!h(f))throw console.error("Invalid call to CSS.set. Property ",c,":: Value ",f,":: Element ",r),new Error("CSS value must be a string: "+f);Gn(r)&&r.style.setProperty(c,f)},ec=(r,c)=>{Gn(r)&&r.style.removeProperty(c)},Ro=(r,c,f)=>{const m=r.dom;ei(m,c,f)},tc=(r,c)=>{const f=r.dom;Cn(c,(m,x)=>{ei(f,x,m)})},rl=(r,c)=>{const f=r.dom;Cn(c,(m,x)=>{m.fold(()=>{ec(f,x)},y=>{ei(f,x,y)})})},Fr=(r,c)=>{const f=r.dom,m=window.getComputedStyle(f).getPropertyValue(c);return m!==""||Nr(r)?m:il(f,c)},il=(r,c)=>Gn(r)?r.style.getPropertyValue(c):"",yi=(r,c)=>{const f=r.dom,m=il(f,c);return O.from(m).filter(x=>x.length>0)},Cu=r=>{const c={},f=r.dom;if(Gn(f))for(let m=0;m<f.style.length;m++){const x=f.style.item(m);c[x]=f.style[x]}return c},_u=(r,c,f)=>{const m=ao(r);return Ro(m,c,f),yi(m,c).isSome()},us=(r,c)=>{const f=r.dom;ec(f,c),Is(Di(r,"style").map(ps),"")&&Lr(r,"style")},al=r=>r.dom.offsetWidth,pe=(r,c)=>{const f=x=>{const y=c(x);if(y<=0||y===null){const E=Fr(x,r);return parseFloat(E)||0}return y},m=(x,y)=>an(y,(E,D)=>{const A=Fr(x,D),P=A===void 0?0:parseInt(A,10);return isNaN(P)?E:E+P},0);return{set:(x,y)=>{if(!W(y)&&!y.match(/^[0-9]+$/))throw new Error(r+".set accepts only positive integer values. Value was "+y);const E=x.dom;Gn(E)&&(E.style[r]=y+"px")},get:f,getOuter:f,aggregate:m,max:(x,y,E)=>{const D=m(x,E);return y>D?y-D:0}}},Ge=pe("height",r=>{const c=r.dom;return Nr(r)?c.getBoundingClientRect().height:c.offsetHeight}),Qe=r=>Ge.get(r),Tt=r=>Ge.getOuter(r),pn=(r,c)=>({left:r,top:c,translate:(f,m)=>pn(r+f,c+m)}),Sn=pn,Cs=(r,c)=>r!==void 0?r:c!==void 0?c:0,wr=r=>{const c=r.dom.ownerDocument,f=c.body,m=c.defaultView,x=c.documentElement;if(f===r.dom)return Sn(f.offsetLeft,f.offsetTop);const y=Cs(m==null?void 0:m.pageYOffset,x.scrollTop),E=Cs(m==null?void 0:m.pageXOffset,x.scrollLeft),D=Cs(x.clientTop,f.clientTop),A=Cs(x.clientLeft,f.clientLeft);return Ds(r).translate(E-A,y-D)},Ds=r=>{const c=r.dom,f=c.ownerDocument.body;return f===c?Sn(f.offsetLeft,f.offsetTop):Nr(r)?(m=>{const x=m.getBoundingClientRect();return Sn(x.left,x.top)})(c):Sn(0,0)},lr=pe("width",r=>r.dom.offsetWidth),ds=r=>lr.get(r),Zr=r=>lr.getOuter(r),Nc=r=>{let c,f=!1;return(...m)=>(f||(f=!0,c=r.apply(null,m)),c)},gs=()=>nd(0,0),nd=(r,c)=>({major:r,minor:c}),Ld={nu:nd,detect:(r,c)=>{const f=String(c).toLowerCase();return r.length===0?gs():((m,x)=>{const y=((D,A)=>{for(let P=0;P<D.length;P++){const U=D[P];if(U.test(A))return U}})(m,x);if(!y)return{major:0,minor:0};const E=D=>Number(x.replace(y,"$"+D));return nd(E(1),E(2))})(r,f)},unknown:gs},lf=(r,c)=>{const f=String(c).toLowerCase();return J(r,m=>m.search(f))},Fc=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Bc=r=>c=>Ar(c,r),Kp=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:r=>Ar(r,"edge/")&&Ar(r,"chrome")&&Ar(r,"safari")&&Ar(r,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Fc],search:r=>Ar(r,"chrome")&&!Ar(r,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:r=>Ar(r,"msie")||Ar(r,"trident")},{name:"Opera",versionRegexes:[Fc,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Bc("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Bc("firefox")},{name:"Safari",versionRegexes:[Fc,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:r=>(Ar(r,"safari")||Ar(r,"mobile/"))&&Ar(r,"applewebkit")}],eu=[{name:"Windows",search:Bc("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:r=>Ar(r,"iphone")||Ar(r,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Bc("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:Bc("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Bc("linux"),versionRegexes:[]},{name:"Solaris",search:Bc("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Bc("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:Bc("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],Zp={browsers:Y(Kp),oses:Y(eu)},C0="Edge",av="Chromium",hn="Opera",Rd="Firefox",Rh="Safari",Od=r=>{const c=r.current,f=r.version,m=x=>()=>c===x;return{current:c,version:f,isEdge:m(C0),isChromium:m(av),isIE:m("IE"),isOpera:m(hn),isFirefox:m(Rd),isSafari:m(Rh)}},wa=()=>Od({current:void 0,version:Ld.unknown()}),Oh=Od,cf="Windows",uc="Android",Fm="Linux",Bm="macOS",Id="Solaris",_0="FreeBSD",qp="ChromeOS",Yp=r=>{const c=r.current,f=r.version,m=x=>()=>c===x;return{current:c,version:f,isWindows:m(cf),isiOS:m("iOS"),isAndroid:m(uc),isMacOS:m(Bm),isLinux:m(Fm),isSolaris:m(Id),isFreeBSD:m(_0),isChromeOS:m(qp)}},Xp=()=>Yp({current:void 0,version:Ld.unknown()}),$m=Yp,Jp=r=>window.matchMedia(r).matches;var Ih;let tu=Nc(()=>((r,c,f)=>{const m=Zp.browsers(),x=Zp.oses(),y=c.bind(A=>((P,U)=>Kn(U.brands,B=>{const K=B.brand.toLowerCase();return J(P,oe=>{var ne;return K===((ne=oe.brand)===null||ne===void 0?void 0:ne.toLowerCase())}).map(oe=>({current:oe.name,version:Ld.nu(parseInt(B.version,10),0)}))}))(m,A)).orThunk(()=>((A,P)=>lf(A,P).map(U=>{const B=Ld.detect(U.versionRegexes,P);return{current:U.name,version:B}}))(m,r)).fold(wa,Oh),E=((A,P)=>lf(A,P).map(U=>{const B=Ld.detect(U.versionRegexes,P);return{current:U.name,version:B}}))(x,r).fold(Xp,$m),D=((A,P,U,B)=>{const K=A.isiOS()&&/ipad/i.test(U)===!0,oe=A.isiOS()&&!K,ne=A.isiOS()||A.isAndroid(),ge=ne||B("(pointer:coarse)"),he=K||!oe&&ne&&B("(min-device-width:768px)"),Le=oe||ne&&!he,fe=P.isSafari()&&A.isiOS()&&/safari/i.test(U)===!1,de=!Le&&!he&&!fe;return{isiPad:Y(K),isiPhone:Y(oe),isTablet:Y(he),isPhone:Y(Le),isTouch:Y(ge),isAndroid:A.isAndroid,isiOS:A.isiOS,isWebView:Y(fe),isDesktop:Y(de)}})(E,y,r,f);return{browser:y,os:E,deviceType:D}})(navigator.userAgent,O.from(navigator.userAgentData),Jp));const da=()=>tu(),ls=r=>{const c=Ie((y=>{if(vi()&&z(y.target)){const E=Ie(y.target);if(zn(E)&&(D=>z(D.dom.shadowRoot))(E)&&y.composed&&y.composedPath){const D=y.composedPath();if(D)return Dn(D)}}return O.from(y.target)})(r).getOr(r.target)),f=()=>r.stopPropagation(),m=()=>r.preventDefault(),x=re(m,f);return((y,E,D,A,P,U,B)=>({target:y,x:E,y:D,stop:A,prevent:P,kill:U,raw:B}))(c,r.clientX,r.clientY,f,m,x,r)},$c=(r,c,f,m,x)=>{const y=((E,D)=>A=>{E(A)&&D(ls(A))})(f,m);return r.dom.addEventListener(c,y,x),{unbind:Ce($l,r,c,y,x)}},$l=(r,c,f,m)=>{r.dom.removeEventListener(c,f,m)},Tu=(r,c)=>{la(r).each(f=>{f.dom.insertBefore(c.dom,r.dom)})},uf=(r,c)=>{(m=>O.from(m.dom.nextSibling).map(Ie))(r).fold(()=>{la(r).each(m=>{ti(m,c)})},m=>{Tu(m,c)})},ll=(r,c)=>{Hi(r).fold(()=>{ti(r,c)},f=>{r.dom.insertBefore(c.dom,f.dom)})},ti=(r,c)=>{r.dom.appendChild(c.dom)},Ph=(r,c)=>{mt(c,f=>{ti(r,f)})},Hl=r=>{r.dom.textContent="",mt(xr(r),c=>{ci(c)})},ci=r=>{const c=r.dom;c.parentNode!==null&&c.parentNode.removeChild(c)},ui=r=>{const c=r!==void 0?r.dom:document,f=c.body.scrollLeft||c.documentElement.scrollLeft,m=c.body.scrollTop||c.documentElement.scrollTop;return Sn(f,m)},$s=(r,c,f)=>{const m=(f!==void 0?f.dom:document).defaultView;m&&m.scrollTo(r,c)},Hc=(r,c,f,m)=>({x:r,y:c,width:f,height:m,right:r+f,bottom:c+m}),Oa=r=>{const c=r===void 0?window:r,f=c.document,m=ui(Ie(f));return(x=>{const y=x===void 0?window:x;return da().browser.isFirefox()?O.none():O.from(y.visualViewport)})(c).fold(()=>{const x=c.document.documentElement,y=x.clientWidth,E=x.clientHeight;return Hc(m.left,m.top,y,E)},x=>Hc(Math.max(x.pageLeft,m.left),Math.max(x.pageTop,m.top),x.width,x.height))},Ul=()=>Ie(document),dc=(r,c)=>r.view(c).fold(Y([]),f=>{const m=r.owner(f),x=dc(r,m);return[f].concat(x)});var Xi=Object.freeze({__proto__:null,view:r=>{var c;return(r.dom===document?O.none():O.from((c=r.dom.defaultView)===null||c===void 0?void 0:c.frameElement)).map(Ie)},owner:r=>tr(r)});const Vf=r=>{const c=Ul(),f=ui(c);return((x,y)=>{const E=y.owner(x),D=dc(y,E);return O.some(D)})(r,Xi).fold(Ce(wr,r),x=>{const y=Ds(r),E=vt(x,(D,A)=>{const P=Ds(A);return{left:D.left+P.left,top:D.top+P.top}},{left:0,top:0});return Sn(E.left+y.left+f.left,E.top+y.top+f.top)})},Oi=(r,c,f,m)=>({x:r,y:c,width:f,height:m,right:r+f,bottom:c+m}),Ys=r=>{const c=wr(r),f=Zr(r),m=Tt(r);return Oi(c.left,c.top,f,m)},fc=r=>{const c=Vf(r),f=Zr(r),m=Tt(r);return Oi(c.left,c.top,f,m)},hc=(r,c)=>{const f=Math.max(r.x,c.x),m=Math.max(r.y,c.y),x=Math.min(r.right,c.right),y=Math.min(r.bottom,c.bottom);return Oi(f,m,x-f,y-m)},Ii=()=>Oa(window),ho=r=>{let c=r;return{get:()=>c,set:f=>{c=f}}},Pd=r=>{const c=ho(O.none()),f=()=>c.get().each(r);return{clear:()=>{f(),c.set(O.none())},isSet:()=>c.get().isSome(),get:()=>c.get(),set:m=>{f(),c.set(O.some(m))}}},mc=()=>Pd(r=>r.unbind()),nr=()=>{const r=Pd(j);return{...r,on:c=>r.get().each(c)}};var od=tinymce.util.Tools.resolve("tinymce.ThemeManager");const zf=r=>{const c=y=>y(r),f=Y(r),m=()=>x,x={tag:!0,inner:r,fold:(y,E)=>E(r),isValue:Oe,isError:ve,map:y=>os.value(y(r)),mapError:m,bind:c,exists:c,forall:c,getOr:f,or:m,getOrThunk:f,orThunk:m,getOrDie:f,each:y=>{y(r)},toOptional:()=>O.some(r)};return x},nu=r=>{const c=()=>f,f={tag:!1,inner:r,fold:(m,x)=>m(r),isValue:ve,isError:Oe,map:c,mapError:m=>os.error(m(r)),bind:c,exists:ve,forall:Oe,getOr:me,or:me,getOrThunk:Ae,orThunk:Ae,getOrDie:ot(String(r)),each:j,toOptional:O.none};return f},os={value:zf,error:nu,fromOption:(r,c)=>r.fold(()=>nu(c),zf)};var cl;(function(r){r[r.Error=0]="Error",r[r.Value=1]="Value"})(cl||(cl={}));const Mh=(r,c,f)=>r.stype===cl.Error?c(r.serror):f(r.svalue),df=r=>({stype:cl.Value,svalue:r}),Md=r=>({stype:cl.Error,serror:r}),pc=df,F=Md,M=Mh,Ee=(r,c,f,m)=>({tag:"field",key:r,newKey:c,presence:f,prop:m}),Ve=(r,c,f)=>{switch(r.tag){case"field":return c(r.key,r.newKey,r.presence,r.prop);case"custom":return f(r.newKey,r.instantiator)}},tt=r=>(...c)=>{if(c.length===0)throw new Error("Can't merge zero objects");const f={};for(let m=0;m<c.length;m++){const x=c[m];for(const y in x)On(x,y)&&(f[y]=r(f[y],x[y]))}return f},Ze=tt((r,c)=>b(r)&&b(c)?Ze(r,c):c),pt=tt((r,c)=>c),gt=r=>({tag:"defaultedThunk",process:r}),ln=r=>gt(Y(r)),Io=r=>({tag:"mergeWithThunk",process:r}),ss=r=>{const c=(m=>{const x=[],y=[];return mt(m,E=>{Mh(E,D=>y.push(D),D=>x.push(D))}),{values:x,errors:y}})(r);return c.errors.length>0?(f=c.errors,re(F,Vn)(f)):pc(c.values);var f},Sr=r=>g(r)&&Jt(r).length>100?" removed due to size":JSON.stringify(r,null,2),vs=(r,c)=>F([{path:r,getErrorInfo:c}]),_s=r=>({extract:(c,f)=>((m,x)=>m.stype===cl.Error?x(m.serror):m)(r(f),m=>((x,y)=>vs(x,Y(y)))(c,m)),toString:Y("val")}),ki=_s(pc),Sl=(r,c,f,m)=>m(At(r,c).getOrThunk(()=>f(r))),ns=(r,c,f,m,x)=>{const y=D=>x.extract(c.concat([m]),D),E=D=>D.fold(()=>pc(O.none()),A=>((P,U)=>P.stype===cl.Value?{stype:cl.Value,svalue:U(P.svalue)}:P)(x.extract(c.concat([m]),A),O.some));switch(r.tag){case"required":return((D,A,P,U)=>At(A,P).fold(()=>((B,K,oe)=>vs(B,()=>'Could not find valid *required* value for "'+K+'" in '+Sr(oe)))(D,P,A),U))(c,f,m,y);case"defaultedThunk":return Sl(f,m,r.process,y);case"option":return((D,A,P)=>P(At(D,A)))(f,m,E);case"defaultedOptionThunk":return((D,A,P,U)=>U(At(D,A).map(B=>B===!0?P(D):B)))(f,m,r.process,E);case"mergeWithThunk":return Sl(f,m,Y({}),D=>{const A=Ze(r.process(f),D);return y(A)})}},Vs=r=>({extract:(c,f)=>r().extract(c,f),toString:()=>r().toString()}),xs=r=>Jt(as(r,z)),ks=r=>{const c=Wn(r),f=vt(r,(m,x)=>Ve(x,y=>Ze(m,{[y]:!0}),Y(m)),{});return{extract:(m,x)=>{const y=k(x)?[]:xs(x),E=on(y,D=>!In(f,D));return E.length===0?c.extract(m,x):((D,A)=>vs(D,()=>"There are unsupported fields: ["+A.join(", ")+"] specified"))(m,E)},toString:c.toString}},Wn=r=>({extract:(c,f)=>((m,x,y)=>{const E={},D=[];for(const A of y)Ve(A,(P,U,B,K)=>{const oe=ns(B,m,x,P,K);M(oe,ne=>{D.push(...ne)},ne=>{E[U]=ne})},(P,U)=>{E[P]=U(x)});return D.length>0?F(D):pc(E)})(c,f,r),toString:()=>`obj{
`+qe(r,f=>Ve(f,(m,x,y,E)=>m+" -> "+E.toString(),(m,x)=>"state("+m+")")).join(`
`)+"}"}),cr=r=>({extract:(c,f)=>{const m=qe(f,(x,y)=>r.extract(c.concat(["["+y+"]"]),x));return ss(m)},toString:()=>"array("+r.toString()+")"}),el=(r,c)=>{const f=c!==void 0?c:me;return{extract:(m,x)=>{const y=[];for(const E of r){const D=E.extract(m,x);if(D.stype===cl.Value)return{stype:cl.Value,svalue:f(D.svalue)};y.push(D)}return ss(y)},toString:()=>"oneOf("+qe(r,m=>m.toString()).join(", ")+")"}},sd=(r,c)=>({extract:(f,m)=>{const x=Jt(m),y=((E,D)=>cr(_s(r)).extract(E,D))(f,x);return((E,D)=>E.stype===cl.Value?D(E.svalue):E)(y,E=>{const D=qe(E,A=>Ee(A,A,{tag:"required",process:{}},c));return Wn(D).extract(f,m)})},toString:()=>"setOf("+c.toString()+")"}),ou=re(cr,Wn),Sa=Y(ki),su=(r,c)=>_s(f=>{const m=typeof f;return r(f)?pc(f):F(`Expected type: ${c} but got: ${m}`)}),rd=su(W,"number"),ni=su(h,"string"),ru=su(k,"boolean"),gc=su($,"function"),bc=r=>{if(Object(r)!==r)return!0;switch({}.toString.call(r).slice(8,-1)){case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return!0;case"Array":case"Object":return Object.keys(r).every(c=>bc(r[c]));default:return!1}},ff=_s(r=>bc(r)?pc(r):F("Expected value to be acceptable for sending via postMessage")),Du=(r,c)=>({extract:(f,m)=>At(m,r).fold(()=>((x,y)=>vs(x,()=>'Choice schema did not contain choice key: "'+y+'"'))(f,r),x=>((y,E,D,A)=>At(D,A).fold(()=>((P,U,B)=>vs(P,()=>'The chosen schema: "'+B+'" did not exist in branches: '+Sr(U)))(y,D,A),P=>P.extract(y.concat(["branch: "+A]),E)))(f,m,c,x)),toString:()=>"chooseOn("+r+"). Possible values: "+Jt(c)}),vc=r=>_s(c=>r(c).fold(F,pc)),hf=(r,c)=>sd(f=>r(f).fold(Md,df),c),Rr=(r,c,f)=>{return m=((x,y,E)=>((D,A)=>D.stype===cl.Error?{stype:cl.Error,serror:A(D.serror)}:D)(y.extract([x],E),D=>({input:E,errors:D})))(r,c,f),Mh(m,os.error,os.value);var m},Vl=r=>r.fold(c=>{throw new Error(xc(c))},me),Ui=(r,c,f)=>Vl(Rr(r,c,f)),xc=r=>`Errors: 
`+(c=>{const f=c.length>10?c.slice(0,10).concat([{path:[],getErrorInfo:Y("... (only showing first ten failures)")}]):c;return qe(f,m=>"Failed path: ("+m.path.join(" > ")+`)
`+m.getErrorInfo())})(r.errors).join(`
`)+`

Input object: `+Sr(r.input),Kr=(r,c)=>Du(r,Nn(c,Wn)),El=(r,c)=>((f,m)=>{const x=Nc(m);return{extract:(y,E)=>x().extract(y,E),toString:()=>x().toString()}})(0,c),wi=Ee,Pi=(r,c)=>({tag:"custom",newKey:r,instantiator:c}),Uc=r=>vc(c=>et(r,c)?os.value(c):os.error(`Unsupported value: "${c}", choose one of "${r.join(", ")}".`)),Rt=r=>wi(r,r,{tag:"required",process:{}},Sa()),fa=(r,c)=>wi(r,r,{tag:"required",process:{}},c),iu=r=>fa(r,rd),qr=r=>fa(r,ni),$a=(r,c)=>wi(r,r,{tag:"required",process:{}},Uc(c)),Ji=r=>fa(r,gc),Ha=(r,c)=>wi(r,r,{tag:"required",process:{}},Wn(c)),Cl=(r,c)=>wi(r,r,{tag:"required",process:{}},ou(c)),ha=(r,c)=>wi(r,r,{tag:"required",process:{}},cr(c)),ys=r=>wi(r,r,{tag:"option",process:{}},Sa()),ma=(r,c)=>wi(r,r,{tag:"option",process:{}},c),Vi=r=>ma(r,rd),oi=r=>ma(r,ni),Vc=(r,c)=>ma(r,Uc(c)),_l=r=>ma(r,gc),yc=(r,c)=>ma(r,cr(c)),ul=(r,c)=>ma(r,Wn(c)),lt=(r,c)=>wi(r,r,ln(c),Sa()),Si=(r,c,f)=>wi(r,r,ln(c),f),au=(r,c)=>Si(r,c,rd),rr=(r,c)=>Si(r,c,ni),Tl=(r,c,f)=>Si(r,c,Uc(f)),pa=(r,c)=>Si(r,c,ru),Or=(r,c)=>Si(r,c,gc),Ua=(r,c,f)=>Si(r,c,cr(f)),Xs=(r,c,f)=>Si(r,c,Wn(f)),di=r=>{if(!S(r))throw new Error("cases must be an array");if(r.length===0)throw new Error("there must be at least one case");const c=[],f={};return mt(r,(m,x)=>{const y=Jt(m);if(y.length!==1)throw new Error("one and only one name per case");const E=y[0],D=m[E];if(f[E]!==void 0)throw new Error("duplicate key detected:"+E);if(E==="cata")throw new Error("cannot have a case named cata (sorry)");if(!S(D))throw new Error("case arguments must be an array");c.push(E),f[E]=(...A)=>{const P=A.length;if(P!==D.length)throw new Error("Wrong number of arguments to case "+E+". Expected "+D.length+" ("+D+"), got "+P);return{fold:(...U)=>{if(U.length!==r.length)throw new Error("Wrong number of arguments to fold. Expected "+r.length+", got "+U.length);return U[x].apply(null,A)},match:U=>{const B=Jt(U);if(c.length!==B.length)throw new Error("Wrong number of arguments to match. Expected: "+c.join(",")+`
Actual: `+B.join(","));if(!An(c,K=>et(B,K)))throw new Error("Not all branches were specified when using match. Specified: "+B.join(", ")+`
Required: `+c.join(", "));return U[E].apply(null,A)},log:U=>{console.log(U,{constructors:c,constructor:E,params:A})}}}}),f};di([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const nc=(r,c)=>((f,m)=>({[f]:m}))(r,c),wc=r=>(c=>{const f={};return mt(c,m=>{f[m.key]=m.value}),f})(r),ku=r=>$(r)?r:ve,zc=(r,c,f)=>{let m=r.dom;const x=ku(f);for(;m.parentNode;){m=m.parentNode;const y=Ie(m),E=c(y);if(E.isSome())return E;if(x(y))break}return O.none()},Gc=(r,c,f)=>{const m=c(r),x=ku(f);return m.orThunk(()=>x(r)?O.none():zc(r,c,x))},mf=(r,c)=>po(r.element,c.event.target),Bt={can:Oe,abort:ve,run:j},io=r=>{if(!In(r,"can")&&!In(r,"abort")&&!In(r,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(r,null,2)+" does not have can, abort, or run!");return{...Bt,...r}},Qn=Y,Po=Qn("touchstart"),Js=Qn("touchmove"),N=Qn("touchend"),X=Qn("touchcancel"),ce=Qn("mousedown"),Ne=Qn("mousemove"),We=Qn("mouseout"),Kt=Qn("mouseup"),Yn=Qn("mouseover"),Co=Qn("focusin"),$o=Qn("focusout"),Jn=Qn("keydown"),mr=Qn("keyup"),Vr=Qn("input"),Va=Qn("change"),Dl=Qn("click"),$e=Qn("transitioncancel"),cn=Qn("transitionend"),Ln=Qn("transitionstart"),Wo=Qn("selectstart"),bn=r=>Y("alloy."+r),Jo={tap:bn("tap")},Vo=bn("focus"),Yr=bn("blur.post"),za=bn("paste.post"),Au=bn("receive"),pr=bn("execute"),dl=bn("focus.item"),Gf=Jo.tap,T0=bn("longpress"),lv=bn("sandbox.close"),cv=bn("typeahead.cancel"),Nd=bn("system.init"),Qp=bn("system.touchmove"),oo=bn("system.touchend"),lu=bn("system.scroll"),eg=bn("system.resize"),Sc=bn("system.attached"),kl=bn("system.detached"),Fd=bn("system.dismissRequested"),hS=bn("system.repositionRequested"),Bd=bn("focusmanager.shifted"),p1=bn("slotcontainer.visibility"),$d=bn("system.external.element.scroll"),tg=bn("change.tab"),ng=bn("dismiss.tab"),rn=bn("highlight"),g1=bn("dehighlight"),rs=(r,c)=>{fi(r,r.element,c,{})},so=(r,c,f)=>{fi(r,r.element,c,f)},id=r=>{rs(r,pr())},D0=(r,c,f)=>{fi(r,c,f,{})},fi=(r,c,f,m)=>{const x={target:c,...m};r.getSystem().triggerEvent(f,c,x)},ad=(r,c,f,m)=>{r.getSystem().triggerEvent(f,c,m.event)},Ws=r=>wc(r),Ir=(r,c)=>({key:r,value:io({abort:c})}),og=r=>({key:r,value:io({run:(c,f)=>{f.event.prevent()}})}),Ft=(r,c)=>({key:r,value:io({run:c})}),Lu=(r,c,f)=>({key:r,value:io({run:(m,x)=>{c.apply(void 0,[m,x].concat(f))}})}),uv=r=>c=>({key:r,value:io({run:(f,m)=>{mf(f,m)&&c(f,m)}})}),Nh=(r,c,f)=>((m,x)=>Ft(m,(y,E)=>{y.getSystem().getByUid(x).each(D=>{ad(D,D.element,m,E)})}))(r,c.partUids[f]),b1=(r,c)=>Ft(r,(f,m)=>{const x=m.event,y=f.getSystem().getByDom(x.target).getOrThunk(()=>Gc(x.target,E=>f.getSystem().getByDom(E).toOptional(),ve).getOr(f));c(f,y,m)}),Hd=r=>Ft(r,(c,f)=>{f.cut()}),mS=r=>Ft(r,(c,f)=>{f.stop()}),Hm=(r,c)=>uv(r)(c),zr=uv(Sc()),pf=uv(kl()),pS=uv(Nd()),Ud=(ag=pr(),r=>Ft(ag,r)),sg=r=>qe(r,c=>aa(c,"/*")?c.substring(0,c.length-2):c),Fh=(r,c)=>{const f=r.toString(),m=f.indexOf(")")+1,x=f.indexOf("("),y=f.substring(x+1,m-1).split(/,\s*/);return r.toFunctionAnnotation=()=>({name:c,parameters:sg(y)}),r},Ga=r=>({classes:R(r.classes)?[]:r.classes,attributes:R(r.attributes)?{}:r.attributes,styles:R(r.styles)?{}:r.styles}),fl=(r,c,f)=>pS((m,x)=>{f(m,r,c)}),v1=r=>({key:r,value:void 0}),Ea=(r,c,f,m,x,y,E)=>{const D=U=>In(U,f)?U[f]():O.none(),A=Nn(x,(U,B)=>((K,oe,ne)=>((ge,he,Le)=>{const fe=Le.toString(),de=fe.indexOf(")")+1,be=fe.indexOf("("),Te=fe.substring(be+1,de-1).split(/,\s*/);return ge.toFunctionAnnotation=()=>({name:he,parameters:sg(Te.slice(0,1).concat(Te.slice(3)))}),ge})((ge,...he)=>{const Le=[ge].concat(he);return ge.config({name:Y(K)}).fold(()=>{throw new Error("We could not find any behaviour configuration for: "+K+". Using API: "+ne)},fe=>{const de=Array.prototype.slice.call(Le,1);return oe.apply(void 0,[ge,fe.config,fe.state].concat(de))})},ne,oe))(f,U,B)),P={...Nn(y,(U,B)=>Fh(U,B)),...A,revoke:Ce(v1,f),config:U=>{const B=Ui(f+"-config",r,U);return{key:f,value:{config:B,me:P,configAsRaw:Nc(()=>Ui(f+"-config",r,U)),initialConfig:U,state:E}}},schema:Y(c),exhibit:(U,B)=>Yt(D(U),At(m,"exhibit"),(K,oe)=>oe(B,K.config,K.state)).getOrThunk(()=>Ga({})),name:Y(f),handlers:U=>D(U).map(B=>At(m,"events").getOr(()=>({}))(B.config,B.state)).getOr({})};return P},Ru={init:()=>Ec({readState:Y("No State required")})},Ec=r=>r,tn=r=>wc(r),x1=ks([Rt("fields"),Rt("name"),lt("active",{}),lt("apis",{}),lt("state",Ru),lt("extra",{})]),Mi=r=>{const c=Ui("Creating behaviour: "+r.name,x1,r);return((f,m,x,y,E,D)=>{const A=ks(f),P=ul(m,[(U=f,ma("config",ks(U)))]);var U;return Ea(A,P,m,x,y,E,D)})(c.fields,c.name,c.active,c.apis,c.extra,c.state)},y1=ks([Rt("branchKey"),Rt("branches"),Rt("name"),lt("active",{}),lt("apis",{}),lt("state",Ru),lt("extra",{})]),w1=r=>{const c=Ui("Creating behaviour: "+r.name,y1,r);return((f,m,x,y,E,D)=>{const A=f,P=ul(m,[ma("config",f)]);return Ea(A,P,m,x,y,E,D)})(Kr(c.branchKey,c.branches),c.name,c.active,c.apis,c.extra,c.state)},MT=Y(void 0),S1=(r,c)=>{const f=xi(r,c);return f===void 0||f===""?[]:f.split(" ")},Ou=r=>r.dom.classList!==void 0,dv=r=>S1(r,"class"),fv=(r,c)=>((f,m,x)=>{const y=S1(f,m).concat([x]);return Eo(f,m,y.join(" ")),!0})(r,"class",c),hv=(r,c)=>((f,m,x)=>{const y=on(S1(f,m),E=>E!==x);return y.length>0?Eo(f,m,y.join(" ")):Lr(f,m),!1})(r,"class",c),zi=(r,c)=>{Ou(r)?r.dom.classList.add(c):fv(r,c)},Um=r=>{(Ou(r)?r.dom.classList:dv(r)).length===0&&Lr(r,"class")},hi=(r,c)=>{Ou(r)?r.dom.classList.remove(c):hv(r,c),Um(r)},zl=(r,c)=>Ou(r)&&r.dom.classList.contains(c),Wf=(r,c)=>{mt(c,f=>{zi(r,f)})},Xr=(r,c)=>{mt(c,f=>{hi(r,f)})},mv=r=>Ou(r)?(c=>{const f=c.dom.classList,m=new Array(f.length);for(let x=0;x<f.length;x++){const y=f.item(x);y!==null&&(m[x]=y)}return m})(r):dv(r),hl=(r,c,f,m,x)=>{const y=E=>E+"px";return{position:r,left:c.map(y),top:f.map(y),right:m.map(y),bottom:x.map(y)}},ld=(r,c)=>{rl(r,(f=>({...f,position:O.some(f.position)}))(c))},rg=r=>(Is(yi(r,"position"),"fixed")?O.none():Qc(r)).orThunk(()=>{const c=ao("span");return la(r).bind(f=>{ti(f,c);const m=Qc(c);return ci(c),m})}),k0=r=>rg(r).map(wr).getOrThunk(()=>Sn(0,0)),Bh=(r,c)=>{const f=r.element;zi(f,c.transitionClass),hi(f,c.fadeOutClass),zi(f,c.fadeInClass),c.onShow(r)},gS=(r,c)=>{const f=r.element;zi(f,c.transitionClass),hi(f,c.fadeInClass),zi(f,c.fadeOutClass),c.onHide(r)},Vm=(r,c)=>r.y>=c.y,E1=(r,c)=>r.bottom<=c.bottom,A0=(r,c,f)=>({location:"top",leftX:c,topY:f.bounds.y-r.y}),L0=(r,c,f)=>({location:"bottom",leftX:c,bottomY:r.bottom-f.bounds.bottom}),pv=r=>r.box.x-r.win.x,C1=(r,c,f)=>f.getInitialPos().map(m=>{const x=((y,E)=>{const D=E.optScrollEnv.fold(Y(y.bounds.y),A=>A.scrollElmTop+(y.bounds.y-A.currentScrollTop));return Sn(y.bounds.x,D)})(m,c);return{box:Oi(x.left,x.top,ds(r),Qe(r)),location:m.location}}),zm=(r,c,f,m,x)=>{const y=((D,A)=>{const P=A.optScrollEnv.fold(Y(D.y),U=>D.y+U.currentScrollTop-U.scrollElmTop);return Sn(D.x,P)})(c,f),E=Oi(y.left,y.top,c.width,c.height);m.setInitialPos({style:Cu(r),position:Fr(r,"position")||"static",bounds:E,location:x.location})},NT=(r,c,f)=>f.getInitialPos().bind(m=>{var x;switch(f.clearInitialPos(),m.position){case"static":return O.some({morph:"static"});case"absolute":const y=rg(r).getOr(Fa()),E=Ys(y),D=(x=y.dom.scrollTop)!==null&&x!==void 0?x:0;return O.some({morph:"absolute",positionCss:hl("absolute",At(m.style,"left").map(A=>c.x-E.x),At(m.style,"top").map(A=>c.y-E.y+D),At(m.style,"right").map(A=>E.right-c.right),At(m.style,"bottom").map(A=>E.bottom-c.bottom))});default:return O.none()}}),R0=r=>{switch(r.location){case"top":return O.some({morph:"fixed",positionCss:hl("fixed",O.some(r.leftX),O.some(r.topY),O.none(),O.none())});case"bottom":return O.some({morph:"fixed",positionCss:hl("fixed",O.some(r.leftX),O.none(),O.none(),O.some(r.bottomY))});default:return O.none()}},bS=(r,c,f)=>{const m=r.element;return Is(yi(m,"position"),"fixed")?((x,y,E)=>((D,A,P)=>C1(D,A,P).filter(({box:U})=>((B,K,oe)=>An(B,ne=>{switch(ne){case"bottom":return E1(K,oe.bounds);case"top":return Vm(K,oe.bounds)}}))(P.getModes(),U,A)).bind(({box:U})=>NT(D,U,P)))(x,y,E).orThunk(()=>y.optScrollEnv.bind(D=>C1(x,y,E)).bind(({box:D,location:A})=>{const P=Ii(),U=pv({win:P,box:D}),B=A==="top"?A0(P,U,y):L0(P,U,y);return R0(B)})))(m,c,f):((x,y,E)=>{const D=Ys(x),A=Ii(),P=((U,B,K)=>{const oe=B.win,ne=B.box,ge=pv(B);return Kn(U,he=>{switch(he){case"bottom":return E1(ne,K.bounds)?O.none():O.some(L0(oe,ge,K));case"top":return Vm(ne,K.bounds)?O.none():O.some(A0(oe,ge,K));default:return O.none()}}).getOr({location:"no-dock"})})(E.getModes(),{win:A,box:D},y);return P.location==="top"||P.location==="bottom"?(zm(x,D,y,E,P),R0(P)):O.none()})(m,c,f)},gv=(r,c,f)=>{f.setDocked(!1),mt(["left","right","top","bottom","position"],m=>us(r.element,m)),c.onUndocked(r)},bv=(r,c,f,m)=>{const x=m.position==="fixed";f.setDocked(x),ld(r.element,m),(x?c.onDocked:c.onUndocked)(r)},vv=(r,c,f,m,x=!1)=>{c.contextual.each(y=>{y.lazyContext(r).each(E=>{const D=((A,P)=>A.y<P.bottom&&A.bottom>P.y)(E,m.bounds);D!==f.isVisible()&&(f.setVisible(D),x&&!D?(Wf(r.element,[y.fadeOutClass]),y.onHide(r)):(D?Bh:gS)(r,y))})})},_1=(r,c,f,m,x)=>{vv(r,c,f,m,!0),bv(r,c,f,x.positionCss)},O0=(r,c,f)=>{r.getSystem().isConnected()&&((m,x,y)=>{const E=x.lazyViewport(m);vv(m,x,y,E),bS(m,E,y).each(D=>{((A,P,U,B,K)=>{switch(K.morph){case"static":return gv(A,P,U);case"absolute":return bv(A,P,U,K.positionCss);case"fixed":_1(A,P,U,B,K)}})(m,x,y,E,D)})})(r,c,f)},T1=(r,c,f)=>{f.isDocked()&&((m,x,y)=>{const E=m.element;y.setDocked(!1);const D=x.lazyViewport(m);((A,P,U)=>{const B=A.element;return C1(B,P,U).bind(({box:K})=>NT(B,K,U))})(m,D,y).each(A=>{switch(A.morph){case"static":gv(m,x,y);break;case"absolute":bv(m,x,y,A.positionCss)}}),y.setVisible(!0),x.contextual.each(A=>{Xr(E,[A.fadeInClass,A.fadeOutClass,A.transitionClass]),A.onShow(m)}),O0(m,x,y)})(r,c,f)},ig=r=>(c,f,m)=>{const x=f.lazyViewport(c);((y,E,D,A)=>{const P=Ys(y),U=Ii(),B=A(U,pv({win:U,box:P}),E);return B.location==="bottom"||B.location==="top"?(((K,oe,ne,ge,he)=>{ge.getInitialPos().fold(()=>zm(K,oe,ne,ge,he),()=>j)})(y,P,E,D,B),R0(B)):O.none()})(c.element,x,m,r).each(y=>{_1(c,f,m,x,y)})},vS=ig(A0),I0=ig(L0);var ag,Gm=Object.freeze({__proto__:null,refresh:O0,reset:T1,isDocked:(r,c,f)=>f.isDocked(),getModes:(r,c,f)=>f.getModes(),setModes:(r,c,f,m)=>f.setModes(m),forceDockToTop:vS,forceDockToBottom:I0}),lg=Object.freeze({__proto__:null,events:(r,c)=>Ws([Hm(cn(),(f,m)=>{r.contextual.each(x=>{zl(f.element,x.transitionClass)&&(Xr(f.element,[x.transitionClass,x.fadeInClass]),(c.isVisible()?x.onShown:x.onHidden)(f)),m.stop()})}),Ft(lu(),(f,m)=>{O0(f,r,c)}),Ft($d(),(f,m)=>{O0(f,r,c)}),Ft(eg(),(f,m)=>{T1(f,r,c)})])});const P0=r=>r.dom.innerHTML,Iu=(r,c)=>{const f=tr(r).dom,m=Ie(f.createDocumentFragment()),x=((y,E)=>{const D=(E||document).createElement("div");return D.innerHTML=y,xr(Ie(D))})(c,f);Ph(m,x),Hl(r),ti(r,m)},D1=(r,c)=>Ie(r.dom.cloneNode(c)),Pu=r=>(c=>{if(La(c))return"#shadow-root";{const f=(m=>D1(m,!1))(c);return(m=>{const x=ao("div"),y=Ie(m.dom.cloneNode(!0));return ti(x,y),P0(x)})(f)}})(r);var $h;(function(r){r[r.STOP=0]="STOP",r[r.NORMAL=1]="NORMAL",r[r.LOGGING=2]="LOGGING"})($h||($h={}));const cg=ho({}),k1=["alloy/data/Fields","alloy/debugging/Debugging"],A1=(r,c,f)=>((m,x,y)=>{switch(At(cg.get(),m).orThunk(()=>{const E=Jt(cg.get());return Kn(E,D=>m.indexOf(D)>-1?O.some(cg.get()[D]):O.none())}).getOr($h.NORMAL)){case $h.NORMAL:return y(L1());case $h.LOGGING:{const E=((A,P)=>{const U=[],B=new Date().getTime();return{logEventCut:(K,oe,ne)=>{U.push({outcome:"cut",target:oe,purpose:ne})},logEventStopped:(K,oe,ne)=>{U.push({outcome:"stopped",target:oe,purpose:ne})},logNoParent:(K,oe,ne)=>{U.push({outcome:"no-parent",target:oe,purpose:ne})},logEventNoHandlers:(K,oe)=>{U.push({outcome:"no-handlers-left",target:oe})},logEventResponse:(K,oe,ne)=>{U.push({outcome:"response",purpose:ne,target:oe})},write:()=>{const K=new Date().getTime();et(["mousemove","mouseover","mouseout",Nd()],A)||console.log(A,{event:A,time:K-B,target:P.dom,sequence:qe(U,oe=>et(["cut","stopped","response"],oe.outcome)?"{"+oe.purpose+"} "+oe.outcome+" at ("+Pu(oe.target)+")":oe.outcome)})}}})(m,x),D=y(E);return E.write(),D}case $h.STOP:return!0}})(r,c,f),L1=Y({logEventCut:j,logEventStopped:j,logNoParent:j,logEventNoHandlers:j,logEventResponse:j,write:j}),cu=Y([Rt("menu"),Rt("selectedMenu")]),R1=Y([Rt("item"),Rt("selectedItem")]);Y(Wn(R1().concat(cu())));const FT=Y(Wn(R1())),Hh=Ha("initSize",[Rt("numColumns"),Rt("numRows")]),Ca=()=>Ha("markers",[Rt("backgroundMenu")].concat(cu()).concat(R1())),gf=r=>Ha("markers",qe(r,Rt)),xv=(r,c,f)=>((()=>{const m=new Error;if(m.stack!==void 0){const x=m.stack.split(`
`);J(x,y=>y.indexOf("alloy")>0&&!Dt(k1,E=>y.indexOf(E)>-1)).getOr("unknown")}})(),wi(c,c,f,vc(m=>os.value((...x)=>m.apply(void 0,x))))),Rs=r=>xv(0,r,ln(j)),Cc=r=>xv(0,r,ln(O.none)),jf=r=>xv(0,r,{tag:"required",process:{}}),Wm=r=>xv(0,r,{tag:"required",process:{}}),As=(r,c)=>Pi(r,Y(c)),M0=r=>Pi(r,me),N0=Y(Hh);var BT=[ul("contextual",[qr("fadeInClass"),qr("fadeOutClass"),qr("transitionClass"),Ji("lazyContext"),Rs("onShow"),Rs("onShown"),Rs("onHide"),Rs("onHidden")]),Or("lazyViewport",()=>({bounds:Ii(),optScrollEnv:O.none()})),Ua("modes",["top","bottom"],ni),Rs("onDocked"),Rs("onUndocked")];const mi=Mi({fields:BT,name:"docking",active:lg,apis:Gm,state:Object.freeze({__proto__:null,init:r=>{const c=ho(!1),f=ho(!0),m=nr(),x=ho(r.modes);return Ec({isDocked:c.get,setDocked:c.set,getInitialPos:m.get,setInitialPos:m.set,clearInitialPos:m.clear,isVisible:f.get,setVisible:f.set,getModes:x.get,setModes:x.set,readState:()=>`docked:  ${c.get()}, visible: ${f.get()}, modes: ${x.get().join(",")}`})}})}),O1=Ws([((r,c)=>({key:r,value:io({can:(f,m)=>{const x=m.event,y=x.originator,E=x.target;return!((D,A,P)=>po(A,D.element)&&!po(A,P))(f,y,E)||(console.warn(Vo()+` did not get interpreted by the desired target. 
Originator: `+Pu(y)+`
Target: `+Pu(E)+`
Check the `+Vo()+" event handlers"),!1)}})}))(Vo())]);var yv=Object.freeze({__proto__:null,events:O1});let wv=0;const Zn=r=>{const c=new Date().getTime(),f=Math.floor(1e9*Math.random());return wv++,r+"_"+f+wv+String(c)},xS=Y("alloy-id-"),F0=Y("data-alloy-id"),ug=xS(),Mu=F0(),B0=(r,c)=>{Object.defineProperty(r.dom,Mu,{value:c,writable:!0})},Uh=r=>{const c=zn(r)?r.dom[Mu]:null;return O.from(c)},bf=r=>Zn(r),yS=me,dg=r=>{const c=x=>`The component must be in a context to execute: ${x}`+(r?`
`+Pu(r().element)+" is not in context.":""),f=x=>()=>{throw new Error(c(x))},m=x=>()=>{console.warn(c(x))};return{debugInfo:Y("fake"),triggerEvent:m("triggerEvent"),triggerFocus:m("triggerFocus"),triggerEscape:m("triggerEscape"),broadcast:m("broadcast"),broadcastOn:m("broadcastOn"),broadcastEvent:m("broadcastEvent"),build:f("build"),buildOrPatch:f("buildOrPatch"),addToWorld:f("addToWorld"),removeFromWorld:f("removeFromWorld"),addToGui:f("addToGui"),removeFromGui:f("removeFromGui"),getByUid:f("getByUid"),getByDom:f("getByDom"),isConnected:ve}},Vh=dg(),Sv=Zn("alloy-premade"),wS=r=>(Object.defineProperty(r.element.dom,Sv,{value:r.uid,writable:!0}),nc(Sv,r)),Ev=r=>At(r,Sv),Cv=r=>((c,f)=>{const m=f.toString(),x=m.indexOf(")")+1,y=m.indexOf("("),E=m.substring(y+1,x-1).split(/,\s*/);return c.toFunctionAnnotation=()=>({name:"OVERRIDE",parameters:sg(E.slice(1))}),c})((c,...f)=>r(c.getApis(),c,...f),r),I1=(r,c)=>{const f={};return Cn(r,(m,x)=>{Cn(m,(y,E)=>{const D=At(f,E).getOr([]);f[E]=D.concat([c(x,y)])})}),f},_v=r=>r.cHandler,$T=(r,c)=>({name:r,handler:c}),SS=(r,c)=>{const f={};return mt(r,m=>{f[m.name()]=m.handlers(c)}),f},HT=(r,c,f)=>{const m=c[f];return m?((x,y,E,D)=>{try{const A=xe(E,(P,U)=>{const B=P[y],K=U[y],oe=D.indexOf(B),ne=D.indexOf(K);if(oe===-1)throw new Error("The ordering for "+x+" does not have an entry for "+B+`.
Order specified: `+JSON.stringify(D,null,2));if(ne===-1)throw new Error("The ordering for "+x+" does not have an entry for "+K+`.
Order specified: `+JSON.stringify(D,null,2));return oe<ne?-1:ne<oe?1:0});return os.value(A)}catch(A){return os.error([A])}})("Event: "+f,"name",r,m).map(x=>(y=>({can:((A,P)=>(...U)=>an(A,(B,K)=>B&&(oe=>oe.can)(K).apply(void 0,U),!0))(y),abort:((A,P)=>(...U)=>an(A,(B,K)=>B||(oe=>oe.abort)(K).apply(void 0,U),!1))(y),run:(...A)=>{mt(y,P=>{P.run.apply(void 0,A)})}}))(qe(x,y=>y.handler))):((x,y)=>os.error(["The event ("+x+`) has more than one behaviour that listens to it.
When this occurs, you must specify an event ordering for the behaviours in your spec (e.g. [ "listing", "toggling" ]).
The behaviours that can trigger it are: `+JSON.stringify(qe(y,E=>E.name),null,2)]))(f,r)},ES=(r,c)=>((f,m)=>{const x=(E=>{const D=[],A=[];return mt(E,P=>{P.fold(U=>{D.push(U)},U=>{A.push(U)})}),{errors:D,values:A}})(f);return x.errors.length>0?(y=x.errors,os.error(Vn(y))):((E,D)=>E.length===0?os.value(D):os.value(Ze(D,pt.apply(void 0,E))))(x.values,m);var y})(xt(r,(f,m)=>(f.length===1?os.value(f[0].handler):HT(f,c,m)).map(x=>{const y=(D=>{const A=(P=>$(P)?{can:Oe,abort:ve,run:P}:P)(D);return(P,U,...B)=>{const K=[P,U].concat(B);A.abort.apply(void 0,K)?U.stop():A.can.apply(void 0,K)&&A.run.apply(void 0,K)}})(x),E=f.length>1?on(c[m],D=>Dt(f,A=>A.name===D)).join(" > "):f[0].name;return nc(m,((D,A)=>({handler:D,purpose:A}))(y,E))})),{}),jm="alloy.base.behaviour",$0=Wn([wi("dom","dom",{tag:"required",process:{}},Wn([Rt("tag"),lt("styles",{}),lt("classes",[]),lt("attributes",{}),ys("value"),ys("innerHtml")])),Rt("components"),Rt("uid"),lt("events",{}),lt("apis",{}),wi("eventOrder","eventOrder",(F1={[pr()]:["disabling",jm,"toggling","typeaheadevents"],[Vo()]:[jm,"focusing","keying"],[Nd()]:[jm,"disabling","toggling","representing"],[Vr()]:[jm,"representing","streaming","invalidating"],[kl()]:[jm,"representing","item-events","toolbar-button-events","tooltipping"],[ce()]:["focusing",jm,"item-type-events"],[Po()]:["focusing",jm,"item-type-events"],[Yn()]:["item-type-events","tooltipping"],[Au()]:["receiving","reflecting","tooltipping"]},Io(Y(F1))),Sa()),ys("domModification")]),P1=r=>r.events,Kf=r=>r.dom.value,Km=(r,c)=>{if(c===void 0)throw new Error("Value.set was undefined");r.dom.value=c},CS=(r,c,f)=>{f.fold(()=>ti(r,c),m=>{po(m,c)||(Tu(m,c),ci(m))})},_S=(r,c,f)=>{const m=qe(c,f),x=xr(r);return mt(x.slice(m.length),ci),m},M1=(r,c,f,m)=>{const x=qs(r,c),y=m(f,x),E=((D,A,P)=>qs(D,A).map(U=>{if(P.exists(B=>!po(B,U))){const B=P.map(sn).getOr("span"),K=ao(B);return Tu(U,K),K}return U}))(r,c,x);return CS(r,y.element,E),y},Tv=(r,c)=>{const f=Jt(r),m=Jt(c),x=to(m,f),y=((E,D)=>{const A={},P={};return ms(E,(U,B)=>!On(c,B)||U!==c[B],jo(A),jo(P)),{t:A,f:P}})(r).t;return{toRemove:x,toSet:y}},UT=(r,c)=>{const f=c.filter(m=>sn(m)===r.tag&&!(x=>x.innerHtml.isSome()&&x.domChildren.length>0)(r)&&!(x=>On(x.dom,Sv))(m)).bind(m=>((x,y)=>{try{const E=((D,A)=>{const{class:P,style:U,...B}=(be=>an(be.dom.attributes,(Te,ke)=>(Te[ke.name]=ke.value,Te),{}))(A),{toSet:K,toRemove:oe}=Tv(D.attributes,B),ne=Cu(A),{toSet:ge,toRemove:he}=Tv(D.styles,ne),Le=mv(A),fe=to(Le,D.classes),de=to(D.classes,Le);return mt(oe,be=>Lr(A,be)),Mc(A,K),Wf(A,de),Xr(A,fe),mt(he,be=>us(A,be)),tc(A,ge),D.innerHtml.fold(()=>{const be=D.domChildren;((Te,ke)=>{_S(Te,ke,(Ke,dt)=>{const zt=qs(Te,dt);return CS(Te,Ke,zt),Ke})})(A,be)},be=>{Iu(A,be)}),(()=>{const be=A,Te=D.value.getOrUndefined();Te!==Kf(be)&&Km(be,Te??"")})(),A})(x,y);return O.some(E)}catch{return O.none()}})(r,m)).getOrThunk(()=>(m=>{const x=ao(m.tag);Mc(x,m.attributes),Wf(x,m.classes),tc(x,m.styles),m.innerHtml.each(E=>Iu(x,E));const y=m.domChildren;return Ph(x,y),m.value.each(E=>{Km(x,E)}),x})(r));return B0(f,r.uid),f},TS=r=>{const c=(f=>{const m=At(f,"behaviours").getOr({});return Rn(Jt(m),x=>{const y=m[x];return z(y)?[y.me]:[]})})(r);return((f,m)=>((x,y)=>{const E=qe(y,A=>ul(A.name(),[Rt("config"),lt("state",Ru)])),D=Rr("component.behaviours",Wn(E),x.behaviours).fold(A=>{throw new Error(xc(A)+`
Complete spec:
`+JSON.stringify(x,null,2))},me);return{list:y,data:Nn(D,A=>{const P=A.map(U=>({config:U.config,state:U.state.init(U.config)}));return Y(P)})}})(f,m))(r,c)},Dv=(r,c)=>{const f=()=>K,m=ho(Vh),x=Vl((oe=>Rr("custom.definition",$0,oe))(r)),y=TS(r),E=(oe=>oe.list)(y),D=(oe=>oe.data)(y),A=((oe,ne,ge)=>{const he={...(Le=oe).dom,uid:Le.uid,domChildren:qe(Le.components,Ke=>Ke.element)};var Le;const fe=(Ke=>Ke.domModification.fold(()=>Ga({}),Ga))(oe),de={"alloy.base.modification":fe},be=ne.length>0?((Ke,dt,zt,Wt)=>{const en={...dt};mt(zt,ws=>{en[ws.name()]=ws.exhibit(Ke,Wt)});const xn=I1(en,(ws,ii)=>({name:ws,modification:ii})),$n=ws=>vt(ws,(ii,pi)=>({...pi.modification,...ii}),{}),ro=vt(xn.classes,(ws,ii)=>ii.modification.concat(ws),[]),xo=$n(xn.attributes),Zo=$n(xn.styles);return Ga({classes:ro,attributes:xo,styles:Zo})})(ge,de,ne,he):fe;return Te=he,ke=be,{...Te,attributes:{...Te.attributes,...ke.attributes},styles:{...Te.styles,...ke.styles},classes:Te.classes.concat(ke.classes)};var Te,ke})(x,E,D),P=UT(A,c),U=((oe,ne,ge)=>{const he={"alloy.base.behaviour":P1(oe)};return((Le,fe,de,be)=>{const Te=((ke,Ke,dt)=>{const zt={...dt,...SS(Ke,ke)};return I1(zt,$T)})(Le,de,be);return ES(Te,fe)})(ge,oe.eventOrder,ne,he).getOrDie()})(x,E,D),B=ho(x.components),K={uid:r.uid,getSystem:m.get,config:oe=>{const ne=D;return($(ne[oe.name()])?ne[oe.name()]:()=>{throw new Error("Could not find "+oe.name()+" in "+JSON.stringify(r,null,2))})()},hasConfigured:oe=>$(D[oe.name()]),spec:r,readState:oe=>D[oe]().map(ne=>ne.state.readState()).getOr("not enabled"),getApis:()=>x.apis,connect:oe=>{m.set(oe)},disconnect:()=>{m.set(dg(f))},element:P,syncComponents:()=>{const oe=xr(P),ne=Rn(oe,ge=>m.get().getByDom(ge).fold(()=>[],$t));B.set(ne)},components:B.get,events:U};return K},Pr=r=>{const c=ze(r);return H0({element:c})},H0=r=>{const c=Ui("external.component",ks([Rt("element"),ys("uid")]),r),f=ho(dg()),m=c.uid.getOrThunk(()=>bf("external"));B0(c.element,m);const x={uid:m,getSystem:f.get,config:O.none,hasConfigured:ve,connect:y=>{f.set(y)},disconnect:()=>{f.set(dg(()=>x))},getApis:()=>({}),element:c.element,spec:r,readState:Y("No state"),syncComponents:j,components:Y([]),events:{}};return wS(x)},ga=bf,N1=(r,c)=>Ev(r).getOrThunk(()=>((f,m)=>{const{events:x,...y}=yS(f),E=((A,P)=>{const U=At(A,"components").getOr([]);return P.fold(()=>qe(U,Qi),B=>qe(U,(K,oe)=>N1(K,qs(B,oe))))})(y,m),D={...y,events:{...yv,...x},components:E};return os.value(Dv(D,m))})((f=>On(f,"uid"))(r)?r:{uid:ga(""),...r},c).getOrDie()),Qi=r=>N1(r,O.none()),_c=wS;var F1,U0=(r,c,f,m,x)=>r(f,m)?O.some(f):$(x)&&x(f)?O.none():c(f,m,x);const fg=(r,c,f)=>{let m=r.dom;const x=$(f)?f:ve;for(;m.parentNode;){m=m.parentNode;const y=Ie(m);if(c(y))return O.some(y);if(x(y))break}return O.none()},Zm=(r,c,f)=>U0((m,x)=>x(m),fg,r,c,f),Zf=(r,c)=>J(r.dom.childNodes,f=>c(Ie(f))).map(Ie),zh=(r,c,f)=>Zm(r,c,f).isSome(),vf=(r,c,f)=>fg(r,m=>es(m,c),f),VT=(r,c)=>((f,m)=>{const x=f.dom;return x.parentNode?Zf(Ie(x.parentNode),y=>!po(f,y)&&es(y,c)):O.none()})(r),kv=(r,c)=>Zf(r,f=>es(f,c)),si=(r,c)=>hr(c,r),js=(r,c,f)=>U0((m,x)=>es(m,x),vf,r,c,f),hg="aria-controls",B1=()=>{const r=Zn(hg);return{id:r,link:c=>{Eo(c,hg,r)},unlink:c=>{Lr(c,hg)}}},Gh=(r,c)=>zh(c,f=>po(f,r.element),ve)||((f,m)=>(x=>Zm(x,y=>{if(!zn(y))return!1;const E=xi(y,"id");return E!==void 0&&E.indexOf(hg)>-1}).bind(y=>{const E=xi(y,"id"),D=jr(y);return si(D,`[${hg}="${E}"]`)}))(m).exists(x=>Gh(f,x)))(r,c),Gi=(r,c,f,m,x,y,E,D=!1)=>({x:r,y:c,bubble:f,direction:m,placement:x,restriction:y,label:`${E}-${x}`,alwaysFit:D}),Nu=di([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),uu=Nu.southeast,Av=Nu.southwest,$1=Nu.northeast,Lv=Nu.northwest,mg=Nu.south,Rv=Nu.north,pg=Nu.east,DS=Nu.west,qm=(r,c,f,m)=>{const x=r+c;return x>m?f:x<f?m:x},Fu=(r,c,f)=>Math.min(Math.max(r,c),f),ml=(r,c)=>mo(["left","right","top","bottom"],f=>At(c,f).map(m=>((x,y)=>{switch(y){case 1:return x.x;case 0:return x.x+x.width;case 2:return x.y;case 3:return x.y+x.height}})(r,m))),qf="layout",kS=r=>r.x,AS=(r,c)=>r.x+r.width/2-c.width/2,Bu=(r,c)=>r.x+r.width-c.width,Al=(r,c)=>r.y-c.height,Ym=r=>r.y+r.height,V0=(r,c)=>r.y+r.height/2-c.height/2,_a=(r,c,f)=>Gi(kS(r),Ym(r),f.southeast(),uu(),"southeast",ml(r,{left:1,top:3}),qf),Ei=(r,c,f)=>Gi(Bu(r,c),Ym(r),f.southwest(),Av(),"southwest",ml(r,{right:0,top:3}),qf),ea=(r,c,f)=>Gi(kS(r),Al(r,c),f.northeast(),$1(),"northeast",ml(r,{left:1,bottom:2}),qf),Wi=(r,c,f)=>Gi(Bu(r,c),Al(r,c),f.northwest(),Lv(),"northwest",ml(r,{right:0,bottom:2}),qf),ir=(r,c,f)=>Gi(AS(r,c),Al(r,c),f.north(),Rv(),"north",ml(r,{bottom:2}),qf),Jr=(r,c,f)=>Gi(AS(r,c),Ym(r),f.south(),mg(),"south",ml(r,{top:3}),qf),Xm=(r,c,f)=>Gi((m=>m.x+m.width)(r),V0(r,c),f.east(),pg(),"east",ml(r,{left:0}),qf),Ov=(r,c,f)=>Gi(((m,x)=>m.x-x.width)(r,c),V0(r,c),f.west(),DS(),"west",ml(r,{right:1}),qf),H1=()=>[_a,Ei,ea,Wi,Jr,ir,Xm,Ov],U1=()=>[Ei,_a,Wi,ea,Jr,ir,Xm,Ov],z0=()=>[ea,Wi,_a,Ei,ir,Jr],V1=()=>[Wi,ea,Ei,_a,ir,Jr],Wh=()=>[_a,Ei,ea,Wi,Jr,ir],Iv=()=>[Ei,_a,Wi,ea,Jr,ir];var LS=Object.freeze({__proto__:null,events:r=>Ws([Ft(Au(),(c,f)=>{const m=r.channels,x=Jt(m),y=f,E=((D,A)=>A.universal?D:on(D,P=>et(A.channels,P)))(x,y);mt(E,D=>{const A=m[D],P=A.schema,U=Ui("channel["+D+`] data
Receiver: `+Pu(c.element),P,y.data);A.onReceive(c,U)})})])}),z1=[fa("channels",hf(os.value,ks([jf("onReceive"),lt("schema",Sa())])))];const pl=Mi({fields:z1,name:"receiving",active:LS});var gg=Object.freeze({__proto__:null,exhibit:(r,c)=>Ga({classes:[],styles:c.useFixed()?{}:{position:"relative"}})});const $u=(r,c=!1)=>r.dom.focus({preventScroll:c}),Jm=r=>r.dom.blur(),Qm=r=>{const c=jr(r).dom;return r.dom===c.activeElement},Gl=(r=Ul())=>O.from(r.dom.activeElement).map(Ie),Ll=r=>Gl(jr(r)).filter(c=>r.dom.contains(c.dom)),jh=(r,c)=>{const f=jr(c),m=Gl(f).bind(y=>{const E=D=>po(y,D);return E(c)?O.some(c):((D,A)=>{const P=U=>{for(let B=0;B<U.childNodes.length;B++){const K=Ie(U.childNodes[B]);if(A(K))return O.some(K);const oe=P(U.childNodes[B]);if(oe.isSome())return oe}return O.none()};return P(D.dom)})(c,E)}),x=r(c);return m.each(y=>{Gl(f).filter(E=>po(E,y)).fold(()=>{$u(y)},j)}),x},ep=di([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),G1=(r,c,f,m,x,y)=>{const E=c.rect,D=E.x-f,A=E.y-m,P=x-(D+E.width),U=y-(A+E.height),B=O.some(D),K=O.some(A),oe=O.some(P),ne=O.some(U),ge=O.none();return c.direction.fold(()=>hl(r,B,K,ge,ge),()=>hl(r,ge,K,oe,ge),()=>hl(r,B,ge,ge,ne),()=>hl(r,ge,ge,oe,ne),()=>hl(r,B,K,ge,ge),()=>hl(r,B,ge,ge,ne),()=>hl(r,B,K,ge,ge),()=>hl(r,ge,K,oe,ge))},Yf=(r,c)=>r.fold(()=>{const f=c.rect;return hl("absolute",O.some(f.x),O.some(f.y),O.none(),O.none())},(f,m,x,y)=>G1("absolute",c,f,m,x,y),(f,m,x,y)=>G1("fixed",c,f,m,x,y)),Pv=(r,c)=>{const f=Ce(Vf,c),m=r.fold(f,f,()=>{const E=ui();return Vf(c).translate(-E.left,-E.top)}),x=Zr(c),y=Tt(c);return Oi(m.left,m.top,x,y)},Mv=(r,c)=>c.fold(()=>r.fold(Ii,Ii,Oi),f=>r.fold(Y(f),Y(f),()=>{const m=bg(r,f.x,f.y);return Oi(m.left,m.top,f.width,f.height)})),bg=(r,c,f)=>{const m=Sn(c,f);return r.fold(Y(m),Y(m),()=>{const x=ui();return m.translate(-x.left,-x.top)})};ep.none;const RS=ep.relative,Nv=ep.fixed,Fv="data-alloy-placement",W1=r=>Di(r,Fv),tp=di([{fit:["reposition"]},{nofit:["reposition","visibleW","visibleH","isVisible"]}]),zT=(r,c,f,m)=>{const x=r.bubble,y=x.offset,E=((be,Te,ke)=>{const Ke=(xn,$n)=>Te[xn].map(ro=>{const xo=xn==="top"||xn==="bottom",Zo=xo?ke.top:ke.left,ws=(xn==="left"||xn==="top"?Math.max:Math.min)(ro,$n)+Zo;return xo?Fu(ws,be.y,be.bottom):Fu(ws,be.x,be.right)}).getOr($n),dt=Ke("left",be.x),zt=Ke("top",be.y),Wt=Ke("right",be.right),en=Ke("bottom",be.bottom);return Oi(dt,zt,Wt-dt,en-zt)})(m,r.restriction,y),D=r.x+y.left,A=r.y+y.top,P=Oi(D,A,c,f),{originInBounds:U,sizeInBounds:B,visibleW:K,visibleH:oe}=((be,Te)=>{const{x:ke,y:Ke,right:dt,bottom:zt}=Te,{x:Wt,y:en,right:xn,bottom:$n,width:ro,height:xo}=be;return{originInBounds:Wt>=ke&&Wt<=dt&&en>=Ke&&en<=zt,sizeInBounds:xn<=dt&&xn>=ke&&$n<=zt&&$n>=Ke,visibleW:Math.min(ro,Wt>=ke?dt-Wt:xn-ke),visibleH:Math.min(xo,en>=Ke?zt-en:$n-Ke)}})(P,E),ne=U&&B,ge=ne?P:((be,Te)=>{const{x:ke,y:Ke,right:dt,bottom:zt}=Te,{x:Wt,y:en,width:xn,height:$n}=be,ro=Math.max(ke,dt-xn),xo=Math.max(Ke,zt-$n),Zo=Fu(Wt,ke,ro),ws=Fu(en,Ke,xo),ii=Math.min(Zo+xn,dt)-Zo,pi=Math.min(ws+$n,zt)-ws;return Oi(Zo,ws,ii,pi)})(P,E),he=ge.width>0&&ge.height>0,{maxWidth:Le,maxHeight:fe}=((be,Te,ke)=>{const Ke=Y(Te.bottom-ke.y),dt=Y(ke.bottom-Te.y),zt=(($n,ro,xo,Zo)=>$n.fold(ro,ro,Zo,Zo,ro,Zo,xo,xo))(be,dt,dt,Ke),Wt=Y(Te.right-ke.x),en=Y(ke.right-Te.x);return{maxWidth:(($n,ro,xo,Zo)=>$n.fold(ro,Zo,ro,Zo,xo,xo,ro,Zo))(be,en,en,Wt),maxHeight:zt}})(r.direction,ge,m),de={rect:ge,maxHeight:fe,maxWidth:Le,direction:r.direction,placement:r.placement,classes:{on:x.classesOn,off:x.classesOff},layout:r.label,testY:A};return ne||r.alwaysFit?tp.fit(de):tp.nofit(de,K,oe,he)},np=Oe,Rl=(r,c,f)=>((m,x,y,E)=>$c(m,x,y,E,!1))(r,c,np,f),xf=(r,c,f)=>((m,x,y,E)=>$c(m,x,y,E,!0))(r,c,np,f),OS=ls,Vd=["top","bottom","right","left"],Kh="data-alloy-transition-timer",Bv=(r,c,f,m,x,y)=>{const E=((D,A,P)=>P.exists(U=>{const B=D.mode;return B==="all"||U[B]!==A[B]}))(m,x,y);if(E||((D,A)=>((P,U)=>An(U,B=>zl(P,B)))(D,A.classes))(r,m)){Ro(r,"position",f.position);const D=Pv(c,r),A=Yf(c,{...x,rect:D}),P=mo(Vd,U=>A[U]);((U,B)=>{const K=oe=>parseFloat(oe).toFixed(3);return Pt(B,(oe,ne)=>!((ge,he,Le=ae)=>Yt(ge,he,Le).getOr(ge.isNone()&&he.isNone()))(U[ne].map(K),oe.map(K))).isSome()})(f,P)&&(rl(r,P),E&&((U,B)=>{Wf(U,B.classes),Di(U,Kh).each(K=>{clearTimeout(parseInt(K,10)),Lr(U,Kh)}),((K,oe)=>{const ne=mc(),ge=mc();let he;const Le=Te=>{var ke;const Ke=(ke=Te.raw.pseudoElement)!==null&&ke!==void 0?ke:"";return po(Te.target,K)&&vo(Ke)&&et(Vd,Te.raw.propertyName)},fe=Te=>{if(V(Te)||Le(Te)){ne.clear(),ge.clear();const ke=Te==null?void 0:Te.raw.type;(V(ke)||ke===cn())&&(clearTimeout(he),Lr(K,Kh),Xr(K,oe.classes))}},de=Rl(K,Ln(),Te=>{Le(Te)&&(de.unbind(),ne.set(Rl(K,cn(),fe)),ge.set(Rl(K,$e(),fe)))}),be=(Te=>{const ke=Wt=>{const en=Fr(Te,Wt).split(/\s*,\s*/);return on(en,dn)},Ke=Wt=>{if(h(Wt)&&/^[\d.]+/.test(Wt)){const en=parseFloat(Wt);return aa(Wt,"ms")?en:1e3*en}return 0},dt=ke("transition-delay"),zt=ke("transition-duration");return an(zt,(Wt,en,xn)=>{const $n=Ke(dt[xn])+Ke(en);return Math.max(Wt,$n)},0)})(K);requestAnimationFrame(()=>{he=setTimeout(fe,be+17),Eo(K,Kh,he)})})(U,B)})(r,m),al(r))}else Xr(r,m.classes)},yf=(r,c)=>{((f,m)=>{const x=Ge.max(f,m,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]);Ro(f,"max-height",x+"px")})(r,Math.floor(c))},j1=Y((r,c)=>{yf(r,c),tc(r,{"overflow-x":"hidden","overflow-y":"auto"})}),zd=Y((r,c)=>{yf(r,c)}),vg=(r,c,f)=>r[c]===void 0?f:r[c],Zh=(r,c,f,m)=>{const x=((y,E,D,A)=>{us(E,"max-height"),us(E,"max-width");const P={width:Zr(U=E),height:Tt(U)};var U;return((B,K,oe,ne,ge,he)=>{const Le=ne.width,fe=ne.height,de=(be,Te,ke,Ke,dt)=>{const zt=be(oe,ne,ge,B,he),Wt=zT(zt,Le,fe,he);return Wt.fold(Y(Wt),(en,xn,$n,ro)=>(dt===ro?$n>Ke||xn>ke:!dt&&ro)?Wt:tp.nofit(Te,ke,Ke,dt))};return an(K,(be,Te)=>{const ke=Ce(de,Te);return be.fold(Y(be),ke)},tp.nofit({rect:oe,maxHeight:ne.height,maxWidth:ne.width,direction:uu(),placement:"southeast",classes:{on:[],off:[]},layout:"none",testY:oe.y},-1,-1,!1)).fold(me,me)})(E,A.preference,y,P,D,A.bounds)})(r,c,f,m);return((y,E,D)=>{const A=Yf(D.origin,E);D.transition.each(P=>{Bv(y,D.origin,A,P,E,D.lastPlacement)}),ld(y,A)})(c,x,m),((y,E)=>{((D,A)=>{Eo(D,Fv,A)})(y,E.placement)})(c,x),((y,E)=>{const D=E.classes;Xr(y,D.off),Wf(y,D.on)})(c,x),((y,E,D)=>{(0,D.maxHeightFunction)(y,E.maxHeight)})(c,x,m),((y,E,D)=>{(0,D.maxWidthFunction)(y,E.maxWidth)})(c,x,m),{layout:x.layout,placement:x.placement}},IS=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right","inset"],Tc=(r,c,f,m=1)=>{const x=r*m,y=c*m,E=A=>At(f,A).getOr([]),D=(A,P,U)=>{const B=to(IS,U);return{offset:Sn(A,P),classesOn:Rn(U,E),classesOff:Rn(B,E)}};return{southeast:()=>D(-r,c,["top","alignLeft"]),southwest:()=>D(r,c,["top","alignRight"]),south:()=>D(-r/2,c,["top","alignCentre"]),northeast:()=>D(-r,-c,["bottom","alignLeft"]),northwest:()=>D(r,-c,["bottom","alignRight"]),north:()=>D(-r/2,-c,["bottom","alignCentre"]),east:()=>D(r,-c/2,["valignCentre","left"]),west:()=>D(-r,-c/2,["valignCentre","right"]),insetNortheast:()=>D(x,y,["top","alignLeft","inset"]),insetNorthwest:()=>D(-x,y,["top","alignRight","inset"]),insetNorth:()=>D(-x/2,y,["top","alignCentre","inset"]),insetSoutheast:()=>D(x,-y,["bottom","alignLeft","inset"]),insetSouthwest:()=>D(-x,-y,["bottom","alignRight","inset"]),insetSouth:()=>D(-x/2,-y,["bottom","alignCentre","inset"]),insetEast:()=>D(-x,-y/2,["valignCentre","right","inset"]),insetWest:()=>D(x,-y/2,["valignCentre","left","inset"])}},Hu=()=>Tc(0,0,{}),G0=me,ta=(r,c)=>f=>$v(f)==="rtl"?c:r,$v=r=>Fr(r,"direction")==="rtl"?"rtl":"ltr";var Ta;(function(r){r.TopToBottom="toptobottom",r.BottomToTop="bottomtotop"})(Ta||(Ta={}));const Hv="data-alloy-vertical-dir",PS=r=>zh(r,c=>zn(c)&&xi(c,"data-alloy-vertical-dir")===Ta.BottomToTop),Uu=()=>ul("layouts",[Rt("onLtr"),Rt("onRtl"),ys("onBottomLtr"),ys("onBottomRtl")]),wf=(r,c,f,m,x,y,E)=>{const D=E.map(PS).getOr(!1),A=c.layouts.map(K=>K.onLtr(r)),P=c.layouts.map(K=>K.onRtl(r)),U=D?c.layouts.bind(K=>K.onBottomLtr.map(oe=>oe(r))).or(A).getOr(x):A.getOr(f),B=D?c.layouts.bind(K=>K.onBottomRtl.map(oe=>oe(r))).or(P).getOr(y):P.getOr(m);return ta(U,B)(r)};var Xf=[Rt("hotspot"),ys("bubble"),lt("overrides",{}),Uu(),As("placement",(r,c,f)=>{const m=c.hotspot,x=Pv(f,m.element),y=wf(r.element,c,Wh(),Iv(),z0(),V1(),O.some(c.hotspot.element));return O.some(G0({anchorBox:x,bubble:c.bubble.getOr(Hu()),overrides:c.overrides,layouts:y}))})],Vu=[Rt("x"),Rt("y"),lt("height",0),lt("width",0),lt("bubble",Hu()),lt("overrides",{}),Uu(),As("placement",(r,c,f)=>{const m=bg(f,c.x,c.y),x=Oi(m.left,m.top,c.width,c.height),y=wf(r.element,c,H1(),U1(),H1(),U1(),O.none());return O.some(G0({anchorBox:x,bubble:c.bubble,overrides:c.overrides,layouts:y}))})];const K1=di([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),MS=r=>r.fold(me,(c,f,m)=>c.translate(-f,-m)),W0=r=>r.fold(me,me),op=r=>an(r,(c,f)=>c.translate(f.left,f.top),Sn(0,0)),Z1=r=>{const c=qe(r,W0);return op(c)},Uv=K1.screen,j0=K1.absolute,q1=(r,c,f)=>{const m=tr(r.element),x=ui(m),y=((E,D,A)=>{const P=Ti(A.root).dom;return O.from(P.frameElement).map(Ie).filter(U=>{const B=tr(U),K=tr(E.element);return po(B,K)}).map(wr)})(r,0,f).getOr(x);return j0(y,x.left,x.top)},Sf=(r,c,f,m)=>{const x=Uv(Sn(r,c));return O.some(((y,E,D)=>({point:y,width:E,height:D}))(x,f,m))},K0=(r,c,f,m,x)=>r.map(y=>{const E=[c,y.point],D=(A=()=>Z1(E),P=()=>Z1(E),U=()=>(de=>{const be=qe(de,MS);return op(be)})(E),m.fold(A,P,U));var A,P,U;const B=(ge=D.left,he=D.top,Le=y.width,fe=y.height,{x:ge,y:he,width:Le,height:fe}),K=f.showAbove?z0():Wh(),oe=f.showAbove?V1():Iv(),ne=wf(x,f,K,oe,K,oe,O.none());var ge,he,Le,fe;return G0({anchorBox:B,bubble:f.bubble.getOr(Hu()),overrides:f.overrides,layouts:ne})});var Jf=[Rt("node"),Rt("root"),ys("bubble"),Uu(),lt("overrides",{}),lt("showAbove",!1),As("placement",(r,c,f)=>{const m=q1(r,0,c);return c.node.filter(Nr).bind(x=>{const y=x.dom.getBoundingClientRect(),E=Sf(y.left,y.top,y.width,y.height),D=c.node.getOr(r.element);return K0(E,m,c,f,D)})})];const Wc=(r,c,f,m)=>({start:r,soffset:c,finish:f,foffset:m}),Vv=di([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),GT=(Vv.before,Vv.on,Vv.after,r=>r.fold(me,me,me)),qh=di([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),du={domRange:qh.domRange,relative:qh.relative,exact:qh.exact,exactFromRange:r=>qh.exact(r.start,r.soffset,r.finish,r.foffset),getWin:r=>{const c=(f=>f.match({domRange:m=>Ie(m.startContainer),relative:(m,x)=>GT(m),exact:(m,x,y,E)=>m}))(r);return Ti(c)},range:Wc},xg=(r,c,f)=>{const m=r.document.createRange();var x;return x=m,c.fold(y=>{x.setStartBefore(y.dom)},(y,E)=>{x.setStart(y.dom,E)},y=>{x.setStartAfter(y.dom)}),((y,E)=>{E.fold(D=>{y.setEndBefore(D.dom)},(D,A)=>{y.setEnd(D.dom,A)},D=>{y.setEndAfter(D.dom)})})(m,f),m},Z0=(r,c,f,m,x)=>{const y=r.document.createRange();return y.setStart(c.dom,f),y.setEnd(m.dom,x),y},q0=r=>({left:r.left,top:r.top,right:r.right,bottom:r.bottom,width:r.width,height:r.height}),sp=di([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),zv=(r,c,f)=>c(Ie(f.startContainer),f.startOffset,Ie(f.endContainer),f.endOffset),Y1=(r,c)=>((f,m)=>{const x=((y,E)=>E.match({domRange:D=>({ltr:Y(D),rtl:O.none}),relative:(D,A)=>({ltr:Nc(()=>xg(y,D,A)),rtl:Nc(()=>O.some(xg(y,A,D)))}),exact:(D,A,P,U)=>({ltr:Nc(()=>Z0(y,D,A,P,U)),rtl:Nc(()=>O.some(Z0(y,P,U,D,A)))})}))(f,m);return((y,E)=>{const D=E.ltr();return D.collapsed?E.rtl().filter(A=>A.collapsed===!1).map(A=>sp.rtl(Ie(A.endContainer),A.endOffset,Ie(A.startContainer),A.startOffset)).getOrThunk(()=>zv(0,sp.ltr,D)):zv(0,sp.ltr,D)})(0,x)})(r,c).match({ltr:(f,m,x,y)=>{const E=r.document.createRange();return E.setStart(f.dom,m),E.setEnd(x.dom,y),E},rtl:(f,m,x,y)=>{const E=r.document.createRange();return E.setStart(x.dom,y),E.setEnd(f.dom,m),E}});sp.ltr,sp.rtl;const yg=(r,c,f)=>on(((m,x)=>{const y=$(x)?x:ve;let E=m.dom;const D=[];for(;E.parentNode!==null&&E.parentNode!==void 0;){const A=E.parentNode,P=Ie(A);if(D.push(P),y(P)===!0)break;E=A}return D})(r,f),c),ba=(r,c)=>((f,m)=>{const x=m===void 0?document:m.dom;return Ms(x)?[]:qe(x.querySelectorAll(f),Ie)})(c,r),X1=r=>{if(r.rangeCount>0){const c=r.getRangeAt(0),f=r.getRangeAt(r.rangeCount-1);return O.some(Wc(Ie(c.startContainer),c.startOffset,Ie(f.endContainer),f.endOffset))}return O.none()},WT=r=>{if(r.anchorNode===null||r.focusNode===null)return X1(r);{const c=Ie(r.anchorNode),f=Ie(r.focusNode);return((m,x,y,E)=>{const D=((P,U,B,K)=>{const oe=tr(P).dom.createRange();return oe.setStart(P.dom,U),oe.setEnd(B.dom,K),oe})(m,x,y,E),A=po(m,y)&&x===E;return D.collapsed&&!A})(c,r.anchorOffset,f,r.focusOffset)?O.some(Wc(c,r.anchorOffset,f,r.focusOffset)):X1(r)}},Gv=(r,c)=>(f=>{const m=f.getClientRects(),x=m.length>0?m[0]:f.getBoundingClientRect();return x.width>0||x.height>0?O.some(x).map(q0):O.none()})(Y1(r,c)),NS=((r,c)=>{const f=m=>r(m)?O.from(m.dom.nodeValue):O.none();return{get:m=>{if(!r(m))throw new Error("Can only get text value of a text node");return f(m).getOr("")},getOption:f,set:(m,x)=>{if(!r(m))throw new Error("Can only set raw text value of a text node");m.dom.nodeValue=x}}})(Ko),wg=(r,c)=>({element:r,offset:c}),Yh=(r,c)=>Ko(r)?wg(r,c):((f,m)=>{const x=xr(f);if(x.length===0)return wg(f,m);if(m<x.length)return wg(x[m],0);{const y=x[x.length-1],E=Ko(y)?(D=>NS.get(D))(y).length:xr(y).length;return wg(y,E)}})(r,c),Wv=r=>r.foffset!==void 0,jv=(r,c)=>c.getSelection.getOrThunk(()=>()=>(f=>(m=>O.from(m.getSelection()))(f).filter(m=>m.rangeCount>0).bind(WT))(r))().map(f=>{if(Wv(f)){const m=Yh(f.start,f.soffset),x=Yh(f.finish,f.foffset);return du.range(m.element,m.offset,x.element,x.offset)}return f});var FS=[ys("getSelection"),Rt("root"),ys("bubble"),Uu(),lt("overrides",{}),lt("showAbove",!1),As("placement",(r,c,f)=>{const m=Ti(c.root).dom,x=q1(r,0,c),y=jv(m,c).bind(D=>{if(Wv(D))return((P,U)=>(B=>{const K=B.getBoundingClientRect();return K.width>0||K.height>0?O.some(K).map(q0):O.none()})(Y1(P,U)))(m,du.exactFromRange(D)).orThunk(()=>{const P=ze("\uFEFF");Tu(D.start,P);const U=Gv(m,du.exact(P,0,P,1));return ci(P),U}).bind(P=>Sf(P.left,P.top,P.width,P.height));{const A=Nn(D,U=>U.dom.getBoundingClientRect()),P={left:Math.min(A.firstCell.left,A.lastCell.left),right:Math.max(A.firstCell.right,A.lastCell.right),top:Math.min(A.firstCell.top,A.lastCell.top),bottom:Math.max(A.firstCell.bottom,A.lastCell.bottom)};return Sf(P.left,P.top,P.right-P.left,P.bottom-P.top)}}),E=jv(m,c).bind(D=>Wv(D)?zn(D.start)?O.some(D.start):li(D.start):O.some(D.firstCell)).getOr(r.element);return K0(y,x,c,f,E)})];const Kv="link-layout",Xh=r=>r.x+r.width,Zv=(r,c)=>r.x-c.width,BS=(r,c)=>r.y-c.height+r.height,cd=r=>r.y,$S=(r,c,f)=>Gi(Xh(r),cd(r),f.southeast(),uu(),"southeast",ml(r,{left:0,top:2}),Kv),Y0=(r,c,f)=>Gi(Zv(r,c),cd(r),f.southwest(),Av(),"southwest",ml(r,{right:1,top:2}),Kv),HS=(r,c,f)=>Gi(Xh(r),BS(r,c),f.northeast(),$1(),"northeast",ml(r,{left:0,bottom:3}),Kv),US=(r,c,f)=>Gi(Zv(r,c),BS(r,c),f.northwest(),Lv(),"northwest",ml(r,{right:1,bottom:3}),Kv),rp=()=>[$S,Y0,HS,US],ip=()=>[Y0,$S,US,HS];var qv=[Rt("item"),Uu(),lt("overrides",{}),As("placement",(r,c,f)=>{const m=Pv(f,c.item.element),x=wf(r.element,c,rp(),ip(),rp(),ip(),O.none());return O.some(G0({anchorBox:m,bubble:Hu(),overrides:c.overrides,layouts:x}))})],jT=Kr("type",{selection:FS,node:Jf,hotspot:Xf,submenu:qv,makeshift:Vu});const zu=[ha("classes",ni),Tl("mode","all",["all","layout","placement"])],ap=[lt("useFixed",ve),ys("getBounds")],Qf=[fa("anchor",jT),ul("transition",zu)],VS=(r,c,f,m,x,y)=>{const E=Ui("placement.info",Wn(Qf),x),D=E.anchor,A=m.element,P=f.get(m.uid);jh(()=>{Ro(A,"position","fixed");const U=yi(A,"visibility");Ro(A,"visibility","hidden");const B=c.useFixed()?(()=>{const K=document.documentElement;return Nv(0,0,K.clientWidth,K.clientHeight)})():(K=>{const oe=wr(K.element),ne=K.element.dom.getBoundingClientRect();return RS(oe.left,oe.top,ne.width,ne.height)})(r);D.placement(r,D,B).each(K=>{const oe=y.orThunk(()=>c.getBounds.map(Ae)),ne=((ge,he,Le,fe,de,be)=>((Te,ke,Ke,dt,zt,Wt,en,xn)=>{const $n=vg(en,"maxHeightFunction",j1()),ro=vg(en,"maxWidthFunction",j),xo=Te.anchorBox,Zo=Te.origin,ws={bounds:Mv(Zo,Wt),origin:Zo,preference:dt,maxHeightFunction:$n,maxWidthFunction:ro,lastPlacement:zt,transition:xn};return Zh(xo,ke,Ke,ws)})(((Te,ke)=>((Ke,dt)=>({anchorBox:Ke,origin:dt}))(Te,ke))(he.anchorBox,ge),fe.element,he.bubble,he.layouts,de,Le,he.overrides,be))(B,K,oe,m,P,E.transition);f.set(m.uid,ne)}),U.fold(()=>{us(A,"visibility")},K=>{Ro(A,"visibility",K)}),yi(A,"left").isNone()&&yi(A,"top").isNone()&&yi(A,"right").isNone()&&yi(A,"bottom").isNone()&&Is(yi(A,"position"),"fixed")&&us(A,"position")},A)};var lp=Object.freeze({__proto__:null,position:(r,c,f,m,x)=>{const y=O.none();VS(r,c,f,m,x,y)},positionWithinBounds:VS,getMode:(r,c,f)=>c.useFixed()?"fixed":"absolute",reset:(r,c,f,m)=>{const x=m.element;mt(["position","left","right","top","bottom"],y=>us(x,y)),(y=>{Lr(y,Fv)})(x),f.clear(m.uid)}});const tl=Mi({fields:ap,name:"positioning",active:gg,apis:lp,state:Object.freeze({__proto__:null,init:()=>{let r={};return Ec({readState:()=>r,clear:c=>{z(c)?delete r[c]:r={}},set:(c,f)=>{r[c]=f},get:c=>At(r,c)})}})}),Yv=r=>r.getSystem().isConnected(),Jh=r=>{rs(r,kl());const c=r.components();mt(c,Jh)},cp=r=>{const c=r.components();mt(c,cp),rs(r,Sc())},X0=(r,c)=>{r.getSystem().addToWorld(c),Nr(r.element)&&cp(c)},J0=r=>{Jh(r),r.getSystem().removeFromWorld(r)},Xv=(r,c)=>{ti(r.element,c.element)},Ef=(r,c)=>{Jv(r,c,ti)},Jv=(r,c,f)=>{r.getSystem().addToWorld(c),f(r.element,c.element),Nr(r.element)&&cp(c),r.syncComponents()},Qv=r=>{Jh(r),ci(r.element),r.getSystem().removeFromWorld(r)},oc=r=>{const c=la(r.element).bind(f=>r.getSystem().getByDom(f).toOptional());Qv(r),c.each(f=>{f.syncComponents()})},Cf=r=>{const c=r.components();mt(c,Qv),Hl(r.element),r.syncComponents()},ex=(r,c)=>{up(r,c,ti)},Et=(r,c)=>{up(r,c,uf)},up=(r,c,f)=>{f(r,c.element);const m=xr(c.element);mt(m,x=>{c.getByDom(x).each(cp)})},zS=r=>{const c=xr(r.element);mt(c,f=>{r.getByDom(f).each(Jh)}),ci(r.element)},GS=(r,c,f,m)=>{f.get().each(E=>{Cf(r)});const x=c.getAttachPoint(r);Ef(x,r);const y=r.getSystem().build(m);return Ef(r,y),f.set(y),y},tx=(r,c,f,m)=>{const x=GS(r,c,f,m);return c.onOpen(r,x),x},ud=(r,c,f)=>{f.get().each(m=>{Cf(r),oc(r),c.onClose(r,m),f.clear()})},J1=(r,c,f)=>f.isOpen(),nx=(r,c,f)=>{const m=c.getAttachPoint(r);Ro(r.element,"position",tl.getMode(m)),((x,y,E,D)=>{yi(x.element,y).fold(()=>{Lr(x.element,E)},A=>{Eo(x.element,E,A)}),Ro(x.element,y,"hidden")})(r,"visibility",c.cloakVisibilityAttr)},Q0=(r,c,f)=>{(m=>Dt(["top","left","right","bottom"],x=>yi(m,x).isSome()))(r.element)||us(r.element,"position"),((m,x,y)=>{Di(m.element,y).fold(()=>us(m.element,x),E=>Ro(m.element,x,E))})(r,"visibility",c.cloakVisibilityAttr)};var Q1=Object.freeze({__proto__:null,cloak:nx,decloak:Q0,open:tx,openWhileCloaked:(r,c,f,m,x)=>{nx(r,c),tx(r,c,f,m),x(),Q0(r,c)},close:ud,isOpen:J1,isPartOf:(r,c,f,m)=>J1(0,0,f)&&f.get().exists(x=>c.isPartOf(r,x,m)),getState:(r,c,f)=>f.get(),setContent:(r,c,f,m)=>f.get().map(()=>GS(r,c,f,m))}),KT=Object.freeze({__proto__:null,events:(r,c)=>Ws([Ft(lv(),(f,m)=>{ud(f,r,c)})])}),WS=[Rs("onOpen"),Rs("onClose"),Rt("isPartOf"),Rt("getAttachPoint"),lt("cloakVisibilityAttr","data-precloak-visibility")],w=Object.freeze({__proto__:null,init:()=>{const r=nr(),c=Y("not-implemented");return Ec({readState:c,isOpen:r.isSet,clear:r.clear,set:r.set,get:r.get})}});const _=Mi({fields:WS,name:"sandboxing",active:KT,apis:Q1,state:w}),I=Y("dismiss.popups"),H=Y("reposition.popups"),Z=Y("mouse.released"),q=ks([lt("isExtraPart",ve),ul("fireEventInstead",[lt("event",Fd())])]),le=r=>{const c=Ui("Dismissal",q,r);return{[I()]:{schema:ks([Rt("target")]),onReceive:(f,m)=>{_.isOpen(f)&&(_.isPartOf(f,m.target)||c.isExtraPart(f,m.target)||c.fireEventInstead.fold(()=>_.close(f),x=>rs(f,x.event)))}}}},ue=ks([ul("fireEventInstead",[lt("event",hS())]),Ji("doReposition")]),_e=r=>{const c=Ui("Reposition",ue,r);return{[H()]:{onReceive:f=>{_.isOpen(f)&&c.fireEventInstead.fold(()=>c.doReposition(f),m=>rs(f,m.event))}}}},Be=(r,c,f)=>{c.store.manager.onLoad(r,c,f)},Ye=(r,c,f)=>{c.store.manager.onUnload(r,c,f)};var Me=Object.freeze({__proto__:null,onLoad:Be,onUnload:Ye,setValue:(r,c,f,m)=>{c.store.manager.setValue(r,c,f,m)},getValue:(r,c,f)=>c.store.manager.getValue(r,c,f),getState:(r,c,f)=>f}),He=Object.freeze({__proto__:null,events:(r,c)=>{const f=r.resetOnDom?[zr((m,x)=>{Be(m,r,c)}),pf((m,x)=>{Ye(m,r,c)})]:[fl(r,c,Be)];return Ws(f)}});const je=()=>{const r=ho(null);return Ec({set:r.set,get:r.get,isNotSet:()=>r.get()===null,clear:()=>{r.set(null)},readState:()=>({mode:"memory",value:r.get()})})},ct=()=>{const r=ho({}),c=ho({});return Ec({readState:()=>({mode:"dataset",dataByValue:r.get(),dataByText:c.get()}),lookup:f=>At(r.get(),f).orThunk(()=>At(c.get(),f)),update:f=>{const m=r.get(),x=c.get(),y={},E={};mt(f,D=>{y[D.value]=D,At(D,"meta").each(A=>{At(A,"text").each(P=>{E[P]=D})})}),r.set({...m,...y}),c.set({...x,...E})},clear:()=>{r.set({}),c.set({})}})};var ut=Object.freeze({__proto__:null,memory:je,dataset:ct,manual:()=>Ec({readState:j}),init:r=>r.store.manager.state(r)});const Ht=(r,c,f,m)=>{const x=c.store;f.update([m]),x.setValue(r,m),c.onSetValue(r,m)};var Gt=[ys("initialValue"),Rt("getFallbackEntry"),Rt("getDataKey"),Rt("setValue"),As("manager",{setValue:Ht,getValue:(r,c,f)=>{const m=c.store,x=m.getDataKey(r);return f.lookup(x).getOrThunk(()=>m.getFallbackEntry(x))},onLoad:(r,c,f)=>{c.store.initialValue.each(m=>{Ht(r,c,f,m)})},onUnload:(r,c,f)=>{f.clear()},state:ct})],Vt=[Rt("getValue"),lt("setValue",j),ys("initialValue"),As("manager",{setValue:(r,c,f,m)=>{c.store.setValue(r,m),c.onSetValue(r,m)},getValue:(r,c,f)=>c.store.getValue(r),onLoad:(r,c,f)=>{c.store.initialValue.each(m=>{c.store.setValue(r,m)})},onUnload:j,state:Ru.init})],jt=[ys("initialValue"),As("manager",{setValue:(r,c,f,m)=>{f.set(m),c.onSetValue(r,m)},getValue:(r,c,f)=>f.get(),onLoad:(r,c,f)=>{c.store.initialValue.each(m=>{f.isNotSet()&&f.set(m)})},onUnload:(r,c,f)=>{f.clear()},state:je})],un=[Si("store",{mode:"memory"},Kr("mode",{memory:jt,manual:Vt,dataset:Gt})),Rs("onSetValue"),lt("resetOnDom",!1)];const at=Mi({fields:un,name:"representing",active:He,apis:Me,extra:{setValueFrom:(r,c)=>{const f=at.getValue(c);at.setValue(r,f)}},state:ut}),vn=(r,c)=>Xs(r,{},qe(c,f=>{return m=f.name(),x="Cannot configure "+f.name()+" for "+r,wi(m,m,{tag:"option",process:{}},_s(y=>F("The field: "+m+" is forbidden. "+x)));var m,x}).concat([Pi("dump",me)])),go=r=>r.dump,eo=(r,c)=>({...tn(c),...r.dump}),Hs=vn,lo=eo,is="placeholder",Oo=di([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),ur=r=>On(r,"uiType"),na=(r,c,f,m)=>((x,y,E,D)=>ur(E)&&E.uiType===is?((A,P,U,B)=>A.exists(K=>K!==U.owner)?Oo.single(!0,Y(U)):At(B,U.name).fold(()=>{throw new Error("Unknown placeholder component: "+U.name+`
Known: [`+Jt(B)+`]
Namespace: `+A.getOr("none")+`
Spec: `+JSON.stringify(U,null,2))},K=>K.replace()))(x,0,E,D):Oo.single(!1,Y(E)))(r,0,f,m).fold((x,y)=>{const E=ur(f)?y(c,f.config,f.validated):y(c),D=At(E,"components").getOr([]),A=Rn(D,P=>na(r,c,P,m));return[{...E,components:A}]},(x,y)=>{if(ur(f)){const E=y(c,f.config,f.validated);return f.validated.preprocess.getOr(me)(E)}return y(c)}),gl=Oo.single,Wa=Oo.multiple,jc=Y(is),Gd=di([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),bl=lt("factory",{sketch:me}),eh=lt("schema",[]),th=Rt("name"),dp=wi("pname","pname",gt(r=>"<alloy."+Zn(r.name)+">"),Sa()),ey=Pi("schema",()=>[ys("preprocess")]),nh=lt("defaults",Y({})),fp=lt("overrides",Y({})),zB=Wn([bl,eh,th,dp,nh,fp]),GB=Wn([bl,eh,th,nh,fp]),mR=Wn([bl,eh,th,dp,nh,fp]),qn=Wn([bl,ey,th,Rt("unit"),dp,nh,fp]),ty=r=>r.fold(O.some,O.none,O.some,O.some),ZT=r=>{const c=f=>f.name;return r.fold(c,c,c,c)},jS=(r,c)=>f=>{const m=Ui("Converting part type",c,f);return r(m)},sc=jS(Gd.required,zB),_f=jS(Gd.external,GB),dd=jS(Gd.optional,mR),KS=jS(Gd.group,qn),qT=Y("entirety");var pR=Object.freeze({__proto__:null,required:sc,external:_f,optional:dd,group:KS,asNamedPart:ty,name:ZT,asCommon:r=>r.fold(me,me,me,me),original:qT});const YT=(r,c,f,m)=>Ze(c.defaults(r,f,m),f,{uid:r.partUids[c.name]},c.overrides(r,f,m)),Wl=(r,c)=>{const f={};return mt(c,m=>{ty(m).each(x=>{const y=ny(r,x.pname);f[x.name]=E=>{const D=Ui("Part: "+x.name+" in "+r,Wn(x.schema),E);return{...y,config:E,validated:D}}})}),f},ny=(r,c)=>({uiType:jc(),owner:r,name:c}),XT=(r,c,f)=>({uiType:jc(),owner:r,name:c,config:f,validated:{}}),gR=r=>Rn(r,c=>c.fold(O.none,O.some,O.none,O.none).map(f=>Ha(f.name,f.schema.concat([M0(qT())]))).toArray()),bR=r=>qe(r,ZT),JT=(r,c,f)=>((m,x,y)=>{const E={},D={};return mt(y,A=>{A.fold(P=>{E[P.pname]=gl(!0,(U,B,K)=>P.factory.sketch(YT(U,P,B,K)))},P=>{const U=x.parts[P.name];D[P.name]=Y(P.factory.sketch(YT(x,P,U[qT()]),U))},P=>{E[P.pname]=gl(!1,(U,B,K)=>P.factory.sketch(YT(U,P,B,K)))},P=>{E[P.pname]=Wa(!0,(U,B,K)=>{const oe=U[P.name];return qe(oe,ne=>P.factory.sketch(Ze(P.defaults(U,ne,K),ne,P.overrides(U,ne))))})})}),{internals:Y(E),externals:Y(D)}})(0,c,f),QT=(r,c,f)=>((m,x,y,E)=>{const D=Nn(E,(P,U)=>((B,K)=>{let oe=!1;return{name:Y(B),required:()=>K.fold((ne,ge)=>ne,(ne,ge)=>ne),used:()=>oe,replace:()=>{if(oe)throw new Error("Trying to use the same placeholder more than once: "+B);return oe=!0,K}}})(U,P)),A=((P,U,B,K)=>Rn(B,oe=>na(P,U,oe,K)))(m,x,y,D);return Cn(D,P=>{if(P.used()===!1&&P.required())throw new Error("Placeholder: "+P.name()+` was not found in components list
Namespace: `+m.getOr("none")+`
Components: `+JSON.stringify(x.components,null,2))}),A})(O.some(r),c,c.components,f),Br=(r,c,f)=>{const m=c.partUids[f];return r.getSystem().getByUid(m).toOptional()},hp=(r,c,f)=>Br(r,c,f).getOrDie("Could not find part: "+f),vR=(r,c,f)=>{const m={},x=c.partUids,y=r.getSystem();return mt(f,E=>{m[E]=Y(y.getByUid(x[E]))}),m},e2=(r,c)=>{const f=r.getSystem();return Nn(c.partUids,(m,x)=>Y(f.getByUid(m)))},xR=r=>Jt(r.partUids),t2=(r,c,f)=>{const m={},x=c.partUids,y=r.getSystem();return mt(f,E=>{m[E]=Y(y.getByUid(x[E]).getOrDie())}),m},yR=(r,c)=>{const f=bR(c);return wc(qe(f,m=>({key:m,value:r+"-"+m})))},n2=r=>wi("partUids","partUids",Io(c=>yR(c.uid,r)),Sa());var WB=Object.freeze({__proto__:null,generate:Wl,generateOne:XT,schemas:gR,names:bR,substitutes:JT,components:QT,defaultUids:yR,defaultUidsSchema:n2,getAllParts:e2,getAllPartNames:xR,getPart:Br,getPartOrDie:hp,getParts:vR,getPartsOrDie:t2});const wR=(r,c,f,m,x)=>{const y=((E,D)=>(E.length>0?[Ha("parts",E)]:[]).concat([Rt("uid"),lt("dom",{}),lt("components",[]),M0("originalSpec"),lt("debug.sketcher",{})]).concat(D))(m,x);return Ui(r+" [SpecSchema]",ks(y.concat(c)),f)},oy=(r,c,f,m,x)=>{const y=o2(x),E=gR(f),D=n2(f),A=wR(r,c,y,E,[D]),P=JT(0,A,f);return m(A,QT(r,A,P.internals()),y,P.externals())},o2=r=>(c=>On(c,"uid"))(r)?r:{...r,uid:bf("uid")},jB=ks([Rt("name"),Rt("factory"),Rt("configFields"),lt("apis",{}),lt("extraApis",{})]),SR=ks([Rt("name"),Rt("factory"),Rt("configFields"),Rt("partFields"),lt("apis",{}),lt("extraApis",{})]),fd=r=>{const c=Ui("Sketcher for "+r.name,jB,r),f=Nn(c.apis,Cv),m=Nn(c.extraApis,(x,y)=>Fh(x,y));return{name:c.name,configFields:c.configFields,sketch:x=>((y,E,D,A)=>{const P=o2(A);return D(wR(y,E,P,[],[]),P)})(c.name,c.configFields,c.factory,x),...f,...m}},Dc=r=>{const c=Ui("Sketcher for "+r.name,SR,r),f=Wl(c.name,c.partFields),m=Nn(c.apis,Cv),x=Nn(c.extraApis,(y,E)=>Fh(y,E));return{name:c.name,partFields:c.partFields,configFields:c.configFields,sketch:y=>oy(c.name,c.configFields,c.partFields,c.factory,y),parts:f,...m,...x}},ox=r=>Lo("input")(r)&&xi(r,"type")!=="radio"||Lo("textarea")(r);var ER=Object.freeze({__proto__:null,getCurrent:(r,c,f)=>c.find(r)});const KB=[Rt("find")],Os=Mi({fields:KB,name:"composing",apis:ER}),CR=["input","button","textarea","select"],_R=(r,c,f)=>{(c.disabled()?sy:r2)(r,c)},s2=(r,c)=>c.useNative===!0&&et(CR,sn(r.element)),TR=r=>{Eo(r.element,"disabled","disabled")},ZB=r=>{Lr(r.element,"disabled")},sx=r=>{Eo(r.element,"aria-disabled","true")},qB=r=>{Eo(r.element,"aria-disabled","false")},sy=(r,c,f)=>{c.disableClass.each(m=>{zi(r.element,m)}),(s2(r,c)?TR:sx)(r),c.onDisabled(r)},r2=(r,c,f)=>{c.disableClass.each(m=>{hi(r.element,m)}),(s2(r,c)?ZB:qB)(r),c.onEnabled(r)},rx=(r,c)=>s2(r,c)?(f=>Ba(f.element,"disabled"))(r):(f=>xi(f.element,"aria-disabled")==="true")(r);var YB=Object.freeze({__proto__:null,enable:r2,disable:sy,isDisabled:rx,onLoad:_R,set:(r,c,f,m)=>{(m?sy:r2)(r,c)}}),XB=Object.freeze({__proto__:null,exhibit:(r,c)=>Ga({classes:c.disabled()?c.disableClass.toArray():[]}),events:(r,c)=>Ws([Ir(pr(),(f,m)=>rx(f,r)),fl(r,c,_R)])}),JB=[Or("disabled",ve),lt("useNative",!0),ys("disableClass"),Rs("onDisabled"),Rs("onEnabled")];const Ho=Mi({fields:JB,name:"disabling",active:XB,apis:YB}),DR=(r,c,f,m)=>{const x=ba(r.element,"."+c.highlightClass);mt(x,y=>{Dt(m,E=>po(E.element,y))||(hi(y,c.highlightClass),r.getSystem().getByDom(y).each(E=>{c.onDehighlight(r,E),rs(E,g1())}))})},eb=(r,c,f,m)=>{DR(r,c,0,[m]),i2(r,c,f,m)||(zi(m.element,c.highlightClass),c.onHighlight(r,m),rs(m,rn()))},i2=(r,c,f,m)=>zl(m.element,c.highlightClass),kR=(r,c,f)=>si(r.element,"."+c.itemClass).bind(m=>r.getSystem().getByDom(m).toOptional()),AR=(r,c,f)=>{const m=ba(r.element,"."+c.itemClass);return(m.length>0?O.some(m[m.length-1]):O.none()).bind(x=>r.getSystem().getByDom(x).toOptional())},LR=(r,c,f,m)=>{const x=ba(r.element,"."+c.itemClass);return Bn(x,y=>zl(y,c.highlightClass)).bind(y=>{const E=qm(y,m,0,x.length-1);return r.getSystem().getByDom(x[E]).toOptional()})},RR=(r,c,f)=>{const m=ba(r.element,"."+c.itemClass);return kr(qe(m,x=>r.getSystem().getByDom(x).toOptional()))};var QB=Object.freeze({__proto__:null,dehighlightAll:(r,c,f)=>DR(r,c,0,[]),dehighlight:(r,c,f,m)=>{i2(r,c,f,m)&&(hi(m.element,c.highlightClass),c.onDehighlight(r,m),rs(m,g1()))},highlight:eb,highlightFirst:(r,c,f)=>{kR(r,c).each(m=>{eb(r,c,f,m)})},highlightLast:(r,c,f)=>{AR(r,c).each(m=>{eb(r,c,f,m)})},highlightAt:(r,c,f,m)=>{((x,y,E,D)=>{const A=ba(x.element,"."+y.itemClass);return O.from(A[D]).fold(()=>os.error(new Error("No element found with index "+D)),x.getSystem().getByDom)})(r,c,0,m).fold(x=>{throw x},x=>{eb(r,c,f,x)})},highlightBy:(r,c,f,m)=>{const x=RR(r,c);J(x,m).each(y=>{eb(r,c,f,y)})},isHighlighted:i2,getHighlighted:(r,c,f)=>si(r.element,"."+c.highlightClass).bind(m=>r.getSystem().getByDom(m).toOptional()),getFirst:kR,getLast:AR,getPrevious:(r,c,f)=>LR(r,c,0,-1),getNext:(r,c,f)=>LR(r,c,0,1),getCandidates:RR}),OR=[Rt("highlightClass"),Rt("itemClass"),Rs("onHighlight"),Rs("onDehighlight")];const or=Mi({fields:OR,name:"highlighting",apis:QB}),IR=[8],Tf=[9],Qh=[13],ZS=[27],Gu=[32],qS=[37],ix=[38],ry=[39],ax=[40],e5=(r,c,f)=>{const m=jn(r.slice(0,c)),x=jn(r.slice(c+1));return J(m.concat(x),f)},t5=(r,c,f)=>{const m=jn(r.slice(0,c));return J(m,f)},n5=(r,c,f)=>{const m=r.slice(0,c),x=r.slice(c+1);return J(x.concat(m),f)},o5=(r,c,f)=>{const m=r.slice(c+1);return J(m,f)},Ns=r=>c=>{const f=c.raw;return et(r,f.which)},oh=r=>c=>An(r,f=>f(c)),em=r=>r.raw.shiftKey===!0,s5=r=>r.raw.ctrlKey===!0,iy=Ue(em),zs=(r,c)=>({matches:r,classification:c}),PR=(r,c,f)=>{c.exists(m=>f.exists(x=>po(x,m)))||so(r,Bd(),{prevFocus:c,newFocus:f})},a2=()=>{const r=c=>Ll(c.element);return{get:r,set:(c,f)=>{const m=r(c);c.getSystem().triggerFocus(f,c.element);const x=r(c);PR(c,m,x)}}},r5=()=>{const r=c=>or.getHighlighted(c).map(f=>f.element);return{get:r,set:(c,f)=>{const m=r(c);c.getSystem().getByDom(f).fold(j,y=>{or.highlight(c,y)});const x=r(c);PR(c,m,x)}}};var tb;(function(r){r.OnFocusMode="onFocus",r.OnEnterOrSpaceMode="onEnterOrSpace",r.OnApiMode="onApi"})(tb||(tb={}));const nb=(r,c,f,m,x)=>{const y=(D,A,P,U,B)=>{return(K=P(D,A,U,B),oe=A.event,J(K,ne=>ne.matches(oe)).map(ne=>ne.classification)).bind(ne=>ne(D,A,U,B));var K,oe},E={schema:()=>r.concat([lt("focusManager",a2()),Si("focusInside","onFocus",vc(D=>et(["onFocus","onEnterOrSpace","onApi"],D)?os.value(D):os.error("Invalid value for focusInside"))),As("handler",E),As("state",c),As("sendFocusIn",x)]),processKey:y,toEvents:(D,A)=>{const P=D.focusInside!==tb.OnFocusMode?O.none():x(D).map(B=>Ft(Vo(),(K,oe)=>{B(K,D,A),oe.stop()})),U=[Ft(Jn(),(B,K)=>{y(B,K,f,D,A).fold(()=>{((oe,ne)=>{const ge=Ns(Gu.concat(Qh))(ne.event);D.focusInside===tb.OnEnterOrSpaceMode&&ge&&mf(oe,ne)&&x(D).each(he=>{he(oe,D,A),ne.stop()})})(B,K)},oe=>{K.stop()})}),Ft(mr(),(B,K)=>{y(B,K,m,D,A).each(oe=>{K.stop()})})];return Ws(P.toArray().concat(U))}};return E},MR=r=>{const c=[ys("onEscape"),ys("onEnter"),lt("selector",'[data-alloy-tabstop="true"]:not(:disabled)'),lt("firstTabstop",0),lt("useTabstopAt",Oe),ys("visibilitySelector")].concat([r]),f=(U,B)=>{const K=U.visibilitySelector.bind(oe=>js(B,oe)).getOr(B);return Qe(K)>0},m=(U,B)=>B.focusManager.get(U).bind(K=>js(K,B.selector)),x=(U,B,K)=>{((oe,ne)=>{const ge=ba(oe.element,ne.selector),he=on(ge,Le=>f(ne,Le));return O.from(he[ne.firstTabstop])})(U,B).each(oe=>{B.focusManager.set(U,oe)})},y=(U,B,K,oe)=>{const ne=ba(U.element,K.selector);return m(U,K).bind(ge=>Bn(ne,Ce(po,ge)).bind(he=>((Le,fe,de,be,Te)=>Te(fe,de,ke=>((Ke,dt)=>f(Ke,dt)&&Ke.useTabstopAt(dt))(be,ke)).fold(()=>be.cyclic?O.some(!0):O.none(),ke=>(be.focusManager.set(Le,ke),O.some(!0))))(U,ne,he,K,oe)))},E=(U,B,K)=>{const oe=K.cyclic?e5:t5;return y(U,0,K,oe)},D=(U,B,K)=>{const oe=K.cyclic?n5:o5;return y(U,0,K,oe)},A=Y([zs(oh([em,Ns(Tf)]),E),zs(Ns(Tf),D),zs(oh([iy,Ns(Qh)]),(U,B,K)=>K.onEnter.bind(oe=>oe(U,B)))]),P=Y([zs(Ns(ZS),(U,B,K)=>K.onEscape.bind(oe=>oe(U,B))),zs(Ns(Tf),(U,B,K)=>m(U,K).filter(oe=>!K.useTabstopAt(oe)).bind(oe=>((ne=>(ge=>la(ge))(ne).bind(Hi).exists(ge=>po(ge,ne)))(oe)?E:D)(U,B,K)))]);return nb(c,Ru.init,A,P,()=>O.some(x))};var i5=MR(Pi("cyclic",ve)),a5=MR(Pi("cyclic",Oe));const ay=(r,c,f)=>ox(f)&&Ns(Gu)(c.event)?O.none():((m,x,y)=>(D0(m,y,pr()),O.some(!0)))(r,0,f),ob=(r,c)=>O.some(!0),l5=[lt("execute",ay),lt("useSpace",!1),lt("useEnter",!0),lt("useControlEnter",!1),lt("useDown",!1)],NR=(r,c,f)=>f.execute(r,c,r.element);var c5=nb(l5,Ru.init,(r,c,f,m)=>{const x=f.useSpace&&!ox(r.element)?Gu:[],y=f.useEnter?Qh:[],E=f.useDown?ax:[],D=x.concat(y).concat(E);return[zs(Ns(D),NR)].concat(f.useControlEnter?[zs(oh([s5,Ns(Qh)]),NR)]:[])},(r,c,f,m)=>f.useSpace&&!ox(r.element)?[zs(Ns(Gu),ob)]:[],()=>O.none());const FR=()=>{const r=nr();return Ec({readState:()=>r.get().map(c=>({numRows:String(c.numRows),numColumns:String(c.numColumns)})).getOr({numRows:"?",numColumns:"?"}),setGridSize:(c,f)=>{r.set({numRows:c,numColumns:f})},getNumRows:()=>r.get().map(c=>c.numRows),getNumColumns:()=>r.get().map(c=>c.numColumns)})};var BR=Object.freeze({__proto__:null,flatgrid:FR,init:r=>r.state(r)});const $R=r=>(c,f,m,x)=>{const y=r(c.element);return HR(y,c,f,m,x)},l2=(r,c)=>{const f=ta(r,c);return $R(f)},c2=(r,c)=>{const f=ta(c,r);return $R(f)},u2=r=>(c,f,m,x)=>HR(r,c,f,m,x),HR=(r,c,f,m,x)=>m.focusManager.get(c).bind(y=>r(c.element,y,m,x)).map(y=>(m.focusManager.set(c,y),!0)),d2=u2,UR=u2,YS=u2,VR=r=>!(c=>c.offsetWidth<=0&&c.offsetHeight<=0)(r.dom),f2=(r,c,f)=>{const m=ba(r,f);return((x,y)=>Bn(x,E=>po(E,c)).map(E=>({index:E,candidates:x})))(on(m,VR))},XS=(r,c)=>Bn(r,f=>po(c,f)),zR=(r,c,f,m)=>m(Math.floor(c/f),c%f).bind(x=>{const y=x.row*f+x.column;return y>=0&&y<r.length?O.some(r[y]):O.none()}),GR=(r,c,f,m,x)=>zR(r,c,m,(y,E)=>{const D=y===f-1?r.length-y*m:m,A=qm(E,x,0,D-1);return O.some({row:y,column:A})}),WR=(r,c,f,m,x)=>zR(r,c,m,(y,E)=>{const D=qm(y,x,0,f-1),A=D===f-1?r.length-D*m:m,P=Fu(E,0,A-1);return O.some({row:D,column:P})}),u5=[Rt("selector"),lt("execute",ay),Cc("onEscape"),lt("captureTab",!1),N0()],jR=(r,c,f)=>{si(r.element,c.selector).each(m=>{c.focusManager.set(r,m)})},ly=r=>(c,f,m,x)=>f2(c,f,m.selector).bind(y=>r(y.candidates,y.index,x.getNumRows().getOr(m.initSize.numRows),x.getNumColumns().getOr(m.initSize.numColumns))),h2=(r,c,f)=>f.captureTab?O.some(!0):O.none(),m2=ly((r,c,f,m)=>GR(r,c,f,m,-1)),p2=ly((r,c,f,m)=>GR(r,c,f,m,1)),d5=ly((r,c,f,m)=>WR(r,c,f,m,-1)),f5=ly((r,c,f,m)=>WR(r,c,f,m,1)),h5=Y([zs(Ns(qS),l2(m2,p2)),zs(Ns(ry),c2(m2,p2)),zs(Ns(ix),d2(d5)),zs(Ns(ax),UR(f5)),zs(oh([em,Ns(Tf)]),h2),zs(oh([iy,Ns(Tf)]),h2),zs(Ns(Gu.concat(Qh)),(r,c,f,m)=>((x,y)=>y.focusManager.get(x).bind(E=>js(E,y.selector)))(r,f).bind(x=>f.execute(r,c,x)))]),m5=Y([zs(Ns(ZS),(r,c,f)=>f.onEscape(r,c)),zs(Ns(Gu),ob)]);var p5=nb(u5,FR,h5,m5,()=>O.some(jR));const Sg=(r,c,f,m,x)=>{const y=(E,D,A)=>x(E,D,m,0,A.length-1,A[D],P=>{return U=A[P],sn(U)==="button"&&xi(U,"disabled")==="disabled"?y(E,P,A):O.from(A[P]);var U});return f2(r,f,c).bind(E=>{const D=E.index,A=E.candidates;return y(D,D,A)})},KR=(r,c,f,m)=>Sg(r,c,f,m,(x,y,E,D,A,P,U)=>{const B=Fu(y+E,D,A);return B===x?O.from(P):U(B)}),JS=(r,c,f,m)=>Sg(r,c,f,m,(x,y,E,D,A,P,U)=>{const B=qm(y,E,D,A);return B===x?O.none():U(B)}),g5=[Rt("selector"),lt("getInitial",O.none),lt("execute",ay),Cc("onEscape"),lt("executeOnMove",!1),lt("allowVertical",!0),lt("allowHorizontal",!0),lt("cycles",!0)],g2=(r,c,f)=>((m,x)=>x.focusManager.get(m).bind(y=>js(y,x.selector)))(r,f).bind(m=>f.execute(r,c,m)),ZR=(r,c,f)=>{c.getInitial(r).orThunk(()=>si(r.element,c.selector)).each(m=>{c.focusManager.set(r,m)})},qR=(r,c,f)=>(f.cycles?JS:KR)(r,f.selector,c,-1),YR=(r,c,f)=>(f.cycles?JS:KR)(r,f.selector,c,1),b2=r=>(c,f,m,x)=>r(c,f,m,x).bind(()=>m.executeOnMove?g2(c,f,m):O.some(!0)),cy=Y([zs(Ns(Gu),ob),zs(Ns(ZS),(r,c,f)=>f.onEscape(r,c))]);var uy=nb(g5,Ru.init,(r,c,f,m)=>{const x=[...f.allowHorizontal?qS:[]].concat(f.allowVertical?ix:[]),y=[...f.allowHorizontal?ry:[]].concat(f.allowVertical?ax:[]);return[zs(Ns(x),b2(l2(qR,YR))),zs(Ns(y),b2(c2(qR,YR))),zs(Ns(Qh),g2),zs(Ns(Gu),g2)]},cy,()=>O.some(ZR));const QS=(r,c,f)=>O.from(r[c]).bind(m=>O.from(m[f]).map(x=>({rowIndex:c,columnIndex:f,cell:x}))),eE=(r,c,f,m)=>{const x=r[c].length,y=qm(f,m,0,x-1);return QS(r,c,y)},XR=(r,c,f,m)=>{const x=qm(f,m,0,r.length-1),y=r[x].length,E=Fu(c,0,y-1);return QS(r,x,E)},v2=(r,c,f,m)=>{const x=r[c].length,y=Fu(f+m,0,x-1);return QS(r,c,y)},x2=(r,c,f,m)=>{const x=Fu(f+m,0,r.length-1),y=r[x].length,E=Fu(c,0,y-1);return QS(r,x,E)},JR=[Ha("selectors",[Rt("row"),Rt("cell")]),lt("cycles",!0),lt("previousSelector",O.none),lt("execute",ay)],b5=(r,c,f)=>{c.previousSelector(r).orThunk(()=>{const m=c.selectors;return si(r.element,m.cell)}).each(m=>{c.focusManager.set(r,m)})},tE=(r,c)=>(f,m,x)=>{const y=x.cycles?r:c;return js(m,x.selectors.row).bind(E=>{const D=ba(E,x.selectors.cell);return XS(D,m).bind(A=>{const P=ba(f,x.selectors.row);return XS(P,E).bind(U=>{const B=((K,oe)=>qe(K,ne=>ba(ne,oe.selectors.cell)))(P,x);return y(B,U,A).map(K=>K.cell)})})})},QR=tE((r,c,f)=>eE(r,c,f,-1),(r,c,f)=>v2(r,c,f,-1)),sb=tE((r,c,f)=>eE(r,c,f,1),(r,c,f)=>v2(r,c,f,1)),rb=tE((r,c,f)=>XR(r,f,c,-1),(r,c,f)=>x2(r,f,c,-1)),nE=tE((r,c,f)=>XR(r,f,c,1),(r,c,f)=>x2(r,f,c,1)),dy=Y([zs(Ns(qS),l2(QR,sb)),zs(Ns(ry),c2(QR,sb)),zs(Ns(ix),d2(rb)),zs(Ns(ax),UR(nE)),zs(Ns(Gu.concat(Qh)),(r,c,f)=>Ll(r.element).bind(m=>f.execute(r,c,m)))]),v5=Y([zs(Ns(Gu),ob)]);var Eg=nb(JR,Ru.init,dy,v5,()=>O.some(b5));const tm=[Rt("selector"),lt("execute",ay),lt("moveOnTab",!1)],oE=(r,c,f)=>f.focusManager.get(r).bind(m=>f.execute(r,c,m)),eO=(r,c,f)=>{si(r.element,c.selector).each(m=>{c.focusManager.set(r,m)})},tO=(r,c,f)=>JS(r,f.selector,c,-1),y2=(r,c,f)=>JS(r,f.selector,c,1),fy=Y([zs(Ns(ix),YS(tO)),zs(Ns(ax),YS(y2)),zs(oh([em,Ns(Tf)]),(r,c,f,m)=>f.moveOnTab?YS(tO)(r,c,f,m):O.none()),zs(oh([iy,Ns(Tf)]),(r,c,f,m)=>f.moveOnTab?YS(y2)(r,c,f,m):O.none()),zs(Ns(Qh),oE),zs(Ns(Gu),oE)]),hy=Y([zs(Ns(Gu),ob)]);var w2=nb(tm,Ru.init,fy,hy,()=>O.some(eO));const nO=[Cc("onSpace"),Cc("onEnter"),Cc("onShiftEnter"),Cc("onLeft"),Cc("onRight"),Cc("onTab"),Cc("onShiftTab"),Cc("onUp"),Cc("onDown"),Cc("onEscape"),lt("stopSpaceKeyup",!1),ys("focusIn")];var my=nb(nO,Ru.init,(r,c,f)=>[zs(Ns(Gu),f.onSpace),zs(oh([iy,Ns(Qh)]),f.onEnter),zs(oh([em,Ns(Qh)]),f.onShiftEnter),zs(oh([em,Ns(Tf)]),f.onShiftTab),zs(oh([iy,Ns(Tf)]),f.onTab),zs(Ns(ix),f.onUp),zs(Ns(ax),f.onDown),zs(Ns(qS),f.onLeft),zs(Ns(ry),f.onRight),zs(Ns(Gu),f.onSpace)],(r,c,f)=>[...f.stopSpaceKeyup?[zs(Ns(Gu),ob)]:[],zs(Ns(ZS),f.onEscape)],r=>r.focusIn);const sE=i5.schema(),x5=a5.schema(),S2=uy.schema(),rE=p5.schema(),Ol=Eg.schema(),y5=c5.schema(),nm=w2.schema(),oO=my.schema(),uo=w1({branchKey:"mode",branches:Object.freeze({__proto__:null,acyclic:sE,cyclic:x5,flow:S2,flatgrid:rE,matrix:Ol,execution:y5,menu:nm,special:oO}),name:"keying",active:{events:(r,c)=>r.handler.toEvents(r,c)},apis:{focusIn:(r,c,f)=>{c.sendFocusIn(c).fold(()=>{r.getSystem().triggerFocus(r.element,r.element)},m=>{m(r,c,f)})},setGridSize:(r,c,f,m,x)=>{(y=>In(y,"setGridSize"))(f)?f.setGridSize(m,x):console.error("Layout does not support setGridSize")}},state:BR}),ib=(r,c)=>{jh(()=>{((f,m,x)=>{const y=f.components();(A=>{mt(A.components(),P=>ci(P.element)),Hl(A.element),A.syncComponents()})(f);const E=x(m),D=to(y,E);mt(D,A=>{Jh(A),f.getSystem().removeFromWorld(A)}),mt(E,A=>{Yv(A)?Xv(f,A):(f.getSystem().addToWorld(A),Xv(f,A),Nr(f.element)&&cp(A))}),f.syncComponents()})(r,c,()=>qe(c,r.getSystem().build))},r.element)},E2=(r,c)=>{jh(()=>{((f,m,x)=>{const y=f.components(),E=Rn(m,P=>Ev(P).toArray());mt(y,P=>{et(E,P)||J0(P)});const D=((P,U,B)=>_S(P,U,(K,oe)=>M1(P,oe,K,B)))(r.element,c,r.getSystem().buildOrPatch),A=to(y,D);mt(A,P=>{Yv(P)&&J0(P)}),mt(D,P=>{Yv(P)||X0(f,P)}),f.syncComponents()})(r,c)},r.element)},iE=(r,c,f,m)=>{J0(c);const x=M1(r.element,f,m,r.getSystem().buildOrPatch);X0(r,x),r.syncComponents()},C2=(r,c,f)=>{const m=r.getSystem().build(f);Jv(r,m,c)},sO=(r,c,f,m)=>{oc(c),C2(r,(x,y)=>((E,D,A)=>{qs(E,A).fold(()=>{ti(E,D)},P=>{Tu(P,D)})})(x,y,f),m)},py=(r,c)=>r.components(),rO=(r,c,f,m,x)=>{const y=py(r);return O.from(y[m]).map(E=>(x.fold(()=>oc(E),D=>{(c.reuseDom?iE:sO)(r,E,m,D)}),E))};var _2=Object.freeze({__proto__:null,append:(r,c,f,m)=>{C2(r,ti,m)},prepend:(r,c,f,m)=>{C2(r,ll,m)},remove:(r,c,f,m)=>{const x=py(r);J(x,E=>po(m.element,E.element)).each(oc)},replaceAt:rO,replaceBy:(r,c,f,m,x)=>{const y=py(r);return Bn(y,m).bind(E=>rO(r,c,0,E,x))},set:(r,c,f,m)=>(c.reuseDom?E2:ib)(r,m),contents:py});const Do=Mi({fields:[pa("reuseDom",!0)],name:"replacing",apis:_2}),Qo=(r,c)=>{const f=((m,x)=>{const y=Ws(x);return Mi({fields:[Rt("enabled")],name:m,active:{events:Y(y)}})})(r,c);return{key:r,value:{config:{},me:f,configAsRaw:Y({}),initialConfig:{},state:Ru}}},iO=(r,c)=>{c.ignore||($u(r.element),c.onFocus(r))};var aO=Object.freeze({__proto__:null,focus:iO,blur:(r,c)=>{c.ignore||Jm(r.element)},isFocused:r=>Qm(r.element)}),lO=Object.freeze({__proto__:null,exhibit:(r,c)=>{const f=c.ignore?{}:{attributes:{tabindex:"-1"}};return Ga(f)},events:r=>Ws([Ft(Vo(),(c,f)=>{iO(c,r),f.stop()})].concat(r.stopMousedown?[Ft(ce(),(c,f)=>{f.event.prevent()})]:[]))}),cO=[Rs("onFocus"),lt("stopMousedown",!1),lt("ignore",!1)];const Bo=Mi({fields:cO,name:"focusing",active:lO,apis:aO}),gy=(r,c,f,m)=>{const x=f.get();f.set(m),((y,E,D)=>{E.toggleClass.each(A=>{D.get()?zi(y.element,A):hi(y.element,A)})})(r,c,f),((y,E,D)=>{const A=E.aria;A.update(y,A,D.get())})(r,c,f),x!==m&&c.onToggled(r,m)},hd=(r,c,f)=>{gy(r,c,f,!f.get())},ab=(r,c,f)=>{gy(r,c,f,c.selected)};var uO=Object.freeze({__proto__:null,onLoad:ab,toggle:hd,isOn:(r,c,f)=>f.get(),on:(r,c,f)=>{gy(r,c,f,!0)},off:(r,c,f)=>{gy(r,c,f,!1)},set:gy}),lx=Object.freeze({__proto__:null,exhibit:()=>Ga({}),events:(r,c)=>{const f=(m=r,x=c,y=hd,Ud(D=>{y(D,m,x)}));var m,x,y;const E=fl(r,c,ab);return Ws(Vn([r.toggleOnExecute?[f]:[],[E]]))}});const Kc=(r,c,f)=>{Eo(r.element,"aria-expanded",f)};var Wu=[lt("selected",!1),ys("toggleClass"),lt("toggleOnExecute",!0),Rs("onToggled"),Si("aria",{mode:"none"},Kr("mode",{pressed:[lt("syncWithExpanded",!1),As("update",(r,c,f)=>{Eo(r.element,"aria-pressed",f),c.syncWithExpanded&&Kc(r,0,f)})],checked:[As("update",(r,c,f)=>{Eo(r.element,"aria-checked",f)})],expanded:[As("update",Kc)],selected:[As("update",(r,c,f)=>{Eo(r.element,"aria-selected",f)})],none:[As("update",j)]}))];const Mo=Mi({fields:Wu,name:"toggling",active:lx,apis:uO,state:{init:()=>{const r=ho(!1);return{get:()=>r.get(),set:c=>r.set(c),clear:()=>r.set(!1),readState:()=>r.get()}}}}),Wd=()=>{const r=(c,f)=>{f.stop(),id(c)};return[Ft(Dl(),r),Ft(Gf(),r),Hd(Po()),Hd(ce())]},cx=r=>Ws(Vn([r.map(c=>Ud((f,m)=>{c(f),m.stop()})).toArray(),Wd()])),md="alloy.item-hover",Cg="alloy.item-focus",dO="alloy.item-toggled",fO=r=>{(Ll(r.element).isNone()||Bo.isFocused(r))&&(Bo.isFocused(r)||Bo.focus(r),so(r,md,{item:r}))},hO=r=>{so(r,Cg,{item:r})},T2=Y(md),mO=Y(Cg),aE=Y(dO),pO=r=>r.toggling.map(c=>c.exclusive?"menuitemradio":"menuitemcheckbox").getOr("menuitem"),w5=[Rt("data"),Rt("components"),Rt("dom"),lt("hasSubmenu",!1),ys("toggling"),Hs("itemBehaviours",[Mo,Bo,uo,at]),lt("ignoreFocus",!1),lt("domModification",{}),As("builder",r=>({dom:r.dom,domModification:{...r.domModification,attributes:{role:pO(r),...r.domModification.attributes,"aria-haspopup":r.hasSubmenu,...r.hasSubmenu?{"aria-expanded":!1}:{}}},behaviours:lo(r.itemBehaviours,[r.toggling.fold(Mo.revoke,c=>Mo.config((f=>({aria:{mode:"checked"},...as(f,(m,x)=>x!=="exclusive"),onToggled:(m,x)=>{$(f.onToggled)&&f.onToggled(m,x),((y,E)=>{so(y,dO,{item:y,state:E})})(m,x)}}))(c))),Bo.config({ignore:r.ignoreFocus,stopMousedown:r.ignoreFocus,onFocus:c=>{hO(c)}}),uo.config({mode:"execution"}),at.config({store:{mode:"memory",initialValue:r.data}}),Qo("item-type-events",[...Wd(),Ft(Yn(),fO),Ft(dl(),Bo.focus)])]),components:r.components,eventOrder:r.eventOrder})),lt("eventOrder",{})],S5=[Rt("dom"),Rt("components"),As("builder",r=>({dom:r.dom,components:r.components,events:Ws([mS(dl())])}))],D2=Y("item-widget"),k2=Y([sc({name:"widget",overrides:r=>({behaviours:tn([at.config({store:{mode:"manual",getValue:c=>r.data,setValue:j}})])})})]),gO=[Rt("uid"),Rt("data"),Rt("components"),Rt("dom"),lt("autofocus",!1),lt("ignoreFocus",!1),Hs("widgetBehaviours",[at,Bo,uo]),lt("domModification",{}),n2(k2()),As("builder",r=>{const c=JT(D2(),r,k2()),f=QT(D2(),r,c.internals()),m=y=>Br(y,r,"widget").map(E=>(uo.focusIn(E),E)),x=(y,E)=>(ox(E.event.target)||r.autofocus&&E.setSource(y.element),O.none());return{dom:r.dom,components:f,domModification:r.domModification,events:Ws([Ud((y,E)=>{m(y).each(D=>{E.stop()})}),Ft(Yn(),fO),Ft(dl(),(y,E)=>{r.autofocus?m(y):Bo.focus(y)})]),behaviours:lo(r.widgetBehaviours,[at.config({store:{mode:"memory",initialValue:r.data}}),Bo.config({ignore:r.ignoreFocus,onFocus:y=>{hO(y)}}),uo.config({mode:"special",focusIn:r.autofocus?y=>{m(y)}:MT(),onLeft:x,onRight:x,onEscape:(y,E)=>Bo.isFocused(y)||r.autofocus?(r.autofocus&&E.setSource(y.element),O.none()):(Bo.focus(y),O.some(!0))})])}})],bO=Kr("type",{widget:gO,item:w5,separator:S5}),A2=Y([KS({factory:{sketch:r=>{const c=Ui("menu.spec item",bO,r);return c.builder(c)}},name:"items",unit:"item",defaults:(r,c)=>On(c,"uid")?c:{...c,uid:bf("item")},overrides:(r,c)=>({type:c.type,ignoreFocus:r.fakeFocus,domModification:{classes:[r.markers.item]}})})]),vO=Y([Rt("value"),Rt("items"),Rt("dom"),Rt("components"),lt("eventOrder",{}),vn("menuBehaviours",[or,at,Os,uo]),Si("movement",{mode:"menu",moveOnTab:!0},Kr("mode",{grid:[N0(),As("config",(r,c)=>({mode:"flatgrid",selector:"."+r.markers.item,initSize:{numColumns:c.initSize.numColumns,numRows:c.initSize.numRows},focusManager:r.focusManager}))],matrix:[As("config",(r,c)=>({mode:"matrix",selectors:{row:c.rowSelector,cell:"."+r.markers.item},previousSelector:c.previousSelector,focusManager:r.focusManager})),Rt("rowSelector"),lt("previousSelector",O.none)],menu:[lt("moveOnTab",!0),As("config",(r,c)=>({mode:"menu",selector:"."+r.markers.item,moveOnTab:c.moveOnTab,focusManager:r.focusManager}))]})),fa("markers",FT()),lt("fakeFocus",!1),lt("focusManager",a2()),Rs("onHighlight"),Rs("onDehighlight"),lt("menuRole",!0)]),xO=Y("alloy.menu-focus"),lb=Dc({name:"Menu",configFields:vO(),partFields:A2(),factory:(r,c,f,m)=>({uid:r.uid,dom:r.dom,markers:r.markers,behaviours:eo(r.menuBehaviours,[or.config({highlightClass:r.markers.selectedItem,itemClass:r.markers.item,onHighlight:r.onHighlight,onDehighlight:r.onDehighlight}),at.config({store:{mode:"memory",initialValue:r.value}}),Os.config({find:O.some}),uo.config(r.movement.config(r,r.movement))]),events:Ws([Ft(mO(),(x,y)=>{const E=y.event;x.getSystem().getByDom(E.target).each(D=>{or.highlight(x,D),y.stop(),so(x,xO(),{menu:x,item:D})})}),Ft(T2(),(x,y)=>{const E=y.event.item;or.highlight(x,E)}),Ft(aE(),(x,y)=>{const{item:E,state:D}=y.event;D&&xi(E.element,"role")==="menuitemradio"&&((A,P)=>{const U=ba(A.element,'[role="menuitemradio"][aria-checked="true"]');mt(U,B=>{po(B,P.element)||A.getSystem().getByDom(B).each(K=>{Mo.off(K)})})})(x,E)})]),components:c,eventOrder:r.eventOrder,...r.menuRole?{domModification:{attributes:{role:"menu"}}}:{}})}),yO=(r,c,f,m)=>At(f,m).bind(x=>At(r,x).bind(y=>{const E=yO(r,c,f,y);return O.some([y].concat(E))})).getOr([]),wO=r=>r.type==="prepared"?O.some(r.menu):O.none(),E5=()=>{const r=ho({}),c=ho({}),f=ho({}),m=nr(),x=ho({}),y=A=>E(A).bind(wO),E=A=>At(c.get(),A),D=A=>At(r.get(),A);return{setMenuBuilt:(A,P)=>{c.set({...c.get(),[A]:{type:"prepared",menu:P}})},setContents:(A,P,U,B)=>{m.set(A),r.set(U),c.set(P),x.set(B);const K=((oe,ne)=>{const ge={};Cn(oe,(de,be)=>{mt(de,Te=>{ge[Te]=be})});const he=ne,Le=kt(ne,(de,be)=>({k:de,v:be})),fe=Nn(Le,(de,be)=>[be].concat(yO(ge,he,Le,be)));return Nn(ge,de=>At(fe,de).getOr([de]))})(B,U);f.set(K)},expand:A=>At(r.get(),A).map(P=>{const U=At(f.get(),A).getOr([]);return[P].concat(U)}),refresh:A=>At(f.get(),A),collapse:A=>At(f.get(),A).bind(P=>P.length>1?O.some(P.slice(1)):O.none()),lookupMenu:E,lookupItem:D,otherMenus:A=>{const P=x.get();return to(Jt(P),A)},getPrimary:()=>m.get().bind(y),getMenus:()=>c.get(),clear:()=>{r.set({}),c.set({}),f.set({}),m.clear()},isClear:()=>m.get().isNone(),getTriggeringPath:(A,P)=>{const U=on(D(A).toArray(),B=>y(B).isSome());return At(f.get(),A).bind(B=>{const K=jn(U.concat(B));return(oe=>{const ne=[];for(let ge=0;ge<oe.length;ge++){const he=oe[ge];if(!he.isSome())return O.none();ne.push(he.getOrDie())}return O.some(ne)})(Rn(K,(oe,ne)=>((ge,he,Le)=>y(ge).bind(fe=>(de=>Pt(r.get(),(be,Te)=>be===de))(ge).bind(de=>he(de).map(be=>({triggeredMenu:fe,triggeringItem:be,triggeringPath:Le})))))(oe,P,K.slice(0,ne+1)).fold(()=>Is(m.get(),oe)?[]:[O.none()],ge=>[O.some(ge)])))})}}},C5=wO,pd=Zn("tiered-menu-item-highlight"),_5=Zn("tiered-menu-item-dehighlight");var jl;(function(r){r[r.HighlightMenuAndItem=0]="HighlightMenuAndItem",r[r.HighlightJustMenu=1]="HighlightJustMenu",r[r.HighlightNone=2]="HighlightNone"})(jl||(jl={}));const ux=Y("collapse-item"),mp=fd({name:"TieredMenu",configFields:[Wm("onExecute"),Wm("onEscape"),jf("onOpenMenu"),jf("onOpenSubmenu"),Rs("onRepositionMenu"),Rs("onCollapseMenu"),lt("highlightOnOpen",jl.HighlightMenuAndItem),Ha("data",[Rt("primary"),Rt("menus"),Rt("expansions")]),lt("fakeFocus",!1),Rs("onHighlightItem"),Rs("onDehighlightItem"),Rs("onHover"),Ca(),Rt("dom"),lt("navigateOnHover",!0),lt("stayInDom",!1),vn("tmenuBehaviours",[uo,or,Os,Do]),lt("eventOrder",{})],apis:{collapseMenu:(r,c)=>{r.collapseMenu(c)},highlightPrimary:(r,c)=>{r.highlightPrimary(c)},repositionMenus:(r,c)=>{r.repositionMenus(c)}},factory:(r,c)=>{const f=nr(),m=E5(),x=de=>at.getValue(de).value,y=de=>Nn(r.data.menus,(be,Te)=>Rn(be.items,ke=>ke.type==="separator"?[]:[ke.data.value])),E=or.highlight,D=(de,be)=>{E(de,be),or.getHighlighted(be).orThunk(()=>or.getFirst(be)).each(Te=>{r.fakeFocus?or.highlight(be,Te):D0(de,Te.element,dl())})},A=(de,be)=>kr(qe(be,Te=>de.lookupMenu(Te).bind(ke=>ke.type==="prepared"?O.some(ke.menu):O.none()))),P=(de,be,Te)=>{const ke=A(be,be.otherMenus(Te));mt(ke,Ke=>{Xr(Ke.element,[r.markers.backgroundMenu]),r.stayInDom||Do.remove(de,Ke)})},U=(de,be)=>{const Te=(ke=>f.get().getOrThunk(()=>{const Ke={},dt=ba(ke.element,`.${r.markers.item}`),zt=on(dt,Wt=>xi(Wt,"aria-haspopup")==="true");return mt(zt,Wt=>{ke.getSystem().getByDom(Wt).each(en=>{const xn=x(en);Ke[xn]=en})}),f.set(Ke),Ke}))(de);Cn(Te,(ke,Ke)=>{const dt=et(be,Ke);Eo(ke.element,"aria-expanded",dt)})},B=(de,be,Te)=>O.from(Te[0]).bind(ke=>be.lookupMenu(ke).bind(Ke=>{if(Ke.type==="notbuilt")return O.none();{const dt=Ke.menu,zt=A(be,Te.slice(1));return mt(zt,Wt=>{zi(Wt.element,r.markers.backgroundMenu)}),Nr(dt.element)||Do.append(de,_c(dt)),Xr(dt.element,[r.markers.backgroundMenu]),D(de,dt),P(de,be,Te),O.some(dt)}}));let K;(function(de){de[de.HighlightSubmenu=0]="HighlightSubmenu",de[de.HighlightParent=1]="HighlightParent"})(K||(K={}));const oe=(de,be,Te=K.HighlightSubmenu)=>{if(be.hasConfigured(Ho)&&Ho.isDisabled(be))return O.some(be);{const ke=x(be);return m.expand(ke).bind(Ke=>(U(de,Ke),O.from(Ke[0]).bind(dt=>m.lookupMenu(dt).bind(zt=>{const Wt=((en,xn,$n)=>{if($n.type==="notbuilt"){const ro=en.getSystem().build($n.nbMenu());return m.setMenuBuilt(xn,ro),ro}return $n.menu})(de,dt,zt);return Nr(Wt.element)||Do.append(de,_c(Wt)),r.onOpenSubmenu(de,be,Wt,jn(Ke)),Te===K.HighlightSubmenu?(or.highlightFirst(Wt),B(de,m,Ke)):(or.dehighlightAll(Wt),O.some(be))}))))}},ne=(de,be)=>{const Te=x(be);return m.collapse(Te).bind(ke=>(U(de,ke),B(de,m,ke).map(Ke=>(r.onCollapseMenu(de,be,Ke),Ke))))},ge=de=>(be,Te)=>js(Te.getSource(),`.${r.markers.item}`).bind(ke=>be.getSystem().getByDom(ke).toOptional().bind(Ke=>de(be,Ke).map(Oe))),he=Ws([Ft(xO(),(de,be)=>{const Te=be.event.item;m.lookupItem(x(Te)).each(()=>{const ke=be.event.menu;or.highlight(de,ke);const Ke=x(be.event.item);m.refresh(Ke).each(dt=>P(de,m,dt))})}),Ud((de,be)=>{const Te=be.event.target;de.getSystem().getByDom(Te).each(ke=>{x(ke).indexOf("collapse-item")===0&&ne(de,ke),oe(de,ke,K.HighlightSubmenu).fold(()=>{r.onExecute(de,ke)},j)})}),zr((de,be)=>{(Te=>{const ke=((dt,zt,Wt)=>Nn(Wt,(en,xn)=>{const $n=()=>lb.sketch({...en,value:xn,markers:r.markers,fakeFocus:r.fakeFocus,onHighlight:(ro,xo)=>{so(ro,pd,{menuComp:ro,itemComp:xo})},onDehighlight:(ro,xo)=>{so(ro,_5,{menuComp:ro,itemComp:xo})},focusManager:r.fakeFocus?r5():a2()});return xn===zt?{type:"prepared",menu:dt.getSystem().build($n())}:{type:"notbuilt",nbMenu:$n}}))(Te,r.data.primary,r.data.menus),Ke=y();return m.setContents(r.data.primary,ke,r.data.expansions,Ke),m.getPrimary()})(de).each(Te=>{Do.append(de,_c(Te)),r.onOpenMenu(de,Te),r.highlightOnOpen===jl.HighlightMenuAndItem?D(de,Te):r.highlightOnOpen===jl.HighlightJustMenu&&E(de,Te)})}),Ft(pd,(de,be)=>{r.onHighlightItem(de,be.event.menuComp,be.event.itemComp)}),Ft(_5,(de,be)=>{r.onDehighlightItem(de,be.event.menuComp,be.event.itemComp)}),...r.navigateOnHover?[Ft(T2(),(de,be)=>{const Te=be.event.item;((ke,Ke)=>{const dt=x(Ke);m.refresh(dt).bind(zt=>(U(ke,zt),B(ke,m,zt)))})(de,Te),oe(de,Te,K.HighlightParent),r.onHover(de,Te)})]:[]]),Le=de=>or.getHighlighted(de).bind(or.getHighlighted),fe={collapseMenu:de=>{Le(de).each(be=>{ne(de,be)})},highlightPrimary:de=>{m.getPrimary().each(be=>{D(de,be)})},repositionMenus:de=>{m.getPrimary().bind(Te=>Le(de).bind(ke=>{const Ke=x(ke),dt=gn(m.getMenus()),zt=kr(qe(dt,C5));return m.getTriggeringPath(Ke,Wt=>((en,xn,$n)=>Kn(xn,ro=>{if(!ro.getSystem().isConnected())return O.none();const xo=or.getCandidates(ro);return J(xo,Zo=>x(Zo)===$n)}))(0,zt,Wt))}).map(ke=>({primary:Te,triggeringPath:ke}))).fold(()=>{(Te=>O.from(Te.components()[0]).filter(ke=>xi(ke.element,"role")==="menu"))(de).each(Te=>{r.onRepositionMenu(de,Te,[])})},({primary:Te,triggeringPath:ke})=>{r.onRepositionMenu(de,Te,ke)})}};return{uid:r.uid,dom:r.dom,markers:r.markers,behaviours:eo(r.tmenuBehaviours,[uo.config({mode:"special",onRight:ge((de,be)=>ox(be.element)?O.none():oe(de,be,K.HighlightSubmenu)),onLeft:ge((de,be)=>ox(be.element)?O.none():ne(de,be)),onEscape:ge((de,be)=>ne(de,be).orThunk(()=>r.onEscape(de,be).map(()=>de))),focusIn:(de,be)=>{m.getPrimary().each(Te=>{D0(de,Te.element,dl())})}}),or.config({highlightClass:r.markers.selectedMenu,itemClass:r.markers.menu}),Os.config({find:de=>or.getHighlighted(de)}),Do.config({})]),eventOrder:r.eventOrder,apis:fe,events:he}},extraApis:{tieredData:(r,c,f)=>({primary:r,menus:c,expansions:f}),singleData:(r,c)=>({primary:r,menus:nc(r,c),expansions:{}}),collapseItem:r=>({value:Zn(ux()),meta:{text:r}})}}),ri=fd({name:"InlineView",configFields:[Rt("lazySink"),Rs("onShow"),Rs("onHide"),_l("onEscape"),vn("inlineBehaviours",[_,at,pl]),ul("fireDismissalEventInstead",[lt("event",Fd())]),ul("fireRepositionEventInstead",[lt("event",hS())]),lt("getRelated",O.none),lt("isExtraPart",ve),lt("eventOrder",O.none)],factory:(r,c)=>{const f=(E,D,A,P)=>{const U=r.lazySink(E).getOrDie();_.openWhileCloaked(E,D,()=>tl.positionWithinBounds(U,E,A,P())),at.setValue(E,O.some({mode:"position",config:A,getBounds:P}))},m=(E,D,A,P)=>{const U=((B,K,oe,ne,ge)=>{const he=()=>B.lazySink(K),Le=ne.type==="horizontal"?{layouts:{onLtr:()=>Wh(),onRtl:()=>Iv()}}:{},fe=de=>(be=>be.length===2)(de)?Le:{};return mp.sketch({dom:{tag:"div"},data:ne.data,markers:ne.menu.markers,highlightOnOpen:ne.menu.highlightOnOpen,fakeFocus:ne.menu.fakeFocus,onEscape:()=>(_.close(K),B.onEscape.map(de=>de(K)),O.some(!0)),onExecute:()=>O.some(!0),onOpenMenu:(de,be)=>{tl.positionWithinBounds(he().getOrDie(),be,oe,ge())},onOpenSubmenu:(de,be,Te,ke)=>{const Ke=he().getOrDie();tl.position(Ke,Te,{anchor:{type:"submenu",item:be,...fe(ke)}})},onRepositionMenu:(de,be,Te)=>{const ke=he().getOrDie();tl.positionWithinBounds(ke,be,oe,ge()),mt(Te,Ke=>{const dt=fe(Ke.triggeringPath);tl.position(ke,Ke.triggeredMenu,{anchor:{type:"submenu",item:Ke.triggeringItem,...dt}})})}})})(r,E,D,A,P);_.open(E,U),at.setValue(E,O.some({mode:"menu",menu:U}))},x=E=>{_.isOpen(E)&&at.getValue(E).each(D=>{switch(D.mode){case"menu":_.getState(E).each(mp.repositionMenus);break;case"position":const A=r.lazySink(E).getOrDie();tl.positionWithinBounds(A,E,D.config,D.getBounds())}})},y={setContent:(E,D)=>{_.setContent(E,D)},showAt:(E,D,A)=>{const P=O.none;f(E,D,A,P)},showWithinBounds:f,showMenuAt:(E,D,A)=>{m(E,D,A,O.none)},showMenuWithinBounds:m,hide:E=>{_.isOpen(E)&&(at.setValue(E,O.none()),_.close(E))},getContent:E=>_.getState(E),reposition:x,isOpen:_.isOpen};return{uid:r.uid,dom:r.dom,behaviours:eo(r.inlineBehaviours,[_.config({isPartOf:(E,D,A)=>Gh(D,A)||((P,U)=>r.getRelated(P).exists(B=>Gh(B,U)))(E,A),getAttachPoint:E=>r.lazySink(E).getOrDie(),onOpen:E=>{r.onShow(E)},onClose:E=>{r.onHide(E)}}),at.config({store:{mode:"memory",initialValue:O.none()}}),pl.config({channels:{...le({isExtraPart:c.isExtraPart,...r.fireDismissalEventInstead.map(E=>({fireEventInstead:{event:E.event}})).getOr({})}),..._e({...r.fireRepositionEventInstead.map(E=>({fireEventInstead:{event:E.event}})).getOr({}),doReposition:x})}})]),eventOrder:r.eventOrder,apis:y}},apis:{showAt:(r,c,f,m)=>{r.showAt(c,f,m)},showWithinBounds:(r,c,f,m,x)=>{r.showWithinBounds(c,f,m,x)},showMenuAt:(r,c,f,m)=>{r.showMenuAt(c,f,m)},showMenuWithinBounds:(r,c,f,m,x)=>{r.showMenuWithinBounds(c,f,m,x)},hide:(r,c)=>{r.hide(c)},isOpen:(r,c)=>r.isOpen(c),getContent:(r,c)=>r.getContent(c),setContent:(r,c,f)=>{r.setContent(c,f)},reposition:(r,c)=>{r.reposition(c)}}});var jd,by,lE=tinymce.util.Tools.resolve("tinymce.util.Delay"),dx=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),SO=tinymce.util.Tools.resolve("tinymce.EditorManager"),sh=tinymce.util.Tools.resolve("tinymce.Env");(function(r){r.default="wrap",r.floating="floating",r.sliding="sliding",r.scrolling="scrolling"})(jd||(jd={})),function(r){r.auto="auto",r.top="top",r.bottom="bottom"}(by||(by={}));const gr=r=>c=>c.options.get(r),vy=r=>c=>O.from(r(c)),EO=r=>{const c=sh.deviceType.isPhone(),f=sh.deviceType.isTablet()||c,m=r.options.register,x=E=>h(E)||E===!1,y=E=>h(E)||W(E);m("skin",{processor:E=>h(E)||E===!1,default:"oxide"}),m("skin_url",{processor:"string"}),m("height",{processor:y,default:Math.max(r.getElement().offsetHeight,400)}),m("width",{processor:y,default:dx.DOM.getStyle(r.getElement(),"width")}),m("min_height",{processor:"number",default:100}),m("min_width",{processor:"number"}),m("max_height",{processor:"number"}),m("max_width",{processor:"number"}),m("style_formats",{processor:"object[]"}),m("style_formats_merge",{processor:"boolean",default:!1}),m("style_formats_autohide",{processor:"boolean",default:!1}),m("line_height_formats",{processor:"string",default:"1 1.1 1.2 1.3 1.4 1.5 2"}),m("font_family_formats",{processor:"string",default:"Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats"}),m("font_size_formats",{processor:"string",default:"8pt 10pt 12pt 14pt 18pt 24pt 36pt"}),m("font_size_input_default_unit",{processor:"string",default:"pt"}),m("block_formats",{processor:"string",default:"Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre"}),m("content_langs",{processor:"object[]"}),m("removed_menuitems",{processor:"string",default:""}),m("menubar",{processor:E=>h(E)||k(E),default:!c}),m("menu",{processor:"object",default:{}}),m("toolbar",{processor:E=>k(E)||h(E)||S(E)?{value:E,valid:!0}:{valid:!1,message:"Must be a boolean, string or array."},default:!0}),Xe(9,E=>{m("toolbar"+(E+1),{processor:"string"})}),m("toolbar_mode",{processor:"string",default:f?"scrolling":"floating"}),m("toolbar_groups",{processor:"object",default:{}}),m("toolbar_location",{processor:"string",default:by.auto}),m("toolbar_persist",{processor:"boolean",default:!1}),m("toolbar_sticky",{processor:"boolean",default:r.inline}),m("toolbar_sticky_offset",{processor:"number",default:0}),m("fixed_toolbar_container",{processor:"string",default:""}),m("fixed_toolbar_container_target",{processor:"object"}),m("ui_mode",{processor:"string",default:"combined"}),m("file_picker_callback",{processor:"function"}),m("file_picker_validator_handler",{processor:"function"}),m("file_picker_types",{processor:"string"}),m("typeahead_urls",{processor:"boolean",default:!0}),m("anchor_top",{processor:x,default:"#top"}),m("anchor_bottom",{processor:x,default:"#bottom"}),m("draggable_modal",{processor:"boolean",default:!1}),m("statusbar",{processor:"boolean",default:!0}),m("elementpath",{processor:"boolean",default:!0}),m("branding",{processor:"boolean",default:!0}),m("promotion",{processor:"boolean",default:!0}),m("resize",{processor:E=>E==="both"||k(E),default:!sh.deviceType.isTouch()}),m("sidebar_show",{processor:"string"}),m("help_accessibility",{processor:"boolean",default:r.hasPlugin("help")}),m("default_font_stack",{processor:"string[]",default:[]})},L2=gr("readonly"),xy=gr("height"),yy=gr("width"),wy=vy(gr("min_width")),fx=vy(gr("min_height")),hx=vy(gr("max_width")),cE=vy(gr("max_height")),mx=vy(gr("style_formats")),uE=gr("style_formats_merge"),CO=gr("style_formats_autohide"),R2=gr("content_langs"),_O=gr("removed_menuitems"),cb=gr("toolbar_mode"),dE=gr("toolbar_groups"),_g=gr("toolbar_location"),O2=gr("fixed_toolbar_container"),T5=gr("fixed_toolbar_container_target"),TO=gr("toolbar_persist"),I2=gr("toolbar_sticky_offset"),pp=gr("menubar"),px=gr("toolbar"),fE=gr("file_picker_callback"),Sy=gr("file_picker_validator_handler"),P2=gr("font_size_input_default_unit"),Ey=gr("file_picker_types"),hE=gr("typeahead_urls"),DO=gr("anchor_top"),kO=gr("anchor_bottom"),rh=gr("draggable_modal"),AO=gr("statusbar"),LO=gr("elementpath"),ju=gr("branding"),nl=gr("resize"),RO=gr("paste_as_text"),mE=gr("sidebar_show"),OO=gr("promotion"),M2=gr("help_accessibility"),pE=gr("default_font_stack"),Tg=r=>r.options.get("skin")===!1,Cy=r=>r.options.get("menubar")!==!1,gE=r=>{const c=r.options.get("skin_url");if(Tg(r))return c;if(c)return r.documentBaseURI.toAbsolute(c);{const f=r.options.get("skin");return SO.baseURL+"/skins/ui/"+f}},bE=r=>O.from(r.options.get("skin_url")),IO=r=>r.options.get("line_height_formats").split(" "),_y=r=>{const c=px(r),f=h(c),m=S(c)&&c.length>0;return!Ty(r)&&(m||f||c===!0)},vE=r=>{const c=Xe(9,m=>r.options.get("toolbar"+(m+1))),f=on(c,h);return qo(f.length>0,f)},Ty=r=>vE(r).fold(()=>{const c=px(r);return Q(c,h)&&c.length>0},Oe),N2=r=>_g(r)===by.bottom,F2=r=>{var c;if(!r.inline)return O.none();const f=(c=O2(r))!==null&&c!==void 0?c:"";if(f.length>0)return si(Fa(),f);const m=T5(r);return z(m)?O.some(Ie(m)):O.none()},ub=r=>r.inline&&F2(r).isSome(),xE=r=>F2(r).getOrThunk(()=>ca(jr(Ie(r.getElement())))),yE=r=>r.inline&&!Cy(r)&&!_y(r)&&!Ty(r),gp=r=>(r.options.get("toolbar_sticky")||r.inline)&&!ub(r)&&!yE(r),bp=r=>!ub(r)&&r.options.get("ui_mode")==="split",Dg=r=>{const c=r.options.get("menu");return Nn(c,f=>({...f,items:f.items}))};var Dy=Object.freeze({__proto__:null,get ToolbarMode(){return jd},get ToolbarLocation(){return by},register:EO,getSkinUrl:gE,getSkinUrlOption:bE,isReadOnly:L2,isSkinDisabled:Tg,getHeightOption:xy,getWidthOption:yy,getMinWidthOption:wy,getMinHeightOption:fx,getMaxWidthOption:hx,getMaxHeightOption:cE,getUserStyleFormats:mx,shouldMergeStyleFormats:uE,shouldAutoHideStyleFormats:CO,getLineHeightFormats:IO,getContentLanguages:R2,getRemovedMenuItems:_O,isMenubarEnabled:Cy,isMultipleToolbars:Ty,isToolbarEnabled:_y,isToolbarPersist:TO,getMultipleToolbarsOption:vE,getUiContainer:xE,useFixedContainer:ub,isSplitUiMode:bp,getToolbarMode:cb,isDraggableModal:rh,isDistractionFree:yE,isStickyToolbar:gp,getStickyToolbarOffset:I2,getToolbarLocation:_g,isToolbarLocationBottom:N2,getToolbarGroups:dE,getMenus:Dg,getMenubar:pp,getToolbar:px,getFilePickerCallback:fE,getFilePickerTypes:Ey,useTypeaheadUrls:hE,getAnchorTop:DO,getAnchorBottom:kO,getFilePickerValidatorHandler:Sy,getFontSizeInputDefaultUnit:P2,useStatusBar:AO,useElementPath:LO,promotionEnabled:OO,useBranding:ju,getResize:nl,getPasteAsText:RO,getSidebarShow:mE,useHelpAccessibility:M2,getDefaultFontStack:pE});const D5=["visible","hidden","clip"],PO=r=>ps(r).length>0&&!et(D5,r),MO=r=>{if(Xn(r)){const c=Fr(r,"overflow-x"),f=Fr(r,"overflow-y");return PO(c)||PO(f)}return!1},kg=(r,c)=>bp(r)?(f=>{const m=yg(f,MO),x=m.length===0?yr(f).map(Ql).map(y=>yg(y,MO)).getOr([]):m;return Dn(x).map(y=>({element:y,others:x.slice(1)}))})(c):O.none(),Ag=r=>{const c=[...qe(r.others,Ys),Ii()];return((f,m)=>an(m,(x,y)=>hc(x,y),f))(Ys(r.element),c)},Il=fd({name:"Button",factory:r=>{const c=cx(r.action),f=r.dom.tag,m=x=>At(r.dom,"attributes").bind(y=>At(y,x));return{uid:r.uid,dom:r.dom,components:r.components,events:c,behaviours:lo(r.buttonBehaviours,[Bo.config({}),uo.config({mode:"execution",useSpace:!0,useEnter:!0})]),domModification:{attributes:f==="button"?{type:m("type").getOr("button"),...m("role").map(x=>({role:x})).getOr({})}:{role:r.role.getOr(m("role").getOr("button"))}},eventOrder:r.eventOrder}},configFields:[lt("uid",void 0),Rt("dom"),lt("components",[]),Hs("buttonBehaviours",[Bo,uo]),ys("action"),ys("role"),lt("eventOrder",{})]}),om=r=>{const c=vr(r),f=xr(c),m=(E=>{const D=E.dom.attributes!==void 0?E.dom.attributes:[];return an(D,(A,P)=>P.name==="class"?A:{...A,[P.name]:P.value},{})})(c),x=(E=>Array.prototype.slice.call(E.dom.classList,0))(c),y=f.length===0?{}:{innerHtml:P0(c)};return{tag:sn(c),classes:x,attributes:m,...y}},dr=r=>{const c=(f=>f.uid!==void 0)(r)&&In(r,"uid")?r.uid:bf("memento");return{get:f=>f.getSystem().getByUid(c).getOrDie(),getOpt:f=>f.getSystem().getByUid(c).toOptional(),asSpec:()=>({...r,uid:c})}};var k5=Object.freeze({__proto__:null,exhibit:(r,c)=>Ga({attributes:wc([{key:c.tabAttr,value:"true"}])})}),NO=[lt("tabAttr","data-alloy-tabstop")];const Mr=Mi({fields:NO,name:"tabstopping",active:k5}),B2=Zn("tooltip.exclusive"),ky=Zn("tooltip.show"),Ay=Zn("tooltip.hide"),wE=Zn("tooltip.immediateHide"),SE=Zn("tooltip.immediateShow"),FO=(r,c,f)=>{r.getSystem().broadcastOn([B2],{})};var A5=Object.freeze({__proto__:null,hideAllExclusive:FO,setComponents:(r,c,f,m)=>{f.getTooltip().each(x=>{x.getSystem().isConnected()&&Do.set(x,m)})}}),L5=Object.freeze({__proto__:null,events:(r,c)=>{const f=y=>{c.getTooltip().each(E=>{E.getSystem().isConnected()&&(oc(E),r.onHide(y,E),c.clearTooltip())}),c.clearTimer()},m=y=>{if(!c.isShowing()){FO(y);const E=r.lazySink(y).getOrDie(),D=y.getSystem().build({dom:r.tooltipDom,components:r.tooltipComponents,events:Ws(r.mode==="normal"?[Ft(Yn(),A=>{rs(y,ky)}),Ft(We(),A=>{rs(y,Ay)})]:[]),behaviours:tn([Do.config({})])});c.setTooltip(D),Ef(E,D),r.onShow(y,D),tl.position(E,D,{anchor:r.anchor(y)})}},x=y=>{c.getTooltip().each(E=>{const D=r.lazySink(y).getOrDie();tl.position(D,E,{anchor:r.anchor(y)})})};return Ws(Vn([[Ft(ky,y=>{c.resetTimer(()=>{m(y)},r.delayForShow())}),Ft(Ay,y=>{c.resetTimer(()=>{f(y)},r.delayForHide())}),Ft(SE,y=>{c.resetTimer(()=>{m(y)},0)}),Ft(wE,y=>{c.resetTimer(()=>{f(y)},0)}),Ft(Au(),(y,E)=>{const D=E;D.universal||et(D.channels,B2)&&f(y)}),pf(y=>{f(y)})],(()=>{switch(r.mode){case"normal":return[Ft(Co(),y=>{rs(y,SE)}),Ft(Yr(),y=>{rs(y,wE)}),Ft(Yn(),y=>{rs(y,ky)}),Ft(We(),y=>{rs(y,Ay)})];case"follow-highlight":return[Ft(rn(),(y,E)=>{rs(y,ky)}),Ft(g1(),y=>{rs(y,Ay)})];case"children-normal":return[Ft(Co(),(y,E)=>{Ll(y.element).each(D=>{es(E.event.target,"[data-mce-tooltip]")&&c.getTooltip().fold(()=>{rs(y,SE)},A=>{c.isShowing()&&(r.onShow(y,A),x(y))})})}),Ft(Yr(),y=>{Ll(y.element).fold(()=>{rs(y,wE)},j)}),Ft(Yn(),y=>{si(y.element,"[data-mce-tooltip]:hover").each(E=>{c.getTooltip().fold(()=>{rs(y,ky)},D=>{c.isShowing()&&(r.onShow(y,D),x(y))})})}),Ft(We(),y=>{si(y.element,"[data-mce-tooltip]:hover").fold(()=>{rs(y,Ay)},j)})];default:return[Ft(Co(),(y,E)=>{Ll(y.element).each(D=>{es(E.event.target,"[data-mce-tooltip]")&&c.getTooltip().fold(()=>{rs(y,SE)},A=>{c.isShowing()&&(r.onShow(y,A),x(y))})})}),Ft(Yr(),y=>{Ll(y.element).fold(()=>{rs(y,wE)},j)})]}})()]))}}),R5=[Rt("lazySink"),Rt("tooltipDom"),lt("exclusive",!0),lt("tooltipComponents",[]),Or("delayForShow",Y(300)),Or("delayForHide",Y(300)),Tl("mode","normal",["normal","follow-highlight","children-keyboard-focus","children-normal"]),lt("anchor",r=>({type:"hotspot",hotspot:r,layouts:{onLtr:Y([Jr,ir,_a,ea,Ei,Wi]),onRtl:Y([Jr,ir,_a,ea,Ei,Wi])},bubble:Tc(0,-2,{})})),Rs("onHide"),Rs("onShow")],O5=Object.freeze({__proto__:null,init:()=>{const r=nr(),c=nr(),f=()=>{r.on(clearTimeout)},m=Y("not-implemented");return Ec({getTooltip:c.get,isShowing:c.isSet,setTooltip:c.set,clearTooltip:c.clear,clearTimer:f,resetTimer:(x,y)=>{f(),r.set(setTimeout(x,y))},readState:m})}});const Pl=Mi({fields:R5,name:"tooltipping",active:L5,state:O5,apis:A5}),{entries:BO,setPrototypeOf:$2,isFrozen:$O,getPrototypeOf:HO,getOwnPropertyDescriptor:I5}=Object;let{freeze:fu,seal:ih,create:UO}=Object,{apply:H2,construct:U2}=typeof Reflect<"u"&&Reflect;H2||(H2=function(r,c,f){return r.apply(c,f)}),fu||(fu=function(r){return r}),ih||(ih=function(r){return r}),U2||(U2=function(r,c){return new r(...c)});const V2=Df(Array.prototype.forEach),P5=Df(Array.prototype.pop),Ly=Df(Array.prototype.push),EE=Df(String.prototype.toLowerCase),CE=Df(String.prototype.toString),M5=Df(String.prototype.match),Pn=Df(String.prototype.replace),db=Df(String.prototype.indexOf),N5=Df(String.prototype.trim),gd=Df(RegExp.prototype.test),Lg=(_E=TypeError,function(){for(var r=arguments.length,c=new Array(r),f=0;f<r;f++)c[f]=arguments[f];return U2(_E,c)});var _E;function Df(r){return function(c){for(var f=arguments.length,m=new Array(f>1?f-1:0),x=1;x<f;x++)m[x-1]=arguments[x];return H2(r,c,m)}}function Er(r,c,f){var m;f=(m=f)!==null&&m!==void 0?m:EE,$2&&$2(r,null);let x=c.length;for(;x--;){let y=c[x];if(typeof y=="string"){const E=f(y);E!==y&&($O(c)||(c[x]=E),y=E)}r[y]=!0}return r}function gx(r){const c=UO(null);for(const[f,m]of BO(r))c[f]=m;return c}function TE(r,c){for(;r!==null;){const f=I5(r,c);if(f){if(f.get)return Df(f.get);if(typeof f.value=="function")return Df(f.value)}r=HO(r)}return function(f){return console.warn("fallback value for",f),null}}const z2=fu(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ry=fu(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),fb=fu(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),VO=fu(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),G2=fu(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),F5=fu(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),zO=fu(["#text"]),B5=fu(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),DE=fu(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),GO=fu(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),kE=fu(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),$5=ih(/\{\{[\w\W]*|[\w\W]*\}\}/gm),H5=ih(/<%[\w\W]*|[\w\W]*%>/gm),W2=ih(/\${[\w\W]*}/gm),U5=ih(/^data-[\-\w.\u00B7-\uFFFF]/),V5=ih(/^aria-[\-\w]+$/),WO=ih(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),z5=ih(/^(?:\w+script|data):/i),G5=ih(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),sm=ih(/^html$/i);var Oy=Object.freeze({__proto__:null,MUSTACHE_EXPR:$5,ERB_EXPR:H5,TMPLIT_EXPR:W2,DATA_ATTR:U5,ARIA_ATTR:V5,IS_ALLOWED_URI:WO,IS_SCRIPT_OR_DATA:z5,ATTR_WHITESPACE:G5,DOCTYPE_NAME:sm});const W5=()=>typeof window>"u"?null:window;var j5=function r(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:W5();const f=ht=>r(ht);if(f.version="3.0.5",f.removed=[],!c||!c.document||c.document.nodeType!==9)return f.isSupported=!1,f;const m=c.document,x=m.currentScript;let{document:y}=c;const{DocumentFragment:E,HTMLTemplateElement:D,Node:A,Element:P,NodeFilter:U,NamedNodeMap:B=c.NamedNodeMap||c.MozNamedAttrMap,HTMLFormElement:K,DOMParser:oe,trustedTypes:ne}=c,ge=P.prototype,he=TE(ge,"cloneNode"),Le=TE(ge,"nextSibling"),fe=TE(ge,"childNodes"),de=TE(ge,"parentNode");if(typeof D=="function"){const ht=y.createElement("template");ht.content&&ht.content.ownerDocument&&(y=ht.content.ownerDocument)}let be,Te="";const{implementation:ke,createNodeIterator:Ke,createDocumentFragment:dt,getElementsByTagName:zt}=y,{importNode:Wt}=m;let en={};f.isSupported=typeof BO=="function"&&typeof de=="function"&&ke&&ke.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:xn,ERB_EXPR:$n,TMPLIT_EXPR:ro,DATA_ATTR:xo,ARIA_ATTR:Zo,IS_SCRIPT_OR_DATA:ws,ATTR_WHITESPACE:ii}=Oy;let{IS_ALLOWED_URI:pi}=Oy,_o=null;const Ai=Er({},[...z2,...Ry,...fb,...G2,...zO]);let No=null;const Qr=Er({},[...B5,...DE,...GO,...kE]);let fr=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ac=null,Ki=null,qa=!0,mu=!0,qx=!1,Yx=!0,Ip=!1,Pp=!1,Pw=!1,t0=!1,bm=!1,n0=!1,o0=!1,s0=!0,N_=!1,Mw=!0,r0=!1,Mp={},vm=null;const Nw=Er({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Fw=null;const Ks=Er({},["audio","video","img","source","image","track"]);let xm=null;const Mf=Er({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),F_="http://www.w3.org/1998/Math/MathML",B_="http://www.w3.org/2000/svg",ym="http://www.w3.org/1999/xhtml";let Xx=ym,mL=!1,Uo=null;const Bw=Er({},[F_,B_,ym],CE);let Ub;const x3=["application/xhtml+xml","text/html"];let lc,Vb=null;const y3=y.createElement("form"),q7=function(ht){return ht instanceof RegExp||ht instanceof Function},zb=function(ht){if(!Vb||Vb!==ht){if(ht&&typeof ht=="object"||(ht={}),ht=gx(ht),Ub=Ub=x3.indexOf(ht.PARSER_MEDIA_TYPE)===-1?"text/html":ht.PARSER_MEDIA_TYPE,lc=Ub==="application/xhtml+xml"?CE:EE,_o="ALLOWED_TAGS"in ht?Er({},ht.ALLOWED_TAGS,lc):Ai,No="ALLOWED_ATTR"in ht?Er({},ht.ALLOWED_ATTR,lc):Qr,Uo="ALLOWED_NAMESPACES"in ht?Er({},ht.ALLOWED_NAMESPACES,CE):Bw,xm="ADD_URI_SAFE_ATTR"in ht?Er(gx(Mf),ht.ADD_URI_SAFE_ATTR,lc):Mf,Fw="ADD_DATA_URI_TAGS"in ht?Er(gx(Ks),ht.ADD_DATA_URI_TAGS,lc):Ks,vm="FORBID_CONTENTS"in ht?Er({},ht.FORBID_CONTENTS,lc):Nw,ac="FORBID_TAGS"in ht?Er({},ht.FORBID_TAGS,lc):{},Ki="FORBID_ATTR"in ht?Er({},ht.FORBID_ATTR,lc):{},Mp="USE_PROFILES"in ht&&ht.USE_PROFILES,qa=ht.ALLOW_ARIA_ATTR!==!1,mu=ht.ALLOW_DATA_ATTR!==!1,qx=ht.ALLOW_UNKNOWN_PROTOCOLS||!1,Yx=ht.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ip=ht.SAFE_FOR_TEMPLATES||!1,Pp=ht.WHOLE_DOCUMENT||!1,bm=ht.RETURN_DOM||!1,n0=ht.RETURN_DOM_FRAGMENT||!1,o0=ht.RETURN_TRUSTED_TYPE||!1,t0=ht.FORCE_BODY||!1,s0=ht.SANITIZE_DOM!==!1,N_=ht.SANITIZE_NAMED_PROPS||!1,Mw=ht.KEEP_CONTENT!==!1,r0=ht.IN_PLACE||!1,pi=ht.ALLOWED_URI_REGEXP||WO,Xx=ht.NAMESPACE||ym,fr=ht.CUSTOM_ELEMENT_HANDLING||{},ht.CUSTOM_ELEMENT_HANDLING&&q7(ht.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(fr.tagNameCheck=ht.CUSTOM_ELEMENT_HANDLING.tagNameCheck),ht.CUSTOM_ELEMENT_HANDLING&&q7(ht.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(fr.attributeNameCheck=ht.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),ht.CUSTOM_ELEMENT_HANDLING&&typeof ht.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(fr.allowCustomizedBuiltInElements=ht.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ip&&(mu=!1),n0&&(bm=!0),Mp&&(_o=Er({},[...zO]),No=[],Mp.html===!0&&(Er(_o,z2),Er(No,B5)),Mp.svg===!0&&(Er(_o,Ry),Er(No,DE),Er(No,kE)),Mp.svgFilters===!0&&(Er(_o,fb),Er(No,DE),Er(No,kE)),Mp.mathMl===!0&&(Er(_o,G2),Er(No,GO),Er(No,kE))),ht.ADD_TAGS&&(_o===Ai&&(_o=gx(_o)),Er(_o,ht.ADD_TAGS,lc)),ht.ADD_ATTR&&(No===Qr&&(No=gx(No)),Er(No,ht.ADD_ATTR,lc)),ht.ADD_URI_SAFE_ATTR&&Er(xm,ht.ADD_URI_SAFE_ATTR,lc),ht.FORBID_CONTENTS&&(vm===Nw&&(vm=gx(vm)),Er(vm,ht.FORBID_CONTENTS,lc)),Mw&&(_o["#text"]=!0),Pp&&Er(_o,["html","head","body"]),_o.table&&(Er(_o,["tbody"]),delete ac.tbody),ht.TRUSTED_TYPES_POLICY){if(typeof ht.TRUSTED_TYPES_POLICY.createHTML!="function")throw Lg('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof ht.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Lg('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');be=ht.TRUSTED_TYPES_POLICY,Te=be.createHTML("")}else be===void 0&&(be=function(wo,zo){if(typeof wo!="object"||typeof wo.createPolicy!="function")return null;let Wr=null;const Ni="data-tt-policy-suffix";zo&&zo.hasAttribute(Ni)&&(Wr=zo.getAttribute(Ni));const oa="dompurify"+(Wr?"#"+Wr:"");try{return wo.createPolicy(oa,{createHTML:Zi=>Zi,createScriptURL:Zi=>Zi})}catch{return console.warn("TrustedTypes policy "+oa+" could not be created."),null}}(ne,x)),be!==null&&typeof Te=="string"&&(Te=be.createHTML(""));fu&&fu(ht),Vb=ht}},w3=Er({},["mi","mo","mn","ms","mtext"]),pL=Er({},["foreignobject","desc","title","annotation-xml"]),Y7=Er({},["title","style","font","a","script"]),$_=Er({},Ry);Er($_,fb),Er($_,VO);const gL=Er({},G2);Er(gL,F5);const i0=function(ht){Ly(f.removed,{element:ht});try{ht.parentNode.removeChild(ht)}catch{ht.remove()}},Gb=function(ht,wo){try{Ly(f.removed,{attribute:wo.getAttributeNode(ht),from:wo})}catch{Ly(f.removed,{attribute:null,from:wo})}if(wo.removeAttribute(ht),ht==="is"&&!No[ht])if(bm||n0)try{i0(wo)}catch{}else try{wo.setAttribute(ht,"")}catch{}},bL=function(ht){let wo,zo;if(t0)ht="<remove></remove>"+ht;else{const oa=M5(ht,/^[\r\n\t ]+/);zo=oa&&oa[0]}Ub==="application/xhtml+xml"&&Xx===ym&&(ht='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+ht+"</body></html>");const Wr=be?be.createHTML(ht):ht;if(Xx===ym)try{wo=new oe().parseFromString(Wr,Ub)}catch{}if(!wo||!wo.documentElement){wo=ke.createDocument(Xx,"template",null);try{wo.documentElement.innerHTML=mL?Te:Wr}catch{}}const Ni=wo.body||wo.documentElement;return ht&&zo&&Ni.insertBefore(y.createTextNode(zo),Ni.childNodes[0]||null),Xx===ym?zt.call(wo,Pp?"html":"body")[0]:Pp?wo.documentElement:Ni},S3=function(ht){return Ke.call(ht.ownerDocument||ht,ht,U.SHOW_ELEMENT|U.SHOW_COMMENT|U.SHOW_TEXT,null,!1)},H_=function(ht){return typeof A=="object"?ht instanceof A:ht&&typeof ht=="object"&&typeof ht.nodeType=="number"&&typeof ht.nodeName=="string"},Np=function(ht,wo,zo){en[ht]&&V2(en[ht],Wr=>{Wr.call(f,wo,zo,Vb)})},E3=function(ht){let wo;if(Np("beforeSanitizeElements",ht,null),(zo=ht)instanceof K&&(typeof zo.nodeName!="string"||typeof zo.textContent!="string"||typeof zo.removeChild!="function"||!(zo.attributes instanceof B)||typeof zo.removeAttribute!="function"||typeof zo.setAttribute!="function"||typeof zo.namespaceURI!="string"||typeof zo.insertBefore!="function"||typeof zo.hasChildNodes!="function"))return i0(ht),!0;var zo;const Wr=lc(ht.nodeName);if(Np("uponSanitizeElement",ht,{tagName:Wr,allowedTags:_o}),ht.hasChildNodes()&&!H_(ht.firstElementChild)&&(!H_(ht.content)||!H_(ht.content.firstElementChild))&&gd(/<[/\w]/g,ht.innerHTML)&&gd(/<[/\w]/g,ht.textContent))return i0(ht),!0;if(!_o[Wr]||ac[Wr]){if(!ac[Wr]&&_3(Wr)&&(fr.tagNameCheck instanceof RegExp&&gd(fr.tagNameCheck,Wr)||fr.tagNameCheck instanceof Function&&fr.tagNameCheck(Wr)))return!1;if(Mw&&!vm[Wr]){const Ni=de(ht)||ht.parentNode,oa=fe(ht)||ht.childNodes;if(oa&&Ni)for(let Zi=oa.length-1;Zi>=0;--Zi)Ni.insertBefore(he(oa[Zi],!0),Le(ht))}return i0(ht),!0}return ht instanceof P&&!function(Ni){let oa=de(Ni);oa&&oa.tagName||(oa={namespaceURI:Xx,tagName:"template"});const Zi=EE(Ni.tagName),Da=EE(oa.tagName);return!!Uo[Ni.namespaceURI]&&(Ni.namespaceURI===B_?oa.namespaceURI===ym?Zi==="svg":oa.namespaceURI===F_?Zi==="svg"&&(Da==="annotation-xml"||w3[Da]):!!$_[Zi]:Ni.namespaceURI===F_?oa.namespaceURI===ym?Zi==="math":oa.namespaceURI===B_?Zi==="math"&&pL[Da]:!!gL[Zi]:Ni.namespaceURI===ym?!(oa.namespaceURI===B_&&!pL[Da])&&!(oa.namespaceURI===F_&&!w3[Da])&&!gL[Zi]&&(Y7[Zi]||!$_[Zi]):!(Ub!=="application/xhtml+xml"||!Uo[Ni.namespaceURI]))}(ht)?(i0(ht),!0):Wr!=="noscript"&&Wr!=="noembed"&&Wr!=="noframes"||!gd(/<\/no(script|embed|frames)/i,ht.innerHTML)?(Ip&&ht.nodeType===3&&(wo=ht.textContent,wo=Pn(wo,xn," "),wo=Pn(wo,$n," "),wo=Pn(wo,ro," "),ht.textContent!==wo&&(Ly(f.removed,{element:ht.cloneNode()}),ht.textContent=wo)),Np("afterSanitizeElements",ht,null),!1):(i0(ht),!0)},C3=function(ht,wo,zo){if(s0&&(wo==="id"||wo==="name")&&(zo in y||zo in y3))return!1;if(!(mu&&!Ki[wo]&&gd(xo,wo))){if(!(qa&&gd(Zo,wo))){if(!No[wo]||Ki[wo]){if(!(_3(ht)&&(fr.tagNameCheck instanceof RegExp&&gd(fr.tagNameCheck,ht)||fr.tagNameCheck instanceof Function&&fr.tagNameCheck(ht))&&(fr.attributeNameCheck instanceof RegExp&&gd(fr.attributeNameCheck,wo)||fr.attributeNameCheck instanceof Function&&fr.attributeNameCheck(wo))||wo==="is"&&fr.allowCustomizedBuiltInElements&&(fr.tagNameCheck instanceof RegExp&&gd(fr.tagNameCheck,zo)||fr.tagNameCheck instanceof Function&&fr.tagNameCheck(zo))))return!1}else if(!xm[wo]){if(!gd(pi,Pn(zo,ii,""))){if((wo!=="src"&&wo!=="xlink:href"&&wo!=="href"||ht==="script"||db(zo,"data:")!==0||!Fw[ht])&&!(qx&&!gd(ws,Pn(zo,ii,"")))){if(zo)return!1}}}}}return!0},_3=function(ht){return ht.indexOf("-")>0},T3=function(ht){let wo,zo,Wr,Ni;Np("beforeSanitizeAttributes",ht,null);const{attributes:oa}=ht;if(!oa)return;const Zi={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:No};for(Ni=oa.length;Ni--;){wo=oa[Ni];const{name:Da,namespaceURI:Jx}=wo;zo=Da==="value"?wo.value:N5(wo.value);const J7=zo;if(Wr=lc(Da),Zi.attrName=Wr,Zi.attrValue=zo,Zi.keepAttr=!0,Zi.forceKeepAttr=void 0,Np("uponSanitizeAttribute",ht,Zi),zo=Zi.attrValue,Zi.forceKeepAttr)continue;if(!Zi.keepAttr){Gb(Da,ht);continue}if(!Yx&&gd(/\/>/i,zo)){Gb(Da,ht);continue}Ip&&(zo=Pn(zo,xn," "),zo=Pn(zo,$n," "),zo=Pn(zo,ro," "));const D3=lc(ht.nodeName);if(C3(D3,Wr,zo)){if(!N_||Wr!=="id"&&Wr!=="name"||(Gb(Da,ht),zo="user-content-"+zo),be&&typeof ne=="object"&&typeof ne.getAttributeType=="function"&&!Jx)switch(ne.getAttributeType(D3,Wr)){case"TrustedHTML":zo=be.createHTML(zo);break;case"TrustedScriptURL":zo=be.createScriptURL(zo)}if(zo!==J7)try{Jx?ht.setAttributeNS(Jx,Da,zo):ht.setAttribute(Da,zo)}catch{Gb(Da,ht)}}else Gb(Da,ht)}Np("afterSanitizeAttributes",ht,null)},X7=function ht(wo){let zo;const Wr=S3(wo);for(Np("beforeSanitizeShadowDOM",wo,null);zo=Wr.nextNode();)Np("uponSanitizeShadowNode",zo,null),E3(zo)||(zo.content instanceof E&&ht(zo.content),T3(zo));Np("afterSanitizeShadowDOM",wo,null)};return f.sanitize=function(ht){let wo,zo,Wr,Ni,oa=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(mL=!ht,mL&&(ht="<!-->"),typeof ht!="string"&&!H_(ht)){if(typeof ht.toString!="function")throw Lg("toString is not a function");if(typeof(ht=ht.toString())!="string")throw Lg("dirty is not a string, aborting")}if(!f.isSupported)return ht;if(Pw||zb(oa),f.removed=[],typeof ht=="string"&&(r0=!1),r0){if(ht.nodeName){const Jx=lc(ht.nodeName);if(!_o[Jx]||ac[Jx])throw Lg("root node is forbidden and cannot be sanitized in-place")}}else if(ht instanceof A)wo=bL("<!---->"),zo=wo.ownerDocument.importNode(ht,!0),zo.nodeType===1&&zo.nodeName==="BODY"||zo.nodeName==="HTML"?wo=zo:wo.appendChild(zo);else{if(!bm&&!Ip&&!Pp&&ht.indexOf("<")===-1)return be&&o0?be.createHTML(ht):ht;if(wo=bL(ht),!wo)return bm?null:o0?Te:""}wo&&t0&&i0(wo.firstChild);const Zi=S3(r0?ht:wo);for(;Wr=Zi.nextNode();)E3(Wr)||(Wr.content instanceof E&&X7(Wr.content),T3(Wr));if(r0)return ht;if(bm){if(n0)for(Ni=dt.call(wo.ownerDocument);wo.firstChild;)Ni.appendChild(wo.firstChild);else Ni=wo;return(No.shadowroot||No.shadowrootmode)&&(Ni=Wt.call(m,Ni,!0)),Ni}let Da=Pp?wo.outerHTML:wo.innerHTML;return Pp&&_o["!doctype"]&&wo.ownerDocument&&wo.ownerDocument.doctype&&wo.ownerDocument.doctype.name&&gd(sm,wo.ownerDocument.doctype.name)&&(Da="<!DOCTYPE "+wo.ownerDocument.doctype.name+`>
`+Da),Ip&&(Da=Pn(Da,xn," "),Da=Pn(Da,$n," "),Da=Pn(Da,ro," ")),be&&o0?be.createHTML(Da):Da},f.setConfig=function(ht){zb(ht),Pw=!0},f.clearConfig=function(){Vb=null,Pw=!1},f.isValidAttribute=function(ht,wo,zo){Vb||zb({});const Wr=lc(ht),Ni=lc(wo);return C3(Wr,Ni,zo)},f.addHook=function(ht,wo){typeof wo=="function"&&(en[ht]=en[ht]||[],Ly(en[ht],wo))},f.removeHook=function(ht){if(en[ht])return P5(en[ht])},f.removeHooks=function(ht){en[ht]&&(en[ht]=[])},f.removeAllHooks=function(){en={}},f}();const jO=r=>j5().sanitize(r);var bd=tinymce.util.Tools.resolve("tinymce.util.I18n");const K5={indent:!0,outdent:!0,"table-insert-column-after":!0,"table-insert-column-before":!0,"paste-column-after":!0,"paste-column-before":!0,"unordered-list":!0,"list-bull-circle":!0,"list-bull-default":!0,"list-bull-square":!0},KO="temporary-placeholder",j2=r=>()=>At(r,KO).getOr("!not found!"),Rg=(r,c)=>{const f=r.toLowerCase();if(bd.isRtl()){const m=((x,y)=>aa(x,y)?x:((E,D)=>E+D)(x,y))(f,"-rtl");return On(c,m)?m:f}return f},Iy=(r,c)=>At(c,Rg(r,c)),ZO=(r,c)=>{const f=c();return Iy(r,f).getOrThunk(j2(f))},AE=()=>Qo("add-focusable",[zr(r=>{kv(r.element,"svg").each(c=>Eo(c,"focusable","false"))})]),qO=(r,c,f,m)=>{var x,y;const E=(A=>!!bd.isRtl()&&On(K5,A))(c)?["tox-icon--flip"]:[],D=At(f,Rg(c,f)).or(m).getOrThunk(j2(f));return{dom:{tag:r.tag,attributes:(x=r.attributes)!==null&&x!==void 0?x:{},classes:r.classes.concat(E),innerHtml:D},behaviours:tn([...(y=r.behaviours)!==null&&y!==void 0?y:[],AE()])}},vd=(r,c,f,m=O.none())=>qO(c,r,f(),m),Z5={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},K2=fd({name:"Notification",factory:r=>{const c=Zn("notification-text"),f=dr({dom:om(`<p id=${c}>${jO(r.backstageProvider.translate(r.text))}</p>`),behaviours:tn([Do.config({})])}),m=B=>({dom:{tag:"div",classes:["tox-bar"],styles:{width:`${B}%`}}}),x=B=>({dom:{tag:"div",classes:["tox-text"],innerHtml:`${B}%`}}),y=dr({dom:{tag:"div",classes:r.progress?["tox-progress-bar","tox-progress-indicator"]:["tox-progress-bar"]},components:[{dom:{tag:"div",classes:["tox-bar-container"]},components:[m(0)]},x(0)],behaviours:tn([Do.config({})])}),E={updateProgress:(B,K)=>{B.getSystem().isConnected()&&y.getOpt(B).each(oe=>{Do.set(oe,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[m(K)]},x(K)])})},updateText:(B,K)=>{if(B.getSystem().isConnected()){const oe=f.get(B);Do.set(oe,[Pr(K)])}}},D=Vn([r.icon.toArray(),r.level.toArray(),r.level.bind(B=>O.from(Z5[B])).toArray()]),A=dr(Il.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"],attributes:{"aria-label":r.backstageProvider.translate("Close")}},components:[vd("close",{tag:"span",classes:["tox-icon"]},r.iconProvider)],buttonBehaviours:tn([Mr.config({}),Pl.config({...r.backstageProvider.tooltips.getConfig({tooltipText:r.backstageProvider.translate("Close")})})]),action:B=>{r.onAction(B)}})),P=((B,K,oe)=>{const ne=oe(),ge=J(B,he=>On(ne,Rg(he,ne)));return qO({tag:"div",classes:["tox-notification__icon"]},ge.getOr(KO),ne,O.none())})(D,0,r.iconProvider),U=[P,{dom:{tag:"div",classes:["tox-notification__body"]},components:[f.asSpec()],behaviours:tn([Do.config({})])}];return{uid:r.uid,dom:{tag:"div",attributes:{role:"alert","aria-labelledby":c},classes:r.level.map(B=>["tox-notification","tox-notification--in",`tox-notification--${B}`]).getOr(["tox-notification","tox-notification--in"])},behaviours:tn([Mr.config({}),Bo.config({}),uo.config({mode:"special",onEscape:B=>(r.onAction(B),O.some(!0))})]),components:U.concat(r.progress?[y.asSpec()]:[]).concat([A.asSpec()]),apis:E}},configFields:[ys("level"),Rt("progress"),ys("icon"),Rt("onAction"),Rt("text"),Rt("iconProvider"),Rt("backstageProvider")],apis:{updateProgress:(r,c,f)=>{r.updateProgress(c,f)},updateText:(r,c,f)=>{r.updateText(c,f)}}});var YO=(r,c,f,m)=>{const x=c.backstage.shared,y=()=>{const D=Ys(Ie(r.getContentAreaContainer()));return O.some(D)},E=D=>{y().each(A=>{mt(D,P=>{ds(P.element)>A.width&&Ro(P.element,"width",A.width+"px")})})};return{open:(D,A,P)=>{const U=()=>{m.on(oe=>{A();const ne=P();(ge=>{Do.remove(ge,B),K()})(oe),((ge,he)=>{xr(ge.element).length===0?((Le,fe)=>{ri.hide(Le),m.clear(),fe&&r.focus()})(ge,he):((Le,fe)=>{fe&&uo.focusIn(Le)})(ge,he)})(oe,ne)})},B=Qi(K2.sketch({text:D.text,level:et(["success","error","warning","warn","info"],D.type)?D.type:void 0,progress:D.progressBar===!0,icon:D.icon,onAction:U,iconProvider:x.providers.icons,backstageProvider:x.providers}));if(m.isSet()){const oe=_c(B);m.on(ne=>{Do.append(ne,oe),ri.reposition(ne),mi.refresh(ne),E(ne.components())})}else{const oe=Qi(ri.sketch({dom:{tag:"div",classes:["tox-notifications-container"],attributes:{"aria-label":"Notifications",role:"region"}},lazySink:x.getSink,fireDismissalEventInstead:{},...x.header.isPositionedAtTop()?{}:{fireRepositionEventInstead:{}},inlineBehaviours:tn([uo.config({mode:"cyclic",selector:".tox-notification, .tox-notification a, .tox-notification button"}),Do.config({}),...gp(r)&&!x.header.isPositionedAtTop()?[]:[mi.config({contextual:{lazyContext:()=>O.some(Ys(Ie(r.getContentAreaContainer()))),fadeInClass:"tox-notification-container-dock-fadein",fadeOutClass:"tox-notification-container-dock-fadeout",transitionClass:"tox-notification-container-dock-transition"},modes:["top"],lazyViewport:Le=>kg(r,Le.element).map(fe=>({bounds:Ag(fe),optScrollEnv:O.some({currentScrollTop:fe.element.dom.scrollTop,scrollElmTop:wr(fe.element).top})})).getOrThunk(()=>({bounds:Ii(),optScrollEnv:O.none()}))})]])})),ne=_c(B),ge={maxHeightFunction:zd()},he={...x.anchors.banner(),overrides:ge};m.set(oe),f.add(oe),ri.showWithinBounds(oe,ne,{anchor:he},y)}W(D.timeout)&&D.timeout>0&&lE.setEditorTimeout(r,()=>{U()},D.timeout);const K=()=>{m.on(oe=>{ri.reposition(oe),mi.refresh(oe),E(oe.components())})};return{close:U,reposition:K,text:oe=>{K2.updateText(B,oe)},settings:D,getEl:()=>B.element.dom,progressBar:{value:oe=>{K2.updateProgress(B,oe)}}}},close:D=>{D.close()},getArgs:D=>D.settings}},Py;(function(r){r[r.CLOSE_ON_EXECUTE=0]="CLOSE_ON_EXECUTE",r[r.BUBBLE_TO_SANDBOX=1]="BUBBLE_TO_SANDBOX"})(Py||(Py={}));var ah=Py;const LE="tox-menu-nav__js",RE="tox-collection__item",XO="tox-swatch",JO={normal:LE,color:XO},QO="tox-collection__item--enabled",eI="tox-collection__item-icon",My="tox-collection__item-label",Z2="tox-collection__item-caret",rm="tox-collection__item--active",Ny="tox-collection__item-container",Fy="tox-collection__item-container--row",Og=r=>At(JO,r).getOr(LE),Ez=r=>r==="color"?"tox-swatches":"tox-menu",q2=r=>({backgroundMenu:"tox-background-menu",selectedMenu:"tox-selected-menu",selectedItem:"tox-collection__item--active",hasIcons:"tox-menu--has-icons",menu:Ez(r),tieredMenu:"tox-tiered-menu"}),hb=r=>{const c=q2(r);return{backgroundMenu:c.backgroundMenu,selectedMenu:c.selectedMenu,menu:c.menu,selectedItem:c.selectedItem,item:Og(r)}},tI=(r,c,f)=>{const m=q2(f);return{tag:"div",classes:Vn([[m.menu,`tox-menu-${c}-column`],r?[m.hasIcons]:[]])}},nI=[lb.parts.items({})],OE=(r,c,f)=>{const m=q2(f);return{dom:{tag:"div",classes:Vn([[m.tieredMenu]])},markers:hb(f)}},q5=Y([ys("data"),lt("inputAttributes",{}),lt("inputStyles",{}),lt("tag","input"),lt("inputClasses",[]),Rs("onSetValue"),lt("styles",{}),lt("eventOrder",{}),vn("inputBehaviours",[at,Bo]),lt("selectOnFocus",!0)]),Y5=r=>tn([Bo.config({onFocus:r.selectOnFocus?c=>{const f=c.element,m=Kf(f);f.dom.setSelectionRange(0,m.length)}:j})]),X5=r=>({...Y5(r),...eo(r.inputBehaviours,[at.config({store:{mode:"manual",...r.data.map(c=>({initialValue:c})).getOr({}),getValue:c=>Kf(c.element),setValue:(c,f)=>{Kf(c.element)!==f&&Km(c.element,f)}},onSetValue:r.onSetValue})])}),oI=r=>({tag:r.tag,attributes:{type:"text",...r.inputAttributes},styles:r.inputStyles,classes:r.inputClasses}),vp=fd({name:"Input",configFields:q5(),factory:(r,c)=>({uid:r.uid,dom:oI(r),components:[],behaviours:X5(r),eventOrder:r.eventOrder})}),sI=Zn("refetch-trigger-event"),rI=Zn("redirect-menu-item-interaction"),iI="tox-menu__searcher",By=r=>si(r.element,`.${iI}`).bind(c=>r.getSystem().getByDom(c).toOptional()),aI=By,lI=r=>({fetchPattern:at.getValue(r),selectionStart:r.element.dom.selectionStart,selectionEnd:r.element.dom.selectionEnd}),cI=r=>{const c=(x,y)=>(y.cut(),O.none()),f=(x,y)=>{const E={interactionEvent:y.event,eventType:y.event.raw.type};return so(x,rI,E),O.some(!0)},m="searcher-events";return{dom:{tag:"div",classes:[RE]},components:[vp.sketch({inputClasses:[iI,"tox-textfield"],inputAttributes:{...r.placeholder.map(x=>({placeholder:r.i18n(x)})).getOr({}),type:"search","aria-autocomplete":"list"},inputBehaviours:tn([Qo(m,[Ft(Vr(),x=>{rs(x,sI)}),Ft(Jn(),(x,y)=>{y.event.raw.key==="Escape"&&y.stop()})]),uo.config({mode:"special",onLeft:c,onRight:c,onSpace:c,onEnter:f,onEscape:f,onUp:f,onDown:f})]),eventOrder:{keydown:[m,uo.name()]}})]}},$y="tox-collection--results__js",uI=r=>{var c;return r.dom?{...r,dom:{...r.dom,attributes:{...(c=r.dom.attributes)!==null&&c!==void 0?c:{},id:Zn("aria-item-search-result-id"),"aria-selected":"false"}}}:r},IE=(r,c)=>f=>{const m=it(f,c);return qe(m,x=>({dom:r,components:x}))},dI=(r,c)=>{const f=[];let m=[];return mt(r,(x,y)=>{c(x,y)?(m.length>0&&f.push(m),m=[],(On(x.dom,"innerHtml")||x.components&&x.components.length>0)&&m.push(x)):m.push(x)}),m.length>0&&f.push(m),qe(f,x=>({dom:{tag:"div",classes:["tox-collection__group"]},components:x}))},Hy=(r,c,f)=>lb.parts.items({preprocess:m=>{const x=qe(m,f);return r!=="auto"&&r>1?IE({tag:"div",classes:["tox-collection__group"]},r)(x):dI(x,(y,E)=>c[E].type==="separator")}}),Y2=(r,c,f=!0)=>({dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(r===1?["tox-collection--list"]:["tox-collection--grid"])},components:[Hy(r,c,me)]}),Uy=r=>Dt(r,c=>"icon"in c&&c.icon!==void 0),im=r=>(console.error(xc(r)),console.log(r),O.none()),J5=(r,c,f,m,x)=>{const y=(E=f,{dom:{tag:"div",classes:["tox-collection","tox-collection--horizontal"]},components:[lb.parts.items({preprocess:D=>dI(D,(A,P)=>E[P].type==="separator")})]});var E;return{value:r,dom:y.dom,components:y.components,items:f}},X2=(r,c,f,m,x)=>{if(x.menuType==="color"){const y=(E=>({dom:{tag:"div",classes:["tox-menu","tox-swatches-menu"]},components:[{dom:{tag:"div",classes:["tox-swatches"]},components:[lb.parts.items({preprocess:E!=="auto"?IE({tag:"div",classes:["tox-swatches__row"]},E):me})]}]}))(m);return{value:r,dom:y.dom,components:y.components,items:f}}if(x.menuType==="normal"&&m==="auto"){const y=Y2(m,f);return{value:r,dom:y.dom,components:y.components,items:f}}if(x.menuType==="normal"||x.menuType==="searchable"){const y=x.menuType!=="searchable"?Y2(m,f):x.searchMode.searchMode==="search-with-field"?((E,D,A)=>{const P=Zn("aria-controls-search-results");return{dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(E===1?["tox-collection--list"]:["tox-collection--grid"])},components:[cI({i18n:bd.translate,placeholder:A.placeholder}),{dom:{tag:"div",classes:[...E===1?["tox-collection--list"]:["tox-collection--grid"],$y],attributes:{id:P}},components:[Hy(E,D,uI)]}]}})(m,f,x.searchMode):((E,D,A=!0)=>{const P=Zn("aria-controls-search-results");return{dom:{tag:"div",classes:["tox-menu","tox-collection",$y].concat(E===1?["tox-collection--list"]:["tox-collection--grid"]),attributes:{id:P}},components:[Hy(E,D,uI)]}})(m,f);return{value:r,dom:y.dom,components:y.components,items:f}}if(x.menuType==="listpreview"&&m!=="auto"){const y=(E=>({dom:{tag:"div",classes:["tox-menu","tox-collection","tox-collection--toolbar","tox-collection--toolbar-lg"]},components:[lb.parts.items({preprocess:IE({tag:"div",classes:["tox-collection__group"]},E)})]}))(m);return{value:r,dom:y.dom,components:y.components,items:f}}return{value:r,dom:tI(c,m,x.menuType),components:nI,items:f}},va=qr("type"),J2=qr("name"),Q2=qr("label"),Kd=qr("text"),eD=qr("title"),tD=qr("icon"),mb=qr("value"),Q5=Ji("fetch"),fI=Ji("getSubmenuItems"),bx=Ji("onAction"),hI=Ji("onItemAction"),Ig=Or("onSetup",()=>j),e6=oi("name"),Pg=oi("text"),Zd=oi("icon"),Vy=oi("tooltip"),nD=oi("label"),oD=oi("shortcut"),PE=_l("select"),vx=pa("active",!1),t6=pa("borderless",!1),lh=pa("enabled",!0),zy=pa("primary",!1),mI=r=>lt("columns",r),sD=lt("meta",{}),Ku=Or("onAction",j),pb=r=>rr("type",r),rD=r=>wi("name","name",gt(()=>Zn(`${r}-name`)),ni),pI=Wn([va,Pg]),n6=Wn([pb("autocompleteitem"),vx,lh,sD,mb,Pg,Zd]),Gy=[lh,Vy,Zd,Pg,Ig],xx=Wn([va,bx,oD].concat(Gy)),ME=r=>Rr("toolbarbutton",xx,r),iD=[vx].concat(Gy),aD=Wn(iD.concat([va,bx,oD])),Wy=r=>Rr("ToggleButton",aD,r),NE=[Or("predicate",ve),Tl("scope","node",["node","editor"]),Tl("position","selection",["node","selection","line"])],o6=Gy.concat([pb("contextformbutton"),zy,bx,Pi("original",me)]),s6=iD.concat([pb("contextformbutton"),zy,bx,Pi("original",me)]),r6=Gy.concat([pb("contextformbutton")]),i6=iD.concat([pb("contextformtogglebutton")]),a6=Kr("type",{contextformbutton:o6,contextformtogglebutton:s6}),l6=Wn([pb("contextform"),Or("initValue",Y("")),nD,ha("commands",a6),ma("launch",Kr("type",{contextformbutton:r6,contextformtogglebutton:i6}))].concat(NE)),gI=Wn([pb("contexttoolbar"),qr("items")].concat(NE)),lD=[va,qr("src"),oi("alt"),Ua("classes",[],ni)],c6=Wn(lD),u6=[va,Kd,e6,Ua("classes",["tox-collection__item-label"],ni)],d6=Wn(u6),bI=Vs(()=>Du("type",{cardimage:c6,cardtext:d6,cardcontainer:gb})),gb=Wn([va,rr("direction","horizontal"),rr("align","left"),rr("valign","middle"),ha("items",bI)]),bb=[lh,Pg,oD,wi("value","value",gt(()=>Zn("menuitem-value")),Sa()),sD],f6=Wn([va,nD,ha("items",bI),Ig,Ku].concat(bb)),cD=Wn([va,vx,Zd].concat(bb)),vI=[va,qr("fancytype"),Ku],xI=[lt("initData",{})].concat(vI),yI=[_l("select"),Xs("initData",{},[pa("allowCustomColors",!0),rr("storageKey","default"),yc("colors",Sa())])].concat(vI),wI=Kr("fancytype",{inserttable:xI,colorswatch:yI}),SI=Wn([va,Ig,Ku,Zd].concat(bb)),EI=Wn([va,fI,Ig,Zd].concat(bb)),h6=Wn([va,Zd,vx,Ig,bx].concat(bb)),uD=(r,c,f)=>{const m=ba(r.element,"."+f);if(m.length>0){const x=Bn(m,y=>{const E=y.dom.getBoundingClientRect().top,D=m[0].dom.getBoundingClientRect().top;return Math.abs(E-D)>c}).getOr(m.length);return O.some({numColumns:x,numRows:Math.ceil(m.length/x)})}return O.none()},jy=r=>((c,f)=>tn([Qo(c,f)]))(Zn("unnamed-events"),r),FE="silver.readonly",m6=Wn([fa("readonly",ru)]),vb=(r,c)=>{const f=r.mainUi.outerContainer.element,m=[r.mainUi.mothership,...r.uiMotherships];c&&mt(m,x=>{x.broadcastOn([I()],{target:f})}),mt(m,x=>{x.broadcastOn([FE],{readonly:c})})},CI=(r,c)=>{r.on("init",()=>{r.mode.isReadOnly()&&vb(c,!0)}),r.on("SwitchMode",()=>vb(c,r.mode.isReadOnly())),L2(r)&&r.mode.set("readonly")},Ia=()=>pl.config({channels:{[FE]:{schema:m6,onReceive:(r,c)=>{Ho.set(r,c.readonly)}}}}),vl=r=>Ho.config({disabled:r}),_I=r=>Ho.config({disabled:r,disableClass:"tox-tbtn--disabled"}),BE=r=>Ho.config({disabled:r,disableClass:"tox-tbtn--disabled",useNative:!1}),Ky=(r,c)=>{const f=r.getApi(c);return m=>{m(f)}},Mg=(r,c)=>zr(f=>{Ky(r,f)(m=>{const x=r.onSetup(m);$(x)&&c.set(x)})}),xp=(r,c)=>pf(f=>Ky(r,f)(c.get())),TI=(r,c)=>Ud((f,m)=>{Ky(r,f)(r.onAction),r.triggersSubmenu||c!==ah.CLOSE_ON_EXECUTE||(f.getSystem().isConnected()&&rs(f,lv()),m.stop())}),p6={[pr()]:["disabling","alloy.base.behaviour","toggling","item-events"]},yx=kr,wx=(r,c,f,m)=>{const x=ho(j);return{type:"item",dom:c.dom,components:yx(c.optComponents),data:r.data,eventOrder:p6,hasSubmenu:r.triggersSubmenu,itemBehaviours:tn([Qo("item-events",[TI(r,f),Mg(r,x),xp(r,x)]),(y=()=>!r.enabled||m.isDisabled(),Ho.config({disabled:y,disableClass:"tox-collection__item--state-disabled"})),Ia(),Do.config({})].concat(r.itemBehaviours))};var y},Sx=r=>({value:r.value,meta:{text:r.text.getOr(""),...r.meta}}),$E=r=>{const c=sh.os.isMacOS()||sh.os.isiOS(),f=c?{alt:"⌥",ctrl:"⌃",shift:"⇧",meta:"⌘",access:"⌃⌥"}:{meta:"Ctrl",access:"Shift+Alt"},m=r.split("+"),x=qe(m,y=>{const E=y.toLowerCase().trim();return On(f,E)?f[E]:y});return c?x.join(""):x.join("+")},dD=(r,c,f=[eI])=>vd(r,{tag:"div",classes:f},c),DI=r=>({dom:{tag:"div",classes:[My]},components:[Pr(bd.translate(r))]}),fD=(r,c)=>({dom:{tag:"div",classes:c,innerHtml:r}}),kI=(r,c)=>({dom:{tag:"div",classes:[My]},components:[{dom:{tag:r.tag,styles:r.styles},components:[Pr(bd.translate(c))]}]}),AI=r=>({dom:{tag:"div",classes:["tox-collection__item-accessory"]},components:[Pr($E(r))]}),LI=r=>dD("checkmark",r,["tox-collection__item-checkmark"]),RI=r=>{const c=r.map(f=>({attributes:{id:Zn("menu-item"),"aria-label":bd.translate(f)}})).getOr({});return{tag:"div",classes:[LE,RE],...c}},Zy=(r,c,f,m=O.none())=>r.presets==="color"?((x,y,E)=>{const D=x.value,A=x.iconContent.map(U=>((B,K,oe)=>{const ne=K();return Iy(B,ne).or(oe).getOrThunk(j2(ne))})(U,y.icons,E)),P=x.ariaLabel.map(U=>({"aria-label":y.translate(U),"data-mce-name":U})).getOr({});return{dom:(()=>{const U=XO,B=A.getOr(""),K={tag:"div",attributes:P,classes:[U]};return D==="custom"?{...K,tag:"button",classes:[...K.classes,"tox-swatches__picker-btn"],innerHtml:B}:D==="remove"?{...K,classes:[...K.classes,"tox-swatch--remove"],innerHtml:B}:z(D)?{...K,attributes:{...K.attributes,"data-mce-color":D},styles:{"background-color":D},innerHtml:B}:K})(),optComponents:[]}})(r,c,m):((x,y,E,D)=>{const A={tag:"div",classes:[eI]},P=E?x.iconContent.map(oe=>vd(oe,A,y.icons,D)).orThunk(()=>O.some({dom:A})):O.none(),U=x.checkMark,B=O.from(x.meta).fold(()=>DI,oe=>On(oe,"style")?Ce(kI,oe.style):DI),K=x.htmlContent.fold(()=>x.textContent.map(B),oe=>O.some(fD(oe,[My])));return{dom:RI(x.ariaLabel),optComponents:[P,K,x.shortcutContent.map(AI),U,x.caret]}})(r,c,f,m),OI=(r,c,f)=>At(r,"tooltipWorker").map(m=>[Pl.config({lazySink:c.getSink,tooltipDom:{tag:"div",classes:["tox-tooltip-worker-container"]},tooltipComponents:[],anchor:x=>({type:"submenu",item:x,overrides:{maxHeightFunction:zd}}),mode:"follow-highlight",onShow:(x,y)=>{m(E=>{Pl.setComponents(x,[H0({element:Ie(E)})])})}})]).getOrThunk(()=>f.map(m=>[Pl.config({...c.providers.tooltips.getConfig({tooltipText:m}),mode:"follow-highlight"})]).getOr([])),hD=(r,c)=>{const f=(m=>dx.DOM.encode(m))(bd.translate(r));if(c.length>0){const m=new RegExp((x=>x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))(c),"gi");return f.replace(m,x=>`<span class="tox-autocompleter-highlight">${x}</span>`)}return f},mD=(r,c)=>qe(r,f=>{switch(f.type){case"cardcontainer":return((y,E)=>{const D=y.direction==="vertical"?"tox-collection__item-container--column":Fy,A=y.align==="left"?"tox-collection__item-container--align-left":"tox-collection__item-container--align-right";return{dom:{tag:"div",classes:[Ny,D,A,(()=>{switch(y.valign){case"top":return"tox-collection__item-container--valign-top";case"middle":return"tox-collection__item-container--valign-middle";case"bottom":return"tox-collection__item-container--valign-bottom"}})()]},components:E}})(f,mD(f.items,c));case"cardimage":return((y,E,D)=>({dom:{tag:"img",classes:E,attributes:{src:y,alt:D.getOr("")}}}))(f.src,f.classes,f.alt);case"cardtext":const m=f.name.exists(y=>et(c.cardText.highlightOn,y)),x=m?O.from(c.cardText.matchText).getOr(""):"";return fD(hD(f.text,x),f.classes)}}),yp=Wl(D2(),k2()),pD=r=>({value:PI(r)}),gD=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,HE=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,II=r=>gD.test(r)||HE.test(r),PI=r=>bs(r,"#").toUpperCase(),bD=r=>{const c=r.toString(16);return(c.length===1?"0"+c:c).toUpperCase()},qy=r=>{const c=bD(r.red)+bD(r.green)+bD(r.blue);return pD(c)},vD=Math.min,UE=Math.max,Ex=Math.round,g6=/^\s*rgb\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*\)\s*$/i,Ng=/^\s*rgba\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*((?:\d?\.\d+|\d+)%?)\s*\)\s*$/i,Fg=(r,c,f,m)=>({red:r,green:c,blue:f,alpha:m}),VE=r=>{const c=parseInt(r,10);return c.toString()===r&&c>=0&&c<=255},MI=r=>{let c,f,m;const x=(r.hue||0)%360;let y=r.saturation/100,E=r.value/100;if(y=UE(0,vD(y,1)),E=UE(0,vD(E,1)),y===0)return c=f=m=Ex(255*E),Fg(c,f,m,1);const D=x/60,A=E*y,P=A*(1-Math.abs(D%2-1)),U=E-A;switch(Math.floor(D)){case 0:c=A,f=P,m=0;break;case 1:c=P,f=A,m=0;break;case 2:c=0,f=A,m=P;break;case 3:c=0,f=P,m=A;break;case 4:c=P,f=0,m=A;break;case 5:c=A,f=0,m=P;break;default:c=f=m=0}return c=Ex(255*(c+U)),f=Ex(255*(f+U)),m=Ex(255*(m+U)),Fg(c,f,m,1)},Yy=r=>{const c=(y=>{const E=(A=>({value:A.value.replace(gD,(U,B,K,oe)=>B+B+K+K+oe+oe)}))(y),D=HE.exec(E.value);return D===null?["FFFFFF","FF","FF","FF"]:D})(r),f=parseInt(c[1],16),m=parseInt(c[2],16),x=parseInt(c[3],16);return Fg(f,m,x,1)},Cx=(r,c,f,m)=>{const x=parseInt(r,10),y=parseInt(c,10),E=parseInt(f,10),D=parseFloat(m);return Fg(x,y,E,D)},xb=r=>{const c=g6.exec(r);if(c!==null)return O.some(Cx(c[1],c[2],c[3],"1"));const f=Ng.exec(r);return f!==null?O.some(Cx(f[1],f[2],f[3],f[4])):O.none()},xD=r=>`rgba(${r.red},${r.green},${r.blue},${r.alpha})`,yD=Fg(255,0,0,1),am=(r,c)=>{r.dispatch("ResizeContent",c)},wp=(r,c)=>{r.dispatch("TextColorChange",c)},b6=(r,c)=>r.dispatch("ResolveName",{name:c.nodeName.toLowerCase(),target:c}),zE=(r,c)=>()=>{r(),c()},rc=r=>Sp(r,"NodeChange",c=>{c.setEnabled(r.selection.isEditable())}),kf=(r,c)=>f=>{const m=rc(r)(f),x=((y,E)=>D=>{const A=mc(),P=()=>{D.setActive(y.formatter.match(E));const U=y.formatter.formatChanged(E,D.setActive);A.set(U)};return y.initialized?P():y.once("init",P),()=>{y.off("init",P),A.clear()}})(r,c)(f);return()=>{m(),x()}},Sp=(r,c,f)=>m=>{const x=()=>f(m),y=()=>{f(m),r.on(c,x)};return r.initialized?y():r.once("init",y),()=>{r.off("init",y),r.off(c,x)}},NI=r=>c=>()=>{r.undoManager.transact(()=>{r.focus(),r.execCommand("mceToggleFormat",!1,c.format)})},hu=(r,c)=>()=>r.execCommand(c);var Bg=tinymce.util.Tools.resolve("tinymce.util.LocalStorage");const wD={},GE=r=>At(wD,r).getOrThunk(()=>{const c=`tinymce-custom-colors-${r}`,f=Bg.getItem(c);if(V(f)){const x=Bg.getItem("tinymce-custom-colors");Bg.setItem(c,z(x)?x:"[]")}const m=((x,y=10)=>{const E=Bg.getItem(x),D=h(E)?JSON.parse(E):[],A=y-(P=D).length<0?P.slice(0,y):P;var P;const U=B=>{A.splice(B,1)};return{add:B=>{((K,oe)=>{const ne=Ut(K,oe);return ne===-1?O.none():O.some(ne)})(A,B).each(U),A.unshift(B),A.length>y&&A.pop(),Bg.setItem(x,JSON.stringify(A))},state:()=>A.slice(0)}})(c,10);return wD[r]=m,m}),SD=(r,c)=>{GE(r).add(c)},Xy=(r,c,f)=>({hue:r,saturation:c,value:f}),ED=r=>{let c=0,f=0,m=0;const x=r.red/255,y=r.green/255,E=r.blue/255,D=Math.min(x,Math.min(y,E)),A=Math.max(x,Math.max(y,E));return D===A?(m=D,Xy(0,0,100*m)):(c=x===D?3:E===D?1:5,c=60*(c-(x===D?y-E:E===D?x-y:E-x)/(A-D)),f=(A-D)/A,m=A,Xy(Math.round(c),Math.round(100*f),Math.round(100*m)))},FI=r=>qy(MI(r)),WE=r=>{return(c=r,II(c)?O.some({value:PI(c)}):O.none()).orThunk(()=>xb(r).map(qy)).getOrThunk(()=>{const f=document.createElement("canvas");f.height=1,f.width=1;const m=f.getContext("2d");m.clearRect(0,0,f.width,f.height),m.fillStyle="#FFFFFF",m.fillStyle=r,m.fillRect(0,0,1,1);const x=m.getImageData(0,0,1,1).data,y=x[0],E=x[1],D=x[2],A=x[3];return qy(Fg(y,E,D,A))});var c},Jy="forecolor",Qy="hilitecolor",v6=r=>{const c=[];for(let f=0;f<r.length;f+=2)c.push({text:r[f+1],value:"#"+WE(r[f]).value,icon:"checkmark",type:"choiceitem"});return c},lm=r=>c=>c.options.get(r),jE="#000000",ew=(r,c)=>c===Jy&&r.options.isSet("color_map_foreground")?lm("color_map_foreground")(r):c===Qy&&r.options.isSet("color_map_background")?lm("color_map_background")(r):lm("color_map")(r),KE=(r,c="default")=>Math.max(5,Math.ceil(Math.sqrt(ew(r,c).length))),CD=(r,c)=>{const f=lm("color_cols")(r),m=KE(r,c);return f===KE(r)?m:f},BI=(r,c="default")=>Math.round(c===Jy?lm("color_cols_foreground")(r):c===Qy?lm("color_cols_background")(r):lm("color_cols")(r)),ZE=lm("custom_colors"),x6=lm("color_default_foreground"),y6=lm("color_default_background"),$I=(r,c)=>{const f=Ie(r.selection.getStart()),m=c==="hilitecolor"?Gc(f,x=>{if(zn(x)){const y=Fr(x,"background-color");return qo(xb(y).exists(E=>E.alpha!==0),y)}return O.none()}).getOr("rgba(0, 0, 0, 0)"):Fr(f,"color");return xb(m).map(x=>"#"+qy(x).value)},HI=r=>{const c="choiceitem",f={type:c,text:"Remove color",icon:"color-swatch-remove-color",value:"remove"};return r?[f,{type:c,text:"Custom color",icon:"color-picker",value:"custom"}]:[f]},qE=(r,c,f,m)=>{f==="custom"?DD(r)(x=>{x.each(y=>{SD(c,y),r.execCommand("mceApplyTextcolor",c,y),m(y)})},$I(r,c).getOr(jE)):f==="remove"?(m(""),r.execCommand("mceRemoveTextcolor",c)):(m(f),r.execCommand("mceApplyTextcolor",c,f))},_D=(r,c,f)=>r.concat((m=>qe(GE(m).state(),x=>({type:"choiceitem",text:x,icon:"checkmark",value:x})))(c).concat(HI(f))),UI=(r,c,f)=>m=>{m(_D(r,c,f))},YE=(r,c,f)=>{const m=c==="forecolor"?"tox-icon-text-color__color":"tox-icon-highlight-bg-color__color";r.setIconFill(m,f)},_x=(r,c)=>{r.setTooltip(c)},VI=(r,c)=>f=>{const m=$I(r,c);return Is(m,f.toUpperCase())},yb=(r,c,f)=>{if(vo(f))return c==="forecolor"?"Text color":"Background color";const m=c==="forecolor"?"Text color {0}":"Background color {0}",x=_D(ew(r,c),c,!1),y=J(x,E=>E.value===f).getOr({text:""}).text;return r.translate([m,r.translate(y)])},XE=(r,c,f,m)=>{r.ui.registry.addSplitButton(c,{tooltip:yb(r,f,m.get()),presets:"color",icon:c==="forecolor"?"text-color":"highlight-bg-color",select:VI(r,f),columns:BI(r,f),fetch:UI(ew(r,f),f,ZE(r)),onAction:x=>{qE(r,f,m.get(),j)},onItemAction:(x,y)=>{qE(r,f,y,E=>{m.set(E),wp(r,{name:c,color:E})})},onSetup:x=>{YE(x,c,m.get());const y=E=>{E.name===c&&(YE(x,E.name,E.color),_x(x,yb(r,f,E.color)))};return r.on("TextColorChange",y),zE(rc(r)(x),()=>{r.off("TextColorChange",y)})}})},TD=(r,c,f,m,x)=>{r.ui.registry.addNestedMenuItem(c,{text:m,icon:c==="forecolor"?"text-color":"highlight-bg-color",onSetup:y=>(_x(y,yb(r,f,x.get())),YE(y,c,x.get()),rc(r)(y)),getSubmenuItems:()=>[{type:"fancymenuitem",fancytype:"colorswatch",select:VI(r,f),initData:{storageKey:f},onAction:y=>{qE(r,f,y.value,E=>{x.set(E),wp(r,{name:c,color:E})})}}]})},DD=r=>(c,f)=>{let m=!1;const x={colorpicker:f};r.windowManager.open({title:"Color Picker",size:"normal",body:{type:"panel",items:[{type:"colorpicker",name:"colorpicker",label:"Color"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:x,onAction:(y,E)=>{E.name==="hex-valid"&&(m=E.value)},onSubmit:y=>{const E=y.getData().colorpicker;m?(c(O.from(E)),y.close()):r.windowManager.alert(r.translate(["Invalid hex color code: {0}",E]))},onClose:j,onCancel:()=>{c(O.none())}})},kD=(r,c,f,m,x,y,E,D)=>{const A=Uy(c),P=w6(c,f,m,x!=="color"?"normal":"color",y,E,D);return X2(r,A,P,m,{menuType:x})},w6=(r,c,f,m,x,y,E)=>kr(qe(r,D=>{return D.type==="choiceitem"?(A=D,Rr("choicemenuitem",cD,A)).fold(im,P=>O.some(((U,B,K,oe,ne,ge,he,Le=!0)=>{const fe=Zy({presets:K,textContent:B?U.text:O.none(),htmlContent:O.none(),ariaLabel:U.text,iconContent:U.icon,shortcutContent:B?U.shortcut:O.none(),checkMark:B?O.some(LI(he.icons)):O.none(),caret:O.none(),value:U.value},he,Le),de=U.text.filter(Y(!B)).map(be=>Pl.config(he.tooltips.getConfig({tooltipText:he.translate(be)})));return Ze(wx({data:Sx(U),enabled:U.enabled,getApi:be=>({setActive:Te=>{Mo.set(be,Te)},isActive:()=>Mo.isOn(be),isEnabled:()=>!Ho.isDisabled(be),setEnabled:Te=>Ho.set(be,!Te)}),onAction:be=>oe(U.value),onSetup:be=>(be.setActive(ne),j),triggersSubmenu:!1,itemBehaviours:[...de.toArray()]},fe,ge,he),{toggling:{toggleClass:QO,toggleOnExecute:!1,selected:U.active,exclusive:!0}})})(P,f===1,m,c,y(P.value),x,E,Uy(r)))):O.none();var A})),tw=(r,c)=>{const f=hb(c);return r===1?{mode:"menu",moveOnTab:!0}:r==="auto"?{mode:"grid",selector:"."+f.item,initSize:{numColumns:1,numRows:1}}:{mode:"matrix",rowSelector:"."+(c==="color"?"tox-swatches__row":"tox-collection__group"),previousSelector:m=>c==="color"?si(m.element,"[aria-checked=true]"):O.none()}},zI=Zn("cell-over"),AD=Zn("cell-execute"),S6=(r,c,f)=>{const m=y=>so(y,AD,{row:r,col:c}),x=(y,E)=>{E.stop(),m(y)};return Qi({dom:{tag:"div",attributes:{role:"button","aria-label":f}},behaviours:tn([Qo("insert-table-picker-cell",[Ft(Yn(),Bo.focus),Ft(pr(),m),Ft(Dl(),x),Ft(Gf(),x)]),Mo.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),Bo.config({onFocus:y=>so(y,zI,{row:r,col:c})})])})},E6=r=>Rn(r,c=>qe(c,_c)),LD=(r,c)=>Pr(`${c}x${r}`),JE={inserttable:(r,c)=>{const f=(E=>(D,A)=>E.shared.providers.translate(["{0} columns, {1} rows",A,D]))(c),m=((E,D,A)=>{const P=[];for(let U=0;U<10;U++){const B=[];for(let K=0;K<10;K++){const oe=E(U+1,K+1);B.push(S6(U,K,oe))}P.push(B)}return P})(f),x=LD(0,0),y=dr({dom:{tag:"span",classes:["tox-insert-table-picker__label"]},components:[x],behaviours:tn([Do.config({})])});return{type:"widget",data:{value:Zn("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[yp.widget({dom:{tag:"div",classes:["tox-insert-table-picker"]},components:E6(m).concat(y.asSpec()),behaviours:tn([Qo("insert-table-picker",[zr(E=>{Do.set(y.get(E),[x])}),b1(zI,(E,D,A)=>{const{row:P,col:U}=A.event;((B,K,oe,ne,ge)=>{for(let he=0;he<10;he++)for(let Le=0;Le<10;Le++)Mo.set(B[he][Le],he<=K&&Le<=oe)})(m,P,U),Do.set(y.get(E),[LD(P+1,U+1)])}),b1(AD,(E,D,A)=>{const{row:P,col:U}=A.event;r.onAction({numRows:P+1,numColumns:U+1}),rs(E,lv())})]),uo.config({initSize:{numRows:10,numColumns:10},mode:"flatgrid",selector:'[role="button"]'})])})]}},colorswatch:(r,c)=>{const f=((E,D)=>{const A=E.initData.allowCustomColors&&D.colorinput.hasCustomColors();return E.initData.colors.fold(()=>_D(D.colorinput.getColors(E.initData.storageKey),E.initData.storageKey,A),P=>P.concat(HI(A)))})(r,c),m=c.colorinput.getColorCols(r.initData.storageKey),x="color",y={...kD(Zn("menu-value"),f,E=>{r.onAction({value:E})},m,x,ah.CLOSE_ON_EXECUTE,r.select.getOr(ve),c.shared.providers),markers:hb(x),movement:tw(m,x),menuRole:!1};return{type:"widget",data:{value:Zn("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[yp.widget(lb.sketch(y))]}}},QE=r=>({type:"separator",dom:{tag:"div",classes:[RE,"tox-collection__group-heading"]},components:r.text.map(Pr).toArray()});var RD=Object.freeze({__proto__:null,getCoupled:(r,c,f,m)=>f.getOrCreate(r,c,m),getExistingCoupled:(r,c,f,m)=>f.getExisting(r,c,m)}),C6=[fa("others",hf(os.value,Sa()))],_6=Object.freeze({__proto__:null,init:()=>{const r={},c=(m,x)=>{if(Jt(m.others).length===0)throw new Error("Cannot find any known coupled components");return At(r,x)},f=Y({});return Ec({readState:f,getExisting:(m,x,y)=>c(x,y).orThunk(()=>(At(x.others,y).getOrDie("No information found for coupled component: "+y),O.none())),getOrCreate:(m,x,y)=>c(x,y).getOrThunk(()=>{const E=At(x.others,y).getOrDie("No information found for coupled component: "+y)(m),D=m.getSystem().build(E);return r[y]=D,D})})}});const ji=Mi({fields:C6,name:"coupling",apis:RD,state:_6}),OD=r=>{let c=O.none(),f=[];const m=E=>{x()?y(E):f.push(E)},x=()=>c.isSome(),y=E=>{c.each(D=>{setTimeout(()=>{E(D)},0)})};return r(E=>{x()||(c=O.some(E),mt(f,y),f=[])}),{get:m,map:E=>OD(D=>{m(A=>{D(E(A))})}),isReady:x}},GI={nu:OD,pure:r=>OD(c=>{c(r)})},WI=r=>{setTimeout(()=>{throw r},0)},Tx=r=>{const c=f=>{r().then(f,WI)};return{map:f=>Tx(()=>r().then(f)),bind:f=>Tx(()=>r().then(m=>f(m).toPromise())),anonBind:f=>Tx(()=>r().then(()=>f.toPromise())),toLazy:()=>GI.nu(c),toCached:()=>{let f=null;return Tx(()=>(f===null&&(f=r()),f))},toPromise:r,get:c}},$g=r=>Tx(()=>new Promise(r)),Ep=r=>Tx(()=>Promise.resolve(r)),jI=Y("sink"),KI=Y(dd({name:jI(),overrides:Y({dom:{tag:"div"},behaviours:tn([tl.config({useFixed:Oe})]),events:Ws([Hd(Jn()),Hd(ce()),Hd(Dl())])})})),ZI=(r,c)=>{const f=r.getHotspot(c).getOr(c),m="hotspot",x=r.getAnchorOverrides();return r.layouts.fold(()=>({type:m,hotspot:f,overrides:x}),y=>({type:m,hotspot:f,overrides:x,layouts:y}))},nw=(r,c,f,m,x,y,E)=>((A,P,U,B,K,oe,ne)=>{const ge=((Le,fe,de)=>(0,Le.fetch)(de).map(fe))(A,P,B),he=qI(B,A);return ge.map(Le=>Le.bind(fe=>O.from(mp.sketch({...oe.menu(),uid:bf(""),data:fe,highlightOnOpen:ne,onOpenMenu:(de,be)=>{const Te=he().getOrDie();tl.position(Te,be,{anchor:U}),_.decloak(K)},onOpenSubmenu:(de,be,Te)=>{const ke=he().getOrDie();tl.position(ke,Te,{anchor:{type:"submenu",item:be}}),_.decloak(K)},onRepositionMenu:(de,be,Te)=>{const ke=he().getOrDie();tl.position(ke,be,{anchor:U}),mt(Te,Ke=>{tl.position(ke,Ke.triggeredMenu,{anchor:{type:"submenu",item:Ke.triggeringItem}})})},onEscape:()=>(Bo.focus(B),_.close(K),O.some(!0))}))))})(r,c,ZI(r,f),f,m,x,E).map(A=>(A.fold(()=>{_.isOpen(m)&&_.close(m)},P=>{_.cloak(m),_.open(m,P),y(m)}),m)),T6=(r,c,f,m,x,y,E)=>(_.close(m),Ep(m)),ID=(r,c,f,m,x,y)=>{const E=ji.getCoupled(f,"sandbox");return(_.isOpen(E)?T6:nw)(r,c,f,E,m,x,y)},qI=(r,c)=>r.getSystem().getByUid(c.uid+"-"+jI()).map(f=>()=>os.value(f)).getOrThunk(()=>c.lazySink.fold(()=>()=>os.error(new Error("No internal sink is specified, nor could an external sink be found")),f=>()=>f(r))),YI=r=>{_.getState(r).each(c=>{mp.repositionMenus(c)})},PD=(r,c,f)=>{const m=B1(),x=qI(c,r);return{dom:{tag:"div",classes:r.sandboxClasses,attributes:{id:m.id,role:"listbox"}},behaviours:lo(r.sandboxBehaviours,[at.config({store:{mode:"memory",initialValue:c}}),_.config({onOpen:(y,E)=>{const D=ZI(r,c);m.link(c.element),r.matchWidth&&((A,P,U)=>{const B=Os.getCurrent(P).getOr(P),K=ds(A.element);U?Ro(B.element,"min-width",K+"px"):((oe,ne)=>{lr.set(oe,ne)})(B.element,K)})(D.hotspot,E,r.useMinWidth),r.onOpen(D,y,E),f!==void 0&&f.onOpen!==void 0&&f.onOpen(y,E)},onClose:(y,E)=>{m.unlink(c.element),x().getOr(E).element.dom.dispatchEvent(new window.FocusEvent("focusout")),f!==void 0&&f.onClose!==void 0&&f.onClose(y,E)},isPartOf:(y,E,D)=>Gh(E,D)||Gh(c,D),getAttachPoint:()=>x().getOrDie()}),Os.config({find:y=>_.getState(y).bind(E=>Os.getCurrent(E))}),pl.config({channels:{...le({isExtraPart:ve}),..._e({doReposition:YI})}})])}},Hg=r=>{const c=ji.getCoupled(r,"sandbox");YI(c)},MD=()=>[lt("sandboxClasses",[]),Hs("sandboxBehaviours",[Os,pl,_,at])],D6=Y([Rt("dom"),Rt("fetch"),Rs("onOpen"),Cc("onExecute"),lt("getHotspot",O.some),lt("getAnchorOverrides",Y({})),Uu(),vn("dropdownBehaviours",[Mo,ji,uo,Bo]),Rt("toggleClass"),lt("eventOrder",{}),ys("lazySink"),lt("matchWidth",!1),lt("useMinWidth",!1),ys("role")].concat(MD())),wb=Y([_f({schema:[Ca(),lt("fakeFocus",!1)],name:"menu",defaults:r=>({onExecute:r.onExecute})}),KI()]),xd=Dc({name:"Dropdown",configFields:D6(),partFields:wb(),factory:(r,c,f,m)=>{const x=A=>{_.getState(A).each(P=>{mp.highlightPrimary(P)})},y=(A,P,U)=>ID(r,me,A,m,P,U),E={expand:A=>{Mo.isOn(A)||y(A,j,jl.HighlightNone).get(j)},open:A=>{Mo.isOn(A)||y(A,j,jl.HighlightMenuAndItem).get(j)},refetch:A=>ji.getExistingCoupled(A,"sandbox").fold(()=>y(A,j,jl.HighlightMenuAndItem).map(j),P=>nw(r,me,A,P,m,j,jl.HighlightMenuAndItem).map(j)),isOpen:Mo.isOn,close:A=>{Mo.isOn(A)&&y(A,j,jl.HighlightMenuAndItem).get(j)},repositionMenus:A=>{Mo.isOn(A)&&Hg(A)}},D=(A,P)=>(id(A),O.some(!0));return{uid:r.uid,dom:r.dom,components:c,behaviours:eo(r.dropdownBehaviours,[Mo.config({toggleClass:r.toggleClass,aria:{mode:"expanded"}}),ji.config({others:{sandbox:A=>PD(r,A,{onOpen:()=>Mo.on(A),onClose:()=>Mo.off(A)})}}),uo.config({mode:"special",onSpace:D,onEnter:D,onDown:(A,P)=>{if(xd.isOpen(A)){const U=ji.getCoupled(A,"sandbox");x(U)}else xd.open(A);return O.some(!0)},onEscape:(A,P)=>xd.isOpen(A)?(xd.close(A),O.some(!0)):O.none()}),Bo.config({})]),events:cx(O.some(A=>{y(A,x,jl.HighlightMenuAndItem).get(j)})),eventOrder:{...r.eventOrder,[pr()]:["disabling","toggling","alloy.base.behaviour"]},apis:E,domModification:{attributes:{"aria-haspopup":"true",...r.role.fold(()=>({}),A=>({role:A})),...r.dom.tag==="button"?{type:At(r.dom,"attributes").bind(A=>At(A,"type")).getOr("button")}:{}}}}},apis:{open:(r,c)=>r.open(c),refetch:(r,c)=>r.refetch(c),expand:(r,c)=>r.expand(c),close:(r,c)=>r.close(c),isOpen:(r,c)=>r.isOpen(c),repositionMenus:(r,c)=>r.repositionMenus(c)}}),XI=(r,c,f)=>{aI(r).each(m=>{var x;((y,E)=>{Di(E.element,"id").each(D=>Eo(y.element,"aria-activedescendant",D))})(m,f),(zl((x=c).element,$y)?O.some(x.element):si(x.element,"."+$y)).each(y=>{Di(y,"id").each(E=>Eo(m.element,"aria-controls",E))})}),Eo(f.element,"aria-selected","true")},Ug=(r,c,f)=>{Eo(f.element,"aria-selected","false")},k6=r=>ji.getExistingCoupled(r,"sandbox").bind(By).map(lI).map(c=>c.fetchPattern).getOr("");var eC;(function(r){r[r.ContentFocus=0]="ContentFocus",r[r.UiFocus=1]="UiFocus"})(eC||(eC={}));const qd=(r,c,f,m,x)=>{const y=f.shared.providers,E=A=>x?{...A,shortcut:O.none(),icon:A.text.isSome()?O.none():A.icon}:A;switch(r.type){case"menuitem":return(D=r,Rr("menuitem",SI,D)).fold(im,A=>O.some(((P,U,B,K=!0)=>{const oe=Zy({presets:"normal",iconContent:P.icon,textContent:P.text,htmlContent:O.none(),ariaLabel:P.text,caret:O.none(),checkMark:O.none(),shortcutContent:P.shortcut},B,K);return wx({data:Sx(P),getApi:ne=>({isEnabled:()=>!Ho.isDisabled(ne),setEnabled:ge=>Ho.set(ne,!ge)}),enabled:P.enabled,onAction:P.onAction,onSetup:P.onSetup,triggersSubmenu:!1,itemBehaviours:[]},oe,U,B)})(E(A),c,y,m)));case"nestedmenuitem":return(A=>Rr("nestedmenuitem",EI,A))(r).fold(im,A=>O.some(((P,U,B,K=!0,oe=!1)=>{const ne=oe?(ge=B.icons,dD("chevron-down",ge,[Z2])):(Le=>dD("chevron-right",Le,[Z2]))(B.icons);var ge;const he=Zy({presets:"normal",iconContent:P.icon,textContent:P.text,htmlContent:O.none(),ariaLabel:P.text,caret:O.some(ne),checkMark:O.none(),shortcutContent:P.shortcut},B,K);return wx({data:Sx(P),getApi:Le=>({isEnabled:()=>!Ho.isDisabled(Le),setEnabled:fe=>Ho.set(Le,!fe),setIconFill:(fe,de)=>{si(Le.element,`svg path[class="${fe}"], rect[class="${fe}"]`).each(be=>{Eo(be,"fill",de)})},setTooltip:fe=>{const de=B.translate(fe);Eo(Le.element,"aria-label",de)}}),enabled:P.enabled,onAction:j,onSetup:P.onSetup,triggersSubmenu:!0,itemBehaviours:[]},he,U,B)})(E(A),c,y,m,x)));case"togglemenuitem":return(A=>Rr("togglemenuitem",h6,A))(r).fold(im,A=>O.some(((P,U,B,K=!0)=>{const oe=Zy({iconContent:P.icon,textContent:P.text,htmlContent:O.none(),ariaLabel:P.text,checkMark:O.some(LI(B.icons)),caret:O.none(),shortcutContent:P.shortcut,presets:"normal",meta:P.meta},B,K);return Ze(wx({data:Sx(P),enabled:P.enabled,getApi:ne=>({setActive:ge=>{Mo.set(ne,ge)},isActive:()=>Mo.isOn(ne),isEnabled:()=>!Ho.isDisabled(ne),setEnabled:ge=>Ho.set(ne,!ge)}),onAction:P.onAction,onSetup:P.onSetup,triggersSubmenu:!1,itemBehaviours:[]},oe,U,B),{toggling:{toggleClass:QO,toggleOnExecute:!1,selected:P.active}})})(E(A),c,y,m)));case"separator":return(A=>Rr("separatormenuitem",pI,A))(r).fold(im,A=>O.some(QE(A)));case"fancymenuitem":return(A=>Rr("fancymenuitem",wI,A))(r).fold(im,A=>((P,U)=>At(JE,P.fancytype).map(B=>B(P,U)))(A,f));default:return console.error("Unknown item in general menu",r),O.none()}var D},JI=(r,c,f,m,x,y,E)=>{const D=m===1,A=!D||Uy(r);return kr(qe(r,P=>{switch(P.type){case"separator":return(U=P,Rr("Autocompleter.Separator",pI,U)).fold(im,B=>O.some(QE(B)));case"cardmenuitem":return(B=>Rr("cardmenuitem",f6,B))(P).fold(im,B=>O.some(((K,oe,ne,ge)=>{const he={dom:RI(K.label),optComponents:[O.some({dom:{tag:"div",classes:[Ny,Fy]},components:mD(K.items,ge)})]};return wx({data:Sx({text:O.none(),...K}),enabled:K.enabled,getApi:Le=>({isEnabled:()=>!Ho.isDisabled(Le),setEnabled:fe=>{Ho.set(Le,!fe),mt(ba(Le.element,"*"),de=>{Le.getSystem().getByDom(de).each(be=>{be.hasConfigured(Ho)&&Ho.set(be,!fe)})})}}),onAction:K.onAction,onSetup:K.onSetup,triggersSubmenu:!1,itemBehaviours:O.from(ge.itemBehaviours).getOr([])},he,oe,ne.providers)})({...B,onAction:K=>{B.onAction(K),f(B.value,B.meta)}},x,y,{itemBehaviours:OI(B.meta,y,O.none()),cardText:{matchText:c,highlightOn:E}})));default:return(B=>Rr("Autocompleter.Item",n6,B))(P).fold(im,B=>O.some(((K,oe,ne,ge,he,Le,fe,de=!0)=>{const be=Zy({presets:ge,textContent:O.none(),htmlContent:ne?K.text.map(ke=>hD(ke,oe)):O.none(),ariaLabel:K.text,iconContent:K.icon,shortcutContent:O.none(),checkMark:O.none(),caret:O.none(),value:K.value},fe.providers,de,K.icon),Te=K.text.filter(ke=>!ne&&ke!=="");return wx({data:Sx(K),enabled:K.enabled,getApi:Y({}),onAction:ke=>he(K.value,K.meta),onSetup:Y(j),triggersSubmenu:!1,itemBehaviours:OI(K,fe,Te)},be,Le,fe.providers)})(B,c,D,"normal",f,x,y,A)))}var U}))},ND=(r,c,f,m,x,y)=>{const E=Uy(c),D=kr(qe(c,P=>{const U=B=>qd(B,f,m,(K=>x?!On(K,"text"):E)(B),x);return P.type==="nestedmenuitem"&&P.getSubmenuItems().length<=0?U({...P,enabled:!1}):U(P)})),A=(P=>P.searchMode==="no-search"?{menuType:"normal"}:{menuType:"searchable",searchMode:P})(y);return(x?J5:X2)(r,E,D,1,A)},tC=r=>mp.singleData(r.value,r),A6=r=>Wc(Ie(r.startContainer),r.startOffset,Ie(r.endContainer),r.endOffset),FD=(r,c)=>{const f=Zn("autocompleter"),m=ho(!1),x=ho(!1),y=nr(),E=Qi(ri.sketch({dom:{tag:"div",classes:["tox-autocompleter"],attributes:{id:f}},components:[],fireDismissalEventInstead:{},inlineBehaviours:tn([Qo("dismissAutocompleter",[Ft(Fd(),()=>B()),Ft(rn(),(ne,ge)=>{Di(ge.event.target,"id").each(he=>Eo(Ie(r.getBody()),"aria-activedescendant",he))})])]),lazySink:c.getSink})),D=()=>ri.isOpen(E),A=x.get,P=()=>{if(D()){ri.hide(E),r.dom.remove(f,!1);const ne=Ie(r.getBody());Di(ne,"aria-owns").filter(ge=>ge===f).each(()=>{Lr(ne,"aria-owns"),Lr(ne,"aria-activedescendant")})}},U=()=>ri.getContent(E).bind(ne=>It(ne.components(),0)),B=()=>r.execCommand("mceAutocompleterClose"),K=ne=>{const ge=(he=>{const Le=Kn(he,fe=>O.from(fe.columns)).getOr(1);return Rn(he,fe=>{const de=fe.items;return JI(de,fe.matchText,(be,Te)=>{const ke={hide:()=>B(),reload:Ke=>{P(),r.execCommand("mceAutocompleterReload",!1,{fetchOptions:Ke})}};r.execCommand("mceAutocompleterRefreshActiveRange"),y.get().each(Ke=>{m.set(!0),fe.onAction(ke,Ke,be,Te),m.set(!1)})},Le,ah.BUBBLE_TO_SANDBOX,c,fe.highlightOn)})})(ne);ge.length>0?(((he,Le)=>{const fe=Kn(he,de=>O.from(de.columns)).getOr(1);ri.showMenuAt(E,{anchor:{type:"selection",getSelection:()=>y.get().map(A6),root:Ie(r.getBody())}},((de,be,Te,ke)=>{const Ke=tw(be,ke),dt=hb(ke);return{data:tC({...de,movement:Ke,menuBehaviours:jy(be!=="auto"?[]:[zr((zt,Wt)=>{uD(zt,4,dt.item).each(({numColumns:en,numRows:xn})=>{uo.setGridSize(zt,xn,en)})})])}),menu:{markers:hb(ke),fakeFocus:Te===eC.ContentFocus}}})(X2("autocompleter-value",!0,Le,fe,{menuType:"normal"}),fe,eC.ContentFocus,"normal")),U().each(or.highlightFirst)})(ne,ge),Eo(Ie(r.getBody()),"aria-owns",f),r.inline||oe()):P()},oe=()=>{r.dom.get(f)&&r.dom.remove(f,!1);const ne=r.getDoc().documentElement,ge=r.selection.getNode(),he=(Le=>D1(Le,!0))(E.element);tc(he,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",top:`${ge.offsetTop}px`,left:`${ge.offsetLeft}px`}),r.dom.add(ne,he.dom),si(he,'[role="menu"]').each(Le=>{us(Le,"position"),us(Le,"max-height")})};r.on("AutocompleterStart",({lookupData:ne})=>{x.set(!0),m.set(!1),K(ne)}),r.on("AutocompleterUpdate",({lookupData:ne})=>K(ne)),r.on("AutocompleterUpdateActiveRange",({range:ne})=>y.set(ne)),r.on("AutocompleterEnd",()=>{P(),x.set(!1),m.set(!1),y.clear()}),((ne,ge)=>{const he=(fe,de)=>{so(fe,Jn(),{raw:de})},Le=()=>ne.getMenu().bind(or.getHighlighted);ge.on("keydown",fe=>{const de=fe.which;ne.isActive()&&(ne.isMenuOpen()?de===13?(Le().each(id),fe.preventDefault()):de===40?(Le().fold(()=>{ne.getMenu().each(or.highlightFirst)},be=>{he(be,fe)}),fe.preventDefault(),fe.stopImmediatePropagation()):de!==37&&de!==38&&de!==39||Le().each(be=>{he(be,fe),fe.preventDefault(),fe.stopImmediatePropagation()}):de!==13&&de!==38&&de!==40||ne.cancelIfNecessary())}),ge.on("NodeChange",()=>{!ne.isActive()||ne.isProcessingAction()||ge.queryCommandState("mceAutoCompleterInRange")||ne.cancelIfNecessary()})})({cancelIfNecessary:B,isMenuOpen:D,isActive:A,isProcessingAction:m.get,getMenu:U},r)},ow=(r,c,f)=>js(r,c,f).isSome(),QI=(r,c)=>{let f=null;return{cancel:()=>{f!==null&&(clearTimeout(f),f=null)},schedule:(...m)=>{f=setTimeout(()=>{r.apply(null,m),f=null},c)}}},eP=r=>{const c=r.raw;return c.touches===void 0||c.touches.length!==1?O.none():O.some(c.touches[0])},nC=(r,c)=>{const f={stopBackspace:!0,...c},m=(B=>{const K=nr(),oe=ho(!1),ne=QI(he=>{B.triggerEvent(T0(),he),oe.set(!0)},400),ge=wc([{key:Po(),value:he=>(eP(he).each(Le=>{ne.cancel();const fe={x:Le.clientX,y:Le.clientY,target:he.target};ne.schedule(he),oe.set(!1),K.set(fe)}),O.none())},{key:Js(),value:he=>(ne.cancel(),eP(he).each(Le=>{K.on(fe=>{((de,be)=>{const Te=Math.abs(de.clientX-be.x),ke=Math.abs(de.clientY-be.y);return Te>5||ke>5})(Le,fe)&&K.clear()})}),O.none())},{key:N(),value:he=>(ne.cancel(),K.get().filter(Le=>po(Le.target,he.target)).map(Le=>oe.get()?(he.prevent(),!1):B.triggerEvent(Gf(),he)))}]);return{fireIfReady:(he,Le)=>At(ge,Le).bind(fe=>fe(he))}})(f),x=qe(["touchstart","touchmove","touchend","touchcancel","gesturestart","mousedown","mouseup","mouseover","mousemove","mouseout","click"].concat(["selectstart","input","contextmenu","change","transitionend","transitioncancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),B=>Rl(r,B,K=>{m.fireIfReady(K,B).each(oe=>{oe&&K.kill()}),f.triggerEvent(B,K)&&K.kill()})),y=nr(),E=Rl(r,"paste",B=>{m.fireIfReady(B,"paste").each(K=>{K&&B.kill()}),f.triggerEvent("paste",B)&&B.kill(),y.set(setTimeout(()=>{f.triggerEvent(za(),B)},0))}),D=Rl(r,"keydown",B=>{f.triggerEvent("keydown",B)?B.kill():f.stopBackspace&&(K=>K.raw.which===IR[0]&&!et(["input","textarea"],sn(K.target))&&!ow(K.target,'[contenteditable="true"]'))(B)&&B.prevent()}),A=Rl(r,"focusin",B=>{f.triggerEvent("focusin",B)&&B.kill()}),P=nr(),U=Rl(r,"focusout",B=>{f.triggerEvent("focusout",B)&&B.kill(),P.set(setTimeout(()=>{f.triggerEvent(Yr(),B)},0))});return{unbind:()=>{mt(x,B=>{B.unbind()}),D.unbind(),A.unbind(),U.unbind(),E.unbind(),y.on(clearTimeout),P.on(clearTimeout)}}},oC=(r,c)=>{const f=At(r,"target").getOr(c);return ho(f)},Dx=di([{stopped:[]},{resume:["element"]},{complete:[]}]),BD=(r,c,f,m,x,y)=>{const E=r(c,m),D=((A,P)=>{const U=ho(!1),B=ho(!1);return{stop:()=>{U.set(!0)},cut:()=>{B.set(!0)},isStopped:U.get,isCut:B.get,event:A,setSource:P.set,getSource:P.get}})(f,x);return E.fold(()=>(y.logEventNoHandlers(c,m),Dx.complete()),A=>{const P=A.descHandler;return _v(P)(D),D.isStopped()?(y.logEventStopped(c,A.element,P.purpose),Dx.stopped()):D.isCut()?(y.logEventCut(c,A.element,P.purpose),Dx.complete()):la(A.element).fold(()=>(y.logNoParent(c,A.element,P.purpose),Dx.complete()),U=>(y.logEventResponse(c,A.element,P.purpose),Dx.resume(U)))})},$D=(r,c,f,m,x,y)=>BD(r,c,f,m,x,y).fold(Oe,E=>$D(r,c,f,E,x,y),ve),tP=(r,c,f,m,x)=>{const y=oC(f,m);return $D(r,c,f,m,y,x)},HD=()=>{const r=(()=>{const m={};return{registerId:(x,y,E)=>{Cn(E,(D,A)=>{const P=m[A]!==void 0?m[A]:{};P[y]=((U,B)=>({cHandler:Ce.apply(void 0,[U.handler].concat(B)),purpose:U.purpose}))(D,x),m[A]=P})},unregisterId:x=>{Cn(m,(y,E)=>{On(y,x)&&delete y[x]})},filterByType:x=>At(m,x).map(y=>xt(y,(E,D)=>((A,P)=>({id:A,descHandler:P}))(D,E))).getOr([]),find:(x,y,E)=>At(m,y).bind(D=>Gc(E,A=>((P,U)=>Uh(U).bind(B=>At(P,B)).map(B=>((K,oe)=>({element:K,descHandler:oe}))(U,B)))(D,A),x))}})(),c={},f=m=>{Uh(m.element).each(x=>{delete c[x],r.unregisterId(x)})};return{find:(m,x,y)=>r.find(m,x,y),filter:m=>r.filterByType(m),register:m=>{const x=(E=>{const D=E.element;return Uh(D).getOrThunk(()=>((A,P)=>{const U=Zn(ug+"uid-");return B0(P,U),U})(0,E.element))})(m);In(c,x)&&((E,D)=>{const A=c[D];if(A!==E)throw new Error('The tagId "'+D+'" is already used by: '+Pu(A.element)+`
Cannot use it for: `+Pu(E.element)+`
The conflicting element is`+(Nr(A.element)?" ":" not ")+"already in the DOM");f(E)})(m,x);const y=[m];r.registerId(y,x,m.events),c[x]=m},unregister:f,getById:m=>At(c,m)}},Af=fd({name:"Container",factory:r=>{const{attributes:c,...f}=r.dom;return{uid:r.uid,dom:{tag:"div",attributes:{role:"presentation",...c},...f},components:r.components,behaviours:go(r.containerBehaviours),events:r.events,domModification:r.domModification,eventOrder:r.eventOrder}},configFields:[lt("components",[]),vn("containerBehaviours",[]),lt("events",{}),lt("domModification",{}),lt("eventOrder",{})]}),UD=r=>{const c=he=>la(r.element).fold(Oe,Le=>po(he,Le)),f=HD(),m=(he,Le)=>f.find(c,he,Le),x=nC(r.element,{triggerEvent:(he,Le)=>A1(he,Le.target,fe=>((de,be,Te,ke)=>tP(de,be,Te,Te.target,ke))(m,he,Le,fe))}),y={debugInfo:Y("real"),triggerEvent:(he,Le,fe)=>{A1(he,Le,de=>tP(m,he,fe,Le,de))},triggerFocus:(he,Le)=>{Uh(he).fold(()=>{$u(he)},fe=>{A1(Vo(),he,de=>(((be,Te,ke,Ke,dt)=>{const zt=oC(ke,Ke);BD(be,Te,ke,Ke,zt,dt)})(m,Vo(),{originator:Le,kill:j,prevent:j,target:he},he,de),!1))})},triggerEscape:(he,Le)=>{y.triggerEvent("keydown",he.element,Le.event)},getByUid:he=>ne(he),getByDom:he=>ge(he),build:Qi,buildOrPatch:N1,addToGui:he=>{A(he)},removeFromGui:he=>{P(he)},addToWorld:he=>{E(he)},removeFromWorld:he=>{D(he)},broadcast:he=>{B(he)},broadcastOn:(he,Le)=>{K(he,Le)},broadcastEvent:(he,Le)=>{oe(he,Le)},isConnected:Oe},E=he=>{he.connect(y),Ko(he.element)||(f.register(he),mt(he.components(),E),y.triggerEvent(Nd(),he.element,{target:he.element}))},D=he=>{Ko(he.element)||(mt(he.components(),D),f.unregister(he)),he.disconnect()},A=he=>{Ef(r,he)},P=he=>{oc(he)},U=he=>{const Le=f.filter(Au());mt(Le,fe=>{const de=fe.descHandler;_v(de)(he)})},B=he=>{U({universal:!0,data:he})},K=(he,Le)=>{U({universal:!1,channels:he,data:Le})},oe=(he,Le)=>((fe,de,be)=>{const Te=(ke=>{const Ke=ho(!1);return{stop:()=>{Ke.set(!0)},cut:j,isStopped:Ke.get,isCut:ve,event:ke,setSource:ot("Cannot set source of a broadcasted event"),getSource:ot("Cannot get source of a broadcasted event")}})(de);return mt(fe,ke=>{const Ke=ke.descHandler;_v(Ke)(Te)}),Te.isStopped()})(f.filter(he),Le),ne=he=>f.getById(he).fold(()=>os.error(new Error('Could not find component with uid: "'+he+'" in system.')),os.value),ge=he=>{const Le=Uh(he).getOr("not found");return ne(Le)};return E(r),{root:r,element:r.element,destroy:()=>{x.unbind(),ci(r.element)},add:A,remove:P,getByUid:ne,getByDom:ge,addToWorld:E,removeFromWorld:D,broadcast:B,broadcastOn:K,broadcastEvent:oe}},L6=Y([lt("prefix","form-field"),vn("fieldBehaviours",[Os,at])]),R6=Y([dd({schema:[Rt("dom")],name:"label"}),dd({factory:{sketch:r=>({uid:r.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:r.text}})},schema:[Rt("text")],name:"aria-descriptor"}),sc({factory:{sketch:r=>{const c=((f,m)=>{const x={};return Cn(f,(y,E)=>{et(m,E)||(x[E]=y)}),x})(r,["factory"]);return r.factory.sketch(c)}},schema:[Rt("factory")],name:"field"})]),sr=Dc({name:"FormField",configFields:L6(),partFields:R6(),factory:(r,c,f,m)=>{const x=eo(r.fieldBehaviours,[Os.config({find:D=>Br(D,r,"field")}),at.config({store:{mode:"manual",getValue:D=>Os.getCurrent(D).bind(at.getValue),setValue:(D,A)=>{Os.getCurrent(D).each(P=>{at.setValue(P,A)})}}})]),y=Ws([zr((D,A)=>{const P=vR(D,r,["label","field","aria-descriptor"]);P.field().each(U=>{const B=Zn(r.prefix);P.label().each(K=>{Eo(K.element,"for",B),Eo(U.element,"id",B)}),P["aria-descriptor"]().each(K=>{const oe=Zn(r.prefix);Eo(K.element,"id",oe),Eo(U.element,"aria-describedby",oe)})})})]),E={getField:D=>Br(D,r,"field"),getLabel:D=>Br(D,r,"label")};return{uid:r.uid,dom:r.dom,components:c,behaviours:x,events:y,apis:E}},apis:{getField:(r,c)=>r.getField(c),getLabel:(r,c)=>r.getLabel(c)}});var O6=tinymce.util.Tools.resolve("tinymce.html.Entities");const Cp=(r,c,f,m)=>{const x=sC(r,c,f,m);return sr.sketch(x)},sC=(r,c,f,m)=>({dom:VD(f),components:r.toArray().concat([c]),fieldBehaviours:tn(m)}),VD=r=>({tag:"div",classes:["tox-form__group"].concat(r)}),_p=(r,c)=>sr.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[Pr(c.translate(r))]}),Zu=Zn("form-component-change"),sw=Zn("form-close"),Vg=Zn("form-cancel"),cm=Zn("form-action"),Sb=Zn("form-submit"),rC=Zn("form-block"),iC=Zn("form-unblock"),aC=Zn("form-tabchange"),nP=Zn("form-resize"),oP=(r,c,f)=>{const m=r.label.map(B=>_p(B,c)),x=c.icons(),y=B=>(K,oe)=>{js(oe.event.target,"[data-collection-item-value]").each(ne=>{B(K,oe,ne,xi(ne,"data-collection-item-value"))})},E=y((B,K,oe,ne)=>{K.stop(),c.isDisabled()||so(B,cm,{name:r.name,value:ne})}),D=[Ft(Yn(),y((B,K,oe)=>{$u(oe)})),Ft(Dl(),E),Ft(Gf(),E),Ft(Co(),y((B,K,oe)=>{si(B.element,"."+rm).each(ne=>{hi(ne,rm)}),zi(oe,rm)})),Ft($o(),y(B=>{si(B.element,"."+rm).each(K=>{hi(K,rm),Jm(K)})})),Ud(y((B,K,oe,ne)=>{so(B,cm,{name:r.name,value:ne})}))],A=(B,K)=>qe(ba(B.element,".tox-collection__item"),K),P=sr.parts.field({dom:{tag:"div",classes:["tox-collection"].concat(r.columns!==1?["tox-collection--grid"]:["tox-collection--list"])},components:[],factory:{sketch:me},behaviours:tn([Ho.config({disabled:c.isDisabled,onDisabled:B=>{A(B,K=>{zi(K,"tox-collection__item--state-disabled"),Eo(K,"aria-disabled",!0)})},onEnabled:B=>{A(B,K=>{hi(K,"tox-collection__item--state-disabled"),Lr(K,"aria-disabled")})}}),Ia(),Do.config({}),Pl.config({...c.tooltips.getConfig({tooltipText:"",onShow:B=>{si(B.element,"."+rm+"[data-mce-tooltip]").each(K=>{Di(K,"data-mce-tooltip").each(oe=>{Pl.setComponents(B,c.tooltips.getComponents({tooltipText:oe}))})})}}),mode:"children-keyboard-focus",anchor:B=>({type:"node",node:si(B.element,"."+rm).orThunk(()=>hr(".tox-collection__item")),root:B.element,layouts:{onLtr:Y([Jr,ir,_a,ea,Ei,Wi]),onRtl:Y([Jr,ir,_a,ea,Ei,Wi])},bubble:Tc(0,-2,{})})}),at.config({store:{mode:"memory",initialValue:f.getOr([])},onSetValue:(B,K)=>{((oe,ne)=>{const ge=qe(ne,fe=>{const de=bd.translate(fe.text),be=r.columns===1?`<div class="tox-collection__item-label">${de}</div>`:"",Te=`<div class="tox-collection__item-icon">${(dt=>{var zt;return(zt=x[dt])!==null&&zt!==void 0?zt:dt})(fe.icon)}</div>`,ke={_:" "," - ":" ","-":" "},Ke=de.replace(/\_| \- |\-/g,dt=>ke[dt]);return`<div data-mce-tooltip="${Ke}" class="tox-collection__item${c.isDisabled()?" tox-collection__item--state-disabled":""}" tabindex="-1" data-collection-item-value="${O6.encodeAllRaw(fe.value)}" aria-label="${Ke}">${Te}${be}</div>`}),he=r.columns!=="auto"&&r.columns>1?it(ge,r.columns):[ge],Le=qe(he,fe=>`<div class="tox-collection__group">${fe.join("")}</div>`);Iu(oe.element,Le.join(""))})(B,K),r.columns==="auto"&&uD(B,5,"tox-collection__item").each(({numRows:oe,numColumns:ne})=>{uo.setGridSize(B,oe,ne)}),rs(B,nP)}}),Mr.config({}),uo.config((U=r.columns,U===1?{mode:"menu",moveOnTab:!1,selector:".tox-collection__item"}:U==="auto"?{mode:"flatgrid",selector:".tox-collection__item",initSize:{numColumns:1,numRows:1}}:{mode:"matrix",selectors:{row:".tox-collection__group",cell:`.${RE}`}})),Qo("collection-events",D)]),eventOrder:{[pr()]:["disabling","alloy.base.behaviour","collection-events"],[Co()]:["collection-events","tooltipping"]}});var U;return Cp(m,P,["tox-form__group--collection"],[])},I6=["input","textarea"],sP=r=>{const c=sn(r);return et(I6,c)},rP=(r,c)=>{const f=c.getRoot(r).getOr(r.element);hi(f,c.invalidClass),c.notify.each(m=>{sP(r.element)&&Eo(r.element,"aria-invalid",!1),m.getContainer(r).each(x=>{Iu(x,m.validHtml)}),m.onValid(r)})},zD=(r,c,f,m)=>{const x=c.getRoot(r).getOr(r.element);zi(x,c.invalidClass),c.notify.each(y=>{sP(r.element)&&Eo(r.element,"aria-invalid",!0),y.getContainer(r).each(E=>{Iu(E,m)}),y.onInvalid(r,m)})},iP=(r,c,f)=>c.validator.fold(()=>Ep(os.value(!0)),m=>m.validate(r)),GD=(r,c,f)=>(c.notify.each(m=>{m.onValidate(r)}),iP(r,c).map(m=>r.getSystem().isConnected()?m.fold(x=>(zD(r,c,0,x),os.error(x)),x=>(rP(r,c),os.value(x))):os.error("No longer in system")));var WD=Object.freeze({__proto__:null,markValid:rP,markInvalid:zD,query:iP,run:GD,isInvalid:(r,c)=>{const f=c.getRoot(r).getOr(r.element);return zl(f,c.invalidClass)}}),aP=Object.freeze({__proto__:null,events:(r,c)=>r.validator.map(f=>Ws([Ft(f.onEvent,m=>{GD(m,r).get(me)})].concat(f.validateOnLoad?[zr(m=>{GD(m,r).get(j)})]:[]))).getOr({})}),lP=[Rt("invalidClass"),lt("getRoot",O.none),ul("notify",[lt("aria","alert"),lt("getContainer",O.none),lt("validHtml",""),Rs("onValid"),Rs("onInvalid"),Rs("onValidate")]),ul("validator",[Rt("validate"),lt("onEvent","input"),lt("validateOnLoad",!0)])];const um=Mi({fields:lP,name:"invalidating",active:aP,apis:WD,extra:{validation:r=>c=>{const f=at.getValue(c);return Ep(r(f))}}}),Eb=Mi({fields:[],name:"unselecting",active:Object.freeze({__proto__:null,events:()=>Ws([Ir(Wo(),Oe)]),exhibit:()=>Ga({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})})}),cP=Zn("color-input-change"),uP=Zn("color-swatch-change"),dP=Zn("color-picker-cancel"),P6=dd({schema:[Rt("dom")],name:"label"}),zg=r=>dd({name:r+"-edge",overrides:c=>c.model.manager.edgeActions[r].fold(()=>({}),f=>({events:Ws([Lu(Po(),(m,x,y)=>f(m,y),[c]),Lu(ce(),(m,x,y)=>f(m,y),[c]),Lu(Ne(),(m,x,y)=>{y.mouseIsDown.get()&&f(m,y)},[c])])}))}),fP=zg("top-left"),jD=zg("top"),M6=zg("top-right"),lC=zg("right"),N6=zg("bottom-right"),F6=zg("bottom"),B6=zg("bottom-left"),$6=zg("left"),H6=sc({name:"thumb",defaults:Y({dom:{styles:{position:"absolute"}}}),overrides:r=>({events:Ws([Nh(Po(),r,"spectrum"),Nh(Js(),r,"spectrum"),Nh(N(),r,"spectrum"),Nh(ce(),r,"spectrum"),Nh(Ne(),r,"spectrum"),Nh(Kt(),r,"spectrum")])})}),cC=r=>em(r.event);var hP=[P6,$6,lC,jD,F6,fP,M6,B6,N6,H6,sc({schema:[Pi("mouseIsDown",()=>ho(!1))],name:"spectrum",overrides:r=>{const c=r.model.manager,f=(m,x)=>c.getValueFromEvent(x).map(y=>c.setValueFrom(m,r,y));return{behaviours:tn([uo.config({mode:"special",onLeft:(m,x)=>c.onLeft(m,r,cC(x)),onRight:(m,x)=>c.onRight(m,r,cC(x)),onUp:(m,x)=>c.onUp(m,r,cC(x)),onDown:(m,x)=>c.onDown(m,r,cC(x))}),Mr.config({}),Bo.config({})]),events:Ws([Ft(Po(),f),Ft(Js(),f),Ft(ce(),f),Ft(Ne(),(m,x)=>{r.mouseIsDown.get()&&f(m,x)})])}}})];const rw=Y("slider.change.value"),KD=r=>{const c=r.event.raw;if((f=>f.type.indexOf("touch")!==-1)(c)){const f=c;return f.touches!==void 0&&f.touches.length===1?O.some(f.touches[0]).map(m=>Sn(m.clientX,m.clientY)):O.none()}{const f=c;return f.clientX!==void 0?O.some(f).map(m=>Sn(m.clientX,m.clientY)):O.none()}},Tp=r=>r.model.minX,Yd=r=>r.model.minY,uC=r=>r.model.minX-1,dC=r=>r.model.minY-1,Dp=r=>r.model.maxX,Gg=r=>r.model.maxY,fC=r=>r.model.maxX+1,hC=r=>r.model.maxY+1,ZD=(r,c,f)=>c(r)-f(r),qD=r=>ZD(r,Dp,Tp),mC=r=>ZD(r,Gg,Yd),YD=r=>qD(r)/2,pC=r=>mC(r)/2,kx=(r,c)=>c?r.stepSize*r.speedMultiplier:r.stepSize,XD=r=>r.snapToGrid,mP=r=>r.snapStart,Ax=r=>r.rounded,gC=(r,c)=>r[c+"-edge"]!==void 0,pP=r=>gC(r,"left"),bC=r=>gC(r,"right"),vC=r=>gC(r,"top"),gP=r=>gC(r,"bottom"),ch=r=>r.model.value.get(),Wg=(r,c)=>({x:r,y:c}),Lf=(r,c)=>{so(r,rw(),{value:c})},iw=(r,c,f,m)=>r<c?r:r>f?f:r===c?c-1:Math.max(c,r-m),JD=(r,c,f,m)=>r>f?r:r<c?c:r===f?f+1:Math.min(f,r+m),bP=(r,c,f)=>Math.max(c,Math.min(f,r)),vP=r=>{const{min:c,max:f,range:m,value:x,step:y,snap:E,snapStart:D,rounded:A,hasMinEdge:P,hasMaxEdge:U,minBound:B,maxBound:K,screenRange:oe}=r,ne=P?c-1:c,ge=U?f+1:f;if(x<B)return ne;if(x>K)return ge;{const he=((fe,de,be)=>Math.min(be,Math.max(fe,de))-de)(x,B,K),Le=bP(he/oe*m+c,ne,ge);return E&&Le>=c&&Le<=f?((fe,de,be,Te,ke)=>ke.fold(()=>{const Ke=fe-de,dt=Math.round(Ke/Te)*Te;return bP(de+dt,de-1,be+1)},Ke=>{const dt=(fe-Ke)%Te,zt=Math.round(dt/Te),Wt=Math.floor((fe-Ke)/Te),en=Math.floor((be-Ke)/Te),xn=Ke+Math.min(en,Wt+zt)*Te;return Math.max(Ke,xn)}))(Le,c,f,y,D):A?Math.round(Le):Le}},xP=r=>{const{min:c,max:f,range:m,value:x,hasMinEdge:y,hasMaxEdge:E,maxBound:D,maxOffset:A,centerMinEdge:P,centerMaxEdge:U}=r;return x<c?y?0:P:x>f?E?D:U:(x-c)/m*A},QD="top",yP="right",wP="bottom",ek="left",dm=r=>r.element.dom.getBoundingClientRect(),Rf=(r,c)=>r[c],xC=r=>{const c=dm(r);return Rf(c,ek)},SP=r=>{const c=dm(r);return Rf(c,yP)},Lx=r=>{const c=dm(r);return Rf(c,QD)},EP=r=>{const c=dm(r);return Rf(c,wP)},CP=r=>{const c=dm(r);return Rf(c,"width")},_P=r=>{const c=dm(r);return Rf(c,"height")},tk=(r,c,f)=>(r+c)/2-f,TP=(r,c)=>{const f=dm(r),m=dm(c),x=Rf(f,ek),y=Rf(f,yP),E=Rf(m,ek);return tk(x,y,E)},DP=(r,c)=>{const f=dm(r),m=dm(c),x=Rf(f,QD),y=Rf(f,wP),E=Rf(m,QD);return tk(x,y,E)},yC=(r,c)=>{so(r,rw(),{value:c})},nk=(r,c,f)=>{const m={min:Tp(c),max:Dp(c),range:qD(c),value:f,step:kx(c),snap:XD(c),snapStart:mP(c),rounded:Ax(c),hasMinEdge:pP(c),hasMaxEdge:bC(c),minBound:xC(r),maxBound:SP(r),screenRange:CP(r)};return vP(m)},kP=r=>(c,f,m)=>((x,y,E,D)=>{const A=(x>0?JD:iw)(ch(E),Tp(E),Dp(E),kx(E,D));return yC(y,A),O.some(A)})(r,c,f,m).map(Oe),ok=(r,c,f,m,x,y)=>{const E=((D,A,P,U,B)=>{const K=CP(D),oe=U.bind(he=>O.some(TP(he,D))).getOr(0),ne=B.bind(he=>O.some(TP(he,D))).getOr(K),ge={min:Tp(A),max:Dp(A),range:qD(A),value:P,hasMinEdge:pP(A),hasMaxEdge:bC(A),minBound:xC(D),minOffset:0,maxBound:SP(D),maxOffset:K,centerMinEdge:oe,centerMaxEdge:ne};return xP(ge)})(c,y,f,m,x);return xC(c)-xC(r)+E},sk=kP(-1),U6=kP(1),V6=O.none,z6=O.none,G6={"top-left":O.none(),top:O.none(),"top-right":O.none(),right:O.some((r,c)=>{Lf(r,fC(c))}),"bottom-right":O.none(),bottom:O.none(),"bottom-left":O.none(),left:O.some((r,c)=>{Lf(r,uC(c))})};var W6=Object.freeze({__proto__:null,setValueFrom:(r,c,f)=>{const m=nk(r,c,f);return yC(r,m),m},setToMin:(r,c)=>{const f=Tp(c);yC(r,f)},setToMax:(r,c)=>{const f=Dp(c);yC(r,f)},findValueOfOffset:nk,getValueFromEvent:r=>KD(r).map(c=>c.left),findPositionOfValue:ok,setPositionFromValue:(r,c,f,m)=>{const x=ch(f),y=ok(r,m.getSpectrum(r),x,m.getLeftEdge(r),m.getRightEdge(r),f),E=ds(c.element)/2;Ro(c.element,"left",y-E+"px")},onLeft:sk,onRight:U6,onUp:V6,onDown:z6,edgeActions:G6});const wC=(r,c)=>{so(r,rw(),{value:c})},rk=(r,c,f)=>{const m={min:Yd(c),max:Gg(c),range:mC(c),value:f,step:kx(c),snap:XD(c),snapStart:mP(c),rounded:Ax(c),hasMinEdge:vC(c),hasMaxEdge:gP(c),minBound:Lx(r),maxBound:EP(r),screenRange:_P(r)};return vP(m)},AP=r=>(c,f,m)=>((x,y,E,D)=>{const A=(x>0?JD:iw)(ch(E),Yd(E),Gg(E),kx(E,D));return wC(y,A),O.some(A)})(r,c,f,m).map(Oe),ik=(r,c,f,m,x,y)=>{const E=((D,A,P,U,B)=>{const K=_P(D),oe=U.bind(he=>O.some(DP(he,D))).getOr(0),ne=B.bind(he=>O.some(DP(he,D))).getOr(K),ge={min:Yd(A),max:Gg(A),range:mC(A),value:P,hasMinEdge:vC(A),hasMaxEdge:gP(A),minBound:Lx(D),minOffset:0,maxBound:EP(D),maxOffset:K,centerMinEdge:oe,centerMaxEdge:ne};return xP(ge)})(c,y,f,m,x);return Lx(c)-Lx(r)+E},j6=O.none,K6=O.none,Z6=AP(-1),q6=AP(1),SC={"top-left":O.none(),top:O.some((r,c)=>{Lf(r,dC(c))}),"top-right":O.none(),right:O.none(),"bottom-right":O.none(),bottom:O.some((r,c)=>{Lf(r,hC(c))}),"bottom-left":O.none(),left:O.none()};var Y6=Object.freeze({__proto__:null,setValueFrom:(r,c,f)=>{const m=rk(r,c,f);return wC(r,m),m},setToMin:(r,c)=>{const f=Yd(c);wC(r,f)},setToMax:(r,c)=>{const f=Gg(c);wC(r,f)},findValueOfOffset:rk,getValueFromEvent:r=>KD(r).map(c=>c.top),findPositionOfValue:ik,setPositionFromValue:(r,c,f,m)=>{const x=ch(f),y=ik(r,m.getSpectrum(r),x,m.getTopEdge(r),m.getBottomEdge(r),f),E=Qe(c.element)/2;Ro(c.element,"top",y-E+"px")},onLeft:j6,onRight:K6,onUp:Z6,onDown:q6,edgeActions:SC});const Rx=(r,c)=>{so(r,rw(),{value:c})},EC=(r,c)=>({x:r,y:c}),CC=(r,c)=>(f,m,x)=>((y,E,D,A,P)=>{const U=y>0?JD:iw,B=E?ch(A).x:U(ch(A).x,Tp(A),Dp(A),kx(A,P)),K=E?U(ch(A).y,Yd(A),Gg(A),kx(A,P)):ch(A).y;return Rx(D,EC(B,K)),O.some(B)})(r,c,f,m,x).map(Oe),X6=CC(-1,!1),LP=CC(1,!1),J6=CC(-1,!0),ak=CC(1,!0),lk={"top-left":O.some((r,c)=>{Lf(r,Wg(uC(c),dC(c)))}),top:O.some((r,c)=>{Lf(r,Wg(YD(c),dC(c)))}),"top-right":O.some((r,c)=>{Lf(r,Wg(fC(c),dC(c)))}),right:O.some((r,c)=>{Lf(r,Wg(fC(c),pC(c)))}),"bottom-right":O.some((r,c)=>{Lf(r,Wg(fC(c),hC(c)))}),bottom:O.some((r,c)=>{Lf(r,Wg(YD(c),hC(c)))}),"bottom-left":O.some((r,c)=>{Lf(r,Wg(uC(c),hC(c)))}),left:O.some((r,c)=>{Lf(r,Wg(uC(c),pC(c)))})};var RP=Object.freeze({__proto__:null,setValueFrom:(r,c,f)=>{const m=nk(r,c,f.left),x=rk(r,c,f.top),y=EC(m,x);return Rx(r,y),y},setToMin:(r,c)=>{const f=Tp(c),m=Yd(c);Rx(r,EC(f,m))},setToMax:(r,c)=>{const f=Dp(c),m=Gg(c);Rx(r,EC(f,m))},getValueFromEvent:r=>KD(r),setPositionFromValue:(r,c,f,m)=>{const x=ch(f),y=ok(r,m.getSpectrum(r),x.x,m.getLeftEdge(r),m.getRightEdge(r),f),E=ik(r,m.getSpectrum(r),x.y,m.getTopEdge(r),m.getBottomEdge(r),f),D=ds(c.element)/2,A=Qe(c.element)/2;Ro(c.element,"left",y-D+"px"),Ro(c.element,"top",E-A+"px")},onLeft:X6,onRight:LP,onUp:J6,onDown:ak,edgeActions:lk});const yd=Dc({name:"Slider",configFields:[lt("stepSize",1),lt("speedMultiplier",10),lt("onChange",j),lt("onChoose",j),lt("onInit",j),lt("onDragStart",j),lt("onDragEnd",j),lt("snapToGrid",!1),lt("rounded",!0),ys("snapStart"),fa("model",Kr("mode",{x:[lt("minX",0),lt("maxX",100),Pi("value",r=>ho(r.mode.minX)),Rt("getInitialValue"),As("manager",W6)],y:[lt("minY",0),lt("maxY",100),Pi("value",r=>ho(r.mode.minY)),Rt("getInitialValue"),As("manager",Y6)],xy:[lt("minX",0),lt("maxX",100),lt("minY",0),lt("maxY",100),Pi("value",r=>ho({x:r.mode.minX,y:r.mode.minY})),Rt("getInitialValue"),As("manager",RP)]})),vn("sliderBehaviours",[uo,at]),Pi("mouseIsDown",()=>ho(!1))],partFields:hP,factory:(r,c,f,m)=>{const x=fe=>hp(fe,r,"thumb"),y=fe=>hp(fe,r,"spectrum"),E=fe=>Br(fe,r,"left-edge"),D=fe=>Br(fe,r,"right-edge"),A=fe=>Br(fe,r,"top-edge"),P=fe=>Br(fe,r,"bottom-edge"),U=r.model,B=U.manager,K=(fe,de)=>{B.setPositionFromValue(fe,de,r,{getLeftEdge:E,getRightEdge:D,getTopEdge:A,getBottomEdge:P,getSpectrum:y})},oe=(fe,de)=>{U.value.set(de);const be=x(fe);K(fe,be)},ne=fe=>{const de=r.mouseIsDown.get();r.mouseIsDown.set(!1),de&&Br(fe,r,"thumb").each(be=>{const Te=U.value.get();r.onChoose(fe,be,Te)})},ge=(fe,de)=>{de.stop(),r.mouseIsDown.set(!0),r.onDragStart(fe,x(fe))},he=(fe,de)=>{de.stop(),r.onDragEnd(fe,x(fe)),ne(fe)},Le=fe=>{Br(fe,r,"spectrum").map(uo.focusIn)};return{uid:r.uid,dom:r.dom,components:c,behaviours:eo(r.sliderBehaviours,[uo.config({mode:"special",focusIn:Le}),at.config({store:{mode:"manual",getValue:fe=>U.value.get(),setValue:oe}}),pl.config({channels:{[Z()]:{onReceive:ne}}})]),events:Ws([Ft(rw(),(fe,de)=>{((be,Te)=>{oe(be,Te);const ke=x(be);r.onChange(be,ke,Te)})(fe,de.event.value)}),zr((fe,de)=>{const be=U.getInitialValue();U.value.set(be);const Te=x(fe);K(fe,Te);const ke=y(fe);r.onInit(fe,Te,ke,U.value.get())}),Ft(Po(),ge),Ft(N(),he),Ft(ce(),(fe,de)=>{Le(fe),ge(fe,de)}),Ft(Kt(),he)]),apis:{resetToMin:fe=>{B.setToMin(fe,r)},resetToMax:fe=>{B.setToMax(fe,r)},setValue:oe,refresh:K},domModification:{styles:{position:"relative"}}}},apis:{setValue:(r,c,f)=>{r.setValue(c,f)},resetToMin:(r,c)=>{r.resetToMin(c)},resetToMax:(r,c)=>{r.resetToMax(c)},refresh:(r,c)=>{r.refresh(c)}}}),Ox=Zn("rgb-hex-update"),ck=Zn("slider-update"),uh=Zn("palette-update"),_C="form",Q6=[vn("formBehaviours",[at])],OP=r=>"<alloy.field."+r+">",e8=(r,c)=>({uid:r.uid,dom:r.dom,components:c,behaviours:eo(r.formBehaviours,[at.config({store:{mode:"manual",getValue:f=>{const m=e2(f,r);return Nn(m,(x,y)=>x().bind(E=>{return D=Os.getCurrent(E),A=new Error(`Cannot find a current component to extract the value from for form part '${y}': `+Pu(E.element)),D.fold(()=>os.error(A),os.value);var D,A}).map(at.getValue))},setValue:(f,m)=>{Cn(m,(x,y)=>{Br(f,r,y).each(E=>{Os.getCurrent(E).each(D=>{at.setValue(D,x)})})})}}})]),apis:{getField:(f,m)=>Br(f,r,m).bind(Os.getCurrent)}}),Ix={getField:Cv((r,c,f)=>r.getField(c,f)),sketch:r=>{const c=(()=>{const y=[];return{field:(E,D)=>(y.push(E),XT(_C,OP(E),D)),record:Y(y)}})(),f=r(c),m=c.record(),x=qe(m,y=>sc({name:y,pname:OP(y)}));return oy(_C,Q6,x,e8,f)}},Px=Zn("valid-input"),IP=Zn("invalid-input"),uk=Zn("validating-input"),aw="colorcustom.rgb.",t8=(r,c,f,m)=>{const x=(U,B)=>um.config({invalidClass:c("invalid"),notify:{onValidate:K=>{so(K,uk,{type:U})},onValid:K=>{so(K,Px,{type:U,value:at.getValue(K)})},onInvalid:K=>{so(K,IP,{type:U,value:at.getValue(K)})}},validator:{validate:K=>{const oe=at.getValue(K),ne=B(oe)?os.value(!0):os.error(r("aria.input.invalid"));return Ep(ne)},validateOnLoad:!1}}),y=(U,B,K,oe,ne)=>{const ge=r(aw+"range"),he=sr.parts.label({dom:{tag:"label",attributes:{"aria-label":oe}},components:[Pr(K)]}),Le=sr.parts.field({data:ne,factory:vp,inputAttributes:{type:"text",...B==="hex"?{"aria-live":"polite"}:{}},inputClasses:[c("textfield")],inputBehaviours:tn([x(B,U),Mr.config({})]),onSetValue:be=>{um.isInvalid(be)&&um.run(be).get(j)}}),fe=[he,Le],de=B!=="hex"?[sr.parts["aria-descriptor"]({text:ge})]:[];return{dom:{tag:"div",attributes:{role:"presentation"}},components:fe.concat(de)}},E=(U,B)=>{const K=B.red,oe=B.green,ne=B.blue;at.setValue(U,{red:K,green:oe,blue:ne})},D=dr({dom:{tag:"div",classes:[c("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),A=(U,B)=>{D.getOpt(U).each(K=>{Ro(K.element,"background-color","#"+B.value)})};return fd({factory:()=>{const U={red:ho(O.some(255)),green:ho(O.some(255)),blue:ho(O.some(255)),hex:ho(O.some("ffffff"))},B=Te=>U[Te].get(),K=(Te,ke)=>{U[Te].set(ke)},oe=Te=>{const ke=Te.red,Ke=Te.green,dt=Te.blue;K("red",O.some(ke)),K("green",O.some(Ke)),K("blue",O.some(dt))},ne=(Te,ke)=>{const Ke=ke.event;Ke.type!=="hex"?K(Ke.type,O.none()):m(Te)},ge=(Te,ke)=>{const Ke=ke.event;(dt=>dt.type==="hex")(Ke)?((dt,zt)=>{f(dt);const Wt=pD(zt);K("hex",O.some(Wt.value));const en=Yy(Wt);E(dt,en),oe(en),so(dt,Ox,{hex:Wt}),A(dt,Wt)})(Te,Ke.value):((dt,zt,Wt)=>{const en=parseInt(Wt,10);K(zt,O.some(en)),B("red").bind(xn=>B("green").bind($n=>B("blue").map(ro=>Fg(xn,$n,ro,1)))).each(xn=>{const $n=((ro,xo)=>{const Zo=qy(xo);return Ix.getField(ro,"hex").each(ws=>{Bo.isFocused(ws)||at.setValue(ro,{hex:Zo.value})}),Zo})(dt,xn);so(dt,Ox,{hex:$n}),A(dt,$n)})})(Te,Ke.type,Ke.value)},he=Te=>({label:r(aw+Te+".label"),description:r(aw+Te+".description")}),Le=he("red"),fe=he("green"),de=he("blue"),be=he("hex");return Ze(Ix.sketch(Te=>({dom:{tag:"form",classes:[c("rgb-form")],attributes:{"aria-label":r("aria.color.picker")}},components:[Te.field("red",sr.sketch(y(VE,"red",Le.label,Le.description,255))),Te.field("green",sr.sketch(y(VE,"green",fe.label,fe.description,255))),Te.field("blue",sr.sketch(y(VE,"blue",de.label,de.description,255))),Te.field("hex",sr.sketch(y(II,"hex",be.label,be.description,"ffffff"))),D.asSpec()],formBehaviours:tn([um.config({invalidClass:c("form-invalid")}),Qo("rgb-form-events",[Ft(Px,ge),Ft(IP,ne),Ft(uk,ne)])])})),{apis:{updateHex:(Te,ke)=>{at.setValue(Te,{hex:ke.value}),((Ke,dt)=>{const zt=Yy(dt);E(Ke,zt),oe(zt)})(Te,ke),A(Te,ke)}}})},name:"RgbForm",configFields:[],apis:{updateHex:(U,B,K)=>{U.updateHex(B,K)}},extraApis:{}})},dk=(r,c)=>fd({name:"ColourPicker",configFields:[Rt("dom"),lt("onValidHex",j),lt("onInvalidHex",j)],factory:m=>{const x=t8(r,c,m.onValidHex,m.onInvalidHex),y=((ge,he)=>{const Le=yd.parts.spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[he("sv-palette-spectrum")]}}),fe=yd.parts.thumb({dom:{tag:"div",attributes:{role:"presentation"},classes:[he("sv-palette-thumb")],innerHtml:`<div class=${he("sv-palette-inner-thumb")} role="presentation"></div>`}}),de=(be,Te)=>{const{width:ke,height:Ke}=be,dt=be.getContext("2d");if(dt===null)return;dt.fillStyle=Te,dt.fillRect(0,0,ke,Ke);const zt=dt.createLinearGradient(0,0,ke,0);zt.addColorStop(0,"rgba(255,255,255,1)"),zt.addColorStop(1,"rgba(255,255,255,0)"),dt.fillStyle=zt,dt.fillRect(0,0,ke,Ke);const Wt=dt.createLinearGradient(0,0,0,Ke);Wt.addColorStop(0,"rgba(0,0,0,0)"),Wt.addColorStop(1,"rgba(0,0,0,1)"),dt.fillStyle=Wt,dt.fillRect(0,0,ke,Ke)};return fd({factory:be=>{const Te=Y({x:0,y:0}),ke=tn([Os.config({find:O.some}),Bo.config({})]);return yd.sketch({dom:{tag:"div",attributes:{role:"slider","aria-valuetext":ge(["Saturation {0}%, Brightness {1}%",0,0])},classes:[he("sv-palette")]},model:{mode:"xy",getInitialValue:Te},rounded:!1,components:[Le,fe],onChange:(Ke,dt,zt)=>{W(zt)||Eo(Ke.element,"aria-valuetext",ge(["Saturation {0}%, Brightness {1}%",Math.floor(zt.x),Math.floor(100-zt.y)])),so(Ke,uh,{value:zt})},onInit:(Ke,dt,zt,Wt)=>{de(zt.element.dom,xD(yD))},sliderBehaviours:ke})},name:"SaturationBrightnessPalette",configFields:[],apis:{setHue:(be,Te,ke)=>{((Ke,dt)=>{const zt=Ke.components()[0].element.dom,Wt=Xy(dt,100,100),en=MI(Wt);de(zt,xD(en))})(Te,ke)},setThumb:(be,Te,ke)=>{((Ke,dt)=>{const zt=ED(Yy(dt));yd.setValue(Ke,{x:zt.saturation,y:100-zt.value}),Eo(Ke.element,"aria-valuetext",ge(["Saturation {0}%, Brightness {1}%",zt.saturation,zt.value]))})(Te,ke)}},extraApis:{}})})(r,c),E={paletteRgba:ho(yD),paletteHue:ho(0)},D=dr(((ge,he)=>{const Le=yd.parts.spectrum({dom:{tag:"div",classes:[he("hue-slider-spectrum")],attributes:{role:"presentation"}}}),fe=yd.parts.thumb({dom:{tag:"div",classes:[he("hue-slider-thumb")],attributes:{role:"presentation"}}});return yd.sketch({dom:{tag:"div",classes:[he("hue-slider")],attributes:{role:"slider","aria-valuemin":0,"aria-valuemax":360,"aria-valuenow":120}},rounded:!1,model:{mode:"y",getInitialValue:Y(0)},components:[Le,fe],sliderBehaviours:tn([Bo.config({})]),onChange:(de,be,Te)=>{Eo(de.element,"aria-valuenow",Math.floor(360-3.6*Te)),so(de,ck,{value:Te})}})})(0,c)),A=dr(y.sketch({})),P=dr(x.sketch({})),U=(ge,he,Le)=>{A.getOpt(ge).each(fe=>{y.setHue(fe,Le)})},B=(ge,he)=>{P.getOpt(ge).each(Le=>{x.updateHex(Le,he)})},K=(ge,he,Le)=>{D.getOpt(ge).each(fe=>{yd.setValue(fe,(de=>100-de/360*100)(Le))})},oe=(ge,he)=>{A.getOpt(ge).each(Le=>{y.setThumb(Le,he)})},ne=(ge,he,Le,fe)=>{((de,be)=>{const Te=Yy(de);E.paletteRgba.set(Te),E.paletteHue.set(be)})(he,Le),mt(fe,de=>{de(ge,he,Le)})};return{uid:m.uid,dom:m.dom,components:[A.asSpec(),D.asSpec(),P.asSpec()],behaviours:tn([Qo("colour-picker-events",[Ft(Ox,(()=>{const ge=[U,K,oe];return(he,Le)=>{const fe=Le.event.hex,de=(be=>ED(Yy(be)))(fe);ne(he,fe,de.hue,ge)}})()),Ft(uh,(()=>{const ge=[B];return(he,Le)=>{const fe=Le.event.value,de=E.paletteHue.get(),be=Xy(de,fe.x,100-fe.y),Te=FI(be);ne(he,Te,de,ge)}})()),Ft(ck,(()=>{const ge=[U,B];return(he,Le)=>{const fe=(Ke=>(100-Ke)/100*360)(Le.event.value),de=E.paletteRgba.get(),be=ED(de),Te=Xy(fe,be.saturation,be.value),ke=FI(Te);ne(he,ke,fe,ge)}})())]),Os.config({find:ge=>P.getOpt(ge)}),uo.config({mode:"acyclic"})])}}}),fm=()=>Os.config({find:O.some}),fk=r=>Os.config({find:c=>qs(c.element,r).bind(f=>c.getSystem().getByDom(f).toOptional())}),PP=Wn([lt("preprocess",me),lt("postprocess",me)]),MP=(r,c)=>{const f=Ui("RepresentingConfigs.memento processors",PP,c);return at.config({store:{mode:"manual",getValue:m=>{const x=r.get(m),y=at.getValue(x);return f.postprocess(y)},setValue:(m,x)=>{const y=f.preprocess(x),E=r.get(m);at.setValue(E,y)}}})},Cb=(r,c,f)=>at.config({store:{mode:"manual",...r.map(m=>({initialValue:m})).getOr({}),getValue:c,setValue:f}}),NP=(r,c,f)=>Cb(r,m=>c(m.element),(m,x)=>f(m.element,x)),TC=r=>at.config({store:{mode:"memory",initialValue:r}}),n8={"colorcustom.rgb.red.label":"R","colorcustom.rgb.red.description":"Red component","colorcustom.rgb.green.label":"G","colorcustom.rgb.green.description":"Green component","colorcustom.rgb.blue.label":"B","colorcustom.rgb.blue.description":"Blue component","colorcustom.rgb.hex.label":"#","colorcustom.rgb.hex.description":"Hex color code","colorcustom.rgb.range":"Range 0 to 255","aria.color.picker":"Color Picker","aria.input.invalid":"Invalid input"};var o8=tinymce.util.Tools.resolve("tinymce.Resource");const FP=r=>On(r,"init");var hm=tinymce.util.Tools.resolve("tinymce.util.Tools");const DC=(r,c)=>{let f=null;const m=()=>{T(f)||(clearTimeout(f),f=null)};return{cancel:m,throttle:(...x)=>{m(),f=setTimeout(()=>{f=null,r.apply(null,x)},c)}}},hk=Zn("alloy-fake-before-tabstop"),kC=Zn("alloy-fake-after-tabstop"),Mx=r=>({dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:r},behaviours:tn([Bo.config({ignore:!0}),Mr.config({})])}),mk=(r,c)=>({dom:{tag:"div",classes:["tox-navobj",...r.getOr([])]},components:[Mx([hk]),c,Mx([kC])],behaviours:tn([fk(1)])}),BP=(r,c)=>{so(r,Jn(),{raw:{which:9,shiftKey:c}})},s8=(r,c)=>{const f=c.element;zl(f,hk)?BP(r,!0):zl(f,kC)&&BP(r,!1)},Nx=r=>ow(r,["."+hk,"."+kC].join(","),ve),AC=Zn("update-dialog"),$P=Zn("update-title"),pk=Zn("update-body"),gk=Zn("update-footer"),bk=Zn("body-send-message"),lw=Zn("dialog-focus-shifted"),vk=da().browser,cw=vk.isSafari(),HP=vk.isFirefox(),LC=cw||HP,xk=vk.isChromium(),UP=({scrollTop:r,scrollHeight:c,clientHeight:f})=>Math.ceil(r)+f>=c,yk=(r,c)=>r.scrollTo(0,c==="bottom"?99999999:c),wk=(r,c,f)=>{const m=r.dom;O.from(m.contentDocument).fold(f,x=>{let y=0;const E=((A,P)=>{const U=A.body;return O.from(!/^<!DOCTYPE (html|HTML)/.test(P)&&(!xk&&!cw||z(U)&&(U.scrollTop!==0||Math.abs(U.scrollHeight-U.clientHeight)>1))?U:A.documentElement)})(x,c).map(A=>(y=A.scrollTop,A)).forall(UP),D=()=>{const A=m.contentWindow;z(A)&&(E?yk(A,"bottom"):!E&&LC&&y!==0&&yk(A,y))};cw&&m.addEventListener("load",D,{once:!0}),x.open(),x.write(c),x.close(),cw||D()})},r8=qo(LC,cw?500:200).map(r=>((c,f)=>{let m=null,x=null;return{cancel:()=>{T(m)||(clearTimeout(m),m=null,x=null)},throttle:(...y)=>{x=y,T(m)&&(m=setTimeout(()=>{const E=x;m=null,x=null,c.apply(null,E)},f))}}})(wk,r)),RC=Zn("toolbar.button.execute"),_b=Zn("common-button-display-events"),Sk={[pr()]:["disabling","alloy.base.behaviour","toggling","toolbar-button-events","tooltipping"],[Sc()]:["toolbar-button-events",_b],[kl()]:["toolbar-button-events","dropdown-events","tooltipping"],[ce()]:["focusing","alloy.base.behaviour",_b]},OC=r=>Ro(r.element,"width",Fr(r.element,"width")),jg=(r,c,f)=>vd(r,{tag:"span",classes:["tox-icon","tox-tbtn__icon-wrap"],behaviours:f},c),Ek=(r,c)=>jg(r,c,[]),mm=(r,c)=>jg(r,c,[Do.config({})]),uw=(r,c,f)=>({dom:{tag:"span",classes:[`${c}__select-label`]},components:[Pr(f.translate(r))],behaviours:tn([Do.config({})])}),Xd=Zn("update-menu-text"),Kg=Zn("update-menu-icon"),IC=(r,c,f,m)=>{const x=ho(j),y=r.text.map(ne=>dr(uw(ne,c,f.providers))),E=r.icon.map(ne=>dr(mm(ne,f.providers.icons))),D=(ne,ge)=>{const he=at.getValue(ne);return Bo.focus(he),so(he,"keydown",{raw:ge.event.raw}),xd.close(he),O.some(!0)},A=r.role.fold(()=>({}),ne=>({role:ne})),P=r.ariaLabel.fold(()=>({}),ne=>({"aria-label":f.providers.translate(ne)})),U=vd("chevron-down",{tag:"div",classes:[`${c}__select-chevron`]},f.providers.icons),B=Zn("common-button-display-events"),K="dropdown-events";return dr(xd.sketch({...r.uid?{uid:r.uid}:{},...A,dom:{tag:"button",classes:[c,`${c}--select`].concat(qe(r.classes,ne=>`${c}--${ne}`)),attributes:{...P,...z(m)?{"data-mce-name":m}:{}}},components:yx([E.map(ne=>ne.asSpec()),y.map(ne=>ne.asSpec()),O.some(U)]),matchWidth:!0,useMinWidth:!0,onOpen:(ne,ge,he)=>{r.searchable&&(Le=>{aI(Le).each(fe=>Bo.focus(fe))})(he)},dropdownBehaviours:tn([...r.dropdownBehaviours,vl(()=>r.disabled||f.providers.isDisabled()),Ia(),Eb.config({}),Do.config({}),...r.tooltip.map(ne=>Pl.config(f.providers.tooltips.getConfig({tooltipText:f.providers.translate(ne)}))).toArray(),Qo(K,[Mg(r,x),xp(r,x)]),Qo(B,[zr((ne,ge)=>OC(ne))]),Qo("menubutton-update-display-text",[Ft(Xd,(ne,ge)=>{y.bind(he=>he.getOpt(ne)).each(he=>{Do.set(he,[Pr(f.providers.translate(ge.event.text))])})}),Ft(Kg,(ne,ge)=>{E.bind(he=>he.getOpt(ne)).each(he=>{Do.set(he,[mm(ge.event.icon,f.providers.icons)])})})])]),eventOrder:Ze(Sk,{[ce()]:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"],[Sc()]:["toolbar-button-events",Pl.name(),K,B]}),sandboxBehaviours:tn([uo.config({mode:"special",onLeft:D,onRight:D}),Qo("dropdown-sandbox-events",[Ft(sI,(ne,ge)=>{(he=>{const Le=at.getValue(he),fe=By(he).map(lI);xd.refetch(Le).get(()=>{const de=ji.getCoupled(Le,"sandbox");fe.each(be=>By(de).each(Te=>((ke,Ke)=>{at.setValue(ke,Ke.fetchPattern),ke.element.dom.selectionStart=Ke.selectionStart,ke.element.dom.selectionEnd=Ke.selectionEnd})(Te,be)))})})(ne),ge.stop()}),Ft(rI,(ne,ge)=>{((he,Le)=>{(fe=>_.getState(fe).bind(or.getHighlighted).bind(or.getHighlighted))(he).each(fe=>{((de,be,Te,ke)=>{const Ke={...ke,target:be};de.getSystem().triggerEvent(Te,be,Ke)})(he,fe.element,Le.event.eventType,Le.event.interactionEvent)})})(ne,ge),ge.stop()})])]),lazySink:f.getSink,toggleClass:`${c}--active`,parts:{menu:{...OE(0,r.columns,r.presets),fakeFocus:r.searchable,onHighlightItem:XI,onCollapseMenu:(ne,ge,he)=>{or.getHighlighted(he).each(Le=>{XI(ne,he,Le)})},onDehighlightItem:Ug}},getAnchorOverrides:()=>({maxHeightFunction:(ne,ge)=>{j1()(ne,ge-10)}}),fetch:ne=>$g(Ce(r.fetch,ne))})).asSpec()},Ck=r=>r.type==="separator",_k={type:"separator"},Tk=(r,c)=>{const f=((m,x)=>{const y=an(m,(E,D)=>(A=>h(A))(D)?D===""?E:D==="|"?E.length>0&&!Ck(E[E.length-1])?E.concat([_k]):E:On(x,D.toLowerCase())?E.concat([x[D.toLowerCase()]]):E:E.concat([D]),[]);return y.length>0&&Ck(y[y.length-1])&&y.pop(),y})(h(r)?r.split(" "):r,c);return vt(f,(m,x)=>{if((y=>On(y,"getSubmenuItems"))(x)){const y=(D=>{const A=At(D,"value").getOrThunk(()=>Zn("generated-menu-item"));return Ze({value:A},D)})(x),E=((D,A)=>{const P=D.getSubmenuItems(),U=Tk(P,A);return{item:D,menus:Ze(U.menus,{[D.value]:U.items}),expansions:Ze(U.expansions,{[D.value]:D.value})}})(y,c);return{menus:Ze(m.menus,E.menus),items:[E.item,...m.items],expansions:Ze(m.expansions,E.expansions)}}return{...m,items:[x,...m.items]}},{menus:{},expansions:{},items:[]})},Fx=(r,c,f,m)=>{const x=Zn("primary-menu"),y=Tk(r,f.shared.providers.menuItems());if(y.items.length===0)return O.none();const E=(B=>B.search.fold(()=>({searchMode:"no-search"}),K=>({searchMode:"search-with-field",placeholder:K.placeholder})))(m),D=ND(x,y.items,c,f,m.isHorizontalMenu,E),A=(B=>B.search.fold(()=>({searchMode:"no-search"}),K=>({searchMode:"search-with-results"})))(m),P=Nn(y.menus,(B,K)=>ND(K,B,c,f,!1,A)),U=Ze(P,nc(x,D));return O.from(mp.tieredData(x,U,y.expansions))},PC=r=>!On(r,"items"),Dk="data-value",kk=(r,c,f,m)=>qe(f,x=>PC(x)?{type:"togglemenuitem",text:x.text,value:x.value,active:x.value===m,onAction:()=>{at.setValue(r,x.value),so(r,Zu,{name:c}),Bo.focus(r)}}:{type:"nestedmenuitem",text:x.text,getSubmenuItems:()=>kk(r,c,x.items,m)}),MC=(r,c)=>Kn(r,f=>PC(f)?qo(f.value===c,f):MC(f.items,c)),i8=fd({name:"HtmlSelect",configFields:[Rt("options"),vn("selectBehaviours",[Bo,at]),lt("selectClasses",[]),lt("selectAttributes",{}),ys("data")],factory:(r,c)=>{const f=qe(r.options,x=>({dom:{tag:"option",value:x.value,innerHtml:x.text}})),m=r.data.map(x=>nc("initialValue",x)).getOr({});return{uid:r.uid,dom:{tag:"select",classes:r.selectClasses,attributes:r.selectAttributes},components:f,behaviours:eo(r.selectBehaviours,[Bo.config({}),at.config({store:{mode:"manual",getValue:x=>Kf(x.element),setValue:(x,y)=>{const E=Dn(r.options);J(r.options,D=>D.value===y).isSome()?Km(x.element,y):x.element.dom.selectedIndex===-1&&y===""&&E.each(D=>Km(x.element,D.value))},...m}})])}}}),VP=Y([lt("field1Name","field1"),lt("field2Name","field2"),jf("onLockedChange"),gf(["lockClass"]),lt("locked",!1),Hs("coupledFieldBehaviours",[Os,at])]),zP=(r,c)=>sc({factory:sr,name:r,overrides:f=>({fieldBehaviours:tn([Qo("coupled-input-behaviour",[Ft(Vr(),m=>{((x,y,E)=>Br(x,y,E).bind(Os.getCurrent))(m,f,c).each(x=>{Br(m,f,"lock").each(y=>{Mo.isOn(y)&&f.onLockedChange(m,x,y)})})})])])})}),a8=Y([zP("field1","field2"),zP("field2","field1"),sc({factory:Il,schema:[Rt("dom")],name:"lock",overrides:r=>({buttonBehaviours:tn([Mo.config({selected:r.locked,toggleClass:r.markers.lockClass,aria:{mode:"pressed"}})])})})]),wd=Dc({name:"FormCoupledInputs",configFields:VP(),partFields:a8(),factory:(r,c,f,m)=>({uid:r.uid,dom:r.dom,components:c,behaviours:lo(r.coupledFieldBehaviours,[Os.config({find:O.some}),at.config({store:{mode:"manual",getValue:x=>{const y=t2(x,r,["field1","field2"]);return{[r.field1Name]:at.getValue(y.field1()),[r.field2Name]:at.getValue(y.field2())}},setValue:(x,y)=>{const E=t2(x,r,["field1","field2"]);In(y,r.field1Name)&&at.setValue(E.field1(),y[r.field1Name]),In(y,r.field2Name)&&at.setValue(E.field2(),y[r.field2Name])}}})]),apis:{getField1:x=>Br(x,r,"field1"),getField2:x=>Br(x,r,"field2"),getLock:x=>Br(x,r,"lock")}}),apis:{getField1:(r,c)=>r.getField1(c),getField2:(r,c)=>r.getField2(c),getLock:(r,c)=>r.getLock(c)}}),Ak=r=>{const c=/^\s*(\d+(?:\.\d+)?)\s*(|cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vmin|vmax|%)\s*$/.exec(r);if(c!==null){const f=parseFloat(c[1]),m=c[2];return os.value({value:f,unit:m})}return os.error(r)},Lk=(r,c)=>{const f={"":96,px:96,pt:72,cm:2.54,pc:12,mm:25.4,in:1},m=x=>On(f,x);return r.unit===c?O.some(r.value):m(r.unit)&&m(c)?f[r.unit]===f[c]?O.some(r.value):O.some(r.value/f[r.unit]*f[c]):O.none()},Tb=r=>O.none(),Rk=(r,c)=>{const f=r.label.map(U=>_p(U,c)),m=[Ho.config({disabled:()=>r.disabled||c.isDisabled()}),Ia(),uo.config({mode:"execution",useEnter:r.multiline!==!0,useControlEnter:r.multiline===!0,execute:U=>(rs(U,Sb),O.some(!0))}),Qo("textfield-change",[Ft(Vr(),(U,B)=>{so(U,Zu,{name:r.name})}),Ft(za(),(U,B)=>{so(U,Zu,{name:r.name})})]),Mr.config({})],x=r.validation.map(U=>um.config({getRoot:B=>li(B.element),invalidClass:"tox-invalid",validator:{validate:B=>{const K=at.getValue(B),oe=U.validator(K);return Ep(oe===!0?os.value(K):os.error(oe))},validateOnLoad:U.validateOnLoad}})).toArray(),y={...r.placeholder.fold(Y({}),U=>({placeholder:c.translate(U)})),...r.inputMode.fold(Y({}),U=>({inputmode:U}))},E=sr.parts.field({tag:r.multiline===!0?"textarea":"input",...r.data.map(U=>({data:U})).getOr({}),inputAttributes:y,inputClasses:[r.classname],inputBehaviours:tn(Vn([m,x])),selectOnFocus:!1,factory:vp}),D=r.multiline?{dom:{tag:"div",classes:["tox-textarea-wrap"]},components:[E]}:E,A=(r.flex?["tox-form__group--stretched"]:[]).concat(r.maximized?["tox-form-group--maximize"]:[]),P=[Ho.config({disabled:()=>r.disabled||c.isDisabled(),onDisabled:U=>{sr.getField(U).each(Ho.disable)},onEnabled:U=>{sr.getField(U).each(Ho.enable)}}),Ia()];return Cp(f,D,A,P)},dw=(r,c)=>c.getAnimationRoot.fold(()=>r.element,f=>f(r)),kp=r=>r.dimension.property,Db=(r,c)=>r.dimension.getDimension(c),NC=(r,c)=>{const f=dw(r,c);Xr(f,[c.shrinkingClass,c.growingClass])},Ok=(r,c)=>{hi(r.element,c.openClass),zi(r.element,c.closedClass),Ro(r.element,kp(c),"0px"),al(r.element)},Bx=(r,c)=>{hi(r.element,c.closedClass),zi(r.element,c.openClass),us(r.element,kp(c))},GP=(r,c,f,m)=>{f.setCollapsed(),Ro(r.element,kp(c),Db(c,r.element)),NC(r,c),Ok(r,c),c.onStartShrink(r),c.onShrunk(r)},WP=(r,c,f,m)=>{const x=m.getOrThunk(()=>Db(c,r.element));f.setCollapsed(),Ro(r.element,kp(c),x),al(r.element);const y=dw(r,c);hi(y,c.growingClass),zi(y,c.shrinkingClass),Ok(r,c),c.onStartShrink(r)},jP=(r,c,f)=>{const m=Db(c,r.element);(m==="0px"?GP:WP)(r,c,f,O.some(m))},Ik=(r,c,f)=>{const m=dw(r,c),x=zl(m,c.shrinkingClass),y=Db(c,r.element);Bx(r,c);const E=Db(c,r.element);(x?()=>{Ro(r.element,kp(c),y),al(r.element)}:()=>{Ok(r,c)})(),hi(m,c.shrinkingClass),zi(m,c.growingClass),Bx(r,c),Ro(r.element,kp(c),E),f.setExpanded(),c.onStartGrow(r)},Pk=(r,c,f)=>{const m=dw(r,c);return zl(m,c.growingClass)===!0},KP=(r,c,f)=>{const m=dw(r,c);return zl(m,c.shrinkingClass)===!0};var ZP=Object.freeze({__proto__:null,refresh:(r,c,f)=>{if(f.isExpanded()){us(r.element,kp(c));const m=Db(c,r.element);Ro(r.element,kp(c),m)}},grow:(r,c,f)=>{f.isExpanded()||Ik(r,c,f)},shrink:(r,c,f)=>{f.isExpanded()&&jP(r,c,f)},immediateShrink:(r,c,f)=>{f.isExpanded()&&GP(r,c,f)},hasGrown:(r,c,f)=>f.isExpanded(),hasShrunk:(r,c,f)=>f.isCollapsed(),isGrowing:Pk,isShrinking:KP,isTransitioning:(r,c,f)=>Pk(r,c)||KP(r,c),toggleGrow:(r,c,f)=>{(f.isExpanded()?jP:Ik)(r,c,f)},disableTransitions:NC,immediateGrow:(r,c,f)=>{f.isExpanded()||(Bx(r,c),Ro(r.element,kp(c),Db(c,r.element)),NC(r,c),f.setExpanded(),c.onStartGrow(r),c.onGrown(r))}}),qP=Object.freeze({__proto__:null,exhibit:(r,c,f)=>{const m=c.expanded;return Ga(m?{classes:[c.openClass],styles:{}}:{classes:[c.closedClass],styles:nc(c.dimension.property,"0px")})},events:(r,c)=>Ws([Hm(cn(),(f,m)=>{m.event.raw.propertyName===r.dimension.property&&(NC(f,r),c.isExpanded()&&us(f.element,r.dimension.property),(c.isExpanded()?r.onGrown:r.onShrunk)(f))})])}),YP=[Rt("closedClass"),Rt("openClass"),Rt("shrinkingClass"),Rt("growingClass"),ys("getAnimationRoot"),Rs("onShrunk"),Rs("onStartShrink"),Rs("onGrown"),Rs("onStartGrow"),lt("expanded",!1),fa("dimension",Kr("property",{width:[As("property","width"),As("getDimension",r=>ds(r)+"px")],height:[As("property","height"),As("getDimension",r=>Qe(r)+"px")]}))];const Zc=Mi({fields:YP,name:"sliding",active:qP,apis:ZP,state:Object.freeze({__proto__:null,init:r=>{const c=ho(r.expanded);return Ec({isExpanded:()=>c.get()===!0,isCollapsed:()=>c.get()===!1,setCollapsed:Ce(c.set,!1),setExpanded:Ce(c.set,!0),readState:()=>"expanded: "+c.get()})}})}),XP=r=>({isEnabled:()=>!Ho.isDisabled(r),setEnabled:c=>Ho.set(r,!c),setActive:c=>{const f=r.element;c?(zi(f,"tox-tbtn--enabled"),Eo(f,"aria-pressed",!0)):(hi(f,"tox-tbtn--enabled"),Lr(f,"aria-pressed"))},isActive:()=>zl(r.element,"tox-tbtn--enabled"),setText:c=>{so(r,Xd,{text:c})},setIcon:c=>so(r,Kg,{icon:c})}),fw=(r,c,f,m,x=!0,y)=>IC({text:r.text,icon:r.icon,tooltip:r.tooltip,ariaLabel:r.tooltip,searchable:r.search.isSome(),role:m,fetch:(E,D)=>{const A={pattern:r.search.isSome()?k6(E):""};r.fetch(P=>{D(Fx(P,ah.CLOSE_ON_EXECUTE,f,{isHorizontalMenu:!1,search:r.search}))},A,XP(E))},onSetup:r.onSetup,getApi:XP,columns:1,presets:"normal",classes:[],dropdownBehaviours:[...x?[Mr.config({})]:[]]},c,f.shared,y),l8=(r,c,f)=>{const m=y=>E=>{const D=!E.isActive();E.setActive(D),y.storage.set(D),f.shared.getSink().each(A=>{c().getOpt(A).each(P=>{$u(P.element),so(P,cm,{name:y.name,value:y.storage.get()})})})},x=y=>E=>{E.setActive(y.storage.get())};return y=>{y(qe(r,E=>{const D=E.text.fold(()=>({}),A=>({text:A}));return{type:E.type,active:!1,...D,onAction:m(E),onSetup:x(E)}}))}},JP=r=>({dom:{tag:"span",classes:["tox-tree__label"],attributes:{"aria-label":r}},components:[Pr(r)]}),Mk=Zn("leaf-label-event-id"),FC=({leaf:r,onLeafAction:c,visible:f,treeId:m,selectedId:x,backstage:y})=>{const E=r.menu.map(A=>fw(A,"tox-mbtn",y,O.none(),f)),D=[JP(r.title)];return E.each(A=>D.push(A)),Il.sketch({dom:{tag:"div",classes:["tox-tree--leaf__label","tox-trbtn"].concat(f?["tox-tree--leaf__label--visible"]:[])},components:D,role:"treeitem",action:A=>{c(r.id),A.getSystem().broadcastOn([`update-active-item-${m}`],{value:r.id})},eventOrder:{[Jn()]:[Mk,"keying"]},buttonBehaviours:tn([...f?[Mr.config({})]:[],Mo.config({toggleClass:"tox-trbtn--enabled",toggleOnExecute:!1,aria:{mode:"selected"}}),pl.config({channels:{[`update-active-item-${m}`]:{onReceive:(A,P)=>{(P.value===r.id?Mo.on:Mo.off)(A)}}}}),Qo(Mk,[zr((A,P)=>{x.each(U=>{(U===r.id?Mo.on:Mo.off)(A)})}),Ft(Jn(),(A,P)=>{const U=P.event.raw.code==="ArrowLeft",B=P.event.raw.code==="ArrowRight";U?(vf(A.element,".tox-tree--directory").each(K=>{A.getSystem().getByDom(K).each(oe=>{kv(K,".tox-tree--directory__label").each(ne=>{oe.getSystem().getByDom(ne).each(Bo.focus)})})}),P.stop()):B&&P.stop()})])])})},QP=Zn("directory-label-event-id"),c8=({directory:r,visible:c,noChildren:f,backstage:m})=>{const x=r.menu.map(P=>fw(P,"tox-mbtn",m,O.none())),y=[{dom:{tag:"div",classes:["tox-chevron"]},components:[(E="chevron-right",D=m.shared.providers.icons,((P,U,B)=>vd(P,{tag:"span",classes:["tox-tree__icon-wrap","tox-icon"],behaviours:[]},U))(E,D))]},JP(r.title)];var E,D;x.each(P=>{y.push(P)});const A=P=>{vf(P.element,".tox-tree--directory").each(U=>{P.getSystem().getByDom(U).each(B=>{const K=!Mo.isOn(B);Mo.toggle(B),so(P,"expand-tree-node",{expanded:K,node:r.id})})})};return Il.sketch({dom:{tag:"div",classes:["tox-tree--directory__label","tox-trbtn"].concat(c?["tox-tree--directory__label--visible"]:[])},components:y,action:A,eventOrder:{[Jn()]:[QP,"keying"]},buttonBehaviours:tn([...c?[Mr.config({})]:[],Qo(QP,[Ft(Jn(),(P,U)=>{const B=U.event.raw.code==="ArrowRight",K=U.event.raw.code==="ArrowLeft";B&&f&&U.stop(),(B||K)&&vf(P.element,".tox-tree--directory").each(oe=>{P.getSystem().getByDom(oe).each(ne=>{!Mo.isOn(ne)&&B||Mo.isOn(ne)&&K?(A(P),U.stop()):K&&!Mo.isOn(ne)&&(vf(ne.element,".tox-tree--directory").each(ge=>{kv(ge,".tox-tree--directory__label").each(he=>{ne.getSystem().getByDom(he).each(Bo.focus)})}),U.stop())})})})])])})},u8=({children:r,onLeafAction:c,visible:f,treeId:m,expandedIds:x,selectedId:y,backstage:E})=>({dom:{tag:"div",classes:["tox-tree--directory__children"]},components:r.map(D=>D.type==="leaf"?FC({leaf:D,selectedId:y,onLeafAction:c,visible:f,treeId:m,backstage:E}):Nk({directory:D,expandedIds:x,selectedId:y,onLeafAction:c,labelTabstopping:f,treeId:m,backstage:E})),behaviours:tn([Zc.config({dimension:{property:"height"},closedClass:"tox-tree--directory__children--closed",openClass:"tox-tree--directory__children--open",growingClass:"tox-tree--directory__children--growing",shrinkingClass:"tox-tree--directory__children--shrinking",expanded:f}),Do.config({})])}),d8=Zn("directory-event-id"),Nk=({directory:r,onLeafAction:c,labelTabstopping:f,treeId:m,backstage:x,expandedIds:y,selectedId:E})=>{const{children:D}=r,A=ho(y),P=y.includes(r.id);return{dom:{tag:"div",classes:["tox-tree--directory"],attributes:{role:"treeitem"}},components:[c8({directory:r,visible:f,noChildren:r.children.length===0,backstage:x}),u8({children:D,expandedIds:y,selectedId:E,onLeafAction:c,visible:P,treeId:m,backstage:x})],behaviours:tn([Qo(d8,[zr((U,B)=>{Mo.set(U,P)}),Ft("expand-tree-node",(U,B)=>{const{expanded:K,node:oe}=B.event;A.set(K?[...A.get(),oe]:A.get().filter(ne=>ne!==oe))})]),Mo.config({...r.children.length>0?{aria:{mode:"expanded"}}:{},toggleClass:"tox-tree--directory--expanded",onToggled:(U,B)=>{const K=U.components()[1],oe=(ne=B,D.map(ge=>ge.type==="leaf"?FC({leaf:ge,selectedId:E,onLeafAction:c,visible:ne,treeId:m,backstage:x}):Nk({directory:ge,expandedIds:A.get(),selectedId:E,onLeafAction:c,labelTabstopping:ne,treeId:m,backstage:x})));var ne;B?Zc.grow(K):Zc.shrink(K),Do.set(K,oe)}})])}},f8=Zn("tree-event-id");var h8=Object.freeze({__proto__:null,events:(r,c)=>{const f=r.stream.streams.setup(r,c);return Ws([Ft(r.event,f),pf(()=>c.cancel())].concat(r.cancelEvent.map(m=>[Ft(m,()=>c.cancel())]).getOr([])))}});const BC=r=>{const c=ho(null);return Ec({readState:()=>({timer:c.get()!==null?"set":"unset"}),setTimer:f=>{c.set(f)},cancel:()=>{const f=c.get();f!==null&&f.cancel()}})};var eM=Object.freeze({__proto__:null,throttle:BC,init:r=>r.stream.streams.state(r)}),m8=[fa("stream",Kr("mode",{throttle:[Rt("delay"),lt("stopEvent",!0),As("streams",{setup:(r,c)=>{const f=r.stream,m=DC(r.onStream,f.delay);return c.setTimer(m),(x,y)=>{m.throttle(x,y),f.stopEvent&&y.stop()}},state:BC})]})),lt("event","input"),ys("cancelEvent"),jf("onStream")];const Fk=Mi({fields:m8,name:"streaming",active:h8,state:eM}),hw=(r,c,f)=>{const m=at.getValue(f);at.setValue(c,m),nM(c)},tM=(r,c)=>{const f=r.element,m=Kf(f),x=f.dom;xi(f,"type")!=="number"&&c(x,m)},nM=r=>{tM(r,(c,f)=>c.setSelectionRange(f.length,f.length))},$C=Y("alloy.typeahead.itemexecute"),oM=Y([ys("lazySink"),Rt("fetch"),lt("minChars",5),lt("responseTime",1e3),Rs("onOpen"),lt("getHotspot",O.some),lt("getAnchorOverrides",Y({})),lt("layouts",O.none()),lt("eventOrder",{}),Xs("model",{},[lt("getDisplayText",r=>r.meta!==void 0&&r.meta.text!==void 0?r.meta.text:r.value),lt("selectsOver",!0),lt("populateFromBrowse",!0)]),Rs("onSetValue"),Cc("onExecute"),Rs("onItemExecute"),lt("inputClasses",[]),lt("inputAttributes",{}),lt("inputStyles",{}),lt("matchWidth",!0),lt("useMinWidth",!1),lt("dismissOnBlur",!0),gf(["openClass"]),ys("initialData"),vn("typeaheadBehaviours",[Bo,at,Fk,uo,Mo,ji]),Pi("lazyTypeaheadComp",()=>ho(O.none)),Pi("previewing",()=>ho(!0))].concat(q5()).concat(MD())),sM=Y([_f({schema:[Ca()],name:"menu",overrides:r=>({fakeFocus:!0,onHighlightItem:(c,f,m)=>{r.previewing.get()?r.lazyTypeaheadComp.get().each(x=>{((y,E,D)=>{if(y.selectsOver){const A=at.getValue(E),P=y.getDisplayText(A),U=at.getValue(D);return y.getDisplayText(U).indexOf(P)===0?O.some(()=>{hw(0,E,D),((B,K)=>{tM(B,(oe,ne)=>oe.setSelectionRange(K,ne.length))})(E,P.length)}):O.none()}return O.none()})(r.model,x,m).fold(()=>{r.model.selectsOver?(or.dehighlight(f,m),r.previewing.set(!0)):r.previewing.set(!1)},y=>{y(),r.previewing.set(!1)})}):r.lazyTypeaheadComp.get().each(x=>{r.model.populateFromBrowse&&hw(r.model,x,m),Di(m.element,"id").each(y=>Eo(x.element,"aria-activedescendant",y))})},onExecute:(c,f)=>r.lazyTypeaheadComp.get().map(m=>(so(m,$C(),{item:f}),!0)),onHover:(c,f)=>{r.previewing.set(!1),r.lazyTypeaheadComp.get().each(m=>{r.model.populateFromBrowse&&hw(r.model,m,f)})}})})]),p8=Dc({name:"Typeahead",configFields:oM(),partFields:sM(),factory:(r,c,f,m)=>{const x=(B,K,oe)=>{r.previewing.set(!1);const ne=ji.getCoupled(B,"sandbox");if(_.isOpen(ne))Os.getCurrent(ne).each(ge=>{or.getHighlighted(ge).fold(()=>{oe(ge)},()=>{ad(ne,ge.element,"keydown",K)})});else{const ge=he=>{Os.getCurrent(he).each(oe)};nw(r,E(B),B,ne,m,ge,jl.HighlightMenuAndItem).get(j)}},y=Y5(r),E=B=>K=>K.map(oe=>{const ne=gn(oe.menus),ge=Rn(ne,he=>on(he.items,Le=>Le.type==="item"));return at.getState(B).update(qe(ge,he=>he.data)),oe}),D=B=>Os.getCurrent(B),A="typeaheadevents",P=[Bo.config({}),at.config({onSetValue:r.onSetValue,store:{mode:"dataset",getDataKey:B=>Kf(B.element),getFallbackEntry:B=>({value:B,meta:{}}),setValue:(B,K)=>{Km(B.element,r.model.getDisplayText(K))},...r.initialData.map(B=>nc("initialValue",B)).getOr({})}}),Fk.config({stream:{mode:"throttle",delay:r.responseTime,stopEvent:!1},onStream:(B,K)=>{const oe=ji.getCoupled(B,"sandbox");if(Bo.isFocused(B)&&Kf(B.element).length>=r.minChars){const ne=D(oe).bind(he=>or.getHighlighted(he).map(at.getValue));r.previewing.set(!0);const ge=he=>{D(oe).each(Le=>{ne.fold(()=>{r.model.selectsOver&&or.highlightFirst(Le)},fe=>{or.highlightBy(Le,de=>at.getValue(de).value===fe.value),or.getHighlighted(Le).orThunk(()=>(or.highlightFirst(Le),O.none()))})})};nw(r,E(B),B,oe,m,ge,jl.HighlightJustMenu).get(j)}},cancelEvent:cv()}),uo.config({mode:"special",onDown:(B,K)=>(x(B,K,or.highlightFirst),O.some(!0)),onEscape:B=>{const K=ji.getCoupled(B,"sandbox");return _.isOpen(K)?(_.close(K),O.some(!0)):O.none()},onUp:(B,K)=>(x(B,K,or.highlightLast),O.some(!0)),onEnter:B=>{const K=ji.getCoupled(B,"sandbox"),oe=_.isOpen(K);if(oe&&!r.previewing.get())return D(K).bind(ne=>or.getHighlighted(ne)).map(ne=>(so(B,$C(),{item:ne}),!0));{const ne=at.getValue(B);return rs(B,cv()),r.onExecute(K,B,ne),oe&&_.close(K),O.some(!0)}}}),Mo.config({toggleClass:r.markers.openClass,aria:{mode:"expanded"}}),ji.config({others:{sandbox:B=>PD(r,B,{onOpen:()=>Mo.on(B),onClose:()=>{r.lazyTypeaheadComp.get().each(K=>Lr(K.element,"aria-activedescendant")),Mo.off(B)}})}}),Qo(A,[zr(B=>{r.lazyTypeaheadComp.set(O.some(B))}),pf(B=>{r.lazyTypeaheadComp.set(O.none())}),Ud(B=>{const K=j;ID(r,E(B),B,m,K,jl.HighlightMenuAndItem).get(j)}),Ft($C(),(B,K)=>{const oe=ji.getCoupled(B,"sandbox");hw(r.model,B,K.event.item),rs(B,cv()),r.onItemExecute(B,oe,K.event.item,at.getValue(B)),_.close(oe),nM(B)})].concat(r.dismissOnBlur?[Ft(Yr(),B=>{const K=ji.getCoupled(B,"sandbox");Ll(K.element).isNone()&&_.close(K)})]:[]))],U={[kl()]:[at.name(),Fk.name(),A],...r.eventOrder};return{uid:r.uid,dom:oI(Ze(r,{inputAttributes:{role:"combobox","aria-autocomplete":"list","aria-haspopup":"true"}})),behaviours:{...y,...eo(r.typeaheadBehaviours,P)},eventOrder:U}}}),kb=r=>({...r,toCached:()=>kb(r.toCached()),bindFuture:c=>kb(r.bind(f=>f.fold(m=>Ep(os.error(m)),m=>c(m)))),bindResult:c=>kb(r.map(f=>f.bind(c))),mapResult:c=>kb(r.map(f=>f.map(c))),mapError:c=>kb(r.map(f=>f.mapError(c))),foldResult:(c,f)=>r.map(m=>m.fold(c,f)),withTimeout:(c,f)=>kb($g(m=>{let x=!1;const y=setTimeout(()=>{x=!0,m(os.error(f()))},c);r.get(E=>{x||(clearTimeout(y),m(E))})}))}),g8=r=>kb($g(r)),mw=(r,c,f=[],m,x,y,E)=>{const D=c.fold(()=>({}),U=>({action:U})),A={buttonBehaviours:tn([vl(()=>!r.enabled||E.isDisabled()),Ia(),Mr.config({}),...y.map(U=>Pl.config(E.tooltips.getConfig({tooltipText:E.translate(U)}))).toArray(),Qo("button press",[og("click"),og("mousedown")])].concat(f)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]},...D},P=Ze(A,{dom:m});return Ze(P,{components:x})},Bk=(r,c,f,m=[],x)=>{const y={tag:"button",classes:["tox-tbtn"],attributes:{...r.tooltip.map(A=>({"aria-label":f.translate(A)})).getOr({}),"data-mce-name":x}},E=r.icon.map(A=>Ek(A,f.icons)),D=yx([E]);return mw(r,c,m,y,D,r.tooltip,f)},$k=r=>{switch(r){case"primary":return["tox-button"];case"toolbar":return["tox-tbtn"];default:return["tox-button","tox-button--secondary"]}},rM=(r,c,f,m=[],x=[])=>{const y=f.translate(r.text),E=r.icon.map(B=>Ek(B,f.icons)),D=[E.getOrThunk(()=>Pr(y))],A=r.buttonType.getOr(r.primary||r.borderless?"primary":"secondary"),P={tag:"button",classes:[...$k(A),...E.isSome()?["tox-button--icon"]:[],...r.borderless?["tox-button--naked"]:[],...x],attributes:{"aria-label":y,"data-mce-name":r.text}},U=r.icon.map(Y(y));return mw(r,c,m,P,D,U,f)},iM=(r,c,f,m=[],x=[])=>{const y=rM(r,O.some(c),f,m,x);return Il.sketch(y)},aM=(r,c)=>f=>{c==="custom"?so(f,cm,{name:r,value:{}}):c==="submit"?rs(f,Sb):c==="cancel"?rs(f,Vg):console.error("Unknown button type: ",c)},HC=(r,c,f)=>{if(((m,x)=>x==="menu")(0,c)){const m=()=>E,x=r,y={...r,type:"menubutton",search:O.none(),onSetup:D=>(D.setEnabled(r.enabled),j),fetch:l8(x.items,m,f)},E=dr(fw(y,"tox-tbtn",f,O.none(),!0,r.text.or(r.tooltip).getOrUndefined()));return E.asSpec()}if(((m,x)=>x==="custom"||x==="cancel"||x==="submit")(0,c)){const m=aM(r.name,c),x={...r,borderless:!1};return iM(x,m,f.shared.providers,[])}if(((m,x)=>x==="togglebutton")(0,c))return((m,x,y)=>{var E,D;const A=m.icon.map(de=>mm(de,x.icons)).map(dr),P=m.buttonType.getOr(m.primary?"primary":"secondary"),U={...m,name:(E=m.name)!==null&&E!==void 0?E:"",primary:P==="primary",tooltip:m.tooltip,enabled:(D=m.enabled)!==null&&D!==void 0&&D,borderless:!1},B=U.tooltip.or(m.text).map(de=>({"aria-label":x.translate(de)})).getOr({}),K=$k(P??"secondary"),oe=m.icon.isSome()&&m.text.isSome(),ne={tag:"button",classes:[...K.concat(m.icon.isSome()?["tox-button--icon"]:[]),...m.active?["tox-button--enabled"]:[],...oe?["tox-button--icon-and-text"]:[]],attributes:{...B,...z(y)?{"data-mce-name":y}:{}}},ge=x.translate(m.text.getOr("")),he=Pr(ge),Le=[...yx([A.map(de=>de.asSpec())]),...m.text.isSome()?[he]:[]],fe=mw(U,O.some(de=>{so(de,cm,{name:m.name,value:{setIcon:be=>{A.map(Te=>Te.getOpt(de).each(ke=>{Do.set(ke,[mm(be,x.icons)])}))}}})}),[],ne,Le,m.tooltip,x);return Il.sketch(fe)})(r,f.shared.providers,r.text.or(r.tooltip).getOrUndefined());throw console.error("Unknown footer button type: ",c),new Error("Unknown footer button type")},b8={type:"separator"},lM=r=>({type:"menuitem",value:r.url,text:r.title,meta:{attach:r.attach},onAction:j}),UC=(r,c)=>({type:"menuitem",value:c,text:r,meta:{attach:void 0},onAction:j}),cM=(r,c)=>(f=>qe(f,lM))(((f,m)=>on(m,x=>x.type===f))(r,c)),v8=r=>cM("header",r.targets),x8=r=>cM("anchor",r.targets),qu=r=>O.from(r.anchorTop).map(c=>UC("<top>",c)).toArray(),dh=r=>O.from(r.anchorBottom).map(c=>UC("<bottom>",c)).toArray(),Hk=(r,c)=>{const f=r.toLowerCase();return on(c,m=>{var x;const y=m.meta!==void 0&&m.meta.text!==void 0?m.meta.text:m.text,E=(x=m.value)!==null&&x!==void 0?x:"";return Ar(y.toLowerCase(),f)||Ar(E.toLowerCase(),f)})},VC=Zn("aria-invalid"),Uk=(r,c)=>{r.dom.checked=c},y8=r=>r.dom.checked,ja=r=>(c,f,m,x)=>At(f,"name").fold(()=>r(f,x,O.none()),y=>c.field(y,r(f,x,At(m,y)))),pw={bar:ja((r,c)=>((f,m)=>({dom:{tag:"div",classes:["tox-bar","tox-form__controls-h-stack"]},components:qe(f.items,m.interpreter)}))(r,c.shared)),collection:ja((r,c,f)=>oP(r,c.shared.providers,f)),alertbanner:ja((r,c)=>((f,m)=>{const x=ZO(f.icon,m.icons);return Af.sketch({dom:{tag:"div",attributes:{role:"alert"},classes:["tox-notification","tox-notification--in",`tox-notification--${f.level}`]},components:[{dom:{tag:"div",classes:["tox-notification__icon"],innerHtml:f.url?void 0:x},components:f.url?[Il.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:x,attributes:{title:m.translate(f.iconTooltip)}},action:y=>so(y,cm,{name:"alert-banner",value:f.url}),buttonBehaviours:tn([AE()])})]:void 0},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:m.translate(f.text)}}]})})(r,c.shared.providers)),input:ja((r,c,f)=>((m,x,y)=>Rk({name:m.name,multiline:!1,label:m.label,inputMode:m.inputMode,placeholder:m.placeholder,flex:!1,disabled:!m.enabled,classname:"tox-textfield",validation:O.none(),maximized:m.maximized,data:y},x))(r,c.shared.providers,f)),textarea:ja((r,c,f)=>((m,x,y)=>Rk({name:m.name,multiline:!0,label:m.label,inputMode:O.none(),placeholder:m.placeholder,flex:!0,disabled:!m.enabled,classname:"tox-textarea",validation:O.none(),maximized:m.maximized,data:y},x))(r,c.shared.providers,f)),label:ja((r,c)=>((f,m)=>{const x="tox-label";return{dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"label",classes:[x,...f.align==="center"?[`${x}--center`]:[],...f.align==="end"?[`${x}--end`]:[]]},components:[Pr(m.providers.translate(f.label))]},...qe(f.items,m.interpreter)],behaviours:tn([fm(),Do.config({}),(y=O.none(),NP(y,P0,Iu)),uo.config({mode:"acyclic"})])};var y})(r,c.shared)),iframe:(BM=(r,c,f)=>((m,x,y)=>{const E="tox-dialog__iframe",D=m.transparent?[]:[`${E}--opaque`],A=m.border?["tox-navobj-bordered"]:[],P={...m.label.map(oe=>({title:oe})).getOr({}),...y.map(oe=>({srcdoc:oe})).getOr({}),...m.sandboxed?{sandbox:"allow-scripts allow-same-origin"}:{}},U=((oe,ne)=>{const ge=ho(oe.getOr(""));return{getValue:he=>ge.get(),setValue:(he,Le)=>{if(ge.get()!==Le){const fe=he.element,de=()=>Eo(fe,"srcdoc",Le);ne?r8.fold(Y(wk),be=>be.throttle)(fe,Le,de):de()}ge.set(Le)}}})(y,m.streamContent),B=m.label.map(oe=>_p(oe,x)),K=sr.parts.field({factory:{sketch:oe=>mk(O.from(A),{uid:oe.uid,dom:{tag:"iframe",attributes:P,classes:[E,...D]},behaviours:tn([Mr.config({}),Bo.config({}),Cb(y,U.getValue,U.setValue),pl.config({channels:{[lw]:{onReceive:(ne,ge)=>{ge.newFocus.each(he=>{li(ne.element).each(Le=>{(po(ne.element,he)?zi:hi)(Le,"tox-navobj-bordered-focus")})})}}}})])})}});return Cp(B,K,["tox-form__group--stretched"],[])})(r,c.shared.providers,f),(r,c,f,m)=>{const x=Ze(c,{source:"dynamic"});return ja(BM)(r,x,f,m)}),button:ja((r,c)=>((f,m)=>{const x=aM(f.name,"custom");return y=O.none(),E=sr.parts.field({factory:Il,...rM(f,O.some(x),m,[TC(""),fm()])}),Cp(y,E,[],[]);var y,E})(r,c.shared.providers)),checkbox:ja((r,c,f)=>((m,x,y)=>{const E=B=>(B.element.dom.click(),O.some(!0)),D=sr.parts.field({factory:{sketch:me},dom:{tag:"input",classes:["tox-checkbox__input"],attributes:{type:"checkbox"}},behaviours:tn([fm(),Ho.config({disabled:()=>!m.enabled||x.isDisabled(),onDisabled:B=>{li(B.element).each(K=>zi(K,"tox-checkbox--disabled"))},onEnabled:B=>{li(B.element).each(K=>hi(K,"tox-checkbox--disabled"))}}),Mr.config({}),Bo.config({}),NP(y,y8,Uk),uo.config({mode:"special",onEnter:E,onSpace:E,stopSpaceKeyup:!0}),Qo("checkbox-events",[Ft(Va(),(B,K)=>{so(B,Zu,{name:m.name})})])])}),A=sr.parts.label({dom:{tag:"span",classes:["tox-checkbox__label"]},components:[Pr(x.translate(m.label))],behaviours:tn([Eb.config({})])}),P=B=>vd(B==="checked"?"selected":"unselected",{tag:"span",classes:["tox-icon","tox-checkbox-icon__"+B]},x.icons),U=dr({dom:{tag:"div",classes:["tox-checkbox__icons"]},components:[P("checked"),P("unchecked")]});return sr.sketch({dom:{tag:"label",classes:["tox-checkbox"]},components:[D,U.asSpec(),A],fieldBehaviours:tn([Ho.config({disabled:()=>!m.enabled||x.isDisabled()}),Ia()])})})(r,c.shared.providers,f)),colorinput:ja((r,c,f)=>((m,x,y,E)=>{const D=sr.parts.field({factory:vp,inputClasses:["tox-textfield"],data:E,onSetValue:B=>um.run(B).get(j),inputBehaviours:tn([Ho.config({disabled:x.providers.isDisabled}),Ia(),Mr.config({}),um.config({invalidClass:"tox-textbox-field-invalid",getRoot:B=>li(B.element),notify:{onValid:B=>{const K=at.getValue(B);so(B,cP,{color:K})}},validator:{validateOnLoad:!1,validate:B=>{const K=at.getValue(B);if(K.length===0)return Ep(os.value(!0));{const oe=ao("span");Ro(oe,"background-color",K);const ne=yi(oe,"background-color").fold(()=>os.error("blah"),ge=>os.value(K));return Ep(ne)}}}})]),selectOnFocus:!1}),A=m.label.map(B=>_p(B,x.providers)),P=(B,K)=>{so(B,uP,{value:K})},U=dr(((B,K)=>xd.sketch({dom:B.dom,components:B.components,toggleClass:"mce-active",dropdownBehaviours:tn([vl(K.providers.isDisabled),Ia(),Eb.config({}),Mr.config({})]),layouts:B.layouts,sandboxClasses:["tox-dialog__popups"],lazySink:K.getSink,fetch:oe=>$g(ne=>B.fetch(ne)).map(ne=>O.from(tC(Ze(kD(Zn("menu-value"),ne,ge=>{B.onItemAction(oe,ge)},B.columns,B.presets,ah.CLOSE_ON_EXECUTE,ve,K.providers),{movement:tw(B.columns,B.presets)})))),parts:{menu:OE(0,0,B.presets)}}))({dom:{tag:"span",attributes:{"aria-label":x.providers.translate("Color swatch")}},layouts:{onRtl:()=>[Ei,_a,Jr],onLtr:()=>[_a,Ei,Jr]},components:[],fetch:UI(y.getColors(m.storageKey),m.storageKey,y.hasCustomColors()),columns:y.getColorCols(m.storageKey),presets:"color",onItemAction:(B,K)=>{U.getOpt(B).each(oe=>{K==="custom"?y.colorPicker(ne=>{ne.fold(()=>rs(oe,dP),ge=>{P(oe,ge),SD(m.storageKey,ge)})},"#ffffff"):P(oe,K==="remove"?"":K)})}},x));return sr.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:A.toArray().concat([{dom:{tag:"div",classes:["tox-color-input"]},components:[D,U.asSpec()]}]),fieldBehaviours:tn([Qo("form-field-events",[Ft(cP,(B,K)=>{U.getOpt(B).each(oe=>{Ro(oe.element,"background-color",K.event.color)}),so(B,Zu,{name:m.name})}),Ft(uP,(B,K)=>{sr.getField(B).each(oe=>{at.setValue(oe,K.event.value),Os.getCurrent(B).each(Bo.focus)})}),Ft(dP,(B,K)=>{sr.getField(B).each(oe=>{Os.getCurrent(B).each(Bo.focus)})})])])})})(r,c.shared,c.colorinput,f)),colorpicker:ja((r,c,f)=>((m,x,y)=>{const E=P=>"tox-"+P,D=dk((P=>U=>h(U)?P.translate(n8[U]):P.translate(U))(x),E),A=dr(D.sketch({dom:{tag:"div",classes:[E("color-picker-container")],attributes:{role:"presentation"}},onValidHex:P=>{so(P,cm,{name:"hex-valid",value:!0})},onInvalidHex:P=>{so(P,cm,{name:"hex-valid",value:!1})}}));return{dom:{tag:"div"},components:[A.asSpec()],behaviours:tn([Cb(y,P=>{const U=A.get(P);return Os.getCurrent(U).bind(B=>at.getValue(B).hex).map(B=>"#"+bs(B,"#")).getOr("")},(P,U)=>{const B=O.from(/^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/.exec(U)).bind(oe=>It(oe,1)),K=A.get(P);Os.getCurrent(K).fold(()=>{console.log("Can not find form")},oe=>{at.setValue(oe,{hex:B.getOr("")}),Ix.getField(oe,"hex").each(ne=>{rs(ne,Vr())})})}),fm()])}})(0,c.shared.providers,f)),dropzone:ja((r,c,f)=>((m,x,y)=>{const E=(ne,ge)=>{ge.stop()},D=ne=>(ge,he)=>{mt(ne,Le=>{Le(ge,he)})},A=(ne,ge)=>{var he;if(!Ho.isDisabled(ne)){const Le=ge.event.raw;U(ne,(he=Le.dataTransfer)===null||he===void 0?void 0:he.files)}},P=(ne,ge)=>{const he=ge.event.raw.target;U(ne,he.files)},U=(ne,ge)=>{ge&&(at.setValue(ne,((he,Le)=>{const fe=hm.explode(Le.getOption("images_file_types"));return on(yo(he),de=>Dt(fe,be=>aa(de.name.toLowerCase(),`.${be.toLowerCase()}`)))})(ge,x)),so(ne,Zu,{name:m.name}))},B=dr({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:tn([Qo("input-file-events",[Hd(Dl()),Hd(Gf())])])}),K=m.label.map(ne=>_p(ne,x)),oe=sr.parts.field({factory:{sketch:ne=>({uid:ne.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:tn([TC(y.getOr([])),fm(),Ho.config({}),Mo.config({toggleClass:"dragenter",toggleOnExecute:!1}),Qo("dropzone-events",[Ft("dragenter",D([E,Mo.toggle])),Ft("dragleave",D([E,Mo.toggle])),Ft("dragover",E),Ft("drop",D([E,A])),Ft(Va(),P)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p"},components:[Pr(x.translate("Drop an image here"))]},Il.sketch({dom:{tag:"button",styles:{position:"relative"},classes:["tox-button","tox-button--secondary"]},components:[Pr(x.translate("Browse for an image")),B.asSpec()],action:ge=>{B.get(ge).element.dom.click()},buttonBehaviours:tn([Mr.config({}),vl(x.isDisabled),Ia()])})]}]})}});return Cp(K,oe,["tox-form__group--stretched"],[])})(r,c.shared.providers,f)),grid:ja((r,c)=>((f,m)=>({dom:{tag:"div",classes:["tox-form__grid",`tox-form__grid--${f.columns}col`]},components:qe(f.items,m.interpreter)}))(r,c.shared)),listbox:ja((r,c,f)=>((m,x,y)=>{const E=x.shared.providers,D=y.bind(B=>MC(m.items,B)).orThunk(()=>Dn(m.items).filter(PC)),A=m.label.map(B=>_p(B,E)),P=sr.parts.field({dom:{},factory:{sketch:B=>IC({uid:B.uid,text:D.map(K=>K.text),icon:O.none(),tooltip:O.none(),role:O.none(),ariaLabel:m.label,fetch:(K,oe)=>{const ne=kk(K,m.name,m.items,at.getValue(K));oe(Fx(ne,ah.CLOSE_ON_EXECUTE,x,{isHorizontalMenu:!1,search:O.none()}))},onSetup:Y(j),getApi:Y({}),columns:1,presets:"normal",classes:[],dropdownBehaviours:[Mr.config({}),Cb(D.map(K=>K.value),K=>xi(K.element,Dk),(K,oe)=>{MC(m.items,oe).each(ne=>{Eo(K.element,Dk,ne.value),so(K,Xd,{text:ne.text})})})]},"tox-listbox",x.shared)}}),U={dom:{tag:"div",classes:["tox-listboxfield"]},components:[P]};return sr.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:Vn([A.toArray(),[U]]),fieldBehaviours:tn([Ho.config({disabled:Y(!m.enabled),onDisabled:B=>{sr.getField(B).each(Ho.disable)},onEnabled:B=>{sr.getField(B).each(Ho.enable)}})])})})(r,c,f)),selectbox:ja((r,c,f)=>((m,x,y)=>{const E=qe(m.items,B=>({text:x.translate(B.text),value:B.value})),D=m.label.map(B=>_p(B,x)),A=sr.parts.field({dom:{},...y.map(B=>({data:B})).getOr({}),selectAttributes:{size:m.size},options:E,factory:i8,selectBehaviours:tn([Ho.config({disabled:()=>!m.enabled||x.isDisabled()}),Mr.config({}),Qo("selectbox-change",[Ft(Va(),(B,K)=>{so(B,Zu,{name:m.name})})])])}),P=m.size>1?O.none():O.some(vd("chevron-down",{tag:"div",classes:["tox-selectfield__icon-js"]},x.icons)),U={dom:{tag:"div",classes:["tox-selectfield"]},components:Vn([[A],P.toArray()])};return sr.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:Vn([D.toArray(),[U]]),fieldBehaviours:tn([Ho.config({disabled:()=>!m.enabled||x.isDisabled(),onDisabled:B=>{sr.getField(B).each(Ho.disable)},onEnabled:B=>{sr.getField(B).each(Ho.enable)}}),Ia()])})})(r,c.shared.providers,f)),sizeinput:ja((r,c)=>((f,m)=>{let x=Tb;const y=Zn("ratio-event"),E=ge=>vd(ge,{tag:"span",classes:["tox-icon","tox-lock-icon__"+ge]},m.icons),D=f.label.getOr("Constrain proportions"),A=m.translate(D),P=wd.parts.lock({dom:{tag:"button",classes:["tox-lock","tox-button","tox-button--naked","tox-button--icon"],attributes:{"aria-label":A,"data-mce-name":D}},components:[E("lock"),E("unlock")],buttonBehaviours:tn([Ho.config({disabled:()=>!f.enabled||m.isDisabled()}),Ia(),Mr.config({}),Pl.config(m.tooltips.getConfig({tooltipText:A}))])}),U=ge=>({dom:{tag:"div",classes:["tox-form__group"]},components:ge}),B=ge=>sr.parts.field({factory:vp,inputClasses:["tox-textfield"],inputBehaviours:tn([Ho.config({disabled:()=>!f.enabled||m.isDisabled()}),Ia(),Mr.config({}),Qo("size-input-events",[Ft(Co(),(he,Le)=>{so(he,y,{isField1:ge})}),Ft(Va(),(he,Le)=>{so(he,Zu,{name:f.name})})])]),selectOnFocus:!1}),K=ge=>({dom:{tag:"label",classes:["tox-label"]},components:[Pr(m.translate(ge))]}),oe=wd.parts.field1(U([sr.parts.label(K("Width")),B(!0)])),ne=wd.parts.field2(U([sr.parts.label(K("Height")),B(!1)]));return wd.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:[oe,ne,U([K(" "),P])]}],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:(ge,he,Le)=>{Ak(at.getValue(ge)).each(fe=>{x(fe).each(de=>{at.setValue(he,(be=>{const Te={"":0,px:0,pt:1,mm:1,pc:2,ex:2,em:2,ch:2,rem:2,cm:3,in:4,"%":4};let ke=be.value.toFixed((Ke=be.unit)in Te?Te[Ke]:1);var Ke;return ke.indexOf(".")!==-1&&(ke=ke.replace(/\.?0*$/,"")),ke+be.unit})(de))})})},coupledFieldBehaviours:tn([Ho.config({disabled:()=>!f.enabled||m.isDisabled(),onDisabled:ge=>{wd.getField1(ge).bind(sr.getField).each(Ho.disable),wd.getField2(ge).bind(sr.getField).each(Ho.disable),wd.getLock(ge).each(Ho.disable)},onEnabled:ge=>{wd.getField1(ge).bind(sr.getField).each(Ho.enable),wd.getField2(ge).bind(sr.getField).each(Ho.enable),wd.getLock(ge).each(Ho.enable)}}),Ia(),Qo("size-input-events2",[Ft(y,(ge,he)=>{const Le=he.event.isField1,fe=Le?wd.getField1(ge):wd.getField2(ge),de=Le?wd.getField2(ge):wd.getField1(ge),be=fe.map(at.getValue).getOr(""),Te=de.map(at.getValue).getOr("");x=((ke,Ke)=>{const dt=Ak(ke).toOptional(),zt=Ak(Ke).toOptional();return Yt(dt,zt,(Wt,en)=>Lk(Wt,en.unit).map(xn=>en.value/xn).map(xn=>{return $n=xn,ro=en.unit,xo=>Lk(xo,ro).map(Zo=>({value:Zo*$n,unit:ro}));var $n,ro}).getOr(Tb)).getOr(Tb)})(be,Te)})])])})})(r,c.shared.providers)),slider:ja((r,c,f)=>((m,x,y)=>{const E=yd.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[Pr(x.translate(m.label))]}),D=yd.parts.spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),A=yd.parts.thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return yd.sketch({dom:{tag:"div",classes:["tox-slider"],attributes:{role:"presentation"}},model:{mode:"x",minX:m.min,maxX:m.max,getInitialValue:Y(y.getOrThunk(()=>(Math.abs(m.max)-Math.abs(m.min))/2))},components:[E,D,A],sliderBehaviours:tn([fm(),Bo.config({})]),onChoose:(P,U,B)=>{so(P,Zu,{name:m.name,value:B})}})})(r,c.shared.providers,f)),urlinput:ja((r,c,f)=>((m,x,y,E)=>{const D=x.shared.providers,A=fe=>{const de=at.getValue(fe);y.addToHistory(de.value,m.filetype)},P={...E.map(fe=>({initialData:fe})).getOr({}),dismissOnBlur:!0,inputClasses:["tox-textfield"],sandboxClasses:["tox-dialog__popups"],inputAttributes:{"aria-errormessage":VC,type:"url"},minChars:0,responseTime:0,fetch:fe=>{const de=((Te,ke,Ke)=>{var dt,zt;const Wt=at.getValue(ke),en=(zt=(dt=Wt==null?void 0:Wt.meta)===null||dt===void 0?void 0:dt.text)!==null&&zt!==void 0?zt:Wt.value;return Ke.getLinkInformation().fold(()=>[],xn=>{const $n=Hk(en,(xo=>qe(xo,Zo=>UC(Zo,Zo)))(Ke.getHistory(Te)));return Te==="file"?(ro=[$n,Hk(en,v8(xn)),Hk(en,Vn([qu(xn),x8(xn),dh(xn)]))],an(ro,(xo,Zo)=>xo.length===0||Zo.length===0?xo.concat(Zo):xo.concat(b8,Zo),[])):$n;var ro})})(m.filetype,fe,y),be=Fx(de,ah.BUBBLE_TO_SANDBOX,x,{isHorizontalMenu:!1,search:O.none()});return Ep(be)},getHotspot:fe=>he.getOpt(fe),onSetValue:(fe,de)=>{fe.hasConfigured(um)&&um.run(fe).get(j)},typeaheadBehaviours:tn([...y.getValidationHandler().map(fe=>um.config({getRoot:de=>li(de.element),invalidClass:"tox-control-wrap--status-invalid",notify:{onInvalid:(de,be)=>{K.getOpt(de).each(Te=>{Eo(Te.element,"title",D.translate(be))})}},validator:{validate:de=>{const be=at.getValue(de);return g8(Te=>{fe({type:m.filetype,url:be.value},ke=>{if(ke.status==="invalid"){const Ke=os.error(ke.message);Te(Ke)}else{const Ke=os.value(ke.message);Te(Ke)}})})},validateOnLoad:!1}})).toArray(),Ho.config({disabled:()=>!m.enabled||D.isDisabled()}),Mr.config({}),Qo("urlinput-events",[Ft(Vr(),fe=>{const de=Kf(fe.element),be=de.trim();be!==de&&Km(fe.element,be),m.filetype==="file"&&so(fe,Zu,{name:m.name})}),Ft(Va(),fe=>{so(fe,Zu,{name:m.name}),A(fe)}),Ft(za(),fe=>{so(fe,Zu,{name:m.name}),A(fe)})])]),eventOrder:{[Vr()]:["streaming","urlinput-events","invalidating"]},model:{getDisplayText:fe=>fe.value,selectsOver:!1,populateFromBrowse:!1},markers:{openClass:"tox-textfield--popup-open"},lazySink:x.shared.getSink,parts:{menu:OE(0,0,"normal")},onExecute:(fe,de,be)=>{so(de,Sb,{})},onItemExecute:(fe,de,be,Te)=>{A(fe),so(fe,Zu,{name:m.name})}},U=sr.parts.field({...P,factory:p8}),B=m.label.map(fe=>_p(fe,D)),K=dr(((fe,de,be=fe,Te=fe)=>vd(be,{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+fe],attributes:{title:D.translate(Te),"aria-live":"polite",...de.fold(()=>({}),ke=>({id:ke}))}},D.icons))("invalid",O.some(VC),"warning")),oe=dr({dom:{tag:"div",classes:["tox-control-wrap__status-icon-wrap"]},components:[K.asSpec()]}),ne=y.getUrlPicker(m.filetype),ge=Zn("browser.url.event"),he=dr({dom:{tag:"div",classes:["tox-control-wrap"]},components:[U,oe.asSpec()],behaviours:tn([Ho.config({disabled:()=>!m.enabled||D.isDisabled()})])}),Le=dr(iM({name:m.name,icon:O.some("browse"),text:m.picker_text.or(m.label).getOr(""),enabled:m.enabled,primary:!1,buttonType:O.none(),borderless:!0},fe=>rs(fe,ge),D,[],["tox-browse-url"]));return sr.sketch({dom:VD([]),components:B.toArray().concat([{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:Vn([[he.asSpec()],ne.map(()=>Le.asSpec()).toArray()])}]),fieldBehaviours:tn([Ho.config({disabled:()=>!m.enabled||D.isDisabled(),onDisabled:fe=>{sr.getField(fe).each(Ho.disable),Le.getOpt(fe).each(Ho.disable)},onEnabled:fe=>{sr.getField(fe).each(Ho.enable),Le.getOpt(fe).each(Ho.enable)}}),Ia(),Qo("url-input-events",[Ft(ge,fe=>{Os.getCurrent(fe).each(de=>{const be=at.getValue(de),Te={fieldname:m.name,...be};ne.each(ke=>{ke(Te).get(Ke=>{at.setValue(de,Ke),so(fe,Zu,{name:m.name})})})})})])])})})(r,c,c.urlinput,f)),customeditor:ja(r=>{const c=nr(),f=dr({dom:{tag:r.tag}}),m=nr(),x=!FP(r)&&r.onFocus.isSome()?[Bo.config({onFocus:y=>{r.onFocus.each(E=>{E(y.element.dom)})}}),Mr.config({})]:[];return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:tn([Qo("custom-editor-events",[zr(y=>{f.getOpt(y).each(E=>{(FP(r)?r.init(E.element.dom):o8.load(r.scriptId,r.scriptUrl).then(D=>D(E.element.dom,r.settings))).then(D=>{m.on(A=>{D.setValue(A)}),m.clear(),c.set(D)})})})]),Cb(O.none(),()=>c.get().fold(()=>m.get().getOr(""),y=>y.getValue()),(y,E)=>{c.get().fold(()=>m.set(E),D=>D.setValue(E))}),fm()].concat(x)),components:[f.asSpec()]}}),htmlpanel:ja((r,c)=>((f,m)=>f.presets==="presentation"?Af.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:f.html},containerBehaviours:tn([Pl.config({...m.tooltips.getConfig({tooltipText:"",onShow:x=>{si(x.element,"[data-mce-tooltip]:hover").orThunk(()=>Ll(x.element)).each(y=>{Di(y,"data-mce-tooltip").each(E=>{Pl.setComponents(x,m.tooltips.getComponents({tooltipText:E}))})})}}),mode:"children-normal",anchor:x=>({type:"node",node:si(x.element,"[data-mce-tooltip]:hover").orThunk(()=>Ll(x.element).filter(y=>Di(y,"data-mce-tooltip").isSome())),root:x.element,layouts:{onLtr:Y([Jr,ir,_a,ea,Ei,Wi]),onRtl:Y([Jr,ir,_a,ea,Ei,Wi])},bubble:Tc(0,-2,{})})})])}):Af.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:f.html,attributes:{role:"document"}},containerBehaviours:tn([Mr.config({}),Bo.config({})])}))(r,c.shared.providers)),imagepreview:ja((r,c,f)=>((m,x)=>{const y=ho(x.getOr({url:""})),E=dr({dom:{tag:"img",classes:["tox-imagepreview__image"],attributes:x.map(U=>({src:U.url})).getOr({})}}),D=dr({dom:{tag:"div",classes:["tox-imagepreview__container"],attributes:{role:"presentation"}},components:[E.asSpec()]}),A={};m.height.each(U=>A.height=U);const P=x.map(U=>({url:U.url,zoom:O.from(U.zoom),cachedWidth:O.from(U.cachedWidth),cachedHeight:O.from(U.cachedHeight)}));return{dom:{tag:"div",classes:["tox-imagepreview"],styles:A,attributes:{role:"presentation"}},components:[D.asSpec()],behaviours:tn([fm(),Cb(P,()=>y.get(),(U,B)=>{const K={url:B.url};B.zoom.each(ne=>K.zoom=ne),B.cachedWidth.each(ne=>K.cachedWidth=ne),B.cachedHeight.each(ne=>K.cachedHeight=ne),y.set(K);const oe=()=>{const{cachedWidth:ne,cachedHeight:ge,zoom:he}=K;if(!R(ne)&&!R(ge)){if(R(he)){const fe=((de,be,Te)=>{const ke=ds(de),Ke=Qe(de);return Math.min(ke/be,Ke/Te,1)})(U.element,ne,ge);K.zoom=fe}const Le=((fe,de,be,Te,ke)=>{const Ke=be*ke,dt=Te*ke,zt=Math.max(0,fe/2-Ke/2),Wt=Math.max(0,de/2-dt/2);return{left:zt.toString()+"px",top:Wt.toString()+"px",width:Ke.toString()+"px",height:dt.toString()+"px"}})(ds(U.element),Qe(U.element),ne,ge,K.zoom);D.getOpt(U).each(fe=>{tc(fe.element,Le)})}};E.getOpt(U).each(ne=>{const ge=ne.element;var he;B.url!==xi(ge,"src")&&(Eo(ge,"src",B.url),hi(U.element,"tox-imagepreview__loaded")),oe(),(he=ge,new Promise((Le,fe)=>{const de=()=>{Te(),Le(he)},be=[Rl(he,"load",de),Rl(he,"error",()=>{Te(),fe("Unable to load data from image: "+he.dom.src)})],Te=()=>mt(be,ke=>ke.unbind());he.dom.complete&&de()})).then(Le=>{U.getSystem().isConnected()&&(zi(U.element,"tox-imagepreview__loaded"),K.cachedWidth=Le.dom.naturalWidth,K.cachedHeight=Le.dom.naturalHeight,oe())})})})])}})(r,f)),table:ja((r,c)=>((f,m)=>{const x=D=>({dom:{tag:"td",innerHtml:m.translate(D)}});return{dom:{tag:"table",classes:["tox-dialog__table"]},components:[(E=f.header,{dom:{tag:"thead"},components:[{dom:{tag:"tr"},components:qe(E,D=>({dom:{tag:"th",innerHtml:m.translate(D)}}))}]}),(y=f.cells,{dom:{tag:"tbody"},components:qe(y,D=>({dom:{tag:"tr"},components:qe(D,x)}))})],behaviours:tn([Mr.config({}),Bo.config({})])};var y,E})(r,c.shared.providers)),tree:ja((r,c)=>((f,m)=>{const x=f.onLeafAction.getOr(j),y=f.onToggleExpand.getOr(j),E=f.defaultExpandedIds,D=ho(E),A=ho(f.defaultSelectedId),P=Zn("tree-id"),U=(B,K)=>f.items.map(oe=>oe.type==="leaf"?FC({leaf:oe,selectedId:B,onLeafAction:x,visible:!0,treeId:P,backstage:m}):Nk({directory:oe,selectedId:B,onLeafAction:x,expandedIds:K,labelTabstopping:!0,treeId:P,backstage:m}));return{dom:{tag:"div",classes:["tox-tree"],attributes:{role:"tree"}},components:U(A.get(),D.get()),behaviours:tn([uo.config({mode:"flow",selector:".tox-tree--leaf__label--visible, .tox-tree--directory__label--visible",cycles:!1}),Qo(f8,[Ft("expand-tree-node",(B,K)=>{const{expanded:oe,node:ne}=K.event;D.set(oe?[...D.get(),ne]:D.get().filter(ge=>ge!==ne)),y(D.get(),{expanded:oe,node:ne})})]),pl.config({channels:{[`update-active-item-${P}`]:{onReceive:(B,K)=>{A.set(O.some(K.value)),Do.set(B,U(O.some(K.value),D.get()))}}}}),Do.config({})])}})(r,c)),panel:ja((r,c)=>((f,m)=>({dom:{tag:"div",classes:f.classes},components:qe(f.items,m.shared.interpreter)}))(r,c))},zC={field:(r,c)=>c,record:Y([])},GC=(r,c,f,m)=>{const x=Ze(m,{shared:{interpreter:y=>Vk(r,y,f,x)}});return Vk(r,c,f,x)},Vk=(r,c,f,m)=>At(pw,c.type).fold(()=>(console.error(`Unknown factory type "${c.type}", defaulting to container: `,c),c),x=>x(r,c,f,m)),Of=(r,c,f)=>Vk(zC,r,c,f),Zg="layout-inset",zk=r=>r.x,Sd=(r,c)=>r.x+r.width/2-c.width/2,Ab=(r,c)=>r.x+r.width-c.width,Ed=r=>r.y,Gk=(r,c)=>r.y+r.height-c.height,Cr=(r,c)=>r.y+r.height/2-c.height/2,Ap=(r,c,f)=>Gi(Ab(r,c),Gk(r,c),f.insetSouthwest(),Lv(),"southwest",ml(r,{right:0,bottom:3}),Zg),Lb=(r,c,f)=>Gi(zk(r),Gk(r,c),f.insetSoutheast(),$1(),"southeast",ml(r,{left:1,bottom:3}),Zg),$x=(r,c,f)=>Gi(Ab(r,c),Ed(r),f.insetNorthwest(),Av(),"northwest",ml(r,{right:0,top:2}),Zg),Rb=(r,c,f)=>Gi(zk(r),Ed(r),f.insetNortheast(),uu(),"northeast",ml(r,{left:1,top:2}),Zg),Cd=(r,c,f)=>Gi(Sd(r,c),Ed(r),f.insetNorth(),mg(),"north",ml(r,{top:2}),Zg),gw=(r,c,f)=>Gi(Sd(r,c),Gk(r,c),f.insetSouth(),Rv(),"south",ml(r,{bottom:3}),Zg),WC=(r,c,f)=>Gi(Ab(r,c),Cr(r,c),f.insetEast(),DS(),"east",ml(r,{right:0}),Zg),uM=(r,c,f)=>Gi(zk(r),Cr(r,c),f.insetWest(),pg(),"west",ml(r,{left:1}),Zg),dM=r=>{switch(r){case"north":return Cd;case"northeast":return Rb;case"northwest":return $x;case"south":return gw;case"southeast":return Lb;case"southwest":return Ap;case"east":return WC;case"west":return uM}},Wk=(r,c,f,m,x)=>W1(m).map(dM).getOr(Cd)(r,c,f,m,x),jk=r=>{switch(r){case"north":return gw;case"northeast":return Lb;case"northwest":return Ap;case"south":return Cd;case"southeast":return Rb;case"southwest":return $x;case"east":return uM;case"west":return WC}},fM=(r,c,f,m,x)=>W1(m).map(jk).getOr(Cd)(r,c,f,m,x),qg={valignCentre:[],alignCentre:[],alignLeft:[],alignRight:[],right:[],left:[],bottom:[],top:[]},w8=(r,c,f)=>{const m={maxHeightFunction:zd()};return()=>f()?{type:"node",root:ca(jr(r())),node:O.from(r()),bubble:Tc(12,12,qg),layouts:{onRtl:()=>[Rb],onLtr:()=>[$x]},overrides:m}:{type:"hotspot",hotspot:c(),bubble:Tc(-12,12,qg),layouts:{onRtl:()=>[_a,Ei,Jr],onLtr:()=>[Ei,_a,Jr]},overrides:m}},S8=(r,c,f,m)=>{const x={maxHeightFunction:zd()};return()=>m()?{type:"node",root:ca(jr(c())),node:O.from(c()),bubble:Tc(12,12,qg),layouts:{onRtl:()=>[Cd],onLtr:()=>[Cd]},overrides:x}:r?{type:"node",root:ca(jr(c())),node:O.from(c()),bubble:Tc(0,-Tt(c()),qg),layouts:{onRtl:()=>[ir],onLtr:()=>[ir]},overrides:x}:{type:"hotspot",hotspot:f(),bubble:Tc(0,0,qg),layouts:{onRtl:()=>[ir],onLtr:()=>[ir]},overrides:x}},E8=(r,c,f)=>()=>f()?{type:"node",root:ca(jr(r())),node:O.from(r()),layouts:{onRtl:()=>[Cd],onLtr:()=>[Cd]}}:{type:"hotspot",hotspot:c(),layouts:{onRtl:()=>[Jr],onLtr:()=>[Jr]}},C8=(r,c)=>()=>({type:"selection",root:c(),getSelection:()=>{const f=r.selection.getRng(),m=r.model.table.getSelectedCells();if(m.length>1){const x=m[0],y=m[m.length-1],E={firstCell:Ie(x),lastCell:Ie(y)};return O.some(E)}return O.some(du.range(Ie(f.startContainer),f.startOffset,Ie(f.endContainer),f.endOffset))}}),_8=r=>c=>({type:"node",root:r(),node:c}),hM=(r,c,f,m)=>{const x=ub(r),y=()=>Ie(r.getBody()),E=()=>Ie(r.getContentAreaContainer()),D=()=>x||!m();return{inlineDialog:w8(E,c,D),inlineBottomDialog:S8(r.inline,E,f,D),banner:E8(E,c,D),cursor:C8(r,y),node:_8(y)}},T8=r=>(c,f)=>{DD(r)(c,f)},D8=r=>()=>ZE(r),mM=r=>c=>ew(r,c),pM=r=>c=>BI(r,c),k8=r=>()=>rh(r),gM=r=>In(r,"items"),Kk=r=>In(r,"format"),jC=[{title:"Headings",items:[{title:"Heading 1",format:"h1"},{title:"Heading 2",format:"h2"},{title:"Heading 3",format:"h3"},{title:"Heading 4",format:"h4"},{title:"Heading 5",format:"h5"},{title:"Heading 6",format:"h6"}]},{title:"Inline",items:[{title:"Bold",format:"bold"},{title:"Italic",format:"italic"},{title:"Underline",format:"underline"},{title:"Strikethrough",format:"strikethrough"},{title:"Superscript",format:"superscript"},{title:"Subscript",format:"subscript"},{title:"Code",format:"code"}]},{title:"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Align",items:[{title:"Left",format:"alignleft"},{title:"Center",format:"aligncenter"},{title:"Right",format:"alignright"},{title:"Justify",format:"alignjustify"}]}],Zk=r=>an(r,(c,f)=>{if(On(f,"items")){const m=Zk(f.items);return{customFormats:c.customFormats.concat(m.customFormats),formats:c.formats.concat([{title:f.title,items:m.formats}])}}if(On(f,"inline")||(m=>On(m,"block"))(f)||(m=>On(m,"selector"))(f)){const m=`custom-${h(f.name)?f.name:f.title.toLowerCase()}`;return{customFormats:c.customFormats.concat([{name:m,format:f}]),formats:c.formats.concat([{title:f.title,format:m,icon:f.icon}])}}return{...c,formats:c.formats.concat(f)}},{customFormats:[],formats:[]}),bM=r=>mx(r).map(c=>{const f=((m,x)=>{const y=Zk(x),E=D=>{mt(D,A=>{m.formatter.has(A.name)||m.formatter.register(A.name,A.format)})};return m.formatter?E(y.customFormats):m.on("init",()=>{E(y.customFormats)}),y.formats})(r,c);return uE(r)?jC.concat(f):f}).getOr(jC),vM=(r,c,f)=>({...r,type:"formatter",isSelected:c(r.format),getStylePreview:f(r.format)}),xM=(r,c,f,m)=>{const x=y=>qe(y,E=>gM(E)?(D=>{const A=x(D.items);return{...D,type:"submenu",getStyleItems:Y(A)}})(E):Kk(E)?(D=>vM(D,f,m))(E):(D=>{const A=Jt(D);return A.length===1&&et(A,"title")})(E)?{...E,type:"separator"}:(D=>{const A=h(D.name)?D.name:Zn(D.title),P=`custom-${A}`,U={...D,type:"formatter",format:P,isSelected:f(P),getStylePreview:m(P)};return r.formatter.register(A,U),U})(E));return x(c)},A8=r=>{let c=0;const f=m=>[{dom:{tag:"div",classes:["tox-tooltip__body"]},components:[Pr(m.tooltipText)]}];return{getConfig:m=>({delayForShow:()=>c>0?60:300,delayForHide:Y(300),exclusive:!0,lazySink:r,tooltipDom:{tag:"div",classes:["tox-tooltip","tox-tooltip--up"]},tooltipComponents:f(m),onShow:(x,y)=>{c++,m.onShow&&m.onShow(x,y)},onHide:()=>{c--}}),getComponents:f}},L8=hm.trim,yM=r=>c=>!!((f=>z(f)&&f.nodeType===1)(c)&&(c.contentEditable===r||c.getAttribute("data-mce-contenteditable")===r)),wM=yM("true"),If=yM("false"),SM=(r,c,f,m,x)=>({type:r,title:c,url:f,level:m,attach:x}),KC=r=>r.innerText||r.textContent,EM=r=>(c=>c&&c.nodeName==="A"&&(c.id||c.name)!==void 0)(r)&&CM(r),qk=r=>r&&/^(H[1-6])$/.test(r.nodeName),CM=r=>(c=>{let f=c;for(;f=f.parentNode;){const m=f.contentEditable;if(m&&m!=="inherit")return wM(f)}return!1})(r)&&!If(r),_M=r=>qk(r)&&CM(r),TM=r=>{var c;const f=(m=>m.id?m.id:Zn("h"))(r);return SM("header",(c=KC(r))!==null&&c!==void 0?c:"","#"+f,(m=>qk(m)?parseInt(m.nodeName.substr(1),10):0)(r),()=>{r.id=f})},DM=r=>{const c=r.id||r.name,f=KC(r);return SM("anchor",f||"#"+c,"#"+c,0,j)},R8=r=>L8(r.title).length>0,O8=r=>{const c=(f=>qe(ba(Ie(f),"h1,h2,h3,h4,h5,h6,a:not([href])"),x=>x.dom))(r);return on((f=>qe(on(f,_M),TM))(c).concat((f=>qe(on(f,EM),DM))(c)),R8)},ZC="tinymce-url-history",kM=r=>h(r)&&/^https?/.test(r),AM=r=>g(r)&&Pt(r,c=>{return!(S(f=c)&&f.length<=5&&An(f,kM));var f}).isNone(),Yk=()=>{const r=Bg.getItem(ZC);if(r===null)return{};let c;try{c=JSON.parse(r)}catch(f){if(f instanceof SyntaxError)return console.log("Local storage "+ZC+" was not valid JSON",f),{};throw f}return AM(c)?c:(console.log("Local storage "+ZC+" was not valid format",c),{})},LM=r=>{const c=Yk();return At(c,r).getOr([])},RM=(r,c)=>{if(!kM(r))return;const f=Yk(),m=At(f,c).getOr([]),x=on(m,y=>y!==r);f[c]=[r].concat(x).slice(0,5),(y=>{if(!AM(y))throw new Error(`Bad format for history:
`+JSON.stringify(y));Bg.setItem(ZC,JSON.stringify(y))})(f)},OM=r=>!!r,I8=r=>Nn(hm.makeMap(r,/[, ]/),OM),Xk=r=>O.from(fE(r)),Ob=r=>O.from(r).filter(h).getOrUndefined(),P8=r=>({getHistory:LM,addToHistory:RM,getLinkInformation:()=>(c=>hE(c)?O.some({targets:O8(c.getBody()),anchorTop:Ob(DO(c)),anchorBottom:Ob(kO(c))}):O.none())(r),getValidationHandler:()=>(c=>O.from(Sy(c)))(r),getUrlPicker:c=>((f,m)=>((x,y)=>{const E=(D=>{const A=O.from(Ey(D)).filter(OM).map(I8);return Xk(D).fold(ve,P=>A.fold(Oe,U=>Jt(U).length>0&&U))})(x);return k(E)?E?Xk(x):O.none():E[y]?Xk(x):O.none()})(f,m).map(x=>y=>$g(E=>{const D={filetype:m,fieldname:y.fieldname,...O.from(y.meta).getOr({})};x.call(f,(A,P)=>{if(!h(A))throw new Error("Expected value to be string");if(P!==void 0&&!g(P))throw new Error("Expected meta to be a object");E({value:A,meta:P})},y.value,D)})))(r,c)}),Ka=WB,fh=pR,IM=Y([lt("shell",!1),Rt("makeItem"),lt("setupItem",j),Hs("listBehaviours",[Do])]),PM=dd({name:"items",overrides:()=>({behaviours:tn([Do.config({})])})}),Jk=Y([PM]),qC=Dc({name:Y("CustomList")(),configFields:IM(),partFields:Jk(),factory:(r,c,f,m)=>{const x=r.shell?{behaviours:[Do.config({})],components:[]}:{behaviours:[],components:c};return{uid:r.uid,dom:r.dom,components:x.components,behaviours:eo(r.listBehaviours,x.behaviours),apis:{setItems:(y,E)=>{var D;(D=y,r.shell?O.some(D):Br(D,r,"items")).fold(()=>{throw console.error("Custom List was defined to not be a shell, but no item container was specified in components"),new Error("Custom List was defined to not be a shell, but no item container was specified in components")},A=>{const P=Do.contents(A),U=E.length,B=U-P.length,K=B>0?Xe(B,()=>r.makeItem()):[],oe=P.slice(U);mt(oe,ge=>Do.remove(A,ge)),mt(K,ge=>Do.append(A,ge));const ne=Do.contents(A);mt(ne,(ge,he)=>{r.setupItem(y,ge,E[he],he)})})}}}},apis:{setItems:(r,c,f)=>{r.setItems(c,f)}}}),Yg=Y([Rt("dom"),lt("shell",!0),vn("toolbarBehaviours",[Do])]),MM=Y([dd({name:"groups",overrides:()=>({behaviours:tn([Do.config({})])})})]),hh=Dc({name:"Toolbar",configFields:Yg(),partFields:MM(),factory:(r,c,f,m)=>{const x=r.shell?{behaviours:[Do.config({})],components:[]}:{behaviours:[],components:c};return{uid:r.uid,dom:r.dom,components:x.components,behaviours:eo(r.toolbarBehaviours,x.behaviours),apis:{setGroups:(y,E)=>{var D;(D=y,r.shell?O.some(D):Br(D,r,"groups")).fold(()=>{throw console.error("Toolbar was defined to not be a shell, but no groups container was specified in components"),new Error("Toolbar was defined to not be a shell, but no groups container was specified in components")},A=>{Do.set(A,E)})},refresh:j},domModification:{attributes:{role:"group"}}}},apis:{setGroups:(r,c,f)=>{r.setGroups(c,f)}}}),NM=j,M8=ve,FM=Y([]);var BM,$M=Object.freeze({__proto__:null,setup:NM,isDocked:M8,getBehaviours:FM});const YC=Y(Zn("toolbar-height-change")),mh={fadeInClass:"tox-editor-dock-fadein",fadeOutClass:"tox-editor-dock-fadeout",transitionClass:"tox-editor-dock-transition"},HM="tox-tinymce--toolbar-sticky-on",UM="tox-tinymce--toolbar-sticky-off",XC=(r,c)=>et(mi.getModes(r),c),Qk=r=>{const c=r.element;li(c).each(f=>{const m="padding-"+mi.getModes(r)[0];if(mi.isDocked(r)){const x=ds(f);Ro(c,"width",x+"px"),Ro(f,m,(y=>Tt(y)+(parseInt(Fr(y,"margin-top"),10)||0)+(parseInt(Fr(y,"margin-bottom"),10)||0))(c)+"px")}else us(c,"width"),us(f,m)})},VM=(r,c)=>{c?(hi(r,mh.fadeOutClass),Wf(r,[mh.transitionClass,mh.fadeInClass])):(hi(r,mh.fadeInClass),Wf(r,[mh.fadeOutClass,mh.transitionClass]))},zM=(r,c)=>{const f=Ie(r.getContainer());c?(zi(f,HM),hi(f,UM)):(zi(f,UM),hi(f,HM))},GM=(r,c)=>{const f=nr(),m=c.getSink,x=D=>{m().each(A=>D(A.element))},y=D=>{r.inline||Qk(D),zM(r,mi.isDocked(D)),D.getSystem().broadcastOn([H()],{}),m().each(A=>A.getSystem().broadcastOn([H()],{}))},E=r.inline?[]:[pl.config({channels:{[YC()]:{onReceive:Qk}}})];return[Bo.config({}),mi.config({contextual:{lazyContext:D=>{const A=Tt(D.element),P=r.inline?r.getContentAreaContainer():r.getContainer();return O.from(P).map(U=>{const B=Ys(Ie(U));return kg(r,D.element).fold(()=>{const K=B.height-A,oe=B.y+(XC(D,"top")?0:A);return Oi(B.x,oe,B.width,K)},K=>{const oe=hc(B,Ag(K)),ne=XC(D,"top")?oe.y:oe.y+A;return Oi(oe.x,ne,oe.width,oe.height-A)})})},onShow:()=>{x(D=>VM(D,!0))},onShown:D=>{x(A=>Xr(A,[mh.transitionClass,mh.fadeInClass])),f.get().each(A=>{((P,U)=>{const B=tr(U);Gl(B).filter(K=>!po(U,K)).filter(K=>po(K,Ie(B.dom.body))||ts(P,K)).each(()=>$u(U))})(D.element,A),f.clear()})},onHide:D=>{((A,P)=>Ll(A).orThunk(()=>P().toOptional().bind(U=>Ll(U.element))))(D.element,m).fold(f.clear,f.set),x(A=>VM(A,!1))},onHidden:()=>{x(D=>Xr(D,[mh.transitionClass]))},...mh},lazyViewport:D=>kg(r,D.element).fold(()=>{const A=Ii(),P=I2(r),U=A.y+(XC(D,"top")?P:0),B=A.height-(XC(D,"bottom")?P:0);return{bounds:Oi(A.x,U,A.width,B),optScrollEnv:O.none()}},A=>({bounds:Ag(A),optScrollEnv:O.some({currentScrollTop:A.element.dom.scrollTop,scrollElmTop:wr(A.element).top})})),modes:[c.header.getDockingMode()],onDocked:y,onUndocked:y}),...E]};var N8=Object.freeze({__proto__:null,setup:(r,c,f)=>{r.inline||(c.header.isPositionedAtTop()||r.on("ResizeEditor",()=>{f().each(mi.reset)}),r.on("ResizeWindow ResizeEditor",()=>{f().each(Qk)}),r.on("SkinLoaded",()=>{f().each(m=>{mi.isDocked(m)?mi.reset(m):mi.refresh(m)})}),r.on("FullscreenStateChanged",()=>{f().each(mi.reset)})),r.on("AfterScrollIntoView",m=>{f().each(x=>{mi.refresh(x);const y=x.element;VR(y)&&((E,D)=>{const A=tr(D),P=Ti(D).dom.innerHeight,U=ui(A),B=Ie(E.elm),K=fc(B),oe=Qe(B),ne=K.y,ge=ne+oe,he=wr(D),Le=Qe(D),fe=he.top,de=fe+Le,be=Math.abs(fe-U.top)<2,Te=Math.abs(de-(U.top+P))<2;if(be&&ne<de)$s(U.left,ne-Le,A);else if(Te&&ge>fe){const ke=ne-P+oe+Le;$s(U.left,ke,A)}})(m,y)})}),r.on("PostRender",()=>{zM(r,!1)})},isDocked:r=>r().map(mi.isDocked).getOr(!1),getBehaviours:GM});const F8=Wn([va,fa("items",el([ou([J2,ha("items",ni)]),ni]))].concat(Gy)),B8=[oi("text"),oi("tooltip"),oi("icon"),Si("search",!1,el([ru,Wn([oi("placeholder")])],r=>k(r)?r?O.some({placeholder:O.none()}):O.none():O.some(r))),Ji("fetch"),Or("onSetup",()=>j)],WM=Wn([va,...B8]),eA=r=>Rr("menubutton",WM,r),$8=Wn([va,Vy,Zd,Pg,PE,Q5,Ig,Tl("presets","normal",["normal","color","listpreview"]),mI(1),bx,hI]);var tA=fd({factory:(r,c)=>{const f={focus:uo.focusIn,setMenus:(m,x)=>{const y=qe(x,E=>{const D={type:"menubutton",text:E.text,fetch:P=>{P(E.getItems())}},A=eA(D).mapError(P=>xc(P)).getOrDie();return fw(A,"tox-mbtn",c.backstage,O.some("menuitem"))});Do.set(m,y)}};return{uid:r.uid,dom:r.dom,components:[],behaviours:tn([Do.config({}),Qo("menubar-events",[zr(m=>{r.onSetup(m)}),Ft(Yn(),(m,x)=>{si(m.element,".tox-mbtn--active").each(y=>{js(x.event.target,".tox-mbtn").each(E=>{po(y,E)||m.getSystem().getByDom(y).each(D=>{m.getSystem().getByDom(E).each(A=>{xd.expand(A),xd.close(D),Bo.focus(A)})})})})}),Ft(Bd(),(m,x)=>{x.event.prevFocus.bind(y=>m.getSystem().getByDom(y).toOptional()).each(y=>{x.event.newFocus.bind(E=>m.getSystem().getByDom(E).toOptional()).each(E=>{xd.isOpen(y)&&(xd.expand(E),xd.close(y))})})})]),uo.config({mode:"flow",selector:".tox-mbtn",onEscape:m=>(r.onEscape(m),O.some(!0))}),Mr.config({})]),apis:f,domModification:{attributes:{role:"menubar"}}}},name:"silver.Menubar",configFields:[Rt("dom"),Rt("uid"),Rt("onEscape"),Rt("backstage"),lt("onSetup",j)],apis:{focus:(r,c)=>{r.focus(c)},setMenus:(r,c,f)=>{r.setMenus(c,f)}}});const jM="container",H8=[vn("slotBehaviours",[])],KM=r=>"<alloy.field."+r+">",JC=(r,c)=>{const f=U=>xR(r),m=(U,B)=>(K,oe)=>Br(K,r,oe).map(ne=>U(ne,oe)).getOr(B),x=(U,B)=>xi(U.element,"aria-hidden")!=="true",y=m(x,!1),E=m((U,B)=>{if(x(U)){const K=U.element;Ro(K,"display","none"),Eo(K,"aria-hidden","true"),so(U,p1(),{name:B,visible:!1})}}),D=(U=>(B,K)=>{mt(K,oe=>U(B,oe))})(E),A=m((U,B)=>{if(!x(U)){const K=U.element;us(K,"display"),Lr(K,"aria-hidden"),so(U,p1(),{name:B,visible:!0})}}),P={getSlotNames:f,getSlot:(U,B)=>Br(U,r,B),isShowing:y,hideSlot:E,hideAllSlots:U=>D(U,f()),showSlot:A};return{uid:r.uid,dom:r.dom,components:c,behaviours:go(r.slotBehaviours),apis:P}},ZM=Nn({getSlotNames:(r,c)=>r.getSlotNames(c),getSlot:(r,c,f)=>r.getSlot(c,f),isShowing:(r,c,f)=>r.isShowing(c,f),hideSlot:(r,c,f)=>r.hideSlot(c,f),hideAllSlots:(r,c)=>r.hideAllSlots(c),showSlot:(r,c,f)=>r.showSlot(c,f)},r=>Cv(r)),ic={...ZM,sketch:r=>{const c=(()=>{const y=[];return{slot:(E,D)=>(y.push(E),XT(jM,KM(E),D)),record:Y(y)}})(),f=r(c),m=c.record(),x=qe(m,y=>sc({name:y,pname:KM(y)}));return oy(jM,H8,x,JC,f)}},U8=Wn([Zd,Vy,Or("onShow",j),Or("onHide",j),Ig]),V8=r=>({element:()=>r.element.dom}),z8=(r,c)=>{const f=qe(Jt(c),m=>{const x=c[m],y=Vl((E=>Rr("sidebar",U8,E))(x));return{name:m,getApi:V8,onSetup:y.onSetup,onShow:y.onShow,onHide:y.onHide}});return qe(f,m=>{const x=ho(j);return r.slot(m.name,{dom:{tag:"div",classes:["tox-sidebar__pane"]},behaviours:jy([Mg(m,x),xp(m,x),Ft(p1(),(y,E)=>{const D=E.event;J(f,P=>P.name===D.name).each(P=>{(D.visible?P.onShow:P.onHide)(P.getApi(y))})})])})})},G8=r=>ic.sketch(c=>({dom:{tag:"div",classes:["tox-sidebar__pane-container"]},components:z8(c,r),slotBehaviours:jy([zr(f=>ic.hideAllSlots(f))])})),QC=(r,c)=>{Eo(r,"role",c)},nA=r=>Os.getCurrent(r).bind(c=>Zc.isGrowing(c)||Zc.hasGrown(c)?Os.getCurrent(c).bind(f=>J(ic.getSlotNames(f),m=>ic.isShowing(f,m))):O.none()),e_=Zn("FixSizeEvent"),t_=Zn("AutoSizeEvent");var W8=Object.freeze({__proto__:null,block:(r,c,f,m)=>{Eo(r.element,"aria-busy",!0);const x=c.getRoot(r).getOr(r),y=tn([uo.config({mode:"special",onTab:()=>O.some(!0),onShiftTab:()=>O.some(!0)}),Bo.config({})]),E=m(x,y),D=x.getSystem().build(E);Do.append(x,_c(D)),D.hasConfigured(uo)&&c.focus&&uo.focusIn(D),f.isBlocked()||c.onBlock(r),f.blockWith(()=>Do.remove(x,D))},unblock:(r,c,f)=>{Lr(r.element,"aria-busy"),f.isBlocked()&&c.onUnblock(r),f.clear()},isBlocked:(r,c,f)=>f.isBlocked()}),oA=[Or("getRoot",O.none),pa("focus",!0),Rs("onBlock"),Rs("onUnblock")];const ph=Mi({fields:oA,name:"blocking",apis:W8,state:Object.freeze({__proto__:null,init:()=>{const r=Pd(c=>c.destroy());return Ec({readState:r.isSet,blockWith:c=>{r.set({destroy:c})},clear:r.clear,isBlocked:r.isSet})}})}),qM=r=>Os.getCurrent(r).each(c=>$u(c.element,!0)),j8=(r,c,f)=>{const m=ho(!1),x=nr(),y=D=>{var A;m.get()&&(!(P=>P.type==="focusin")(A=D)||!(A.composed?Dn(A.composedPath()):O.from(A.target)).map(Ie).filter(zn).exists(P=>zl(P,"mce-pastebin")))&&(D.preventDefault(),qM(c()),r.editorManager.setActive(r))};r.inline||r.on("PreInit",()=>{r.dom.bind(r.getWin(),"focusin",y),r.on("BeforeExecCommand",D=>{D.command.toLowerCase()==="mcefocus"&&D.value!==!0&&y(D)})});const E=D=>{D!==m.get()&&(m.set(D),((A,P,U,B)=>{const K=P.element;if(((oe,ne)=>{const ge="tabindex",he=`data-mce-${ge}`;O.from(oe.iframeElement).map(Ie).each(Le=>{ne?(Di(Le,ge).each(fe=>Eo(Le,he,fe)),Eo(Le,ge,-1)):(Lr(Le,ge),Di(Le,he).each(fe=>{Eo(Le,ge,fe),Lr(Le,he)}))})})(A,U),U)ph.block(P,(oe=>(ne,ge)=>({dom:{tag:"div",attributes:{"aria-label":oe.translate("Loading..."),tabindex:"0"},classes:["tox-throbber__busy-spinner"]},components:[{dom:om('<div class="tox-spinner"><div></div><div></div><div></div></div>')}]}))(B)),us(K,"display"),Lr(K,"aria-hidden"),A.hasFocus()&&qM(P);else{const oe=Os.getCurrent(P).exists(ne=>Qm(ne.element));ph.unblock(P),Ro(K,"display","none"),Eo(K,"aria-hidden","true"),oe&&A.focus()}})(r,c(),D,f.providers),((A,P)=>{A.dispatch("AfterProgressState",{state:P})})(r,D))};r.on("ProgressState",D=>{if(x.on(clearTimeout),W(D.time)){const A=lE.setEditorTimeout(r,()=>E(D.state),D.time);x.set(A)}else E(D.state),x.clear()})},sA=(r,c,f)=>({within:r,extra:c,withinWidth:f}),YM=(r,c,f)=>{const m=an(r,(E,D)=>((A,P)=>{const U=f(A);return O.some({element:A,start:P,finish:P+U,width:U})})(D,E.len).fold(Y(E),A=>({len:A.finish,list:E.list.concat([A])})),{len:0,list:[]}).list,x=on(m,E=>E.finish<=c),y=vt(x,(E,D)=>E+D.width,0);return{within:x,extra:m.slice(x.length),withinWidth:y}},n_=r=>qe(r,c=>c.element),XM=(r,c)=>{const f=qe(c,m=>_c(m));hh.setGroups(r,f)},JM=(r,c,f)=>{const m=c.builtGroups.get();if(m.length===0)return;const x=hp(r,c,"primary"),y=ji.getCoupled(r,"overflowGroup");Ro(x.element,"visibility","hidden");const E=m.concat([y]),D=Kn(E,P=>Ll(P.element).bind(U=>P.getSystem().getByDom(U).toOptional()));f([]),XM(x,E);const A=((P,U,B,K)=>{const oe=((Le,fe,de)=>{const be=YM(fe,Le,de);return be.extra.length===0?O.some(be):O.none()})(P,U,B).getOrThunk(()=>YM(U,P-B(K),B)),ne=oe.within,ge=oe.extra,he=oe.withinWidth;return ge.length===1&&ge[0].width<=B(K)?((Le,fe,de)=>{const be=n_(Le.concat(fe));return sA(be,[],de)})(ne,ge,he):ge.length>=1?((Le,fe,de,be)=>{const Te=n_(Le).concat([de]);return sA(Te,n_(fe),be)})(ne,ge,K,he):((Le,fe,de)=>sA(n_(Le),[],de))(ne,0,he)})(ds(x.element),c.builtGroups.get(),P=>Math.ceil(P.element.dom.getBoundingClientRect().width),y);A.extra.length===0?(Do.remove(x,y),f([])):(XM(x,A.within),f(A.extra)),us(x.element,"visibility"),al(x.element),D.each(Bo.focus)},QM=Y([vn("splitToolbarBehaviours",[ji]),Pi("builtGroups",()=>ho([]))]),K8=Y([gf(["overflowToggledClass"]),_l("getOverflowBounds"),Rt("lazySink"),Pi("overflowGroups",()=>ho([])),Rs("onOpened"),Rs("onClosed")].concat(QM())),o_=Y([sc({factory:hh,schema:Yg(),name:"primary"}),_f({schema:Yg(),name:"overflow"}),_f({name:"overflow-button"}),_f({name:"overflow-group"})]),bw=Y((r,c)=>{((f,m)=>{const x=lr.max(f,m,["margin-left","border-left-width","padding-left","padding-right","border-right-width","margin-right"]);Ro(f,"max-width",x+"px")})(r,Math.floor(c))}),rA=Y([gf(["toggledClass"]),Rt("lazySink"),Ji("fetch"),_l("getBounds"),ul("fireDismissalEventInstead",[lt("event",Fd())]),Uu(),Rs("onToggled")]),eN=Y([_f({name:"button",overrides:r=>({dom:{attributes:{"aria-haspopup":"true"}},buttonBehaviours:tn([Mo.config({toggleClass:r.markers.toggledClass,aria:{mode:"expanded"},toggleOnExecute:!1,onToggled:r.onToggled})])})}),_f({factory:hh,schema:Yg(),name:"toolbar",overrides:r=>({toolbarBehaviours:tn([uo.config({mode:"cyclic",onEscape:c=>(Br(c,r,"button").each(Bo.focus),O.none())})])})})]),s_=nr(),iA=(r,c)=>{const f=ji.getCoupled(r,"toolbarSandbox");_.isOpen(f)?_.close(f):_.open(f,c.toolbar())},vw=(r,c,f,m)=>{const x=f.getBounds.map(E=>E()),y=f.lazySink(r).getOrDie();tl.positionWithinBounds(y,c,{anchor:{type:"hotspot",hotspot:r,layouts:m,overrides:{maxWidthFunction:bw()}}},x)},r_=(r,c,f,m,x)=>{hh.setGroups(c,x),vw(r,c,f,m),Mo.on(r)},gh=Dc({name:"FloatingToolbarButton",factory:(r,c,f,m)=>({...Il.sketch({...m.button(),action:x=>{iA(x,m)},buttonBehaviours:lo({dump:m.button().buttonBehaviours},[ji.config({others:{toolbarSandbox:x=>((y,E,D)=>{const A=B1();return{dom:{tag:"div",attributes:{id:A.id}},behaviours:tn([uo.config({mode:"special",onEscape:P=>(_.close(P),O.some(!0))}),_.config({onOpen:(P,U)=>{const B=s_.get().getOr(!1);D.fetch().get(K=>{r_(y,U,D,E.layouts,K),A.link(y.element),B||uo.focusIn(U)})},onClose:()=>{Mo.off(y),s_.get().getOr(!1)||Bo.focus(y),A.unlink(y.element)},isPartOf:(P,U,B)=>Gh(U,B)||Gh(y,B),getAttachPoint:()=>D.lazySink(y).getOrDie()}),pl.config({channels:{...le({isExtraPart:ve,...D.fireDismissalEventInstead.map(P=>({fireEventInstead:{event:P.event}})).getOr({})}),..._e({doReposition:()=>{_.getState(ji.getCoupled(y,"toolbarSandbox")).each(P=>{vw(y,P,D,E.layouts)})}})}})])}})(x,f,r)}})])}),apis:{setGroups:(x,y)=>{_.getState(ji.getCoupled(x,"toolbarSandbox")).each(E=>{r_(x,E,r,f.layouts,y)})},reposition:x=>{_.getState(ji.getCoupled(x,"toolbarSandbox")).each(y=>{vw(x,y,r,f.layouts)})},toggle:x=>{iA(x,m)},toggleWithoutFocusing:x=>{((y,E)=>{s_.set(!0),iA(y,E),s_.clear()})(x,m)},getToolbar:x=>_.getState(ji.getCoupled(x,"toolbarSandbox")),isOpen:x=>_.isOpen(ji.getCoupled(x,"toolbarSandbox"))}}),configFields:rA(),partFields:eN(),apis:{setGroups:(r,c,f)=>{r.setGroups(c,f)},reposition:(r,c)=>{r.reposition(c)},toggle:(r,c)=>{r.toggle(c)},toggleWithoutFocusing:(r,c)=>{r.toggleWithoutFocusing(c)},getToolbar:(r,c)=>r.getToolbar(c),isOpen:(r,c)=>r.isOpen(c)}}),tN=Y([Rt("items"),gf(["itemSelector"]),vn("tgroupBehaviours",[uo])]),Z8=Y([KS({name:"items",unit:"item"})]),i_=Dc({name:"ToolbarGroup",configFields:tN(),partFields:Z8(),factory:(r,c,f,m)=>({uid:r.uid,dom:r.dom,components:c,behaviours:eo(r.tgroupBehaviours,[uo.config({mode:"flow",selector:r.markers.itemSelector})]),domModification:{attributes:{role:"toolbar"}}})}),nN=r=>qe(r,c=>_c(c)),oN=(r,c,f)=>{JM(r,f,m=>{f.overflowGroups.set(m),c.getOpt(r).each(x=>{gh.setGroups(x,nN(m))})})},sN=Dc({name:"SplitFloatingToolbar",configFields:K8(),partFields:o_(),factory:(r,c,f,m)=>{const x=dr(gh.sketch({fetch:()=>$g(y=>{y(nN(r.overflowGroups.get()))}),layouts:{onLtr:()=>[Ei,_a],onRtl:()=>[_a,Ei],onBottomLtr:()=>[Wi,ea],onBottomRtl:()=>[ea,Wi]},getBounds:f.getOverflowBounds,lazySink:r.lazySink,fireDismissalEventInstead:{},markers:{toggledClass:r.markers.overflowToggledClass},parts:{button:m["overflow-button"](),toolbar:m.overflow()},onToggled:(y,E)=>r[E?"onOpened":"onClosed"](y)}));return{uid:r.uid,dom:r.dom,components:c,behaviours:eo(r.splitToolbarBehaviours,[ji.config({others:{overflowGroup:()=>i_.sketch({...m["overflow-group"](),items:[x.asSpec()]})}})]),apis:{setGroups:(y,E)=>{r.builtGroups.set(qe(E,y.getSystem().build)),oN(y,x,r)},refresh:y=>oN(y,x,r),toggle:y=>{x.getOpt(y).each(E=>{gh.toggle(E)})},toggleWithoutFocusing:y=>{x.getOpt(y).each(gh.toggleWithoutFocusing)},isOpen:y=>x.getOpt(y).map(gh.isOpen).getOr(!1),reposition:y=>{x.getOpt(y).each(E=>{gh.reposition(E)})},getOverflow:y=>x.getOpt(y).bind(gh.getToolbar)},domModification:{attributes:{role:"group"}}}},apis:{setGroups:(r,c,f)=>{r.setGroups(c,f)},refresh:(r,c)=>{r.refresh(c)},reposition:(r,c)=>{r.reposition(c)},toggle:(r,c)=>{r.toggle(c)},toggleWithoutFocusing:(r,c)=>{r.toggle(c)},isOpen:(r,c)=>r.isOpen(c),getOverflow:(r,c)=>r.getOverflow(c)}}),q8=Y([gf(["closedClass","openClass","shrinkingClass","growingClass","overflowToggledClass"]),Rs("onOpened"),Rs("onClosed")].concat(QM())),Y8=Y([sc({factory:hh,schema:Yg(),name:"primary"}),sc({factory:hh,schema:Yg(),name:"overflow",overrides:r=>({toolbarBehaviours:tn([Zc.config({dimension:{property:"height"},closedClass:r.markers.closedClass,openClass:r.markers.openClass,shrinkingClass:r.markers.shrinkingClass,growingClass:r.markers.growingClass,onShrunk:c=>{Br(c,r,"overflow-button").each(f=>{Mo.off(f)}),r.onClosed(c)},onGrown:c=>{r.onOpened(c)},onStartGrow:c=>{Br(c,r,"overflow-button").each(Mo.on)}}),uo.config({mode:"acyclic",onEscape:c=>(Br(c,r,"overflow-button").each(Bo.focus),O.some(!0))})])})}),_f({name:"overflow-button",overrides:r=>({buttonBehaviours:tn([Mo.config({toggleClass:r.markers.overflowToggledClass,aria:{mode:"expanded"},toggleOnExecute:!1})])})}),_f({name:"overflow-group"})]),aA=(r,c,f)=>{Br(r,c,"overflow-button").each(m=>{Br(r,c,"overflow").each(x=>{if(lA(r,c),Zc.hasShrunk(x)){const y=c.onOpened;c.onOpened=E=>{f||uo.focusIn(x),y(E),c.onOpened=y}}else{const y=c.onClosed;c.onClosed=E=>{f||Bo.focus(m),y(E),c.onClosed=y}}Zc.toggleGrow(x)})})},lA=(r,c)=>{Br(r,c,"overflow").each(f=>{JM(r,c,m=>{const x=qe(m,y=>_c(y));hh.setGroups(f,x)}),Br(r,c,"overflow-button").each(m=>{Zc.hasGrown(f)&&Mo.on(m)}),Zc.refresh(f)})},cA=Dc({name:"SplitSlidingToolbar",configFields:q8(),partFields:Y8(),factory:(r,c,f,m)=>{const x="alloy.toolbar.toggle";return{uid:r.uid,dom:r.dom,components:c,behaviours:eo(r.splitToolbarBehaviours,[ji.config({others:{overflowGroup:y=>i_.sketch({...m["overflow-group"](),items:[Il.sketch({...m["overflow-button"](),action:E=>{rs(y,x)}})]})}}),Qo("toolbar-toggle-events",[Ft(x,y=>{aA(y,r,!1)})])]),apis:{setGroups:(y,E)=>{((D,A)=>{const P=qe(A,D.getSystem().build);r.builtGroups.set(P)})(y,E),lA(y,r)},refresh:y=>lA(y,r),toggle:y=>{aA(y,r,!1)},toggleWithoutFocusing:y=>{aA(y,r,!0)},isOpen:y=>((E,D)=>Br(E,D,"overflow").map(Zc.hasGrown).getOr(!1))(y,r)},domModification:{attributes:{role:"group"}}}},apis:{setGroups:(r,c,f)=>{r.setGroups(c,f)},refresh:(r,c)=>{r.refresh(c)},toggle:(r,c)=>{r.toggle(c)},isOpen:(r,c)=>r.isOpen(c)}}),rN=r=>{const c=r.title.fold(()=>({}),f=>({attributes:{title:f}}));return{dom:{tag:"div",classes:["tox-toolbar__group"],...c},components:[i_.parts.items({})],items:r.items,markers:{itemSelector:"*:not(.tox-split-button) > .tox-tbtn:not([disabled]), .tox-split-button:not([disabled]), .tox-toolbar-nav-js:not([disabled]), .tox-number-input:not([disabled])"},tgroupBehaviours:tn([Mr.config({}),Bo.config({})])}},a_=r=>i_.sketch(rN(r)),iN=(r,c)=>{const f=zr(m=>{const x=qe(r.initGroups,a_);hh.setGroups(m,x)});return tn([BE(r.providers.isDisabled),Ia(),uo.config({mode:c,onEscape:r.onEscape,selector:".tox-toolbar__group"}),Qo("toolbar-events",[f])])},uA=r=>{const c=r.cyclicKeying?"cyclic":"acyclic";return{uid:r.uid,dom:{tag:"div",classes:["tox-toolbar-overlord"]},parts:{"overflow-group":rN({title:O.none(),items:[]}),"overflow-button":Bk({name:"more",icon:O.some("more-drawer"),enabled:!0,tooltip:O.some("Reveal or hide additional toolbar items"),primary:!1,buttonType:O.none(),borderless:!1},O.none(),r.providers,[],"overflow-button")},splitToolbarBehaviours:iN(r,c)}},X8=r=>{const c=uA(r),f=sN.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}});return sN.sketch({...c,lazySink:r.getSink,getOverflowBounds:()=>{const m=r.moreDrawerData.lazyHeader().element,x=fc(m),y=Ur(m),E=fc(y),D=Math.max(y.dom.scrollHeight,E.height);return Oi(x.x+4,E.y,x.width-8,D)},parts:{...c.parts,overflow:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:r.attributes}}},components:[f],markers:{overflowToggledClass:"tox-tbtn--enabled"},onOpened:m=>r.onToggled(m,!0),onClosed:m=>r.onToggled(m,!1)})},J8=r=>{const c=cA.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}}),f=cA.parts.overflow({dom:{tag:"div",classes:["tox-toolbar__overflow"]}}),m=uA(r);return cA.sketch({...m,components:[c,f],markers:{openClass:"tox-toolbar__overflow--open",closedClass:"tox-toolbar__overflow--closed",growingClass:"tox-toolbar__overflow--growing",shrinkingClass:"tox-toolbar__overflow--shrinking",overflowToggledClass:"tox-tbtn--enabled"},onOpened:x=>{x.getSystem().broadcastOn([YC()],{type:"opened"}),r.onToggled(x,!0)},onClosed:x=>{x.getSystem().broadcastOn([YC()],{type:"closed"}),r.onToggled(x,!1)}})},Pf=r=>{const c=r.cyclicKeying?"cyclic":"acyclic";return hh.sketch({uid:r.uid,dom:{tag:"div",classes:["tox-toolbar"].concat(r.type===jd.scrolling?["tox-toolbar--scrolling"]:[])},components:[hh.parts.groups({})],toolbarBehaviours:iN(r,c)})},aN=[Pg,Zd,oi("tooltip"),Tl("buttonType","secondary",["primary","secondary"]),pa("borderless",!1),Ji("onAction")],lN={button:[...aN,Kd,$a("type",["button"])],togglebutton:[...aN,pa("active",!1),$a("type",["togglebutton"])]},dA=[$a("type",["group"]),Ua("buttons",[],Kr("type",lN))],ol=Kr("type",{...lN,group:dA}),Q8=Wn([Ua("buttons",[],ol),Ji("onShow"),Ji("onHide")]),cN=(r,c)=>((f,m)=>{var x,y;const E=f.type==="togglebutton",D=f.icon.map(fe=>mm(fe,m.icons)).map(dr),A={...f,name:E?f.text.getOr(f.icon.getOr("")):(x=f.text)!==null&&x!==void 0?x:f.icon.getOr(""),primary:f.buttonType==="primary",buttonType:O.from(f.buttonType),tooltip:f.tooltip,icon:f.icon,enabled:!0,borderless:f.borderless},P=$k((y=f.buttonType)!==null&&y!==void 0?y:"secondary"),U=E?f.text.map(m.translate):O.some(m.translate(f.text)),B=U.map(Pr),K=A.tooltip.or(U).map(fe=>({"aria-label":m.translate(fe)})).getOr({}),oe=D.map(fe=>fe.asSpec()),ne=yx([oe,B]),ge=f.icon.isSome()&&B.isSome(),he={tag:"button",classes:P.concat(...f.icon.isSome()&&!ge?["tox-button--icon"]:[]).concat(...ge?["tox-button--icon-and-text"]:[]).concat(...f.borderless?["tox-button--naked"]:[]).concat(...f.type==="togglebutton"&&f.active?["tox-button--enabled"]:[]),attributes:K},Le=mw(A,O.some(fe=>{const de=be=>{D.map(Te=>Te.getOpt(fe).each(ke=>{Do.set(ke,[mm(be,m.icons)])}))};return E?f.onAction({setIcon:de,setActive:be=>{const Te=fe.element;be?(zi(Te,"tox-button--enabled"),Eo(Te,"aria-pressed",!0)):(hi(Te,"tox-button--enabled"),Lr(Te,"aria-pressed"))},isActive:()=>zl(fe.element,"tox-button--enabled")}):f.type==="button"?f.onAction({setIcon:de}):void 0}),[],he,ne,f.tooltip,m);return Il.sketch(Le)})(r,c),uN=da().deviceType,e$=uN.isPhone(),t$=uN.isTablet();var Hx=Dc({name:"silver.View",configFields:[Rt("viewConfig")],partFields:[dd({factory:{sketch:r=>{let c=!1;const f=qe(r.buttons,m=>m.type==="group"?(c=!0,((x,y)=>({dom:{tag:"div",classes:["tox-view__toolbar__group"]},components:qe(x.buttons,E=>cN(E,y))}))(m,r.providers)):cN(m,r.providers));return{uid:r.uid,dom:{tag:"div",classes:[c?"tox-view__toolbar":"tox-view__header",...e$||t$?["tox-view--mobile","tox-view--scrolling"]:[]]},behaviours:tn([Bo.config({}),uo.config({mode:"flow",selector:"button, .tox-button",focusInside:tb.OnEnterOrSpaceMode})]),components:c?f:[Af.sketch({dom:{tag:"div",classes:["tox-view__header-start"]},components:[]}),Af.sketch({dom:{tag:"div",classes:["tox-view__header-end"]},components:f})]}}},schema:[Rt("buttons"),Rt("providers")],name:"header"}),dd({factory:{sketch:r=>({uid:r.uid,behaviours:tn([Bo.config({}),Mr.config({})]),dom:{tag:"div",classes:["tox-view__pane"]}})},schema:[],name:"pane"})],factory:(r,c,f,m)=>{const x={getPane:y=>Ka.getPart(y,r,"pane"),getOnShow:y=>r.viewConfig.onShow,getOnHide:y=>r.viewConfig.onHide};return{uid:r.uid,dom:r.dom,components:c,behaviours:tn([Bo.config({}),uo.config({mode:"cyclic",focusInside:tb.OnEnterOrSpaceMode})]),apis:x}},apis:{getPane:(r,c)=>r.getPane(c),getOnShow:(r,c)=>r.getOnShow(c),getOnHide:(r,c)=>r.getOnHide(c)}});const n$=(r,c,f)=>xt(c,(m,x)=>{const y=Vl(Rr("view",Q8,m));return r.slot(x,Hx.sketch({dom:{tag:"div",classes:["tox-view"]},viewConfig:y,components:[...y.buttons.length>0?[Hx.parts.header({buttons:y.buttons,providers:f})]:[],Hx.parts.pane({})]}))}),o$=(r,c)=>ic.sketch(f=>({dom:{tag:"div",classes:["tox-view-wrap__slot-container"]},components:n$(f,r,c),slotBehaviours:jy([zr(m=>ic.hideAllSlots(m))])})),dN=r=>J(ic.getSlotNames(r),c=>ic.isShowing(r,c)),fN=(r,c,f)=>{ic.getSlot(r,c).each(m=>{Hx.getPane(m).each(x=>{var y;f(m)((y=x.element.dom,{getContainer:Y(y)}))})})};var l_=fd({factory:(r,c)=>{const f={setViews:(m,x)=>{Do.set(m,[o$(x,c.backstage.shared.providers)])},whichView:m=>Os.getCurrent(m).bind(dN),toggleView:(m,x,y,E)=>Os.getCurrent(m).exists(D=>{const A=dN(D),P=A.exists(B=>E===B),U=ic.getSlot(D,E).isSome();return U&&(ic.hideAllSlots(D),P?((B=>{const K=B.element;Ro(K,"display","none"),Eo(K,"aria-hidden","true")})(m),x()):(y(),(B=>{const K=B.element;us(K,"display"),Lr(K,"aria-hidden")})(m),ic.showSlot(D,E),((B,K)=>{fN(B,K,Hx.getOnShow)})(D,E)),A.each(B=>((K,oe)=>fN(K,oe,Hx.getOnHide))(D,B))),U})};return{uid:r.uid,dom:{tag:"div",classes:["tox-view-wrap"],attributes:{"aria-hidden":"true"},styles:{display:"none"}},components:[],behaviours:tn([Do.config({}),Os.config({find:m=>{const x=Do.contents(m);return Dn(x)}})]),apis:f}},name:"silver.ViewWrapper",configFields:[Rt("backstage")],apis:{setViews:(r,c,f)=>r.setViews(c,f),toggleView:(r,c,f,m,x)=>r.toggleView(c,f,m,x),whichView:(r,c)=>r.whichView(c)}});const s$=fh.optional({factory:tA,name:"menubar",schema:[Rt("backstage")]}),r$=fh.optional({factory:{sketch:r=>qC.sketch({uid:r.uid,dom:r.dom,listBehaviours:tn([uo.config({mode:"acyclic",selector:".tox-toolbar"})]),makeItem:()=>Pf({type:r.type,uid:Zn("multiple-toolbar-item"),cyclicKeying:!1,initGroups:[],providers:r.providers,onEscape:()=>(r.onEscape(),O.some(!0))}),setupItem:(c,f,m,x)=>{hh.setGroups(f,m)},shell:!0})},name:"multiple-toolbar",schema:[Rt("dom"),Rt("onEscape")]}),i$=fh.optional({factory:{sketch:r=>(f=>f.type===jd.sliding?J8:f.type===jd.floating?X8:Pf)(r)({type:r.type,uid:r.uid,onEscape:()=>(r.onEscape(),O.some(!0)),onToggled:(f,m)=>r.onToolbarToggled(m),cyclicKeying:!1,initGroups:[],getSink:r.getSink,providers:r.providers,moreDrawerData:{lazyToolbar:r.lazyToolbar,lazyMoreButton:r.lazyMoreButton,lazyHeader:r.lazyHeader},attributes:r.attributes})},name:"toolbar",schema:[Rt("dom"),Rt("onEscape"),Rt("getSink")]}),a$=fh.optional({factory:{sketch:r=>{const c=r.editor,f=r.sticky?GM:FM;return{uid:r.uid,dom:r.dom,components:r.components,behaviours:tn(f(c,r.sharedBackstage))}}},name:"header",schema:[Rt("dom")]}),l$=fh.optional({factory:{sketch:r=>({uid:r.uid,dom:r.dom,components:[{dom:{tag:"a",attributes:{href:"https://www.tiny.cloud/tinymce-self-hosted-premium-features/?utm_campaign=self_hosted_upgrade_promo&utm_source=tiny&utm_medium=referral",rel:"noopener",target:"_blank","aria-hidden":"true"},classes:["tox-promotion-link"],innerHtml:"⚡️Upgrade"}}]})},name:"promotion",schema:[Rt("dom")]}),c$=fh.optional({name:"socket",schema:[Rt("dom")]}),u$=fh.optional({factory:{sketch:r=>({uid:r.uid,dom:{tag:"div",classes:["tox-sidebar"],attributes:{role:"presentation"}},components:[{dom:{tag:"div",classes:["tox-sidebar__slider"]},components:[],behaviours:tn([Mr.config({}),Bo.config({}),Zc.config({dimension:{property:"width"},closedClass:"tox-sidebar--sliding-closed",openClass:"tox-sidebar--sliding-open",shrinkingClass:"tox-sidebar--sliding-shrinking",growingClass:"tox-sidebar--sliding-growing",onShrunk:c=>{Os.getCurrent(c).each(ic.hideAllSlots),rs(c,t_)},onGrown:c=>{rs(c,t_)},onStartGrow:c=>{so(c,e_,{width:yi(c.element,"width").getOr("")})},onStartShrink:c=>{so(c,e_,{width:ds(c.element)+"px"})}}),Do.config({}),Os.config({find:c=>{const f=Do.contents(c);return Dn(f)}})])}],behaviours:tn([fk(0),Qo("sidebar-sliding-events",[Ft(e_,(c,f)=>{Ro(c.element,"width",f.event.width)}),Ft(t_,(c,f)=>{us(c.element,"width")})])])})},name:"sidebar",schema:[Rt("dom")]}),d$=fh.optional({factory:{sketch:r=>({uid:r.uid,dom:{tag:"div",attributes:{"aria-hidden":"true"},classes:["tox-throbber"],styles:{display:"none"}},behaviours:tn([Do.config({}),ph.config({focus:!1}),Os.config({find:c=>Dn(c.components())})]),components:[]})},name:"throbber",schema:[Rt("dom")]}),f$=fh.optional({factory:l_,name:"viewWrapper",schema:[Rt("backstage")]}),h$=fh.optional({factory:{sketch:r=>({uid:r.uid,dom:{tag:"div",classes:["tox-editor-container"]},components:r.components})},name:"editorContainer",schema:[]});var Gr=Dc({name:"OuterContainer",factory:(r,c,f)=>{let m=!1;const x=E=>{VT(E,".tox-statusbar").each(D=>{Fr(D,"display")==="none"&&xi(D,"aria-hidden")==="true"?(us(D,"display"),Lr(D,"aria-hidden")):(Ro(D,"display","none"),Eo(D,"aria-hidden","true"))})},y={getSocket:E=>Ka.getPart(E,r,"socket"),setSidebar:(E,D,A)=>{Ka.getPart(E,r,"sidebar").each(P=>((U,B,K)=>{Os.getCurrent(U).each(oe=>{Do.set(oe,[G8(B)]);const ne=K==null?void 0:K.toLowerCase();h(ne)&&On(B,ne)&&Os.getCurrent(oe).each(ge=>{ic.showSlot(ge,ne),Zc.immediateGrow(oe),us(oe.element,"width"),QC(U.element,"region")})})})(P,D,A))},toggleSidebar:(E,D)=>{Ka.getPart(E,r,"sidebar").each(A=>((P,U)=>{Os.getCurrent(P).each(B=>{Os.getCurrent(B).each(K=>{Zc.hasGrown(B)?ic.isShowing(K,U)?(Zc.shrink(B),QC(P.element,"presentation")):(ic.hideAllSlots(K),ic.showSlot(K,U),QC(P.element,"region")):(ic.hideAllSlots(K),ic.showSlot(K,U),Zc.grow(B),QC(P.element,"region"))})})})(A,D))},whichSidebar:E=>Ka.getPart(E,r,"sidebar").bind(nA).getOrNull(),getHeader:E=>Ka.getPart(E,r,"header"),getToolbar:E=>Ka.getPart(E,r,"toolbar"),setToolbar:(E,D)=>{Ka.getPart(E,r,"toolbar").each(A=>{const P=qe(D,a_);A.getApis().setGroups(A,P)})},setToolbars:(E,D)=>{Ka.getPart(E,r,"multiple-toolbar").each(A=>{const P=qe(D,U=>qe(U,a_));qC.setItems(A,P)})},refreshToolbar:E=>{Ka.getPart(E,r,"toolbar").each(D=>D.getApis().refresh(D))},toggleToolbarDrawer:E=>{Ka.getPart(E,r,"toolbar").each(D=>{Ps(D.getApis().toggle,A=>A(D))})},toggleToolbarDrawerWithoutFocusing:E=>{Ka.getPart(E,r,"toolbar").each(D=>{Ps(D.getApis().toggleWithoutFocusing,A=>A(D))})},isToolbarDrawerToggled:E=>Ka.getPart(E,r,"toolbar").bind(D=>O.from(D.getApis().isOpen).map(A=>A(D))).getOr(!1),getThrobber:E=>Ka.getPart(E,r,"throbber"),focusToolbar:E=>{Ka.getPart(E,r,"toolbar").orThunk(()=>Ka.getPart(E,r,"multiple-toolbar")).each(D=>{uo.focusIn(D)})},setMenubar:(E,D)=>{Ka.getPart(E,r,"menubar").each(A=>{tA.setMenus(A,D)})},focusMenubar:E=>{Ka.getPart(E,r,"menubar").each(D=>{tA.focus(D)})},setViews:(E,D)=>{Ka.getPart(E,r,"viewWrapper").each(A=>{l_.setViews(A,D)})},toggleView:(E,D)=>Ka.getPart(E,r,"viewWrapper").exists(A=>l_.toggleView(A,()=>y.showMainView(E),()=>y.hideMainView(E),D)),whichView:E=>Ka.getPart(E,r,"viewWrapper").bind(l_.whichView).getOrNull(),hideMainView:E=>{m=y.isToolbarDrawerToggled(E),m&&y.toggleToolbarDrawer(E),Ka.getPart(E,r,"editorContainer").each(D=>{const A=D.element;x(A),Ro(A,"display","none"),Eo(A,"aria-hidden","true")})},showMainView:E=>{m&&y.toggleToolbarDrawer(E),Ka.getPart(E,r,"editorContainer").each(D=>{const A=D.element;x(A),us(A,"display"),Lr(A,"aria-hidden")})}};return{uid:r.uid,dom:r.dom,components:c,apis:y,behaviours:r.behaviours}},configFields:[Rt("dom"),Rt("behaviours")],partFields:[a$,s$,i$,r$,c$,u$,l$,d$,f$,h$],apis:{getSocket:(r,c)=>r.getSocket(c),setSidebar:(r,c,f,m)=>{r.setSidebar(c,f,m)},toggleSidebar:(r,c,f)=>{r.toggleSidebar(c,f)},whichSidebar:(r,c)=>r.whichSidebar(c),getHeader:(r,c)=>r.getHeader(c),getToolbar:(r,c)=>r.getToolbar(c),setToolbar:(r,c,f)=>{r.setToolbar(c,f)},setToolbars:(r,c,f)=>{r.setToolbars(c,f)},refreshToolbar:(r,c)=>r.refreshToolbar(c),toggleToolbarDrawer:(r,c)=>{r.toggleToolbarDrawer(c)},toggleToolbarDrawerWithoutFocusing:(r,c)=>{r.toggleToolbarDrawerWithoutFocusing(c)},isToolbarDrawerToggled:(r,c)=>r.isToolbarDrawerToggled(c),getThrobber:(r,c)=>r.getThrobber(c),setMenubar:(r,c,f)=>{r.setMenubar(c,f)},focusMenubar:(r,c)=>{r.focusMenubar(c)},focusToolbar:(r,c)=>{r.focusToolbar(c)},setViews:(r,c,f)=>{r.setViews(c,f)},toggleView:(r,c,f)=>r.toggleView(c,f),whichView:(r,c)=>r.whichView(c)}});const hN={file:{title:"File",items:"newdocument restoredraft | preview | importword exportpdf exportword | export print | deleteallconversations"},edit:{title:"Edit",items:"undo redo | cut copy paste pastetext | selectall | searchreplace"},view:{title:"View",items:"code revisionhistory | visualaid visualchars visualblocks | spellchecker | preview fullscreen | showcomments"},insert:{title:"Insert",items:"image link media addcomment pageembed inserttemplate codesample inserttable accordion math | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents footnotes | mergetags | insertdatetime"},format:{title:"Format",items:"bold italic underline strikethrough superscript subscript codeformat | styles blocks fontfamily fontsize align lineheight | forecolor backcolor | language | removeformat"},tools:{title:"Tools",items:"aidialog aishortcuts | spellchecker spellcheckerlanguage | autocorrect capitalization | a11ycheck code typography wordcount addtemplate"},table:{title:"Table",items:"inserttable | cell row column | advtablesort | tableprops deletetable"},help:{title:"Help",items:"help"}},fA=r=>r.split(" "),mN=(r,c)=>{const f={...hN,...c.menus},m=Jt(c.menus).length>0,x=c.menubar===void 0||c.menubar===!0?fA("file edit view insert format tools table help"):fA(c.menubar===!1?"":c.menubar),y=on(x,D=>{const A=On(hN,D);return m?A||At(c.menus,D).exists(P=>On(P,"items")):A}),E=qe(y,D=>{const A=f[D];return((P,U,B)=>{const K=_O(B).split(/[ ,]/);return{text:P.title,getItems:()=>Rn(P.items,oe=>{const ne=oe.toLowerCase();return ne.trim().length===0||Dt(K,ge=>ge===ne)?[]:ne==="separator"||ne==="|"?[{type:"separator"}]:U.menuItems[ne]?[U.menuItems[ne]]:[]})}})({title:A.title,items:fA(A.items)},c,r)});return on(E,D=>D.getItems().length>0&&Dt(D.getItems(),A=>h(A)||A.type!=="separator"))},hA=(r,c,f)=>(r.on("remove",()=>f.unload(c)),f.load(c)),mA=(r,c,f,m)=>(r.on("remove",()=>m.unloadRawCss(c)),m.loadRawCss(c,f)),pN=async(r,c)=>{const f="ui/"+bE(r).getOr("default")+"/skin.css",m=tinymce.Resource.get(f);if(!h(m)){const x=r.editorManager.suffix;return hA(r,c+`/skin${x}.css`,r.ui.styleSheetLoader)}mA(r,f,m,r.ui.styleSheetLoader)},m$=async(r,c)=>{var f;if(f=Ie(r.getElement()),yr(f).isSome()){const m="ui/"+bE(r).getOr("default")+"/skin.shadowdom.css",x=tinymce.Resource.get(m);if(!h(x)){const y=r.editorManager.suffix;return hA(r,c+`/skin.shadowdom${y}.css`,dx.DOM.styleSheetLoader)}mA(r,m,x,dx.DOM.styleSheetLoader)}},gN=(r,c)=>(async(f,m)=>{const x=()=>{const E=gE(m),D=m.editorManager.suffix;E&&m.contentCSS.push(E+(f?"/content.inline":"/content")+`${D}.css`)};bE(m).fold(x,E=>{const D="ui/"+E+(f?"/content.inline":"/content")+".css",A=tinymce.Resource.get(D);h(A)?mA(m,D,A,m.ui.styleSheetLoader):x()});const y=gE(m);if(!Tg(m)&&h(y))return Promise.all([pN(m,y),m$(m,y)]).then()})(r,c).then((f=>{const m=()=>{f._skinLoaded=!0,(x=>{x.dispatch("SkinLoaded")})(f)};return()=>{f.initialized?m():f.on("init",m)}})(c),((f,m)=>()=>((x,y)=>{x.dispatch("SkinLoadError",y)})(f,{message:"Skin could not be loaded"}))(c)),p$=Ce(gN,!1),bN=Ce(gN,!0),Ux=(r,c,f)=>vo(f)?r.translate(c):r.translate([c,r.translate(f)]),g$=(r,c)=>{const f=(y,E,D,A)=>{const P=r.shared.providers.translate(y.title);if(y.type==="separator")return O.some({type:"separator",text:P});if(y.type==="submenu"){const U=Rn(y.getStyleItems(),B=>m(B,E,A));return E===0&&U.length<=0?O.none():O.some({type:"nestedmenuitem",text:P,enabled:U.length>0,getSubmenuItems:()=>Rn(y.getStyleItems(),B=>m(B,E,A))})}return O.some({type:"togglemenuitem",text:P,icon:y.icon,active:y.isSelected(A),enabled:!D,onAction:c.onAction(y),...y.getStylePreview().fold(()=>({}),U=>({meta:{style:U}}))})},m=(y,E,D)=>{const A=y.type==="formatter"&&c.isInvalid(y);return E===0?A?[]:f(y,E,!1,D).toArray():f(y,E,A,D).toArray()},x=y=>{const E=c.getCurrentValue(),D=c.shouldHide?0:1;return Rn(y,A=>m(A,D,E))};return{validateItems:x,getFetch:(y,E)=>(D,A)=>{const P=E(),U=x(P);A(Fx(U,ah.CLOSE_ON_EXECUTE,y,{isHorizontalMenu:!1,search:O.none()}))}}},Vx=(r,c)=>{const f=c.dataset,m=f.type==="basic"?()=>qe(f.data,x=>vM(x,c.isSelectedFor,c.getPreviewFor)):f.getData;return{items:g$(r,c),getStyleItems:m}},xw=(r,c,f,m,x,y)=>{const{items:E,getStyleItems:D}=Vx(c,f),A=ho(f.tooltip);return IC({text:f.icon.isSome()?O.none():f.text,icon:f.icon,ariaLabel:O.some(f.tooltip),tooltip:O.none(),role:O.none(),fetch:E.getFetch(c,D),onSetup:P=>{const U=B=>P.setTooltip(Ux(r,m(B.value),B.value));return r.on(x,U),zE(Sp(r,"NodeChange",B=>{const K=B.getComponent();f.updateText(K),Ho.set(B.getComponent(),!r.selection.isEditable())})(P),()=>r.off(x,U))},getApi:P=>({getComponent:Y(P),setTooltip:U=>{const B=c.shared.providers.translate(U);Eo(P.element,"aria-label",B),A.set(U)}}),columns:1,presets:"normal",classes:f.icon.isSome()?[]:["bespoke"],dropdownBehaviours:[Pl.config({...c.shared.providers.tooltips.getConfig({tooltipText:c.shared.providers.translate(f.tooltip),onShow:P=>{if(f.tooltip!==A.get()){const U=c.shared.providers.translate(A.get());Pl.setComponents(P,c.shared.providers.tooltips.getComponents({tooltipText:U}))}}})})]},"tox-tbtn",c.shared,y)};var Ib;(function(r){r[r.SemiColon=0]="SemiColon",r[r.Space=1]="Space"})(Ib||(Ib={}));const pA=(r,c,f)=>{const m=(x=((y,E)=>E===Ib.SemiColon?y.replace(/;$/,"").split(";"):y.split(" "))(r.options.get(c),f),qe(x,y=>{let E=y,D=y;const A=y.split("=");return A.length>1&&(E=A[0],D=A[1]),{title:E,format:D}}));var x;return{type:"basic",data:m}},gA=Y("Alignment {0}"),vN="left",c_=[{title:"Left",icon:"align-left",format:"alignleft",command:"JustifyLeft"},{title:"Center",icon:"align-center",format:"aligncenter",command:"JustifyCenter"},{title:"Right",icon:"align-right",format:"alignright",command:"JustifyRight"},{title:"Justify",icon:"align-justify",format:"alignjustify",command:"JustifyFull"}],xN=r=>{const c={type:"basic",data:c_};return{tooltip:Ux(r,gA(),vN),text:O.none(),icon:O.some("align-left"),isSelectedFor:f=>()=>r.formatter.match(f),getCurrentValue:O.none,getPreviewFor:f=>O.none,onAction:f=>()=>J(c_,m=>m.format===f.format).each(m=>r.execCommand(m.command)),updateText:f=>{const m=J(c_,x=>r.formatter.match(x.format)).fold(Y(vN),x=>x.title.toLowerCase());so(f,Kg,{icon:`align-${m}`}),((x,y)=>{x.dispatch("AlignTextUpdate",y)})(r,{value:m})},dataset:c,shouldHide:!1,isInvalid:f=>!r.formatter.canApply(f.format)}},yN=(r,c)=>{const f=c(),m=qe(f,x=>x.format);return O.from(r.formatter.closest(m)).bind(x=>J(f,y=>y.format===x))},wN=Y("Block {0}"),bA="Paragraph",SN=r=>{const c=pA(r,"block_formats",Ib.SemiColon);return{tooltip:Ux(r,wN(),bA),text:O.some(bA),icon:O.none(),isSelectedFor:f=>()=>r.formatter.match(f),getCurrentValue:O.none,getPreviewFor:f=>()=>{const m=r.formatter.get(f);return m?O.some({tag:m.length>0&&(m[0].inline||m[0].block)||"div",styles:r.dom.parseStyle(r.formatter.getCssText(f))}):O.none()},onAction:NI(r),updateText:f=>{const m=yN(r,()=>c.data).fold(Y(bA),x=>x.title);so(f,Xd,{text:m}),((x,y)=>{x.dispatch("BlocksTextUpdate",y)})(r,{value:m})},dataset:c,shouldHide:!1,isInvalid:f=>!r.formatter.canApply(f.format)}},EN=Y("Font {0}"),vA="System Font",b$=["-apple-system","Segoe UI","Roboto","Helvetica Neue","sans-serif"],CN=r=>{const c=r.split(/\s*,\s*/);return qe(c,f=>f.replace(/^['"]+|['"]+$/g,""))},_N=(r,c)=>c.length>0&&An(c,f=>r.indexOf(f.toLowerCase())>-1),TN=r=>{const c=()=>{const m=P=>P?CN(P)[0]:"",x=r.queryCommandValue("FontName"),y=f.data,E=x?x.toLowerCase():"",D=pE(r);return{matchOpt:J(y,P=>{const U=P.format;return U.toLowerCase()===E||m(U).toLowerCase()===m(E).toLowerCase()}).orThunk(()=>qo(((P,U)=>{if(P.indexOf("-apple-system")===0||U.length>0){const B=CN(P.toLowerCase());return _N(B,b$)||_N(B,U)}return!1})(E,D),{title:vA,format:E})),font:x}},f=pA(r,"font_family_formats",Ib.SemiColon);return{tooltip:Ux(r,EN(),vA),text:O.some(vA),icon:O.none(),isSelectedFor:m=>x=>x.exists(y=>y.format===m),getCurrentValue:()=>{const{matchOpt:m}=c();return m},getPreviewFor:m=>()=>O.some({tag:"div",styles:m.indexOf("dings")===-1?{"font-family":m}:{}}),onAction:m=>()=>{r.undoManager.transact(()=>{r.focus(),r.execCommand("FontName",!1,m.format)})},updateText:m=>{const{matchOpt:x,font:y}=c(),E=x.fold(Y(y),D=>D.title);so(m,Xd,{text:E}),((D,A)=>{D.dispatch("FontFamilyTextUpdate",A)})(r,{value:E})},dataset:f,shouldHide:!1,isInvalid:ve}},v$={unsupportedLength:["em","ex","cap","ch","ic","rem","lh","rlh","vw","vh","vi","vb","vmin","vmax","cm","mm","Q","in","pc","pt","px"],fixed:["px","pt"],relative:["%"],empty:[""]},x$=(()=>{const r="[0-9]+",c="[eE][+-]?"+r,f=x=>`(?:${x})?`,m=["Infinity",r+"\\."+f(r)+f(c),"\\."+r+f(c),r+f(c)].join("|");return new RegExp(`^([+-]?(?:${m}))(.*)$`)})(),yw=(r,c)=>O.from(x$.exec(r)).bind(f=>{const m=Number(f[1]),x=f[2];return((y,E)=>Dt(E,D=>Dt(v$[D],A=>y===A)))(x,c)?O.some({value:m,unit:x}):O.none()}),DN={tab:Y(9),escape:Y(27),enter:Y(13),backspace:Y(8),delete:Y(46),left:Y(37),up:Y(38),right:Y(39),down:Y(40),space:Y(32),home:Y(36),end:Y(35),pageUp:Y(33),pageDown:Y(34)},kN=Y("Font size {0}"),AN="12pt",y$={"8pt":"1","10pt":"2","12pt":"3","14pt":"4","18pt":"5","24pt":"6","36pt":"7"},w$={"xx-small":"7pt","x-small":"8pt",small:"10pt",medium:"12pt",large:"14pt","x-large":"18pt","xx-large":"24pt"},xA=(r,c)=>/[0-9.]+px$/.test(r)?((f,m)=>{const x=Math.pow(10,m);return Math.round(f*x)/x})(72*parseInt(r,10)/96,c||0)+"pt":At(w$,r).getOr(r),S$=r=>At(y$,r).getOr(""),LN=r=>{const c=()=>{let x=O.none();const y=m.data,E=r.queryCommandValue("FontSize");if(E)for(let D=3;x.isNone()&&D>=0;D--){const A=xA(E,D),P=S$(A);x=J(y,U=>U.format===E||U.format===A||U.format===P)}return{matchOpt:x,size:E}},f=Y(O.none),m=pA(r,"font_size_formats",Ib.Space);return{tooltip:Ux(r,kN(),AN),text:O.some(AN),icon:O.none(),isSelectedFor:x=>y=>y.exists(E=>E.format===x),getPreviewFor:f,getCurrentValue:()=>{const{matchOpt:x}=c();return x},onAction:x=>()=>{r.undoManager.transact(()=>{r.focus(),r.execCommand("FontSize",!1,x.format)})},updateText:x=>{const{matchOpt:y,size:E}=c(),D=y.fold(Y(E),A=>A.title);so(x,Xd,{text:D}),((A,P)=>{A.dispatch("FontSizeTextUpdate",P)})(r,{value:D})},dataset:m,shouldHide:!1,isInvalid:ve}},RN=r=>vo(r)?"Formats":"Format {0}",yA=(r,c)=>{const f="Formats";return{tooltip:Ux(r,RN(""),""),text:O.some(f),icon:O.none(),isSelectedFor:m=>()=>r.formatter.match(m),getCurrentValue:O.none,getPreviewFor:m=>()=>{const x=r.formatter.get(m);return x!==void 0?O.some({tag:x.length>0&&(x[0].inline||x[0].block)||"div",styles:r.dom.parseStyle(r.formatter.getCssText(m))}):O.none()},onAction:NI(r),updateText:m=>{const x=D=>gM(D)?Rn(D.items,x):Kk(D)?[{title:D.title,format:D.format}]:[],y=Rn(bM(r),x),E=yN(r,Y(y)).fold(Y({title:f,tooltipLabel:""}),D=>({title:D.title,tooltipLabel:D.title}));so(m,Xd,{text:E.title}),((D,A)=>{D.dispatch("StylesTextUpdate",A)})(r,{value:E.tooltipLabel})},shouldHide:CO(r),isInvalid:m=>!r.formatter.canApply(m.format),dataset:c}},ON=Y([Rt("toggleClass"),Rt("fetch"),jf("onExecute"),lt("getHotspot",O.some),lt("getAnchorOverrides",Y({})),Uu(),jf("onItemExecute"),ys("lazySink"),Rt("dom"),Rs("onOpen"),vn("splitDropdownBehaviours",[ji,uo,Bo]),lt("matchWidth",!1),lt("useMinWidth",!1),lt("eventOrder",{}),ys("role")].concat(MD())),E$=sc({factory:Il,schema:[Rt("dom")],name:"arrow",defaults:()=>({buttonBehaviours:tn([Bo.revoke()])}),overrides:r=>({dom:{tag:"span",attributes:{role:"presentation"}},action:c=>{c.getSystem().getByUid(r.uid).each(id)},buttonBehaviours:tn([Mo.config({toggleOnExecute:!1,toggleClass:r.toggleClass})])})}),C$=sc({factory:Il,schema:[Rt("dom")],name:"button",defaults:()=>({buttonBehaviours:tn([Bo.revoke()])}),overrides:r=>({dom:{tag:"span",attributes:{role:"presentation"}},action:c=>{c.getSystem().getByUid(r.uid).each(f=>{r.onExecute(f,c)})}})}),IN=Y([E$,C$,dd({factory:{sketch:r=>({uid:r.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:r.text}})},schema:[Rt("text")],name:"aria-descriptor"}),_f({schema:[Ca()],name:"menu",defaults:r=>({onExecute:(c,f)=>{c.getSystem().getByUid(r.uid).each(m=>{r.onItemExecute(m,c,f)})}})}),KI()]),u_=Dc({name:"SplitDropdown",configFields:ON(),partFields:IN(),factory:(r,c,f,m)=>{const x=P=>{Os.getCurrent(P).each(U=>{or.highlightFirst(U),uo.focusIn(U)})},y=P=>{ID(r,me,P,m,x,jl.HighlightMenuAndItem).get(j)},E=P=>{const U=hp(P,r,"button");return id(U),O.some(!0)},D={...Ws([zr((P,U)=>{Br(P,r,"aria-descriptor").each(B=>{const K=Zn("aria");Eo(B.element,"id",K),Eo(P.element,"aria-describedby",K)})})]),...cx(O.some(y))},A={repositionMenus:P=>{Mo.isOn(P)&&Hg(P)}};return{uid:r.uid,dom:r.dom,components:c,apis:A,eventOrder:{...r.eventOrder,[pr()]:["disabling","toggling","alloy.base.behaviour"]},events:D,behaviours:eo(r.splitDropdownBehaviours,[ji.config({others:{sandbox:P=>{const U=hp(P,r,"arrow");return PD(r,P,{onOpen:()=>{Mo.on(U),Mo.on(P)},onClose:()=>{Mo.off(U),Mo.off(P)}})}}}),uo.config({mode:"special",onSpace:E,onEnter:E,onDown:P=>(y(P),O.some(!0))}),Bo.config({}),Mo.config({toggleOnExecute:!1,aria:{mode:"expanded"}})]),domModification:{attributes:{role:r.role.getOr("button"),"aria-haspopup":!0}}}},apis:{repositionMenus:(r,c)=>r.repositionMenus(c)}}),PN=r=>({isEnabled:()=>!Ho.isDisabled(r),setEnabled:c=>Ho.set(r,!c),setText:c=>so(r,Xd,{text:c}),setIcon:c=>so(r,Kg,{icon:c})}),_$=r=>({setActive:c=>{Mo.set(r,c)},isActive:()=>Mo.isOn(r),isEnabled:()=>!Ho.isDisabled(r),setEnabled:c=>Ho.set(r,!c),setText:c=>so(r,Xd,{text:c}),setIcon:c=>so(r,Kg,{icon:c})}),MN=(r,c)=>r.map(f=>({"aria-label":c.translate(f)})).getOr({}),NN=Zn("focus-button"),wA=(r,c,f,m,x,y)=>{const E=c.map(A=>dr(uw(A,"tox-tbtn",x))),D=r.map(A=>dr(mm(A,x.icons)));return{dom:{tag:"button",classes:["tox-tbtn"].concat(c.isSome()?["tox-tbtn--select"]:[]),attributes:{...MN(f,x),...z(y)?{"data-mce-name":y}:{}}},components:yx([D.map(A=>A.asSpec()),E.map(A=>A.asSpec())]),eventOrder:{[ce()]:["focusing","alloy.base.behaviour",_b],[Sc()]:[_b,"toolbar-group-button-events"]},buttonBehaviours:tn([BE(x.isDisabled),Ia(),Qo(_b,[zr((A,P)=>OC(A)),Ft(Xd,(A,P)=>{E.bind(U=>U.getOpt(A)).each(U=>{Do.set(U,[Pr(x.translate(P.event.text))])})}),Ft(Kg,(A,P)=>{D.bind(U=>U.getOpt(A)).each(U=>{Do.set(U,[mm(P.event.icon,x.icons)])})}),Ft(ce(),(A,P)=>{P.event.prevent(),rs(A,NN)})])].concat(m.getOr([])))}},ww=(r,c,f,m)=>{var x;const y=ho(j),E=wA(r.icon,r.text,r.tooltip,O.none(),f,m);return Il.sketch({dom:E.dom,components:E.components,eventOrder:Sk,buttonBehaviours:{...tn([Qo("toolbar-button-events",[(D={onAction:r.onAction,getApi:c.getApi},Ud((A,P)=>{Ky(D,A)(U=>{so(A,RC,{buttonApi:U}),D.onAction(U)})})),Mg(c,y),xp(c,y)]),...r.tooltip.map(A=>Pl.config(f.tooltips.getConfig({tooltipText:f.translate(A)+r.shortcut.map(P=>` (${$E(P)})`).getOr("")}))).toArray(),BE(()=>!r.enabled||f.isDisabled()),Ia()].concat(c.toolbarButtonBehaviours)),[_b]:(x=E.buttonBehaviours)===null||x===void 0?void 0:x[_b]}});var D},FN=(r,c,f,m)=>ww(r,{toolbarButtonBehaviours:f.length>0?[Qo("toolbarButtonWith",f)]:[],getApi:PN,onSetup:r.onSetup},c,m),Sw=(r,c,f,m)=>ww(r,{toolbarButtonBehaviours:[Do.config({}),Mo.config({toggleClass:"tox-tbtn--enabled",aria:{mode:"pressed"},toggleOnExecute:!1})].concat(f.length>0?[Qo("toolbarToggleButtonWith",f)]:[]),getApi:_$,onSetup:r.onSetup},c,m),T$=(r,c,f)=>m=>$g(x=>c.fetch(x)).map(x=>O.from(tC(Ze(kD(Zn("menu-value"),x,y=>{c.onItemAction(r(m),y)},c.columns,c.presets,ah.CLOSE_ON_EXECUTE,c.select.getOr(ve),f),{movement:tw(c.columns,c.presets),menuBehaviours:jy(c.columns!=="auto"?[]:[zr((y,E)=>{uD(y,4,Og(c.presets)).each(({numRows:D,numColumns:A})=>{uo.setGridSize(y,D,A)})})])})))),D$=[{name:"history",items:["undo","redo"]},{name:"ai",items:["aidialog","aishortcuts"]},{name:"styles",items:["styles"]},{name:"formatting",items:["bold","italic"]},{name:"alignment",items:["alignleft","aligncenter","alignright","alignjustify"]},{name:"indentation",items:["outdent","indent"]},{name:"permanent pen",items:["permanentpen"]},{name:"comments",items:["addcomment"]}],Ew=(r,c)=>(f,m,x,y)=>{const E=r(f).mapError(D=>xc(D)).getOrDie();return c(E,m,x,y)},k$={button:Ew(ME,(r,c,f,m)=>((x,y,E)=>FN(x,y,[],E))(r,c.shared.providers,m)),togglebutton:Ew(Wy,(r,c,f,m)=>((x,y,E)=>Sw(x,y,[],E))(r,c.shared.providers,m)),menubutton:Ew(eA,(r,c,f,m)=>fw(r,"tox-tbtn",c,O.none(),!1,m)),splitbutton:Ew(r=>Rr("SplitButton",$8,r),(r,c,f,m)=>((x,y,E)=>{const D=ho(x.tooltip.getOr("")),A=B=>({isEnabled:()=>!Ho.isDisabled(B),setEnabled:K=>Ho.set(B,!K),setIconFill:(K,oe)=>{si(B.element,`svg path[class="${K}"], rect[class="${K}"]`).each(ne=>{Eo(ne,"fill",oe)})},setActive:K=>{Eo(B.element,"aria-pressed",K),si(B.element,"span").each(oe=>{B.getSystem().getByDom(oe).each(ne=>Mo.set(ne,K))})},isActive:()=>si(B.element,"span").exists(K=>B.getSystem().getByDom(K).exists(Mo.isOn)),setText:K=>si(B.element,"span").each(oe=>B.getSystem().getByDom(oe).each(ne=>so(ne,Xd,{text:K}))),setIcon:K=>si(B.element,"span").each(oe=>B.getSystem().getByDom(oe).each(ne=>so(ne,Kg,{icon:K}))),setTooltip:K=>{const oe=y.providers.translate(K);Eo(B.element,"aria-label",oe),D.set(K)}}),P=ho(j),U={getApi:A,onSetup:x.onSetup};return u_.sketch({dom:{tag:"div",classes:["tox-split-button"],attributes:{"aria-pressed":!1,...MN(x.tooltip,y.providers),...z(E)?{"data-mce-name":E}:{}}},onExecute:B=>{const K=A(B);K.isEnabled()&&x.onAction(K)},onItemExecute:(B,K,oe)=>{},splitDropdownBehaviours:tn([_I(y.providers.isDisabled),Ia(),Qo("split-dropdown-events",[zr((B,K)=>OC(B)),Ft(NN,Bo.focus),Mg(U,P),xp(U,P)]),Eb.config({}),...x.tooltip.map(B=>Pl.config({...y.providers.tooltips.getConfig({tooltipText:y.providers.translate(B),onShow:K=>{if(D.get()!==B){const oe=y.providers.translate(D.get());Pl.setComponents(K,y.providers.tooltips.getComponents({tooltipText:oe}))}}})})).toArray()]),eventOrder:{[Sc()]:["alloy.base.behaviour","split-dropdown-events","tooltipping"],[kl()]:["split-dropdown-events","tooltipping"]},toggleClass:"tox-tbtn--enabled",lazySink:y.getSink,fetch:T$(A,x,y.providers),parts:{menu:OE(0,x.columns,x.presets)},components:[u_.parts.button(wA(x.icon,x.text,O.none(),O.some([Mo.config({toggleClass:"tox-tbtn--enabled",toggleOnExecute:!1})]),y.providers)),u_.parts.arrow({dom:{tag:"button",classes:["tox-tbtn","tox-split-button__chevron"],innerHtml:ZO("chevron-down",y.providers.icons)},buttonBehaviours:tn([_I(y.providers.isDisabled),Ia(),AE()])}),u_.parts["aria-descriptor"]({text:y.providers.translate("To open the popup, press Shift+Enter")})]})})(r,c.shared,m)),grouptoolbarbutton:Ew(r=>Rr("GroupToolbarButton",F8,r),(r,c,f,m)=>{const x=f.ui.registry.getAll().buttons,y={[Hv]:c.shared.header.isPositionedAtTop()?Ta.TopToBottom:Ta.BottomToTop};if(cb(f)===jd.floating)return((E,D,A,P,U)=>{const B=D.shared,K=ho(j),oe={toolbarButtonBehaviours:[],getApi:PN,onSetup:E.onSetup},ne=[Qo("toolbar-group-button-events",[Mg(oe,K),xp(oe,K)])];return gh.sketch({lazySink:B.getSink,fetch:()=>$g(ge=>{ge(qe(A(E.items),a_))}),markers:{toggledClass:"tox-tbtn--enabled"},parts:{button:wA(E.icon,E.text,E.tooltip,O.some(ne),B.providers,U),toolbar:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:P}}}})})(r,c,E=>Pb(f,{buttons:x,toolbar:E,allowToolbarGroups:!1},c,O.none()),y,m);throw new Error("Toolbar groups are only supported when using floating toolbar mode")})},A$={styles:(r,c)=>{const f={type:"advanced",...c.styles};return xw(r,c,yA(r,f),RN,"StylesTextUpdate","styles")},fontsize:(r,c)=>xw(r,c,LN(r),kN,"FontSizeTextUpdate","fontsize"),fontsizeinput:(r,c)=>((f,m,x,y)=>{let E=O.none();const D=Sp(f,"NodeChange SwitchMode",be=>{const Te=be.getComponent();E=O.some(Te),x.updateInputValue(Te),Ho.set(Te,!f.selection.isEditable())}),A=be=>({getComponent:Y(be)}),P=ho(j),U=Zn("custom-number-input-events"),B=(be,Te,ke)=>{const Ke=E.map(xn=>at.getValue(xn)).getOr(""),dt=x.getNewValue(Ke,be),zt=Ke.length-`${dt}`.length,Wt=E.map(xn=>xn.element.dom.selectionStart-zt),en=E.map(xn=>xn.element.dom.selectionEnd-zt);x.onAction(dt,ke),E.each(xn=>{at.setValue(xn,dt),Te&&(Wt.each($n=>xn.element.dom.selectionStart=$n),en.each($n=>xn.element.dom.selectionEnd=$n))})},K=(be,Te)=>B((ke,Ke)=>ke-Ke,be,Te),oe=(be,Te)=>B((ke,Ke)=>ke+Ke,be,Te),ne=be=>li(be.element).fold(O.none,Te=>($u(Te),O.some(!0))),ge=be=>Qm(be.element)?(Hi(be.element).each(Te=>$u(Te)),O.some(!0)):O.none(),he=(be,Te,ke,Ke)=>{const dt=ho(j),zt=m.shared.providers.translate(ke),Wt=Zn("altExecuting"),en=Sp(f,"NodeChange SwitchMode",$n=>{Ho.set($n.getComponent(),!f.selection.isEditable())}),xn=$n=>{Ho.isDisabled($n)||be(!0)};return Il.sketch({dom:{tag:"button",attributes:{"aria-label":zt,"data-mce-name":Te},classes:Ke.concat(Te)},components:[Ek(Te,m.shared.providers.icons)],buttonBehaviours:tn([Ho.config({}),Pl.config(m.shared.providers.tooltips.getConfig({tooltipText:zt})),Qo(Wt,[Mg({onSetup:en,getApi:A},dt),xp({getApi:A},dt),Ft(Jn(),($n,ro)=>{ro.event.raw.keyCode!==DN.space()&&ro.event.raw.keyCode!==DN.enter()||Ho.isDisabled($n)||be(!1)}),Ft(Dl(),xn),Ft(N(),xn)])]),eventOrder:{[Jn()]:[Wt,"keying"],[Dl()]:[Wt,"alloy.base.behaviour"],[N()]:[Wt,"alloy.base.behaviour"],[Sc()]:["alloy.base.behaviour",Wt,"tooltipping"],[kl()]:[Wt,"tooltipping"]}})},Le=dr(he(be=>K(!1,be),"minus","Decrease font size",[])),fe=dr(he(be=>oe(!1,be),"plus","Increase font size",[])),de=dr({dom:{tag:"div",classes:["tox-input-wrapper"]},components:[vp.sketch({inputBehaviours:tn([Ho.config({}),Qo(U,[Mg({onSetup:D,getApi:A},P),xp({getApi:A},P)]),Qo("input-update-display-text",[Ft(Xd,(be,Te)=>{at.setValue(be,Te.event.text)}),Ft($o(),be=>{x.onAction(at.getValue(be))}),Ft(Va(),be=>{x.onAction(at.getValue(be))})]),uo.config({mode:"special",onEnter:be=>(B(me,!0,!0),O.some(!0)),onEscape:ne,onUp:be=>(oe(!0,!1),O.some(!0)),onDown:be=>(K(!0,!1),O.some(!0)),onLeft:(be,Te)=>(Te.cut(),O.none()),onRight:(be,Te)=>(Te.cut(),O.none())})])})],behaviours:tn([Bo.config({}),uo.config({mode:"special",onEnter:ge,onSpace:ge,onEscape:ne}),Qo("input-wrapper-events",[Ft(Yn(),be=>{mt([Le,fe],Te=>{const ke=Ie(Te.get(be).element.dom);Qm(ke)&&Jm(ke)})})])])});return{dom:{tag:"div",classes:["tox-number-input"],attributes:{...z(y)?{"data-mce-name":y}:{}}},components:[Le.asSpec(),de.asSpec(),fe.asSpec()],behaviours:tn([Bo.config({}),uo.config({mode:"flow",focusInside:tb.OnEnterOrSpaceMode,cycles:!1,selector:"button, .tox-input-wrapper",onEscape:be=>Qm(be.element)?O.none():($u(be.element),O.some(!0))})])}})(r,c,(f=>{const m=()=>f.queryCommandValue("FontSize");return{updateInputValue:x=>so(x,Xd,{text:m()}),onAction:(x,y)=>f.execCommand("FontSize",!1,x,{skip_focus:!y}),getNewValue:(x,y)=>{yw(x,["unsupportedLength","empty"]);const E=m(),D=yw(x,["unsupportedLength","empty"]).or(yw(E,["unsupportedLength","empty"])),A=D.map(oe=>oe.value).getOr(16),P=P2(f),U=D.map(oe=>oe.unit).filter(oe=>oe!=="").getOr(P),B=y(A,(oe=>{var ne;return(ne={em:{step:.1},cm:{step:.1},in:{step:.1},pc:{step:.1},ch:{step:.1},rem:{step:.1}}[oe])!==null&&ne!==void 0?ne:{step:1}})(U).step),K=`${(oe=>oe>=0)(B)?B:A}${U}`;return K!==E&&((oe,ne)=>{oe.dispatch("FontSizeInputTextUpdate",ne)})(f,{value:K}),K}}})(r),"fontsizeinput"),fontfamily:(r,c)=>xw(r,c,TN(r),EN,"FontFamilyTextUpdate","fontfamily"),blocks:(r,c)=>xw(r,c,SN(r),wN,"BlocksTextUpdate","blocks"),align:(r,c)=>xw(r,c,xN(r),gA,"AlignTextUpdate","align")},Pb=(r,c,f,m)=>{const x=(E=>{const D=E.toolbar,A=E.buttons;return D===!1?[]:D===void 0||D===!0?(P=>{const U=qe(D$,B=>{const K=on(B.items,oe=>On(P,oe)||On(A$,oe));return{name:B.name,items:K}});return on(U,B=>B.items.length>0)})(A):h(D)?(P=>{const U=P.split("|");return qe(U,B=>({items:B.trim().split(" ")}))})(D):(P=>Q(P,U=>On(U,"name")&&On(U,"items")))(D)?D:(console.error("Toolbar type should be string, string[], boolean or ToolbarGroup[]"),[])})(c),y=qe(x,E=>{const D=Rn(E.items,A=>A.trim().length===0?[]:((P,U,B,K,oe,ne)=>At(U,B.toLowerCase()).orThunk(()=>ne.bind(ge=>Kn(ge,he=>At(U,he+B.toLowerCase())))).fold(()=>At(A$,B.toLowerCase()).map(ge=>ge(P,oe)),ge=>ge.type!=="grouptoolbarbutton"||K?((he,Le,fe,de)=>At(k$,he.type).fold(()=>(console.error("skipping button defined by",he),O.none()),be=>O.some(be(he,Le,fe,de))))(ge,oe,P,B.toLowerCase()):(console.warn(`Ignoring the '${B}' toolbar button. Group toolbar buttons are only supported when using floating toolbar mode and cannot be nested.`),O.none())))(r,c.buttons,A,c.allowToolbarGroups,f,m).toArray());return{title:O.from(r.translate(E.name)),items:D}});return on(y,E=>E.items.length>0)},Mb=(r,c,f,m)=>{const x=c.mainUi.outerContainer,y=f.toolbar,E=f.buttons;if(Q(y,h)){const D=y.map(A=>{const P={toolbar:A,buttons:E,allowToolbarGroups:f.allowToolbarGroups};return Pb(r,P,m,O.none())});Gr.setToolbars(x,D)}else Gr.setToolbar(x,Pb(r,f,m,O.none()))},SA=da(),BN=SA.os.isiOS()&&SA.os.version.major<=12;var L$=Object.freeze({__proto__:null,render:(r,c,f,m,x)=>{const{mainUi:y,uiMotherships:E}=c,D=ho(0),A=y.outerContainer;p$(r);const P=Ie(x.targetNode),U=ca(jr(P));Et(P,y.mothership),((ne,ge,he)=>{bp(ne)&&Et(he.mainUi.mothership.element,he.popupUi.mothership),ex(ge,he.dialogUi.mothership)})(r,U,c),r.on("SkinLoaded",()=>{Gr.setSidebar(A,f.sidebar,mE(r)),Mb(r,c,f,m),D.set(r.getWin().innerWidth),Gr.setMenubar(A,mN(r,f)),Gr.setViews(A,f.views),((ne,ge)=>{const{uiMotherships:he}=ge,Le=ne.dom;let fe=ne.getWin();const de=ne.getDoc().documentElement,be=ho(Sn(fe.innerWidth,fe.innerHeight)),Te=ho(Sn(de.offsetWidth,de.offsetHeight)),ke=()=>{const Wt=be.get();Wt.left===fe.innerWidth&&Wt.top===fe.innerHeight||(be.set(Sn(fe.innerWidth,fe.innerHeight)),am(ne))},Ke=()=>{const Wt=ne.getDoc().documentElement,en=Te.get();en.left===Wt.offsetWidth&&en.top===Wt.offsetHeight||(Te.set(Sn(Wt.offsetWidth,Wt.offsetHeight)),am(ne))},dt=Wt=>{((en,xn)=>{en.dispatch("ScrollContent",xn)})(ne,Wt)};Le.bind(fe,"resize",ke),Le.bind(fe,"scroll",dt);const zt=xf(Ie(ne.getBody()),"load",Ke);ne.on("hide",()=>{mt(he,Wt=>{Ro(Wt.element,"display","none")})}),ne.on("show",()=>{mt(he,Wt=>{us(Wt.element,"display")})}),ne.on("NodeChange",Ke),ne.on("remove",()=>{zt.unbind(),Le.unbind(fe,"resize",ke),Le.unbind(fe,"scroll",dt),fe=null})})(r,c)});const B=Gr.getSocket(A).getOrDie("Could not find expected socket element");if(BN){tc(B.element,{overflow:"scroll","-webkit-overflow-scrolling":"touch"});const ne=((he,Le)=>{let fe=null;return{cancel:()=>{T(fe)||(clearTimeout(fe),fe=null)},throttle:(...de)=>{T(fe)&&(fe=setTimeout(()=>{fe=null,he.apply(null,de)},20))}}})(()=>{r.dispatch("ScrollContent")}),ge=Rl(B.element,"scroll",ne.throttle);r.on("remove",ge.unbind)}CI(r,c),r.addCommand("ToggleSidebar",(ne,ge)=>{Gr.toggleSidebar(A,ge),r.dispatch("ToggleSidebar")}),r.addQueryValueHandler("ToggleSidebar",()=>{var ne;return(ne=Gr.whichSidebar(A))!==null&&ne!==void 0?ne:""}),r.addCommand("ToggleView",(ne,ge)=>{if(Gr.toggleView(A,ge)){const he=A.element;y.mothership.broadcastOn([I()],{target:he}),mt(E,Le=>{Le.broadcastOn([I()],{target:he})}),T(Gr.whichView(A))&&(r.focus(),r.nodeChanged(),Gr.refreshToolbar(A))}}),r.addQueryValueHandler("ToggleView",()=>{var ne;return(ne=Gr.whichView(A))!==null&&ne!==void 0?ne:""});const K=cb(r);K!==jd.sliding&&K!==jd.floating||r.on("ResizeWindow ResizeEditor ResizeContent",()=>{const ne=r.getWin().innerWidth;ne!==D.get()&&(Gr.refreshToolbar(c.mainUi.outerContainer),D.set(ne))});const oe={setEnabled:ne=>{vb(c,!ne)},isEnabled:()=>!Ho.isDisabled(A)};return{iframeContainer:B.element.dom,editorContainer:A.element.dom,api:oe}}});const $N=r=>/^[0-9\.]+(|px)$/i.test(""+r)?O.some(parseInt(""+r,10)):O.none(),EA=r=>W(r)?r+"px":r,d_=(r,c,f)=>{const m=c.filter(y=>r<y),x=f.filter(y=>r>y);return m.or(x).getOr(r)},HN=r=>{const c=yy(r),f=wy(r),m=hx(r);return $N(c).map(x=>d_(x,f,m))},{ToolbarLocation:CA,ToolbarMode:UN}=Dy,R$=(r,c,f,m,x)=>{const{mainUi:y,uiMotherships:E}=f,D=dx.DOM,A=ub(r),P=gp(r),U=hx(r).or(HN(r)),B=m.shared.header,K=B.isPositionedAtTop,oe=cb(r),ne=oe===UN.sliding||oe===UN.floating,ge=ho(!1),he=()=>ge.get()&&!r.removed,Le=Te=>ne?Te.fold(Y(0),ke=>ke.components().length>1?Qe(ke.components()[1].element):0):0,fe=()=>{mt(E,Te=>{Te.broadcastOn([H()],{})})},de=Te=>{if(!he())return;A||x.on(dt=>{const zt=U.getOrThunk(()=>Oa().width-Ds(c).left-10);Ro(dt.element,"max-width",zt+"px")});const ke=ui(),Ke=!(A||A||!(wr(y.outerContainer.element).left+Zr(y.outerContainer.element)>=window.innerWidth-40||yi(y.outerContainer.element,"width").isSome())||(Ro(y.outerContainer.element,"position","absolute"),Ro(y.outerContainer.element,"left","0px"),us(y.outerContainer.element,"width"),0));if(ne&&Gr.refreshToolbar(y.outerContainer),!A){const dt=ui(),zt=qo(ke.left!==dt.left,ke);((Wt,en)=>{x.on(xn=>{const $n=Gr.getToolbar(y.outerContainer),ro=Le($n),xo=Ys(c),Zo=((_o,Ai)=>bp(_o)?rg(Ai):O.none())(r,y.outerContainer.element),ws=Zo.fold(()=>xo.x,_o=>{const Ai=Ys(_o);return po(_o,Fa())?xo.x:xo.x-Ai.x}),ii=qo(Wt,Math.ceil(y.outerContainer.element.dom.getBoundingClientRect().width)).filter(_o=>_o>150).map(_o=>{const Ai=en.getOr(ui()),No=window.innerWidth-(ws-Ai.left),Qr=Math.max(Math.min(_o,No),150);return No<_o&&Ro(y.outerContainer.element,"width",Qr+"px"),{width:Qr+"px"}}).getOr({width:"max-content"}),pi={position:"absolute",left:Math.round(ws)+"px",top:Zo.fold(()=>K()?Math.max(xo.y-Qe(xn.element)+ro,0):xo.bottom,_o=>{var Ai;const No=Ys(_o),Qr=(Ai=_o.dom.scrollTop)!==null&&Ai!==void 0?Ai:0,fr=po(_o,Fa())?Math.max(xo.y-Qe(xn.element)+ro,0):xo.y-No.y+Qr-Qe(xn.element)+ro;return K()?fr:xo.bottom})+"px"};tc(y.outerContainer.element,{...pi,...ii})})})(Ke,zt),zt.each(Wt=>{$s(Wt.left,dt.top)})}P&&x.on(Te),fe()},be=()=>!(A||!P||!he())&&x.get().exists(Te=>{const ke=B.getDockingMode(),Ke=(zt=>{switch(_g(r)){case CA.auto:const Wt=Gr.getToolbar(y.outerContainer),en=Le(Wt),xn=Qe(zt.element)-en,$n=Ys(c);if($n.y>xn)return"top";{const ro=Ur(c),xo=Math.max(ro.dom.scrollHeight,Qe(ro));return $n.bottom<xo-xn||Ii().bottom<$n.bottom-xn?"bottom":"top"}case CA.bottom:return"bottom";case CA.top:default:return"top"}})(Te);return Ke!==ke&&(dt=Ke,x.on(zt=>{mi.setModes(zt,[dt]),B.setDockingMode(dt);const Wt=K()?Ta.TopToBottom:Ta.BottomToTop;Eo(zt.element,Hv,Wt)}),!0);var dt});return{isVisible:he,isPositionedAtTop:K,show:()=>{ge.set(!0),Ro(y.outerContainer.element,"display","flex"),D.addClass(r.getBody(),"mce-edit-focus"),mt(E,Te=>{us(Te.element,"display")}),be(),bp(r)?de(Te=>mi.isDocked(Te)?mi.reset(Te):mi.refresh(Te)):de(mi.refresh)},hide:()=>{ge.set(!1),Ro(y.outerContainer.element,"display","none"),D.removeClass(r.getBody(),"mce-edit-focus"),mt(E,Te=>{Ro(Te.element,"display","none")})},update:de,updateMode:()=>{be()&&de(mi.reset)},repositionPopups:fe}},VN=(r,c)=>{const f=Ys(r);return{pos:c?f.y:f.bottom,bounds:f}};var O$=Object.freeze({__proto__:null,render:(r,c,f,m,x)=>{const{mainUi:y}=c,E=nr(),D=Ie(x.targetNode),A=R$(r,D,c,m,E),P=TO(r);bN(r);const U=()=>{if(E.isSet())return void A.show();E.set(Gr.getHeader(y.outerContainer).getOrDie());const K=xE(r);bp(r)?(Et(D,y.mothership),Et(D,c.popupUi.mothership)):ex(K,y.mothership),ex(K,c.dialogUi.mothership);const oe=()=>{Mb(r,c,f,m),Gr.setMenubar(y.outerContainer,mN(r,f)),A.show(),((ne,ge,he,Le)=>{const fe=ho(VN(ge,he.isPositionedAtTop())),de=Ke=>{const{pos:dt,bounds:zt}=VN(ge,he.isPositionedAtTop()),{pos:Wt,bounds:en}=fe.get(),xn=zt.height!==en.height||zt.width!==en.width;fe.set({pos:dt,bounds:zt}),xn&&am(ne,Ke),he.isVisible()&&(Wt!==dt?he.update(mi.reset):xn&&(he.updateMode(),he.repositionPopups()))};Le||(ne.on("activate",he.show),ne.on("deactivate",he.hide)),ne.on("SkinLoaded ResizeWindow",()=>he.update(mi.reset)),ne.on("NodeChange keydown",Ke=>{requestAnimationFrame(()=>de(Ke))});let be=0;const Te=DC(()=>he.update(mi.refresh),33);ne.on("ScrollWindow",()=>{const Ke=ui().left;Ke!==be&&(be=Ke,Te.throttle()),he.updateMode()}),bp(ne)&&ne.on("ElementScroll",Ke=>{he.update(mi.refresh)});const ke=mc();ke.set(xf(Ie(ne.getBody()),"load",Ke=>de(Ke.raw))),ne.on("remove",()=>{ke.clear()})})(r,D,A,P),r.nodeChanged()};P?r.once("SkinLoaded",oe):oe()};r.on("show",U),r.on("hide",A.hide),P||(r.on("focus",U),r.on("blur",A.hide)),r.on("init",()=>{(r.hasFocus()||P)&&U()}),CI(r,c);const B={show:U,hide:A.hide,setEnabled:K=>{vb(c,!K)},isEnabled:()=>!Ho.isDisabled(y.outerContainer)};return{editorContainer:y.outerContainer.element.dom,api:B}}});const zN="contexttoolbar-hide",_A=(r,c)=>Ft(RC,(f,m)=>{const x=(y=>({hide:()=>rs(y,lv()),getValue:()=>at.getValue(y)}))(r.get(f));c.onAction(x,m.event.buttonApi)}),zx=(r,c)=>{const f=r.label.fold(()=>({}),y=>({"aria-label":y})),m=dr(vp.sketch({inputClasses:["tox-toolbar-textfield","tox-toolbar-nav-js"],data:r.initValue(),inputAttributes:f,selectOnFocus:!0,inputBehaviours:tn([uo.config({mode:"special",onEnter:y=>x.findPrimary(y).map(E=>(id(E),!0)),onLeft:(y,E)=>(E.cut(),O.none()),onRight:(y,E)=>(E.cut(),O.none())})])})),x=((y,E,D)=>{const A=qe(E,P=>dr(((U,B,K)=>(oe=>oe.type==="contextformtogglebutton")(B)?((oe,ne,ge)=>{const{primary:he,...Le}=ne.original,fe=Vl(Wy({...Le,type:"togglebutton",onAction:j}));return Sw(fe,ge,[_A(oe,ne)])})(U,B,K):((oe,ne,ge)=>{const{primary:he,...Le}=ne.original,fe=Vl(ME({...Le,type:"button",onAction:j}));return FN(fe,ge,[_A(oe,ne)])})(U,B,K))(y,P,D)));return{asSpecs:()=>qe(A,P=>P.asSpec()),findPrimary:P=>Kn(E,(U,B)=>U.primary?O.from(A[B]).bind(K=>K.getOpt(P)).filter(Ue(Ho.isDisabled)):O.none())}})(m,r.commands,c);return[{title:O.none(),items:[m.asSpec()]},{title:O.none(),items:x.asSpecs()}]},Xg=(r,c,f)=>c.bottom-r.y>=f&&r.bottom-c.y>=f,TA=r=>{const c=(f=>{const m=f.getBoundingClientRect();if(m.height<=0&&m.width<=0){const x=Qa(Ie(f.startContainer),f.startOffset).element;return(Ko(x)?la(x):O.some(x)).filter(zn).map(y=>y.dom.getBoundingClientRect()).getOr(m)}return m})(r.selection.getRng());if(r.inline){const f=ui();return Oi(f.left+c.left,f.top+c.top,c.width,c.height)}{const f=fc(Ie(r.getBody()));return Oi(f.x+c.left,f.y+c.top,c.width,c.height)}},DA=(r,c,f,m=0)=>{const x=Oa(window),y=Ys(Ie(r.getContentAreaContainer())),E=Cy(r)||_y(r)||Ty(r),{x:D,width:A}=((P,U,B)=>{const K=Math.max(P.x+B,U.x);return{x:K,width:Math.min(P.right-B,U.right)-K}})(y,x,m);if(r.inline&&!E)return Oi(D,x.y,A,x.height);{const P=c.header.isPositionedAtTop(),{y:U,bottom:B}=((K,oe,ne,ge,he,Le)=>{const fe=Ie(K.getContainer()),de=si(fe,".tox-editor-header").getOr(fe),be=Ys(de),Te=be.y>=oe.bottom,ke=ge&&!Te;if(K.inline&&ke)return{y:Math.max(be.bottom+Le,ne.y),bottom:ne.bottom};if(K.inline&&!ke)return{y:ne.y,bottom:Math.min(be.y-Le,ne.bottom)};const Ke=he==="line"?Ys(fe):oe;return ke?{y:Math.max(be.bottom+Le,ne.y),bottom:Math.min(Ke.bottom-Le,ne.bottom)}:{y:Math.max(Ke.y+Le,ne.y),bottom:Math.min(be.y-Le,ne.bottom)}})(r,y,x,P,f,m);return Oi(D,U,A,B-U)}},kA={valignCentre:[],alignCentre:[],alignLeft:["tox-pop--align-left"],alignRight:["tox-pop--align-right"],right:["tox-pop--right"],left:["tox-pop--left"],bottom:["tox-pop--bottom"],top:["tox-pop--top"],inset:["tox-pop--inset"]},Cw={maxHeightFunction:zd(),maxWidthFunction:bw()},GN=r=>r==="node",_w=(r,c,f,m,x)=>{const y=TA(r),E=m.lastElement().exists(D=>po(f,D));return((D,A)=>{const P=D.selection.getRng(),U=Qa(Ie(P.startContainer),P.startOffset);return P.startContainer===P.endContainer&&P.startOffset===P.endOffset-1&&po(U.element,A)})(r,f)?E?Wk:Cd:E?((D,A,P)=>{const U=yi(D,"position");Ro(D,"position",A);const B=Xg(y,Ys(c),-20)&&!m.isReposition()?fM:Wk;return U.each(K=>Ro(D,"position",K)),B})(c,m.getMode()):(m.getMode()==="fixed"?x.y+ui().top:x.y)+(Qe(c)+12)<=y.y?Cd:gw},Tw=(r,c,f,m)=>{const x=E=>(D,A,P,U,B)=>({..._w(r,U,E,f,B)({...D,y:B.y,height:B.height},A,P,U,B),alwaysFit:!0}),y=E=>GN(m)?[x(E)]:[];return c?{onLtr:E=>[Jr,_a,Ei,ea,Wi,ir].concat(y(E)),onRtl:E=>[Jr,Ei,_a,Wi,ea,ir].concat(y(E))}:{onLtr:E=>[ir,Jr,ea,_a,Wi,Ei].concat(y(E)),onRtl:E=>[ir,Jr,Wi,Ei,ea,_a].concat(y(E))}},AA=(r,c)=>{const f=on(c,y=>y.predicate(r.dom)),{pass:m,fail:x}=Un(f,y=>y.type==="contexttoolbar");return{contextToolbars:m,contextForms:x}},I$=(r,c)=>{const f={},m=[],x=[],y={},E={},D=Jt(r);return mt(D,A=>{const P=r[A];P.type==="contextform"?((U,B)=>{const K=Vl(Rr("ContextForm",l6,B));f[U]=K,K.launch.map(oe=>{y["form:"+U]={...B.launch,type:oe.type==="contextformtogglebutton"?"togglebutton":"button",onAction:()=>{c(K)}}}),K.scope==="editor"?x.push(K):m.push(K),E[U]=K})(A,P):P.type==="contexttoolbar"&&((U,B)=>{var K;(K=B,Rr("ContextToolbar",gI,K)).each(oe=>{B.scope==="editor"?x.push(oe):m.push(oe),E[U]=oe})})(A,P)}),{forms:f,inNodeScope:m,inEditorScope:x,lookupTable:E,formNavigators:y}},WN=Zn("forward-slide"),jN=Zn("backward-slide"),LA=Zn("change-slide-event"),RA="tox-pop--resizing",Gx="tox-pop--transition",P$=(r,c,f,m)=>{const x=m.backstage,y=x.shared,E=da().deviceType.isTouch,D=nr(),A=nr(),P=nr(),U=Qi((ke=>{const Ke=ho([]);return ri.sketch({dom:{tag:"div",classes:["tox-pop"]},fireDismissalEventInstead:{event:"doNotDismissYet"},onShow:dt=>{Ke.set([]),ri.getContent(dt).each(zt=>{us(zt.element,"visibility")}),hi(dt.element,RA),us(dt.element,"width")},inlineBehaviours:tn([Qo("context-toolbar-events",[Hm(cn(),(dt,zt)=>{zt.event.raw.propertyName==="width"&&(hi(dt.element,RA),us(dt.element,"width"))}),Ft(LA,(dt,zt)=>{const Wt=dt.element;us(Wt,"width");const en=ds(Wt);ri.setContent(dt,zt.event.contents),zi(Wt,RA);const xn=ds(Wt);Ro(Wt,"width",en+"px"),ri.getContent(dt).each($n=>{zt.event.focus.bind(ro=>($u(ro),Ll(Wt))).orThunk(()=>(uo.focusIn($n),Gl(jr(Wt))))}),setTimeout(()=>{Ro(dt.element,"width",xn+"px")},0)}),Ft(WN,(dt,zt)=>{ri.getContent(dt).each(Wt=>{Ke.set(Ke.get().concat([{bar:Wt,focus:Gl(jr(dt.element))}]))}),so(dt,LA,{contents:zt.event.forwardContents,focus:O.none()})}),Ft(jN,(dt,zt)=>{Ct(Ke.get()).each(Wt=>{Ke.set(Ke.get().slice(0,Ke.get().length-1)),so(dt,LA,{contents:_c(Wt.bar),focus:Wt.focus})})})]),uo.config({mode:"special",onEscape:dt=>Ct(Ke.get()).fold(()=>ke.onEscape(),zt=>(rs(dt,jN),O.some(!0)))})]),lazySink:()=>os.value(ke.sink)})})({sink:f,onEscape:()=>(r.focus(),O.some(!0))})),B=()=>{const ke=P.get().getOr("node"),Ke=GN(ke)?1:0;return DA(r,y,ke,Ke)},K=()=>!(r.removed||E()&&x.isContextMenuOpen()),oe=()=>{if(K()){const ke=B(),Ke=Is(P.get(),"node")?((dt,zt)=>zt.filter(Wt=>Nr(Wt)&&Xn(Wt)).map(fc).getOrThunk(()=>TA(dt)))(r,D.get()):TA(r);return ke.height<=0||!Xg(Ke,ke,.01)}return!0},ne=()=>{D.clear(),A.clear(),P.clear(),ri.hide(U)},ge=()=>{if(ri.isOpen(U)){const ke=U.element;us(ke,"display"),oe()?Ro(ke,"display","none"):(A.set(0),ri.reposition(U))}},he=ke=>({dom:{tag:"div",classes:["tox-pop__dialog"]},components:[ke],behaviours:tn([uo.config({mode:"acyclic"}),Qo("pop-dialog-wrap-events",[zr(Ke=>{r.shortcuts.add("ctrl+F9","focus statusbar",()=>uo.focusIn(Ke))}),pf(Ke=>{r.shortcuts.remove("ctrl+F9")})])])}),Le=Nc(()=>I$(c,ke=>{const Ke=fe([ke]);so(U,WN,{forwardContents:he(Ke)})})),fe=ke=>{const{buttons:Ke}=r.ui.registry.getAll(),dt={...Ke,...Le().formNavigators},zt=cb(r)===jd.scrolling?jd.scrolling:jd.default,Wt=Vn(qe(ke,en=>en.type==="contexttoolbar"?((xn,$n)=>Pb(r,{buttons:xn,toolbar:$n.items,allowToolbarGroups:!1},m.backstage,O.some(["form:"])))(dt,en):((xn,$n)=>zx(xn,$n))(en,y.providers)));return Pf({type:zt,uid:Zn("context-toolbar"),initGroups:Wt,onEscape:O.none,cyclicKeying:!0,providers:y.providers})},de=(ke,Ke)=>{if(Te.cancel(),!K())return;const dt=fe(ke),zt=ke[0].position,Wt=((xn,$n)=>{const ro=xn==="node"?y.anchors.node($n):y.anchors.cursor(),xo=((Zo,ws,ii,pi)=>ws==="line"?{bubble:Tc(12,0,kA),layouts:{onLtr:()=>[Xm],onRtl:()=>[Ov]},overrides:Cw}:{bubble:Tc(0,12,kA,1/12),layouts:Tw(Zo,ii,pi,ws),overrides:Cw})(r,xn,E(),{lastElement:D.get,isReposition:()=>Is(A.get(),0),getMode:()=>tl.getMode(f)});return Ze(ro,xo)})(zt,Ke);P.set(zt),A.set(1);const en=U.element;us(en,"display"),(xn=>Is(Yt(xn,D.get(),po),!0))(Ke)||(hi(en,Gx),tl.reset(f,U)),ri.showWithinBounds(U,he(dt),{anchor:Wt,transition:{classes:[Gx],mode:"placement"}},()=>O.some(B())),Ke.fold(D.clear,D.set),oe()&&Ro(en,"display","none")};let be=!1;const Te=DC(()=>{!r.hasFocus()||r.removed||be||(zl(U.element,Gx)?Te.throttle():((ke,Ke)=>{const dt=Ie(Ke.getBody()),zt=en=>po(en,dt),Wt=Ie(Ke.selection.getNode());return(en=>!zt(en)&&!ts(dt,en))(Wt)?O.none():((en,xn,$n)=>{const ro=AA(en,xn);if(ro.contextForms.length>0)return O.some({elem:en,toolbars:[ro.contextForms[0]]});{const xo=AA(en,$n);if(xo.contextForms.length>0)return O.some({elem:en,toolbars:[xo.contextForms[0]]});if(ro.contextToolbars.length>0||xo.contextToolbars.length>0){const Zo=(ws=>{if(ws.length<=1)return ws;{const ii=No=>Dt(ws,Qr=>Qr.position===No),pi=No=>on(ws,Qr=>Qr.position===No),_o=ii("selection"),Ai=ii("node");if(_o||Ai){if(Ai&&_o){const No=pi("node"),Qr=qe(pi("selection"),fr=>({...fr,position:"node"}));return No.concat(Qr)}return pi(_o?"selection":"node")}return pi("line")}})(ro.contextToolbars.concat(xo.contextToolbars));return O.some({elem:en,toolbars:Zo})}return O.none()}})(Wt,ke.inNodeScope,ke.inEditorScope).orThunk(()=>((en,xn,$n)=>en(xn)?O.none():zc(xn,ro=>{if(zn(ro)){const{contextToolbars:xo,contextForms:Zo}=AA(ro,$n.inNodeScope),ws=Zo.length>0?Zo:(ii=>{if(ii.length<=1)return ii;{const pi=_o=>J(ii,Ai=>Ai.position===_o);return pi("selection").orThunk(()=>pi("node")).orThunk(()=>pi("line")).map(_o=>_o.position).fold(()=>[],_o=>on(ii,Ai=>Ai.position===_o))}})(xo);return ws.length>0?O.some({elem:ro,toolbars:ws}):O.none()}return O.none()},en))(zt,Wt,ke))})(Le(),r).fold(ne,ke=>{de(ke.toolbars,O.some(ke.elem))}))},17);r.on("init",()=>{r.on("remove",ne),r.on("ScrollContent ScrollWindow ObjectResized ResizeEditor longpress",ge),r.on("click keyup focus SetContent",Te.throttle),r.on(zN,ne),r.on("contexttoolbar-show",ke=>{const Ke=Le();At(Ke.lookupTable,ke.toolbarKey).each(dt=>{de([dt],qo(ke.target!==r,ke.target)),ri.getContent(U).each(uo.focusIn)})}),r.on("focusout",ke=>{lE.setEditorTimeout(r,()=>{Ll(f.element).isNone()&&Ll(U.element).isNone()&&ne()},0)}),r.on("SwitchMode",()=>{r.mode.isReadOnly()&&ne()}),r.on("ExecCommand",({command:ke})=>{ke.toLowerCase()==="toggleview"&&ne()}),r.on("AfterProgressState",ke=>{ke.state?ne():r.hasFocus()&&Te.throttle()}),r.on("dragstart",()=>{be=!0}),r.on("dragend drop",()=>{be=!1}),r.on("NodeChange",ke=>{Ll(U.element).fold(Te.throttle,j)})})},f_=(r,c)=>{const f=()=>{const m=c.getOptions(r),x=c.getCurrent(r).map(c.hash),y=nr();return qe(m,E=>({type:"togglemenuitem",text:c.display(E),onSetup:D=>{const A=U=>{U&&(y.on(B=>B.setActive(!1)),y.set(D)),D.setActive(U)};A(Is(x,c.hash(E)));const P=c.watcher(r,E,A);return()=>{y.clear(),P()}},onAction:()=>c.setCurrent(r,E)}))};r.ui.registry.addMenuButton(c.name,{tooltip:c.text,icon:c.icon,fetch:m=>m(f()),onSetup:c.onToolbarSetup}),r.ui.registry.addNestedMenuItem(c.name,{type:"nestedmenuitem",text:c.text,getSubmenuItems:f,onSetup:c.onMenuSetup})},M$=r=>{f_(r,(c=>({name:"lineheight",text:"Line height",icon:"line-height",getOptions:IO,hash:f=>((m,x)=>yw(m,["fixed","relative","empty"]).map(({value:y,unit:E})=>y+E))(f).getOr(f),display:me,watcher:(f,m,x)=>f.formatter.formatChanged("lineheight",x,!1,{value:m}).unbind,getCurrent:f=>O.from(f.queryCommandValue("LineHeight")),setCurrent:(f,m)=>f.execCommand("LineHeight",!1,m),onToolbarSetup:rc(c),onMenuSetup:rc(c)}))(r)),(c=>O.from(R2(c)).map(f=>({name:"language",text:"Language",icon:"language",getOptions:Y(f),hash:m=>R(m.customCode)?m.code:`${m.code}/${m.customCode}`,display:m=>m.title,watcher:(m,x,y)=>{var E;return m.formatter.formatChanged("lang",y,!1,{value:x.code,customValue:(E=x.customCode)!==null&&E!==void 0?E:null}).unbind},getCurrent:m=>{const x=Ie(m.selection.getNode());return Gc(x,y=>O.some(y).filter(zn).bind(E=>Di(E,"lang").map(D=>({code:D,customCode:Di(E,"data-mce-lang").getOrUndefined(),title:""}))))},setCurrent:(m,x)=>m.execCommand("Lang",!1,x),onToolbarSetup:m=>{const x=mc();return m.setActive(c.formatter.match("lang",{},void 0,!0)),x.set(c.formatter.formatChanged("lang",m.setActive,!0)),zE(x.clear,rc(c)(m))},onMenuSetup:rc(c)})))(r).each(c=>f_(r,c))},N$=r=>Sp(r,"NodeChange",c=>{c.setEnabled(r.queryCommandState("outdent")&&r.selection.isEditable())}),KN=(r,c)=>f=>{f.setActive(c.get());const m=x=>{c.set(x.state),f.setActive(x.state)};return r.on("PastePlainTextToggle",m),zE(()=>r.off("PastePlainTextToggle",m),rc(r)(f))},h_=(r,c)=>()=>{r.execCommand("mceToggleFormat",!1,c)},F$=r=>{(c=>{(f=>{hm.each([{name:"bold",text:"Bold",icon:"bold",shortcut:"Meta+B"},{name:"italic",text:"Italic",icon:"italic",shortcut:"Meta+I"},{name:"underline",text:"Underline",icon:"underline",shortcut:"Meta+U"},{name:"strikethrough",text:"Strikethrough",icon:"strike-through"},{name:"subscript",text:"Subscript",icon:"subscript"},{name:"superscript",text:"Superscript",icon:"superscript"}],(m,x)=>{f.ui.registry.addToggleButton(m.name,{tooltip:m.text,icon:m.icon,onSetup:kf(f,m.name),onAction:h_(f,m.name),shortcut:m.shortcut})});for(let m=1;m<=6;m++){const x="h"+m,y=`Access+${m}`;f.ui.registry.addToggleButton(x,{text:x.toUpperCase(),tooltip:"Heading "+m,onSetup:kf(f,x),onAction:h_(f,x),shortcut:y})}})(c),(f=>{hm.each([{name:"copy",text:"Copy",action:"Copy",icon:"copy"},{name:"help",text:"Help",action:"mceHelp",icon:"help",shortcut:"Alt+0"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all",shortcut:"Meta+A"},{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document"},{name:"print",text:"Print",action:"mcePrint",icon:"print",shortcut:"Meta+P"}],m=>{f.ui.registry.addButton(m.name,{tooltip:m.text,icon:m.icon,onAction:hu(f,m.action),shortcut:m.shortcut})}),hm.each([{name:"cut",text:"Cut",action:"Cut",icon:"cut"},{name:"paste",text:"Paste",action:"Paste",icon:"paste"},{name:"removeformat",text:"Clear formatting",action:"RemoveFormat",icon:"remove-formatting"},{name:"remove",text:"Remove",action:"Delete",icon:"remove"},{name:"hr",text:"Horizontal line",action:"InsertHorizontalRule",icon:"horizontal-rule"}],m=>{f.ui.registry.addButton(m.name,{tooltip:m.text,icon:m.icon,onSetup:rc(f),onAction:hu(f,m.action)})})})(c),(f=>{hm.each([{name:"blockquote",text:"Blockquote",action:"mceBlockQuote",icon:"quote"}],m=>{f.ui.registry.addToggleButton(m.name,{tooltip:m.text,icon:m.icon,onAction:hu(f,m.action),onSetup:kf(f,m.name)})})})(c)})(r),(c=>{hm.each([{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document"},{name:"copy",text:"Copy",action:"Copy",icon:"copy",shortcut:"Meta+C"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all",shortcut:"Meta+A"},{name:"print",text:"Print...",action:"mcePrint",icon:"print",shortcut:"Meta+P"}],f=>{c.ui.registry.addMenuItem(f.name,{text:f.text,icon:f.icon,shortcut:f.shortcut,onAction:hu(c,f.action)})}),hm.each([{name:"bold",text:"Bold",action:"Bold",icon:"bold",shortcut:"Meta+B"},{name:"italic",text:"Italic",action:"Italic",icon:"italic",shortcut:"Meta+I"},{name:"underline",text:"Underline",action:"Underline",icon:"underline",shortcut:"Meta+U"},{name:"strikethrough",text:"Strikethrough",action:"Strikethrough",icon:"strike-through"},{name:"subscript",text:"Subscript",action:"Subscript",icon:"subscript"},{name:"superscript",text:"Superscript",action:"Superscript",icon:"superscript"},{name:"removeformat",text:"Clear formatting",action:"RemoveFormat",icon:"remove-formatting"},{name:"cut",text:"Cut",action:"Cut",icon:"cut",shortcut:"Meta+X"},{name:"paste",text:"Paste",action:"Paste",icon:"paste",shortcut:"Meta+V"},{name:"hr",text:"Horizontal line",action:"InsertHorizontalRule",icon:"horizontal-rule"}],f=>{c.ui.registry.addMenuItem(f.name,{text:f.text,icon:f.icon,shortcut:f.shortcut,onSetup:rc(c),onAction:hu(c,f.action)})}),c.ui.registry.addMenuItem("codeformat",{text:"Code",icon:"sourcecode",onSetup:rc(c),onAction:h_(c,"code")})})(r)},m_=(r,c)=>Sp(r,"Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",f=>{f.setEnabled(!r.mode.isReadOnly()&&r.undoManager[c]())}),B$=r=>Sp(r,"VisualAid",c=>{c.setActive(r.hasVisual)}),ZN=(r,c)=>{(f=>{mt([{name:"alignleft",text:"Align left",cmd:"JustifyLeft",icon:"align-left"},{name:"aligncenter",text:"Align center",cmd:"JustifyCenter",icon:"align-center"},{name:"alignright",text:"Align right",cmd:"JustifyRight",icon:"align-right"},{name:"alignjustify",text:"Justify",cmd:"JustifyFull",icon:"align-justify"}],m=>{f.ui.registry.addToggleButton(m.name,{tooltip:m.text,icon:m.icon,onAction:hu(f,m.cmd),onSetup:kf(f,m.name)})}),f.ui.registry.addButton("alignnone",{tooltip:"No alignment",icon:"align-none",onSetup:rc(f),onAction:hu(f,"JustifyNone")})})(r),F$(r),((f,m)=>{((x,y)=>{const E=Vx(y,xN(x));x.ui.registry.addNestedMenuItem("align",{text:y.shared.providers.translate("Align"),onSetup:rc(x),getSubmenuItems:()=>E.items.validateItems(E.getStyleItems())})})(f,m),((x,y)=>{const E=Vx(y,TN(x));x.ui.registry.addNestedMenuItem("fontfamily",{text:y.shared.providers.translate("Fonts"),onSetup:rc(x),getSubmenuItems:()=>E.items.validateItems(E.getStyleItems())})})(f,m),((x,y)=>{const E={type:"advanced",...y.styles},D=Vx(y,yA(x,E));x.ui.registry.addNestedMenuItem("styles",{text:"Formats",onSetup:rc(x),getSubmenuItems:()=>D.items.validateItems(D.getStyleItems())})})(f,m),((x,y)=>{const E=Vx(y,SN(x));x.ui.registry.addNestedMenuItem("blocks",{text:"Blocks",onSetup:rc(x),getSubmenuItems:()=>E.items.validateItems(E.getStyleItems())})})(f,m),((x,y)=>{const E=Vx(y,LN(x));x.ui.registry.addNestedMenuItem("fontsize",{text:"Font sizes",onSetup:rc(x),getSubmenuItems:()=>E.items.validateItems(E.getStyleItems())})})(f,m)})(r,c),(f=>{(m=>{m.ui.registry.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onSetup:m_(m,"hasUndo"),onAction:hu(m,"undo")}),m.ui.registry.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onSetup:m_(m,"hasRedo"),onAction:hu(m,"redo")})})(f),(m=>{m.ui.registry.addButton("undo",{tooltip:"Undo",icon:"undo",enabled:!1,onSetup:m_(m,"hasUndo"),onAction:hu(m,"undo"),shortcut:"Meta+Z"}),m.ui.registry.addButton("redo",{tooltip:"Redo",icon:"redo",enabled:!1,onSetup:m_(m,"hasRedo"),onAction:hu(m,"redo"),shortcut:"Meta+Y"})})(f)})(r),(f=>{(D=>{D.addCommand("mceApplyTextcolor",(A,P)=>{((U,B,K)=>{U.undoManager.transact(()=>{U.focus(),U.formatter.apply(B,{value:K}),U.nodeChanged()})})(D,A,P)}),D.addCommand("mceRemoveTextcolor",A=>{((P,U)=>{P.undoManager.transact(()=>{P.focus(),P.formatter.remove(U,{value:null},void 0,!0),P.nodeChanged()})})(D,A)})})(f);const m=x6(f),x=y6(f),y=ho(m),E=ho(x);XE(f,"forecolor","forecolor",y),XE(f,"backcolor","hilitecolor",E),TD(f,"forecolor","forecolor","Text color",y),TD(f,"backcolor","hilitecolor","Background color",E)})(r),(f=>{(m=>{m.ui.registry.addButton("visualaid",{tooltip:"Visual aids",text:"Visual aids",onAction:hu(m,"mceToggleVisualAid")})})(f),(m=>{m.ui.registry.addToggleMenuItem("visualaid",{text:"Visual aids",onSetup:B$(m),onAction:hu(m,"mceToggleVisualAid")})})(f)})(r),(f=>{(m=>{m.ui.registry.addButton("outdent",{tooltip:"Decrease indent",icon:"outdent",onSetup:N$(m),onAction:hu(m,"outdent")}),m.ui.registry.addButton("indent",{tooltip:"Increase indent",icon:"indent",onSetup:rc(m),onAction:hu(m,"indent")})})(f)})(r),M$(r),(f=>{const m=ho(RO(f)),x=()=>f.execCommand("mceTogglePlainTextPaste");f.ui.registry.addToggleButton("pastetext",{active:!1,icon:"paste-text",tooltip:"Paste as text",onAction:x,onSetup:KN(f,m)}),f.ui.registry.addToggleMenuItem("pastetext",{text:"Paste as text",icon:"paste-text",onAction:x,onSetup:KN(f,m)})})(r)},$$=r=>h(r)?r.split(/[ ,]/):r,qN=r=>c=>c.options.get(r),YN=qN("contextmenu_never_use_native"),H$=qN("contextmenu_avoid_overlap"),XN=r=>{const c=r.ui.registry.getAll().contextMenus,f=r.options.get("contextmenu");return r.options.isSet("contextmenu")?f:on(f,m=>On(c,m))},Wx=(r,c)=>({type:"makeshift",x:r,y:c}),OA=r=>r.type==="longpress"||r.type.indexOf("touch")===0,U$=(r,c)=>c.type==="contextmenu"||c.type==="longpress"?r.inline?(f=>{if(OA(f)){const m=f.touches[0];return Wx(m.pageX,m.pageY)}return Wx(f.pageX,f.pageY)})(c):((f,m)=>{const x=dx.DOM.getPos(f);return((y,E,D)=>Wx(y.x+E,y.y+D))(m,x.x,x.y)})(r.getContentAreaContainer(),(f=>{if(OA(f)){const m=f.touches[0];return Wx(m.clientX,m.clientY)}return Wx(f.clientX,f.clientY)})(c)):JN(r),JN=r=>({type:"selection",root:Ie(r.selection.getNode())}),QN=(r,c,f)=>{switch(f){case"node":return(m=>({type:"node",node:O.some(Ie(m.selection.getNode())),root:Ie(m.getBody())}))(r);case"point":return U$(r,c);case"selection":return JN(r)}},V$=(r,c,f,m,x,y)=>{const E=f(),D=QN(r,c,y);Fx(E,ah.CLOSE_ON_EXECUTE,m,{isHorizontalMenu:!1,search:O.none()}).map(A=>{c.preventDefault(),ri.showMenuAt(x,{anchor:D},{menu:{markers:hb("normal")},data:A})})},z$={onLtr:()=>[Jr,_a,Ei,ea,Wi,ir,Cd,gw,Rb,Lb,$x,Ap],onRtl:()=>[Jr,Ei,_a,Wi,ea,ir,Cd,gw,$x,Ap,Rb,Lb]},eF={valignCentre:[],alignCentre:[],alignLeft:["tox-pop--align-left"],alignRight:["tox-pop--align-right"],right:["tox-pop--right"],left:["tox-pop--left"],bottom:["tox-pop--bottom"],top:["tox-pop--top"]},jx=(r,c,f,m,x,y)=>{const E=da(),D=E.os.isiOS(),A=E.os.isMacOS(),P=E.os.isAndroid(),U=E.deviceType.isTouch(),B=()=>{const K=f();((oe,ne,ge,he,Le,fe,de)=>{const be=((Te,ke,Ke)=>{const dt=QN(Te,ke,Ke);return{bubble:Tc(0,Ke==="point"?12:0,eF),layouts:z$,overrides:{maxWidthFunction:bw(),maxHeightFunction:zd()},...dt}})(oe,ne,fe);Fx(ge,ah.CLOSE_ON_EXECUTE,he,{isHorizontalMenu:!0,search:O.none()}).map(Te=>{ne.preventDefault();const ke=de?jl.HighlightMenuAndItem:jl.HighlightNone;ri.showMenuWithinBounds(Le,{anchor:be},{menu:{markers:hb("normal"),highlightOnOpen:ke},data:Te,type:"horizontal"},()=>O.some(DA(oe,he.shared,fe==="node"?"node":"selection"))),oe.dispatch(zN)})})(r,c,K,m,x,y,!(P||D||A&&U))};if((A||D)&&y!=="node"){const K=()=>{(oe=>{const ne=oe.selection.getRng(),ge=()=>{lE.setEditorTimeout(oe,()=>{oe.selection.setRng(ne)},10),fe()};oe.once("touchend",ge);const he=de=>{de.preventDefault(),de.stopImmediatePropagation()};oe.on("mousedown",he,!0);const Le=()=>fe();oe.once("longpresscancel",Le);const fe=()=>{oe.off("touchend",ge),oe.off("longpresscancel",Le),oe.off("mousedown",he)}})(r),B()};((oe,ne)=>{const ge=oe.selection;if(ge.isCollapsed()||ne.touches.length<1)return!1;{const he=ne.touches[0],Le=ge.getRng();return Gv(oe.getWin(),du.domRange(Le)).exists(fe=>fe.left<=he.clientX&&fe.right>=he.clientX&&fe.top<=he.clientY&&fe.bottom>=he.clientY)}})(r,c)?K():(r.once("selectionchange",K),r.once("touchend",()=>r.off("selectionchange",K)))}else B()},tF=r=>h(r)?r==="|":r.type==="separator",IA={type:"separator"},nF=r=>{const c=f=>({text:f.text,icon:f.icon,enabled:f.enabled,shortcut:f.shortcut});if(h(r))return r;switch(r.type){case"separator":return IA;case"submenu":return{type:"nestedmenuitem",...c(r),getSubmenuItems:()=>{const m=r.getSubmenuItems();return h(m)?m:qe(m,nF)}};default:const f=r;return{type:"menuitem",...c(f),onAction:se(f.onAction)}}},Dw=(r,c)=>{if(c.length===0)return r;const f=Ct(r).filter(m=>!tF(m)).fold(()=>[],m=>[IA]);return r.concat(f).concat(c).concat([IA])},_d=(r,c)=>!(f=>f.type==="longpress"||On(f,"touches"))(c)&&(c.button!==2||c.target===r.getBody()&&c.pointerType===""),p_=(r,c)=>_d(r,c)?r.selection.getStart(!0):c.target,oF=(r,c,f)=>{const m=da().deviceType.isTouch,x=Qi(ri.sketch({dom:{tag:"div"},lazySink:c,onEscape:()=>r.focus(),onShow:()=>f.setContextMenuState(!0),onHide:()=>f.setContextMenuState(!1),fireDismissalEventInstead:{},inlineBehaviours:tn([Qo("dismissContextMenu",[Ft(Fd(),(D,A)=>{_.close(D),r.focus()})])])})),y=()=>ri.hide(x),E=D=>{if(YN(r)&&D.preventDefault(),((P,U)=>U.ctrlKey&&!YN(P))(r,D)||(P=>XN(P).length===0)(r))return;const A=((P,U)=>{const B=H$(P),K=_d(P,U)?"selection":"point";if(dn(B)){const oe=p_(P,U);return ow(Ie(oe),B)?"node":K}return K})(r,D);(m()?jx:V$)(r,D,()=>{const P=p_(r,D),U=r.ui.registry.getAll(),B=XN(r);return((K,oe,ne)=>{const ge=an(oe,(he,Le)=>At(K,Le.toLowerCase()).map(fe=>{const de=fe.update(ne);if(h(de)&&dn(ps(de)))return Dw(he,de.split(" "));if(S(de)&&de.length>0){const be=qe(de,nF);return Dw(he,be)}return he}).getOrThunk(()=>he.concat([Le])),[]);return ge.length>0&&tF(ge[ge.length-1])&&ge.pop(),ge})(U.contextMenus,B,P)},f,x,A)};r.on("init",()=>{const D="ResizeEditor ScrollContent ScrollWindow longpresscancel"+(m()?"":" ResizeWindow");r.on(D,y),r.on("longpress contextmenu",E)})},PA=di([{offset:["x","y"]},{absolute:["x","y"]},{fixed:["x","y"]}]),g_=r=>c=>c.translate(-r.left,-r.top),b_=r=>c=>c.translate(r.left,r.top),Lp=r=>(c,f)=>an(r,(m,x)=>x(m),Sn(c,f)),kw=(r,c,f)=>r.fold(Lp([b_(f),g_(c)]),Lp([g_(c)]),Lp([])),Nb=(r,c,f)=>r.fold(Lp([b_(f)]),Lp([]),Lp([b_(c)])),sF=(r,c,f)=>r.fold(Lp([]),Lp([g_(f)]),Lp([b_(c),g_(f)])),rF=(r,c,f)=>{const m=r.fold((x,y)=>({position:O.some("absolute"),left:O.some(x+"px"),top:O.some(y+"px")}),(x,y)=>({position:O.some("absolute"),left:O.some(x-f.left+"px"),top:O.some(y-f.top+"px")}),(x,y)=>({position:O.some("fixed"),left:O.some(x+"px"),top:O.some(y+"px")}));return{right:O.none(),bottom:O.none(),...m}},v_=(r,c,f,m)=>{const x=(y,E)=>(D,A)=>{const P=y(c,f,m);return E(D.getOr(P.left),A.getOr(P.top))};return r.fold(x(sF,x_),x(Nb,Rp),x(kw,Jg))},x_=PA.offset,Rp=PA.absolute,Jg=PA.fixed,MA=(r,c)=>{const f=xi(r,c);return R(f)?NaN:parseInt(f,10)},G$=(r,c,f,m,x,y)=>{const E=((P,U,B,K)=>((oe,ne)=>{const ge=oe.element,he=MA(ge,ne.leftAttr),Le=MA(ge,ne.topAttr);return isNaN(he)||isNaN(Le)?O.none():O.some(Sn(he,Le))})(P,U).fold(()=>B,oe=>Jg(oe.left+K.left,oe.top+K.top)))(r,c,f,m),D=c.mustSnap?W$(r,c,E,x,y):j$(r,c,E,x,y),A=kw(E,x,y);return((P,U,B)=>{const K=P.element;Eo(K,U.leftAttr,B.left+"px"),Eo(K,U.topAttr,B.top+"px")})(r,c,A),D.fold(()=>({coord:Jg(A.left,A.top),extra:O.none()}),P=>({coord:P.output,extra:P.extra}))},iF=(r,c,f,m)=>Kn(r,x=>{const y=x.sensor;return((D,A,P,U,B,K)=>{const oe=Nb(D,B,K),ne=Nb(A,B,K);return Math.abs(oe.left-ne.left)<=P&&Math.abs(oe.top-ne.top)<=U})(c,y,x.range.left,x.range.top,f,m)?O.some({output:v_(x.output,c,f,m),extra:x.extra}):O.none()}),W$=(r,c,f,m,x)=>{const y=c.getSnapPoints(r);return iF(y,f,m,x).orThunk(()=>an(y,(D,A)=>{const P=A.sensor,U=((B,K,oe,ne,ge,he)=>{const Le=Nb(B,ge,he),fe=Nb(K,ge,he),de=Math.abs(Le.left-fe.left),be=Math.abs(Le.top-fe.top);return Sn(de,be)})(f,P,A.range.left,A.range.top,m,x);return D.deltas.fold(()=>({deltas:O.some(U),snap:O.some(A)}),B=>(U.left+U.top)/2<=(B.left+B.top)/2?{deltas:O.some(U),snap:O.some(A)}:D)},{deltas:O.none(),snap:O.none()}).snap.map(D=>({output:v_(D.output,f,m,x),extra:D.extra})))},j$=(r,c,f,m,x)=>{const y=c.getSnapPoints(r);return iF(y,f,m,x)};var K$=Object.freeze({__proto__:null,snapTo:(r,c,f,m)=>{const x=c.getTarget(r.element);if(c.repositionTarget){const y=tr(r.element),E=ui(y),D=k0(x),A=((U,B,K)=>({coord:v_(U.output,U.output,B,K),extra:U.extra}))(m,E,D),P=rF(A.coord,0,D);rl(x,P)}}});const NA="data-initial-z-index",y_=(r,c)=>{r.getSystem().addToGui(c),(f=>{la(f.element).filter(zn).each(m=>{yi(m,"z-index").each(x=>{Eo(m,NA,x)}),Ro(m,"z-index",Fr(f.element,"z-index"))})})(c)},Z$=r=>{(c=>{la(c.element).filter(zn).each(f=>{Di(f,NA).fold(()=>us(f,"z-index"),m=>Ro(f,"z-index",m)),Lr(f,NA)})})(r),r.getSystem().removeFromGui(r)},aF=(r,c,f)=>r.getSystem().build(Af.sketch({dom:{styles:{left:"0px",top:"0px",width:"100%",height:"100%",position:"fixed","z-index":"1000000000000000"},classes:[c]},events:f}));var lF=ul("snaps",[Rt("getSnapPoints"),Rs("onSensor"),Rt("leftAttr"),Rt("topAttr"),lt("lazyViewport",Ii),lt("mustSnap",!1)]);const FA=[lt("useFixed",ve),Rt("blockerClass"),lt("getTarget",me),lt("onDrag",j),lt("repositionTarget",!0),lt("onDrop",j),Or("getBounds",Ii),lF],q$=r=>{return(c=yi(r,"left"),f=yi(r,"top"),m=yi(r,"position"),c.isSome()&&f.isSome()&&m.isSome()?O.some(((x,y,E)=>(E==="fixed"?Jg:x_)(parseInt(x,10),parseInt(y,10)))(c.getOrDie(),f.getOrDie(),m.getOrDie())):O.none()).getOrThunk(()=>{const x=wr(r);return Rp(x.left,x.top)});var c,f,m},cF=(r,c)=>({bounds:r.getBounds(),height:Tt(c.element),width:Zr(c.element)}),BA=(r,c,f,m,x)=>{const y=f.update(m,x),E=f.getStartData().getOrThunk(()=>cF(c,r));y.each(D=>{((A,P,U,B)=>{const K=P.getTarget(A.element);if(P.repositionTarget){const oe=tr(A.element),ne=ui(oe),ge=k0(K),he=q$(K),Le=((de,be,Te,ke,Ke,dt,zt)=>((Wt,en,xn,$n,ro)=>{const xo=ro.bounds,Zo=Nb(en,xn,$n),ws=Fu(Zo.left,xo.x,xo.x+xo.width-ro.width),ii=Fu(Zo.top,xo.y,xo.y+xo.height-ro.height),pi=Rp(ws,ii);return en.fold(()=>{const _o=sF(pi,xn,$n);return x_(_o.left,_o.top)},Y(pi),()=>{const _o=kw(pi,xn,$n);return Jg(_o.left,_o.top)})})(0,be.fold(()=>{const Wt=(en=Te,xn=dt.left,$n=dt.top,en.fold((xo,Zo)=>x_(xo+xn,Zo+$n),(xo,Zo)=>Rp(xo+xn,Zo+$n),(xo,Zo)=>Jg(xo+xn,Zo+$n)));var en,xn,$n;const ro=kw(Wt,ke,Ke);return Jg(ro.left,ro.top)},Wt=>{const en=G$(de,Wt,Te,dt,ke,Ke);return en.extra.each(xn=>{Wt.onSensor(de,xn)}),en.coord}),ke,Ke,zt))(A,P.snaps,he,ne,ge,B,U),fe=rF(Le,0,ge);rl(K,fe)}P.onDrag(A,K,B)})(r,c,E,D)})},uF=(r,c,f,m)=>{c.each(Z$),f.snaps.each(y=>{((E,D)=>{((A,P)=>{const U=A.element;Lr(U,P.leftAttr),Lr(U,P.topAttr)})(E,D)})(r,y)});const x=f.getTarget(r.element);m.reset(),f.onDrop(r,x)},$A=r=>(c,f)=>{const m=x=>{f.setStartData(cF(c,x))};return Ws([Ft(lu(),x=>{f.getStartData().each(()=>m(x))}),...r(c,f,m)])};var Y$=Object.freeze({__proto__:null,getData:r=>O.from(Sn(r.x,r.y)),getDelta:(r,c)=>Sn(c.left-r.left,c.top-r.top)});const HA=(r,c,f)=>[Ft(ce(),(m,x)=>{if(x.event.raw.button!==0)return;x.stop();const y=()=>uF(m,O.some(A),r,c),E=QI(y,200),D={drop:y,delayDrop:E.schedule,forceDrop:y,move:P=>{E.cancel(),BA(m,r,c,Y$,P)}},A=aF(m,r.blockerClass,(P=>Ws([Ft(ce(),P.forceDrop),Ft(Kt(),P.drop),Ft(Ne(),(U,B)=>{P.move(B.event)}),Ft(We(),P.delayDrop)]))(D));f(m),y_(m,A)})],dF=[...FA,As("dragger",{handlers:$A(HA)})];var fF=Object.freeze({__proto__:null,getData:r=>{const c=r.raw.touches;return c.length===1?(f=>{const m=f[0];return O.some(Sn(m.clientX,m.clientY))})(c):O.none()},getDelta:(r,c)=>Sn(c.left-r.left,c.top-r.top)});const hF=(r,c,f)=>{const m=nr(),x=y=>{uF(y,m.get(),r,c),m.clear()};return[Ft(Po(),(y,E)=>{E.stop();const D=()=>x(y),A={drop:D,delayDrop:j,forceDrop:D,move:U=>{BA(y,r,c,fF,U)}},P=aF(y,r.blockerClass,(U=>Ws([Ft(Po(),U.forceDrop),Ft(N(),U.drop),Ft(X(),U.drop),Ft(Js(),(B,K)=>{U.move(K.event)})]))(A));m.set(P),f(y),y_(y,P)}),Ft(Js(),(y,E)=>{E.stop(),BA(y,r,c,fF,E.event)}),Ft(N(),(y,E)=>{E.stop(),x(y)}),Ft(X(),x)]},X$=dF,J$=[...FA,As("dragger",{handlers:$A(hF)})],Q$=[...FA,As("dragger",{handlers:$A((r,c,f)=>[...HA(r,c,f),...hF(r,c,f)])})];var e7=Object.freeze({__proto__:null,mouse:X$,touch:J$,mouseOrTouch:Q$}),mF=Object.freeze({__proto__:null,init:()=>{let r=O.none(),c=O.none();const f=Y({});return Ec({readState:f,reset:()=>{r=O.none(),c=O.none()},update:(m,x)=>m.getData(x).bind(y=>((E,D)=>{const A=r.map(P=>E.getDelta(P,D));return r=O.some(D),A})(m,y)),getStartData:()=>c,setStartData:m=>{c=O.some(m)}})}});const Qg=w1({branchKey:"mode",branches:e7,name:"dragging",active:{events:(r,c)=>r.dragger.handlers(r,c)},extra:{snap:r=>({sensor:r.sensor,range:r.range,output:r.output,extra:O.from(r.extra)})},state:mF,apis:K$}),UA=(r,c,f,m,x,y)=>r.fold(()=>Qg.snap({sensor:Rp(f-20,m-20),range:Sn(x,y),output:Rp(O.some(f),O.some(m)),extra:{td:c}}),E=>{const D=f-20,A=m-20,P=E.element.dom.getBoundingClientRect();return Qg.snap({sensor:Rp(D,A),range:Sn(40,40),output:Rp(O.some(f-P.width/2),O.some(m-P.height/2)),extra:{td:c}})}),w_=(r,c,f)=>({getSnapPoints:r,leftAttr:"data-drag-left",topAttr:"data-drag-top",onSensor:(m,x)=>{const y=x.td;((E,D)=>E.exists(A=>po(A,D)))(c.get(),y)||(c.set(y),f(y))},mustSnap:!0}),pF=r=>dr(Il.sketch({dom:{tag:"div",classes:["tox-selector"]},buttonBehaviours:tn([Qg.config({mode:"mouseOrTouch",blockerClass:"blocker",snaps:r}),Eb.config({})]),eventOrder:{mousedown:["dragging","alloy.base.behaviour"],touchstart:["dragging","alloy.base.behaviour"]}})),gF=(r,c)=>{const f=ho([]),m=ho([]),x=ho(!1),y=nr(),E=nr(),D=fe=>{const de=fc(fe);return UA(B.getOpt(c),fe,de.x,de.y,de.width,de.height)},A=fe=>{const de=fc(fe);return UA(K.getOpt(c),fe,de.right,de.bottom,de.width,de.height)},P=w_(()=>qe(f.get(),fe=>D(fe)),y,fe=>{E.get().each(de=>{r.dispatch("TableSelectorChange",{start:fe,finish:de})})}),U=w_(()=>qe(m.get(),fe=>A(fe)),E,fe=>{y.get().each(de=>{r.dispatch("TableSelectorChange",{start:de,finish:fe})})}),B=pF(P),K=pF(U),oe=Qi(B.asSpec()),ne=Qi(K.asSpec()),ge=(fe,de,be,Te)=>{const ke=be(de);Qg.snapTo(fe,ke),((Ke,dt,zt,Wt)=>{const en=dt.dom.getBoundingClientRect();us(Ke.element,"display");const xn=Ti(Ie(r.getBody())).dom.innerHeight,$n=en[Te]<0,ro=((xo,Zo)=>xo[Te]>Zo)(en,xn);($n||ro)&&Ro(Ke.element,"display","none")})(fe,de)},he=fe=>ge(oe,fe,D,"top"),Le=fe=>ge(ne,fe,A,"bottom");if(da().deviceType.isTouch()){const fe=de=>qe(de,Ie);r.on("TableSelectionChange",de=>{x.get()||(Ef(c,oe),Ef(c,ne),x.set(!0));const be=Ie(de.start),Te=Ie(de.finish);y.set(be),E.set(Te),O.from(de.otherCells).each(ke=>{f.set(fe(ke.upOrLeftCells)),m.set(fe(ke.downOrRightCells)),he(be),Le(Te)})}),r.on("ResizeEditor ResizeWindow ScrollContent",()=>{y.get().each(he),E.get().each(Le)}),r.on("TableSelectionClear",()=>{x.get()&&(oc(oe),oc(ne),x.set(!1)),y.clear(),E.clear()})}},t7=(r,c,f)=>{var m;const x=(m=c.delimiter)!==null&&m!==void 0?m:"›";return{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:tn([uo.config({mode:"flow",selector:"div[role=button]"}),Ho.config({disabled:f.isDisabled}),Ia(),Mr.config({}),Do.config({}),Qo("elementPathEvents",[zr((y,E)=>{r.shortcuts.add("alt+F11","focus statusbar elementpath",()=>uo.focusIn(y)),r.on("NodeChange",D=>{const A=(U=>{const B=[];let K=U.length;for(;K-- >0;){const ne=U[K];if(ne.nodeType===1&&(oe=ne).nodeName!=="BR"&&!oe.getAttribute("data-mce-bogus")&&oe.getAttribute("data-mce-type")!=="bookmark"){const ge=b6(r,ne);if(ge.isDefaultPrevented()||B.push({name:ge.name,element:ne}),ge.isPropagationStopped())break}}var oe;return B})(D.parents),P=A.length>0?an(A,(U,B,K)=>{const oe=((ne,ge,he)=>Il.sketch({dom:{tag:"div",classes:["tox-statusbar__path-item"],attributes:{"data-index":he,"aria-level":he+1}},components:[Pr(ne)],action:Le=>{r.focus(),r.selection.select(ge),r.nodeChanged()},buttonBehaviours:tn([vl(f.isDisabled),Ia()])}))(B.name,B.element,K);return K===0?U.concat([oe]):U.concat([{dom:{tag:"div",classes:["tox-statusbar__path-divider"],attributes:{"aria-hidden":!0}},components:[Pr(` ${x} `)]},oe])},[]):[];Do.set(y,P)})})])]),components:[]}};var e0;(function(r){r[r.None=0]="None",r[r.Both=1]="Both",r[r.Vertical=2]="Vertical"})(e0||(e0={}));const bF=(r,c,f)=>{const m=Ie(r.getContainer()),x=((y,E,D,A,P)=>{const U={height:d_(A+E.top,fx(y),cE(y))};return D===e0.Both&&(U.width=d_(P+E.left,wy(y),hx(y))),U})(r,c,f,Qe(m),ds(m));Cn(x,(y,E)=>{W(y)&&Ro(m,E,EA(y))}),(y=>{y.dispatch("ResizeEditor")})(r)},S_=(r,c,f,m)=>{const x=Sn(20*f,20*m);return bF(r,x,c),O.some(!0)},VA=(r,c)=>{const f=()=>{const m=[],x=M2(r),y=LO(r),E=ju(r)||r.hasPlugin("wordcount");return y&&m.push(t7(r,{},c)),x&&m.push((()=>{const D=$E("Alt+0");return{dom:{tag:"div",classes:["tox-statusbar__help-text"]},components:[Pr(bd.translate(["Press {0} for help",D]))]}})()),E&&m.push((()=>{const D=[];return r.hasPlugin("wordcount")&&D.push(((A,P)=>{const U=(B,K,oe)=>Do.set(B,[Pr(P.translate(["{0} "+oe,K[oe]]))]);return Il.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:tn([vl(P.isDisabled),Ia(),Mr.config({}),Do.config({}),at.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),Qo("wordcount-events",[Ud(B=>{const K=at.getValue(B),oe=K.mode==="words"?"characters":"words";at.setValue(B,{mode:oe,count:K.count}),U(B,K.count,oe)}),zr(B=>{A.on("wordCountUpdate",K=>{const{mode:oe}=at.getValue(B);at.setValue(B,{mode:oe,count:K.wordCount}),U(B,K.wordCount,oe)})})])]),eventOrder:{[pr()]:["disabling","alloy.base.behaviour","wordcount-events"]}})})(r,c)),ju(r)&&D.push({dom:{tag:"span",classes:["tox-statusbar__branding"]},components:[{dom:{tag:"a",attributes:{href:"https://www.tiny.cloud/powered-by-tiny?utm_campaign=poweredby&utm_source=tiny&utm_medium=referral&utm_content=v7",rel:"noopener",target:"_blank","aria-label":bd.translate(["Powered by {0}","Tiny"])},innerHtml:`<svg width="50px" height="16px" viewBox="0 0 50 16" xmlns="http://www.w3.org/2000/svg">
  <path fill-rule="evenodd" clip-rule="evenodd" d="M10.143 0c2.608.015 5.186 2.178 5.186 5.331 0 0 .077 3.812-.084 4.87-.361 2.41-2.164 4.074-4.65 4.496-1.453.284-2.523.49-3.212.623-.373.071-.634.122-.785.152-.184.038-.997.145-1.35.145-2.732 0-5.21-2.04-5.248-5.33 0 0 0-3.514.03-4.442.093-2.4 1.758-4.342 4.926-4.963 0 0 3.875-.752 4.036-.782.368-.07.775-.1 1.15-.1Zm1.826 2.8L5.83 3.989v2.393l-2.455.475v5.968l6.137-1.189V9.243l2.456-.476V2.8ZM5.83 6.382l3.682-.713v3.574l-3.682.713V6.382Zm27.173-1.64-.084-1.066h-2.226v9.132h2.456V7.743c-.008-1.151.998-2.064 2.149-2.072 1.15-.008 1.987.92 1.995 2.072v5.065h2.455V7.359c-.015-2.18-1.657-3.929-3.837-3.913a3.993 3.993 0 0 0-2.908 1.296Zm-6.3-4.266L29.16 0v2.387l-2.456.475V.476Zm0 3.2v9.132h2.456V3.676h-2.456Zm18.179 11.787L49.11 3.676H46.58l-1.612 4.527-.46 1.382-.384-1.382-1.611-4.527H39.98l3.3 9.132L42.15 16l2.732-.537ZM22.867 9.738c0 .752.568 1.075.921 1.075.353 0 .668-.047.998-.154l.537 1.765c-.23.154-.92.537-2.225.537-1.305 0-2.655-.997-2.686-2.686a136.877 136.877 0 0 1 0-4.374H18.8V3.676h1.612v-1.98l2.455-.476v2.456h2.302V5.9h-2.302v3.837Z"/>
</svg>
`.trim()},behaviours:tn([Bo.config({})])}]}),{dom:{tag:"div",classes:["tox-statusbar__right-container"]},components:D}})()),m.length>0?[{dom:{tag:"div",classes:["tox-statusbar__text-container",...(()=>{const D="tox-statusbar__text-container--flex-start",A="tox-statusbar__text-container--flex-end";if(x){const P="tox-statusbar__text-container-3-cols";return E||y?E&&!y?[P,A]:[P,D]:[P,"tox-statusbar__text-container--space-around"]}return[E&&!y?A:D]})()]},components:m}]:[]};return{dom:{tag:"div",classes:["tox-statusbar"]},components:(()=>{const m=f(),x=((y,E)=>{const D=(P=>{const U=nl(P);return U===!1?e0.None:U==="both"?e0.Both:e0.Vertical})(y);if(D===e0.None)return O.none();const A=D===e0.Both?"Press the arrow keys to resize the editor.":"Press the Up and Down arrow keys to resize the editor.";return O.some(vd("resize-handle",{tag:"div",classes:["tox-statusbar__resize-handle"],attributes:{"aria-label":E.translate(A),"data-mce-name":"resize-handle"},behaviours:[Qg.config({mode:"mouse",repositionTarget:!1,onDrag:(P,U,B)=>bF(y,B,D),blockerClass:"tox-blocker"}),uo.config({mode:"special",onLeft:()=>S_(y,D,-1,0),onRight:()=>S_(y,D,1,0),onUp:()=>S_(y,D,0,-1),onDown:()=>S_(y,D,0,1)}),Mr.config({}),Bo.config({}),Pl.config(E.tooltips.getConfig({tooltipText:E.translate("Resize")}))]},E.icons))})(r,c);return m.concat(x.toArray())})()}},pm=(r,c)=>c.get().getOrDie(`UI for ${r} has not been rendered`),n7=(r,c)=>{const f=r.inline,m=f?O$:L$,x=gp(r)?N8:$M,y=(()=>{const ke=nr(),Ke=nr(),dt=nr();return{dialogUi:ke,popupUi:Ke,mainUi:dt,getUiMotherships:()=>{const zt=ke.get().map(en=>en.mothership),Wt=Ke.get().map(en=>en.mothership);return zt.fold(()=>Wt.toArray(),en=>Wt.fold(()=>[en],xn=>po(en.element,xn.element)?[en]:[en,xn]))},lazyGetInOuterOrDie:(zt,Wt)=>()=>dt.get().bind(en=>Wt(en.outerContainer)).getOrDie(`Could not find ${zt} element in OuterContainer`)}})(),E=nr(),D=nr(),A=nr(),P=da().deviceType.isTouch()?["tox-platform-touch"]:[],U=N2(r),B=cb(r),K=dr({dom:{tag:"div",classes:["tox-anchorbar"]}}),oe=dr({dom:{tag:"div",classes:["tox-bottom-anchorbar"]}}),ne=()=>y.mainUi.get().map(ke=>ke.outerContainer).bind(Gr.getHeader),ge=y.lazyGetInOuterOrDie("anchor bar",K.getOpt),he=y.lazyGetInOuterOrDie("bottom anchor bar",oe.getOpt),Le=y.lazyGetInOuterOrDie("toolbar",Gr.getToolbar),fe=y.lazyGetInOuterOrDie("throbber",Gr.getThrobber),de=((ke,Ke,dt,zt)=>{const Wt=ho(!1),en=(_o=>{const Ai=ho(N2(_o)?"bottom":"top");return{isPositionedAtTop:()=>Ai.get()==="top",getDockingMode:Ai.get,setDockingMode:Ai.set}})(Ke),xn={icons:()=>Ke.ui.registry.getAll().icons,menuItems:()=>Ke.ui.registry.getAll().menuItems,translate:bd.translate,isDisabled:()=>Ke.mode.isReadOnly()||!Ke.ui.isEnabled(),getOption:Ke.options.get,tooltips:A8(ke.dialog)},$n=P8(Ke),ro=(_o=>{const Ai=Ki=>()=>_o.formatter.match(Ki),No=Ki=>()=>{const qa=_o.formatter.get(Ki);return qa!==void 0?O.some({tag:qa.length>0&&(qa[0].inline||qa[0].block)||"div",styles:_o.dom.parseStyle(_o.formatter.getCssText(Ki))}):O.none()},Qr=ho([]),fr=ho([]),ac=ho(!1);return _o.on("PreInit",Ki=>{const qa=bM(_o),mu=xM(_o,qa,Ai,No);Qr.set(mu)}),_o.on("addStyleModifications",Ki=>{const qa=xM(_o,Ki.items,Ai,No);fr.set(qa),ac.set(Ki.replace)}),{getData:()=>{const Ki=ac.get()?[]:Qr.get(),qa=fr.get();return Ki.concat(qa)}}})(Ke),xo=(_o=>({colorPicker:T8(_o),hasCustomColors:D8(_o),getColors:mM(_o),getColorCols:pM(_o)}))(Ke),Zo=(_o=>({isDraggableModal:k8(_o)}))(Ke),ws={shared:{providers:xn,anchors:hM(Ke,dt,zt,en.isPositionedAtTop),header:en},urlinput:$n,styles:ro,colorinput:xo,dialog:Zo,isContextMenuOpen:()=>Wt.get(),setContextMenuState:_o=>Wt.set(_o)},ii={...ws,shared:{...ws.shared,interpreter:_o=>Of(_o,{},ii),getSink:ke.popup}},pi={...ws,shared:{...ws.shared,interpreter:_o=>Of(_o,{},pi),getSink:ke.dialog}};return{popup:ii,dialog:pi}})({popup:()=>os.fromOption(y.popupUi.get().map(ke=>ke.sink),"(popup) UI has not been rendered"),dialog:()=>os.fromOption(y.dialogUi.get().map(ke=>ke.sink),"UI has not been rendered")},r,ge,he),be=()=>{const ke=(()=>{const ws={attributes:{[Hv]:U?Ta.BottomToTop:Ta.TopToBottom}},ii=Gr.parts.menubar({dom:{tag:"div",classes:["tox-menubar"]},backstage:de.popup,onEscape:()=>{r.focus()}}),pi=Gr.parts.toolbar({dom:{tag:"div",classes:["tox-toolbar"]},getSink:de.popup.shared.getSink,providers:de.popup.shared.providers,onEscape:()=>{r.focus()},onToolbarToggled:mu=>{((qx,Yx)=>{qx.dispatch("ToggleToolbarDrawer",{state:Yx})})(r,mu)},type:B,lazyToolbar:Le,lazyHeader:()=>ne().getOrDie("Could not find header element"),...ws}),_o=Gr.parts["multiple-toolbar"]({dom:{tag:"div",classes:["tox-toolbar-overlord"]},providers:de.popup.shared.providers,onEscape:()=>{r.focus()},type:B}),Ai=Ty(r),No=_y(r),Qr=Cy(r),fr=OO(r),ac=Gr.parts.promotion({dom:{tag:"div",classes:["tox-promotion"]}}),Ki=Ai||No||Qr,qa=fr?[ac,ii]:[ii];return Gr.parts.header({dom:{tag:"div",classes:["tox-editor-header"].concat(Ki?[]:["tox-editor-header--empty"]),...ws},components:Vn([Qr?qa:[],Ai?[_o]:No?[pi]:[],ub(r)?[]:[K.asSpec()]]),sticky:gp(r),editor:r,sharedBackstage:de.popup.shared})})(),Ke={dom:{tag:"div",classes:["tox-sidebar-wrap"]},components:[Gr.parts.socket({dom:{tag:"div",classes:["tox-edit-area"]}}),Gr.parts.sidebar({dom:{tag:"div",classes:["tox-sidebar"]}})]},dt=Gr.parts.throbber({dom:{tag:"div",classes:["tox-throbber"]},backstage:de.popup}),zt=Gr.parts.viewWrapper({backstage:de.popup}),Wt=AO(r)&&!f?O.some(VA(r,de.popup.shared.providers)):O.none(),en=Vn([U?[]:[ke],f?[]:[Ke],U?[ke]:[]]),xn=Gr.parts.editorContainer({components:Vn([en,f?[]:[oe.asSpec()]])}),$n=yE(r),ro={role:"application",...bd.isRtl()?{dir:"rtl"}:{},...$n?{"aria-hidden":"true"}:{}},xo=Qi(Gr.sketch({dom:{tag:"div",classes:["tox","tox-tinymce"].concat(f?["tox-tinymce-inline"]:[]).concat(U?["tox-tinymce--toolbar-bottom"]:[]).concat(P),styles:{visibility:"hidden",...$n?{opacity:"0",border:"0"}:{}},attributes:ro},components:[xn,...f?[]:[zt,...Wt.toArray()],dt],behaviours:tn([Ia(),Ho.config({disableClass:"tox-tinymce--disabled"}),uo.config({mode:"cyclic",selector:".tox-menubar, .tox-toolbar, .tox-toolbar__primary, .tox-toolbar__overflow--open, .tox-sidebar__overflow--open, .tox-statusbar__path, .tox-statusbar__wordcount, .tox-statusbar__branding a, .tox-statusbar__resize-handle"})])})),Zo=UD(xo);return E.set(Zo),{mothership:Zo,outerContainer:xo}},Te=ke=>{const Ke=EA((zt=>(en=>{const xn=xy(en),$n=fx(en),ro=cE(en);return $N(xn).map(xo=>d_(xo,$n,ro))})(zt).getOr(xy(zt)))(r)),dt=EA((zt=>HN(zt).getOr(yy(zt)))(r));return r.inline||(_u("div","width",dt)&&Ro(ke.element,"width",dt),_u("div","height",Ke)?Ro(ke.element,"height",Ke):Ro(ke.element,"height","400px")),Ke};return{popups:{backstage:de.popup,getMothership:()=>pm("popups",A)},dialogs:{backstage:de.dialog,getMothership:()=>pm("dialogs",D)},renderUI:()=>{const ke=be(),Ke=(()=>{const zt=xE(r),Wt=po(Fa(),zt)&&Fr(zt,"display")==="grid",en={dom:{tag:"div",classes:["tox","tox-silver-sink","tox-tinymce-aux"].concat(P),attributes:{...bd.isRtl()?{dir:"rtl"}:{}}},behaviours:tn([tl.config({useFixed:()=>x.isDocked(ne)})])},xn={dom:{styles:{width:document.body.clientWidth+"px"}},events:Ws([Ft(eg(),xo=>{Ro(xo.element,"width",document.body.clientWidth+"px")})])},$n=Qi(Ze(en,Wt?xn:{})),ro=UD($n);return D.set(ro),{sink:$n,mothership:ro}})(),dt=bp(r)?(()=>{const zt={dom:{tag:"div",classes:["tox","tox-silver-sink","tox-silver-popup-sink","tox-tinymce-aux"].concat(P),attributes:{...bd.isRtl()?{dir:"rtl"}:{}}},behaviours:tn([tl.config({useFixed:()=>x.isDocked(ne),getBounds:()=>c.getPopupSinkBounds()})])},Wt=Qi(zt),en=UD(Wt);return A.set(en),{sink:Wt,mothership:en}})():(zt=>(A.set(zt.mothership),zt))(Ke);return y.dialogUi.set(Ke),y.popupUi.set(dt),y.mainUi.set(ke),(zt=>{const{mainUi:Wt,popupUi:en,uiMotherships:xn}=zt;Nn(dE(r),(No,Qr)=>{r.ui.registry.addGroupToolbarButton(Qr,No)});const{buttons:$n,menuItems:ro,contextToolbars:xo,sidebars:Zo,views:ws}=r.ui.registry.getAll(),ii=vE(r),pi={menuItems:ro,menus:Dg(r),menubar:pp(r),toolbar:ii.getOrThunk(()=>px(r)),allowToolbarGroups:B===jd.floating,buttons:$n,sidebar:Zo,views:ws};var _o;_o=Wt.outerContainer,r.addShortcut("alt+F9","focus menubar",()=>{Gr.focusMenubar(_o)}),r.addShortcut("alt+F10","focus toolbar",()=>{Gr.focusToolbar(_o)}),r.addCommand("ToggleToolbarDrawer",(No,Qr)=>{Qr!=null&&Qr.skipFocus?Gr.toggleToolbarDrawerWithoutFocusing(_o):Gr.toggleToolbarDrawer(_o)}),r.addQueryStateHandler("ToggleToolbarDrawer",()=>Gr.isToolbarDrawerToggled(_o)),((No,Qr,fr)=>{const ac=(Ks,xm)=>{mt([Qr,...fr],Mf=>{Mf.broadcastEvent(Ks,xm)})},Ki=(Ks,xm)=>{mt([Qr,...fr],Mf=>{Mf.broadcastOn([Ks],xm)})},qa=Ks=>Ki(I(),{target:Ks.target}),mu=Ul(),qx=Rl(mu,"touchstart",qa),Yx=Rl(mu,"touchmove",Ks=>ac(Qp(),Ks)),Ip=Rl(mu,"touchend",Ks=>ac(oo(),Ks)),Pp=Rl(mu,"mousedown",qa),Pw=Rl(mu,"mouseup",Ks=>{Ks.raw.button===0&&Ki(Z(),{target:Ks.target})}),t0=Ks=>Ki(I(),{target:Ie(Ks.target)}),bm=Ks=>{Ks.button===0&&Ki(Z(),{target:Ie(Ks.target)})},n0=()=>{mt(No.editorManager.get(),Ks=>{No!==Ks&&Ks.dispatch("DismissPopups",{relatedTarget:No})})},o0=Ks=>ac(lu(),OS(Ks)),s0=Ks=>{Ki(H(),{}),ac(eg(),OS(Ks))},N_=jr(Ie(No.getElement())),Mw=xf(N_,"scroll",Ks=>{requestAnimationFrame(()=>{if(No.getContainer()!=null){const xm=kg(No,Qr.element).map(Mf=>[Mf.element,...Mf.others]).getOr([]);Dt(xm,Mf=>po(Mf,Ks.target))&&(No.dispatch("ElementScroll",{target:Ks.target.dom}),ac($d(),Ks))}})}),r0=()=>Ki(H(),{}),Mp=Ks=>{Ks.state&&Ki(I(),{target:Ie(No.getContainer())})},vm=Ks=>{Ki(I(),{target:Ie(Ks.relatedTarget.getContainer())})},Nw=Ks=>No.dispatch("focusin",Ks),Fw=Ks=>No.dispatch("focusout",Ks);No.on("PostRender",()=>{No.on("click",t0),No.on("tap",t0),No.on("mouseup",bm),No.on("mousedown",n0),No.on("ScrollWindow",o0),No.on("ResizeWindow",s0),No.on("ResizeEditor",r0),No.on("AfterProgressState",Mp),No.on("DismissPopups",vm),mt([Qr,...fr],Ks=>{Ks.element.dom.addEventListener("focusin",Nw),Ks.element.dom.addEventListener("focusout",Fw)})}),No.on("remove",()=>{No.off("click",t0),No.off("tap",t0),No.off("mouseup",bm),No.off("mousedown",n0),No.off("ScrollWindow",o0),No.off("ResizeWindow",s0),No.off("ResizeEditor",r0),No.off("AfterProgressState",Mp),No.off("DismissPopups",vm),mt([Qr,...fr],Ks=>{Ks.element.dom.removeEventListener("focusin",Nw),Ks.element.dom.removeEventListener("focusout",Fw)}),Pp.unbind(),qx.unbind(),Yx.unbind(),Ip.unbind(),Pw.unbind(),Mw.unbind()}),No.on("detach",()=>{mt([Qr,...fr],zS),mt([Qr,...fr],Ks=>Ks.destroy())})})(r,Wt.mothership,xn),x.setup(r,de.popup.shared,ne),ZN(r,de.popup),oF(r,de.popup.shared.getSink,de.popup),(No=>{const{sidebars:Qr}=No.ui.registry.getAll();mt(Jt(Qr),fr=>{const ac=Qr[fr],Ki=()=>Is(O.from(No.queryCommandValue("ToggleSidebar")),fr);No.ui.registry.addToggleButton(fr,{icon:ac.icon,tooltip:ac.tooltip,onAction:qa=>{No.execCommand("ToggleSidebar",!1,fr),qa.setActive(Ki())},onSetup:qa=>{qa.setActive(Ki());const mu=()=>qa.setActive(Ki());return No.on("ToggleSidebar",mu),()=>{No.off("ToggleSidebar",mu)}}})})})(r),j8(r,fe,de.popup.shared),P$(r,xo,en.sink,{backstage:de.popup}),gF(r,en.sink);const Ai={targetNode:r.getElement(),height:Te(Wt.outerContainer)};return m.render(r,zt,pi,de.popup,Ai)})({popupUi:dt,dialogUi:Ke,mainUi:ke,uiMotherships:y.getUiMotherships()})}}},Aw=Y([Rt("lazySink"),ys("dragBlockClass"),Or("getBounds",Ii),lt("useTabstopAt",Oe),lt("firstTabstop",0),lt("eventOrder",{}),vn("modalBehaviours",[uo]),Cc("onExecute"),Wm("onEscape")]),zA={sketch:me},GA=Y([dd({name:"draghandle",overrides:(r,c)=>({behaviours:tn([Qg.config({mode:"mouse",getTarget:f=>vf(f,'[role="dialog"]').getOr(f),blockerClass:r.dragBlockClass.getOrDie(new Error(`The drag blocker class was not specified for a dialog with a drag handle: 
`+JSON.stringify(c,null,2)).message),getBounds:r.getDragBounds})])})}),sc({schema:[Rt("dom")],name:"title"}),sc({factory:zA,schema:[Rt("dom")],name:"close"}),sc({factory:zA,schema:[Rt("dom")],name:"body"}),dd({factory:zA,schema:[Rt("dom")],name:"footer"}),_f({factory:{sketch:(r,c)=>({...r,dom:c.dom,components:c.components})},schema:[lt("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),lt("components",[])],name:"blocker"})]),Za=Dc({name:"ModalDialog",configFields:Aw(),partFields:GA(),factory:(r,c,f,m)=>{const x=nr(),y=Zn("modal-events"),E={...r.eventOrder,[Sc()]:[y].concat(r.eventOrder["alloy.system.attached"]||[])},D=da();return{uid:r.uid,dom:r.dom,components:c,apis:{show:A=>{x.set(A);const P=r.lazySink(A).getOrDie(),U=m.blocker(),B=P.getSystem().build({...U,components:U.components.concat([_c(A)]),behaviours:tn([Bo.config({}),Qo("dialog-blocker-events",[Hm(Co(),()=>{ph.isBlocked(A)||uo.focusIn(A)})])])});Ef(P,B),uo.focusIn(A)},hide:A=>{x.clear(),la(A.element).each(P=>{A.getSystem().getByDom(P).each(U=>{oc(U)})})},getBody:A=>hp(A,r,"body"),getFooter:A=>Br(A,r,"footer"),setIdle:A=>{ph.unblock(A)},setBusy:(A,P)=>{ph.block(A,P)}},eventOrder:E,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:eo(r.modalBehaviours,[Do.config({}),uo.config({mode:"cyclic",onEnter:r.onExecute,onEscape:r.onEscape,useTabstopAt:r.useTabstopAt,firstTabstop:r.firstTabstop}),ph.config({getRoot:x.get}),Qo(y,[zr(A=>{const P=hp(A,r,"title").element,U=(B=>B.dom.textContent)(P);D.os.isMacOS()&&z(U)?Eo(A.element,"aria-label",U):((B,K)=>{const oe=Di(B,"id").fold(()=>{const ne=Zn("dialog-label");return Eo(K,"id",ne),ne},me);Eo(B,"aria-labelledby",oe)})(A.element,P)})])])}},apis:{show:(r,c)=>{r.show(c)},hide:(r,c)=>{r.hide(c)},getBody:(r,c)=>r.getBody(c),getFooter:(r,c)=>r.getFooter(c),setBusy:(r,c,f)=>{r.setBusy(c,f)},setIdle:(r,c)=>{r.setIdle(c)}}}),o7=Wn([va,J2].concat(bb)),s7=ru,E_=[rD("button"),Zd,Tl("align","end",["start","end"]),zy,lh,Vc("buttonType",["primary","secondary"])],vF=[...E_,Kd],Lw=[$a("type",["submit","cancel","custom"]),...vF],WA=[$a("type",["menu"]),Pg,Vy,Zd,ha("items",o7),...E_],jA=[...E_,$a("type",["togglebutton"]),Vy,Zd,Pg,pa("active",!1)],r7=Kr("type",{submit:Lw,cancel:Lw,custom:Lw,menu:WA,togglebutton:jA}),Td=[va,Kd,$a("level",["info","warn","error","success"]),tD,lt("url","")],i7=Wn(Td),a7=[va,Kd,lh,rD("button"),Zd,t6,Vc("buttonType",["primary","secondary","toolbar"]),zy],xF=Wn(a7),Fb=[va,J2],bh=Fb.concat([nD]),l7=Fb.concat([Q2,lh]),c7=Wn(l7),u7=ru,d7=bh.concat([mI("auto")]),f7=Wn(d7),h7=ou([mb,Kd,tD]),yF=bh.concat([rr("storageKey","default")]),m7=Wn(yF),p7=ni,g7=Wn(bh),wF=ni,KA=Fb.concat([rr("tag","textarea"),qr("scriptId"),qr("scriptUrl"),_l("onFocus"),Si("settings",void 0,ff)]),b7=Fb.concat([rr("tag","textarea"),Ji("init")]),ZA=vc(r=>Rr("customeditor.old",ks(b7),r).orThunk(()=>Rr("customeditor.new",ks(KA),r))),Kx=ni,SF=Wn(bh),EF=cr(ki),CF=r=>[va,iu("columns"),r],v7=[va,qr("html"),Tl("presets","presentation",["presentation","document"])],x7=Wn(v7),C_=bh.concat([pa("border",!1),pa("sandboxed",!0),pa("streamContent",!1),pa("transparent",!0)]),y7=Wn(C_),w7=ni,_F=Wn(Fb.concat([oi("height")])),TF=Wn([qr("url"),Vi("zoom"),Vi("cachedWidth"),Vi("cachedHeight")]),qA=bh.concat([oi("inputMode"),oi("placeholder"),pa("maximized",!1),lh]),DF=Wn(qA),qc=ni,kF=r=>[va,Q2,r,Tl("align","start",["start","center","end"])],S7=[Kd,mb],E7=[Kd,ha("items",El(0,()=>YA))],YA=el([Wn(S7),Wn(E7)]),C7=bh.concat([ha("items",YA),lh]),_7=Wn(C7),T7=ni,AF=bh.concat([Cl("items",[Kd,mb]),au("size",1),lh]),gm=Wn(AF),XA=ni,LF=bh.concat([pa("constrain",!0),lh]),__=Wn(LF),T_=Wn([qr("width"),qr("height")]),D7=Fb.concat([Q2,au("min",0),au("max",0)]),k7=Wn(D7),A7=rd,L7=[va,ha("header",ni),ha("cells",cr(ni))],R7=Wn(L7),O7=bh.concat([oi("placeholder"),pa("maximized",!1),lh]),I7=Wn(O7),RF=ni,OF=[$a("type",["directory","leaf"]),eD,qr("id"),ma("menu",WM)],vh=Wn(OF),D_=OF.concat([ha("children",El(0,()=>Du("type",{directory:IF,leaf:vh})))]),IF=Wn(D_),P7=Du("type",{directory:IF,leaf:vh}),PF=[va,ha("items",P7),_l("onLeafAction"),_l("onToggleExpand"),Ua("defaultExpandedIds",[],ni),oi("defaultSelectedId")],MF=Wn(PF),JA=bh.concat([Tl("filetype","file",["image","media","file"]),lh,oi("picker_text")]),k_=Wn(JA),Rw=Wn([mb,sD]),Bb=r=>wi("items","items",{tag:"required",process:{}},cr(vc(c=>Rr(`Checking item of ${r}`,A_,c).fold(f=>os.error(xc(f)),f=>os.value(f))))),A_=Vs(()=>{return Du("type",{alertbanner:i7,bar:Wn((r=Bb("bar"),[va,r])),button:xF,checkbox:c7,colorinput:m7,colorpicker:g7,dropzone:SF,grid:Wn(CF(Bb("grid"))),iframe:y7,input:DF,listbox:_7,selectbox:gm,sizeinput:__,slider:k7,textarea:I7,urlinput:k_,customeditor:ZA,htmlpanel:x7,imagepreview:_F,collection:f7,label:Wn(kF(Bb("label"))),table:R7,tree:MF,panel:QA});var r}),NF=[va,lt("classes",[]),ha("items",A_)],QA=Wn(NF),FF=[rD("tab"),eD,ha("items",A_)],M7=[va,Cl("tabs",FF)],N7=Wn(M7),F7=vF,B7=r7,$7=Wn([qr("title"),fa("body",Du("type",{panel:QA,tabpanel:N7})),rr("size","normal"),Ua("buttons",[],B7),lt("initialData",{}),Or("onAction",j),Or("onChange",j),Or("onSubmit",j),Or("onClose",j),Or("onCancel",j),Or("onTabChange",j)]),BF=Wn([$a("type",["cancel","custom"]),...F7]),$F=Wn([qr("title"),qr("url"),Vi("height"),Vi("width"),yc("buttons",BF),Or("onAction",j),Or("onCancel",j),Or("onClose",j),Or("onMessage",j)]),eL=r=>g(r)?[r].concat(Rn(gn(r),eL)):S(r)?Rn(r,eL):[],HF=r=>h(r.type)&&h(r.name),H7={checkbox:u7,colorinput:p7,colorpicker:wF,dropzone:EF,input:qc,iframe:w7,imagepreview:TF,selectbox:XA,sizeinput:T_,slider:A7,listbox:T7,size:T_,textarea:RF,urlinput:Rw,customeditor:Kx,collection:h7,togglemenuitem:s7},UF=r=>{const c=(m=>on(eL(m),HF))(r),f=Rn(c,m=>(x=>O.from(H7[x.type]))(m).fold(()=>[],x=>[fa(m.name,x)]));return Wn(f)},Zx=r=>{var c;return{internalDialog:Vl(Rr("dialog",$7,r)),dataValidator:UF(r),initialData:(c=r.initialData)!==null&&c!==void 0?c:{}}},$b={open:(r,c)=>{const f=Zx(c);return r(f.internalDialog,f.initialData,f.dataValidator)},openUrl:(r,c)=>r(Vl(Rr("dialog",$F,c))),redial:r=>Zx(r)};var VF=Object.freeze({__proto__:null,events:(r,c)=>{const f=(m,x)=>{r.updateState.each(y=>{const E=y(m,x);c.set(E)}),r.renderComponents.each(y=>{const E=y(x,c.get());(r.reuseDom?E2:ib)(m,E)})};return Ws([Ft(Au(),(m,x)=>{const y=x;if(!y.universal){const E=r.channel;et(y.channels,E)&&f(m,y.data)}}),zr((m,x)=>{r.initialData.each(y=>{f(m,y)})})])}}),U7=Object.freeze({__proto__:null,getState:(r,c,f)=>f}),V7=[Rt("channel"),ys("renderComponents"),ys("updateState"),ys("initialData"),pa("reuseDom",!0)];const Yu=Mi({fields:V7,name:"reflecting",active:VF,apis:U7,state:Object.freeze({__proto__:null,init:()=>{const r=ho(O.none());return{readState:()=>r.get().getOr("none"),get:r.get,set:r.set,clear:()=>r.set(O.none())}}})}),zF=r=>{const c=[],f={};return Cn(r,(m,x)=>{m.fold(()=>{c.push(x)},y=>{f[x]=y})}),c.length>0?os.error(c):os.value(f)},GF=(r,c,f)=>{const m=dr(Ix.sketch(y=>({dom:{tag:"div",classes:["tox-form"].concat(r.classes)},components:qe(r.items,E=>GC(y,E,c,f))})));return{dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[m.asSpec()]}],behaviours:tn([uo.config({mode:"acyclic",useTabstopAt:Ue(Nx)}),(x=m,Os.config({find:x.getOpt})),MP(m,{postprocess:y=>zF(y).fold(E=>(console.error(E),{}),me)}),Qo("dialog-body-panel",[Ft(Co(),(y,E)=>{y.getSystem().broadcastOn([lw],{newFocus:O.some(E.event.target)})})])])};var x},z7=fd({name:"TabButton",configFields:[lt("uid",void 0),Rt("value"),wi("dom","dom",Io(()=>({attributes:{role:"tab",id:Zn("aria"),"aria-selected":"false"}})),Sa()),ys("action"),lt("domModification",{}),vn("tabButtonBehaviours",[Bo,uo,at]),Rt("view")],factory:(r,c)=>({uid:r.uid,dom:r.dom,components:r.components,events:cx(r.action),behaviours:eo(r.tabButtonBehaviours,[Bo.config({}),uo.config({mode:"execution",useSpace:!0,useEnter:!0}),at.config({store:{mode:"memory",initialValue:r.value}})]),domModification:r.domModification})}),WF=Y([Rt("tabs"),Rt("dom"),lt("clickToDismiss",!1),vn("tabbarBehaviours",[or,uo]),gf(["tabClass","selectedClass"])]),tL=KS({factory:z7,name:"tabs",unit:"tab",overrides:r=>{const c=(m,x)=>{or.dehighlight(m,x),so(m,ng(),{tabbar:m,button:x})},f=(m,x)=>{or.highlight(m,x),so(m,tg(),{tabbar:m,button:x})};return{action:m=>{const x=m.getSystem().getByUid(r.uid).getOrDie(),y=or.isHighlighted(x,m);(y&&r.clickToDismiss?c:y?j:f)(x,m)},domModification:{classes:[r.markers.tabClass]}}}}),Op=Y([tL]),L_=Dc({name:"Tabbar",configFields:WF(),partFields:Op(),factory:(r,c,f,m)=>({uid:r.uid,dom:r.dom,components:c,"debug.sketcher":"Tabbar",domModification:{attributes:{role:"tablist"}},behaviours:eo(r.tabbarBehaviours,[or.config({highlightClass:r.markers.selectedClass,itemClass:r.markers.tabClass,onHighlight:(x,y)=>{Eo(y.element,"aria-selected","true")},onDehighlight:(x,y)=>{Eo(y.element,"aria-selected","false")}}),uo.config({mode:"flow",getInitial:x=>or.getHighlighted(x).map(y=>y.element),selector:"."+r.markers.tabClass,executeOnMove:!0})])})}),jF=fd({name:"Tabview",configFields:[vn("tabviewBehaviours",[Do])],factory:(r,c)=>({uid:r.uid,dom:r.dom,behaviours:eo(r.tabviewBehaviours,[Do.config({})]),domModification:{attributes:{role:"tabpanel"}}})}),KF=Y([lt("selectFirst",!0),Rs("onChangeTab"),Rs("onDismissTab"),lt("tabs",[]),vn("tabSectionBehaviours",[])]),nL=sc({factory:L_,schema:[Rt("dom"),Ha("markers",[Rt("tabClass"),Rt("selectedClass")])],name:"tabbar",defaults:r=>({tabs:r.tabs})}),ZF=sc({factory:jF,name:"tabview"}),R_=Y([nL,ZF]),Hb=Dc({name:"TabSection",configFields:KF(),partFields:R_(),factory:(r,c,f,m)=>{const x=(y,E)=>{Br(y,r,"tabbar").each(D=>{E(D).each(id)})};return{uid:r.uid,dom:r.dom,components:c,behaviours:go(r.tabSectionBehaviours),events:Ws(Vn([r.selectFirst?[zr((y,E)=>{x(y,or.getFirst)})]:[],[Ft(tg(),(y,E)=>{(D=>{const A=at.getValue(D);Br(D,r,"tabview").each(P=>{J(r.tabs,U=>U.value===A).each(U=>{const B=U.view();Di(D.element,"id").each(K=>{Eo(P.element,"aria-labelledby",K)}),Do.set(P,B),r.onChangeTab(P,D,B)})})})(E.event.button)}),Ft(ng(),(y,E)=>{const D=E.event.button;r.onDismissTab(y,D)})]])),apis:{getViewItems:y=>Br(y,r,"tabview").map(E=>Do.contents(E)).getOr([]),showTab:(y,E)=>{x(y,D=>{const A=or.getCandidates(D);return J(A,P=>at.getValue(P)===E).filter(P=>!or.isHighlighted(D,P))})}}}},apis:{getViewItems:(r,c)=>r.getViewItems(c),showTab:(r,c,f)=>{r.showTab(c,f)}}}),oL=(r,c)=>{Ro(r,"height",c+"px"),Ro(r,"flex-basis",c+"px")},O_=(r,c,f)=>{vf(r,'[role="dialog"]').each(m=>{si(m,'[role="tablist"]').each(x=>{f.get().map(y=>(Ro(c,"height","0"),Ro(c,"flex-basis","0"),Math.min(y,((E,D,A)=>{const P=Ur(E).dom,U=vf(E,".tox-dialog-wrap").getOr(E);let B;B=Fr(U,"position")==="fixed"?Math.max(P.clientHeight,window.innerHeight):Math.max(P.offsetHeight,P.scrollHeight);const K=Qe(D),oe=D.dom.offsetLeft>=A.dom.offsetLeft+ds(A)?Math.max(Qe(A),K):K,ne=parseInt(Fr(E,"margin-top"),10)||0,ge=parseInt(Fr(E,"margin-bottom"),10)||0;return B-(Qe(E)+ne+ge-oe)})(m,c,x)))).each(y=>{oL(c,y)})})})},sL=r=>si(r,'[role="tabpanel"]'),qF="send-data-to-section",YF="send-data-to-view",G7=(r,c,f)=>{const m=ho({}),x=P=>{const U=at.getValue(P),B=zF(U).getOr({}),K=m.get(),oe=Ze(K,B);m.set(oe)},y=P=>{const U=m.get();at.setValue(P,U)},E=ho(null),D=qe(r.tabs,P=>({value:P.name,dom:{tag:"div",classes:["tox-dialog__body-nav-item"]},components:[Pr(f.shared.providers.translate(P.title))],view:()=>[Ix.sketch(U=>({dom:{tag:"div",classes:["tox-form"]},components:qe(P.items,B=>GC(U,B,c,f)),formBehaviours:tn([uo.config({mode:"acyclic",useTabstopAt:Ue(Nx)}),Qo("TabView.form.events",[zr(y),pf(x)]),pl.config({channels:wc([{key:qF,value:{onReceive:x}},{key:YF,value:{onReceive:y}}])})])}))]})),A=(P=>{const U=nr();return{extraEvents:[zr(K=>{const oe=K.element;sL(oe).each(ne=>{Ro(ne,"visibility","hidden"),K.getSystem().getByDom(ne).toOptional().each(ge=>{const he=((fe,de,be)=>qe(fe,(Te,ke)=>{Do.set(be,fe[ke].view());const Ke=de.dom.getBoundingClientRect();return Do.set(be,[]),Ke.height}))(P,ne,ge);(fe=>Dn(xe(fe,(de,be)=>de>be?-1:de<be?1:0)))(he).fold(U.clear,U.set)}),O_(oe,ne,U),us(ne,"visibility"),((ge,he)=>{Dn(ge).each(Le=>Hb.showTab(he,Le.value))})(P,K),requestAnimationFrame(()=>{O_(oe,ne,U)})})}),Ft(eg(),K=>{const oe=K.element;sL(oe).each(ne=>{O_(oe,ne,U)})}),Ft(nP,(K,oe)=>{const ne=K.element;sL(ne).each(ge=>{const he=Gl(jr(ge));Ro(ge,"visibility","hidden");const Le=yi(ge,"height").map(de=>parseInt(de,10));us(ge,"height"),us(ge,"flex-basis");const fe=ge.dom.getBoundingClientRect().height;Le.forall(de=>fe>de)?(U.set(fe),O_(ne,ge,U)):Le.each(de=>{oL(ge,de)}),us(ge,"visibility"),he.each($u)})})],selectFirst:!1}})(D);return Hb.sketch({dom:{tag:"div",classes:["tox-dialog__body"]},onChangeTab:(P,U,B)=>{const K=at.getValue(U);so(P,aC,{name:K,oldName:E.get()}),E.set(K)},tabs:D,components:[Hb.parts.tabbar({dom:{tag:"div",classes:["tox-dialog__body-nav"]},components:[L_.parts.tabs({})],markers:{tabClass:"tox-tab",selectedClass:"tox-dialog__body-nav-item--active"},tabbarBehaviours:tn([Mr.config({})])}),Hb.parts.tabview({dom:{tag:"div",classes:["tox-dialog__body-content"]}})],selectFirst:A.selectFirst,tabSectionBehaviours:tn([Qo("tabpanel",A.extraEvents),uo.config({mode:"acyclic"}),Os.config({find:P=>Dn(Hb.getViewItems(P))}),Cb(O.none(),P=>(P.getSystem().broadcastOn([qF],{}),m.get()),(P,U)=>{m.set(U),P.getSystem().broadcastOn([YF],{})})])})},rL=(r,c,f,m,x)=>({dom:{tag:"div",classes:["tox-dialog__content-js"],attributes:{...f.map(y=>({id:y})).getOr({}),...x?{"aria-live":"polite"}:{}}},components:[],behaviours:tn([fk(0),Yu.config({channel:`${pk}-${c}`,updateState:(y,E)=>O.some({isTabPanel:()=>E.body.type==="tabpanel"}),renderComponents:y=>{const E=y.body;return E.type==="tabpanel"?[G7(E,y.initialData,m)]:[GF(E,y.initialData,m)]},initialData:r})])}),XF=sh.deviceType.isTouch(),JF=(r,c)=>({dom:{tag:"div",styles:{display:"none"},classes:["tox-dialog__header"]},components:[r,c]}),QF=(r,c)=>Za.parts.close(Il.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":c.translate("Close")}},action:r,buttonBehaviours:tn([Mr.config({})])})),e3=()=>Za.parts.title({dom:{tag:"div",classes:["tox-dialog__title"],innerHtml:"",styles:{display:"none"}}}),Ow=(r,c)=>Za.parts.body({dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[{dom:om(`<p>${jO(c.translate(r))}</p>`)}]}]}),t3=r=>Za.parts.footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:r}),n3=(r,c)=>[Af.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:r}),Af.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:c})],I_=r=>{const c="tox-dialog",f=c+"-wrap",m=f+"__backdrop",x=c+"__disable-scroll";return Za.sketch({lazySink:r.lazySink,onEscape:y=>(r.onEscape(y),O.some(!0)),useTabstopAt:y=>!Nx(y),firstTabstop:r.firstTabstop,dom:{tag:"div",classes:[c].concat(r.extraClasses),styles:{position:"relative",...r.extraStyles}},components:[r.header,r.body,...r.footer.toArray()],parts:{blocker:{dom:om(`<div class="${f}"></div>`),components:[{dom:{tag:"div",classes:XF?[m,m+"--opaque"]:[m]}}]}},dragBlockClass:f,modalBehaviours:tn([Bo.config({}),Qo("dialog-events",r.dialogEvents.concat([Hm(Co(),(y,E)=>{ph.isBlocked(y)||uo.focusIn(y)}),Ft(Bd(),(y,E)=>{y.getSystem().broadcastOn([lw],{newFocus:E.event.newFocus})})])),Qo("scroll-lock",[zr(()=>{zi(Fa(),x)}),pf(()=>{hi(Fa(),x)})]),...r.extraBehaviours]),eventOrder:{[pr()]:["dialog-events"],[Sc()]:["scroll-lock","dialog-events","alloy.base.behaviour"],[kl()]:["alloy.base.behaviour","dialog-events","scroll-lock"],...r.eventOrder}})},iL=r=>Il.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":r.translate("Close"),"data-mce-name":"close"}},buttonBehaviours:tn([Mr.config({}),Pl.config(r.tooltips.getConfig({tooltipText:r.translate("Close")}))]),components:[vd("close",{tag:"span",classes:["tox-icon"]},r.icons)],action:c=>{rs(c,Vg)}}),o3=(r,c,f,m)=>({dom:{tag:"h1",classes:["tox-dialog__title"],attributes:{...f.map(x=>({id:x})).getOr({})}},components:[],behaviours:tn([Yu.config({channel:`${$P}-${c}`,initialData:r,renderComponents:x=>[Pr(m.translate(x.title))]})])}),s3=()=>({dom:om('<div class="tox-dialog__draghandle"></div>')}),P_=(r,c,f)=>((m,x,y)=>{const E=Za.parts.title(o3(m,x,O.none(),y)),D=Za.parts.draghandle(s3()),A=Za.parts.close(iL(y)),P=[E].concat(m.draggable?[D]:[]).concat([A]);return Af.sketch({dom:om('<div class="tox-dialog__header"></div>'),components:P})})({title:f.shared.providers.translate(r),draggable:f.dialog.isDraggableModal()},c,f.shared.providers),r3=(r,c,f,m)=>({dom:{tag:"div",classes:["tox-dialog__busy-spinner"],attributes:{"aria-label":f.translate(r)},styles:{left:"0px",right:"0px",bottom:"0px",top:`${m.getOr(0)}px`,position:"absolute"}},behaviours:c,components:[{dom:om('<div class="tox-spinner"><div></div><div></div><div></div></div>')}]}),aL=(r,c,f)=>({onClose:()=>f.closeWindow(),onBlock:m=>{const x=si(r().element,".tox-dialog__header").map(y=>Qe(y));Za.setBusy(r(),(y,E)=>r3(m.message,E,c,x))},onUnblock:()=>{Za.setIdle(r())}}),i3="tox-dialog--fullscreen",lL="tox-dialog--width-lg",cL="tox-dialog--width-md",Iw=r=>{switch(r){case"large":return O.some(lL);case"medium":return O.some(cL);default:return O.none()}},uL=(r,c)=>{const f=Ie(c.element.dom);zl(f,i3)||(Xr(f,[lL,cL]),Iw(r).each(m=>zi(f,m)))},a3=(r,c)=>{const f=Ie(r.element.dom),m=mv(f),x=J(m,y=>y===lL||y===cL).or(Iw(c));((y,E)=>{mt(E,D=>{((A,P)=>{Ou(A)?A.dom.classList.toggle(P):((U,B)=>et(dv(U),B)?hv(U,B):fv(U,B))(A,P),Um(A)})(y,D)})})(f,[i3,...x.toArray()])},l3=(r,c,f)=>Qi(I_({...r,firstTabstop:1,lazySink:f.shared.getSink,extraBehaviours:[TC({}),...r.extraBehaviours],onEscape:m=>{rs(m,Vg)},dialogEvents:c,eventOrder:{[Au()]:[Yu.name(),pl.name()],[Sc()]:["scroll-lock",Yu.name(),"messages","dialog-events","alloy.base.behaviour"],[kl()]:["alloy.base.behaviour","dialog-events","messages",Yu.name(),"scroll-lock"]}})),dL=(r,c={})=>qe(r,f=>f.type==="menu"?(m=>{const x=qe(m.items,y=>{const E=At(c,y.name).getOr(ho(!1));return{...y,storage:E}});return{...m,items:x}})(f):f),c3=r=>an(r,(c,f)=>f.type==="menu"?an(f.items,(m,x)=>(m[x.name]=x.storage,m),c):c,{}),fL=(r,c)=>[b1(Co(),s8),r(sw,(f,m,x,y)=>{Gl(jr(y.element)).fold(j,Jm),c.onClose(),m.onClose()}),r(Vg,(f,m,x,y)=>{m.onCancel(f),rs(y,sw)}),Ft(iC,(f,m)=>c.onUnblock()),Ft(rC,(f,m)=>c.onBlock(m.event))],u3=(r,c,f)=>{const m=(y,E)=>Ft(y,(D,A)=>{x(D,(P,U)=>{E(r(),P,A.event,D)})}),x=(y,E)=>{Yu.getState(y).get().each(D=>{E(D.internalDialog,y)})};return[...fL(m,c),m(Sb,(y,E)=>E.onSubmit(y)),m(Zu,(y,E,D)=>{E.onChange(y,{name:D.name})}),m(cm,(y,E,D,A)=>{const P=()=>A.getSystem().isConnected()?uo.focusIn(A):void 0,U=oe=>Ba(oe,"disabled")||Di(oe,"aria-disabled").exists(ne=>ne==="true"),B=jr(A.element),K=Gl(B);E.onAction(y,{name:D.name,value:D.value}),Gl(B).fold(P,oe=>{U(oe)||K.exists(ne=>ts(oe,ne)&&U(ne))?P():f().toOptional().filter(ne=>!ts(ne.element,oe)).each(P)})}),m(aC,(y,E,D)=>{E.onTabChange(y,{newTabName:D.name,oldTabName:D.oldName})}),pf(y=>{const E=r();at.setValue(y,E.getData())})]},d3=(r,c)=>{const f=c.map(y=>y.footerButtons).getOr([]),m=Un(f,y=>y.align==="start"),x=(y,E)=>Af.sketch({dom:{tag:"div",classes:[`tox-dialog__footer-${y}`]},components:qe(E,D=>D.memento.asSpec())});return[x("start",m.pass),x("end",m.fail)]},f3=(r,c,f)=>({dom:om('<div class="tox-dialog__footer"></div>'),components:[],behaviours:tn([Yu.config({channel:`${gk}-${c}`,initialData:r,updateState:(m,x)=>{const y=qe(x.buttons,E=>{const D=dr(((A,P)=>HC(A,A.type,P))(E,f));return{name:E.name,align:E.align,memento:D}});return O.some({lookupByName:E=>((D,A,P)=>J(A,U=>U.name===P).bind(U=>U.memento.getOpt(D)))(m,y,E),footerButtons:y})},renderComponents:d3})])}),h3=(r,c,f)=>Za.parts.footer(f3(r,c,f)),m3=(r,c)=>{if(r.getRoot().getSystem().isConnected()){const f=Os.getCurrent(r.getFormWrapper()).getOr(r.getFormWrapper());return Ix.getField(f,c).orThunk(()=>r.getFooter().bind(x=>Yu.getState(x).get()).bind(x=>x.lookupByName(c)))}return O.none()},p3=(r,c,f)=>{const m=y=>{const E=r.getRoot();E.getSystem().isConnected()&&y(E)},x={getData:()=>{const y=r.getRoot(),E=y.getSystem().isConnected()?r.getFormWrapper():y;return{...at.getValue(E),...Nn(f,D=>D.get())}},setData:y=>{m(E=>{const D=x.getData(),A=Ze(D,y),P=((B,K)=>{const oe=B.getRoot();return Yu.getState(oe).get().map(ne=>Vl(Rr("data",ne.dataValidator,K))).getOr(K)})(r,A),U=r.getFormWrapper();at.setValue(U,P),Cn(f,(B,K)=>{On(A,K)&&B.set(A[K])})})},setEnabled:(y,E)=>{m3(r,y).each(E?Ho.enable:Ho.disable)},focus:y=>{m3(r,y).each(Bo.focus)},block:y=>{if(!h(y))throw new Error("The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument");m(E=>{so(E,rC,{message:y})})},unblock:()=>{m(y=>{rs(y,iC)})},showTab:y=>{m(E=>{const D=r.getBody();Yu.getState(D).get().exists(A=>A.isTabPanel())&&Os.getCurrent(D).each(A=>{Hb.showTab(A,y)})})},redial:y=>{m(E=>{const D=r.getId(),A=c(y),P=dL(A.internalDialog.buttons,f);E.getSystem().broadcastOn([`${AC}-${D}`],A),E.getSystem().broadcastOn([`${$P}-${D}`],A.internalDialog),E.getSystem().broadcastOn([`${pk}-${D}`],A.internalDialog),E.getSystem().broadcastOn([`${gk}-${D}`],{...A.internalDialog,buttons:P}),x.setData(A.initialData)})},close:()=>{m(y=>{rs(y,sw)})},toggleFullscreen:r.toggleFullscreen};return x},g3=(r,c,f,m=!1,x)=>{const y=Zn("dialog"),E=Zn("dialog-label"),D=Zn("dialog-content"),A=r.internalDialog,P=ho(A.size),U=Iw(P.get()).toArray(),B=dr(((be,Te,ke,Ke)=>Af.sketch({dom:om('<div class="tox-dialog__header"></div>'),components:[o3(be,Te,O.some(ke),Ke),s3(),iL(Ke)],containerBehaviours:tn([Qg.config({mode:"mouse",blockerClass:"blocker",getTarget:dt=>js(dt,'[role="dialog"]').getOrDie(),snaps:{getSnapPoints:()=>[],leftAttr:"data-drag-left",topAttr:"data-drag-top"}})])}))({title:A.title,draggable:!0},y,E,f.shared.providers)),K=dr(((be,Te,ke,Ke,dt)=>rL(be,Te,O.some(ke),Ke,dt))({body:A.body,initialData:A.initialData},y,D,f,m)),oe=dL(A.buttons),ne=c3(oe),ge=qo(oe.length!==0,dr(((be,Te,ke)=>f3(be,Te,ke))({buttons:oe},y,f))),he=u3(()=>de,{onBlock:be=>{ph.block(fe,(Te,ke)=>{const Ke=B.getOpt(fe).map(dt=>Qe(dt.element));return r3(be.message,ke,f.shared.providers,Ke)})},onUnblock:()=>{ph.unblock(fe)},onClose:()=>c.closeWindow()},f.shared.getSink),Le=da().os,fe=Qi({dom:{tag:"div",classes:["tox-dialog","tox-dialog-inline",...U],attributes:{role:"dialog",...Le.isMacOS()?{"aria-label":A.title}:{"aria-labelledby":E}}},eventOrder:{[Au()]:[Yu.name(),pl.name()],[pr()]:["execute-on-form"],[Sc()]:["reflecting","execute-on-form"]},behaviours:tn([uo.config({mode:"cyclic",onEscape:be=>(rs(be,sw),O.some(!0)),useTabstopAt:be=>!Nx(be)&&(sn(be)!=="button"||xi(be,"disabled")!=="disabled"),firstTabstop:1}),Yu.config({channel:`${AC}-${y}`,updateState:(be,Te)=>(P.set(Te.internalDialog.size),uL(Te.internalDialog.size,be),x(),O.some(Te)),initialData:r}),Bo.config({}),Qo("execute-on-form",he.concat([Hm(Co(),(be,Te)=>{uo.focusIn(be)}),Ft(Bd(),(be,Te)=>{be.getSystem().broadcastOn([lw],{newFocus:Te.event.newFocus})})])),ph.config({getRoot:()=>O.some(fe)}),Do.config({}),TC({})]),components:[B.asSpec(),K.asSpec(),...ge.map(be=>be.asSpec()).toArray()]}),de=p3({getId:Y(y),getRoot:Y(fe),getFooter:()=>ge.map(be=>be.get(fe)),getBody:()=>K.get(fe),getFormWrapper:()=>{const be=K.get(fe);return Os.getCurrent(be).getOr(be)},toggleFullscreen:()=>{a3(fe,P.get())}},c.redial,ne);return{dialog:fe,instanceApi:de}};var hL=tinymce.util.Tools.resolve("tinymce.util.URI");const W7=["insertContent","setContent","execCommand","close","block","unblock"],b3=r=>g(r)&&W7.indexOf(r.mceAction)!==-1,j7=(r,c,f,m)=>{const x=Zn("dialog"),y=P_(r.title,x,m),E=(Le=>{const fe={dom:{tag:"div",classes:["tox-dialog__content-js"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-iframe"]},components:[mk(O.none(),{dom:{tag:"iframe",attributes:{src:Le.url}},behaviours:tn([Mr.config({}),Bo.config({})])})]}],behaviours:tn([uo.config({mode:"acyclic",useTabstopAt:Ue(Nx)})])};return Za.parts.body(fe)})(r),D=r.buttons.bind(Le=>Le.length===0?O.none():O.some(h3({buttons:Le},x,m))),A=((Le,fe)=>{const de=(Te,ke)=>Ft(Te,(Ke,dt)=>{be(Ke,(zt,Wt)=>{ke(he,zt,dt.event,Ke)})}),be=(Te,ke)=>{Yu.getState(Te).get().each(Ke=>{ke(Ke,Te)})};return[...fL(de,fe),de(cm,(Te,ke,Ke)=>{ke.onAction(Te,{name:Ke.name})})]})(0,aL(()=>ge,m.shared.providers,c)),P={...r.height.fold(()=>({}),Le=>({height:Le+"px","max-height":Le+"px"})),...r.width.fold(()=>({}),Le=>({width:Le+"px","max-width":Le+"px"}))},U=r.width.isNone()&&r.height.isNone()?["tox-dialog--width-lg"]:[],B=new hL(r.url,{base_uri:new hL(window.location.href)}),K=`${B.protocol}://${B.host}${B.port?":"+B.port:""}`,oe=mc(),ne=[Yu.config({channel:`${AC}-${x}`,updateState:(Le,fe)=>O.some(fe),initialData:r}),Qo("messages",[zr(()=>{const Le=Rl(Ie(window),"message",fe=>{if(B.isSameOrigin(new hL(fe.raw.origin))){const de=fe.raw.data;b3(de)?((be,Te,ke)=>{switch(ke.mceAction){case"insertContent":be.insertContent(ke.content);break;case"setContent":be.setContent(ke.content);break;case"execCommand":const Ke=!!k(ke.ui)&&ke.ui;be.execCommand(ke.cmd,Ke,ke.value);break;case"close":Te.close();break;case"block":Te.block(ke.message);break;case"unblock":Te.unblock()}})(f,he,de):(be=>!b3(be)&&g(be)&&On(be,"mceAction"))(de)&&r.onMessage(he,de)}});oe.set(Le)}),pf(oe.clear)]),pl.config({channels:{[bk]:{onReceive:(Le,fe)=>{si(Le.element,"iframe").each(de=>{const be=de.dom.contentWindow;z(be)&&be.postMessage(fe,K)})}}}})],ge=l3({id:x,header:y,body:E,footer:D,extraClasses:U,extraBehaviours:ne,extraStyles:P},A,m),he=(Le=>{const fe=de=>{Le.getSystem().isConnected()&&de(Le)};return{block:de=>{if(!h(de))throw new Error("The urlDialogInstanceAPI.block function should be passed a blocking message of type string as an argument");fe(be=>{so(be,rC,{message:de})})},unblock:()=>{fe(de=>{rs(de,iC)})},close:()=>{fe(de=>{rs(de,sw)})},sendMessage:de=>{fe(be=>{be.getSystem().broadcastOn([bk],de)})}}})(ge);return{dialog:ge,instanceApi:he}},M_=(r,c)=>Vl(Rr("data",c,r)),v3=r=>ow(r,".tox-alert-dialog")||ow(r,".tox-confirm-dialog"),K7=(r,c,f)=>c&&f?[]:[mi.config({contextual:{lazyContext:()=>O.some(Ys(Ie(r.getContentAreaContainer()))),fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition"},modes:["top"],lazyViewport:m=>kg(r,m.element).map(x=>({bounds:Ag(x),optScrollEnv:O.some({currentScrollTop:x.element.dom.scrollTop,scrollElmTop:wr(x.element).top})})).getOrThunk(()=>({bounds:Ii(),optScrollEnv:O.none()}))})],Z7=r=>{const c=r.editor,f=gp(c),m=(A=>{const P=A.shared;return{open:(U,B)=>{const K=()=>{Za.hide(he),B()},oe=dr(HC({name:"close-alert",text:"OK",primary:!0,buttonType:O.some("primary"),align:"end",enabled:!0,icon:O.none()},"cancel",A)),ne=e3(),ge=QF(K,P.providers),he=Qi(I_({lazySink:()=>P.getSink(),header:JF(ne,ge),body:Ow(U,P.providers),footer:O.some(t3(n3([],[oe.asSpec()]))),onEscape:K,extraClasses:["tox-alert-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[Ft(Vg,K)],eventOrder:{}}));Za.show(he);const Le=oe.get(he);Bo.focus(Le)}}})(r.backstages.dialog),x=(A=>{const P=A.shared;return{open:(U,B)=>{const K=de=>{Za.hide(Le),B(de)},oe=dr(HC({name:"yes",text:"Yes",primary:!0,buttonType:O.some("primary"),align:"end",enabled:!0,icon:O.none()},"submit",A)),ne=HC({name:"no",text:"No",primary:!1,buttonType:O.some("secondary"),align:"end",enabled:!0,icon:O.none()},"cancel",A),ge=e3(),he=QF(()=>K(!1),P.providers),Le=Qi(I_({lazySink:()=>P.getSink(),header:JF(ge,he),body:Ow(U,P.providers),footer:O.some(t3(n3([],[ne,oe.asSpec()]))),onEscape:()=>K(!1),extraClasses:["tox-confirm-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[Ft(Vg,()=>K(!1)),Ft(Sb,()=>K(!0))],eventOrder:{}}));Za.show(Le);const fe=oe.get(Le);Bo.focus(fe)}}})(r.backstages.dialog),y=(A,P)=>$b.open((U,B,K)=>{const oe=B,ne=((ge,he,Le)=>{const fe=Zn("dialog"),de=ge.internalDialog,be=P_(de.title,fe,Le),Te=ho(de.size),ke=Iw(Te.get()).toArray(),Ke=((Zo,ws,ii)=>{const pi=rL(Zo,ws,O.none(),ii,!1);return Za.parts.body(pi)})({body:de.body,initialData:de.initialData},fe,Le),dt=dL(de.buttons),zt=c3(dt),Wt=qo(dt.length!==0,h3({buttons:dt},fe,Le)),en=u3(()=>xo,aL(()=>$n,Le.shared.providers,he),Le.shared.getSink),xn={id:fe,header:be,body:Ke,footer:Wt,extraClasses:ke,extraBehaviours:[Yu.config({channel:`${AC}-${fe}`,updateState:(Zo,ws)=>(Te.set(ws.internalDialog.size),uL(ws.internalDialog.size,Zo),O.some(ws)),initialData:ge})],extraStyles:{}},$n=l3(xn,en,Le),ro={getId:Y(fe),getRoot:Y($n),getBody:()=>Za.getBody($n),getFooter:()=>Za.getFooter($n),getFormWrapper:()=>{const Zo=Za.getBody($n);return Os.getCurrent(Zo).getOr(Zo)},toggleFullscreen:()=>{a3($n,Te.get())}},xo=p3(ro,he.redial,zt);return{dialog:$n,instanceApi:xo}})({dataValidator:K,initialData:oe,internalDialog:U},{redial:$b.redial,closeWindow:()=>{Za.hide(ne.dialog),P(ne.instanceApi)}},r.backstages.dialog);return Za.show(ne.dialog),ne.instanceApi.setData(oe),ne.instanceApi},A),E=(A,P,U,B)=>$b.open((K,oe,ne)=>{const ge=M_(oe,ne),he=nr(),Le=r.backstages.popup.shared.header.isPositionedAtTop(),fe=()=>he.on(Te=>{ri.reposition(Te),f&&Le||mi.refresh(Te)}),de=g3({dataValidator:ne,initialData:ge,internalDialog:K},{redial:$b.redial,closeWindow:()=>{he.on(ri.hide),c.off("ResizeEditor",fe),he.clear(),U(de.instanceApi)}},r.backstages.popup,B.ariaAttrs,fe),be=Qi(ri.sketch({lazySink:r.backstages.popup.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:B.persistent?{event:"doNotDismissYet"}:{},...Le?{}:{fireRepositionEventInstead:{}},inlineBehaviours:tn([Qo("window-manager-inline-events",[Ft(Fd(),(Te,ke)=>{rs(de.dialog,Vg)})]),...K7(c,f,Le)]),isExtraPart:(Te,ke)=>v3(ke)}));return he.set(be),ri.showWithinBounds(be,_c(de.dialog),{anchor:P},()=>{const Te=c.inline?Fa():Ie(c.getContainer()),ke=Ys(Te);return O.some(ke)}),f&&Le||(mi.refresh(be),c.on("ResizeEditor",fe)),de.instanceApi.setData(ge),uo.focusIn(de.dialog),de.instanceApi},A),D=(A,P,U,B)=>$b.open((K,oe,ne)=>{const ge=M_(oe,ne),he=nr(),Le=r.backstages.popup.shared.header.isPositionedAtTop(),fe=()=>he.on(Te=>{ri.reposition(Te),mi.refresh(Te)}),de=g3({dataValidator:ne,initialData:ge,internalDialog:K},{redial:$b.redial,closeWindow:()=>{he.on(ri.hide),c.off("ResizeEditor ScrollWindow ElementScroll",fe),he.clear(),U(de.instanceApi)}},r.backstages.popup,B.ariaAttrs,fe),be=Qi(ri.sketch({lazySink:r.backstages.popup.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:B.persistent?{event:"doNotDismissYet"}:{},...Le?{}:{fireRepositionEventInstead:{}},inlineBehaviours:tn([Qo("window-manager-inline-events",[Ft(Fd(),(Te,ke)=>{rs(de.dialog,Vg)})]),mi.config({contextual:{lazyContext:()=>O.some(Ys(Ie(c.getContentAreaContainer()))),fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition"},modes:["top","bottom"],lazyViewport:Te=>kg(c,Te.element).map(ke=>({bounds:Ag(ke),optScrollEnv:O.some({currentScrollTop:ke.element.dom.scrollTop,scrollElmTop:wr(ke.element).top})})).getOrThunk(()=>({bounds:Ii(),optScrollEnv:O.none()}))})]),isExtraPart:(Te,ke)=>v3(ke)}));return he.set(be),ri.showWithinBounds(be,_c(de.dialog),{anchor:P},()=>r.backstages.popup.shared.getSink().toOptional().bind(Te=>{const ke=kg(c,Te.element).map(zt=>Ag(zt)).getOr(Ii()),Ke=Ys(Ie(c.getContentAreaContainer())),dt=hc(Ke,ke);return O.some(Oi(dt.x,dt.y,dt.width,dt.height-15))})),mi.refresh(be),c.on("ResizeEditor ScrollWindow ElementScroll ResizeWindow",fe),de.instanceApi.setData(ge),uo.focusIn(de.dialog),de.instanceApi},A);return{open:(A,P,U)=>{if(!R(P)){if(P.inline==="toolbar")return E(A,r.backstages.popup.shared.anchors.inlineDialog(),U,P);if(P.inline==="bottom")return D(A,r.backstages.popup.shared.anchors.inlineBottomDialog(),U,P);if(P.inline==="cursor")return E(A,r.backstages.popup.shared.anchors.cursor(),U,P)}return y(A,U)},openUrl:(A,P)=>((U,B)=>$b.openUrl(K=>{const oe=j7(K,{closeWindow:()=>{Za.hide(oe.dialog),B(oe.instanceApi)}},c,r.backstages.dialog);return Za.show(oe.dialog),oe.instanceApi},U))(A,P),alert:(A,P)=>{m.open(A,P)},close:A=>{A.close()},confirm:(A,P)=>{x.open(A,P)}}};od.add("silver",r=>{(D=>{EO(D),(A=>{const P=A.options.register,U=K=>Q(K,h)?{value:v6(K),valid:!0}:{valid:!1,message:"Must be an array of strings."},B=K=>W(K)&&K>0?{value:K,valid:!0}:{valid:!1,message:"Must be a positive number."};P("color_map",{processor:U,default:["#BFEDD2","Light Green","#FBEEB8","Light Yellow","#F8CAC6","Light Red","#ECCAFA","Light Purple","#C2E0F4","Light Blue","#2DC26B","Green","#F1C40F","Yellow","#E03E2D","Red","#B96AD9","Purple","#3598DB","Blue","#169179","Dark Turquoise","#E67E23","Orange","#BA372A","Dark Red","#843FA1","Dark Purple","#236FA1","Dark Blue","#ECF0F1","Light Gray","#CED4D9","Medium Gray","#95A5A6","Gray","#7E8C8D","Dark Gray","#34495E","Navy Blue","#000000","Black","#ffffff","White"]}),P("color_map_background",{processor:U}),P("color_map_foreground",{processor:U}),P("color_cols",{processor:B,default:KE(A)}),P("color_cols_foreground",{processor:B,default:CD(A,Jy)}),P("color_cols_background",{processor:B,default:CD(A,Qy)}),P("custom_colors",{processor:"boolean",default:!0}),P("color_default_foreground",{processor:"string",default:jE}),P("color_default_background",{processor:"string",default:jE})})(D),(A=>{const P=A.options.register;P("contextmenu_avoid_overlap",{processor:"string",default:""}),P("contextmenu_never_use_native",{processor:"boolean",default:!1}),P("contextmenu",{processor:U=>U===!1?{value:[],valid:!0}:h(U)||Q(U,h)?{value:$$(U),valid:!0}:{valid:!1,message:"Must be false or a string."},default:"link linkchecker image editimage table spellchecker configurepermanentpen"})})(D)})(r);let c=()=>Ii();const{dialogs:f,popups:m,renderUI:x}=n7(r,{getPopupSinkBounds:()=>c()});FD(r,m.backstage.shared);const y=Z7({editor:r,backstages:{popup:m.backstage,dialog:f.backstage}}),E=nr();return{renderUI:()=>{const D=x();return kg(r,m.getMothership().element).each(A=>{c=()=>Ag(A)}),D},getWindowManagerImpl:Y(y),getNotificationManagerImpl:()=>YO(r,{backstage:m.backstage},m.getMothership(),E)}})})();(function(){var l=tinymce.util.Tools.resolve("tinymce.ModelManager");const n=w=>_=>(I=>{const H=typeof I;return I===null?"null":H==="object"&&Array.isArray(I)?"array":H==="object"&&(Z=q=I,(le=String).prototype.isPrototypeOf(Z)||((ue=q.constructor)===null||ue===void 0?void 0:ue.name)===le.name)?"string":H;var Z,q,le,ue})(_)===w,o=w=>_=>typeof _===w,i=w=>_=>w===_,u=n("string"),h=n("object"),g=n("array"),b=i(null),S=o("boolean"),T=i(void 0),k=w=>!(_=>_==null)(w),R=o("function"),V=o("number"),z=()=>{},$=w=>()=>w,W=w=>w,Q=(w,_)=>w===_;function j(w,..._){return(...I)=>{const H=_.concat(I);return w.apply(null,H)}}const se=w=>_=>!w(_),re=w=>w(),Y=$(!1),me=$(!0);class ae{constructor(_,I){this.tag=_,this.value=I}static some(_){return new ae(!0,_)}static none(){return ae.singletonNone}fold(_,I){return this.tag?I(this.value):_()}isSome(){return this.tag}isNone(){return!this.tag}map(_){return this.tag?ae.some(_(this.value)):ae.none()}bind(_){return this.tag?_(this.value):ae.none()}exists(_){return this.tag&&_(this.value)}forall(_){return!this.tag||_(this.value)}filter(_){return!this.tag||_(this.value)?this:ae.none()}getOr(_){return this.tag?this.value:_}or(_){return this.tag?this:_}getOrThunk(_){return this.tag?this.value:_()}orThunk(_){return this.tag?this:_()}getOrDie(_){if(this.tag)return this.value;throw new Error(_??"Called getOrDie on None")}static from(_){return k(_)?ae.some(_):ae.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(_){this.tag&&_(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}ae.singletonNone=new ae(!1);const Ce=Array.prototype.slice,Ue=Array.prototype.indexOf,ot=Array.prototype.push,Ae=(w,_)=>{return I=w,H=_,Ue.call(I,H)>-1;var I,H},ve=(w,_)=>{for(let I=0,H=w.length;I<H;I++)if(_(w[I],I))return!0;return!1},Oe=(w,_)=>{const I=[];for(let H=0;H<w;H++)I.push(_(H));return I},O=(w,_)=>{const I=w.length,H=new Array(I);for(let Z=0;Z<I;Z++){const q=w[Z];H[Z]=_(q,Z)}return H},De=(w,_)=>{for(let I=0,H=w.length;I<H;I++)_(w[I],I)},Fe=(w,_)=>{const I=[],H=[];for(let Z=0,q=w.length;Z<q;Z++){const le=w[Z];(_(le,Z)?I:H).push(le)}return{pass:I,fail:H}},st=(w,_)=>{const I=[];for(let H=0,Z=w.length;H<Z;H++){const q=w[H];_(q,H)&&I.push(q)}return I},Ut=(w,_,I)=>(((H,Z)=>{for(let q=H.length-1;q>=0;q--)Z(H[q],q)})(w,(H,Z)=>{I=_(I,H,Z)}),I),et=(w,_,I)=>(De(w,(H,Z)=>{I=_(I,H,Z)}),I),Dt=(w,_)=>((I,H,Z)=>{for(let q=0,le=I.length;q<le;q++){const ue=I[q];if(H(ue,q))return ae.some(ue);if(Z(ue,q))break}return ae.none()})(w,_,Y),Xe=(w,_)=>{for(let I=0,H=w.length;I<H;I++)if(_(w[I],I))return ae.some(I);return ae.none()},it=w=>{const _=[];for(let I=0,H=w.length;I<H;++I){if(!g(w[I]))throw new Error("Arr.flatten item "+I+" was not an array, input: "+w);ot.apply(_,w[I])}return _},qe=(w,_)=>it(O(w,_)),mt=(w,_)=>{for(let I=0,H=w.length;I<H;++I)if(_(w[I],I)!==!0)return!1;return!0},Un=(w,_)=>{const I={};for(let H=0,Z=w.length;H<Z;H++){const q=w[H];I[String(q)]=_(q,H)}return I},on=(w,_)=>_>=0&&_<w.length?ae.some(w[_]):ae.none(),vt=w=>on(w,0),an=w=>on(w,w.length-1),J=(w,_)=>{for(let I=0;I<w.length;I++){const H=_(w[I],I);if(H.isSome())return H}return ae.none()},Bn=Object.keys,Vn=Object.hasOwnProperty,Rn=(w,_)=>{const I=Bn(w);for(let H=0,Z=I.length;H<Z;H++){const q=I[H];_(w[q],q)}},An=(w,_)=>jn(w,(I,H)=>({k:H,v:_(I,H)})),jn=(w,_)=>{const I={};return Rn(w,(H,Z)=>{const q=_(H,Z);I[q.k]=q.v}),I},to=(w,_)=>{const I=[];return Rn(w,(H,Z)=>{I.push(_(H,Z))}),I},mo=w=>to(w,W),$t=(w,_)=>Vn.call(w,_),xe=typeof window<"u"?window:Function("return this;")(),It=(w,_)=>((I,H)=>{let Z=H??xe;for(let q=0;q<I.length&&Z!=null;++q)Z=Z[I[q]];return Z})(w.split("."),_),Dn=Object.getPrototypeOf,Ct=w=>{const _=It("ownerDocument.defaultView",w);return h(w)&&((I=>((H,Z)=>{const q=((le,ue)=>It(le,ue))(H,Z);if(q==null)throw new Error(H+" not available on this browser");return q})("HTMLElement",I))(_).prototype.isPrototypeOf(w)||/^HTML\w*Element$/.test(Dn(w).constructor.name))},yo=w=>w.dom.nodeName.toLowerCase(),Kn=w=>w.dom.nodeType,Jt=w=>_=>Kn(_)===w,Qt=w=>Kn(w)===8||yo(w)==="#comment",Cn=w=>Nn(w)&&Ct(w.dom),Nn=Jt(1),kt=Jt(3),jo=Jt(9),ms=Jt(11),as=w=>_=>Nn(_)&&yo(_)===w,xt=(w,_,I)=>{if(!(u(I)||S(I)||V(I)))throw console.error("Invalid call to Attribute.set. Key ",_,":: Value ",I,":: Element ",w),new Error("Attribute value was not simple");w.setAttribute(_,I+"")},Pt=(w,_,I)=>{xt(w.dom,_,I)},gn=(w,_)=>{const I=w.dom;Rn(_,(H,Z)=>{xt(I,Z,H)})},At=(w,_)=>{const I=w.dom.getAttribute(_);return I===null?void 0:I},On=(w,_)=>ae.from(At(w,_)),In=(w,_)=>{w.dom.removeAttribute(_)},Is=w=>et(w.dom.attributes,(_,I)=>(_[I.name]=I.value,_),{}),kr=w=>{if(w==null)throw new Error("Node cannot be null or undefined");return{dom:w}},Yt={fromHtml:(w,_)=>{const I=(_||document).createElement("div");if(I.innerHTML=w,!I.hasChildNodes()||I.childNodes.length>1){const H="HTML does not have a single root node";throw console.error(H,w),new Error(H)}return kr(I.childNodes[0])},fromTag:(w,_)=>{const I=(_||document).createElement(w);return kr(I)},fromText:(w,_)=>{const I=(_||document).createTextNode(w);return kr(I)},fromDom:kr,fromPoint:(w,_,I)=>ae.from(w.dom.elementFromPoint(_,I)).map(kr)},Ps=(w,_)=>{const I=w.dom;if(I.nodeType!==1)return!1;{const H=I;if(H.matches!==void 0)return H.matches(_);if(H.msMatchesSelector!==void 0)return H.msMatchesSelector(_);if(H.webkitMatchesSelector!==void 0)return H.webkitMatchesSelector(_);if(H.mozMatchesSelector!==void 0)return H.mozMatchesSelector(_);throw new Error("Browser lacks native selectors")}},qo=w=>w.nodeType!==1&&w.nodeType!==9&&w.nodeType!==11||w.childElementCount===0,_i=(w,_)=>{const I=_===void 0?document:_.dom;return qo(I)?ae.none():ae.from(I.querySelector(w)).map(Yt.fromDom)},bs=(w,_)=>w.dom===_.dom,Ar=(w,_)=>{const I=w.dom,H=_.dom;return I!==H&&I.contains(H)},Bl=Ps,aa=w=>Yt.fromDom(w.dom.ownerDocument),ps=w=>jo(w)?w:aa(w),dn=w=>ae.from(w.dom.parentNode).map(Yt.fromDom),vo=w=>ae.from(w.dom.parentElement).map(Yt.fromDom),Gn=(w,_)=>{const I=R(_)?_:Y;let H=w.dom;const Z=[];for(;H.parentNode!==null&&H.parentNode!==void 0;){const q=H.parentNode,le=Yt.fromDom(q);if(Z.push(le),I(le)===!0)break;H=q}return Z},yn=w=>ae.from(w.dom.previousSibling).map(Yt.fromDom),vr=w=>ae.from(w.dom.nextSibling).map(Yt.fromDom),ao=w=>O(w.dom.childNodes,Yt.fromDom),ze=(w,_)=>{const I=w.dom.childNodes;return ae.from(I[_]).map(Yt.fromDom)},Ie=(w,_)=>{dn(w).each(I=>{I.dom.insertBefore(_.dom,w.dom)})},Ot=(w,_)=>{vr(w).fold(()=>{dn(w).each(I=>{Nt(I,_)})},I=>{Ie(I,_)})},_t=(w,_)=>{(H=>ze(H,0))(w).fold(()=>{Nt(w,_)},H=>{w.dom.insertBefore(_.dom,H.dom)})},Nt=(w,_)=>{w.dom.appendChild(_.dom)},_n=(w,_)=>{Ie(w,_),Nt(_,w)},sn=(w,_)=>{De(_,(I,H)=>{const Z=H===0?w:_[H-1];Ot(Z,I)})},Tn=(w,_)=>{De(_,I=>{Nt(w,I)})},Xn=w=>{w.dom.textContent="",De(ao(w),_=>{zn(_)})},zn=w=>{const _=w.dom;_.parentNode!==null&&_.parentNode.removeChild(_)},Ko=w=>{const _=ao(w);_.length>0&&sn(w,_),zn(w)},To=(w,_)=>Yt.fromDom(w.dom.cloneNode(_)),Yo=w=>To(w,!1),Lo=w=>To(w,!0),es=(w,_)=>{const I=Yt.fromTag(_),H=Is(w);return gn(I,H),I},Ms=["tfoot","thead","tbody","colgroup"],hr=(w,_,I)=>({element:w,rowspan:_,colspan:I}),po=(w,_,I)=>({element:w,cells:_,section:I}),ts=(w,_,I)=>({element:w,isNew:_,isLocked:I}),tr=(w,_,I,H)=>({element:w,cells:_,section:I,isNew:H}),ai=R(Element.prototype.attachShadow)&&R(Node.prototype.getRootNode),Ur=$(ai),Ti=ai?w=>Yt.fromDom(w.dom.getRootNode()):ps,la=w=>Yt.fromDom(w.dom.host),li=w=>{const _=kt(w)?w.dom.parentNode:w.dom;if(_==null||_.ownerDocument===null)return!1;const I=_.ownerDocument;return(q=>{const le=Ti(q);return ms(ue=le)&&k(ue.dom.host)?ae.some(le):ae.none();var ue})(Yt.fromDom(_)).fold(()=>I.body.contains(_),(H=li,Z=la,q=>H(Z(q))));var H,Z},Qc=w=>{const _=w.dom.body;if(_==null)throw new Error("Body is not available yet");return Yt.fromDom(_)},xr=(w,_)=>{let I=[];return De(ao(w),H=>{_(H)&&(I=I.concat([H])),I=I.concat(xr(H,_))}),I},qs=(w,_,I)=>((H,Z,q)=>st(Gn(H,q),le=>Ps(le,_)))(w,0,I),Hi=(w,_)=>((I,H)=>st(ao(I),Z=>Ps(Z,_)))(w),Aa=(w,_)=>((I,H)=>{const Z=H===void 0?document:H.dom;return qo(Z)?[]:O(Z.querySelectorAll(I),Yt.fromDom)})(_,w);var Qa=(w,_,I,H,Z)=>w(I,H)?ae.some(I):R(Z)&&Z(I)?ae.none():_(I,H,Z);const La=(w,_,I)=>{let H=w.dom;const Z=R(I)?I:Y;for(;H.parentNode;){H=H.parentNode;const q=Yt.fromDom(H);if(_(q))return ae.some(q);if(Z(q))break}return ae.none()},Na=(w,_,I)=>Qa((H,Z)=>Z(H),La,w,_,I),vi=(w,_,I)=>La(w,H=>Ps(H,_),I),jr=(w,_)=>((I,H)=>Dt(I.dom.childNodes,Z=>{return q=Yt.fromDom(Z),Ps(q,_);var q}).map(Yt.fromDom))(w),ca=(w,_)=>_i(_,w),yr=(w,_,I)=>Qa((H,Z)=>Ps(H,Z),vi,w,_,I),Ql=(w,_,I=Q)=>w.exists(H=>I(H,_)),Nr=w=>{const _=[],I=H=>{_.push(H)};for(let H=0;H<w.length;H++)w[H].each(I);return _},Fa=(w,_)=>w?ae.some(_):ae.none(),Ra=(w,_,I)=>_===""||w.length>=_.length&&w.substr(I,I+_.length)===_,ua=(w,_,I=0,H)=>{const Z=w.indexOf(_,I);return Z!==-1&&(!!T(H)||Z+_.length<=H)},Eo=(w,_)=>Ra(w,_,0),Mc=(w,_)=>Ra(w,_,w.length-_.length),xi=(w=>_=>_.replace(w,""))(/^\s+|\s+$/g),Di=w=>w.length>0,Ba=w=>w.style!==void 0&&R(w.style.getPropertyValue),Lr=(w,_,I)=>{if(!u(I))throw console.error("Invalid call to CSS.set. Property ",_,":: Value ",I,":: Element ",w),new Error("CSS value must be a string: "+I);Ba(w)&&w.style.setProperty(_,I)},ei=(w,_,I)=>{const H=w.dom;Lr(H,_,I)},ec=(w,_)=>{const I=w.dom;Rn(_,(H,Z)=>{Lr(I,Z,H)})},Ro=(w,_)=>{const I=w.dom,H=window.getComputedStyle(I).getPropertyValue(_);return H!==""||li(w)?H:tc(I,_)},tc=(w,_)=>Ba(w)?w.style.getPropertyValue(_):"",rl=(w,_)=>{const I=w.dom,H=tc(I,_);return ae.from(H).filter(Z=>Z.length>0)},Fr=(w,_)=>{((I,H)=>{Ba(I)&&I.style.removeProperty(H)})(w.dom,_),Ql(On(w,"style").map(xi),"")&&In(w,"style")},il=(w,_,I=0)=>On(w,_).map(H=>parseInt(H,10)).getOr(I),yi=(w,_)=>il(w,_,1),Cu=w=>as("col")(w)?il(w,"span",1)>1:yi(w,"colspan")>1,_u=(w,_)=>parseInt(Ro(w,_),10),us=$(10),al=$(10),pe=(w,_)=>Ge(w,_,me),Ge=(w,_,I)=>qe(ao(w),H=>Ps(H,_)?I(H)?[H]:[]:Ge(H,_,I)),Qe=(w,_)=>((I,H,Z=Y)=>Z(H)?ae.none():Ae(I,yo(H))?ae.some(H):vi(H,I.join(","),q=>Ps(q,"table")||Z(q)))(["td","th"],w,_),Tt=w=>pe(w,"th,td"),pn=w=>Ps(w,"colgroup")?Hi(w,"col"):qe(wr(w),_=>Hi(_,"col")),Sn=(w,_)=>yr(w,"table",_),Cs=w=>pe(w,"tr"),wr=w=>Sn(w).fold($([]),_=>Hi(_,"colgroup")),Ds=(w,_)=>O(w,I=>{if(yo(I)==="colgroup"){const H=O(pn(I),Z=>{const q=il(Z,"span",1);return hr(Z,1,q)});return po(I,H,"colgroup")}{const H=O(Tt(I),Z=>{const q=il(Z,"rowspan",1),le=il(Z,"colspan",1);return hr(Z,q,le)});return po(I,H,_(I))}}),lr=w=>dn(w).map(_=>{const I=yo(_);return(H=>Ae(Ms,H))(I)?I:"tbody"}).getOr("tbody"),ds=w=>{const _=Cs(w),I=[...wr(w),..._];return Ds(I,lr)},Zr=w=>{let _,I=!1;return(...H)=>(I||(I=!0,_=w.apply(null,H)),_)},Nc=()=>gs(0,0),gs=(w,_)=>({major:w,minor:_}),nd={nu:gs,detect:(w,_)=>{const I=String(_).toLowerCase();return w.length===0?Nc():((H,Z)=>{const q=((ue,_e)=>{for(let Be=0;Be<ue.length;Be++){const Ye=ue[Be];if(Ye.test(_e))return Ye}})(H,Z);if(!q)return{major:0,minor:0};const le=ue=>Number(Z.replace(q,"$"+ue));return gs(le(1),le(2))})(w,I)},unknown:Nc},Ld=(w,_)=>{const I=String(_).toLowerCase();return Dt(w,H=>H.search(I))},lf=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Fc=w=>_=>ua(_,w),Bc=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:w=>ua(w,"edge/")&&ua(w,"chrome")&&ua(w,"safari")&&ua(w,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,lf],search:w=>ua(w,"chrome")&&!ua(w,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:w=>ua(w,"msie")||ua(w,"trident")},{name:"Opera",versionRegexes:[lf,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Fc("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Fc("firefox")},{name:"Safari",versionRegexes:[lf,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:w=>(ua(w,"safari")||ua(w,"mobile/"))&&ua(w,"applewebkit")}],Kp=[{name:"Windows",search:Fc("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:w=>ua(w,"iphone")||ua(w,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Fc("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:Fc("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Fc("linux"),versionRegexes:[]},{name:"Solaris",search:Fc("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Fc("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:Fc("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],eu={browsers:$(Bc),oses:$(Kp)},Zp="Edge",C0="Chromium",av="Opera",hn="Firefox",Rd="Safari",Rh=w=>{const _=w.current,I=w.version,H=Z=>()=>_===Z;return{current:_,version:I,isEdge:H(Zp),isChromium:H(C0),isIE:H("IE"),isOpera:H(av),isFirefox:H(hn),isSafari:H(Rd)}},Od=()=>Rh({current:void 0,version:nd.unknown()}),wa=Rh,Oh="Windows",cf="Android",uc="Linux",Fm="macOS",Bm="Solaris",Id="FreeBSD",_0="ChromeOS",qp=w=>{const _=w.current,I=w.version,H=Z=>()=>_===Z;return{current:_,version:I,isWindows:H(Oh),isiOS:H("iOS"),isAndroid:H(cf),isMacOS:H(Fm),isLinux:H(uc),isSolaris:H(Bm),isFreeBSD:H(Id),isChromeOS:H(_0)}},Yp=()=>qp({current:void 0,version:nd.unknown()}),Xp=qp,$m=w=>window.matchMedia(w).matches;let Jp=Zr(()=>((w,_,I)=>{const H=eu.browsers(),Z=eu.oses(),q=_.bind(_e=>((Be,Ye)=>J(Ye.brands,Me=>{const He=Me.brand.toLowerCase();return Dt(Be,je=>{var ct;return He===((ct=je.brand)===null||ct===void 0?void 0:ct.toLowerCase())}).map(je=>({current:je.name,version:nd.nu(parseInt(Me.version,10),0)}))}))(H,_e)).orThunk(()=>((_e,Be)=>Ld(_e,Be).map(Ye=>{const Me=nd.detect(Ye.versionRegexes,Be);return{current:Ye.name,version:Me}}))(H,w)).fold(Od,wa),le=((_e,Be)=>Ld(_e,Be).map(Ye=>{const Me=nd.detect(Ye.versionRegexes,Be);return{current:Ye.name,version:Me}}))(Z,w).fold(Yp,Xp),ue=((_e,Be,Ye,Me)=>{const He=_e.isiOS()&&/ipad/i.test(Ye)===!0,je=_e.isiOS()&&!He,ct=_e.isiOS()||_e.isAndroid(),ut=ct||Me("(pointer:coarse)"),Ht=He||!je&&ct&&Me("(min-device-width:768px)"),Gt=je||ct&&!Ht,Vt=Be.isSafari()&&_e.isiOS()&&/safari/i.test(Ye)===!1,jt=!Gt&&!Ht&&!Vt;return{isiPad:$(He),isiPhone:$(je),isTablet:$(Ht),isPhone:$(Gt),isTouch:$(ut),isAndroid:_e.isAndroid,isiOS:_e.isiOS,isWebView:$(Vt),isDesktop:$(jt)}})(le,q,w,I);return{browser:q,os:le,deviceType:ue}})(navigator.userAgent,ae.from(navigator.userAgentData),$m));const Ih=()=>Jp(),tu=(w,_)=>{const I=Z=>{const q=_(Z);if(q<=0||q===null){const le=Ro(Z,w);return parseFloat(le)||0}return q},H=(Z,q)=>et(q,(le,ue)=>{const _e=Ro(Z,ue),Be=_e===void 0?0:parseInt(_e,10);return isNaN(Be)?le:le+Be},0);return{set:(Z,q)=>{if(!V(q)&&!q.match(/^[0-9]+$/))throw new Error(w+".set accepts only positive integer values. Value was "+q);const le=Z.dom;Ba(le)&&(le.style[w]=q+"px")},get:I,getOuter:I,aggregate:H,max:(Z,q,le)=>{const ue=H(Z,le);return q>ue?q-ue:0}}},da=(w,_,I)=>((H,Z)=>(q=>{const le=parseFloat(q);return isNaN(le)?ae.none():ae.some(le)})(H).getOr(Z))(Ro(w,_),I),ls=tu("width",w=>w.dom.offsetWidth),$c=w=>ls.get(w),$l=w=>ls.getOuter(w),Tu=w=>((_,I)=>{const H=_.dom,Z=H.getBoundingClientRect().width||H.offsetWidth;return I==="border-box"?Z:((q,le,ue,_e)=>le-da(q,`padding-${ue}`,0)-da(q,`padding-${_e}`,0)-da(q,`border-${ue}-width`,0)-da(q,`border-${_e}-width`,0))(_,Z,"left","right")})(w,"content-box"),uf=(w,_,I)=>{const H=w.cells,Z=H.slice(0,_),q=H.slice(_),le=Z.concat(I).concat(q);return Ph(w,le)},ll=(w,_,I)=>uf(w,_,[I]),ti=(w,_,I)=>{w.cells[_]=I},Ph=(w,_)=>tr(w.element,_,w.section,w.isNew),Hl=(w,_)=>w.cells[_],ci=(w,_)=>Hl(w,_).element,ui=w=>w.cells.length,$s=w=>{const _=Fe(w,I=>I.section==="colgroup");return{rows:_.fail,cols:_.pass}},Hc=(w,_,I)=>{const H=O(w.cells,I);return tr(_(w.element),H,w.section,!0)},Oa="data-snooker-locked-cols",Ul=w=>On(w,Oa).bind(_=>ae.from(_.match(/\d+/g))).map(_=>Un(_,me)),dc=w=>{const _=et($s(w).rows,(H,Z)=>(De(Z.cells,(q,le)=>{q.isLocked&&(H[le]=!0)}),H),{}),I=to(_,(H,Z)=>parseInt(Z,10));return((H,Z)=>{const q=Ce.call(H,0);return q.sort(void 0),q})(I)},Xi=(w,_)=>w+","+_,Vf=(w,_)=>{const I=qe(w.all,H=>H.cells);return st(I,_)},Oi=w=>{const _={},I=[],H=vt(w).map(He=>He.element).bind(Sn).bind(Ul).getOr({});let Z=0,q=0,le=0;const{pass:ue,fail:_e}=Fe(w,He=>He.section==="colgroup");De(_e,He=>{const je=[];De(He.cells,ct=>{let ut=0;for(;_[Xi(le,ut)]!==void 0;)ut++;const Ht=((Vt,jt)=>$t(Vt,jt)&&Vt[jt]!==void 0&&Vt[jt]!==null)(H,ut.toString()),Gt=((Vt,jt,un,at,vn,go)=>({element:Vt,rowspan:jt,colspan:un,row:at,column:vn,isLocked:go}))(ct.element,ct.rowspan,ct.colspan,le,ut,Ht);for(let Vt=0;Vt<ct.colspan;Vt++)for(let jt=0;jt<ct.rowspan;jt++){const un=ut+Vt,at=Xi(le+jt,un);_[at]=Gt,q=Math.max(q,un+1)}je.push(Gt)}),Z++,I.push(po(He.element,je,He.section)),le++});const{columns:Be,colgroups:Ye}=an(ue).map(He=>{const je=(ut=>{const Ht={};let Gt=0;return De(ut.cells,Vt=>{const jt=Vt.colspan;Oe(jt,un=>{const at=Gt+un;Ht[at]=((vn,go,eo)=>({element:vn,colspan:go,column:eo}))(Vt.element,jt,at)}),Gt+=jt}),Ht})(He);return{colgroups:[((ut,Ht)=>({element:ut,columns:Ht}))(He.element,mo(je))],columns:je}}).getOrThunk(()=>({colgroups:[],columns:{}}));return{grid:((He,je)=>({rows:He,columns:je}))(Z,q),access:_,all:I,columns:Be,colgroups:Ye}},Ys=w=>{const _=ds(w);return Oi(_)},fc=Oi,hc=(w,_,I)=>ae.from(w.access[Xi(_,I)]),Ii=(w,_,I)=>{const H=Vf(w,Z=>I(_,Z.element));return H.length>0?ae.some(H[0]):ae.none()},ho=Vf,Pd=w=>qe(w.all,_=>_.cells),mc=w=>mo(w.columns),nr=w=>Bn(w.columns).length>0,od=(w,_)=>ae.from(w.columns[_]),zf=(w,_=me)=>{const I=w.grid,H=Oe(I.columns,W),Z=Oe(I.rows,W);return O(H,q=>nu(()=>qe(Z,le=>hc(w,le,q).filter(ue=>ue.column===q).toArray()),le=>le.colspan===1&&_(le.element),()=>hc(w,0,q)))},nu=(w,_,I)=>{const H=w();return Dt(H,_).orThunk(()=>ae.from(H[0]).orThunk(I)).map(Z=>Z.element)},os=w=>{const _=w.grid,I=Oe(_.rows,W),H=Oe(_.columns,W);return O(I,Z=>nu(()=>qe(H,q=>hc(w,Z,q).filter(le=>le.row===Z).fold($([]),le=>[le])),q=>q.rowspan===1,()=>hc(w,Z,0)))},cl=(w,_)=>I=>Mh(I)==="rtl"?_:w,Mh=w=>Ro(w,"direction")==="rtl"?"rtl":"ltr",df=tu("height",w=>{const _=w.dom;return li(w)?_.getBoundingClientRect().height:_.offsetHeight}),Md=w=>df.get(w),pc=w=>df.getOuter(w),F=(w,_)=>({left:w,top:_,translate:(I,H)=>F(w+I,_+H)}),M=F,Ee=(w,_)=>w!==void 0?w:_!==void 0?_:0,Ve=w=>{const _=w.dom.ownerDocument,I=_.body,H=_.defaultView,Z=_.documentElement;if(I===w.dom)return M(I.offsetLeft,I.offsetTop);const q=Ee(H==null?void 0:H.pageYOffset,Z.scrollTop),le=Ee(H==null?void 0:H.pageXOffset,Z.scrollLeft),ue=Ee(Z.clientTop,I.clientTop),_e=Ee(Z.clientLeft,I.clientLeft);return tt(w).translate(le-_e,q-ue)},tt=w=>{const _=w.dom,I=_.ownerDocument.body;return I===_?M(I.offsetLeft,I.offsetTop):li(w)?(H=>{const Z=H.getBoundingClientRect();return M(Z.left,Z.top)})(_):M(0,0)},Ze=(w,_)=>({row:w,y:_}),pt=(w,_)=>({col:w,x:_}),gt=w=>Ve(w).left+$l(w),ln=w=>Ve(w).left,Io=(w,_)=>pt(w,ln(_)),ss=(w,_)=>pt(w,gt(_)),Sr=w=>Ve(w).top,vs=(w,_)=>Ze(w,Sr(_)),_s=(w,_)=>Ze(w,Sr(_)+pc(_)),ki=(w,_,I)=>{if(I.length===0)return[];const H=O(I.slice(1),(q,le)=>q.map(ue=>w(le,ue))),Z=I[I.length-1].map(q=>_(I.length-1,q));return H.concat([Z])},Sl={delta:W,positions:w=>ki(vs,_s,w),edge:Sr},ns=cl({delta:W,edge:ln,positions:w=>ki(Io,ss,w)},{delta:w=>-w,edge:gt,positions:w=>ki(ss,Io,w)}),Vs={delta:(w,_)=>ns(_).delta(w,_),positions:(w,_)=>ns(_).positions(w,_),edge:w=>ns(w).edge(w)},xs={unsupportedLength:["em","ex","cap","ch","ic","rem","lh","rlh","vw","vh","vi","vb","vmin","vmax","cm","mm","Q","in","pc","pt","px"],fixed:["px","pt"],relative:["%"],empty:[""]},ks=(()=>{const w="[0-9]+",_="[eE][+-]?"+w,I=Z=>`(?:${Z})?`,H=["Infinity",w+"\\."+I(w)+I(_),"\\."+w+I(_),w+I(_)].join("|");return new RegExp(`^([+-]?(?:${H}))(.*)$`)})(),Wn=/(\d+(\.\d+)?)%/,cr=/(\d+(\.\d+)?)px|em/,el=as("col"),sd=as("tr"),ou=(w,_,I)=>{const H=vo(w).getOrThunk(()=>Qc(aa(w)));return _(w)/I(H)*100},Sa=(w,_)=>{ei(w,"width",_+"px")},su=(w,_)=>{ei(w,"width",_+"%")},rd=(w,_)=>{ei(w,"height",_+"px")},ni=w=>{const _=(I=>{return da(H=I,"height",H.dom.offsetHeight)+"px";var H})(w);return _?((I,H,Z,q)=>{const le=parseFloat(I);return Mc(I,"%")&&yo(H)!=="table"?((ue,_e,Be,Ye)=>{const Me=Sn(ue).map(He=>{const je=Be(He);return Math.floor(_e/100*je)}).getOr(_e);return Ye(ue,Me),Me})(H,le,Z,q):le})(_,w,Md,rd):Md(w)},ru=(w,_)=>rl(w,_).orThunk(()=>On(w,_).map(I=>I+"px")),gc=w=>ru(w,"width"),bc=w=>ou(w,$c,Tu),ff=w=>{return el(w)?$c(w):da(_=w,"width",_.dom.offsetWidth);var _},Du=w=>sd(w)?Md(w):((_,I,H)=>H(_)/yi(_,"rowspan"))(w,0,ni),vc=(w,_,I)=>{ei(w,"width",_+I)},hf=w=>ou(w,$c,Tu)+"%",Rr=$(Wn),Vl=as("col"),Ui=w=>gc(w).getOrThunk(()=>ff(w)+"px"),xc=w=>{return(_=w,ru(_,"height")).getOrThunk(()=>Du(w)+"px");var _},Kr=(w,_,I,H,Z,q)=>w.filter(H).fold(()=>q(((le,ue)=>{if(ue<0||ue>=le.length-1)return ae.none();const _e=le[ue].fold(()=>{const Ye=(Me=>{const He=Ce.call(Me,0);return He.reverse(),He})(le.slice(0,ue));return J(Ye,(Me,He)=>Me.map(je=>({value:je,delta:He+1})))},Ye=>ae.some({value:Ye,delta:0})),Be=le[ue+1].fold(()=>{const Ye=le.slice(ue+1);return J(Ye,(Me,He)=>Me.map(je=>({value:je,delta:He+1})))},Ye=>ae.some({value:Ye,delta:1}));return _e.bind(Ye=>Be.map(Me=>{const He=Me.delta+Ye.delta;return Math.abs(Me.value-Ye.value)/He}))})(I,_)),le=>Z(le)),El=(w,_,I,H)=>{const Z=zf(w),q=nr(w)?(_e=>O(mc(_e),Be=>ae.from(Be.element)))(w):Z,le=[ae.some(Vs.edge(_))].concat(O(Vs.positions(Z,_),_e=>_e.map(Be=>Be.x))),ue=se(Cu);return O(q,(_e,Be)=>Kr(_e,Be,le,ue,Ye=>{if((He=>{const je=Ih().browser,ct=je.isChromium()||je.isFirefox();return!Vl(He)||ct})(Ye))return I(Ye);{const He=(Me=Z[Be])!=null?W(Me):ae.none();return Kr(He,Be,le,ue,je=>H(ae.some($c(je))),H)}var Me},H))},wi=w=>w.map(_=>_+"px").getOr(""),Pi=(w,_,I)=>El(w,_,ff,H=>H.getOrThunk(I.minCellWidth)),Uc=(w,_,I,H)=>{const Z=os(w),q=O(w.all,ue=>ae.some(ue.element)),le=[ae.some(Sl.edge(_))].concat(O(Sl.positions(Z,_),ue=>ue.map(_e=>_e.y)));return O(q,(ue,_e)=>Kr(ue,_e,le,me,I,H))},Rt=(w,_)=>()=>li(w)?_(w):parseFloat(rl(w,"width").getOr("0")),fa=w=>{const _=Rt(w,H=>parseFloat(hf(H))),I=Rt(w,$c);return{width:_,pixelWidth:I,getWidths:(H,Z)=>((q,le,ue)=>El(q,le,bc,_e=>_e.fold(()=>ue.minCellWidth(),Be=>Be/ue.pixelWidth()*100)))(H,w,Z),getCellDelta:H=>H/I()*100,singleColumnWidth:(H,Z)=>[100-H],minCellWidth:()=>us()/I()*100,setElementWidth:su,adjustTableWidth:H=>{const Z=_();su(w,Z+H/100*Z)},isRelative:!0,label:"percent"}},iu=w=>{const _=Rt(w,$c);return{width:_,pixelWidth:_,getWidths:(I,H)=>Pi(I,w,H),getCellDelta:W,singleColumnWidth:(I,H)=>[Math.max(us(),I+H)-I],minCellWidth:us,setElementWidth:Sa,adjustTableWidth:I=>{const H=_()+I;Sa(w,H)},isRelative:!1,label:"pixel"}},qr=w=>gc(w).fold(()=>(_=>{const I=Rt(_,$c),H=$(0);return{width:I,pixelWidth:I,getWidths:(Z,q)=>Pi(Z,_,q),getCellDelta:H,singleColumnWidth:$([0]),minCellWidth:H,setElementWidth:z,adjustTableWidth:z,isRelative:!0,label:"none"}})(w),_=>((I,H)=>Rr().exec(H)!==null?fa(I):iu(I))(w,_)),$a=iu,Ji=fa,Ha=(w,_,I)=>{const H=w[I].element,Z=Yt.fromTag("td");Nt(Z,Yt.fromTag("br")),(_?Nt:_t)(H,Z)},Cl=((w,_)=>{const I=H=>w(H)?ae.from(H.dom.nodeValue):ae.none();return{get:H=>{if(!w(H))throw new Error("Can only get text value of a text node");return I(H).getOr("")},getOption:I,set:(H,Z)=>{if(!w(H))throw new Error("Can only set raw text value of a text node");H.dom.nodeValue=Z}}})(kt),ha=w=>Cl.get(w),ys=w=>Cl.getOption(w),ma=(w,_)=>Cl.set(w,_),Vi=w=>yo(w)==="img"?1:ys(w).fold(()=>ao(w).length,_=>_.length),oi=["img","br"],Vc=w=>ys(w).filter(_=>_.trim().length!==0||_.indexOf(" ")>-1).isSome()||Ae(oi,yo(w))||(_=>Cn(_)&&At(_,"contenteditable")==="false")(w),_l=w=>((_,I)=>{const H=Z=>{for(let q=0;q<Z.childNodes.length;q++){const le=Yt.fromDom(Z.childNodes[q]);if(I(le))return ae.some(le);const ue=H(Z.childNodes[q]);if(ue.isSome())return ue}return ae.none()};return H(_.dom)})(w,Vc),yc=w=>ul(w,Vc),ul=(w,_)=>{const I=H=>{const Z=ao(H);for(let q=Z.length-1;q>=0;q--){const le=Z[q];if(_(le))return ae.some(le);const ue=I(le);if(ue.isSome())return ue}return ae.none()};return I(w)},lt={scope:["row","col"]},Si=w=>()=>{const _=Yt.fromTag("td",w.dom);return Nt(_,Yt.fromTag("br",w.dom)),_},au=w=>()=>Yt.fromTag("col",w.dom),rr=w=>()=>Yt.fromTag("colgroup",w.dom),Tl=w=>()=>Yt.fromTag("tr",w.dom),pa=(w,_,I)=>{const H=((Z,q)=>{const le=es(Z,q),ue=ao(Lo(Z));return Tn(le,ue),le})(w,_);return Rn(I,(Z,q)=>{Z===null?In(H,q):Pt(H,q,Z)}),H},Or=w=>w,Ua=(w,_,I)=>{const H=(Z,q)=>{((le,ue)=>{const _e=le.dom,Be=ue.dom;Ba(_e)&&Ba(Be)&&(Be.style.cssText=_e.style.cssText)})(Z.element,q),Fr(q,"height"),Z.colspan!==1&&Fr(q,"width")};return{col:Z=>{const q=Yt.fromTag(yo(Z.element),_.dom);return H(Z,q),w(Z.element,q),q},colgroup:rr(_),row:Tl(_),cell:Z=>{const q=Yt.fromTag(yo(Z.element),_.dom),le=I.getOr(["strong","em","b","i","span","font","h1","h2","h3","h4","h5","h6","p","div"]),ue=le.length>0?((_e,Be,Ye)=>_l(_e).map(Me=>{const He=Ye.join(","),je=qs(Me,He,ct=>bs(ct,_e));return Ut(je,(ct,ut)=>{const Ht=Yo(ut);return Nt(ct,Ht),Ht},Be)}).getOr(Be))(Z.element,q,le):q;return Nt(ue,Yt.fromTag("br")),H(Z,q),((_e,Be)=>{Rn(lt,(Ye,Me)=>On(_e,Me).filter(He=>Ae(Ye,He)).each(He=>Pt(Be,Me,He)))})(Z.element,q),w(Z.element,q),q},replace:pa,colGap:au(_),gap:Si(_)}},Xs=w=>({col:au(w),colgroup:rr(w),row:Tl(w),cell:Si(w),replace:Or,colGap:au(w),gap:Si(w)}),di=w=>_=>_.options.get(w),nc="100%",wc=w=>{var _;const I=w.dom,H=(_=I.getParent(w.selection.getStart(),I.isBlock))!==null&&_!==void 0?_:w.getBody();return Tu(Yt.fromDom(H))+"px"},ku=w=>ae.from(w.options.get("table_clone_elements")),zc=di("table_header_type"),Gc=di("table_column_resizing"),mf=w=>Gc(w)==="preservetable",Bt=w=>Gc(w)==="resizetable",io=di("table_sizing_mode"),Qn=w=>io(w)==="relative",Po=w=>io(w)==="fixed",Js=w=>io(w)==="responsive",N=di("table_resize_bars"),X=di("table_style_by_css"),ce=di("table_merge_content_on_paste"),Ne=w=>{const _=w.options,I=_.get("table_default_attributes");return _.isSet("table_default_attributes")?I:((H,Z)=>Js(H)||X(H)?Z:Po(H)?{...Z,width:wc(H)}:{...Z,width:nc})(w,I)},We=di("table_use_colgroups"),Kt=w=>yr(w,"[contenteditable]"),Yn=(w,_=!1)=>li(w)?w.dom.isContentEditable:Kt(w).fold($(_),I=>Co(I)==="true"),Co=w=>w.dom.contentEditable,$o=w=>Yt.fromDom(w.getBody()),Jn=w=>_=>bs(_,$o(w)),mr=w=>{In(w,"data-mce-style");const _=I=>In(I,"data-mce-style");De(Tt(w),_),De(pn(w),_),De(Cs(w),_)},Vr=w=>Yt.fromDom(w.selection.getStart()),Va=w=>w.getBoundingClientRect().width,Dl=w=>w.getBoundingClientRect().height,$e=w=>(_,I)=>{const H=_.dom.getStyle(I,w)||_.dom.getAttrib(I,w);return ae.from(H).filter(Di)},cn=$e("width"),Ln=$e("height"),Wo=w=>Na(w,as("table")).exists(Yn),bn=(w,_)=>{const I=_.column,H=_.column+_.colspan-1,Z=_.row,q=_.row+_.rowspan-1;return I<=w.finishCol&&H>=w.startCol&&Z<=w.finishRow&&q>=w.startRow},Jo=(w,_)=>_.column>=w.startCol&&_.column+_.colspan-1<=w.finishCol&&_.row>=w.startRow&&_.row+_.rowspan-1<=w.finishRow,Vo=(w,_,I)=>{const H=Ii(w,_,bs),Z=Ii(w,I,bs);return H.bind(q=>Z.map(le=>{return ue=q,_e=le,{startRow:Math.min(ue.row,_e.row),startCol:Math.min(ue.column,_e.column),finishRow:Math.max(ue.row+ue.rowspan-1,_e.row+_e.rowspan-1),finishCol:Math.max(ue.column+ue.colspan-1,_e.column+_e.colspan-1)};var ue,_e}))},Yr=(w,_,I)=>Vo(w,_,I).map(H=>{const Z=ho(w,j(bn,H));return O(Z,q=>q.element)}),za=(w,_)=>Ii(w,_,(I,H)=>Ar(H,I)).map(I=>I.element),Au=(w,_,I)=>{const H=dl(w);return Yr(H,_,I)},pr=(w,_,I,H,Z)=>{const q=dl(w),le=bs(w,I)?ae.some(_):za(q,_),ue=bs(w,Z)?ae.some(H):za(q,H);return le.bind(_e=>ue.bind(Be=>Yr(q,_e,Be)))},dl=Ys;var Gf=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],T0=()=>({up:$({selector:vi,closest:yr,predicate:La,all:Gn}),down:$({selector:Aa,predicate:xr}),styles:$({get:Ro,getRaw:rl,set:ei,remove:Fr}),attrs:$({get:At,set:Pt,remove:In,copyTo:(w,_)=>{const I=Is(w);gn(_,I)}}),insert:$({before:Ie,after:Ot,afterAll:sn,append:Nt,appendAll:Tn,prepend:_t,wrap:_n}),remove:$({unwrap:Ko,remove:zn}),create:$({nu:Yt.fromTag,clone:w=>Yt.fromDom(w.dom.cloneNode(!1)),text:Yt.fromText}),query:$({comparePosition:(w,_)=>w.dom.compareDocumentPosition(_.dom),prevSibling:yn,nextSibling:vr}),property:$({children:ao,name:yo,parent:dn,document:w=>ps(w).dom,isText:kt,isComment:Qt,isElement:Nn,isSpecial:w=>{const _=yo(w);return Ae(["script","noscript","iframe","noframes","noembed","title","style","textarea","xmp"],_)},getLanguage:w=>Nn(w)?On(w,"lang"):ae.none(),getText:ha,setText:ma,isBoundary:w=>!!Nn(w)&&(yo(w)==="body"||Ae(Gf,yo(w))),isEmptyTag:w=>!!Nn(w)&&Ae(["br","img","hr","input"],yo(w)),isNonEditable:w=>Nn(w)&&At(w,"contenteditable")==="false"}),eq:bs,is:Bl});const lv=(w,_,I,H)=>{const Z=_(w,I);return Ut(H,(q,le)=>{const ue=_(w,le);return cv(w,q,ue)},Z)},cv=(w,_,I)=>_.bind(H=>I.filter(j(w.eq,H))),Nd=T0(),Qp=(w,_)=>((I,H,Z)=>Z.length>0?((q,le,ue,_e)=>_e(q,le,ue[0],ue.slice(1)))(I,H,Z,lv):ae.none())(Nd,(I,H)=>w(H),_),oo=w=>vi(w,"table"),lu=(w,_,I)=>{const H=Z=>q=>I!==void 0&&I(q)||bs(q,Z);return bs(w,_)?ae.some({boxes:ae.some([w]),start:w,finish:_}):oo(w).bind(Z=>oo(_).bind(q=>{if(bs(Z,q))return ae.some({boxes:Au(Z,w,_),start:w,finish:_});if(Ar(Z,q)){const le=qs(_,"td,th",H(Z)),ue=le.length>0?le[le.length-1]:_;return ae.some({boxes:pr(Z,w,Z,_,q),start:w,finish:ue})}if(Ar(q,Z)){const le=qs(w,"td,th",H(q)),ue=le.length>0?le[le.length-1]:w;return ae.some({boxes:pr(q,w,Z,_,q),start:w,finish:ue})}return((le,ue,_e)=>((Be,Ye,Me,He=Y)=>{const je=[Ye].concat(Be.up().all(Ye)),ct=[Me].concat(Be.up().all(Me)),ut=jt=>Xe(jt,He).fold(()=>jt,un=>jt.slice(0,un+1)),Ht=ut(je),Gt=ut(ct),Vt=Dt(Ht,jt=>ve(Gt,((un,at)=>j(un.eq,at))(Be,jt)));return{firstpath:Ht,secondpath:Gt,shared:Vt}})(Nd,le,ue,void 0))(w,_).shared.bind(le=>yr(le,"table",I).bind(ue=>{const _e=qs(_,"td,th",H(ue)),Be=_e.length>0?_e[_e.length-1]:_,Ye=qs(w,"td,th",H(ue)),Me=Ye.length>0?Ye[Ye.length-1]:w;return ae.some({boxes:pr(ue,w,Z,_,q),start:Me,finish:Be})}))}))},eg=(w,_)=>{const I=Aa(w,_);return I.length>0?ae.some(I):ae.none()},Sc=(w,_,I)=>ca(w,_).bind(H=>ca(w,I).bind(Z=>Qp(oo,[H,Z]).map(q=>({first:H,last:Z,table:q})))),kl=(w,_,I,H,Z)=>((q,le)=>Dt(q,ue=>Ps(ue,le)))(w,Z).bind(q=>((le,ue,_e)=>Sn(le).bind(Be=>((Ye,Me,He,je)=>Ii(Ye,Me,bs).bind(ct=>{const ut=He>0?ct.row+ct.rowspan-1:ct.row,Ht=je>0?ct.column+ct.colspan-1:ct.column;return hc(Ye,ut+He,Ht+je).map(Gt=>Gt.element)}))(dl(Be),le,ue,_e)))(q,_,I).bind(le=>((ue,_e)=>vi(ue,"table").bind(Be=>ca(Be,_e).bind(Ye=>lu(Ye,ue).bind(Me=>Me.boxes.map(He=>({boxes:He,start:Me.start,finish:Me.finish}))))))(le,H))),Fd=(w,_)=>eg(w,_),hS=(w,_,I)=>Sc(w,_,I).bind(H=>{const Z=_e=>bs(w,_e),q="thead,tfoot,tbody,table",le=vi(H.first,q,Z),ue=vi(H.last,q,Z);return le.bind(_e=>ue.bind(Be=>bs(_e,Be)?((Ye,Me,He)=>((je,ct,ut)=>Vo(je,ct,ut).bind(Ht=>((Gt,Vt)=>{let jt=!0;const un=j(Jo,Vt);for(let at=Vt.startRow;at<=Vt.finishRow;at++)for(let vn=Vt.startCol;vn<=Vt.finishCol;vn++)jt=jt&&hc(Gt,at,vn).exists(un);return jt?ae.some(Vt):ae.none()})(je,Ht)))(dl(Ye),Me,He))(H.table,H.first,H.last):ae.none()))}),Bd=W,p1=w=>{const _=(I,H)=>On(I,H).exists(Z=>parseInt(Z,10)>1);return w.length>0&&mt(w,I=>_(I,"rowspan")||_(I,"colspan"))?ae.some(w):ae.none()},$d=(w,_,I)=>_.length<=1?ae.none():hS(w,I.firstSelectedSelector,I.lastSelectedSelector).map(H=>({bounds:H,cells:_})),tg="data-mce-selected",ng="data-mce-first-selected",rn="data-mce-last-selected",g1="["+tg+"]",rs={selected:tg,selectedSelector:"td["+tg+"],th["+tg+"]",firstSelected:ng,firstSelectedSelector:"td["+ng+"],th["+ng+"]",lastSelected:rn,lastSelectedSelector:"td["+rn+"],th["+rn+"]"},so=(w,_,I)=>({element:I,mergable:$d(_,w,rs),unmergable:p1(w),selection:Bd(w)}),id=w=>(_,I)=>{const H=yo(_),Z=H==="col"||H==="colgroup"?Sn(q=_).bind(le=>Fd(le,rs.firstSelectedSelector)).fold($(q),le=>le[0]):_;var q;return yr(Z,w,I)},D0=id("th,td,caption"),fi=id("th,td"),ad=w=>{return _=w.model.table.getSelectedCells(),O(_,Yt.fromDom);var _},Ws=(w,_)=>{w.on("BeforeGetContent",I=>{const H=Z=>{I.preventDefault(),(q=>Sn(q[0]).map(le=>{const ue=((_e,Be)=>{const Ye=jt=>Ps(jt.element,Be),Me=Lo(_e),He=ds(Me),je=qr(_e),ct=fc(He),ut=((jt,un)=>{const at=jt.grid.columns;let vn=jt.grid.rows,go=at,eo=0,Hs=0;const lo=[],is=[];return Rn(jt.access,Oo=>{if(lo.push(Oo),un(Oo)){is.push(Oo);const ur=Oo.row,na=ur+Oo.rowspan-1,gl=Oo.column,Wa=gl+Oo.colspan-1;ur<vn?vn=ur:na>eo&&(eo=na),gl<go?go=gl:Wa>Hs&&(Hs=Wa)}}),((Oo,ur,na,gl,Wa,jc)=>({minRow:Oo,minCol:ur,maxRow:na,maxCol:gl,allCells:Wa,selectedCells:jc}))(vn,go,eo,Hs,lo,is)})(ct,Ye),Ht="th:not("+Be+"),td:not("+Be+")",Gt=Ge(Me,"th,td",jt=>Ps(jt,Ht));De(Gt,zn),((jt,un,at,vn)=>{const go=st(jt,lo=>lo.section!=="colgroup"),eo=un.grid.columns,Hs=un.grid.rows;for(let lo=0;lo<Hs;lo++){let is=!1;for(let Oo=0;Oo<eo;Oo++)lo<at.minRow||lo>at.maxRow||Oo<at.minCol||Oo>at.maxCol||(hc(un,lo,Oo).filter(vn).isNone()?Ha(go,is,lo):is=!0)}})(He,ct,ut,Ye);const Vt=((jt,un,at,vn)=>{if(vn.minCol===0&&un.grid.columns===vn.maxCol+1)return 0;const go=Pi(un,jt,at),eo=et(go,(is,Oo)=>is+Oo,0),Hs=et(go.slice(vn.minCol,vn.maxCol+1),(is,Oo)=>is+Oo,0),lo=Hs/eo*at.pixelWidth()-at.pixelWidth();return at.getCellDelta(lo)})(_e,Ys(_e),je,ut);return((jt,un,at,vn)=>{Rn(at.columns,eo=>{(eo.column<un.minCol||eo.column>un.maxCol)&&zn(eo.element)});const go=st(pe(jt,"tr"),eo=>eo.dom.childElementCount===0);De(go,zn),un.minCol!==un.maxCol&&un.minRow!==un.maxRow||De(pe(jt,"th,td"),eo=>{In(eo,"rowspan"),In(eo,"colspan")}),In(jt,Oa),In(jt,"data-snooker-col-series"),qr(jt).adjustTableWidth(vn)})(Me,ut,ct,Vt),Me})(le,g1);return mr(ue),[ue]}))(Z).each(q=>{I.content=I.format==="text"?(le=>O(le,ue=>ue.dom.innerText).join(""))(q):((le,ue)=>O(ue,_e=>le.selection.serializer.serialize(_e.dom,{})).join(""))(w,q)})};if(I.selection===!0){const Z=(q=>st(ad(q),le=>Ps(le,rs.selectedSelector)))(w);Z.length>=1&&H(Z)}}),w.on("BeforeSetContent",I=>{if(I.selection===!0&&I.paste===!0){const H=ad(w);vt(H).each(Z=>{Sn(Z).each(q=>{const le=st(((_e,Be)=>{const Ye=document.createElement("div");return Ye.innerHTML=_e,ao(Yt.fromDom(Ye))})(I.content),_e=>yo(_e)!=="meta"),ue=as("table");if(ce(w)&&le.length===1&&ue(le[0])){I.preventDefault();const _e=Yt.fromDom(w.getDoc()),Be=Xs(_e),Ye=((Me,He,je)=>({element:Me,clipboard:He,generators:je}))(Z,le[0],Be);_.pasteCells(q,Ye).each(()=>{w.focus()})}})})}})},Ir=(w,_)=>({element:w,offset:_}),og=(w,_,I)=>w.property().isText(_)&&w.property().getText(_).trim().length===0||w.property().isComment(_)?I(_).bind(H=>og(w,H,I).orThunk(()=>ae.some(H))):ae.none(),Ft=(w,_)=>w.property().isText(_)?w.property().getText(_).length:w.property().children(_).length,Lu=(w,_)=>{const I=og(w,_,w.query().prevSibling).getOr(_);if(w.property().isText(I))return Ir(I,Ft(w,I));const H=w.property().children(I);return H.length>0?Lu(w,H[H.length-1]):Ir(I,Ft(w,I))},uv=Lu,Nh=T0(),b1=(w,_)=>{Cu(w)||(H=>gc(H).bind(Z=>{return q=Z,le=["fixed","relative","empty"],ae.from(ks.exec(q)).bind(ue=>{const _e=Number(ue[1]),Be=ue[2];return((Ye,Me)=>ve(Me,He=>ve(xs[He],je=>Ye===je)))(Be,le)?ae.some({value:_e,unit:Be}):ae.none()});var q,le}))(w).each(H=>{const Z=H.value/2;vc(w,Z,H.unit),vc(_,Z,H.unit)})},Hd=w=>O(w,$(0)),mS=(w,_,I,H,Z)=>Z(w.slice(0,_)).concat(H).concat(Z(w.slice(I))),Hm=w=>(_,I,H,Z)=>{if(w(H)){const q=Math.max(Z,_[I]-Math.abs(H)),le=Math.abs(q-_[I]);return H>=0?le:-le}return H},zr=Hm(w=>w<0),pf=Hm(me),pS=()=>{const w=(I,H,Z,q)=>{const le=(100+Z)/100,ue=Math.max(q,(I[H]+Z)/le);return O(I,(_e,Be)=>(Be===H?ue:_e/le)-_e)},_=(I,H,Z,q,le,ue)=>ue?w(I,H,q,le):((_e,Be,Ye,Me,He)=>{const je=zr(_e,Be,Me,He);return mS(_e,Be,Ye+1,[je,0],Hd)})(I,H,Z,q,le);return{resizeTable:(I,H)=>I(H),clampTableDelta:zr,calcLeftEdgeDeltas:_,calcMiddleDeltas:(I,H,Z,q,le,ue,_e)=>_(I,Z,q,le,ue,_e),calcRightEdgeDeltas:(I,H,Z,q,le,ue)=>{if(ue)return w(I,Z,q,le);{const _e=zr(I,Z,q,le);return Hd(I.slice(0,Z)).concat([_e])}},calcRedestributedWidths:(I,H,Z,q)=>{if(q){const le=(H+Z)/H,ue=O(I,_e=>_e/le);return{delta:100*le-100,newSizes:ue}}return{delta:Z,newSizes:I}}}},Ud=()=>{const w=(_,I,H,Z,q)=>{const le=pf(_,Z>=0?H:I,Z,q);return mS(_,I,H+1,[le,-le],Hd)};return{resizeTable:(_,I,H)=>{H&&_(I)},clampTableDelta:(_,I,H,Z,q)=>{if(q){if(H>=0)return H;{const le=et(_,(ue,_e)=>ue+_e-Z,0);return Math.max(-le,H)}}return zr(_,I,H,Z)},calcLeftEdgeDeltas:w,calcMiddleDeltas:(_,I,H,Z,q,le)=>w(_,H,Z,q,le),calcRightEdgeDeltas:(_,I,H,Z,q,le)=>{if(le)return Hd(_);{const ue=Z/_.length;return O(_,$(ue))}},calcRedestributedWidths:(_,I,H,Z)=>({delta:0,newSizes:_})}},sg=w=>Ys(w).grid,Fh=as("th"),Ga=w=>mt(w,_=>Fh(_.element)),fl=(w,_)=>w&&_?"sectionCells":w?"section":"cells",v1=w=>{const _=w.section==="thead",I=Ql(Ea(w.cells),"th");return w.section==="tfoot"?{type:"footer"}:_||I?{type:"header",subType:fl(_,I)}:{type:"body"}},Ea=w=>{const _=st(w,I=>Fh(I.element));return _.length===0?ae.some("td"):_.length===w.length?ae.some("th"):ae.none()},Ru=(w,_,I)=>ts(I(w.element,_),!0,w.isLocked),Ec=(w,_)=>w.section!==_?tr(w.element,w.cells,_,w.isNew):w,tn=()=>({transformRow:Ec,transformCell:(w,_,I)=>{const H=I(w.element,_),Z=yo(H)!=="td"?((q,le)=>{const ue=es(q,"td");Ot(q,ue);const _e=ao(q);return Tn(ue,_e),zn(q),ue})(H):H;return ts(Z,w.isNew,w.isLocked)}}),x1=()=>({transformRow:Ec,transformCell:Ru}),Mi=()=>({transformRow:(w,_)=>Ec(w,_==="thead"?"tbody":_),transformCell:Ru}),y1=tn,w1=x1,MT=Mi,S1=()=>({transformRow:W,transformCell:Ru}),Ou=(w,_,I,H)=>{I===H?In(w,_):Pt(w,_,I)},dv=(w,_,I)=>{an(Hi(w,_)).fold(()=>_t(w,I),H=>Ot(H,I))},fv=(w,_)=>{const I=[],H=[],Z=He=>O(He,je=>{je.isNew&&I.push(je.element);const ct=je.element;return Xn(ct),De(je.cells,ut=>{ut.isNew&&H.push(ut.element),Ou(ut.element,"colspan",ut.colspan,1),Ou(ut.element,"rowspan",ut.rowspan,1),Nt(ct,ut.element)}),ct}),q=He=>qe(He,je=>O(je.cells,ct=>(Ou(ct.element,"span",ct.colspan,1),ct.element))),le=(He,je)=>{const ct=((Ht,Gt)=>{const Vt=jr(Ht,Gt).getOrThunk(()=>{const jt=Yt.fromTag(Gt,aa(Ht).dom);return Gt==="thead"?dv(Ht,"caption,colgroup",jt):Gt==="colgroup"?dv(Ht,"caption",jt):Nt(Ht,jt),jt});return Xn(Vt),Vt})(w,je),ut=(je==="colgroup"?q:Z)(He);Tn(ct,ut)},ue=(He,je)=>{He.length>0?le(He,je):(ct=>{jr(w,ct).each(zn)})(je)},_e=[],Be=[],Ye=[],Me=[];return De(_,He=>{switch(He.section){case"thead":_e.push(He);break;case"tbody":Be.push(He);break;case"tfoot":Ye.push(He);break;case"colgroup":Me.push(He)}}),ue(Me,"colgroup"),ue(_e,"thead"),ue(Be,"tbody"),ue(Ye,"tfoot"),{newRows:I,newCells:H}},hv=(w,_)=>{if(w.length===0)return 0;const I=w[0];return Xe(w,H=>!_(I.element,H.element)).getOr(w.length)},zi=(w,_)=>{const I=O(w,H=>O(H.cells,Y));return O(w,(H,Z)=>{const q=qe(H.cells,(le,ue)=>{if(I[Z][ue]===!1){const He=((je,ct,ut,Ht)=>{const Gt=((at,vn)=>at[vn])(je,ct),Vt=Gt.section==="colgroup",jt=hv(Gt.cells.slice(ut),Ht),un=Vt?1:hv(((at,vn)=>O(at,go=>Hl(go,vn)))(je.slice(ct),ut),Ht);return{colspan:jt,rowspan:un}})(w,Z,ue,_);return((je,ct,ut,Ht)=>{for(let Gt=je;Gt<je+ut;Gt++)for(let Vt=ct;Vt<ct+Ht;Vt++)I[Gt][Vt]=!0})(Z,ue,He.rowspan,He.colspan),[(_e=le.element,Be=He.rowspan,Ye=He.colspan,Me=le.isNew,{element:_e,rowspan:Be,colspan:Ye,isNew:Me})]}return[];var _e,Be,Ye,Me});return((le,ue,_e,Be)=>({element:le,cells:ue,section:_e,isNew:Be}))(H.element,q,H.section,H.isNew)})},Um=(w,_,I)=>{const H=[];De(w.colgroups,Z=>{const q=[];for(let le=0;le<w.grid.columns;le++){const ue=od(w,le).map(_e=>ts(_e.element,I,!1)).getOrThunk(()=>ts(_.colGap(),!0,!1));q.push(ue)}H.push(tr(Z.element,q,"colgroup",I))});for(let Z=0;Z<w.grid.rows;Z++){const q=[];for(let _e=0;_e<w.grid.columns;_e++){const Be=hc(w,Z,_e).map(Ye=>ts(Ye.element,I,Ye.isLocked)).getOrThunk(()=>ts(_.gap(),!0,!1));q.push(Be)}const le=w.all[Z],ue=tr(le.element,q,le.section,I);H.push(ue)}return H},hi=w=>zi(w,bs),zl=(w,_)=>J(w.all,I=>Dt(I.cells,H=>bs(_,H.element))),Wf=(w,_,I)=>{const H=O(_.selection,q=>Qe(q).bind(le=>zl(w,le)).filter(I)),Z=Nr(H);return Fa(Z.length>0,Z)},Xr=(w,_,I,H,Z)=>(q,le,ue,_e)=>{const Be=Ys(q),Ye=ae.from(_e==null?void 0:_e.section).getOrThunk(S1);return _(Be,le).map(Me=>{const He=((ut,Ht)=>Um(ut,Ht,!1))(Be,ue),je=w(He,Me,bs,Z(ue),Ye),ct=dc(je.grid);return{info:Me,grid:hi(je.grid),cursor:je.cursor,lockedColumns:ct}}).bind(Me=>{const He=fv(q,Me.grid),je=ae.from(_e==null?void 0:_e.sizing).getOrThunk(()=>qr(q)),ct=ae.from(_e==null?void 0:_e.resize).getOrThunk(Ud);return I(q,Me.grid,Me.info,{sizing:je,resize:ct,section:Ye}),H(q),In(q,Oa),Me.lockedColumns.length>0&&Pt(q,Oa,Me.lockedColumns.join(",")),ae.some({cursor:Me.cursor,newRows:He.newRows,newCells:He.newCells})})},mv=(w,_)=>Wf(w,_,me).map(I=>({cells:I,generators:_.generators,clipboard:_.clipboard})),hl=(w,_)=>Wf(w,_,me),ld=(w,_)=>Wf(w,_,I=>!I.isLocked),rg=(w,_)=>mt(_,I=>((H,Z)=>zl(H,Z).exists(q=>!q.isLocked))(w,I)),k0=(w,_,I,H)=>{const Z=$s(w).rows;let q=!0;for(let le=0;le<Z.length;le++)for(let ue=0;ue<ui(Z[0]);ue++){const _e=Z[le],Be=Hl(_e,ue),Ye=I(Be.element,_);Ye&&!q?ti(_e,ue,ts(H(),!0,Be.isLocked)):Ye&&(q=!1)}return w},Bh=w=>{const _=q=>q(w),I=$(w),H=()=>Z,Z={tag:!0,inner:w,fold:(q,le)=>le(w),isValue:me,isError:Y,map:q=>Vm.value(q(w)),mapError:H,bind:_,exists:_,forall:_,getOr:I,or:H,getOrThunk:I,orThunk:H,getOrDie:I,each:q=>{q(w)},toOptional:()=>ae.some(w)};return Z},gS=w=>{const _=()=>I,I={tag:!1,inner:w,fold:(Z,q)=>Z(w),isValue:Y,isError:me,map:_,mapError:Z=>Vm.error(Z(w)),bind:_,exists:Y,forall:me,getOr:W,or:W,getOrThunk:re,orThunk:re,getOrDie:(H=String(w),()=>{throw new Error(H)}),each:z,toOptional:ae.none};var H;return I},Vm={value:Bh,error:gS,fromOption:(w,_)=>w.fold(()=>gS(_),Bh)},E1=(w,_)=>({rowDelta:0,colDelta:ui(w[0])-ui(_[0])}),A0=(w,_)=>({rowDelta:w.length-_.length,colDelta:0}),L0=(w,_,I,H)=>{const Z=_.section==="colgroup"?I.col:I.cell;return Oe(w,q=>ts(Z(),!0,H(q)))},pv=(w,_,I,H)=>{const Z=w[w.length-1];return w.concat(Oe(_,()=>{const q=Z.section==="colgroup"?I.colgroup:I.row,le=Hc(Z,q,W),ue=L0(le.cells.length,le,I,_e=>$t(H,_e.toString()));return Ph(le,ue)}))},C1=(w,_,I,H)=>O(w,Z=>{const q=L0(_,Z,I,Y);return uf(Z,H,q)}),zm=(w,_,I)=>{const H=_.colDelta<0?C1:W,Z=_.rowDelta<0?pv:W,q=dc(w),le=ui(w[0]),ue=ve(q,Ye=>Ye===le-1),_e=H(w,Math.abs(_.colDelta),I,ue?le-1:le),Be=dc(_e);return Z(_e,Math.abs(_.rowDelta),I,Un(Be,me))},NT=(w,_,I,H)=>{const Z=j(H,Hl(w[_],I).element),q=w[_];return w.length>1&&ui(q)>1&&(I>0&&Z(ci(q,I-1))||I<q.cells.length-1&&Z(ci(q,I+1))||_>0&&Z(ci(w[_-1],I))||_<w.length-1&&Z(ci(w[_+1],I)))},R0=(w,_,I)=>st(I,H=>H>=w.column&&H<=ui(_[0])+w.column),bS=(w,_,I,H,Z)=>{((Be,Ye,Me,He)=>{Ye>0&&Ye<Be[0].cells.length&&De(Be,je=>{const ct=je.cells[Ye-1];let ut=0;const Ht=He();for(;je.cells.length>Ye+ut&&Me(ct.element,je.cells[Ye+ut].element);)ti(je,Ye+ut,ts(Ht,!0,je.cells[Ye+ut].isLocked)),ut++})})(_,w,Z,H.cell);const q=A0(I,_),le=zm(I,q,H),ue=A0(_,le),_e=zm(_,ue,H);return O(_e,(Be,Ye)=>uf(Be,w,le[Ye].cells))},gv=(w,_,I,H,Z)=>{((Vt,jt,un,at)=>{const vn=$s(Vt).rows;if(jt>0&&jt<vn.length){const go=((eo,Hs)=>et(eo,(lo,is)=>ve(lo,Oo=>Hs(Oo.element,is.element))?lo:lo.concat([is]),[]))(vn[jt-1].cells,un);De(go,eo=>{let Hs=ae.none();for(let lo=jt;lo<vn.length;lo++)for(let is=0;is<ui(vn[0]);is++){const Oo=vn[lo],ur=Hl(Oo,is);un(ur.element,eo.element)&&(Hs.isNone()&&(Hs=ae.some(at())),Hs.each(na=>{ti(Oo,is,ts(na,!0,ur.isLocked))}))}})}})(_,w,Z,H.cell);const q=dc(_),le=E1(_,I),ue={...le,colDelta:le.colDelta-q.length},_e=zm(_,ue,H),{cols:Be,rows:Ye}=$s(_e),Me=dc(_e),He=E1(I,_),je={...He,colDelta:He.colDelta+Me.length},ct=(Ht=H,Gt=Me,O(I,Vt=>et(Gt,(jt,un)=>{const at=L0(1,Vt,Ht,me)[0];return ll(jt,un,at)},Vt))),ut=zm(ct,je,H);var Ht,Gt;return[...Be,...Ye.slice(0,w),...ut,...Ye.slice(w,Ye.length)]},bv=(w,_,I,H,Z)=>{const{rows:q,cols:le}=$s(w),ue=q.slice(0,_),_e=q.slice(_);return[...le,...ue,((Be,Ye,Me,He)=>Hc(Be,je=>He(je,Me),Ye))(q[I],(Be,Ye)=>_>0&&_<q.length&&H(ci(q[_-1],Ye),ci(q[_],Ye))?Hl(q[_],Ye):ts(Z(Be.element,H),!0,Be.isLocked),H,Z),..._e]},vv=(w,_,I,H,Z)=>O(w,q=>{const le=_>0&&_<ui(q)&&H(ci(q,_-1),ci(q,_)),ue=((_e,Be,Ye,Me,He,je,ct)=>{if(Ye!=="colgroup"&&Me)return Hl(_e,Be);{const ut=Hl(_e,He);return ts(ct(ut.element,je),!0,!1)}})(q,_,q.section,le,I,H,Z);return ll(q,_,ue)}),_1=(w,_,I,H)=>((Z,q,le,ue)=>ci(Z[q],le)!==void 0&&q>0&&ue(ci(Z[q-1],le),ci(Z[q],le)))(w,_,I,H)||((Z,q,le)=>q>0&&le(ci(Z,q-1),ci(Z,q)))(w[_],I,H),O0=(w,_,I,H)=>{const Z=q=>(le=>le==="row"?(ue=>yi(ue,"rowspan")>1)(_):Cu(_))(q)?`${q}group`:q;return w?Fh(_)?Z(I):null:H&&Fh(_)?Z(I==="row"?"col":"row"):null},T1=(w,_,I)=>ts(I(w.element,_),!0,w.isLocked),ig=(w,_,I,H,Z,q,le)=>O(w,(ue,_e)=>((Be,Ye)=>{const Me=Be.cells,He=O(Me,(je,ct)=>{if((ut=>ve(_,Ht=>I(ut.element,Ht.element)))(je)){const ut=le(je,_e,ct)?Z(je,I,H):je;return q(ut,_e,ct).each(Ht=>{var Gt,Vt;Gt=ut.element,Vt={scope:ae.from(Ht)},Rn(Vt,(jt,un)=>{jt.fold(()=>{In(Gt,un)},at=>{xt(Gt.dom,un,at)})})}),ut}return je});return tr(Be.element,He,Be.section,Be.isNew)})(ue)),vS=(w,_,I)=>qe(w,(H,Z)=>_1(w,Z,_,I)?[]:[Hl(H,_)]),I0=(w,_,I,H,Z)=>{const q=$s(w).rows,le=qe(_,Ye=>vS(q,Ye,H)),ue=O(q,Ye=>Ga(Ye.cells)),_e=((Ye,Me)=>mt(Me,W)&&Ga(Ye)?me:(He,je,ct)=>!(yo(He.element)==="th"&&Me[je]))(le,ue);return ig(w,le,H,Z,T1,((Ye,Me)=>(He,je)=>ae.some(O0(Ye,He.element,"row",Me[je])))(I,ue),_e)},ag=(w,_,I,H)=>{const Z=$s(w).rows,q=O(_,le=>Hl(Z[le.row],le.column));return ig(w,q,I,H,T1,ae.none,me)},Gm=w=>{if(!g(w))throw new Error("cases must be an array");if(w.length===0)throw new Error("there must be at least one case");const _=[],I={};return De(w,(H,Z)=>{const q=Bn(H);if(q.length!==1)throw new Error("one and only one name per case");const le=q[0],ue=H[le];if(I[le]!==void 0)throw new Error("duplicate key detected:"+le);if(le==="cata")throw new Error("cannot have a case named cata (sorry)");if(!g(ue))throw new Error("case arguments must be an array");_.push(le),I[le]=(..._e)=>{const Be=_e.length;if(Be!==ue.length)throw new Error("Wrong number of arguments to case "+le+". Expected "+ue.length+" ("+ue+"), got "+Be);return{fold:(...Ye)=>{if(Ye.length!==w.length)throw new Error("Wrong number of arguments to fold. Expected "+w.length+", got "+Ye.length);return Ye[Z].apply(null,_e)},match:Ye=>{const Me=Bn(Ye);if(_.length!==Me.length)throw new Error("Wrong number of arguments to match. Expected: "+_.join(",")+`
Actual: `+Me.join(","));if(!mt(_,He=>Ae(Me,He)))throw new Error("Not all branches were specified when using match. Specified: "+Me.join(", ")+`
Required: `+_.join(", "));return Ye[le].apply(null,_e)},log:Ye=>{console.log(Ye,{constructors:_,constructor:le,params:_e})}}}}),I},lg={...Gm([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}])},P0=(w,_,I)=>{const H=((Z,q)=>nr(Z)?((le,ue)=>{const _e=mc(le);return O(_e,(Be,Ye)=>({element:Be.element,width:ue[Ye],colspan:Be.colspan}))})(Z,q):((le,ue)=>{const _e=Pd(le);return O(_e,Be=>{const Ye=((Me,He,je)=>{let ct=0;for(let ut=Me;ut<He;ut++)ct+=je[ut]!==void 0?je[ut]:0;return ct})(Be.column,Be.column+Be.colspan,ue);return{element:Be.element,width:Ye,colspan:Be.colspan}})})(Z,q))(w,_);De(H,Z=>{I.setElementWidth(Z.element,Z.width)})},Iu=(w,_,I,H,Z)=>{const q=Ys(w),le=Z.getCellDelta(_),ue=Z.getWidths(q,Z),_e=I===q.grid.columns-1,Be=H.clampTableDelta(ue,I,le,Z.minCellWidth(),_e),Ye=((He,je,ct,ut,Ht)=>{const Gt=He.slice(0),Vt=((un,at)=>un.length===0?lg.none():un.length===1?lg.only(0):at===0?lg.left(0,1):at===un.length-1?lg.right(at-1,at):at>0&&at<un.length-1?lg.middle(at-1,at,at+1):lg.none())(He,je),jt=$(O(Gt,$(0)));return Vt.fold(jt,un=>ut.singleColumnWidth(Gt[un],ct),(un,at)=>Ht.calcLeftEdgeDeltas(Gt,un,at,ct,ut.minCellWidth(),ut.isRelative),(un,at,vn)=>Ht.calcMiddleDeltas(Gt,un,at,vn,ct,ut.minCellWidth(),ut.isRelative),(un,at)=>Ht.calcRightEdgeDeltas(Gt,un,at,ct,ut.minCellWidth(),ut.isRelative))})(ue,I,Be,Z,H),Me=O(Ye,(He,je)=>He+ue[je]);P0(q,Me,Z),H.resizeTable(Z.adjustTableWidth,Be,_e)},D1=(w,_,I)=>{const H=Ys(w),Z=((_e,Be)=>Uc(_e,Be,Du,Ye=>Ye.getOrThunk(al)))(H,w),q=O(Z,(_e,Be)=>I===Be?Math.max(_+_e,al()):_e),le=((_e,Be)=>O(_e.all,(Ye,Me)=>({element:Ye.element,height:Be[Me]})))(H,q);De(le,_e=>{rd(_e.element,_e.height)}),De(Pd(H),_e=>{(Be=>{Fr(Be,"height")})(_e.element)});const ue=Ut(q,(_e,Be)=>_e+Be,0);rd(w,ue)},Pu=w=>et(w,(_,I)=>ve(_,H=>H.column===I.column)?_:_.concat([I]),[]).sort((_,I)=>_.column-I.column),$h=as("col"),cg=as("colgroup"),k1=w=>yo(w)==="tr"||cg(w),A1=w=>({element:w,colspan:il(w,"colspan",1),rowspan:il(w,"rowspan",1)}),L1=w=>On(w,"scope").map(_=>_.substr(0,3)),cu=(w,_=A1)=>{const I=Z=>{if(k1(Z))return cg((q={element:Z}).element)?w.colgroup(q):w.row(q);{const le=Z,ue=(_e=>$h(_e.element)?w.col(_e):w.cell(_e))(_(le));return H=ae.some({item:le,replacement:ue}),ue}var q};let H=ae.none();return{getOrInit:(Z,q)=>H.fold(()=>I(Z),le=>q(Z,le.item)?le.replacement:I(Z))}},R1=w=>_=>{const I=[],H=Z=>{const q=w==="td"?{scope:null}:{},le=_.replace(Z,w,q);return I.push({item:Z,sub:le}),le};return{replaceOrInit:(Z,q)=>{if(k1(Z)||$h(Z))return Z;{const le=Z;return((ue,_e)=>Dt(I,Be=>_e(Be.item,ue)))(le,q).fold(()=>H(le),ue=>q(Z,ue.item)?ue.sub:H(le))}}}},FT=w=>({unmerge:_=>{const I=L1(_);return I.each(H=>Pt(_,"scope",H)),()=>{const H=w.cell({element:_,colspan:1,rowspan:1});return Fr(H,"width"),Fr(_,"width"),I.each(Z=>Pt(H,"scope",Z)),H}},merge:_=>(Fr(_[0],"width"),(()=>{const I=Nr(O(_,L1));if(I.length===0)return ae.none();{const H=I[0],Z=["row","col"];return ve(I,q=>q!==H&&Ae(Z,q))?ae.none():ae.from(H)}})().fold(()=>In(_[0],"scope"),I=>Pt(_[0],"scope",I+"group")),$(_[0]))}),Hh=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","table","thead","tfoot","tbody","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],Ca=T0(),gf=w=>((_,I)=>{const H=_.property().name(I);return Ae(Hh,H)})(Ca,w),xv=w=>((_,I)=>{const H=_.property().name(I);return Ae(["ol","ul"],H)})(Ca,w),Rs=w=>{const _=as("br"),I=Z=>yc(Z).bind(q=>{const le=vr(q).map(ue=>!!gf(ue)||!!((_e,Be)=>Ae(["br","img","hr","input"],_e.property().name(Be)))(Ca,ue)&&yo(ue)!=="img").getOr(!1);return dn(q).map(ue=>{return le===!0||yo(_e=ue)==="li"||La(_e,xv).isSome()||_(q)||gf(ue)&&!bs(Z,ue)?[]:[Yt.fromTag("br")];var _e})}).getOr([]),H=(()=>{const Z=qe(w,q=>{const le=ao(q);return(ue=>mt(ue,_e=>_(_e)||kt(_e)&&ha(_e).trim().length===0))(le)?[]:le.concat(I(q))});return Z.length===0?[Yt.fromTag("br")]:Z})();Xn(w[0]),Tn(w[0],H)},Cc=w=>Yn(w,!0),jf=w=>{Tt(w).length===0&&zn(w)},Wm=(w,_)=>({grid:w,cursor:_}),As=(w,_,I)=>{const H=((Z,q,le)=>{var ue,_e;const Be=$s(Z).rows;return ae.from((_e=(ue=Be[q])===null||ue===void 0?void 0:ue.cells[le])===null||_e===void 0?void 0:_e.element).filter(Cc).orThunk(()=>(Ye=>J(Ye,Me=>J(Me.cells,He=>{const je=He.element;return Fa(Cc(je),je)})))(Be))})(w,_,I);return Wm(w,H)},M0=w=>et(w,(_,I)=>ve(_,H=>H.row===I.row)?_:_.concat([I]),[]).sort((_,I)=>_.row-I.row),N0=(w,_)=>(I,H,Z,q,le)=>{const ue=M0(H),_e=O(ue,Ye=>Ye.row),Be=((Ye,Me,He,je,ct,ut,Ht)=>{const{cols:Gt,rows:Vt}=$s(Ye),jt=Vt[Me[0]],un=qe(Me,lo=>((is,Oo,ur)=>{const na=is[Oo];return qe(na.cells,(gl,Wa)=>_1(is,Oo,Wa,ur)?[]:[gl])})(Vt,lo,ct)),at=O(jt.cells,(lo,is)=>Ga(vS(Vt,is,ct))),vn=[...Vt];De(Me,lo=>{vn[lo]=Ht.transformRow(Vt[lo],He)});const go=[...Gt,...vn],eo=((lo,is)=>mt(is,W)&&Ga(lo.cells)?me:(Oo,ur,na)=>!(yo(Oo.element)==="th"&&is[na]))(jt,at),Hs=((lo,is)=>(Oo,ur,na)=>ae.some(O0(lo,Oo.element,"col",is[na])))(je,at);return ig(go,un,ct,ut,Ht.transformCell,Hs,eo)})(I,_e,w,_,Z,q.replaceOrInit,le);return As(Be,H[0].row,H[0].column)},BT=N0("thead",!0),mi=N0("tbody",!1),O1=N0("tfoot",!1),yv=(w,_,I)=>{const H=((q,le)=>Ds(q,()=>le))(w,I.section),Z=fc(H);return Um(Z,_,!0)},wv=(w,_,I,H)=>((Z,q,le,ue)=>{const _e=fc(q),Be=ue.getWidths(_e,ue);P0(_e,Be,ue)})(0,_,0,H.sizing),Zn=(w,_,I,H)=>((Z,q,le,ue,_e)=>{const Be=fc(q),Ye=ue.getWidths(Be,ue),Me=ue.pixelWidth(),{newSizes:He,delta:je}=_e.calcRedestributedWidths(Ye,Me,le.pixelDelta,ue.isRelative);P0(Be,He,ue),ue.adjustTableWidth(je)})(0,_,I,H.sizing,H.resize),xS=(w,_)=>ve(_,I=>I.column===0&&I.isLocked),F0=(w,_)=>ve(_,I=>I.column+I.colspan>=w.grid.columns&&I.isLocked),ug=(w,_)=>{const I=zf(w),H=Pu(_);return et(H,(Z,q)=>Z+I[q.column].map($l).getOr(0),0)},Mu=w=>(_,I)=>hl(_,I).filter(H=>!(w?xS:F0)(_,H)).map(H=>({details:H,pixelDelta:ug(_,H)})),B0=w=>(_,I)=>mv(_,I).filter(H=>!(w?xS:F0)(_,H.cells)),Uh=R1("th"),bf=R1("td"),yS=Xr((w,_,I,H)=>{const Z=_[0].row,q=M0(_),le=Ut(q,(ue,_e)=>({grid:bv(ue.grid,Z,_e.row+ue.delta,I,H.getOrInit),delta:ue.delta+1}),{grid:w,delta:0}).grid;return As(le,Z,_[0].column)},hl,z,z,cu),dg=Xr((w,_,I,H)=>{const Z=M0(_),q=Z[Z.length-1],le=q.row+q.rowspan,ue=Ut(Z,(_e,Be)=>bv(_e,le,Be.row,I,H.getOrInit),w);return As(ue,le,_[0].column)},hl,z,z,cu),Vh=Xr((w,_,I,H)=>{const Z=_.details,q=Pu(Z),le=q[0].column,ue=Ut(q,(_e,Be)=>({grid:vv(_e.grid,le,Be.column+_e.delta,I,H.getOrInit),delta:_e.delta+1}),{grid:w,delta:0}).grid;return As(ue,Z[0].row,le)},Mu(!0),Zn,z,cu),Sv=Xr((w,_,I,H)=>{const Z=_.details,q=Z[Z.length-1],le=q.column+q.colspan,ue=Pu(Z),_e=Ut(ue,(Be,Ye)=>vv(Be,le,Ye.column,I,H.getOrInit),w);return As(_e,Z[0].row,le)},Mu(!1),Zn,z,cu),wS=Xr((w,_,I,H)=>{const Z=Pu(_.details),q=((ue,_e)=>qe(ue,Be=>{const Ye=Be.cells,Me=Ut(_e,(He,je)=>je>=0&&je<He.length?He.slice(0,je).concat(He.slice(je+1)):He,Ye);return Me.length>0?[tr(Be.element,Me,Be.section,Be.isNew)]:[]}))(w,O(Z,ue=>ue.column)),le=q.length>0?q[0].cells.length-1:0;return As(q,Z[0].row,Math.min(Z[0].column,le))},(w,_)=>ld(w,_).map(I=>({details:I,pixelDelta:-ug(w,I)})),Zn,jf,cu),Ev=Xr((w,_,I,H)=>{const Z=M0(_),q=((ue,_e,Be)=>{const{rows:Ye,cols:Me}=$s(ue);return[...Me,...Ye.slice(0,_e),...Ye.slice(Be+1)]})(w,Z[0].row,Z[Z.length-1].row),le=Math.max($s(q).rows.length-1,0);return As(q,Math.min(_[0].row,le),_[0].column)},hl,z,jf,cu),Cv=Xr((w,_,I,H)=>{const Z=Pu(_),q=O(Z,ue=>ue.column),le=I0(w,q,!0,I,H.replaceOrInit);return As(le,_[0].row,_[0].column)},ld,z,z,Uh),I1=Xr((w,_,I,H)=>{const Z=Pu(_),q=O(Z,ue=>ue.column),le=I0(w,q,!1,I,H.replaceOrInit);return As(le,_[0].row,_[0].column)},ld,z,z,bf),_v=Xr(BT,ld,z,z,Uh),$T=Xr(mi,ld,z,z,bf),SS=Xr(O1,ld,z,z,bf),HT=Xr((w,_,I,H)=>{const Z=ag(w,_,I,H.replaceOrInit);return As(Z,_[0].row,_[0].column)},ld,z,z,Uh),ES=Xr((w,_,I,H)=>{const Z=ag(w,_,I,H.replaceOrInit);return As(Z,_[0].row,_[0].column)},ld,z,z,bf),jm=Xr((w,_,I,H)=>{const Z=_.cells;Rs(Z);const q=((le,ue,_e,Be)=>{const Ye=$s(le).rows;if(Ye.length===0)return le;for(let Me=ue.startRow;Me<=ue.finishRow;Me++)for(let He=ue.startCol;He<=ue.finishCol;He++){const je=Ye[Me],ct=Hl(je,He).isLocked;ti(je,He,ts(Be(),!1,ct))}return le})(w,_.bounds,0,H.merge(Z));return Wm(q,ae.from(Z[0]))},(w,_)=>((I,H)=>H.mergable)(0,_).filter(I=>rg(w,I.cells)),wv,z,FT),$0=Xr((w,_,I,H)=>{const Z=Ut(_,(q,le)=>k0(q,le,I,H.unmerge(le)),w);return Wm(Z,ae.from(_[0]))},(w,_)=>((I,H)=>H.unmergable)(0,_).filter(I=>rg(w,I)),wv,z,FT),P1=Xr((w,_,I,H)=>{const Z=((ue,_e)=>{const Be=Ys(ue);return Um(Be,_e,!0)})(_.clipboard,_.generators);var q,le;return((ue,_e,Be,Ye,Me)=>{const He=dc(_e),je=((Gt,Vt,jt)=>{const un=ui(Vt[0]),at=$s(Vt).cols.length+Gt.row,vn=Oe(un-Gt.column,go=>go+Gt.column);return{row:at,column:Dt(vn,go=>mt(jt,eo=>eo!==go)).getOr(un-1)}})(ue,_e,He),ct=$s(Be).rows,ut=R0(je,ct,He);return((Gt,Vt,jt)=>{if(Gt.row>=Vt.length||Gt.column>ui(Vt[0]))return Vm.error("invalid start address out of table bounds, row: "+Gt.row+", column: "+Gt.column);const un=Vt.slice(Gt.row),at=un[0].cells.slice(Gt.column),vn=ui(jt[0]),go=jt.length;return Vm.value({rowDelta:un.length-go,colDelta:at.length-vn})})(je,_e,ct).map(Gt=>{const Vt={...Gt,colDelta:Gt.colDelta-ut.length},jt=zm(_e,Vt,Ye),un=dc(jt),at=R0(je,ct,un);return((vn,go,eo,Hs,lo,is)=>{const Oo=vn.row,ur=vn.column,na=Oo+eo.length,gl=ur+ui(eo[0])+is.length,Wa=Un(is,me);for(let jc=Oo;jc<na;jc++){let Gd=0;for(let bl=ur;bl<gl;bl++){if(Wa[bl]){Gd++;continue}NT(go,jc,bl,lo)&&k0(go,ci(go[jc],bl),lo,Hs.cell);const eh=bl-ur-Gd,th=Hl(eo[jc-Oo],eh),dp=th.element,ey=Hs.replace(dp);ti(go[jc],bl,ts(ey,!0,th.isLocked))}}return go})(je,jt,ct,Ye,Me,at)})})((q=_.row,le=_.column,{row:q,column:le}),w,Z,_.generators,I).fold(()=>Wm(w,ae.some(_.element)),ue=>As(ue,_.row,_.column))},(w,_)=>Qe(_.element).bind(I=>zl(w,I).map(H=>({...H,generators:_.generators,clipboard:_.clipboard}))),wv,z,cu),Kf=Xr((w,_,I,H)=>{const Z=$s(w).rows,q=_.cells[0].column,le=Z[_.cells[0].row],ue=yv(_.clipboard,_.generators,le),_e=bS(q,w,ue,_.generators,I);return As(_e,_.cells[0].row,_.cells[0].column)},B0(!0),z,z,cu),Km=Xr((w,_,I,H)=>{const Z=$s(w).rows,q=_.cells[_.cells.length-1].column+_.cells[_.cells.length-1].colspan,le=Z[_.cells[0].row],ue=yv(_.clipboard,_.generators,le),_e=bS(q,w,ue,_.generators,I);return As(_e,_.cells[0].row,q)},B0(!1),z,z,cu),CS=Xr((w,_,I,H)=>{const Z=$s(w).rows,q=_.cells[0].row,le=Z[q],ue=yv(_.clipboard,_.generators,le),_e=gv(q,w,ue,_.generators,I);return As(_e,_.cells[0].row,_.cells[0].column)},mv,z,z,cu),_S=Xr((w,_,I,H)=>{const Z=$s(w).rows,q=_.cells[_.cells.length-1].row+_.cells[_.cells.length-1].rowspan,le=Z[_.cells[0].row],ue=yv(_.clipboard,_.generators,le),_e=gv(q,w,ue,_.generators,I);return As(_e,q,_.cells[0].column)},mv,z,z,cu),M1=(w,_)=>{const I=Ys(w);return hl(I,_).bind(H=>{const Z=H[H.length-1],q=H[0].column,le=Z.column+Z.colspan,ue=it(O(I.all,_e=>st(_e.cells,Be=>Be.column>=q&&Be.column<le)));return Ea(ue)}).getOr("")},Tv=(w,_)=>{const I=Ys(w);return hl(I,_).bind(Ea).getOr("")},UT=(w,_)=>{const I=Ys(w);return hl(I,_).bind(H=>{const Z=H[H.length-1],q=H[0].row,le=Z.row+Z.rowspan;return(ue=>{const _e=O(ue,Me=>v1(Me).type),Be=Ae(_e,"header"),Ye=Ae(_e,"footer");if(Be||Ye){const Me=Ae(_e,"body");return!Be||Me||Ye?Be||Me||!Ye?ae.none():ae.some("footer"):ae.some("header")}return ae.some("body")})(I.all.slice(q,le))}).getOr("")},TS=(w,_)=>w.dispatch("NewRow",{node:_}),Dv=(w,_)=>w.dispatch("NewCell",{node:_}),Pr=(w,_,I)=>{w.dispatch("TableModified",{...I,table:_})},H0={structure:!1,style:!0},ga={structure:!0,style:!1},N1={structure:!0,style:!0},Qi=(w,_)=>Qn(w)?Ji(_):Po(w)?$a(_):qr(_),_c=(w,_,I)=>{const H=Ye=>yo($o(Ye))==="table",Z=ku(w),q=Bt(w)?z:b1,le=Ye=>{switch(zc(w)){case"section":return y1();case"sectionCells":return w1();case"cells":return MT();default:return((Me,He)=>{var je;switch((je=Ys(Me),J(je.all,ct=>{const ut=v1(ct);return ut.type==="header"?ae.from(ut.subType):ae.none()})).getOr(He)){case"section":return tn();case"sectionCells":return x1();case"cells":return Mi()}})(Ye,"section")}},ue=(Ye,Me,He,je)=>(ct,ut,Ht=!1)=>{mr(ct);const Gt=Yt.fromDom(w.getDoc()),Vt=Ua(He,Gt,Z),jt={sizing:Qi(w,ct),resize:Bt(w)?pS():Ud(),section:le(ct)};return Me(ct)?Ye(ct,ut,Vt,jt).bind(un=>{_.refresh(ct.dom),De(un.newRows,vn=>{TS(w,vn.dom)}),De(un.newCells,vn=>{Dv(w,vn.dom)});const at=((vn,go)=>go.cursor.fold(()=>{const eo=Tt(vn);return vt(eo).filter(li).map(Hs=>{I.clearSelectedCells(vn.dom);const lo=w.dom.createRng();return lo.selectNode(Hs.dom),w.selection.setRng(lo),Pt(Hs,"data-mce-selected","1"),lo})},eo=>{const Hs=uv(Nh,eo),lo=w.dom.createRng();return lo.setStart(Hs.element.dom,Hs.offset),lo.setEnd(Hs.element.dom,Hs.offset),w.selection.setRng(lo),I.clearSelectedCells(vn.dom),ae.some(lo)}))(ct,un);return li(ct)&&(mr(ct),Ht||Pr(w,ct.dom,je)),at.map(vn=>({rng:vn,effect:je}))}):ae.none()},_e=ue(Ev,Ye=>!H(w)||sg(Ye).rows>1,z,ga),Be=ue(wS,Ye=>!H(w)||sg(Ye).columns>1,z,ga);return{deleteRow:_e,deleteColumn:Be,insertRowsBefore:ue(yS,me,z,ga),insertRowsAfter:ue(dg,me,z,ga),insertColumnsBefore:ue(Vh,me,q,ga),insertColumnsAfter:ue(Sv,me,q,ga),mergeCells:ue(jm,me,z,ga),unmergeCells:ue($0,me,z,ga),pasteColsBefore:ue(Kf,me,z,ga),pasteColsAfter:ue(Km,me,z,ga),pasteRowsBefore:ue(CS,me,z,ga),pasteRowsAfter:ue(_S,me,z,ga),pasteCells:ue(P1,me,z,N1),makeCellsHeader:ue(HT,me,z,ga),unmakeCellsHeader:ue(ES,me,z,ga),makeColumnsHeader:ue(Cv,me,z,ga),unmakeColumnsHeader:ue(I1,me,z,ga),makeRowsHeader:ue(_v,me,z,ga),makeRowsBody:ue($T,me,z,ga),makeRowsFooter:ue(SS,me,z,ga),getTableRowType:UT,getTableCellType:Tv,getTableColType:M1}},F1=(w,_,I)=>{const H=il(w,_,1);I===1||H<=1?In(w,_):Pt(w,_,Math.min(I,H))},U0=(w,_)=>I=>{const H=I.column+I.colspan-1,Z=I.column;return H>=w&&Z<_},fg=Gm([{invalid:["raw"]},{pixels:["value"]},{percent:["value"]}]),Zm=(w,_,I)=>{const H=I.substring(0,I.length-w.length),Z=parseFloat(H);return H===Z.toString()?_(Z):fg.invalid(I)},Zf={...fg,from:w=>Mc(w,"%")?Zm("%",fg.percent,w):Mc(w,"px")?Zm("px",fg.pixels,w):fg.invalid(w)},zh=(w,_,I)=>{const H=Zf.from(I),Z=mt(w,q=>q==="0px")?((q,le)=>{const ue=q.fold(()=>$(""),_e=>$(_e/le+"px"),()=>$(100/le+"%"));return Oe(le,ue)})(H,w.length):((q,le,ue)=>q.fold(()=>le,_e=>((Be,Ye,Me)=>{const He=Me/Ye;return O(Be,je=>Zf.from(je).fold(()=>je,ct=>ct*He+"px",ct=>ct/100*Me+"px"))})(le,ue,_e),_e=>((Be,Ye)=>O(Be,Me=>Zf.from(Me).fold(()=>Me,He=>He/Ye*100+"%",He=>He+"%")))(le,ue)))(H,w,_);return kv(Z)},vf=(w,_)=>w.length===0?_:Ut(w,(I,H)=>Zf.from(H).fold($(0),W,W)+I,0),VT=(w,_)=>Zf.from(w).fold($(w),I=>I+_+"px",I=>I+_+"%"),kv=w=>{if(w.length===0)return w;const _=Ut(w,(H,Z)=>{const q=Zf.from(Z).fold(()=>({value:Z,remainder:0}),le=>((ue,_e)=>{const Be=Math.floor(ue);return{value:Be+"px",remainder:ue-Be}})(le),le=>({value:le+"%",remainder:0}));return{output:[q.value].concat(H.output),remainder:H.remainder+q.remainder}},{output:[],remainder:0}),I=_.output;return I.slice(0,I.length-1).concat([VT(I[I.length-1],Math.round(_.remainder))])},si=Zf.from,js=(w,_,I)=>{const H=Ys(w),Z=H.all,q=Pd(H),le=mc(H);_.each(ue=>{const _e=si(ue).fold($("px"),$("px"),$("%")),Be=$c(w),Ye=((He,je)=>El(He,je,Ui,wi))(H,w),Me=zh(Ye,Be,ue);nr(H)?((He,je,ct)=>{De(je,(ut,Ht)=>{const Gt=vf([He[Ht]],us());ei(ut.element,"width",Gt+ct)})})(Me,le,_e):((He,je,ct)=>{De(je,ut=>{const Ht=He.slice(ut.column,ut.colspan+ut.column),Gt=vf(Ht,us());ei(ut.element,"width",Gt+ct)})})(Me,q,_e),ei(w,"width",ue)}),I.each(ue=>{const _e=Md(w),Be=((Ye,Me)=>Uc(Ye,Me,xc,wi))(H,w);((Ye,Me,He)=>{De(He,je=>{Fr(je.element,"height")}),De(Me,(je,ct)=>{ei(je.element,"height",Ye[ct])})})(zh(Be,_e,ue),Z,q),ei(w,"height",ue)})},hg=w=>gc(w).exists(_=>Wn.test(_)),B1=w=>gc(w).exists(_=>cr.test(_)),Gh=w=>gc(w).isNone(),Gi=w=>{In(w,"width"),In(w,"height")},Nu=w=>{const _=hf(w);js(w,ae.some(_),ae.none()),Gi(w)},uu=w=>{const _=(I=>$c(I)+"px")(w);js(w,ae.some(_),ae.none()),Gi(w)},Av=w=>{Fr(w,"width");const _=pn(w),I=_.length>0?_:Tt(w);De(I,H=>{Fr(H,"width"),Gi(H)}),Gi(w)},$1={styles:{"border-collapse":"collapse",width:"100%"},attributes:{border:"1"},colGroups:!1},Lv=(w,_,I,H)=>Oe(w,Z=>((q,le,ue,_e)=>{const Be=Yt.fromTag("tr");for(let Ye=0;Ye<q;Ye++){const Me=Yt.fromTag(_e<le||Ye<ue?"th":"td");Ye<ue&&Pt(Me,"scope","row"),_e<le&&Pt(Me,"scope","col"),Nt(Me,Yt.fromTag("br")),Nt(Be,Me)}return Be})(_,I,H,Z)),mg=(w,_)=>{w.selection.select(_.dom,!0),w.selection.collapse(!0)},Rv=(w,_,I,H,Z)=>{const q=(ue=>{const _e=ue.options,Be=_e.get("table_default_styles");return _e.isSet("table_default_styles")?Be:((Ye,Me)=>Js(Ye)||!X(Ye)?Me:Po(Ye)?{...Me,width:wc(Ye)}:{...Me,width:nc})(ue,Be)})(w),le={styles:q,attributes:Ne(w),colGroups:We(w)};return w.undoManager.ignore(()=>{const ue=((Be,Ye,Me,He,je,ct=$1)=>{const ut=Yt.fromTag("table"),Ht=je!=="cells";ec(ut,ct.styles),gn(ut,ct.attributes),ct.colGroups&&Nt(ut,(un=>{const at=Yt.fromTag("colgroup");return Oe(un,()=>Nt(at,Yt.fromTag("col"))),at})(Ye));const Gt=Math.min(Be,Me);if(Ht&&Me>0){const un=Yt.fromTag("thead");Nt(ut,un);const at=Lv(Me,Ye,je==="sectionCells"?Gt:0,He);Tn(un,at)}const Vt=Yt.fromTag("tbody");Nt(ut,Vt);const jt=Lv(Ht?Be-Gt:Be,Ye,Ht?0:Me,He);return Tn(Vt,jt),ut})(I,_,Z,H,zc(w),le);Pt(ue,"data-mce-id","__mce");const _e=(Be=>{const Ye=Yt.fromTag("div"),Me=Yt.fromDom(Be.dom.cloneNode(!0));return Nt(Ye,Me),(He=>He.dom.innerHTML)(Ye)})(ue);w.insertContent(_e),w.addVisual()}),ca($o(w),'table[data-mce-id="__mce"]').map(ue=>(Po(w)?uu(ue):Js(w)?Av(ue):(Qn(w)||(_e=>u(_e)&&_e.indexOf("%")!==-1)(q.width))&&Nu(ue),mr(ue),In(ue,"data-mce-id"),((_e,Be)=>{De(Aa(Be,"tr"),Ye=>{TS(_e,Ye.dom),De(Aa(Ye,"th,td"),Me=>{Dv(_e,Me.dom)})})})(w,ue),((_e,Be)=>{ca(Be,"td,th").each(j(mg,_e))})(w,ue),ue.dom)).getOrNull()};var pg=tinymce.util.Tools.resolve("tinymce.FakeClipboard");const DS="x-tinymce/dom-table-",qm=DS+"rows",Fu=DS+"columns",ml=w=>{const _=pg.FakeClipboardItem(w);pg.write([_])},qf=w=>{var _;const I=(_=pg.read())!==null&&_!==void 0?_:[];return J(I,H=>ae.from(H.getType(w)))},kS=w=>{qf(w).isSome()&&pg.clear()},AS=w=>{w.fold(Al,_=>ml({[qm]:_}))},Bu=()=>qf(qm),Al=()=>kS(qm),Ym=w=>{w.fold(_a,_=>ml({[Fu]:_}))},V0=()=>qf(Fu),_a=()=>kS(Fu),Ei=w=>D0(Vr(w),Jn(w)).filter(Wo),ea=(w,_)=>{const I=Jn(w),H=Me=>Sn(Me,I),Z=Me=>(He=>fi(Vr(He),Jn(He)).filter(Wo))(w).bind(He=>H(He).map(je=>Me(je,He))),q=Me=>{w.focus()},le=(Me,He=!1)=>Z((je,ct)=>{const ut=so(ad(w),je,ct);Me(je,ut,He).each(q)}),ue=()=>Z((Me,He)=>((je,ct,ut)=>{const Ht=Ys(je);return hl(Ht,ct).bind(Gt=>{const Vt=Um(Ht,ut,!1),jt=$s(Vt).rows.slice(Gt[0].row,Gt[Gt.length-1].row+Gt[Gt.length-1].rowspan),un=qe(jt,vn=>{const go=st(vn.cells,eo=>!eo.isLocked);return go.length>0?[{...vn,cells:go}]:[]}),at=hi(un);return Fa(at.length>0,at)}).map(Gt=>O(Gt,Vt=>{const jt=Yo(Vt.element);return De(Vt.cells,un=>{const at=Lo(un.element);Ou(at,"colspan",un.colspan,1),Ou(at,"rowspan",un.rowspan,1),Nt(jt,at)}),jt}))})(Me,so(ad(w),Me,He),Ua(z,Yt.fromDom(w.getDoc()),ae.none()))),_e=()=>Z((Me,He)=>((je,ct)=>{const ut=Ys(je);return ld(ut,ct).map(Ht=>{const Gt=Ht[Ht.length-1],Vt=Ht[0].column,jt=Gt.column+Gt.colspan,un=((vn,go,eo)=>{if(nr(vn)){const Hs=st(mc(vn),U0(go,eo)),lo=O(Hs,Oo=>{const ur=Lo(Oo.element);return F1(ur,"span",eo-go),ur}),is=Yt.fromTag("colgroup");return Tn(is,lo),[is]}return[]})(ut,Vt,jt),at=((vn,go,eo)=>O(vn.all,Hs=>{const lo=st(Hs.cells,U0(go,eo)),is=O(lo,ur=>{const na=Lo(ur.element);return F1(na,"colspan",eo-go),na}),Oo=Yt.fromTag("tr");return Tn(Oo,is),Oo}))(ut,Vt,jt);return[...un,...at]})})(Me,so(ad(w),Me,He))),Be=(Me,He)=>He().each(je=>{const ct=O(je,ut=>Lo(ut));Z((ut,Ht)=>{const Gt=Xs(Yt.fromDom(w.getDoc())),Vt=((jt,un,at,vn)=>({selection:Bd(jt),clipboard:at,generators:vn}))(ad(w),0,ct,Gt);Me(ut,Vt).each(q)})}),Ye=Me=>(He,je)=>((ct,ut)=>$t(ct,ut)?ae.from(ct[ut]):ae.none())(je,"type").each(ct=>{le(Me(ct),je.no_events)});Rn({mceTableSplitCells:()=>le(_.unmergeCells),mceTableMergeCells:()=>le(_.mergeCells),mceTableInsertRowBefore:()=>le(_.insertRowsBefore),mceTableInsertRowAfter:()=>le(_.insertRowsAfter),mceTableInsertColBefore:()=>le(_.insertColumnsBefore),mceTableInsertColAfter:()=>le(_.insertColumnsAfter),mceTableDeleteCol:()=>le(_.deleteColumn),mceTableDeleteRow:()=>le(_.deleteRow),mceTableCutCol:()=>_e().each(Me=>{Ym(Me),le(_.deleteColumn)}),mceTableCutRow:()=>ue().each(Me=>{AS(Me),le(_.deleteRow)}),mceTableCopyCol:()=>_e().each(Me=>Ym(Me)),mceTableCopyRow:()=>ue().each(Me=>AS(Me)),mceTablePasteColBefore:()=>Be(_.pasteColsBefore,V0),mceTablePasteColAfter:()=>Be(_.pasteColsAfter,V0),mceTablePasteRowBefore:()=>Be(_.pasteRowsBefore,Bu),mceTablePasteRowAfter:()=>Be(_.pasteRowsAfter,Bu),mceTableDelete:()=>Ei(w).each(Me=>{Sn(Me,I).filter(se(I)).each(He=>{const je=Yt.fromText("");if(Ot(He,je),zn(He),w.dom.isEmpty(w.getBody()))w.setContent(""),w.selection.setCursorLocation();else{const ct=w.dom.createRng();ct.setStart(je.dom,0),ct.setEnd(je.dom,0),w.selection.setRng(ct),w.nodeChanged()}})}),mceTableCellToggleClass:(Me,He)=>{Z(je=>{const ct=ad(w),ut=mt(ct,Gt=>w.formatter.match("tablecellclass",{value:He},Gt.dom)),Ht=ut?w.formatter.remove:w.formatter.apply;De(ct,Gt=>Ht("tablecellclass",{value:He},Gt.dom)),Pr(w,je.dom,H0)})},mceTableToggleClass:(Me,He)=>{Z(je=>{w.formatter.toggle("tableclass",{value:He},je.dom),Pr(w,je.dom,H0)})},mceTableToggleCaption:()=>{Ei(w).each(Me=>{Sn(Me,I).each(He=>{jr(He,"caption").fold(()=>{const je=Yt.fromTag("caption");Nt(je,Yt.fromText("Caption")),((ct,ut,Ht)=>{ze(ct,0).fold(()=>{Nt(ct,ut)},Gt=>{Ie(Gt,ut)})})(He,je),w.selection.setCursorLocation(je.dom,0)},je=>{as("caption")(Me)&&_i("td",He).each(ct=>w.selection.setCursorLocation(ct.dom,0)),zn(je)}),Pr(w,He.dom,ga)})})},mceTableSizingMode:(Me,He)=>(je=>Ei(w).each(ct=>{Js(w)||Po(w)||Qn(w)||Sn(ct,I).each(ut=>{je!=="relative"||hg(ut)?je!=="fixed"||B1(ut)?je!=="responsive"||Gh(ut)||Av(ut):uu(ut):Nu(ut),mr(ut),Pr(w,ut.dom,ga)})}))(He),mceTableCellType:Ye(Me=>Me==="th"?_.makeCellsHeader:_.unmakeCellsHeader),mceTableColType:Ye(Me=>Me==="th"?_.makeColumnsHeader:_.unmakeColumnsHeader),mceTableRowType:Ye(Me=>{switch(Me){case"header":return _.makeRowsHeader;case"footer":return _.makeRowsFooter;default:return _.makeRowsBody}})},(Me,He)=>w.addCommand(He,Me)),w.addCommand("mceInsertTable",(Me,He)=>{((je,ct,ut,Ht={})=>{const Gt=Vt=>V(Vt)&&Vt>0;if(Gt(ct)&&Gt(ut)){const Vt=Ht.headerRows||0,jt=Ht.headerColumns||0;return Rv(je,ut,ct,jt,Vt)}console.error("Invalid values for mceInsertTable - rows and columns values are required to insert a table.")})(w,He.rows,He.columns,He.options)}),w.addCommand("mceTableApplyCellStyle",(Me,He)=>{const je=Ht=>"tablecell"+Ht.toLowerCase().replace("-","");if(!h(He))return;const ct=st(ad(w),Wo);if(ct.length===0)return;const ut=((Ht,Gt)=>{const Vt={};return((jt,un,at,vn)=>{Rn(jt,(go,eo)=>{(un(go,eo)?at:vn)(go,eo)})})(Ht,Gt,(jt=>(un,at)=>{jt[at]=un})(Vt),z),Vt})(He,(Ht,Gt)=>w.formatter.has(je(Gt))&&u(Ht));(Ht=>{for(const Gt in Ht)if(Vn.call(Ht,Gt))return!1;return!0})(ut)||(Rn(ut,(Ht,Gt)=>{const Vt=je(Gt);De(ct,jt=>{Ht===""?w.formatter.remove(Vt,{value:null},jt.dom,!0):w.formatter.apply(Vt,{value:Ht},jt.dom)})}),H(ct[0]).each(Ht=>Pr(w,Ht.dom,H0)))})},Wi=Gm([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),ir={before:Wi.before,on:Wi.on,after:Wi.after,cata:(w,_,I,H)=>w.fold(_,I,H),getStart:w=>w.fold(W,W,W)},Jr=(w,_)=>({selection:w,kill:_}),Xm=(w,_)=>{const I=w.document.createRange();return I.selectNode(_.dom),I},Ov=(w,_)=>{const I=w.document.createRange();return H1(I,_),I},H1=(w,_)=>w.selectNodeContents(_.dom),U1=(w,_,I)=>{const H=w.document.createRange();var Z;return Z=H,_.fold(q=>{Z.setStartBefore(q.dom)},(q,le)=>{Z.setStart(q.dom,le)},q=>{Z.setStartAfter(q.dom)}),((q,le)=>{le.fold(ue=>{q.setEndBefore(ue.dom)},(ue,_e)=>{q.setEnd(ue.dom,_e)},ue=>{q.setEndAfter(ue.dom)})})(H,I),H},z0=(w,_,I,H,Z)=>{const q=w.document.createRange();return q.setStart(_.dom,I),q.setEnd(H.dom,Z),q},V1=w=>({left:w.left,top:w.top,right:w.right,bottom:w.bottom,width:w.width,height:w.height}),Wh=Gm([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Iv=(w,_,I)=>_(Yt.fromDom(I.startContainer),I.startOffset,Yt.fromDom(I.endContainer),I.endOffset),LS=(w,_)=>{const I=((H,Z)=>Z.match({domRange:q=>({ltr:$(q),rtl:ae.none}),relative:(q,le)=>({ltr:Zr(()=>U1(H,q,le)),rtl:Zr(()=>ae.some(U1(H,le,q)))}),exact:(q,le,ue,_e)=>({ltr:Zr(()=>z0(H,q,le,ue,_e)),rtl:Zr(()=>ae.some(z0(H,ue,_e,q,le)))})}))(w,_);return((H,Z)=>{const q=Z.ltr();return q.collapsed?Z.rtl().filter(le=>le.collapsed===!1).map(le=>Wh.rtl(Yt.fromDom(le.endContainer),le.endOffset,Yt.fromDom(le.startContainer),le.startOffset)).getOrThunk(()=>Iv(0,Wh.ltr,q)):Iv(0,Wh.ltr,q)})(0,I)},z1=(w,_)=>LS(w,_).match({ltr:(I,H,Z,q)=>{const le=w.document.createRange();return le.setStart(I.dom,H),le.setEnd(Z.dom,q),le},rtl:(I,H,Z,q)=>{const le=w.document.createRange();return le.setStart(Z.dom,q),le.setEnd(I.dom,H),le}});Wh.ltr,Wh.rtl;const pl=(w,_,I,H)=>({start:w,soffset:_,finish:I,foffset:H}),gg=(w,_,I,H)=>({start:ir.on(w,_),finish:ir.on(I,H)}),$u=(w,_)=>{const I=z1(w,_);return pl(Yt.fromDom(I.startContainer),I.startOffset,Yt.fromDom(I.endContainer),I.endOffset)},Jm=gg,Qm=(w,_,I,H,Z)=>bs(I,H)?ae.none():lu(I,H,_).bind(q=>{const le=q.boxes.getOr([]);return le.length>1?(Z(w,le,q.start,q.finish),ae.some(Jr(ae.some(Jm(I,0,I,Vi(I))),!0))):ae.none()}),Gl=(w,_)=>({item:w,mode:_}),Ll=(w,_,I,H=jh)=>w.property().parent(_).map(Z=>Gl(Z,H)),jh=(w,_,I,H=ep)=>I.sibling(w,_).map(Z=>Gl(Z,H)),ep=(w,_,I,H=ep)=>{const Z=w.property().children(_);return I.first(Z).map(q=>Gl(q,H))},G1=[{current:Ll,next:jh,fallback:ae.none()},{current:jh,next:ep,fallback:ae.some(Ll)},{current:ep,next:ep,fallback:ae.some(jh)}],Yf=(w,_,I,H,Z=G1)=>Dt(Z,q=>q.current===I).bind(q=>q.current(w,_,H,q.next).orThunk(()=>q.fallback.bind(le=>Yf(w,_,le,H)))),Pv=(w,_,I,H,Z,q)=>Yf(w,_,H,Z).bind(le=>q(le.item)?ae.none():I(le.item)?ae.some(le.item):Pv(w,le.item,I,le.mode,Z,q)),Mv=w=>_=>w.property().children(_).length===0,bg=(w,_,I,H)=>Pv(w,_,I,jh,{sibling:(Z,q)=>Z.query().prevSibling(q),first:Z=>Z.length>0?ae.some(Z[Z.length-1]):ae.none()},H),RS=(w,_,I,H)=>Pv(w,_,I,jh,{sibling:(Z,q)=>Z.query().nextSibling(q),first:Z=>Z.length>0?ae.some(Z[0]):ae.none()},H),Nv=T0(),Fv=(w,_)=>((I,H,Z)=>bg(I,H,Mv(I),Z))(Nv,w,_),W1=(w,_)=>((I,H,Z)=>RS(I,H,Mv(I),Z))(Nv,w,_),tp=Gm([{none:["message"]},{success:[]},{failedUp:["cell"]},{failedDown:["cell"]}]),zT=w=>yr(w,"tr"),np={...tp,verify:(w,_,I,H,Z,q,le)=>yr(H,"td,th",le).bind(ue=>yr(_,"td,th",le).map(_e=>bs(ue,_e)?bs(H,ue)&&Vi(ue)===Z?q(_e):tp.none("in same cell"):Qp(zT,[ue,_e]).fold(()=>((Be,Ye,Me)=>{const He=Be.getRect(Ye),je=Be.getRect(Me);return je.right>He.left&&je.left<He.right})(w,_e,ue)?tp.success():q(_e),Be=>q(_e)))).getOr(tp.none("default")),cata:(w,_,I,H,Z)=>w.fold(_,I,H,Z)},Rl=as("br"),xf=(w,_,I)=>_(w,I).bind(H=>kt(H)&&ha(H).trim().length===0?xf(H,_,I):ae.some(H)),OS=(w,_,I,H)=>((Z,q)=>ze(Z,q).filter(Rl).orThunk(()=>ze(Z,q-1).filter(Rl)))(_,I).bind(Z=>H.traverse(Z).fold(()=>xf(Z,H.gather,w).map(H.relative),q=>(le=>dn(le).bind(ue=>{const _e=ao(ue);return((Be,Ye)=>Xe(Be,j(bs,Ye)))(_e,le).map(Be=>((Ye,Me,He,je)=>({parent:Ye,children:Me,element:He,index:je}))(ue,_e,le,Be))}))(q).map(le=>ir.on(le.parent,le.index)))),Vd=(w,_)=>({left:w.left,top:w.top+_,right:w.right,bottom:w.bottom+_}),Kh=(w,_)=>({left:w.left,top:w.top-_,right:w.right,bottom:w.bottom-_}),Bv=(w,_,I)=>({left:w.left+_,top:w.top+I,right:w.right+_,bottom:w.bottom+I}),yf=w=>({left:w.left,top:w.top,right:w.right,bottom:w.bottom}),j1=(w,_)=>ae.some(w.getRect(_)),zd=(w,_,I)=>Nn(_)?j1(w,_).map(yf):kt(_)?((H,Z,q)=>q>=0&&q<Vi(Z)?H.getRangedRect(Z,q,Z,q+1):q>0?H.getRangedRect(Z,q-1,Z,q):ae.none())(w,_,I).map(yf):ae.none(),vg=(w,_)=>Nn(_)?j1(w,_).map(yf):kt(_)?w.getRangedRect(_,0,_,Vi(_)).map(yf):ae.none(),Zh=Gm([{none:[]},{retry:["caret"]}]),IS=(w,_,I)=>Na(_,gf).fold(Y,H=>vg(w,H).exists(Z=>((q,le)=>q.left<le.left||Math.abs(le.right-q.left)<1||q.left>le.right)(I,Z))),Tc={point:w=>w.bottom,adjuster:(w,_,I,H,Z)=>{const q=Vd(Z,5);return Math.abs(I.bottom-H.bottom)<1||I.top>Z.bottom?Zh.retry(q):I.top===Z.bottom?Zh.retry(Vd(Z,1)):IS(w,_,Z)?Zh.retry(Bv(q,5,0)):Zh.none()},move:Vd,gather:W1},Hu=(w,_,I,H,Z)=>Z===0?ae.some(H):((q,le,ue)=>q.elementFromPoint(le,ue).filter(_e=>yo(_e)==="table").isSome())(w,H.left,_.point(H))?((q,le,ue,_e,Be)=>Hu(q,le,ue,le.move(_e,5),Be))(w,_,I,H,Z-1):w.situsFromPoint(H.left,_.point(H)).bind(q=>q.start.fold(ae.none,le=>vg(w,le).bind(ue=>_.adjuster(w,le,ue,I,H).fold(ae.none,_e=>Hu(w,_,I,_e,Z-1))).orThunk(()=>ae.some(H)),ae.none)),G0=(w,_,I)=>{const H=w.move(I,5),Z=Hu(_,w,I,H,100).getOr(H);return((q,le,ue)=>q.point(le)>ue.getInnerHeight()?ae.some(q.point(le)-ue.getInnerHeight()):q.point(le)<0?ae.some(-q.point(le)):ae.none())(w,Z,_).fold(()=>_.situsFromPoint(Z.left,w.point(Z)),q=>(_.scrollBy(0,q),_.situsFromPoint(Z.left,w.point(Z)-q)))},ta={tryUp:j(G0,{point:w=>w.top,adjuster:(w,_,I,H,Z)=>{const q=Kh(Z,5);return Math.abs(I.top-H.top)<1||I.bottom<Z.top?Zh.retry(q):I.bottom===Z.top?Zh.retry(Kh(Z,1)):IS(w,_,Z)?Zh.retry(Bv(q,5,0)):Zh.none()},move:Kh,gather:Fv}),tryDown:j(G0,Tc),getJumpSize:$(5)},$v=(w,_,I)=>w.getSelection().bind(H=>((Z,q,le,ue)=>(Rl(q)?((Be,Ye,Me)=>Me.traverse(Ye).orThunk(()=>xf(Ye,Me.gather,Be)).map(Me.relative))(Z,q,ue):OS(Z,q,le,ue)).map(Be=>({start:Be,finish:Be})))(_,H.finish,H.foffset,I).fold(()=>ae.some(Ir(H.finish,H.foffset)),Z=>{const q=w.fromSitus(Z);return le=np.verify(w,H.finish,H.foffset,q.finish,q.foffset,I.failure,_),np.cata(le,ue=>ae.none(),()=>ae.none(),ue=>ae.some(Ir(ue,0)),ue=>ae.some(Ir(ue,Vi(ue))));var le})),Ta=(w,_,I,H,Z,q)=>q===0?ae.none():Uu(w,_,I,H,Z).bind(le=>{const ue=w.fromSitus(le),_e=np.verify(w,I,H,ue.finish,ue.foffset,Z.failure,_);return np.cata(_e,()=>ae.none(),()=>ae.some(le),Be=>bs(I,Be)&&H===0?Hv(w,I,H,Kh,Z):Ta(w,_,Be,0,Z,q-1),Be=>bs(I,Be)&&H===Vi(Be)?Hv(w,I,H,Vd,Z):Ta(w,_,Be,Vi(Be),Z,q-1))}),Hv=(w,_,I,H,Z)=>zd(w,_,I).bind(q=>PS(w,Z,H(q,ta.getJumpSize()))),PS=(w,_,I)=>{const H=Ih().browser;return H.isChromium()||H.isSafari()||H.isFirefox()?_.retry(w,I):ae.none()},Uu=(w,_,I,H,Z)=>zd(w,I,H).bind(q=>PS(w,Z,q)),wf=(w,_,I,H,Z)=>yr(H,"td,th",_).bind(q=>yr(q,"table",_).bind(le=>((ue,_e)=>La(ue,Be=>dn(Be).exists(Ye=>bs(Ye,_e)),void 0).isSome())(Z,le)?((ue,_e,Be)=>$v(ue,_e,Be).bind(Ye=>Ta(ue,_e,Ye.element,Ye.offset,Be,20).map(ue.fromSitus)))(w,_,I).bind(ue=>yr(ue.finish,"td,th",_).map(_e=>({start:q,finish:_e,range:ue}))):ae.none())),Xf=(w,_,I,H,Z,q)=>q(H,_).orThunk(()=>wf(w,_,I,H,Z).map(le=>{const ue=le.range;return Jr(ae.some(Jm(ue.start,ue.soffset,ue.finish,ue.foffset)),!0)})),Vu=(w,_)=>yr(w,"tr",_).bind(I=>yr(I,"table",_).bind(H=>{const Z=Aa(H,"tr");return bs(I,Z[0])?((q,le,ue)=>bg(Nv,q,_e=>yc(_e).isSome(),ue))(H,0,_).map(q=>{const le=Vi(q);return Jr(ae.some(Jm(q,le,q,le)),!0)}):ae.none()})),K1=(w,_)=>yr(w,"tr",_).bind(I=>yr(I,"table",_).bind(H=>{const Z=Aa(H,"tr");return bs(I,Z[Z.length-1])?((q,le,ue)=>RS(Nv,q,_e=>_l(_e).isSome(),ue))(H,0,_).map(q=>Jr(ae.some(Jm(q,0,q,0)),!0)):ae.none()})),MS=(w,_,I,H,Z,q,le)=>wf(w,I,H,Z,q).bind(ue=>Qm(_,I,ue.start,ue.finish,le)),W0=w=>{let _=w;return{get:()=>_,set:I=>{_=I}}},op=()=>{const w=(_=>{const I=W0(ae.none()),H=()=>I.get().each(_);return{clear:()=>{H(),I.set(ae.none())},isSet:()=>I.get().isSome(),get:()=>I.get(),set:Z=>{H(),I.set(ae.some(Z))}}})(z);return{...w,on:_=>w.get().each(_)}},Z1=(w,_)=>yr(w,"td,th",_),Uv=w=>vo(w).exists(Yn),j0={traverse:vr,gather:W1,relative:ir.before,retry:ta.tryDown,failure:np.failedDown},q1={traverse:yn,gather:Fv,relative:ir.before,retry:ta.tryUp,failure:np.failedUp},Sf=w=>_=>_===w,K0=Sf(38),Jf=Sf(40),Wc=w=>w>=37&&w<=40,Vv={isBackward:Sf(37),isForward:Sf(39)},GT={isBackward:Sf(39),isForward:Sf(37)},qh=Gm([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),du={domRange:qh.domRange,relative:qh.relative,exact:qh.exact,exactFromRange:w=>qh.exact(w.start,w.soffset,w.finish,w.foffset),getWin:w=>{const _=(I=>I.match({domRange:H=>Yt.fromDom(H.startContainer),relative:(H,Z)=>ir.getStart(H),exact:(H,Z,q,le)=>H}))(w);return Yt.fromDom(ps(_).dom.defaultView)},range:pl},xg=document.caretPositionFromPoint?(w,_,I)=>{var H,Z;return ae.from((Z=(H=w.dom).caretPositionFromPoint)===null||Z===void 0?void 0:Z.call(H,_,I)).bind(q=>{if(q.offsetNode===null)return ae.none();const le=w.dom.createRange();return le.setStart(q.offsetNode,q.offset),le.collapse(),ae.some(le)})}:document.caretRangeFromPoint?(w,_,I)=>{var H,Z;return ae.from((Z=(H=w.dom).caretRangeFromPoint)===null||Z===void 0?void 0:Z.call(H,_,I))}:ae.none,Z0=(w,_)=>{const I=yo(w);return I==="input"?ir.after(w):Ae(["br","img"],I)?_===0?ir.before(w):ir.after(w):ir.on(w,_)},q0=w=>ae.from(w.getSelection()),sp=(w,_)=>{q0(w).each(I=>{I.removeAllRanges(),I.addRange(_)})},zv=(w,_,I,H,Z)=>{const q=z0(w,_,I,H,Z);sp(w,q)},Y1=(w,_)=>LS(w,_).match({ltr:(I,H,Z,q)=>{zv(w,I,H,Z,q)},rtl:(I,H,Z,q)=>{q0(w).each(le=>{if(le.setBaseAndExtent)le.setBaseAndExtent(I.dom,H,Z.dom,q);else if(le.extend)try{((ue,_e,Be,Ye,Me,He)=>{_e.collapse(Be.dom,Ye),_e.extend(Me.dom,He)})(0,le,I,H,Z,q)}catch{zv(w,Z,q,I,H)}else zv(w,Z,q,I,H)})}}),yg=(w,_,I,H,Z)=>{const q=((le,ue,_e,Be)=>{const Ye=Z0(le,ue),Me=Z0(_e,Be);return du.relative(Ye,Me)})(_,I,H,Z);Y1(w,q)},ba=(w,_,I)=>{const H=((Z,q)=>{const le=Z.fold(ir.before,Z0,ir.after),ue=q.fold(ir.before,Z0,ir.after);return du.relative(le,ue)})(_,I);Y1(w,H)},X1=w=>{if(w.rangeCount>0){const _=w.getRangeAt(0),I=w.getRangeAt(w.rangeCount-1);return ae.some(pl(Yt.fromDom(_.startContainer),_.startOffset,Yt.fromDom(I.endContainer),I.endOffset))}return ae.none()},WT=w=>{if(w.anchorNode===null||w.focusNode===null)return X1(w);{const _=Yt.fromDom(w.anchorNode),I=Yt.fromDom(w.focusNode);return((H,Z,q,le)=>{const ue=((Be,Ye,Me,He)=>{const je=aa(Be).dom.createRange();return je.setStart(Be.dom,Ye),je.setEnd(Me.dom,He),je})(H,Z,q,le),_e=bs(H,q)&&Z===le;return ue.collapsed&&!_e})(_,w.anchorOffset,I,w.focusOffset)?ae.some(pl(_,w.anchorOffset,I,w.focusOffset)):X1(w)}},Gv=(w,_,I=!0)=>{const H=(I?Ov:Xm)(w,_);sp(w,H)},NS=w=>(_=>q0(_).filter(I=>I.rangeCount>0).bind(WT))(w).map(_=>du.exact(_.start,_.soffset,_.finish,_.foffset)),wg=w=>({elementFromPoint:(_,I)=>Yt.fromPoint(Yt.fromDom(w.document),_,I),getRect:_=>_.dom.getBoundingClientRect(),getRangedRect:(_,I,H,Z)=>{const q=du.exact(_,I,H,Z);return((le,ue)=>(_e=>{const Be=_e.getClientRects(),Ye=Be.length>0?Be[0]:_e.getBoundingClientRect();return Ye.width>0||Ye.height>0?ae.some(Ye).map(V1):ae.none()})(z1(le,ue)))(w,q)},getSelection:()=>NS(w).map(_=>$u(w,_)),fromSitus:_=>{const I=du.relative(_.start,_.finish);return $u(w,I)},situsFromPoint:(_,I)=>((H,Z,q)=>((le,ue,_e)=>{const Be=Yt.fromDom(le.document);return xg(Be,ue,_e).map(Ye=>pl(Yt.fromDom(Ye.startContainer),Ye.startOffset,Yt.fromDom(Ye.endContainer),Ye.endOffset))})(H,Z,q))(w,_,I).map(H=>gg(H.start,H.soffset,H.finish,H.foffset)),clearSelection:()=>{(_=>{q0(_).each(I=>I.removeAllRanges())})(w)},collapseSelection:(_=!1)=>{NS(w).each(I=>I.fold(H=>H.collapse(_),(H,Z)=>{const q=_?H:Z;ba(w,q,q)},(H,Z,q,le)=>{const ue=_?H:q,_e=_?Z:le;yg(w,ue,_e,ue,_e)}))},setSelection:_=>{yg(w,_.start,_.soffset,_.finish,_.foffset)},setRelativeSelection:(_,I)=>{ba(w,_,I)},selectNode:_=>{Gv(w,_,!1)},selectContents:_=>{Gv(w,_)},getInnerHeight:()=>w.innerHeight,getScrollY:()=>(_=>{const I=_!==void 0?_.dom:document,H=I.body.scrollLeft||I.documentElement.scrollLeft,Z=I.body.scrollTop||I.documentElement.scrollTop;return M(H,Z)})(Yt.fromDom(w.document)).top,scrollBy:(_,I)=>{((H,Z,q)=>{const le=(q!==void 0?q.dom:document).defaultView;le&&le.scrollBy(H,Z)})(_,I,Yt.fromDom(w.document))}}),Yh=(w,_)=>({rows:w,cols:_}),Wv=w=>Na(w,Cn).exists(Yn),jv=(w,_)=>Wv(w)||Wv(_),FS=w=>w.dom.classList!==void 0,Kv=(w,_)=>((I,H,Z)=>{const q=((le,ue)=>{const _e=At(le,ue);return _e===void 0||_e===""?[]:_e.split(" ")})(I,H).concat([Z]);return Pt(I,H,q.join(" ")),!0})(w,"class",_),Xh=(w,_)=>{FS(w)?w.dom.classList.add(_):Kv(w,_)},Zv=(w,_)=>FS(w)&&w.dom.classList.contains(_),BS=()=>({tag:"none"}),cd=w=>({tag:"multiple",elements:w}),$S=w=>({tag:"single",element:w}),Y0=w=>{const _=Yt.fromDom((ue=>{if(Ur()&&k(ue.target)){const _e=Yt.fromDom(ue.target);if(Nn(_e)&&k(_e.dom.shadowRoot)&&ue.composed&&ue.composedPath){const Be=ue.composedPath();if(Be)return vt(Be)}}return ae.from(ue.target)})(w).getOr(w.target)),I=()=>w.stopPropagation(),H=()=>w.preventDefault(),Z=(q=H,le=I,(...ue)=>q(le.apply(null,ue)));var q,le;return((ue,_e,Be,Ye,Me,He,je)=>({target:ue,x:_e,y:Be,stop:Ye,prevent:Me,kill:He,raw:je}))(_,w.clientX,w.clientY,I,H,Z,w)},HS=(w,_,I,H)=>{w.dom.removeEventListener(_,I,H)},US=me,rp=(w,_,I)=>((H,Z,q,le)=>((ue,_e,Be,Ye,Me)=>{const He=((je,ct)=>ut=>{je(ut)&&ct(Y0(ut))})(Be,Ye);return ue.dom.addEventListener(_e,He,Me),{unbind:j(HS,ue,_e,He,Me)}})(H,Z,q,le,!1))(w,_,US,I),ip=Y0,qv=w=>!Zv(Yt.fromDom(w.target),"ephox-snooker-resizer-bar"),jT=(w,_)=>{const I=(Z=rs.selectedSelector,{get:()=>Fd(Yt.fromDom(w.getBody()),Z).fold(()=>fi(Vr(w),Jn(w)).fold(BS,$S),cd)}),H=((q,le,ue)=>{const _e=He=>{In(He,q.selected),In(He,q.firstSelected),In(He,q.lastSelected)},Be=He=>{Pt(He,q.selected,"1")},Ye=He=>{Me(He),ue()},Me=He=>{const je=Aa(He,`${q.selectedSelector},${q.firstSelectedSelector},${q.lastSelectedSelector}`);De(je,_e)};return{clearBeforeUpdate:Me,clear:Ye,selectRange:(He,je,ct,ut)=>{Ye(He),De(je,Be),Pt(ct,q.firstSelected,"1"),Pt(ut,q.lastSelected,"1"),le(je,ct,ut)},selectedSelector:q.selectedSelector,firstSelectedSelector:q.firstSelectedSelector,lastSelectedSelector:q.lastSelectedSelector}})(rs,(q,le,ue)=>{Sn(le).each(_e=>{const Be=O(q,je=>je.dom),Ye=ku(w),Me=Ua(z,Yt.fromDom(w.getDoc()),Ye),He=((je,ct,ut)=>{const Ht=Ys(je);return hl(Ht,ct).map(Gt=>{const Vt=Um(Ht,ut,!1),{rows:jt}=$s(Vt),un=((vn,go)=>{const eo=vn.slice(0,go[go.length-1].row+1),Hs=hi(eo);return qe(Hs,lo=>{const is=lo.cells.slice(0,go[go.length-1].column+1);return O(is,Oo=>Oo.element)})})(jt,Gt),at=((vn,go)=>{const eo=vn.slice(go[0].row+go[0].rowspan-1,vn.length),Hs=hi(eo);return qe(Hs,lo=>{const is=lo.cells.slice(go[0].column+go[0].colspan-1,lo.cells.length);return O(is,Oo=>Oo.element)})})(jt,Gt);return{upOrLeftCells:un,downOrRightCells:at}})})(_e,{selection:ad(w)},Me).map(je=>An(je,ct=>O(ct,ut=>ut.dom))).getOrUndefined();((je,ct,ut,Ht,Gt)=>{je.dispatch("TableSelectionChange",{cells:ct,start:ut,finish:Ht,otherCells:Gt})})(w,Be,le.dom,ue.dom,He)})},()=>(q=>{q.dispatch("TableSelectionClear")})(w));var Z;return w.on("init",q=>{const le=w.getWin(),ue=$o(w),_e=Jn(w),Be=((ut,Ht,Gt,Vt)=>{const jt=((un,at,vn,go)=>{const eo=op(),Hs=eo.clear,lo=is=>{eo.on(Oo=>{go.clearBeforeUpdate(at),Z1(is.target,vn).each(ur=>{lu(Oo,ur,vn).each(na=>{const gl=na.boxes.getOr([]);if(gl.length===1){const Wa=gl[0],jc=Co(Wa)==="false",Gd=Ql(Kt(is.target),Wa,bs);jc&&Gd&&(go.selectRange(at,gl,Wa,Wa),un.selectContents(Wa))}else gl.length>1&&(go.selectRange(at,gl,na.start,na.finish),un.selectContents(ur))})})})};return{clearstate:Hs,mousedown:is=>{go.clear(at),Z1(is.target,vn).filter(Uv).each(eo.set)},mouseover:is=>{lo(is)},mouseup:is=>{lo(is),Hs()}}})(wg(ut),Ht,Gt,Vt);return{clearstate:jt.clearstate,mousedown:jt.mousedown,mouseover:jt.mouseover,mouseup:jt.mouseup}})(le,ue,_e,H),Ye=((ut,Ht,Gt,Vt)=>{const jt=wg(ut),un=()=>(Vt.clear(Ht),ae.none());return{keydown:(at,vn,go,eo,Hs,lo)=>{const is=at.raw,Oo=is.which,ur=is.shiftKey===!0;return eg(Ht,Vt.selectedSelector).fold(()=>(Wc(Oo)&&!ur&&Vt.clearBeforeUpdate(Ht),Wc(Oo)&&ur&&!jv(vn,eo)?ae.none:Jf(Oo)&&ur?j(MS,jt,Ht,Gt,j0,eo,vn,Vt.selectRange):K0(Oo)&&ur?j(MS,jt,Ht,Gt,q1,eo,vn,Vt.selectRange):Jf(Oo)?j(Xf,jt,Gt,j0,eo,vn,K1):K0(Oo)?j(Xf,jt,Gt,q1,eo,vn,Vu):ae.none),gl=>{const Wa=jc=>()=>J(jc,bl=>((eh,th,dp,ey,nh)=>kl(ey,eh,th,nh.firstSelectedSelector,nh.lastSelectedSelector).map(fp=>(nh.clearBeforeUpdate(dp),nh.selectRange(dp,fp.boxes,fp.start,fp.finish),fp.boxes)))(bl.rows,bl.cols,Ht,gl,Vt)).fold(()=>Sc(Ht,Vt.firstSelectedSelector,Vt.lastSelectedSelector).map(bl=>{const eh=Jf(Oo)||lo.isForward(Oo)?ir.after:ir.before;return jt.setRelativeSelection(ir.on(bl.first,0),eh(bl.table)),Vt.clear(Ht),Jr(ae.none(),!0)}),bl=>ae.some(Jr(ae.none(),!0)));return Wc(Oo)&&ur&&!jv(vn,eo)?ae.none:Jf(Oo)&&ur?Wa([Yh(1,0)]):K0(Oo)&&ur?Wa([Yh(-1,0)]):lo.isBackward(Oo)&&ur?Wa([Yh(0,-1),Yh(-1,0)]):lo.isForward(Oo)&&ur?Wa([Yh(0,1),Yh(1,0)]):Wc(Oo)&&!ur?un:ae.none})()},keyup:(at,vn,go,eo,Hs)=>eg(Ht,Vt.selectedSelector).fold(()=>{const lo=at.raw,is=lo.which;return lo.shiftKey===!0&&Wc(is)&&jv(vn,eo)?((Oo,ur,na,gl,Wa,jc,Gd)=>bs(na,Wa)&&gl===jc?ae.none():yr(na,"td,th",ur).bind(bl=>yr(Wa,"td,th",ur).bind(eh=>Qm(Oo,ur,bl,eh,Gd))))(Ht,Gt,vn,go,eo,Hs,Vt.selectRange):ae.none()},ae.none)}})(le,ue,_e,H),Me=((ut,Ht,Gt,Vt)=>{const jt=wg(ut);return(un,at)=>{Vt.clearBeforeUpdate(Ht),lu(un,at,Gt).each(vn=>{const go=vn.boxes.getOr([]);Vt.selectRange(Ht,go,vn.start,vn.finish),jt.selectContents(at),jt.collapseSelection()})}})(le,ue,_e,H);w.on("TableSelectorChange",ut=>Me(ut.start,ut.finish));const He=(ut,Ht)=>{(Gt=>Gt.raw.shiftKey===!0)(ut)&&(Ht.kill&&ut.kill(),Ht.selection.each(Gt=>{const Vt=du.relative(Gt.start,Gt.finish),jt=z1(le,Vt);w.selection.setRng(jt)}))},je=ut=>ut.button===0,ct=(()=>{const ut=W0(Yt.fromDom(ue)),Ht=W0(0);return{touchEnd:Gt=>{const Vt=Yt.fromDom(Gt.target);if(as("td")(Vt)||as("th")(Vt)){const jt=ut.get(),un=Ht.get();bs(jt,Vt)&&Gt.timeStamp-un<300&&(Gt.preventDefault(),Me(Vt,Vt))}ut.set(Vt),Ht.set(Gt.timeStamp)}}})();w.on("dragstart",ut=>{Be.clearstate()}),w.on("mousedown",ut=>{je(ut)&&qv(ut)&&Be.mousedown(ip(ut))}),w.on("mouseover",ut=>{var Ht;(Ht=ut).buttons!==void 0&&!(1&Ht.buttons)||!qv(ut)||Be.mouseover(ip(ut))}),w.on("mouseup",ut=>{je(ut)&&qv(ut)&&Be.mouseup(ip(ut))}),w.on("touchend",ct.touchEnd),w.on("keyup",ut=>{const Ht=ip(ut);if(Ht.raw.shiftKey&&Wc(Ht.raw.which)){const Gt=w.selection.getRng(),Vt=Yt.fromDom(Gt.startContainer),jt=Yt.fromDom(Gt.endContainer);Ye.keyup(Ht,Vt,Gt.startOffset,jt,Gt.endOffset).each(un=>{He(Ht,un)})}}),w.on("keydown",ut=>{const Ht=ip(ut);_.hide();const Gt=w.selection.getRng(),Vt=Yt.fromDom(Gt.startContainer),jt=Yt.fromDom(Gt.endContainer),un=cl(Vv,GT)(Yt.fromDom(w.selection.getStart()));Ye.keydown(Ht,Vt,Gt.startOffset,jt,Gt.endOffset,un).each(at=>{He(Ht,at)}),_.show()}),w.on("NodeChange",()=>{const ut=w.selection,Ht=Yt.fromDom(ut.getStart()),Gt=Yt.fromDom(ut.getEnd());Qp(Sn,[Ht,Gt]).fold(()=>H.clear(ue),z)})}),w.on("PreInit",()=>{w.serializer.addTempAttr(rs.firstSelected),w.serializer.addTempAttr(rs.lastSelected)}),{getSelectedCells:()=>((q,le,ue,_e)=>{switch(q.tag){case"none":return le();case"single":return(Be=>[Be.dom])(q.element);case"multiple":return(Be=>O(Be,Ye=>Ye.dom))(q.elements)}})(I.get(),$([])),clearSelectedCells:q=>H.clear(Yt.fromDom(q))}},zu=w=>{let _=[];return{bind:I=>{if(I===void 0)throw new Error("Event bind error: undefined handler");_.push(I)},unbind:I=>{_=st(_,H=>H!==I)},trigger:(...I)=>{const H={};De(w,(Z,q)=>{H[Z]=I[q]}),De(_,Z=>{Z(H)})}}},ap=w=>({registry:An(w,_=>({bind:_.bind,unbind:_.unbind})),trigger:An(w,_=>_.trigger)}),Qf=w=>w.slice(0).sort(),VS=(w,_)=>{const I=st(_,H=>!Ae(w,H));I.length>0&&(H=>{throw new Error("Unsupported keys for object: "+Qf(H).join(", "))})(I)},lp=w=>((_,I)=>((H,Z,q)=>{if(Z.length===0)throw new Error("You must specify at least one required field.");return((le,ue)=>{if(!g(ue))throw new Error("The "+le+" fields must be an array. Was: "+ue+".");De(ue,_e=>{if(!u(_e))throw new Error("The value "+_e+" in the "+le+" fields was not a string.")})})("required",Z),(le=>{const ue=Qf(le);Dt(ue,(_e,Be)=>Be<ue.length-1&&_e===ue[Be+1]).each(_e=>{throw new Error("The field: "+_e+" occurs more than once in the combined fields: ["+ue.join(", ")+"].")})})(Z),le=>{const ue=Bn(le);mt(Z,Be=>Ae(ue,Be))||((Be,Ye)=>{throw new Error("All required keys ("+Qf(Be).join(", ")+") were not specified. Specified keys were: "+Qf(Ye).join(", ")+".")})(Z,ue),H(Z,ue);const _e=st(Z,Be=>!q.validate(le[Be],Be));return _e.length>0&&((Be,Ye)=>{throw new Error("All values need to be of type: "+Ye+". Keys ("+Qf(Be).join(", ")+") were not.")})(_e,q.label),le}})(_,I,{validate:R,label:"function"}))(VS,w),tl=lp(["compare","extract","mutate","sink"]),Yv=lp(["element","start","stop","destroy"]),Jh=lp(["forceDrop","drop","move","delayDrop"]),cp=()=>{const w=(()=>{const H=ap({move:zu(["info"])});return{onEvent:z,reset:z,events:H.registry}})(),_=(()=>{let H=ae.none();const Z=ap({move:zu(["info"])});return{onEvent:(q,le)=>{le.extract(q).each(ue=>{((Be,Ye)=>{const Me=H.map(He=>Be.compare(He,Ye));return H=ae.some(Ye),Me})(le,ue).each(Be=>{Z.trigger.move(Be)})})},reset:()=>{H=ae.none()},events:Z.registry}})();let I=w;return{on:()=>{I.reset(),I=_},off:()=>{I.reset(),I=w},isOn:()=>I===_,onEvent:(H,Z)=>{I.onEvent(H,Z)},events:_.events}},X0=w=>{const _=w.replace(/\./g,"-");return{resolve:I=>_+"-"+I}},J0=X0("ephox-dragster").resolve;var Xv=tl({compare:(w,_)=>M(_.left-w.left,_.top-w.top),extract:w=>ae.some(M(w.x,w.y)),sink:(w,_)=>{const I=(ue=>{const _e={layerClass:J0("blocker"),...ue},Be=Yt.fromTag("div");return Pt(Be,"role","presentation"),ec(Be,{position:"fixed",left:"0px",top:"0px",width:"100%",height:"100%"}),Xh(Be,J0("blocker")),Xh(Be,_e.layerClass),{element:$(Be),destroy:()=>{zn(Be)}}})(_),H=rp(I.element(),"mousedown",w.forceDrop),Z=rp(I.element(),"mouseup",w.drop),q=rp(I.element(),"mousemove",w.move),le=rp(I.element(),"mouseout",w.delayDrop);return Yv({element:I.element,start:ue=>{Nt(ue,I.element())},stop:()=>{zn(I.element())},destroy:()=>{I.destroy(),Z.unbind(),q.unbind(),le.unbind(),H.unbind()}})},mutate:(w,_)=>{w.mutate(_.left,_.top)}});const Ef=X0("ephox-snooker").resolve,Jv=Ef("resizer-bar"),Qv=Ef("resizer-rows"),oc=Ef("resizer-cols"),Cf=w=>{const _=Aa(w.parent(),"."+Jv);De(_,zn)},ex=(w,_,I)=>{const H=w.origin();De(_,Z=>{Z.each(q=>{const le=I(H,q);Xh(le,Jv),Nt(w.parent(),le)})})},Et=(w,_,I,H,Z)=>{const q=Ve(I),le=_.isResizable,ue=H.length>0?Sl.positions(H,I):[],_e=ue.length>0?((Me,He)=>qe(Me.all,(je,ct)=>He(je.element)?[ct]:[]))(w,le):[];((Me,He,je,ct)=>{ex(Me,He,(ut,Ht)=>{const Gt=((Vt,jt,un,at,vn)=>{const go=Yt.fromTag("div");return ec(go,{position:"absolute",left:jt+"px",top:un-3.5+"px",height:"7px",width:at+"px"}),gn(go,{"data-row":Vt,role:"presentation"}),go})(Ht.row,je.left-ut.left,Ht.y-ut.top,ct);return Xh(Gt,Qv),Gt})})(_,st(ue,(Me,He)=>ve(_e,je=>He===je)),q,$l(I));const Be=Z.length>0?Vs.positions(Z,I):[],Ye=Be.length>0?((Me,He)=>{const je=[];return Oe(Me.grid.columns,ct=>{od(Me,ct).map(ut=>ut.element).forall(He)&&je.push(ct)}),st(je,ct=>{const ut=ho(Me,Ht=>Ht.column===ct);return mt(ut,Ht=>He(Ht.element))})})(w,le):[];((Me,He,je,ct)=>{ex(Me,He,(ut,Ht)=>{const Gt=((Vt,jt,un,at,vn)=>{const go=Yt.fromTag("div");return ec(go,{position:"absolute",left:jt-3.5+"px",top:un+"px",height:vn+"px",width:"7px"}),gn(go,{"data-column":Vt,role:"presentation"}),go})(Ht.col,Ht.x-ut.left,je.top-ut.top,0,ct);return Xh(Gt,oc),Gt})})(_,st(Be,(Me,He)=>ve(Ye,je=>He===je)),q,pc(I))},up=(w,_)=>{if(Cf(w),w.isResizable(_)){const I=Ys(_),H=os(I),Z=zf(I);Et(I,w,_,H,Z)}},zS=(w,_)=>{const I=Aa(w.parent(),"."+Jv);De(I,_)},GS=w=>{zS(w,_=>{ei(_,"display","none")})},tx=w=>{zS(w,_=>{ei(_,"display","block")})},ud=Ef("resizer-bar-dragging"),J1=w=>{const _=(()=>{const Me=ap({drag:zu(["xDelta","yDelta","target"])});let He=ae.none();const je=(()=>{const ct=ap({drag:zu(["xDelta","yDelta"])});return{mutate:(ut,Ht)=>{ct.trigger.drag(ut,Ht)},events:ct.registry}})();return je.events.drag.bind(ct=>{He.each(ut=>{Me.trigger.drag(ct.xDelta,ct.yDelta,ut)})}),{assign:ct=>{He=ae.some(ct)},get:()=>He,mutate:je.mutate,events:Me.registry}})(),I=((Me,He={})=>{var je;return((ct,ut,Ht)=>{let Gt=!1;const Vt=ap({start:zu([]),stop:zu([])}),jt=cp(),un=()=>{go.stop(),jt.isOn()&&(jt.off(),Vt.trigger.stop())},at=((eo,Hs)=>{let lo=null;const is=()=>{b(lo)||(clearTimeout(lo),lo=null)};return{cancel:is,throttle:(...Oo)=>{is(),lo=setTimeout(()=>{lo=null,eo.apply(null,Oo)},200)}}})(un);jt.events.move.bind(eo=>{ut.mutate(ct,eo.info)});const vn=eo=>(...Hs)=>{Gt&&eo.apply(null,Hs)},go=ut.sink(Jh({forceDrop:un,drop:vn(un),move:vn(eo=>{at.cancel(),jt.onEvent(eo,ut)}),delayDrop:vn(at.throttle)}),Ht);return{element:go.element,go:eo=>{go.start(eo),jt.on(),Vt.trigger.start()},on:()=>{Gt=!0},off:()=>{Gt=!1},isActive:()=>Gt,destroy:()=>{go.destroy()},events:Vt.registry}})(Me,(je=He.mode)!==null&&je!==void 0?je:Xv,He)})(_,{});let H=ae.none();const Z=(Me,He)=>ae.from(At(Me,He));_.events.drag.bind(Me=>{Z(Me.target,"data-row").each(He=>{const je=_u(Me.target,"top");ei(Me.target,"top",je+Me.yDelta+"px")}),Z(Me.target,"data-column").each(He=>{const je=_u(Me.target,"left");ei(Me.target,"left",je+Me.xDelta+"px")})});const q=(Me,He)=>_u(Me,He)-il(Me,"data-initial-"+He,0);I.events.stop.bind(()=>{_.get().each(Me=>{H.each(He=>{Z(Me,"data-row").each(je=>{const ct=q(Me,"top");In(Me,"data-initial-top"),Ye.trigger.adjustHeight(He,ct,parseInt(je,10))}),Z(Me,"data-column").each(je=>{const ct=q(Me,"left");In(Me,"data-initial-left"),Ye.trigger.adjustWidth(He,ct,parseInt(je,10))}),up(w,He)})})});const le=(Me,He)=>{Ye.trigger.startAdjust(),_.assign(Me),Pt(Me,"data-initial-"+He,_u(Me,He)),Xh(Me,ud),ei(Me,"opacity","0.2"),I.go(w.parent())},ue=rp(w.parent(),"mousedown",Me=>{var He;He=Me.target,Zv(He,Qv)&&le(Me.target,"top"),(je=>Zv(je,oc))(Me.target)&&le(Me.target,"left")}),_e=Me=>bs(Me,w.view()),Be=rp(w.view(),"mouseover",Me=>{var He;(He=Me.target,yr(He,"table",_e).filter(Yn)).fold(()=>{li(Me.target)&&Cf(w)},je=>{I.isActive()&&(H=ae.some(je),up(w,je))})}),Ye=ap({adjustHeight:zu(["table","delta","row"]),adjustWidth:zu(["table","delta","column"]),startAdjust:zu([])});return{destroy:()=>{ue.unbind(),Be.unbind(),I.destroy(),Cf(w)},refresh:Me=>{up(w,Me)},on:I.on,off:I.off,hideBars:j(GS,w),showBars:j(tx,w),events:Ye.registry}},nx=w=>k(w)&&w.nodeName==="TABLE",Q0="bar-",Q1=w=>At(w,"data-mce-resize")!=="false",KT=w=>{const _=op(),I=op(),H=op();let Z,q,le,ue;const _e=Me=>Qi(w,Me),Be=()=>mf(w)?Ud():pS(),Ye=(Me,He,je,ct)=>{const ut=(Vt=>{return Eo(jt=Vt,"corner-")?((un,at)=>un.substring(7))(jt):jt;var jt})(He),Ht=Mc(ut,"e"),Gt=Eo(ut,"n");if(q===""&&Nu(Me),ue===""&&(Vt=>{const jt=(un=>Md(un)+"px")(Vt);js(Vt,ae.none(),ae.some(jt)),Gi(Vt)})(Me),je!==Z&&q!==""){ei(Me,"width",q);const Vt=Be(),jt=_e(Me),un=mf(w)||Ht?(at=>sg(at).columns)(Me)-1:0;Iu(Me,je-Z,un,Vt,jt)}else if((Vt=>/^(\d+(\.\d+)?)%$/.test(Vt))(q)){const Vt=parseFloat(q.replace("%",""));ei(Me,"width",je*Vt/Z+"%")}if((Vt=>/^(\d+(\.\d+)?)px$/.test(Vt))(q)&&(Vt=>{const jt=Ys(Vt);nr(jt)||De(Tt(Vt),un=>{const at=Ro(un,"width");ei(un,"width",at),In(un,"width")})})(Me),ct!==le&&ue!==""){ei(Me,"height",ue);const Vt=Gt?0:(jt=>sg(jt).rows)(Me)-1;D1(Me,ct-le,Vt)}};return w.on("init",()=>{const Me=((He,je)=>He.inline?((ct,ut,Ht)=>({parent:$(ut),view:$(ct),origin:$(M(0,0)),isResizable:Ht}))(Yt.fromDom(He.getBody()),(()=>{const ct=Yt.fromTag("div");return ec(ct,{position:"static",height:"0",width:"0",padding:"0",margin:"0",border:"0"}),Nt(Qc(Yt.fromDom(document)),ct),ct})(),je):((ct,ut)=>{const Ht=jo(ct)?(Gt=>Yt.fromDom(ps(Gt).dom.documentElement))(ct):ct;return{parent:$(Ht),view:$(ct),origin:$(M(0,0)),isResizable:ut}})(Yt.fromDom(He.getDoc()),je))(w,Q1);if(H.set(Me),(He=>{const je=He.options.get("object_resizing");return Ae(je.split(","),"table")})(w)&&N(w)){const He=((je,ct,ut)=>{const Ht=Sl,Gt=Vs,Vt=J1(je),jt=ap({beforeResize:zu(["table","type"]),afterResize:zu(["table","type"]),startDrag:zu([])});return Vt.events.adjustHeight.bind(un=>{const at=un.table;jt.trigger.beforeResize(at,"row");const vn=Ht.delta(un.delta,at);D1(at,vn,un.row),jt.trigger.afterResize(at,"row")}),Vt.events.startAdjust.bind(un=>{jt.trigger.startDrag()}),Vt.events.adjustWidth.bind(un=>{const at=un.table;jt.trigger.beforeResize(at,"col");const vn=Gt.delta(un.delta,at),go=ut(at);Iu(at,vn,un.column,ct,go),jt.trigger.afterResize(at,"col")}),{on:Vt.on,off:Vt.off,refreshBars:Vt.refresh,hideBars:Vt.hideBars,showBars:Vt.showBars,destroy:Vt.destroy,events:jt.registry}})(Me,Be(),_e);He.on(),He.events.startDrag.bind(je=>{_.set(w.selection.getRng())}),He.events.beforeResize.bind(je=>{const ct=je.table.dom;((ut,Ht,Gt,Vt,jt)=>{ut.dispatch("ObjectResizeStart",{target:Ht,width:Gt,height:Vt,origin:jt})})(w,ct,Va(ct),Dl(ct),Q0+je.type)}),He.events.afterResize.bind(je=>{const ct=je.table,ut=ct.dom;mr(ct),_.on(Ht=>{w.selection.setRng(Ht),w.focus()}),((Ht,Gt,Vt,jt,un)=>{Ht.dispatch("ObjectResized",{target:Gt,width:Vt,height:jt,origin:un})})(w,ut,Va(ut),Dl(ut),Q0+je.type),w.undoManager.add()}),I.set(He)}}),w.on("ObjectResizeStart",Me=>{const He=Me.target;if(nx(He)){const je=Yt.fromDom(He);De(w.dom.select(".mce-clonedresizable"),ct=>{w.dom.addClass(ct,"mce-"+Gc(w)+"-columns")}),!B1(je)&&Po(w)?uu(je):!hg(je)&&Qn(w)&&Nu(je),Gh(je)&&Eo(Me.origin,Q0)&&Nu(je),Z=Me.width,q=Js(w)?"":cn(w,He).getOr(""),le=Me.height,ue=Ln(w,He).getOr("")}}),w.on("ObjectResized",Me=>{const He=Me.target;if(nx(He)){const je=Yt.fromDom(He),ct=Me.origin;(ut=>Eo(ut,"corner-"))(ct)&&Ye(je,ct,Me.width,Me.height),mr(je),Pr(w,je.dom,H0)}}),w.on("SwitchMode",()=>{I.on(Me=>{w.mode.isReadOnly()?Me.hideBars():Me.showBars()})}),w.on("dragstart dragend",Me=>{I.on(He=>{Me.type==="dragstart"?(He.hideBars(),He.off()):(He.on(),He.showBars())})}),w.on("remove",()=>{I.on(Me=>{Me.destroy()}),H.on(Me=>{((He,je)=>{He.inline&&zn(je.parent())})(w,Me)})}),{refresh:Me=>{I.on(He=>He.refreshBars(Yt.fromDom(Me)))},hide:()=>{I.on(Me=>Me.hideBars())},show:()=>{I.on(Me=>Me.showBars())}}},WS=w=>{(Z=>{const q=Z.options.register;q("table_clone_elements",{processor:"string[]"}),q("table_use_colgroups",{processor:"boolean",default:!0}),q("table_header_type",{processor:le=>{const ue=Ae(["section","cells","sectionCells","auto"],le);return ue?{value:le,valid:ue}:{valid:!1,message:"Must be one of: section, cells, sectionCells or auto."}},default:"section"}),q("table_sizing_mode",{processor:"string",default:"auto"}),q("table_default_attributes",{processor:"object",default:{border:"1"}}),q("table_default_styles",{processor:"object",default:{"border-collapse":"collapse"}}),q("table_column_resizing",{processor:le=>{const ue=Ae(["preservetable","resizetable"],le);return ue?{value:le,valid:ue}:{valid:!1,message:"Must be preservetable, or resizetable."}},default:"preservetable"}),q("table_resize_bars",{processor:"boolean",default:!0}),q("table_style_by_css",{processor:"boolean",default:!0}),q("table_merge_content_on_paste",{processor:"boolean",default:!0})})(w);const _=KT(w),I=jT(w,_),H=_c(w,_,I);return ea(w,H),((Z,q)=>{const le=Jn(Z),ue=_e=>fi(Vr(Z)).bind(Be=>Sn(Be,le).map(Ye=>{const Me=so(ad(Z),Ye,Be);return _e(Ye,Me)})).getOr("");Rn({mceTableRowType:()=>ue(q.getTableRowType),mceTableCellType:()=>ue(q.getTableCellType),mceTableColType:()=>ue(q.getTableColType)},(_e,Be)=>Z.addQueryValueHandler(Be,_e))})(w,H),Ws(w,H),{getSelectedCells:I.getSelectedCells,clearSelectedCells:I.clearSelectedCells}};l.add("dom",w=>({table:WS(w)}))})();tinymce.Resource.add("ui/default/skin.css",`.tox{box-shadow:none;box-sizing:content-box;color:#222f3e;cursor:auto;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:16px;font-style:normal;font-weight:400;line-height:normal;-webkit-tap-highlight-color:transparent;text-decoration:none;text-shadow:none;text-transform:none;vertical-align:initial;white-space:normal}.tox :not(svg):not(rect){box-sizing:inherit;color:inherit;cursor:inherit;direction:inherit;font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;line-height:inherit;-webkit-tap-highlight-color:inherit;text-align:inherit;text-decoration:inherit;text-shadow:inherit;text-transform:inherit;vertical-align:inherit;white-space:inherit}.tox :not(svg):not(rect){background:0 0;border:0;box-shadow:none;float:none;height:auto;margin:0;max-width:none;outline:0;padding:0;position:static;width:auto}.tox:not([dir=rtl]){direction:ltr;text-align:left}.tox[dir=rtl]{direction:rtl;text-align:right}.tox-tinymce{border:2px solid #eee;border-radius:10px;box-shadow:none;box-sizing:border-box;display:flex;flex-direction:column;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;overflow:hidden;position:relative;visibility:inherit!important}.tox.tox-tinymce-inline{border:none;box-shadow:none;overflow:initial}.tox.tox-tinymce-inline .tox-editor-container{overflow:initial}.tox.tox-tinymce-inline .tox-editor-header{background-color:#fff;border:2px solid #eee;border-radius:10px;box-shadow:none;overflow:hidden}.tox-tinymce-aux{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;z-index:1300}.tox-tinymce :focus,.tox-tinymce-aux :focus{outline:0}button::-moz-focus-inner{border:0}.tox[dir=rtl] .tox-icon--flip svg{transform:rotateY(180deg)}.tox .accessibility-issue__header{align-items:center;display:flex;margin-bottom:4px}.tox .accessibility-issue__description{align-items:stretch;border-radius:6px;display:flex;justify-content:space-between}.tox .accessibility-issue__description>div{padding-bottom:4px}.tox .accessibility-issue__description>div>div{align-items:center;display:flex;margin-bottom:4px}.tox .accessibility-issue__description>div>div .tox-icon svg{display:block}.tox .accessibility-issue__repair{margin-top:16px}.tox .tox-dialog__body-content .accessibility-issue--info .accessibility-issue__description{background-color:rgba(0,101,216,.1);color:#222f3e}.tox .tox-dialog__body-content .accessibility-issue--info .tox-form__group h2{color:#006ce7}.tox .tox-dialog__body-content .accessibility-issue--info .tox-icon svg{fill:#006ce7}.tox .tox-dialog__body-content .accessibility-issue--info a.tox-button--naked.tox-button--icon{background-color:#006ce7;color:#fff}.tox .tox-dialog__body-content .accessibility-issue--info a.tox-button--naked.tox-button--icon:focus,.tox .tox-dialog__body-content .accessibility-issue--info a.tox-button--naked.tox-button--icon:hover{background-color:#0060ce}.tox .tox-dialog__body-content .accessibility-issue--info a.tox-button--naked.tox-button--icon:active{background-color:#0054b4}.tox .tox-dialog__body-content .accessibility-issue--warn .accessibility-issue__description{background-color:rgba(255,165,0,.08);color:#222f3e}.tox .tox-dialog__body-content .accessibility-issue--warn .tox-form__group h2{color:#8f5d00}.tox .tox-dialog__body-content .accessibility-issue--warn .tox-icon svg{fill:#8f5d00}.tox .tox-dialog__body-content .accessibility-issue--warn a.tox-button--naked.tox-button--icon{background-color:#ffe89d;color:#222f3e}.tox .tox-dialog__body-content .accessibility-issue--warn a.tox-button--naked.tox-button--icon:focus,.tox .tox-dialog__body-content .accessibility-issue--warn a.tox-button--naked.tox-button--icon:hover{background-color:#f2d574;color:#222f3e}.tox .tox-dialog__body-content .accessibility-issue--warn a.tox-button--naked.tox-button--icon:active{background-color:#e8c657;color:#222f3e}.tox .tox-dialog__body-content .accessibility-issue--error .accessibility-issue__description{background-color:rgba(204,0,0,.1);color:#222f3e}.tox .tox-dialog__body-content .accessibility-issue--error .tox-form__group h2{color:#c00}.tox .tox-dialog__body-content .accessibility-issue--error .tox-icon svg{fill:#c00}.tox .tox-dialog__body-content .accessibility-issue--error a.tox-button--naked.tox-button--icon{background-color:#f2bfbf;color:#222f3e}.tox .tox-dialog__body-content .accessibility-issue--error a.tox-button--naked.tox-button--icon:focus,.tox .tox-dialog__body-content .accessibility-issue--error a.tox-button--naked.tox-button--icon:hover{background-color:#e9a4a4;color:#222f3e}.tox .tox-dialog__body-content .accessibility-issue--error a.tox-button--naked.tox-button--icon:active{background-color:#ee9494;color:#222f3e}.tox .tox-dialog__body-content .accessibility-issue--success .accessibility-issue__description{background-color:rgba(120,171,70,.1);color:#222f3e}.tox .tox-dialog__body-content .accessibility-issue--success .accessibility-issue__description>:last-child{display:none}.tox .tox-dialog__body-content .accessibility-issue--success .tox-form__group h2{color:#527530}.tox .tox-dialog__body-content .accessibility-issue--success .tox-icon svg{fill:#527530}.tox .tox-dialog__body-content .accessibility-issue__header .tox-form__group h1,.tox .tox-dialog__body-content .tox-form__group .accessibility-issue__description h2{font-size:14px;margin-top:0}.tox:not([dir=rtl]) .tox-dialog__body-content .accessibility-issue__header .tox-button{margin-left:4px}.tox:not([dir=rtl]) .tox-dialog__body-content .accessibility-issue__header>:nth-last-child(2){margin-left:auto}.tox:not([dir=rtl]) .tox-dialog__body-content .accessibility-issue__description{padding:4px 4px 4px 8px}.tox[dir=rtl] .tox-dialog__body-content .accessibility-issue__header .tox-button{margin-right:4px}.tox[dir=rtl] .tox-dialog__body-content .accessibility-issue__header>:nth-last-child(2){margin-right:auto}.tox[dir=rtl] .tox-dialog__body-content .accessibility-issue__description{padding:4px 8px 4px 4px}.tox .mce-codemirror{background:#fff;bottom:0;font-size:13px;left:0;position:absolute;right:0;top:0;z-index:1}.tox .mce-codemirror.tox-inline-codemirror{margin:8px;position:absolute}.tox .tox-advtemplate .tox-form__grid{flex:1}.tox .tox-advtemplate .tox-form__grid>div:first-child{display:flex;flex-direction:column;width:30%}.tox .tox-advtemplate .tox-form__grid>div:first-child>div:nth-child(2){flex-basis:0;flex-grow:1;overflow:auto}@media only screen and (max-width:767px){body:not(.tox-force-desktop) .tox .tox-advtemplate .tox-form__grid>div:first-child{width:100%}}.tox .tox-advtemplate iframe{border-color:#eee;border-radius:10px;border-style:solid;border-width:1px;margin:0 10px}.tox .tox-anchorbar{display:flex;flex:0 0 auto}.tox .tox-bottom-anchorbar{display:flex;flex:0 0 auto}.tox .tox-bar{display:flex;flex:0 0 auto}.tox .tox-button{background-color:#006ce7;background-image:none;background-position:0 0;background-repeat:repeat;border-color:#006ce7;border-radius:6px;border-style:solid;border-width:1px;box-shadow:none;box-sizing:border-box;color:#fff;cursor:pointer;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:14px;font-style:normal;font-weight:700;letter-spacing:normal;line-height:24px;margin:0;outline:0;padding:4px 16px;position:relative;text-align:center;text-decoration:none;text-transform:none;white-space:nowrap}.tox .tox-button::before{border-radius:6px;bottom:-1px;box-shadow:inset 0 0 0 1px #fff,0 0 0 2px #006ce7;content:'';left:-1px;opacity:0;pointer-events:none;position:absolute;right:-1px;top:-1px}.tox .tox-button[disabled]{background-color:#006ce7;background-image:none;border-color:#006ce7;box-shadow:none;color:rgba(255,255,255,.5);cursor:not-allowed}.tox .tox-button:focus:not(:disabled){background-color:#0060ce;background-image:none;border-color:#0060ce;box-shadow:none;color:#fff}.tox .tox-button:focus:not(:disabled)::before{opacity:1}.tox .tox-button:hover:not(:disabled){background-color:#0060ce;background-image:none;border-color:#0060ce;box-shadow:none;color:#fff}.tox .tox-button:active:not(:disabled){background-color:#0054b4;background-image:none;border-color:#0054b4;box-shadow:none;color:#fff}.tox .tox-button.tox-button--enabled{background-color:#0054b4;background-image:none;border-color:#0054b4;box-shadow:none;color:#fff}.tox .tox-button.tox-button--enabled[disabled]{background-color:#0054b4;background-image:none;border-color:#0054b4;box-shadow:none;color:rgba(255,255,255,.5);cursor:not-allowed}.tox .tox-button.tox-button--enabled:focus:not(:disabled){background-color:#00489b;background-image:none;border-color:#00489b;box-shadow:none;color:#fff}.tox .tox-button.tox-button--enabled:hover:not(:disabled){background-color:#00489b;background-image:none;border-color:#00489b;box-shadow:none;color:#fff}.tox .tox-button.tox-button--enabled:active:not(:disabled){background-color:#003c81;background-image:none;border-color:#003c81;box-shadow:none;color:#fff}.tox .tox-button--icon-and-text,.tox .tox-button.tox-button--icon-and-text,.tox .tox-button.tox-button--secondary.tox-button--icon-and-text{display:flex;padding:5px 4px}.tox .tox-button--icon-and-text .tox-icon svg,.tox .tox-button.tox-button--icon-and-text .tox-icon svg,.tox .tox-button.tox-button--secondary.tox-button--icon-and-text .tox-icon svg{display:block;fill:currentColor}.tox .tox-button--secondary{background-color:#f0f0f0;background-image:none;background-position:0 0;background-repeat:repeat;border-color:#f0f0f0;border-radius:6px;border-style:solid;border-width:1px;box-shadow:none;color:#222f3e;font-size:14px;font-style:normal;font-weight:700;letter-spacing:normal;outline:0;padding:4px 16px;text-decoration:none;text-transform:none}.tox .tox-button--secondary[disabled]{background-color:#f0f0f0;background-image:none;border-color:#f0f0f0;box-shadow:none;color:rgba(34,47,62,.5)}.tox .tox-button--secondary:focus:not(:disabled){background-color:#e3e3e3;background-image:none;border-color:#e3e3e3;box-shadow:none;color:#222f3e}.tox .tox-button--secondary:hover:not(:disabled){background-color:#e3e3e3;background-image:none;border-color:#e3e3e3;box-shadow:none;color:#222f3e}.tox .tox-button--secondary:active:not(:disabled){background-color:#d6d6d6;background-image:none;border-color:#d6d6d6;box-shadow:none;color:#222f3e}.tox .tox-button--secondary.tox-button--enabled{background-color:#a8c8ed;background-image:none;border-color:#a8c8ed;box-shadow:none;color:#222f3e}.tox .tox-button--secondary.tox-button--enabled[disabled]{background-color:#a8c8ed;background-image:none;border-color:#a8c8ed;box-shadow:none;color:rgba(34,47,62,.5)}.tox .tox-button--secondary.tox-button--enabled:focus:not(:disabled){background-color:#93bbe9;background-image:none;border-color:#93bbe9;box-shadow:none;color:#222f3e}.tox .tox-button--secondary.tox-button--enabled:hover:not(:disabled){background-color:#93bbe9;background-image:none;border-color:#93bbe9;box-shadow:none;color:#222f3e}.tox .tox-button--secondary.tox-button--enabled:active:not(:disabled){background-color:#7daee4;background-image:none;border-color:#7daee4;box-shadow:none;color:#222f3e}.tox .tox-button--icon,.tox .tox-button.tox-button--icon,.tox .tox-button.tox-button--secondary.tox-button--icon{padding:4px}.tox .tox-button--icon .tox-icon svg,.tox .tox-button.tox-button--icon .tox-icon svg,.tox .tox-button.tox-button--secondary.tox-button--icon .tox-icon svg{display:block;fill:currentColor}.tox .tox-button-link{background:0;border:none;box-sizing:border-box;cursor:pointer;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;padding:0;white-space:nowrap}.tox .tox-button-link--sm{font-size:14px}.tox .tox-button--naked{background-color:transparent;border-color:transparent;box-shadow:unset;color:#222f3e}.tox .tox-button--naked[disabled]{background-color:rgba(34,47,62,.12);border-color:transparent;box-shadow:unset;color:rgba(34,47,62,.5)}.tox .tox-button--naked:hover:not(:disabled){background-color:rgba(34,47,62,.12);border-color:transparent;box-shadow:unset;color:#222f3e}.tox .tox-button--naked:focus:not(:disabled){background-color:rgba(34,47,62,.12);border-color:transparent;box-shadow:unset;color:#222f3e}.tox .tox-button--naked:active:not(:disabled){background-color:rgba(34,47,62,.18);border-color:transparent;box-shadow:unset;color:#222f3e}.tox .tox-button--naked .tox-icon svg{fill:currentColor}.tox .tox-button--naked.tox-button--icon:hover:not(:disabled){color:#222f3e}.tox .tox-checkbox{align-items:center;border-radius:6px;cursor:pointer;display:flex;height:36px;min-width:36px}.tox .tox-checkbox__input{height:1px;overflow:hidden;position:absolute;top:auto;width:1px}.tox .tox-checkbox__icons{align-items:center;border-radius:6px;box-shadow:0 0 0 2px transparent;box-sizing:content-box;display:flex;height:24px;justify-content:center;padding:calc(4px - 1px);width:24px}.tox .tox-checkbox__icons .tox-checkbox-icon__unchecked svg{display:block;fill:rgba(34,47,62,.3)}@media (forced-colors:active){.tox .tox-checkbox__icons .tox-checkbox-icon__unchecked svg{fill:currentColor!important}}.tox .tox-checkbox__icons .tox-checkbox-icon__indeterminate svg{display:none;fill:#006ce7}.tox .tox-checkbox__icons .tox-checkbox-icon__checked svg{display:none;fill:#006ce7}.tox .tox-checkbox--disabled{color:rgba(34,47,62,.5);cursor:not-allowed}.tox .tox-checkbox--disabled .tox-checkbox__icons .tox-checkbox-icon__checked svg{fill:rgba(34,47,62,.5)}.tox .tox-checkbox--disabled .tox-checkbox__icons .tox-checkbox-icon__unchecked svg{fill:rgba(34,47,62,.5)}.tox .tox-checkbox--disabled .tox-checkbox__icons .tox-checkbox-icon__indeterminate svg{fill:rgba(34,47,62,.5)}.tox input.tox-checkbox__input:checked+.tox-checkbox__icons .tox-checkbox-icon__unchecked svg{display:none}.tox input.tox-checkbox__input:checked+.tox-checkbox__icons .tox-checkbox-icon__checked svg{display:block}.tox input.tox-checkbox__input:indeterminate+.tox-checkbox__icons .tox-checkbox-icon__unchecked svg{display:none}.tox input.tox-checkbox__input:indeterminate+.tox-checkbox__icons .tox-checkbox-icon__indeterminate svg{display:block}.tox input.tox-checkbox__input:focus+.tox-checkbox__icons{border-radius:6px;box-shadow:inset 0 0 0 1px #006ce7;padding:calc(4px - 1px)}.tox:not([dir=rtl]) .tox-checkbox__label{margin-left:4px}.tox:not([dir=rtl]) .tox-checkbox__input{left:-10000px}.tox:not([dir=rtl]) .tox-bar .tox-checkbox{margin-left:4px}.tox[dir=rtl] .tox-checkbox__label{margin-right:4px}.tox[dir=rtl] .tox-checkbox__input{right:-10000px}.tox[dir=rtl] .tox-bar .tox-checkbox{margin-right:4px}.tox .tox-collection--toolbar .tox-collection__group{display:flex;padding:0}.tox .tox-collection--grid .tox-collection__group{display:flex;flex-wrap:wrap;max-height:208px;overflow-x:hidden;overflow-y:auto;padding:0}.tox .tox-collection--list .tox-collection__group{border-bottom-width:0;border-color:#e3e3e3;border-left-width:0;border-right-width:0;border-style:solid;border-top-width:1px;padding:4px 0}.tox .tox-collection--list .tox-collection__group:first-child{border-top-width:0}.tox .tox-collection__group-heading{background-color:#fcfcfc;color:rgba(34,47,62,.7);cursor:default;font-size:12px;font-style:normal;font-weight:400;margin-bottom:4px;margin-top:-4px;padding:4px 8px;text-transform:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.tox .tox-collection__item{align-items:center;border-radius:3px;color:#222f3e;display:flex;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.tox .tox-collection--list .tox-collection__item{padding:4px 8px}.tox .tox-collection--toolbar .tox-collection__item{border-radius:3px;padding:4px}.tox .tox-collection--grid .tox-collection__item{border-radius:3px;padding:4px}.tox .tox-collection--list .tox-collection__item--enabled{background-color:#fff;color:#222f3e}.tox .tox-collection--list .tox-collection__item--active{background-color:#006ce7}.tox .tox-collection--toolbar .tox-collection__item--enabled,.tox .tox-collection--toolbar .tox-collection__item--enabled.tox-collection__item--active,.tox .tox-collection--toolbar .tox-collection__item--enabled.tox-collection__item--active:hover{background-color:#a6ccf7;color:#222f3e}@media (forced-colors:active){.tox .tox-collection--toolbar .tox-collection__item--enabled,.tox .tox-collection--toolbar .tox-collection__item--enabled.tox-collection__item--active,.tox .tox-collection--toolbar .tox-collection__item--enabled.tox-collection__item--active:hover{border-radius:3px;outline:solid 1px}}.tox .tox-collection--toolbar .tox-collection__item--active{background-color:#fff;position:relative}.tox .tox-collection--toolbar .tox-collection__item--active:hover{background-color:#f0f0f0;color:#222f3e}.tox .tox-collection--toolbar .tox-collection__item--active:focus{background-color:#f0f0f0;color:#222f3e}.tox .tox-collection--toolbar .tox-collection__item--active:focus::after{border-radius:3px;bottom:0;box-shadow:0 0 0 2px #006ce7;content:'';left:0;position:absolute;right:0;top:0}@media (forced-colors:active){.tox .tox-collection--toolbar .tox-collection__item--active:focus::after{border:2px solid highlight}}.tox .tox-collection--grid .tox-collection__item--enabled{background-color:#a6ccf7;color:#222f3e}.tox .tox-collection--grid .tox-collection__item--active:not(.tox-collection__item--state-disabled){background-color:#f0f0f0;color:#222f3e;position:relative;z-index:1}.tox .tox-collection--grid .tox-collection__item--active:not(.tox-collection__item--state-disabled):focus::after{border-radius:3px;bottom:0;box-shadow:0 0 0 2px #006ce7 inset;content:'';left:0;position:absolute;right:0;top:0}@media (forced-colors:active){.tox .tox-collection--grid .tox-collection__item--active:not(.tox-collection__item--state-disabled):focus::after{border:2px solid highlight}}.tox .tox-collection--list .tox-collection__item--active:not(.tox-collection__item--state-disabled){color:#fff}@media (forced-colors:active){.tox .tox-collection--list .tox-collection__item--active:not(.tox-collection__item--state-disabled){border:solid 1px}}.tox .tox-collection--toolbar .tox-collection__item--active:not(.tox-collection__item--state-disabled){color:#222f3e}@media (forced-colors:active){.tox .tox-collection--toolbar .tox-collection__item--active:not(.tox-collection__item--state-disabled):hover{border-radius:3px;outline:solid 1px}}.tox .tox-collection__item-checkmark,.tox .tox-collection__item-icon{align-items:center;display:flex;height:24px;justify-content:center;width:24px}.tox .tox-collection__item-checkmark svg,.tox .tox-collection__item-icon svg{fill:currentColor}.tox .tox-collection--toolbar-lg .tox-collection__item-icon{height:48px;width:48px}.tox .tox-collection__item-label{color:currentColor;display:inline-block;flex:1;font-size:14px;font-style:normal;font-weight:400;line-height:24px;max-width:100%;text-transform:none;word-break:break-all}.tox .tox-collection__item-accessory{color:currentColor;display:inline-block;font-size:14px;height:24px;line-height:24px;text-transform:none}.tox .tox-collection__item-caret{align-items:center;display:flex;min-height:24px}.tox .tox-collection__item-caret::after{content:'';font-size:0;min-height:inherit}.tox .tox-collection__item-caret svg{fill:currentColor}.tox .tox-collection__item--state-disabled{background-color:transparent;color:rgba(34,47,62,.5);cursor:not-allowed}.tox .tox-collection__item--state-disabled .tox-collection__item-caret svg{fill:rgba(34,47,62,.5)}.tox .tox-collection--list .tox-collection__item:not(.tox-collection__item--enabled) .tox-collection__item-checkmark svg{display:none}.tox .tox-collection--list .tox-collection__item:not(.tox-collection__item--enabled) .tox-collection__item-accessory+.tox-collection__item-checkmark{display:none}.tox .tox-collection--horizontal{background-color:#fff;border:1px solid #e3e3e3;border-radius:6px;box-shadow:0 0 2px 0 rgba(34,47,62,.2),0 4px 8px 0 rgba(34,47,62,.15);display:flex;flex:0 0 auto;flex-shrink:0;flex-wrap:nowrap;margin-bottom:0;overflow-x:auto;padding:0}.tox .tox-collection--horizontal .tox-collection__group{align-items:center;display:flex;flex-wrap:nowrap;margin:0;padding:0 4px}.tox .tox-collection--horizontal .tox-collection__item{height:28px;margin:6px 1px 5px 0;padding:0 4px}.tox .tox-collection--horizontal .tox-collection__item-label{white-space:nowrap}.tox .tox-collection--horizontal .tox-collection__item-caret{margin-left:4px}.tox .tox-collection__item-container{display:flex}.tox .tox-collection__item-container--row{align-items:center;flex:1 1 auto;flex-direction:row}.tox .tox-collection__item-container--row.tox-collection__item-container--align-left{margin-right:auto}.tox .tox-collection__item-container--row.tox-collection__item-container--align-right{justify-content:flex-end;margin-left:auto}.tox .tox-collection__item-container--row.tox-collection__item-container--valign-top{align-items:flex-start;margin-bottom:auto}.tox .tox-collection__item-container--row.tox-collection__item-container--valign-middle{align-items:center}.tox .tox-collection__item-container--row.tox-collection__item-container--valign-bottom{align-items:flex-end;margin-top:auto}.tox .tox-collection__item-container--column{align-self:center;flex:1 1 auto;flex-direction:column}.tox .tox-collection__item-container--column.tox-collection__item-container--align-left{align-items:flex-start}.tox .tox-collection__item-container--column.tox-collection__item-container--align-right{align-items:flex-end}.tox .tox-collection__item-container--column.tox-collection__item-container--valign-top{align-self:flex-start}.tox .tox-collection__item-container--column.tox-collection__item-container--valign-middle{align-self:center}.tox .tox-collection__item-container--column.tox-collection__item-container--valign-bottom{align-self:flex-end}.tox:not([dir=rtl]) .tox-collection--horizontal .tox-collection__group:not(:last-of-type){border-right:1px solid transparent}.tox:not([dir=rtl]) .tox-collection--list .tox-collection__item>:not(:first-child){margin-left:8px}.tox:not([dir=rtl]) .tox-collection--list .tox-collection__item>.tox-collection__item-label:first-child{margin-left:4px}.tox:not([dir=rtl]) .tox-collection__item-accessory{margin-left:16px;text-align:right}.tox:not([dir=rtl]) .tox-collection .tox-collection__item-caret{margin-left:16px}.tox[dir=rtl] .tox-collection--horizontal .tox-collection__group:not(:last-of-type){border-left:1px solid transparent}.tox[dir=rtl] .tox-collection--list .tox-collection__item>:not(:first-child){margin-right:8px}.tox[dir=rtl] .tox-collection--list .tox-collection__item>.tox-collection__item-label:first-child{margin-right:4px}.tox[dir=rtl] .tox-collection__item-accessory{margin-right:16px;text-align:left}.tox[dir=rtl] .tox-collection .tox-collection__item-caret{margin-right:16px;transform:rotateY(180deg)}.tox[dir=rtl] .tox-collection--horizontal .tox-collection__item-caret{margin-right:4px}@media (forced-colors:active){.tox .tox-hue-slider,.tox .tox-rgb-form .tox-rgba-preview{background-color:currentColor!important;border:1px solid highlight!important;forced-color-adjust:none}}.tox .tox-color-picker-container{display:flex;flex-direction:row;height:225px;margin:0}.tox .tox-sv-palette{box-sizing:border-box;display:flex;height:100%}.tox .tox-sv-palette-spectrum{height:100%}.tox .tox-sv-palette,.tox .tox-sv-palette-spectrum{width:225px}.tox .tox-sv-palette-thumb{background:0 0;border:1px solid #000;border-radius:50%;box-sizing:content-box;height:12px;position:absolute;width:12px}.tox .tox-sv-palette-inner-thumb{border:1px solid #fff;border-radius:50%;height:10px;position:absolute;width:10px}.tox .tox-hue-slider{box-sizing:border-box;height:100%;width:25px}.tox .tox-hue-slider-spectrum{background:linear-gradient(to bottom,red,#ff0080,#f0f,#8000ff,#00f,#0080ff,#0ff,#00ff80,#0f0,#80ff00,#ff0,#ff8000,red);height:100%;width:100%}.tox .tox-hue-slider,.tox .tox-hue-slider-spectrum{width:20px}.tox .tox-hue-slider-spectrum:focus,.tox .tox-sv-palette-spectrum:focus{outline:#08f solid}.tox .tox-hue-slider-thumb{background:#fff;border:1px solid #000;box-sizing:content-box;height:4px;width:100%}.tox .tox-rgb-form{display:flex;flex-direction:column;justify-content:space-between}.tox .tox-rgb-form div{align-items:center;display:flex;justify-content:space-between;margin-bottom:5px;width:inherit}.tox .tox-rgb-form input{width:6em}.tox .tox-rgb-form input.tox-invalid{border:1px solid red!important}.tox .tox-rgb-form .tox-rgba-preview{border:1px solid #000;flex-grow:2;margin-bottom:0}.tox:not([dir=rtl]) .tox-sv-palette{margin-right:15px}.tox:not([dir=rtl]) .tox-hue-slider{margin-right:15px}.tox:not([dir=rtl]) .tox-hue-slider-thumb{margin-left:-1px}.tox:not([dir=rtl]) .tox-rgb-form label{margin-right:.5em}.tox[dir=rtl] .tox-sv-palette{margin-left:15px}.tox[dir=rtl] .tox-hue-slider{margin-left:15px}.tox[dir=rtl] .tox-hue-slider-thumb{margin-right:-1px}.tox[dir=rtl] .tox-rgb-form label{margin-left:.5em}.tox .tox-toolbar .tox-swatches,.tox .tox-toolbar__overflow .tox-swatches,.tox .tox-toolbar__primary .tox-swatches{margin:5px 0 6px 11px}.tox .tox-collection--list .tox-collection__group .tox-swatches-menu{border:0;margin:-4px -4px}.tox .tox-swatches__row{display:flex}@media (forced-colors:active){.tox .tox-swatches__row{forced-color-adjust:none}}.tox .tox-swatch{height:30px;transition:transform .15s,box-shadow .15s;width:30px}.tox .tox-swatch:focus,.tox .tox-swatch:hover{box-shadow:0 0 0 1px rgba(127,127,127,.3) inset;transform:scale(.8)}.tox .tox-swatch--remove{align-items:center;display:flex;justify-content:center}.tox .tox-swatch--remove svg path{stroke:#e74c3c}.tox .tox-swatches__picker-btn{align-items:center;background-color:transparent;border:0;cursor:pointer;display:flex;height:30px;justify-content:center;outline:0;padding:0;width:30px}.tox .tox-swatches__picker-btn svg{fill:#222f3e;height:24px;width:24px}.tox .tox-swatches__picker-btn:hover{background:#f0f0f0}.tox div.tox-swatch:not(.tox-swatch--remove) svg{display:none;fill:#222f3e;height:24px;margin:calc((30px - 24px)/ 2) calc((30px - 24px)/ 2);width:24px}.tox div.tox-swatch:not(.tox-swatch--remove) svg path{fill:#fff;paint-order:stroke;stroke:#222f3e;stroke-width:2px}.tox div.tox-swatch:not(.tox-swatch--remove).tox-collection__item--enabled svg{display:block}.tox:not([dir=rtl]) .tox-swatches__picker-btn{margin-left:auto}.tox[dir=rtl] .tox-swatches__picker-btn{margin-right:auto}.tox .tox-comment-thread{background:#fff;position:relative}.tox .tox-comment-thread>:not(:first-child){margin-top:8px}.tox .tox-comment{background:#fff;border:1px solid #eee;border-radius:6px;box-shadow:0 4px 8px 0 rgba(34,47,62,.1);padding:8px 8px 16px 8px;position:relative}.tox .tox-comment__header{align-items:center;color:#222f3e;display:flex;justify-content:space-between}.tox .tox-comment__date{color:#222f3e;font-size:12px;line-height:18px}.tox .tox-comment__body{color:#222f3e;font-size:14px;font-style:normal;font-weight:400;line-height:1.3;margin-top:8px;position:relative;text-transform:initial}.tox .tox-comment__body textarea{resize:none;white-space:normal;width:100%}.tox .tox-comment__expander{padding-top:8px}.tox .tox-comment__expander p{color:rgba(34,47,62,.7);font-size:14px;font-style:normal}.tox .tox-comment__body p{margin:0}.tox .tox-comment__buttonspacing{padding-top:16px;text-align:center}.tox .tox-comment-thread__overlay::after{background:#fff;bottom:0;content:"";display:flex;left:0;opacity:.9;position:absolute;right:0;top:0;z-index:5}.tox .tox-comment__reply{display:flex;flex-shrink:0;flex-wrap:wrap;justify-content:flex-end;margin-top:8px}.tox .tox-comment__reply>:first-child{margin-bottom:8px;width:100%}.tox .tox-comment__edit{display:flex;flex-wrap:wrap;justify-content:flex-end;margin-top:16px}.tox .tox-comment__gradient::after{background:linear-gradient(rgba(255,255,255,0),#fff);bottom:0;content:"";display:block;height:5em;margin-top:-40px;position:absolute;width:100%}.tox .tox-comment__overlay{background:#fff;bottom:0;display:flex;flex-direction:column;flex-grow:1;left:0;opacity:.9;position:absolute;right:0;text-align:center;top:0;z-index:5}.tox .tox-comment__loading-text{align-items:center;color:#222f3e;display:flex;flex-direction:column;position:relative}.tox .tox-comment__loading-text>div{padding-bottom:16px}.tox .tox-comment__overlaytext{bottom:0;flex-direction:column;font-size:14px;left:0;padding:1em;position:absolute;right:0;top:0;z-index:10}.tox .tox-comment__overlaytext p{background-color:#fff;box-shadow:0 0 8px 8px #fff;color:#222f3e;text-align:center}.tox .tox-comment__overlaytext div:nth-of-type(2){font-size:.8em}.tox .tox-comment__busy-spinner{align-items:center;background-color:#fff;bottom:0;display:flex;justify-content:center;left:0;position:absolute;right:0;top:0;z-index:20}.tox .tox-comment__scroll{display:flex;flex-direction:column;flex-shrink:1;overflow:auto}.tox .tox-conversations{margin:8px}.tox:not([dir=rtl]) .tox-comment__edit{margin-left:8px}.tox:not([dir=rtl]) .tox-comment__buttonspacing>:last-child,.tox:not([dir=rtl]) .tox-comment__edit>:last-child,.tox:not([dir=rtl]) .tox-comment__reply>:last-child{margin-left:8px}.tox[dir=rtl] .tox-comment__edit{margin-right:8px}.tox[dir=rtl] .tox-comment__buttonspacing>:last-child,.tox[dir=rtl] .tox-comment__edit>:last-child,.tox[dir=rtl] .tox-comment__reply>:last-child{margin-right:8px}.tox .tox-user{align-items:center;display:flex}.tox .tox-user__avatar svg{fill:rgba(34,47,62,.7)}.tox .tox-user__avatar img{border-radius:50%;height:36px;object-fit:cover;vertical-align:middle;width:36px}.tox .tox-user__name{color:#222f3e;font-size:14px;font-style:normal;font-weight:700;line-height:18px;text-transform:none}.tox:not([dir=rtl]) .tox-user__avatar img,.tox:not([dir=rtl]) .tox-user__avatar svg{margin-right:8px}.tox:not([dir=rtl]) .tox-user__avatar+.tox-user__name{margin-left:8px}.tox[dir=rtl] .tox-user__avatar img,.tox[dir=rtl] .tox-user__avatar svg{margin-left:8px}.tox[dir=rtl] .tox-user__avatar+.tox-user__name{margin-right:8px}.tox .tox-dialog-wrap{align-items:center;bottom:0;display:flex;justify-content:center;left:0;position:fixed;right:0;top:0;z-index:1100}.tox .tox-dialog-wrap__backdrop{background-color:rgba(255,255,255,.75);bottom:0;left:0;position:absolute;right:0;top:0;z-index:1}.tox .tox-dialog-wrap__backdrop--opaque{background-color:#fff}.tox .tox-dialog{background-color:#fff;border-color:#eee;border-radius:10px;border-style:solid;border-width:0;box-shadow:0 16px 16px -10px rgba(34,47,62,.15),0 0 40px 1px rgba(34,47,62,.15);display:flex;flex-direction:column;max-height:100%;max-width:480px;overflow:hidden;position:relative;width:95vw;z-index:2}@media only screen and (max-width:767px){body:not(.tox-force-desktop) .tox .tox-dialog{align-self:flex-start;margin:8px auto;max-height:calc(100vh - 8px * 2);width:calc(100vw - 16px)}}.tox .tox-dialog-inline{z-index:1100}.tox .tox-dialog__header{align-items:center;background-color:#fff;border-bottom:none;color:#222f3e;display:flex;font-size:16px;justify-content:space-between;padding:8px 16px 0 16px;position:relative}.tox .tox-dialog__header .tox-button{z-index:1}.tox .tox-dialog__draghandle{cursor:grab;height:100%;left:0;position:absolute;top:0;width:100%}.tox .tox-dialog__draghandle:active{cursor:grabbing}.tox .tox-dialog__dismiss{margin-left:auto}.tox .tox-dialog__title{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:20px;font-style:normal;font-weight:400;line-height:1.3;margin:0;text-transform:none}.tox .tox-dialog__body{color:#222f3e;display:flex;flex:1;font-size:16px;font-style:normal;font-weight:400;line-height:1.3;min-width:0;text-align:left;text-transform:none}@media only screen and (max-width:767px){body:not(.tox-force-desktop) .tox .tox-dialog__body{flex-direction:column}}.tox .tox-dialog__body-nav{align-items:flex-start;display:flex;flex-direction:column;flex-shrink:0;padding:16px 16px}@media only screen and (min-width:768px){.tox .tox-dialog__body-nav{max-width:11em}}@media only screen and (max-width:767px){body:not(.tox-force-desktop) .tox .tox-dialog__body-nav{flex-direction:row;-webkit-overflow-scrolling:touch;overflow-x:auto;padding-bottom:0}}.tox .tox-dialog__body-nav-item{border-bottom:2px solid transparent;color:rgba(34,47,62,.7);display:inline-block;flex-shrink:0;font-size:14px;line-height:1.3;margin-bottom:8px;max-width:13em;text-decoration:none}.tox .tox-dialog__body-nav-item:focus{background-color:rgba(0,108,231,.1)}.tox .tox-dialog__body-nav-item--active{border-bottom:2px solid #006ce7;color:#006ce7}@media (forced-colors:active){.tox .tox-dialog__body-nav-item--active{border-bottom:2px solid highlight;color:highlight}}.tox .tox-dialog__body-content{box-sizing:border-box;display:flex;flex:1;flex-direction:column;max-height:min(650px,calc(100vh - 110px));overflow:auto;-webkit-overflow-scrolling:touch;padding:16px 16px}.tox .tox-dialog__body-content>*{margin-bottom:0;margin-top:16px}.tox .tox-dialog__body-content>:first-child{margin-top:0}.tox .tox-dialog__body-content>:last-child{margin-bottom:0}.tox .tox-dialog__body-content>:only-child{margin-bottom:0;margin-top:0}.tox .tox-dialog__body-content a{color:#006ce7;cursor:pointer;text-decoration:underline}.tox .tox-dialog__body-content a:focus,.tox .tox-dialog__body-content a:hover{color:#003c81;text-decoration:underline}.tox .tox-dialog__body-content a:focus-visible{border-radius:1px;outline:2px solid #006ce7;outline-offset:2px}.tox .tox-dialog__body-content a:active{color:#00244e;text-decoration:underline}.tox .tox-dialog__body-content svg{fill:#222f3e}.tox .tox-dialog__body-content strong{font-weight:700}.tox .tox-dialog__body-content ul{list-style-type:disc}.tox .tox-dialog__body-content dd,.tox .tox-dialog__body-content ol,.tox .tox-dialog__body-content ul{padding-inline-start:2.5rem}.tox .tox-dialog__body-content dl,.tox .tox-dialog__body-content ol,.tox .tox-dialog__body-content ul{margin-bottom:16px}.tox .tox-dialog__body-content dd,.tox .tox-dialog__body-content dl,.tox .tox-dialog__body-content dt,.tox .tox-dialog__body-content ol,.tox .tox-dialog__body-content ul{display:block;margin-inline-end:0;margin-inline-start:0}.tox .tox-dialog__body-content .tox-form__group h1{color:#222f3e;font-size:20px;font-style:normal;font-weight:700;letter-spacing:normal;margin-bottom:16px;margin-top:2rem;text-transform:none}.tox .tox-dialog__body-content .tox-form__group h2{color:#222f3e;font-size:16px;font-style:normal;font-weight:700;letter-spacing:normal;margin-bottom:16px;margin-top:2rem;text-transform:none}.tox .tox-dialog__body-content .tox-form__group p{margin-bottom:16px}.tox .tox-dialog__body-content .tox-form__group h1:first-child,.tox .tox-dialog__body-content .tox-form__group h2:first-child,.tox .tox-dialog__body-content .tox-form__group p:first-child{margin-top:0}.tox .tox-dialog__body-content .tox-form__group h1:last-child,.tox .tox-dialog__body-content .tox-form__group h2:last-child,.tox .tox-dialog__body-content .tox-form__group p:last-child{margin-bottom:0}.tox .tox-dialog__body-content .tox-form__group h1:only-child,.tox .tox-dialog__body-content .tox-form__group h2:only-child,.tox .tox-dialog__body-content .tox-form__group p:only-child{margin-bottom:0;margin-top:0}.tox .tox-dialog__body-content .tox-form__group .tox-label.tox-label--center{text-align:center}.tox .tox-dialog__body-content .tox-form__group .tox-label.tox-label--end{text-align:end}.tox .tox-dialog--width-lg{height:650px;max-width:1200px}.tox .tox-dialog--fullscreen{height:100%;max-width:100%}.tox .tox-dialog--fullscreen .tox-dialog__body-content{max-height:100%}.tox .tox-dialog--width-md{max-width:800px}.tox .tox-dialog--width-md .tox-dialog__body-content{overflow:auto}.tox .tox-dialog__body-content--centered{text-align:center}.tox .tox-dialog__footer{align-items:center;background-color:#fff;border-top:none;display:flex;justify-content:space-between;padding:8px 16px}.tox .tox-dialog__footer-end,.tox .tox-dialog__footer-start{display:flex}.tox .tox-dialog__busy-spinner{align-items:center;background-color:rgba(255,255,255,.75);bottom:0;display:flex;justify-content:center;left:0;position:absolute;right:0;top:0;z-index:3}.tox .tox-dialog__table{border-collapse:collapse;width:100%}.tox .tox-dialog__table thead th{font-weight:700;padding-bottom:8px}.tox .tox-dialog__table thead th:first-child{padding-right:8px}.tox .tox-dialog__table tbody tr{border-bottom:1px solid #626262}.tox .tox-dialog__table tbody tr:last-child{border-bottom:none}.tox .tox-dialog__table td{padding-bottom:8px;padding-top:8px}.tox .tox-dialog__table td:first-child{padding-right:8px}.tox .tox-dialog__iframe{min-height:200px}.tox .tox-dialog__iframe.tox-dialog__iframe--opaque{background:#fff}.tox .tox-navobj-bordered{position:relative}.tox .tox-navobj-bordered::before{border:1px solid #eee;border-radius:6px;content:'';inset:0;opacity:1;pointer-events:none;position:absolute;z-index:1}.tox .tox-navobj-bordered iframe{border-radius:6px}.tox .tox-navobj-bordered-focus.tox-navobj-bordered::before{border-color:#006ce7;box-shadow:0 0 0 1px #006ce7;outline:0}.tox .tox-dialog__popups{position:absolute;width:100%;z-index:1100}.tox .tox-dialog__body-iframe{display:flex;flex:1;flex-direction:column}.tox .tox-dialog__body-iframe .tox-navobj{display:flex;flex:1}.tox .tox-dialog__body-iframe .tox-navobj :nth-child(2){flex:1;height:100%}.tox .tox-dialog-dock-fadeout{opacity:0;visibility:hidden}.tox .tox-dialog-dock-fadein{opacity:1;visibility:visible}.tox .tox-dialog-dock-transition{transition:visibility 0s linear .3s,opacity .3s ease}.tox .tox-dialog-dock-transition.tox-dialog-dock-fadein{transition-delay:0s}@media only screen and (max-width:767px){body:not(.tox-force-desktop) .tox:not([dir=rtl]) .tox-dialog__body-nav{margin-right:0}}@media only screen and (max-width:767px){body:not(.tox-force-desktop) .tox:not([dir=rtl]) .tox-dialog__body-nav-item:not(:first-child){margin-left:8px}}.tox:not([dir=rtl]) .tox-dialog__footer .tox-dialog__footer-end>*,.tox:not([dir=rtl]) .tox-dialog__footer .tox-dialog__footer-start>*{margin-left:8px}.tox[dir=rtl] .tox-dialog__body{text-align:right}@media only screen and (max-width:767px){body:not(.tox-force-desktop) .tox[dir=rtl] .tox-dialog__body-nav{margin-left:0}}@media only screen and (max-width:767px){body:not(.tox-force-desktop) .tox[dir=rtl] .tox-dialog__body-nav-item:not(:first-child){margin-right:8px}}.tox[dir=rtl] .tox-dialog__footer .tox-dialog__footer-end>*,.tox[dir=rtl] .tox-dialog__footer .tox-dialog__footer-start>*{margin-right:8px}body.tox-dialog__disable-scroll{overflow:hidden}.tox .tox-dropzone-container{display:flex;flex:1}.tox .tox-dropzone{align-items:center;background:#fff;border:2px dashed #eee;box-sizing:border-box;display:flex;flex-direction:column;flex-grow:1;justify-content:center;min-height:100px;padding:10px}.tox .tox-dropzone p{color:rgba(34,47,62,.7);margin:0 0 16px 0}.tox .tox-edit-area{display:flex;flex:1;overflow:hidden;position:relative}.tox .tox-edit-area::before{border:2px solid #006ce7;border-radius:4px;content:'';inset:0;opacity:0;pointer-events:none;position:absolute;transition:opacity .15s;z-index:1}@media (forced-colors:active){.tox .tox-edit-area::before{border:2px solid highlight}}.tox .tox-edit-area__iframe{background-color:#fff;border:0;box-sizing:border-box;flex:1;height:100%;position:absolute;width:100%}.tox.tox-edit-focus .tox-edit-area::before{opacity:1}.tox.tox-inline-edit-area{border:1px dotted #eee}.tox .tox-editor-container{display:flex;flex:1 1 auto;flex-direction:column;overflow:hidden}.tox .tox-editor-header{display:grid;grid-template-columns:1fr min-content;z-index:2}.tox:not(.tox-tinymce-inline) .tox-editor-header{background-color:#fff;border-bottom:none;box-shadow:0 2px 2px -2px rgba(34,47,62,.1),0 8px 8px -4px rgba(34,47,62,.07);padding:4px 0}.tox:not(.tox-tinymce-inline) .tox-editor-header:not(.tox-editor-dock-transition){transition:box-shadow .5s}.tox:not(.tox-tinymce-inline).tox-tinymce--toolbar-bottom .tox-editor-header{border-top:1px solid #e3e3e3;box-shadow:none}.tox:not(.tox-tinymce-inline).tox-tinymce--toolbar-sticky-on .tox-editor-header{background-color:#fff;box-shadow:0 2px 2px -2px rgba(34,47,62,.2),0 8px 8px -4px rgba(34,47,62,.15);padding:4px 0}.tox:not(.tox-tinymce-inline).tox-tinymce--toolbar-sticky-on.tox-tinymce--toolbar-bottom .tox-editor-header{box-shadow:0 2px 2px -2px rgba(34,47,62,.2),0 8px 8px -4px rgba(34,47,62,.15)}.tox.tox:not(.tox-tinymce-inline) .tox-editor-header.tox-editor-header--empty{background:0 0;border:none;box-shadow:none;padding:0}.tox-editor-dock-fadeout{opacity:0;visibility:hidden}.tox-editor-dock-fadein{opacity:1;visibility:visible}.tox-editor-dock-transition{transition:visibility 0s linear .25s,opacity .25s ease}.tox-editor-dock-transition.tox-editor-dock-fadein{transition-delay:0s}.tox .tox-control-wrap{flex:1;position:relative}.tox .tox-control-wrap:not(.tox-control-wrap--status-invalid) .tox-control-wrap__status-icon-invalid,.tox .tox-control-wrap:not(.tox-control-wrap--status-unknown) .tox-control-wrap__status-icon-unknown,.tox .tox-control-wrap:not(.tox-control-wrap--status-valid) .tox-control-wrap__status-icon-valid{display:none}.tox .tox-control-wrap svg{display:block}.tox .tox-control-wrap__status-icon-wrap{position:absolute;top:50%;transform:translateY(-50%)}.tox .tox-control-wrap__status-icon-invalid svg{fill:#c00}.tox .tox-control-wrap__status-icon-unknown svg{fill:orange}.tox .tox-control-wrap__status-icon-valid svg{fill:green}.tox:not([dir=rtl]) .tox-control-wrap--status-invalid .tox-textfield,.tox:not([dir=rtl]) .tox-control-wrap--status-unknown .tox-textfield,.tox:not([dir=rtl]) .tox-control-wrap--status-valid .tox-textfield{padding-right:32px}.tox:not([dir=rtl]) .tox-control-wrap__status-icon-wrap{right:4px}.tox[dir=rtl] .tox-control-wrap--status-invalid .tox-textfield,.tox[dir=rtl] .tox-control-wrap--status-unknown .tox-textfield,.tox[dir=rtl] .tox-control-wrap--status-valid .tox-textfield{padding-left:32px}.tox[dir=rtl] .tox-control-wrap__status-icon-wrap{left:4px}.tox .tox-autocompleter{max-width:25em}.tox .tox-autocompleter .tox-menu{box-sizing:border-box;max-width:25em}.tox .tox-autocompleter .tox-autocompleter-highlight{font-weight:700}.tox .tox-color-input{display:flex;position:relative;z-index:1}.tox .tox-color-input .tox-textfield{z-index:-1}.tox .tox-color-input span{border-color:rgba(34,47,62,.2);border-radius:6px;border-style:solid;border-width:1px;box-shadow:none;box-sizing:border-box;height:24px;position:absolute;top:6px;width:24px}@media (forced-colors:active){.tox .tox-color-input span{border-color:currentColor;border-width:2px!important;forced-color-adjust:none}}.tox .tox-color-input span:focus:not([aria-disabled=true]),.tox .tox-color-input span:hover:not([aria-disabled=true]){border-color:#006ce7;cursor:pointer}.tox .tox-color-input span::before{background-image:linear-gradient(45deg,rgba(0,0,0,.25) 25%,transparent 25%),linear-gradient(-45deg,rgba(0,0,0,.25) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,rgba(0,0,0,.25) 75%),linear-gradient(-45deg,transparent 75%,rgba(0,0,0,.25) 75%);background-position:0 0,0 6px,6px -6px,-6px 0;background-size:12px 12px;border:1px solid #fff;border-radius:6px;box-sizing:border-box;content:'';height:24px;left:-1px;position:absolute;top:-1px;width:24px;z-index:-1}@media (forced-colors:active){.tox .tox-color-input span::before{border:none}}.tox .tox-color-input span[aria-disabled=true]{cursor:not-allowed}.tox:not([dir=rtl]) .tox-color-input .tox-textfield{padding-left:36px}.tox:not([dir=rtl]) .tox-color-input span{left:6px}.tox[dir=rtl] .tox-color-input .tox-textfield{padding-right:36px}.tox[dir=rtl] .tox-color-input span{right:6px}.tox .tox-label,.tox .tox-toolbar-label{color:rgba(34,47,62,.7);display:block;font-size:14px;font-style:normal;font-weight:400;line-height:1.3;padding:0 8px 0 0;text-transform:none;white-space:nowrap}.tox .tox-toolbar-label{padding:0 8px}.tox[dir=rtl] .tox-label{padding:0 0 0 8px}.tox .tox-form{display:flex;flex:1;flex-direction:column}.tox .tox-form__group{box-sizing:border-box;margin-bottom:4px}.tox .tox-form-group--maximize{flex:1}.tox .tox-form__group--error{color:#c00}.tox .tox-form__group--collection{display:flex}.tox .tox-form__grid{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between}.tox .tox-form__grid--2col>.tox-form__group{width:calc(50% - (8px / 2))}.tox .tox-form__grid--3col>.tox-form__group{width:calc(100% / 3 - (8px / 2))}.tox .tox-form__grid--4col>.tox-form__group{width:calc(25% - (8px / 2))}.tox .tox-form__controls-h-stack{align-items:center;display:flex}.tox .tox-form__group--inline{align-items:center;display:flex}.tox .tox-form__group--stretched{display:flex;flex:1;flex-direction:column}.tox .tox-form__group--stretched .tox-textarea{flex:1}.tox .tox-form__group--stretched .tox-navobj{display:flex;flex:1}.tox .tox-form__group--stretched .tox-navobj :nth-child(2){flex:1;height:100%}.tox:not([dir=rtl]) .tox-form__controls-h-stack>:not(:first-child){margin-left:4px}.tox[dir=rtl] .tox-form__controls-h-stack>:not(:first-child){margin-right:4px}.tox .tox-lock.tox-locked .tox-lock-icon__unlock,.tox .tox-lock:not(.tox-locked) .tox-lock-icon__lock{display:none}.tox .tox-listboxfield .tox-listbox--select,.tox .tox-textarea,.tox .tox-textarea-wrap .tox-textarea:focus,.tox .tox-textfield,.tox .tox-toolbar-textfield{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#eee;border-radius:6px;border-style:solid;border-width:1px;box-shadow:none;box-sizing:border-box;color:#222f3e;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:16px;line-height:24px;margin:0;min-height:34px;outline:0;padding:5px 5.5px;resize:none;width:100%}.tox .tox-textarea[disabled],.tox .tox-textfield[disabled]{background-color:#f2f2f2;color:rgba(34,47,62,.85);cursor:not-allowed}.tox .tox-custom-editor:focus-within,.tox .tox-listboxfield .tox-listbox--select:focus,.tox .tox-textarea-wrap:focus-within,.tox .tox-textarea:focus,.tox .tox-textfield:focus{background-color:#fff;border-color:#006ce7;box-shadow:0 0 0 1px #006ce7;outline:0}.tox .tox-toolbar-textfield{border-width:0;margin-bottom:3px;margin-top:2px;max-width:250px}.tox .tox-naked-btn{background-color:transparent;border:0;border-color:transparent;box-shadow:unset;color:#006ce7;cursor:pointer;display:block;margin:0;padding:0}.tox .tox-naked-btn svg{display:block;fill:#222f3e}.tox:not([dir=rtl]) .tox-toolbar-textfield+*{margin-left:4px}.tox[dir=rtl] .tox-toolbar-textfield+*{margin-right:4px}.tox .tox-listboxfield{cursor:pointer;position:relative}.tox .tox-listboxfield .tox-listbox--select[disabled]{background-color:#f2f2f2;color:rgba(34,47,62,.85);cursor:not-allowed}.tox .tox-listbox__select-label{cursor:default;flex:1;margin:0 4px}.tox .tox-listbox__select-chevron{align-items:center;display:flex;justify-content:center;width:16px}.tox .tox-listbox__select-chevron svg{fill:#222f3e}@media (forced-colors:active){.tox .tox-listbox__select-chevron svg{fill:currentColor!important}}.tox .tox-listboxfield .tox-listbox--select{align-items:center;display:flex}.tox:not([dir=rtl]) .tox-listboxfield svg{right:8px}.tox[dir=rtl] .tox-listboxfield svg{left:8px}.tox .tox-selectfield{cursor:pointer;position:relative}.tox .tox-selectfield select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#eee;border-radius:6px;border-style:solid;border-width:1px;box-shadow:none;box-sizing:border-box;color:#222f3e;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:16px;line-height:24px;margin:0;min-height:34px;outline:0;padding:5px 5.5px;resize:none;width:100%}.tox .tox-selectfield select[disabled]{background-color:#f2f2f2;color:rgba(34,47,62,.85);cursor:not-allowed}.tox .tox-selectfield select::-ms-expand{display:none}.tox .tox-selectfield select:focus{background-color:#fff;border-color:#006ce7;box-shadow:0 0 0 1px #006ce7;outline:0}.tox .tox-selectfield svg{pointer-events:none;position:absolute;top:50%;transform:translateY(-50%)}.tox:not([dir=rtl]) .tox-selectfield select[size="0"],.tox:not([dir=rtl]) .tox-selectfield select[size="1"]{padding-right:24px}.tox:not([dir=rtl]) .tox-selectfield svg{right:8px}.tox[dir=rtl] .tox-selectfield select[size="0"],.tox[dir=rtl] .tox-selectfield select[size="1"]{padding-left:24px}.tox[dir=rtl] .tox-selectfield svg{left:8px}.tox .tox-textarea-wrap{border-color:#eee;border-radius:6px;border-style:solid;border-width:1px;display:flex;flex:1;overflow:hidden}.tox .tox-textarea{-webkit-appearance:textarea;-moz-appearance:textarea;appearance:textarea;white-space:pre-wrap}.tox .tox-textarea-wrap .tox-textarea{border:none}.tox .tox-textarea-wrap .tox-textarea:focus{border:none}.tox-fullscreen{border:0;height:100%;margin:0;overflow:hidden;overscroll-behavior:none;padding:0;touch-action:pinch-zoom;width:100%}.tox.tox-tinymce.tox-fullscreen .tox-statusbar__resize-handle{display:none}.tox-shadowhost.tox-fullscreen,.tox.tox-tinymce.tox-fullscreen{left:0;position:fixed;top:0;z-index:1200}.tox.tox-tinymce.tox-fullscreen{background-color:transparent}.tox-fullscreen .tox.tox-tinymce-aux,.tox-fullscreen~.tox.tox-tinymce-aux{z-index:1201}.tox .tox-help__more-link{list-style:none;margin-top:1em}.tox .tox-imagepreview{background-color:#666;height:380px;overflow:hidden;position:relative;width:100%}.tox .tox-imagepreview.tox-imagepreview__loaded{overflow:auto}.tox .tox-imagepreview__container{display:flex;left:100vw;position:absolute;top:100vw}.tox .tox-imagepreview__image{background:url(data:image/gif;base64,R0lGODdhDAAMAIABAMzMzP///ywAAAAADAAMAAACFoQfqYeabNyDMkBQb81Uat85nxguUAEAOw==)}.tox .tox-image-tools .tox-spacer{flex:1}.tox .tox-image-tools .tox-bar{align-items:center;display:flex;height:60px;justify-content:center}.tox .tox-image-tools .tox-imagepreview,.tox .tox-image-tools .tox-imagepreview+.tox-bar{margin-top:8px}.tox .tox-image-tools .tox-croprect-block{background:#000;opacity:.5;position:absolute;zoom:1}.tox .tox-image-tools .tox-croprect-handle{border:2px solid #fff;height:20px;left:0;position:absolute;top:0;width:20px}.tox .tox-image-tools .tox-croprect-handle-move{border:0;cursor:move;position:absolute}.tox .tox-image-tools .tox-croprect-handle-nw{border-width:2px 0 0 2px;cursor:nw-resize;left:100px;margin:-2px 0 0 -2px;top:100px}.tox .tox-image-tools .tox-croprect-handle-ne{border-width:2px 2px 0 0;cursor:ne-resize;left:200px;margin:-2px 0 0 -20px;top:100px}.tox .tox-image-tools .tox-croprect-handle-sw{border-width:0 0 2px 2px;cursor:sw-resize;left:100px;margin:-20px 2px 0 -2px;top:200px}.tox .tox-image-tools .tox-croprect-handle-se{border-width:0 2px 2px 0;cursor:se-resize;left:200px;margin:-20px 0 0 -20px;top:200px}.tox .tox-insert-table-picker{background-color:#fff;display:flex;flex-wrap:wrap;width:170px}.tox .tox-insert-table-picker>div{border-color:#eee;border-style:solid;border-width:0 1px 1px 0;box-sizing:border-box;height:17px;width:17px}.tox .tox-collection--list .tox-collection__group .tox-insert-table-picker{margin:-4px -4px}.tox .tox-insert-table-picker .tox-insert-table-picker__selected{background-color:#006ce7;border-color:#eee}@media (forced-colors:active){.tox .tox-insert-table-picker .tox-insert-table-picker__selected{border-color:Highlight;filter:contrast(50%)}}.tox .tox-insert-table-picker__label{color:rgba(34,47,62,.7);display:block;font-size:14px;padding:4px;text-align:center;width:100%}.tox:not([dir=rtl]) .tox-insert-table-picker>div:nth-child(10n){border-right:0}.tox[dir=rtl] .tox-insert-table-picker>div:nth-child(10n+1){border-right:0}.tox .tox-menu{background-color:#fff;border:1px solid transparent;border-radius:6px;box-shadow:0 0 2px 0 rgba(34,47,62,.2),0 4px 8px 0 rgba(34,47,62,.15);display:inline-block;overflow:hidden;vertical-align:top;z-index:1150}.tox .tox-menu.tox-collection.tox-collection--list{padding:0 4px}.tox .tox-menu.tox-collection.tox-collection--toolbar{padding:8px}.tox .tox-menu.tox-collection.tox-collection--grid{padding:8px}@media only screen and (min-width:768px){.tox .tox-menu .tox-collection__item-label{overflow-wrap:break-word;word-break:normal}.tox .tox-dialog__popups .tox-menu .tox-collection__item-label{word-break:break-all}}.tox .tox-menu__label blockquote,.tox .tox-menu__label code,.tox .tox-menu__label h1,.tox .tox-menu__label h2,.tox .tox-menu__label h3,.tox .tox-menu__label h4,.tox .tox-menu__label h5,.tox .tox-menu__label h6,.tox .tox-menu__label p{margin:0}.tox .tox-menubar{background:repeating-linear-gradient(transparent 0 1px,transparent 1px 39px) center top 39px/100% calc(100% - 39px) no-repeat;background-color:#fff;display:flex;flex:0 0 auto;flex-shrink:0;flex-wrap:wrap;grid-column:1/-1;grid-row:1;padding:0 11px 0 12px}.tox .tox-promotion+.tox-menubar{grid-column:1}.tox .tox-promotion{background:repeating-linear-gradient(transparent 0 1px,transparent 1px 39px) center top 39px/100% calc(100% - 39px) no-repeat;background-color:#fff;grid-column:2;grid-row:1;padding-inline-end:8px;padding-inline-start:4px;padding-top:5px}.tox .tox-promotion-link{align-items:unsafe center;background-color:#e8f1f8;border-radius:5px;color:#086be6;cursor:pointer;display:flex;font-size:14px;height:26.6px;padding:4px 8px;white-space:nowrap}.tox .tox-promotion-link:hover{background-color:#b4d7ff}.tox .tox-promotion-link:focus{background-color:#d9edf7}.tox .tox-mbtn{align-items:center;background:#fff;border:0;border-radius:3px;box-shadow:none;color:#222f3e;display:flex;flex:0 0 auto;font-size:14px;font-style:normal;font-weight:400;height:28px;justify-content:center;margin:5px 1px 6px 0;outline:0;padding:0 4px;text-transform:none;width:auto}.tox .tox-mbtn[disabled]{background-color:#fff;border:0;box-shadow:none;color:rgba(34,47,62,.5);cursor:not-allowed}.tox .tox-mbtn:focus:not(:disabled){background:#fff;border:0;box-shadow:none;color:#222f3e;position:relative;z-index:1}.tox .tox-mbtn:focus:not(:disabled)::after{border-radius:3px;bottom:0;box-shadow:0 0 0 2px #006ce7;content:'';left:0;position:absolute;right:0;top:0}@media (forced-colors:active){.tox .tox-mbtn:focus:not(:disabled)::after{border:2px solid highlight}}.tox .tox-mbtn--active,.tox .tox-mbtn:not(:disabled).tox-mbtn--active:focus{background:#a6ccf7;border:0;box-shadow:none;color:#222f3e}.tox .tox-mbtn:hover:not(:disabled):not(.tox-mbtn--active){background:#f0f0f0;border:0;box-shadow:none;color:#222f3e}.tox .tox-mbtn__select-label{cursor:default;font-weight:400;margin:0 4px}.tox .tox-mbtn[disabled] .tox-mbtn__select-label{cursor:not-allowed}.tox .tox-mbtn__select-chevron{align-items:center;display:flex;justify-content:center;width:16px;display:none}.tox .tox-notification{border-radius:6px;border-style:solid;border-width:1px;box-shadow:none;box-sizing:border-box;display:grid;font-size:14px;font-weight:400;grid-template-columns:minmax(40px,1fr) auto minmax(40px,1fr);margin-left:auto;margin-right:auto;margin-top:4px;opacity:0;padding:4px;transition:transform .1s ease-in,opacity 150ms ease-in;width:-moz-max-content;width:max-content}.tox .tox-notification a{cursor:pointer;text-decoration:underline}.tox .tox-notification p{font-size:14px;font-weight:400}.tox .tox-notification:focus{border-color:#006ce7;box-shadow:0 0 0 1px #006ce7}.tox .tox-notification--in{opacity:1}.tox .tox-notification--success{background-color:#e4eeda;border-color:#d7e6c8;color:#222f3e}.tox .tox-notification--success p{color:#222f3e}.tox .tox-notification--success a{color:#517342}.tox .tox-notification--success a:focus,.tox .tox-notification--success a:hover{color:#24321d;text-decoration:underline}.tox .tox-notification--success a:focus-visible{border-radius:1px;outline:2px solid #517342;outline-offset:2px}.tox .tox-notification--success a:active{color:#0d120a;text-decoration:underline}.tox .tox-notification--success svg{fill:#222f3e}.tox .tox-notification--error{background-color:#f5cccc;border-color:#f0b3b3;color:#222f3e}.tox .tox-notification--error p{color:#222f3e}.tox .tox-notification--error a{color:#77181f}.tox .tox-notification--error a:focus,.tox .tox-notification--error a:hover{color:#220709;text-decoration:underline}.tox .tox-notification--error a:focus-visible{border-radius:1px;outline:2px solid #77181f;outline-offset:2px}.tox .tox-notification--error a:active{color:#000;text-decoration:underline}.tox .tox-notification--error svg{fill:#222f3e}.tox .tox-notification--warn,.tox .tox-notification--warning{background-color:#fff5cc;border-color:#fff0b3;color:#222f3e}.tox .tox-notification--warn p,.tox .tox-notification--warning p{color:#222f3e}.tox .tox-notification--warn a,.tox .tox-notification--warning a{color:#7a6e25}.tox .tox-notification--warn a:focus,.tox .tox-notification--warn a:hover,.tox .tox-notification--warning a:focus,.tox .tox-notification--warning a:hover{color:#2c280d;text-decoration:underline}.tox .tox-notification--warn a:focus-visible,.tox .tox-notification--warning a:focus-visible{border-radius:1px;outline:2px solid #7a6e25;outline-offset:2px}.tox .tox-notification--warn a:active,.tox .tox-notification--warning a:active{color:#050502;text-decoration:underline}.tox .tox-notification--warn svg,.tox .tox-notification--warning svg{fill:#222f3e}.tox .tox-notification--info{background-color:#d6e7fb;border-color:#c1dbf9;color:#222f3e}.tox .tox-notification--info p{color:#222f3e}.tox .tox-notification--info a{color:#2a64a6}.tox .tox-notification--info a:focus,.tox .tox-notification--info a:hover{color:#163355;text-decoration:underline}.tox .tox-notification--info a:focus-visible{border-radius:1px;outline:2px solid #2a64a6;outline-offset:2px}.tox .tox-notification--info a:active{color:#0b1a2c;text-decoration:underline}.tox .tox-notification--info svg{fill:#222f3e}.tox .tox-notification__body{align-self:center;color:#222f3e;font-size:14px;grid-column-end:3;grid-column-start:2;grid-row-end:2;grid-row-start:1;text-align:center;white-space:normal;word-break:break-all;word-break:break-word}.tox .tox-notification__body>*{margin:0}.tox .tox-notification__body>*+*{margin-top:1rem}.tox .tox-notification__icon{align-self:center;grid-column-end:2;grid-column-start:1;grid-row-end:2;grid-row-start:1;justify-self:end}.tox .tox-notification__icon svg{display:block}.tox .tox-notification__dismiss{align-self:start;grid-column-end:4;grid-column-start:3;grid-row-end:2;grid-row-start:1;justify-self:end}.tox .tox-notification .tox-progress-bar{grid-column-end:4;grid-column-start:1;grid-row-end:3;grid-row-start:2;justify-self:center}.tox .tox-notification-container-dock-fadeout{opacity:0;visibility:hidden}.tox .tox-notification-container-dock-fadein{opacity:1;visibility:visible}.tox .tox-notification-container-dock-transition{transition:visibility 0s linear .3s,opacity .3s ease}.tox .tox-notification-container-dock-transition.tox-notification-container-dock-fadein{transition-delay:0s}.tox .tox-pop{display:inline-block;position:relative}.tox .tox-pop--resizing{transition:width .1s ease}.tox .tox-pop--resizing .tox-toolbar,.tox .tox-pop--resizing .tox-toolbar__group{flex-wrap:nowrap}.tox .tox-pop--transition{transition:.15s ease;transition-property:left,right,top,bottom}.tox .tox-pop--transition::after,.tox .tox-pop--transition::before{transition:all .15s,visibility 0s,opacity 75ms ease 75ms}.tox .tox-pop__dialog{background-color:#fff;border:1px solid #eee;border-radius:6px;box-shadow:0 0 2px 0 rgba(34,47,62,.2),0 4px 8px 0 rgba(34,47,62,.15);min-width:0;overflow:hidden}.tox .tox-pop__dialog>:not(.tox-toolbar){margin:4px 4px 4px 8px}.tox .tox-pop__dialog .tox-toolbar{background-color:transparent;margin-bottom:-1px}.tox .tox-pop::after,.tox .tox-pop::before{border-style:solid;content:'';display:block;height:0;opacity:1;position:absolute;width:0}@media (forced-colors:active){.tox .tox-pop::after,.tox .tox-pop::before{content:none}}.tox .tox-pop.tox-pop--inset::after,.tox .tox-pop.tox-pop--inset::before{opacity:0;transition:all 0s .15s,visibility 0s,opacity 75ms ease}.tox .tox-pop.tox-pop--bottom::after,.tox .tox-pop.tox-pop--bottom::before{left:50%;top:100%}.tox .tox-pop.tox-pop--bottom::after{border-color:#fff transparent transparent transparent;border-width:8px;margin-left:-8px;margin-top:-1px}.tox .tox-pop.tox-pop--bottom::before{border-color:#eee transparent transparent transparent;border-width:9px;margin-left:-9px}.tox .tox-pop.tox-pop--top::after,.tox .tox-pop.tox-pop--top::before{left:50%;top:0;transform:translateY(-100%)}.tox .tox-pop.tox-pop--top::after{border-color:transparent transparent #fff transparent;border-width:8px;margin-left:-8px;margin-top:1px}.tox .tox-pop.tox-pop--top::before{border-color:transparent transparent #eee transparent;border-width:9px;margin-left:-9px}.tox .tox-pop.tox-pop--left::after,.tox .tox-pop.tox-pop--left::before{left:0;top:calc(50% - 1px);transform:translateY(-50%)}.tox .tox-pop.tox-pop--left::after{border-color:transparent #fff transparent transparent;border-width:8px;margin-left:-15px}.tox .tox-pop.tox-pop--left::before{border-color:transparent #eee transparent transparent;border-width:10px;margin-left:-19px}.tox .tox-pop.tox-pop--right::after,.tox .tox-pop.tox-pop--right::before{left:100%;top:calc(50% + 1px);transform:translateY(-50%)}.tox .tox-pop.tox-pop--right::after{border-color:transparent transparent transparent #fff;border-width:8px;margin-left:-1px}.tox .tox-pop.tox-pop--right::before{border-color:transparent transparent transparent #eee;border-width:10px;margin-left:-1px}.tox .tox-pop.tox-pop--align-left::after,.tox .tox-pop.tox-pop--align-left::before{left:20px}.tox .tox-pop.tox-pop--align-right::after,.tox .tox-pop.tox-pop--align-right::before{left:calc(100% - 20px)}.tox .tox-sidebar-wrap{display:flex;flex-direction:row;flex-grow:1;min-height:0}.tox .tox-sidebar{background-color:#fff;display:flex;flex-direction:row;justify-content:flex-end}.tox .tox-sidebar__slider{display:flex;overflow:hidden}.tox .tox-sidebar__pane-container{display:flex}.tox .tox-sidebar__pane{display:flex}.tox .tox-sidebar--sliding-closed{opacity:0}.tox .tox-sidebar--sliding-open{opacity:1}.tox .tox-sidebar--sliding-growing,.tox .tox-sidebar--sliding-shrinking{transition:width .5s ease,opacity .5s ease}.tox .tox-selector{background-color:#4099ff;border-color:#4099ff;border-style:solid;border-width:1px;box-sizing:border-box;display:inline-block;height:10px;position:absolute;width:10px}.tox.tox-platform-touch .tox-selector{height:12px;width:12px}.tox .tox-slider{align-items:center;display:flex;flex:1;height:24px;justify-content:center;position:relative}.tox .tox-slider__rail{background-color:transparent;border:1px solid #eee;border-radius:6px;height:10px;min-width:120px;width:100%}.tox .tox-slider__handle{background-color:#006ce7;border:2px solid #0054b4;border-radius:6px;box-shadow:none;height:24px;left:50%;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:14px}.tox .tox-form__controls-h-stack>.tox-slider:not(:first-of-type){margin-inline-start:8px}.tox .tox-form__controls-h-stack>.tox-form__group+.tox-slider{margin-inline-start:32px}.tox .tox-form__controls-h-stack>.tox-slider+.tox-form__group{margin-inline-start:32px}.tox .tox-source-code{overflow:auto}.tox .tox-spinner{display:flex}.tox .tox-spinner>div{animation:tam-bouncing-dots 1.5s ease-in-out 0s infinite both;background-color:rgba(34,47,62,.7);border-radius:100%;height:8px;width:8px}.tox .tox-spinner>div:nth-child(1){animation-delay:-.32s}.tox .tox-spinner>div:nth-child(2){animation-delay:-.16s}@keyframes tam-bouncing-dots{0%,100%,80%{transform:scale(0)}40%{transform:scale(1)}}.tox:not([dir=rtl]) .tox-spinner>div:not(:first-child){margin-left:4px}.tox[dir=rtl] .tox-spinner>div:not(:first-child){margin-right:4px}.tox .tox-statusbar{align-items:center;background-color:#fff;border-top:1px solid #e3e3e3;color:rgba(34,47,62,.7);display:flex;flex:0 0 auto;font-size:14px;font-weight:400;height:25px;overflow:hidden;padding:0 8px;position:relative;text-transform:none}.tox .tox-statusbar__path{display:flex;flex:1 1 auto;text-overflow:ellipsis;white-space:nowrap}.tox .tox-statusbar__right-container{display:flex;justify-content:flex-end;white-space:nowrap}.tox .tox-statusbar__help-text{text-align:center}.tox .tox-statusbar__text-container{display:flex;flex:1 1 auto;justify-content:space-between}@media only screen and (min-width:768px){.tox .tox-statusbar__text-container.tox-statusbar__text-container-3-cols>.tox-statusbar__help-text,.tox .tox-statusbar__text-container.tox-statusbar__text-container-3-cols>.tox-statusbar__path,.tox .tox-statusbar__text-container.tox-statusbar__text-container-3-cols>.tox-statusbar__right-container{flex:0 0 calc(100% / 3)}}.tox .tox-statusbar__text-container.tox-statusbar__text-container--flex-end{justify-content:flex-end}.tox .tox-statusbar__text-container.tox-statusbar__text-container--flex-start{justify-content:flex-start}.tox .tox-statusbar__text-container.tox-statusbar__text-container--space-around{justify-content:space-around}.tox .tox-statusbar__path>*{display:inline;white-space:nowrap}.tox .tox-statusbar__wordcount{flex:0 0 auto;margin-left:1ch}@media only screen and (max-width:767px){.tox .tox-statusbar__text-container .tox-statusbar__help-text{display:none}.tox .tox-statusbar__text-container .tox-statusbar__help-text:only-child{display:block}}.tox .tox-statusbar a,.tox .tox-statusbar__path-item,.tox .tox-statusbar__wordcount{color:rgba(34,47,62,.7);position:relative;text-decoration:none}.tox .tox-statusbar a:focus:not(:disabled):not([aria-disabled=true]),.tox .tox-statusbar a:hover:not(:disabled):not([aria-disabled=true]),.tox .tox-statusbar__path-item:focus:not(:disabled):not([aria-disabled=true]),.tox .tox-statusbar__path-item:hover:not(:disabled):not([aria-disabled=true]),.tox .tox-statusbar__wordcount:focus:not(:disabled):not([aria-disabled=true]),.tox .tox-statusbar__wordcount:hover:not(:disabled):not([aria-disabled=true]){color:#222f3e;cursor:pointer}.tox .tox-statusbar a:focus-visible::after,.tox .tox-statusbar__path-item:focus-visible::after,.tox .tox-statusbar__wordcount:focus-visible::after{border-radius:3px;bottom:0;box-shadow:0 0 0 2px #006ce7;content:'';left:0;position:absolute;right:0;top:0}@media (forced-colors:active){.tox .tox-statusbar a:focus-visible::after,.tox .tox-statusbar__path-item:focus-visible::after,.tox .tox-statusbar__wordcount:focus-visible::after{border:2px solid highlight}}.tox .tox-statusbar__branding svg{fill:rgba(34,47,62,.8);height:1.14em;vertical-align:-.28em;width:3.6em}@media (forced-colors:active){.tox .tox-statusbar__branding svg{fill:currentColor}}.tox .tox-statusbar__branding a:focus:not(:disabled):not([aria-disabled=true]) svg,.tox .tox-statusbar__branding a:hover:not(:disabled):not([aria-disabled=true]) svg{fill:#222f3e}.tox .tox-statusbar__resize-handle{align-items:flex-end;align-self:stretch;cursor:nwse-resize;display:flex;flex:0 0 auto;justify-content:flex-end;margin-bottom:3px;margin-left:4px;margin-right:calc(3px - 8px);margin-top:3px;padding-bottom:0;padding-left:0;padding-right:0;position:relative}.tox .tox-statusbar__resize-handle svg{display:block;fill:rgba(34,47,62,.5)}.tox .tox-statusbar__resize-handle:focus svg,.tox .tox-statusbar__resize-handle:hover svg{fill:#222f3e}.tox .tox-statusbar__resize-handle:focus-visible{background-color:transparent;border-radius:1px 1px 5px 1px;box-shadow:0 0 0 2px transparent}.tox .tox-statusbar__resize-handle:focus-visible::after{border-radius:3px;bottom:0;box-shadow:0 0 0 2px #006ce7;content:'';left:0;position:absolute;right:0;top:0}@media (forced-colors:active){.tox .tox-statusbar__resize-handle:focus-visible::after{border:2px solid highlight}}.tox:not([dir=rtl]) .tox-statusbar__path>*{margin-right:4px}.tox:not([dir=rtl]) .tox-statusbar__branding{margin-left:2ch}.tox[dir=rtl] .tox-statusbar{flex-direction:row-reverse}.tox[dir=rtl] .tox-statusbar__path>*{margin-left:4px}.tox .tox-throbber{z-index:1299}.tox .tox-throbber__busy-spinner{align-items:center;background-color:rgba(255,255,255,.6);bottom:0;display:flex;justify-content:center;left:0;position:absolute;right:0;top:0}.tox .tox-tbtn{align-items:center;background:#fff;border:0;border-radius:3px;box-shadow:none;color:#222f3e;display:flex;flex:0 0 auto;font-size:14px;font-style:normal;font-weight:400;height:28px;justify-content:center;margin:6px 1px 5px 0;outline:0;padding:0;text-transform:none;width:34px}@media (forced-colors:active){.tox .tox-tbtn.tox-tbtn:hover,.tox .tox-tbtn:hover{outline:1px dashed currentColor}.tox .tox-tbtn.tox-tbtn--active,.tox .tox-tbtn.tox-tbtn--enabled,.tox .tox-tbtn.tox-tbtn--enabled:focus,.tox .tox-tbtn.tox-tbtn--enabled:hover,.tox .tox-tbtn:focus:not(.tox-tbtn--disabled){outline:1px solid currentColor;position:relative}}.tox .tox-tbtn svg{display:block;fill:#222f3e}@media (forced-colors:active){.tox .tox-tbtn svg{fill:currentColor!important}.tox .tox-tbtn svg.tox-tbtn--enabled,.tox .tox-tbtn svg:focus:not(.tox-tbtn--disabled){fill:currentColor!important}.tox .tox-tbtn svg .tox-tbtn:disabled,.tox .tox-tbtn svg .tox-tbtn:disabled:hover,.tox .tox-tbtn svg.tox-tbtn--disabled,.tox .tox-tbtn svg.tox-tbtn--disabled:hover{filter:contrast(0)}}.tox .tox-tbtn.tox-tbtn-more{padding-left:5px;padding-right:5px;width:inherit}.tox .tox-tbtn:focus{background:#fff;border:0;box-shadow:none;position:relative;z-index:1}.tox .tox-tbtn:focus::after{border-radius:3px;bottom:0;box-shadow:0 0 0 2px #006ce7;content:'';left:0;position:absolute;right:0;top:0}@media (forced-colors:active){.tox .tox-tbtn:focus::after{border:2px solid highlight}}.tox .tox-tbtn:hover{background:#f0f0f0;border:0;box-shadow:none;color:#222f3e}.tox .tox-tbtn:hover svg{fill:#222f3e}.tox .tox-tbtn:active{background:#a6ccf7;border:0;box-shadow:none;color:#222f3e}.tox .tox-tbtn:active svg{fill:#222f3e}.tox .tox-tbtn--disabled .tox-tbtn--enabled svg{fill:rgba(34,47,62,.5)}.tox .tox-tbtn--disabled,.tox .tox-tbtn--disabled:hover,.tox .tox-tbtn:disabled,.tox .tox-tbtn:disabled:hover{background:#fff;border:0;box-shadow:none;color:rgba(34,47,62,.5);cursor:not-allowed}.tox .tox-tbtn--disabled svg,.tox .tox-tbtn--disabled:hover svg,.tox .tox-tbtn:disabled svg,.tox .tox-tbtn:disabled:hover svg{fill:rgba(34,47,62,.5)}.tox .tox-tbtn--active,.tox .tox-tbtn--enabled,.tox .tox-tbtn--enabled:focus,.tox .tox-tbtn--enabled:hover{background:#a6ccf7;border:0;box-shadow:none;color:#222f3e;position:relative}.tox .tox-tbtn--active>*,.tox .tox-tbtn--enabled:focus>*,.tox .tox-tbtn--enabled:hover>*,.tox .tox-tbtn--enabled>*{transform:none}.tox .tox-tbtn--active svg,.tox .tox-tbtn--enabled svg,.tox .tox-tbtn--enabled:focus svg,.tox .tox-tbtn--enabled:hover svg{fill:#222f3e}.tox .tox-tbtn--active.tox-tbtn--disabled svg,.tox .tox-tbtn--enabled.tox-tbtn--disabled svg,.tox .tox-tbtn--enabled:focus.tox-tbtn--disabled svg,.tox .tox-tbtn--enabled:hover.tox-tbtn--disabled svg{fill:rgba(34,47,62,.5)}.tox .tox-tbtn--enabled:focus::after{border-radius:3px;bottom:0;box-shadow:0 0 0 2px #006ce7;content:'';left:0;position:absolute;right:0;top:0}@media (forced-colors:active){.tox .tox-tbtn--enabled:focus::after{border:2px solid highlight}}.tox .tox-tbtn:focus:not(.tox-tbtn--disabled){color:#222f3e}.tox .tox-tbtn:focus:not(.tox-tbtn--disabled) svg{fill:#222f3e}.tox .tox-tbtn:active>*{transform:none}.tox .tox-tbtn--md{height:42px;width:51px}.tox .tox-tbtn--lg{flex-direction:column;height:56px;width:68px}.tox .tox-tbtn--return{align-self:stretch;height:unset;width:16px}.tox .tox-tbtn--labeled{padding:0 4px;width:unset}.tox .tox-tbtn__vlabel{display:block;font-size:10px;font-weight:400;letter-spacing:-.025em;margin-bottom:4px;white-space:nowrap}.tox .tox-number-input{background:#f7f7f7;border-radius:3px;display:flex;margin:6px 1px 5px 0;position:relative;width:auto}.tox .tox-number-input:focus{background:#f7f7f7}.tox .tox-number-input:focus::after{border-radius:3px;bottom:0;box-shadow:0 0 0 2px #006ce7;content:'';left:0;position:absolute;right:0;top:0}@media (forced-colors:active){.tox .tox-number-input:focus::after{border:2px solid highlight}}.tox .tox-number-input .tox-input-wrapper{display:flex;pointer-events:none;position:relative;text-align:center}.tox .tox-number-input .tox-input-wrapper:focus{background-color:#f7f7f7;z-index:1}.tox .tox-number-input .tox-input-wrapper:focus::after{border-radius:3px;bottom:0;box-shadow:0 0 0 2px #006ce7;content:'';left:0;position:absolute;right:0;top:0}@media (forced-colors:active){.tox .tox-number-input .tox-input-wrapper:focus::after{border:2px solid highlight}}.tox .tox-number-input .tox-input-wrapper:has(input:focus)::after{border-radius:3px;bottom:0;box-shadow:0 0 0 2px #006ce7;content:'';left:0;position:absolute;right:0;top:0}@media (forced-colors:active){.tox .tox-number-input .tox-input-wrapper:has(input:focus)::after{border:2px solid highlight}}.tox .tox-number-input input{border-radius:3px;color:#222f3e;font-size:14px;margin:2px 0;pointer-events:all;position:relative;width:60px}.tox .tox-number-input input:hover{background:#f0f0f0;color:#222f3e}.tox .tox-number-input input:focus{background-color:#f7f7f7}.tox .tox-number-input input:disabled{background:#fff;border:0;box-shadow:none;color:rgba(34,47,62,.5);cursor:not-allowed}.tox .tox-number-input button{color:#222f3e;height:28px;position:relative;text-align:center;width:24px}@media (forced-colors:active){.tox .tox-number-input button:active,.tox .tox-number-input button:focus,.tox .tox-number-input button:hover{outline:1px solid currentColor!important}}.tox .tox-number-input button svg{display:block;fill:#222f3e;margin:0 auto;transform:scale(.67)}@media (forced-colors:active){.tox .tox-number-input button svg,.tox .tox-number-input button svg:active,.tox .tox-number-input button svg:hover{fill:currentColor!important}.tox .tox-number-input button svg:disabled{filter:contrast(0)}}.tox .tox-number-input button:focus{background:#f7f7f7;z-index:1}.tox .tox-number-input button:focus::after{border-radius:3px;bottom:0;box-shadow:0 0 0 2px #006ce7;content:'';left:0;position:absolute;right:0;top:0}@media (forced-colors:active){.tox .tox-number-input button:focus::after{border:2px solid highlight}}.tox .tox-number-input button:hover{background:#f0f0f0;border:0;box-shadow:none;color:#222f3e}.tox .tox-number-input button:hover svg{fill:#222f3e}.tox .tox-number-input button:active{background:#a6ccf7;border:0;box-shadow:none;color:#222f3e}.tox .tox-number-input button:active svg{fill:#222f3e}.tox .tox-number-input button:disabled{background:#fff;border:0;box-shadow:none;color:rgba(34,47,62,.5);cursor:not-allowed}.tox .tox-number-input button:disabled svg{fill:rgba(34,47,62,.5)}.tox .tox-number-input button.minus{border-radius:3px 0 0 3px}.tox .tox-number-input button.plus{border-radius:0 3px 3px 0}.tox .tox-number-input:focus:not(:active)>.tox-input-wrapper,.tox .tox-number-input:focus:not(:active)>button{background:#f7f7f7}.tox .tox-tbtn--select{margin:6px 1px 5px 0;padding:0 4px;width:auto}.tox .tox-tbtn__select-label{cursor:default;font-weight:400;height:initial;margin:0 4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tox .tox-tbtn__select-chevron{align-items:center;display:flex;justify-content:center;width:16px}.tox .tox-tbtn__select-chevron svg{fill:rgba(34,47,62,.5)}@media (forced-colors:active){.tox .tox-tbtn__select-chevron svg{fill:currentColor}}.tox .tox-tbtn--bespoke{background:#f7f7f7}.tox .tox-tbtn--bespoke:focus{background:#f7f7f7}.tox .tox-tbtn--bespoke+.tox-tbtn--bespoke{margin-inline-start:4px}.tox .tox-tbtn--bespoke .tox-tbtn__select-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:7em}.tox .tox-tbtn--disabled .tox-tbtn__select-label,.tox .tox-tbtn--select:disabled .tox-tbtn__select-label{cursor:not-allowed}.tox .tox-split-button{border:0;border-radius:3px;box-sizing:border-box;display:flex;margin:6px 1px 5px 0}.tox .tox-split-button:hover{box-shadow:0 0 0 1px #f0f0f0 inset}.tox .tox-split-button:focus{background:#fff;box-shadow:none;color:#222f3e;position:relative;z-index:1}.tox .tox-split-button:focus::after{pointer-events:none;border-radius:3px;bottom:0;box-shadow:0 0 0 2px #006ce7;content:'';left:0;position:absolute;right:0;top:0}@media (forced-colors:active){.tox .tox-split-button:focus::after{border:2px solid highlight}}.tox .tox-split-button>*{border-radius:0}.tox .tox-split-button>:nth-child(1){border-bottom-left-radius:3px;border-top-left-radius:3px}.tox .tox-split-button>:nth-child(2){border-bottom-right-radius:3px;border-top-right-radius:3px}.tox .tox-split-button__chevron{width:16px}.tox .tox-split-button__chevron svg{fill:rgba(34,47,62,.5)}@media (forced-colors:active){.tox .tox-split-button__chevron svg{fill:currentColor}}.tox .tox-split-button .tox-tbtn{margin:0}.tox .tox-split-button:focus .tox-tbtn{background-color:transparent}.tox .tox-split-button.tox-tbtn--disabled .tox-tbtn:focus,.tox .tox-split-button.tox-tbtn--disabled .tox-tbtn:hover,.tox .tox-split-button.tox-tbtn--disabled:focus,.tox .tox-split-button.tox-tbtn--disabled:hover{background:#fff;box-shadow:none;color:rgba(34,47,62,.5)}.tox.tox-platform-touch .tox-split-button .tox-tbtn--select{padding:0 0}.tox.tox-platform-touch .tox-split-button .tox-tbtn:not(.tox-tbtn--select):first-child{width:30px}.tox.tox-platform-touch .tox-split-button__chevron{width:20px}.tox .tox-split-button.tox-tbtn--disabled svg #tox-icon-highlight-bg-color__color,.tox .tox-split-button.tox-tbtn--disabled svg #tox-icon-text-color__color{opacity:.6}.tox .tox-toolbar-overlord{background-color:#fff}.tox .tox-toolbar,.tox .tox-toolbar__overflow,.tox .tox-toolbar__primary{background-attachment:local;background-color:#fff;background-image:repeating-linear-gradient(#e3e3e3 0 1px,transparent 1px 39px);background-position:center top 40px;background-repeat:no-repeat;background-size:calc(100% - 11px * 2) calc(100% - 41px);display:flex;flex:0 0 auto;flex-shrink:0;flex-wrap:wrap;padding:0 0;transform:perspective(1px)}.tox .tox-toolbar-overlord>.tox-toolbar,.tox .tox-toolbar-overlord>.tox-toolbar__overflow,.tox .tox-toolbar-overlord>.tox-toolbar__primary{background-position:center top 0;background-size:calc(100% - 11px * 2) calc(100% - 0px)}.tox .tox-toolbar__overflow.tox-toolbar__overflow--closed{height:0;opacity:0;padding-bottom:0;padding-top:0;visibility:hidden}.tox .tox-toolbar__overflow--growing{transition:height .3s ease,opacity .2s linear .1s}.tox .tox-toolbar__overflow--shrinking{transition:opacity .3s ease,height .2s linear .1s,visibility 0s linear .3s}.tox .tox-anchorbar,.tox .tox-toolbar-overlord{grid-column:1/-1}.tox .tox-menubar+.tox-toolbar,.tox .tox-menubar+.tox-toolbar-overlord{border-top:1px solid transparent;margin-top:-1px;padding-bottom:1px;padding-top:1px}@media (forced-colors:active){.tox .tox-menubar+.tox-toolbar,.tox .tox-menubar+.tox-toolbar-overlord{outline:1px solid currentColor}}.tox .tox-toolbar--scrolling{flex-wrap:nowrap;overflow-x:auto}.tox .tox-pop .tox-toolbar{border-width:0}.tox .tox-toolbar--no-divider{background-image:none}.tox .tox-toolbar-overlord .tox-toolbar:not(.tox-toolbar--scrolling):first-child,.tox .tox-toolbar-overlord .tox-toolbar__primary{background-position:center top 39px}.tox .tox-editor-header>.tox-toolbar--scrolling,.tox .tox-toolbar-overlord .tox-toolbar--scrolling:first-child{background-image:none}.tox.tox-tinymce-aux .tox-toolbar__overflow{background-color:#fff;background-position:center top 43px;background-size:calc(100% - 8px * 2) calc(100% - 51px);border:none;border-radius:6px;box-shadow:0 0 2px 0 rgba(34,47,62,.2),0 4px 8px 0 rgba(34,47,62,.15);overscroll-behavior:none;padding:4px 0}@media (forced-colors:active){.tox.tox-tinymce-aux .tox-toolbar__overflow{border:solid}}.tox-pop .tox-pop__dialog .tox-toolbar{background-position:center top 43px;background-size:calc(100% - 11px * 2) calc(100% - 51px);padding:4px 0}.tox .tox-toolbar__group{align-items:center;display:flex;flex-wrap:wrap;margin:0 0;padding:0 11px 0 12px}.tox .tox-toolbar__group--pull-right{margin-left:auto}.tox .tox-toolbar--scrolling .tox-toolbar__group{flex-shrink:0;flex-wrap:nowrap}.tox:not([dir=rtl]) .tox-toolbar__group:not(:last-of-type){border-right:1px solid transparent}.tox[dir=rtl] .tox-toolbar__group:not(:last-of-type){border-left:1px solid transparent}.tox .tox-tooltip{display:inline-block;max-width:15em;padding:8px;pointer-events:none;position:relative;width:-moz-max-content;width:max-content;z-index:1150}.tox .tox-tooltip__body{background-color:#222f3e;border-radius:6px;box-shadow:none;color:#fff;font-size:12px;font-style:normal;font-weight:600;overflow-wrap:break-word;padding:4px 6px;text-transform:none}@media (forced-colors:active){.tox .tox-tooltip__body{outline:outset 1px}}.tox .tox-tooltip__arrow{position:absolute}.tox .tox-tooltip--down .tox-tooltip__arrow{border-left:8px solid transparent;border-right:8px solid transparent;border-top:8px solid #222f3e;bottom:0;left:50%;position:absolute;transform:translateX(-50%)}.tox .tox-tooltip--up .tox-tooltip__arrow{border-bottom:8px solid #222f3e;border-left:8px solid transparent;border-right:8px solid transparent;left:50%;position:absolute;top:0;transform:translateX(-50%)}.tox .tox-tooltip--right .tox-tooltip__arrow{border-bottom:8px solid transparent;border-left:8px solid #222f3e;border-top:8px solid transparent;position:absolute;right:0;top:50%;transform:translateY(-50%)}.tox .tox-tooltip--left .tox-tooltip__arrow{border-bottom:8px solid transparent;border-right:8px solid #222f3e;border-top:8px solid transparent;left:0;position:absolute;top:50%;transform:translateY(-50%)}.tox .tox-tree{display:flex;flex-direction:column}.tox .tox-tree .tox-trbtn{align-items:center;background:0 0;border:0;border-radius:4px;box-shadow:none;color:#222f3e;display:flex;flex:0 0 auto;font-size:14px;font-style:normal;font-weight:400;height:28px;margin-bottom:4px;margin-top:4px;outline:0;overflow:hidden;padding:0;padding-left:8px;text-transform:none}.tox .tox-tree .tox-trbtn .tox-tree__label{cursor:default;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tox .tox-tree .tox-trbtn svg{display:block;fill:#222f3e}.tox .tox-tree .tox-trbtn:focus{background:#f0f0f0;border:0;box-shadow:none}.tox .tox-tree .tox-trbtn:hover{background:#f0f0f0;border:0;box-shadow:none;color:#222f3e}.tox .tox-tree .tox-trbtn:hover svg{fill:#222f3e}.tox .tox-tree .tox-trbtn:active{background:#a6ccf7;border:0;box-shadow:none;color:#222f3e}.tox .tox-tree .tox-trbtn:active svg{fill:#222f3e}.tox .tox-tree .tox-trbtn--disabled,.tox .tox-tree .tox-trbtn--disabled:hover,.tox .tox-tree .tox-trbtn:disabled,.tox .tox-tree .tox-trbtn:disabled:hover{background:0 0;border:0;box-shadow:none;color:rgba(34,47,62,.5);cursor:not-allowed}.tox .tox-tree .tox-trbtn--disabled svg,.tox .tox-tree .tox-trbtn--disabled:hover svg,.tox .tox-tree .tox-trbtn:disabled svg,.tox .tox-tree .tox-trbtn:disabled:hover svg{fill:rgba(34,47,62,.5)}.tox .tox-tree .tox-trbtn--enabled,.tox .tox-tree .tox-trbtn--enabled:hover{background:#a6ccf7;border:0;box-shadow:none;color:#222f3e}.tox .tox-tree .tox-trbtn--enabled:hover>*,.tox .tox-tree .tox-trbtn--enabled>*{transform:none}.tox .tox-tree .tox-trbtn--enabled svg,.tox .tox-tree .tox-trbtn--enabled:hover svg{fill:#222f3e}.tox .tox-tree .tox-trbtn:focus:not(.tox-trbtn--disabled){color:#222f3e}.tox .tox-tree .tox-trbtn:focus:not(.tox-trbtn--disabled) svg{fill:#222f3e}.tox .tox-tree .tox-trbtn:active>*{transform:none}.tox .tox-tree .tox-trbtn--return{align-self:stretch;height:unset;width:16px}.tox .tox-tree .tox-trbtn--labeled{padding:0 4px;width:unset}.tox .tox-tree .tox-trbtn__vlabel{display:block;font-size:10px;font-weight:400;letter-spacing:-.025em;margin-bottom:4px;white-space:nowrap}.tox .tox-tree .tox-tree--directory{display:flex;flex-direction:column}.tox .tox-tree .tox-tree--directory .tox-tree--directory__label{font-weight:700}.tox .tox-tree .tox-tree--directory .tox-tree--directory__label .tox-mbtn{margin-left:auto}.tox .tox-tree .tox-tree--directory .tox-tree--directory__label .tox-mbtn svg{fill:transparent}.tox .tox-tree .tox-tree--directory .tox-tree--directory__label .tox-mbtn.tox-mbtn--active svg,.tox .tox-tree .tox-tree--directory .tox-tree--directory__label .tox-mbtn:focus svg{fill:#222f3e}.tox .tox-tree .tox-tree--directory .tox-tree--directory__label:focus .tox-mbtn svg,.tox .tox-tree .tox-tree--directory .tox-tree--directory__label:hover .tox-mbtn svg{fill:#222f3e}.tox .tox-tree .tox-tree--directory .tox-tree--directory__label:hover:has(.tox-mbtn:hover){background-color:transparent;color:#222f3e}.tox .tox-tree .tox-tree--directory .tox-tree--directory__label:hover:has(.tox-mbtn:hover) .tox-chevron svg{fill:#222f3e}.tox .tox-tree .tox-tree--directory .tox-tree--directory__label .tox-chevron{margin-right:6px}.tox .tox-tree .tox-tree--directory .tox-tree--directory__label:has(+.tox-tree--directory__children--growing) .tox-chevron,.tox .tox-tree .tox-tree--directory .tox-tree--directory__label:has(+.tox-tree--directory__children--shrinking) .tox-chevron{transition:transform .5s ease-in-out}.tox .tox-tree .tox-tree--directory .tox-tree--directory__label:has(+.tox-tree--directory__children--growing) .tox-chevron,.tox .tox-tree .tox-tree--directory .tox-tree--directory__label:has(+.tox-tree--directory__children--open) .tox-chevron{transform:rotate(90deg)}.tox .tox-tree .tox-tree--leaf__label{font-weight:400}.tox .tox-tree .tox-tree--leaf__label .tox-mbtn{margin-left:auto}.tox .tox-tree .tox-tree--leaf__label .tox-mbtn svg{fill:transparent}.tox .tox-tree .tox-tree--leaf__label .tox-mbtn.tox-mbtn--active svg,.tox .tox-tree .tox-tree--leaf__label .tox-mbtn:focus svg{fill:#222f3e}.tox .tox-tree .tox-tree--leaf__label:hover .tox-mbtn svg{fill:#222f3e}.tox .tox-tree .tox-tree--leaf__label:hover:has(.tox-mbtn:hover){background-color:transparent;color:#222f3e}.tox .tox-tree .tox-tree--leaf__label:hover:has(.tox-mbtn:hover) .tox-chevron svg{fill:#222f3e}.tox .tox-tree .tox-tree--directory__children{overflow:hidden;padding-left:16px}.tox .tox-tree .tox-tree--directory__children.tox-tree--directory__children--growing,.tox .tox-tree .tox-tree--directory__children.tox-tree--directory__children--shrinking{transition:height .5s ease-in-out}.tox .tox-tree .tox-trbtn.tox-tree--leaf__label{display:flex;justify-content:space-between}.tox .tox-revisionhistory__pane{padding:0!important}.tox .tox-revisionhistory__container{display:flex;flex-direction:column;height:100%}.tox .tox-revisionhistory{background-color:#fff;border-radius:4px;border-top:1px solid #eee;display:flex;flex:1;height:100%;margin-top:8px;overflow-x:auto;overflow-y:hidden;position:relative;width:100%}.tox .tox-revisionhistory--align-right{margin-left:auto}.tox .tox-revisionhistory__iframe{flex:1}.tox .tox-revisionhistory__sidebar{border-left:1px solid #eee;height:100%;max-width:360px}.tox .tox-revisionhistory__sidebar .tox-revisionhistory__sidebar-title{border-bottom:1px solid #eee;color:#222f3e;font-size:20px;font-weight:400;height:60px;min-width:192px;padding:16px}.tox .tox-revisionhistory__sidebar .tox-revisionhistory__revisions{flex-direction:column;max-height:calc(100% - 60px);min-width:192px;overflow-y:auto;padding:8px}.tox .tox-revisionhistory__sidebar .tox-revisionhistory__revisions:focus{height:100%;position:relative;z-index:1}.tox .tox-revisionhistory__sidebar .tox-revisionhistory__revisions:focus::after{border-radius:3px;bottom:0;box-shadow:0 0 0 2px #006ce7;content:'';left:0;position:absolute;right:0;top:0;border-radius:6px;bottom:1px;left:1px;right:1px;top:1px}@media (forced-colors:active){.tox .tox-revisionhistory__sidebar .tox-revisionhistory__revisions:focus::after{border:2px solid highlight}}.tox .tox-revisionhistory__sidebar .tox-revisionhistory__revisions .tox-revisionhistory__card{border:1px solid #eee;border-radius:6px;color:#222f3e;cursor:pointer;font-size:14px;margin-bottom:8px;padding:8px;text-overflow:ellipsis;text-wrap:nowrap;width:100%}.tox .tox-revisionhistory__sidebar .tox-revisionhistory__revisions .tox-revisionhistory__card:hover{background-color:#f0f0f0;box-shadow:none;color:#222f3e}.tox .tox-revisionhistory__sidebar .tox-revisionhistory__revisions .tox-revisionhistory__card:focus{position:relative;z-index:1}.tox .tox-revisionhistory__sidebar .tox-revisionhistory__revisions .tox-revisionhistory__card:focus::after{border-radius:6px!important;border-radius:3px;bottom:0;box-shadow:0 0 0 2px #006ce7;content:'';left:0;position:absolute;right:0;top:0}@media (forced-colors:active){.tox .tox-revisionhistory__sidebar .tox-revisionhistory__revisions .tox-revisionhistory__card:focus::after{border:2px solid highlight}}.tox .tox-revisionhistory__sidebar .tox-revisionhistory__revisions .tox-revisionhistory__card.tox-revisionhistory__card--selected{background-color:#a6ccf7;box-shadow:none;color:#222f3e}.tox .tox-revisionhistory__sidebar .tox-revisionhistory__revisions .tox-revisionhistory__norevision{color:rgba(34,47,62,.7);font-size:16px;line-height:24px;padding:5px 5.5px}.tox .tox-view-wrap,.tox .tox-view-wrap__slot-container{background-color:#fff;display:flex;flex:1;flex-direction:column;height:100%}.tox .tox-view{display:flex;flex:1 1 auto;flex-direction:column;overflow:hidden}.tox .tox-view__header{align-items:center;display:flex;font-size:16px;justify-content:space-between;padding:10px 10px 2px 10px;position:relative}.tox .tox-view__label{color:#222f3e;font-weight:700;line-height:24px;padding:4px 16px;text-align:center;white-space:nowrap}.tox .tox-view__label--normal{font-size:16px}.tox .tox-view__label--large{font-size:20px}.tox .tox-view--mobile.tox-view__header,.tox .tox-view--mobile.tox-view__toolbar{padding:8px}.tox .tox-view--scrolling{flex-wrap:nowrap;overflow-x:auto}.tox .tox-view__toolbar{display:flex;flex-direction:row;gap:8px;justify-content:space-between;overflow-x:auto;padding:10px 10px 2px 10px}.tox .tox-view__toolbar__group{display:flex;flex-direction:row;gap:12px}.tox .tox-view__header-end,.tox .tox-view__header-start{display:flex}.tox .tox-view__pane{height:100%;padding:8px;position:relative;width:100%}.tox .tox-view__pane_panel{border:1px solid #eee;border-radius:6px}.tox:not([dir=rtl]) .tox-view__header .tox-view__header-end>*,.tox:not([dir=rtl]) .tox-view__header .tox-view__header-start>*{margin-left:8px}.tox[dir=rtl] .tox-view__header .tox-view__header-end>*,.tox[dir=rtl] .tox-view__header .tox-view__header-start>*{margin-right:8px}.tox .tox-well{border:1px solid #eee;border-radius:6px;padding:8px;width:100%}.tox .tox-well>:first-child{margin-top:0}.tox .tox-well>:last-child{margin-bottom:0}.tox .tox-well>:only-child{margin:0}.tox .tox-custom-editor{border:1px solid #eee;border-radius:6px;display:flex;flex:1;overflow:hidden;position:relative}.tox .tox-dialog-loading::before{background-color:rgba(0,0,0,.5);content:"";height:100%;position:absolute;width:100%;z-index:1000}.tox .tox-tab{cursor:pointer}.tox .tox-dialog__content-js{display:flex;flex:1}.tox .tox-dialog__body-content .tox-collection{display:flex;flex:1}`);(function(){var l=tinymce.util.Tools.resolve("tinymce.PluginManager");const n=(pe,Ge,Qe)=>{var Tt;return Qe(pe,Ge.prototype)?!0:((Tt=pe.constructor)===null||Tt===void 0?void 0:Tt.name)===Ge.name},o=pe=>{const Ge=typeof pe;return pe===null?"null":Ge==="object"&&Array.isArray(pe)?"array":Ge==="object"&&n(pe,String,(Qe,Tt)=>Tt.isPrototypeOf(Qe))?"string":Ge},i=pe=>Ge=>o(Ge)===pe,u=pe=>Ge=>typeof Ge===pe,h=pe=>Ge=>pe===Ge,g=i("string"),b=i("object"),S=i("array"),T=h(null),k=u("boolean"),R=pe=>pe==null,V=pe=>!R(pe),z=u("function"),$=(pe,Ge)=>{if(S(pe)){for(let Qe=0,Tt=pe.length;Qe<Tt;++Qe)if(!Ge(pe[Qe]))return!1;return!0}return!1},W=()=>{},Q=pe=>()=>pe,j=(pe,Ge)=>pe===Ge;class se{constructor(Ge,Qe){this.tag=Ge,this.value=Qe}static some(Ge){return new se(!0,Ge)}static none(){return se.singletonNone}fold(Ge,Qe){return this.tag?Qe(this.value):Ge()}isSome(){return this.tag}isNone(){return!this.tag}map(Ge){return this.tag?se.some(Ge(this.value)):se.none()}bind(Ge){return this.tag?Ge(this.value):se.none()}exists(Ge){return this.tag&&Ge(this.value)}forall(Ge){return!this.tag||Ge(this.value)}filter(Ge){return!this.tag||Ge(this.value)?this:se.none()}getOr(Ge){return this.tag?this.value:Ge}or(Ge){return this.tag?this:Ge}getOrThunk(Ge){return this.tag?this.value:Ge()}orThunk(Ge){return this.tag?this:Ge()}getOrDie(Ge){if(this.tag)return this.value;throw new Error(Ge??"Called getOrDie on None")}static from(Ge){return V(Ge)?se.some(Ge):se.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(Ge){this.tag&&Ge(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}se.singletonNone=new se(!1);const re=Array.prototype.indexOf,Y=Array.prototype.push,me=(pe,Ge)=>re.call(pe,Ge),ae=(pe,Ge)=>me(pe,Ge)>-1,Ce=(pe,Ge)=>{const Qe=pe.length,Tt=new Array(Qe);for(let pn=0;pn<Qe;pn++){const Sn=pe[pn];Tt[pn]=Ge(Sn,pn)}return Tt},Ue=(pe,Ge)=>{for(let Qe=0,Tt=pe.length;Qe<Tt;Qe++){const pn=pe[Qe];Ge(pn,Qe)}},ot=(pe,Ge,Qe)=>(Ue(pe,(Tt,pn)=>{Qe=Ge(Qe,Tt,pn)}),Qe),Ae=pe=>{const Ge=[];for(let Qe=0,Tt=pe.length;Qe<Tt;++Qe){if(!S(pe[Qe]))throw new Error("Arr.flatten item "+Qe+" was not an array, input: "+pe);Y.apply(Ge,pe[Qe])}return Ge},ve=(pe,Ge)=>Ae(Ce(pe,Ge)),Oe=(pe,Ge)=>{for(let Qe=0;Qe<pe.length;Qe++){const Tt=Ge(pe[Qe],Qe);if(Tt.isSome())return Tt}return se.none()},O=(pe,Ge,Qe=j)=>pe.exists(Tt=>Qe(Tt,Ge)),De=pe=>{const Ge=[],Qe=Tt=>{Ge.push(Tt)};for(let Tt=0;Tt<pe.length;Tt++)pe[Tt].each(Qe);return Ge},Fe=(pe,Ge)=>pe?se.some(Ge):se.none(),st=pe=>Ge=>Ge.options.get(pe),Ut=pe=>{const Ge=pe.options.register;Ge("link_assume_external_targets",{processor:Qe=>{const Tt=g(Qe)||k(Qe);return Tt?Qe===!0?{value:1,valid:Tt}:Qe==="http"||Qe==="https"?{value:Qe,valid:Tt}:{value:0,valid:Tt}:{valid:!1,message:"Must be a string or a boolean."}},default:!1}),Ge("link_context_toolbar",{processor:"boolean",default:!1}),Ge("link_list",{processor:Qe=>g(Qe)||z(Qe)||$(Qe,b)}),Ge("link_default_target",{processor:"string"}),Ge("link_default_protocol",{processor:"string",default:"https"}),Ge("link_target_list",{processor:Qe=>k(Qe)||$(Qe,b),default:!0}),Ge("link_rel_list",{processor:"object[]",default:[]}),Ge("link_class_list",{processor:"object[]",default:[]}),Ge("link_title",{processor:"boolean",default:!0}),Ge("allow_unsafe_link_target",{processor:"boolean",default:!1}),Ge("link_quicklink",{processor:"boolean",default:!1})},et=st("link_assume_external_targets"),Dt=st("link_context_toolbar"),Xe=st("link_list"),it=st("link_default_target"),qe=st("link_default_protocol"),mt=st("link_target_list"),Un=st("link_rel_list"),on=st("link_class_list"),vt=st("link_title"),an=st("allow_unsafe_link_target"),J=st("link_quicklink");var Bn=tinymce.util.Tools.resolve("tinymce.util.Tools");const Vn=pe=>g(pe.value)?pe.value:"",Rn=pe=>g(pe.text)?pe.text:g(pe.title)?pe.title:"",An=(pe,Ge)=>{const Qe=[];return Bn.each(pe,Tt=>{const pn=Rn(Tt);if(Tt.menu!==void 0){const Sn=An(Tt.menu,Ge);Qe.push({text:pn,items:Sn})}else{const Sn=Ge(Tt);Qe.push({text:pn,value:Sn})}}),Qe},jn=(pe=Vn)=>Ge=>se.from(Ge).map(Qe=>An(Qe,pe)),$t={sanitize:pe=>jn(Vn)(pe),sanitizeWith:jn,createUi:(pe,Ge)=>Qe=>({name:pe,type:"listbox",label:Ge,items:Qe}),getValue:Vn},xe=Object.keys,It=Object.hasOwnProperty,Dn=(pe,Ge)=>{const Qe=xe(pe);for(let Tt=0,pn=Qe.length;Tt<pn;Tt++){const Sn=Qe[Tt],Cs=pe[Sn];Ge(Cs,Sn)}},Ct=pe=>(Ge,Qe)=>{pe[Qe]=Ge},yo=(pe,Ge,Qe,Tt)=>{Dn(pe,(pn,Sn)=>{(Ge(pn,Sn)?Qe:Tt)(pn,Sn)})},Kn=(pe,Ge)=>{const Qe={};return yo(pe,Ge,Ct(Qe),W),Qe},Jt=(pe,Ge)=>It.call(pe,Ge),Qt=(pe,Ge)=>Jt(pe,Ge)&&pe[Ge]!==void 0&&pe[Ge]!==null;var Cn=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),Nn=tinymce.util.Tools.resolve("tinymce.util.URI");const kt=pe=>V(pe)&&pe.nodeName.toLowerCase()==="a",jo=pe=>kt(pe)&&!!xt(pe),ms=(pe,Ge)=>{if(pe.collapsed)return[];{const Qe=pe.cloneContents(),Tt=Qe.firstChild,pn=new Cn(Tt,Qe),Sn=[];let Cs=Tt;do Ge(Cs)&&Sn.push(Cs);while(Cs=pn.next());return Sn}},as=pe=>/^\w+:/i.test(pe),xt=pe=>{var Ge,Qe;return(Qe=(Ge=pe.getAttribute("data-mce-href"))!==null&&Ge!==void 0?Ge:pe.getAttribute("href"))!==null&&Qe!==void 0?Qe:""},Pt=(pe,Ge)=>{const Qe=["noopener"],Tt=pe?pe.split(/\s+/):[],pn=Ds=>Bn.trim(Ds.sort().join(" ")),Sn=Ds=>(Ds=Cs(Ds),Ds.length>0?Ds.concat(Qe):Qe),Cs=Ds=>Ds.filter(lr=>Bn.inArray(Qe,lr)===-1),wr=Ge?Sn(Tt):Cs(Tt);return wr.length>0?pn(wr):""},gn=pe=>pe.replace(/\uFEFF/g,""),At=(pe,Ge)=>(Ge=Ge||Is(pe.selection.getRng())[0]||pe.selection.getNode(),_i(Ge)?se.from(pe.dom.select("a[href]",Ge)[0]):se.from(pe.dom.getParent(Ge,"a[href]"))),On=(pe,Ge)=>At(pe,Ge).isSome(),In=(pe,Ge)=>{const Qe=Ge.fold(()=>pe.getContent({format:"text"}),Tt=>Tt.innerText||Tt.textContent||"");return gn(Qe)},Is=pe=>ms(pe,jo),kr=pe=>Bn.grep(pe,jo),Yt=pe=>kr(pe).length>0,Ps=pe=>Is(pe).length>0,qo=pe=>{const Ge=pe.schema.getTextInlineElements(),Qe=Sn=>Sn.nodeType===1&&!kt(Sn)&&!Jt(Ge,Sn.nodeName.toLowerCase());if(At(pe).exists(Sn=>Sn.hasAttribute("data-mce-block")))return!1;const pn=pe.selection.getRng();return pn.collapsed?!0:ms(pn,Qe).length===0},_i=pe=>V(pe)&&pe.nodeName==="FIGURE"&&/\bimage\b/i.test(pe.className),bs=pe=>ot(["title","rel","class","target"],(Qe,Tt)=>(pe[Tt].each(pn=>{Qe[Tt]=pn.length>0?pn:null}),Qe),{href:pe.href}),Ar=(pe,Ge)=>(Ge==="http"||Ge==="https")&&!as(pe)?Ge+"://"+pe:pe,Bl=(pe,Ge)=>{const Qe={...Ge};if(Un(pe).length===0&&!an(pe)){const Tt=Pt(Qe.rel,Qe.target==="_blank");Qe.rel=Tt||null}return se.from(Qe.target).isNone()&&mt(pe)===!1&&(Qe.target=it(pe)),Qe.href=Ar(Qe.href,et(pe)),Qe},aa=(pe,Ge,Qe,Tt)=>{Qe.each(pn=>{Jt(Ge,"innerText")?Ge.innerText=pn:Ge.textContent=pn}),pe.dom.setAttribs(Ge,Tt),pe.selection.select(Ge)},ps=(pe,Ge,Qe,Tt)=>{const pn=pe.dom;_i(Ge)?Ot(pn,Ge,Tt):Qe.fold(()=>{pe.execCommand("mceInsertLink",!1,Tt)},Sn=>{pe.insertContent(pn.createHTML("a",Tt,pn.encode(Sn)))})},dn=(pe,Ge,Qe)=>{const Tt=pe.selection.getNode(),pn=At(pe,Tt),Sn=Bl(pe,bs(Qe));pe.undoManager.transact(()=>{Qe.href===Ge.href&&Ge.attach(),pn.fold(()=>{ps(pe,Tt,Qe.text,Sn)},Cs=>{pe.focus(),aa(pe,Cs,Qe.text,Sn)})})},vo=pe=>{const Ge=pe.dom,Qe=pe.selection,Tt=Qe.getBookmark(),pn=Qe.getRng().cloneRange(),Sn=Ge.getParent(pn.startContainer,"a[href]",pe.getBody()),Cs=Ge.getParent(pn.endContainer,"a[href]",pe.getBody());Sn&&pn.setStartBefore(Sn),Cs&&pn.setEndAfter(Cs),Qe.setRng(pn),pe.execCommand("unlink"),Qe.moveToBookmark(Tt)},Gn=pe=>{pe.undoManager.transact(()=>{const Ge=pe.selection.getNode();_i(Ge)?Ie(pe,Ge):vo(pe),pe.focus()})},yn=pe=>{const{class:Ge,href:Qe,rel:Tt,target:pn,text:Sn,title:Cs}=pe;return Kn({class:Ge.getOrNull(),href:Qe,rel:Tt.getOrNull(),target:pn.getOrNull(),text:Sn.getOrNull(),title:Cs.getOrNull()},(wr,Ds)=>T(wr)===!1)},vr=(pe,Ge)=>{const Qe=pe.options.get,Tt={allow_html_data_urls:Qe("allow_html_data_urls"),allow_script_urls:Qe("allow_script_urls"),allow_svg_data_urls:Qe("allow_svg_data_urls")},pn=Ge.href;return{...Ge,href:Nn.isDomSafe(pn,"a",Tt)?pn:""}},ao=(pe,Ge,Qe)=>{const Tt=vr(pe,Qe);pe.hasPlugin("rtc",!0)?pe.execCommand("createlink",!1,yn(Tt)):dn(pe,Ge,Tt)},ze=pe=>{pe.hasPlugin("rtc",!0)?pe.execCommand("unlink"):Gn(pe)},Ie=(pe,Ge)=>{var Qe;const Tt=pe.dom.select("img",Ge)[0];if(Tt){const pn=pe.dom.getParents(Tt,"a[href]",Ge)[0];pn&&((Qe=pn.parentNode)===null||Qe===void 0||Qe.insertBefore(Tt,pn),pe.dom.remove(pn))}},Ot=(pe,Ge,Qe)=>{var Tt;const pn=pe.select("img",Ge)[0];if(pn){const Sn=pe.create("a",Qe);(Tt=pn.parentNode)===null||Tt===void 0||Tt.insertBefore(Sn,pn),Sn.appendChild(pn)}},_t=pe=>Qt(pe,"items"),Nt=(pe,Ge)=>Oe(Ge,Qe=>_t(Qe)?Nt(pe,Qe.items):Fe(Qe.value===pe,Qe)),_n=(pe,Ge,Qe,Tt)=>{const pn=Tt[Ge],Sn=pe.length>0;return pn!==void 0?Nt(pn,Qe).map(Cs=>({url:{value:Cs.value,meta:{text:Sn?pe:Cs.text,attach:W}},text:Sn?pe:Cs.text})):se.none()},sn=(pe,Ge)=>Ge==="link"?pe.link:Ge==="anchor"?pe.anchor:se.none(),Xn={init:(pe,Ge)=>{const Qe={text:pe.text,title:pe.title},Tt=Ds=>{var lr;return Fe(Qe.title.length<=0,se.from((lr=Ds.meta)===null||lr===void 0?void 0:lr.title).getOr(""))},pn=Ds=>{var lr;return Fe(Qe.text.length<=0,se.from((lr=Ds.meta)===null||lr===void 0?void 0:lr.text).getOr(Ds.value))},Sn=Ds=>{const lr=pn(Ds.url),ds=Tt(Ds.url);return lr.isSome()||ds.isSome()?se.some({...lr.map(Zr=>({text:Zr})).getOr({}),...ds.map(Zr=>({title:Zr})).getOr({})}):se.none()},Cs=(Ds,lr)=>{const ds=sn(Ge,lr).getOr([]);return _n(Qe.text,lr,ds,Ds)};return{onChange:(Ds,lr)=>{const ds=lr.name;return ds==="url"?Sn(Ds()):ae(["anchor","link"],ds)?Cs(Ds(),ds):((ds==="text"||ds==="title")&&(Qe[ds]=Ds()[ds]),se.none())}}},getDelta:_n};var zn=tinymce.util.Tools.resolve("tinymce.util.Delay");const Ko=(pe,Ge,Qe)=>{const Tt=pe.selection.getRng();zn.setEditorTimeout(pe,()=>{pe.windowManager.confirm(Ge,pn=>{pe.selection.setRng(Tt),Qe(pn)})})},To=pe=>{const Ge=pe.href;return Ge.indexOf("@")>0&&Ge.indexOf("/")===-1&&Ge.indexOf("mailto:")===-1?se.some({message:"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",preprocess:Tt=>({...Tt,href:"mailto:"+Ge})}):se.none()},Yo=(pe,Ge)=>Qe=>{const Tt=Qe.href;return pe===1&&!as(Tt)||pe===0&&/^\s*www(\.|\d\.)/i.test(Tt)?se.some({message:`The URL you entered seems to be an external link. Do you want to add the required ${Ge}:// prefix?`,preprocess:Sn=>({...Sn,href:Ge+"://"+Tt})}):se.none()},es={preprocess:(pe,Ge)=>Oe([To,Yo(et(pe),qe(pe))],Qe=>Qe(Ge)).fold(()=>Promise.resolve(Ge),Qe=>new Promise(Tt=>{Ko(pe,Qe.message,pn=>{Tt(pn?Qe.preprocess(Ge):Ge)})}))},hr={getAnchors:pe=>{const Ge=pe.dom.select("a:not([href])"),Qe=ve(Ge,Tt=>{const pn=Tt.name||Tt.id;return pn?[{text:pn,value:"#"+pn}]:[]});return Qe.length>0?se.some([{text:"None",value:""}].concat(Qe)):se.none()}},ts={getClasses:pe=>{const Ge=on(pe);return Ge.length>0?$t.sanitize(Ge):se.none()}},tr=pe=>{try{return se.some(JSON.parse(pe))}catch{return se.none()}},Ur={getLinks:pe=>{const Ge=Tt=>pe.convertURL(Tt.value||Tt.url||"","href"),Qe=Xe(pe);return new Promise(Tt=>{g(Qe)?fetch(Qe).then(pn=>pn.ok?pn.text().then(tr):Promise.reject()).then(Tt,()=>Tt(se.none())):z(Qe)?Qe(pn=>Tt(se.some(pn))):Tt(se.from(Qe))}).then(Tt=>Tt.bind($t.sanitizeWith(Ge)).map(pn=>pn.length>0?[{text:"None",value:""}].concat(pn):pn))}},la={getRels:(pe,Ge)=>{const Qe=Un(pe);if(Qe.length>0){const Tt=O(Ge,"_blank"),pn=an(pe)===!1,Sn=wr=>Pt($t.getValue(wr),Tt);return(pn?$t.sanitizeWith(Sn):$t.sanitize)(Qe)}return se.none()}},li=[{text:"Current window",value:""},{text:"New window",value:"_blank"}],xr={getTargets:pe=>{const Ge=mt(pe);return S(Ge)?$t.sanitize(Ge).orThunk(()=>se.some(li)):Ge===!1?se.none():se.some(li)}},qs=(pe,Ge,Qe)=>{const Tt=pe.getAttrib(Ge,Qe);return Tt!==null&&Tt.length>0?se.some(Tt):se.none()},Hi=(pe,Ge)=>{const Qe=pe.dom,pn=qo(pe)?se.some(In(pe.selection,Ge)):se.none(),Sn=Ge.bind(ds=>se.from(Qe.getAttrib(ds,"href"))),Cs=Ge.bind(ds=>se.from(Qe.getAttrib(ds,"target"))),wr=Ge.bind(ds=>qs(Qe,ds,"rel")),Ds=Ge.bind(ds=>qs(Qe,ds,"class")),lr=Ge.bind(ds=>qs(Qe,ds,"title"));return{url:Sn,text:pn,title:lr,target:Cs,rel:wr,linkClass:Ds}},Qa={collect:(pe,Ge)=>Ur.getLinks(pe).then(Qe=>{const Tt=Hi(pe,Ge);return{anchor:Tt,catalogs:{targets:xr.getTargets(pe),rels:la.getRels(pe,Tt.target),classes:ts.getClasses(pe),anchor:hr.getAnchors(pe),link:Qe},optNode:Ge,flags:{titleEnabled:vt(pe)}}})},La=(pe,Ge)=>Qe=>{const Tt=Qe.getData();if(!Tt.url.value){ze(pe),Qe.close();return}const pn=wr=>se.from(Tt[wr]).filter(Ds=>!O(Ge.anchor[wr],Ds)),Sn={href:Tt.url.value,text:pn("text"),target:pn("target"),rel:pn("rel"),class:pn("linkClass"),title:pn("title")},Cs={href:Tt.url.value,attach:Tt.url.meta!==void 0&&Tt.url.meta.attach?Tt.url.meta.attach:W};es.preprocess(pe,Sn).then(wr=>{ao(pe,Cs,wr)}),Qe.close()},Na=pe=>{const Ge=At(pe);return Qa.collect(pe,Ge)},vi=(pe,Ge)=>{const Qe=pe.anchor,Tt=Qe.url.getOr("");return{url:{value:Tt,meta:{original:{value:Tt}}},text:Qe.text.getOr(""),title:Qe.title.getOr(""),anchor:Tt,link:Tt,rel:Qe.rel.getOr(""),target:Qe.target.or(Ge).getOr(""),linkClass:Qe.linkClass.getOr("")}},jr=(pe,Ge,Qe)=>{const Tt=[{name:"url",type:"urlinput",filetype:"file",label:"URL",picker_text:"Browse links"}],pn=pe.anchor.text.map(()=>({name:"text",type:"input",label:"Text to display"})).toArray(),Sn=pe.flags.titleEnabled?[{name:"title",type:"input",label:"Title"}]:[],Cs=se.from(it(Qe)),wr=vi(pe,Cs),Ds=pe.catalogs,lr=Xn.init(wr,Ds);return{title:"Insert/Edit Link",size:"normal",body:{type:"panel",items:Ae([Tt,pn,Sn,De([Ds.anchor.map($t.createUi("anchor","Anchors")),Ds.rels.map($t.createUi("rel","Rel")),Ds.targets.map($t.createUi("target","Open link in...")),Ds.link.map($t.createUi("link","Link list")),Ds.classes.map($t.createUi("linkClass","Class"))])])},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:wr,onChange:(Zr,{name:Nc})=>{lr.onChange(Zr.getData,{name:Nc}).each(gs=>{Zr.setData(gs)})},onSubmit:Ge}},ca=pe=>{Na(pe).then(Qe=>{const Tt=La(pe,Qe);return jr(Qe,Tt,pe)}).then(Qe=>{pe.windowManager.open(Qe)})},yr=pe=>{pe.addCommand("mceLink",(Ge,Qe)=>{(Qe==null?void 0:Qe.dialog)===!0||!J(pe)?ca(pe):pe.dispatch("contexttoolbar-show",{toolbarKey:"quicklink"})})};var Ql=tinymce.util.Tools.resolve("tinymce.util.VK");const Nr=(pe,Ge)=>{document.body.appendChild(pe),pe.dispatchEvent(Ge),document.body.removeChild(pe)},Fa=pe=>{const Ge=document.createElement("a");Ge.target="_blank",Ge.href=pe,Ge.rel="noreferrer noopener";const Qe=document.createEvent("MouseEvents");Qe.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Nr(Ge,Qe)},Ra=pe=>{const Ge=pe.selection.getRng(),Qe=Ge.startContainer;return jo(Qe)&&Ge.startContainer===Ge.endContainer&&pe.dom.select("img",Qe).length===1},ua=pe=>pe.selection.isCollapsed()||Ra(pe)?kr(pe.dom.getParents(pe.selection.getStart())):Is(pe.selection.getRng()),Eo=pe=>ua(pe)[0],Mc=pe=>pe.altKey===!0&&pe.shiftKey===!1&&pe.ctrlKey===!1&&pe.metaKey===!1,xi=(pe,Ge)=>{if(Ge){const Qe=xt(Ge);if(/^#/.test(Qe)){const Tt=pe.dom.select(Qe);Tt.length&&pe.selection.scrollIntoView(Tt[0],!0)}else Fa(Ge.href)}},Di=pe=>()=>{pe.execCommand("mceLink",!1,{dialog:!0})},Ba=pe=>()=>{xi(pe,Eo(pe))},Lr=pe=>{pe.on("click",Ge=>{const Qe=kr(pe.dom.getParents(Ge.target));Qe.length===1&&Ql.metaKeyPressed(Ge)&&(Ge.preventDefault(),xi(pe,Qe[0]))}),pe.on("keydown",Ge=>{if(!Ge.isDefaultPrevented()&&Ge.keyCode===13&&Mc(Ge)){const Qe=Eo(pe);Qe&&(Ge.preventDefault(),xi(pe,Qe))}})},ei=(pe,Ge)=>(pe.on("NodeChange",Ge),()=>pe.off("NodeChange",Ge)),ec=pe=>Ge=>{const Qe=()=>{Ge.setActive(!pe.mode.isReadOnly()&&On(pe,pe.selection.getNode())),Ge.setEnabled(pe.selection.isEditable())};return Qe(),ei(pe,Qe)},Ro=pe=>Ge=>{const Qe=()=>{Ge.setEnabled(pe.selection.isEditable())};return Qe(),ei(pe,Qe)},tc=pe=>ua(pe).length===1,rl=pe=>Ge=>{const Qe=()=>Ge.setEnabled(tc(pe));return Qe(),ei(pe,Qe)},Fr=pe=>Ge=>{const Qe=Sn=>Yt(Sn)||Ps(pe.selection.getRng()),Tt=pe.dom.getParents(pe.selection.getStart()),pn=Sn=>{Ge.setEnabled(Qe(Sn)&&pe.selection.isEditable())};return pn(Tt),ei(pe,Sn=>pn(Sn.parents))},il=pe=>{pe.addShortcut("Meta+K","",()=>{pe.execCommand("mceLink")})},yi=pe=>{pe.ui.registry.addToggleButton("link",{icon:"link",tooltip:"Insert/edit link",onAction:Di(pe),onSetup:ec(pe),shortcut:"Meta+K"}),pe.ui.registry.addButton("openlink",{icon:"new-tab",tooltip:"Open link",onAction:Ba(pe),onSetup:rl(pe)}),pe.ui.registry.addButton("unlink",{icon:"unlink",tooltip:"Remove link",onAction:()=>ze(pe),onSetup:Fr(pe)})},Cu=pe=>{pe.ui.registry.addMenuItem("openlink",{text:"Open link",icon:"new-tab",onAction:Ba(pe),onSetup:rl(pe)}),pe.ui.registry.addMenuItem("link",{icon:"link",text:"Link...",shortcut:"Meta+K",onSetup:Ro(pe),onAction:Di(pe)}),pe.ui.registry.addMenuItem("unlink",{icon:"unlink",text:"Remove link",onAction:()=>ze(pe),onSetup:Fr(pe)})},_u=pe=>{const Ge="link unlink openlink",Qe="link";pe.ui.registry.addContextMenu("link",{update:Tt=>pe.dom.isEditable(Tt)?Yt(pe.dom.getParents(Tt,"a"))?Ge:Qe:""})},us=pe=>{const Ge=pn=>{pn.selection.collapse(!1)},Qe=pn=>{const Sn=pe.selection.getNode();return pn.setEnabled(On(pe,Sn)),W},Tt=pn=>{const Sn=At(pe),Cs=qo(pe);if(Sn.isNone()&&Cs){const wr=In(pe.selection,Sn);return Fe(wr.length===0,pn)}else return se.none()};pe.ui.registry.addContextForm("quicklink",{launch:{type:"contextformtogglebutton",icon:"link",tooltip:"Link",onSetup:ec(pe)},label:"Link",predicate:pn=>Dt(pe)&&On(pe,pn),initValue:()=>At(pe).fold(Q(""),xt),commands:[{type:"contextformtogglebutton",icon:"link",tooltip:"Link",primary:!0,onSetup:pn=>{const Sn=pe.selection.getNode();return pn.setActive(On(pe,Sn)),ec(pe)(pn)},onAction:pn=>{const Sn=pn.getValue(),Cs=Tt(Sn);ao(pe,{href:Sn,attach:W},{href:Sn,text:Cs,title:se.none(),rel:se.none(),target:se.from(it(pe)),class:se.none()}),Ge(pe),pn.hide()}},{type:"contextformbutton",icon:"unlink",tooltip:"Remove link",onSetup:Qe,onAction:pn=>{ze(pe),pn.hide()}},{type:"contextformbutton",icon:"new-tab",tooltip:"Open link",onSetup:Qe,onAction:pn=>{Ba(pe)(),pn.hide()}}]})};var al=()=>{l.add("link",pe=>{Ut(pe),yi(pe),Cu(pe),_u(pe),us(pe),Lr(pe),yr(pe),il(pe)})};al()})();(function(){var l=tinymce.util.Tools.resolve("tinymce.PluginManager");const n=(N,X,ce)=>{var Ne;return ce(N,X.prototype)?!0:((Ne=N.constructor)===null||Ne===void 0?void 0:Ne.name)===X.name},o=N=>{const X=typeof N;return N===null?"null":X==="object"&&Array.isArray(N)?"array":X==="object"&&n(N,String,(ce,Ne)=>Ne.isPrototypeOf(ce))?"string":X},i=N=>X=>o(X)===N,u=N=>X=>typeof X===N,h=i("string"),g=i("object"),b=i("array"),S=u("boolean"),T=N=>N==null,k=N=>!T(N),R=u("function"),V=u("number"),z=()=>{},$=(N,X)=>ce=>N(X(ce)),W=N=>()=>N,Q=(N,X)=>N===X;function j(N,...X){return(...ce)=>{const Ne=X.concat(ce);return N.apply(null,Ne)}}const se=N=>X=>!N(X),re=W(!1);class Y{constructor(X,ce){this.tag=X,this.value=ce}static some(X){return new Y(!0,X)}static none(){return Y.singletonNone}fold(X,ce){return this.tag?ce(this.value):X()}isSome(){return this.tag}isNone(){return!this.tag}map(X){return this.tag?Y.some(X(this.value)):Y.none()}bind(X){return this.tag?X(this.value):Y.none()}exists(X){return this.tag&&X(this.value)}forall(X){return!this.tag||X(this.value)}filter(X){return!this.tag||X(this.value)?this:Y.none()}getOr(X){return this.tag?this.value:X}or(X){return this.tag?this:X}getOrThunk(X){return this.tag?this.value:X()}orThunk(X){return this.tag?this:X()}getOrDie(X){if(this.tag)return this.value;throw new Error(X??"Called getOrDie on None")}static from(X){return k(X)?Y.some(X):Y.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(X){this.tag&&X(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}Y.singletonNone=new Y(!1);const me=Array.prototype.slice,ae=Array.prototype.indexOf,Ce=Array.prototype.push,Ue=(N,X)=>ae.call(N,X),ot=(N,X)=>Ue(N,X)>-1,Ae=(N,X)=>{for(let ce=0,Ne=N.length;ce<Ne;ce++){const We=N[ce];if(X(We,ce))return!0}return!1},ve=(N,X)=>{const ce=N.length,Ne=new Array(ce);for(let We=0;We<ce;We++){const Kt=N[We];Ne[We]=X(Kt,We)}return Ne},Oe=(N,X)=>{for(let ce=0,Ne=N.length;ce<Ne;ce++){const We=N[ce];X(We,ce)}},O=(N,X)=>{const ce=[];for(let Ne=0,We=N.length;Ne<We;Ne++){const Kt=N[Ne];X(Kt,Ne)&&ce.push(Kt)}return ce},De=(N,X)=>{if(N.length===0)return[];{let ce=X(N[0]);const Ne=[];let We=[];for(let Kt=0,Yn=N.length;Kt<Yn;Kt++){const Co=N[Kt],$o=X(Co);$o!==ce&&(Ne.push(We),We=[]),ce=$o,We.push(Co)}return We.length!==0&&Ne.push(We),Ne}},Fe=(N,X,ce)=>(Oe(N,(Ne,We)=>{ce=X(ce,Ne,We)}),ce),st=(N,X,ce)=>{for(let Ne=0,We=N.length;Ne<We;Ne++){const Kt=N[Ne];if(X(Kt,Ne))return Y.some(Kt);if(ce(Kt,Ne))break}return Y.none()},Ut=(N,X)=>st(N,X,re),et=N=>{const X=[];for(let ce=0,Ne=N.length;ce<Ne;++ce){if(!b(N[ce]))throw new Error("Arr.flatten item "+ce+" was not an array, input: "+N);Ce.apply(X,N[ce])}return X},Dt=(N,X)=>et(ve(N,X)),Xe=N=>{const X=me.call(N,0);return X.reverse(),X},it=(N,X)=>X>=0&&X<N.length?Y.some(N[X]):Y.none(),qe=N=>it(N,0),mt=N=>it(N,N.length-1),Un=(N,X)=>{const ce=[],Ne=R(X)?We=>Ae(ce,Kt=>X(Kt,We)):We=>ot(ce,We);for(let We=0,Kt=N.length;We<Kt;We++){const Yn=N[We];Ne(Yn)||ce.push(Yn)}return ce},on=(N,X,ce=Q)=>N.exists(Ne=>ce(Ne,X)),vt=(N,X,ce=Q)=>an(N,X,ce).getOr(N.isNone()&&X.isNone()),an=(N,X,ce)=>N.isSome()&&X.isSome()?Y.some(ce(N.getOrDie(),X.getOrDie())):Y.none(),J=8,Bn=9,Vn=11,Rn=1,An=3,jn=(N,X)=>{const Ne=(X||document).createElement("div");if(Ne.innerHTML=N,!Ne.hasChildNodes()||Ne.childNodes.length>1){const We="HTML does not have a single root node";throw console.error(We,N),new Error(We)}return $t(Ne.childNodes[0])},to=(N,X)=>{const Ne=(X||document).createElement(N);return $t(Ne)},mo=(N,X)=>{const Ne=(X||document).createTextNode(N);return $t(Ne)},$t=N=>{if(N==null)throw new Error("Node cannot be null or undefined");return{dom:N}},It={fromHtml:jn,fromTag:to,fromText:mo,fromDom:$t,fromPoint:(N,X,ce)=>Y.from(N.dom.elementFromPoint(X,ce)).map($t)},Dn=(N,X)=>{const ce=N.dom;if(ce.nodeType!==Rn)return!1;{const Ne=ce;if(Ne.matches!==void 0)return Ne.matches(X);if(Ne.msMatchesSelector!==void 0)return Ne.msMatchesSelector(X);if(Ne.webkitMatchesSelector!==void 0)return Ne.webkitMatchesSelector(X);if(Ne.mozMatchesSelector!==void 0)return Ne.mozMatchesSelector(X);throw new Error("Browser lacks native selectors")}},Ct=(N,X)=>N.dom===X.dom,yo=(N,X)=>{const ce=N.dom,Ne=X.dom;return ce===Ne?!1:ce.contains(Ne)},Kn=Dn,Jt=typeof window<"u"?window:Function("return this;")(),Qt=(N,X)=>{let ce=X??Jt;for(let Ne=0;Ne<N.length&&ce!==void 0&&ce!==null;++Ne)ce=ce[N[Ne]];return ce},Cn=(N,X)=>{const ce=N.split(".");return Qt(ce,X)},Nn=(N,X)=>Cn(N,X),kt=(N,X)=>{const ce=Nn(N,X);if(ce==null)throw new Error(N+" not available on this browser");return ce},jo=Object.getPrototypeOf,ms=N=>kt("HTMLElement",N),as=N=>{const X=Cn("ownerDocument.defaultView",N);return g(N)&&(ms(X).prototype.isPrototypeOf(N)||/^HTML\w*Element$/.test(jo(N).constructor.name))},xt=N=>N.dom.nodeName.toLowerCase(),Pt=N=>N.dom.nodeType,gn=N=>X=>Pt(X)===N,At=N=>Pt(N)===J||xt(N)==="#comment",On=N=>In(N)&&as(N.dom),In=gn(Rn),Is=gn(An),kr=gn(Bn),Yt=gn(Vn),Ps=N=>X=>In(X)&&xt(X)===N,qo=N=>It.fromDom(N.dom.ownerDocument),_i=N=>kr(N)?N:qo(N),bs=N=>Y.from(N.dom.parentNode).map(It.fromDom),Ar=N=>Y.from(N.dom.parentElement).map(It.fromDom),Bl=N=>Y.from(N.dom.nextSibling).map(It.fromDom),aa=N=>ve(N.dom.childNodes,It.fromDom),ps=(N,X)=>{const ce=N.dom.childNodes;return Y.from(ce[X]).map(It.fromDom)},dn=N=>ps(N,0),vo=N=>ps(N,N.dom.childNodes.length-1),Gn=N=>Yt(N)&&k(N.dom.host),vr=R(Element.prototype.attachShadow)&&R(Node.prototype.getRootNode)?N=>It.fromDom(N.dom.getRootNode()):_i,ao=N=>{const X=vr(N);return Gn(X)?Y.some(X):Y.none()},ze=N=>It.fromDom(N.dom.host),Ie=N=>{const X=Is(N)?N.dom.parentNode:N.dom;if(X==null||X.ownerDocument===null)return!1;const ce=X.ownerDocument;return ao(It.fromDom(X)).fold(()=>ce.body.contains(X),$(Ie,ze))};var Ot=(N,X,ce,Ne,We)=>N(ce,Ne)?Y.some(ce):R(We)&&We(ce)?Y.none():X(ce,Ne,We);const _t=(N,X,ce)=>{let Ne=N.dom;const We=R(ce)?ce:re;for(;Ne.parentNode;){Ne=Ne.parentNode;const Kt=It.fromDom(Ne);if(X(Kt))return Y.some(Kt);if(We(Kt))break}return Y.none()},Nt=(N,X,ce)=>Ot((We,Kt)=>Kt(We),_t,N,X,ce),_n=(N,X,ce)=>_t(N,Ne=>Dn(Ne,X),ce),sn=(N,X,ce)=>Ot((We,Kt)=>Dn(We,Kt),_n,N,X,ce),Tn=N=>sn(N,"[contenteditable]"),Xn=(N,X=!1)=>Ie(N)?N.dom.isContentEditable:Tn(N).fold(W(X),ce=>zn(ce)==="true"),zn=N=>N.dom.contentEditable,Ko=(N,X)=>{bs(N).each(Ne=>{Ne.dom.insertBefore(X.dom,N.dom)})},To=(N,X)=>{Bl(N).fold(()=>{bs(N).each(We=>{Lo(We,X)})},Ne=>{Ko(Ne,X)})},Yo=(N,X)=>{dn(N).fold(()=>{Lo(N,X)},Ne=>{N.dom.insertBefore(X.dom,Ne.dom)})},Lo=(N,X)=>{N.dom.appendChild(X.dom)},es=(N,X)=>{Oe(X,ce=>{Ko(N,ce)})},Ms=(N,X)=>{Oe(X,ce=>{Lo(N,ce)})},hr=N=>{N.dom.textContent="",Oe(aa(N),X=>{po(X)})},po=N=>{const X=N.dom;X.parentNode!==null&&X.parentNode.removeChild(X)};var ts=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),tr=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),ai=tinymce.util.Tools.resolve("tinymce.util.VK");const Ur=N=>ve(N,It.fromDom),Ti=Object.keys,la=(N,X)=>{const ce=Ti(N);for(let Ne=0,We=ce.length;Ne<We;Ne++){const Kt=ce[Ne],Yn=N[Kt];X(Yn,Kt)}},li=N=>(X,ce)=>{N[ce]=X},Qc=(N,X,ce,Ne)=>{la(N,(We,Kt)=>{(X(We,Kt)?ce:Ne)(We,Kt)})},xr=(N,X)=>{const ce={};return Qc(N,X,li(ce),z),ce},qs=(N,X,ce)=>{if(h(ce)||S(ce)||V(ce))N.setAttribute(X,ce+"");else throw console.error("Invalid call to Attribute.set. Key ",X,":: Value ",ce,":: Element ",N),new Error("Attribute value was not simple")},Hi=(N,X)=>{const ce=N.dom;la(X,(Ne,We)=>{qs(ce,We,Ne)})},Aa=N=>Fe(N.dom.attributes,(X,ce)=>(X[ce.name]=ce.value,X),{}),Qa=(N,X)=>It.fromDom(N.dom.cloneNode(X)),La=N=>Qa(N,!0),Na=(N,X)=>{const ce=It.fromTag(X),Ne=Aa(N);return Hi(ce,Ne),ce},vi=(N,X)=>{const ce=Na(N,X);To(N,ce);const Ne=aa(N);return Ms(ce,Ne),po(N),ce};var jr=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),ca=tinymce.util.Tools.resolve("tinymce.util.Tools");const yr=N=>X=>k(X)&&X.nodeName.toLowerCase()===N,Ql=N=>X=>k(X)&&N.test(X.nodeName),Nr=N=>k(N)&&N.nodeType===3,Fa=N=>k(N)&&N.nodeType===1,Ra=Ql(/^(OL|UL|DL)$/),ua=Ql(/^(OL|UL)$/),Eo=yr("ol"),Mc=Ql(/^(LI|DT|DD)$/),xi=Ql(/^(DT|DD)$/),Di=Ql(/^(TH|TD)$/),Ba=yr("br"),Lr=N=>{var X;return((X=N.parentNode)===null||X===void 0?void 0:X.firstChild)===N},ei=(N,X)=>k(X)&&X.nodeName in N.schema.getTextBlockElements(),ec=(N,X)=>k(N)&&N.nodeName in X,Ro=(N,X)=>k(X)&&X.nodeName in N.schema.getVoidElements(),tc=(N,X)=>Ba(X)?N.isBlock(X.nextSibling)&&!Ba(X.previousSibling):!1,rl=(N,X,ce)=>{const Ne=N.isEmpty(X);return ce&&N.select("span[data-mce-type=bookmark]",X).length>0?!1:Ne},Fr=(N,X)=>N.isChildOf(X,N.getRoot()),il=N=>X=>X.options.get(N),yi=N=>{const X=N.options.register;X("lists_indent_on_tab",{processor:"boolean",default:!0})},Cu=il("lists_indent_on_tab"),_u=il("forced_root_block"),us=il("forced_root_block_attrs"),al=(N,X,ce={})=>{const Ne=N.dom,We=N.schema.getBlockElements(),Kt=Ne.createFragment(),Yn=_u(N),Co=us(N);let $o,Jn,mr=!1;for(Jn=Ne.create(Yn,{...Co,...ce.style?{style:ce.style}:{}}),ec(X.firstChild,We)||Kt.appendChild(Jn);$o=X.firstChild;){const Vr=$o.nodeName;!mr&&(Vr!=="SPAN"||$o.getAttribute("data-mce-type")!=="bookmark")&&(mr=!0),ec($o,We)?(Kt.appendChild($o),Jn=null):(Jn||(Jn=Ne.create(Yn,Co),Kt.appendChild(Jn)),Jn.appendChild($o))}return!mr&&Jn&&Jn.appendChild(Ne.create("br",{"data-mce-bogus":"1"})),Kt},pe=jr.DOM,Ge=(N,X,ce)=>{const Ne=Jn=>{const mr=Jn.parentNode;mr&&ca.each(We,Vr=>{mr.insertBefore(Vr,ce.parentNode)}),pe.remove(Jn)},We=pe.select('span[data-mce-type="bookmark"]',X),Kt=al(N,ce),Yn=pe.createRng();Yn.setStartAfter(ce),Yn.setEndAfter(X);const Co=Yn.extractContents();for(let Jn=Co.firstChild;Jn;Jn=Jn.firstChild)if(Jn.nodeName==="LI"&&N.dom.isEmpty(Jn)){pe.remove(Jn);break}N.dom.isEmpty(Co)||pe.insertAfter(Co,X),pe.insertAfter(Kt,X);const $o=ce.parentElement;$o&&rl(N.dom,$o)&&Ne($o),pe.remove(ce),rl(N.dom,X)&&pe.remove(X)},Qe=Ps("dd"),Tt=Ps("dt"),pn=(N,X)=>{Qe(X)?vi(X,"dt"):Tt(X)&&Ar(X).each(ce=>Ge(N,ce.dom,X.dom))},Sn=N=>{Tt(N)&&vi(N,"dd")},Cs=(N,X,ce)=>{X==="Indent"?Oe(ce,Sn):Oe(ce,Ne=>pn(N,Ne))},wr=(N,X)=>{if(Nr(N))return{container:N,offset:X};const ce=ts.getNode(N,X);return Nr(ce)?{container:ce,offset:X>=N.childNodes.length?ce.data.length:0}:ce.previousSibling&&Nr(ce.previousSibling)?{container:ce.previousSibling,offset:ce.previousSibling.data.length}:ce.nextSibling&&Nr(ce.nextSibling)?{container:ce.nextSibling,offset:0}:{container:N,offset:X}},Ds=N=>{const X=N.cloneRange(),ce=wr(N.startContainer,N.startOffset);X.setStart(ce.container,ce.offset);const Ne=wr(N.endContainer,N.endOffset);return X.setEnd(Ne.container,Ne.offset),X},lr=["OL","UL","DL"],ds=lr.join(","),Zr=(N,X)=>{const ce=X||N.selection.getStart(!0);return N.dom.getParent(ce,ds,eu(N,ce))},Nc=(N,X)=>k(N)&&X.length===1&&X[0]===N,gs=N=>O(N.querySelectorAll(ds),Ra),nd=N=>{const X=Zr(N),ce=N.selection.getSelectedBlocks();return Nc(X,ce)?gs(X):O(ce,Ne=>Ra(Ne)&&X!==Ne)},Ld=(N,X)=>{const ce=ca.map(X,Ne=>{const We=N.dom.getParent(Ne,"li,dd,dt",eu(N,Ne));return We||Ne});return Un(ce)},lf=N=>{const X=N.selection.getSelectedBlocks();return O(Ld(N,X),Mc)},Fc=N=>O(lf(N),xi),Bc=(N,X)=>{const ce=N.dom.getParents(X,"TD,TH");return ce.length>0?ce[0]:N.getBody()},Kp=(N,X)=>!Ra(X)&&!Mc(X)&&Ae(lr,ce=>N.isValidChild(X.nodeName,ce)),eu=(N,X)=>{const ce=N.dom.getParents(X,N.dom.isBlock),Ne=Kt=>Kt.nodeName.toLowerCase()!==_u(N);return Ut(ce,Kt=>Ne(Kt)&&Kp(N.schema,Kt)).getOr(N.getBody())},Zp=N=>bs(N).exists(X=>Mc(X.dom)&&dn(X).exists(ce=>!Ra(ce.dom))&&vo(X).exists(ce=>!Ra(ce.dom))),C0=(N,X)=>{const ce=N.dom.getParents(X,"ol,ul",eu(N,X));return mt(ce)},av=N=>{const X=C0(N,N.selection.getStart()),ce=O(N.selection.getSelectedBlocks(),ua);return X.toArray().concat(ce)},hn=N=>{const X=N.selection.getStart();return N.dom.getParents(X,"ol,ul",eu(N,X))},Rd=N=>{const X=av(N),ce=hn(N);return Ut(ce,Ne=>Zp(It.fromDom(Ne))).fold(()=>Rh(N,X),Ne=>[Ne])},Rh=(N,X)=>{const ce=ve(X,Ne=>C0(N,Ne).getOr(Ne));return Un(ce)},Od=N=>/\btox\-/.test(N.className),wa=(N,X)=>st(N,Ra,Di).exists(ce=>ce.nodeName===X&&!Od(ce)),Oh=(N,X)=>X!==null&&!N.dom.isEditable(X),cf=N=>{const X=Zr(N);return Oh(N,X)},uc=(N,X)=>{const ce=N.dom.getParent(X,"ol,ul,dl");return Oh(N,ce)},Fm=(N,X)=>{const ce=N.selection.getNode();return X({parents:N.dom.getParents(ce),element:ce}),N.on("NodeChange",X),()=>N.off("NodeChange",X)},Bm=(N,X)=>{const Ne=(X||document).createDocumentFragment();return Oe(N,We=>{Ne.appendChild(We.dom)}),It.fromDom(Ne)},Id=(N,X,ce)=>N.dispatch("ListMutation",{action:X,element:ce}),qp=(N=>X=>X.replace(N,""))(/^\s+|\s+$/g),Yp=N=>N.length>0,Xp=N=>!Yp(N),$m=N=>N.style!==void 0&&R(N.style.getPropertyValue),Jp=(N,X,ce)=>{if(!h(ce))throw console.error("Invalid call to CSS.set. Property ",X,":: Value ",ce,":: Element ",N),new Error("CSS value must be a string: "+ce);$m(N)&&N.style.setProperty(X,ce)},Ih=(N,X,ce)=>{const Ne=N.dom;Jp(Ne,X,ce)},tu=N=>Kn(N,"OL,UL"),da=N=>Kn(N,"LI"),ls=N=>dn(N).exists(tu),$c=N=>vo(N).exists(tu),$l=N=>"listAttributes"in N,Tu=N=>"isComment"in N,uf=N=>"isFragment"in N,ll=N=>N.depth>0,ti=N=>N.isSelected,Ph=N=>{const X=aa(N),ce=$c(N)?X.slice(0,-1):X;return ve(ce,La)},Hl=(N,X,ce)=>bs(N).filter(In).map(Ne=>({depth:X,dirty:!1,isSelected:ce,content:Ph(N),itemAttributes:Aa(N),listAttributes:Aa(Ne),listType:xt(Ne),isInPreviousLi:!1})),ci=(N,X)=>{Lo(N.item,X.list)},ui=N=>{for(let X=1;X<N.length;X++)ci(N[X-1],N[X])},$s=(N,X)=>{an(mt(N),qe(X),ci)},Hc=(N,X)=>{const ce={list:It.fromTag(X,N),item:It.fromTag("li",N)};return Lo(ce.list,ce.item),ce},Oa=(N,X,ce)=>{const Ne=[];for(let We=0;We<ce;We++)Ne.push(Hc(N,$l(X)?X.listType:X.parentListType));return Ne},Ul=(N,X)=>{for(let ce=0;ce<N.length-1;ce++)Ih(N[ce].item,"list-style-type","none");mt(N).each(ce=>{$l(X)&&(Hi(ce.list,X.listAttributes),Hi(ce.item,X.itemAttributes)),Ms(ce.item,X.content)})},dc=(N,X)=>{xt(N.list)!==X.listType&&(N.list=vi(N.list,X.listType)),Hi(N.list,X.listAttributes)},Xi=(N,X,ce)=>{const Ne=It.fromTag("li",N);return Hi(Ne,X),Ms(Ne,ce),Ne},Vf=(N,X)=>{Lo(N.list,X),N.item=X},Oi=(N,X,ce)=>{const Ne=X.slice(0,ce.depth);return mt(Ne).each(We=>{if($l(ce)){const Kt=Xi(N,ce.itemAttributes,ce.content);Vf(We,Kt),dc(We,ce)}else if(uf(ce))Ms(We.item,ce.content);else{const Kt=It.fromHtml(`<!--${ce.content}-->`);Lo(We.list,Kt)}}),Ne},Ys=(N,X,ce)=>{const Ne=Oa(N,ce,ce.depth-X.length);return ui(Ne),Ul(Ne,ce),$s(X,Ne),X.concat(Ne)},fc=(N,X)=>{let ce=Y.none();const Ne=Fe(X,(We,Kt,Yn)=>Tu(Kt)?Yn===0?(ce=Y.some(Kt),We):Oi(N,We,Kt):Kt.depth>We.length?Ys(N,We,Kt):Oi(N,We,Kt),[]);return ce.each(We=>{const Kt=It.fromHtml(`<!--${We.content}-->`);qe(Ne).each(Yn=>{Yo(Yn.list,Kt)})}),qe(Ne).map(We=>We.list)},hc=(N,X)=>{switch(N){case"Indent":X.depth++;break;case"Outdent":X.depth--;break;case"Flatten":X.depth=0}X.dirty=!0},Ii=(N,X)=>{$l(N)&&$l(X)&&(N.listType=X.listType,N.listAttributes={...X.listAttributes})},ho=N=>{N.listAttributes=xr(N.listAttributes,(X,ce)=>ce!=="start")},Pd=(N,X)=>{const ce=N[X].depth,Ne=Kt=>Kt.depth===ce&&!Kt.dirty,We=Kt=>Kt.depth<ce;return st(Xe(N.slice(0,X)),Ne,We).orThunk(()=>st(N.slice(X+1),Ne,We))},mc=N=>(Oe(N,(X,ce)=>{Pd(N,ce).fold(()=>{X.dirty&&$l(X)&&ho(X)},Ne=>Ii(X,Ne))}),N),nr=N=>{let X=N;return{get:()=>X,set:We=>{X=We}}},od=(N,X,ce,Ne)=>{var We;if(At(Ne))return[{depth:N+1,content:(We=Ne.dom.nodeValue)!==null&&We!==void 0?We:"",dirty:!1,isSelected:!1,isComment:!0}];X.each(Co=>{Ct(Co.start,Ne)&&ce.set(!0)});const Kt=Hl(Ne,N,ce.get());X.each(Co=>{Ct(Co.end,Ne)&&ce.set(!1)});const Yn=vo(Ne).filter(tu).map(Co=>nu(N,X,ce,Co)).getOr([]);return Kt.toArray().concat(Yn)},zf=(N,X,ce,Ne)=>dn(Ne).filter(tu).fold(()=>od(N,X,ce,Ne),We=>{const Kt=Fe(aa(Ne),(Yn,Co,$o)=>{if($o===0)return Yn;if(da(Co))return Yn.concat(od(N,X,ce,Co));{const Jn={isFragment:!0,depth:N,content:[Co],isSelected:!1,dirty:!1,parentListType:xt(We)};return Yn.concat(Jn)}},[]);return nu(N,X,ce,We).concat(Kt)}),nu=(N,X,ce,Ne)=>Dt(aa(Ne),We=>{const Kt=tu(We)?nu:zf,Yn=N+1;return Kt(Yn,X,ce,We)}),os=(N,X)=>{const ce=nr(!1),Ne=0;return ve(N,We=>({sourceList:We,entries:nu(Ne,X,ce,We)}))},cl=(N,X)=>{const ce=mc(X);return ve(ce,Ne=>{const We=Tu(Ne)?Bm([It.fromHtml(`<!--${Ne.content}-->`)]):Bm(Ne.content),Kt=$l(Ne)?Ne.itemAttributes:{};return It.fromDom(al(N,We.dom,Kt))})},Mh=(N,X)=>{const ce=mc(X);return fc(N.contentDocument,ce).toArray()},df=(N,X)=>Dt(De(X,ll),ce=>qe(ce).exists(ll)?Mh(N,ce):cl(N,ce)),Md=(N,X)=>{Oe(O(N,ti),ce=>hc(X,ce))},pc=N=>{const X=ve(lf(N),It.fromDom);return an(Ut(X,se(ls)),Ut(Xe(X),se(ls)),(ce,Ne)=>({start:ce,end:Ne}))},F=(N,X,ce)=>{const Ne=os(X,pc(N));Oe(Ne,We=>{Md(We.entries,ce);const Kt=df(N,We.entries);Oe(Kt,Yn=>{Id(N,ce==="Indent"?"IndentList":"OutdentList",Yn.dom)}),es(We.sourceList,Kt),po(We.sourceList)})},M=(N,X)=>{const ce=Ur(Rd(N)),Ne=Ur(Fc(N));let We=!1;if(ce.length||Ne.length){const Kt=N.selection.getBookmark();F(N,ce,X),Cs(N,X,Ne),N.selection.moveToBookmark(Kt),N.selection.setRng(Ds(N.selection.getRng())),N.nodeChanged(),We=!0}return We},Ee=(N,X)=>!cf(N)&&M(N,X),Ve=N=>Ee(N,"Indent"),tt=N=>Ee(N,"Outdent"),Ze=N=>Ee(N,"Flatten"),pt="\uFEFF",gt=N=>N===pt,ln=(N,X,ce)=>_t(N,X,ce).isSome(),Io=(N,X)=>ln(N,j(Ct,X));var ss=tinymce.util.Tools.resolve("tinymce.dom.BookmarkManager");const Sr=jr.DOM,vs=N=>{const X={},ce=Ne=>{let We=N[Ne?"startContainer":"endContainer"],Kt=N[Ne?"startOffset":"endOffset"];if(Fa(We)){const Yn=Sr.create("span",{"data-mce-type":"bookmark"});We.hasChildNodes()?(Kt=Math.min(Kt,We.childNodes.length-1),Ne?We.insertBefore(Yn,We.childNodes[Kt]):Sr.insertAfter(Yn,We.childNodes[Kt])):We.appendChild(Yn),We=Yn,Kt=0}X[Ne?"startContainer":"endContainer"]=We,X[Ne?"startOffset":"endOffset"]=Kt};return ce(!0),N.collapsed||ce(),X},_s=N=>{const X=Ne=>{const We=Co=>{var $o;let Jn=($o=Co.parentNode)===null||$o===void 0?void 0:$o.firstChild,mr=0;for(;Jn;){if(Jn===Co)return mr;(!Fa(Jn)||Jn.getAttribute("data-mce-type")!=="bookmark")&&mr++,Jn=Jn.nextSibling}return-1};let Kt=N[Ne?"startContainer":"endContainer"],Yn=N[Ne?"startOffset":"endOffset"];if(Kt){if(Fa(Kt)&&Kt.parentNode){const Co=Kt;Yn=We(Kt),Kt=Kt.parentNode,Sr.remove(Co),!Kt.hasChildNodes()&&Sr.isBlock(Kt)&&Kt.appendChild(Sr.create("br"))}N[Ne?"startContainer":"endContainer"]=Kt,N[Ne?"startOffset":"endOffset"]=Yn}};X(!0),X();const ce=Sr.createRng();return ce.setStart(N.startContainer,N.startOffset),N.endContainer&&ce.setEnd(N.endContainer,N.endOffset),Ds(ce)},ki=N=>{switch(N){case"UL":return"ToggleUlList";case"OL":return"ToggleOlList";case"DL":return"ToggleDLList"}},Sl=(N,X,ce)=>{const Ne=ce["list-style-type"]?ce["list-style-type"]:null;N.setStyle(X,"list-style-type",Ne)},ns=(N,X)=>{ca.each(X,(ce,Ne)=>{N.setAttribute(Ne,ce)})},Vs=(N,X,ce)=>{ns(X,ce["list-attributes"]),ca.each(N.select("li",X),Ne=>{ns(Ne,ce["list-item-attributes"])})},xs=(N,X,ce)=>{Sl(N,X,ce),Vs(N,X,ce)},ks=(N,X,ce)=>{ca.each(ce,Ne=>N.setStyle(X,Ne,""))},Wn=(N,X)=>k(X)&&!ec(X,N.schema.getBlockElements()),cr=(N,X,ce,Ne)=>{let We=X[ce?"startContainer":"endContainer"];const Kt=X[ce?"startOffset":"endOffset"];Fa(We)&&(We=We.childNodes[Math.min(Kt,We.childNodes.length-1)]||We),!ce&&Ba(We.nextSibling)&&(We=We.nextSibling);const Yn=$o=>{for(;!N.dom.isBlock($o)&&$o.parentNode&&Ne!==$o;)$o=$o.parentNode;return $o},Co=($o,Jn)=>{var mr;const Vr=new tr($o,Yn($o)),Va=Jn?"next":"prev";let Dl;for(;Dl=Vr[Va]();)if(!(Ro(N,Dl)||gt(Dl.textContent)||((mr=Dl.textContent)===null||mr===void 0?void 0:mr.length)===0))return Y.some(Dl);return Y.none()};if(ce&&Nr(We))if(gt(We.textContent))We=Co(We,!1).getOr(We);else for(We.parentNode!==null&&Wn(N,We.parentNode)&&(We=We.parentNode);We.previousSibling!==null&&(Wn(N,We.previousSibling)||Nr(We.previousSibling));)We=We.previousSibling;if(!ce&&Nr(We))if(gt(We.textContent))We=Co(We,!0).getOr(We);else for(We.parentNode!==null&&Wn(N,We.parentNode)&&(We=We.parentNode);We.nextSibling!==null&&(Wn(N,We.nextSibling)||Nr(We.nextSibling));)We=We.nextSibling;for(;We.parentNode!==Ne;){const $o=We.parentNode;if(ei(N,We)||/^(TD|TH)$/.test($o.nodeName))return We;We=$o}return We},el=(N,X,ce)=>{const Ne=[],We=N.dom,Kt=cr(N,X,!0,ce),Yn=cr(N,X,!1,ce);let Co;const $o=[];for(let Jn=Kt;Jn&&($o.push(Jn),Jn!==Yn);Jn=Jn.nextSibling);return ca.each($o,Jn=>{var mr;if(ei(N,Jn)){Ne.push(Jn),Co=null;return}if(We.isBlock(Jn)||Ba(Jn)){Ba(Jn)&&We.remove(Jn),Co=null;return}const Vr=Jn.nextSibling;if(ss.isBookmarkNode(Jn)&&(Ra(Vr)||ei(N,Vr)||!Vr&&Jn.parentNode===ce)){Co=null;return}Co||(Co=We.create("p"),(mr=Jn.parentNode)===null||mr===void 0||mr.insertBefore(Co,Jn),Ne.push(Co)),Co.appendChild(Jn)}),Ne},sd=(N,X,ce)=>{const Ne=N.getStyle(X,"list-style-type");let We=ce?ce["list-style-type"]:"";return We=We===null?"":We,Ne===We},ou=(N,X)=>{const ce=N.selection.getStart(!0),Ne=cr(N,X,!0,N.getBody());return Io(It.fromDom(Ne),It.fromDom(X.commonAncestorContainer))?X.commonAncestorContainer:ce},Sa=(N,X,ce)=>{const Ne=N.selection.getRng();let We="LI";const Kt=eu(N,ou(N,Ne)),Yn=N.dom;if(Yn.getContentEditable(N.selection.getNode())==="false")return;X=X.toUpperCase(),X==="DL"&&(We="DT");const Co=vs(Ne),$o=O(el(N,Ne,Kt),N.dom.isEditable);ca.each($o,Jn=>{let mr;const Vr=Jn.previousSibling,Va=Jn.parentNode;Mc(Va)||(Vr&&Ra(Vr)&&Vr.nodeName===X&&sd(Yn,Vr,ce)?(mr=Vr,Jn=Yn.rename(Jn,We),Vr.appendChild(Jn)):(mr=Yn.create(X),Va.insertBefore(mr,Jn),mr.appendChild(Jn),Jn=Yn.rename(Jn,We)),ks(Yn,Jn,["margin","margin-right","margin-bottom","margin-left","margin-top","padding","padding-right","padding-bottom","padding-left","padding-top"]),xs(Yn,mr,ce),gc(N.dom,mr))}),N.selection.setRng(_s(Co))},su=(N,X)=>Ra(N)&&N.nodeName===(X==null?void 0:X.nodeName),rd=(N,X,ce)=>{const Ne=N.getStyle(X,"list-style-type",!0),We=N.getStyle(ce,"list-style-type",!0);return Ne===We},ni=(N,X)=>N.className===X.className,ru=(N,X,ce)=>su(X,ce)&&rd(N,X,ce)&&ni(X,ce),gc=(N,X)=>{let ce,Ne=X.nextSibling;if(ru(N,X,Ne)){const We=Ne;for(;ce=We.firstChild;)X.appendChild(ce);N.remove(We)}if(Ne=X.previousSibling,ru(N,X,Ne)){const We=Ne;for(;ce=We.lastChild;)X.insertBefore(ce,X.firstChild);N.remove(We)}},bc=(N,X,ce,Ne)=>{if(X.nodeName!==ce){const We=N.dom.rename(X,ce);xs(N.dom,We,Ne),Id(N,ki(ce),We)}else xs(N.dom,X,Ne),Id(N,ki(ce),X)},ff=(N,X,ce,Ne)=>{if(X.classList.forEach((We,Kt,Yn)=>{We.startsWith("tox-")&&(Yn.remove(We),Yn.length===0&&X.removeAttribute("class"))}),X.nodeName!==ce){const We=N.dom.rename(X,ce);xs(N.dom,We,Ne),Id(N,ki(ce),We)}else xs(N.dom,X,Ne),Id(N,ki(ce),X)},Du=(N,X,ce,Ne,We)=>{const Kt=Ra(X);if(Kt&&X.nodeName===Ne&&!vc(We)&&!Od(X))Ze(N);else{Sa(N,Ne,We);const Yn=vs(N.selection.getRng()),Co=Kt?[X,...ce]:ce,$o=Kt&&Od(X)?ff:bc;ca.each(Co,Jn=>{$o(N,Jn,Ne,We)}),N.selection.setRng(_s(Yn))}},vc=N=>"list-style-type"in N,hf=(N,X,ce,Ne)=>{if(X!==N.getBody())if(X)if(X.nodeName===ce&&!vc(Ne)&&!Od(X))Ze(N);else{const We=vs(N.selection.getRng());Od(X)&&X.classList.forEach((Yn,Co,$o)=>{Yn.startsWith("tox-")&&($o.remove(Yn),$o.length===0&&X.removeAttribute("class"))}),xs(N.dom,X,Ne);const Kt=N.dom.rename(X,ce);gc(N.dom,Kt),N.selection.setRng(_s(We)),Sa(N,ce,Ne),Id(N,ki(ce),Kt)}else Sa(N,ce,Ne),Id(N,ki(ce),X)},Rr=(N,X,ce)=>{const Ne=Zr(N);if(uc(N,Ne))return;const We=nd(N),Kt=g(ce)?ce:{};We.length>0?Du(N,Ne,We,X,Kt):hf(N,Ne,X,Kt)},Vl=jr.DOM,Ui=(N,X)=>{const ce=X.parentElement;if(ce&&ce.nodeName==="LI"&&ce.firstChild===X){const Ne=ce.previousSibling;Ne&&Ne.nodeName==="LI"?(Ne.appendChild(X),rl(N,ce)&&Vl.remove(ce)):Vl.setStyle(ce,"listStyleType","none")}if(Ra(ce)){const Ne=ce.previousSibling;Ne&&Ne.nodeName==="LI"&&Ne.appendChild(X)}},xc=(N,X)=>{const ce=ca.grep(N.select("ol,ul",X));ca.each(ce,Ne=>{Ui(N,Ne)})},Kr=(N,X,ce,Ne)=>{let We=X.startContainer;const Kt=X.startOffset;if(Nr(We)&&(ce?Kt<We.data.length:Kt>0))return We;const Yn=N.schema.getNonEmptyElements();Fa(We)&&(We=ts.getNode(We,Kt));const Co=new tr(We,Ne);ce&&tc(N.dom,We)&&Co.next();const $o=ce?Co.next.bind(Co):Co.prev2.bind(Co);for(;We=$o();)if(We.nodeName==="LI"&&!We.hasChildNodes()||Yn[We.nodeName]||Nr(We)&&We.data.length>0)return We;return null},El=(N,X)=>{const ce=X.childNodes;return ce.length===1&&!Ra(ce[0])&&N.isBlock(ce[0])},wi=N=>Y.from(N).map(It.fromDom).filter(On).exists(X=>Xn(X)&&!ot(["details"],xt(X))),Pi=(N,X)=>{El(N,X)&&wi(X.firstChild)&&N.remove(X.firstChild,!0)},Uc=(N,X,ce)=>{let Ne;const We=El(N,ce)?ce.firstChild:ce;if(Pi(N,X),!rl(N,X,!0))for(;Ne=X.firstChild;)We.appendChild(Ne)},Rt=(N,X,ce)=>{let Ne;const We=X.parentNode;if(!Fr(N,X)||!Fr(N,ce))return;Ra(ce.lastChild)&&(Ne=ce.lastChild),We===ce.lastChild&&Ba(We.previousSibling)&&N.remove(We.previousSibling);const Kt=ce.lastChild;Kt&&Ba(Kt)&&X.hasChildNodes()&&N.remove(Kt),rl(N,ce,!0)&&hr(It.fromDom(ce)),Uc(N,X,ce),Ne&&ce.appendChild(Ne);const Co=yo(It.fromDom(ce),It.fromDom(X))?N.getParents(X,Ra,ce):[];N.remove(X),Oe(Co,$o=>{rl(N,$o)&&$o!==N.getRoot()&&N.remove($o)})},fa=(N,X,ce)=>{hr(It.fromDom(ce)),Rt(N.dom,X,ce),N.selection.setCursorLocation(ce,0)},iu=(N,X,ce,Ne)=>{const We=N.dom;if(We.isEmpty(Ne))fa(N,ce,Ne);else{const Kt=vs(X);Rt(We,ce,Ne),N.selection.setRng(_s(Kt))}},qr=(N,X,ce,Ne)=>{const We=vs(X);Rt(N.dom,ce,Ne);const Kt=_s(We);N.selection.setRng(Kt)},$a=(N,X)=>{const ce=N.dom,Ne=N.selection,We=Ne.getStart(),Kt=Bc(N,We),Yn=ce.getParent(Ne.getStart(),"LI",Kt);if(Yn){const Co=Yn.parentElement;if(Co===N.getBody()&&rl(ce,Co))return!0;const $o=Ds(Ne.getRng()),Jn=ce.getParent(Kr(N,$o,X,Kt),"LI",Kt),mr=Jn&&(X?ce.isChildOf(Yn,Jn):ce.isChildOf(Jn,Yn));if(Jn&&Jn!==Yn&&!mr)return N.undoManager.transact(()=>{X?iu(N,$o,Jn,Yn):Lr(Yn)?tt(N):qr(N,$o,Yn,Jn)}),!0;if(mr&&!X&&Jn!==Yn)return N.undoManager.transact(()=>{if($o.commonAncestorContainer.parentElement){const Vr=vs($o),Va=$o.commonAncestorContainer.parentElement;Uc(ce,$o.commonAncestorContainer.parentElement,Jn),Va.remove();const Dl=_s(Vr);N.selection.setRng(Dl)}}),!0;if(!Jn&&!X&&$o.startOffset===0&&$o.endOffset===0)return N.undoManager.transact(()=>{Ze(N)}),!0}return!1},Ji=(N,X,ce)=>{const Ne=N.getParent(X.parentNode,N.isBlock,ce);N.remove(X),Ne&&N.isEmpty(Ne)&&N.remove(Ne)},Ha=(N,X)=>{const ce=N.dom,Ne=N.selection.getStart(),We=Bc(N,Ne),Kt=ce.getParent(Ne,ce.isBlock,We);if(Kt&&ce.isEmpty(Kt,void 0,{checkRootAsContent:!0})){const Yn=Ds(N.selection.getRng()),Co=ce.getParent(Kr(N,Yn,X,We),"LI",We);if(Co){const $o=Va=>ot(["td","th","caption"],xt(Va)),Jn=Va=>Va.dom===We,mr=Nt(It.fromDom(Co),$o,Jn),Vr=Nt(It.fromDom(Yn.startContainer),$o,Jn);return vt(mr,Vr,Ct)?(N.undoManager.transact(()=>{const Va=Co.parentNode;Ji(ce,Kt,We),gc(ce,Va),N.selection.select(Co,!0),N.selection.collapse(X)}),!0):!1}}return!1},Cl=(N,X)=>$a(N,X)||Ha(N,X),ha=N=>{const X=N.selection.getStart(),ce=Bc(N,X);return N.dom.getParent(X,"LI,DT,DD",ce)||lf(N).length>0},ys=N=>ha(N)?(N.undoManager.transact(()=>{N.execCommand("Delete"),xc(N.dom,N.getBody())}),!0):!1,ma=(N,X)=>{const ce=N.selection;return!uc(N,ce.getNode())&&(ce.isCollapsed()?Cl(N,X):ys(N))},Vi=N=>{N.on("ExecCommand",X=>{const ce=X.command.toLowerCase();(ce==="delete"||ce==="forwarddelete")&&ha(N)&&xc(N.dom,N.getBody())}),N.on("keydown",X=>{X.keyCode===ai.BACKSPACE?ma(N,!1)&&X.preventDefault():X.keyCode===ai.DELETE&&ma(N,!0)&&X.preventDefault()})},oi=N=>({backspaceDelete:X=>{ma(N,X)}}),Vc=(N,X)=>{const ce=Zr(N);ce===null||uc(N,ce)||N.undoManager.transact(()=>{g(X.styles)&&N.dom.setStyles(ce,X.styles),g(X.attrs)&&la(X.attrs,(Ne,We)=>N.dom.setAttrib(ce,We,Ne))})},_l=N=>{const X=Xe(qp(N).split("")),ce=ve(X,(Ne,We)=>{const Kt=Ne.toUpperCase().charCodeAt(0)-65+1;return Math.pow(26,We)*Kt});return Fe(ce,(Ne,We)=>Ne+We,0)},yc=N=>{if(N--,N<0)return"";{const X=N%26,ce=Math.floor(N/26),Ne=yc(ce),We=String.fromCharCode(65+X);return Ne+We}},ul=N=>/^[A-Z]+$/.test(N),lt=N=>/^[a-z]+$/.test(N),Si=N=>/^[0-9]+$/.test(N),au=N=>Si(N)?2:ul(N)?0:lt(N)?1:Xp(N)?3:4,rr=N=>{switch(au(N)){case 2:return Y.some({listStyleType:Y.none(),start:N});case 0:return Y.some({listStyleType:Y.some("upper-alpha"),start:_l(N).toString()});case 1:return Y.some({listStyleType:Y.some("lower-alpha"),start:_l(N).toString()});case 3:return Y.some({listStyleType:Y.none(),start:""});case 4:return Y.none()}},Tl=N=>{const X=parseInt(N.start,10);return on(N.listStyleType,"upper-alpha")?yc(X):on(N.listStyleType,"lower-alpha")?yc(X).toLowerCase():N.start},pa=N=>{const X=Zr(N);!Eo(X)||uc(N,X)||N.windowManager.open({title:"List Properties",body:{type:"panel",items:[{type:"input",name:"start",label:"Start list at number",inputMode:"numeric"}]},initialData:{start:Tl({start:N.dom.getAttrib(X,"start","1"),listStyleType:Y.from(N.dom.getStyle(X,"list-style-type"))})},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],onSubmit:ce=>{const Ne=ce.getData();rr(Ne.start).each(We=>{N.execCommand("mceListUpdate",!1,{attrs:{start:We.start==="1"?"":We.start},styles:{"list-style-type":We.listStyleType.getOr("")}})}),ce.close()}})},Or=(N,X)=>()=>{const ce=Zr(N);return k(ce)&&ce.nodeName===X},Ua=N=>{N.addCommand("mceListProps",()=>{pa(N)})},Xs=N=>{N.on("BeforeExecCommand",X=>{const ce=X.command.toLowerCase();ce==="indent"?Ve(N):ce==="outdent"&&tt(N)}),N.addCommand("InsertUnorderedList",(X,ce)=>{Rr(N,"UL",ce)}),N.addCommand("InsertOrderedList",(X,ce)=>{Rr(N,"OL",ce)}),N.addCommand("InsertDefinitionList",(X,ce)=>{Rr(N,"DL",ce)}),N.addCommand("RemoveList",()=>{Ze(N)}),Ua(N),N.addCommand("mceListUpdate",(X,ce)=>{g(ce)&&Vc(N,ce)}),N.addQueryStateHandler("InsertUnorderedList",Or(N,"UL")),N.addQueryStateHandler("InsertOrderedList",Or(N,"OL")),N.addQueryStateHandler("InsertDefinitionList",Or(N,"DL"))};var di=tinymce.util.Tools.resolve("tinymce.html.Node");const nc=N=>N.type===3,wc=N=>N.length===0,ku=N=>{const X=(We,Kt)=>{const Yn=di.create("li");Oe(We,Co=>Yn.append(Co)),Kt?N.insert(Yn,Kt,!0):N.append(Yn)},ce=(We,Kt)=>nc(Kt)?[...We,Kt]:!wc(We)&&!nc(Kt)?(X(We,Kt),[]):We,Ne=Fe(N.children(),ce,[]);wc(Ne)||X(Ne)},zc=N=>{N.on("PreInit",()=>{const{parser:X}=N;X.addNodeFilter("ul,ol",ce=>Oe(ce,ku))})},Gc=N=>{N.on("keydown",X=>{X.keyCode!==ai.TAB||ai.metaKeyPressed(X)||N.undoManager.transact(()=>{(X.shiftKey?tt(N):Ve(N))&&X.preventDefault()})})},mf=N=>{Cu(N)&&Gc(N),Vi(N)},Bt=(N,X)=>ce=>{const Ne=We=>{ce.setActive(wa(We.parents,X)),ce.setEnabled(!uc(N,We.element)&&N.selection.isEditable())};return ce.setEnabled(N.selection.isEditable()),Fm(N,Ne)},io=N=>{const X=ce=>()=>N.execCommand(ce);N.hasPlugin("advlist")||(N.ui.registry.addToggleButton("numlist",{icon:"ordered-list",active:!1,tooltip:"Numbered list",onAction:X("InsertOrderedList"),onSetup:Bt(N,"OL")}),N.ui.registry.addToggleButton("bullist",{icon:"unordered-list",active:!1,tooltip:"Bullet list",onAction:X("InsertUnorderedList"),onSetup:Bt(N,"UL")}))},Qn=(N,X)=>ce=>Fm(N,We=>ce.setEnabled(wa(We.parents,X)&&!uc(N,We.element))),Po=N=>{const X={text:"List properties...",icon:"ordered-list",onAction:()=>N.execCommand("mceListProps"),onSetup:Qn(N,"OL")};N.ui.registry.addMenuItem("listprops",X),N.ui.registry.addContextMenu("lists",{update:ce=>{const Ne=Zr(N,ce);return Eo(Ne)?["listprops"]:[]}})};var Js=()=>{l.add("lists",N=>(yi(N),zc(N),N.hasPlugin("rtc",!0)?Ua(N):(mf(N),Xs(N)),io(N),Po(N),oi(N)))};Js()})();(function(){var l=tinymce.util.Tools.resolve("tinymce.PluginManager");const n=(b,S)=>{b.focus(),b.undoManager.transact(()=>{b.setContent(S)}),b.selection.setCursorLocation(),b.nodeChanged()},o=b=>b.getContent({source_view:!0}),i=b=>{const S=o(b);b.windowManager.open({title:"Source Code",size:"large",body:{type:"panel",items:[{type:"textarea",name:"code"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{code:S},onSubmit:T=>{n(b,T.getData().code),T.close()}})},u=b=>{b.addCommand("mceCodeEditor",()=>{i(b)})},h=b=>{const S=()=>b.execCommand("mceCodeEditor");b.ui.registry.addButton("code",{icon:"sourcecode",tooltip:"Source code",onAction:S}),b.ui.registry.addMenuItem("code",{icon:"sourcecode",text:"Source code",onAction:S})};var g=()=>{l.add("code",b=>(u(b),h(b),{}))};g()})();(function(){var l=tinymce.util.Tools.resolve("tinymce.PluginManager");const n=(De,Fe,st)=>{const Ut=Fe==="UL"?"InsertUnorderedList":"InsertOrderedList";De.execCommand(Ut,!1,st===!1?null:{"list-style-type":st})},o=De=>{De.addCommand("ApplyUnorderedListStyle",(Fe,st)=>{n(De,"UL",st["list-style-type"])}),De.addCommand("ApplyOrderedListStyle",(Fe,st)=>{n(De,"OL",st["list-style-type"])})},i=De=>Fe=>Fe.options.get(De),u=De=>{const Fe=De.options.register;Fe("advlist_number_styles",{processor:"string[]",default:"default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman".split(",")}),Fe("advlist_bullet_styles",{processor:"string[]",default:"default,circle,square".split(",")})},h=i("advlist_number_styles"),g=i("advlist_bullet_styles"),b=De=>De==null,S=De=>!b(De);var T=tinymce.util.Tools.resolve("tinymce.util.Tools");class k{constructor(Fe,st){this.tag=Fe,this.value=st}static some(Fe){return new k(!0,Fe)}static none(){return k.singletonNone}fold(Fe,st){return this.tag?st(this.value):Fe()}isSome(){return this.tag}isNone(){return!this.tag}map(Fe){return this.tag?k.some(Fe(this.value)):k.none()}bind(Fe){return this.tag?Fe(this.value):k.none()}exists(Fe){return this.tag&&Fe(this.value)}forall(Fe){return!this.tag||Fe(this.value)}filter(Fe){return!this.tag||Fe(this.value)?this:k.none()}getOr(Fe){return this.tag?this.value:Fe}or(Fe){return this.tag?this:Fe}getOrThunk(Fe){return this.tag?this.value:Fe()}orThunk(Fe){return this.tag?this:Fe()}getOrDie(Fe){if(this.tag)return this.value;throw new Error(Fe??"Called getOrDie on None")}static from(Fe){return S(Fe)?k.some(Fe):k.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(Fe){this.tag&&Fe(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}k.singletonNone=new k(!1);const R=(De,Fe,st)=>{for(let Ut=0,et=De.length;Ut<et;Ut++){const Dt=De[Ut];if(Fe(Dt,Ut))return k.some(Dt);if(st(Dt,Ut))break}return k.none()},V=De=>/\btox\-/.test(De.className),z=(De,Fe)=>De.dom.isChildOf(Fe,De.getBody()),$=De=>Fe=>S(Fe)&&De.test(Fe.nodeName),W=$(/^(OL|UL|DL)$/),Q=$(/^(TH|TD)$/),j=(De,Fe,st)=>R(Fe,Ut=>W(Ut)&&!V(Ut),Q).exists(Ut=>Ut.nodeName===st&&z(De,Ut)),se=De=>{const Fe=De.dom.getParent(De.selection.getNode(),"ol,ul"),st=De.dom.getStyle(Fe,"listStyleType");return k.from(st)},re=(De,Fe)=>Fe!==null&&!De.dom.isEditable(Fe),Y=(De,Fe)=>{const st=De.dom.getParent(Fe,"ol,ul,dl");return re(De,st)&&De.selection.isEditable()},me=(De,Fe)=>{const st=De.selection.getNode();return Fe({parents:De.dom.getParents(st),element:st}),De.on("NodeChange",Fe),()=>De.off("NodeChange",Fe)},ae=De=>De.replace(/\-/g," ").replace(/\b\w/g,Fe=>Fe.toUpperCase()),Ce=De=>b(De)||De==="default"?"":De,Ue=(De,Fe)=>st=>{const Ut=(Dt,Xe)=>{const it=Dt.selection.getStart(!0);st.setActive(j(Dt,Xe,Fe)),st.setEnabled(!Y(Dt,it)&&Dt.selection.isEditable())};return me(De,Dt=>Ut(De,Dt.parents))},ot=(De,Fe,st,Ut,et,Dt)=>{De.ui.registry.addSplitButton(Fe,{tooltip:st,icon:et==="OL"?"ordered-list":"unordered-list",presets:"listpreview",columns:3,fetch:Xe=>{const it=T.map(Dt,qe=>{const mt=et==="OL"?"num":"bull",Un=qe==="disc"||qe==="decimal"?"default":qe,on=Ce(qe),vt=ae(qe);return{type:"choiceitem",value:on,icon:"list-"+mt+"-"+Un,text:vt}});Xe(it)},onAction:()=>De.execCommand(Ut),onItemAction:(Xe,it)=>{n(De,et,it)},select:Xe=>se(De).map(qe=>Xe===qe).getOr(!1),onSetup:Ue(De,et)})},Ae=(De,Fe,st,Ut,et,Dt)=>{De.ui.registry.addToggleButton(Fe,{active:!1,tooltip:st,icon:et==="OL"?"ordered-list":"unordered-list",onSetup:Ue(De,et),onAction:()=>De.queryCommandState(Ut)||Dt===""?De.execCommand(Ut):n(De,et,Dt)})},ve=(De,Fe,st,Ut,et,Dt)=>{Dt.length>1?ot(De,Fe,st,Ut,et,Dt):Ae(De,Fe,st,Ut,et,Ce(Dt[0]))},Oe=De=>{ve(De,"numlist","Numbered list","InsertOrderedList","OL",h(De)),ve(De,"bullist","Bullet list","InsertUnorderedList","UL",g(De))};var O=()=>{l.add("advlist",De=>{De.hasPlugin("lists")?(u(De),Oe(De),o(De)):console.error("Please use the Lists plugin together with the List Styles plugin.")})};O()})();(function(){var l=tinymce.util.Tools.resolve("tinymce.PluginManager");const n=(xt,Pt,gn)=>{var At;return gn(xt,Pt.prototype)?!0:((At=xt.constructor)===null||At===void 0?void 0:At.name)===Pt.name},o=xt=>{const Pt=typeof xt;return xt===null?"null":Pt==="object"&&Array.isArray(xt)?"array":Pt==="object"&&n(xt,String,(gn,At)=>At.isPrototypeOf(gn))?"string":Pt},i=xt=>Pt=>o(Pt)===xt,u=xt=>Pt=>typeof Pt===xt,h=i("string"),g=u("boolean"),b=xt=>xt==null,S=xt=>!b(xt),T=u("function"),k=u("number"),R=(xt,Pt)=>gn=>xt(Pt(gn)),z=(xt=>()=>xt)(!1);class ${constructor(Pt,gn){this.tag=Pt,this.value=gn}static some(Pt){return new $(!0,Pt)}static none(){return $.singletonNone}fold(Pt,gn){return this.tag?gn(this.value):Pt()}isSome(){return this.tag}isNone(){return!this.tag}map(Pt){return this.tag?$.some(Pt(this.value)):$.none()}bind(Pt){return this.tag?Pt(this.value):$.none()}exists(Pt){return this.tag&&Pt(this.value)}forall(Pt){return!this.tag||Pt(this.value)}filter(Pt){return!this.tag||Pt(this.value)?this:$.none()}getOr(Pt){return this.tag?this.value:Pt}or(Pt){return this.tag?this:Pt}getOrThunk(Pt){return this.tag?this.value:Pt()}orThunk(Pt){return this.tag?this:Pt()}getOrDie(Pt){if(this.tag)return this.value;throw new Error(Pt??"Called getOrDie on None")}static from(Pt){return S(Pt)?$.some(Pt):$.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(Pt){this.tag&&Pt(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}$.singletonNone=new $(!1);const W=(xt,Pt)=>{const gn=xt.length,At=new Array(gn);for(let On=0;On<gn;On++){const In=xt[On];At[On]=Pt(In,On)}return At},Q=(xt,Pt)=>{for(let gn=0,At=xt.length;gn<At;gn++){const On=xt[gn];Pt(On,gn)}},j=(xt,Pt)=>{const gn=[];for(let At=0,On=xt.length;At<On;At++){const In=xt[At];Pt(In,At)&&gn.push(In)}return gn},se=9,re=11,Y=1,me=3,ae=(xt,Pt)=>{const At=(Pt||document).createElement("div");if(At.innerHTML=xt,!At.hasChildNodes()||At.childNodes.length>1){const On="HTML does not have a single root node";throw console.error(On,xt),new Error(On)}return ot(At.childNodes[0])},Ce=(xt,Pt)=>{const At=(Pt||document).createElement(xt);return ot(At)},Ue=(xt,Pt)=>{const At=(Pt||document).createTextNode(xt);return ot(At)},ot=xt=>{if(xt==null)throw new Error("Node cannot be null or undefined");return{dom:xt}},ve={fromHtml:ae,fromTag:Ce,fromText:Ue,fromDom:ot,fromPoint:(xt,Pt,gn)=>$.from(xt.dom.elementFromPoint(Pt,gn)).map(ot)},Oe=(xt,Pt)=>{const gn=xt.dom;if(gn.nodeType!==Y)return!1;{const At=gn;if(At.matches!==void 0)return At.matches(Pt);if(At.msMatchesSelector!==void 0)return At.msMatchesSelector(Pt);if(At.webkitMatchesSelector!==void 0)return At.webkitMatchesSelector(Pt);if(At.mozMatchesSelector!==void 0)return At.mozMatchesSelector(Pt);throw new Error("Browser lacks native selectors")}};typeof window<"u"||Function("return this;")();const O=xt=>xt.dom.nodeName.toLowerCase(),De=xt=>xt.dom.nodeType,Fe=xt=>Pt=>De(Pt)===xt,st=Fe(Y),Ut=Fe(me),et=Fe(se),Dt=Fe(re),Xe=xt=>Pt=>st(Pt)&&O(Pt)===xt,it=xt=>ve.fromDom(xt.dom.ownerDocument),qe=xt=>et(xt)?xt:it(xt),mt=xt=>$.from(xt.dom.parentNode).map(ve.fromDom),Un=xt=>W(xt.dom.childNodes,ve.fromDom),on=(xt,Pt,gn)=>{if(h(gn)||g(gn)||k(gn))xt.setAttribute(Pt,gn+"");else throw console.error("Invalid call to Attribute.set. Key ",Pt,":: Value ",gn,":: Element ",xt),new Error("Attribute value was not simple")},vt=(xt,Pt,gn)=>{on(xt.dom,Pt,gn)},an=(xt,Pt)=>{xt.dom.removeAttribute(Pt)},J=xt=>Dt(xt)&&S(xt.dom.host),Vn=T(Element.prototype.attachShadow)&&T(Node.prototype.getRootNode)?xt=>ve.fromDom(xt.dom.getRootNode()):qe,Rn=xt=>{const Pt=Vn(xt);return J(Pt)?$.some(Pt):$.none()},An=xt=>ve.fromDom(xt.dom.host),jn=xt=>{const Pt=Ut(xt)?xt.dom.parentNode:xt.dom;if(Pt==null||Pt.ownerDocument===null)return!1;const gn=Pt.ownerDocument;return Rn(ve.fromDom(Pt)).fold(()=>gn.body.contains(Pt),R(jn,An))},to=(xt,Pt,gn)=>{let At=xt.dom;const On=T(gn)?gn:z;for(;At.parentNode;){At=At.parentNode;const In=ve.fromDom(At);if(Pt(In))return $.some(In);if(On(In))break}return $.none()},mo=(xt,Pt,gn)=>to(xt,At=>Oe(At,Pt),gn),$t=xt=>xt.style!==void 0&&T(xt.style.getPropertyValue),xe=(xt,Pt)=>{const gn=xt.dom,On=window.getComputedStyle(gn).getPropertyValue(Pt);return On===""&&!jn(xt)?It(gn,Pt):On},It=(xt,Pt)=>$t(xt)?xt.style.getPropertyValue(Pt):"",Dn=xt=>xe(xt,"direction")==="rtl"?"rtl":"ltr",Ct=(xt,Pt)=>j(Un(xt),Pt),yo=(xt,Pt)=>Ct(xt,gn=>Oe(gn,Pt)),Kn=xt=>mt(xt).filter(st),Jt=(xt,Pt)=>(Pt?mo(xt,"ol,ul"):$.some(xt)).getOr(xt),Qt=Xe("li"),Cn=(xt,Pt,gn)=>{Q(Pt,At=>{const On=ve.fromDom(At),In=Qt(On),Is=Jt(On,In);Kn(Is).each(Yt=>{if(xt.setStyle(Is.dom,"direction",null),Dn(Yt)===gn?an(Is,"dir"):vt(Is,"dir",gn),Dn(Is)!==gn&&xt.setStyle(Is.dom,"direction",gn),In){const qo=yo(Is,"li[dir],li[style]");Q(qo,_i=>{an(_i,"dir"),xt.setStyle(_i.dom,"direction",null)})}})})},Nn=(xt,Pt)=>{xt.selection.isEditable()&&(Cn(xt.dom,xt.selection.getSelectedBlocks(),Pt),xt.nodeChanged())},kt=xt=>{xt.addCommand("mceDirectionLTR",()=>{Nn(xt,"ltr")}),xt.addCommand("mceDirectionRTL",()=>{Nn(xt,"rtl")})},jo=(xt,Pt)=>gn=>{const At=On=>{const In=ve.fromDom(On.element);gn.setActive(Dn(In)===Pt),gn.setEnabled(xt.selection.isEditable())};return xt.on("NodeChange",At),gn.setEnabled(xt.selection.isEditable()),()=>xt.off("NodeChange",At)},ms=xt=>{xt.ui.registry.addToggleButton("ltr",{tooltip:"Left to right",icon:"ltr",onAction:()=>xt.execCommand("mceDirectionLTR"),onSetup:jo(xt,"ltr")}),xt.ui.registry.addToggleButton("rtl",{tooltip:"Right to left",icon:"rtl",onAction:()=>xt.execCommand("mceDirectionRTL"),onSetup:jo(xt,"rtl")})};var as=()=>{l.add("directionality",xt=>{kt(xt),ms(xt)})};as()})();class epe{constructor(){this.init()}init(){this.registerEventListeners()}registerEventListeners(){window.Livewire.hook("morph.removed",({el:n})=>{this.findEditorsInHtml(n.outerHTML).forEach(o=>{this.destroyWysiwyg(o.id)})}),window.Livewire.hook("morph.added",({el:n})=>{this.findEditorsInHtml(n.outerHTML).forEach(o=>{console.log("Add editor: ",o.id),this.initWysiwyg("#"+o.id)})})}findEditorsInHtml(n){return n.includes("js-wysisyg")?(console.log("There is WYSIWYG in the payload"),new DOMParser().parseFromString(n,"text/html").querySelectorAll(".js-wysisyg")):[]}destroyWysiwyg(n){const o=ZU.get(n);o&&ZU.remove(o)}initWysiwyg(n){ZU.init({selector:n,setup:o=>{o.on("change",()=>{const i=o.getContent(),u=document.querySelector(n);u.value=i;const h=new Event("input",{bubbles:!0});u.dispatchEvent(h),o.save()}),o.on("input",()=>{o.save()})},license_key:"gpl",plugins:["link","lists","code","advlist","directionality"],menubar:!1,force_br_newlines:!0,force_p_newlines:!1,convert_newlines_to_brs:!1,toolbar:["blocks | bold italic underline | link | bullist numlist | alignleft aligncenter alignright | removeformat code"],content_style:`
        html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
            margin: 0;
            padding: 0;
            border: 0;
            font-size: 100%;
            vertical-align: baseline;
            font-family: sans-serif;
        }
        body {
          margin: 1rem;
          padding: 1rem;
        }
        p, ul, ol, blockquote {
          margin-bottom: 16px;
          line-height: 1.5;
        }
        ul, ol {
          padding-left: 16px;
        }
        h1 {
          font-size: 2em;
          margin-bottom: 0.5em;
        }
        h2 {
          font-size: 1.75em;
          margin-bottom: 0.5em;
        }
        h3 {
          font-size: 1.5em;
          margin-bottom: 0.5em;
        }
        h4 {
          font-size: 1.25em;
          margin-bottom: 0.5em;
        }
      `})}}ire.light();Fae.plugin(ble);qV.start();window.axios=HK;window.axios.defaults.headers.common={"X-Requested-With":"XMLHttpRequest","X-CSRF-TOKEN":document.querySelector('meta[name="csrf-token"]').getAttribute("content")};const tpe=function(){new Rue,new Lue,new Oue,new Fce,new Hce,new uue,new kue,new Xme,new epe,new Due};document.addEventListener("DOMContentLoaded",tpe);
