@rimori/playwright-testing 0.3.28 → 0.3.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare___mf_0_rimori_mf_1_client__loadShare__.mjs.js +5 -8
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare___mf_0_rimori_mf_1_react_mf_2_client__loadShare__.mjs.js +51 -69
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs.js +1 -1
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react_mf_1_jsx_mf_2_dev_mf_2_runtime__loadShare__.mjs.js +1 -9
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs.js +9 -25
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__zod__loadShare__.mjs.js +1 -1
- package/dist/harness/dist.js +4 -0
- package/dist/harness/hostInit.js +1 -1
- package/dist/harness/index.html +1 -0
- package/dist/harness/index.js +1 -1
- package/dist/harness/localSharedImportMap.js +1 -1
- package/dist/harness/preload-helper.js +1 -1
- package/dist/harness/remoteEntry.js +2 -7
- package/dist/harness/rolldown-runtime.js +1 -0
- package/dist/harness/virtualExposes.js +1 -1
- package/package.json +6 -6
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react__loadShare__.mjs.js +0 -9
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react__loadShare__.mjs_commonjs-proxy.js +0 -1
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs.js +0 -9
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react_mf_2_dom__loadShare__.mjs.js +0 -9
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy.js +0 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import{b as Z,c as Oe,d as J,e as Fc,f as h0,R as ae,g as Ht,h as f0,i as p0,j as jb,k as Ic,l as m0}from"./__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react__loadShare__.mjs.js";import{c as M,d as Ae,g as Vb,e as Yd}from"./__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs.js";import{a as Zd,b as qb,c as Wb,d as Ub,e as Kb,f as g0}from"./__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare___mf_0_rimori_mf_1_client__loadShare__.mjs.js";import{R as Jb}from"./__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react_mf_2_dom__loadShare__.mjs.js";function Gb(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var E=typeof window<"u"?window:void 0,De=typeof globalThis<"u"?globalThis:E;typeof self>"u"&&(De.self=De),typeof File>"u"&&(De.File=function(){});var ft=De?.navigator,N=De?.document,He=De?.location,al=De?.fetch,ul=De!=null&&De.XMLHttpRequest&&"withCredentials"in new De.XMLHttpRequest?De.XMLHttpRequest:void 0,Xd=De?.AbortController,Yb=De?.CompressionStream,st=ft?.userAgent,$=E??{},Qd="1.372.5",et={DEBUG:!1,LIB_VERSION:Qd,LIB_NAME:"web",JS_SDK_VERSION:Qd};function eh(t,e,n,r,i,s,o){try{var a=t[s](o),u=a.value}catch(l){return void n(l)}a.done?e(u):Promise.resolve(u).then(r,i)}function kt(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var s=t.apply(e,n);function o(u){eh(s,r,i,o,a,"next",u)}function a(u){eh(s,r,i,o,a,"throw",u)}o(void 0)})}}function O(){return O=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},O.apply(null,arguments)}function b0(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function ll(){return ll=kt(function*(t,e,n){e===void 0&&(e=!0);try{var r=new CompressionStream("gzip"),i=r.writable.getWriter(),s=i.write(new TextEncoder().encode(t)).then(()=>i.close()).catch(function(){var u=kt(function*(l){try{yield i.abort(l)}catch{}throw l});return function(l){return u.apply(this,arguments)}}()),o=new Response(r.readable).blob(),[a]=yield Promise.all([o,s]);return a}catch(u){if(n!=null&&n.rethrow)throw u;return e&&console.error("Failed to gzip compress data",u),null}}),ll.apply(this,arguments)}var Zb=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],th=function(t,e){if(e===void 0&&(e=[]),!t)return!1;var n=t.toLowerCase();return Zb.concat(e).some(r=>{var i=r.toLowerCase();return n.indexOf(i)!==-1})},Xb=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function G(t,e){return t.indexOf(e)!==-1}var Ca=function(t){return t.trim()},cl=function(t){return t.replace(/^\$/,"")},v0=Object.prototype,y0=v0.hasOwnProperty,Ea=v0.toString,Q=Array.isArray||function(t){return Ea.call(t)==="[object Array]"},dn=t=>typeof t=="function",ke=t=>t===Object(t)&&!Q(t),zr=t=>{if(ke(t)){for(var e in t)if(y0.call(t,e))return!1;return!0}return!1},P=t=>t===void 0,me=t=>Ea.call(t)=="[object String]",Ys=t=>me(t)&&t.trim().length===0,yn=t=>t===null,Y=t=>P(t)||yn(t),Tt=t=>Ea.call(t)=="[object Number]"&&t==t,Nr=t=>Tt(t)&&t>0,Vt=t=>Ea.call(t)==="[object Boolean]",Qb=t=>t instanceof FormData,ev=t=>G(Xb,t);function _0(t){return t===null||typeof t!="object"}function lo(t,e){return{}.toString.call(t)==="[object "+e+"]"}function Pc(t){return typeof Event<"u"&&function(e,n){try{return e instanceof n}catch{return!1}}(t,Event)}var tv=[!0,"true",1,"1","yes"],Za=t=>G(tv,t),nv=[!1,"false",0,"0","no"];function qt(t,e,n,r,i){return e>n&&(r.warn("min cannot be greater than max."),e=n),Tt(t)?t>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+i),qt(i||n,e,n,r))}class rv{constructor(e){this.$t={},this.zt=e.zt,this.Ut=qt(e.bucketSize,0,100,e.Gt),this.Wt=qt(e.refillRate,0,this.Ut,e.Gt),this.Xt=qt(e.refillInterval,0,864e5,e.Gt)}Jt(e,n){var r=Math.floor((n-e.lastAccess)/this.Xt);r>0&&(e.tokens=Math.min(e.tokens+r*this.Wt,this.Ut),e.lastAccess=e.lastAccess+r*this.Xt)}consumeRateLimit(e){var n,r=Date.now(),i=String(e),s=this.$t[i];return s?this.Jt(s,r):this.$t[i]=s={tokens:this.Ut,lastAccess:r},s.tokens===0||(s.tokens--,s.tokens===0&&((n=this.zt)==null||n.call(this,e)),s.tokens===0)}stop(){this.$t={}}}var Es,nh,Xa,pt="Mobile",co="iOS",fn="Android",Yr="Tablet",x0=fn+" "+Yr,k0="iPad",w0="Apple",C0=w0+" Watch",Ri="Safari",Zr="BlackBerry",E0="Samsung",S0=E0+"Browser",A0=E0+" Internet",ur="Chrome",iv=ur+" OS",M0=ur+" "+co,Lc="Internet Explorer",T0=Lc+" "+pt,Bc="Opera",sv=Bc+" Mini",$c="Edge",D0="Microsoft "+$c,Wr="Firefox",O0=Wr+" "+co,Ki="Nintendo",Ji="PlayStation",Ur="Xbox",R0=fn+" "+pt,N0=pt+" "+Ri,xi="Windows",dl=xi+" Phone",rh="Nokia",hl="Ouya",F0="Generic",ov=F0+" "+pt.toLowerCase(),I0=F0+" "+Yr.toLowerCase(),fl="Konqueror",Qe="(\\d+(\\.\\d+)?)",Qa=new RegExp("Version/"+Qe),av=new RegExp(Ur,"i"),uv=new RegExp(Ji+" \\w+","i"),lv=new RegExp(Ki+" \\w+","i"),zc=new RegExp(Zr+"|PlayBook|BB10","i"),cv={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},P0=function(t,e){return e=e||"",G(t," OPR/")&&G(t,"Mini")?sv:G(t," OPR/")?Bc:zc.test(t)?Zr:G(t,"IE"+pt)||G(t,"WPDesktop")?T0:G(t,S0)?A0:G(t,$c)||G(t,"Edg/")?D0:G(t,"FBIOS")?"Facebook "+pt:G(t,"UCWEB")||G(t,"UCBrowser")?"UC Browser":G(t,"CriOS")?M0:G(t,"CrMo")||G(t,ur)?ur:G(t,fn)&&G(t,Ri)?R0:G(t,"FxiOS")?O0:G(t.toLowerCase(),fl.toLowerCase())?fl:((n,r)=>r&&G(r,w0)||function(i){return G(i,Ri)&&!G(i,ur)&&!G(i,fn)}(n))(t,e)?G(t,pt)?N0:Ri:G(t,Wr)?Wr:G(t,"MSIE")||G(t,"Trident/")?Lc:G(t,"Gecko")?Wr:""},dv={[T0]:[new RegExp("rv:"+Qe)],[D0]:[new RegExp($c+"?\\/"+Qe)],[ur]:[new RegExp("("+ur+"|CrMo)\\/"+Qe)],[M0]:[new RegExp("CriOS\\/"+Qe)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Qe)],[Ri]:[Qa],[N0]:[Qa],[Bc]:[new RegExp("(Opera|OPR)\\/"+Qe)],[Wr]:[new RegExp(Wr+"\\/"+Qe)],[O0]:[new RegExp("FxiOS\\/"+Qe)],[fl]:[new RegExp("Konqueror[:/]?"+Qe,"i")],[Zr]:[new RegExp(Zr+" "+Qe),Qa],[R0]:[new RegExp("android\\s"+Qe,"i")],[A0]:[new RegExp(S0+"\\/"+Qe)],[Lc]:[new RegExp("(rv:|MSIE )"+Qe)],Mozilla:[new RegExp("rv:"+Qe)]},hv=function(t,e){var n=P0(t,e),r=dv[n];if(P(r))return null;for(var i=0;r.length>i;i++){var s=t.match(r[i]);if(s)return parseFloat(s[s.length-2])}return null},ih=[[new RegExp(Ur+"; "+Ur+" (.*?)[);]","i"),t=>[Ur,t&&t[1]||""]],[new RegExp(Ki,"i"),[Ki,""]],[new RegExp(Ji,"i"),[Ji,""]],[zc,[Zr,""]],[new RegExp(xi,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[dl,""];if(new RegExp(pt).test(e)&&!/IEMobile\b/.test(e))return[xi+" "+pt,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var r=cv[n[1]]||"";return/arm/i.test(e)&&(r="RT"),[xi,r]}return[xi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[co,[t[3],t[4],t[5]||"0"].join(".")]:[co,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=P(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+fn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+fn+")","i"),t=>t&&t[2]?[fn,[t[2],t[3],t[4]||"0"].join(".")]:[fn,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[iv,""]],[/Linux|debian/i,["Linux",""]]],sh=function(t){return lv.test(t)?Ki:uv.test(t)?Ji:av.test(t)?Ur:new RegExp(hl,"i").test(t)?hl:new RegExp("("+dl+"|WPDesktop)","i").test(t)?dl:/iPad/.test(t)?k0:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?C0:zc.test(t)?Zr:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(rh,"i").test(t)?rh:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(pt).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?fn:x0:new RegExp("(pda|"+pt+")","i").test(t)?ov:new RegExp(Yr,"i").test(t)&&!new RegExp(Yr+" pc","i").test(t)?I0:""},fv=t=>t instanceof Error,L0={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},pv=L0.info;function B0(t){if(Vt(t))return{boolValue:t};if(typeof t=="number")return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if(typeof t=="string")return{stringValue:t};if(Q(t))return{arrayValue:{values:t.map(e=>B0(e))}};try{return{stringValue:JSON.stringify(t)}}catch{return{stringValue:String(t)}}}function oh(t){var e=[];for(var n in t){var r=t[n];yn(r)||P(r)||e.push({key:n,value:B0(r)})}return e}function mv(t){var e=globalThis._posthogChunkIds;if(e){var n=Object.keys(e);return Xa&&n.length===nh||(nh=n.length,Xa=n.reduce((r,i)=>{Es||(Es={});var s=Es[i];if(s)r[s[0]]=s[1];else for(var o=t(i),a=o.length-1;a>=0;a--){var u=o[a],l=u?.filename,c=e[i];if(l&&c){r[l]=c,Es[i]=[l,c];break}}return r},{})),Xa}}class gv{constructor(e,n,r){r===void 0&&(r=[]),this.coercers=e,this.stackParser=n,this.modifiers=r}buildFromUnknown(e,n){n===void 0&&(n={});var r=n&&n.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,n,0).apply(e),s=this.buildParsingContext(n),o=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(o,r),$exception_level:"error"}}modifyFrames(e){var n=this;return kt(function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&Q(r.stacktrace.frames)&&(r.stacktrace.frames=yield n.applyModifiers(r.stacktrace.frames));return e})()}coerceFallback(e){var n;return{type:"Error",value:"Unknown error",stack:(n=e.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(e,n){var r,i;return e.cause!=null&&(r=this.parseStacktrace(e.cause,n)),e.stack!=""&&e.stack!=null&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?n.skipFirstLines:0),n.chunkIdMap)),O({},e,{cause:r,stack:i})}applyChunkIds(e,n){return e.map(r=>(r.filename&&n&&(r.chunk_id=n[r.filename]),r))}applyCoercers(e,n){for(var r of this.coercers)if(r.match(e))return r.coerce(e,n);return this.coerceFallback(n)}applyModifiers(e){var n=this;return kt(function*(){var r=e;for(var i of n.modifiers)r=yield i(r);return r})()}convertToExceptionList(e,n){var r,i,s,o={type:e.type,value:e.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"generic",handled:(i=n.handled)===null||i===void 0||i,synthetic:(s=e.synthetic)!==null&&s!==void 0&&s}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,O({},n,{handled:!0}))),a}buildParsingContext(e){var n;return{chunkIdMap:mv(this.stackParser),skipFirstLines:(n=e.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(e,n,r){r===void 0&&(r=0);var i=(s,o)=>{if(4>=o){var a=this.buildCoercingContext(e,n,o);return this.applyCoercers(s,a)}};return O({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:e,apply:s=>i(s,r),next:s=>i(s,r+1)})}}var Xr="?";function pl(t,e,n,r,i){var s={platform:t,filename:e,function:n==="<anonymous>"?Xr:n,in_app:!0};return P(r)||(s.lineno=r),P(i)||(s.colno=i),s}var $0=(t,e)=>{var n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:Xr,n?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},bv=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,vv=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,yv=/\((\S*)(?::(\d+))(?::(\d+))\)/,_v=(t,e)=>{var n=bv.exec(t);if(n){var[,r,i,s]=n;return pl(e,r,Xr,+i,+s)}var o=vv.exec(t);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=yv.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[u,l]=$0(o[1]||Xr,o[2]);return pl(e,l,u,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},xv=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,kv=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,wv=(t,e)=>{var n=xv.exec(t);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var r=kv.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}var i=n[3],s=n[1]||Xr;return[s,i]=$0(s,i),pl(e,i,s,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},ah=/\(error: (.*)\)/;class Cv{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){var r=me(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var n=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?n+": "+e.message:n}isDOMException(e){return lo(e,"DOMException")}isDOMError(e){return lo(e,"DOMError")}}class Ev{match(e){return(n=>n instanceof Error)(e)}coerce(e,n){return{type:this.getType(e),value:this.getMessage(e,n),stack:this.getStack(e),cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,n){var r=e.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(e){return e.stacktrace||e.stack||void 0}}class Sv{constructor(){}match(e){return lo(e,"ErrorEvent")&&e.error!=null}coerce(e,n){var r;return n.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}var Av=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Mv{match(e){return typeof e=="string"}coerce(e,n){var r,[i,s]=this.getInfos(e);return{type:i??"Error",value:s??e,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(e){var n="Error",r=e,i=e.match(Av);return i&&(n=i[1],r=i[2]),[n,r]}}var Tv=["fatal","error","warning","log","info","debug"];function z0(t,e){e===void 0&&(e=40);var n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(", ");if(e>=i.length)return r===n.length?i:i.length>e?i.slice(0,e)+"...":i}return""}class Dv{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var r,i=this.getErrorPropertyFromObject(e);return i?n.apply(i):{type:this.getType(e),value:this.getValue(e),stack:(r=n.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Pc(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var n="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(n+=" with message: '"+e.message+"'"),n}if("message"in e&&typeof e.message=="string")return e.message;var r=this.getObjectClassName(e);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+z0(e)}isSeverityLevel(e){return me(e)&&!Ys(e)&&Tv.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var n in e)if({}.hasOwnProperty.call(e,n)){var r=e[n];if(fv(r))return r}}getObjectClassName(e){try{var n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}}class Ov{match(e){return Pc(e)}coerce(e,n){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+z0(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class Rv{match(e){return _0(e)}coerce(e,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class Nv{match(e){return lo(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Pc(e))return!1;try{var n=e.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(e,n){var r,i=this.getUnhandledRejectionReason(e);return _0(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var ho="$message",fo="$timestamp",Fv=new Set([ho,fo]),eu={enabled:!0,max_bytes:32768};function po(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:eu.enabled,max_bytes:Pv(t.max_bytes,eu.max_bytes)}:O({},eu)}class Iv{constructor(e){this.Kt=[],this.Qt=0,this.Bt=po(e)}setConfig(e){this.Bt=po(e),this.er()}add(e){var n=function(i){var s=function(c){var d=new WeakSet;try{return JSON.stringify(c,(h,f)=>{if(typeof f=="bigint")return f.toString();if(typeof f!="function"&&typeof f!="symbol"){if(f instanceof Date)return f.toISOString();if(f instanceof Error)return{name:f.name,message:f.message,stack:f.stack};if(f&&typeof f=="object"){if(d.has(f))return"[Circular]";d.add(f)}return f}})}catch{return}}(i);if(s)try{var o=JSON.parse(s);if(!ke(o))return;var a=o,u=a[ho],l=a[fo];return!me(u)||u.trim().length===0||!me(l)&&!Tt(l)?void 0:{step:a,json:s}}catch{return}}(e);if(n){var r=function(i){if(typeof TextEncoder<"u")return new TextEncoder().encode(i).length;for(var s=encodeURIComponent(i),o=0,a=0;s.length>a;a++)s[a]==="%"?(o+=1,a+=2):o+=1;return o}(n.json);r>this.Bt.max_bytes||(this.Kt.push({step:n.step,bytes:r}),this.Qt+=r,this.er())}}getAttachable(){return this.Kt.map(e=>e.step)}clear(){this.Kt=[],this.Qt=0}size(){return this.Kt.length}er(){for(;this.Qt>this.Bt.max_bytes&&this.Kt.length>0;){var e=this.Kt.shift();e&&(this.Qt-=e.bytes)}}}function Pv(t,e){if(!Tt(t)||t===1/0||t===-1/0)return e;var n=Math.floor(t);return 0>n?e:n}var H0=function(t,e){var{debugEnabled:n}=e===void 0?{}:e,r={C(i){if(E&&(et.DEBUG||$.POSTHOG_DEBUG||n)&&!P(E.console)&&E.console){for(var s=("__rrweb_original__"in E.console[i])?E.console[i].__rrweb_original__:E.console[i],o=arguments.length,a=new Array(o>1?o-1:0),u=1;o>u;u++)a[u-1]=arguments[u];s(t,...a)}},info(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];r.C("log",...s)},warn(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];r.C("warn",...s)},error(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];r.C("error",...s)},critical(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];console.error(t,...s)},uninitializedWarning(i){r.error("You must initialize PostHog before calling "+i)},createLogger:(i,s)=>H0(t+" "+i,s)};return r},I=H0("[PostHog.js]"),fe=I.createLogger,Lv=fe("[ExternalScriptsLoader]"),tu=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return Lv.warn(e+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=N?.querySelectorAll("script");if(r){for(var i,s=function(){if(r[o].src===e){var u=r[o];return u.__posthog_loading_callback_fired?{v:n()}:(u.addEventListener("load",l=>{u.__posthog_loading_callback_fired=!0,n(void 0,l)}),u.onerror=l=>n(l),{v:void 0})}},o=0;r.length>o;o++)if(i=s())return i.v}var a=()=>{if(!N)return n("document not found");var u=N.createElement("script");if(u.type="text/javascript",u.crossOrigin="anonymous",u.src=e,u.onload=d=>{u.__posthog_loading_callback_fired=!0,n(void 0,d)},u.onerror=d=>n(d),t.config.prepare_external_dependency_script&&(u=t.config.prepare_external_dependency_script(u)),!u)return n("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")N.head.appendChild(u);else{var l,c=N.querySelectorAll("body > script");c.length>0?(l=c[0].parentNode)==null||l.insertBefore(u,c[0]):N.body.appendChild(u)}};N!=null&&N.body?a():N?.addEventListener("DOMContentLoaded",a)};$.__PosthogExtensions__=$.__PosthogExtensions__||{},$.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{if(e!=="remote-config"){var r;if(t.config.__preview_external_dependency_versioned_paths)r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var i="/static/"+e+".js?v="+t.version;if(e==="toolbar"){var s=3e5;i=i+"&t="+Math.floor(Date.now()/s)*s}r=t.requestRouter.endpointFor("assets",i)}tu(t,r,n)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");tu(t,o,n)}},$.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{var r=t.requestRouter.endpointFor("api",e);tu(t,r,n)};var j0="$people_distinct_id",mo="$device_id",ki="__alias",wi="__timers",ml="$autocapture_disabled_server_side",gl="$heatmaps_enabled_server_side",bl="$exception_capture_enabled_server_side",vl="$error_tracking_suppression_rules",yl="$error_tracking_capture_extension_exceptions",_l="$web_vitals_enabled_server_side",Hc="$dead_clicks_enabled_server_side",xl="$product_tours_enabled_server_side",kl="$web_vitals_allowed_metrics",Ci="$session_recording_remote_config",V0="$replay_override_sampling",q0="$replay_override_linked_flag",W0="$replay_override_url_trigger",U0="$replay_override_event_trigger",go="$sesid",jc="$session_is_sampled",Hr="$enabled_feature_flags",Zs="$active_feature_flags",Ei="$early_access_features",wl="$feature_flag_details",Cl="$feature_flag_payloads",El="$feature_flag_request_id",an="$override_feature_flags",Fr="$override_feature_flag_payloads",Si="$stored_person_properties",er="$stored_group_properties",Sl="$surveys",Al="$surveys_activated",Xs="ph_product_tours",Ni="$flag_call_reported",Ml="$flag_call_reported_session_id",Tl="$feature_flag_errors",bo="$feature_flag_evaluated_at",Rt="$user_state",Dl="$client_session_props",Ol="$capture_rate_limit",Rl="$initial_campaign_params",Nl="$initial_referrer_info",vo="$initial_person_info",yo="$epp",K0="__POSTHOG_TOOLBAR__",Ss="$posthog_cookieless",J0="$sdk_debug_extensions_init_method",G0="$sdk_debug_extensions_init_time_ms",Y0="$sdk_debug_recording_script_not_loaded",Vc="PostHog loadExternalDependency extension not found.",tr="on_reject",hn="always",Er="anonymous",Sr="identified",Fl="identified_only",_o="visibilitychange",xo="beforeunload",Ir="$pageview",nu="$pageleave",ru="$identify",uh="$groupidentify";function As(t,e){Q(t)&&t.forEach(e)}function de(t,e){if(!Y(t))if(Q(t))t.forEach(e);else if(Qb(t))t.forEach((r,i)=>e(r,i));else for(var n in t)y0.call(t,n)&&e(t[n],n)}var ve=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;e>r;r++)n[r-1]=arguments[r];for(var i of n)for(var s in i)i[s]!==void 0&&(t[s]=i[s]);return t};function Qs(t){for(var e=Object.keys(t),n=e.length,r=new Array(n);n--;)r[n]=[e[n],t[e[n]]];return r}var lh=function(t){try{return t()}catch{return}},Bv=function(t){return function(){try{for(var e=arguments.length,n=new Array(e),r=0;e>r;r++)n[r]=arguments[r];return t.apply(this,n)}catch(i){I.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),I.critical(i)}}},qc=function(t){var e={};return de(t,function(n,r){(me(n)&&n.length>0||Tt(n))&&(e[r]=n)}),e},$v=["herokuapp.com","vercel.app","netlify.app"];function zv(t){var e=t?.hostname;if(!me(e))return!1;var n=e.split(".").slice(-2).join(".");for(var r of $v)if(n===r)return!1;return!0}function Ee(t,e,n,r){var{capture:i=!1,passive:s=!0}=r??{};t?.addEventListener(e,n,{capture:i,passive:s})}function Z0(t){return t.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return Tt(t)&&isFinite(t)&&Math.floor(t)===t});class ko{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,r,i){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||0>e||0>n||0>r||0>i||e>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|n>>>8,s[7]=n,s[8]=128|r>>>24,s[9]=r>>>16,s[10]=r>>>8,s[11]=r,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new ko(s)}toString(){for(var e="",n=0;this.bytes.length>n;n++)e=e+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new ko(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var n=0;16>n;n++){var r=this.bytes[n]-e.bytes[n];if(r!==0)return Math.sign(r)}return 0}}let Hv=class{constructor(){this.I=0,this.S=0,this.k=new jv}generate(){var e=this.generateOrAbort();if(P(e)){this.I=0;var n=this.generateOrAbort();if(P(n))throw new Error("Could not generate UUID after timestamp reset");return n}return e}generateOrAbort(){var e=Date.now();if(e>this.I)this.I=e,this.A();else{if(this.I>=e+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return ko.fromFieldsV7(this.I,Math.trunc(this.S/Math.pow(2,30)),this.S&Math.pow(2,30)-1,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}};var ch,X0=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};E&&!P(E.crypto)&&crypto.getRandomValues&&(X0=t=>crypto.getRandomValues(t));class jv{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(X0(this.T),this.N=0),this.T[this.N++]}}var On=()=>Vv().toString(),Vv=()=>(ch||(ch=new Hv)).generate(),ci="",qv=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,jt={R:()=>!!N,B(t){I.error("cookieStore error: "+t)},O(t){if(N){try{for(var e=t+"=",n=N.cookie.split(";").filter(s=>s.length),r=0;n.length>r;r++){for(var i=n[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}}catch{}return null}},Z(t){var e;try{e=JSON.parse(jt.O(t))||{}}catch{}return e},M(t,e,n,r,i){if(N)try{var s="",o="",a=function(c,d){if(d){var h=function(p,m){if(m===void 0&&(m=N),ci)return ci;if(!m||["localhost","127.0.0.1"].includes(p))return"";for(var g=p.split("."),b=Math.min(g.length,8),v="dmn_chk_"+On();!ci&&b--;){var _=g.slice(b).join("."),x=v+"=1;domain=."+_+";path=/";m.cookie=x+";max-age=3",m.cookie.includes(v)&&(m.cookie=x+";max-age=0",ci=_)}return ci}(c);if(!h){var f=(p=>{var m=p.match(qv);return m?m[0]:""})(c);f!==h&&I.info("Warning: cookie subdomain discovery mismatch",f,h),h=f}return h?"; domain=."+h:""}return""}(N.location.hostname,r);if(n){var u=new Date;u.setTime(u.getTime()+864e5*n),s="; expires="+u.toUTCString()}i&&(o="; secure");var l=t+"="+encodeURIComponent(JSON.stringify(e))+s+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&I.warn("cookieStore warning: large cookie, len="+l.length),N.cookie=l,l}catch{return}},F(t,e){if(N!=null&&N.cookie)try{jt.M(t,"",-1,e)}catch{return}}},iu=null,pe={R(){if(!yn(iu))return iu;var t=!0;if(P(E))t=!1;else try{var e="__mplssupport__";pe.M(e,"xyz"),pe.O(e)!=='"xyz"'&&(t=!1),pe.F(e)}catch{t=!1}return t||I.error("localStorage unsupported; falling back to cookie store"),iu=t,t},B(t){I.error("localStorage error: "+t)},O(t){try{return E?.localStorage.getItem(t)}catch(e){pe.B(e)}return null},Z(t){try{return JSON.parse(pe.O(t))||{}}catch{}return null},M(t,e){try{E?.localStorage.setItem(t,JSON.stringify(e))}catch(n){pe.B(n)}},F(t){try{E?.localStorage.removeItem(t)}catch(e){pe.B(e)}}},Wv=[mo,"distinct_id",go,jc,yo,vo,Rt],Ms={},Uv={R:()=>!0,B(t){I.error("memoryStorage error: "+t)},O:t=>Ms[t]||null,Z:t=>Ms[t]||null,M(t,e){Ms[t]=e},F(t){delete Ms[t]}},Yn=null,je={R(){if(!yn(Yn))return Yn;if(Yn=!0,P(E))Yn=!1;else try{var t="__support__";je.M(t,"xyz"),je.O(t)!=='"xyz"'&&(Yn=!1),je.F(t)}catch{Yn=!1}return Yn},B(t){I.error("sessionStorage error: ",t)},O(t){try{return E?.sessionStorage.getItem(t)}catch(e){je.B(e)}return null},Z(t){try{return JSON.parse(je.O(t))||null}catch{}return null},M(t,e){try{E?.sessionStorage.setItem(t,JSON.stringify(e))}catch(n){je.B(n)}},F(t){try{E?.sessionStorage.removeItem(t)}catch(e){je.B(e)}}};class Kv{constructor(e){this._instance=e}get Bt(){return this._instance.config}get consent(){return this.rr()?0:this.ir}isOptedOut(){return this.Bt.cookieless_mode===hn||this.isRejected()||this.consent===-1&&this.Bt.cookieless_mode===tr}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Bt.opt_out_capturing_by_default}optInOut(e){this.nr.M(this.sr,e?1:0,this.Bt.cookie_expiration,this.Bt.cross_subdomain_cookie,this.Bt.secure_cookie)}reset(){this.nr.F(this.sr,this.Bt.cross_subdomain_cookie)}get sr(){var{token:e,opt_out_capturing_cookie_prefix:n,consent_persistence_name:r}=this._instance.config;return r||(n?n+e:"__ph_opt_in_out_"+e)}get ir(){var e=this.nr.O(this.sr);return Za(e)?1:G(nv,e)?0:-1}get nr(){var e=this.Bt.opt_out_capturing_persistence_type,n=e==="localStorage"?pe:jt;if(!this.ar||this.ar!==n){this.ar=n;var r=e==="localStorage"?jt:pe;r.O(this.sr)&&(this.ar.O(this.sr)||this.optInOut(Za(r.O(this.sr))),r.F(this.sr,this.Bt.cross_subdomain_cookie))}return this.ar}rr(){return!!this.Bt.respect_dnt&&[ft?.doNotTrack,ft?.msDoNotTrack,$.doNotTrack].some(e=>Za(e))}}var Ts=fe("[Dead Clicks]"),Jv=()=>!0,Gv=t=>{var e,n=!((e=t.instance.persistence)==null||!e.get_property(Hc)),r=t.instance.config.capture_dead_clicks;return Vt(r)?r:!!ke(r)||n};class dh{get lazyLoadedDeadClicksAutocapture(){return this.lr}constructor(e,n,r){this.instance=e,this.isEnabled=n,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[Hc]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.ur(()=>{this.hr()}):this.stop()}ur(e){var n,r;(n=$.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture&&e(),(r=$.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",i=>{i?Ts.error("failed to load script",i):e()})}hr(){var e;if(N){if(!this.lr&&(e=$.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var n=ke(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.lr=$.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.lr.start(N),Ts.info("starting...")}}else Ts.error("`document` not found. Cannot start.")}stop(){this.lr&&(this.lr.stop(),this.lr=void 0,Ts.info("stopping..."))}}var su=fe("[SegmentIntegration]"),Q0="posthog-js";function em(t,e){var{organization:n,projectId:r,prefix:i,severityAllowList:s=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var u,l,c,d,h;if(s!=="*"&&!s.includes(a.level)||!t.__loaded)return a;a.tags||(a.tags={});var f=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());a.tags["PostHog Person URL"]=f,t.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var p,m=((u=a.exception)==null?void 0:u.values)||[],g=m.map(v=>O({},v,{stacktrace:v.stacktrace?O({},v.stacktrace,{type:"raw",frames:(v.stacktrace.frames||[]).map(_=>O({},_,{platform:"web:javascript"}))}):void 0})),b={$exception_message:((l=m[0])==null?void 0:l.value)||a.message,$exception_type:(c=m[0])==null?void 0:c.type,$exception_level:a.level,$exception_list:g,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((d=m[0])==null?void 0:d.value)||a.message,$sentry_exception_type:(h=m[0])==null?void 0:h.type,$sentry_tags:a.tags};return n&&r&&(b.$sentry_url=(i||"https://sentry.io/organizations/")+n+"/issues/?project="+r+"&query="+a.event_id),o&&((p=t.exceptions)==null||p.sendExceptionEvent(b)),a}}class Yv{constructor(e,n,r,i,s,o){this.name=Q0,this.setupOnce=function(a){a(em(e,{organization:n,projectId:r,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}}class hh{constructor(e){this.cr=(n,r,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(I.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:i}),this.dr=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.vr()}vr(){var e;this.pr=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.cr)}destroy(){var e;(e=this.pr)==null||e.call(this),this.pr=void 0}doPageView(e,n){var r,i=this.gr(e,n);return this.dr={pathname:(r=E?.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var n;return this.gr(e,(n=this.dr)==null?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.dr)==null?void 0:e.pageViewId}}gr(e,n){var r=this.dr;if(!r)return{$pageview_id:n};var i={$pageview_id:n,$prev_pageview_id:r.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:u,maxContentHeight:l,lastContentY:c,maxContentY:d}=s;if(!(P(o)||P(a)||P(u)||P(l)||P(c)||P(d))){o=Math.ceil(o),a=Math.ceil(a),u=Math.ceil(u),l=Math.ceil(l),c=Math.ceil(c),d=Math.ceil(d);var h=o>1?qt(a/o,0,1,I):1,f=o>1?qt(u/o,0,1,I):1,p=l>1?qt(c/l,0,1,I):1,m=l>1?qt(d/l,0,1,I):1;i=ve(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:u,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:m})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),i}}var Zv={[j0]:{exposure:"hidden"},[ki]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[wi]:{exposure:"hidden"},[ml]:{exposure:"event"},[gl]:{exposure:"hidden"},[bl]:{exposure:"event"},[vl]:{exposure:"hidden"},[yl]:{exposure:"event"},[_l]:{exposure:"event"},[Hc]:{exposure:"event"},[xl]:{exposure:"hidden"},[kl]:{exposure:"event"},[Ci]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[go]:{exposure:"hidden"},[jc]:{exposure:"event"},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},[Hr]:{exposure:"derived",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!ke(t))return{};for(var e={},n=Object.keys(t),r=0;n.length>r;r++)e["$feature/"+n[r]]=t[n[r]];return e}},[Zs]:{exposure:"event"},[Ei]:{exposure:"hidden"},[wl]:{exposure:"hidden"},[Cl]:{exposure:"event"},[El]:{exposure:"event"},[an]:{exposure:"event"},[Fr]:{exposure:"hidden"},[Si]:{exposure:"hidden"},[er]:{exposure:"hidden"},[Sl]:{exposure:"hidden"},[Al]:{exposure:"event"},[Xs]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Ni]:{exposure:"hidden"},[Ml]:{exposure:"hidden"},[Tl]:{exposure:"hidden"},[bo]:{exposure:"hidden"},[Rt]:{exposure:"hidden"},[Dl]:{exposure:"hidden"},[Ol]:{exposure:"hidden"},[Rl]:{exposure:"hidden"},[Nl]:{exposure:"hidden"},[vo]:{exposure:"hidden"},[yo]:{exposure:"hidden"},[V0]:{exposure:"event"},[q0]:{exposure:"event"},[W0]:{exposure:"event"},[U0]:{exposure:"event"},[J0]:{exposure:"event"},[G0]:{exposure:"event"},[Y0]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Xv=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],wo=t=>{var e=N?.createElement("a");return P(e)?null:(e.href=t,e)},Co=function(t,e){for(var n,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;r.length>i;i++){var s=r[i].split("=");if(s[0]===e){n=s;break}}if(!Q(n)||2>n.length)return"";var o=n[1];try{o=decodeURIComponent(o)}catch{I.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Gi=function(t,e,n){if(!t||!e||!e.length)return t;for(var r=t.split("#"),i=r[1],s=(r[0]||"").split("?"),o=s[1],a=s[0],u=(o||"").split("&"),l=[],c=0;u.length>c;c++){var d=u[c].split("=");Q(d)&&(e.includes(d[0])?l.push(d[0]+"="+n):l.push(u[c]))}var h=a;return o!=null&&(h+="?"+l.join("&")),i!=null&&(h+="#"+i),h},Eo=function(t,e){var n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},Ds="https?://(.*)",Qr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Qv=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Qr],Yi="<masked>",e2=["li_fat_id"];function tm(t,e,n){if(!N)return{};var r,i=e?[...Qr,...n||[]]:[],s=nm(Gi(N.URL,i,Yi),t),o=(r={},de(e2,function(a){var u=jt.O(a);r[a]=u||null}),r);return ve(o,s)}function nm(t,e){var n=Qv.concat(e||[]),r={};return de(n,function(i){var s=Co(t,i);r[i]=s||null}),r}function rm(t){var e=function(s){return s?s.search(Ds+"google.([^/?]*)")===0?"google":s.search(Ds+"bing.com")===0?"bing":s.search(Ds+"yahoo.com")===0?"yahoo":s.search(Ds+"duckduckgo.com")===0?"duckduckgo":null:null}(t),n=e!="yahoo"?"q":"p",r={};if(!yn(e)){r.$search_engine=e;var i=N?Co(N.referrer,n):"";i.length&&(r.ph_keyword=i)}return r}function fh(){return navigator.language||navigator.userLanguage}var So="$direct";function im(){return N?.referrer||So}function sm(t,e){var n=t?[...Qr,...e||[]]:[],r=He?.href.substring(0,1e3);return{r:im().substring(0,1e3),u:r?Gi(r,n,Yi):void 0}}function om(t){var e,{r:n,u:r}=t,i={$referrer:n,$referring_domain:n==null?void 0:n==So?So:(e=wo(n))==null?void 0:e.host};if(r){i.$current_url=r;var s=wo(r);i.$host=s?.host,i.$pathname=s?.pathname;var o=nm(r);ve(i,o)}if(n){var a=rm(n);ve(i,a)}return i}function am(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function t2(){try{return new Date().getTimezoneOffset()}catch{return}}var n2=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class ou{constructor(e,n){this.Bt=e,this.props={},this.mr=!1,this.yr=(r=>{var i="";return r.token&&(i=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+i+"_posthog"})(e),this.nr=this.br(e),this.load(),e.debug&&I.info("Persistence loaded",e.persistence,O({},this.props)),this.update_config(e,e,n),this.save()}isDisabled(){return!!this._r}br(e){n2.indexOf(e.persistence.toLowerCase())===-1&&(I.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n=function(i){i===void 0&&(i=[]);var s=[...Wv,...i];return O({},pe,{Z(o){try{var a={};try{a=jt.Z(o)||{}}catch{}var u=ve(a,JSON.parse(pe.O(o)||"{}"));return pe.M(o,u),u}catch{}return null},M(o,a,u,l,c,d){try{pe.M(o,a,void 0,void 0,d);var h={};s.forEach(f=>{a[f]&&(h[f]=a[f])}),Object.keys(h).length&&jt.M(o,h,u,l,c,d)}catch(f){pe.B(f)}},F(o,a){try{E?.localStorage.removeItem(o),jt.F(o,a)}catch(u){pe.B(u)}}})}(e.cookie_persisted_properties||[]),r=e.persistence.toLowerCase();return r==="localstorage"&&pe.R()?pe:r==="localstorage+cookie"&&n.R()?n:r==="sessionstorage"&&je.R()?je:r==="memory"?Uv:r==="cookie"?jt:n.R()?n:jt}wr(e){var n=e??this.Bt.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var r=this.props[bo];return!r||typeof r!="number"||Date.now()-r>n}properties(){var e={};return de(this.props,(n,r)=>{var i=(s=>{var o=Zv[s];if(o)return o;for(var[a,u]of Xv)if(s.indexOf(a)===0)return u})(r);if(i?.exposure==="derived"){if(i.shouldSkipFromEventProperties!=null&&i.shouldSkipFromEventProperties(n,r===Hr?()=>this.wr():()=>!1))return;i.transformToEventProperties&&ve(e,i.transformToEventProperties(n))}else i&&i.exposure!=="event"||(e[r]=n)}),e}load(){if(!this._r){var e=this.nr.Z(this.yr);e&&(this.props=ve({},e))}}save(){this._r||this.nr.M(this.yr,this.props,this.Ir,this.Cr,this.Sr,this.Bt.debug)}remove(){this.nr.F(this.yr,!1),this.nr.F(this.yr,!0)}clear(){this.remove(),this.props={}}register_once(e,n,r){if(ke(e)){P(n)&&(n="None"),this.Ir=P(r)?this.kr:r;var i=!1;if(de(e,(s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==n||(this.Tr(o,s),i=!0)}),i)return this.save(),!0}return!1}register(e,n){if(ke(e)){this.Ir=P(n)?this.kr:n;var r=!1;if(de(e,(i,s)=>{e.hasOwnProperty(s)&&this.props[s]!==i&&(this.Tr(s,i),r=!0)}),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Ar(e),this.save())}update_campaign_params(){if(!this.mr){var e=tm(this.Bt.custom_campaign_params,this.Bt.mask_personal_data_properties,this.Bt.custom_personal_data_properties);zr(qc(e))||this.register(e),this.mr=!0}}update_search_keyword(){var e;this.register((e=N?.referrer)?rm(e):{})}update_referrer_info(){var e;this.register_once({$referrer:im(),$referring_domain:N!=null&&N.referrer&&((e=wo(N.referrer))==null?void 0:e.host)||So},void 0)}set_initial_person_info(){this.props[Rl]||this.props[Nl]||this.register_once({[vo]:sm(this.Bt.mask_personal_data_properties,this.Bt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};de([Nl,Rl],o=>{var a=this.props[o];a&&de(a,function(u,l){e["$initial_"+cl(l)]=u})});var n,r,i=this.props[vo];if(i){var s=(n=om(i),r={},de(n,function(o,a){r["$initial_"+cl(a)]=o}),r);ve(e,s)}return e}safe_merge(e){return de(this.props,function(n,r){r in e||(e[r]=n)}),e}update_config(e,n,r){if(this.kr=this.Ir=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==n.persistence||!((o,a)=>{if(o.length!==a.length)return!1;var u=[...o].sort(),l=[...a].sort();return u.every((c,d)=>c===l[d])})(e.cookie_persisted_properties||[],n.cookie_persisted_properties||[])){var i=this.br(e),s=this.props;this.clear(),this.nr=i,this.props=s,this.save()}}set_disabled(e){this._r=e,this._r?this.remove():this.save()}set_cross_subdomain(e){e!==this.Cr&&(this.Cr=e,this.remove(),this.save())}set_secure(e){e!==this.Sr&&(this.Sr=e,this.remove(),this.save())}set_event_timer(e,n){var r=this.props[wi]||{};r[e]=n,this.Tr(wi,r),this.save()}remove_event_timer(e){var n=this.props[wi]||{},r=n[e];return P(r)||(delete n[e],this.Tr(wi,n),this.save()),r}get_property(e){return this.props[e]}set_property(e,n){this.Tr(e,n),this.save()}Tr(e,n){this.props[e]=n}Ar(e){delete this.props[e]}}var di={Activation:"events",Cancellation:"cancelEvents"},au={Popover:"popover",API:"api",Widget:"widget"},Ai={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},uu={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Il={Popover:"popover",Inline:"inline"},r2={SHOWN:"product tour shown"},ph={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},mh=fe("[RateLimiter]");class i2{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var r=n.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach(i=>{mh.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void mh.warn('could not rate limit - continuing. Error: "'+i?.message+'"',{text:r})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var n,r,i;e===void 0&&(e=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:o}=this,a=new Date().getTime(),u=(n=(r=this.instance.persistence)==null?void 0:r.get_property(Ol))!==null&&n!==void 0?n:{tokens:s,last:a};u.tokens+=(a-u.last)/1e3*o,u.last=a,u.tokens>s&&(u.tokens=s);var l=1>u.tokens;return l||e||(u.tokens=Math.max(0,u.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+o+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,(i=this.instance.persistence)==null||i.set_property(Ol,u),{isRateLimited:l,remainingTokens:u.tokens}}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var hi=fe("[RemoteConfig]");class um{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=$._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Er(e){var n,r;(n=$.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=$.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Rr(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(n){e(n.json)}})}load(){try{if(this.remoteConfig)return hi.info("Using preloaded remote config",this.remoteConfig),this.Nr(this.remoteConfig),void this.Mr();if(this._instance.Fr())return void hi.warn("Remote config is disabled. Falling back to local config.");this.Er(e=>{if(!e)return hi.info("No config found after loading remote JS config. Falling back to JSON."),void this.Rr(n=>{this.Nr(n),this.Mr()});this.Nr(e),this.Mr()})}catch(e){hi.error("Error loading remote config",e)}}stop(){this.Or&&(clearInterval(this.Or),this.Or=void 0)}refresh(){this._instance.Fr()||N?.visibilityState==="hidden"||this._instance.reloadFeatureFlags()}Mr(){var e;if(!this.Or){var n=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;n!==0&&(this.Or=setInterval(()=>{this.refresh()},n))}}Nr(e){var n;e||hi.error("Failed to fetch remote config from PostHog."),this._instance.Nr(e??{}),e?.hasFeatureFlags!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded())}}var zt={GZipJS:"gzip-js",Base64:"base64"},St=Uint8Array,at=Uint16Array,ei=Uint32Array,Wc=new St([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Uc=new St([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),gh=new St([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),lm=function(t,e){for(var n=new at(31),r=0;31>r;++r)n[r]=e+=1<<t[r-1];var i=new ei(n[30]);for(r=1;30>r;++r)for(var s=n[r];n[r+1]>s;++s)i[s]=s-n[r]<<5|r;return[n,i]},cm=lm(Wc,2),Pl=cm[1];cm[0][28]=258,Pl[258]=28;for(var bh=lm(Uc,0)[1],dm=new at(32768),he=0;32768>he;++he){var Ar=(43690&he)>>>1|(21845&he)<<1;dm[he]=((65280&(Ar=(61680&(Ar=(52428&Ar)>>>2|(13107&Ar)<<2))>>>4|(3855&Ar)<<4))>>>8|(255&Ar)<<8)>>>1}var Fi=function(t,e,n){for(var r=t.length,i=0,s=new at(e);r>i;++i)++s[t[i]-1];var o,a=new at(e);for(i=0;e>i;++i)a[i]=a[i-1]+s[i-1]<<1;for(o=new at(r),i=0;r>i;++i)o[i]=dm[a[t[i]-1]++]>>>15-t[i];return o},pr=new St(288);for(he=0;144>he;++he)pr[he]=8;for(he=144;256>he;++he)pr[he]=9;for(he=256;280>he;++he)pr[he]=7;for(he=280;288>he;++he)pr[he]=8;var Ao=new St(32);for(he=0;32>he;++he)Ao[he]=5;var s2=Fi(pr,9),o2=Fi(Ao,5),hm=function(t){return(t/8>>0)+(7&t&&1)},fm=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var r=new(t instanceof at?at:t instanceof ei?ei:St)(n-e);return r.set(t.subarray(e,n)),r},tn=function(t,e,n){var r=e/8>>0;t[r]|=n<<=7&e,t[r+1]|=n>>>8},fi=function(t,e,n){var r=e/8>>0;t[r]|=n<<=7&e,t[r+1]|=n>>>8,t[r+2]|=n>>>16},lu=function(t,e){for(var n=[],r=0;t.length>r;++r)t[r]&&n.push({s:r,f:t[r]});var i=n.length,s=n.slice();if(!i)return[new St(0),0];if(i==1){var o=new St(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(y,k){return y.f-k.f}),n.push({s:-1,f:25001});var a=n[0],u=n[1],l=0,c=1,d=2;for(n[0]={s:-1,f:a.f+u.f,l:a,r:u};c!=i-1;)a=n[n[d].f>n[l].f?l++:d++],u=n[l!=c&&n[d].f>n[l].f?l++:d++],n[c++]={s:-1,f:a.f+u.f,l:a,r:u};var h=s[0].s;for(r=1;i>r;++r)s[r].s>h&&(h=s[r].s);var f=new at(h+1),p=Ll(n[c-1],f,0);if(p>e){r=0;var m=0,g=p-e,b=1<<g;for(s.sort(function(y,k){return f[k.s]-f[y.s]||y.f-k.f});i>r;++r){var v=s[r].s;if(e>=f[v])break;m+=b-(1<<p-f[v]),f[v]=e}for(m>>>=g;m>0;){var _=s[r].s;e>f[_]?m-=1<<e-f[_]++-1:++r}for(;r>=0&&m;--r){var x=s[r].s;f[x]==e&&(--f[x],++m)}p=e}return[new St(f),p]},Ll=function(t,e,n){return t.s==-1?Math.max(Ll(t.l,e,n+1),Ll(t.r,e,n+1)):e[t.s]=n},vh=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new at(++e),r=0,i=t[0],s=1,o=function(u){n[r++]=u},a=1;e>=a;++a)if(t[a]==i&&a!=e)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=t[a]}return[n.subarray(0,r),e]},pi=function(t,e){for(var n=0,r=0;e.length>r;++r)n+=t[r]*e[r];return n},Bl=function(t,e,n){var r=n.length,i=hm(e+2);t[i]=255&r,t[i+1]=r>>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var s=0;r>s;++s)t[i+s+4]=n[s];return 8*(i+4+r)},yh=function(t,e,n,r,i,s,o,a,u,l,c){tn(e,c++,n),++i[256];for(var d=lu(i,15),h=d[0],f=d[1],p=lu(s,15),m=p[0],g=p[1],b=vh(h),v=b[0],_=b[1],x=vh(m),y=x[0],k=x[1],w=new at(19),C=0;v.length>C;++C)w[31&v[C]]++;for(C=0;y.length>C;++C)w[31&y[C]]++;for(var S=lu(w,7),D=S[0],F=S[1],L=19;L>4&&!D[gh[L-1]];--L);var j,V,X,ne,oe=l+5<<3,W=pi(i,pr)+pi(s,Ao)+o,re=pi(i,h)+pi(s,m)+o+14+3*L+pi(w,D)+(2*w[16]+3*w[17]+7*w[18]);if(W>=oe&&re>=oe)return Bl(e,c,t.subarray(u,u+l));if(tn(e,c,1+(W>re)),c+=2,W>re){j=Fi(h,f),V=h,X=Fi(m,g),ne=m;var Ce=Fi(D,F);for(tn(e,c,_-257),tn(e,c+5,k-1),tn(e,c+10,L-4),c+=14,C=0;L>C;++C)tn(e,c+3*C,D[gh[C]]);c+=3*L;for(var Te=[v,y],bt=0;2>bt;++bt){var Re=Te[bt];for(C=0;Re.length>C;++C)tn(e,c,Ce[Ue=31&Re[C]]),c+=D[Ue],Ue>15&&(tn(e,c,Re[C]>>>5&127),c+=Re[C]>>>12)}}else j=s2,V=pr,X=o2,ne=Ao;for(C=0;a>C;++C)if(r[C]>255){var Ue;fi(e,c,j[257+(Ue=r[C]>>>18&31)]),c+=V[Ue+257],Ue>7&&(tn(e,c,r[C]>>>23&31),c+=Wc[Ue]);var Dt=31&r[C];fi(e,c,X[Dt]),c+=ne[Dt],Dt>3&&(fi(e,c,r[C]>>>5&8191),c+=Uc[Dt])}else fi(e,c,j[r[C]]),c+=V[r[C]];return fi(e,c,j[256]),c+V[256]},a2=new ei([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),u2=function(){for(var t=new ei(256),e=0;256>e;++e){for(var n=e,r=9;--r;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),cu=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function l2(t,e){e===void 0&&(e={});var n=function(){var d=4294967295;return{p(h){for(var f=d,p=0;h.length>p;++p)f=u2[255&f^h[p]]^f>>>8;d=f},d(){return 4294967295^d}}}(),r=t.length;n.p(t);var i,s,o,a,u,l=(a=10+((i=e).filename&&i.filename.length+1||0),u=8,function(d,h,f,p,m,g){var b=d.length,v=new St(p+b+5*(1+Math.floor(b/7e3))+m),_=v.subarray(p,v.length-m),x=0;if(!h||8>b)for(var y=0;b>=y;y+=65535){var k=y+65535;b>k?x=Bl(_,x,d.subarray(y,k)):(_[y]=!0,x=Bl(_,x,d.subarray(y,b)))}else{for(var w=a2[h-1],C=w>>>13,S=8191&w,D=(1<<f)-1,F=new at(32768),L=new at(D+1),j=Math.ceil(f/3),V=2*j,X=function(Ya){return(d[Ya]^d[Ya+1]<<j^d[Ya+2]<<V)&D},ne=new ei(25e3),oe=new at(288),W=new at(32),re=0,Ce=0,Te=(y=0,0),bt=0,Re=0;b>y;++y){var Ue=X(y),Dt=32767&y,Cr=L[Ue];if(F[Dt]=Cr,L[Ue]=Dt,y>=bt){var ws=b-y;if((re>7e3||Te>24576)&&ws>423){x=yh(d,_,0,ne,oe,W,Ce,Te,Re,y-Re,x),Te=re=Ce=0,Re=y;for(var Ot=0;286>Ot;++Ot)oe[Ot]=0;for(Ot=0;30>Ot;++Ot)W[Ot]=0}var Gn=2,Cs=0,Lb=S,_n=Dt-Cr&32767;if(ws>2&&Ue==X(y-_n))for(var Bb=Math.min(C,ws)-1,$b=Math.min(32767,y),zb=Math.min(258,ws);$b>=_n&&--Lb&&Dt!=Cr;){if(d[y+Gn]==d[y+Gn-_n]){for(var xn=0;zb>xn&&d[y+xn]==d[y+xn-_n];++xn);if(xn>Gn){if(Gn=xn,Cs=_n,xn>Bb)break;var Hb=Math.min(_n,xn-2),Ud=0;for(Ot=0;Hb>Ot;++Ot){var Ga=y-_n+Ot+32768&32767,Kd=Ga-F[Ga]+32768&32767;Kd>Ud&&(Ud=Kd,Cr=Ga)}}}_n+=(Dt=Cr)-(Cr=F[Dt])+32768&32767}if(Cs){ne[Te++]=268435456|Pl[Gn]<<18|bh[Cs];var Jd=31&Pl[Gn],Gd=31&bh[Cs];Ce+=Wc[Jd]+Uc[Gd],++oe[257+Jd],++W[Gd],bt=y+Gn,++re}else ne[Te++]=d[y],++oe[d[y]]}}x=yh(d,_,!0,ne,oe,W,Ce,Te,Re,y-Re,x)}return fm(v,0,p+hm(x)+m)}(s=t,(o=e).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+o.mem,a,u)),c=l.length;return function(d,h){var f=h.filename;if(d[0]=31,d[1]=139,d[2]=8,d[8]=2>h.level?4:h.level==9?2:0,d[9]=3,h.mtime!=0&&cu(d,4,Math.floor(new Date(h.mtime||Date.now())/1e3)),f){d[3]=8;for(var p=0;f.length>=p;++p)d[p+10]=f.charCodeAt(p)}}(l,e),cu(l,c-8,n.d()),cu(l,c-4,r),l}var c2=!!ul||!!al,pm="text/plain",_h=!1,Sa=function(t,e,n){var r;n===void 0&&(n=!0);var[i,s]=t.split("?"),o=O({},e),a=(r=s?.split("&").map(l=>{var c,[d,h]=l.split("="),f=n&&(c=o[d])!==null&&c!==void 0?c:h;return delete o[d],d+"="+f}))!==null&&r!==void 0?r:[],u=function(l,c){var d,h;c===void 0&&(c="&");var f=[];return de(l,function(p,m){P(p)||P(m)||m==="undefined"||(d=encodeURIComponent((g=>g instanceof File)(p)?p.name:p.toString()),h=encodeURIComponent(m),f[f.length]=h+"="+d)}),f.join(c)}(o);return u&&a.push(u),i+"?"+a.join("&")},jr=(t,e)=>JSON.stringify(t,(n,r)=>typeof r=="bigint"?r.toString():r,e),du=t=>{if(t.tr)return t.tr;var{data:e,compression:n}=t;if(e){if(n===zt.GZipJS){var r=l2(function(a,u){var l=a.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(a);for(var c=new St(a.length+(a.length>>>1)),d=0,h=function(g){c[d++]=g},f=0;l>f;++f){if(d+5>c.length){var p=new St(d+8+(l-f<<1));p.set(c),c=p}var m=a.charCodeAt(f);128>m?h(m):2048>m?(h(192|m>>>6),h(128|63&m)):m>55295&&57344>m?(h(240|(m=65536+(1047552&m)|1023&a.charCodeAt(++f))>>>18),h(128|m>>>12&63),h(128|m>>>6&63),h(128|63&m)):(h(224|m>>>12),h(128|m>>>6&63),h(128|63&m))}return fm(c,0,d)}(jr(e)),{mtime:0});return{contentType:pm,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===zt.Base64){var i=function(a){return a&&btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,(u,l)=>String.fromCharCode(parseInt(l,16))))}(jr(e)),s=(a=>"data="+encodeURIComponent(typeof a=="string"?a:jr(a)))(i);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var o=jr(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},d2=function(){var t=kt(function*(e){var n=jr(e.data),r=yield function(s,o,a){return ll.apply(this,arguments)}(n,et.DEBUG,{rethrow:!0});if(!r)return e;var i=yield r.arrayBuffer();return O({},e,{tr:{contentType:pm,body:i,estimatedSize:i.byteLength}})});return function(e){return t.apply(this,arguments)}}(),xh=(t,e)=>Sa(t,{_:new Date().getTime().toString(),ver:et.JS_SDK_VERSION,compression:e}),eo=[];al&&eo.push({transport:"fetch",method(t){var e,n,{contentType:r,body:i,estimatedSize:s}=(e=du(t))!==null&&e!==void 0?e:{},o=new Headers;de(t.headers,function(c,d){o.append(d,c)}),r&&o.append("Content-Type",r);var a=t.url,u=null;if(Xd){var l=new Xd;u={signal:l.signal,timeout:setTimeout(()=>l.abort(),t.timeout)}}al(a,O({method:t?.method||"GET",headers:o,keepalive:t.method==="POST"&&52428.8>(s||0),body:i,signal:(n=u)==null?void 0:n.signal},t.fetchOptions)).then(c=>c.text().then(d=>{var h={statusCode:c.status,text:d};if(c.status===200)try{h.json=JSON.parse(d)}catch(f){I.error(f)}t.callback==null||t.callback(h)})).catch(c=>{I.error(c),t.callback==null||t.callback({statusCode:0,error:c})}).finally(()=>u?clearTimeout(u.timeout):null)}}),ul&&eo.push({transport:"XHR",method(t){var e,n=new ul;n.open(t.method||"GET",t.url,!0);var{contentType:r,body:i}=(e=du(t))!==null&&e!==void 0?e:{};de(t.headers,function(s,o){n.setRequestHeader(o,s)}),r&&n.setRequestHeader("Content-Type",r),t.timeout&&(n.timeout=t.timeout),t.disableXHRCredentials||(n.withCredentials=!0),n.onreadystatechange=()=>{if(n.readyState===4){var s={statusCode:n.status,text:n.responseText};if(n.status===200)try{s.json=JSON.parse(n.responseText)}catch{}t.callback==null||t.callback(s)}},n.send(i)}}),ft!=null&&ft.sendBeacon&&eo.push({transport:"sendBeacon",method(t){var e=Sa(t.url,{beacon:"1"});try{var n,{contentType:r,body:i}=(n=du(t))!==null&&n!==void 0?n:{};if(!i)return;var s=i instanceof Blob?i:new Blob([i],{type:r});ft.sendBeacon(e,s)}catch{}}});var $l=3e3;class h2{constructor(e,n){this.Pr=!0,this.Lr=[],this.Dr=qt(n?.flush_interval_ms||$l,250,5e3,I.createLogger("flush interval"),$l),this.Br=e}enqueue(e){this.Lr.push(e),this.jr||this.$r()}unload(){this.qr();var e=this.Lr.length>0?this.Zr():{},n=Object.values(e);[...n.filter(r=>r.url.indexOf("/e")===0),...n.filter(r=>r.url.indexOf("/e")!==0)].map(r=>{this.Br(O({},r,{transport:"sendBeacon"}))})}enable(){this.Pr=!1,this.$r()}$r(){var e=this;this.Pr||(this.jr=setTimeout(()=>{if(this.qr(),this.Lr.length>0){var n=this.Zr(),r=function(){var s=n[i],o=new Date().getTime();s.data&&Q(s.data)&&de(s.data,a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp}),e.Br(s)};for(var i in n)r()}},this.Dr))}qr(){clearTimeout(this.jr),this.jr=void 0}Zr(){var e={};return de(this.Lr,n=>{var r,i=n,s=(i?i.batchKey:null)||i.url;P(e[s])&&(e[s]=O({},i,{data:[]})),(r=e[s].data)==null||r.push(i.data)}),this.Lr=[],e}}var f2=["retriesPerformedSoFar"];class p2{constructor(e){this.Vr=!1,this.Hr=3e3,this.Lr=[],this._instance=e,this.Lr=[],this.zr=!0,!P(E)&&"onLine"in E.navigator&&(this.zr=E.navigator.onLine,this.Ur=()=>{this.zr=!0,this.Yr()},this.Gr=()=>{this.zr=!1},Ee(E,"online",this.Ur),Ee(E,"offline",this.Gr))}get length(){return this.Lr.length}retriableRequest(e){var{retriesPerformedSoFar:n}=e,r=b0(e,f2);Nr(n)&&(r.url=Sa(r.url,{retry_count:n})),this._instance._send_request(O({},r,{callback:i=>{i.statusCode===200||i.statusCode>=400&&500>i.statusCode||(n??0)>=10?r.callback==null||r.callback(i):this.Wr(O({retriesPerformedSoFar:n},r))}}))}Wr(e){var n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;var r=function(o){var a=3e3*Math.pow(2,o),u=a/2,l=Math.min(18e5,a),c=Math.random()-.5;return Math.ceil(l+c*(l-u))}(n),i=Date.now()+r;this.Lr.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in "+r;navigator.onLine||(s+=" (Browser is offline)"),I.warn(s),this.Vr||(this.Vr=!0,this.Xr())}Xr(){if(this.Jr&&clearTimeout(this.Jr),this.Lr.length===0)return this.Vr=!1,void(this.Jr=void 0);this.Jr=setTimeout(()=>{this.zr&&this.Lr.length>0&&this.Yr(),this.Xr()},this.Hr)}Yr(){var e=Date.now(),n=[],r=this.Lr.filter(s=>e>s.retryAt||(n.push(s),!1));if(this.Lr=n,r.length>0)for(var{requestOptions:i}of r)this.retriableRequest(i)}unload(){for(var{requestOptions:e}of(this.Jr&&(clearTimeout(this.Jr),this.Jr=void 0),this.Vr=!1,P(E)||(this.Ur&&(E.removeEventListener("online",this.Ur),this.Ur=void 0),this.Gr&&(E.removeEventListener("offline",this.Gr),this.Gr=void 0)),this.Lr))try{this._instance._send_request(O({},e,{transport:"sendBeacon"}))}catch(n){I.error(n)}this.Lr=[]}}class m2{constructor(e){this.Kr=()=>{var n,r,i,s;this.Qr||(this.Qr={});var o=this.scrollElement(),a=this.scrollY(),u=o?Math.max(0,o.scrollHeight-o.clientHeight):0,l=a+(o?.clientHeight||0),c=o?.scrollHeight||0;this.Qr.lastScrollY=Math.ceil(a),this.Qr.maxScrollY=Math.max(a,(n=this.Qr.maxScrollY)!==null&&n!==void 0?n:0),this.Qr.maxScrollHeight=Math.max(u,(r=this.Qr.maxScrollHeight)!==null&&r!==void 0?r:0),this.Qr.lastContentY=l,this.Qr.maxContentY=Math.max(l,(i=this.Qr.maxContentY)!==null&&i!==void 0?i:0),this.Qr.maxContentHeight=Math.max(c,(s=this.Qr.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}get ei(){return this._instance.config.scroll_root_selector}getContext(){return this.Qr}resetContext(){var e=this.Qr;return setTimeout(this.Kr,0),e}startMeasuringScrollPosition(){Ee(E,"scroll",this.Kr,{capture:!0}),Ee(E,"scrollend",this.Kr,{capture:!0}),Ee(E,"resize",this.Kr)}scrollElement(){if(!this.ei)return E?.document.documentElement;var e=Q(this.ei)?this.ei:[this.ei];for(var n of e){var r=E?.document.querySelector(n);if(r)return r}}scrollY(){if(this.ei){var e=this.scrollElement();return e&&e.scrollTop||0}return E&&(E.scrollY||E.pageYOffset||E.document.documentElement.scrollTop)||0}scrollX(){if(this.ei){var e=this.scrollElement();return e&&e.scrollLeft||0}return E&&(E.scrollX||E.pageXOffset||E.document.documentElement.scrollLeft)||0}}var g2=t=>sm(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties);class kh{constructor(e,n,r,i){this.ti=s=>{var o=this.ri();if(!o||o.sessionId!==s){var a={sessionId:s,props:this.ii(this._instance)};this.ni.register({[Dl]:a})}},this._instance=e,this.si=n,this.ni=r,this.ii=i||g2,this.si.onSessionId(this.ti)}ri(){return this.ni.props[Dl]}getSetOnceProps(){var e,n=(e=this.ri())==null?void 0:e.props;return n?"r"in n?om(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var e={};return de(qc(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+cl(r)]=n}),e}}class Kc{constructor(){this.oi={}}on(e,n){return this.oi[e]||(this.oi[e]=[]),this.oi[e].push(n),()=>{this.oi[e]=this.oi[e].filter(r=>r!==n)}}emit(e,n){for(var r of this.oi[e]||[])r(n);for(var i of this.oi["*"]||[])i(e,n)}}var hu=fe("[SessionId]");class wh{on(e,n){return this.ai.on(e,n)}constructor(e,n,r){var i;if(this.li=[],this.ui=void 0,this.ai=new Kc,this.hi=(l,c)=>!(!Nr(l)||!Nr(c))&&Math.abs(l-c)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===hn)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Bt=e.config,this.ni=e.persistence,this.ci=void 0,this.di=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.vi=n||On,this.fi=r||On;var s=this.Bt.persistence_name||this.Bt.token;if(this._sessionTimeoutMs=1e3*qt(this.Bt.session_idle_timeout_seconds||1800,60,36e3,hu.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.pi(),this.gi="ph_"+s+"_window_id",this.mi="ph_"+s+"_primary_window_exists",this.yi()){var o=je.Z(this.gi),a=je.Z(this.mi);o&&!a?this.ci=o:je.F(this.gi),je.M(this.mi,!0)}if((i=this.Bt.bootstrap)!=null&&i.sessionID)try{var u=(l=>{var c=this.Bt.bootstrap.sessionID.replace(/-/g,"");if(c.length!==32)throw new Error("Not a valid UUID");if(c[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(c.substring(0,12),16)})();this.bi(this.Bt.bootstrap.sessionID,new Date().getTime(),u)}catch(l){hu.error("Invalid sessionID in bootstrap",l)}this.wi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return P(this.li)&&(this.li=[]),this.li.push(e),this.di&&e(this.di,this.ci),()=>{this.li=this.li.filter(n=>n!==e)}}yi(){return this.Bt.persistence!=="memory"&&!this.ni._r&&je.R()}Ii(e){e!==this.ci&&(this.ci=e,this.yi()&&je.M(this.gi,e))}Ci(){return this.ci?this.ci:this.yi()?je.Z(this.gi):null}bi(e,n,r){e===this.di&&n===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.di=e,this.ni.register({[go]:[n,e,r]}))}Si(){var e=this.ni.props[go];return Q(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.bi(null,null,null)}destroy(){clearTimeout(this.xi),this.xi=void 0,this.ui&&E&&(E.removeEventListener(xo,this.ui,{capture:!1}),this.ui=void 0),this.li=[]}wi(){this.ui=()=>{this.yi()&&je.F(this.mi)},Ee(E,xo,this.ui,{capture:!1})}checkAndGetSessionAndWindowId(e,n){if(e===void 0&&(e=!1),n===void 0&&(n=null),this.Bt.cookieless_mode===hn)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),[i,s,o]=this.Si(),a=this.Ci(),u=Nr(o)&&Math.abs(r-o)>864e5,l=!1,c=!s,d=!c&&!e&&this.hi(r,i);c||d||u?(s=this.vi(),a=this.fi(),hu.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:u}}),o=r,l=!0):a||(a=this.fi(),l=!0);var h=Nr(i)&&e&&!u?i:r,f=Nr(o)?o:new Date().getTime();return this.Ii(a),this.bi(s,h,f),e||this.pi(),l&&this.li.forEach(p=>p(s,a,l?{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:u}:void 0)),{sessionId:s,windowId:a,sessionStartTimestamp:f,changeReason:l?{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:u}:void 0,lastActivityTimestamp:i}}pi(){clearTimeout(this.xi),this.xi=setTimeout(()=>{var[e]=this.Si();if(this.hi(new Date().getTime(),e)){var n=this.di;this.resetSessionId(),this.ai.emit("forcedIdleReset",{idleSessionId:n})}},1.1*this.sessionTimeoutMs)}}var mm=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&th(n,e))return!0;try{var r=t?.userAgentData;if(r!=null&&r.brands&&r.brands.some(i=>th(i?.brand,e)))return!0}catch{}return!!t.webdriver},Mo=function(t,e){if(!function(n){try{new RegExp(n)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function Ch(t,e,n){return jr({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}var gm={exact:(t,e)=>e.some(n=>t.some(r=>n===r)),is_not:(t,e)=>e.every(n=>t.every(r=>n!==r)),regex:(t,e)=>e.some(n=>t.some(r=>Mo(n,r))),not_regex:(t,e)=>e.every(n=>t.every(r=>!Mo(n,r))),icontains:(t,e)=>e.map(Os).some(n=>t.map(Os).some(r=>n.includes(r))),not_icontains:(t,e)=>e.map(Os).every(n=>t.map(Os).every(r=>!n.includes(r))),gt:(t,e)=>e.some(n=>{var r=parseFloat(n);return!isNaN(r)&&t.some(i=>r>parseFloat(i))}),lt:(t,e)=>e.some(n=>{var r=parseFloat(n);return!isNaN(r)&&t.some(i=>r<parseFloat(i))})},Os=t=>t.toLowerCase();function bm(t,e){return!t||Object.entries(t).every(n=>{var[r,i]=n,s=e?.[r];if(P(s)||yn(s))return!1;var o=[String(s)],a=gm[i.operator];return!!a&&a(i.values,o)})}var zl="custom",Eh="i.posthog.com",b2=/^\/static\//;class v2{constructor(e){this.ki={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,n=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+Eh,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.ki[this.apiHost]||(this.ki[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":zl),this.ki[this.apiHost]}Ti(e){var n=this.instance.config.__preview_external_dependency_versioned_paths;if(typeof n=="string"&&b2.test(e))return n.trim().replace(/\/$/,"")||void 0}endpointFor(e,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),e==="ui")return this.uiHost+n;if(e==="flags")return this.flagsApiHost+n;if(e==="assets"){var r=this.Ti(n);if(r)return""+r+n}if(this.region===zl)return this.apiHost+n;var i=Eh+n;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var se=fe("[Surveys]"),Hl="seenSurvey_",y2=[au.Popover,au.Widget,au.API],_2={ignoreConditions:!1,ignoreDelay:!1,displayType:Il.Popover},x2=fe("[PostHog ExternalIntegrations]"),k2={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class w2{constructor(e){this._instance=e}ur(e,n){var r;(r=$.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,i=>{if(i)return x2.error("failed to load script",i);n()})}startIfEnabledOrStop(){var e=this,n=function(o){var a,u,l;!i||(a=$.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.ur(k2[o],()=>{var c;(c=$.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.start(e._instance)}),!i&&(u=$.__PosthogExtensions__)!=null&&(u=u.integrations)!=null&&u[o]&&((l=$.__PosthogExtensions__)==null||(l=l.integrations)==null||(l=l[o])==null||l.stop())};for(var[r,i]of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;n(r)}}}var Mr,Ii={},fu=0,jl=()=>{},Sh='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',mi="Surveys module not available",Ah="sanitize_properties is deprecated. Use before_send instead",vm="Invalid value for property_denylist config: ",Pr="posthog",ym=!c2&&st?.indexOf("MSIE")===-1&&st?.indexOf("Mozilla")===-1,Mh=t=>{var e;return O({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:zv(N?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:jl,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,debug:He&&me(He?.search)&&He.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(E==null||(e=E.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(n){I.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Fl,before_send:void 0,request_queue_config:{flush_interval_ms:$l},error_tracking:{},_onCapture:jl,__preview_eager_load_replay:!1},(n=>({rageclick:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(t))},C2=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],Th=t=>{var e={};for(var[n,r]of C2)P(t[n])||(e[r]=t[n]);var i=ve({},e,t);return Q(t.property_blacklist)&&(P(t.property_denylist)?i.property_denylist=t.property_blacklist:Q(t.property_denylist)?i.property_denylist=[...t.property_blacklist,...t.property_denylist]:I.error(vm+t.property_denylist)),i};class E2{constructor(){this.__forceAllowLocalhost=!1}get Ai(){return this.__forceAllowLocalhost}set Ai(e){I.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Ct{Ei(e,n){if(e){var r=this.Ri.indexOf(e);r!==-1&&this.Ri.splice(r,1)}return this.Ri.push(n),n.initialize==null||n.initialize(),n}Ni(){return this.config.cookieless_mode===hn||this.config.cookieless_mode===tr&&this.consent.isRejected()}get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new E2,this.Mi=!1,this.version=et.LIB_VERSION,this.Fi=new Kc,this.Ri=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Mh(),this.SentryIntegration=Yv,this.sentryIntegration=r=>function(i,s){var o=em(i,s);return{name:Q0,processEvent:a=>o(a)}}(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Oi=!1,this.Pi=null,this.Li=null,this.Di=null,this.scrollManager=new m2(this),this.pageViewManager=new hh(this),this.rateLimiter=new i2(this),this.requestRouter=new v2(this),this.consent=new Kv(this),this.externalIntegrations=new w2(this);var n=(e=Ct.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(r,i,s)=>{var o=me(r)?{[r]:i}:r;this.setPersonProperties(o),s?.({})},set_once:(r,i,s)=>{var o=me(r)?{[r]:i}:r;this.setPersonProperties(void 0,o),s?.({})}},this.on("eventCaptured",r=>I.info('send "'+r?.event+'"',r))}init(e,n,r){if(r&&r!==Pr){var i,s=(i=Ii[r])!==null&&i!==void 0?i:new Ct;return s._init(e,n,r),Ii[r]=s,Ii[Pr][r]=s,s}return this._init(e,n,r)}_init(e,n,r){var i,s;if(n===void 0&&(n={}),P(e)||Ys(e))return I.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.Bi(n.debug),this.ji=n,this.$i=[],n.person_profiles?this.Li=n.person_profiles:n.process_person&&(this.Li=n.process_person),this.set_config(ve({},Mh(n.defaults),Th(n),{name:r,token:e})),this.config.on_xhr_error&&I.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:zt.GZipJS;var o=this.qi();this.persistence=new ou(this.config,o),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ou(O({},this.config,{persistence:"sessionStorage"}),o);var a=O({},this.persistence.props),u=O({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Zi=new h2(g=>this.Vi(g),this.config.request_queue_config),this.Hi=new p2(this),this.__request_queue=[];var l=this.Ni();if(l||(this.sessionManager=new wh(this),this.sessionPropsManager=new kh(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(I.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.zi(l)},0)):(I.info("Initializing extensions synchronously"),this.zi(l)),et.DEBUG=et.DEBUG||this.config.debug,et.DEBUG&&I.info("Starting in debug mode",{this:this,config:n,thisC:O({},this.config),p:a,s:u}),!this.config.identity_distinct_id||(i=n.bootstrap)!=null&&i.distinctID||(n.bootstrap=O({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((s=n.bootstrap)==null?void 0:s.distinctID)!==void 0){var c=n.bootstrap.distinctID,d=this.get_distinct_id(),h=this.persistence.get_property(Rt);if(n.bootstrap.isIdentifiedID&&d!=null&&d!==c&&h===Er)this.identify(c);else if(n.bootstrap.isIdentifiedID&&d!=null&&d!==c&&h===Sr)I.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var f=this.config.get_device_id(On()),p=n.bootstrap.isIdentifiedID?f:c;this.persistence.set_property(Rt,n.bootstrap.isIdentifiedID?Sr:Er),this.register({distinct_id:c,$device_id:p})}}if(l)this.register_once({distinct_id:Ss,$device_id:null},"");else if(!this.get_distinct_id()){var m=this.config.get_device_id(On());this.register_once({distinct_id:m,$device_id:m},""),this.persistence.set_property(Rt,Er)}return Ee(E,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?function(g,b){var v=g.config.segment;if(!v)return b();(function(_,x){var y=_.config.segment;if(!y)return x();var k=C=>{var S=()=>C.anonymousId()||On();_.config.get_device_id=S,C.id()&&(_.register({distinct_id:C.id(),$device_id:S()}),_.persistence.set_property(Rt,Sr)),x()},w=y.user();"then"in w&&dn(w.then)?w.then(k):k(w)})(g,()=>{v.register((_=>{Promise&&Promise.resolve||su.warn("This browser does not have Promise support, and can not use the segment integration");var x=(y,k)=>{if(!k)return y;y.event.userId||y.event.anonymousId===_.get_distinct_id()||(su.info("No userId set, resetting PostHog"),_.reset()),y.event.userId&&y.event.userId!==_.get_distinct_id()&&(su.info("UserId set, identifying with PostHog"),_.identify(y.event.userId));var w=_.calculateEventProperties(k,y.event.properties);return y.event.properties=Object.assign({},w,y.event.properties),y};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:y=>x(y,y.event.event),page:y=>x(y,Ir),identify:y=>x(y,ru),screen:y=>x(y,"$screen")}})(g)).then(()=>{b()})})}(this,()=>this.Ui()):this.Ui(),dn(this.config._onCapture)&&this.config._onCapture!==jl&&(I.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",g=>this.config._onCapture(g.event,g))),this.config.ip&&I.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}zi(e){var n,r,i,s,o,a,u,l=performance.now(),c=O({},Ct.__defaultExtensionClasses,this.config.__extensionClasses),d=[];c.featureFlags&&this.Ri.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new c.featureFlags(this)),c.exceptions&&this.Ri.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new c.exceptions(this)),c.historyAutocapture&&this.Ri.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this.Ri.push(new c.tracingHeaders(this)),c.siteApps&&this.Ri.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!e&&this.Ri.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||d.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),c.autocapture&&this.Ri.push(this.autocapture=new c.autocapture(this)),c.surveys&&this.Ri.push(this.surveys=(i=this.surveys)!==null&&i!==void 0?i:new c.surveys(this)),c.logs&&this.Ri.push(this.logs=(s=this.logs)!==null&&s!==void 0?s:new c.logs(this)),c.conversations&&this.Ri.push(this.conversations=(o=this.conversations)!==null&&o!==void 0?o:new c.conversations(this)),c.productTours&&this.Ri.push(this.productTours=new c.productTours(this)),c.heatmaps&&this.Ri.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this.Ri.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this.Ri.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this.Ri.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,Gv)),c.toolbar&&this.Ri.push(this.toolbar=(a=this.toolbar)!==null&&a!==void 0?a:new c.toolbar(this)),c.experiments&&this.Ri.push(this.experiments=(u=this.experiments)!==null&&u!==void 0?u:new c.experiments(this)),this.Ri.forEach(h=>{h.initialize&&d.push(()=>{h.initialize==null||h.initialize()})}),d.push(()=>{if(this.Yi){var h=this.Yi;this.Yi=void 0,this.Nr(h)}}),this.Gi(d,l)}Gi(e,n){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&e.length>0)return void setTimeout(()=>{this.Gi(e,n)},0);var r=e.shift();if(r)try{r()}catch(s){I.error("Error initializing extension:",s)}}var i=Math.round(performance.now()-n);this.register_for_session({[J0]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[G0]:i}),this.config.__preview_deferred_init_extensions&&I.info("PostHog extensions initialized ("+i+"ms)")}Nr(e){var n;if(!N||!N.body)return I.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Nr(e)},500);this.config.__preview_deferred_init_extensions&&(this.Yi=e),this.Wi=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=G(e.supportedCompression,zt.GZipJS)?zt.GZipJS:G(e.supportedCompression,zt.Base64)?zt.Base64:void 0),(n=e.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Li?this.Li:Fl}),this.Ri.forEach(r=>r.onRemoteConfig==null?void 0:r.onRemoteConfig(e))}Ui(){try{this.config.loaded(this)}catch(r){I.critical("`loaded` function failed",r)}if(this.Xi(),this.config.internal_or_test_user_hostname&&He!=null&&He.hostname){var e=He.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?e===n:n.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.Ni())&&this.Ji()},1),this.Ki=new um(this),this.Ki.load()}Xi(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Zi)==null||e.enable())}_dom_loaded(){this.is_capturing()&&As(this.__request_queue,e=>this.Vi(e)),this.__request_queue=[],this.Xi()}_handle_unload(){var e,n,r,i;(e=this.surveys)==null||e.handlePageUnload(),this.config.request_batching?(this.Qi()&&this.capture(nu),(n=this.logs)==null||n.flushLogs("sendBeacon"),(r=this.Zi)==null||r.unload(),(i=this.Hi)==null||i.unload()):this.Qi()&&this.capture(nu,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(ym?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Sa(e.url,{ip:this.config.ip?1:0}),e.headers=O({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(n=>{var r,i,s,o=O({},n);o.timeout=o.timeout||6e4,o.url=xh(o.url,o.compression);var a=(r=o.transport)!==null&&r!==void 0?r:"fetch",u=eo.filter(c=>!o.disableTransport||!c.transport||!o.disableTransport.includes(c.transport)),l=(i=(s=function(c,d){for(var h=0;c.length>h;h++)if(c[h].transport===a)return c[h]}(u))==null?void 0:s.method)!==null&&i!==void 0?i:u[0].method;if(!l)throw new Error("No available transport method");a!=="sendBeacon"&&o.data&&o.compression===zt.GZipJS&&Yb&&!_h?d2(o).then(c=>{l(c)}).catch(c=>{if((d=>!(!d||typeof d!="object")&&("name"in d?String(d.name):"")==="NotReadableError")(c))return _h=!0,void l(O({},o,{compression:void 0,url:xh(n.url,void 0)}));l(o)}):l(o)})(O({},e,{callback:n=>{var r,i;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(r=(i=this.config).on_request_error)==null||r.call(i,n),e.callback==null||e.callback(n)}}))))}Vi(e){this.Hi?this.Hi.retriableRequest(e):this._send_request(e)}_execute_array(e){fu++;try{var n,r=[],i=[],s=[];As(e,a=>{a&&(Q(n=a[0])?s.push(a):dn(a)?a.call(this):Q(a)&&n==="alias"?r.push(a):Q(a)&&n.indexOf("capture")!==-1&&dn(this[n])?s.push(a):i.push(a))});var o=function(a,u){As(a,function(l){if(Q(l[0])){var c=u;de(l,function(d){c=c[d[0]].apply(c,d.slice(1))})}else u[l[0]].apply(u,l.slice(1))})};o(r,this),o(i,this),o(s,this)}finally{fu--}}push(e){if(fu>0&&Q(e)&&me(e[0])){var n=Ct.prototype[e[0]];dn(n)&&n.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,n,r){var i,s,o,a,u;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Zi){if(this.is_capturing())if(!P(e)&&me(e)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var c=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(c==null||!c.isRateLimited){n!=null&&n.$current_url&&!me(n?.$current_url)&&(I.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),e!=="$exception"||r!=null&&r.en||I.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var d=new Date,h=r?.timestamp||d,f=On(),p={uuid:f,event:e,properties:this.calculateEventProperties(e,n||{},h,f)};e===Ir&&this.config.__preview_capture_bot_pageviews&&l&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),c&&(p.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens),r?.$set&&(p.$set=r?.$set);var m,g,b,v=this.tn(r?.$set_once,e!==uh,e===ru);if(v&&(p.$set_once=v),r!=null&&r._noTruncate||(s=this.config.properties_string_max_length,o=p,a=S=>me(S)?S.slice(0,s):S,u=new Set,p=function S(D,F){return D!==Object(D)?a?a(D):D:u.has(D)?void 0:(u.add(D),Q(D)?(L=[],As(D,j=>{L.push(S(j))})):(L={},de(D,(j,V)=>{u.has(j)||(L[V]=S(j))})),L);var L}(o)),p.timestamp=h,P(r?.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),e===Ai.DISMISSED||e===Ai.SENT){var _=n?.[uu.SURVEY_ID],x=n?.[uu.SURVEY_ITERATION];(S=>{try{var D=(F=>((L,j)=>{var V=""+Hl+j.id;return j.current_iteration&&j.current_iteration>0&&(V=""+Hl+j.id+"_"+j.current_iteration),V})(0,F))(S);if(localStorage.getItem(D))return;localStorage.setItem(D,"true")}catch(F){se.error("Failed to persist survey seen state",F)}})({id:_,current_iteration:x}),p.$set=O({},p.$set,{[(m={id:_,current_iteration:x},g=e===Ai.SENT?"responded":"dismissed",b="$survey_"+g+"/"+m.id,m.current_iteration&&m.current_iteration>0&&(b="$survey_"+g+"/"+m.id+"/"+m.current_iteration),b)]:!0})}else e===Ai.SHOWN&&(p.$set=O({},p.$set,{[uu.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===r2.SHOWN){var y=n?.[ph.TOUR_TYPE];y&&(p.$set=O({},p.$set,{[ph.TOUR_LAST_SEEN_DATE+"/"+y]:new Date().toISOString()}))}var k=O({},p.properties.$set,p.$set);if(zr(k)||this.setPersonPropertiesForFlags(k),!Y(this.config.before_send)){var w=this.rn(p);if(!w)return;p=w}this.Fi.emit("eventCaptured",p);var C={method:"POST",url:(i=r?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:r?._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Vi(C):this.Zi.enqueue(C),p}I.critical("This capture call is ignored due to client rate limiting.")}}else I.error("No event name provided to posthog.capture")}else I.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",n=>e(n.event,n))}calculateEventProperties(e,n,r,i,s){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var o=s?void 0:this.persistence.remove_event_timer(e),a=O({},n);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.Ni()&&(a.$cookieless_mode=!0),e==="$snapshot"){var u=O({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=u.distinct_id,(!me(a.distinct_id)&&!Tt(a.distinct_id)||Ys(a.distinct_id))&&I.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var l,c=function(b,v){var _,x,y,k;if(!st)return{};var w,C,S,D,F,L,j,V,X=b?[...Qr,...v||[]]:[],[ne,oe]=function(W){for(var re=0;ih.length>re;re++){var[Ce,Te]=ih[re],bt=Ce.exec(W),Re=bt&&(dn(Te)?Te(bt,W):Te);if(Re)return Re}return["",""]}(st);return ve(qc({$os:ne,$os_version:oe,$browser:P0(st,navigator.vendor),$device:sh(st),$device_type:(C=st,S={userAgentDataPlatform:(_=navigator)==null||(_=_.userAgentData)==null?void 0:_.platform,maxTouchPoints:(x=navigator)==null?void 0:x.maxTouchPoints,screenWidth:E==null||(y=E.screen)==null?void 0:y.width,screenHeight:E==null||(k=E.screen)==null?void 0:k.height,devicePixelRatio:E?.devicePixelRatio},V=sh(C),V===k0||V===x0||V==="Kobo"||V==="Kindle Fire"||V===I0?Yr:V===Ki||V===Ur||V===Ji||V===hl?"Console":V===C0?"Wearable":V?pt:S?.userAgentDataPlatform==="Android"&&((D=S?.maxTouchPoints)!==null&&D!==void 0?D:0)>0?600>Math.min((F=S?.screenWidth)!==null&&F!==void 0?F:0,(L=S?.screenHeight)!==null&&L!==void 0?L:0)/((j=S?.devicePixelRatio)!==null&&j!==void 0?j:1)?pt:Yr:"Desktop"),$timezone:am(),$timezone_offset:t2()}),{$current_url:Gi(He?.href,X,Yi),$host:He?.host,$pathname:He?.pathname,$raw_user_agent:st.length>1e3?st.substring(0,997)+"...":st,$browser_version:hv(st,navigator.vendor),$browser_language:fh(),$browser_language_prefix:(w=fh(),typeof w=="string"?w.split("-")[0]:void 0),$screen_height:E?.screen.height,$screen_width:E?.screen.width,$viewport_height:E?.innerHeight,$viewport_width:E?.innerWidth,$lib:et.LIB_NAME,$lib_version:et.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:d,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime());a.$session_id=d,a.$window_id=h}this.sessionPropsManager&&ve(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&ve(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this.Hi)==null?void 0:f.length}catch(b){a.$sdk_debug_error_capturing_properties=String(b)}if(this.requestRouter.region===zl&&(a.$lib_custom_api_host=this.config.api_host),l=e!==Ir||s?e!==nu||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,i),a=ve(a,l),e===Ir&&N&&(a.title=N.title),!P(o)){var p=r.getTime()-o;a.$duration=parseFloat((p/1e3).toFixed(3))}st&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=ve({},c,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),Q(this.config.property_denylist)?de(this.config.property_denylist,function(b){delete a[b]}):I.error(vm+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var m=this.config.sanitize_properties;m&&(I.error(Ah),a=m(a,e));var g=this.nn();return a.$process_person_profile=g,g&&!s&&this.sn("_calculate_event_properties"),a}tn(e,n,r){var i;if(n===void 0&&(n=!0),r===void 0&&(r=!1),!this.persistence||!this.nn()||this.Mi&&!r)return e;var s=this.persistence.get_initial_props(),o=(i=this.sessionPropsManager)==null?void 0:i.getSetOnceProps(),a=ve({},s,o||{},e||{}),u=this.config.sanitize_properties;return u&&(I.error(Ah),a=u(a,"$set_once")),n&&(this.Mi=!0),zr(a)?void 0:a}register(e,n){var r;(r=this.persistence)==null||r.register(e,n)}register_once(e,n,r){var i;(i=this.persistence)==null||i.register_once(e,n,r)}register_for_session(e){var n;(n=this.sessionPersistence)==null||n.register(e)}unregister(e){var n;(n=this.persistence)==null||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)==null||n.unregister(e)}an(e,n){this.register({[e]:n})}getFeatureFlag(e,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(e)}getFeatureFlagResult(e,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(e,n)}isFeatureEnabled(e,n){var r;return(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(e,n)}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,n,r){var i;(i=this.featureFlags)==null||i.updateFlags(e,n,r)}updateEarlyAccessFeatureEnrollment(e,n,r){var i;(i=this.featureFlags)==null||i.updateEarlyAccessFeatureEnrollment(e,n,r)}getEarlyAccessFeatures(e,n,r){var i;return n===void 0&&(n=!1),(i=this.featureFlags)==null?void 0:i.getEarlyAccessFeatures(e,n,r)}on(e,n){return this.Fi.on(e,n)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:mi}),()=>{})}onSessionId(e){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(e,n):e([],{isLoaded:!1,error:mi})}getActiveMatchingSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:mi})}renderSurvey(e,n){var r;(r=this.surveys)==null||r.renderSurvey(e,n)}displaySurvey(e,n){var r;n===void 0&&(n=_2),(r=this.surveys)==null||r.displaySurvey(e,n)}cancelPendingSurvey(e){var n;(n=this.surveys)==null||n.cancelPendingSurvey(e)}canRenderSurvey(e){var n,r;return(n=(r=this.surveys)==null?void 0:r.canRenderSurvey(e))!==null&&n!==void 0?n:{visible:!1,disabledReason:mi}}canRenderSurveyAsync(e,n){var r,i;return n===void 0&&(n=!1),(r=(i=this.surveys)==null?void 0:i.canRenderSurveyAsync(e,n))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:mi})}ln(e){return!e||Ys(e)?(I.critical("Unique user id has not been set in posthog.identify"),!1):e===Ss?(I.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(I.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,n,r){if(!this.__loaded||!this.persistence)return I.uninitializedWarning("posthog.identify");if(Tt(e)&&(e=e.toString(),I.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.ln(e)&&this.sn("posthog.identify")){var i=this.get_distinct_id();this.register({$user_id:e}),this.get_property(mo)||this.register_once({$had_persisted_distinct_id:!0,$device_id:i},""),e!==i&&e!==this.get_property(ki)&&(this.unregister(ki),this.register({distinct_id:e}));var s,o=(this.persistence.get_property(Rt)||Er)===Er;e!==i&&o?(this.persistence.set_property(Rt,Sr),this.setPersonPropertiesForFlags({$set:n||{},$set_once:r||{}},!1),this.capture(ru,{distinct_id:e,$anon_distinct_id:i},{$set:n||{},$set_once:r||{}}),this.Di=Ch(e,n,r),(s=this.featureFlags)==null||s.setAnonymousDistinctId(i)):(n||r)&&this.setPersonProperties(n,r),e!==i&&(this.reloadFeatureFlags(),this.unregister(Ni))}}setPersonProperties(e,n){if((e||n)&&this.sn("posthog.setPersonProperties")){var r=Ch(this.get_distinct_id(),e,n);this.Di!==r?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:n||{}},!0),this.capture("$set",{$set:e||{},$set_once:n||{}}),this.Di=r):I.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,n,r){if(e&&n){var i=this.getGroups(),s=i[e]!==n;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:O({},i,{[e]:n})}),s||r){var o={$group_type:e,$group_key:n};r&&(o.$group_set=r),this.capture(uh,o)}r&&this.setGroupPropertiesForFlags({[e]:r}),s&&!r&&this.reloadFeatureFlags()}else I.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n){var r;n===void 0&&(n=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(){var e;(e=this.featureFlags)==null||e.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,n){var r;n===void 0&&(n=!0),this.sn("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(e,n))}resetGroupPropertiesForFlags(e){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(e)}reset(e){var n,r,i,s,o,a,u,l;if(I.info("reset"),!this.__loaded)return I.uninitializedWarning("posthog.reset");var c=this.get_property(mo);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),(i=this.surveys)==null||i.reset(),(s=this.Ki)==null||s.stop(),(o=this.featureFlags)==null||o.reset(),(a=this.conversations)==null||a.reset(),(u=this.persistence)==null||u.set_property(Rt,Er),(l=this.sessionManager)==null||l.resetSessionId(),this.Di=null,this.config.cookieless_mode===hn)this.register_once({distinct_id:Ss,$device_id:null},"");else{var d=this.config.get_device_id(On());this.register_once({distinct_id:d,$device_id:e?d:c},"")}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,n){var r;this.config.identity_distinct_id=e,this.config.identity_hash=n,this.alias(e),(r=this.conversations)==null||r.un()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.hn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,n;return(e=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(e!=null&&e.withTimestamp&&r){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!r)return i;i+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0)}return i}alias(e,n){return e===this.get_property(j0)?(I.critical("Attempting to create alias for existing People user - aborting."),-2):this.sn("posthog.alias")?(P(n)&&(n=this.get_distinct_id()),e!==n?(this.an(ki,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(I.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n=O({},this.config);if(ke(e)){var r,i,s,o,a,u,l,c,d,h;ve(this.config,Th(e));var f=this.qi();(r=this.persistence)==null||r.update_config(this.config,n,f),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ou(O({},this.config,{persistence:"sessionStorage"}),f);var p=this.Bi(this.config.debug);Vt(p)&&(this.config.debug=p),Vt(this.config.debug)&&(this.config.debug?(et.DEBUG=!0,pe.R()&&pe.M("ph_debug",!0),I.info("set_config",{config:e,oldConfig:n,newConfig:O({},this.config)})):(et.DEBUG=!1,pe.R()&&pe.F("ph_debug"))),(i=this.exceptionObserver)==null||i.onConfigChange(),(s=this.exceptions)==null||s.onConfigChange(),(o=this.sessionRecording)==null||o.startIfEnabledOrStop(),(a=this.autocapture)==null||a.startIfEnabled(),(u=this.heatmaps)==null||u.startIfEnabled(),(l=this.exceptionObserver)==null||l.startIfEnabledOrStop(),(c=this.deadClicksAutocapture)==null||c.startIfEnabledOrStop(),(d=this.surveys)==null||d.loadIfEnabled(),this.cn(),(h=this.externalIntegrations)==null||h.startIfEnabledOrStop()}}_overrideSDKInfo(e,n){et.LIB_NAME=e,et.LIB_VERSION=n}startSessionRecording(e){var n,r,i,s,o,a=e===!0,u={sampling:a||!(e==null||!e.sampling),linked_flag:a||!(e==null||!e.linked_flag),url_trigger:a||!(e==null||!e.url_trigger),event_trigger:a||!(e==null||!e.event_trigger)};Object.values(u).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),u.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),u.linked_flag&&((i=this.sessionRecording)==null||i.overrideLinkedFlag()),u.url_trigger&&((s=this.sessionRecording)==null||s.overrideTrigger("url")),u.event_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,n){if(this.exceptions){var r=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(O({},i,n))}}addExceptionStep(e,n){var r;(r=this.exceptions)==null||r.addExceptionStep(e,n)}captureLog(e){var n;(n=this.logs)==null||n.captureLog(e)}get logger(){var e,n;return(e=(n=this.logs)==null?void 0:n.logger)!==null&&e!==void 0?e:Ct.dn}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var n,r;return(n=(r=this.toolbar)==null?void 0:r.loadToolbar(e))!==null&&n!==void 0&&n}get_property(e){var n;return(n=this.persistence)==null?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)==null?void 0:n.props[e]}toString(){var e,n=(e=this.config.name)!==null&&e!==void 0?e:Pr;return n!==Pr&&(n=Pr+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)==null?void 0:e.get_property(Rt))===Sr||((n=this.sessionPersistence)==null?void 0:n.get_property(Rt))===Sr}nn(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===Fl&&!this._isIdentified()&&zr(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[ki])&&((n=this.persistence)==null||(n=n.props)==null||!n[yo]))}Qi(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.nn()||this.sn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.sn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}sn(e){return this.config.person_profiles==="never"?(I.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.an(yo,!0),!0)}qi(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==tr)}cn(){var e,n,r,i,s=this.qi();return((e=this.persistence)==null?void 0:e._r)!==s&&((r=this.persistence)==null||r.set_disabled(s)),((n=this.sessionPersistence)==null?void 0:n._r)!==s&&((i=this.sessionPersistence)==null||i.set_disabled(s)),s}opt_in_capturing(e){var n;if(this.config.cookieless_mode!==hn){if(this.Ni()){var r,i,s,o,a;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=new wh(this),this.pageViewManager=new hh(this),this.persistence&&(this.sessionPropsManager=new kh(this,this.sessionManager,this.persistence));var u,l=(s=(o=this.config.__extensionClasses)==null?void 0:o.sessionRecording)!==null&&s!==void 0?s:(a=Ct.__defaultExtensionClasses)==null?void 0:a.sessionRecording;l&&(this.sessionRecording=this.Ei(this.sessionRecording,new l(this)),this.Wi&&((u=this.sessionRecording)==null||u.onRemoteConfig==null||u.onRemoteConfig(this.Wi)))}var c,d;this.consent.optInOut(!0),this.cn(),this.Xi(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==tr&&((c=this.surveys)==null||c.loadIfEnabled()),(P(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((d=e?.captureEventName)!==null&&d!==void 0?d:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Ji()}else I.warn(Sh)}opt_out_capturing(){var e,n,r;this.config.cookieless_mode!==hn?(this.config.cookieless_mode===tr&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.cn(),this.config.cookieless_mode===tr&&(this.register({distinct_id:Ss,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(r=this.sessionRecording)==null||r.stopRecording(),this.sessionRecording=void 0,this.Ji())):I.warn(Sh)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===hn||(this.config.cookieless_mode===tr?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.cn()}_is_bot(){return ft?mm(ft,this.config.custom_blocked_useragents):void 0}Ji(){N&&(N.visibilityState==="visible"?this.Oi||(this.Oi=!0,this.capture(Ir,{title:N.title},{send_instantly:!0}),this.Pi&&(N.removeEventListener(_o,this.Pi),this.Pi=null)):this.Pi||(this.Pi=this.Ji.bind(this),Ee(N,_o,this.Pi)))}debug(e){e===!1?(E?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(E?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Fr(){var e,n,r,i,s,o,a=this.ji||{};return"advanced_disable_flags"in a?!!a.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(I.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(r="advanced_disable_decide",i=I,s=(n="advanced_disable_flags")in(e=a)&&!Y(e[n]),o=r in e&&!Y(e[r]),s?e[n]:!!o&&(i&&i.warn("Config field '"+r+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),e[r]))}rn(e){if(Y(this.config.before_send))return e;var n=Q(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var i of n){if(r=i(r),Y(r)){var s="Event '"+e.event+"' was rejected in beforeSend function";return ev(e.event)?I.warn(s+". This can cause unexpected behavior."):I.info(s),null}r.properties&&!zr(r.properties)||I.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var e;return(e=this.pageViewManager.dr)==null?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(r)})}Bi(e){var n=Vt(e)&&!e,r=pe.R()&&pe.O("ph_debug")==="true";return!n&&(!!r||e)}}Ct.__defaultExtensionClasses={},Ct.dn={trace:Mr=()=>{},debug:Mr,info:Mr,warn:Mr,error:Mr,fatal:Mr},function(t,e){for(var n=0;e.length>n;n++)t.prototype[e[n]]=Bv(t.prototype[e[n]])}(Ct,["identify"]);var S2=1,A2=3,M2=11;function Dh(t){return t instanceof Element&&(t.id===K0||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function mr(t){return!!t&&t.nodeType===S2}function Ft(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function _m(t){return!!t&&t.nodeType===A2}function xm(t){return!!t&&t.nodeType===M2&&mr(t.host)}function Jc(t){return t?Ca(t).split(/\s+/):[]}function Oh(t){var e=E?.location.href;return!!(e&&t&&t.some(n=>e.match(n)))}function To(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return Jc(e)}function km(t){return Y(t)?null:Ca(t).split(/(\s+)/).filter(e=>Pi(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Zi(t){var e="";return ql(t)&&!Cm(t)&&t.childNodes&&t.childNodes.length&&de(t.childNodes,function(n){var r;_m(n)&&n.textContent&&(e+=(r=km(n.textContent))!==null&&r!==void 0?r:"")}),Ca(e)}function Rh(t){return P(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var Gc=["a","button","form","input","select","textarea","label"];function Nh(t,e){if(P(e))return!0;var n,r=function(s){if(e.some(o=>s.matches(o)))return{v:!0}};for(var i of t)if(n=r(i))return n.v;return!1}function wm(t){var e=t.parentNode;return!(!e||!mr(e))&&e}var T2=["next","previous","prev",">","<"],Fh=[".ph-no-rageclick",".ph-no-capture"],Vl=t=>!t||Ft(t,"html")||!mr(t),Ih=(t,e)=>{if(!E||Vl(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[t],i=t;i.parentNode&&!Ft(i,"body");)if(xm(i.parentNode))r.push(i.parentNode.host),i=i.parentNode.host;else{var s=wm(i);if(!s)break;if(e||Gc.indexOf(s.tagName.toLowerCase())>-1)n=!0;else{var o=E.getComputedStyle(s);o&&o.getPropertyValue("cursor")==="pointer"&&(n=!0)}r.push(s),i=s}return{parentIsUsefulElement:n,targetElementList:r}};function ql(t){for(var e=t;e.parentNode&&!Ft(e,"body");e=e.parentNode){var n=To(e);if(G(n,"ph-sensitive")||G(n,"ph-no-capture"))return!1}if(G(To(t),"ph-include"))return!0;var r=t.type||"";if(me(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=t.name||t.id||"";return!me(i)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,""))}function Cm(t){return!!(Ft(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Ft(t,"select")||Ft(t,"textarea")||t.getAttribute("contenteditable")==="true")}var Em="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",D2=new RegExp("^(?:"+Em+")$"),O2=new RegExp(Em),Sm="\\d{3}-?\\d{2}-?\\d{4}",R2=new RegExp("^("+Sm+")$"),N2=new RegExp("("+Sm+")");function Pi(t,e){return e===void 0&&(e=!0),!(Y(t)||me(t)&&(t=Ca(t),(e?D2:O2).test((t||"").replace(/[- ]/g,""))||(e?R2:N2).test(t)))}function Ph(t){var e=Zi(t);return Pi(e=(e+" "+Am(t)).trim())?e:""}function Am(t){var e="";return t&&t.childNodes&&t.childNodes.length&&de(t.childNodes,function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var i=Zi(n);e=(e+" "+i).trim(),n.childNodes&&n.childNodes.length&&(e=(e+" "+Am(n)).trim())}catch(s){I.error("[AutoCapture]",s)}}),e}function Lh(t){return t.replace(/"|\\"/g,'\\"')}function F2(t){var e=t.attr__class;return e?Q(e)?e:Jc(e):void 0}class Bh{constructor(e){this.disabled=e===!1;var n=ke(e)?e:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(e,n,r){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(n-i.y)<this.thresholdPx&&this.timeoutMs>r-i.timestamp){if(this.clicks.push({x:e,y:n,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:n,timestamp:r}];return!1}}var pu="$copy_autocapture",mu=fe("[AutoCapture]");function gu(t,e){return e.length>t?e.slice(0,t)+"...":e}function I2(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!mr(e));return e}function P2(t,e){var n,r,{e:i,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:u}=e;if(!mr(t))return{props:{}};for(var l=[t],c=t;c.parentNode&&!Ft(c,"body");)if(xm(c.parentNode))l.push(c.parentNode.host),c=c.parentNode.host;else{if(!mr(c.parentNode))break;l.push(c.parentNode),c=c.parentNode}var d,h,f=[],p={},m=!1,g=!1;if(de(l,y=>{var k=ql(y);if(Ft(y,"a")){var w=y.getAttribute("href");m=k&&!!w&&Pi(w)&&w}G(To(y),"ph-no-capture")&&(g=!0),f.push(function(S,D,F,L){var j=S.tagName.toLowerCase(),V={tag_name:j};Gc.indexOf(j)>-1&&!F&&(V.$el_text=j.toLowerCase()==="a"||j.toLowerCase()==="button"?gu(1024,Ph(S)):gu(1024,Zi(S)));var X=To(S);X.length>0&&(V.classes=X.filter(function(re){return re!==""})),de(S.attributes,function(re){var Ce;if((!Cm(S)||["name","id","class","aria-label"].indexOf(re.name)!==-1)&&(L==null||!L.includes(re.name))&&!D&&Pi(re.value)&&(!me(Ce=re.name)||Ce.substring(0,10)!=="_ngcontent"&&Ce.substring(0,7)!=="_nghost")){var Te=re.value;re.name==="class"&&(Te=Jc(Te).join(" ")),V["attr__"+re.name]=gu(1024,Te)}});for(var ne=1,oe=1,W=S;W=I2(W);)ne++,W.tagName===S.tagName&&oe++;return V.nth_child=ne,V.nth_of_type=oe,V}(y,s,o,a));var C=function(S){if(!ql(S))return{};var D={};return de(S.attributes,function(F){if(F.name&&F.name.indexOf("data-ph-capture-attribute")===0){var L=F.name.replace("data-ph-capture-attribute-",""),j=F.value;L&&j&&Pi(j)&&(D[L]=j)}}),D}(y);ve(p,C)}),g)return{props:{},explicitNoCapture:g};if(o||(f[0].$el_text=Ft(t,"a")||Ft(t,"button")?Ph(t):Zi(t)),m){var b,v;f[0].attr__href=m;var _=(b=wo(m))==null?void 0:b.host,x=E==null||(v=E.location)==null?void 0:v.host;_&&x&&_!==x&&(d=m)}return{props:ve({$event_type:i.type,$ce_version:1},u?{}:{$elements:f},{$elements_chain:(h=f,function(y){return y.map(k=>{var w,C,S="";if(k.tag_name&&(S+=k.tag_name),k.attr_class)for(var D of(k.attr_class.sort(),k.attr_class))S+="."+D.replace(/"/g,"");var F=O({},k.text?{text:k.text}:{},{"nth-child":(w=k.nth_child)!==null&&w!==void 0?w:0,"nth-of-type":(C=k.nth_of_type)!==null&&C!==void 0?C:0},k.href?{href:k.href}:{},k.attr_id?{attr_id:k.attr_id}:{},k.attributes),L={};return Qs(F).sort((j,V)=>{var[X]=j,[ne]=V;return X.localeCompare(ne)}).forEach(j=>{var[V,X]=j;return L[Lh(V.toString())]=Lh(X.toString())}),(S+=":")+Qs(L).map(j=>{var[V,X]=j;return V+'="'+X+'"'}).join("")}).join(";")}(function(y){return y.map(k=>{var w,C,S={text:(w=k.$el_text)==null?void 0:w.slice(0,400),tag_name:k.tag_name,href:(C=k.attr__href)==null?void 0:C.slice(0,2048),attr_class:F2(k),attr_id:k.attr__id,nth_child:k.nth_child,nth_of_type:k.nth_of_type,attributes:{}};return Qs(k).filter(D=>{var[F]=D;return F.indexOf("attr__")===0}).forEach(D=>{var[F,L]=D;return S.attributes[F]=L}),S})}(h)))},(n=f[0])!=null&&n.$el_text?{$el_text:(r=f[0])==null?void 0:r.$el_text}:{},d&&i.type==="click"?{$external_click_url:d}:{},p)}}var gi=fe("[ExceptionAutocapture]");function $h(t,e,n){try{if(!(e in t))return()=>{};var r=t[e],i=n(r);return dn(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=i,()=>{t[e]=r}}catch{return()=>{}}}var L2=fe("[TracingHeaders]"),kn=fe("[Web Vitals]"),zh=9e5,Hh="disabled",jh="lazy_loading",bi="awaiting_config",Rs="missing_config";fe("[SessionRecording]"),fe("[SessionRecording]");var Wl="[SessionRecording]",wn=fe(Wl),B2=fe("[Heatmaps]");function Vh(t){return ke(t)&&"clientX"in t&&"clientY"in t&&Tt(t.clientX)&&Tt(t.clientY)}var qh=fe("[Product Tours]"),$2=["$set_once","$set"],Cn=fe("[SiteApps]"),Wh="Error while initializing PostHog app with config id ";function Tr(t,e,n){if(Y(t))return!1;switch(n){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}class z2{constructor(e){this.vn=new Kc,this.fn=(n,r)=>this.pn(n,r)&&this.gn(n,r)&&this.mn(n,r)&&this.yn(n,r),this.pn=(n,r)=>r==null||!r.event||n?.event===r?.event,this._instance=e,this.bn=new Set,this._n=new Set}init(){var e,n;P((e=this._instance)==null?void 0:e._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook((r,i)=>{this.on(r,i)})}register(e){var n,r;if(!P((n=this._instance)==null?void 0:n._addCaptureHook)&&(e.forEach(o=>{var a,u;(a=this._n)==null||a.add(o),(u=o.steps)==null||u.forEach(l=>{var c;(c=this.bn)==null||c.add(l?.event||"")})}),(r=this._instance)!=null&&r.autocapture)){var i,s=new Set;e.forEach(o=>{var a;(a=o.steps)==null||a.forEach(u=>{u!=null&&u.selector&&s.add(u?.selector)})}),(i=this._instance)==null||i.autocapture.setElementSelectors(s)}}on(e,n){var r;n!=null&&e.length!=0&&(this.bn.has(e)||this.bn.has(n?.event))&&this._n&&((r=this._n)==null?void 0:r.size)>0&&this._n.forEach(i=>{this.wn(n,i)&&this.vn.emit("actionCaptured",i.name)})}In(e){this.onAction("actionCaptured",n=>e(n))}wn(e,n){if(n?.steps==null)return!1;for(var r of n.steps)if(this.fn(e,r))return!0;return!1}onAction(e,n){return this.vn.on(e,n)}gn(e,n){if(n!=null&&n.url){var r,i=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!i||typeof i!="string"||!Tr(i,n.url,n.url_matching||"contains"))return!1}return!0}mn(e,n){return!!this.Cn(e,n)&&!!this.Sn(e,n)&&!!this.xn(e,n)}Cn(e,n){var r;if(n==null||!n.href)return!0;var i=this.kn(e);if(i.length>0)return i.some(a=>Tr(a.href,n.href,n.href_matching||"exact"));var s,o=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!o&&Tr((s=o.match(/(?::|")href="(.*?)"/))?s[1]:"",n.href,n.href_matching||"exact")}Sn(e,n){var r;if(n==null||!n.text)return!0;var i=this.kn(e);if(i.length>0)return i.some(l=>Tr(l.text,n.text,n.text_matching||"exact")||Tr(l.$el_text,n.text,n.text_matching||"exact"));var s,o,a,u=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!u&&(s=function(l){for(var c,d=[],h=/(?::|")text="(.*?)"/g;!Y(c=h.exec(l));)d.includes(c[1])||d.push(c[1]);return d}(u),o=n.text,a=n.text_matching||"exact",s.some(l=>Tr(l,o,a)))}xn(e,n){var r,i;if(n==null||!n.selector)return!0;var s=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(s!=null&&s.includes(n.selector))return!0;var o=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";if(n.selector_regex&&o)try{return new RegExp(n.selector_regex).test(o)}catch{return!1}return!1}kn(e){var n;return(e==null||(n=e.properties)==null?void 0:n.$elements)==null?[]:e?.properties.$elements}yn(e,n){return n==null||!n.properties||n.properties.length===0||bm(n.properties.reduce((r,i)=>{var s=Q(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return r[i.key]={values:s,operator:i.operator||"exact"},r},{}),e?.properties)}}class H2{constructor(e){this._instance=e,this.Tn=new Map,this.An=new Map,this.En=new Map}Rn(e,n){return!!e&&bm(e.propertyFilters,n?.properties)}Nn(e,n){var r=new Map;return e.forEach(i=>{var s;(s=i.conditions)==null||(s=s[n])==null||(s=s.values)==null||s.forEach(o=>{if(o!=null&&o.name){var a=r.get(o.name)||[];a.push(i.id),r.set(o.name,a)}})}),r}Mn(e,n,r){var i=(r===di.Activation?this.Tn:this.An).get(e),s=[];return this.Fn(o=>{s=o.filter(a=>i?.includes(a.id))}),s.filter(o=>{var a,u=(a=o.conditions)==null||(a=a[r])==null||(a=a.values)==null?void 0:a.find(l=>l.name===e);return this.Rn(u,n)})}register(e){var n;P((n=this._instance)==null?void 0:n._addCaptureHook)||(this.On(e),this.Pn(e))}Pn(e){var n=e.filter(r=>{var i,s;return((i=r.conditions)==null?void 0:i.actions)&&((s=r.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0});n.length!==0&&(this.Ln==null&&(this.Ln=new z2(this._instance),this.Ln.init(),this.Ln.In(r=>{this.onAction(r)})),n.forEach(r=>{var i,s,o,a,u;r.conditions&&(i=r.conditions)!=null&&i.actions&&(s=r.conditions)!=null&&(s=s.actions)!=null&&s.values&&((o=r.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.Ln)==null||a.register(r.conditions.actions.values),(u=r.conditions)==null||(u=u.actions)==null||(u=u.values)==null||u.forEach(l=>{if(l&&l.name){var c=this.En.get(l.name);c&&c.push(r.id),this.En.set(l.name,c||[r.id])}}))}))}On(e){var n,r=e.filter(s=>{var o,a;return((o=s.conditions)==null?void 0:o.events)&&((a=s.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0}),i=e.filter(s=>{var o,a;return((o=s.conditions)==null?void 0:o.cancelEvents)&&((a=s.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0});r.length===0&&i.length===0||((n=this._instance)==null||n._addCaptureHook((s,o)=>{this.onEvent(s,o)}),this.Tn=this.Nn(e,di.Activation),this.An=this.Nn(e,di.Cancellation))}onEvent(e,n){var r,i=this.le(),s=this.Dn(),o=this.Bn(),a=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[s])||[];if(o===e&&n&&a.length>0){var u,l;i.info("event matched, removing item from activated items",{event:e,eventPayload:n,existingActivatedItems:a});var c=(n==null||(u=n.properties)==null?void 0:u.$survey_id)||(n==null||(l=n.properties)==null?void 0:l.$product_tour_id);if(c){var d=a.indexOf(c);0>d||(a.splice(d,1),this.jn(a))}}else{if(this.An.has(e)){var h=this.Mn(e,n,di.Cancellation);h.length>0&&(i.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map(p=>p.id)}),h.forEach(p=>{var m=a.indexOf(p.id);0>m||a.splice(m,1),this.$n(p.id)}),this.jn(a))}if(this.Tn.has(e)){i.info("event name matched",{event:e,eventPayload:n,items:this.Tn.get(e)});var f=this.Mn(e,n,di.Activation);this.jn(a.concat(f.map(p=>p.id)||[]))}}}onAction(e){var n,r=this.Dn(),i=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[r])||[];this.En.has(e)&&this.jn(i.concat(this.En.get(e)||[]))}jn(e){var n=this.le(),r=[...new Set(e)].filter(i=>!this.qn(i));n.info("updating activated items",{activatedItems:r}),this.Zn(r)}getActivatedIds(){var e,n=this.Dn();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[n])||[]}getEventToItemsMap(){return this.Tn}Vn(){return this.Ln}}class j2 extends H2{constructor(e){super(e)}Dn(){return Al}Bn(){return Ai.SHOWN}Fn(e){var n;(n=this._instance)==null||n.getSurveys(e)}$n(e){var n;(n=this._instance)==null||n.cancelPendingSurvey(e)}le(){return se}Zn(e){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Al]:e})}qn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var bu="SDK is not enabled or survey functionality is not yet loaded",Uh="Disabled. Not loading surveys.",V2=E!=null&&E.location?Eo(E.location.hash,"__posthog")||Eo(location.hash,"state"):null,Kh="_postHogToolbarParams",Jh=fe("[Toolbar]"),Xe=fe("[FeatureFlags]"),Zn=fe("[FeatureFlags]",{debugEnabled:!0}),vu=`" failed. Feature flags didn't load in time.`,Gh=t=>{for(var e={},n=0;t.length>n;n++)e[t[n]]=!0;return e},Yh=t=>{var e={};for(var[n,r]of Qs(t||{}))r&&(e[n]=r);return e},nn=fe("[Error tracking]"),Zh="Refusing to render web experiment since the viewer is a likely bot",q2={icontains:(t,e)=>!!E&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!E&&e.href.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>!!E&&Mo(e.href,t),not_regex:(t,e)=>!!E&&!Mo(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class Ke{get Bt(){return this._instance.config}constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments(i=>{Ke.Hn("retrieved web experiments from the server"),n.zn=new Map,i.forEach(s=>{if(s.feature_flag_key){var o;n.zn&&(Ke.Hn("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=n.zn)==null||o.set(s.feature_flag_key,s));var a=n._instance.getFeatureFlag(s.feature_flag_key);me(a)&&s.variants[a]&&n.Un(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var u in s.variants){var l=s.variants[u];Ke.Yn(l)&&n.Un(s.name,u,l.transforms)}})},r)},this._instance=e,this._instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}initialize(){}onFeatureFlags(e){if(this._is_bot())Ke.Hn(Zh);else if(!this.Bt.disable_web_experiments){if(Y(this.zn))return this.zn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Ke.Hn("applying feature flags",e),e.forEach(n=>{var r;if(this.zn&&(r=this.zn)!=null&&r.has(n)){var i,s=this._instance.getFeatureFlag(n),o=(i=this.zn)==null?void 0:i.get(n);s&&o!=null&&o.variants[s]&&this.Un(o.name,s,o.variants[s].transforms)}})}}previewWebExperiment(){var e=Ke.getWindowLocation();if(e!=null&&e.search){var n=Co(e?.search,"__experiment_id"),r=Co(e?.search,"__experiment_variant");n&&r&&(Ke.Hn("previewing web experiments "+n+" && "+r),this.getWebExperiments(i=>{this.Gn(parseInt(n),r,i)},!1,!0))}}loadIfEnabled(){this.Bt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,r){if(this.Bt.disable_web_experiments&&!r)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!n)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Bt.token),method:"GET",callback:s=>e(s.statusCode===200&&s.json&&s.json.experiments||[])})}Gn(e,n,r){var i=r.filter(s=>s.id===e);i&&i.length>0&&(Ke.Hn("Previewing web experiment ["+i[0].name+"] with variant ["+n+"]"),this.Un(i[0].name,n,i[0].variants[n].transforms))}static Yn(e){return!Y(e.conditions)&&Ke.Wn(e)&&Ke.Xn(e)}static Wn(e){var n;if(Y(e.conditions)||Y((n=e.conditions)==null?void 0:n.url))return!0;var r,i,s,o=Ke.getWindowLocation();return!!o&&((r=e.conditions)==null||!r.url||q2[(i=(s=e.conditions)==null?void 0:s.urlMatchType)!==null&&i!==void 0?i:"icontains"](e.conditions.url,o))}static getWindowLocation(){return E?.location}static Xn(e){var n;if(Y(e.conditions)||Y((n=e.conditions)==null?void 0:n.utm))return!0;var r=tm();if(r.utm_source){var i,s,o,a,u,l,c,d,h=(i=e.conditions)==null||(i=i.utm)==null||!i.utm_campaign||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==r.utm_campaign,f=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==r.utm_source,p=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_medium||((l=e.conditions)==null||(l=l.utm)==null?void 0:l.utm_medium)==r.utm_medium,m=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((d=e.conditions)==null||(d=d.utm)==null?void 0:d.utm_term)==r.utm_term;return h&&p&&m&&f}return!1}static Hn(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;n>i;i++)r[i-1]=arguments[i];I.info("[WebExperiments] "+e,r)}Un(e,n,r){this._is_bot()?Ke.Hn(Zh):n!=="control"?r.forEach(i=>{if(i.selector){var s;Ke.Hn("applying transform of variant "+n+" for experiment "+e+" ",i);var o=(s=document)==null?void 0:s.querySelectorAll(i.selector);o?.forEach(a=>{var u=a;i.html&&(u.innerHTML=i.html),i.css&&u.setAttribute("style",i.css)})}}):Ke.Hn("Control variants leave the page unmodified.")}_is_bot(){return ft&&this._instance?mm(ft,this.Bt.custom_blocked_useragents):void 0}}var vt=fe("[Conversations]"),Xn="Conversations not available yet.",Aa={featureFlags:class{constructor(t){this.Jn=!1,this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this.ss=!1,this._instance=t,this.featureFlagEventHandlers=[]}get Bt(){return this._instance.config}get ni(){return this._instance.persistence}os(t){return this._instance.get_property(t)}ls(){var t,e;return(t=(e=this.ni)==null?void 0:e.wr(this.Bt.feature_flag_cache_ttl_ms))!==null&&t!==void 0&&t}us(){return!!this.ls()&&(this.ss||this.Qn||(this.ss=!0,Xe.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}hs(){var t,e=(t=this.Bt.evaluation_contexts)!==null&&t!==void 0?t:this.Bt.evaluation_environments;return!this.Bt.evaluation_environments||this.Bt.evaluation_contexts||this.ns||(Xe.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ns=!0),e!=null&&e.length?e.filter(n=>{var r=n&&typeof n=="string"&&n.trim().length>0;return r||Xe.error("Invalid evaluation context found:",n,"Expected non-empty string"),r}):[]}cs(){return this.hs().length>0}initialize(){var t,e,{config:n}=this._instance,r=(t=(e=n.bootstrap)==null?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(r).length){var i,s,o=(i=(s=n.bootstrap)==null?void 0:s.featureFlagPayloads)!==null&&i!==void 0?i:{},a=Object.keys(r).filter(l=>!!r[l]).reduce((l,c)=>(l[c]=r[c]||!1,l),{}),u=Object.keys(o).filter(l=>a[l]).reduce((l,c)=>(o[c]&&(l[c]=o[c]),l),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:u})}}updateFlags(t,e,n){var r=n!=null&&n.merge?this.getFlagVariants():{},i=n!=null&&n.merge?this.getFlagPayloads():{},s=O({},r,t),o=O({},i,e),a={};for(var[u,l]of Object.entries(s)){var c=typeof l=="string";a[u]={key:u,enabled:!!c||!!l,variant:c?l:void 0,reason:void 0,metadata:P(o?.[u])?void 0:{id:0,version:void 0,description:void 0,payload:o[u]}}}this.receivedFeatureFlags({flags:a})}get hasLoadedFlags(){return this.Kn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.os(wl),e=this.os(an),n=this.os(Fr);if(!n&&!e)return t||{};var r=ve({},t||{}),i=[...new Set([...Object.keys(n||{}),...Object.keys(e||{})])];for(var s of i){var o,a,u=r[s],l=e?.[s],c=P(l)?(o=u?.enabled)!==null&&o!==void 0&&o:!!l,d=P(l)?u.variant:typeof l=="string"?l:void 0,h=n?.[s],f=O({},u,{enabled:c,variant:c?d??u?.variant:void 0});c!==u?.enabled&&(f.original_enabled=u?.enabled),d!==u?.variant&&(f.original_variant=u?.variant),h&&(f.metadata=O({},u?.metadata,{payload:h,original_payload:u==null||(a=u.metadata)==null?void 0:a.payload})),r[s]=f}return this.Jn||(Xe.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:n,finalDetails:r}),this.Jn=!0),r}getFlagVariants(){var t=this.os(Hr),e=this.os(an);if(!e)return t||{};for(var n=ve({},t),r=Object.keys(e),i=0;r.length>i;i++)n[r[i]]=e[r[i]];return this.Jn||(Xe.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:n}),this.Jn=!0),n}getFlagPayloads(){var t=this.os(Cl),e=this.os(Fr);if(!e)return t||{};for(var n=ve({},t||{}),r=Object.keys(e),i=0;r.length>i;i++)n[r[i]]=e[r[i]];return this.Jn||(Xe.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:n}),this.Jn=!0),n}reloadFeatureFlags(){this.es||this.Bt.advanced_disable_feature_flags||this.ds||(this._instance.Fi.emit("featureFlagsReloading",!0),this.ds=setTimeout(()=>{this.vs()},5))}fs(){clearTimeout(this.ds),this.ds=void 0}ensureFlagsLoaded(){this.Kn||this.Qn||this.ds||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.es=t}vs(t){var e;if(this.fs(),!this._instance.Fr())if(this.Qn)this.ts=!0;else{var n=this.Bt.token,r=this.os(mo),i={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:O({},((e=this.ni)==null?void 0:e.get_initial_props())||{},this.os(Si)||{}),group_properties:this.os(er),timezone:am()};yn(r)||P(r)||(i.$device_id=r),(t!=null&&t.disableFlags||this.Bt.advanced_disable_feature_flags)&&(i.disable_flags=!0),this.cs()&&(i.evaluation_contexts=this.hs());var s=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Bt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Qn=!0,this._instance._send_request({method:"POST",url:s,data:i,compression:this.Bt.disable_compression?void 0:zt.Base64,timeout:this.Bt.feature_flag_request_timeout_ms,callback:o=>{var a,u,l,c=!0;if(o.statusCode===200&&(this.ts||(this.$anon_distinct_id=void 0),c=!1),this.Qn=!1,!i.disable_flags||this.ts){this.rs=!c;var d=[];o.error?o.error instanceof Error?d.push(o.error.name==="AbortError"?"timeout":"connection_error"):d.push("unknown_error"):o.statusCode!==200&&d.push("api_error_"+o.statusCode),(a=o.json)!=null&&a.errorsWhileComputingFlags&&d.push("errors_while_computing_flags");var h,f=!((u=o.json)==null||(u=u.quotaLimited)==null||!u.includes("feature_flags"));f&&d.push("quota_limited"),(l=this.ni)==null||l.register({[Tl]:d}),f?Xe.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(i.disable_flags||this.receivedFeatureFlags((h=o.json)!==null&&h!==void 0?h:{},c,{partialResponse:!!this.Bt.advanced_only_evaluate_survey_feature_flags}),this.ts&&(this.ts=!1,this.vs()))}}})}}getFeatureFlag(t,e){var n;if(e===void 0&&(e={}),!e.fresh||this.rs)if(this.Kn||this.getFlags()&&this.getFlags().length>0){if(!this.us()){var r=this.getFeatureFlagResult(t,e);return(n=r?.variant)!==null&&n!==void 0?n:r?.enabled}}else Xe.warn('getFeatureFlag for key "'+t+vu)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return e?.payload}getFeatureFlagResult(t,e){if(e===void 0&&(e={}),!e.fresh||this.rs)if(this.Kn||this.getFlags()&&this.getFlags().length>0){if(!this.us()){var n=this.getFlagVariants(),r=t in n,i=n[t],s=this.getFlagPayloads()[t],o=String(i),a=this.os(El)||void 0,u=this.os(bo)||void 0,l=this.os(Ni)||{};if(this.Bt.advanced_feature_flags_dedup_per_session){var c,d=this._instance.get_session_id(),h=this.os(Ml);d&&d!==h&&(l={},(c=this.ni)==null||c.register({[Ni]:l,[Ml]:d}))}if((e.send_event||!("send_event"in e))&&(!(t in l)||!l[t].includes(o))){var f,p,m,g,b,v,_,x,y,k;Q(l[t])?l[t].push(o):l[t]=[o],(f=this.ni)==null||f.register({[Ni]:l});var w=this.getFeatureFlagDetails(t),C=[...(p=this.os(Tl))!==null&&p!==void 0?p:[]];P(i)&&C.push("flag_missing");var S={$feature_flag:t,$feature_flag_response:i,$feature_flag_payload:s||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:((m=this.Bt.bootstrap)==null||(m=m.featureFlags)==null?void 0:m[t])||null,$feature_flag_bootstrapped_payload:((g=this.Bt.bootstrap)==null||(g=g.featureFlagPayloads)==null?void 0:g[t])||null,$used_bootstrap_value:!this.rs};P(w==null||(b=w.metadata)==null?void 0:b.version)||(S.$feature_flag_version=w.metadata.version);var D,F=(v=w==null||(_=w.reason)==null?void 0:_.description)!==null&&v!==void 0?v:w==null||(x=w.reason)==null?void 0:x.code;F&&(S.$feature_flag_reason=F),w!=null&&(y=w.metadata)!=null&&y.id&&(S.$feature_flag_id=w.metadata.id),P(w?.original_variant)&&P(w?.original_enabled)||(S.$feature_flag_original_response=P(w.original_variant)?w.original_enabled:w.original_variant),w!=null&&(k=w.metadata)!=null&&k.original_payload&&(S.$feature_flag_original_payload=w==null||(D=w.metadata)==null?void 0:D.original_payload),C.length&&(S.$feature_flag_error=C.join(",")),this._instance.capture("$feature_flag_called",S)}if(r){var L=s;if(!P(s))try{L=JSON.parse(s)}catch{}return{key:t,enabled:!!i,variant:typeof i=="string"?i:void 0,payload:L}}}}else Xe.warn('getFeatureFlagResult for key "'+t+vu)}getRemoteConfigPayload(t,e){var n=this.Bt.token,r={distinct_id:this._instance.get_distinct_id(),token:n};this.cs()&&(r.evaluation_contexts=this.hs()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Bt.disable_compression?void 0:zt.Base64,timeout:this.Bt.feature_flag_request_timeout_ms,callback(i){var s,o=(s=i.json)==null?void 0:s.featureFlagPayloads;e(o?.[t]||void 0)}})}isFeatureEnabled(t,e){if(e===void 0&&(e={}),!e.fresh||this.rs){if(this.Kn||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(t,e);return P(n)?void 0:!!n}Xe.warn('isFeatureEnabled for key "'+t+vu)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(e=>e!==t)}receivedFeatureFlags(t,e,n){if(this.ni){this.Kn=!0;var r=this.getFlagVariants(),i=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(o,a,u,l,c,d){u===void 0&&(u={}),l===void 0&&(l={}),c===void 0&&(c={});var h=(C=>{var S=C.flags;return S?(C.featureFlags=Object.fromEntries(Object.keys(S).map(D=>{var F;return[D,(F=S[D].variant)!==null&&F!==void 0?F:S[D].enabled]})),C.featureFlagPayloads=Object.fromEntries(Object.keys(S).filter(D=>S[D].enabled).filter(D=>{var F;return(F=S[D].metadata)==null?void 0:F.payload}).map(D=>{var F;return[D,(F=S[D].metadata)==null?void 0:F.payload]}))):Xe.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),C})(o),f=h.flags,p=h.featureFlags,m=h.featureFlagPayloads;if(p){var g=o.requestId,b=o.evaluatedAt;if(Q(p)){Xe.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(p)for(var _=0;p.length>_;_++)v[p[_]]=!0;a&&a.register({[Zs]:p,[Hr]:v})}else{var x=p,y=m,k=f;if(d!=null&&d.partialResponse)x=O({},u,x),y=O({},l,y),k=O({},c,k);else if(o.errorsWhileComputingFlags)if(f){var w=new Set(Object.keys(f).filter(C=>{var S;return!((S=f[C])!=null&&S.failed)}));x=O({},u,Object.fromEntries(Object.entries(x).filter(C=>{var[S]=C;return w.has(S)}))),y=O({},l,Object.fromEntries(Object.entries(y||{}).filter(C=>{var[S]=C;return w.has(S)}))),k=O({},c,Object.fromEntries(Object.entries(k||{}).filter(C=>{var[S]=C;return w.has(S)})))}else x=O({},u,x),y=O({},l,y),k=O({},c,k);a&&a.register(O({[Zs]:Object.keys(Yh(x)),[Hr]:x||{},[Cl]:y||{},[wl]:k||{}},g?{[El]:g}:{},b?{[bo]:b}:{}))}}})(t,this.ni,r,i,s,n),e||(this.ss=!1),this.ps(e)}}override(t,e){e===void 0&&(e=!1),Xe.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.ni)return Xe.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.ni.unregister(an),this.ni.unregister(Fr),this.ps(),Zn.info("All overrides cleared");if(Q(t)){var e=Gh(t);return this.ni.register({[an]:e}),this.ps(),Zn.info("Flag overrides set",{flags:t})}if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var n,r=t;if(this.Jn=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this.ni.unregister(an),Zn.info("Flag overrides cleared");else if(r.flags){if(Q(r.flags)){var i=Gh(r.flags);this.ni.register({[an]:i})}else this.ni.register({[an]:r.flags});Zn.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this.ni.unregister(Fr),Zn.info("Payload overrides cleared")):r.payloads&&(this.ni.register({[Fr]:r.payloads}),Zn.info("Payload overrides set",{payloads:r.payloads}))),void this.ps()}if(t&&typeof t=="object")return this.ni.register({[an]:t}),this.ps(),Zn.info("Flag overrides set",{flags:t});Xe.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Kn){var{flags:e,flagVariants:n}=this.gs();t(e,n)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,n){var r,i=(this.os(Ei)||[]).find(u=>u.flagKey===t),s={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:s};i&&(o.$early_access_feature_name=i.name),n&&(o.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(s,!1);var a=O({},this.getFlagVariants(),{[t]:e});(r=this.ni)==null||r.register({[Zs]:Object.keys(Yh(a)),[Hr]:a}),this.ps()}getEarlyAccessFeatures(t,e,n){e===void 0&&(e=!1);var r=this.os(Ei),i=n?"&"+n.map(s=>"stage="+s).join("&"):"";if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Bt.token+i),method:"GET",callback:s=>{var o,a;if(s.json){var u=s.json.earlyAccessFeatures;return(o=this.ni)==null||o.unregister(Ei),(a=this.ni)==null||a.register({[Ei]:u}),t(u)}}})}gs(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter(n=>e[n]),flagVariants:Object.keys(e).filter(n=>e[n]).reduce((n,r)=>(n[r]=e[r],n),{})}}ps(t){var{flags:e,flagVariants:n}=this.gs();this.featureFlagEventHandlers.forEach(r=>r(e,n,{errorsLoading:t}))}setPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=this.os(Si)||{},r=t?.$set||(t!=null&&t.$set_once?{}:t),i=t?.$set_once,s={};if(i)for(var o in i)({}).hasOwnProperty.call(i,o)&&(o in n||(s[o]=i[o]));this._instance.register({[Si]:O({},n,s,r)}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Si)}setGroupPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=this.os(er)||{};Object.keys(n).length!==0&&Object.keys(n).forEach(r=>{n[r]=O({},n[r],t[r]),delete t[r]}),this._instance.register({[er]:O({},n,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.os(er)||{};this._instance.register({[er]:O({},e,{[t]:{}})})}else this._instance.unregister(er)}reset(){this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.$anon_distinct_id=void 0,this.fs(),this.Jn=!1}}},W2={sessionRecording:class{get Bt(){return this._instance.config}get ni(){return this._instance.persistence}get started(){var t;return!((t=this.ys)==null||!t.isStarted)}get status(){var t,e;return this.bs===bi||this.bs===Rs?this.bs:(t=(e=this.ys)==null?void 0:e.status)!==null&&t!==void 0?t:this.bs}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.bs=Hh,this._s=void 0,this._instance=t,!this._instance.sessionManager)throw wn.error("started without valid sessionManager"),new Error(Wl+" started without valid sessionManager. This is a bug.");if(this.Bt.cookieless_mode===hn)throw new Error(Wl+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get ws(){var t,e=!((t=this._instance.get_property(Ci))==null||!t.enabled),n=!this.Bt.disable_session_recording,r=this.Bt.disable_session_recording||this._instance.consent.isOptedOut();return E&&e&&n&&!r}startIfEnabledOrStop(t){var e;if(!this.ws||(e=this.ys)==null||!e.isStarted){var n=!P(Object.assign)&&!P(Array.from);this.ws&&n?(this.Is(t),wn.info("starting")):(this.bs=Hh,this.stopRecording())}}Is(t){var e,n,r;this.ws&&(this.bs!==bi&&this.bs!==Rs&&(this.bs=jh),$!=null&&(e=$.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(n=$.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Cs(t):(r=$.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.Ss,i=>{if(i)return wn.error("could not load recorder",i);this.Cs(t)}))}stopRecording(){var t,e;(t=this._s)==null||t.call(this),this._s=void 0,(e=this.ys)==null||e.stop()}xs(){var t,e;(t=this._s)==null||t.call(this),this._s=void 0,(e=this.ys)==null||e.discard()}ks(){var t;(t=this.ni)==null||t.unregister(jc)}Ts(t,e){if(Y(t))return null;var n,r=Tt(t)?t:parseFloat(t);return typeof(n=r)!="number"||!Number.isFinite(n)||0>n||n>1?(wn.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}As(t){if(this.ni){var e,n,r=this.ni,i=()=>{var s,o=t.sessionRecording===!1?void 0:t.sessionRecording,a=this.Ts((s=this.Bt.session_recording)==null?void 0:s.sampleRate,"session_recording.sampleRate"),u=this.Ts(o?.sampleRate,"remote config sampleRate"),l=a??u;Y(l)&&this.ks();var c=o?.minimumDurationMilliseconds;r.register({[Ci]:O({cache_timestamp:Date.now(),enabled:!!o},o,{networkPayloadCapture:O({capturePerformance:t.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:P(c)?null:c,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers,version:o?.version,triggerGroups:o?.triggerGroups})})};i(),(e=this._s)==null||e.call(this),this._s=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(i)}}onRemoteConfig(t){return"sessionRecording"in t?t.sessionRecording===!1?(this.As(t),void this.xs()):(this.As(t),void this.startIfEnabledOrStop()):(this.bs===bi&&(this.bs=Rs,wn.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var n;e===void 0&&(e="log"),(n=this.ys)!=null&&n.log?this.ys.log(t,e):wn.warn("log called before recorder was ready")}get Ss(){var t,e,n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(Ci);return(n==null||(e=n.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}Es(){var t,e=this._instance.get_property(Ci);if(!e)return!1;var n=(t=(typeof e=="object"?e:JSON.parse(e)).cache_timestamp)!==null&&t!==void 0?t:Date.now();return 36e5>=Date.now()-n}Cs(t){var e,n;if((e=$.__PosthogExtensions__)==null||!e.initSessionRecording)return wn.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Y0]:!0});if(this.ys||(this.ys=(n=$.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.ys._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Es())return this.bs===Rs||this.bs===bi?void 0:(this.bs=bi,wn.info("persisted remote config is stale, requesting fresh config before starting"),void new um(this._instance).load());this.bs=jh,this.ys.start(t)}onRRwebEmit(t){var e;(e=this.ys)==null||e.onRRwebEmit==null||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.ys||(e=this.ni)==null||e.register({[q0]:!0}),(t=this.ys)==null||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.ys||(e=this.ni)==null||e.register({[V0]:!0}),(t=this.ys)==null||t.overrideSampling()}overrideTrigger(t){var e,n;this.ys||(n=this.ni)==null||n.register({[t==="url"?W0:U0]:!0}),(e=this.ys)==null||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.ys)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var n;return!((n=this.ys)==null||!n.tryAddCustomEvent(t,e))}}},U2={autocapture:class{constructor(t){this.Rs=!1,this.Ns=null,this.Ms=!1,this.instance=t,this.rageclicks=new Bh(t.config.rageclick),this.Fs=null}initialize(){this.startIfEnabled()}get Bt(){var t,e,n=ke(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(t=n.url_allowlist)==null?void 0:t.map(r=>new RegExp(r)),n.url_ignorelist=(e=n.url_ignorelist)==null?void 0:e.map(r=>new RegExp(r)),n}Os(){if(this.isBrowserSupported()){if(E&&N){var t=n=>{n=n||E?.event;try{this.Ps(n)}catch(r){mu.error("Failed to capture event",r)}};if(Ee(N,"submit",t,{capture:!0}),Ee(N,"change",t,{capture:!0}),Ee(N,"click",t,{capture:!0}),this.Bt.capture_copied_text){var e=n=>{n=n||E?.event;try{this.Ps(n,pu)}catch(r){mu.error("Failed to capture copy/cut event",r)}};Ee(N,"copy",e,{capture:!0}),Ee(N,"cut",e,{capture:!0})}}}else mu.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Rs&&(this.Os(),this.Rs=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.Ms=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[ml]:!!t.autocapture_opt_out}),this.Ns=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Fs=t}getElementSelectors(t){var e,n=[];return(e=this.Fs)==null||e.forEach(r=>{var i=N?.querySelectorAll(r);i?.forEach(s=>{t===s&&n.push(r)})}),n}get isEnabled(){var t,e,n=(t=this.instance.persistence)==null?void 0:t.props[ml];if(yn(this.Ns)&&!Vt(n)&&!this.instance.Fr())return!1;var r=(e=this.Ns)!==null&&e!==void 0?e:!!n;return!!this.instance.config.autocapture&&!r}Ps(t,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var n,r=Rh(t);_m(r)&&(r=r.parentNode||null),e==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&function(d,h){if(!E||Vl(d))return!1;var f,p,m;if(Vt(h)?(f=!!h&&Fh,p=void 0):(f=(m=h?.css_selector_ignorelist)!==null&&m!==void 0?m:Fh,p=h?.content_ignorelist),f===!1)return!1;var{targetElementList:g}=Ih(d,!1);return!function(b,v){if(b===!1||P(b))return!1;var _;if(b===!0)_=T2;else{if(!Q(b))return!1;if(b.length>10)return I.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;_=b.map(x=>x.toLowerCase())}return v.some(x=>{var{safeText:y,ariaLabel:k}=x;return _.some(w=>y.includes(w)||k.includes(w))})}(p,g.map(b=>{var v;return{safeText:Zi(b).toLowerCase(),ariaLabel:((v=b.getAttribute("aria-label"))==null?void 0:v.toLowerCase().trim())||""}}))&&!Nh(g,f)}(r,this.instance.config.rageclick)&&this.Ps(t,"$rageclick");var i=e===pu;if(r&&function(d,h,f,p,m){var g,b,v,_;if(f===void 0&&(f=void 0),!E||Vl(d)||(g=f)!=null&&g.url_allowlist&&!Oh(f.url_allowlist)||(b=f)!=null&&b.url_ignorelist&&Oh(f.url_ignorelist))return!1;if((v=f)!=null&&v.dom_event_allowlist){var x=f.dom_event_allowlist;if(x&&!x.some(S=>h.type===S))return!1}var{parentIsUsefulElement:y,targetElementList:k}=Ih(d,p);if(!function(S,D){var F=D?.element_allowlist;if(P(F))return!0;var L,j=function(X){if(F.some(ne=>X.tagName.toLowerCase()===ne))return{v:!0}};for(var V of S)if(L=j(V))return L.v;return!1}(k,f)||!Nh(k,(_=f)==null?void 0:_.css_selector_allowlist))return!1;var w=E.getComputedStyle(d);if(w&&w.getPropertyValue("cursor")==="pointer"&&h.type==="click")return!0;var C=d.tagName.toLowerCase();switch(C){case"html":return!1;case"form":return(m||["submit"]).indexOf(h.type)>=0;case"input":case"select":case"textarea":return(m||["change","click"]).indexOf(h.type)>=0;default:return y?(m||["click"]).indexOf(h.type)>=0:(m||["click"]).indexOf(h.type)>=0&&(Gc.indexOf(C)>-1||d.getAttribute("contenteditable")==="true")}}(r,t,this.Bt,i,i?["copy","cut"]:void 0)){var{props:s,explicitNoCapture:o}=P2(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Bt.element_attribute_ignorelist,elementsChainAsString:this.Ms});if(o)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(s.$element_selectors=a),e===pu){var u,l=km(E==null||(u=E.getSelection())==null?void 0:u.toString()),c=t.type||"clipboard";if(!l)return!1;s.$selected_content=l,s.$copy_type=c}return this.instance.capture(e,s),!0}}}isBrowserSupported(){return dn(N?.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.Ls=(E==null||(e=E.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(I.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ds&&this.Ds(),this.Ds=void 0,I.info("History API monitoring stopped")}monitorHistoryChanges(){var t,e;if(E&&E.history){var n=this;(t=E.history.pushState)!=null&&t.__posthog_wrapped__||$h(E.history,"pushState",r=>function(i,s,o){r.call(this,i,s,o),n.Bs("pushState")}),(e=E.history.replaceState)!=null&&e.__posthog_wrapped__||$h(E.history,"replaceState",r=>function(i,s,o){r.call(this,i,s,o),n.Bs("replaceState")}),this.js()}}Bs(t){try{var e,n=E==null||(e=E.location)==null?void 0:e.pathname;if(!n)return;n!==this.Ls&&this.isEnabled&&this._instance.capture(Ir,{navigation_type:t}),this.Ls=n}catch(r){I.error("Error capturing "+t+" pageview",r)}}js(){if(!this.Ds){var t=()=>{this.Bs("popstate")};Ee(E,"popstate",t),this.Ds=()=>{E&&E.removeEventListener("popstate",t)}}}},heatmaps:class{get Bt(){return this.instance.config}constructor(t){var e;this.$s=!1,this.Rs=!1,this.qs=null,this.instance=t,this.$s=!((e=this.instance.persistence)==null||!e.props[gl]),this.rageclicks=new Bh(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return ke(this.Bt.capture_heatmaps)&&this.Bt.capture_heatmaps.flush_interval_milliseconds&&(t=this.Bt.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Y(this.Bt.capture_heatmaps)?Y(this.Bt.enable_heatmaps)?this.$s:this.Bt.enable_heatmaps:this.Bt.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Rs)return;B2.info("starting..."),this.Zs(),this.Ft()}else{var t;clearInterval((t=this.qs)!==null&&t!==void 0?t:void 0),this.Vs(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[gl]:e}),this.$s=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.T;return this.T=void 0,t}Hs(t){this.Tt(t.originalEvent,"deadclick")}Ft(){this.qs&&clearInterval(this.qs),this.qs=N?.visibilityState==="visible"?setInterval(this.Yr.bind(this),this.flushIntervalMilliseconds):null}Zs(){E&&N&&(this.zs=this.Yr.bind(this),Ee(E,xo,this.zs),this.Us=t=>this.Tt(t||E?.event),Ee(N,"click",this.Us,{capture:!0}),this.Ys=t=>this.Gs(t||E?.event),Ee(N,"mousemove",this.Ys,{capture:!0}),this.Ws=new dh(this.instance,Jv,this.Hs.bind(this)),this.Ws.startIfEnabledOrStop(),this.Xs=this.Ft.bind(this),Ee(N,_o,this.Xs),this.Rs=!0)}Vs(){var t;E&&N&&(this.zs&&E.removeEventListener(xo,this.zs),this.Us&&N.removeEventListener("click",this.Us,{capture:!0}),this.Ys&&N.removeEventListener("mousemove",this.Ys,{capture:!0}),this.Xs&&N.removeEventListener(_o,this.Xs),clearTimeout(this.Js),(t=this.Ws)==null||t.stop(),this.Rs=!1)}Ks(t,e){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),s=function(o,a,u){for(var l=o;l&&mr(l)&&!Ft(l,"body");){if(l===u)return!1;if(G(a,E?.getComputedStyle(l).position))return!0;l=wm(l)}return!1}(Rh(t),["fixed","sticky"],i);return{x:t.clientX+(s?0:r),y:t.clientY+(s?0:n),target_fixed:s,type:e}}Tt(t,e){var n;if(e===void 0&&(e="click"),!Dh(t.target)&&Vh(t)){var r=this.Ks(t,e);(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this.Qs(O({},r,{type:"rageclick"})),this.Qs(r)}}Gs(t){!Dh(t.target)&&Vh(t)&&(clearTimeout(this.Js),this.Js=setTimeout(()=>{this.Qs(this.Ks(t,"mousemove"))},500))}Qs(t){if(E){var e=E.location.href,n=this.Bt.custom_personal_data_properties,r=this.Bt.mask_personal_data_properties?[...Qr,...n||[]]:[],i=Gi(e,r,Yi);this.T=this.T||{},this.T[i]||(this.T[i]=[]),this.T[i].push(t)}}Yr(){this.T&&!zr(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:dh,webVitalsAutocapture:class{constructor(t){var e;this.$s=!1,this.Rs=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.eo=()=>{clearTimeout(this.ro),this.T.metrics.length!==0&&(this._instance.capture("$web_vitals",this.T.metrics.reduce((n,r)=>O({},n,{["$web_vitals_"+r.name+"_event"]:O({},r),["$web_vitals_"+r.name+"_value"]:r.value}),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ht=n=>{var r,i=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0);if(P(i))kn.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.io();P(s)||(Y(n?.name)||Y(n?.value)?kn.error("Invalid metric received",n):!this.no||this.no>n.value?(this.T.url!==s&&(this.eo(),this.ro=setTimeout(this.eo,this.flushToCaptureTimeoutMs)),P(this.T.url)&&(this.T.url=s),this.T.firstMetricTimestamp=P(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.T.metrics.push(O({},n,{$current_url:s,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.eo()):kn.error("Ignoring metric with value >= "+this.no,n))}},this.so=()=>{if(!this.Rs){var n,r,i,s,o=$.__PosthogExtensions__;P(o)||P(o.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:r,onFCP:i,onINP:s}=o.postHogWebVitalsCallbacks),n&&r&&i&&s?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.ht.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.ht.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.ht.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this.ht.bind(this)),this.Rs=!0):kn.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.$s=!((e=this._instance.persistence)==null||!e.props[_l]),this.startIfEnabled()}get oo(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,n=ke(this.oo)?(t=this.oo)==null?void 0:t.web_vitals_allowed_metrics:void 0;return Y(n)?((e=this._instance.persistence)==null?void 0:e.props[kl])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(ke(this.oo)?this.oo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=ke(this.oo)?this.oo.web_vitals_attribution:void 0;return t!=null&&t}get no(){var t=ke(this.oo)&&Tt(this.oo.__web_vitals_max_value)?this.oo.__web_vitals_max_value:zh;return t>0&&6e4>=t?zh:t}get isEnabled(){var t=He?.protocol;if(t!=="http:"&&t!=="https:")return kn.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=ke(this.oo)?this.oo.web_vitals:Vt(this.oo)?this.oo:void 0;return Vt(e)?e:this.$s}startIfEnabled(){this.isEnabled&&!this.Rs&&(kn.info("enabled, starting..."),this.ur(this.so))}onRemoteConfig(t){if("capturePerformance"in t){var e=ke(t.capturePerformance)&&!!t.capturePerformance.web_vitals,n=ke(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[_l]:e}),this._instance.persistence.register({[kl]:n})),this.$s=e,this.startIfEnabled()}}ur(t){var e,n;(e=$.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?t():(n=$.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",r=>{r?kn.error("failed to load script",r):t()})}io(){var t=E?E.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Qr,...e||[]]:[];return Gi(t,n,Yi)}kn.error("Could not determine current URL")}}},K2={exceptionObserver:class{constructor(t){var e,n,r;this.so=()=>{var i;if(E&&this.isEnabled&&(i=$.__PosthogExtensions__)!=null&&i.errorWrappingFunctions){var s=$.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=$.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=$.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ao&&this.Bt.capture_unhandled_errors&&(this.ao=s(this.captureException.bind(this))),!this.lo&&this.Bt.capture_unhandled_rejections&&(this.lo=o(this.captureException.bind(this))),!this.uo&&this.Bt.capture_console_errors&&(this.uo=a(this.captureException.bind(this)))}catch(u){gi.error("failed to start",u),this.ho()}}},this._instance=t,this.co=!((e=this._instance.persistence)==null||!e.props[bl]),this.do=new rv({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10,refillInterval:1e4,Gt:gi}),this.Bt=this.vo(),this.startIfEnabledOrStop()}vo(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return ke(t)?e=O({},e,t):(P(t)?this.co:t)&&(e=O({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Bt.capture_console_errors||this.Bt.capture_unhandled_errors||this.Bt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(gi.info("enabled"),this.ho(),this.ur(this.so)):this.ho()}ur(t){var e,n;(e=$.__PosthogExtensions__)!=null&&e.errorWrappingFunctions&&t(),(n=$.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",r=>{if(r)return gi.error("failed to load script",r);t()})}ho(){var t,e,n;(t=this.ao)==null||t.call(this),this.ao=void 0,(e=this.lo)==null||e.call(this),this.lo=void 0,(n=this.uo)==null||n.call(this),this.uo=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.co=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[bl]:this.co}),this.Bt=this.vo(),this.startIfEnabledOrStop())}onConfigChange(){this.Bt=this.vo()}captureException(t){var e,n,r,i=(e=t==null||(n=t.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&e!==void 0?e:"Exception";this.do.consumeRateLimit(i)?gi.info("Skipping exception capture because of client rate limiting.",{exception:i}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,n;this.fo=[],this.po=new gv([new Cv,new Nv,new Sv,new Ev,new Ov,new Dv,new Mv,new Rv],function(r){for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;i>o;o++)s[o-1]=arguments[o];return function(a,u){u===void 0&&(u=0);for(var l=[],c=a.split(`
|
|
2
|
-
`),d=u;c.length>d;d++){var h=c[d];if(1024>=h.length){var f=ah.test(h)?h.replace(ah,"$1"):h;if(!f.match(/\S*Error: /)){for(var p of s){var m=p(f,r);if(m){l.push(m);break}}if(l.length>=50)break}}}return function(g){if(!g.length)return[];var b=Array.from(g);return b.reverse(),b.slice(0,50).map(v=>{return O({},v,{filename:v.filename||(_=b,_[_.length-1]||{}).filename,function:v.function||Xr});var _})}(l)}}("web:javascript",_v,wv)),this._instance=t,this.fo=(e=(n=this._instance.persistence)==null?void 0:n.get_property(vl))!==null&&e!==void 0?e:[],this.mo=po(this.yo()),this.bo=new Iv(this.mo)}onConfigChange(){this.mo=po(this.yo()),this.bo.setConfig(this.mo)}onRemoteConfig(t){var e,n,r;if("errorTracking"in t){var i=(e=(n=t.errorTracking)==null?void 0:n.suppressionRules)!==null&&e!==void 0?e:[],s=(r=t.errorTracking)==null?void 0:r.captureExtensionExceptions;this.fo=i,this._instance.persistence&&this._instance.persistence.register({[vl]:this.fo,[yl]:s})}}get _o(){var t,e=!!this._instance.get_property(yl),n=this._instance.config.error_tracking.captureExtensionExceptions;return(t=n??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.po.buildFromUnknown(t,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(t,e){if(this.mo.enabled)try{if(!me(t)||t.trim().length===0)return void nn.warn("Ignoring exception step because message must be a non-empty string");var n=this.wo(e),{sanitizedProperties:r,droppedKeys:i}=function(s){if(!s)return{sanitizedProperties:{},droppedKeys:[]};var o=[];return{sanitizedProperties:Object.keys(s).reduce((a,u)=>Fv.has(u)?(o.push(u),a):(a[u]=s[u],a),{}),droppedKeys:o}}(n);i.length>0&&nn.warn("Ignoring reserved exception step fields",{droppedKeys:i}),this.bo.add(O({[ho]:t,[fo]:new Date().toISOString()},r))}catch(s){nn.error("Failed to add exception step. Ignoring breadcrumb.",s)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.Io(e)){if(this.Co(e))return this.So("Exception dropped: matched a suppression rule"),void nn.info("Skipping exception capture because a suppression rule matched");if(!this._o&&this.xo(e))return this.So("Exception dropped: thrown by a browser extension"),void nn.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ko(e))return this.So("Exception dropped: thrown by the PostHog SDK"),void nn.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.mo.enabled&&Y(t.$exception_steps)?this.To(t):t;try{var r=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",en:!0});return r&&this.bo.clear(),r}catch(i){return nn.error("Failed to capture exception event. Dropping this exception.",i),void this.bo.clear()}}catch(i){return void nn.error("Failed to process exception event. Ignoring this exception.",i)}}To(t){try{var e=this.bo.getAttachable();return e.length===0?t:O({},t,{$exception_steps:e})}catch(n){return nn.error("Failed to read buffered exception steps. Capturing exception without steps.",n),t}}So(t){this.mo.enabled&&this.bo.add({[ho]:t,[fo]:new Date().toISOString()})}wo(t){return ke(t)?O({},t):{}}yo(){var t,e;return(t=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&t!==void 0?t:{}}Co(t){if(t.length===0)return!1;var e=t.reduce((n,r)=>{var{type:i,value:s}=r;return me(i)&&i.length>0&&n.$exception_types.push(i),me(s)&&s.length>0&&n.$exception_values.push(s),n},{$exception_types:[],$exception_values:[]});return this.fo.some(n=>{var r=n.values.map(i=>{var s,o=gm[i.operator],a=Q(i.value)?i.value:[i.value],u=(s=e[i.key])!==null&&s!==void 0?s:[];return a.length>0&&o(a,u)});return n.type==="OR"?r.some(Boolean):r.every(Boolean)})}xo(t){return t.flatMap(e=>{var n,r;return(n=(r=e.stacktrace)==null?void 0:r.frames)!==null&&n!==void 0?n:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}ko(t){if(t.length>0){var e,n,r,i,s=(e=(n=t[0].stacktrace)==null?void 0:n.frames)!==null&&e!==void 0?e:[],o=s[s.length-1];return(r=o==null||(i=o.filename)==null?void 0:i.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}Io(t){return!Y(t)&&Q(t)}}},J2=O({productTours:class{get ni(){return this._instance.persistence}constructor(t){this.Ao=null,this.Eo=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){"productTours"in t&&(this.ni&&this.ni.register({[xl]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,e;this.Ao||(t=this._instance).config.disable_product_tours||(e=t.persistence)==null||!e.get_property(xl)||this.ur(()=>this.Ro())}ur(t){var e,n;(e=$.__PosthogExtensions__)!=null&&e.generateProductTours?t():(n=$.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",r=>{r?qh.error("Could not load product tours script",r):t()})}Ro(){var t;!this.Ao&&(t=$.__PosthogExtensions__)!=null&&t.generateProductTours&&(this.Ao=$.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(e===void 0&&(e=!1),!Q(this.Eo)||e){var n=this.ni;if(n){var r=n.props[Xs];if(Q(r)&&!e)return this.Eo=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:i=>{var s=i.statusCode;if(s!==200||!i.json){var o="Product Tours API could not be loaded, status: "+s;return qh.error(o),void t([],{isLoaded:!1,error:o})}var a=Q(i.json.product_tours)?i.json.product_tours:[];this.Eo=a,n&&n.register({[Xs]:a}),t(a,{isLoaded:!0})}})}else t(this.Eo,{isLoaded:!0})}getActiveProductTours(t){Y(this.Ao)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ao.getActiveProductTours(t)}showProductTour(t){var e;(e=this.Ao)==null||e.showTourById(t)}previewTour(t){this.Ao?this.Ao.previewTour(t):this.ur(()=>{var e;this.Ro(),(e=this.Ao)==null||e.previewTour(t)})}dismissProductTour(){var t;(t=this.Ao)==null||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.Ao)==null||t.nextStep()}previousStep(){var t;(t=this.Ao)==null||t.previousStep()}clearCache(){var t;this.Eo=null,(t=this.ni)==null||t.unregister(Xs)}resetTour(t){var e;(e=this.Ao)==null||e.resetTour(t)}resetAllTours(){var t;(t=this.Ao)==null||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.Ao)==null||e.cancelPendingTour(t)}}},Aa),G2={siteApps:class{constructor(t){this._instance=t,this.No=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Mo(t,e){if(e){var n=this.globalsForEvent(e);this.No.push(n),this.No.length>1e3&&(this.No=this.No.slice(10))}}get siteAppLoaders(){var t;return(t=$._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Mo.bind(this));this.Fo=()=>{t(),this.No=[],this.Fo=void 0}}}globalsForEvent(t){var e,n,r,i,s,o,a;if(!t)throw new Error("Event payload is required");var u={},l=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var[d,h]of Object.entries(c))u[d]={id:l[d],type:d,properties:h};var{$set_once:f,$set:p}=t;return{event:O({},b0(t,$2),{properties:O({},t.properties,p?{$set:O({},(e=(n=t.properties)==null?void 0:n.$set)!==null&&e!==void 0?e:{},p)}:{},f?{$set_once:O({},(r=(i=t.properties)==null?void 0:i.$set_once)!==null&&r!==void 0?r:{},f)}:{}),elements_chain:(s=(o=t.properties)==null?void 0:o.$elements_chain)!==null&&s!==void 0?s:"",distinct_id:(a=t.properties)==null?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(t){var e=this.apps[t.id],n=()=>{var o;!e.errored&&this.No.length&&(Cn.info("Processing "+this.No.length+" events for site app with id "+t.id),this.No.forEach(a=>e.processEvent==null?void 0:e.processEvent(a)),e.processedBuffer=!0),Object.values(this.apps).every(a=>a.processedBuffer||a.errored)&&((o=this.Fo)==null||o.call(this))},r=!1,i=o=>{e.errored=!o,e.loaded=!0,Cn.info("Site app with id "+t.id+" "+(o?"loaded":"errored")),r&&n()};try{var{processEvent:s}=t.init({posthog:this._instance,callback(o){i(o)}});s&&(e.processEvent=s),r=!0}catch(o){Cn.error(Wh+t.id,o),i(!1)}if(r&&e.loaded)try{n()}catch(o){Cn.error("Error while processing buffered events PostHog app with config id "+t.id,o),e.errored=!0}}Oo(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of t)this.setupSiteApp(n)}Po(t){if(Object.keys(this.apps).length!==0){var e=this.globalsForEvent(t);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(e)}catch(r){Cn.error("Error while processing event "+t.event+" for site app "+n.id,r)}}}onRemoteConfig(t){var e,n,r,i=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.Oo(),void this._instance.on("eventCaptured",u=>this.Po(u))):void Cn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.Fo)==null||n.call(this),(r=t.siteApps)!=null&&r.length)if(this.isEnabled){var s=function(u){var l;$["__$$ph_site_app_"+u]=i._instance,(l=$.__PosthogExtensions__)==null||l.loadSiteApp==null||l.loadSiteApp(i._instance,a,c=>{if(c)return Cn.error(Wh+u,c)})};for(var{id:o,url:a}of t.siteApps)s(o)}else Cn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Y2={tracingHeaders:class{constructor(t){this.Lo=void 0,this.Do=void 0,this.so=()=>{var e,n,r=this.Bo()||[];P(this.Lo)&&((e=$.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null||e._patchXHR(r,this._instance.get_distinct_id(),this._instance.sessionManager)),P(this.Do)&&((n=$.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchFetch(r,this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}initialize(){this.startIfEnabledOrStop()}ur(t){var e,n;(e=$.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns&&t(),(n=$.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",r=>{if(r)return L2.error("failed to load script",r);t()})}Bo(){var t;return(t=this._instance.config.addTracingHeaders)!==null&&t!==void 0?t:this._instance.config.__add_tracing_headers}startIfEnabledOrStop(){var t,e;this.Bo()?this.ur(this.so):((t=this.Lo)==null||t.call(this),(e=this.Do)==null||e.call(this),this.Lo=void 0,this.Do=void 0)}}},Z2=O({surveys:class{get Bt(){return this._instance.config}constructor(t){this.jo=void 0,this._surveyManager=null,this.$o=!1,this.qo=[],this.Zo=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Bt.disable_surveys){var e=t.surveys;if(Y(e))return se.warn("Flags not loaded yet. Not loading surveys.");var n=Q(e);this.jo=n?e.length>0:e,se.info("flags response received, isSurveysEnabled: "+this.jo),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],e=0;e<localStorage.length;e++){var n=localStorage.key(e);(n!=null&&n.startsWith(Hl)||n!=null&&n.startsWith("inProgressSurvey_"))&&t.push(n)}t.forEach(r=>localStorage.removeItem(r))}loadIfEnabled(){if(!this._surveyManager)if(this.$o)se.info("Already initializing surveys, skipping...");else if(this.Bt.disable_surveys)se.info(Uh);else if(this.Bt.cookieless_mode&&this._instance.consent.isOptedOut())se.info("Not loading surveys in cookieless mode without consent.");else{var t=$?.__PosthogExtensions__;if(t){if(!P(this.jo)||this.Bt.advanced_enable_surveys){var e=this.jo||this.Bt.advanced_enable_surveys;this.$o=!0;try{var n=t.generateSurveys;if(n)return void this.Vo(n,e);var r=t.loadExternalDependency;if(!r)return void this.Ho(Vc);r(this._instance,"surveys",i=>{i||!t.generateSurveys?this.Ho("Could not load surveys script",i):this.Vo(t.generateSurveys,e)})}catch(i){throw this.Ho("Error initializing surveys",i),i}finally{this.$o=!1}}}else se.error("PostHog Extensions not found.")}}Vo(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new j2(this._instance),se.info("Surveys loaded successfully"),this.zo({isLoaded:!0})}Ho(t,e){se.error(t,e),this.zo({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.qo.push(t),this._surveyManager&&this.zo({isLoaded:!0}),()=>{this.qo=this.qo.filter(e=>e!==t)}}getSurveys(t,e){if(e===void 0&&(e=!1),this.Bt.disable_surveys)return se.info(Uh),t([]);var n,r=this._instance.get_property(Sl);if(r&&!e)return t(r,{isLoaded:!0});typeof Promise<"u"&&this.Zo?this.Zo.then(i=>{var{surveys:s,context:o}=i;return t(s,o)}):(typeof Promise<"u"&&(this.Zo=new Promise(i=>{n=i})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Bt.token),method:"GET",timeout:this.Bt.surveys_request_timeout_ms,callback:i=>{var s;this.Zo=null;var o=i.statusCode;if(o!==200||!i.json){var a="Surveys API could not be loaded, status: "+o;se.error(a);var u={isLoaded:!1,error:a};return t([],u),void(n==null||n({surveys:[],context:u}))}var l,c=i.json.surveys||[],d=c.filter(f=>function(p){return!(!p.start_date||p.end_date)}(f)&&(function(p){var m;return!((m=p.conditions)==null||(m=m.events)==null||(m=m.values)==null||!m.length)}(f)||function(p){var m;return!((m=p.conditions)==null||(m=m.actions)==null||(m=m.values)==null||!m.length)}(f)));d.length>0&&((l=this._surveyEventReceiver)==null||l.register(d)),(s=this._instance.persistence)==null||s.register({[Sl]:c});var h={isLoaded:!0};t(c,h),n?.({surveys:c,context:h})}}))}zo(t){for(var e of this.qo)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(n){se.error("Error in survey callback",n)}}getActiveMatchingSurveys(t,e){if(e===void 0&&(e=!1),!Y(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);se.warn("init was not called")}Uo(t){var e=null;return this.getSurveys(n=>{var r;e=(r=n.find(i=>i.id===t))!==null&&r!==void 0?r:null}),e}Yo(t){if(Y(this._surveyManager))return{eligible:!1,reason:bu};var e=typeof t=="string"?this.Uo(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Y(this._surveyManager))return se.warn("init was not called"),{visible:!1,disabledReason:bu};var e=this.Yo(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return Y(this._surveyManager)?(se.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:bu})):new Promise(n=>{this.getSurveys(r=>{var i,s=(i=r.find(a=>a.id===t))!==null&&i!==void 0?i:null;if(s){var o=this.Yo(s);n({visible:o.eligible,disabledReason:o.reason})}else n({visible:!1,disabledReason:"Survey not found"})},e)})}renderSurvey(t,e,n){var r;if(Y(this._surveyManager))se.warn("init was not called");else{var i=typeof t=="string"?this.Uo(t):t;if(i!=null&&i.id)if(y2.includes(i.type)){var s=N?.querySelector(e);if(s)return(r=i.appearance)!=null&&r.surveyPopupDelaySeconds?(se.info("Rendering survey "+i.id+" with delay of "+i.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var o,a;se.info("Rendering survey "+i.id+" with delay of "+((o=i.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(a=this._surveyManager)==null||a.renderSurvey(i,s,n),se.info("Survey "+i.id+" rendered")},1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,s,n);se.warn("Survey element not found")}else se.warn("Surveys of type "+i.type+" cannot be rendered in the app");else se.warn("Survey not found")}}displaySurvey(t,e){var n;if(Y(this._surveyManager))se.warn("init was not called");else{var r=this.Uo(t);if(r){var i=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&e.ignoreDelay&&(i=O({},r,{appearance:O({},r.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==Il.Popover&&e.initialResponses&&se.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var s=this.canRenderSurvey(r);if(!s.visible)return void se.warn("Survey is not eligible to be displayed: ",s.disabledReason)}e.displayType!==Il.Inline?this._surveyManager.handlePopoverSurvey(i,e):this.renderSurvey(i,e.selector,e.properties)}else se.warn("Survey not found")}}cancelPendingSurvey(t){Y(this._surveyManager)?se.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;(t=this._surveyManager)==null||t.handlePageUnload()}}},Aa),X2={toolbar:class{constructor(t){this.instance=t}Go(t){$.ph_toolbar_state=t}Wo(){var t;return(t=$.ph_toolbar_state)!==null&&t!==void 0?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,n){if(t===void 0&&(t=void 0),e===void 0&&(e=void 0),n===void 0&&(n=void 0),Z0(this.instance.config)||!E||!N)return!1;t=t??E.location,n=n??E.history;try{if(!e){try{E.localStorage.setItem("test","test"),E.localStorage.removeItem("test")}catch{return!1}e=E?.localStorage}var r,i=V2||Eo(t.hash,"__posthog")||Eo(t.hash,"state"),s=i?lh(()=>JSON.parse(atob(decodeURIComponent(i))))||lh(()=>JSON.parse(decodeURIComponent(i))):null;return s&&s.action==="ph_authorize"?((r=s).source="url",r&&Object.keys(r).length>0&&(s.desiredHash?t.hash=s.desiredHash:n?n.replaceState(n.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(e.getItem(Kh)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}Xo(t){var e=$.ph_load_toolbar||$.ph_load_editor;!Y(e)&&dn(e)?e(t,this.instance):Jh.warn("No toolbar load function found")}loadToolbar(t){var e=!(N==null||!N.getElementById(K0));if(!E||e)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=O({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(E.localStorage.setItem(Kh,JSON.stringify(O({},r,{source:void 0}))),this.Wo()===2)this.Xo(r);else if(this.Wo()===0){var i;this.Go(1),(i=$.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"toolbar",s=>{if(s)return Jh.error("[Toolbar] Failed to load",s),void this.Go(0);this.Go(2),this.Xo(r)}),Ee(E,"turbolinks:load",()=>{this.Go(0),this.loadToolbar(r)})}return!0}Jo(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,n){return t===void 0&&(t=void 0),e===void 0&&(e=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(t,e,n)}}},Q2=O({experiments:Ke},Aa),ey={conversations:class{constructor(t){this.Ko=void 0,this._conversationsManager=null,this.Qo=!1,this.ea=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;Y(e)||(Vt(e)?this.Ko=e:(this.Ko=e.enabled,this.ea=e),this.loadIfEnabled())}}reset(){var t;(t=this._conversationsManager)==null||t.reset(),this._conversationsManager=null,this.Ko=void 0,this.ea=null}loadIfEnabled(){if(!(this._conversationsManager||this.Qo||this._instance.config.disable_conversations||Z0(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=$?.__PosthogExtensions__;if(t&&!P(this.Ko)&&this.Ko)if(this.ea&&this.ea.token){this.Qo=!0;try{var e=t.initConversations;if(e)return this.ta(e),void(this.Qo=!1);var n=t.loadExternalDependency;if(!n)return void this.ra(Vc);n(this._instance,"conversations",r=>{r||!t.initConversations?this.ra("Could not load conversations script",r):this.ta(t.initConversations),this.Qo=!1})}catch(r){this.ra("Error initializing conversations",r),this.Qo=!1}}else vt.error("Conversations enabled but missing token in remote config.")}}ta(t){if(this.ea)try{this._conversationsManager=t(this.ea,this._instance),vt.info("Conversations loaded successfully")}catch(e){this.ra("Error completing conversations initialization",e)}else vt.error("Cannot complete initialization: remote config is null")}ra(t,e){vt.error(t,e),this._conversationsManager=null,this.Qo=!1}show(){this._conversationsManager?this._conversationsManager.show():vt.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Ko===!0&&!yn(this._conversationsManager)}isVisible(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&t!==void 0&&t}sendMessage(t,e,n){var r=this;return kt(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,e,n):(vt.warn(Xn),null)})()}getMessages(t,e){var n=this;return kt(function*(){return n._conversationsManager?n._conversationsManager.getMessages(t,e):(vt.warn(Xn),null)})()}markAsRead(t){var e=this;return kt(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(vt.warn(Xn),null)})()}getTickets(t){var e=this;return kt(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(vt.warn(Xn),null)})()}requestRestoreLink(t){var e=this;return kt(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(vt.warn(Xn),null)})()}restoreFromToken(t){var e=this;return kt(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(vt.warn(Xn),null)})()}restoreFromUrlToken(){var t=this;return kt(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(vt.warn(Xn),null)})()}getCurrentTicketId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&t!==void 0?t:null}getWidgetSessionId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&t!==void 0?t:null}un(){var t;(t=this._conversationsManager)==null||t.setIdentity()}hn(){var t;(t=this._conversationsManager)==null||t.clearIdentity()}}},ty={logs:class{constructor(t){var e;this.ia=!1,this.na=!1,this.Gt=fe("[logs]"),this.sa=[],this.oa=0,this.aa=0,this.la=!1,this._instance=t,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.ia=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,n=(e=t.logs)==null?void 0:e.captureConsoleLogs;!Y(n)&&n&&(this.ia=!0,this.loadIfEnabled())}reset(){this.sa=[],this.jr&&(clearTimeout(this.jr),this.jr=void 0),this.oa=0,this.aa=0,this.la=!1}loadIfEnabled(){if(this.ia&&!this.na){var t=$?.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",n=>{var r;n||(r=t.logs)==null||!r.initializeLogs?this.Gt.error("Could not load logs script",n):(t.logs.initializeLogs(this._instance),this.na=!0)}):this.Gt.error(Vc)}else this.Gt.error("PostHog Extensions not found.")}}captureLog(t){var e,n,r,i,s,o;if(this._instance.is_capturing())if(t&&t.body){var a=(e=(n=this._instance.config.logs)==null?void 0:n.flushIntervalMs)!==null&&e!==void 0?e:3e3,u=(r=(i=this._instance.config.logs)==null?void 0:i.maxLogsPerInterval)!==null&&r!==void 0?r:1e3,l=Date.now();if(a>l-this.aa||(this.aa=l,this.oa=0,this.la=!1),u>this.oa){this.oa++;var c=function(d,h){var f=d.level||"info",{text:p,number:m}=L0[f]||pv,g=String(Date.now())+"000000",b={};h.distinctId&&(b.posthogDistinctId=h.distinctId),h.sessionId&&(b.sessionId=h.sessionId),h.currentUrl&&(b["url.full"]=h.currentUrl),h.screenName&&(b["screen.name"]=h.screenName),h.appState&&(b["app.state"]=h.appState),h.activeFeatureFlags&&h.activeFeatureFlags.length>0&&(b.feature_flags=h.activeFeatureFlags);var v=O({},b,d.attributes||{}),_={timeUnixNano:g,observedTimeUnixNano:g,severityNumber:m,severityText:p,body:{stringValue:d.body},attributes:oh(v)};return d.trace_id&&(_.traceId=d.trace_id),d.span_id&&(_.spanId=d.span_id),P(d.trace_flags)||(_.flags=d.trace_flags),_}(t,this.ua());this.sa.push({record:c}),((s=(o=this._instance.config.logs)==null?void 0:o.maxBufferSize)!==null&&s!==void 0?s:100)>this.sa.length?this.ha():this.flushLogs()}else this.la||(this.Gt.warn("captureLog dropping logs: exceeded "+u+" logs per "+a+"ms"),this.la=!0)}else this.Gt.warn("captureLog requires a body")}get logger(){return this.ca||(this.ca={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.ca}flushLogs(t){if(this.jr&&(clearTimeout(this.jr),this.jr=void 0),this.sa.length!==0){var e=this.sa;this.sa=[];var n=this._instance.config.logs,r=O({"service.name":n?.serviceName||"unknown_service"},n?.environment&&{"deployment.environment":n.environment},n?.serviceVersion&&{"service.version":n.serviceVersion},n?.resourceAttributes),i=function(o,a,u,l){return{resourceLogs:[{resource:{attributes:oh(a)},scopeLogs:[{scope:{name:u,version:l},logRecords:o}]}]}}(e.map(o=>o.record),r,et.LIB_NAME,et.LIB_VERSION),s=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Vi({method:"POST",url:s,data:i,compression:"best-available",batchKey:"logs",transport:t})}}ha(){var t,e;this.jr||(this.jr=setTimeout(()=>{this.jr=void 0,this.flushLogs()},(t=(e=this._instance.config.logs)==null?void 0:e.flushIntervalMs)!==null&&t!==void 0?t:3e3))}ua(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=n}if($!=null&&(t=$.location)!=null&&t.href&&(e.currentUrl=$.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(e.activeFeatureFlags=r)}return e}}},ny=O({},Aa,W2,U2,K2,J2,G2,Z2,Y2,X2,Q2,ey,ty);Ct.__defaultExtensionClasses=O({},ny);var Xh,yu=(Xh=Ii[Pr]=new Ct,function(){function t(){t.done||(t.done=!0,ym=!1,de(Ii,function(e){e._dom_loaded()}))}N!=null&&N.addEventListener?N.readyState==="complete"?t():Ee(N,"DOMContentLoaded",t,{capture:!1}):E&&I.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),Xh);const ry=({client:t})=>{const[e,n]=Z(!1),[r,i]=Z({x:0,y:0}),[s,o]=Z(0),a=Oe(null),u=window.innerWidth<768,l=t.plugin.getUserInfo().context_menu_on_select,c=t.plugin.getPluginInfo().installedPlugins.flatMap(h=>h.context_menu_actions).filter(Boolean),d=(h,f=0)=>{const p=window.getSelection();if(!p||!h)return{x:0,y:0,text:h};const g=p.getRangeAt(0).getBoundingClientRect(),b=g.left+g.width/2-f/2,v=g.bottom+12;return{x:b,y:v,text:h}};return J(()=>{t.event.on("global.contextMenu.createActions",({data:h})=>{c.push(...h.actions)})},[]),J(()=>{e&&a.current&&o(a.current.offsetWidth)},[e]),J(()=>{const h=m=>{var g;const b=(g=window.getSelection())===null||g===void 0?void 0:g.toString().trim();e&&b===r.text||i(u&&b?d(b,s):{x:m.clientX,y:m.clientY,text:b})},f=m=>{var g,b;const v=(g=window.getSelection())===null||g===void 0?void 0:g.toString().trim();if(a.current&&a.current.contains(m.target))return;const _=m.target;if(_&&(_.tagName==="TEXTAREA"||_.tagName==="INPUT"&&_.type==="text")){n(!1);return}m.button===0&&e?(n(!1),(b=window.getSelection())===null||b===void 0||b.removeAllRanges()):v&&(l||m.button===2)?(m.button===2&&m.preventDefault(),i(u?d(v,s):{x:m.clientX,y:m.clientY,text:v}),n(!0)):n(!1)},p=()=>{var m;const g=(m=window.getSelection())===null||m===void 0?void 0:m.toString().trim();!g&&e?n(!1):g&&e&&u&&i(d(g,s))};return document.addEventListener("mouseup",f),window.addEventListener("mousemove",h),document.addEventListener("contextmenu",f),document.addEventListener("selectionchange",p),()=>{document.removeEventListener("mouseup",f),window.removeEventListener("mousemove",h),document.removeEventListener("contextmenu",f),document.removeEventListener("selectionchange",p)}},[l,e,r.text]),e?M("div",{ref:a,className:"fixed bg-gray-400 dark:bg-gray-700 shadow-lg border border-gray-400 rounded-md overflow-hidden dark:text-white z-50",style:{top:r.y,left:r.x},children:c.map((h,f)=>M(iy,{iconUrl:h.iconUrl,text:h.text,onClick:()=>{var p;n(!1),(p=window.getSelection())===null||p===void 0||p.removeAllRanges(),t.event.emitSidebarAction(h.plugin_id,h.action_key,r.text)}},f))}):null};function iy(t){return Ae("button",{onClick:t.onClick,className:"px-2 md:px-4 py-2 text-left hover:bg-gray-500 dark:hover:bg-gray-600 w-full flex flex-row",children:[t.iconUrl&&M("span",{className:"flex-grow",children:M("img",{src:t.iconUrl,alt:t.text,className:"w-4 h-4 mr-2"})}),M("span",{className:"flex-grow",children:t.text})]})}function Yc(t="system",e=!1){const n=t==="system"?sy():t==="dark";if(e)return{isDark:n,theme:t,isDisabled:e};const r=document.documentElement;return r.dataset.theme=n?"dark":"light",r.style.colorScheme=n?"dark":"light",r.classList[n?"add":"remove"]("dark"),document.querySelector("#root").classList.add("dark:bg-gradient-to-br","dark:from-gray-900","dark:to-gray-800","dark:text-white","min-h-screen","bg-fixed"),{isDark:n,theme:t,isDisabled:e}}function sy(){return window.matchMedia("(prefers-color-scheme: dark)").matches}var oy=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};const Mm=Fc(null),ay=({children:t,pluginId:e,client:n,userInfo:r,settings:i})=>{const s=!!n,[o,a]=Z(n??null),[u,l]=Z(!1),[c,d]=Z(null),[h,f]=Z(void 0),[p,m]=Z(r??null);J(()=>{s&&(n&&a(n),r&&m(r))},[n,r,s]),Yc(h,s),J(()=>{yu.__loaded||yu.init("phc_l4vPVZxtjlcQUDivoh5TaUL6oDe8K2lig89405cGnsv",{cookieless_mode:"always",api_host:"https://c.rimori.se",defaults:"2026-01-30",loaded:v=>{v.register({application:"frontend",pluginId:e})}})},[]);const g=c==="sidebar",b=c==="settings";return J(()=>{if(s)return;ly(e);const v=window===window.parent;v&&!u&&Zd.getInstance().then(_=>{_.needsLogin().then(x=>l(x?_:!0))}),(!v&&!o||v&&u===!0)&&qb.getInstance(e).then(_=>{a(_),m(_.plugin.getUserInfo()),v||(f(_.plugin.theme),d(_.plugin.applicationMode),_.event.emit("self.rimori.triggerInitFinished"))})},[e,u,o,s]),J(()=>{p?.user_id&&yu.identify(p.user_id)},[p?.user_id]),J(()=>{if(!o)return;const v=o.plugin.onRimoriInfoUpdate(_=>{m(_.profile)});return()=>v()},[o]),J(()=>{if(!o||g||s)return;const v=history.pushState;history.pushState=(..._)=>{const x=v.apply(history,_);return o.event.emit("session.triggerUrlChange",{url:location.hash}),x}},[o,g,s]),J(()=>{if(!o||s)return;const v=()=>{const x=document.documentElement.scrollHeight>window.innerHeight;o.event.emit("session.triggerScrollbarChange",{hasScrollbar:x})};v(),window.addEventListener("resize",v);const _=new ResizeObserver(()=>v());return _.observe(document.body),()=>{window.removeEventListener("resize",v),_.disconnect()}},[o,s]),u instanceof Zd?M(cy,{onLogin:(v,_)=>oy(void 0,void 0,void 0,function*(){(yield u.login(v,_))&&l(!0)})}):!o||!p?"":Ae(Mm.Provider,{value:{client:o,userInfo:p},children:[!i?.disableContextMenu&&!g&&!b&&M(ry,{client:o}),t]})},Yt=()=>{const t=h0(Mm);if(t===null)throw new Error("useRimori must be used within an PluginProvider");return Object.assign(t.client,{userInfo:t.userInfo})};function uy(t){const e=window.location.hash.split("?");if(e.length>1){const i=new URLSearchParams(e[1]).get(t);if(i)return i}return new URL(window.location.href).searchParams.get(t)}function ly(t){const e=uy("applicationMode")==="sidebar";Wb.getInstance("Plugin EventBus "+t+" "+(e?"sidebar":"main"))}function cy({onLogin:t}){const[e,n]=Z(""),[r,i]=Z("");return M("div",{style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.5)"},children:Ae("div",{style:{backgroundColor:"#343534",padding:"1rem",borderRadius:"0.5rem",width:"500px",flexDirection:"column",display:"flex",alignItems:"center",justifyContent:"center"},children:[M("p",{style:{fontSize:"2rem",fontWeight:"bold",marginBottom:"1rem",textAlign:"center"},children:"Rimori Login Required"}),M("p",{style:{marginBottom:"1rem",textAlign:"center"},children:"Please login with your Rimori developer account for this plugin to be able to access the Rimori platform the same way it would when being deployed."}),M("input",{style:{marginBottom:"1rem",width:"100%",padding:"0.5rem",borderRadius:"0.5rem",border:"none",backgroundColor:"#444444"},type:"email",placeholder:"Email",onChange:s=>n(s.target.value)}),M("input",{style:{marginBottom:"1rem",width:"100%",padding:"0.5rem",borderRadius:"0.5rem",border:"none",backgroundColor:"#444444"},type:"password",placeholder:"Password",onChange:s=>i(s.target.value)}),M("button",{style:{marginBottom:"1rem",width:"100%",padding:"0.5rem",borderRadius:"0.5rem",border:"none",backgroundColor:"#928358"},onClick:()=>{t(e,r)},children:"Login"})]})})}function Tm(t,e){const[n,r]=ae.useState([]),[i,s]=ae.useState(!1),{ai:o}=Yt(),a=ae.useRef({prompt:e?.prompt,promptVariables:e?.promptVariables}),u=ae.useCallback(c=>{a.current=Object.assign(Object.assign({},a.current),c)},[]);return{messages:n,append:c=>{var d,h;const f=[...n,...c];r(f),s(!0);const p=(d=a.current.promptVariables)!==null&&d!==void 0?d:e?.promptVariables,m=(h=a.current.prompt)!==null&&h!==void 0?h:e?.prompt;o.getStreamedText({messages:f,onMessage:(g,b,v,_)=>{s(!v),r(x=>{const y=x[x.length-1];return y?.id===g?[...x.slice(0,-1),Object.assign(Object.assign({},y),{content:b,toolCalls:_})]:[...x,{id:g,role:"assistant",content:b,toolCalls:_}]})},tools:t,prompt:m,variables:p})},init:u,isLoading:i,setMessages:r,lastMessage:n[n.length-1]}}var dy=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};function hy(t){const e=Yt(),[n,r]=Z(t),[i,s]=Z(!0);J(()=>{let a=!1;return e.plugin.getSettings(t).then(u=>{a||(r(u),s(!1))}),()=>{a=!0}},[]);const o=Ht(a=>dy(this,void 0,void 0,function*(){const u=Object.assign(Object.assign({},n),a);r(u),yield e.plugin.setSettings(u)}),[n,e]);return{settings:n,isLoading:i,setSettings:o}}var Qh=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};function fy(t){const{actionKey:e,skillCategory:n,initialData:r,onAction:i}=t,s=Yt(),{event:o,exercise:a}=s,[u,l]=Z(!1),[c,d]=Z(null),h=Oe(r??{}),f=Oe(null),p=Oe(!1);J(()=>{r&&(h.current=Object.assign({},r))},[]),J(()=>{const x=o.onMainPanelAction(y=>Qh(this,void 0,void 0,function*(){console.log(`[useExerciseTracker:${e}] Dashboard action received:`,y),p.current=!0,f.current=Date.now(),l(!0),d(y),h.current=r??{},i&&(yield i(y)),console.log(`[useExerciseTracker:${e}] onAction complete, exercise active`)}),e);return()=>x.off()},[e]);const m=Ht(x=>Qh(this,void 0,void 0,function*(){console.log(`[useExerciseTracker:${e}] start() called (self-initiated)`,x),p.current=!1,yield a.start({actionKey:e,knowledgeId:x?.knowledgeId}),f.current=Date.now(),h.current=r??{},l(!0),console.log(`[useExerciseTracker:${e}] start() complete, session token acquired`)}),[e,a,r]),g=Ht(()=>{f.current=Date.now()},[]),b=Ht(x=>{const y={type:"micro",skillCategory:n,accomplishmentKeyword:x.accomplishmentKeyword,description:x.description,meta:x.meta};o.emitAccomplishment(y)},[o,n]),v=Ht(x=>{h.current=Object.assign(Object.assign({},h.current),x)},[]),_=Ht(x=>{var y;const k=f.current?Date.now()-f.current:0,w=Math.max(1,Math.round(k/6e4));console.log(`[useExerciseTracker:${e}] end() — keyword=${x.accomplishmentKeyword}, errorRatio=${x.errorRatio}, duration=${w}min, trackedData=`,h.current);const S=[...Object.entries(h.current).map(([F,L])=>({key:F,value:L,description:F})),...(y=x.meta)!==null&&y!==void 0?y:[]],D={type:"macro",skillCategory:n,accomplishmentKeyword:x.accomplishmentKeyword,description:x.description,errorRatio:x.errorRatio,durationMinutes:w,meta:S.length>0?S:void 0};o.emitAccomplishment(D),console.log(`[useExerciseTracker:${e}] Macro accomplishment emitted`),l(!1),d(null),f.current=null},[e,o,n]);return{isActive:u,actionParams:c,start:m,ready:g,micro:b,track:v,end:_}}var Dm={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ef=ae.createContext&&ae.createContext(Dm),py=["attr","size","title"];function my(t,e){if(t==null)return{};var n=gy(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function gy(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Do(){return Do=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Do.apply(this,arguments)}function tf(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Oo(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?tf(Object(n),!0).forEach(function(r){by(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tf(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function by(t,e,n){return e=vy(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vy(t){var e=yy(t,"string");return typeof e=="symbol"?e:e+""}function yy(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Om(t){return t&&t.map((e,n)=>ae.createElement(e.tag,Oo({key:n},e.attr),Om(e.child)))}function ee(t){return e=>ae.createElement(_y,Do({attr:Oo({},t.attr)},e),Om(t.child))}function _y(t){var e=n=>{var{attr:r,size:i,title:s}=t,o=my(t,py),a=i||n.size||"1em",u;return n.className&&(u=n.className),t.className&&(u=(u?u+" ":"")+t.className),ae.createElement("svg",Do({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,o,{className:u,style:Oo(Oo({color:t.color||n.color},n.style),t.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&ae.createElement("title",null,s),t.children)};return ef!==void 0?ae.createElement(ef.Consumer,null,n=>e(n)):e(Dm)}function xy(t){return ee({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z"},child:[]}]})(t)}function ky(t){return ee({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"},child:[]}]})(t)}function wy(t){return ee({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"},child:[]}]})(t)}function Cy(t){return ee({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M448 48v32a16 16 0 0 1-16 16h-48v368a16 16 0 0 1-16 16h-32a16 16 0 0 1-16-16V96h-32v368a16 16 0 0 1-16 16h-32a16 16 0 0 1-16-16V352h-32a160 160 0 0 1 0-320h240a16 16 0 0 1 16 16z"},child:[]}]})(t)}function Ey(t){return ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm115.7 272l-176 101c-15.8 8.8-35.7-2.5-35.7-21V152c0-18.4 19.8-29.8 35.7-21l176 107c16.4 9.2 16.4 32.9 0 42z"},child:[]}]})(t)}function Sy(t){return ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm96 328c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V176c0-8.8 7.2-16 16-16h160c8.8 0 16 7.2 16 16v160z"},child:[]}]})(t)}function Ay(t){return ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M496 224H293.9l-87.17-26.83A43.55 43.55 0 0 1 219.55 112h66.79A49.89 49.89 0 0 1 331 139.58a16 16 0 0 0 21.46 7.15l42.94-21.47a16 16 0 0 0 7.16-21.46l-.53-1A128 128 0 0 0 287.51 32h-68a123.68 123.68 0 0 0-123 135.64c2 20.89 10.1 39.83 21.78 56.36H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h480a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm-180.24 96A43 43 0 0 1 336 356.45 43.59 43.59 0 0 1 292.45 400h-66.79A49.89 49.89 0 0 1 181 372.42a16 16 0 0 0-21.46-7.15l-42.94 21.47a16 16 0 0 0-7.16 21.46l.53 1A128 128 0 0 0 224.49 480h68a123.68 123.68 0 0 0 123-135.64 114.25 114.25 0 0 0-5.34-24.36z"},child:[]}]})(t)}var My=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};const Rm=[.8,.9,1,1.1,1.2,1.5];let _u=!1;const Ty=({text:t,voice:e,language:n,hide:r,playListenerEvent:i,initialSpeed:s=1,playOnMount:o=!1,enableSpeedAdjustment:a=!1,cache:u=!0,size:l="25px",ttsInstructions:c,disableDialect:d=!1})=>{const[h,f]=Z(null),[p,m]=Z(s),[g,b]=Z(!1),[v,_]=Z(!1),{ai:x,userInfo:y}=Yt(),k=Oe(null),w=Oe(null);J(()=>(h&&f(null),()=>{h&&URL.revokeObjectURL(h)}),[t]);const C=()=>My(void 0,void 0,void 0,function*(){_(!0);const F=c??(!d&&y?.dialect?`Speak with a ${y.dialect} accent and pronunciation.`:void 0),L=yield x.getVoice(t,e||(n?"aws_default":"openai_alloy"),1,n,u,F);f(URL.createObjectURL(L)),_(!1)});J(()=>{if(!h||!g){k.current&&(k.current.pause(),k.current.currentTime=0,k.current=null);return}k.current&&(k.current.pause(),k.current.currentTime=0);const F=new Audio(h);return k.current=F,F.playbackRate=p,F.play().then(()=>{F.onended=()=>{b(!1),_u=!1,k.current=null}}).catch(L=>{console.warn("Error playing audio:",L),b(!1),k.current=null}),()=>{k.current&&(k.current.pause(),k.current.currentTime=0,k.current=null)}},[h,g,p]),J(()=>()=>{k.current&&(k.current.pause(),k.current.currentTime=0,k.current=null),b(!1)},[]),J(()=>()=>{h&&URL.revokeObjectURL(h)},[h]);const S=()=>{!g&&!h?C().then(()=>b(!0)):b(F=>!F)},D=Oe(S);return f0(()=>{D.current=S}),J(()=>{if(!i)return;const F=()=>D.current(),L=Ub.on(i,F);return w.current=L,()=>{w.current&&(w.current.off(),w.current=null)}},[i]),J(()=>{!o||_u||(_u=!0,S())},[o]),M("div",{className:"group relative",children:Ae("div",{className:"flex flex-row items-end",children:[!r&&M("button",{className:"text-gray-400",onClick:S,disabled:v,children:v?M(Dy,{size:l}):g?M(Sy,{size:l}):M(Ey,{size:l})}),a&&Ae("div",{className:"ml-1 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex flex-row text-sm text-gray-500",children:[M("span",{className:"pr-1",children:"Speed: "}),M("select",{value:p,className:"appearance-none cursor-pointer pr-0 p-0 rounded shadow leading-tight focus:outline-none focus:bg-gray-800 focus:ring bg-transparent border-0",onChange:F=>m(parseFloat(F.target.value)),disabled:v,children:Rm.map(F=>M("option",{value:F,children:F},F))})]})]})})},Dy=({text:t,className:e,size:n="30px"})=>Ae("div",{className:"flex items-center space-x-2 pl-1 "+e,children:[Ae("svg",{style:{width:n,height:n},className:"animate-spin -ml-1 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[M("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),M("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t&&M("span",{className:"",children:t})]});function Oy(t){return ee({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M192 0C139 0 96 43 96 96l0 160c0 53 43 96 96 96s96-43 96-96l0-160c0-53-43-96-96-96zM64 216c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40c0 89.1 66.2 162.7 152 174.4l0 33.6-48 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l72 0 72 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-48 0 0-33.6c85.8-11.7 152-85.3 152-174.4l0-40c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40c0 70.7-57.3 128-128 128s-128-57.3-128-128l0-40z"},child:[]}]})(t)}function Ry(t){return ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M304 48a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zm0 416a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM48 304a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm464-48a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM142.9 437A48 48 0 1 0 75 369.1 48 48 0 1 0 142.9 437zm0-294.2A48 48 0 1 0 75 75a48 48 0 1 0 67.9 67.9zM369.1 437A48 48 0 1 0 437 369.1 48 48 0 1 0 369.1 437z"},child:[]}]})(t)}var xu=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};const Zc=p0(({onVoiceRecorded:t,iconSize:e,className:n,disabled:r,loading:i,onRecordingStatusChange:s,enablePushToTalk:o=!1},a)=>{const[u,l]=Z(!1),[c,d]=Z(!1),h=Oe(null),{ai:f,plugin:p}=Yt(),m=Oe(t);J(()=>{m.current=t},[t]);const g=()=>xu(void 0,void 0,void 0,function*(){try{h.current||(h.current=new Kb(p.pluginId)),yield h.current.startRecording(),l(!0),s(!0)}catch(_){console.error("Failed to start recording:",_)}}),b=()=>xu(void 0,void 0,void 0,function*(){try{if(h.current&&u){const _=yield h.current.stopRecording();d(!0);const x=yield f.getTextFromVoice(_.recording);d(!1),m.current(x)}}catch(_){console.error("Failed to stop recording:",_)}finally{l(!1),s(!1)}});jb(a,()=>({startRecording:g,stopRecording:b}));const v=Oe(!1);return J(()=>{if(!o)return;const _=y=>xu(void 0,void 0,void 0,function*(){y.code==="Space"&&!v.current&&(v.current=!0,yield g())}),x=y=>{y.code==="Space"&&v.current&&(v.current=!1,b())};return window.addEventListener("keydown",_),window.addEventListener("keyup",x),()=>{window.removeEventListener("keydown",_),window.removeEventListener("keyup",x)}},[o]),M("button",{className:"flex flex-row justify-center items-center rounded-full mx-auto disabled:opacity-50 "+n,onClick:u?b:g,disabled:r||i||c,children:i||c?M(Ry,{className:"animate-spin"}):M(Oy,{size:e,className:u?"text-red-600":""})})});function Nm({imageUrl:t,className:e,isDarkTheme:n=!1,width:r="150px",loudnessRef:i}){const s=Oe(null),o=Oe(0),a=Oe(null),u=(l,c,d,h)=>{if(c&&l){l.clearRect(0,0,c.width,c.height);const f=Math.min(c.width,c.height)/3,p=c.width/2,m=c.height/2,g=f+h/2.5;l.beginPath(),l.arc(p,m,g,0,Math.PI*2,!0),l.strokeStyle=n?"rgba(255, 255, 255, 0.5)":"rgba(0, 0, 0, 0.5)",l.lineWidth=5,l.stroke(),l.save(),l.beginPath(),l.arc(p,m,f,0,Math.PI*2,!0),l.closePath(),l.clip(),l.drawImage(d,p-f,m-f,f*2,f*2),l.restore(),l.beginPath(),l.arc(p,m,f,0,Math.PI*2,!0),l.strokeStyle=n?"rgba(255, 255, 255, 0.9)":"rgba(0, 0, 0, 0.9)",l.lineWidth=5,l.stroke()}};return J(()=>{const l=s.current;if(l){const c=l.getContext("2d");if(c){const d=new Image;d.src=t;let h=!0;return d.onload=()=>{if(!h)return;u(c,l,d,0);const f=()=>{var p;const m=(p=i?.current)!==null&&p!==void 0?p:0,g=.06;o.current>m?o.current=Math.max(m,o.current-g*o.current):o.current=m,u(c,l,d,o.current),a.current=requestAnimationFrame(f)};a.current=requestAnimationFrame(f)},()=>{h=!1,a.current&&cancelAnimationFrame(a.current)}}}},[t]),M("canvas",{ref:s,className:e,width:500,height:500,style:{width:r}})}function Ny(t){const e=[];return t.userMessage&&e.push({id:"1",role:"user",content:t.userMessage}),t.assistantMessage&&e.push({id:"2",role:"assistant",content:t.assistantMessage}),e}function Fy({avatarImageUrl:t,voiceId:e,agentTools:n,autoStartConversation:r,children:i,circleSize:s="300px",className:o,cache:a=!1,prompt:u,promptVariables:l}){const{ai:c,plugin:d,userInfo:h}=Yt(),{isDark:f}=Yc(d.theme,!0),[p,m]=Z(!1),[g,b]=Z(!1),v=Oe(0),_=h?.dialect?`Speak with a ${h.dialect} accent and pronunciation.`:void 0,x=Ic(()=>new g0((...D)=>c.getVoice(...D),e,a),[e,c,a]);J(()=>{x.setInstructions(_)},[x,_]);const{messages:y,append:k,isLoading:w,lastMessage:C,setMessages:S}=Tm(n,{prompt:u,promptVariables:l});return J(()=>{console.log("messages",y)},[y]),J(()=>{w||b(!1)},[w]),J(()=>{e&&(x.setOnLoudnessChange(D=>{v.current=D}),x.setOnEndOfSpeech(()=>m(!1)),r&&(S(Ny(r)),r.assistantMessage?x.handleNewText(r.assistantMessage,w):r.userMessage&&k([{role:"user",content:r.userMessage,id:y.length.toString()}])))},[r,e]),J(()=>()=>{x.cleanup()},[x]),J(()=>{C?.role==="assistant"&&(x.handleNewText(C.content,w),C.toolCalls&&(m(!1),b(!1)))},[C,w]),Ae("div",{className:`md:pb-8 ${o||""}`,children:[M(Nm,{width:s,className:"mx-auto",imageUrl:t,isDarkTheme:f,loudnessRef:v}),i,M(Zc,{iconSize:"30",className:"w-16 h-16 shadow-lg rounded-full bg-gray-400 dark:bg-gray-800",disabled:p,loading:g,enablePushToTalk:!0,onVoiceRecorded:D=>{m(!0),k([{role:"user",content:"Message("+Math.floor((y.length+1)/2)+"): "+D,id:y.length.toString()}])},onRecordingStatusChange:D=>!D&&b(!0)})]})}function Iy(){const{plugin:t}=Yt(),[e,n]=Z(null),[r,i]=Z(0);return J(()=>{t.getTranslator().then(o=>{n(o),o.onLanguageChanged(()=>{i(a=>a+1)})})},[t]),{t:Ht((o,a)=>{if(!e)return"";const u=e.t(o,a);return u||""},[e,r]),ready:e!==null}}function Py(t){return ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M5.536 21.886a1.004 1.004 0 0 0 1.033-.064l13-9a1 1 0 0 0 0-1.644l-13-9A1 1 0 0 0 5 3v18a1 1 0 0 0 .536.886z"},child:[]}]})(t)}let Ly=0;const By=()=>`ba-${++Ly}`;function $y({prompt:t,promptVariables:e,autoStartConversation:n,circleSize:r="160px",chatPlaceholder:i,bottomAction:s,className:o,voiceSpeed:a=1,tools:u,showName:l=!1}){const{ai:c,plugin:d,userInfo:h}=Yt(),f=d.ttsEnabled,{isDark:p}=Yc(d.theme,!0),m=h.study_buddy,g=h?.dialect,b=g?`Speak with a ${g} accent and pronunciation.`:void 0,[v,_]=Z(""),[x,y]=Z([]),[k,w]=Z(!1),[C,S]=Z(!1),D=Oe(0),F=Oe(f);J(()=>{F.current=f,!f&&C&&(L.stop(),S(!1))},[f]);const L=Ic(()=>{var W;return new g0((...re)=>c.getVoice(...re),(W=m?.voiceId)!==null&&W!==void 0?W:"")},[m?.voiceId,c]);J(()=>{L.setInstructions(b)},[L,b]),J(()=>(L.setVoiceSpeed(a),L.setOnLoudnessChange(W=>{D.current=W}),L.setOnEndOfSpeech(()=>S(!1)),()=>L.cleanup()),[L]);const j=W=>W.map(re=>({role:re.role,content:re.content})),V=W=>{w(!0),c.getStreamedText({messages:j(W),onMessage:(re,Ce,Te)=>{w(!Te);const bt=`ai-${re}`;y(Re=>{const Ue=Re[Re.length-1];return Ue?.id===bt?[...Re.slice(0,-1),Object.assign(Object.assign({},Ue),{content:Ce})]:[...Re,{id:bt,role:"assistant",content:Ce}]}),F.current&&(L.handleNewText(Ce,!Te),Ce&&S(!0))},tools:u,prompt:t,variables:e})},X=Oe(!1);if(J(()=>{if(!X.current){if(X.current=!0,n?.assistantMessage){const W={id:"init",role:"assistant",content:n.assistantMessage};y([W]),F.current&&(L.handleNewText(n.assistantMessage,!1),S(!0))}else if(n?.userMessage){const W={id:"auto-start",role:"user",content:n.userMessage};y([W]),V([W])}}},[]),!m)return M("div",{});const ne=W=>{if(!W.trim()||k)return;const re={id:By(),role:"user",content:W},Ce=[...x,re];y(Ce),V(Ce)},oe=[...x].filter(W=>W.role==="assistant").pop();return Ae("div",{className:`flex flex-col items-center ${o||""}`,children:[M(Nm,{width:r,imageUrl:m.avatarUrl,isDarkTheme:p,loudnessRef:D,className:"mx-auto"}),l&&M("div",{className:"flex items-center gap-2",children:M("span",{className:"text-3xl font-semibold",children:m.name})}),!d.ttsEnabled&&x.length>1?M("div",{className:"w-full rounded-xl bg-gray-200/70 dark:bg-gray-800/70 px-4 py-3 text-sm text-gray-800 dark:text-gray-200 leading-relaxed border border-gray-300/40 dark:border-gray-700/40 mt-4",children:!oe?.content&&k?Ae("span",{className:"inline-flex gap-1 py-0.5",children:[M("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce"}),M("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce",style:{animationDelay:"0.15s"}}),M("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce",style:{animationDelay:"0.3s"}})]}):M("span",{className:"whitespace-pre-wrap",children:oe?.content})}):null,Ae("div",{className:"w-full relative mt-4 "+(f?"max-w-md":""),children:[M("input",{value:v,onChange:W=>_(W.target.value),onKeyDown:W=>{W.key==="Enter"&&!W.shiftKey&&(W.preventDefault(),ne(v),_(""))},placeholder:i??`Ask ${m.name} a question…`,disabled:k,className:"w-full bg-gray-800/50 border border-gray-700 rounded-lg px-3 py-2 pr-16 text-sm text-gray-200 placeholder:text-gray-500 focus:outline-none focus:ring-1 focus:ring-blue-500 disabled:opacity-60"}),Ae("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",children:[M(Zc,{iconSize:"14",className:"p-1 text-gray-400 hover:text-white transition-colors",disabled:k,onVoiceRecorded:W=>ne(W),onRecordingStatusChange:()=>{}}),M("button",{type:"button",onClick:()=>{ne(v),_("")},disabled:k||!v.trim(),className:"p-1 text-gray-400 hover:text-white disabled:opacity-40 transition-colors",children:M(Py,{className:"w-4 h-4"})})]})]}),s&&M("div",{className:"w-full max-w-md border-t border-gray-700/60 pt-3",children:s})]})}function zy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M20 6 9 17l-5-5"},child:[]}]})(t)}function Hy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z"},child:[]},{tag:"path",attr:{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10"},child:[]},{tag:"path",attr:{d:"m17 10 4 4-4 4"},child:[]}]})(t)}function jy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"},child:[]},{tag:"path",attr:{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"},child:[]}]})(t)}function Vy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 12h8"},child:[]},{tag:"path",attr:{d:"M4 18V6"},child:[]},{tag:"path",attr:{d:"M12 18V6"},child:[]},{tag:"path",attr:{d:"m17 12 3-2v8"},child:[]}]})(t)}function qy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 12h8"},child:[]},{tag:"path",attr:{d:"M4 18V6"},child:[]},{tag:"path",attr:{d:"M12 18V6"},child:[]},{tag:"path",attr:{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1"},child:[]}]})(t)}function Wy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 12h8"},child:[]},{tag:"path",attr:{d:"M4 18V6"},child:[]},{tag:"path",attr:{d:"M12 18V6"},child:[]},{tag:"path",attr:{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2"},child:[]},{tag:"path",attr:{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2"},child:[]}]})(t)}function Uy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"},child:[]},{tag:"path",attr:{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"},child:[]}]})(t)}function Ky(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 2v4"},child:[]},{tag:"path",attr:{d:"m16.2 7.8 2.9-2.9"},child:[]},{tag:"path",attr:{d:"M18 12h4"},child:[]},{tag:"path",attr:{d:"m16.2 16.2 2.9 2.9"},child:[]},{tag:"path",attr:{d:"M12 18v4"},child:[]},{tag:"path",attr:{d:"m4.9 19.1 2.9-2.9"},child:[]},{tag:"path",attr:{d:"M2 12h4"},child:[]},{tag:"path",attr:{d:"m4.9 4.9 2.9 2.9"},child:[]}]})(t)}function Jy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"15 3 21 3 21 9"},child:[]},{tag:"polyline",attr:{points:"9 21 3 21 3 15"},child:[]},{tag:"line",attr:{x1:"21",x2:"14",y1:"3",y2:"10"},child:[]},{tag:"line",attr:{x1:"3",x2:"10",y1:"21",y2:"14"},child:[]}]})(t)}function Gy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"4 14 10 14 10 20"},child:[]},{tag:"polyline",attr:{points:"20 10 14 10 14 4"},child:[]},{tag:"line",attr:{x1:"14",x2:"21",y1:"10",y2:"3"},child:[]},{tag:"line",attr:{x1:"3",x2:"10",y1:"21",y2:"14"},child:[]}]})(t)}function Yy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"},child:[]},{tag:"path",attr:{d:"M20 3v4"},child:[]},{tag:"path",attr:{d:"M22 5h-4"},child:[]},{tag:"path",attr:{d:"M4 17v2"},child:[]},{tag:"path",attr:{d:"M5 18H3"},child:[]}]})(t)}function ze(t){this.content=t}ze.prototype={constructor:ze,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new ze(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new ze(n)},addToStart:function(t,e){return new ze([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new ze(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new ze(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=ze.from(t),t.size?new ze(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=ze.from(t),t.size?new ze(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=ze.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};ze.from=function(t){if(t instanceof ze)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new ze(e)};function Fm(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=Fm(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function Im(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),a=e.child(--s),u=o.nodeSize;if(o==a){n-=u,r-=u;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let l=0,c=Math.min(o.text.length,a.text.length);for(;l<c&&o.text[o.text.length-l-1]==a.text[a.text.length-l-1];)l++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let l=Im(o.content,a.content,n-1,r-1);if(l)return l}n-=u,r-=u}}class A{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,a=0;a<n;o++){let u=this.content[o],l=a+u.nodeSize;if(l>e&&r(u,i+a,s||null,o)!==!1&&u.content.size){let c=a+1;u.nodesBetween(Math.max(0,e-c),Math.min(u.content.size,n-c),r,i+c)}a=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(a,u)=>{let l=a.isText?a.text.slice(Math.max(e,u)-u,n-u):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&l||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=l},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new A(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let a=this.content[s],u=o+a.nodeSize;u>e&&((o<e||u>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),i+=a.nodeSize),o=u}return new A(r,i)}cutByIndex(e,n){return e==n?A.empty:e==0&&n==this.content.length?this:new A(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new A(i,s)}addToStart(e){return new A([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new A(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return Fm(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Im(this,e,n,r)}findIndex(e){if(e==0)return Ns(0,e);if(e==this.size)return Ns(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?Ns(n+1,s):Ns(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return A.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new A(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return A.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new A(n||e,r)}static from(e){if(!e)return A.empty;if(e instanceof A)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new A([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}A.empty=new A([],0);const ku={index:0,offset:0};function Ns(t,e){return ku.index=t,ku.offset=e,ku}function Ro(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Ro(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Ro(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let ie=class Ul{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ro(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ul.none;if(e instanceof Ul)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};ie.none=[];class No extends Error{}class R{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Lm(this.content,e+this.openStart,n);return r&&new R(r,this.openStart,this.openEnd)}removeBetween(e,n){return new R(Pm(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return R.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new R(A.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new R(e,r,i)}}R.empty=new R(A.empty,0,0);function Pm(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(i==e||s.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(Pm(s.content,e-i-1,n-i-1)))}function Lm(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=Lm(o.content,e-s-1,n,o);return a&&t.replaceChild(i,o.copy(a))}function Zy(t,e,n){if(n.openStart>t.depth)throw new No("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new No("Inconsistent open depths");return Bm(t,e,n,0)}function Bm(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=Bm(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return cr(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Xy(n,t);return cr(s,zm(t,o,a,e,r))}else return cr(s,Fo(t,e,r))}function $m(t,e){if(!e.type.compatibleContent(t.type))throw new No("Cannot join "+e.type.name+" onto "+t.type.name)}function Kl(t,e,n){let r=t.node(n);return $m(r,e.node(n)),r}function lr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Li(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(lr(t.nodeAfter,r),s++));for(let a=s;a<o;a++)lr(i.child(a),r);e&&e.depth==n&&e.textOffset&&lr(e.nodeBefore,r)}function cr(t,e){return t.type.checkContent(e),t.copy(e)}function zm(t,e,n,r,i){let s=t.depth>i&&Kl(t,e,i+1),o=r.depth>i&&Kl(n,r,i+1),a=[];return Li(null,t,i,a),s&&o&&e.index(i)==n.index(i)?($m(s,o),lr(cr(s,zm(t,e,n,r,i+1)),a)):(s&&lr(cr(s,Fo(t,e,i+1)),a),Li(e,n,i,a),o&&lr(cr(o,Fo(n,r,i+1)),a)),Li(r,null,i,a),new A(a)}function Fo(t,e,n){let r=[];if(Li(null,t,n,r),t.depth>n){let i=Kl(t,e,n+1);lr(cr(i,Fo(t,e,n+1)),r)}return Li(e,null,n,r),new A(r)}function Xy(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(A.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Xi{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return ie.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Io(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:a,offset:u}=o.content.findIndex(s),l=s-u;if(r.push(o,a,i+u),!l||(o=o.child(a),o.isText))break;s=l-1,i+=u+1}return new Xi(n,r,s)}static resolveCached(e,n){let r=nf.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else nf.set(e,r=new Qy);let i=r.elts[r.i]=Xi.resolve(e,n);return r.i=(r.i+1)%e_,i}}class Qy{constructor(){this.elts=[],this.i=0}}const e_=12,nf=new WeakMap;class Io{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const t_=Object.create(null);let zn=class Jl{constructor(e,n,r,i=ie.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||A.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Ro(this.attrs,n||e.defaultAttrs||t_)&&ie.sameSet(this.marks,r||ie.none)}copy(e=null){return e==this.content?this:new Jl(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Jl(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return R.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),a=i.start(o),l=i.node(o).content.cut(i.pos-a,s.pos-a);return new R(l,i.depth-o,s.depth-o)}replace(e,n,r){return Zy(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return Xi.resolveCached(this,e)}resolveNoCache(e){return Xi.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Hm(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=A.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let u=i;u<s;u++)if(!this.type.allowsMarks(r.child(u).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ie.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ie.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=A.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};zn.prototype.text=void 0;class Po extends zn{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Hm(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Po(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Po(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Hm(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class gr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new n_(e,n);if(r.next==null)return gr.empty;let i=jm(r);r.next&&r.err("Unexpected trailing text");let s=l_(u_(i));return c_(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,a){let u=o.matchFragment(e,r);if(u&&(!n||u.validEnd))return A.from(a.map(l=>l.createAndFill()));for(let l=0;l<o.next.length;l++){let{type:c,next:d}=o.next[l];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let h=s(d,a.concat(c));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:u}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||u.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
|
|
3
|
-
`)}}gr.empty=new gr(!0);class n_{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function jm(t){let e=[];do e.push(r_(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function r_(t){let e=[];do e.push(i_(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function i_(t){let e=a_(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=s_(t,e);else break;return e}function rf(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function s_(t,e){let n=rf(t),r=n;return t.eat(",")&&(t.next!="}"?r=rf(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function o_(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function a_(t){if(t.eat("(")){let e=jm(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=o_(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function u_(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,u){let l={term:u,to:a};return e[o].push(l),l}function i(o,a){o.forEach(u=>u.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((u,l)=>u.concat(s(l,a)),[]);if(o.type=="seq")for(let u=0;;u++){let l=s(o.exprs[u],a);if(u==o.exprs.length-1)return l;i(l,a=n())}else if(o.type=="star"){let u=n();return r(a,u),i(s(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return i(s(o.expr,a),u),i(s(o.expr,u),u),[r(u)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let u=a;for(let l=0;l<o.min;l++){let c=n();i(s(o.expr,u),c),u=c}if(o.max==-1)i(s(o.expr,u),u);else for(let l=o.min;l<o.max;l++){let c=n();r(u,c),i(s(o.expr,u),c),u=c}return[r(u)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Vm(t,e){return e-t}function sf(t,e){let n=[];return r(e),n.sort(Vm);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:a,to:u}=s[o];!a&&n.indexOf(u)==-1&&r(u)}}}function l_(t){let e=Object.create(null);return n(sf(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:a,to:u})=>{if(!a)return;let l;for(let c=0;c<i.length;c++)i[c][0]==a&&(l=i[c][1]);sf(t,u).forEach(c=>{l||i.push([a,l=[]]),l.indexOf(c)==-1&&l.push(c)})})});let s=e[r.join(",")]=new gr(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(Vm);s.next.push({type:i[o][0],next:e[a.join(",")]||n(a)})}return s}}function c_(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:u,next:l}=i.next[a];o.push(u.name),s&&!(u.isText||u.hasRequiredAttrs())&&(s=!1),r.indexOf(l)==-1&&r.push(l)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function qm(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Wm(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function Um(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let s=t[i];s.validate&&s.validate(e[i])}}function Km(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new h_(t,r,e[r]);return n}let of=class Jm{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Km(e,r.attrs),this.defaultAttrs=qm(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==gr.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Wm(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new zn(this,this.computeAttrs(e),A.from(n),ie.setFrom(r))}createChecked(e=null,n,r){return n=A.from(n),this.checkContent(n),new zn(this,this.computeAttrs(e),n,ie.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=A.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(A.empty,!0);return s?new zn(this,e,n.append(s),ie.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Um(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:ie.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new Jm(s,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function d_(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class h_{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?d_(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ma{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=Km(e,i.attrs),this.excluded=null;let s=qm(this.attrs);this.instance=s?new ie(this,s):null}create(e=null){return!e&&this.instance?this.instance:new ie(this,Wm(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Ma(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Um(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Xc{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=ze.from(e.nodes),n.marks=ze.from(e.marks||{}),this.nodes=of.compile(this.spec.nodes,this),this.marks=Ma.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=gr.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?af(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:af(this,o.split(" "))}this.nodeFromJSON=i=>zn.fromJSON(this,i),this.markFromJSON=i=>ie.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof of){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new Po(r,r.defaultAttrs,e,ie.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function af(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let a in t.marks){let u=t.marks[a];(i=="_"||u.spec.group&&u.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=u)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function f_(t){return t.tag!=null}function p_(t){return t.style!=null}class gn{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(f_(i))this.tags.push(i);else if(p_(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new lf(this,n,!1);return r.addAll(e,ie.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new lf(this,n,!0);return r.addAll(e,ie.none,n.from,n.to),R.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(b_(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let u=o.getAttrs(n);if(u===!1)continue;o.attrs=u||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=cf(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=cf(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new gn(e,gn.schemaRules(e)))}}const Gm={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},m_={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ym={ol:!0,ul:!0},Qi=1,Gl=2,Bi=4;function uf(t,e,n){return e!=null?(e?Qi:0)|(e==="full"?Gl:0):t&&t.whitespace=="pre"?Qi|Gl:n&~Bi}class Fs{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=ie.none,this.match=s||(o&Bi?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(A.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Qi)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=A.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(A.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Gm.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class lf{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,o=uf(null,n.preserveWhitespace,0)|(r?Bi:0);i?s=new Fs(i.type,i.attrs,ie.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new Fs(null,null,ie.none,!0,null,o):s=new Fs(e.schema.topNodeType,null,ie.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&Gl?"full":this.localPreserveWS||(i.options&Qi)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
|
|
4
|
-
`);else if(
|
|
5
|
-
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let a=void 0;;){let u=this.parser.matchStyle(s,o,this,a);if(!u)break;if(u.ignore)return null;if(u.clearMark?n=n.filter(l=>!u.clearMark(l)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)a=u;else break}}return n}addElementByRule(e,n,r,i){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let u=this.enter(o,n.attrs||null,r,n.preserveWhitespace);u&&(s=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}s&&this.sync(a)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let o=this.open,a=0;o>=0;o--){let u=this.nodes[o],l=u.findWrapping(e);if(l&&(!i||i.length>l.length+a)&&(i=l,s=u,!l.length))break;if(u.solid){if(r)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)n=this.enterInner(i[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=ie.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):df(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=uf(e,s,o.options);o.options&Bi&&o.content.length==0&&(a|=Bi);let u=ie.none;return r=r.filter(l=>(o.type?o.type.allowsMarkType(l.type):df(l.type,e))?(u=l.addToSet(u),!1):!0),this.nodes.push(new Fs(e,n,u,i,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Qi)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(a,u)=>{for(;a>=0;a--){let l=n[a];if(l==""){if(a==n.length-1||a==0)continue;for(;u>=s;u--)if(o(a-1,u))return!0;return!1}else{let c=u>0||u==0&&i?this.nodes[u].type:r&&u>=s?r.node(u-s).type:null;if(!c||c.name!=l&&!c.isInGroup(l))return!1;u--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function g_(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Ym.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function b_(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function cf(t){let e={};for(let n in t)e[n]=t[n];return e}function df(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=a=>{s.push(a);for(let u=0;u<a.edgeCount;u++){let{type:l,next:c}=a.edge(u);if(l==e||s.indexOf(c)<0&&o(c))return!0}};if(o(i.contentMatch))return!0}}class wr{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=wu(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,u=0;for(;a<s.length&&u<o.marks.length;){let l=o.marks[u];if(!this.marks[l.type.name]){u++;continue}if(!l.eq(s[a][0])||l.type.spec.spanning===!1)break;a++,u++}for(;a<s.length;)i=s.pop()[1];for(;u<o.marks.length;){let l=o.marks[u++],c=this.serializeMark(l,o.isInline,n);c&&(s.push([l,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=to(wu(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&to(wu(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return to(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new wr(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=hf(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return hf(e.marks)}}function hf(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function wu(t){return t.document||window.document}const ff=new WeakMap;function v_(t){let e=ff.get(t);return e===void 0&&ff.set(t,e=y_(t)),e}function y_(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function to(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=v_(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let a,u=n?t.createElementNS(n,i):t.createElement(i),l=e[1],c=1;if(l&&typeof l=="object"&&l.nodeType==null&&!Array.isArray(l)){c=2;for(let d in l)if(l[d]!=null){let h=d.indexOf(" ");h>0?u.setAttributeNS(d.slice(0,h),d.slice(h+1),l[d]):d=="style"&&u.style?u.style.cssText=l[d]:u.setAttribute(d,l[d])}}for(let d=c;d<e.length;d++){let h=e[d];if(h===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:f,contentDOM:p}=to(t,h,n,r);if(u.appendChild(f),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:u,contentDOM:a}}const Zm=65535,Xm=Math.pow(2,16);function __(t,e){return t+e*Xm}function pf(t){return t&Zm}function x_(t){return(t-(t&Zm))/Xm}const Qm=1,eg=2,no=4,tg=8;class Yl{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&tg)>0}get deletedBefore(){return(this.delInfo&(Qm|no))>0}get deletedAfter(){return(this.delInfo&(eg|no))>0}get deletedAcross(){return(this.delInfo&no)>0}}class dt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&dt.empty)return dt.empty}recover(e){let n=0,r=pf(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+x_(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let u=this.ranges[a]-(this.inverted?i:0);if(u>e)break;let l=this.ranges[a+s],c=this.ranges[a+o],d=u+l;if(e<=d){let h=l?e==u?-1:e==d?1:n:n,f=u+i+(h<0?0:c);if(r)return f;let p=e==(n<0?u:d)?null:__(a/3,e-u),m=e==u?eg:e==d?Qm:no;return(n<0?e!=u:e!=d)&&(m|=tg),new Yl(f,m,p)}i+=c-l}return r?e+i:new Yl(e+i,0,null)}touches(e,n){let r=0,i=pf(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let u=this.ranges[a]-(this.inverted?r:0);if(u>e)break;let l=this.ranges[a+s],c=u+l;if(e<=c&&a==i*3)return!0;r+=this.ranges[a+o]-l}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),u=o+(this.inverted?0:s),l=this.ranges[i+n],c=this.ranges[i+r];e(a,a+l,u,u+c),s+=c-l}}invert(){return new dt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?dt.empty:new dt(e<0?[0,-e,0]:[0,0,e])}}dt.empty=new dt([]);class es{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new es(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new es;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,n);if(a.recover!=null){let u=this.getMirror(s);if(u!=null&&u>s&&u<this.to){s=u,e=this._maps[u].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new Yl(e,i,null)}}const Cu=Object.create(null);class Ze{getMap(){return dt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Cu[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Cu)throw new RangeError("Duplicate use of step JSON ID "+e);return Cu[e]=n,n.prototype.jsonID=e,n}}class Me{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Me(e,null)}static fail(e){return new Me(null,e)}static fromReplace(e,n,r,i){try{return Me.ok(e.replace(n,r,i))}catch(s){if(s instanceof No)return Me.fail(s.message);throw s}}}function Qc(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(Qc(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return A.fromArray(r)}class Pn extends Ze{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new R(Qc(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Me.fromReplace(e,this.from,this.to,s)}invert(){return new Wt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Pn(n.pos,r.pos,this.mark)}merge(e){return e instanceof Pn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Pn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Pn(n.from,n.to,e.markFromJSON(n.mark))}}Ze.jsonID("addMark",Pn);class Wt extends Ze{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new R(Qc(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Me.fromReplace(e,this.from,this.to,r)}invert(){return new Pn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Wt(n.pos,r.pos,this.mark)}merge(e){return e instanceof Wt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Wt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Wt(n.from,n.to,e.markFromJSON(n.mark))}}Ze.jsonID("removeMark",Wt);class Ln extends Ze{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Me.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Me.fromReplace(e,this.pos,this.pos+1,new R(A.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Ln(this.pos,n.marks[i]);return new Ln(this.pos,this.mark)}}return new br(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ln(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ln(n.pos,e.markFromJSON(n.mark))}}Ze.jsonID("addNodeMark",Ln);class br extends Ze{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Me.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Me.fromReplace(e,this.pos,this.pos+1,new R(A.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Ln(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new br(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new br(n.pos,e.markFromJSON(n.mark))}}Ze.jsonID("removeNodeMark",br);class Se extends Ze{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Zl(e,this.from,this.to)?Me.fail("Structure replace would overwrite content"):Me.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new dt([this.from,this.to-this.from,this.slice.size])}invert(e){return new Se(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&Se.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Se(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Se)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?R.empty:new R(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Se(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?R.empty:new R(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Se(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Se(n.from,n.to,R.fromJSON(e,n.slice),!!n.structure)}}Se.MAP_BIAS=1;Ze.jsonID("replace",Se);class Ie extends Ze{constructor(e,n,r,i,s,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Zl(e,this.from,this.gapFrom)||Zl(e,this.gapTo,this.to)))return Me.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Me.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Me.fromReplace(e,this.from,this.to,r):Me.fail("Content does not fit in gap")}getMap(){return new dt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Ie(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new Ie(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ie(n.from,n.to,n.gapFrom,n.gapTo,R.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ze.jsonID("replaceAround",Ie);function Zl(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function k_(t,e,n,r){let i=[],s=[],o,a;t.doc.nodesBetween(e,n,(u,l,c)=>{if(!u.isInline)return;let d=u.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let h=Math.max(l,e),f=Math.min(l+u.nodeSize,n),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==h&&o.mark.eq(d[m])?o.to=f:i.push(o=new Wt(h,f,d[m])));a&&a.to==h?a.to=f:s.push(a=new Pn(h,f,r))}}),i.forEach(u=>t.step(u)),s.forEach(u=>t.step(u))}function w_(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;s++;let u=null;if(r instanceof Ma){let l=o.marks,c;for(;c=r.isInSet(l);)(u||(u=[])).push(c),l=c.removeFromSet(l)}else r?r.isInSet(o.marks)&&(u=[r]):u=o.marks;if(u&&u.length){let l=Math.min(a+o.nodeSize,n);for(let c=0;c<u.length;c++){let d=u[c],h;for(let f=0;f<i.length;f++){let p=i[f];p.step==s-1&&d.eq(i[f].style)&&(h=p)}h?(h.to=l,h.step=s):i.push({style:d,from:Math.max(a,e),to:l,step:s})}}}),i.forEach(o=>t.step(new Wt(o.from,o.to,o.style)))}function ed(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],a=e+1;for(let u=0;u<s.childCount;u++){let l=s.child(u),c=a+l.nodeSize,d=r.matchType(l.type);if(!d)o.push(new Se(a,c,R.empty));else{r=d;for(let h=0;h<l.marks.length;h++)n.allowsMarkType(l.marks[h].type)||t.step(new Wt(a,c,l.marks[h]));if(i&&l.isText&&n.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(l.text);)p||(p=new R(A.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),o.push(new Se(a+h.index,a+h.index+h[0].length,p))}}a=c}if(!r.validEnd){let u=r.fillBefore(A.empty,!0);t.replace(a,a,new R(u,0,0))}for(let u=o.length-1;u>=0;u--)t.step(o[u])}function C_(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function ui(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),a=t.$from.index(r)+i,u=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(a,u,n))return r;if(r==0||o.type.spec.isolating||!C_(o,a,u))break;a&&(i=1),u<o.childCount&&(s=1)}return null}function E_(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),u=o,l=a,c=A.empty,d=0;for(let p=s,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,c=A.from(r.node(p).copy(c)),d++):u--;let h=A.empty,f=0;for(let p=s,m=!1;p>n;p--)m||i.after(p+1)<i.end(p)?(m=!0,h=A.from(i.node(p).copy(h)),f++):l++;t.step(new Ie(u,l,o,a,new R(c.append(h),d,f),c.size-d,!0))}function td(t,e,n=null,r=t){let i=S_(t,e),s=i&&A_(r,e);return s?i.map(mf).concat({type:e,attrs:n}).concat(s.map(mf)):null}function mf(t){return{type:t,attrs:null}}function S_(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function A_(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let u=(o.length?o[o.length-1]:e).contentMatch;for(let l=r;u&&l<i;l++)u=u.matchType(n.child(l).type);return!u||!u.validEnd?null:o}function M_(t,e,n){let r=A.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=A.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new Ie(i,s,i,s,new R(r,0,0),n.length,!0))}function T_(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let u=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,u)&&D_(t.doc,t.mapping.slice(s).map(a),r)){let l=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!p?l=!1:!f&&p&&(l=!0)}l===!1&&rg(t,o,a,s),ed(t,t.mapping.slice(s).map(a,1),r,void 0,l===null);let c=t.mapping.slice(s),d=c.map(a,1),h=c.map(a+o.nodeSize,1);return t.step(new Ie(d,h,d+1,h-1,new R(A.from(r.create(u,null,o.marks)),0,0),1,!0)),l===!0&&ng(t,o,a,s),!1}})}function ng(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let u=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function rg(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
|
|
6
|
-
`))}})}function D_(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function O_(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Ie(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new R(A.from(o),0,0),1,!0))}function bn(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let l=i.depth-1,c=n-2;l>s;l--,c--){let d=i.node(l),h=i.index(l);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(h,d.childCount),p=r&&r[c+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[c]||d;if(!d.canReplace(h+1,d.childCount)||!m.type.validContent(f))return!1}let a=i.indexAfter(s),u=r&&r[0];return i.node(s).canReplaceWith(a,a,u?u.type:i.node(s+1).type)}function R_(t,e,n=1,r){let i=t.doc.resolve(e),s=A.empty,o=A.empty;for(let a=i.depth,u=i.depth-n,l=n-1;a>u;a--,l--){s=A.from(i.node(a).copy(s));let c=r&&r[l];o=A.from(c?c.type.create(c.attrs,o):i.node(a).copy(o))}t.step(new Se(e,e,new R(s.append(o),n,n),!0))}function Un(t,e){let n=t.resolve(e),r=n.index();return ig(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function N_(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function ig(t,e){return!!(t&&e&&!t.isLeaf&&N_(t,e))}function Ta(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&ig(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function F_(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let c=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);c&&!d?r=!1:!c&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let c=t.doc.resolve(e+n);rg(t,c.node(),c.before(),a)}o.inlineContent&&ed(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let u=t.mapping.slice(a),l=u.map(e-n);if(t.step(new Se(l,u.map(e+n,-1),R.empty,!0)),r===!0){let c=t.doc.resolve(l);ng(t,c.node(),c.before(),t.steps.length)}return t}function I_(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function sg(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,u=r.index(o)+(a>0?1:0),l=r.node(o),c=!1;if(s==1)c=l.canReplace(u,u,i);else{let d=l.contentMatchAt(u).findWrapping(i.firstChild.type);c=d&&l.canReplaceWith(u,u,d[0])}if(c)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function Da(t,e,n=e,r=R.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return og(i,s,r)?new Se(e,n,r):new P_(i,s,r).fit()}function og(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class P_{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=A.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=A.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let l=this.findFittable();l?this.placeNodes(l):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let u=new R(s,o,a);return e>-1?new Ie(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new Se(r.pos,i.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Eu(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:u,match:l}=this.frontier[a],c,d=null;if(n==1&&(o?l.matchType(o.type)||(d=l.fillBefore(A.from(o),!1)):s&&u.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:d};if(n==2&&o&&(c=l.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:c};if(s&&l.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Eu(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new R(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Eu(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new R(Mi(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new R(Mi(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,a=r?r.content:o.content,u=o.openStart-e,l=0,c=[],{match:d,type:h}=this.frontier[n];if(i){for(let m=0;m<i.childCount;m++)c.push(i.child(m));d=d.matchFragment(i)}let f=a.size+e-(o.content.size-o.openEnd);for(;l<a.childCount;){let m=a.child(l),g=d.matchType(m.type);if(!g)break;l++,(l>1||u==0||m.content.size)&&(d=g,c.push(ag(m.mark(h.allowedMarks(m.marks)),l==1?u:0,l==a.childCount?f:-1)))}let p=l==a.childCount;p||(f=-1),this.placed=Ti(this.placed,n,A.from(c)),this.frontier[n].match=d,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<f;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=p?e==0?R.empty:new R(Mi(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new R(Mi(o.content,e,l),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Su(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=Su(e,n,i,r,s);if(o){for(let a=n-1;a>=0;a--){let{match:u,type:l}=this.frontier[a],c=Su(e,a,l,u,!0);if(!c||c.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Ti(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Ti(this.placed,this.depth,A.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(A.empty,!0);n.childCount&&(this.placed=Ti(this.placed,this.frontier.length,n))}}function Mi(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Mi(t.firstChild.content,e-1,n)))}function Ti(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Ti(t.lastChild.content,e-1,n)))}function Eu(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function ag(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,ag(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(A.empty,!0)))),t.copy(r)}function Su(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!L_(n,s.content,o)?a:null}function L_(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function B_(t){return t.spec.defining||t.spec.definingForContent}function $_(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(og(i,s,r))return t.step(new Se(e,n,r));let o=lg(i,s);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let h=i.depth,f=i.pos-1;h>0;h--,f--){let p=i.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(h)>-1?a=h:i.before(h)==f&&o.splice(1,0,-h)}let u=o.indexOf(a),l=[],c=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(l.push(p),f==r.openStart)break;h=p.content}for(let h=c-1;h>=0;h--){let f=l[h],p=B_(f.type);if(p&&!f.sameMarkup(i.node(Math.abs(a)-1)))c=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+c+1)%(r.openStart+1),p=l[f];if(p)for(let m=0;m<o.length;m++){let g=o[(m+u)%o.length],b=!0;g<0&&(b=!1,g=-g);let v=i.node(g-1),_=i.index(g-1);if(v.canReplaceWith(_,_,p.type,p.marks))return t.replace(i.before(g),b?s.after(g):n,new R(ug(r.content,0,r.openStart,f),f,r.openEnd))}}let d=t.steps.length;for(let h=o.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>d));h--){let f=o[h];f<0||(e=i.before(f),n=s.after(f))}}function ug(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(ug(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(A.empty,!0))}return t}function z_(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=I_(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new R(A.from(r),0,0))}function H_(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(n),a=!1;for(let u=r.depth;u>o;u--)r.node(u).type.spec.isolating&&(a=!0);for(let u=i.depth;u>o;u--)i.node(u).type.spec.isolating&&(a=!0);if(!a){for(let u=r.depth;u>0&&e==r.start(u);u--)e=r.before(u);for(let u=i.depth;u>0&&n==i.start(u);u--)n=i.before(u);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let s=lg(r,i);for(let o=0;o<s.length;o++){let a=s[o],u=o==s.length-1;if(u&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(u||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function lg(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class Kr extends Ze{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Me.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Me.fromReplace(e,this.pos,this.pos+1,new R(A.from(i),0,n.isLeaf?0:1))}getMap(){return dt.empty}invert(e){return new Kr(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Kr(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Kr(n.pos,n.attr,n.value)}}Ze.jsonID("attr",Kr);class ts extends Ze{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Me.ok(r)}getMap(){return dt.empty}invert(e){return new ts(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new ts(n.attr,n.value)}}Ze.jsonID("docAttr",ts);let ti=class extends Error{};ti=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};ti.prototype=Object.create(Error.prototype);ti.prototype.constructor=ti;ti.prototype.name="TransformError";class nd{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new es}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new ti(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,o,a,u)=>{e=Math.min(e,a),n=Math.max(n,u)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=R.empty){let i=Da(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new R(A.from(r),0,0))}delete(e,n){return this.replace(e,n,R.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return $_(this,e,n,r),this}replaceRangeWith(e,n,r){return z_(this,e,n,r),this}deleteRange(e,n){return H_(this,e,n),this}lift(e,n){return E_(this,e,n),this}join(e,n=1){return F_(this,e,n),this}wrap(e,n){return M_(this,e,n),this}setBlockType(e,n=e,r,i=null){return T_(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return O_(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new Kr(e,n,r)),this}setDocAttribute(e,n){return this.step(new ts(e,n)),this}addNodeMark(e,n){return this.step(new Ln(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof ie)n.isInSet(r.marks)&&this.step(new br(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new br(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,n=1,r){return R_(this,e,n,r),this}addMark(e,n,r){return k_(this,e,n,r),this}removeMark(e,n,r){return w_(this,e,n,r),this}clearIncompatible(e,n,r){return ed(this,e,n,r),this}}const Au=Object.create(null);class q{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new cg(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=R.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:u,$to:l}=o[a],c=e.mapping.slice(s);e.replaceRange(c.map(u.pos),c.map(l.pos),a?R.empty:n),a==0&&vf(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],u=e.mapping.slice(r),l=u.map(o.pos),c=u.map(a.pos);s?e.deleteRange(l,c):(e.replaceRangeWith(l,c,n),vf(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new H(e):Lr(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?Lr(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Lr(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new mt(e.node(0))}static atStart(e){return Lr(e,e,0,0,1)||new mt(e)}static atEnd(e){return Lr(e,e,e.content.size,e.childCount,-1)||new mt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Au[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Au)throw new RangeError("Duplicate use of selection JSON ID "+e);return Au[e]=n,n.prototype.jsonID=e,n}getBookmark(){return H.between(this.$anchor,this.$head).getBookmark()}}q.prototype.visible=!0;class cg{constructor(e,n){this.$from=e,this.$to=n}}let gf=!1;function bf(t){!gf&&!t.parent.inlineContent&&(gf=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class H extends q{constructor(e,n=e){bf(e),bf(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return q.near(r);let i=e.resolve(n.map(this.anchor));return new H(i.parent.inlineContent?i:r,r)}replace(e,n=R.empty){if(super.replace(e,n),n==R.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof H&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Oa(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new H(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=q.findFrom(n,r,!0)||q.findFrom(n,-r,!0);if(s)n=s.$head;else return q.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(q.findFrom(e,-r,!0)||q.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new H(e,n)}}q.jsonID("text",H);class Oa{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Oa(e.map(this.anchor),e.map(this.head))}resolve(e){return H.between(e.resolve(this.anchor),e.resolve(this.head))}}class z extends q{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?q.near(s):new z(s)}content(){return new R(A.from(this.node),0,0)}eq(e){return e instanceof z&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new rd(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new z(e.resolve(n.anchor))}static create(e,n){return new z(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}z.prototype.visible=!1;q.jsonID("node",z);class rd{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Oa(r,r):new rd(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&z.isSelectable(r)?new z(n):q.near(n)}}class mt extends q{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=R.empty){if(n==R.empty){e.delete(0,e.doc.content.size);let r=q.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new mt(e)}map(e){return new mt(e)}eq(e){return e instanceof mt}getBookmark(){return j_}}q.jsonID("all",mt);const j_={map(){return this},resolve(t){return new mt(t)}};function Lr(t,e,n,r,i,s=!1){if(e.inlineContent)return H.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&z.isSelectable(a))return z.create(t,n-(i<0?a.nodeSize:0))}else{let u=Lr(t,a,n+i,i<0?a.childCount:0,i,s);if(u)return u}n+=a.nodeSize*i}return null}function vf(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Se||i instanceof Ie))return;let s=t.mapping.maps[r],o;s.forEach((a,u,l,c)=>{o==null&&(o=c)}),t.setSelection(q.near(t.doc.resolve(o),n))}const yf=1,Is=2,_f=4;class V_ extends nd{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|yf)&~Is,this.storedMarks=null,this}get selectionSet(){return(this.updated&yf)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Is,this}ensureMarks(e){return ie.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Is)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Is,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ie.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(q.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=_f,this}get scrolledIntoView(){return(this.updated&_f)>0}}function xf(t,e){return!e||!t?t:t.bind(e)}class Di{constructor(e,n,r){this.name=e,this.init=xf(n.init,r),this.apply=xf(n.apply,r)}}const q_=[new Di("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Di("selection",{init(t,e){return t.selection||q.atStart(e.doc)},apply(t){return t.selection}}),new Di("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Di("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Mu{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=q_.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Di(r.key,r.spec.state,r))})}}class Vr{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let u=i?i[o].n:0,l=i?i[o].state:this,c=u<n.length&&a.spec.appendTransaction.call(a,u?n.slice(u):n,l,r);if(c&&r.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(c),r=r.applyInner(c),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Vr(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new V_(this)}static create(e){let n=new Mu(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Vr(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Mu(this.schema,e.plugins),r=n.fields,i=new Vr(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Mu(e.schema,e.plugins),s=new Vr(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=zn.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=q.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let u=r[a],l=u.spec.state;if(u.key==o.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){s[o.name]=l.fromJSON.call(u,e,n[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function dg(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=dg(i,e,{})),n[r]=i}return n}class we{constructor(e){this.spec=e,this.props={},e.props&&dg(e.props,this,this.props),this.key=e.key?e.key.key:hg("plugin")}getState(e){return e[this.key]}}const Tu=Object.create(null);function hg(t){return t in Tu?t+"$"+ ++Tu[t]:(Tu[t]=0,t+"$")}class $e{constructor(e="key"){this.key=hg(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ve=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ni=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Xl=null;const cn=function(t,e,n){let r=Xl||(Xl=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},W_=function(){Xl=null},vr=function(t,e,n,r){return n&&(kf(t,e,n,r,-1)||kf(t,e,n,r,1))},U_=/^(img|br|input|textarea|hr)$/i;function kf(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Et(t))){let o=t.parentNode;if(!o||o.nodeType!=1||gs(t)||U_.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ve(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Et(t):0}else return!1}}function Et(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function K_(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Et(t)}else if(t.parentNode&&!gs(t))e=Ve(t),t=t.parentNode;else return null}}function J_(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!gs(t))e=Ve(t)+1,t=t.parentNode;else return null}}function G_(t,e,n){for(let r=e==0,i=e==Et(t);r||i;){if(t==n)return!0;let s=Ve(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Et(t)}}function gs(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Ra=function(t){return t.focusNode&&vr(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function nr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Y_(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Z_(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Et(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Et(r.startContainer),r.startOffset)}}}const Jt=typeof navigator<"u"?navigator:null,wf=typeof document<"u"?document:null,Kn=Jt&&Jt.userAgent||"",Ql=/Edge\/(\d+)/.exec(Kn),fg=/MSIE \d/.exec(Kn),ec=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Kn),ut=!!(fg||ec||Ql),Hn=fg?document.documentMode:ec?+ec[1]:Ql?+Ql[1]:0,At=!ut&&/gecko\/(\d+)/i.test(Kn);At&&+(/Firefox\/(\d+)/.exec(Kn)||[0,0])[1];const tc=!ut&&/Chrome\/(\d+)/.exec(Kn),We=!!tc,pg=tc?+tc[1]:0,Ge=!ut&&!!Jt&&/Apple Computer/.test(Jt.vendor),ri=Ge&&(/Mobile\/\w+/.test(Kn)||!!Jt&&Jt.maxTouchPoints>2),wt=ri||(Jt?/Mac/.test(Jt.platform):!1),mg=Jt?/Win/.test(Jt.platform):!1,pn=/Android \d/.test(Kn),bs=!!wf&&"webkitFontSmoothing"in wf.documentElement.style,X_=bs?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Q_(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function rn(t,e){return typeof t=="number"?t:t[e]}function ex(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Cf(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=ni(o);continue}let a=o,u=a==s.body,l=u?Q_(s):ex(a),c=0,d=0;if(e.top<l.top+rn(r,"top")?d=-(l.top-e.top+rn(i,"top")):e.bottom>l.bottom-rn(r,"bottom")&&(d=e.bottom-e.top>l.bottom-l.top?e.top+rn(i,"top")-l.top:e.bottom-l.bottom+rn(i,"bottom")),e.left<l.left+rn(r,"left")?c=-(l.left-e.left+rn(i,"left")):e.right>l.right-rn(r,"right")&&(c=e.right-l.right+rn(i,"right")),c||d)if(u)s.defaultView.scrollBy(c,d);else{let f=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);let m=a.scrollLeft-f,g=a.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let h=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:ni(o)}}function tx(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(s,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let u=a.getBoundingClientRect();if(u.top>=n-20){r=a,i=u.top;break}}return{refDOM:r,refTop:i,stack:gg(t.dom)}}function gg(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=ni(r));return e}function nx({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;bg(n,r==0?0:r-e)}function bg(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Dr=null;function rx(t){if(t.setActive)return t.setActive();if(Dr)return t.focus(Dr);let e=gg(t);t.focus(Dr==null?{get preventScroll(){return Dr={preventScroll:!0},!0}}:void 0),Dr||(Dr=!1,bg(e,0))}function vg(t,e){let n,r=2e8,i,s=0,o=e.top,a=e.top,u,l;for(let c=t.firstChild,d=0;c;c=c.nextSibling,d++){let h;if(c.nodeType==1)h=c.getClientRects();else if(c.nodeType==3)h=cn(c).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=o&&p.bottom>=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=c,r=m,i=m&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,c.nodeType==1&&m&&(s=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!u&&p.left<=e.left&&p.right>=e.left&&(u=c,l={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=d+1)}}return!n&&u&&(n=u,i=l,r=0),n&&n.nodeType==3?ix(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:vg(n,i)}function ix(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let o=Sn(r,1);if(o.top!=o.bottom&&id(e,o)){i={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function id(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function sx(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function ox(t,e,n){let{node:r,offset:i}=vg(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function ax(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let a=t.docView.nearestDesc(s,!0),u;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((u=a.dom.getBoundingClientRect()).width||u.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&u.left>r.left||u.top>r.top?i=a.posBefore:(!o&&u.right<r.left||u.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(u.top+u.bottom)/2:r.left<(u.left+u.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function yg(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let o=t.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let u=0;u<a.length;u++){let l=a[u];if(id(e,l))return yg(o,e,l)}}if((s=(s+1)%r)==i)break}return t}function ux(t,e){let n=t.dom.ownerDocument,r,i=0,s=Z_(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let l=t.dom.getBoundingClientRect();if(!id(e,l)||(o=yg(t.dom,e,l),!o))return null}if(Ge)for(let l=o;r&&l;l=ni(l))l.draggable&&(r=void 0);if(o=sx(o,e),r){if(At&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let c=r.childNodes[i],d;c.nodeName=="IMG"&&(d=c.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let l;bs&&i&&r.nodeType==1&&(l=r.childNodes[i-1]).nodeType==1&&l.contentEditable=="false"&&l.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=ax(t,r,i,e))}a==null&&(a=ox(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:a,inside:u?u.posAtStart-u.border:-1}}function Ef(t){return t.top<t.bottom||t.left<t.right}function Sn(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Ef(r))return r}return Array.prototype.find.call(n,Ef)||t.getBoundingClientRect()}const lx=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function _g(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=bs||At;if(r.nodeType==3)if(o&&(lx.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let u=Sn(cn(r,i,i),n);if(At&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let l=Sn(cn(r,i-1,i-1),-1);if(l.top==u.top){let c=Sn(cn(r,i,i+1),-1);if(c.top!=u.top)return vi(c,c.left<l.left)}}return u}else{let u=i,l=i,c=n<0?1:-1;return n<0&&!i?(l++,c=-1):n>=0&&i==r.nodeValue.length?(u--,c=1):n<0?u--:l++,vi(Sn(cn(r,u,l),c),c<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Et(r))){let u=r.childNodes[i-1];if(u.nodeType==1)return Du(u.getBoundingClientRect(),!1)}if(s==null&&i<Et(r)){let u=r.childNodes[i];if(u.nodeType==1)return Du(u.getBoundingClientRect(),!0)}return Du(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Et(r))){let u=r.childNodes[i-1],l=u.nodeType==3?cn(u,Et(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(l)return vi(Sn(l,1),!1)}if(s==null&&i<Et(r)){let u=r.childNodes[i];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let l=u?u.nodeType==3?cn(u,0,o?0:1):u.nodeType==1?u:null:null;if(l)return vi(Sn(l,-1),!0)}return vi(Sn(r.nodeType==3?cn(r):r,-n),n>=0)}function vi(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Du(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function xg(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function cx(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return xg(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=_g(t,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let u;if(a.nodeType==1)u=a.getClientRects();else if(a.nodeType==3)u=cn(a,0,a.nodeValue.length).getClientRects();else continue;for(let l=0;l<u.length;l++){let c=u[l];if(c.bottom>c.top+1&&(n=="up"?o.top-c.top>(c.bottom-o.top)*2:c.bottom-o.bottom>(o.bottom-c.top)*2))return!1}}return!0})}const dx=/[\u0590-\u08ac]/;function hx(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=t.domSelection();return a?!dx.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:o:xg(t,e,()=>{let{focusNode:u,focusOffset:l,anchorNode:c,anchorOffset:d}=t.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",n,"character");let f=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),g=p&&!f.contains(p.nodeType==1?p:p.parentNode)||u==p&&l==m;try{a.collapse(c,d),u&&(u!=c||l!=d)&&a.extend&&a.extend(u,l)}catch{}return h!=null&&(a.caretBidiLevel=h),g}):r.pos==r.start()||r.pos==r.end()}let Sf=null,Af=null,Mf=!1;function fx(t,e,n){return Sf==e&&Af==n?Mf:(Sf=e,Af=n,Mf=n=="up"||n=="down"?cx(t,e,n):hx(t,e,n))}const Mt=0,Tf=1,ir=2,Gt=3;class vs{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Mt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>Ve(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e||o instanceof wg){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof kg&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Ve(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?Ve(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,a=0;;a++){let u=this.children[a],l=o+u.size;if(i==-1&&e<=l){let c=o+u.border;if(e>=c&&n<=l-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,c);e=o;for(let d=a;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=Ve(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(l>n||a==this.children.length-1)){n=l;for(let c=a+1;c<this.children.length;c++){let d=this.children[c];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=Ve(d.dom);break}n+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=l}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let f=0,p=0;f<this.children.length;f++){let m=this.children[f],g=p+m.size;if(s>p&&o<g)return m.setSelection(e-p-m.border,n-p-m.border,r,i);p=g}let a=this.domFromPos(e,e?-1:1),u=n==e?a:this.domFromPos(n,n?-1:1),l=r.root.getSelection(),c=r.domSelectionRange(),d=!1;if((At||Ge)&&e==n){let{node:f,offset:p}=a;if(f.nodeType==3){if(d=!!(p&&f.nodeValue[p-1]==`
|
|
7
|
-
`),d&&p==f.nodeValue.length)for(let m=f,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=u={node:g.parentNode,offset:Ve(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=f.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(At&&c.focusNode&&c.focusNode!=u.node&&c.focusNode.nodeType==1){let f=c.focusNode.childNodes[c.focusOffset];f&&f.contentEditable=="false"&&(i=!0)}if(!(i||d&&Ge)&&vr(a.node,a.offset,c.anchorNode,c.anchorOffset)&&vr(u.node,u.offset,c.focusNode,c.focusOffset))return;let h=!1;if((l.extend||e==n)&&!(d&&At)){l.collapse(a.node,a.offset);try{e!=n&&l.extend(u.node,u.offset),h=!0}catch{}}if(!h){if(e>n){let p=a;a=u,u=p}let f=document.createRange();f.setEnd(u.node,u.offset),f.setStart(a.node,a.offset),l.removeAllRanges(),l.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let a=r+s.border,u=o-s.border;if(e>=a&&n<=u){this.dirty=e==r||n==o?ir:Tf,e==a&&n==u&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Gt:s.markDirty(e-a,n-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?ir:Gt}r=o}this.dirty=ir}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?ir:Tf;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class kg extends vs{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Mt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class px extends vs{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class yr extends vs{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=wr.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new yr(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Gt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Gt&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Mt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Mt}}slice(e,n,r){let i=yr.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=rc(s,n,o,r)),e>0&&(s=rc(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class jn extends vs{constructor(e,n,r,i,s,o,a,u,l){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,s,o){let a=s.nodeViews[n.type.name],u,l=a&&a(n,s,()=>{if(!u)return o;if(u.parent)return u.parent.posBeforeChild(u)},r,i),c=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:d}=wr.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let h=c;return c=Sg(c,r,n),l?u=new mx(e,n,r,i,c,d||null,h,l,s,o+1):n.isText?new Na(e,n,r,i,c,h,s):new jn(e,n,r,i,c,d||null,h,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>A.empty)}return e}matchesNode(e,n,r){return this.dirty==Mt&&e.eq(this.node)&&Lo(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,u=new bx(this,o&&o.node,e);_x(this.node,this.innerDeco,(l,c,d)=>{l.spec.marks?u.syncToMarks(l.spec.marks,r,e,c):l.type.side>=0&&!d&&u.syncToMarks(c==this.node.childCount?ie.none:this.node.child(c).marks,r,e,c),u.placeWidget(l,e,i)},(l,c,d,h)=>{u.syncToMarks(l.marks,r,e,h);let f;u.findNodeMatch(l,c,d,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+l.nodeSize&&(f=u.findIndexWithChild(s.node))>-1&&u.updateNodeAt(l,c,d,f,e)||u.updateNextNode(l,c,d,e,h,i)||u.addNode(l,c,d,e,i),i+=l.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==ir)&&(o&&this.protectLocalComposition(e,o),Cg(this.contentDOM,this.children,e),ri&&xx(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof H)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=kx(this.node.content,o,r-n,i-n);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new px(this,s,n,i);e.input.compositionNodes.push(o),this.children=rc(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==Gt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Mt}updateOuterDeco(e){if(Lo(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Eg(this.dom,this.nodeDOM,nc(this.outerDeco,this.node,n),nc(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Df(t,e,n,r,i){Sg(r,e,t);let s=new jn(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Na extends jn{constructor(e,n,r,i,s,o,a){super(e,n,r,i,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Gt||this.dirty!=Mt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Mt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Mt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new Na(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Gt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class wg extends vs{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Mt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class mx extends jn{constructor(e,n,r,i,s,o,a,u,l,c){super(e,n,r,i,s,o,a,l,c),this.spec=u}update(e,n,r,i){if(this.dirty==Gt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Cg(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=Of(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(o instanceof yr){let u=r?r.previousSibling:t.lastChild;Cg(o.contentDOM,o.children,n),r=u?u.nextSibling:t.firstChild}}for(;r;)r=Of(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const $i=function(t){t&&(this.nodeName=t)};$i.prototype=Object.create(null);const sr=[new $i];function nc(t,e,n){if(t.length==0)return sr;let r=n?sr[0]:new $i,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new $i(o.nodeName));for(let a in o){let u=o[a];u!=null&&(n&&i.length==1&&i.push(r=new $i(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+u:a=="style"?r.style=(r.style?r.style+";":"")+u:a!="nodeName"&&(r[a]=u))}}}return i}function Eg(t,e,n,r){if(n==sr&&r==sr)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],a=n[s];if(s){let u;a&&a.nodeName==o.nodeName&&i!=t&&(u=i.parentNode)&&u.nodeName.toLowerCase()==o.nodeName||(u=document.createElement(o.nodeName),u.pmIsDeco=!0,u.appendChild(i),a=sr[0]),i=u}gx(i,a||sr[0],o)}return i}function gx(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function Sg(t,e,n){return Eg(t,t,sr,nc(e,n,t.nodeType!=1))}function Lo(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Of(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class bx{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=vx(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let s=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;s<a&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=Mt,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let u=-1,l=this.top.children.length;i<this.preMatch.index&&(l=Math.min(this.index+3,l));for(let c=this.index;c<l;c++){let d=this.top.children[c];if(d.matchesMark(e[o])&&!this.isLocked(d.dom)){u=c;break}}if(u>-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let c=yr.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,u=Math.min(this.top.children.length,a+5);a<u;a++){let l=this.top.children[a];if(l.matchesNode(e,n,r)&&!this.preMatch.matched.has(l)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==Gt&&o.dom==o.contentDOM&&(o.dirty=ir),o.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let u=this.top.children[a];if(u instanceof jn){let l=this.preMatch.matched.get(u);if(l!=null&&l!=s)return!1;let c=u.dom,d,h=this.isLocked(c)&&!(e.isText&&u.node&&u.node.isText&&u.nodeDOM.nodeValue==e.text&&u.dirty!=Gt&&Lo(n,u.outerDeco));if(!h&&u.update(e,n,r,i))return this.destroyBetween(this.index,a),u.dom!=c&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(u,e,n,r,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=ir,d.updateChildren(i,o+1),d.dirty=Mt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Lo(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=jn.create(this.top,n,r,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let u of a.children)u.parent=a}return e.destroy(),a}addNode(e,n,r,i,s){let o=jn.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new kg(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof yr;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Na)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ge||We)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new wg(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function vx(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let l=n.children[r-1];if(l instanceof yr)n=l,r=l.children.length;else{a=l,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=a.node;if(u){if(u!=t.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function yx(t,e){return t.type.side-e.type.side}function _x(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let l=0;l<t.childCount;l++){let c=t.child(l);r(c,i,e.forChild(s,c),l),s+=c.nodeSize}return}let o=0,a=[],u=null;for(let l=0;;){let c,d;for(;o<i.length&&i[o].to==s;){let g=i[o++];g.widget&&(c?(d||(d=[c])).push(g):c=g)}if(c)if(d){d.sort(yx);for(let g=0;g<d.length;g++)n(d[g],l,!!u)}else n(c,l,!!u);let h,f;if(u)f=-1,h=u,u=null;else if(l<t.childCount)f=l,h=t.child(l++);else break;for(let g=0;g<a.length;g++)a[g].to<=s&&a.splice(g--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let p=s+h.nodeSize;if(h.isText){let g=p;o<i.length&&i[o].from<g&&(g=i[o].from);for(let b=0;b<a.length;b++)a[b].to<g&&(g=a[b].to);g<p&&(u=h.cut(g-s),h=h.cut(0,g-s),p=g,f=-1)}else for(;o<i.length&&i[o].to<p;)o++;let m=h.isInline&&!h.isLeaf?a.filter(g=>!g.inline):a.slice();r(h,m,e.forChild(s,h),f),s=p}}function xx(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function kx(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let u=o.text;for(;i<t.childCount;){let l=t.child(i++);if(s+=l.nodeSize,!l.isText)break;u+=l.text}if(s>=n){if(s>=r&&u.slice(r-e.length-a,r-a)==e)return r-e.length;let l=a<r?u.lastIndexOf(e,r-a-1):-1;if(l>=0&&l+e.length+a>=n)return a+l;if(n==r&&u.length>=r+e.length-a&&u.slice(r-a,r-a+e.length)==e)return r}}return-1}function rc(t,e,n,r,i){let s=[];for(let o=0,a=0;o<t.length;o++){let u=t[o],l=a,c=a+=u.size;l>=n||c<=e?s.push(u):(l<e&&s.push(u.slice(0,e-l,r)),i&&(s.push(i),i=void 0),c>n&&s.push(u.slice(n-l,u.size,r)))}return s}function sd(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),u,l;if(Ra(n)){for(u=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&z.isSelectable(d)&&i.parent&&!(d.isInline&&G_(n.focusNode,n.focusOffset,i.dom))){let h=i.posBefore;l=new z(o==h?a:r.resolve(h))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,h=o;for(let f=0;f<n.rangeCount;f++){let p=n.getRangeAt(f);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),h=Math.max(h,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[u,o]=h==t.state.selection.anchor?[h,d]:[d,h],a=r.resolve(o)}else u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null}let c=r.resolve(u);if(!l){let d=e=="pointer"||t.state.selection.head<a.pos&&!s?1:-1;l=od(t,c,a,d)}return l}function Ag(t){return t.editable?t.hasFocus():Tg(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function vn(t,e=!1){let n=t.state.selection;if(Mg(t,n),!!Ag(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&We){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&vr(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Cx(t);else{let{anchor:r,head:i}=n,s,o;Rf&&!(n instanceof H)&&(n.$from.parent.inlineContent||(s=Nf(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=Nf(t,n.to))),t.docView.setSelection(r,i,t,e),Rf&&(s&&Ff(s),o&&Ff(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&wx(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Rf=Ge||We&&pg<63;function Nf(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Ge&&i&&i.contentEditable=="false")return Ou(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Ou(i);if(s)return Ou(s)}}function Ou(t){return t.contentEditable="true",Ge&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Ff(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function wx(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Ag(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Cx(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Ve(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ut&&Hn<=11&&(n.disabled=!0,n.disabled=!1)}function Mg(t,e){if(e instanceof z){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(If(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else If(t)}function If(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function od(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||H.between(e,n,r)}function Pf(t){return t.editable&&!t.hasFocus()?!1:Tg(t)}function Tg(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Ex(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return vr(e.node,e.offset,n.anchorNode,n.anchorOffset)}function ic(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&q.findFrom(s,e)}function An(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Lf(t,e,n){let r=t.state.selection;if(r instanceof H)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return An(t,new H(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=ic(t.state,e);return i&&i instanceof z?An(t,i):!1}else if(!(wt&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?z.isSelectable(s)?An(t,new z(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):bs?An(t,new H(t.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof z&&r.node.isInline)return An(t,new H(e>0?r.$to:r.$from));{let i=ic(t.state,e);return i?An(t,i):!1}}}function Bo(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function zi(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Or(t,e){return e<0?Sx(t):Ax(t)}function Sx(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(At&&n.nodeType==1&&r<Bo(n)&&zi(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(zi(a,-1))i=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(Dg(n))break;{let a=n.previousSibling;for(;a&&zi(a,-1);)i=n.parentNode,s=Ve(a),a=a.previousSibling;if(a)n=a,r=Bo(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?sc(t,n,r):i&&sc(t,i,s)}function Ax(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Bo(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(zi(a,1))s=n,o=++r;else break}else{if(Dg(n))break;{let a=n.nextSibling;for(;a&&zi(a,1);)s=a.parentNode,o=Ve(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=Bo(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&sc(t,s,o)}function Dg(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Mx(t,e){for(;t&&e==t.childNodes.length&&!gs(t);)e=Ve(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Tx(t,e){for(;t&&!e&&!gs(t);)e=Ve(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function sc(t,e,n){if(e.nodeType!=3){let s,o;(o=Mx(e,n))?(e=o,n=0):(s=Tx(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Ra(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&vn(t)},50)}function Bf(t,e){let n=t.state.doc.resolve(e);if(!(We||mg)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function $f(t,e,n){let r=t.state.selection;if(r instanceof H&&!r.empty||n.indexOf("s")>-1||wt&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=ic(t.state,e);if(o&&o instanceof z)return An(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof mt?q.near(o,e):q.findFrom(o,e);return a?An(t,a):!1}return!1}function zf(t,e){if(!(t.state.selection instanceof H))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function Hf(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Dx(t){if(!Ge||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Hf(t,r,"true"),setTimeout(()=>Hf(t,r,"false"),20)}return!1}function Ox(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Rx(t,e){let n=e.keyCode,r=Ox(e);if(n==8||wt&&n==72&&r=="c")return zf(t,-1)||Or(t,-1);if(n==46&&!e.shiftKey||wt&&n==68&&r=="c")return zf(t,1)||Or(t,1);if(n==13||n==27)return!0;if(n==37||wt&&n==66&&r=="c"){let i=n==37?Bf(t,t.state.selection.from)=="ltr"?-1:1:-1;return Lf(t,i,r)||Or(t,i)}else if(n==39||wt&&n==70&&r=="c"){let i=n==39?Bf(t,t.state.selection.from)=="ltr"?1:-1:1;return Lf(t,i,r)||Or(t,i)}else{if(n==38||wt&&n==80&&r=="c")return $f(t,-1,r)||Or(t,-1);if(n==40||wt&&n==78&&r=="c")return Dx(t)||$f(t,1,r)||Or(t,1);if(r==(wt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function ad(t,e){t.someProp("transformCopied",f=>{e=f(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let f=r.firstChild;n.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let o=t.someProp("clipboardSerializer")||wr.fromSchema(t.state.schema),a=Pg(),u=a.createElement("div");u.appendChild(o.serializeFragment(r,{document:a}));let l=u.firstChild,c,d=0;for(;l&&l.nodeType==1&&(c=Ig[l.nodeName.toLowerCase()]);){for(let f=c.length-1;f>=0;f--){let p=a.createElement(c[f]);for(;u.firstChild;)p.appendChild(u.firstChild);u.appendChild(p),d++}l=u.firstChild}l&&l.nodeType==1&&l.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",f=>f(e,t))||e.content.textBetween(0,e.content.size,`
|
|
8
|
-
|
|
9
|
-
`)
|
|
10
|
-
`))),0,0),t.someProp("transformPasted",h=>{a=h(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",h=>h(e,i,r,t));if(d)a=d;else{let h=i.marks(),{schema:f}=t.state,p=wr.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(f.text(m,h)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=Px(n),bs&&Lx(o);let l=o&&o.querySelector("[data-pm-slice]"),c=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||gn.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||c),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Nx.test(h.parentNode.nodeName)?{ignore:!0}:null}})),c)a=Bx(jf(a,+c[1],+c[2]),c[4]);else if(a=R.maxOpen(Fx(a.content,i),!0),a.openStart||a.openEnd){let d=0,h=0;for(let f=a.content.firstChild;d<a.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=jf(a,d,h)}return t.someProp("transformPasted",d=>{a=d(a,t,u)}),a}const Nx=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Fx(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(a=>{if(!o)return;let u=i.findWrapping(a.type),l;if(!u)return o=null;if(l=o.length&&s.length&&Ng(u,s,a,o[o.length-1],0))o[o.length-1]=l;else{o.length&&(o[o.length-1]=Fg(o[o.length-1],s.length));let c=Rg(a,u);o.push(c),i=i.matchType(c.type),s=u}}),o)return A.from(o)}return t}function Rg(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,A.from(t));return t}function Ng(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=Ng(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(A.from(Rg(n,t,i+1))))}}function Fg(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Fg(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(A.empty,!0);return t.copy(n.append(r))}function oc(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(s=0),i<r-1&&(a=oc(a,e,n,r,i+1,s)),i>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(A.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function jf(t,e,n){return e<t.openStart&&(t=new R(oc(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new R(oc(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Ig={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Vf=null;function Pg(){return Vf||(Vf=document.implementation.createHTMLDocument("title"))}let Ru=null;function Ix(t){let e=window.trustedTypes;return e?(Ru||(Ru=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Ru.createHTML(t)):t}function Px(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Pg().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&Ig[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=Ix(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function Lx(t){let e=t.querySelectorAll(We?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function Bx(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let u=n.nodes[r[a]];if(!u||u.hasRequiredAttrs())break;i=A.from(u.create(r[a+1],i)),s++,o++}return new R(i,s,o)}const nt={},rt={},$x={touchstart:!0,touchmove:!0};class zx{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Hx(t){for(let e in nt){let n=nt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{Vx(t,r)&&!ud(t,r)&&(t.editable||!(r.type in rt))&&n(t,r)},$x[e]?{passive:!0}:void 0)}Ge&&t.dom.addEventListener("input",()=>null),ac(t)}function Bn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function jx(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function ac(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>ud(t,r))})}function ud(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function Vx(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function qx(t,e){!ud(t,e)&&nt[e.type]&&(t.editable||!(e.type in rt))&&nt[e.type](t,e)}rt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Bg(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(pn&&We&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ri&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,nr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Rx(t,n)?n.preventDefault():Bn(t,"key")};rt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};rt.keypress=(t,e)=>{let n=e;if(Bg(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||wt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof H)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function Fa(t){return{left:t.clientX,top:t.clientY}}function Wx(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function ld(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,a=>o>s.depth?a(t,n,s.nodeAfter,s.before(o),i,!0):a(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function Jr(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function Ux(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&z.isSelectable(r)?(Jr(t,new z(n)),!0):!1}function Kx(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof z&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(z.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(Jr(t,z.create(t.state.doc,i)),!0):!1}function Jx(t,e,n,r,i){return ld(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?Kx(t,n):Ux(t,n))}function Gx(t,e,n,r){return ld(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function Yx(t,e,n,r){return ld(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||Zx(t,n,r)}function Zx(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Jr(t,H.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)Jr(t,H.create(r,a+1,a+1+o.content.size));else if(z.isSelectable(o))Jr(t,z.create(r,a));else continue;return!0}}function cd(t){return $o(t)}const Lg=wt?"metaKey":"ctrlKey";nt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=cd(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&Wx(n,t.input.lastClick)&&!n[Lg]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(Fa(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Xx(t,o,n,!!r)):(s=="doubleClick"?Gx:Yx)(t,o.pos,o.inside,n)?n.preventDefault():Bn(t,"pointer"))};class Xx{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Lg],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let c=e.state.doc.resolve(n.pos);s=c.parent,o=c.depth?c.before():0}const a=i?null:r.target,u=a?e.docView.nearestDesc(a,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:l}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||l instanceof z&&l.from<=o&&l.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&At&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Bn(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>vn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Fa(e))),this.updateAllowDefault(e),this.allowDefault||!n?Bn(this.view,"pointer"):Jx(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ge&&this.mightDrag&&!this.mightDrag.node.isAtom||We&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Jr(this.view,q.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Bn(this.view,"pointer")}move(e){this.updateAllowDefault(e),Bn(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}nt.touchstart=t=>{t.input.lastTouch=Date.now(),cd(t),Bn(t,"pointer")};nt.touchmove=t=>{t.input.lastTouch=Date.now(),Bn(t,"pointer")};nt.contextmenu=t=>cd(t);function Bg(t,e){return t.composing?!0:Ge&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Qx=pn?5e3:-1;rt.compositionstart=rt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof H&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||We&&mg&&ek(t)))t.markCursor=t.state.storedMarks||n.marks(),$o(t,!0),t.markCursor=null;else if($o(t,!e.selection.empty),At&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let a=t.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}$g(t,Qx)};function ek(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}rt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,$g(t,20))};function $g(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>$o(t),e))}function zg(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=nk());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function tk(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=K_(e.focusNode,e.focusOffset),r=J_(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function nk(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function $o(t,e=!1){if(!(pn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),zg(t),e||t.docView&&t.docView.dirty){let n=sd(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function rk(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const ns=ut&&Hn<15||ri&&X_<604;nt.copy=rt.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=ns?null:n.clipboardData,o=r.content(),{dom:a,text:u}=ad(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",u)):rk(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function ik(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function sk(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?rs(t,r.value,null,i,e):rs(t,r.textContent,r.innerHTML,i,e)},50)}function rs(t,e,n,r,i){let s=Og(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,i,s||R.empty)))return!0;if(!s)return!1;let o=ik(s),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Hg(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}rt.paste=(t,e)=>{let n=e;if(t.composing&&!pn)return;let r=ns?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&rs(t,Hg(r),r.getData("text/html"),i,n)?n.preventDefault():sk(t,n)};class jg{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const ok=wt?"altKey":"ctrlKey";function Vg(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[ok]}nt.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Fa(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof z?i.to-1:i.to))){if(r&&r.mightDrag)o=z.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=z.create(t.state.doc,d.posBefore))}}let a=(o||t.state.selection).content(),{dom:u,text:l,slice:c}=ad(t,a);(!n.dataTransfer.files.length||!We||pg>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ns?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",ns||n.dataTransfer.setData("text/plain",l),t.dragging=new jg(c,Vg(t,n),o)};nt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};rt.dragover=rt.dragenter=(t,e)=>e.preventDefault();rt.drop=(t,e)=>{try{ak(t,e,t.dragging)}finally{t.dragging=null}};function ak(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Fa(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",f=>{s=f(s,t,!1)}):s=Og(t,Hg(e.dataTransfer),ns?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&Vg(t,e));if(t.someProp("handleDrop",f=>f(t,e,s||R.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?sg(t.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let u=t.state.tr;if(o){let{node:f}=n;f?f.replace(u):u.deleteSelection()}let l=u.mapping.map(a),c=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=u.doc;if(c?u.replaceRangeWith(l,l,s.content.firstChild):u.replaceRange(l,l,s),u.doc.eq(d))return;let h=u.doc.resolve(l);if(c&&z.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new z(h));else{let f=u.mapping.map(a);u.mapping.maps[u.mapping.maps.length-1].forEach((p,m,g,b)=>f=b),u.setSelection(od(t,h,u.doc.resolve(f)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}nt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&vn(t)},20))};nt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};nt.beforeinput=(t,e)=>{if(We&&pn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,nr(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in rt)nt[t]=rt[t];function is(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class zo{constructor(e,n){this.toDOM=e,this.spec=n||dr,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new tt(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof zo&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&is(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Vn{constructor(e,n){this.attrs=e,this.spec=n||dr}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new tt(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Vn&&is(this.attrs,e.attrs)&&is(this.spec,e.spec)}static is(e){return e.type instanceof Vn}destroy(){}}class dd{constructor(e,n){this.attrs=e,this.spec=n||dr}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new tt(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof dd&&is(this.attrs,e.attrs)&&is(this.spec,e.spec)}destroy(){}}class tt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new tt(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new tt(e,e,new zo(n,r))}static inline(e,n,r,i){return new tt(e,n,new Vn(r,i))}static node(e,n,r,i){return new tt(e,n,new dd(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Vn}get widget(){return this.type instanceof zo}}const Br=[],dr={};class ye{constructor(e,n){this.local=e.length?e:Br,this.children=n.length?n:Br}static create(e,n){return n.length?Ho(n,e,0,dr):Je}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,i+a,s)}}map(e,n,r){return this==Je||e.maps.length==0?this:this.mapInner(e,n,0,0,r||dr)}mapInner(e,n,r,i,s){let o;for(let a=0;a<this.local.length;a++){let u=this.local[a].map(e,r,i);u&&u.type.valid(n,u)?(o||(o=[])).push(u):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?uk(this.children,o||[],e,n,r,i,s):o?new ye(o.sort(hr),Br):Je}add(e,n){return n.length?this==Je?ye.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((a,u)=>{let l=u+r,c;if(c=Wg(n,a,l)){for(i||(i=this.children.slice());s<i.length&&i[s]<u;)s+=3;i[s]==u?i[s+2]=i[s+2].addInner(a,c,l+1):i.splice(s,0,u,u+a.nodeSize,Ho(c,a,l+1,dr)),s+=3}});let o=qg(s?Ug(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new ye(o.length?this.local.concat(o).sort(hr):this.local,i||this.children)}remove(e){return e.length==0||this==Je?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+n,u=r[s+1]+n;for(let c=0,d;c<e.length;c++)(d=e[c])&&d.from>a&&d.to<u&&(e[c]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let l=r[s+2].removeInner(o,a+1);l!=Je?r[s+2]=l:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new ye(i,r):Je}forChild(e,n){if(this==Je)return this;if(n.isLeaf)return ye.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+n.content.size;for(let a=0;a<this.local.length;a++){let u=this.local[a];if(u.from<o&&u.to>s&&u.type instanceof Vn){let l=Math.max(s,u.from)-s,c=Math.min(o,u.to)-s;l<c&&(i||(i=[])).push(u.copy(l,c))}}if(i){let a=new ye(i.sort(hr),Br);return r?new Rn([a,r]):a}return r||Je}eq(e){if(this==e)return!0;if(!(e instanceof ye)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return hd(this.localsInner(e))}localsInner(e){if(this==Je)return Br;if(e.inlineContent||!this.local.some(Vn.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Vn||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ye.empty=new ye([],[]);ye.removeOverlap=hd;const Je=ye.empty;class Rn{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,dr));return Rn.from(r)}forChild(e,n){if(n.isLeaf)return ye.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=Je&&(s instanceof Rn?r=r.concat(s.members):r.push(s))}return Rn.from(r)}eq(e){if(!(e instanceof Rn)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?hd(r?n:n.sort(hr)):Br}static from(e){switch(e.length){case 0:return Je;case 1:return e[0];default:return new Rn(e.every(n=>n instanceof ye)?e:e.reduce((n,r)=>n.concat(r instanceof ye?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function uk(t,e,n,r,i,s,o){let a=t.slice();for(let l=0,c=s;l<n.maps.length;l++){let d=0;n.maps[l].forEach((h,f,p,m)=>{let g=m-p-(f-h);for(let b=0;b<a.length;b+=3){let v=a[b+1];if(v<0||h>v+c-d)continue;let _=a[b]+c-d;f>=_?a[b+1]=h<=_?-2:-1:h>=c&&g&&(a[b]+=g,a[b+1]+=g)}d+=g}),c=n.maps[l].map(c,-1)}let u=!1;for(let l=0;l<a.length;l+=3)if(a[l+1]<0){if(a[l+1]==-2){u=!0,a[l+1]=-1;continue}let c=n.map(t[l]+s),d=c-i;if(d<0||d>=r.content.size){u=!0;continue}let h=n.map(t[l+1]+s,-1),f=h-i,{index:p,offset:m}=r.content.findIndex(d),g=r.maybeChild(p);if(g&&m==d&&m+g.nodeSize==f){let b=a[l+2].mapInner(n,g,c+1,t[l]+s+1,o);b!=Je?(a[l]=d,a[l+1]=f,a[l+2]=b):(a[l+1]=-2,u=!0)}else u=!0}if(u){let l=lk(a,t,e,n,i,s,o),c=Ho(l,r,0,o);e=c.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,h=0;d<c.children.length;d+=3){let f=c.children[d];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,c.children[d],c.children[d+1],c.children[d+2])}}return new ye(e.sort(hr),a)}function qg(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new tt(i.from+e,i.to+e,i.type))}return n}function lk(t,e,n,r,i,s,o){function a(u,l){for(let c=0;c<u.local.length;c++){let d=u.local[c].map(r,i,l);d?n.push(d):o.onRemove&&o.onRemove(u.local[c].spec)}for(let c=0;c<u.children.length;c+=3)a(u.children[c+2],u.children[c]+l+1)}for(let u=0;u<t.length;u+=3)t[u+1]==-1&&a(t[u+2],e[u]+s+1);return n}function Wg(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function Ug(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Ho(t,e,n,r){let i=[],s=!1;e.forEach((a,u)=>{let l=Wg(t,a,u+n);if(l){s=!0;let c=Ho(l,a,n+u+1,r);c!=Je&&i.push(u,u+a.nodeSize,c)}});let o=qg(s?Ug(t):t,-n).sort(hr);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new ye(o,i):Je}function hr(t,e){return t.from-e.from||t.to-e.to}function hd(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),qf(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),qf(e,i,r.copy(s.from,r.to)));break}}}return e}function qf(t,e,n){for(;e<t.length&&hr(n,t[e])>0;)e++;t.splice(e,0,n)}function Nu(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Je&&e.push(r)}),t.cursorWrapper&&e.push(ye.create(t.state.doc,[t.cursorWrapper.deco])),Rn.from(e)}const ck={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},dk=ut&&Hn<=11;class hk{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class fk{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new hk,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);ut&&Hn<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Ge&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),dk&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,ck)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Pf(this.view)){if(this.suppressingSelectionUpdates)return vn(this.view);if(ut&&Hn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&vr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=ni(s))n.add(s);for(let s=e.anchorNode;s;s=ni(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Pf(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,u=[];if(e.editable)for(let c=0;c<n.length;c++){let d=this.registerMutation(n[c],u);d&&(s=s<0?d.from:Math.min(d.from,s),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(u.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let c of u)if(c.nodeName=="BR"&&c.parentNode){let d=c.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){c.parentNode.removeChild(c);break}d=d.firstChild}}}else if(At&&u.length){let c=u.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,h]=c;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of c){let f=h.parentNode;f&&f.nodeName=="LI"&&(!d||gk(e,d)!=f)&&h.remove()}}}let l=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ra(r)&&(l=sd(e))&&l.eq(q.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,vn(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),pk(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,bk(e,u)),this.handleDOMChange(s,o,a,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||vn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;c<e.addedNodes.length;c++){let d=e.addedNodes[c];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(ut&&Hn<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:d,nextSibling:h}=e.addedNodes[c];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let o=i&&i.parentNode==e.target?Ve(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),u=s&&s.parentNode==e.target?Ve(s):e.target.childNodes.length,l=r.localPosFromDOM(e.target,u,1);return{from:a,to:l}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Wf=new WeakMap,Uf=!1;function pk(t){if(!Wf.has(t)&&(Wf.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=At,Uf)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Uf=!0}}function Kf(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return vr(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function mk(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Kf(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Kf(t,n):null}function gk(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function bk(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let u=a.firstChild;if(!u||u.nodeType!=1||u.contentEditable=="false"||/^(BR|IMG)$/.test(u.nodeName))break;a=u}a.insertBefore(s,a.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function vk(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:o,to:a}=t.docView.parseRange(e,n),u=t.domSelectionRange(),l,c=u.anchorNode;if(c&&t.dom.contains(c.nodeType==1?c:c.parentNode)&&(l=[{node:c,offset:u.anchorOffset}],Ra(u)||l.push({node:u.focusNode,offset:u.focusOffset})),We&&t.input.lastKeyCode===8)for(let g=s;g>i;g--){let b=r.childNodes[g-1],v=b.pmViewDesc;if(b.nodeName=="BR"&&!v){s=g;break}if(!v||v.size)break}let d=t.state.doc,h=t.someProp("domParser")||gn.fromSchema(t.state.schema),f=d.resolve(o),p=null,m=h.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:s,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:l,ruleFromNode:yk,context:f});if(l&&l[0].pos!=null){let g=l[0].pos,b=l[1]&&l[1].pos;b==null&&(b=g),p={anchor:g+o,head:b+o}}return{doc:m,sel:p,from:o,to:a}}function yk(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ge&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Ge&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const _k=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function xk(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let w=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,C=sd(t,w);if(C&&!t.state.selection.eq(C)){if(We&&pn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",D=>D(t,nr(13,"Enter"))))return;let S=t.state.tr.setSelection(C);w=="pointer"?S.setMeta("pointer",!0):w=="key"&&S.scrollIntoView(),s&&S.setMeta("composition",s),t.dispatch(S)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let u=t.state.selection,l=vk(t,e,n),c=t.state.doc,d=c.slice(l.from,l.to),h,f;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,f="end"):(h=t.state.selection.from,f="start"),t.input.lastKeyCode=null;let p=Ck(d.content,l.doc.content,l.from,h,f);if(p&&t.input.domChangeCount++,(ri&&t.input.lastIOSEnter>Date.now()-225||pn)&&i.some(w=>w.nodeType==1&&!_k.test(w.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",w=>w(t,nr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&u instanceof H&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))p={start:u.from,endA:u.to,endB:u.to};else{if(l.sel){let w=Jf(t,t.state.doc,l.sel);if(w&&!w.eq(t.state.selection)){let C=t.state.tr.setSelection(w);s&&C.setMeta("composition",s),t.dispatch(C)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof H&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=l.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=l.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),ut&&Hn<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>l.from&&l.doc.textBetween(p.start-l.from-1,p.start-l.from+1)==" "&&(p.start--,p.endA--,p.endB--);let m=l.doc.resolveNoCache(p.start-l.from),g=l.doc.resolveNoCache(p.endB-l.from),b=c.resolve(p.start),v=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=p.endA;if((ri&&t.input.lastIOSEnter>Date.now()-225&&(!v||i.some(w=>w.nodeName=="DIV"||w.nodeName=="P"))||!v&&m.pos<l.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(l.doc.textBetween(m.pos,g.pos,"","")))&&t.someProp("handleKeyDown",w=>w(t,nr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&wk(c,p.start,p.endA,m,g)&&t.someProp("handleKeyDown",w=>w(t,nr(8,"Backspace")))){pn&&We&&t.domObserver.suppressSelectionUpdates();return}We&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),pn&&!v&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==p.endA&&(p.endB-=2,g=l.doc.resolveNoCache(p.endB-l.from),setTimeout(()=>{t.someProp("handleKeyDown",function(w){return w(t,nr(13,"Enter"))})},20));let _=p.start,x=p.endA,y=w=>{let C=w||t.state.tr.replace(_,x,l.doc.slice(p.start-l.from,p.endB-l.from));if(l.sel){let S=Jf(t,C.doc,l.sel);S&&!(We&&t.composing&&S.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(S.head==_||S.head==C.mapping.map(x)-1)||ut&&S.empty&&S.head==_)&&C.setSelection(S)}return s&&C.setMeta("composition",s),C.scrollIntoView()},k;if(v)if(m.pos==g.pos){ut&&Hn<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>vn(t),20));let w=y(t.state.tr.delete(_,x)),C=c.resolve(p.start).marksAcross(c.resolve(p.endA));C&&w.ensureMarks(C),t.dispatch(w)}else if(p.endA==p.endB&&(k=kk(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start())))){let w=y(t.state.tr);k.type=="add"?w.addMark(_,x,k.mark):w.removeMark(_,x,k.mark),t.dispatch(w)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let w=m.parent.textBetween(m.parentOffset,g.parentOffset),C=()=>y(t.state.tr.insertText(w,_,x));t.someProp("handleTextInput",S=>S(t,_,x,w,C))||t.dispatch(C())}else t.dispatch(y());else t.dispatch(y())}function Jf(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:od(t,e.resolve(n.anchor),e.resolve(n.head))}function kk(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,a,u;for(let c=0;c<r.length;c++)i=r[c].removeFromSet(i);for(let c=0;c<n.length;c++)s=n[c].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",u=c=>c.mark(a.addToSet(c.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",u=c=>c.mark(a.removeFromSet(c.marks));else return null;let l=[];for(let c=0;c<e.childCount;c++)l.push(u(e.child(c)));if(A.from(l).eq(t))return{mark:a,type:o}}function wk(t,e,n,r,i){if(n-e<=i.pos-r.pos||Fu(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&n==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(Fu(s,!0,!0));return!o.parent.isTextblock||o.pos>n||Fu(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Fu(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function Ck(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let u=Math.max(0,s-Math.min(o,a));r-=o+u-s}if(o<s&&t.size<e.size){let u=r<=s&&r>=o?s-r:0;s-=u,s&&s<e.size&&Gf(e.textBetween(s-1,s+1))&&(s+=u?1:-1),a=s+(a-o),o=s}else if(a<s){let u=r<=s&&r>=a?s-r:0;s-=u,s&&s<t.size&&Gf(t.textBetween(s-1,s+1))&&(s+=u?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function Gf(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Kg{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new zx,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(ep),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Xf(this),Zf(this),this.nodeViews=Qf(this),this.docView=Df(this.state.doc,Yf(this),Nu(this),this.dom,this),this.domObserver=new fk(this,(r,i,s,o)=>xk(this,r,i,s,o)),this.domObserver.start(),Hx(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ac(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ep),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(zg(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let f=Qf(this);Sk(f,this.nodeViews)&&(this.nodeViews=f,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&ac(this),this.editable=Xf(this),Zf(this);let u=Nu(this),l=Yf(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,l,u);(d||!e.selection.eq(i.selection))&&(o=!0);let h=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&tx(this);if(o){this.domObserver.stop();let f=d&&(ut||We)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Ek(i.selection,e.selection);if(d){let p=We?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=tk(this)),(s||!this.docView.update(e.doc,l,u,this))&&(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=Df(e.doc,l,u,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Ex(this))?vn(this,f):(Mg(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():h&&nx(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof z){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Cf(this,n.getBoundingClientRect(),e)}else Cf(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new jg(e.slice,e.move,i<0?void 0:z.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=n?n(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(ut){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&rx(this.dom),vn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return ux(this,e)}coordsAtPos(e,n=1){return _g(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return fx(this,n||this.state,e)}pasteHTML(e,n){return rs(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return rs(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return ad(this,e)}destroy(){this.docView&&(jx(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Nu(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,W_())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return qx(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ge&&this.root.nodeType===11&&Y_(this.dom.ownerDocument)==this.dom&&mk(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Kg.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Yf(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[tt.node(0,t.state.doc.content.size,e)]}function Zf(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:tt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Xf(t){return!t.someProp("editable",e=>e(t.state)===!1)}function Ek(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Qf(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Sk(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function ep(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var qn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},jo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ak=typeof navigator<"u"&&/Mac/.test(navigator.platform),Mk=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var qe=0;qe<10;qe++)qn[48+qe]=qn[96+qe]=String(qe);for(var qe=1;qe<=24;qe++)qn[qe+111]="F"+qe;for(var qe=65;qe<=90;qe++)qn[qe]=String.fromCharCode(qe+32),jo[qe]=String.fromCharCode(qe);for(var Iu in qn)jo.hasOwnProperty(Iu)||(jo[Iu]=qn[Iu]);function Tk(t){var e=Ak&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Mk&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?jo:qn)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Dk=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Ok=typeof navigator<"u"&&/Win/.test(navigator.platform);function Rk(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let u=e[a];if(/^(cmd|meta|m)$/i.test(u))o=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))Dk?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function Nk(t){let e=Object.create(null);for(let n in t)e[Rk(n)]=t[n];return e}function Pu(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Fk(t){return new we({props:{handleKeyDown:fd(t)}})}function fd(t){let e=Nk(t);return function(n,r){let i=Tk(r),s,o=e[Pu(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[Pu(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Ok&&r.ctrlKey&&r.altKey)&&(s=qn[r.keyCode])&&s!=i){let a=e[Pu(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}const pd=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Jg(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Gg=(t,e,n)=>{let r=Jg(t,n);if(!r)return!1;let i=md(r);if(!i){let o=r.blockRange(),a=o&&ui(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(i1(t,i,e,-1))return!0;if(r.parent.content.size==0&&(ii(s,"end")||z.isSelectable(s)))for(let o=r.depth;;o--){let a=Da(t.doc,r.before(o),r.after(o),R.empty);if(a&&a.slice.size<a.to-a.from){if(e){let u=t.tr.step(a);u.setSelection(ii(s,"end")?q.findFrom(u.doc.resolve(u.mapping.map(i.pos,-1)),-1):z.create(u.doc,i.pos-s.nodeSize)),e(u.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},Ik=(t,e,n)=>{let r=Jg(t,n);if(!r)return!1;let i=md(r);return i?Yg(t,i,e):!1},Pk=(t,e,n)=>{let r=Xg(t,n);if(!r)return!1;let i=gd(r);return i?Yg(t,i,e):!1};function Yg(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let c=i.lastChild;if(!c)return!1;i=c}let o=e.nodeAfter,a=o,u=e.pos+1;for(;!a.isTextblock;u++){if(a.type.spec.isolating)return!1;let c=a.firstChild;if(!c)return!1;a=c}let l=Da(t.doc,s,u,R.empty);if(!l||l.from!=s||l instanceof Se&&l.slice.size>=u-s)return!1;if(n){let c=t.tr.step(l);c.setSelection(H.create(c.doc,s)),n(c.scrollIntoView())}return!0}function ii(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Zg=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=md(r)}let o=s&&s.nodeBefore;return!o||!z.isSelectable(o)?!1:(e&&e(t.tr.setSelection(z.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function md(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Xg(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Qg=(t,e,n)=>{let r=Xg(t,n);if(!r)return!1;let i=gd(r);if(!i)return!1;let s=i.nodeAfter;if(i1(t,i,e,1))return!0;if(r.parent.content.size==0&&(ii(s,"start")||z.isSelectable(s))){let o=Da(t.doc,r.before(),r.after(),R.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(ii(s,"start")?q.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):z.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},e1=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=gd(r)}let o=s&&s.nodeAfter;return!o||!z.isSelectable(o)?!1:(e&&e(t.tr.setSelection(z.create(t.doc,s.pos)).scrollIntoView()),!0)};function gd(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const Lk=(t,e)=>{let n=t.selection,r=n instanceof z,i;if(r){if(n.node.isTextblock||!Un(t.doc,n.from))return!1;i=n.from}else if(i=Ta(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(z.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Bk=(t,e)=>{let n=t.selection,r;if(n instanceof z){if(n.node.isTextblock||!Un(t.doc,n.to))return!1;r=n.to}else if(r=Ta(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},$k=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&ui(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},t1=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
11
|
-
`).scrollIntoView()),!0)};function bd(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const zk=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=bd(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=n.after(),u=t.tr.replaceWith(a,a,o.createAndFill());u.setSelection(q.near(u.doc.resolve(a),1)),e(u.scrollIntoView())}return!0},n1=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof mt||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=bd(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(o,s.createAndFill());a.setSelection(H.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},r1=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(bn(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&ui(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function Hk(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof z&&e.selection.node.isBlock)return!r.parentOffset||!bn(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,a,u=!1,l=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){u=r.end(f)==r.pos+(r.depth-f),l=r.start(f)==r.pos-(r.depth-f),a=bd(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),s.unshift(u&&a?{type:a}:null),o=f;break}else{if(f==1)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof H||e.selection instanceof mt)&&c.deleteSelection();let d=c.mapping.map(r.pos),h=bn(c.doc,d,s.length,s);if(h||(s[0]=a?{type:a}:null,h=bn(c.doc,d,s.length,s)),!h)return!1;if(c.split(d,s.length,s),!u&&l&&r.node(o).type!=a){let f=c.mapping.map(r.before(o)),p=c.doc.resolve(f);a&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,a)&&c.setNodeMarkup(c.mapping.map(r.before(o)),a)}return n&&n(c.scrollIntoView()),!0}}const jk=Hk(),Vk=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(z.create(t.doc,i))),!0)};function qk(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Un(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function i1(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,a,u=i.type.spec.isolating||s.type.spec.isolating;if(!u&&qk(t,e,n))return!0;let l=!u&&e.parent.canReplace(e.index(),e.index()+1);if(l&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(n){let f=e.pos+s.nodeSize,p=A.empty;for(let b=o.length-1;b>=0;b--)p=A.from(o[b].create(null,p));p=A.from(i.copy(p));let m=t.tr.step(new Ie(e.pos-1,f,e.pos,f,new R(p,1,0),o.length,!0)),g=m.doc.resolve(f+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Un(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let c=s.type.spec.isolating||r>0&&u?null:q.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),h=d&&ui(d);if(h!=null&&h>=e.depth)return n&&n(t.tr.lift(d,h).scrollIntoView()),!0;if(l&&ii(s,"start",!0)&&ii(i,"end")){let f=i,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(f.canReplace(f.childCount,f.childCount,m.content)){if(n){let b=A.empty;for(let _=p.length-1;_>=0;_--)b=A.from(p[_].copy(b));let v=t.tr.step(new Ie(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new R(b,p.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function s1(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(H.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const Wk=s1(-1),Uk=s1(1);function Kk(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=o&&td(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function tp(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[s];n.doc.nodesBetween(o,a,(u,l)=>{if(i)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)i=!0;else{let c=n.doc.resolve(l),d=c.index();i=c.parent.canReplaceWith(d,d+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:u}}=n.selection.ranges[o];s.setBlockType(a,u,t,e)}r(s.scrollIntoView())}return!0}}function vd(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}vd(pd,Gg,Zg);vd(pd,Qg,e1);vd(t1,n1,r1,jk);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Jk(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let a=r?n.tr:null;return Gk(a,o,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function Gk(t,e,n,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let u=o.resolve(e.start-2);s=new Io(u,u,e.depth),e.endIndex<e.parent.childCount&&(e=new Io(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=td(s,n,r,e);return a?(t&&Yk(t,e,a,i,n),!0):!1}function Yk(t,e,n,r,i){let s=A.empty;for(let c=n.length-1;c>=0;c--)s=A.from(n[c].type.create(n[c].attrs,s));t.step(new Ie(e.start-(r?2:0),e.end,e.start,e.end,new R(s,0,0),n.length,!0));let o=0;for(let c=0;c<n.length;c++)n[c].type==i&&(o=c+1);let a=n.length-o,u=e.start+n.length-(r?2:0),l=e.parent;for(let c=e.startIndex,d=e.endIndex,h=!0;c<d;c++,h=!1)!h&&bn(t.doc,u,a)&&(t.split(u,a),u+=2*a),u+=l.child(c).nodeSize;return t}function Zk(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?Xk(e,n,t,s):Qk(e,n,s):!0:!1}}function Xk(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Ie(s-1,o,s,o,new R(A.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Io(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=ui(r);if(a==null)return!1;i.lift(r,a);let u=i.doc.resolve(i.mapping.map(s,-1)-1);return Un(i.doc,u.pos)&&u.nodeBefore.type==u.nodeAfter.type&&i.join(u.pos),e(i.scrollIntoView()),!0}function Qk(t,e,n){let r=t.tr,i=n.parent;for(let f=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)f-=i.child(p).nodeSize,r.delete(f-1,f+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,u=n.endIndex==i.childCount,l=s.node(-1),c=s.index(-1);if(!l.canReplace(c+(a?0:1),c+1,o.content.append(u?A.empty:A.from(i))))return!1;let d=s.pos,h=d+o.nodeSize;return r.step(new Ie(d-(a?1:0),h+(u?1:0),d+1,h-1,new R((a?A.empty:A.from(i.copy(A.empty))).append(u?A.empty:A.from(i.copy(A.empty))),a?0:1,u?0:1),a?0:1)),e(r.scrollIntoView()),!0}function e3(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,l=>l.childCount>0&&l.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,u=a.child(o-1);if(u.type!=t)return!1;if(n){let l=u.lastChild&&u.lastChild.type==a.type,c=A.from(l?t.create():null),d=new R(A.from(t.create(null,A.from(a.type.create(null,c)))),l?3:1,0),h=s.start,f=s.end;n(e.tr.step(new Ie(h-(l?3:1),f,h,f,d,1,!0)).scrollIntoView())}return!0}}function Ia(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}class Pa{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([a,u])=>[a,(...c)=>{const d=u(...c)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a=[],u=!!e,l=e||s.tr,c=()=>(!u&&n&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(l),a.every(h=>h===!0)),d={...Object.fromEntries(Object.entries(r).map(([h,f])=>[h,(...m)=>{const g=this.buildProps(l,n),b=f(...m)(g);return a.push(b),d}])),run:c};return d}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([u,l])=>[u,(...c)=>l(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a={tr:e,editor:i,view:o,state:Ia({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([u,l])=>[u,(...c)=>l(...c)(a)]))}};return a}}class t3{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}once(e,n){const r=(...i)=>{this.off(e,r),n.apply(this,i)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function B(t,e,n){return t.config[e]===void 0&&t.parent?B(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?B(t.parent,e,n):null}):t.config[e]}function La(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function o1(t){const e=[],{nodeExtensions:n,markExtensions:r}=La(t),i=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:i},u=B(o,"addGlobalAttributes",a);if(!u)return;u().forEach(c=>{c.types.forEach(d=>{Object.entries(c.attributes).forEach(([h,f])=>{e.push({type:d,name:h,attribute:{...s,...f}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},u=B(o,"addAttributes",a);if(!u)return;const l=u();Object.entries(l).forEach(([c,d])=>{const h={...s,...d};typeof h?.default=="function"&&(h.default=h.default()),h?.isRequired&&h?.default===void 0&&delete h.default,e.push({type:o.name,name:c,attribute:h})})}),e}function Le(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function ge(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?String(s).split(" "):[],u=r[i]?r[i].split(" "):[],l=a.filter(c=>!u.includes(c));r[i]=[...u,...l].join(" ")}else if(i==="style"){const a=s?s.split(";").map(c=>c.trim()).filter(Boolean):[],u=r[i]?r[i].split(";").map(c=>c.trim()).filter(Boolean):[],l=new Map;u.forEach(c=>{const[d,h]=c.split(":").map(f=>f.trim());l.set(d,h)}),a.forEach(c=>{const[d,h]=c.split(":").map(f=>f.trim());l.set(d,h)}),r[i]=Array.from(l.entries()).map(([c,d])=>`${c}: ${d}`).join("; ")}else r[i]=s}),r},{})}function uc(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>ge(n,r),{})}function a1(t){return typeof t=="function"}function U(t,e=void 0,...n){return a1(t)?e?t.bind(e)(...n):t(...n):t}function n3(t={}){return Object.keys(t).length===0&&t.constructor===Object}function r3(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function np(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):r3(n.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function rp(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&n3(n)?!1:n!=null))}function i3(t,e){var n;const r=o1(t),{nodeExtensions:i,markExtensions:s}=La(t),o=(n=i.find(l=>B(l,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(l=>{const c=r.filter(b=>b.type===l.name),d={name:l.name,options:l.options,storage:l.storage,editor:e},h=t.reduce((b,v)=>{const _=B(v,"extendNodeSchema",d);return{...b,..._?_(l):{}}},{}),f=rp({...h,content:U(B(l,"content",d)),marks:U(B(l,"marks",d)),group:U(B(l,"group",d)),inline:U(B(l,"inline",d)),atom:U(B(l,"atom",d)),selectable:U(B(l,"selectable",d)),draggable:U(B(l,"draggable",d)),code:U(B(l,"code",d)),whitespace:U(B(l,"whitespace",d)),linebreakReplacement:U(B(l,"linebreakReplacement",d)),defining:U(B(l,"defining",d)),isolating:U(B(l,"isolating",d)),attrs:Object.fromEntries(c.map(b=>{var v;return[b.name,{default:(v=b?.attribute)===null||v===void 0?void 0:v.default}]}))}),p=U(B(l,"parseHTML",d));p&&(f.parseDOM=p.map(b=>np(b,c)));const m=B(l,"renderHTML",d);m&&(f.toDOM=b=>m({node:b,HTMLAttributes:uc(b,c)}));const g=B(l,"renderText",d);return g&&(f.toText=g),[l.name,f]})),u=Object.fromEntries(s.map(l=>{const c=r.filter(g=>g.type===l.name),d={name:l.name,options:l.options,storage:l.storage,editor:e},h=t.reduce((g,b)=>{const v=B(b,"extendMarkSchema",d);return{...g,...v?v(l):{}}},{}),f=rp({...h,inclusive:U(B(l,"inclusive",d)),excludes:U(B(l,"excludes",d)),group:U(B(l,"group",d)),spanning:U(B(l,"spanning",d)),code:U(B(l,"code",d)),attrs:Object.fromEntries(c.map(g=>{var b;return[g.name,{default:(b=g?.attribute)===null||b===void 0?void 0:b.default}]}))}),p=U(B(l,"parseHTML",d));p&&(f.parseDOM=p.map(g=>np(g,c)));const m=B(l,"renderHTML",d);return m&&(f.toDOM=g=>m({mark:g,HTMLAttributes:uc(g,c)})),[l.name,f]}));return new Xc({topNode:o,nodes:a,marks:u})}function Lu(t,e){return e.nodes[t]||e.marks[t]||null}function ip(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function ys(t,e){const n=wr.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}const s3=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var u,l;const c=((l=(u=i.type.spec).toText)===null||l===void 0?void 0:l.call(u,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,r-s))}),n};function yd(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Ba{constructor(e){this.find=e.find,this.handler=e.handler}}const o3=(t,e)=>{if(yd(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Ps(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:a}=t,{view:u}=n;if(u.composing)return!1;const l=u.state.doc.resolve(r);if(l.parent.type.spec.code||!((e=l.nodeBefore||l.nodeAfter)===null||e===void 0)&&e.marks.find(h=>h.type.spec.code))return!1;let c=!1;const d=s3(l)+s;return o.forEach(h=>{if(c)return;const f=o3(d,h.find);if(!f)return;const p=u.state.tr,m=Ia({state:u.state,transaction:p}),g={from:r-(f[0].length-s.length),to:i},{commands:b,chain:v,can:_}=new Pa({editor:n,state:m});h.handler({state:m,range:g,match:f,commands:b,chain:v,can:_})===null||!p.steps.length||(p.setMeta(a,{transform:p,from:r,to:i,text:s}),u.dispatch(p),c=!0)}),c}function a3(t){const{editor:e,rules:n}=t,r=new we({state:{init(){return null},apply(i,s,o){const a=i.getMeta(r);if(a)return a;const u=i.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:c}=u;typeof c=="string"?c=c:c=ys(A.from(c),o.schema);const{from:d}=u,h=d+c.length;Ps({editor:e,from:d,to:h,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return Ps({editor:e,from:s,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Ps({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Ps({editor:e,from:o.pos,to:o.pos,text:`
|
|
12
|
-
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function
|
|
13
|
-
|
|
14
|
-
`,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,i,(u,l,c,d)=>{var h;u.isBlock&&l>r&&(a+=s);const f=o?.[u.type.name];if(f)return c&&(a+=f({node:u,pos:l,parent:c,index:d,range:e})),!1;u.isText&&(a+=(h=u?.text)===null||h===void 0?void 0:h.slice(Math.max(r,l)-l,i-l))}),a}function c1(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const d1=Be.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new we({key:new $e("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(c=>c.$from.pos)),a=Math.max(...s.map(c=>c.$to.pos)),u=c1(n);return l1(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),m3=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),g3=(t=!1)=>({commands:e})=>e.setContent("",t),b3=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(a,u)=>{if(a.type.isText)return;const{doc:l,mapping:c}=e,d=l.resolve(c.map(u)),h=l.resolve(c.map(u+a.nodeSize)),f=d.blockRange(h);if(!f)return;const p=ui(f);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(f.start,m)}(p||p===0)&&e.lift(f,p)})}),!0},v3=t=>e=>t(e),y3=()=>({state:t,dispatch:e})=>n1(t,e),_3=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new H(r.doc.resolve(Math.max(o-1,0)))),!0},x3=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const a=i.before(s),u=i.after(s);t.delete(a,u).scrollIntoView()}return!0}return!1},k3=t=>({tr:e,state:n,dispatch:r})=>{const i=Le(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const u=s.before(o),l=s.after(o);e.delete(u,l).scrollIntoView()}return!0}return!1},w3=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},C3=()=>({state:t,dispatch:e})=>pd(t,e),E3=()=>({commands:t})=>t.keyboardShortcut("Enter"),S3=()=>({state:t,dispatch:e})=>zk(t,e);function Vo(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:yd(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function h1(t,e,n={}){return t.find(r=>r.type===e&&Vo(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function sp(t,e,n={}){return!!h1(t,e,n)}function _d(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(c=>c.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(c=>c.type===e)||(n=n||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!h1([...i.node.marks],e,n)))return;let o=i.index,a=t.start()+i.offset,u=o+1,l=a+i.node.nodeSize;for(;o>0&&sp([...t.parent.child(o-1).marks],e,n);)o-=1,a-=t.parent.child(o).nodeSize;for(;u<t.parent.childCount&&sp([...t.parent.child(u).marks],e,n);)l+=t.parent.child(u).nodeSize,u+=1;return{from:a,to:l}}function Jn(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const A3=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=Jn(t,r.schema),{doc:o,selection:a}=n,{$from:u,from:l,to:c}=a;if(i){const d=_d(u,s,e);if(d&&d.from<=l&&d.to>=c){const h=H.create(o,d.from,d.to);n.setSelection(h)}}return!0},M3=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function f1(t){return t instanceof H}function or(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function p1(t,e=null){if(!e)return null;const n=q.atStart(t),r=q.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?H.create(t,or(0,i,s),or(t.content.size,i,s)):H.create(t,or(e,i,s),or(e,i,s))}function op(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function qo(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function T3(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const D3=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(qo()||op())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),T3()&&!qo()&&!op()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!f1(n.state.selection))return o(),!0;const a=p1(i.doc,t)||n.state.selection,u=n.state.selection.eq(a);return s&&(u||i.setSelection(a),u&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},O3=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),R3=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),m1=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&m1(r)}return t};function $s(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return m1(n)}function ss(t,e,n){if(t instanceof zn||t instanceof A)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return A.fromArray(t.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),ss("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,a="";const u=new Xc({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:l=>(o=!0,a=typeof l=="string"?l:l.outerHTML,null)}]}})});if(n.slice?gn.fromSchema(u).parseSlice($s(t),n.parseOptions):gn.fromSchema(u).parse($s(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=gn.fromSchema(e);return n.slice?s.parseSlice($s(t),n.parseOptions).content:s.parse($s(t),n.parseOptions)}return ss("",e,n)}function N3(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof Se||i instanceof Ie))return;const s=t.mapping.maps[r];let o=0;s.forEach((a,u,l,c)=>{o===0&&(o=c)}),t.setSelection(q.near(t.doc.resolve(o),n))}const F3=t=>!("type"in t),I3=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const u=g=>{s.emit("contentError",{editor:s,error:g,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},l={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{ss(e,s.schema,{parseOptions:l,errorOnInvalidContent:!0})}catch(g){u(g)}try{a=ss(e,s.schema,{parseOptions:l,errorOnInvalidContent:(o=n.errorOnInvalidContent)!==null&&o!==void 0?o:s.options.enableContentCheck})}catch(g){return u(g),!1}let{from:c,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},h=!0,f=!0;if((F3(a)?a:[a]).forEach(g=>{g.check(),h=h?g.isText&&g.marks.length===0:!1,f=f?g.isBlock:!1}),c===d&&f){const{parent:g}=r.doc.resolve(c);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(c-=1,d+=1)}let m;if(h){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof A){let g="";e.forEach(b=>{b.text&&(g+=b.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,c,d)}else m=a,r.replaceWith(c,d,m);n.updateSelection&&N3(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:m})}return!0},P3=()=>({state:t,dispatch:e})=>Lk(t,e),L3=()=>({state:t,dispatch:e})=>Bk(t,e),B3=()=>({state:t,dispatch:e})=>Gg(t,e),$3=()=>({state:t,dispatch:e})=>Qg(t,e),z3=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Ta(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},H3=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Ta(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},j3=()=>({state:t,dispatch:e})=>Ik(t,e),V3=()=>({state:t,dispatch:e})=>Pk(t,e);function g1(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function q3(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a+=1){const u=e[a];if(/^(cmd|meta|m)$/i.test(u))o=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))qo()||g1()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${u}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const W3=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=q3(t).split(/-(?!$)/),o=s.find(l=>!["Alt","Ctrl","Meta","Shift"].includes(l)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",l=>l(n,a))});return u?.steps.forEach(l=>{const c=l.map(r.mapping);c&&i&&r.maybeStep(c)}),!0};function as(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?Le(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(d,h)=>{if(d.isText)return;const f=Math.max(r,h),p=Math.min(i,h+d.nodeSize);a.push({node:d,from:f,to:p})});const u=i-r,l=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Vo(d.node.attrs,n,{strict:!1}));return s?!!l.length:l.reduce((d,h)=>d+h.to-h.from,0)>=u}const U3=(t,e={})=>({state:n,dispatch:r})=>{const i=Le(t,n.schema);return as(n,i,e)?$k(n,r):!1},K3=()=>({state:t,dispatch:e})=>r1(t,e),J3=t=>({state:e,dispatch:n})=>{const r=Le(t,e.schema);return Zk(r)(e,n)},G3=()=>({state:t,dispatch:e})=>t1(t,e);function za(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function ap(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}const Y3=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=za(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=Le(t,r.schema)),a==="mark"&&(o=Jn(t,r.schema)),i&&n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(l,c)=>{s&&s===l.type&&n.setNodeMarkup(c,void 0,ap(l.attrs,e)),o&&l.marks.length&&l.marks.forEach(d=>{o===d.type&&n.addMark(c,c+l.nodeSize,o.create(ap(d.attrs,e)))})})}),!0):!1},Z3=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),X3=()=>({tr:t,dispatch:e})=>{if(e){const n=new mt(t.doc);t.setSelection(n)}return!0},Q3=()=>({state:t,dispatch:e})=>Zg(t,e),ew=()=>({state:t,dispatch:e})=>e1(t,e),tw=()=>({state:t,dispatch:e})=>Vk(t,e),nw=()=>({state:t,dispatch:e})=>Uk(t,e),rw=()=>({state:t,dispatch:e})=>Wk(t,e);function lc(t,e,n={},r={}){return ss(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const iw=(t,e=!1,n={},r={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{var u,l;const{doc:c}=s;if(n.preserveWhitespace!=="full"){const d=lc(t,i.schema,n,{errorOnInvalidContent:(u=r.errorOnInvalidContent)!==null&&u!==void 0?u:i.options.enableContentCheck});return o&&s.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!e),!0}return o&&s.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:c.content.size},t,{parseOptions:n,errorOnInvalidContent:(l=r.errorOnInvalidContent)!==null&&l!==void 0?l:i.options.enableContentCheck})};function b1(t,e){const n=Jn(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,u=>{o.push(...u.marks)});const a=o.find(u=>u.type.name===n.name);return a?{...a.attrs}:{}}function sw(t,e){const n=new nd(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function ow(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function aw(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function v1(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function xd(t){return e=>v1(e.$from,t)}function uw(t,e){const n={from:0,to:t.content.size};return l1(t,n,e)}function lw(t,e){const n=Le(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function y1(t,e){const n=za(typeof e=="string"?e:e.name,t.schema);return n==="node"?lw(t,e):n==="mark"?b1(t,e):{}}function cw(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function dw(t){const e=cw(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,o)=>o!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function hw(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,u)=>{o.push({from:a,to:u})});else{const{from:a,to:u}=n[s];if(a===void 0||u===void 0)return;o.push({from:a,to:u})}o.forEach(({from:a,to:u})=>{const l=e.slice(s).map(a,-1),c=e.slice(s).map(u),d=e.invert().map(l,-1),h=e.invert().map(c);r.push({oldRange:{from:d,to:h},newRange:{from:l,to:c}})})}),dw(r)}function kd(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),o=_d(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}function ro(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function cc(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?Jn(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>Vo(d.attrs,n,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:d,$to:h})=>{const f=d.pos,p=h.pos;t.doc.nodesBetween(f,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const b=Math.max(f,g),v=Math.min(p,g+m.nodeSize),_=v-b;o+=_,a.push(...m.marks.map(x=>({mark:x,from:b,to:v})))})}),o===0)return!1;const u=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>Vo(d.mark.attrs,n,{strict:!1})).reduce((d,h)=>d+h.to-h.from,0),l=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,h)=>d+h.to-h.from,0);return(u>0?u+l:u)>=o}function fw(t,e,n={}){if(!e)return as(t,null,n)||cc(t,null,n);const r=za(e,t.schema);return r==="node"?as(t,e,n):r==="mark"?cc(t,e,n):!1}function up(t,e){const{nodeExtensions:n}=La(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=U(B(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function wd(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!==null&&r!==void 0?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(s=>{i!==!1&&(wd(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function pw(t){return t instanceof z}function mw(t,e,n){var r;const{selection:i}=e;let s=null;if(f1(i)&&(s=i.$cursor),s){const a=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(a)||!a.some(u=>u.type.excludes(n))}const{ranges:o}=i;return o.some(({$from:a,$to:u})=>{let l=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,u.pos,(c,d,h)=>{if(l)return!1;if(c.isInline){const f=!h||h.type.allowsMarkType(n),p=!!n.isInSet(c.marks)||!c.marks.some(m=>m.type.excludes(n));l=f&&p}return!l}),l})}const gw=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:a}=s,u=Jn(t,r.schema);if(i)if(o){const l=b1(r,u);n.addStoredMark(u.create({...l,...e}))}else a.forEach(l=>{const c=l.$from.pos,d=l.$to.pos;r.doc.nodesBetween(c,d,(h,f)=>{const p=Math.max(f,c),m=Math.min(f+h.nodeSize,d);h.marks.find(b=>b.type===u)?h.marks.forEach(b=>{u===b.type&&n.addMark(p,m,u.create({...b.attrs,...e}))}):n.addMark(p,m,u.create(e))})});return mw(r,n,u)},bw=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),vw=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=Le(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>tp(s,{...o,...e})(n)?!0:a.clearNodes()).command(({state:a})=>tp(s,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},yw=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=or(t,0,r.content.size),s=z.create(r,i);e.setSelection(s)}return!0},_w=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=H.atStart(r).from,a=H.atEnd(r).to,u=or(i,o,a),l=or(s,o,a),c=H.create(r,u,l);e.setSelection(c)}return!0},xw=t=>({state:e,dispatch:n})=>{const r=Le(t,e.schema);return e3(r)(e,n)};function lp(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}const kw=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:u}=s,l=i.extensionManager.attributes,c=ro(l,a.node().type.name,a.node().attrs);if(s instanceof z&&s.node.isBlock)return!a.parentOffset||!bn(o,a.pos)?!1:(r&&(t&&lp(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=u.parentOffset===u.parent.content.size,h=a.depth===0?void 0:ow(a.node(-1).contentMatchAt(a.indexAfter(-1)));let f=d&&h?[{type:h,attrs:c}]:void 0,p=bn(e.doc,e.mapping.map(a.pos),1,f);if(!f&&!p&&bn(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(p=!0,f=h?[{type:h,attrs:c}]:void 0),r){if(p&&(s instanceof H&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,f),h&&!d&&!a.parentOffset&&a.parent.type!==h)){const m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}t&&lp(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},ww=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var o;const a=Le(t,r.schema),{$from:u,$to:l}=r.selection,c=r.selection.node;if(c&&c.isBlock||u.depth<2||!u.sameParent(l))return!1;const d=u.node(-1);if(d.type!==a)return!1;const h=s.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==a||u.index(-2)!==u.node(-2).childCount-1)return!1;if(i){let b=A.empty;const v=u.index(-1)?1:u.index(-2)?2:3;for(let C=u.depth-v;C>=u.depth-3;C-=1)b=A.from(u.node(C).copy(b));const _=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,x={...ro(h,u.node().type.name,u.node().attrs),...e},y=((o=a.contentMatch.defaultType)===null||o===void 0?void 0:o.createAndFill(x))||void 0;b=b.append(A.from(a.createAndFill(null,y)||void 0));const k=u.before(u.depth-(v-1));n.replace(k,u.after(-_),new R(b,4-v,0));let w=-1;n.doc.nodesBetween(k,n.doc.content.size,(C,S)=>{if(w>-1)return!1;C.isTextblock&&C.content.size===0&&(w=S+1)}),w>-1&&n.setSelection(H.near(n.doc.resolve(w))),n.scrollIntoView()}return!0}const f=l.pos===u.end()?d.contentMatchAt(0).defaultType:null,p={...ro(h,d.type.name,d.attrs),...e},m={...ro(h,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,l.pos);const g=f?[{type:a,attrs:p},{type:f,attrs:m}]:[{type:a,attrs:p}];if(!bn(n.doc,u.pos,2))return!1;if(i){const{selection:b,storedMarks:v}=r,{splittableMarks:_}=s.extensionManager,x=v||b.$to.parentOffset&&b.$from.marks();if(n.split(u.pos,2,g).scrollIntoView(),!x||!i)return!0;const y=x.filter(k=>_.includes(k.type.name));n.ensureMarks(y)}return!0},Bu=(t,e)=>{const n=xd(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&Un(t.doc,n.pos)&&t.join(n.pos),!0},$u=(t,e)=>{const n=xd(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&Un(t.doc,r)&&t.join(r),!0},Cw=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:u,commands:l,can:c})=>{const{extensions:d,splittableMarks:h}=i.extensionManager,f=Le(t,o.schema),p=Le(e,o.schema),{selection:m,storedMarks:g}=o,{$from:b,$to:v}=m,_=b.blockRange(v),x=g||m.$to.parentOffset&&m.$from.marks();if(!_)return!1;const y=xd(k=>up(k.type.name,d))(m);if(_.depth>=1&&y&&_.depth-y.depth<=1){if(y.node.type===f)return l.liftListItem(p);if(up(y.node.type.name,d)&&f.validContent(y.node.content)&&a)return u().command(()=>(s.setNodeMarkup(y.pos,f),!0)).command(()=>Bu(s,f)).command(()=>$u(s,f)).run()}return!n||!x||!a?u().command(()=>c().wrapInList(f,r)?!0:l.clearNodes()).wrapInList(f,r).command(()=>Bu(s,f)).command(()=>$u(s,f)).run():u().command(()=>{const k=c().wrapInList(f,r),w=x.filter(C=>h.includes(C.type.name));return s.ensureMarks(w),k?!0:l.clearNodes()}).wrapInList(f,r).command(()=>Bu(s,f)).command(()=>$u(s,f)).run()},Ew=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=Jn(t,r.schema);return cc(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},Sw=(t,e,n={})=>({state:r,commands:i})=>{const s=Le(t,r.schema),o=Le(e,r.schema),a=as(r,s,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),a?i.setNode(o,u):i.setNode(s,{...u,...n})},Aw=(t,e={})=>({state:n,commands:r})=>{const i=Le(t,n.schema);return as(n,i,e)?r.lift(i):r.wrapIn(i,e)},Mw=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const o=t.tr,a=s.transform;for(let u=a.steps.length-1;u>=0;u-=1)o.step(a.steps[u].invert(a.docs[u]));if(s.text){const u=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,u))}else o.delete(s.from,s.to)}return!0}}return!1},Tw=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},Dw=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=n,u=Jn(t,r.schema),{$from:l,empty:c,ranges:d}=a;if(!i)return!0;if(c&&o){let{from:h,to:f}=a;const p=(s=l.marks().find(g=>g.type===u))===null||s===void 0?void 0:s.attrs,m=_d(l,u,p);m&&(h=m.from,f=m.to),n.removeMark(h,f,u)}else d.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,u)});return n.removeStoredMark(u),!0},Ow=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=za(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=Le(t,r.schema)),a==="mark"&&(o=Jn(t,r.schema)),i&&n.selection.ranges.forEach(u=>{const l=u.$from.pos,c=u.$to.pos;let d,h,f,p;n.selection.empty?r.doc.nodesBetween(l,c,(m,g)=>{s&&s===m.type&&(f=Math.max(g,l),p=Math.min(g+m.nodeSize,c),d=g,h=m)}):r.doc.nodesBetween(l,c,(m,g)=>{g<l&&s&&s===m.type&&(f=Math.max(g,l),p=Math.min(g+m.nodeSize,c),d=g,h=m),g>=l&&g<=c&&(s&&s===m.type&&n.setNodeMarkup(g,void 0,{...m.attrs,...e}),o&&m.marks.length&&m.marks.forEach(b=>{if(o===b.type){const v=Math.max(g,l),_=Math.min(g+m.nodeSize,c);n.addMark(v,_,o.create({...b.attrs,...e}))}}))}),h&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(m=>{o===m.type&&n.addMark(f,p,o.create({...m.attrs,...e}))}))}),!0):!1},Rw=(t,e={})=>({state:n,dispatch:r})=>{const i=Le(t,n.schema);return Kk(i,e)(n,r)},Nw=(t,e={})=>({state:n,dispatch:r})=>{const i=Le(t,n.schema);return Jk(i,e)(n,r)};var Fw=Object.freeze({__proto__:null,blur:m3,clearContent:g3,clearNodes:b3,command:v3,createParagraphNear:y3,cut:_3,deleteCurrentNode:x3,deleteNode:k3,deleteRange:w3,deleteSelection:C3,enter:E3,exitCode:S3,extendMarkRange:A3,first:M3,focus:D3,forEach:O3,insertContent:R3,insertContentAt:I3,joinBackward:B3,joinDown:L3,joinForward:$3,joinItemBackward:z3,joinItemForward:H3,joinTextblockBackward:j3,joinTextblockForward:V3,joinUp:P3,keyboardShortcut:W3,lift:U3,liftEmptyBlock:K3,liftListItem:J3,newlineInCode:G3,resetAttributes:Y3,scrollIntoView:Z3,selectAll:X3,selectNodeBackward:Q3,selectNodeForward:ew,selectParentNode:tw,selectTextblockEnd:nw,selectTextblockStart:rw,setContent:iw,setMark:gw,setMeta:bw,setNode:vw,setNodeSelection:yw,setTextSelection:_w,sinkListItem:xw,splitBlock:kw,splitListItem:ww,toggleList:Cw,toggleMark:Ew,toggleNode:Sw,toggleWrap:Aw,undoInputRule:Mw,unsetAllMarks:Tw,unsetMark:Dw,updateAttributes:Ow,wrapIn:Rw,wrapInList:Nw});const _1=Be.create({name:"commands",addCommands(){return{...Fw}}}),x1=Be.create({name:"drop",addProseMirrorPlugins(){return[new we({key:new $e("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),k1=Be.create({name:"editable",addProseMirrorPlugins(){return[new we({key:new $e("editable"),props:{editable:()=>this.editor.options.editable}})]}}),w1=new $e("focusEvents"),C1=Be.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new we({key:w1,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),E1=Be.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:u,doc:l}=a,{empty:c,$anchor:d}=u,{pos:h,parent:f}=d,p=d.parent.isTextblock&&h>0?a.doc.resolve(h-1):d,m=p.parent.type.spec.isolating,g=d.pos-d.parentOffset,b=m&&p.parent.childCount===1?g===d.pos:q.atStart(l).from===h;return!c||!f.type.isTextblock||f.textContent.length||!b||b&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return qo()||g1()?s:i},addProseMirrorPlugins(){return[new we({key:new $e("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),i=t.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:a}=e.selection,u=q.atStart(e.doc).from,l=q.atEnd(e.doc).to;if(s||!(o===u&&a===l)||!wd(n.doc))return;const h=n.tr,f=Ia({state:n,transaction:h}),{commands:p}=new Pa({editor:this.editor,state:f});if(p.clearNodes(),!!h.steps.length)return h}})]}}),S1=Be.create({name:"paste",addProseMirrorPlugins(){return[new we({key:new $e("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),A1=Be.create({name:"tabindex",addProseMirrorPlugins(){return[new we({key:new $e("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});var Iw=Object.freeze({__proto__:null,ClipboardTextSerializer:d1,Commands:_1,Drop:x1,Editable:k1,FocusEvents:C1,Keymap:E1,Paste:S1,Tabindex:A1,focusEventsPluginKey:w1});class rr{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new rr(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new rr(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new rr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,o=this.pos+r+(s?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(o);if(!i&&a.depth<=this.depth)return;const u=new rr(a,this.editor,i,i?n:null);i&&(u.actualDepth=this.depth+1),e.push(new rr(a,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const u=o[a];if(s[u]!==n[u])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(u=>n[u]===o.node.attrs[u])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const Pw=`.ProseMirror {
|
|
1
|
+
import{a as e,i as t,n,r,t as i}from"./rolldown-runtime.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare___mf_0_rimori_mf_1_client__loadShare__.mjs.js";var d=i((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},ee=Object.prototype.hasOwnProperty;function T(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function te(e,t){return T(e.type,t,e.props)}function ne(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function re(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ie=/\/+/g;function ae(e,t){return typeof e==`object`&&e&&e.key!=null?re(``+e.key):t.toString(36)}function oe(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function E(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,E(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ae(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(ie,`$&/`)+`/`),E(o,r,i,``,function(e){return e})):o!=null&&(ne(o)&&(o=te(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ie,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+ae(a,u),c+=E(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+ae(a,u++),c+=E(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return E(oe(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function se(e,t,n){if(e==null)return e;var r=[],i=0;return E(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ce(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var le=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},ue={map:se,forEach:function(e,t,n){se(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return se(e,function(){t++}),t},toArray:function(e){return se(e,function(e){return e})||[]},only:function(e){if(!ne(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=ue,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!ee.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return T(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)ee.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return T(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=ne,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ce}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,le)}catch(e){le(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.5`})),f=i(((e,t)=>{t.exports=d()})),p=r({Activity:()=>b,Children:()=>x,Component:()=>S,Fragment:()=>C,Profiler:()=>w,PureComponent:()=>ee,StrictMode:()=>T,Suspense:()=>te,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>ne,__COMPILER_RUNTIME:()=>re,__moduleExports:()=>v,cache:()=>ie,cacheSignal:()=>ae,cloneElement:()=>oe,createContext:()=>E,createElement:()=>se,createRef:()=>ce,default:()=>y,forwardRef:()=>le,isValidElement:()=>ue,lazy:()=>de,memo:()=>fe,startTransition:()=>pe,unstable_useCacheRefresh:()=>me,use:()=>he,useActionState:()=>ge,useCallback:()=>_e,useContext:()=>ve,useDebugValue:()=>ye,useDeferredValue:()=>be,useEffect:()=>D,useEffectEvent:()=>xe,useId:()=>Se,useImperativeHandle:()=>Ce,useInsertionEffect:()=>we,useLayoutEffect:()=>Te,useMemo:()=>Ee,useOptimistic:()=>De,useReducer:()=>Oe,useRef:()=>ke,useState:()=>O,useSyncExternalStore:()=>Ae,useTransition:()=>je,version:()=>Me}),m,h,g,_,v,y,b,x,S,C,w,ee,T,te,ne,re,ie,ae,oe,E,se,ce,le,ue,de,fe,pe,me,he,ge,_e,ve,ye,be,D,xe,Se,Ce,we,Te,Ee,De,Oe,ke,O,Ae,je,Me,Ne=n((()=>{m=e(f(),1),h=`__mf_module_cache__`,globalThis[h]||={share:{},remote:{}},globalThis[h].share||={},globalThis[h].remote||={},g=globalThis[h],_=g.share.react,_===void 0&&(_=m,g.share.react=_),v=_,y=_.__esModule?_.default:_.default??_,{Activity:b,Children:x,Component:S,Fragment:C,Profiler:w,PureComponent:ee,StrictMode:T,Suspense:te,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:ne,__COMPILER_RUNTIME:re,cache:ie,cacheSignal:ae,cloneElement:oe,createContext:E,createElement:se,createRef:ce,forwardRef:le,isValidElement:ue,lazy:de,memo:fe,startTransition:pe,unstable_useCacheRefresh:me,use:he,useActionState:ge,useCallback:_e,useContext:ve,useDebugValue:ye,useDeferredValue:be,useEffect:D,useEffectEvent:xe,useId:Se,useImperativeHandle:Ce,useInsertionEffect:we,useLayoutEffect:Te,useMemo:Ee,useOptimistic:De,useReducer:Oe,useRef:ke,useState:O,useSyncExternalStore:Ae,useTransition:je,version:Me}=_})),Pe=i((e=>{var n=(Ne(),t(p));function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.5`})),Fe=i(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Pe()})),Ie=r({__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>Ue,__moduleExports:()=>Ve,createPortal:()=>We,default:()=>He,flushSync:()=>Ge,preconnect:()=>Ke,prefetchDNS:()=>qe,preinit:()=>Je,preinitModule:()=>Ye,preload:()=>Xe,preloadModule:()=>Ze,requestFormReset:()=>Qe,unstable_batchedUpdates:()=>$e,useFormState:()=>et,useFormStatus:()=>tt,version:()=>nt}),Le,Re,ze,Be,Ve,He,Ue,We,Ge,Ke,qe,Je,Ye,Xe,Ze,Qe,$e,et,tt,nt,rt=n((()=>{Le=e(Fe(),1),Re=`__mf_module_cache__`,globalThis[Re]||={share:{},remote:{}},globalThis[Re].share||={},globalThis[Re].remote||={},ze=globalThis[Re],Be=ze.share[`react-dom`],Be===void 0&&(Be=Le,ze.share[`react-dom`]=Be),Ve=Be,He=Be.__esModule?Be.default:Be.default??Be,{__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:Ue,createPortal:We,flushSync:Ge,preconnect:Ke,prefetchDNS:qe,preinit:Je,preinitModule:Ye,preload:Xe,preloadModule:Ze,requestFormReset:Qe,unstable_batchedUpdates:$e,useFormState:et,useFormStatus:tt,version:nt}=Be})),it=i((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),at=i(((e,t)=>{t.exports=it()}));Ne();var ot=r({Fragment:()=>pt,__moduleExports:()=>dt,default:()=>ft,jsx:()=>k,jsxs:()=>mt}),st=e(at(),1),ct=`__mf_module_cache__`;globalThis[ct]||={share:{},remote:{}},globalThis[ct].share||={},globalThis[ct].remote||={};var lt=globalThis[ct],ut=lt.share[`react/jsx-runtime`];ut===void 0&&(ut=st,lt.share[`react/jsx-runtime`]=ut);var dt=ut,ft=ut.__esModule?ut.default:ut.default??ut,{Fragment:pt,jsx:k,jsxs:mt}=ut,A=typeof window<`u`?window:void 0,ht=typeof globalThis<`u`?globalThis:A;typeof self>`u`&&(ht.self=ht),typeof File>`u`&&(ht.File=function(){});var gt=ht?.navigator,j=ht?.document,_t=ht?.location,vt=ht?.fetch,yt=ht!=null&&ht.XMLHttpRequest&&`withCredentials`in new ht.XMLHttpRequest?ht.XMLHttpRequest:void 0,bt=ht?.AbortController,xt=ht?.CompressionStream,St=gt?.userAgent,M=A??{},Ct=`1.372.5`,wt={DEBUG:!1,LIB_VERSION:Ct,LIB_NAME:`web`,JS_SDK_VERSION:Ct};function Tt(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function Et(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Tt(a,r,i,o,s,`next`,e)}function s(e){Tt(a,r,i,o,s,`throw`,e)}o(void 0)}))}}function N(){return N=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},N.apply(null,arguments)}function Dt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Ot(){return Ot=Et((function*(e,t,n){t===void 0&&(t=!0);try{var r=new CompressionStream(`gzip`),i=r.writable.getWriter(),a=i.write(new TextEncoder().encode(e)).then((()=>i.close())).catch(function(){var e=Et((function*(e){try{yield i.abort(e)}catch{}throw e}));return function(t){return e.apply(this,arguments)}}()),o=new Response(r.readable).blob(),[s]=yield Promise.all([o,a]);return s}catch(e){if(n!=null&&n.rethrow)throw e;return t&&console.error(`Failed to gzip compress data`,e),null}})),Ot.apply(this,arguments)}var kt=`amazonbot,amazonproductbot,app.hypefactors.com,applebot,archive.org_bot,awariobot,backlinksextendedbot,baiduspider,bingbot,bingpreview,chrome-lighthouse,dataforseobot,deepscan,duckduckbot,facebookexternal,facebookcatalog,http://yandex.com/bots,hubspot,ia_archiver,leikibot,linkedinbot,meta-externalagent,mj12bot,msnbot,nessus,petalbot,pinterest,prerender,rogerbot,screaming frog,sebot-wa,sitebulb,slackbot,slurp,trendictionbot,turnitin,twitterbot,vercel-screenshot,vercelbot,yahoo! slurp,yandexbot,zoombot,bot.htm,bot.php,(bot;,bot/,crawler,ahrefsbot,ahrefssiteaudit,semrushbot,siteauditbot,splitsignalbot,gptbot,oai-searchbot,chatgpt-user,perplexitybot,better uptime bot,sentryuptimebot,uptimerobot,headlesschrome,cypress,google-hoteladsverifier,adsbot-google,apis-google,duplexweb-google,feedfetcher-google,google favicon,google web preview,google-read-aloud,googlebot,googleother,google-cloudvertexbot,googleweblight,mediapartners-google,storebot-google,google-inspectiontool,bytespider`.split(`,`),At=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return kt.concat(t).some((e=>{var t=e.toLowerCase();return n.indexOf(t)!==-1}))},jt=[`$snapshot`,`$pageview`,`$pageleave`,`$set`,`survey dismissed`,`survey sent`,`survey shown`,`$identify`,`$groupidentify`,`$create_alias`,`$$client_ingestion_warning`,`$web_experiment_applied`,`$feature_enrollment_update`,`$feature_flag_called`];function P(e,t){return e.indexOf(t)!==-1}var Mt=function(e){return e.trim()},Nt=function(e){return e.replace(/^\$/,``)},Pt=Object.prototype,Ft=Pt.hasOwnProperty,It=Pt.toString,F=Array.isArray||function(e){return It.call(e)===`[object Array]`},Lt=e=>typeof e==`function`,Rt=e=>e===Object(e)&&!F(e),zt=e=>{if(Rt(e)){for(var t in e)if(Ft.call(e,t))return!1;return!0}return!1},I=e=>e===void 0,Bt=e=>It.call(e)==`[object String]`,Vt=e=>Bt(e)&&e.trim().length===0,Ht=e=>e===null,L=e=>I(e)||Ht(e),Ut=e=>It.call(e)==`[object Number]`&&e==e,Wt=e=>Ut(e)&&e>0,Gt=e=>It.call(e)===`[object Boolean]`,Kt=e=>e instanceof FormData,qt=e=>P(jt,e);function Jt(e){return typeof e!=`object`||!e}function Yt(e,t){return{}.toString.call(e)===`[object `+t+`]`}function Xt(e){return typeof Event<`u`&&function(e,t){try{return e instanceof t}catch{return!1}}(e,Event)}var Zt=[!0,`true`,1,`1`,`yes`],Qt=e=>P(Zt,e),$t=[!1,`false`,0,`0`,`no`];function en(e,t,n,r,i){return t>n&&(r.warn(`min cannot be greater than max.`),t=n),Ut(e)?e>n?(r.warn(` cannot be greater than max: `+n+`. Using max value instead.`),n):t>e?(r.warn(` cannot be less than min: `+t+`. Using min value instead.`),t):e:(r.warn(` must be a number. using max or fallback. max: `+n+`, fallback: `+i),en(i||n,t,n,r))}var tn=class{constructor(e){this.$t={},this.zt=e.zt,this.Ut=en(e.bucketSize,0,100,e.Gt),this.Wt=en(e.refillRate,0,this.Ut,e.Gt),this.Xt=en(e.refillInterval,0,864e5,e.Gt)}Jt(e,t){var n=Math.floor((t-e.lastAccess)/this.Xt);n>0&&(e.tokens=Math.min(e.tokens+n*this.Wt,this.Ut),e.lastAccess+=n*this.Xt)}consumeRateLimit(e){var t,n=Date.now(),r=String(e),i=this.$t[r];return i?this.Jt(i,n):this.$t[r]=i={tokens:this.Ut,lastAccess:n},i.tokens===0||(i.tokens--,i.tokens===0&&((t=this.zt)==null||t.call(this,e)),i.tokens===0)}stop(){this.$t={}}},nn,rn,an,on=`Mobile`,sn=`iOS`,cn=`Android`,ln=`Tablet`,un=cn+` `+ln,dn=`iPad`,fn=`Apple`,pn=fn+` Watch`,mn=`Safari`,hn=`BlackBerry`,gn=`Samsung`,_n=gn+`Browser`,vn=gn+` Internet`,yn=`Chrome`,bn=yn+` OS`,xn=yn+` `+sn,Sn=`Internet Explorer`,Cn=Sn+` `+on,wn=`Opera`,Tn=wn+` Mini`,En=`Edge`,Dn=`Microsoft `+En,On=`Firefox`,kn=On+` `+sn,An=`Nintendo`,jn=`PlayStation`,Mn=`Xbox`,Nn=cn+` `+on,Pn=on+` `+mn,Fn=`Windows`,In=Fn+` Phone`,Ln=`Nokia`,Rn=`Ouya`,zn=`Generic`,Bn=zn+` `+on.toLowerCase(),Vn=zn+` `+ln.toLowerCase(),Hn=`Konqueror`,Un=`(\\d+(\\.\\d+)?)`,Wn=RegExp(`Version/`+Un),Gn=new RegExp(Mn,`i`),Kn=RegExp(jn+` \\w+`,`i`),qn=RegExp(An+` \\w+`,`i`),Jn=RegExp(hn+`|PlayBook|BB10`,`i`),Yn={"NT3.51":`NT 3.11`,"NT4.0":`NT 4.0`,"5.0":`2000`,5.1:`XP`,5.2:`XP`,"6.0":`Vista`,6.1:`7`,6.2:`8`,6.3:`8.1`,6.4:`10`,"10.0":`10`},Xn=function(e,t){return t||=``,P(e,` OPR/`)&&P(e,`Mini`)?Tn:P(e,` OPR/`)?wn:Jn.test(e)?hn:P(e,`IE`+on)||P(e,`WPDesktop`)?Cn:P(e,_n)?vn:P(e,En)||P(e,`Edg/`)?Dn:P(e,`FBIOS`)?`Facebook `+on:P(e,`UCWEB`)||P(e,`UCBrowser`)?`UC Browser`:P(e,`CriOS`)?xn:P(e,`CrMo`)||P(e,yn)?yn:P(e,cn)&&P(e,mn)?Nn:P(e,`FxiOS`)?kn:P(e.toLowerCase(),Hn.toLowerCase())?Hn:((e,t)=>t&&P(t,fn)||function(e){return P(e,mn)&&!P(e,yn)&&!P(e,cn)}(e))(e,t)?P(e,on)?Pn:mn:P(e,On)?On:P(e,`MSIE`)||P(e,`Trident/`)?Sn:P(e,`Gecko`)?On:``},Zn={[Cn]:[RegExp(`rv:`+Un)],[Dn]:[RegExp(En+`?\\/`+Un)],[yn]:[RegExp(`(`+yn+`|CrMo)\\/`+Un)],[xn]:[RegExp(`CriOS\\/`+Un)],"UC Browser":[RegExp(`(UCBrowser|UCWEB)\\/`+Un)],[mn]:[Wn],[Pn]:[Wn],[wn]:[RegExp(`(Opera|OPR)\\/`+Un)],[On]:[RegExp(On+`\\/`+Un)],[kn]:[RegExp(`FxiOS\\/`+Un)],[Hn]:[RegExp(`Konqueror[:/]?`+Un,`i`)],[hn]:[RegExp(hn+` `+Un),Wn],[Nn]:[RegExp(`android\\s`+Un,`i`)],[vn]:[RegExp(_n+`\\/`+Un)],[Sn]:[RegExp(`(rv:|MSIE )`+Un)],Mozilla:[RegExp(`rv:`+Un)]},Qn=function(e,t){var n=Zn[Xn(e,t)];if(I(n))return null;for(var r=0;n.length>r;r++){var i=e.match(n[r]);if(i)return parseFloat(i[i.length-2])}return null},$n=[[RegExp(Mn+`; `+Mn+` (.*?)[);]`,`i`),e=>[Mn,e&&e[1]||``]],[new RegExp(An,`i`),[An,``]],[new RegExp(jn,`i`),[jn,``]],[Jn,[hn,``]],[new RegExp(Fn,`i`),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[In,``];if(new RegExp(on).test(t)&&!/IEMobile\b/.test(t))return[Fn+` `+on,``];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=Yn[n[1]]||``;return/arm/i.test(t)&&(r=`RT`),[Fn,r]}return[Fn,``]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[sn,[e[3],e[4],e[5]||`0`].join(`.`)]:[sn,``]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t=``;return e&&e.length>=3&&(t=I(e[2])?e[3]:e[2]),[`watchOS`,t]}],[RegExp(`(`+cn+` (\\d+)\\.(\\d+)\\.?(\\d+)?|`+cn+`)`,`i`),e=>e&&e[2]?[cn,[e[2],e[3],e[4]||`0`].join(`.`)]:[cn,``]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=[`Mac OS X`,``];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||`0`].join(`.`)),t}],[/Mac/i,[`Mac OS X`,``]],[/CrOS/,[bn,``]],[/Linux|debian/i,[`Linux`,``]]],er=function(e){return qn.test(e)?An:Kn.test(e)?jn:Gn.test(e)?Mn:new RegExp(Rn,`i`).test(e)?Rn:RegExp(`(`+In+`|WPDesktop)`,`i`).test(e)?In:/iPad/.test(e)?dn:/iPod/.test(e)?`iPod Touch`:/iPhone/.test(e)?`iPhone`:/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?pn:Jn.test(e)?hn:/(kobo)\s(ereader|touch)/i.test(e)?`Kobo`:new RegExp(Ln,`i`).test(e)?Ln:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?`Kindle Fire`:/(Android|ZTE)/i.test(e)?new RegExp(on).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?cn:un:RegExp(`(pda|`+on+`)`,`i`).test(e)?Bn:new RegExp(ln,`i`).test(e)&&!RegExp(ln+` pc`,`i`).test(e)?Vn:``},tr=e=>e instanceof Error,nr={trace:{text:`TRACE`,number:1},debug:{text:`DEBUG`,number:5},info:{text:`INFO`,number:9},warn:{text:`WARN`,number:13},error:{text:`ERROR`,number:17},fatal:{text:`FATAL`,number:21}},rr=nr.info;function ir(e){if(Gt(e))return{boolValue:e};if(typeof e==`number`)return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if(typeof e==`string`)return{stringValue:e};if(F(e))return{arrayValue:{values:e.map((e=>ir(e)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function ar(e){var t=[];for(var n in e){var r=e[n];Ht(r)||I(r)||t.push({key:n,value:ir(r)})}return t}function or(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return an&&n.length===rn||(rn=n.length,an=n.reduce(((n,r)=>{nn||={};var i=nn[r];if(i)n[i[0]]=i[1];else for(var a=e(r),o=a.length-1;o>=0;o--){var s=a[o]?.filename,c=t[r];if(s&&c){n[s]=c,nn[r]=[s,c];break}}return n}),{})),an}}var sr=class{constructor(e,t,n){n===void 0&&(n=[]),this.coercers=e,this.stackParser=t,this.modifiers=n}buildFromUnknown(e,t){t===void 0&&(t={});var n=t&&t.mechanism||{handled:!0,type:`generic`},r=this.buildCoercingContext(n,t,0).apply(e),i=this.buildParsingContext(t),a=this.parseStacktrace(r,i);return{$exception_list:this.convertToExceptionList(a,n),$exception_level:`error`}}modifyFrames(e){var t=this;return Et((function*(){for(var n of e)n.stacktrace&&n.stacktrace.frames&&F(n.stacktrace.frames)&&(n.stacktrace.frames=yield t.applyModifiers(n.stacktrace.frames));return e}))()}coerceFallback(e){return{type:`Error`,value:`Unknown error`,stack:e.syntheticException?.stack,synthetic:!0}}parseStacktrace(e,t){var n,r;return e.cause!=null&&(n=this.parseStacktrace(e.cause,t)),e.stack!=``&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),N({},e,{cause:n,stack:r})}applyChunkIds(e,t){return e.map((e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e)))}applyCoercers(e,t){for(var n of this.coercers)if(n.match(e))return n.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return Et((function*(){var n=e;for(var r of t.modifiers)n=yield r(n);return n}))()}convertToExceptionList(e,t){var n,r,i={type:e.type,value:e.value,mechanism:{type:t.type??`generic`,handled:(n=t.handled)==null||n,synthetic:(r=e.synthetic)!=null&&r}};e.stack&&(i.stacktrace={type:`raw`,frames:e.stack});var a=[i];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,N({},t,{handled:!0}))),a}buildParsingContext(e){return{chunkIdMap:or(this.stackParser),skipFirstLines:e.skipFirstLines??1}}buildCoercingContext(e,t,n){n===void 0&&(n=0);var r=(n,r)=>{if(4>=r){var i=this.buildCoercingContext(e,t,r);return this.applyCoercers(n,i)}};return N({},t,{syntheticException:n==0?t.syntheticException:void 0,mechanism:e,apply:e=>r(e,n),next:e=>r(e,n+1)})}},cr=`?`;function lr(e,t,n,r,i){var a={platform:e,filename:t,function:n===`<anonymous>`?cr:n,in_app:!0};return I(r)||(a.lineno=r),I(i)||(a.colno=i),a}var ur=(e,t)=>{var n=e.indexOf(`safari-extension`)!==-1,r=e.indexOf(`safari-web-extension`)!==-1;return n||r?[e.indexOf(`@`)===-1?cr:e.split(`@`)[0],n?`safari-extension:`+t:`safari-web-extension:`+t]:[e,t]},dr=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,fr=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,pr=/\((\S*)(?::(\d+))(?::(\d+))\)/,mr=(e,t)=>{var n=dr.exec(e);if(n){var[,r,i,a]=n;return lr(t,r,cr,+i,+a)}var o=fr.exec(e);if(o){if(o[2]&&o[2].indexOf(`eval`)===0){var s=pr.exec(o[2]);s&&(o[2]=s[1],o[3]=s[2],o[4]=s[3])}var[c,l]=ur(o[1]||cr,o[2]);return lr(t,l,c,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},hr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,gr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,_r=(e,t)=>{var n=hr.exec(e);if(n){if(n[3]&&n[3].indexOf(` > eval`)>-1){var r=gr.exec(n[3]);r&&(n[1]=n[1]||`eval`,n[3]=r[1],n[4]=r[2],n[5]=``)}var i=n[3],a=n[1]||cr;return[a,i]=ur(a,i),lr(t,i,a,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},vr=/\(error: (.*)\)/,yr=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var n=Bt(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?`DOMError`:`DOMException`}getValue(e){var t=e.name||(this.isDOMError(e)?`DOMError`:`DOMException`);return e.message?t+`: `+e.message:t}isDOMException(e){return Yt(e,`DOMException`)}isDOMError(e){return Yt(e,`DOMError`)}},br=class{match(e){return(e=>e instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var n=e.message;return String(n.error&&typeof n.error.message==`string`?n.error.message:n)}getStack(e){return e.stacktrace||e.stack||void 0}},xr=class{constructor(){}match(e){return Yt(e,`ErrorEvent`)&&e.error!=null}coerce(e,t){return t.apply(e.error)||{type:`ErrorEvent`,value:e.message,stack:t.syntheticException?.stack,synthetic:!0}}},Sr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Cr=class{match(e){return typeof e==`string`}coerce(e,t){var[n,r]=this.getInfos(e);return{type:n??`Error`,value:r??e,stack:t.syntheticException?.stack,synthetic:!0}}getInfos(e){var t=`Error`,n=e,r=e.match(Sr);return r&&(t=r[1],n=r[2]),[t,n]}},wr=[`fatal`,`error`,`warning`,`log`,`info`,`debug`];function Tr(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return`[object has no keys]`;for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(`, `);if(t>=i.length)return r===n.length?i:i.length>t?i.slice(0,t)+`...`:i}return``}var Er=class{match(e){return typeof e==`object`&&!!e}coerce(e,t){var n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:t.syntheticException?.stack,level:this.isSeverityLevel(e.level)?e.level:`error`,synthetic:!0}}getType(e){return Xt(e)?e.constructor.name:`Error`}getValue(e){if(`name`in e&&typeof e.name==`string`){var t=`'`+e.name+`' captured as exception`;return`message`in e&&typeof e.message==`string`&&(t+=` with message: '`+e.message+`'`),t}if(`message`in e&&typeof e.message==`string`)return e.message;var n=this.getObjectClassName(e);return(n&&n!==`Object`?`'`+n+`'`:`Object`)+` captured as exception with keys: `+Tr(e)}isSeverityLevel(e){return Bt(e)&&!Vt(e)&&wr.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var n=e[t];if(tr(n))return n}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Dr=class{match(e){return Xt(e)}coerce(e,t){var n=e.constructor.name;return{type:n,value:n+` captured as exception with keys: `+Tr(e),stack:t.syntheticException?.stack,synthetic:!0}}},Or=class{match(e){return Jt(e)}coerce(e,t){return{type:`Error`,value:`Primitive value captured as exception: `+String(e),stack:t.syntheticException?.stack,synthetic:!0}}},kr=class{match(e){return Yt(e,`PromiseRejectionEvent`)||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Xt(e))return!1;try{var t=e.detail;return typeof t==`object`&&!!t&&`reason`in t}catch{return!1}}coerce(e,t){var n=this.getUnhandledRejectionReason(e);return Jt(n)?{type:`UnhandledRejection`,value:`Non-Error promise rejection captured with value: `+String(n),stack:t.syntheticException?.stack,synthetic:!0}:t.apply(n)}getUnhandledRejectionReason(e){try{if(`reason`in e)return e.reason;if(`detail`in e&&e.detail!=null&&typeof e.detail==`object`&&`reason`in e.detail)return e.detail.reason}catch{}return e}},Ar=`$message`,jr=`$timestamp`,Mr=new Set([Ar,jr]),Nr={enabled:!0,max_bytes:32768};function Pr(e){return e?{enabled:e.enabled??Nr.enabled,max_bytes:Ir(e.max_bytes,Nr.max_bytes)}:N({},Nr)}var Fr=class{constructor(e){this.Kt=[],this.Qt=0,this.Bt=Pr(e)}setConfig(e){this.Bt=Pr(e),this.er()}add(e){var t=function(e){var t=function(e){var t=new WeakSet;try{return JSON.stringify(e,((e,n)=>{if(typeof n==`bigint`)return n.toString();if(typeof n!=`function`&&typeof n!=`symbol`){if(n instanceof Date)return n.toISOString();if(n instanceof Error)return{name:n.name,message:n.message,stack:n.stack};if(n&&typeof n==`object`){if(t.has(n))return`[Circular]`;t.add(n)}return n}}))}catch{return}}(e);if(t)try{var n=JSON.parse(t);if(!Rt(n))return;var r=n,i=r[Ar],a=r[jr];return!Bt(i)||i.trim().length===0||!Bt(a)&&!Ut(a)?void 0:{step:r,json:t}}catch{return}}(e);if(t){var n=function(e){if(typeof TextEncoder<`u`)return new TextEncoder().encode(e).length;for(var t=encodeURIComponent(e),n=0,r=0;t.length>r;r++)t[r]===`%`?(n+=1,r+=2):n+=1;return n}(t.json);n>this.Bt.max_bytes||(this.Kt.push({step:t.step,bytes:n}),this.Qt+=n,this.er())}}getAttachable(){return this.Kt.map((e=>e.step))}clear(){this.Kt=[],this.Qt=0}size(){return this.Kt.length}er(){for(;this.Qt>this.Bt.max_bytes&&this.Kt.length>0;){var e=this.Kt.shift();e&&(this.Qt-=e.bytes)}}};function Ir(e,t){if(!Ut(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var Lr=function(e,t){var{debugEnabled:n}=t===void 0?{}:t,r={C(t){if(A&&(wt.DEBUG||M.POSTHOG_DEBUG||n)&&!I(A.console)&&A.console){for(var r=(`__rrweb_original__`in A.console[t])?A.console[t].__rrweb_original__:A.console[t],i=arguments.length,a=Array(i>1?i-1:0),o=1;i>o;o++)a[o-1]=arguments[o];r(e,...a)}},info(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];r.C(`log`,...t)},warn(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];r.C(`warn`,...t)},error(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];r.C(`error`,...t)},critical(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];console.error(e,...n)},uninitializedWarning(e){r.error(`You must initialize PostHog before calling `+e)},createLogger:(t,n)=>Lr(e+` `+t,n)};return r},R=Lr(`[PostHog.js]`),Rr=R.createLogger,zr=Rr(`[ExternalScriptsLoader]`),Br=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return zr.warn(t+` was requested but loading of external scripts is disabled.`),n(`Loading of external scripts is disabled`);var r=j?.querySelectorAll(`script`);if(r){for(var i,a=function(){if(r[o].src===t){var e=r[o];return e.__posthog_loading_callback_fired?{v:n()}:(e.addEventListener(`load`,(t=>{e.__posthog_loading_callback_fired=!0,n(void 0,t)})),e.onerror=e=>n(e),{v:void 0})}},o=0;r.length>o;o++)if(i=a())return i.v}var s=()=>{if(!j)return n(`document not found`);var r=j.createElement(`script`);if(r.type=`text/javascript`,r.crossOrigin=`anonymous`,r.src=t,r.onload=e=>{r.__posthog_loading_callback_fired=!0,n(void 0,e)},r.onerror=e=>n(e),e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return n(`prepare_external_dependency_script returned null`);if(e.config.external_scripts_inject_target===`head`)j.head.appendChild(r);else{var i,a=j.querySelectorAll(`body > script`);a.length>0?(i=a[0].parentNode)==null||i.insertBefore(r,a[0]):j.body.appendChild(r)}};j!=null&&j.body?s():j?.addEventListener(`DOMContentLoaded`,s)};M.__PosthogExtensions__=M.__PosthogExtensions__||{},M.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t!==`remote-config`){var r;if(e.config.__preview_external_dependency_versioned_paths)r=e.requestRouter.endpointFor(`assets`,`/static/`+e.version+`/`+t+`.js`);else{var i=`/static/`+t+`.js?v=`+e.version;if(t===`toolbar`){var a=3e5;i=i+`&t=`+Math.floor(Date.now()/a)*a}r=e.requestRouter.endpointFor(`assets`,i)}Br(e,r,n)}else Br(e,e.requestRouter.endpointFor(`assets`,`/array/`+e.config.token+`/config.js`),n)},M.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{Br(e,e.requestRouter.endpointFor(`api`,t),n)};var Vr=`$people_distinct_id`,Hr=`$device_id`,Ur=`__alias`,Wr=`__timers`,Gr=`$autocapture_disabled_server_side`,Kr=`$heatmaps_enabled_server_side`,qr=`$exception_capture_enabled_server_side`,Jr=`$error_tracking_suppression_rules`,Yr=`$error_tracking_capture_extension_exceptions`,Xr=`$web_vitals_enabled_server_side`,Zr=`$dead_clicks_enabled_server_side`,Qr=`$product_tours_enabled_server_side`,$r=`$web_vitals_allowed_metrics`,ei=`$session_recording_remote_config`,ti=`$replay_override_sampling`,ni=`$replay_override_linked_flag`,ri=`$replay_override_url_trigger`,ii=`$replay_override_event_trigger`,ai=`$sesid`,oi=`$session_is_sampled`,si=`$enabled_feature_flags`,ci=`$active_feature_flags`,li=`$early_access_features`,ui=`$feature_flag_details`,di=`$feature_flag_payloads`,fi=`$feature_flag_request_id`,pi=`$override_feature_flags`,mi=`$override_feature_flag_payloads`,hi=`$stored_person_properties`,gi=`$stored_group_properties`,_i=`$surveys`,vi=`$surveys_activated`,yi=`ph_product_tours`,bi=`$flag_call_reported`,xi=`$flag_call_reported_session_id`,Si=`$feature_flag_errors`,Ci=`$feature_flag_evaluated_at`,wi=`$user_state`,Ti=`$client_session_props`,Ei=`$capture_rate_limit`,Di=`$initial_campaign_params`,Oi=`$initial_referrer_info`,ki=`$initial_person_info`,Ai=`$epp`,ji=`__POSTHOG_TOOLBAR__`,Mi=`$posthog_cookieless`,Ni=`$sdk_debug_extensions_init_method`,Pi=`$sdk_debug_extensions_init_time_ms`,Fi=`$sdk_debug_recording_script_not_loaded`,Ii=`PostHog loadExternalDependency extension not found.`,Li=`on_reject`,Ri=`always`,zi=`anonymous`,Bi=`identified`,Vi=`identified_only`,Hi=`visibilitychange`,Ui=`beforeunload`,Wi=`$pageview`,Gi=`$pageleave`,Ki=`$identify`,qi=`$groupidentify`;function Ji(e,t){F(e)&&e.forEach(t)}function Yi(e,t){if(!L(e))if(F(e))e.forEach(t);else if(Kt(e))e.forEach(((e,n)=>t(e,n)));else for(var n in e)Ft.call(e,n)&&t(e[n],n)}var Xi=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];for(var i of n)for(var a in i)i[a]!==void 0&&(e[a]=i[a]);return e};function Zi(e){for(var t=Object.keys(e),n=t.length,r=Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var Qi=function(e){try{return e()}catch{return}},$i=function(e){return function(){try{for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return e.apply(this,n)}catch(e){R.critical(`Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A.`),R.critical(e)}}},ea=function(e){var t={};return Yi(e,(function(e,n){(Bt(e)&&e.length>0||Ut(e))&&(t[n]=e)})),t},ta=[`herokuapp.com`,`vercel.app`,`netlify.app`];function na(e){var t=e?.hostname;if(!Bt(t))return!1;var n=t.split(`.`).slice(-2).join(`.`);for(var r of ta)if(n===r)return!1;return!0}function ra(e,t,n,r){var{capture:i=!1,passive:a=!0}=r??{};e?.addEventListener(t,n,{capture:i,passive:a})}function ia(e){return e.name===`ph_toolbar_internal`}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Ut(e)&&isFinite(e)&&Math.floor(e)===e});var aa=class e{constructor(e){if(this.bytes=e,e.length!==16)throw TypeError(`not 128-bit length`)}static fromFieldsV7(t,n,r,i){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||0>t||0>n||0>r||0>i||t>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw RangeError(`invalid field value`);var a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|n>>>8,a[7]=n,a[8]=128|r>>>24,a[9]=r>>>16,a[10]=r>>>8,a[11]=r,a[12]=i>>>24,a[13]=i>>>16,a[14]=i>>>8,a[15]=i,new e(a)}toString(){for(var e=``,t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),t!==3&&t!==5&&t!==7&&t!==9||(e+=`-`);if(e.length!==36)throw Error(`Invalid UUIDv7 was generated`);return e}clone(){return new e(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;16>t;t++){var n=this.bytes[t]-e.bytes[t];if(n!==0)return Math.sign(n)}return 0}},oa=class{constructor(){this.I=0,this.S=0,this.k=new la}generate(){var e=this.generateOrAbort();if(I(e)){this.I=0;var t=this.generateOrAbort();if(I(t))throw Error(`Could not generate UUID after timestamp reset`);return t}return e}generateOrAbort(){var e=Date.now();if(e>this.I)this.I=e,this.A();else{if(this.I>=e+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return aa.fromFieldsV7(this.I,Math.trunc(this.S/2**30),this.S&2**30-1,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}},sa,ca=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<`u`&&UUIDV7_DENY_WEAK_RNG)throw Error(`no cryptographically strong RNG available`);for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};A&&!I(A.crypto)&&crypto.getRandomValues&&(ca=e=>crypto.getRandomValues(e));var la=class{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(ca(this.T),this.N=0),this.T[this.N++]}},ua=()=>da().toString(),da=()=>(sa||=new oa).generate(),fa=``,pa=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,ma={R:()=>!!j,B(e){R.error(`cookieStore error: `+e)},O(e){if(j){try{for(var t=e+`=`,n=j.cookie.split(`;`).filter((e=>e.length)),r=0;n.length>r;r++){for(var i=n[r];i.charAt(0)==` `;)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}}catch{}return null}},Z(e){var t;try{t=JSON.parse(ma.O(e))||{}}catch{}return t},M(e,t,n,r,i){if(j)try{var a=``,o=``,s=function(e,t){if(t){var n=function(e,t){if(t===void 0&&(t=j),fa)return fa;if(!t||[`localhost`,`127.0.0.1`].includes(e))return``;for(var n=e.split(`.`),r=Math.min(n.length,8),i=`dmn_chk_`+ua();!fa&&r--;){var a=n.slice(r).join(`.`),o=i+`=1;domain=.`+a+`;path=/`;t.cookie=o+`;max-age=3`,t.cookie.includes(i)&&(t.cookie=o+`;max-age=0`,fa=a)}return fa}(e);if(!n){var r=(e=>{var t=e.match(pa);return t?t[0]:``})(e);r!==n&&R.info(`Warning: cookie subdomain discovery mismatch`,r,n),n=r}return n?`; domain=.`+n:``}return``}(j.location.hostname,r);if(n){var c=new Date;c.setTime(c.getTime()+864e5*n),a=`; expires=`+c.toUTCString()}i&&(o=`; secure`);var l=e+`=`+encodeURIComponent(JSON.stringify(t))+a+`; SameSite=Lax; path=/`+s+o;return l.length>3686.4&&R.warn(`cookieStore warning: large cookie, len=`+l.length),j.cookie=l,l}catch{return}},F(e,t){if(j!=null&&j.cookie)try{ma.M(e,``,-1,t)}catch{return}}},ha=null,ga={R(){if(!Ht(ha))return ha;var e=!0;if(I(A))e=!1;else try{var t=`__mplssupport__`;ga.M(t,`xyz`),ga.O(t)!==`"xyz"`&&(e=!1),ga.F(t)}catch{e=!1}return e||R.error(`localStorage unsupported; falling back to cookie store`),ha=e,e},B(e){R.error(`localStorage error: `+e)},O(e){try{return A?.localStorage.getItem(e)}catch(e){ga.B(e)}return null},Z(e){try{return JSON.parse(ga.O(e))||{}}catch{}return null},M(e,t){try{A?.localStorage.setItem(e,JSON.stringify(t))}catch(e){ga.B(e)}},F(e){try{A?.localStorage.removeItem(e)}catch(e){ga.B(e)}}},_a=[Hr,`distinct_id`,ai,oi,Ai,ki,wi],va={},ya={R:()=>!0,B(e){R.error(`memoryStorage error: `+e)},O:e=>va[e]||null,Z:e=>va[e]||null,M(e,t){va[e]=t},F(e){delete va[e]}},ba=null,xa={R(){if(!Ht(ba))return ba;if(ba=!0,I(A))ba=!1;else try{var e=`__support__`;xa.M(e,`xyz`),xa.O(e)!==`"xyz"`&&(ba=!1),xa.F(e)}catch{ba=!1}return ba},B(e){R.error(`sessionStorage error: `,e)},O(e){try{return A?.sessionStorage.getItem(e)}catch(e){xa.B(e)}return null},Z(e){try{return JSON.parse(xa.O(e))||null}catch{}return null},M(e,t){try{A?.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){xa.B(e)}},F(e){try{A?.sessionStorage.removeItem(e)}catch(e){xa.B(e)}}},Sa=class{constructor(e){this._instance=e}get Bt(){return this._instance.config}get consent(){return this.rr()?0:this.ir}isOptedOut(){return this.Bt.cookieless_mode===Ri||this.isRejected()||this.consent===-1&&this.Bt.cookieless_mode===Li}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Bt.opt_out_capturing_by_default}optInOut(e){this.nr.M(this.sr,+!!e,this.Bt.cookie_expiration,this.Bt.cross_subdomain_cookie,this.Bt.secure_cookie)}reset(){this.nr.F(this.sr,this.Bt.cross_subdomain_cookie)}get sr(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:n}=this._instance.config;return n||(t?t+e:`__ph_opt_in_out_`+e)}get ir(){var e=this.nr.O(this.sr);return Qt(e)?1:P($t,e)?0:-1}get nr(){var e=this.Bt.opt_out_capturing_persistence_type,t=e===`localStorage`?ga:ma;if(!this.ar||this.ar!==t){this.ar=t;var n=e===`localStorage`?ma:ga;n.O(this.sr)&&(this.ar.O(this.sr)||this.optInOut(Qt(n.O(this.sr))),n.F(this.sr,this.Bt.cross_subdomain_cookie))}return this.ar}rr(){return!!this.Bt.respect_dnt&&[gt?.doNotTrack,gt?.msDoNotTrack,M.doNotTrack].some((e=>Qt(e)))}},Ca=Rr(`[Dead Clicks]`),wa=()=>!0,Ta=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(Zr)),r=e.instance.config.capture_dead_clicks;return Gt(r)?r:!!Rt(r)||n},Ea=class{get lazyLoadedDeadClicksAutocapture(){return this.lr}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabledOrStop()}onRemoteConfig(e){`captureDeadClicks`in e&&(this.instance.persistence&&this.instance.persistence.register({[Zr]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.ur((()=>{this.hr()})):this.stop()}ur(e){var t,n;(t=M.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(n=M.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,`dead-clicks-autocapture`,(t=>{t?Ca.error(`failed to load script`,t):e()}))}hr(){var e;if(j){if(!this.lr&&(e=M.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=Rt(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.lr=M.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.lr.start(j),Ca.info(`starting...`)}}else Ca.error("`document` not found. Cannot start.")}stop(){this.lr&&(this.lr.stop(),this.lr=void 0,Ca.info(`stopping...`))}},Da=Rr(`[SegmentIntegration]`),Oa=`posthog-js`;function ka(e,t){var{organization:n,projectId:r,prefix:i,severityAllowList:a=[`error`],sendExceptionsToPostHog:o=!0}=t===void 0?{}:t;return t=>{if(a!==`*`&&!a.includes(t.level)||!e.__loaded)return t;t.tags||={};var s=e.requestRouter.endpointFor(`ui`,`/project/`+e.config.token+`/person/`+e.get_distinct_id());t.tags[`PostHog Person URL`]=s,e.sessionRecordingStarted()&&(t.tags[`PostHog Recording URL`]=e.get_session_replay_url({withTimestamp:!0}));var c,l=t.exception?.values||[],u=l.map((e=>N({},e,{stacktrace:e.stacktrace?N({},e.stacktrace,{type:`raw`,frames:(e.stacktrace.frames||[]).map((e=>N({},e,{platform:`web:javascript`})))}):void 0}))),d={$exception_message:l[0]?.value||t.message,$exception_type:l[0]?.type,$exception_level:t.level,$exception_list:u,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:l[0]?.value||t.message,$sentry_exception_type:l[0]?.type,$sentry_tags:t.tags};return n&&r&&(d.$sentry_url=(i||`https://sentry.io/organizations/`)+n+`/issues/?project=`+r+`&query=`+t.event_id),o&&((c=e.exceptions)==null||c.sendExceptionEvent(d)),t}}var Aa=class{constructor(e,t,n,r,i,a){this.name=Oa,this.setupOnce=function(o){o(ka(e,{organization:t,projectId:n,prefix:r,severityAllowList:i,sendExceptionsToPostHog:a==null||a}))}}},ja=class{constructor(e){this.cr=(e,t,n)=>{n&&(n.noSessionId||n.activityTimeout||n.sessionPastMaximumLength)&&(R.info(`[PageViewManager] Session rotated, clearing pageview state`,{sessionId:e,changeReason:n}),this.dr=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.vr()}vr(){this.pr=this._instance.sessionManager?.onSessionId(this.cr)}destroy(){var e;(e=this.pr)==null||e.call(this),this.pr=void 0}doPageView(e,t){var n=this.gr(e,t);return this.dr={pathname:A?.location.pathname??``,pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),n}doPageLeave(e){return this.gr(e,this.dr?.pageViewId)}doEvent(){return{$pageview_id:this.dr?.pageViewId}}gr(e,t){var n=this.dr;if(!n)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:n.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:o,maxScrollY:s,maxContentHeight:c,lastContentY:l,maxContentY:u}=i;if(!(I(a)||I(o)||I(s)||I(c)||I(l)||I(u))){a=Math.ceil(a),o=Math.ceil(o),s=Math.ceil(s),c=Math.ceil(c),l=Math.ceil(l),u=Math.ceil(u);var d=a>1?en(o/a,0,1,R):1,f=a>1?en(s/a,0,1,R):1,p=c>1?en(l/c,0,1,R):1,m=c>1?en(u/c,0,1,R):1;r=Xi(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:s,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:m})}}return n.pathname&&(r.$prev_pageview_pathname=n.pathname),n.timestamp&&(r.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),r}},Ma={[Vr]:{exposure:`hidden`},[Ur]:{exposure:`hidden`},__cmpns:{exposure:`hidden`},[Wr]:{exposure:`hidden`},[Gr]:{exposure:`event`},[Kr]:{exposure:`hidden`},[qr]:{exposure:`event`},[Jr]:{exposure:`hidden`},[Yr]:{exposure:`event`},[Xr]:{exposure:`event`},[Zr]:{exposure:`event`},[Qr]:{exposure:`hidden`},[$r]:{exposure:`event`},[ei]:{exposure:`hidden`},$session_recording_enabled_server_side:{exposure:`hidden`},[ai]:{exposure:`hidden`},[oi]:{exposure:`event`},$session_past_minimum_duration:{exposure:`event`},$session_recording_url_trigger_activated_session:{exposure:`event`},$session_recording_event_trigger_activated_session:{exposure:`event`},$debug_first_full_snapshot_timestamp:{exposure:`event`},[si]:{exposure:`derived`,shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!Rt(e))return{};for(var t={},n=Object.keys(e),r=0;n.length>r;r++)t[`$feature/`+n[r]]=e[n[r]];return t}},[ci]:{exposure:`event`},[li]:{exposure:`hidden`},[ui]:{exposure:`hidden`},[di]:{exposure:`event`},[fi]:{exposure:`event`},[pi]:{exposure:`event`},[mi]:{exposure:`hidden`},[hi]:{exposure:`hidden`},[gi]:{exposure:`hidden`},[_i]:{exposure:`hidden`},[vi]:{exposure:`event`},[yi]:{exposure:`hidden`},$product_tours_activated:{exposure:`hidden`},$conversations_widget_session_id:{exposure:`event`},$conversations_ticket_id:{exposure:`event`},$conversations_widget_state:{exposure:`event`},$conversations_user_traits:{exposure:`event`},[bi]:{exposure:`hidden`},[xi]:{exposure:`hidden`},[Si]:{exposure:`hidden`},[Ci]:{exposure:`hidden`},[wi]:{exposure:`hidden`},[Ti]:{exposure:`hidden`},[Ei]:{exposure:`hidden`},[Di]:{exposure:`hidden`},[Oi]:{exposure:`hidden`},[ki]:{exposure:`hidden`},[Ai]:{exposure:`hidden`},[ti]:{exposure:`event`},[ni]:{exposure:`event`},[ri]:{exposure:`event`},[ii]:{exposure:`event`},[Ni]:{exposure:`event`},[Pi]:{exposure:`event`},[Fi]:{exposure:`event`},$sdk_debug_replay_event_trigger_status:{exposure:`event`},$sdk_debug_replay_linked_flag_trigger_status:{exposure:`event`},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:`event`},$sdk_debug_replay_remote_trigger_matching_config:{exposure:`event`},$sdk_debug_replay_trigger_groups_count:{exposure:`event`},$sdk_debug_replay_url_trigger_status:{exposure:`event`},$session_recording_start_reason:{exposure:`event`}},Na=[[`$posthog_sr_group_event_trigger_`,{exposure:`hidden`}],[`$posthog_sr_group_url_trigger_`,{exposure:`hidden`}],[`$posthog_sr_group_sampling_`,{exposure:`hidden`}]],Pa=e=>{var t=j?.createElement(`a`);return I(t)?null:(t.href=e,t)},Fa=function(e,t){for(var n,r=((e.split(`#`)[0]||``).split(/\?(.*)/)[1]||``).replace(/^\?+/g,``).split(`&`),i=0;r.length>i;i++){var a=r[i].split(`=`);if(a[0]===t){n=a;break}}if(!F(n)||2>n.length)return``;var o=n[1];try{o=decodeURIComponent(o)}catch{R.error(`Skipping decoding for malformed query param: `+o)}return o.replace(/\+/g,` `)},Ia=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split(`#`),i=r[1],a=(r[0]||``).split(`?`),o=a[1],s=a[0],c=(o||``).split(`&`),l=[],u=0;c.length>u;u++){var d=c[u].split(`=`);F(d)&&(t.includes(d[0])?l.push(d[0]+`=`+n):l.push(c[u]))}var f=s;return o!=null&&(f+=`?`+l.join(`&`)),i!=null&&(f+=`#`+i),f},La=function(e,t){var n=e.match(RegExp(t+`=([^&]*)`));return n?n[1]:null},Ra=`https?://(.*)`,za=[`gclid`,`gclsrc`,`dclid`,`gbraid`,`wbraid`,`fbclid`,`msclkid`,`twclid`,`li_fat_id`,`igshid`,`ttclid`,`rdt_cid`,`epik`,`qclid`,`sccid`,`irclid`,`_kx`],Ba=[`utm_source`,`utm_medium`,`utm_campaign`,`utm_content`,`utm_term`,`gad_source`,`mc_cid`,...za],Va=`<masked>`,Ha=[`li_fat_id`];function Ua(e,t,n){if(!j)return{};var r,i=t?[...za,...n||[]]:[],a=Wa(Ia(j.URL,i,Va),e);return Xi((r={},Yi(Ha,(function(e){var t=ma.O(e);r[e]=t||null})),r),a)}function Wa(e,t){var n=Ba.concat(t||[]),r={};return Yi(n,(function(t){r[t]=Fa(e,t)||null})),r}function Ga(e){var t=function(e){return e?e.search(Ra+`google.([^/?]*)`)===0?`google`:e.search(Ra+`bing.com`)===0?`bing`:e.search(Ra+`yahoo.com`)===0?`yahoo`:e.search(Ra+`duckduckgo.com`)===0?`duckduckgo`:null:null}(e),n=t==`yahoo`?`p`:`q`,r={};if(!Ht(t)){r.$search_engine=t;var i=j?Fa(j.referrer,n):``;i.length&&(r.ph_keyword=i)}return r}function Ka(){return navigator.language||navigator.userLanguage}var qa=`$direct`;function Ja(){return j?.referrer||qa}function Ya(e,t){var n=e?[...za,...t||[]]:[],r=_t?.href.substring(0,1e3);return{r:Ja().substring(0,1e3),u:r?Ia(r,n,Va):void 0}}function Xa(e){var{r:t,u:n}=e,r={$referrer:t,$referring_domain:t==null?void 0:t==qa?qa:Pa(t)?.host};if(n){r.$current_url=n;var i=Pa(n);r.$host=i?.host,r.$pathname=i?.pathname,Xi(r,Wa(n))}return t&&Xi(r,Ga(t)),r}function Za(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Qa(){try{return new Date().getTimezoneOffset()}catch{return}}var $a=[`cookie`,`localstorage`,`localstorage+cookie`,`sessionstorage`,`memory`],eo=class{constructor(e,t){this.Bt=e,this.props={},this.mr=!1,this.yr=(e=>{var t=``;return e.token&&(t=e.token.replace(/\+/g,`PL`).replace(/\//g,`SL`).replace(/=/g,`EQ`)),e.persistence_name?`ph_`+e.persistence_name:`ph_`+t+`_posthog`})(e),this.nr=this.br(e),this.load(),e.debug&&R.info(`Persistence loaded`,e.persistence,N({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this._r}br(e){$a.indexOf(e.persistence.toLowerCase())===-1&&(R.critical(`Unknown persistence type `+e.persistence+`; falling back to localStorage+cookie`),e.persistence=`localStorage+cookie`);var t=function(e){e===void 0&&(e=[]);var t=[..._a,...e];return N({},ga,{Z(e){try{var t={};try{t=ma.Z(e)||{}}catch{}var n=Xi(t,JSON.parse(ga.O(e)||`{}`));return ga.M(e,n),n}catch{}return null},M(e,n,r,i,a,o){try{ga.M(e,n,void 0,void 0,o);var s={};t.forEach((e=>{n[e]&&(s[e]=n[e])})),Object.keys(s).length&&ma.M(e,s,r,i,a,o)}catch(e){ga.B(e)}},F(e,t){try{A?.localStorage.removeItem(e),ma.F(e,t)}catch(e){ga.B(e)}}})}(e.cookie_persisted_properties||[]),n=e.persistence.toLowerCase();return n===`localstorage`&&ga.R()?ga:n===`localstorage+cookie`&&t.R()?t:n===`sessionstorage`&&xa.R()?xa:n===`memory`?ya:n===`cookie`?ma:t.R()?t:ma}wr(e){var t=e??this.Bt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var n=this.props[Ci];return!n||typeof n!=`number`||Date.now()-n>t}properties(){var e={};return Yi(this.props,((t,n)=>{var r=(e=>{var t=Ma[e];if(t)return t;for(var[n,r]of Na)if(e.indexOf(n)===0)return r})(n);if(r?.exposure===`derived`){if(r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(t,n===si?()=>this.wr():()=>!1))return;r.transformToEventProperties&&Xi(e,r.transformToEventProperties(t))}else r&&r.exposure!==`event`||(e[n]=t)})),e}load(){if(!this._r){var e=this.nr.Z(this.yr);e&&(this.props=Xi({},e))}}save(){this._r||this.nr.M(this.yr,this.props,this.Ir,this.Cr,this.Sr,this.Bt.debug)}remove(){this.nr.F(this.yr,!1),this.nr.F(this.yr,!0)}clear(){this.remove(),this.props={}}register_once(e,t,n){if(Rt(e)){I(t)&&(t=`None`),this.Ir=I(n)?this.kr:n;var r=!1;if(Yi(e,((e,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.Tr(n,e),r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(Rt(e)){this.Ir=I(t)?this.kr:t;var n=!1;if(Yi(e,((t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this.Tr(r,t),n=!0)})),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Ar(e),this.save())}update_campaign_params(){if(!this.mr){var e=Ua(this.Bt.custom_campaign_params,this.Bt.mask_personal_data_properties,this.Bt.custom_personal_data_properties);zt(ea(e))||this.register(e),this.mr=!0}}update_search_keyword(){var e;this.register((e=j?.referrer)?Ga(e):{})}update_referrer_info(){this.register_once({$referrer:Ja(),$referring_domain:j!=null&&j.referrer&&Pa(j.referrer)?.host||qa},void 0)}set_initial_person_info(){this.props[Di]||this.props[Oi]||this.register_once({[ki]:Ya(this.Bt.mask_personal_data_properties,this.Bt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Yi([Oi,Di],(t=>{var n=this.props[t];n&&Yi(n,(function(t,n){e[`$initial_`+Nt(n)]=t}))}));var t,n,r=this.props[ki];return r&&Xi(e,(t=Xa(r),n={},Yi(t,(function(e,t){n[`$initial_`+Nt(t)]=e})),n)),e}safe_merge(e){return Yi(this.props,(function(t,n){n in e||(e[n]=t)})),e}update_config(e,t,n){if(this.kr=this.Ir=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var n=[...e].sort(),r=[...t].sort();return n.every(((e,t)=>e===r[t]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var r=this.br(e),i=this.props;this.clear(),this.nr=r,this.props=i,this.save()}}set_disabled(e){this._r=e,this._r?this.remove():this.save()}set_cross_subdomain(e){e!==this.Cr&&(this.Cr=e,this.remove(),this.save())}set_secure(e){e!==this.Sr&&(this.Sr=e,this.remove(),this.save())}set_event_timer(e,t){var n=this.props[Wr]||{};n[e]=t,this.Tr(Wr,n),this.save()}remove_event_timer(e){var t=this.props[Wr]||{},n=t[e];return I(n)||(delete t[e],this.Tr(Wr,t),this.save()),n}get_property(e){return this.props[e]}set_property(e,t){this.Tr(e,t),this.save()}Tr(e,t){this.props[e]=t}Ar(e){delete this.props[e]}},to={Activation:`events`,Cancellation:`cancelEvents`},no={Popover:`popover`,API:`api`,Widget:`widget`,ExternalSurvey:`external_survey`},ro={SHOWN:`survey shown`,DISMISSED:`survey dismissed`,SENT:`survey sent`,ABANDONED:`survey abandoned`},io={SURVEY_ID:`$survey_id`,SURVEY_NAME:`$survey_name`,SURVEY_RESPONSE:`$survey_response`,SURVEY_ITERATION:`$survey_iteration`,SURVEY_ITERATION_START_DATE:`$survey_iteration_start_date`,SURVEY_PARTIALLY_COMPLETED:`$survey_partially_completed`,SURVEY_SUBMISSION_ID:`$survey_submission_id`,SURVEY_QUESTIONS:`$survey_questions`,SURVEY_COMPLETED:`$survey_completed`,PRODUCT_TOUR_ID:`$product_tour_id`,SURVEY_LAST_SEEN_DATE:`$survey_last_seen_date`,SURVEY_LANGUAGE:`$survey_language`},ao={Popover:`popover`,Inline:`inline`},oo={SHOWN:`product tour shown`,DISMISSED:`product tour dismissed`,COMPLETED:`product tour completed`,STEP_SHOWN:`product tour step shown`,STEP_COMPLETED:`product tour step completed`,BUTTON_CLICKED:`product tour button clicked`,STEP_SELECTOR_FAILED:`product tour step selector failed`,BANNER_CONTAINER_SELECTOR_FAILED:`product tour banner container selector failed`,BANNER_ACTION_CLICKED:`product tour banner action clicked`},so={TOUR_ID:`$product_tour_id`,TOUR_NAME:`$product_tour_name`,TOUR_ITERATION:`$product_tour_iteration`,TOUR_RENDER_REASON:`$product_tour_render_reason`,TOUR_STEP_ID:`$product_tour_step_id`,TOUR_STEP_ORDER:`$product_tour_step_order`,TOUR_STEP_TYPE:`$product_tour_step_type`,TOUR_DISMISS_REASON:`$product_tour_dismiss_reason`,TOUR_BUTTON_TEXT:`$product_tour_button_text`,TOUR_BUTTON_ACTION:`$product_tour_button_action`,TOUR_BUTTON_LINK:`$product_tour_button_link`,TOUR_BUTTON_TOUR_ID:`$product_tour_button_tour_id`,TOUR_STEPS_COUNT:`$product_tour_steps_count`,TOUR_STEP_SELECTOR:`$product_tour_step_selector`,TOUR_STEP_SELECTOR_FOUND:`$product_tour_step_selector_found`,TOUR_STEP_ELEMENT_TAG:`$product_tour_step_element_tag`,TOUR_STEP_ELEMENT_ID:`$product_tour_step_element_id`,TOUR_STEP_ELEMENT_CLASSES:`$product_tour_step_element_classes`,TOUR_STEP_ELEMENT_TEXT:`$product_tour_step_element_text`,TOUR_ERROR:`$product_tour_error`,TOUR_MATCHES_COUNT:`$product_tour_matches_count`,TOUR_FAILURE_PHASE:`$product_tour_failure_phase`,TOUR_WAITED_FOR_ELEMENT:`$product_tour_waited_for_element`,TOUR_WAIT_DURATION_MS:`$product_tour_wait_duration_ms`,TOUR_BANNER_SELECTOR:`$product_tour_banner_selector`,TOUR_LINKED_SURVEY_ID:`$product_tour_linked_survey_id`,USE_MANUAL_SELECTOR:`$use_manual_selector`,INFERENCE_DATA_PRESENT:`$inference_data_present`,TOUR_LAST_SEEN_DATE:`$product_tour_last_seen_date`,TOUR_TYPE:`$product_tour_type`},co=Rr(`[RateLimiter]`),lo=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{co.info((e||`events`)+` is quota limited.`),this.serverLimits[e]=new Date().getTime()+6e4}))}catch(e){co.warn(`could not rate limit - continuing. Error: "`+e?.message+`"`,{text:t});return}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){return this.instance.config.rate_limiting?.events_per_second||10}get captureEventsBurstLimit(){return Math.max(this.instance.config.rate_limiting?.events_burst_limit||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t;e===void 0&&(e=!1);var{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,i=new Date().getTime(),a=this.instance.persistence?.get_property(Ei)??{tokens:n,last:i};a.tokens+=(i-a.last)/1e3*r,a.last=i,a.tokens>n&&(a.tokens=n);var o=1>a.tokens;return o||e||(a.tokens=Math.max(0,a.tokens-1)),!o||this.lastEventRateLimited||e||this.instance.capture(`$$client_ingestion_warning`,{$$client_ingestion_warning_message:`posthog-js client rate limited. Config is set to `+r+` events per second and `+n+` events burst limit.`},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,(t=this.instance.persistence)==null||t.set_property(Ei,a),{isRateLimited:o,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||`events`]||!1;return!1!==t&&new Date().getTime()<t}},uo=Rr(`[RemoteConfig]`),fo=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=M._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Er(e){var t,n;(t=M.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=M.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`remote-config`,(()=>e(this.remoteConfig))):e()}Rr(e){this._instance._send_request({method:`GET`,url:this._instance.requestRouter.endpointFor(`assets`,`/array/`+this._instance.config.token+`/config`),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return uo.info(`Using preloaded remote config`,this.remoteConfig),this.Nr(this.remoteConfig),void this.Mr();if(this._instance.Fr())return void uo.warn(`Remote config is disabled. Falling back to local config.`);this.Er((e=>{if(!e)return uo.info(`No config found after loading remote JS config. Falling back to JSON.`),void this.Rr((e=>{this.Nr(e),this.Mr()}));this.Nr(e),this.Mr()}))}catch(e){uo.error(`Error loading remote config`,e)}}stop(){this.Or&&=(clearInterval(this.Or),void 0)}refresh(){this._instance.Fr()||j?.visibilityState===`hidden`||this._instance.reloadFeatureFlags()}Mr(){if(!this.Or){var e=this._instance.config.remote_config_refresh_interval_ms??3e5;e!==0&&(this.Or=setInterval((()=>{this.refresh()}),e))}}Nr(e){var t;e||uo.error(`Failed to fetch remote config from PostHog.`),this._instance.Nr(e??{}),!1!==e?.hasFeatureFlags&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(t=this._instance.featureFlags)==null||t.ensureFlagsLoaded())}},po={GZipJS:`gzip-js`,Base64:`base64`},mo=Uint8Array,ho=Uint16Array,go=Uint32Array,_o=new mo([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),vo=new mo([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),yo=new mo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bo=function(e,t){for(var n=new ho(31),r=0;31>r;++r)n[r]=t+=1<<e[r-1];var i=new go(n[30]);for(r=1;30>r;++r)for(var a=n[r];n[r+1]>a;++a)i[a]=a-n[r]<<5|r;return[n,i]},xo=bo(_o,2),So=xo[1];xo[0][28]=258,So[258]=28;for(var Co=bo(vo,0)[1],wo=new ho(32768),To=0;32768>To;++To){var Eo=(43690&To)>>>1|(21845&To)<<1;wo[To]=((65280&(Eo=(61680&(Eo=(52428&Eo)>>>2|(13107&Eo)<<2))>>>4|(3855&Eo)<<4))>>>8|(255&Eo)<<8)>>>1}var Do=function(e,t,n){for(var r=e.length,i=0,a=new ho(t);r>i;++i)++a[e[i]-1];var o,s=new ho(t);for(i=0;t>i;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){o=new ho(1<<t);var c=15-t;for(i=0;r>i;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=s[e[i]-1]++<<u,f=d|(1<<u)-1;f>=d;++d)o[wo[d]>>>c]=l}else for(o=new ho(r),i=0;r>i;++i)o[i]=wo[s[e[i]-1]++]>>>15-e[i];return o},Oo=new mo(288);for(To=0;144>To;++To)Oo[To]=8;for(To=144;256>To;++To)Oo[To]=9;for(To=256;280>To;++To)Oo[To]=7;for(To=280;288>To;++To)Oo[To]=8;var ko=new mo(32);for(To=0;32>To;++To)ko[To]=5;var Ao=Do(Oo,9,0),jo=Do(ko,5,0),Mo=function(e){return(e/8>>0)+(7&e&&1)},No=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof ho?ho:e instanceof go?go:mo)(n-t);return r.set(e.subarray(t,n)),r},Po=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8},Fo=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8,e[r+2]|=n>>>16},Io=function(e,t){for(var n=[],r=0;e.length>r;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return[new mo(0),0];if(i==1){var o=new mo(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[d].f>n[l].f?l++:d++],c=n[l!=u&&n[d].f>n[l].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};var f=a[0].s;for(r=1;i>r;++r)a[r].s>f&&(f=a[r].s);var p=new ho(f+1),m=Lo(n[u-1],p,0);if(m>t){r=0;var h=0,g=m-t,_=1<<g;for(a.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));i>r;++r){var v=a[r].s;if(t>=p[v])break;h+=_-(1<<m-p[v]),p[v]=t}for(h>>>=g;h>0;){var y=a[r].s;t>p[y]?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}return[new mo(p),m]},Lo=function(e,t,n){return e.s==-1?Math.max(Lo(e.l,t,n+1),Lo(e.r,t,n+1)):t[e.s]=n},Ro=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new ho(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;t>=s;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return[n.subarray(0,r),t]},zo=function(e,t){for(var n=0,r=0;t.length>r;++r)n+=e[r]*t[r];return n},Bo=function(e,t,n){var r=n.length,i=Mo(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var a=0;r>a;++a)e[i+a+4]=n[a];return 8*(i+4+r)},Vo=function(e,t,n,r,i,a,o,s,c,l,u){Po(t,u++,n),++i[256];for(var d=Io(i,15),f=d[0],p=d[1],m=Io(a,15),h=m[0],g=m[1],_=Ro(f),v=_[0],y=_[1],b=Ro(h),x=b[0],S=b[1],C=new ho(19),w=0;v.length>w;++w)C[31&v[w]]++;for(w=0;x.length>w;++w)C[31&x[w]]++;for(var ee=Io(C,7),T=ee[0],te=ee[1],ne=19;ne>4&&!T[yo[ne-1]];--ne);var re,ie,ae,oe,E=l+5<<3,se=zo(i,Oo)+zo(a,ko)+o,ce=zo(i,f)+zo(a,h)+o+14+3*ne+zo(C,T)+(2*C[16]+3*C[17]+7*C[18]);if(se>=E&&ce>=E)return Bo(t,u,e.subarray(c,c+l));if(Po(t,u,1+(se>ce)),u+=2,se>ce){re=Do(f,p,0),ie=f,ae=Do(h,g,0),oe=h;var le=Do(T,te,0);for(Po(t,u,y-257),Po(t,u+5,S-1),Po(t,u+10,ne-4),u+=14,w=0;ne>w;++w)Po(t,u+3*w,T[yo[w]]);u+=3*ne;for(var ue=[v,x],de=0;2>de;++de){var fe=ue[de];for(w=0;fe.length>w;++w)Po(t,u,le[pe=31&fe[w]]),u+=T[pe],pe>15&&(Po(t,u,fe[w]>>>5&127),u+=fe[w]>>>12)}}else re=Ao,ie=Oo,ae=jo,oe=ko;for(w=0;s>w;++w)if(r[w]>255){var pe;Fo(t,u,re[257+(pe=r[w]>>>18&31)]),u+=ie[pe+257],pe>7&&(Po(t,u,r[w]>>>23&31),u+=_o[pe]);var me=31&r[w];Fo(t,u,ae[me]),u+=oe[me],me>3&&(Fo(t,u,r[w]>>>5&8191),u+=vo[me])}else Fo(t,u,re[r[w]]),u+=ie[r[w]];return Fo(t,u,re[256]),u+ie[256]},Ho=new go([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Uo=function(){for(var e=new go(256),t=0;256>t;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),Wo=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function Go(e,t){t===void 0&&(t={});var n=function(){var e=4294967295;return{p(t){for(var n=e,r=0;t.length>r;++r)n=Uo[255&n^t[r]]^n>>>8;e=n},d(){return 4294967295^e}}}(),r=e.length;n.p(e);var i,a,o,s,c,l=(s=10+((i=t).filename&&i.filename.length+1||0),c=8,function(e,t,n,r,i,a){var o=e.length,s=new mo(r+o+5*(1+Math.floor(o/7e3))+i),c=s.subarray(r,s.length-i),l=0;if(!t||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?l=Bo(c,l,e.subarray(u,d)):(c[u]=!0,l=Bo(c,l,e.subarray(u,o)))}else{for(var f=Ho[t-1],p=f>>>13,m=8191&f,h=(1<<n)-1,g=new ho(32768),_=new ho(h+1),v=Math.ceil(n/3),y=2*v,b=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<y)&h},x=new go(25e3),S=new ho(288),C=new ho(32),w=0,ee=0,T=(u=0,0),te=0,ne=0;o>u;++u){var re=b(u),ie=32767&u,ae=_[re];if(g[ie]=ae,_[re]=ie,u>=te){var oe=o-u;if((w>7e3||T>24576)&&oe>423){l=Vo(e,c,0,x,S,C,ee,T,ne,u-ne,l),T=w=ee=0,ne=u;for(var E=0;286>E;++E)S[E]=0;for(E=0;30>E;++E)C[E]=0}var se=2,ce=0,le=m,ue=ie-ae&32767;if(oe>2&&re==b(u-ue))for(var de=Math.min(p,oe)-1,fe=Math.min(32767,u),pe=Math.min(258,oe);fe>=ue&&--le&&ie!=ae;){if(e[u+se]==e[u+se-ue]){for(var me=0;pe>me&&e[u+me]==e[u+me-ue];++me);if(me>se){if(se=me,ce=ue,me>de)break;var he=Math.min(ue,me-2),ge=0;for(E=0;he>E;++E){var _e=u-ue+E+32768&32767,ve=_e-g[_e]+32768&32767;ve>ge&&(ge=ve,ae=_e)}}}ue+=(ie=ae)-(ae=g[ie])+32768&32767}if(ce){x[T++]=268435456|So[se]<<18|Co[ce];var ye=31&So[se],be=31&Co[ce];ee+=_o[ye]+vo[be],++S[257+ye],++C[be],te=u+se,++w}else x[T++]=e[u],++S[e[u]]}}l=Vo(e,c,!0,x,S,C,ee,T,ne,u-ne,l)}return No(s,0,r+Mo(l)+i)}(a=e,(o=t).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(a.length)))):12+o.mem,s,c)),u=l.length;return function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&Wo(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;n.length>=r;++r)e[r+10]=n.charCodeAt(r)}}(l,t),Wo(l,u-8,n.d()),Wo(l,u-4,r),l}var Ko=!!yt||!!vt,qo=`text/plain`,Jo=!1,Yo=function(e,t,n){n===void 0&&(n=!0);var[r,i]=e.split(`?`),a=N({},t),o=i?.split(`&`).map((e=>{var t,[r,i]=e.split(`=`),o=n&&(t=a[r])!=null?t:i;return delete a[r],r+`=`+o}))??[],s=function(e,t){var n,r;t===void 0&&(t=`&`);var i=[];return Yi(e,(function(e,t){I(e)||I(t)||t===`undefined`||(n=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),i[i.length]=r+`=`+n)})),i.join(t)}(a);return s&&o.push(s),r+`?`+o.join(`&`)},Xo=(e,t)=>JSON.stringify(e,((e,t)=>typeof t==`bigint`?t.toString():t),t),Zo=e=>{if(e.tr)return e.tr;var{data:t,compression:n}=e;if(t){if(n===po.GZipJS){var r=Go(function(e,t){var n=e.length;if(typeof TextEncoder<`u`)return new TextEncoder().encode(e);for(var r=new mo(e.length+(e.length>>>1)),i=0,a=function(e){r[i++]=e},o=0;n>o;++o){if(i+5>r.length){var s=new mo(i+8+(n-o<<1));s.set(r),r=s}var c=e.charCodeAt(o);128>c?a(c):2048>c?(a(192|c>>>6),a(128|63&c)):c>55295&&57344>c?(a(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++o))>>>18),a(128|c>>>12&63),a(128|c>>>6&63),a(128|63&c)):(a(224|c>>>12),a(128|c>>>6&63),a(128|63&c))}return No(r,0,i)}(Xo(t)),{mtime:0});return{contentType:qo,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===po.Base64){var i=(e=>`data=`+encodeURIComponent(typeof e==`string`?e:Xo(e)))(function(e){return e&&btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16)))))}(Xo(t)));return{contentType:`application/x-www-form-urlencoded`,body:i,estimatedSize:new Blob([i]).size}}var a=Xo(t);return{contentType:`application/json`,body:a,estimatedSize:new Blob([a]).size}}},Qo=function(){var e=Et((function*(e){var t=yield function(e,t,n){return Ot.apply(this,arguments)}(Xo(e.data),wt.DEBUG,{rethrow:!0});if(!t)return e;var n=yield t.arrayBuffer();return N({},e,{tr:{contentType:qo,body:n,estimatedSize:n.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),$o=(e,t)=>Yo(e,{_:new Date().getTime().toString(),ver:wt.JS_SDK_VERSION,compression:t}),es=[];vt&&es.push({transport:`fetch`,method(e){var{contentType:t,body:n,estimatedSize:r}=Zo(e)??{},i=new Headers;Yi(e.headers,(function(e,t){i.append(t,e)})),t&&i.append(`Content-Type`,t);var a=e.url,o=null;if(bt){var s=new bt;o={signal:s.signal,timeout:setTimeout((()=>s.abort()),e.timeout)}}vt(a,N({method:e?.method||`GET`,headers:i,keepalive:e.method===`POST`&&52428.8>(r||0),body:n,signal:o?.signal},e.fetchOptions)).then((t=>t.text().then((n=>{var r={statusCode:t.status,text:n};if(t.status===200)try{r.json=JSON.parse(n)}catch(e){R.error(e)}e.callback==null||e.callback(r)})))).catch((t=>{R.error(t),e.callback==null||e.callback({statusCode:0,error:t})})).finally((()=>o?clearTimeout(o.timeout):null))}}),yt&&es.push({transport:`XHR`,method(e){var t=new yt;t.open(e.method||`GET`,e.url,!0);var{contentType:n,body:r}=Zo(e)??{};Yi(e.headers,(function(e,n){t.setRequestHeader(n,e)})),n&&t.setRequestHeader(`Content-Type`,n),e.timeout&&(t.timeout=e.timeout),e.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var n={statusCode:t.status,text:t.responseText};if(t.status===200)try{n.json=JSON.parse(t.responseText)}catch{}e.callback==null||e.callback(n)}},t.send(r)}}),gt!=null&>.sendBeacon&&es.push({transport:`sendBeacon`,method(e){var t=Yo(e.url,{beacon:`1`});try{var{contentType:n,body:r}=Zo(e)??{};if(!r)return;var i=r instanceof Blob?r:new Blob([r],{type:n});gt.sendBeacon(t,i)}catch{}}});var ts=3e3,ns=class{constructor(e,t){this.Pr=!0,this.Lr=[],this.Dr=en(t?.flush_interval_ms||ts,250,5e3,R.createLogger(`flush interval`),ts),this.Br=e}enqueue(e){this.Lr.push(e),this.jr||this.$r()}unload(){this.qr();var e=this.Lr.length>0?this.Zr():{},t=Object.values(e);[...t.filter((e=>e.url.indexOf(`/e`)===0)),...t.filter((e=>e.url.indexOf(`/e`)!==0))].map((e=>{this.Br(N({},e,{transport:`sendBeacon`}))}))}enable(){this.Pr=!1,this.$r()}$r(){var e=this;this.Pr||(this.jr=setTimeout((()=>{if(this.qr(),this.Lr.length>0){var t=this.Zr(),n=function(){var n=t[r],i=new Date().getTime();n.data&&F(n.data)&&Yi(n.data,(e=>{e.offset=Math.abs(e.timestamp-i),delete e.timestamp})),e.Br(n)};for(var r in t)n()}}),this.Dr))}qr(){clearTimeout(this.jr),this.jr=void 0}Zr(){var e={};return Yi(this.Lr,(t=>{var n,r=t,i=(r?r.batchKey:null)||r.url;I(e[i])&&(e[i]=N({},r,{data:[]})),(n=e[i].data)==null||n.push(r.data)})),this.Lr=[],e}},rs=[`retriesPerformedSoFar`],is=class{constructor(e){this.Vr=!1,this.Hr=3e3,this.Lr=[],this._instance=e,this.Lr=[],this.zr=!0,!I(A)&&`onLine`in A.navigator&&(this.zr=A.navigator.onLine,this.Ur=()=>{this.zr=!0,this.Yr()},this.Gr=()=>{this.zr=!1},ra(A,`online`,this.Ur),ra(A,`offline`,this.Gr))}get length(){return this.Lr.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=Dt(e,rs);Wt(t)&&(n.url=Yo(n.url,{retry_count:t})),this._instance._send_request(N({},n,{callback:e=>{e.statusCode===200||e.statusCode>=400&&500>e.statusCode||(t??0)>=10?n.callback==null||n.callback(e):this.Wr(N({retriesPerformedSoFar:t},n))}}))}Wr(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=function(e){var t=3e3*2**e,n=t/2,r=Math.min(18e5,t),i=Math.random()-.5;return Math.ceil(r+i*(r-n))}(t),r=Date.now()+n;this.Lr.push({retryAt:r,requestOptions:e});var i=`Enqueued failed request for retry in `+n;navigator.onLine||(i+=` (Browser is offline)`),R.warn(i),this.Vr||(this.Vr=!0,this.Xr())}Xr(){if(this.Jr&&clearTimeout(this.Jr),this.Lr.length===0)return this.Vr=!1,void(this.Jr=void 0);this.Jr=setTimeout((()=>{this.zr&&this.Lr.length>0&&this.Yr(),this.Xr()}),this.Hr)}Yr(){var e=Date.now(),t=[],n=this.Lr.filter((n=>e>n.retryAt||(t.push(n),!1)));if(this.Lr=t,n.length>0)for(var{requestOptions:r}of n)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Jr&&=(clearTimeout(this.Jr),void 0),this.Vr=!1,I(A)||(this.Ur&&=(A.removeEventListener(`online`,this.Ur),void 0),this.Gr&&=(A.removeEventListener(`offline`,this.Gr),void 0)),this.Lr))try{this._instance._send_request(N({},e,{transport:`sendBeacon`}))}catch(e){R.error(e)}this.Lr=[]}},as=class{constructor(e){this.Kr=()=>{this.Qr||={};var e=this.scrollElement(),t=this.scrollY(),n=e?Math.max(0,e.scrollHeight-e.clientHeight):0,r=t+(e?.clientHeight||0),i=e?.scrollHeight||0;this.Qr.lastScrollY=Math.ceil(t),this.Qr.maxScrollY=Math.max(t,this.Qr.maxScrollY??0),this.Qr.maxScrollHeight=Math.max(n,this.Qr.maxScrollHeight??0),this.Qr.lastContentY=r,this.Qr.maxContentY=Math.max(r,this.Qr.maxContentY??0),this.Qr.maxContentHeight=Math.max(i,this.Qr.maxContentHeight??0)},this._instance=e}get ei(){return this._instance.config.scroll_root_selector}getContext(){return this.Qr}resetContext(){var e=this.Qr;return setTimeout(this.Kr,0),e}startMeasuringScrollPosition(){ra(A,`scroll`,this.Kr,{capture:!0}),ra(A,`scrollend`,this.Kr,{capture:!0}),ra(A,`resize`,this.Kr)}scrollElement(){if(!this.ei)return A?.document.documentElement;for(var e of F(this.ei)?this.ei:[this.ei]){var t=A?.document.querySelector(e);if(t)return t}}scrollY(){if(this.ei){var e=this.scrollElement();return e&&e.scrollTop||0}return A&&(A.scrollY||A.pageYOffset||A.document.documentElement.scrollTop)||0}scrollX(){if(this.ei){var e=this.scrollElement();return e&&e.scrollLeft||0}return A&&(A.scrollX||A.pageXOffset||A.document.documentElement.scrollLeft)||0}},ss=e=>Ya(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties),cs=class{constructor(e,t,n,r){this.ti=e=>{var t=this.ri();if(!t||t.sessionId!==e){var n={sessionId:e,props:this.ii(this._instance)};this.ni.register({[Ti]:n})}},this._instance=e,this.si=t,this.ni=n,this.ii=r||ss,this.si.onSessionId(this.ti)}ri(){return this.ni.props[Ti]}getSetOnceProps(){var e=this.ri()?.props;return e?`r`in e?Xa(e):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var e={};return Yi(ea(this.getSetOnceProps()),((t,n)=>{n===`$current_url`&&(n=`url`),e[`$session_entry_`+Nt(n)]=t})),e}},ls=class{constructor(){this.oi={}}on(e,t){return this.oi[e]||(this.oi[e]=[]),this.oi[e].push(t),()=>{this.oi[e]=this.oi[e].filter((e=>e!==t))}}emit(e,t){for(var n of this.oi[e]||[])n(t);for(var r of this.oi[`*`]||[])r(e,t)}},us=Rr(`[SessionId]`),ds=class{on(e,t){return this.ai.on(e,t)}constructor(e,t,n){var r;if(this.li=[],this.ui=void 0,this.ai=new ls,this.hi=(e,t)=>!(!Wt(e)||!Wt(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error(`SessionIdManager requires a PostHogPersistence instance`);if(e.config.cookieless_mode===Ri)throw Error(`SessionIdManager cannot be used with cookieless_mode="always"`);this.Bt=e.config,this.ni=e.persistence,this.ci=void 0,this.di=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.vi=t||ua,this.fi=n||ua;var i=this.Bt.persistence_name||this.Bt.token;if(this._sessionTimeoutMs=1e3*en(this.Bt.session_idle_timeout_seconds||1800,60,36e3,us.createLogger(`session_idle_timeout_seconds`),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.pi(),this.gi=`ph_`+i+`_window_id`,this.mi=`ph_`+i+`_primary_window_exists`,this.yi()){var a=xa.Z(this.gi),o=xa.Z(this.mi);a&&!o?this.ci=a:xa.F(this.gi),xa.M(this.mi,!0)}if((r=this.Bt.bootstrap)!=null&&r.sessionID)try{var s=(e=>{var t=this.Bt.bootstrap.sessionID.replace(/-/g,``);if(t.length!==32)throw Error(`Not a valid UUID`);if(t[12]!==`7`)throw Error(`Not a UUIDv7`);return parseInt(t.substring(0,12),16)})();this.bi(this.Bt.bootstrap.sessionID,new Date().getTime(),s)}catch(e){us.error(`Invalid sessionID in bootstrap`,e)}this.wi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return I(this.li)&&(this.li=[]),this.li.push(e),this.di&&e(this.di,this.ci),()=>{this.li=this.li.filter((t=>t!==e))}}yi(){return this.Bt.persistence!==`memory`&&!this.ni._r&&xa.R()}Ii(e){e!==this.ci&&(this.ci=e,this.yi()&&xa.M(this.gi,e))}Ci(){return this.ci?this.ci:this.yi()?xa.Z(this.gi):null}bi(e,t,n){e===this.di&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.di=e,this.ni.register({[ai]:[t,e,n]}))}Si(){var e=this.ni.props[ai];return F(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.bi(null,null,null)}destroy(){clearTimeout(this.xi),this.xi=void 0,this.ui&&A&&(A.removeEventListener(Ui,this.ui,{capture:!1}),this.ui=void 0),this.li=[]}wi(){this.ui=()=>{this.yi()&&xa.F(this.mi)},ra(A,Ui,this.ui,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.Bt.cookieless_mode===Ri)throw Error(`checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"`);var n=t||new Date().getTime(),[r,i,a]=this.Si(),o=this.Ci(),s=Wt(a)&&Math.abs(n-a)>864e5,c=!1,l=!i,u=!l&&!e&&this.hi(n,r);l||u||s?(i=this.vi(),o=this.fi(),us.info(`new session ID generated`,{sessionId:i,windowId:o,changeReason:{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:s}}),a=n,c=!0):o||(o=this.fi(),c=!0);var d=Wt(r)&&e&&!s?r:n,f=Wt(a)?a:new Date().getTime();return this.Ii(o),this.bi(i,d,f),e||this.pi(),c&&this.li.forEach((e=>e(i,o,c?{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:s}:void 0))),{sessionId:i,windowId:o,sessionStartTimestamp:f,changeReason:c?{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:s}:void 0,lastActivityTimestamp:r}}pi(){clearTimeout(this.xi),this.xi=setTimeout((()=>{var[e]=this.Si();if(this.hi(new Date().getTime(),e)){var t=this.di;this.resetSessionId(),this.ai.emit(`forcedIdleReset`,{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}},fs=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&At(n,t))return!0;try{var r=e?.userAgentData;if(r!=null&&r.brands&&r.brands.some((e=>At(e?.brand,t))))return!0}catch{}return!!e.webdriver},ps=function(e,t){if(!function(e){try{new RegExp(e)}catch{return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function ms(e,t,n){return Xo({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var hs={exact:(e,t)=>t.some((t=>e.some((e=>t===e)))),is_not:(e,t)=>t.every((t=>e.every((e=>t!==e)))),regex:(e,t)=>t.some((t=>e.some((e=>ps(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!ps(t,e))))),icontains:(e,t)=>t.map(gs).some((t=>e.map(gs).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(gs).every((t=>e.map(gs).every((e=>!t.includes(e))))),gt:(e,t)=>t.some((t=>{var n=parseFloat(t);return!isNaN(n)&&e.some((e=>n>parseFloat(e)))})),lt:(e,t)=>t.some((t=>{var n=parseFloat(t);return!isNaN(n)&&e.some((e=>n<parseFloat(e)))}))},gs=e=>e.toLowerCase();function _s(e,t){return!e||Object.entries(e).every((e=>{var[n,r]=e,i=t?.[n];if(I(i)||Ht(i))return!1;var a=[String(i)],o=hs[r.operator];return!!o&&o(r.values,a)}))}var vs=`custom`,ys=`i.posthog.com`,bs=/^\/static\//,xs=class{constructor(e){this.ki={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,``);return e===`https://app.posthog.com`?`https://us.i.posthog.com`:e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,``):this.apiHost}get uiHost(){var e=this.instance.config.ui_host?.replace(/\/$/,``);return e||=this.apiHost.replace(`.`+ys,`.posthog.com`),e===`https://app.posthog.com`?`https://us.posthog.com`:e}get region(){return this.ki[this.apiHost]||(this.ki[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?`us`:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?`eu`:vs),this.ki[this.apiHost]}Ti(e){var t=this.instance.config.__preview_external_dependency_versioned_paths;if(typeof t==`string`&&bs.test(e))return t.trim().replace(/\/$/,``)||void 0}endpointFor(e,t){if(t===void 0&&(t=``),t&&=t[0]===`/`?t:`/`+t,e===`ui`)return this.uiHost+t;if(e===`flags`)return this.flagsApiHost+t;if(e===`assets`){var n=this.Ti(t);if(n)return``+n+t}if(this.region===vs)return this.apiHost+t;var r=ys+t;switch(e){case`assets`:return`https://`+this.region+`-assets.`+r;case`api`:return`https://`+this.region+`.`+r}}},z=Rr(`[Surveys]`),Ss=`seenSurvey_`,Cs=[no.Popover,no.Widget,no.API],ws={ignoreConditions:!1,ignoreDelay:!1,displayType:ao.Popover},Ts=Rr(`[PostHog ExternalIntegrations]`),Es={intercom:`intercom-integration`,crispChat:`crisp-chat-integration`},Ds=class{constructor(e){this._instance=e}ur(e,t){var n;(n=M.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(e=>{if(e)return Ts.error(`failed to load script`,e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var n,i,a;!r||(n=M.__PosthogExtensions__)!=null&&(n=n.integrations)!=null&&n[t]||e.ur(Es[t],(()=>{var n;(n=M.__PosthogExtensions__)==null||(n=n.integrations)==null||(n=n[t])==null||n.start(e._instance)})),!r&&(i=M.__PosthogExtensions__)!=null&&(i=i.integrations)!=null&&i[t]&&((a=M.__PosthogExtensions__)==null||(a=a.integrations)==null||(a=a[t])==null||a.stop())};for(var[n,r]of Object.entries((i=this._instance.config.integrations)??{})){var i;t(n)}}},Os,ks={},As=0,js=()=>{},Ms=`Consent opt in/out is not valid with cookieless_mode="always" and will be ignored`,Ns=`Surveys module not available`,Ps=`sanitize_properties is deprecated. Use before_send instead`,Fs=`Invalid value for property_denylist config: `,Is=`posthog`,Ls=!Ko&&St?.indexOf(`MSIE`)===-1&&St?.indexOf(`Mozilla`)===-1,Rs=e=>{var t;return N({api_host:`https://us.i.posthog.com`,flags_api_host:null,ui_host:null,token:``,autocapture:!0,cross_subdomain_cookie:na(j?.location),persistence:`localStorage+cookie`,persistence_name:``,cookie_persisted_properties:[],loaded:js,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:`if_capture_pageview`,defaults:e??`unset`,__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,debug:_t&&Bt(_t?.search)&&_t.search.indexOf(`__posthog_debug=true`)!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(A==null||(t=A.location)==null?void 0:t.protocol)===`https:`,ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:`localStorage`,consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){R.error(`Bad HTTP status: `+e.statusCode+` `+e.text)},get_device_id:e=>e,capture_performance:void 0,name:`posthog`,bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Vi,before_send:void 0,request_queue_config:{flush_interval_ms:ts},error_tracking:{},_onCapture:js,__preview_eager_load_replay:!1},(e=>({rageclick:!e||`2025-11-30`>e||{content_ignorelist:!0},capture_pageview:!e||`2025-05-24`>e||`history_change`,session_recording:e&&e>=`2025-11-30`?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>=`2026-01-30`?`head`:`body`,internal_or_test_user_hostname:e&&e>=`2026-01-30`?/^(localhost|127\.0\.0\.1)$/:void 0}))(e))},zs=[[`process_person`,`person_profiles`],[`xhr_headers`,`request_headers`],[`cookie_name`,`persistence_name`],[`disable_cookie`,`disable_persistence`],[`store_google`,`save_campaign_params`],[`verbose`,`debug`]],Bs=e=>{var t={};for(var[n,r]of zs)I(e[n])||(t[r]=e[n]);var i=Xi({},t,e);return F(e.property_blacklist)&&(I(e.property_denylist)?i.property_denylist=e.property_blacklist:F(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:R.error(Fs+e.property_denylist)),i},Vs=class{constructor(){this.__forceAllowLocalhost=!1}get Ai(){return this.__forceAllowLocalhost}set Ai(e){R.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Hs=class e{Ei(e,t){if(e){var n=this.Ri.indexOf(e);n!==-1&&this.Ri.splice(n,1)}return this.Ri.push(t),t.initialize==null||t.initialize(),t}Ni(){return this.config.cookieless_mode===Ri||this.config.cookieless_mode===Li&&this.consent.isRejected()}get decideEndpointWasHit(){var e;return(e=this.featureFlags?.hasLoadedFlags)!=null&&e}get flagsEndpointWasHit(){var e;return(e=this.featureFlags?.hasLoadedFlags)!=null&&e}constructor(){this.webPerformance=new Vs,this.Mi=!1,this.version=wt.LIB_VERSION,this.Fi=new ls,this.Ri=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Rs(),this.SentryIntegration=Aa,this.sentryIntegration=e=>function(e,t){var n=ka(e,t);return{name:Oa,processEvent:e=>n(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint=`/e/`,this.Oi=!1,this.Pi=null,this.Li=null,this.Di=null,this.scrollManager=new as(this),this.pageViewManager=new ja(this),this.rateLimiter=new lo(this),this.requestRouter=new xs(this),this.consent=new Sa(this),this.externalIntegrations=new Ds(this);var t=e.__defaultExtensionClasses??{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,n)=>{var r=Bt(e)?{[e]:t}:e;this.setPersonProperties(r),n?.({})},set_once:(e,t,n)=>{var r=Bt(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),n?.({})}},this.on(`eventCaptured`,(e=>R.info(`send "`+e?.event+`"`,e)))}init(t,n,r){if(r&&r!==Is){var i=ks[r]??new e;return i._init(t,n,r),ks[r]=i,ks[Is][r]=i,i}return this._init(t,n,r)}_init(e,t,n){var r;if(t===void 0&&(t={}),I(e)||Vt(e))return R.critical(`PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()`),this;if(this.__loaded)return console.warn(`[PostHog.js]`,`You have already initialized PostHog! Re-initializing is a no-op`),this;this.__loaded=!0,this.config={},t.debug=this.Bi(t.debug),this.ji=t,this.$i=[],t.person_profiles?this.Li=t.person_profiles:t.process_person&&(this.Li=t.process_person),this.set_config(Xi({},Rs(t.defaults),Bs(t),{name:n,token:e})),this.config.on_xhr_error&&R.error(`on_xhr_error is deprecated. Use on_request_error instead`),this.compression=t.disable_compression?void 0:po.GZipJS;var i=this.qi();this.persistence=new eo(this.config,i),this.sessionPersistence=this.config.persistence===`sessionStorage`||this.config.persistence===`memory`?this.persistence:new eo(N({},this.config,{persistence:`sessionStorage`}),i);var a=N({},this.persistence.props),o=N({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Zi=new ns((e=>this.Vi(e)),this.config.request_queue_config),this.Hi=new is(this),this.__request_queue=[];var s=this.Ni();if(s||(this.sessionManager=new ds(this),this.sessionPropsManager=new cs(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(R.info(`Deferring extension initialization to improve startup performance`),setTimeout((()=>{this.zi(s)}),0)):(R.info(`Initializing extensions synchronously`),this.zi(s)),wt.DEBUG=wt.DEBUG||this.config.debug,wt.DEBUG&&R.info(`Starting in debug mode`,{this:this,config:t,thisC:N({},this.config),p:a,s:o}),!this.config.identity_distinct_id||(r=t.bootstrap)!=null&&r.distinctID||(t.bootstrap=N({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),t.bootstrap?.distinctID!==void 0){var c=t.bootstrap.distinctID,l=this.get_distinct_id(),u=this.persistence.get_property(wi);if(t.bootstrap.isIdentifiedID&&l!=null&&l!==c&&u===zi)this.identify(c);else if(t.bootstrap.isIdentifiedID&&l!=null&&l!==c&&u===Bi)R.warn(`Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.`);else{var d=this.config.get_device_id(ua()),f=t.bootstrap.isIdentifiedID?d:c;this.persistence.set_property(wi,t.bootstrap.isIdentifiedID?Bi:zi),this.register({distinct_id:c,$device_id:f})}}if(s)this.register_once({distinct_id:Mi,$device_id:null},``);else if(!this.get_distinct_id()){var p=this.config.get_device_id(ua());this.register_once({distinct_id:p,$device_id:p},``),this.persistence.set_property(wi,zi)}return ra(A,`onpagehide`in self?`pagehide`:`unload`,this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var n=e.config.segment;if(!n)return t();(function(e,t){var n=e.config.segment;if(!n)return t();var r=n=>{var r=()=>n.anonymousId()||ua();e.config.get_device_id=r,n.id()&&(e.register({distinct_id:n.id(),$device_id:r()}),e.persistence.set_property(wi,Bi)),t()},i=n.user();`then`in i&&Lt(i.then)?i.then(r):r(i)})(e,(()=>{n.register((e=>{Promise&&Promise.resolve||Da.warn(`This browser does not have Promise support, and can not use the segment integration`);var t=(t,n)=>{if(!n)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(Da.info(`No userId set, resetting PostHog`),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Da.info(`UserId set, identifying with PostHog`),e.identify(t.event.userId));var r=e.calculateEventProperties(n,t.event.properties);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:`PostHog JS`,type:`enrichment`,version:`1.0.0`,isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,Wi),identify:e=>t(e,Ki),screen:e=>t(e,`$screen`)}})(e)).then((()=>{t()}))}))}(this,(()=>this.Ui())):this.Ui(),Lt(this.config._onCapture)&&this.config._onCapture!==js&&(R.warn("onCapture is deprecated. Please use `before_send` instead"),this.on(`eventCaptured`,(e=>this.config._onCapture(e.event,e)))),this.config.ip&&R.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}zi(t){var n=performance.now(),r=N({},e.__defaultExtensionClasses,this.config.__extensionClasses),i=[];r.featureFlags&&this.Ri.push(this.featureFlags=this.featureFlags??new r.featureFlags(this)),r.exceptions&&this.Ri.push(this.exceptions=this.exceptions??new r.exceptions(this)),r.historyAutocapture&&this.Ri.push(this.historyAutocapture=new r.historyAutocapture(this)),r.tracingHeaders&&this.Ri.push(new r.tracingHeaders(this)),r.siteApps&&this.Ri.push(this.siteApps=new r.siteApps(this)),r.sessionRecording&&!t&&this.Ri.push(this.sessionRecording=new r.sessionRecording(this)),this.config.disable_scroll_properties||i.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),r.autocapture&&this.Ri.push(this.autocapture=new r.autocapture(this)),r.surveys&&this.Ri.push(this.surveys=this.surveys??new r.surveys(this)),r.logs&&this.Ri.push(this.logs=this.logs??new r.logs(this)),r.conversations&&this.Ri.push(this.conversations=this.conversations??new r.conversations(this)),r.productTours&&this.Ri.push(this.productTours=new r.productTours(this)),r.heatmaps&&this.Ri.push(this.heatmaps=new r.heatmaps(this)),r.webVitalsAutocapture&&this.Ri.push(this.webVitalsAutocapture=new r.webVitalsAutocapture(this)),r.exceptionObserver&&this.Ri.push(this.exceptionObserver=new r.exceptionObserver(this)),r.deadClicksAutocapture&&this.Ri.push(this.deadClicksAutocapture=new r.deadClicksAutocapture(this,Ta)),r.toolbar&&this.Ri.push(this.toolbar=this.toolbar??new r.toolbar(this)),r.experiments&&this.Ri.push(this.experiments=this.experiments??new r.experiments(this)),this.Ri.forEach((e=>{e.initialize&&i.push((()=>{e.initialize==null||e.initialize()}))})),i.push((()=>{if(this.Yi){var e=this.Yi;this.Yi=void 0,this.Nr(e)}})),this.Gi(i,n)}Gi(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.Gi(e,t)}),0);var n=e.shift();if(n)try{n()}catch(e){R.error(`Error initializing extension:`,e)}}var r=Math.round(performance.now()-t);this.register_for_session({[Ni]:this.config.__preview_deferred_init_extensions?`deferred`:`synchronous`,[Pi]:r}),this.config.__preview_deferred_init_extensions&&R.info(`PostHog extensions initialized (`+r+`ms)`)}Nr(e){var t;if(!j||!j.body)return R.info(`document not ready yet, trying again in 500 milliseconds...`),void setTimeout((()=>{this.Nr(e)}),500);this.config.__preview_deferred_init_extensions&&(this.Yi=e),this.Wi=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=P(e.supportedCompression,po.GZipJS)?po.GZipJS:P(e.supportedCompression,po.Base64)?po.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Li?this.Li:Vi}),this.Ri.forEach((t=>t.onRemoteConfig==null?void 0:t.onRemoteConfig(e)))}Ui(){try{this.config.loaded(this)}catch(e){R.critical("`loaded` function failed",e)}if(this.Xi(),this.config.internal_or_test_user_hostname&&_t!=null&&_t.hostname){var e=_t.hostname,t=this.config.internal_or_test_user_hostname;(typeof t==`string`?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ni())&&this.Ji()}),1),this.Ki=new fo(this),this.Ki.load()}Xi(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Zi)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Ji(this.__request_queue,(e=>this.Vi(e))),this.__request_queue=[],this.Xi()}_handle_unload(){var e,t,n,r;(e=this.surveys)==null||e.handlePageUnload(),this.config.request_batching?(this.Qi()&&this.capture(Gi),(t=this.logs)==null||t.flushLogs(`sendBeacon`),(n=this.Zi)==null||n.unload(),(r=this.Hi)==null||r.unload()):this.Qi()&&this.capture(Gi,null,{transport:`sendBeacon`})}_send_request(e){this.__loaded&&(Ls?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Yo(e.url,{ip:+!!this.config.ip}),e.headers=N({},this.config.request_headers,e.headers),e.compression=e.compression===`best-available`?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=[`sendBeacon`]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t=N({},e);t.timeout=t.timeout||6e4,t.url=$o(t.url,t.compression);var n=t.transport??`fetch`,r=es.filter((e=>!t.disableTransport||!e.transport||!t.disableTransport.includes(e.transport))),i=function(e,t){for(var r=0;e.length>r;r++)if(e[r].transport===n)return e[r]}(r)?.method??r[0].method;if(!i)throw Error(`No available transport method`);n!==`sendBeacon`&&t.data&&t.compression===po.GZipJS&&xt&&!Jo?Qo(t).then((e=>{i(e)})).catch((n=>{if((e=>!(!e||typeof e!=`object`)&&(`name`in e?String(e.name):``)===`NotReadableError`)(n))return Jo=!0,void i(N({},t,{compression:void 0,url:$o(e.url,void 0)}));i(t)})):i(t)})(N({},e,{callback:t=>{var n,r;this.rateLimiter.checkForLimiting(t),400>t.statusCode||(n=(r=this.config).on_request_error)==null||n.call(r,t),e.callback==null||e.callback(t)}}))))}Vi(e){this.Hi?this.Hi.retriableRequest(e):this._send_request(e)}_execute_array(e){As++;try{var t,n=[],r=[],i=[];Ji(e,(e=>{e&&(F(t=e[0])?i.push(e):Lt(e)?e.call(this):F(e)&&t===`alias`?n.push(e):F(e)&&t.indexOf(`capture`)!==-1&&Lt(this[t])?i.push(e):r.push(e))}));var a=function(e,t){Ji(e,(function(e){if(F(e[0])){var n=t;Yi(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}))};a(n,this),a(r,this),a(i,this)}finally{As--}}push(t){if(As>0&&F(t)&&Bt(t[0])){var n=e.prototype[t[0]];Lt(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(e,t,n){var r,i,a,o;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Zi){if(this.is_capturing())if(!I(e)&&Bt(e)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!s||this.config.__preview_capture_bot_pageviews){var c=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(c==null||!c.isRateLimited){t!=null&&t.$current_url&&!Bt(t?.$current_url)&&(R.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),e!==`$exception`||n!=null&&n.en||R.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var l=new Date,u=n?.timestamp||l,d=ua(),f={uuid:d,event:e,properties:this.calculateEventProperties(e,t||{},u,d)};e===Wi&&this.config.__preview_capture_bot_pageviews&&s&&(f.event=`$bot_pageview`,f.properties.$browser_type=`bot`),c&&(f.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens),n!=null&&n.$set&&(f.$set=n?.$set);var p,m,h,g=this.tn(n?.$set_once,e!==qi,e===Ki);if(g&&(f.$set_once=g),n!=null&&n._noTruncate||(r=this.config.properties_string_max_length,i=f,a=e=>Bt(e)?e.slice(0,r):e,o=new Set,f=function e(t,n){return t===Object(t)?o.has(t)?void 0:(o.add(t),F(t)?(r=[],Ji(t,(t=>{r.push(e(t))}))):(r={},Yi(t,((t,n)=>{o.has(t)||(r[n]=e(t,n))}))),r):a?a(t):t;var r}(i)),f.timestamp=u,I(n?.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=l),e===ro.DISMISSED||e===ro.SENT){var _=t?.[io.SURVEY_ID],v=t?.[io.SURVEY_ITERATION];(e=>{try{var t=(e=>((e,t)=>{var n=``+Ss+t.id;return t.current_iteration&&t.current_iteration>0&&(n=``+Ss+t.id+`_`+t.current_iteration),n})(0,e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,`true`)}catch(e){z.error(`Failed to persist survey seen state`,e)}})({id:_,current_iteration:v}),f.$set=N({},f.$set,{[(p={id:_,current_iteration:v},m=e===ro.SENT?`responded`:`dismissed`,h=`$survey_`+m+`/`+p.id,p.current_iteration&&p.current_iteration>0&&(h=`$survey_`+m+`/`+p.id+`/`+p.current_iteration),h)]:!0})}else e===ro.SHOWN&&(f.$set=N({},f.$set,{[io.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===oo.SHOWN){var y=t?.[so.TOUR_TYPE];y&&(f.$set=N({},f.$set,{[so.TOUR_LAST_SEEN_DATE+`/`+y]:new Date().toISOString()}))}var b=N({},f.properties.$set,f.$set);if(zt(b)||this.setPersonPropertiesForFlags(b),!L(this.config.before_send)){var x=this.rn(f);if(!x)return;f=x}this.Fi.emit(`eventCaptured`,f);var S={method:`POST`,url:n?._url??this.requestRouter.endpointFor(`api`,this.analyticsDefaultEndpoint),data:f,compression:`best-available`,batchKey:n?._batchKey};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.Vi(S):this.Zi.enqueue(S),f}R.critical(`This capture call is ignored due to client rate limiting.`)}}else R.error(`No event name provided to posthog.capture`)}else R.uninitializedWarning(`posthog.capture`)}_addCaptureHook(e){return this.on(`eventCaptured`,(t=>e(t.event,t)))}calculateEventProperties(e,t,n,r,i){if(n||=new Date,!this.persistence||!this.sessionPersistence)return t;var a=i?void 0:this.persistence.remove_event_timer(e),o=N({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.Ni()&&(o.$cookieless_mode=!0),e===`$snapshot`){var s=N({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=s.distinct_id,(!Bt(o.distinct_id)&&!Ut(o.distinct_id)||Vt(o.distinct_id))&&R.error(`Invalid distinct_id for replay event. This indicates a bug in your implementation`),o}var c,l=function(e,t){var n,r,i;if(!St)return{};var a,o,s,c,l=e?[...za,...t||[]]:[],[u,d]=function(e){for(var t=0;$n.length>t;t++){var[n,r]=$n[t],i=n.exec(e),a=i&&(Lt(r)?r(i,e):r);if(a)return a}return[``,``]}(St);return Xi(ea({$os:u,$os_version:d,$browser:Xn(St,navigator.vendor),$device:er(St),$device_type:(o=St,s={userAgentDataPlatform:(n=navigator)==null||(n=n.userAgentData)==null?void 0:n.platform,maxTouchPoints:navigator?.maxTouchPoints,screenWidth:A==null||(r=A.screen)==null?void 0:r.width,screenHeight:A==null||(i=A.screen)==null?void 0:i.height,devicePixelRatio:A?.devicePixelRatio},c=er(o),c===dn||c===un||c===`Kobo`||c===`Kindle Fire`||c===Vn?ln:c===An||c===Mn||c===jn||c===Rn?`Console`:c===pn?`Wearable`:c?on:s?.userAgentDataPlatform===`Android`&&(s?.maxTouchPoints??0)>0?600>Math.min(s?.screenWidth??0,s?.screenHeight??0)/(s?.devicePixelRatio??1)?on:ln:`Desktop`),$timezone:Za(),$timezone_offset:Qa()}),{$current_url:Ia(_t?.href,l,Va),$host:_t?.host,$pathname:_t?.pathname,$raw_user_agent:St.length>1e3?St.substring(0,997)+`...`:St,$browser_version:Qn(St,navigator.vendor),$browser_language:Ka(),$browser_language_prefix:(a=Ka(),typeof a==`string`?a.split(`-`)[0]:void 0),$screen_height:A?.screen.height,$screen_width:A?.screen.width,$viewport_height:A?.innerHeight,$viewport_width:A?.innerWidth,$lib:wt.LIB_NAME,$lib_version:wt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:u,windowId:d}=this.sessionManager.checkAndGetSessionAndWindowId(i,n.getTime());o.$session_id=u,o.$window_id=d}this.sessionPropsManager&&Xi(o,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&Xi(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=this.Hi?.length}catch(e){o.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===vs&&(o.$lib_custom_api_host=this.config.api_host),c=e!==Wi||i?e!==Gi||i?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,r),o=Xi(o,c),e===Wi&&j&&(o.title=j.title),!I(a)){var f=n.getTime()-a;o.$duration=parseFloat((f/1e3).toFixed(3))}St&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?`bot`:`browser`),(o=Xi({},l,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),F(this.config.property_denylist)?Yi(this.config.property_denylist,(function(e){delete o[e]})):R.error(Fs+this.config.property_denylist+` or property_blacklist config: `+this.config.property_blacklist);var p=this.config.sanitize_properties;p&&(R.error(Ps),o=p(o,e));var m=this.nn();return o.$process_person_profile=m,m&&!i&&this.sn(`_calculate_event_properties`),o}tn(e,t,n){if(t===void 0&&(t=!0),n===void 0&&(n=!1),!this.persistence||!this.nn()||this.Mi&&!n)return e;var r=Xi({},this.persistence.get_initial_props(),this.sessionPropsManager?.getSetOnceProps()||{},e||{}),i=this.config.sanitize_properties;return i&&(R.error(Ps),r=i(r,`$set_once`)),t&&(this.Mi=!0),zt(r)?void 0:r}register(e,t){var n;(n=this.persistence)==null||n.register(e,t)}register_once(e,t,n){var r;(r=this.persistence)==null||r.register_once(e,t,n)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}an(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags?.getFeatureFlag(e,t)}getFeatureFlagPayload(e){return this.featureFlags?.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){return this.featureFlags?.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){return this.featureFlags?.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,t,n){var r;(r=this.featureFlags)==null||r.updateFlags(e,t,n)}updateEarlyAccessFeatureEnrollment(e,t,n){var r;(r=this.featureFlags)==null||r.updateEarlyAccessFeatureEnrollment(e,t,n)}getEarlyAccessFeatures(e,t,n){return t===void 0&&(t=!1),this.featureFlags?.getEarlyAccessFeatures(e,t,n)}on(e,t){return this.Fi.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Ns}),()=>{})}onSessionId(e){return this.sessionManager?.onSessionId(e)??(()=>{})}getSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Ns})}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Ns})}renderSurvey(e,t){var n;(n=this.surveys)==null||n.renderSurvey(e,t)}displaySurvey(e,t){var n;t===void 0&&(t=ws),(n=this.surveys)==null||n.displaySurvey(e,t)}cancelPendingSurvey(e){var t;(t=this.surveys)==null||t.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys?.canRenderSurvey(e)??{visible:!1,disabledReason:Ns}}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys?.canRenderSurveyAsync(e,t)??Promise.resolve({visible:!1,disabledReason:Ns})}ln(e){return!e||Vt(e)?(R.critical(`Unique user id has not been set in posthog.identify`),!1):e===Mi?(R.critical(`The string "`+e+`" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):![`distinct_id`,`distinctid`].includes(e.toLowerCase())&&![`undefined`,`null`].includes(e.toLowerCase())||(R.critical(`The string "`+e+`" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(e,t,n){if(!this.__loaded||!this.persistence)return R.uninitializedWarning(`posthog.identify`);if(Ut(e)&&(e=e.toString(),R.warn(`The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.`)),this.ln(e)&&this.sn(`posthog.identify`)){var r=this.get_distinct_id();this.register({$user_id:e}),this.get_property(Hr)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},``),e!==r&&e!==this.get_property(Ur)&&(this.unregister(Ur),this.register({distinct_id:e}));var i,a=(this.persistence.get_property(wi)||zi)===zi;e!==r&&a?(this.persistence.set_property(wi,Bi),this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!1),this.capture(Ki,{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:n||{}}),this.Di=ms(e,t,n),(i=this.featureFlags)==null||i.setAnonymousDistinctId(r)):(t||n)&&this.setPersonProperties(t,n),e!==r&&(this.reloadFeatureFlags(),this.unregister(bi))}}setPersonProperties(e,t){if((e||t)&&this.sn(`posthog.setPersonProperties`)){var n=ms(this.get_distinct_id(),e,t);this.Di===n?R.info(`A duplicate setPersonProperties call was made with the same properties. It has been ignored.`):(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture(`$set`,{$set:e||{},$set_once:t||{}}),this.Di=n)}}group(e,t,n){if(e&&t){var r=this.getGroups(),i=r[e]!==t;if(i&&this.resetGroupPropertiesForFlags(e),this.register({$groups:N({},r,{[e]:t})}),i||n){var a={$group_type:e,$group_key:t};n&&(a.$group_set=n),this.capture(qi,a)}n&&this.setGroupPropertiesForFlags({[e]:n}),i&&!n&&this.reloadFeatureFlags()}else R.error(`posthog.group requires a group type and group key`)}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var n;t===void 0&&(t=!0),(n=this.featureFlags)==null||n.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){var e;(e=this.featureFlags)==null||e.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){var n;t===void 0&&(t=!0),this.sn(`posthog.setGroupPropertiesForFlags`)&&((n=this.featureFlags)==null||n.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;(t=this.featureFlags)==null||t.resetGroupPropertiesForFlags(e)}reset(e){var t,n,r,i,a,o,s,c;if(R.info(`reset`),!this.__loaded)return R.uninitializedWarning(`posthog.reset`);var l=this.get_property(Hr);if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(n=this.sessionPersistence)==null||n.clear(),(r=this.surveys)==null||r.reset(),(i=this.Ki)==null||i.stop(),(a=this.featureFlags)==null||a.reset(),(o=this.conversations)==null||o.reset(),(s=this.persistence)==null||s.set_property(wi,zi),(c=this.sessionManager)==null||c.resetSessionId(),this.Di=null,this.config.cookieless_mode===Ri)this.register_once({distinct_id:Mi,$device_id:null},``);else{var u=this.config.get_device_id(ua());this.register_once({distinct_id:u,$device_id:e?u:l},``)}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,t){var n;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),(n=this.conversations)==null||n.un()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.hn()}get_distinct_id(){return this.get_property(`distinct_id`)}getGroups(){return this.get_property(`$groups`)||{}}get_session_id(){return this.sessionManager?.checkAndGetSessionAndWindowId(!0).sessionId??``}get_session_replay_url(e){if(!this.sessionManager)return``;var{sessionId:t,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor(`ui`,`/project/`+this.config.token+`/replay/`+t);if(e!=null&&e.withTimestamp&&n){var i=e.timestampLookBack??10;if(!n)return r;r+=`?t=`+Math.max(Math.floor((new Date().getTime()-n)/1e3)-i,0)}return r}alias(e,t){return e===this.get_property(Vr)?(R.critical(`Attempting to create alias for existing People user - aborting.`),-2):this.sn(`posthog.alias`)?(I(t)&&(t=this.get_distinct_id()),e===t?(R.warn(`alias matches current distinct_id - skipping api call.`),this.identify(e),-1):(this.an(Ur,e),this.capture(`$create_alias`,{alias:e,distinct_id:t}))):void 0}set_config(e){var t=N({},this.config);if(Rt(e)){var n,r,i,a,o,s,c,l,u,d;Xi(this.config,Bs(e));var f=this.qi();(n=this.persistence)==null||n.update_config(this.config,t,f),this.sessionPersistence=this.config.persistence===`sessionStorage`||this.config.persistence===`memory`?this.persistence:new eo(N({},this.config,{persistence:`sessionStorage`}),f);var p=this.Bi(this.config.debug);Gt(p)&&(this.config.debug=p),Gt(this.config.debug)&&(this.config.debug?(wt.DEBUG=!0,ga.R()&&ga.M(`ph_debug`,!0),R.info(`set_config`,{config:e,oldConfig:t,newConfig:N({},this.config)})):(wt.DEBUG=!1,ga.R()&&ga.F(`ph_debug`))),(r=this.exceptionObserver)==null||r.onConfigChange(),(i=this.exceptions)==null||i.onConfigChange(),(a=this.sessionRecording)==null||a.startIfEnabledOrStop(),(o=this.autocapture)==null||o.startIfEnabled(),(s=this.heatmaps)==null||s.startIfEnabled(),(c=this.exceptionObserver)==null||c.startIfEnabledOrStop(),(l=this.deadClicksAutocapture)==null||l.startIfEnabledOrStop(),(u=this.surveys)==null||u.loadIfEnabled(),this.cn(),(d=this.externalIntegrations)==null||d.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){wt.LIB_NAME=e,wt.LIB_VERSION=t}startSessionRecording(e){var t,n,r,i,a,o=!0===e,s={sampling:o||!(e==null||!e.sampling),linked_flag:o||!(e==null||!e.linked_flag),url_trigger:o||!(e==null||!e.url_trigger),event_trigger:o||!(e==null||!e.event_trigger)};Object.values(s).some(Boolean)&&((t=this.sessionManager)==null||t.checkAndGetSessionAndWindowId(),s.sampling&&((n=this.sessionRecording)==null||n.overrideSampling()),s.linked_flag&&((r=this.sessionRecording)==null||r.overrideLinkedFlag()),s.url_trigger&&((i=this.sessionRecording)==null||i.overrideTrigger(`url`)),s.event_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger(`event`))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){if(this.exceptions){var n=Error(`PostHog syntheticException`),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent(N({},r,t))}}addExceptionStep(e,t){var n;(n=this.exceptions)==null||n.addExceptionStep(e,t)}captureLog(e){var t;(t=this.logs)==null||t.captureLog(e)}get logger(){return this.logs?.logger??e.dn}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t;return(t=this.toolbar?.loadToolbar(e))!=null&&t}get_property(e){return this.persistence?.props[e]}getSessionProperty(e){return this.sessionPersistence?.props[e]}toString(){var e=this.config.name??Is;return e!==Is&&(e=Is+`.`+e),e}_isIdentified(){return this.persistence?.get_property(wi)===Bi||this.sessionPersistence?.get_property(wi)===Bi}nn(){var e,t;return!(this.config.person_profiles===`never`||this.config.person_profiles===Vi&&!this._isIdentified()&&zt(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Ur])&&((t=this.persistence)==null||(t=t.props)==null||!t[Ai]))}Qi(){return!0===this.config.capture_pageleave||this.config.capture_pageleave===`if_capture_pageview`&&(!0===this.config.capture_pageview||this.config.capture_pageview===`history_change`)}createPersonProfile(){this.nn()||this.sn(`posthog.createPersonProfile`)&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.sn(`posthog.setInternalOrTestUser`)&&this.setPersonProperties({$internal_or_test_user:!0})}sn(e){return this.config.person_profiles===`never`?(R.error(e+` was called, but process_person is set to "never". This call will be ignored.`),!1):(this.an(Ai,!0),!0)}qi(){if(this.config.cookieless_mode===`always`)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Li)}cn(){var e,t,n=this.qi();return this.persistence?._r!==n&&((e=this.persistence)==null||e.set_disabled(n)),this.sessionPersistence?._r!==n&&((t=this.sessionPersistence)==null||t.set_disabled(n)),n}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==Ri){if(this.Ni()){var r,i;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=new ds(this),this.pageViewManager=new ja(this),this.persistence&&(this.sessionPropsManager=new cs(this,this.sessionManager,this.persistence));var a,o=this.config.__extensionClasses?.sessionRecording??e.__defaultExtensionClasses?.sessionRecording;o&&(this.sessionRecording=this.Ei(this.sessionRecording,new o(this)),this.Wi&&((a=this.sessionRecording)==null||a.onRemoteConfig==null||a.onRemoteConfig(this.Wi)))}var s;this.consent.optInOut(!0),this.cn(),this.Xi(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==Li&&((s=this.surveys)==null||s.loadIfEnabled()),(I(t?.captureEventName)||t!=null&&t.captureEventName)&&this.capture(t?.captureEventName??`$opt_in`,t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Ji()}else R.warn(Ms)}opt_out_capturing(){var e,t,n;this.config.cookieless_mode===Ri?R.warn(Ms):(this.config.cookieless_mode===Li&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.cn(),this.config.cookieless_mode===Li&&(this.register({distinct_id:Mi,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(t=this.pageViewManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(n=this.sessionRecording)==null||n.stopRecording(),this.sessionRecording=void 0,this.Ji()))}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?`granted`:e===0?`denied`:`pending`}is_capturing(){return this.config.cookieless_mode===Ri||(this.config.cookieless_mode===Li?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.cn()}_is_bot(){return gt?fs(gt,this.config.custom_blocked_useragents):void 0}Ji(){j&&(j.visibilityState===`visible`?this.Oi||(this.Oi=!0,this.capture(Wi,{title:j.title},{send_instantly:!0}),this.Pi&&=(j.removeEventListener(Hi,this.Pi),null)):this.Pi||(this.Pi=this.Ji.bind(this),ra(j,Hi,this.Pi)))}debug(e){!1===e?(A?.console.log(`You've disabled debug mode.`),this.set_config({debug:!1})):(A?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Fr(){var e,t,n,r,i,a,o=this.ji||{};return`advanced_disable_flags`in o?!!o.advanced_disable_flags:!1===this.config.advanced_disable_flags?!0===this.config.advanced_disable_decide?(R.warn(`Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version.`),!0):(n=`advanced_disable_decide`,r=R,i=(t=`advanced_disable_flags`)in(e=o)&&!L(e[t]),a=n in e&&!L(e[n]),i?e[t]:!!a&&(r&&r.warn(`Config field '`+n+`' is deprecated. Please use '`+t+`' instead. The old field will be removed in a future major version.`),e[n])):!!this.config.advanced_disable_flags}rn(e){if(L(this.config.before_send))return e;var t=F(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var r of t){if(n=r(n),L(n)){var i=`Event '`+e.event+`' was rejected in beforeSend function`;return qt(e.event)?R.warn(i+`. This can cause unexpected behavior.`):R.info(i),null}n.properties&&!zt(n.properties)||R.warn(`Event '`+e.event+`' has no properties after beforeSend function, this is likely an error.`)}return n}getPageViewId(){return this.pageViewManager.dr?.pageViewId}captureTraceFeedback(e,t){this.capture(`$ai_feedback`,{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,n){this.capture(`$ai_metric`,{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}Bi(e){var t=Gt(e)&&!e,n=ga.R()&&ga.O(`ph_debug`)===`true`;return!t&&(!!n||e)}};Hs.__defaultExtensionClasses={},Hs.dn={trace:Os=()=>{},debug:Os,info:Os,warn:Os,error:Os,fatal:Os},function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=$i(e.prototype[t[n]])}(Hs,[`identify`]);var Us=1,Ws=3,Gs=11;function Ks(e){return e instanceof Element&&(e.id===ji||!(e.closest==null||!e.closest(`.toolbar-global-fade-container`)))}function qs(e){return!!e&&e.nodeType===Us}function Js(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Ys(e){return!!e&&e.nodeType===Ws}function Xs(e){return!!e&&e.nodeType===Gs&&qs(e.host)}function Zs(e){return e?Mt(e).split(/\s+/):[]}function Qs(e){var t=A?.location.href;return!!(t&&e&&e.some((e=>t.match(e))))}function $s(e){var t=``;switch(typeof e.className){case`string`:t=e.className;break;case`object`:t=(e.className&&`baseVal`in e.className?e.className.baseVal:null)||e.getAttribute(`class`)||``;break;default:t=``}return Zs(t)}function ec(e){return L(e)?null:Mt(e).split(/(\s+)/).filter((e=>vc(e))).join(``).replace(/[\r\n]/g,` `).replace(/[ ]+/g,` `).substring(0,255)}function tc(e){var t=``;return uc(e)&&!dc(e)&&e.childNodes&&e.childNodes.length&&Yi(e.childNodes,(function(e){Ys(e)&&e.textContent&&(t+=ec(e.textContent)??``)})),Mt(t)}function nc(e){return I(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var rc=[`a`,`button`,`form`,`input`,`select`,`textarea`,`label`];function ic(e,t){if(I(t))return!0;var n,r=function(e){if(t.some((t=>e.matches(t))))return{v:!0}};for(var i of e)if(n=r(i))return n.v;return!1}function ac(e){var t=e.parentNode;return!(!t||!qs(t))&&t}var oc=[`next`,`previous`,`prev`,`>`,`<`],sc=[`.ph-no-rageclick`,`.ph-no-capture`],cc=e=>!e||Js(e,`html`)||!qs(e),lc=(e,t)=>{if(!A||cc(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[e],i=e;i.parentNode&&!Js(i,`body`);)if(Xs(i.parentNode))r.push(i.parentNode.host),i=i.parentNode.host;else{var a=ac(i);if(!a)break;if(t||rc.indexOf(a.tagName.toLowerCase())>-1)n=!0;else{var o=A.getComputedStyle(a);o&&o.getPropertyValue(`cursor`)===`pointer`&&(n=!0)}r.push(a),i=a}return{parentIsUsefulElement:n,targetElementList:r}};function uc(e){for(var t=e;t.parentNode&&!Js(t,`body`);t=t.parentNode){var n=$s(t);if(P(n,`ph-sensitive`)||P(n,`ph-no-capture`))return!1}if(P($s(e),`ph-include`))return!0;var r=e.type||``;if(Bt(r))switch(r.toLowerCase()){case`hidden`:case`password`:return!1}var i=e.name||e.id||``;return!Bt(i)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,``))}function dc(e){return!!(Js(e,`input`)&&![`button`,`checkbox`,`submit`,`reset`].includes(e.type)||Js(e,`select`)||Js(e,`textarea`)||e.getAttribute(`contenteditable`)===`true`)}var fc=`(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})`,pc=RegExp(`^(?:`+fc+`)$`),mc=new RegExp(fc),hc=`\\d{3}-?\\d{2}-?\\d{4}`,gc=RegExp(`^(`+hc+`)$`),_c=RegExp(`(`+hc+`)`);function vc(e,t){return t===void 0&&(t=!0),!(L(e)||Bt(e)&&(e=Mt(e),(t?pc:mc).test((e||``).replace(/[- ]/g,``))||(t?gc:_c).test(e)))}function yc(e){var t=tc(e);return vc(t=(t+` `+bc(e)).trim())?t:``}function bc(e){var t=``;return e&&e.childNodes&&e.childNodes.length&&Yi(e.childNodes,(function(e){if(e&&e.tagName?.toLowerCase()===`span`)try{var n=tc(e);t=(t+` `+n).trim(),e.childNodes&&e.childNodes.length&&(t=(t+` `+bc(e)).trim())}catch(e){R.error(`[AutoCapture]`,e)}})),t}function xc(e){return e.replace(/"|\\"/g,`\\"`)}function Sc(e){var t=e.attr__class;return t?F(t)?t:Zs(t):void 0}var Cc=class{constructor(e){this.disabled=!1===e;var t=Rt(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,n){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&this.timeoutMs>n-r.timestamp){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}},wc=`$copy_autocapture`,Tc=Rr(`[AutoCapture]`);function Ec(e,t){return t.length>e?t.slice(0,e)+`...`:t}function Dc(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!qs(t));return t}function Oc(e,t){var n,{e:r,maskAllElementAttributes:i,maskAllText:a,elementAttributeIgnoreList:o,elementsChainAsString:s}=t;if(!qs(e))return{props:{}};for(var c=[e],l=e;l.parentNode&&!Js(l,`body`);)if(Xs(l.parentNode))c.push(l.parentNode.host),l=l.parentNode.host;else{if(!qs(l.parentNode))break;c.push(l.parentNode),l=l.parentNode}var u,d,f=[],p={},m=!1,h=!1;if(Yi(c,(e=>{var t=uc(e);if(Js(e,`a`)){var n=e.getAttribute(`href`);m=t&&!!n&&vc(n)&&n}P($s(e),`ph-no-capture`)&&(h=!0),f.push(function(e,t,n,r){var i=e.tagName.toLowerCase(),a={tag_name:i};rc.indexOf(i)>-1&&!n&&(a.$el_text=i.toLowerCase()===`a`||i.toLowerCase()===`button`?Ec(1024,yc(e)):Ec(1024,tc(e)));var o=$s(e);o.length>0&&(a.classes=o.filter((function(e){return e!==``}))),Yi(e.attributes,(function(n){var i;if((!dc(e)||[`name`,`id`,`class`,`aria-label`].indexOf(n.name)!==-1)&&(r==null||!r.includes(n.name))&&!t&&vc(n.value)&&(!Bt(i=n.name)||i.substring(0,10)!==`_ngcontent`&&i.substring(0,7)!==`_nghost`)){var o=n.value;n.name===`class`&&(o=Zs(o).join(` `)),a[`attr__`+n.name]=Ec(1024,o)}}));for(var s=1,c=1,l=e;l=Dc(l);)s++,l.tagName===e.tagName&&c++;return a.nth_child=s,a.nth_of_type=c,a}(e,i,a,o)),Xi(p,function(e){if(!uc(e))return{};var t={};return Yi(e.attributes,(function(e){if(e.name&&e.name.indexOf(`data-ph-capture-attribute`)===0){var n=e.name.replace(`data-ph-capture-attribute-`,``),r=e.value;n&&r&&vc(r)&&(t[n]=r)}})),t}(e))})),h)return{props:{},explicitNoCapture:h};if(a||(f[0].$el_text=Js(e,`a`)||Js(e,`button`)?yc(e):tc(e)),m){var g;f[0].attr__href=m;var _=Pa(m)?.host,v=A==null||(g=A.location)==null?void 0:g.host;_&&v&&_!==v&&(u=m)}return{props:Xi({$event_type:r.type,$ce_version:1},s?{}:{$elements:f},{$elements_chain:(d=f,function(e){return e.map((e=>{var t=``;if(e.tag_name&&(t+=e.tag_name),e.attr_class)for(var n of(e.attr_class.sort(),e.attr_class))t+=`.`+n.replace(/"/g,``);var r=N({},e.text?{text:e.text}:{},{"nth-child":e.nth_child??0,"nth-of-type":e.nth_of_type??0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),i={};return Zi(r).sort(((e,t)=>{var[n]=e,[r]=t;return n.localeCompare(r)})).forEach((e=>{var[t,n]=e;return i[xc(t.toString())]=xc(n.toString())})),(t+=`:`)+Zi(i).map((e=>{var[t,n]=e;return t+`="`+n+`"`})).join(``)})).join(`;`)}(function(e){return e.map((e=>{var t={text:e.$el_text?.slice(0,400),tag_name:e.tag_name,href:e.attr__href?.slice(0,2048),attr_class:Sc(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Zi(e).filter((e=>{var[t]=e;return t.indexOf(`attr__`)===0})).forEach((e=>{var[n,r]=e;return t.attributes[n]=r})),t}))}(d)))},(n=f[0])!=null&&n.$el_text?{$el_text:f[0]?.$el_text}:{},u&&r.type===`click`?{$external_click_url:u}:{},p)}}var kc=Rr(`[ExceptionAutocapture]`);function Ac(e,t,n){try{if(!(t in e))return()=>{};var r=e[t],i=n(r);return Lt(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}var jc=Rr(`[TracingHeaders]`),Mc=Rr(`[Web Vitals]`),Nc=9e5,Pc=`disabled`,Fc=`lazy_loading`,Ic=`awaiting_config`,Lc=`missing_config`;Rr(`[SessionRecording]`),Rr(`[SessionRecording]`);var Rc=`[SessionRecording]`,zc=Rr(Rc),Bc=Rr(`[Heatmaps]`);function Vc(e){return Rt(e)&&`clientX`in e&&`clientY`in e&&Ut(e.clientX)&&Ut(e.clientY)}var Hc=Rr(`[Product Tours]`),Uc=[`$set_once`,`$set`],Wc=Rr(`[SiteApps]`),Gc=`Error while initializing PostHog app with config id `;function Kc(e,t,n){if(L(e))return!1;switch(n){case`exact`:return e===t;case`contains`:var r=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`).replace(/_/g,`.`).replace(/%/g,`.*`);return new RegExp(r,`i`).test(e);case`regex`:try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var qc=class{constructor(e){this.vn=new ls,this.fn=(e,t)=>this.pn(e,t)&&this.gn(e,t)&&this.mn(e,t)&&this.yn(e,t),this.pn=(e,t)=>t==null||!t.event||e?.event===t?.event,this._instance=e,this.bn=new Set,this._n=new Set}init(){var e;I(this._instance?._addCaptureHook)||(e=this._instance)==null||e._addCaptureHook(((e,t)=>{this.on(e,t)}))}register(e){var t;if(!I(this._instance?._addCaptureHook)&&(e.forEach((e=>{var t,n;(t=this._n)==null||t.add(e),(n=e.steps)==null||n.forEach((e=>{var t;(t=this.bn)==null||t.add(e?.event||``)}))})),(t=this._instance)!=null&&t.autocapture)){var n,r=new Set;e.forEach((e=>{var t;(t=e.steps)==null||t.forEach((e=>{e!=null&&e.selector&&r.add(e?.selector)}))})),(n=this._instance)==null||n.autocapture.setElementSelectors(r)}}on(e,t){t!=null&&e.length!=0&&(this.bn.has(e)||this.bn.has(t?.event))&&this._n&&this._n?.size>0&&this._n.forEach((e=>{this.wn(t,e)&&this.vn.emit(`actionCaptured`,e.name)}))}In(e){this.onAction(`actionCaptured`,(t=>e(t)))}wn(e,t){if(t?.steps==null)return!1;for(var n of t.steps)if(this.fn(e,n))return!0;return!1}onAction(e,t){return this.vn.on(e,t)}gn(e,t){if(t!=null&&t.url){var n,r=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!r||typeof r!=`string`||!Kc(r,t.url,t.url_matching||`contains`))return!1}return!0}mn(e,t){return!!this.Cn(e,t)&&!!this.Sn(e,t)&&!!this.xn(e,t)}Cn(e,t){var n;if(t==null||!t.href)return!0;var r=this.kn(e);if(r.length>0)return r.some((e=>Kc(e.href,t.href,t.href_matching||`exact`)));var i,a=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!a&&Kc((i=a.match(/(?::|")href="(.*?)"/))?i[1]:``,t.href,t.href_matching||`exact`)}Sn(e,t){var n;if(t==null||!t.text)return!0;var r=this.kn(e);if(r.length>0)return r.some((e=>Kc(e.text,t.text,t.text_matching||`exact`)||Kc(e.$el_text,t.text,t.text_matching||`exact`)));var i,a,o,s=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!s&&(i=function(e){for(var t,n=[],r=/(?::|")text="(.*?)"/g;!L(t=r.exec(e));)n.includes(t[1])||n.push(t[1]);return n}(s),a=t.text,o=t.text_matching||`exact`,i.some((e=>Kc(e,a,o))))}xn(e,t){var n,r;if(t==null||!t.selector)return!0;var i=e==null||(n=e.properties)==null?void 0:n.$element_selectors;if(i!=null&&i.includes(t.selector))return!0;var a=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||``;if(t.selector_regex&&a)try{return new RegExp(t.selector_regex).test(a)}catch{return!1}return!1}kn(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}yn(e,t){return t==null||!t.properties||t.properties.length===0||_s(t.properties.reduce(((e,t)=>{var n=F(t.value)?t.value.map(String):t.value==null?[]:[String(t.value)];return e[t.key]={values:n,operator:t.operator||`exact`},e}),{}),e?.properties)}},Jc=class{constructor(e){this._instance=e,this.Tn=new Map,this.An=new Map,this.En=new Map}Rn(e,t){return!!e&&_s(e.propertyFilters,t?.properties)}Nn(e,t){var n=new Map;return e.forEach((e=>{var r;(r=e.conditions)==null||(r=r[t])==null||(r=r.values)==null||r.forEach((t=>{if(t!=null&&t.name){var r=n.get(t.name)||[];r.push(e.id),n.set(t.name,r)}}))})),n}Mn(e,t,n){var r=(n===to.Activation?this.Tn:this.An).get(e),i=[];return this.Fn((e=>{i=e.filter((e=>r?.includes(e.id)))})),i.filter((r=>{var i,a=(i=r.conditions)==null||(i=i[n])==null||(i=i.values)==null?void 0:i.find((t=>t.name===e));return this.Rn(a,t)}))}register(e){I(this._instance?._addCaptureHook)||(this.On(e),this.Pn(e))}Pn(e){var t=e.filter((e=>{var t;return e.conditions?.actions&&((t=e.conditions)==null||(t=t.actions)==null||(t=t.values)==null?void 0:t.length)>0}));t.length!==0&&(this.Ln??(this.Ln=new qc(this._instance),this.Ln.init(),this.Ln.In((e=>{this.onAction(e)}))),t.forEach((e=>{var t,n,r,i,a;e.conditions&&(t=e.conditions)!=null&&t.actions&&(n=e.conditions)!=null&&(n=n.actions)!=null&&n.values&&((r=e.conditions)==null||(r=r.actions)==null||(r=r.values)==null?void 0:r.length)>0&&((i=this.Ln)==null||i.register(e.conditions.actions.values),(a=e.conditions)==null||(a=a.actions)==null||(a=a.values)==null||a.forEach((t=>{if(t&&t.name){var n=this.En.get(t.name);n&&n.push(e.id),this.En.set(t.name,n||[e.id])}})))})))}On(e){var t,n=e.filter((e=>{var t;return e.conditions?.events&&((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null?void 0:t.length)>0})),r=e.filter((e=>{var t;return e.conditions?.cancelEvents&&((t=e.conditions)==null||(t=t.cancelEvents)==null||(t=t.values)==null?void 0:t.length)>0}));n.length===0&&r.length===0||((t=this._instance)==null||t._addCaptureHook(((e,t)=>{this.onEvent(e,t)})),this.Tn=this.Nn(e,to.Activation),this.An=this.Nn(e,to.Cancellation))}onEvent(e,t){var n,r=this.le(),i=this.Dn(),a=this.Bn(),o=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[i])||[];if(a===e&&t&&o.length>0){var s,c;r.info(`event matched, removing item from activated items`,{event:e,eventPayload:t,existingActivatedItems:o});var l=(t==null||(s=t.properties)==null?void 0:s.$survey_id)||(t==null||(c=t.properties)==null?void 0:c.$product_tour_id);if(l){var u=o.indexOf(l);0>u||(o.splice(u,1),this.jn(o))}}else{if(this.An.has(e)){var d=this.Mn(e,t,to.Cancellation);d.length>0&&(r.info(`cancel event matched, cancelling items`,{event:e,itemsToCancel:d.map((e=>e.id))}),d.forEach((e=>{var t=o.indexOf(e.id);0>t||o.splice(t,1),this.$n(e.id)})),this.jn(o))}if(this.Tn.has(e)){r.info(`event name matched`,{event:e,eventPayload:t,items:this.Tn.get(e)});var f=this.Mn(e,t,to.Activation);this.jn(o.concat(f.map((e=>e.id))||[]))}}}onAction(e){var t,n=this.Dn(),r=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[];this.En.has(e)&&this.jn(r.concat(this.En.get(e)||[]))}jn(e){var t=this.le(),n=[...new Set(e)].filter((e=>!this.qn(e)));t.info(`updating activated items`,{activatedItems:n}),this.Zn(n)}getActivatedIds(){var e,t=this.Dn();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}getEventToItemsMap(){return this.Tn}Vn(){return this.Ln}},Yc=class extends Jc{constructor(e){super(e)}Dn(){return vi}Bn(){return ro.SHOWN}Fn(e){var t;(t=this._instance)==null||t.getSurveys(e)}$n(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}le(){return z}Zn(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[vi]:e})}qn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Xc=`SDK is not enabled or survey functionality is not yet loaded`,Zc=`Disabled. Not loading surveys.`,Qc=A!=null&&A.location?La(A.location.hash,`__posthog`)||La(location.hash,`state`):null,$c=`_postHogToolbarParams`,el=Rr(`[Toolbar]`),tl=Rr(`[FeatureFlags]`),nl=Rr(`[FeatureFlags]`,{debugEnabled:!0}),rl=`" failed. Feature flags didn't load in time.`,il=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},al=e=>{var t={};for(var[n,r]of Zi(e||{}))r&&(t[n]=r);return t},ol=Rr(`[Error tracking]`),sl=`Refusing to render web experiment since the viewer is a likely bot`,cl={icontains:(e,t)=>!!A&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!A&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!A&&ps(t.href,e),not_regex:(e,t)=>!!A&&!ps(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e},ll=class e{get Bt(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){t===void 0&&(t=!1),n.getWebExperiments((t=>{e.Hn(`retrieved web experiments from the server`),n.zn=new Map,t.forEach((t=>{if(t.feature_flag_key){var r;n.zn&&(e.Hn(`setting flag key `,t.feature_flag_key,` to web experiment `,t),(r=n.zn)==null||r.set(t.feature_flag_key,t));var i=n._instance.getFeatureFlag(t.feature_flag_key);Bt(i)&&t.variants[i]&&n.Un(t.name,i,t.variants[i].transforms)}else if(t.variants)for(var a in t.variants){var o=t.variants[a];e.Yn(o)&&n.Un(t.name,a,o.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())e.Hn(sl);else if(!this.Bt.disable_web_experiments){if(L(this.zn))return this.zn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.Hn(`applying feature flags`,t),t.forEach((e=>{var t;if(this.zn&&(t=this.zn)!=null&&t.has(e)){var n=this._instance.getFeatureFlag(e),r=this.zn?.get(e);n&&r!=null&&r.variants[n]&&this.Un(r.name,n,r.variants[n].transforms)}}))}}previewWebExperiment(){var t=e.getWindowLocation();if(t!=null&&t.search){var n=Fa(t?.search,`__experiment_id`),r=Fa(t?.search,`__experiment_variant`);n&&r&&(e.Hn(`previewing web experiments `+n+` && `+r),this.getWebExperiments((e=>{this.Gn(parseInt(n),r,e)}),!1,!0))}}loadIfEnabled(){this.Bt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this.Bt.disable_web_experiments&&!n)return e([]);var r=this._instance.get_property(`$web_experiments`);if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/web_experiments/?token=`+this.Bt.token),method:`GET`,callback:t=>e(t.statusCode===200&&t.json&&t.json.experiments||[])})}Gn(t,n,r){var i=r.filter((e=>e.id===t));i&&i.length>0&&(e.Hn(`Previewing web experiment [`+i[0].name+`] with variant [`+n+`]`),this.Un(i[0].name,n,i[0].variants[n].transforms))}static Yn(t){return!L(t.conditions)&&e.Wn(t)&&e.Xn(t)}static Wn(t){if(L(t.conditions)||L(t.conditions?.url))return!0;var n,r=e.getWindowLocation();return!!r&&((n=t.conditions)==null||!n.url||cl[t.conditions?.urlMatchType??`icontains`](t.conditions.url,r))}static getWindowLocation(){return A?.location}static Xn(e){if(L(e.conditions)||L(e.conditions?.utm))return!0;var t=Ua();if(t.utm_source){var n,r,i,a,o,s,c,l,u=(n=e.conditions)==null||(n=n.utm)==null||!n.utm_campaign||((r=e.conditions)==null||(r=r.utm)==null?void 0:r.utm_campaign)==t.utm_campaign,d=(i=e.conditions)==null||(i=i.utm)==null||!i.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==t.utm_source,f=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_medium||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_medium)==t.utm_medium,p=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((l=e.conditions)==null||(l=l.utm)==null?void 0:l.utm_term)==t.utm_term;return u&&f&&p&&d}return!1}static Hn(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];R.info(`[WebExperiments] `+e,n)}Un(t,n,r){this._is_bot()?e.Hn(sl):n===`control`?e.Hn(`Control variants leave the page unmodified.`):r.forEach((r=>{r.selector&&(e.Hn(`applying transform of variant `+n+` for experiment `+t+` `,r),(document?.querySelectorAll(r.selector))?.forEach((e=>{var t=e;r.html&&(t.innerHTML=r.html),r.css&&t.setAttribute(`style`,r.css)})))}))}_is_bot(){return gt&&this._instance?fs(gt,this.Bt.custom_blocked_useragents):void 0}},ul=Rr(`[Conversations]`),dl=`Conversations not available yet.`,fl={featureFlags:class{constructor(e){this.Jn=!1,this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this.ss=!1,this._instance=e,this.featureFlagEventHandlers=[]}get Bt(){return this._instance.config}get ni(){return this._instance.persistence}os(e){return this._instance.get_property(e)}ls(){var e;return(e=this.ni?.wr(this.Bt.feature_flag_cache_ttl_ms))!=null&&e}us(){return!!this.ls()&&(this.ss||this.Qn||(this.ss=!0,tl.warn(`Feature flag cache is stale, triggering refresh...`),this.reloadFeatureFlags()),!0)}hs(){var e=this.Bt.evaluation_contexts??this.Bt.evaluation_environments;return!this.Bt.evaluation_environments||this.Bt.evaluation_contexts||this.ns||(tl.warn(`evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version.`),this.ns=!0),e!=null&&e.length?e.filter((e=>{var t=e&&typeof e==`string`&&e.trim().length>0;return t||tl.error(`Invalid evaluation context found:`,e,`Expected non-empty string`),t})):[]}cs(){return this.hs().length>0}initialize(){var{config:e}=this._instance,t=e.bootstrap?.featureFlags??{};if(Object.keys(t).length){var n=e.bootstrap?.featureFlagPayloads??{},r=Object.keys(t).filter((e=>!!t[e])).reduce(((e,n)=>(e[n]=t[n]||!1,e)),{}),i=Object.keys(n).filter((e=>r[e])).reduce(((e,t)=>(n[t]&&(e[t]=n[t]),e)),{});this.receivedFeatureFlags({featureFlags:r,featureFlagPayloads:i})}}updateFlags(e,t,n){var r=n!=null&&n.merge?this.getFlagVariants():{},i=n!=null&&n.merge?this.getFlagPayloads():{},a=N({},r,e),o=N({},i,t),s={};for(var[c,l]of Object.entries(a)){var u=typeof l==`string`;s[c]={key:c,enabled:!!u||!!l,variant:u?l:void 0,reason:void 0,metadata:I(o?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:o[c]}}}this.receivedFeatureFlags({flags:s})}get hasLoadedFlags(){return this.Kn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.os(ui),t=this.os(pi),n=this.os(mi);if(!n&&!t)return e||{};var r=Xi({},e||{});for(var i of[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])]){var a,o,s=r[i],c=t?.[i],l=I(c)?(a=s?.enabled)!=null&&a:!!c,u=I(c)?s.variant:typeof c==`string`?c:void 0,d=n?.[i],f=N({},s,{enabled:l,variant:l?u??s?.variant:void 0});l!==s?.enabled&&(f.original_enabled=s?.enabled),u!==s?.variant&&(f.original_variant=s?.variant),d&&(f.metadata=N({},s?.metadata,{payload:d,original_payload:s==null||(o=s.metadata)==null?void 0:o.payload})),r[i]=f}return this.Jn||=(tl.warn(` Overriding feature flag details!`,{flagDetails:e,overriddenPayloads:n,finalDetails:r}),!0),r}getFlagVariants(){var e=this.os(si),t=this.os(pi);if(!t)return e||{};for(var n=Xi({},e),r=Object.keys(t),i=0;r.length>i;i++)n[r[i]]=t[r[i]];return this.Jn||=(tl.warn(` Overriding feature flags!`,{enabledFlags:e,overriddenFlags:t,finalFlags:n}),!0),n}getFlagPayloads(){var e=this.os(di),t=this.os(mi);if(!t)return e||{};for(var n=Xi({},e||{}),r=Object.keys(t),i=0;r.length>i;i++)n[r[i]]=t[r[i]];return this.Jn||=(tl.warn(` Overriding feature flag payloads!`,{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),!0),n}reloadFeatureFlags(){this.es||this.Bt.advanced_disable_feature_flags||this.ds||(this._instance.Fi.emit(`featureFlagsReloading`,!0),this.ds=setTimeout((()=>{this.vs()}),5))}fs(){clearTimeout(this.ds),this.ds=void 0}ensureFlagsLoaded(){this.Kn||this.Qn||this.ds||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.es=e}vs(e){if(this.fs(),!this._instance.Fr())if(this.Qn)this.ts=!0;else{var t=this.Bt.token,n=this.os(Hr),r={token:t,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:N({},this.ni?.get_initial_props()||{},this.os(hi)||{}),group_properties:this.os(gi),timezone:Za()};Ht(n)||I(n)||(r.$device_id=n),(e!=null&&e.disableFlags||this.Bt.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.cs()&&(r.evaluation_contexts=this.hs());var i=this._instance.requestRouter.endpointFor(`flags`,`/flags/?v=2`+(this.Bt.advanced_only_evaluate_survey_feature_flags?`&only_evaluate_survey_feature_flags=true`:``));this.Qn=!0,this._instance._send_request({method:`POST`,url:i,data:r,compression:this.Bt.disable_compression?void 0:po.Base64,timeout:this.Bt.feature_flag_request_timeout_ms,callback:e=>{var t,n,i,a=!0;if(e.statusCode===200&&(this.ts||(this.$anon_distinct_id=void 0),a=!1),this.Qn=!1,!r.disable_flags||this.ts){this.rs=!a;var o=[];e.error?e.error instanceof Error?o.push(e.error.name===`AbortError`?`timeout`:`connection_error`):o.push(`unknown_error`):e.statusCode!==200&&o.push(`api_error_`+e.statusCode),(t=e.json)!=null&&t.errorsWhileComputingFlags&&o.push(`errors_while_computing_flags`);var s=!((n=e.json)==null||(n=n.quotaLimited)==null||!n.includes(`feature_flags`));s&&o.push(`quota_limited`),(i=this.ni)==null||i.register({[Si]:o}),s?tl.warn(`You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.`):(r.disable_flags||this.receivedFeatureFlags(e.json??{},a,{partialResponse:!!this.Bt.advanced_only_evaluate_survey_feature_flags}),this.ts&&(this.ts=!1,this.vs()))}}})}}getFeatureFlag(e,t){if(t===void 0&&(t={}),!t.fresh||this.rs)if(this.Kn||this.getFlags()&&this.getFlags().length>0){if(!this.us()){var n=this.getFeatureFlagResult(e,t);return n?.variant??n?.enabled}}else tl.warn(`getFeatureFlag for key "`+e+rl)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFeatureFlagResult(e,{send_event:!1})?.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.rs)if(this.Kn||this.getFlags()&&this.getFlags().length>0){if(!this.us()){var n=this.getFlagVariants(),r=e in n,i=n[e],a=this.getFlagPayloads()[e],o=String(i),s=this.os(fi)||void 0,c=this.os(Ci)||void 0,l=this.os(bi)||{};if(this.Bt.advanced_feature_flags_dedup_per_session){var u,d=this._instance.get_session_id(),f=this.os(xi);d&&d!==f&&(l={},(u=this.ni)==null||u.register({[bi]:l,[xi]:d}))}if((t.send_event||!(`send_event`in t))&&(!(e in l)||!l[e].includes(o))){var p,m,h,g,_,v,y,b;F(l[e])?l[e].push(o):l[e]=[o],(p=this.ni)==null||p.register({[bi]:l});var x=this.getFeatureFlagDetails(e),S=[...this.os(Si)??[]];I(i)&&S.push(`flag_missing`);var C={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:a||null,$feature_flag_request_id:s,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:((m=this.Bt.bootstrap)==null||(m=m.featureFlags)==null?void 0:m[e])||null,$feature_flag_bootstrapped_payload:((h=this.Bt.bootstrap)==null||(h=h.featureFlagPayloads)==null?void 0:h[e])||null,$used_bootstrap_value:!this.rs};I(x==null||(g=x.metadata)==null?void 0:g.version)||(C.$feature_flag_version=x.metadata.version);var w,ee=(x==null||(_=x.reason)==null?void 0:_.description)??(x==null||(v=x.reason)==null?void 0:v.code);ee&&(C.$feature_flag_reason=ee),x!=null&&(y=x.metadata)!=null&&y.id&&(C.$feature_flag_id=x.metadata.id),I(x?.original_variant)&&I(x?.original_enabled)||(C.$feature_flag_original_response=I(x.original_variant)?x.original_enabled:x.original_variant),x!=null&&(b=x.metadata)!=null&&b.original_payload&&(C.$feature_flag_original_payload=x==null||(w=x.metadata)==null?void 0:w.original_payload),S.length&&(C.$feature_flag_error=S.join(`,`)),this._instance.capture(`$feature_flag_called`,C)}if(r){var T=a;if(!I(a))try{T=JSON.parse(a)}catch{}return{key:e,enabled:!!i,variant:typeof i==`string`?i:void 0,payload:T}}}}else tl.warn(`getFeatureFlagResult for key "`+e+rl)}getRemoteConfigPayload(e,t){var n=this.Bt.token,r={distinct_id:this._instance.get_distinct_id(),token:n};this.cs()&&(r.evaluation_contexts=this.hs()),this._instance._send_request({method:`POST`,url:this._instance.requestRouter.endpointFor(`flags`,`/flags/?v=2`),data:r,compression:this.Bt.disable_compression?void 0:po.Base64,timeout:this.Bt.feature_flag_request_timeout_ms,callback(n){var r=n.json?.featureFlagPayloads;t(r?.[e]||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),!t.fresh||this.rs){if(this.Kn||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return I(n)?void 0:!!n}tl.warn(`isFeatureEnabled for key "`+e+rl)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,n){if(this.ni){this.Kn=!0;var r=this.getFlagVariants(),i=this.getFlagPayloads(),a=this.getFlagsWithDetails();(function(e,t,n,r,i,a){n===void 0&&(n={}),r===void 0&&(r={}),i===void 0&&(i={});var o=(e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map((e=>[e,t[e].variant??t[e].enabled]))),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter((e=>t[e].enabled)).filter((e=>t[e].metadata?.payload)).map((e=>[e,t[e].metadata?.payload])))):tl.warn(`Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version`),e})(e),s=o.flags,c=o.featureFlags,l=o.featureFlagPayloads;if(c){var u=e.requestId,d=e.evaluatedAt;if(F(c)){tl.warn(`v1 of the feature flags endpoint is deprecated. Please use the latest version.`);var f={};if(c)for(var p=0;c.length>p;p++)f[c[p]]=!0;t&&t.register({[ci]:c,[si]:f})}else{var m=c,h=l,g=s;if(a!=null&&a.partialResponse)m=N({},n,m),h=N({},r,h),g=N({},i,g);else if(e.errorsWhileComputingFlags)if(s){var _=new Set(Object.keys(s).filter((e=>{var t;return!((t=s[e])!=null&&t.failed)})));m=N({},n,Object.fromEntries(Object.entries(m).filter((e=>{var[t]=e;return _.has(t)})))),h=N({},r,Object.fromEntries(Object.entries(h||{}).filter((e=>{var[t]=e;return _.has(t)})))),g=N({},i,Object.fromEntries(Object.entries(g||{}).filter((e=>{var[t]=e;return _.has(t)}))))}else m=N({},n,m),h=N({},r,h),g=N({},i,g);t&&t.register(N({[ci]:Object.keys(al(m)),[si]:m||{},[di]:h||{},[ui]:g||{}},u?{[fi]:u}:{},d?{[Ci]:d}:{}))}}})(e,this.ni,r,i,a,n),t||(this.ss=!1),this.ps(t)}}override(e,t){t===void 0&&(t=!1),tl.warn(`override is deprecated. Please use overrideFeatureFlags instead.`),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.ni)return tl.uninitializedWarning(`posthog.featureFlags.overrideFeatureFlags`);if(!1===e)return this.ni.unregister(pi),this.ni.unregister(mi),this.ps(),nl.info(`All overrides cleared`);if(F(e)){var t=il(e);return this.ni.register({[pi]:t}),this.ps(),nl.info(`Flag overrides set`,{flags:e})}if(e&&typeof e==`object`&&(`flags`in e||`payloads`in e)){var n,r=e;if(this.Jn=!!((n=r.suppressWarning)!=null&&n),`flags`in r){if(!1===r.flags)this.ni.unregister(pi),nl.info(`Flag overrides cleared`);else if(r.flags){if(F(r.flags)){var i=il(r.flags);this.ni.register({[pi]:i})}else this.ni.register({[pi]:r.flags});nl.info(`Flag overrides set`,{flags:r.flags})}}`payloads`in r&&(!1===r.payloads?(this.ni.unregister(mi),nl.info(`Payload overrides cleared`)):r.payloads&&(this.ni.register({[mi]:r.payloads}),nl.info(`Payload overrides set`,{payloads:r.payloads}))),this.ps();return}if(e&&typeof e==`object`)return this.ni.register({[pi]:e}),this.ps(),nl.info(`Flag overrides set`,{flags:e});tl.warn(`Invalid overrideOptions provided to overrideFeatureFlags`,{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Kn){var{flags:t,flagVariants:n}=this.gs();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r,i=(this.os(li)||[]).find((t=>t.flagKey===e)),a={[`$feature_enrollment/`+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:a};i&&(o.$early_access_feature_name=i.name),n&&(o.$feature_enrollment_stage=n),this._instance.capture(`$feature_enrollment_update`,o),this.setPersonPropertiesForFlags(a,!1);var s=N({},this.getFlagVariants(),{[e]:t});(r=this.ni)==null||r.register({[ci]:Object.keys(al(s)),[si]:s}),this.ps()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this.os(li),i=n?`&`+n.map((e=>`stage=`+e)).join(`&`):``;if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/early_access_features/?token=`+this.Bt.token+i),method:`GET`,callback:t=>{var n,r;if(t.json){var i=t.json.earlyAccessFeatures;return(n=this.ni)==null||n.unregister(li),(r=this.ni)==null||r.register({[li]:i}),e(i)}}})}gs(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((e=>t[e])),flagVariants:Object.keys(t).filter((e=>t[e])).reduce(((e,n)=>(e[n]=t[n],e)),{})}}ps(e){var{flags:t,flagVariants:n}=this.gs();this.featureFlagEventHandlers.forEach((r=>r(t,n,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.os(hi)||{},r=e?.$set||(e!=null&&e.$set_once?{}:e),i=e?.$set_once,a={};if(i)for(var o in i)({}).hasOwnProperty.call(i,o)&&(o in n||(a[o]=i[o]));this._instance.register({[hi]:N({},n,a,r)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(hi)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.os(gi)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((t=>{n[t]=N({},n[t],e[t]),delete e[t]})),this._instance.register({[gi]:N({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.os(gi)||{};this._instance.register({[gi]:N({},t,{[e]:{}})})}else this._instance.unregister(gi)}reset(){this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.$anon_distinct_id=void 0,this.fs(),this.Jn=!1}}},pl={sessionRecording:class{get Bt(){return this._instance.config}get ni(){return this._instance.persistence}get started(){var e;return!((e=this.ys)==null||!e.isStarted)}get status(){return this.bs===Ic||this.bs===Lc?this.bs:this.ys?.status??this.bs}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.bs=Pc,this._s=void 0,this._instance=e,!this._instance.sessionManager)throw zc.error(`started without valid sessionManager`),Error(Rc+` started without valid sessionManager. This is a bug.`);if(this.Bt.cookieless_mode===Ri)throw Error(Rc+` cannot be used with cookieless_mode="always"`)}initialize(){this.startIfEnabledOrStop()}get ws(){var e,t=!((e=this._instance.get_property(ei))==null||!e.enabled),n=!this.Bt.disable_session_recording,r=this.Bt.disable_session_recording||this._instance.consent.isOptedOut();return A&&t&&n&&!r}startIfEnabledOrStop(e){var t;if(!this.ws||(t=this.ys)==null||!t.isStarted){var n=!I(Object.assign)&&!I(Array.from);this.ws&&n?(this.Is(e),zc.info(`starting`)):(this.bs=Pc,this.stopRecording())}}Is(e){var t,n,r;this.ws&&(this.bs!==Ic&&this.bs!==Lc&&(this.bs=Fc),M!=null&&(t=M.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=M.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Cs(e):(r=M.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.Ss,(t=>{if(t)return zc.error(`could not load recorder`,t);this.Cs(e)})))}stopRecording(){var e,t;(e=this._s)==null||e.call(this),this._s=void 0,(t=this.ys)==null||t.stop()}xs(){var e,t;(e=this._s)==null||e.call(this),this._s=void 0,(t=this.ys)==null||t.discard()}ks(){var e;(e=this.ni)==null||e.unregister(oi)}Ts(e,t){if(L(e))return null;var n,r=Ut(e)?e:parseFloat(e);return typeof(n=r)!=`number`||!Number.isFinite(n)||0>n||n>1?(zc.warn(t+` must be between 0 and 1. Ignoring invalid value:`,e),null):r}As(e){if(this.ni){var t,n=this.ni,r=()=>{var t=!1===e.sessionRecording?void 0:e.sessionRecording,r=this.Ts(this.Bt.session_recording?.sampleRate,`session_recording.sampleRate`),i=this.Ts(t?.sampleRate,`remote config sampleRate`),a=r??i;L(a)&&this.ks();var o=t?.minimumDurationMilliseconds;n.register({[ei]:N({cache_timestamp:Date.now(),enabled:!!t},t,{networkPayloadCapture:N({capturePerformance:e.capturePerformance},t?.networkPayloadCapture),canvasRecording:{enabled:t?.recordCanvas,fps:t?.canvasFps,quality:t?.canvasQuality},sampleRate:a,minimumDurationMilliseconds:I(o)?null:o,endpoint:t?.endpoint,triggerMatchType:t?.triggerMatchType,masking:t?.masking,urlTriggers:t?.urlTriggers,version:t?.version,triggerGroups:t?.triggerGroups})})};r(),(t=this._s)==null||t.call(this),this._s=this._instance.sessionManager?.onSessionId(r)}}onRemoteConfig(e){`sessionRecording`in e?!1===e.sessionRecording?(this.As(e),this.xs()):(this.As(e),this.startIfEnabledOrStop()):(this.bs===Ic&&(this.bs=Lc,zc.warn(`config refresh failed, recording will not start until page reload`)),this.startIfEnabledOrStop())}log(e,t){var n;t===void 0&&(t=`log`),(n=this.ys)!=null&&n.log?this.ys.log(e,t):zc.warn(`log called before recorder was ready`)}get Ss(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(ei);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||`lazy-recorder`}Es(){var e=this._instance.get_property(ei);if(!e)return!1;var t=(typeof e==`object`?e:JSON.parse(e)).cache_timestamp??Date.now();return 36e5>=Date.now()-t}Cs(e){var t;if((t=M.__PosthogExtensions__)==null||!t.initSessionRecording)return zc.warn(`Called on script loaded before session recording is available. This can be caused by adblockers.`),void this._instance.register_for_session({[Fi]:!0});if(this.ys||(this.ys=M.__PosthogExtensions__?.initSessionRecording(this._instance),this.ys._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Es()){if(this.bs===Lc||this.bs===Ic)return;this.bs=Ic,zc.info(`persisted remote config is stale, requesting fresh config before starting`),new fo(this._instance).load();return}this.bs=Fc,this.ys.start(e)}onRRwebEmit(e){var t;(t=this.ys)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.ys||(t=this.ni)==null||t.register({[ni]:!0}),(e=this.ys)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.ys||(t=this.ni)==null||t.register({[ti]:!0}),(e=this.ys)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.ys||(n=this.ni)==null||n.register({[e===`url`?ri:ii]:!0}),(t=this.ys)==null||t.overrideTrigger(e)}get sdkDebugProperties(){return this.ys?.sdkDebugProperties||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.ys)==null||!n.tryAddCustomEvent(e,t))}}},ml={autocapture:class{constructor(e){this.Rs=!1,this.Ns=null,this.Ms=!1,this.instance=e,this.rageclicks=new Cc(e.config.rageclick),this.Fs=null}initialize(){this.startIfEnabled()}get Bt(){var e=Rt(this.instance.config.autocapture)?this.instance.config.autocapture:{};return e.url_allowlist=e.url_allowlist?.map((e=>new RegExp(e))),e.url_ignorelist=e.url_ignorelist?.map((e=>new RegExp(e))),e}Os(){if(this.isBrowserSupported()){if(A&&j){var e=e=>{e||=A?.event;try{this.Ps(e)}catch(e){Tc.error(`Failed to capture event`,e)}};if(ra(j,`submit`,e,{capture:!0}),ra(j,`change`,e,{capture:!0}),ra(j,`click`,e,{capture:!0}),this.Bt.capture_copied_text){var t=e=>{e||=A?.event;try{this.Ps(e,wc)}catch(e){Tc.error(`Failed to capture copy/cut event`,e)}};ra(j,`copy`,t,{capture:!0}),ra(j,`cut`,t,{capture:!0})}}}else Tc.info(`Disabling Automatic Event Collection because this browser is not supported`)}startIfEnabled(){this.isEnabled&&!this.Rs&&(this.Os(),this.Rs=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.Ms=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Gr]:!!e.autocapture_opt_out}),this.Ns=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.Fs=e}getElementSelectors(e){var t,n=[];return(t=this.Fs)==null||t.forEach((t=>{(j?.querySelectorAll(t))?.forEach((r=>{e===r&&n.push(t)}))})),n}get isEnabled(){var e=this.instance.persistence?.props[Gr];if(Ht(this.Ns)&&!Gt(e)&&!this.instance.Fr())return!1;var t=this.Ns??!!e;return!!this.instance.config.autocapture&&!t}Ps(e,t){if(t===void 0&&(t=`$autocapture`),this.isEnabled){var n,r=nc(e);Ys(r)&&(r=r.parentNode||null),t===`$autocapture`&&e.type===`click`&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&function(e,t){if(!A||cc(e))return!1;var n,r;if(Gt(t)?(n=!!t&&sc,r=void 0):(n=t?.css_selector_ignorelist??sc,r=t?.content_ignorelist),!1===n)return!1;var{targetElementList:i}=lc(e,!1);return!function(e,t){if(!1===e||I(e))return!1;var n;if(!0===e)n=oc;else{if(!F(e))return!1;if(e.length>10)return R.error(`[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching.`),!1;n=e.map((e=>e.toLowerCase()))}return t.some((e=>{var{safeText:t,ariaLabel:r}=e;return n.some((e=>t.includes(e)||r.includes(e)))}))}(r,i.map((e=>({safeText:tc(e).toLowerCase(),ariaLabel:e.getAttribute(`aria-label`)?.toLowerCase().trim()||``}))))&&!ic(i,n)}(r,this.instance.config.rageclick)&&this.Ps(e,`$rageclick`);var i=t===wc;if(r&&function(e,t,n,r,i){var a,o,s;if(n===void 0&&(n=void 0),!A||cc(e)||(a=n)!=null&&a.url_allowlist&&!Qs(n.url_allowlist)||(o=n)!=null&&o.url_ignorelist&&Qs(n.url_ignorelist))return!1;if((s=n)!=null&&s.dom_event_allowlist){var c=n.dom_event_allowlist;if(c&&!c.some((e=>t.type===e)))return!1}var{parentIsUsefulElement:l,targetElementList:u}=lc(e,r);if(!function(e,t){var n=t?.element_allowlist;if(I(n))return!0;var r,i=function(e){if(n.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var a of e)if(r=i(a))return r.v;return!1}(u,n)||!ic(u,n?.css_selector_allowlist))return!1;var d=A.getComputedStyle(e);if(d&&d.getPropertyValue(`cursor`)===`pointer`&&t.type===`click`)return!0;var f=e.tagName.toLowerCase();switch(f){case`html`:return!1;case`form`:return(i||[`submit`]).indexOf(t.type)>=0;case`input`:case`select`:case`textarea`:return(i||[`change`,`click`]).indexOf(t.type)>=0;default:return l?(i||[`click`]).indexOf(t.type)>=0:(i||[`click`]).indexOf(t.type)>=0&&(rc.indexOf(f)>-1||e.getAttribute(`contenteditable`)===`true`)}}(r,e,this.Bt,i,i?[`copy`,`cut`]:void 0)){var{props:a,explicitNoCapture:o}=Oc(r,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Bt.element_attribute_ignorelist,elementsChainAsString:this.Ms});if(o)return!1;var s=this.getElementSelectors(r);if(s&&s.length>0&&(a.$element_selectors=s),t===wc){var c,l=ec(A==null||(c=A.getSelection())==null?void 0:c.toString()),u=e.type||`clipboard`;if(!l)return!1;a.$selected_content=l,a.$copy_type=u}return this.instance.capture(t,a),!0}}}isBrowserSupported(){return Lt(j?.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.Ls=(A==null||(t=A.location)==null?void 0:t.pathname)||``}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview===`history_change`}startIfEnabled(){this.isEnabled&&(R.info(`History API monitoring enabled, starting...`),this.monitorHistoryChanges())}stop(){this.Ds&&this.Ds(),this.Ds=void 0,R.info(`History API monitoring stopped`)}monitorHistoryChanges(){var e,t;if(A&&A.history){var n=this;(e=A.history.pushState)!=null&&e.__posthog_wrapped__||Ac(A.history,`pushState`,(e=>function(t,r,i){e.call(this,t,r,i),n.Bs(`pushState`)})),(t=A.history.replaceState)!=null&&t.__posthog_wrapped__||Ac(A.history,`replaceState`,(e=>function(t,r,i){e.call(this,t,r,i),n.Bs(`replaceState`)})),this.js()}}Bs(e){try{var t,n=A==null||(t=A.location)==null?void 0:t.pathname;if(!n)return;n!==this.Ls&&this.isEnabled&&this._instance.capture(Wi,{navigation_type:e}),this.Ls=n}catch(t){R.error(`Error capturing `+e+` pageview`,t)}}js(){if(!this.Ds){var e=()=>{this.Bs(`popstate`)};ra(A,`popstate`,e),this.Ds=()=>{A&&A.removeEventListener(`popstate`,e)}}}},heatmaps:class{get Bt(){return this.instance.config}constructor(e){var t;this.$s=!1,this.Rs=!1,this.qs=null,this.instance=e,this.$s=!((t=this.instance.persistence)==null||!t.props[Kr]),this.rageclicks=new Cc(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Rt(this.Bt.capture_heatmaps)&&this.Bt.capture_heatmaps.flush_interval_milliseconds&&(e=this.Bt.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return L(this.Bt.capture_heatmaps)?L(this.Bt.enable_heatmaps)?this.$s:this.Bt.enable_heatmaps:!1!==this.Bt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Rs)return;Bc.info(`starting...`),this.Zs(),this.Ft()}else clearInterval(this.qs??void 0),this.Vs(),this.getAndClearBuffer()}onRemoteConfig(e){if(`heatmaps`in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Kr]:t}),this.$s=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.T;return this.T=void 0,e}Hs(e){this.Tt(e.originalEvent,`deadclick`)}Ft(){this.qs&&clearInterval(this.qs),this.qs=j?.visibilityState===`visible`?setInterval(this.Yr.bind(this),this.flushIntervalMilliseconds):null}Zs(){A&&j&&(this.zs=this.Yr.bind(this),ra(A,Ui,this.zs),this.Us=e=>this.Tt(e||A?.event),ra(j,`click`,this.Us,{capture:!0}),this.Ys=e=>this.Gs(e||A?.event),ra(j,`mousemove`,this.Ys,{capture:!0}),this.Ws=new Ea(this.instance,wa,this.Hs.bind(this)),this.Ws.startIfEnabledOrStop(),this.Xs=this.Ft.bind(this),ra(j,Hi,this.Xs),this.Rs=!0)}Vs(){var e;A&&j&&(this.zs&&A.removeEventListener(Ui,this.zs),this.Us&&j.removeEventListener(`click`,this.Us,{capture:!0}),this.Ys&&j.removeEventListener(`mousemove`,this.Ys,{capture:!0}),this.Xs&&j.removeEventListener(Hi,this.Xs),clearTimeout(this.Js),(e=this.Ws)==null||e.stop(),this.Rs=!1)}Ks(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),a=function(e,t,n){for(var r=e;r&&qs(r)&&!Js(r,`body`);){if(r===n)return!1;if(P(t,A?.getComputedStyle(r).position))return!0;r=ac(r)}return!1}(nc(e),[`fixed`,`sticky`],i);return{x:e.clientX+(a?0:r),y:e.clientY+(a?0:n),target_fixed:a,type:t}}Tt(e,t){var n;if(t===void 0&&(t=`click`),!Ks(e.target)&&Vc(e)){var r=this.Ks(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Qs(N({},r,{type:`rageclick`})),this.Qs(r)}}Gs(e){!Ks(e.target)&&Vc(e)&&(clearTimeout(this.Js),this.Js=setTimeout((()=>{this.Qs(this.Ks(e,`mousemove`))}),500))}Qs(e){if(A){var t=A.location.href,n=this.Bt.custom_personal_data_properties,r=Ia(t,this.Bt.mask_personal_data_properties?[...za,...n||[]]:[],Va);this.T=this.T||{},this.T[r]||(this.T[r]=[]),this.T[r].push(e)}}Yr(){this.T&&!zt(this.T)&&this.instance.capture(`$$heatmap`,{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ea,webVitalsAutocapture:class{constructor(e){var t;this.$s=!1,this.Rs=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.eo=()=>{clearTimeout(this.ro),this.T.metrics.length!==0&&(this._instance.capture(`$web_vitals`,this.T.metrics.reduce(((e,t)=>N({},e,{[`$web_vitals_`+t.name+`_event`]:N({},t),[`$web_vitals_`+t.name+`_value`]:t.value})),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ht=e=>{var t=this._instance.sessionManager?.checkAndGetSessionAndWindowId(!0);if(I(t))Mc.error(`Could not read session ID. Dropping metrics!`);else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var n=this.io();I(n)||(L(e?.name)||L(e?.value)?Mc.error(`Invalid metric received`,e):!this.no||this.no>e.value?(this.T.url!==n&&(this.eo(),this.ro=setTimeout(this.eo,this.flushToCaptureTimeoutMs)),I(this.T.url)&&(this.T.url=n),this.T.firstMetricTimestamp=I(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.T.metrics.push(N({},e,{$current_url:n,$session_id:t.sessionId,$window_id:t.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.eo()):Mc.error(`Ignoring metric with value >= `+this.no,e))}},this.so=()=>{if(!this.Rs){var e,t,n,r,i=M.__PosthogExtensions__;I(i)||I(i.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:n,onINP:r}=i.postHogWebVitalsCallbacks),e&&t&&n&&r?(this.allowedMetrics.indexOf(`LCP`)>-1&&e(this.ht.bind(this)),this.allowedMetrics.indexOf(`CLS`)>-1&&t(this.ht.bind(this)),this.allowedMetrics.indexOf(`FCP`)>-1&&n(this.ht.bind(this)),this.allowedMetrics.indexOf(`INP`)>-1&&r(this.ht.bind(this)),this.Rs=!0):Mc.error(`web vitals callbacks not loaded - not starting`)}},this._instance=e,this.$s=!((t=this._instance.persistence)==null||!t.props[Xr]),this.startIfEnabled()}get oo(){return this._instance.config.capture_performance}get allowedMetrics(){var e=Rt(this.oo)?this.oo?.web_vitals_allowed_metrics:void 0;return L(e)?this._instance.persistence?.props[$r]||[`CLS`,`FCP`,`INP`,`LCP`]:e}get flushToCaptureTimeoutMs(){return(Rt(this.oo)?this.oo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Rt(this.oo)?this.oo.web_vitals_attribution:void 0;return e!=null&&e}get no(){var e=Rt(this.oo)&&Ut(this.oo.__web_vitals_max_value)?this.oo.__web_vitals_max_value:Nc;return e>0&&6e4>=e?Nc:e}get isEnabled(){var e=_t?.protocol;if(e!==`http:`&&e!==`https:`)return Mc.info(`Web Vitals are disabled on non-http/https protocols`),!1;var t=Rt(this.oo)?this.oo.web_vitals:Gt(this.oo)?this.oo:void 0;return Gt(t)?t:this.$s}startIfEnabled(){this.isEnabled&&!this.Rs&&(Mc.info(`enabled, starting...`),this.ur(this.so))}onRemoteConfig(e){if(`capturePerformance`in e){var t=Rt(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Rt(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Xr]:t}),this._instance.persistence.register({[$r]:n})),this.$s=t,this.startIfEnabled()}}ur(e){var t,n;(t=M.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?e():(n=M.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?`web-vitals-with-attribution`:`web-vitals`,(t=>{t?Mc.error(`failed to load script`,t):e()}))}io(){var e=A?A.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties;return Ia(e,this._instance.config.mask_personal_data_properties?[...za,...t||[]]:[],Va)}Mc.error(`Could not determine current URL`)}}},hl={exceptionObserver:class{constructor(e){var t;this.so=()=>{var e;if(A&&this.isEnabled&&(e=M.__PosthogExtensions__)!=null&&e.errorWrappingFunctions){var t=M.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=M.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=M.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ao&&this.Bt.capture_unhandled_errors&&(this.ao=t(this.captureException.bind(this))),!this.lo&&this.Bt.capture_unhandled_rejections&&(this.lo=n(this.captureException.bind(this))),!this.uo&&this.Bt.capture_console_errors&&(this.uo=r(this.captureException.bind(this)))}catch(e){kc.error(`failed to start`,e),this.ho()}}},this._instance=e,this.co=!((t=this._instance.persistence)==null||!t.props[qr]),this.do=new tn({refillRate:this._instance.config.error_tracking.__exceptionRateLimiterRefillRate??1,bucketSize:this._instance.config.error_tracking.__exceptionRateLimiterBucketSize??10,refillInterval:1e4,Gt:kc}),this.Bt=this.vo(),this.startIfEnabledOrStop()}vo(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Rt(e)?t=N({},t,e):(I(e)?this.co:e)&&(t=N({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Bt.capture_console_errors||this.Bt.capture_unhandled_errors||this.Bt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(kc.info(`enabled`),this.ho(),this.ur(this.so)):this.ho()}ur(e){var t,n;(t=M.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=M.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`exception-autocapture`,(t=>{if(t)return kc.error(`failed to load script`,t);e()}))}ho(){var e,t,n;(e=this.ao)==null||e.call(this),this.ao=void 0,(t=this.lo)==null||t.call(this),this.lo=void 0,(n=this.uo)==null||n.call(this),this.uo=void 0}onRemoteConfig(e){`autocaptureExceptions`in e&&(this.co=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[qr]:this.co}),this.Bt=this.vo(),this.startIfEnabledOrStop())}onConfigChange(){this.Bt=this.vo()}captureException(e){var t,n,r=(e==null||(t=e.$exception_list)==null||(t=t[0])==null?void 0:t.type)??`Exception`;this.do.consumeRateLimit(r)?kc.info(`Skipping exception capture because of client rate limiting.`,{exception:r}):(n=this._instance.exceptions)==null||n.sendExceptionEvent(e)}},exceptions:class{constructor(e){this.fo=[],this.po=new sr([new yr,new kr,new xr,new br,new Dr,new Er,new Cr,new Or],function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];return function(t,r){r===void 0&&(r=0);for(var i=[],a=t.split(`
|
|
2
|
+
`),o=r;a.length>o;o++){var s=a[o];if(1024>=s.length){var c=vr.test(s)?s.replace(vr,`$1`):s;if(!c.match(/\S*Error: /)){for(var l of n){var u=l(c,e);if(u){i.push(u);break}}if(i.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map((e=>{return N({},e,{filename:e.filename||(n=t,n[n.length-1]||{}).filename,function:e.function||cr});var n}))}(i)}}(`web:javascript`,mr,_r)),this._instance=e,this.fo=this._instance.persistence?.get_property(Jr)??[],this.mo=Pr(this.yo()),this.bo=new Fr(this.mo)}onConfigChange(){this.mo=Pr(this.yo()),this.bo.setConfig(this.mo)}onRemoteConfig(e){if(`errorTracking`in e){var t=e.errorTracking?.suppressionRules??[],n=e.errorTracking?.captureExtensionExceptions;this.fo=t,this._instance.persistence&&this._instance.persistence.register({[Jr]:this.fo,[Yr]:n})}}get _o(){var e,t=!!this._instance.get_property(Yr);return(e=this._instance.config.error_tracking.captureExtensionExceptions??t)!=null&&e}buildProperties(e,t){return this.po.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}addExceptionStep(e,t){if(this.mo.enabled)try{if(!Bt(e)||e.trim().length===0)return void ol.warn(`Ignoring exception step because message must be a non-empty string`);var{sanitizedProperties:n,droppedKeys:r}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce(((n,r)=>Mr.has(r)?(t.push(r),n):(n[r]=e[r],n)),{}),droppedKeys:t}}(this.wo(t));r.length>0&&ol.warn(`Ignoring reserved exception step fields`,{droppedKeys:r}),this.bo.add(N({[Ar]:e,[jr]:new Date().toISOString()},n))}catch(e){ol.error(`Failed to add exception step. Ignoring breadcrumb.`,e)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.Io(t)){if(this.Co(t))return this.So(`Exception dropped: matched a suppression rule`),void ol.info(`Skipping exception capture because a suppression rule matched`);if(!this._o&&this.xo(t))return this.So(`Exception dropped: thrown by a browser extension`),void ol.info(`Skipping exception capture because it was thrown by an extension`);if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ko(t))return this.So(`Exception dropped: thrown by the PostHog SDK`),void ol.info(`Skipping exception capture because it was thrown by the PostHog SDK`)}var n=this.mo.enabled&&L(e.$exception_steps)?this.To(e):e;try{var r=this._instance.capture(`$exception`,n,{_noTruncate:!0,_batchKey:`exceptionEvent`,en:!0});return r&&this.bo.clear(),r}catch(e){ol.error(`Failed to capture exception event. Dropping this exception.`,e),this.bo.clear();return}}catch(e){ol.error(`Failed to process exception event. Ignoring this exception.`,e);return}}To(e){try{var t=this.bo.getAttachable();return t.length===0?e:N({},e,{$exception_steps:t})}catch(t){return ol.error(`Failed to read buffered exception steps. Capturing exception without steps.`,t),e}}So(e){this.mo.enabled&&this.bo.add({[Ar]:e,[jr]:new Date().toISOString()})}wo(e){return Rt(e)?N({},e):{}}yo(){return this._instance.config.error_tracking?.exception_steps??{}}Co(e){if(e.length===0)return!1;var t=e.reduce(((e,t)=>{var{type:n,value:r}=t;return Bt(n)&&n.length>0&&e.$exception_types.push(n),Bt(r)&&r.length>0&&e.$exception_values.push(r),e}),{$exception_types:[],$exception_values:[]});return this.fo.some((e=>{var n=e.values.map((e=>{var n=hs[e.operator],r=F(e.value)?e.value:[e.value],i=t[e.key]??[];return r.length>0&&n(r,i)}));return e.type===`OR`?n.some(Boolean):n.every(Boolean)}))}xo(e){return e.flatMap((e=>e.stacktrace?.frames??[])).some((e=>e.filename&&e.filename.startsWith(`chrome-extension://`)))}ko(e){if(e.length>0){var t,n,r=e[0].stacktrace?.frames??[],i=r[r.length-1];return(t=i==null||(n=i.filename)==null?void 0:n.includes(`posthog.com/static`))!=null&&t}return!1}Io(e){return!L(e)&&F(e)}}},gl=N({productTours:class{get ni(){return this._instance.persistence}constructor(e){this.Ao=null,this.Eo=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){`productTours`in e&&(this.ni&&this.ni.register({[Qr]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.Ao||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(Qr)||this.ur((()=>this.Ro()))}ur(e){var t,n;(t=M.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=M.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`product-tours`,(t=>{t?Hc.error(`Could not load product tours script`,t):e()}))}Ro(){var e;!this.Ao&&(e=M.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Ao=M.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!F(this.Eo)||t){var n=this.ni;if(n){var r=n.props[yi];if(F(r)&&!t)return this.Eo=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/product_tours/?token=`+this._instance.config.token),method:`GET`,callback:t=>{var r=t.statusCode;if(r!==200||!t.json){var i=`Product Tours API could not be loaded, status: `+r;Hc.error(i),e([],{isLoaded:!1,error:i});return}var a=F(t.json.product_tours)?t.json.product_tours:[];this.Eo=a,n&&n.register({[yi]:a}),e(a,{isLoaded:!0})}})}else e(this.Eo,{isLoaded:!0})}getActiveProductTours(e){L(this.Ao)?e([],{isLoaded:!1,error:`Product tours not loaded`}):this.Ao.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Ao)==null||t.showTourById(e)}previewTour(e){this.Ao?this.Ao.previewTour(e):this.ur((()=>{var t;this.Ro(),(t=this.Ao)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Ao)==null||e.dismissTour(`user_clicked_skip`)}nextStep(){var e;(e=this.Ao)==null||e.nextStep()}previousStep(){var e;(e=this.Ao)==null||e.previousStep()}clearCache(){var e;this.Eo=null,(e=this.ni)==null||e.unregister(yi)}resetTour(e){var t;(t=this.Ao)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Ao)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Ao)==null||t.cancelPendingTour(e)}}},fl),_l={siteApps:class{constructor(e){this._instance=e,this.No=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Mo(e,t){if(t){var n=this.globalsForEvent(t);this.No.push(n),this.No.length>1e3&&(this.No=this.No.slice(10))}}get siteAppLoaders(){var e;return(e=M._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.Mo.bind(this));this.Fo=()=>{e(),this.No=[],this.Fo=void 0}}}globalsForEvent(e){if(!e)throw Error(`Event payload is required`);var t={},n=this._instance.get_property(`$groups`)||[],r=this._instance.get_property(`$stored_group_properties`)||{};for(var[i,a]of Object.entries(r))t[i]={id:n[i],type:i,properties:a};var{$set_once:o,$set:s}=e;return{event:N({},Dt(e,Uc),{properties:N({},e.properties,s?{$set:N({},e.properties?.$set??{},s)}:{},o?{$set_once:N({},e.properties?.$set_once??{},o)}:{}),elements_chain:e.properties?.$elements_chain??``,distinct_id:e.properties?.distinct_id}),person:{properties:this._instance.get_property(`$stored_person_properties`)},groups:t}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var n;!t.errored&&this.No.length&&(Wc.info(`Processing `+this.No.length+` events for site app with id `+e.id),this.No.forEach((e=>t.processEvent==null?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every((e=>e.processedBuffer||e.errored))&&((n=this.Fo)==null||n.call(this))},r=!1,i=i=>{t.errored=!i,t.loaded=!0,Wc.info(`Site app with id `+e.id+` `+(i?`loaded`:`errored`)),r&&n()};try{var{processEvent:a}=e.init({posthog:this._instance,callback(e){i(e)}});a&&(t.processEvent=a),r=!0}catch(t){Wc.error(Gc+e.id,t),i(!1)}if(r&&t.loaded)try{n()}catch(n){Wc.error(`Error while processing buffered events PostHog app with config id `+e.id,n),t.errored=!0}}Oo(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}Po(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(t)}catch(t){Wc.error(`Error while processing event `+e.event+` for site app `+n.id,t)}}}onRemoteConfig(e){var t,n,r,i=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Oo(),void this._instance.on(`eventCaptured`,(e=>this.Po(e)))):void Wc.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`);if((n=this.Fo)==null||n.call(this),(r=e.siteApps)!=null&&r.length)if(this.isEnabled){var a=function(e){var t;M[`__$$ph_site_app_`+e]=i._instance,(t=M.__PosthogExtensions__)==null||t.loadSiteApp==null||t.loadSiteApp(i._instance,s,(t=>{if(t)return Wc.error(Gc+e,t)}))};for(var{id:o,url:s}of e.siteApps)a(o)}else Wc.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`)}}},vl={tracingHeaders:class{constructor(e){this.Lo=void 0,this.Do=void 0,this.so=()=>{var e,t,n=this.Bo()||[];I(this.Lo)&&((e=M.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null||e._patchXHR(n,this._instance.get_distinct_id(),this._instance.sessionManager)),I(this.Do)&&((t=M.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchFetch(n,this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}initialize(){this.startIfEnabledOrStop()}ur(e){var t,n;(t=M.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(n=M.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`tracing-headers`,(t=>{if(t)return jc.error(`failed to load script`,t);e()}))}Bo(){return this._instance.config.addTracingHeaders??this._instance.config.__add_tracing_headers}startIfEnabledOrStop(){var e,t;this.Bo()?this.ur(this.so):((e=this.Lo)==null||e.call(this),(t=this.Do)==null||t.call(this),this.Lo=void 0,this.Do=void 0)}}},yl=N({surveys:class{get Bt(){return this._instance.config}constructor(e){this.jo=void 0,this._surveyManager=null,this.$o=!1,this.qo=[],this.Zo=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Bt.disable_surveys){var t=e.surveys;if(L(t))return z.warn(`Flags not loaded yet. Not loading surveys.`);var n=F(t);this.jo=n?t.length>0:t,z.info(`flags response received, isSurveysEnabled: `+this.jo),this.loadIfEnabled()}}reset(){localStorage.removeItem(`lastSeenSurveyDate`);for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(Ss)||n!=null&&n.startsWith(`inProgressSurvey_`))&&e.push(n)}e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){if(!this._surveyManager)if(this.$o)z.info(`Already initializing surveys, skipping...`);else if(this.Bt.disable_surveys)z.info(Zc);else if(this.Bt.cookieless_mode&&this._instance.consent.isOptedOut())z.info(`Not loading surveys in cookieless mode without consent.`);else{var e=M?.__PosthogExtensions__;if(e){if(!I(this.jo)||this.Bt.advanced_enable_surveys){var t=this.jo||this.Bt.advanced_enable_surveys;this.$o=!0;try{var n=e.generateSurveys;if(n)return void this.Vo(n,t);var r=e.loadExternalDependency;if(!r)return void this.Ho(Ii);r(this._instance,`surveys`,(n=>{n||!e.generateSurveys?this.Ho(`Could not load surveys script`,n):this.Vo(e.generateSurveys,t)}))}catch(e){throw this.Ho(`Error initializing surveys`,e),e}finally{this.$o=!1}}}else z.error(`PostHog Extensions not found.`)}}Vo(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Yc(this._instance),z.info(`Surveys loaded successfully`),this.zo({isLoaded:!0})}Ho(e,t){z.error(e,t),this.zo({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.qo.push(e),this._surveyManager&&this.zo({isLoaded:!0}),()=>{this.qo=this.qo.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this.Bt.disable_surveys)return z.info(Zc),e([]);var n,r=this._instance.get_property(_i);if(r&&!t)return e(r,{isLoaded:!0});typeof Promise<`u`&&this.Zo?this.Zo.then((t=>{var{surveys:n,context:r}=t;return e(n,r)})):(typeof Promise<`u`&&(this.Zo=new Promise((e=>{n=e}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/surveys/?token=`+this.Bt.token),method:`GET`,timeout:this.Bt.surveys_request_timeout_ms,callback:t=>{var r;this.Zo=null;var i=t.statusCode;if(i!==200||!t.json){var a=`Surveys API could not be loaded, status: `+i;z.error(a);var o={isLoaded:!1,error:a};e([],o),n?.({surveys:[],context:o});return}var s,c=t.json.surveys||[],l=c.filter((e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(function(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}(e)||function(e){var t;return!((t=e.conditions)==null||(t=t.actions)==null||(t=t.values)==null||!t.length)}(e))));l.length>0&&((s=this._surveyEventReceiver)==null||s.register(l)),(r=this._instance.persistence)==null||r.register({[_i]:c});var u={isLoaded:!0};e(c,u),n?.({surveys:c,context:u})}}))}zo(e){for(var t of this.qo)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){z.error(`Error in survey callback`,e)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!L(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);z.warn(`init was not called`)}Uo(e){var t=null;return this.getSurveys((n=>{t=n.find((t=>t.id===e))??null})),t}Yo(e){if(L(this._surveyManager))return{eligible:!1,reason:Xc};var t=typeof e==`string`?this.Uo(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:`Survey not found`}}canRenderSurvey(e){if(L(this._surveyManager))return z.warn(`init was not called`),{visible:!1,disabledReason:Xc};var t=this.Yo(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return L(this._surveyManager)?(z.warn(`init was not called`),Promise.resolve({visible:!1,disabledReason:Xc})):new Promise((n=>{this.getSurveys((t=>{var r=t.find((t=>t.id===e))??null;if(r){var i=this.Yo(r);n({visible:i.eligible,disabledReason:i.reason})}else n({visible:!1,disabledReason:`Survey not found`})}),t)}))}renderSurvey(e,t,n){var r;if(L(this._surveyManager))z.warn(`init was not called`);else{var i=typeof e==`string`?this.Uo(e):e;if(i!=null&&i.id)if(Cs.includes(i.type)){var a=j?.querySelector(t);if(a)return(r=i.appearance)!=null&&r.surveyPopupDelaySeconds?(z.info(`Rendering survey `+i.id+` with delay of `+i.appearance.surveyPopupDelaySeconds+` seconds`),void setTimeout((()=>{var e;z.info(`Rendering survey `+i.id+` with delay of `+i.appearance?.surveyPopupDelaySeconds+` seconds`),(e=this._surveyManager)==null||e.renderSurvey(i,a,n),z.info(`Survey `+i.id+` rendered`)}),1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,a,n);z.warn(`Survey element not found`)}else z.warn(`Surveys of type `+i.type+` cannot be rendered in the app`);else z.warn(`Survey not found`)}}displaySurvey(e,t){var n;if(L(this._surveyManager))z.warn(`init was not called`);else{var r=this.Uo(e);if(r){var i=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(i=N({},r,{appearance:N({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==ao.Popover&&t.initialResponses&&z.warn(`initialResponses is only supported for popover surveys. prefill will not be applied.`),!1===t.ignoreConditions){var a=this.canRenderSurvey(r);if(!a.visible)return void z.warn(`Survey is not eligible to be displayed: `,a.disabledReason)}t.displayType===ao.Inline?this.renderSurvey(i,t.selector,t.properties):this._surveyManager.handlePopoverSurvey(i,t)}else z.warn(`Survey not found`)}}cancelPendingSurvey(e){L(this._surveyManager)?z.warn(`init was not called`):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}}},fl),bl={toolbar:class{constructor(e){this.instance=e}Go(e){M.ph_toolbar_state=e}Wo(){return M.ph_toolbar_state??0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),ia(this.instance.config)||!A||!j)return!1;e??=A.location,n??=A.history;try{if(!t){try{A.localStorage.setItem(`test`,`test`),A.localStorage.removeItem(`test`)}catch{return!1}t=A?.localStorage}var r,i=Qc||La(e.hash,`__posthog`)||La(e.hash,`state`),a=i?Qi((()=>JSON.parse(atob(decodeURIComponent(i)))))||Qi((()=>JSON.parse(decodeURIComponent(i)))):null;return a&&a.action===`ph_authorize`?((r=a).source=`url`,r&&Object.keys(r).length>0&&(a.desiredHash?e.hash=a.desiredHash:n?n.replaceState(n.state,``,e.pathname+e.search):e.hash=``)):((r=JSON.parse(t.getItem($c)||`{}`)).source=`localstorage`,delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}Xo(e){var t=M.ph_load_toolbar||M.ph_load_editor;!L(t)&&Lt(t)?t(e,this.instance):el.warn(`No toolbar load function found`)}loadToolbar(e){var t=!(j==null||!j.getElementById(ji));if(!A||t)return!1;var n=this.instance.requestRouter.region===`custom`&&this.instance.config.advanced_disable_toolbar_metrics,r=N({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor(`ui`)},n?{instrument:!1}:{});if(A.localStorage.setItem($c,JSON.stringify(N({},r,{source:void 0}))),this.Wo()===2)this.Xo(r);else if(this.Wo()===0){var i;this.Go(1),(i=M.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,`toolbar`,(e=>{if(e)return el.error(`[Toolbar] Failed to load`,e),void this.Go(0);this.Go(2),this.Xo(r)})),ra(A,`turbolinks:load`,(()=>{this.Go(0),this.loadToolbar(r)}))}return!0}Jo(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}},xl=N({experiments:ll},fl),Sl=N({},fl,pl,ml,hl,gl,_l,yl,vl,bl,xl,{conversations:class{constructor(e){this.Ko=void 0,this._conversationsManager=null,this.Qo=!1,this.ea=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;L(t)||(Gt(t)?this.Ko=t:(this.Ko=t.enabled,this.ea=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.Ko=void 0,this.ea=null}loadIfEnabled(){if(!(this._conversationsManager||this.Qo||this._instance.config.disable_conversations||ia(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=M?.__PosthogExtensions__;if(e&&!I(this.Ko)&&this.Ko)if(this.ea&&this.ea.token){this.Qo=!0;try{var t=e.initConversations;if(t)return this.ta(t),void(this.Qo=!1);var n=e.loadExternalDependency;if(!n)return void this.ra(Ii);n(this._instance,`conversations`,(t=>{t||!e.initConversations?this.ra(`Could not load conversations script`,t):this.ta(e.initConversations),this.Qo=!1}))}catch(e){this.ra(`Error initializing conversations`,e),this.Qo=!1}}else ul.error(`Conversations enabled but missing token in remote config.`)}}ta(e){if(this.ea)try{this._conversationsManager=e(this.ea,this._instance),ul.info(`Conversations loaded successfully`)}catch(e){this.ra(`Error completing conversations initialization`,e)}else ul.error(`Cannot complete initialization: remote config is null`)}ra(e,t){ul.error(e,t),this._conversationsManager=null,this.Qo=!1}show(){this._conversationsManager?this._conversationsManager.show():ul.warn(`Conversations not loaded yet.`)}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Ko&&!Ht(this._conversationsManager)}isVisible(){var e;return(e=this._conversationsManager?.isVisible())!=null&&e}sendMessage(e,t,n){var r=this;return Et((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(ul.warn(dl),null)}))()}getMessages(e,t){var n=this;return Et((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(ul.warn(dl),null)}))()}markAsRead(e){var t=this;return Et((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(ul.warn(dl),null)}))()}getTickets(e){var t=this;return Et((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(ul.warn(dl),null)}))()}requestRestoreLink(e){var t=this;return Et((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(ul.warn(dl),null)}))()}restoreFromToken(e){var t=this;return Et((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(ul.warn(dl),null)}))()}restoreFromUrlToken(){var e=this;return Et((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(ul.warn(dl),null)}))()}getCurrentTicketId(){return this._conversationsManager?.getCurrentTicketId()??null}getWidgetSessionId(){return this._conversationsManager?.getWidgetSessionId()??null}un(){var e;(e=this._conversationsManager)==null||e.setIdentity()}hn(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},{logs:class{constructor(e){var t;this.ia=!1,this.na=!1,this.Gt=Rr(`[logs]`),this.sa=[],this.oa=0,this.aa=0,this.la=!1,this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.ia=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t=e.logs?.captureConsoleLogs;!L(t)&&t&&(this.ia=!0,this.loadIfEnabled())}reset(){this.sa=[],this.jr&&=(clearTimeout(this.jr),void 0),this.oa=0,this.aa=0,this.la=!1}loadIfEnabled(){if(this.ia&&!this.na){var e=M?.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,`logs`,(t=>{var n;t||(n=e.logs)==null||!n.initializeLogs?this.Gt.error(`Could not load logs script`,t):(e.logs.initializeLogs(this._instance),this.na=!0)})):this.Gt.error(Ii)}else this.Gt.error(`PostHog Extensions not found.`)}}captureLog(e){if(this._instance.is_capturing())if(e&&e.body){var t=this._instance.config.logs?.flushIntervalMs??3e3,n=this._instance.config.logs?.maxLogsPerInterval??1e3,r=Date.now();if(t>r-this.aa||(this.aa=r,this.oa=0,this.la=!1),n>this.oa){this.oa++;var i=function(e,t){var{text:n,number:r}=nr[e.level||`info`]||rr,i=String(Date.now())+`000000`,a={};t.distinctId&&(a.posthogDistinctId=t.distinctId),t.sessionId&&(a.sessionId=t.sessionId),t.currentUrl&&(a[`url.full`]=t.currentUrl),t.screenName&&(a[`screen.name`]=t.screenName),t.appState&&(a[`app.state`]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(a.feature_flags=t.activeFeatureFlags);var o=N({},a,e.attributes||{}),s={timeUnixNano:i,observedTimeUnixNano:i,severityNumber:r,severityText:n,body:{stringValue:e.body},attributes:ar(o)};return e.trace_id&&(s.traceId=e.trace_id),e.span_id&&(s.spanId=e.span_id),I(e.trace_flags)||(s.flags=e.trace_flags),s}(e,this.ua());this.sa.push({record:i}),(this._instance.config.logs?.maxBufferSize??100)>this.sa.length?this.ha():this.flushLogs()}else this.la||=(this.Gt.warn(`captureLog dropping logs: exceeded `+n+` logs per `+t+`ms`),!0)}else this.Gt.warn(`captureLog requires a body`)}get logger(){return this.ca||={trace:(e,t)=>this.captureLog({body:e,level:`trace`,attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:`debug`,attributes:t}),info:(e,t)=>this.captureLog({body:e,level:`info`,attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:`warn`,attributes:t}),error:(e,t)=>this.captureLog({body:e,level:`error`,attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:`fatal`,attributes:t})},this.ca}flushLogs(e){if(this.jr&&=(clearTimeout(this.jr),void 0),this.sa.length!==0){var t=this.sa;this.sa=[];var n=this._instance.config.logs,r=N({"service.name":n?.serviceName||`unknown_service`},n?.environment&&{"deployment.environment":n.environment},n?.serviceVersion&&{"service.version":n.serviceVersion},n?.resourceAttributes),i=function(e,t,n,r){return{resourceLogs:[{resource:{attributes:ar(t)},scopeLogs:[{scope:{name:n,version:r},logRecords:e}]}]}}(t.map((e=>e.record)),r,wt.LIB_NAME,wt.LIB_VERSION),a=this._instance.requestRouter.endpointFor(`api`,`/i/v1/logs`)+`?token=`+encodeURIComponent(this._instance.config.token);this._instance.Vi({method:`POST`,url:a,data:i,compression:`best-available`,batchKey:`logs`,transport:e})}}ha(){this.jr||=setTimeout((()=>{this.jr=void 0,this.flushLogs()}),this._instance.config.logs?.flushIntervalMs??3e3)}ua(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=n}if(M!=null&&(e=M.location)!=null&&e.href&&(t.currentUrl=M.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(t.activeFeatureFlags=r)}return t}}});Hs.__defaultExtensionClasses=N({},Sl);var Cl,wl=(Cl=ks[Is]=new Hs,function(){function e(){e.done||(e.done=!0,Ls=!1,Yi(ks,(function(e){e._dom_loaded()})))}j!=null&&j.addEventListener?j.readyState===`complete`?e():ra(j,`DOMContentLoaded`,e,{capture:!1}):A&&R.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),Cl),Tl=({client:e})=>{let[t,n]=O(!1),[r,i]=O({x:0,y:0}),[a,o]=O(0),s=ke(null),c=window.innerWidth<768,l=e.plugin.getUserInfo().context_menu_on_select,u=e.plugin.getPluginInfo().installedPlugins.flatMap(e=>e.context_menu_actions).filter(Boolean),d=(e,t=0)=>{let n=window.getSelection();if(!n||!e)return{x:0,y:0,text:e};let r=n.getRangeAt(0).getBoundingClientRect();return{x:r.left+r.width/2-t/2,y:r.bottom+12,text:e}};return D(()=>{e.event.on(`global.contextMenu.createActions`,({data:e})=>{u.push(...e.actions)})},[]),D(()=>{t&&s.current&&o(s.current.offsetWidth)},[t]),D(()=>{let e=e=>{let n=window.getSelection()?.toString().trim();t&&n===r.text||i(c&&n?d(n,a):{x:e.clientX,y:e.clientY,text:n})},o=e=>{var r;let o=window.getSelection()?.toString().trim();if(s.current&&s.current.contains(e.target))return;let u=e.target;if(u&&(u.tagName===`TEXTAREA`||u.tagName===`INPUT`&&u.type===`text`)){n(!1);return}e.button===0&&t?(n(!1),(r=window.getSelection())==null||r.removeAllRanges()):o&&(l||e.button===2)?(e.button===2&&e.preventDefault(),i(c?d(o,a):{x:e.clientX,y:e.clientY,text:o}),n(!0)):n(!1)},u=()=>{let e=window.getSelection()?.toString().trim();!e&&t?n(!1):e&&t&&c&&i(d(e,a))};return document.addEventListener(`mouseup`,o),window.addEventListener(`mousemove`,e),document.addEventListener(`contextmenu`,o),document.addEventListener(`selectionchange`,u),()=>{document.removeEventListener(`mouseup`,o),window.removeEventListener(`mousemove`,e),document.removeEventListener(`contextmenu`,o),document.removeEventListener(`selectionchange`,u)}},[l,t,r.text]),t?k(`div`,{ref:s,className:`fixed bg-gray-400 dark:bg-gray-700 shadow-lg border border-gray-400 rounded-md overflow-hidden dark:text-white z-50`,style:{top:r.y,left:r.x},children:u.map((t,i)=>k(El,{iconUrl:t.iconUrl,text:t.text,onClick:()=>{var i;n(!1),(i=window.getSelection())==null||i.removeAllRanges(),e.event.emitSidebarAction(t.plugin_id,t.action_key,r.text)}},i))}):null};function El(e){return mt(`button`,{onClick:e.onClick,className:`px-2 md:px-4 py-2 text-left hover:bg-gray-500 dark:hover:bg-gray-600 w-full flex flex-row`,children:[e.iconUrl&&k(`span`,{className:`flex-grow`,children:k(`img`,{src:e.iconUrl,alt:e.text,className:`w-4 h-4 mr-2`})}),k(`span`,{className:`flex-grow`,children:e.text})]})}function Dl(e=`system`,t=!1){let n=e===`system`?Ol():e===`dark`;if(t)return{isDark:n,theme:e,isDisabled:t};let r=document.documentElement;return r.dataset.theme=n?`dark`:`light`,r.style.colorScheme=n?`dark`:`light`,r.classList[n?`add`:`remove`](`dark`),document.querySelector(`#root`).classList.add(`dark:bg-gradient-to-br`,`dark:from-gray-900`,`dark:to-gray-800`,`dark:text-white`,`min-h-screen`,`bg-fixed`),{isDark:n,theme:e,isDisabled:t}}function Ol(){return window.matchMedia(`(prefers-color-scheme: dark)`).matches}Ne();var kl=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},Al=E(null),jl=({children:e,pluginId:t,client:n,userInfo:r,settings:i})=>{let o=!!n,[s,l]=O(n??null),[u,d]=O(!1),[f,p]=O(null),[m,h]=O(void 0),[g,_]=O(r??null);D(()=>{o&&(n&&l(n),r&&_(r))},[n,r,o]),Dl(m,o),D(()=>{wl.__loaded||wl.init(`phc_l4vPVZxtjlcQUDivoh5TaUL6oDe8K2lig89405cGnsv`,{cookieless_mode:`always`,api_host:`https://c.rimori.se`,defaults:`2026-01-30`,loaded:e=>{e.register({application:`frontend`,pluginId:t})}})},[]);let v=f===`sidebar`,y=f===`settings`;return D(()=>{if(o)return;Pl(t);let e=window===window.parent;e&&!u&&c.getInstance().then(e=>{e.needsLogin().then(t=>d(t?e:!0))}),(!e&&!s||e&&u===!0)&&a.getInstance(t).then(t=>{l(t),_(t.plugin.getUserInfo()),e||(h(t.plugin.theme),p(t.plugin.applicationMode),t.event.emit(`self.rimori.triggerInitFinished`))})},[t,u,s,o]),D(()=>{g?.user_id&&wl.identify(g.user_id)},[g?.user_id]),D(()=>{if(!s)return;let e=s.plugin.onRimoriInfoUpdate(e=>{_(e.profile)});return()=>e()},[s]),D(()=>{if(!s||v||o)return;let e=history.pushState;history.pushState=(...t)=>{let n=e.apply(history,t);return s.event.emit(`session.triggerUrlChange`,{url:location.hash}),n}},[s,v,o]),D(()=>{if(!s||o)return;let e=()=>{let e=document.documentElement.scrollHeight>window.innerHeight;s.event.emit(`session.triggerScrollbarChange`,{hasScrollbar:e})};e(),window.addEventListener(`resize`,e);let t=new ResizeObserver(()=>e());return t.observe(document.body),()=>{window.removeEventListener(`resize`,e),t.disconnect()}},[s,o]),u instanceof c?k(Fl,{onLogin:(e,t)=>kl(void 0,void 0,void 0,function*(){(yield u.login(e,t))&&d(!0)})}):!s||!g?``:mt(Al.Provider,{value:{client:s,userInfo:g},children:[!i?.disableContextMenu&&!v&&!y&&k(Tl,{client:s}),e]})},Ml=()=>{let e=ve(Al);if(e===null)throw Error(`useRimori must be used within an PluginProvider`);return Object.assign(e.client,{userInfo:e.userInfo})};function Nl(e){let t=window.location.hash.split(`?`);if(t.length>1){let n=new URLSearchParams(t[1]).get(e);if(n)return n}return new URL(window.location.href).searchParams.get(e)}function Pl(e){let t=Nl(`applicationMode`)===`sidebar`;l.getInstance(`Plugin EventBus `+e+` `+(t?`sidebar`:`main`))}function Fl({onLogin:e}){let[t,n]=O(``),[r,i]=O(``);return k(`div`,{style:{position:`fixed`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:`rgba(0, 0, 0, 0.5)`},children:mt(`div`,{style:{backgroundColor:`#343534`,padding:`1rem`,borderRadius:`0.5rem`,width:`500px`,flexDirection:`column`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[k(`p`,{style:{fontSize:`2rem`,fontWeight:`bold`,marginBottom:`1rem`,textAlign:`center`},children:`Rimori Login Required`}),k(`p`,{style:{marginBottom:`1rem`,textAlign:`center`},children:`Please login with your Rimori developer account for this plugin to be able to access the Rimori platform the same way it would when being deployed.`}),k(`input`,{style:{marginBottom:`1rem`,width:`100%`,padding:`0.5rem`,borderRadius:`0.5rem`,border:`none`,backgroundColor:`#444444`},type:`email`,placeholder:`Email`,onChange:e=>n(e.target.value)}),k(`input`,{style:{marginBottom:`1rem`,width:`100%`,padding:`0.5rem`,borderRadius:`0.5rem`,border:`none`,backgroundColor:`#444444`},type:`password`,placeholder:`Password`,onChange:e=>i(e.target.value)}),k(`button`,{style:{marginBottom:`1rem`,width:`100%`,padding:`0.5rem`,borderRadius:`0.5rem`,border:`none`,backgroundColor:`#928358`},onClick:()=>{e(t,r)},children:`Login`})]})})}Ne();function Il(e,t){let[n,r]=y.useState([]),[i,a]=y.useState(!1),{ai:o}=Ml(),s=y.useRef({prompt:t?.prompt,promptVariables:t?.promptVariables});return{messages:n,append:i=>{let c=[...n,...i];r(c),a(!0);let l=s.current.promptVariables??t?.promptVariables,u=s.current.prompt??t?.prompt;o.getStreamedText({messages:c,onMessage:(e,t,n,i)=>{a(!n),r(n=>{let r=n[n.length-1];return r?.id===e?[...n.slice(0,-1),Object.assign(Object.assign({},r),{content:t,toolCalls:i})]:[...n,{id:e,role:`assistant`,content:t,toolCalls:i}]})},tools:e,prompt:u,variables:l})},init:y.useCallback(e=>{s.current=Object.assign(Object.assign({},s.current),e)},[]),isLoading:i,setMessages:r,lastMessage:n[n.length-1]}}Ne();var Ll=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};function Rl(e){let t=Ml(),[n,r]=O(e),[i,a]=O(!0);return D(()=>{let n=!1;return t.plugin.getSettings(e).then(e=>{n||(r(e),a(!1))}),()=>{n=!0}},[]),{settings:n,isLoading:i,setSettings:_e(e=>Ll(this,void 0,void 0,function*(){let i=Object.assign(Object.assign({},n),e);r(i),yield t.plugin.setSettings(i)}),[n,t])}}Ne();var zl=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};function Bl(e){let{actionKey:t,skillCategory:n,initialData:r,onAction:i}=e,{event:a,exercise:o}=Ml(),[s,c]=O(!1),[l,u]=O(null),d=ke(r??{}),f=ke(null),p=ke(!1);return D(()=>{r&&(d.current=Object.assign({},r))},[]),D(()=>{let e=a.onMainPanelAction(e=>zl(this,void 0,void 0,function*(){console.log(`[useExerciseTracker:${t}] Dashboard action received:`,e),p.current=!0,f.current=Date.now(),c(!0),u(e),d.current=r??{},i&&(yield i(e)),console.log(`[useExerciseTracker:${t}] onAction complete, exercise active`)}),t);return()=>e.off()},[t]),{isActive:s,actionParams:l,start:_e(e=>zl(this,void 0,void 0,function*(){console.log(`[useExerciseTracker:${t}] start() called (self-initiated)`,e),p.current=!1,yield o.start({actionKey:t,knowledgeId:e?.knowledgeId}),f.current=Date.now(),d.current=r??{},c(!0),console.log(`[useExerciseTracker:${t}] start() complete, session token acquired`)}),[t,o,r]),ready:_e(()=>{f.current=Date.now()},[]),micro:_e(e=>{let t={type:`micro`,skillCategory:n,accomplishmentKeyword:e.accomplishmentKeyword,description:e.description,meta:e.meta};a.emitAccomplishment(t)},[a,n]),track:_e(e=>{d.current=Object.assign(Object.assign({},d.current),e)},[]),end:_e(e=>{let r=f.current?Date.now()-f.current:0,i=Math.max(1,Math.round(r/6e4));console.log(`[useExerciseTracker:${t}] end() — keyword=${e.accomplishmentKeyword}, errorRatio=${e.errorRatio}, duration=${i}min, trackedData=`,d.current);let o=[...Object.entries(d.current).map(([e,t])=>({key:e,value:t,description:e})),...e.meta??[]],s={type:`macro`,skillCategory:n,accomplishmentKeyword:e.accomplishmentKeyword,description:e.description,errorRatio:e.errorRatio,durationMinutes:i,meta:o.length>0?o:void 0};a.emitAccomplishment(s),console.log(`[useExerciseTracker:${t}] Macro accomplishment emitted`),c(!1),u(null),f.current=null},[t,a,n])}}Ne();var Vl={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Hl=y.createContext&&y.createContext(Vl);Ne();var Ul=[`attr`,`size`,`title`];function Wl(e,t){if(e==null)return{};var n=Gl(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Gl(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Kl(){return Kl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Kl.apply(this,arguments)}function ql(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Jl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ql(Object(n),!0).forEach(function(t){Yl(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ql(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Yl(e,t,n){return t=Xl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xl(e){var t=Zl(e,`string`);return typeof t==`symbol`?t:t+``}function Zl(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ql(e){return e&&e.map((e,t)=>y.createElement(e.tag,Jl({key:t},e.attr),Ql(e.child)))}function B(e){return t=>y.createElement($l,Kl({attr:Jl({},e.attr)},t),Ql(e.child))}function $l(e){var t=t=>{var{attr:n,size:r,title:i}=e,a=Wl(e,Ul),o=r||t.size||`1em`,s;return t.className&&(s=t.className),e.className&&(s=(s?s+` `:``)+e.className),y.createElement(`svg`,Kl({stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`},t.attr,n,a,{className:s,style:Jl(Jl({color:e.color||t.color},t.style),e.style),height:o,width:o,xmlns:`http://www.w3.org/2000/svg`}),i&&y.createElement(`title`,null,i),e.children)};return Hl===void 0?t(Vl):y.createElement(Hl.Consumer,null,e=>t(e))}function eu(e){return B({tag:`svg`,attr:{viewBox:`0 0 384 512`},child:[{tag:`path`,attr:{d:`M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z`},child:[]}]})(e)}function tu(e){return B({tag:`svg`,attr:{viewBox:`0 0 640 512`},child:[{tag:`path`,attr:{d:`M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z`},child:[]}]})(e)}function nu(e){return B({tag:`svg`,attr:{viewBox:`0 0 320 512`},child:[{tag:`path`,attr:{d:`M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z`},child:[]}]})(e)}function ru(e){return B({tag:`svg`,attr:{viewBox:`0 0 448 512`},child:[{tag:`path`,attr:{d:`M448 48v32a16 16 0 0 1-16 16h-48v368a16 16 0 0 1-16 16h-32a16 16 0 0 1-16-16V96h-32v368a16 16 0 0 1-16 16h-32a16 16 0 0 1-16-16V352h-32a160 160 0 0 1 0-320h240a16 16 0 0 1 16 16z`},child:[]}]})(e)}function iu(e){return B({tag:`svg`,attr:{viewBox:`0 0 512 512`},child:[{tag:`path`,attr:{d:`M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm115.7 272l-176 101c-15.8 8.8-35.7-2.5-35.7-21V152c0-18.4 19.8-29.8 35.7-21l176 107c16.4 9.2 16.4 32.9 0 42z`},child:[]}]})(e)}function au(e){return B({tag:`svg`,attr:{viewBox:`0 0 512 512`},child:[{tag:`path`,attr:{d:`M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm96 328c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V176c0-8.8 7.2-16 16-16h160c8.8 0 16 7.2 16 16v160z`},child:[]}]})(e)}function ou(e){return B({tag:`svg`,attr:{viewBox:`0 0 512 512`},child:[{tag:`path`,attr:{d:`M496 224H293.9l-87.17-26.83A43.55 43.55 0 0 1 219.55 112h66.79A49.89 49.89 0 0 1 331 139.58a16 16 0 0 0 21.46 7.15l42.94-21.47a16 16 0 0 0 7.16-21.46l-.53-1A128 128 0 0 0 287.51 32h-68a123.68 123.68 0 0 0-123 135.64c2 20.89 10.1 39.83 21.78 56.36H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h480a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm-180.24 96A43 43 0 0 1 336 356.45 43.59 43.59 0 0 1 292.45 400h-66.79A49.89 49.89 0 0 1 181 372.42a16 16 0 0 0-21.46-7.15l-42.94 21.47a16 16 0 0 0-7.16 21.46l.53 1A128 128 0 0 0 224.49 480h68a123.68 123.68 0 0 0 123-135.64 114.25 114.25 0 0 0-5.34-24.36z`},child:[]}]})(e)}Ne();var su=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},cu=[.8,.9,1,1.1,1.2,1.5],lu=!1,uu=({text:e,voice:t,language:n,hide:r,playListenerEvent:i,initialSpeed:a=1,playOnMount:s=!1,enableSpeedAdjustment:c=!1,cache:l=!0,size:u=`25px`,ttsInstructions:d,disableDialect:f=!1})=>{let[p,m]=O(null),[h,g]=O(a),[_,v]=O(!1),[y,b]=O(!1),{ai:x,userInfo:S}=Ml(),C=ke(null),w=ke(null);D(()=>(p&&m(null),()=>{p&&URL.revokeObjectURL(p)}),[e]);let ee=()=>su(void 0,void 0,void 0,function*(){b(!0);let r=d??(!f&&S?.dialect?`Speak with a ${S.dialect} accent and pronunciation.`:void 0),i=yield x.getVoice(e,t||(n?`aws_default`:`openai_alloy`),1,n,l,r);m(URL.createObjectURL(i)),b(!1)});D(()=>{if(!p||!_){C.current&&=(C.current.pause(),C.current.currentTime=0,null);return}C.current&&(C.current.pause(),C.current.currentTime=0);let e=new Audio(p);return C.current=e,e.playbackRate=h,e.play().then(()=>{e.onended=()=>{v(!1),lu=!1,C.current=null}}).catch(e=>{console.warn(`Error playing audio:`,e),v(!1),C.current=null}),()=>{C.current&&=(C.current.pause(),C.current.currentTime=0,null)}},[p,_,h]),D(()=>()=>{C.current&&=(C.current.pause(),C.current.currentTime=0,null),v(!1)},[]),D(()=>()=>{p&&URL.revokeObjectURL(p)},[p]);let T=()=>{!_&&!p?ee().then(()=>v(!0)):v(e=>!e)},te=ke(T);return Te(()=>{te.current=T}),D(()=>i?(w.current=o.on(i,()=>te.current()),()=>{w.current&&=(w.current.off(),null)}):void 0,[i]),D(()=>{!s||lu||(lu=!0,T())},[s]),k(`div`,{className:`group relative`,children:mt(`div`,{className:`flex flex-row items-end`,children:[!r&&k(`button`,{className:`text-gray-400`,onClick:T,disabled:y,children:k(y?du:_?au:iu,{size:u})}),c&&mt(`div`,{className:`ml-1 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex flex-row text-sm text-gray-500`,children:[k(`span`,{className:`pr-1`,children:`Speed: `}),k(`select`,{value:h,className:`appearance-none cursor-pointer pr-0 p-0 rounded shadow leading-tight focus:outline-none focus:bg-gray-800 focus:ring bg-transparent border-0`,onChange:e=>g(parseFloat(e.target.value)),disabled:y,children:cu.map(e=>k(`option`,{value:e,children:e},e))})]})]})})},du=({text:e,className:t,size:n=`30px`})=>mt(`div`,{className:`flex items-center space-x-2 pl-1 `+t,children:[mt(`svg`,{style:{width:n,height:n},className:`animate-spin -ml-1 h-5 w-5 text-white`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,children:[k(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),k(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})]}),e&&k(`span`,{className:``,children:e})]});function fu(e){return B({tag:`svg`,attr:{viewBox:`0 0 384 512`},child:[{tag:`path`,attr:{d:`M192 0C139 0 96 43 96 96l0 160c0 53 43 96 96 96s96-43 96-96l0-160c0-53-43-96-96-96zM64 216c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40c0 89.1 66.2 162.7 152 174.4l0 33.6-48 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l72 0 72 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-48 0 0-33.6c85.8-11.7 152-85.3 152-174.4l0-40c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40c0 70.7-57.3 128-128 128s-128-57.3-128-128l0-40z`},child:[]}]})(e)}function pu(e){return B({tag:`svg`,attr:{viewBox:`0 0 512 512`},child:[{tag:`path`,attr:{d:`M304 48a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zm0 416a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM48 304a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm464-48a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM142.9 437A48 48 0 1 0 75 369.1 48 48 0 1 0 142.9 437zm0-294.2A48 48 0 1 0 75 75a48 48 0 1 0 67.9 67.9zM369.1 437A48 48 0 1 0 437 369.1 48 48 0 1 0 369.1 437z`},child:[]}]})(e)}Ne();var mu=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},hu=le(({onVoiceRecorded:e,iconSize:t,className:n,disabled:r,loading:i,onRecordingStatusChange:a,enablePushToTalk:o=!1},s)=>{let[c,l]=O(!1),[d,f]=O(!1),p=ke(null),{ai:m,plugin:h}=Ml(),g=ke(e);D(()=>{g.current=e},[e]);let _=()=>mu(void 0,void 0,void 0,function*(){try{p.current||=new u(h.pluginId),yield p.current.startRecording(),l(!0),a(!0)}catch(e){console.error(`Failed to start recording:`,e)}}),v=()=>mu(void 0,void 0,void 0,function*(){try{if(p.current&&c){let e=yield p.current.stopRecording();f(!0);let t=yield m.getTextFromVoice(e.recording);f(!1),g.current(t)}}catch(e){console.error(`Failed to stop recording:`,e)}finally{l(!1),a(!1)}});Ce(s,()=>({startRecording:_,stopRecording:v}));let y=ke(!1);return D(()=>{if(!o)return;let e=e=>mu(void 0,void 0,void 0,function*(){e.code===`Space`&&!y.current&&(y.current=!0,yield _())}),t=e=>{e.code===`Space`&&y.current&&(y.current=!1,v())};return window.addEventListener(`keydown`,e),window.addEventListener(`keyup`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`keyup`,t)}},[o]),k(`button`,{className:`flex flex-row justify-center items-center rounded-full mx-auto disabled:opacity-50 `+n,onClick:c?v:_,disabled:r||i||d,children:i||d?k(pu,{className:`animate-spin`}):k(fu,{size:t,className:c?`text-red-600`:``})})});Ne();function gu({imageUrl:e,className:t,isDarkTheme:n=!1,width:r=`150px`,loudnessRef:i}){let a=ke(null),o=ke(0),s=ke(null),c=(e,t,r,i)=>{if(t&&e){e.clearRect(0,0,t.width,t.height);let a=Math.min(t.width,t.height)/3,o=t.width/2,s=t.height/2,c=a+i/2.5;e.beginPath(),e.arc(o,s,c,0,Math.PI*2,!0),e.strokeStyle=n?`rgba(255, 255, 255, 0.5)`:`rgba(0, 0, 0, 0.5)`,e.lineWidth=5,e.stroke(),e.save(),e.beginPath(),e.arc(o,s,a,0,Math.PI*2,!0),e.closePath(),e.clip(),e.drawImage(r,o-a,s-a,a*2,a*2),e.restore(),e.beginPath(),e.arc(o,s,a,0,Math.PI*2,!0),e.strokeStyle=n?`rgba(255, 255, 255, 0.9)`:`rgba(0, 0, 0, 0.9)`,e.lineWidth=5,e.stroke()}};return D(()=>{let t=a.current;if(t){let n=t.getContext(`2d`);if(n){let r=new Image;r.src=e;let a=!0;return r.onload=()=>{if(!a)return;c(n,t,r,0);let e=()=>{let a=i?.current??0;o.current>a?o.current=Math.max(a,o.current-.06*o.current):o.current=a,c(n,t,r,o.current),s.current=requestAnimationFrame(e)};s.current=requestAnimationFrame(e)},()=>{a=!1,s.current&&cancelAnimationFrame(s.current)}}}},[e]),k(`canvas`,{ref:a,className:t,width:500,height:500,style:{width:r}})}function _u(e){let t=[];return e.userMessage&&t.push({id:`1`,role:`user`,content:e.userMessage}),e.assistantMessage&&t.push({id:`2`,role:`assistant`,content:e.assistantMessage}),t}Ne();function vu({avatarImageUrl:e,voiceId:t,agentTools:n,autoStartConversation:r,children:i,circleSize:a=`300px`,className:o,cache:c=!1,prompt:l,promptVariables:u}){let{ai:d,plugin:f,userInfo:p}=Ml(),{isDark:m}=Dl(f.theme,!0),[h,g]=O(!1),[_,v]=O(!1),y=ke(0),b=p?.dialect?`Speak with a ${p.dialect} accent and pronunciation.`:void 0,x=Ee(()=>new s((...e)=>d.getVoice(...e),t,c),[t,d,c]);D(()=>{x.setInstructions(b)},[x,b]);let{messages:S,append:C,isLoading:w,lastMessage:ee,setMessages:T}=Il(n,{prompt:l,promptVariables:u});return D(()=>{console.log(`messages`,S)},[S]),D(()=>{w||v(!1)},[w]),D(()=>{t&&(x.setOnLoudnessChange(e=>{y.current=e}),x.setOnEndOfSpeech(()=>g(!1)),r&&(T(_u(r)),r.assistantMessage?x.handleNewText(r.assistantMessage,w):r.userMessage&&C([{role:`user`,content:r.userMessage,id:S.length.toString()}])))},[r,t]),D(()=>()=>{x.cleanup()},[x]),D(()=>{ee?.role===`assistant`&&(x.handleNewText(ee.content,w),ee.toolCalls&&(g(!1),v(!1)))},[ee,w]),mt(`div`,{className:`md:pb-8 ${o||``}`,children:[k(gu,{width:a,className:`mx-auto`,imageUrl:e,isDarkTheme:m,loudnessRef:y}),i,k(hu,{iconSize:`30`,className:`w-16 h-16 shadow-lg rounded-full bg-gray-400 dark:bg-gray-800`,disabled:h,loading:_,enablePushToTalk:!0,onVoiceRecorded:e=>{g(!0),C([{role:`user`,content:`Message(`+Math.floor((S.length+1)/2)+`): `+e,id:S.length.toString()}])},onRecordingStatusChange:e=>!e&&v(!0)})]})}Ne();function yu(){let{plugin:e}=Ml(),[t,n]=O(null),[r,i]=O(0);return D(()=>{e.getTranslator().then(e=>{n(e),e.onLanguageChanged(()=>{i(e=>e+1)})})},[e]),{t:_e((e,n)=>t&&t.t(e,n)||``,[t,r]),ready:t!==null}}function bu(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`},child:[{tag:`path`,attr:{d:`M5.536 21.886a1.004 1.004 0 0 0 1.033-.064l13-9a1 1 0 0 0 0-1.644l-13-9A1 1 0 0 0 5 3v18a1 1 0 0 0 .536.886z`},child:[]}]})(e)}Ne();var xu=0,Su=()=>`ba-${++xu}`;function Cu({prompt:e,promptVariables:t,autoStartConversation:n,circleSize:r=`160px`,chatPlaceholder:i,bottomAction:a,className:o,voiceSpeed:c=1,tools:l,showName:u=!1}){let{ai:d,plugin:f,userInfo:p}=Ml(),m=f.ttsEnabled,{isDark:h}=Dl(f.theme,!0),g=p.study_buddy,_=p?.dialect,v=_?`Speak with a ${_} accent and pronunciation.`:void 0,[y,b]=O(``),[x,S]=O([]),[C,w]=O(!1),[ee,T]=O(!1),te=ke(0),ne=ke(m);D(()=>{ne.current=m,!m&&ee&&(re.stop(),T(!1))},[m]);let re=Ee(()=>new s((...e)=>d.getVoice(...e),g?.voiceId??``),[g?.voiceId,d]);D(()=>{re.setInstructions(v)},[re,v]),D(()=>(re.setVoiceSpeed(c),re.setOnLoudnessChange(e=>{te.current=e}),re.setOnEndOfSpeech(()=>T(!1)),()=>re.cleanup()),[re]);let ie=e=>e.map(e=>({role:e.role,content:e.content})),ae=n=>{w(!0),d.getStreamedText({messages:ie(n),onMessage:(e,t,n)=>{w(!n);let r=`ai-${e}`;S(e=>{let n=e[e.length-1];return n?.id===r?[...e.slice(0,-1),Object.assign(Object.assign({},n),{content:t})]:[...e,{id:r,role:`assistant`,content:t}]}),ne.current&&(re.handleNewText(t,!n),t&&T(!0))},tools:l,prompt:e,variables:t})},oe=ke(!1);if(D(()=>{if(!oe.current){if(oe.current=!0,n?.assistantMessage)S([{id:`init`,role:`assistant`,content:n.assistantMessage}]),ne.current&&(re.handleNewText(n.assistantMessage,!1),T(!0));else if(n?.userMessage){let e={id:`auto-start`,role:`user`,content:n.userMessage};S([e]),ae([e])}}},[]),!g)return k(`div`,{});let E=e=>{if(!e.trim()||C)return;let t={id:Su(),role:`user`,content:e},n=[...x,t];S(n),ae(n)},se=[...x].filter(e=>e.role===`assistant`).pop();return mt(`div`,{className:`flex flex-col items-center ${o||``}`,children:[k(gu,{width:r,imageUrl:g.avatarUrl,isDarkTheme:h,loudnessRef:te,className:`mx-auto`}),u&&k(`div`,{className:`flex items-center gap-2`,children:k(`span`,{className:`text-3xl font-semibold`,children:g.name})}),!f.ttsEnabled&&x.length>1?k(`div`,{className:`w-full rounded-xl bg-gray-200/70 dark:bg-gray-800/70 px-4 py-3 text-sm text-gray-800 dark:text-gray-200 leading-relaxed border border-gray-300/40 dark:border-gray-700/40 mt-4`,children:!se?.content&&C?mt(`span`,{className:`inline-flex gap-1 py-0.5`,children:[k(`span`,{className:`w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce`}),k(`span`,{className:`w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce`,style:{animationDelay:`0.15s`}}),k(`span`,{className:`w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce`,style:{animationDelay:`0.3s`}})]}):k(`span`,{className:`whitespace-pre-wrap`,children:se?.content})}):null,mt(`div`,{className:`w-full relative mt-4 `+(m?`max-w-md`:``),children:[k(`input`,{value:y,onChange:e=>b(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),E(y),b(``))},placeholder:i??`Ask ${g.name} a question…`,disabled:C,className:`w-full bg-gray-800/50 border border-gray-700 rounded-lg px-3 py-2 pr-16 text-sm text-gray-200 placeholder:text-gray-500 focus:outline-none focus:ring-1 focus:ring-blue-500 disabled:opacity-60`}),mt(`div`,{className:`absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1`,children:[k(hu,{iconSize:`14`,className:`p-1 text-gray-400 hover:text-white transition-colors`,disabled:C,onVoiceRecorded:e=>E(e),onRecordingStatusChange:()=>{}}),k(`button`,{type:`button`,onClick:()=>{E(y),b(``)},disabled:C||!y.trim(),className:`p-1 text-gray-400 hover:text-white disabled:opacity-40 transition-colors`,children:k(bu,{className:`w-4 h-4`})})]})]}),a&&k(`div`,{className:`w-full max-w-md border-t border-gray-700/60 pt-3`,children:a})]})}function wu(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M20 6 9 17l-5-5`},child:[]}]})(e)}function Tu(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z`},child:[]},{tag:`path`,attr:{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10`},child:[]},{tag:`path`,attr:{d:`m17 10 4 4-4 4`},child:[]}]})(e)}function Eu(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`},child:[]},{tag:`path`,attr:{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`},child:[]}]})(e)}function Du(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M4 12h8`},child:[]},{tag:`path`,attr:{d:`M4 18V6`},child:[]},{tag:`path`,attr:{d:`M12 18V6`},child:[]},{tag:`path`,attr:{d:`m17 12 3-2v8`},child:[]}]})(e)}function Ou(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M4 12h8`},child:[]},{tag:`path`,attr:{d:`M4 18V6`},child:[]},{tag:`path`,attr:{d:`M12 18V6`},child:[]},{tag:`path`,attr:{d:`M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1`},child:[]}]})(e)}function ku(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M4 12h8`},child:[]},{tag:`path`,attr:{d:`M4 18V6`},child:[]},{tag:`path`,attr:{d:`M12 18V6`},child:[]},{tag:`path`,attr:{d:`M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2`},child:[]},{tag:`path`,attr:{d:`M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2`},child:[]}]})(e)}function Au(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`},child:[]},{tag:`path`,attr:{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`},child:[]}]})(e)}function ju(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12 2v4`},child:[]},{tag:`path`,attr:{d:`m16.2 7.8 2.9-2.9`},child:[]},{tag:`path`,attr:{d:`M18 12h4`},child:[]},{tag:`path`,attr:{d:`m16.2 16.2 2.9 2.9`},child:[]},{tag:`path`,attr:{d:`M12 18v4`},child:[]},{tag:`path`,attr:{d:`m4.9 19.1 2.9-2.9`},child:[]},{tag:`path`,attr:{d:`M2 12h4`},child:[]},{tag:`path`,attr:{d:`m4.9 4.9 2.9 2.9`},child:[]}]})(e)}function Mu(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`15 3 21 3 21 9`},child:[]},{tag:`polyline`,attr:{points:`9 21 3 21 3 15`},child:[]},{tag:`line`,attr:{x1:`21`,x2:`14`,y1:`3`,y2:`10`},child:[]},{tag:`line`,attr:{x1:`3`,x2:`10`,y1:`21`,y2:`14`},child:[]}]})(e)}function Nu(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`4 14 10 14 10 20`},child:[]},{tag:`polyline`,attr:{points:`20 10 14 10 14 4`},child:[]},{tag:`line`,attr:{x1:`14`,x2:`21`,y1:`10`,y2:`3`},child:[]},{tag:`line`,attr:{x1:`3`,x2:`10`,y1:`21`,y2:`14`},child:[]}]})(e)}function Pu(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`},child:[]},{tag:`path`,attr:{d:`M20 3v4`},child:[]},{tag:`path`,attr:{d:`M22 5h-4`},child:[]},{tag:`path`,attr:{d:`M4 17v2`},child:[]},{tag:`path`,attr:{d:`M5 18H3`},child:[]}]})(e)}function Fu(e){this.content=e}Fu.prototype={constructor:Fu,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new Fu(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new Fu(n)},addToStart:function(e,t){return new Fu([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Fu(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new Fu(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=Fu.from(e),e.size?new Fu(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=Fu.from(e),e.size?new Fu(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Fu.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},Fu.from=function(e){if(e instanceof Fu)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Fu(t)};function Iu(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=Iu(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Lu(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=Lu(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var V=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Iu(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Lu(this,e,t,n)}findIndex(e){if(e==0)return zu(0,e);if(e==this.size)return zu(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?zu(t+1,i):zu(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return new e(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};V.empty=new V([],0);var Ru={index:0,offset:0};function zu(e,t){return Ru.index=e,Ru.offset=t,Ru}function Bu(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Bu(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Bu(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var H=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Bu(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};H.none=[];var Vu=class extends Error{},U=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Uu(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Hu(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(V.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};U.empty=new U(V.empty,0,0);function Hu(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Hu(a.content,t-i-1,n-i-1)))}function Uu(e,t,n,r){let{index:i,offset:a}=e.findIndex(t),o=e.maybeChild(i);if(a==t||o.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let s=Uu(o.content,t-a-1,n,o);return s&&e.replaceChild(i,o.copy(s))}function Wu(e,t,n){if(n.openStart>e.depth)throw new Vu(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Vu(`Inconsistent open depths`);return Gu(e,t,n,0)}function Gu(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=Gu(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return Xu(a,Qu(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Xu(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=$u(n,e);return Xu(a,Zu(e,i,o,t,r))}}function Ku(e,t){if(!t.type.compatibleContent(e.type))throw new Vu(`Cannot join `+t.type.name+` onto `+e.type.name)}function qu(e,t,n){let r=e.node(n);return Ku(r,t.node(n)),r}function Ju(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Yu(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Ju(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Ju(i.child(e),r);t&&t.depth==n&&t.textOffset&&Ju(t.nodeBefore,r)}function Xu(e,t){return e.type.checkContent(t),e.copy(t)}function Zu(e,t,n,r,i){let a=e.depth>i&&qu(e,t,i+1),o=r.depth>i&&qu(n,r,i+1),s=[];return Yu(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Ku(a,o),Ju(Xu(a,Zu(e,t,n,r,i+1)),s)):(a&&Ju(Xu(a,Qu(e,t,i+1)),s),Yu(t,n,i,s),o&&Ju(Xu(o,Qu(n,r,i+1)),s)),Yu(r,null,i,s),new V(s)}function Qu(e,t,n){let r=[];return Yu(null,e,n,r),e.depth>n&&Ju(Xu(qu(e,t,n+1),Qu(e,t,n+1)),r),Yu(t,null,n,r),new V(r)}function $u(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(V.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var ed=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return H.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new id(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=rd.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else rd.set(t,r=new td);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%nd,i}},td=class{constructor(){this.elts=[],this.i=0}},nd=12,rd=new WeakMap,id=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},ad=Object.create(null),od=class e{constructor(e,t,n,r=H.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||V.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Bu(this.attrs,t||e.defaultAttrs||ad)&&H.sameSet(this.marks,n||H.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return U.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new U(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return Wu(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return ed.resolveCached(this,e)}resolveNoCache(e){return ed.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),cd(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=V.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=H.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!H.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=V.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};od.prototype.text=void 0;var sd=class e extends od{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):cd(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function cd(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var ld=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new ud(t,n);if(r.next==null)return e.empty;let i=dd(r);r.next&&r.err(`Unexpected trailing text`);let a=xd(vd(i));return Sd(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return V.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
3
|
+
`)}};ld.empty=new ld(!0);var ud=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function dd(e){let t=[];do t.push(fd(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function fd(e){let t=[];do t.push(pd(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function pd(e){let t=_d(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=hd(e,t);else break;return t}function md(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function hd(e,t){let n=md(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:md(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function gd(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function _d(e){if(e.eat(`(`)){let t=dd(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=gd(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function vd(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function yd(e,t){return t-e}function bd(e,t){let n=[];return r(t),n.sort(yd);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function xd(e){let t=Object.create(null);return n(bd(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);bd(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new ld(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(yd);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Sd(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function Cd(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function wd(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function Td(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function Ed(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new kd(e,r,t[r]);return n}var Dd=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=Ed(e,n.attrs),this.defaultAttrs=Cd(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ld.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:wd(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new od(this,this.computeAttrs(e),V.from(t),H.setFrom(n))}createChecked(e=null,t,n){return t=V.from(t),this.checkContent(t),new od(this,this.computeAttrs(e),t,H.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=V.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(V.empty,!0);return i?new od(this,e,t.append(i),H.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Td(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:H.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function Od(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var kd=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?Od(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Ad=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Ed(e,r.attrs),this.excluded=null;let i=Cd(this.attrs);this.instance=i?new H(this,i):null}create(e=null){return!e&&this.instance?this.instance:new H(this,wd(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Td(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},jd=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=Fu.from(e.nodes),t.marks=Fu.from(e.marks||{}),this.nodes=Dd.compile(this.spec.nodes,this),this.marks=Ad.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=ld.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?Md(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:Md(this,n.split(` `))}this.nodeFromJSON=e=>od.fromJSON(this,e),this.markFromJSON=e=>H.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof Dd))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new sd(n,n.defaultAttrs,e,H.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function Md(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function Nd(e){return e.tag!=null}function Pd(e){return e.style!=null}var Fd=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(Nd(e))this.tags.push(e);else if(Pd(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new Wd(this,t,!1);return n.addAll(e,H.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Wd(this,t,!0);return n.addAll(e,H.none,t.from,t.to),U.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Kd(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=qd(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=qd(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},Id={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Ld={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Rd={ol:!0,ul:!0},zd=1,Bd=2,Vd=4;function Hd(e,t,n){return t==null?e&&e.whitespace==`pre`?zd|Bd:n&~Vd:(t?zd:0)|(t===`full`?Bd:0)}var Ud=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=H.none,this.match=i||(a&Vd?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(V.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&zd)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=V.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(V.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Id.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},Wd=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=Hd(null,t.preserveWhitespace,0)|(n?Vd:0);i=r?new Ud(r.type,r.attrs,H.none,!0,t.topMatch||r.type.contentMatch,a):n?new Ud(null,null,H.none,!0,null,a):new Ud(e.schema.topNodeType,null,H.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&Bd?`full`:this.localPreserveWS||(r.options&zd)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
|
|
4
|
+
`);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;Rd.hasOwnProperty(a)&&this.parser.normalizeLists&&Gd(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:Ld.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(Id.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
5
|
+
`),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=H.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):Jd(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=Hd(e,i,a.options);a.options&Vd&&a.content.length==0&&(o|=Vd);let s=H.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):Jd(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new Ud(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=zd);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function Gd(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&Rd.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function Kd(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function qd(e){let t={};for(let n in e)t[n]=e[n];return t}function Jd(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var Yd=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=Zd(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=tf(Zd(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&tf(Zd(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return tf(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=Xd(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return Xd(e.marks)}};function Xd(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Zd(e){return e.document||window.document}var Qd=new WeakMap;function $d(e){let t=Qd.get(e);return t===void 0&&Qd.set(e,t=ef(e)),t}function ef(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function tf(e,t,n,r){if(typeof t==`string`)return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=$d(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else{let{dom:t,contentDOM:i}=tf(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var nf=65535,rf=2**16;function af(e,t){return e+t*rf}function of(e){return e&nf}function sf(e){return(e-(e&nf))/rf}var cf=1,lf=2,uf=4,df=8,ff=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&df)>0}get deletedBefore(){return(this.delInfo&(cf|uf))>0}get deletedAfter(){return(this.delInfo&(lf|uf))>0}get deletedAcross(){return(this.delInfo&uf)>0}},pf=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=of(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+sf(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:af(o/3,e-s),f=e==s?lf:e==u?cf:uf;return(t<0?e!=s:e!=u)&&(f|=df),new ff(a,f,d)}r+=l-c}return n?e+r:new ff(e+r,0,null)}touches(e,t){let n=0,r=of(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};pf.empty=new pf([]);var mf=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new ff(e,r,null)}},hf=Object.create(null),gf=class{getMap(){return pf.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=hf[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in hf)throw RangeError(`Duplicate use of step JSON ID `+e);return hf[e]=t,t.prototype.jsonID=e,t}},_f=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof Vu)return e.fail(t.message);throw t}}};function vf(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(vf(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return V.fromArray(r)}var yf=class e extends gf{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new U(vf(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return _f.fromReplace(e,this.from,this.to,i)}invert(){return new bf(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};gf.jsonID(`addMark`,yf);var bf=class e extends gf{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new U(vf(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return _f.fromReplace(e,this.from,this.to,n)}invert(){return new yf(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};gf.jsonID(`removeMark`,bf);var xf=class e extends gf{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return _f.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return _f.fromReplace(e,this.pos,this.pos+1,new U(V.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new Sf(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};gf.jsonID(`addNodeMark`,xf);var Sf=class e extends gf{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return _f.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return _f.fromReplace(e,this.pos,this.pos+1,new U(V.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new xf(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};gf.jsonID(`removeNodeMark`,Sf);var Cf=class e extends gf{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Tf(e,this.from,this.to)?_f.fail(`Structure replace would overwrite content`):_f.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new pf([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?U.empty:new U(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?U.empty:new U(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,U.fromJSON(t,n.slice),!!n.structure)}};Cf.MAP_BIAS=1,gf.jsonID(`replace`,Cf);var wf=class e extends gf{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(Tf(e,this.from,this.gapFrom)||Tf(e,this.gapTo,this.to)))return _f.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return _f.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?_f.fromReplace(e,this.from,this.to,n):_f.fail(`Content does not fit in gap`)}getMap(){return new pf([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,U.fromJSON(t,n.slice),n.insert,!!n.structure)}};gf.jsonID(`replaceAround`,wf);function Tf(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function Ef(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new bf(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new yf(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function Df(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof Ad){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new bf(t.from,t.to,t.style)))}function Of(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new Cf(s,l,U.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new bf(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new U(V.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new Cf(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(V.empty,!0);e.replace(s,s,new U(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function kf(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Af(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!kf(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function jf(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=V.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=V.from(r.node(e).copy(u)),d++):c--;let f=V.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=V.from(i.node(e).copy(f)),p++):l++;e.step(new wf(c,l,o,s,new U(u.append(f),d,p),u.size-d,!0))}function Mf(e,t,n=null,r=e){let i=Pf(e,t),a=i&&Ff(r,t);return a?i.map(Nf).concat({type:t,attrs:n}).concat(a.map(Nf)):null}function Nf(e){return{type:e,attrs:null}}function Pf(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function Ff(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function If(e,t,n){let r=V.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=V.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new wf(i,a,i,a,new U(r,0,0),n.length,!0))}function Lf(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&Bf(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&zf(e,t,n,a),Of(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new wf(c,l,c+1,l-1,new U(V.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&Rf(e,t,n,a),!1}})}function Rf(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function zf(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
|
|
6
|
+
`))}})}function Bf(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Vf(e,t,n,r,i){let a=e.doc.nodeAt(t);if(!a)throw RangeError(`No node at given position`);n||=a.type;let o=n.create(r,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!n.validContent(a.content))throw RangeError(`Invalid content for node type `+n.name);e.step(new wf(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new U(V.from(o),0,0),1,!0))}function Hf(e,t,n=1,r){let i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>a;e--,t--){let n=i.node(e),a=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(a,n.childCount),s=r&&r[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let c=r&&r[t]||n;if(!n.canReplace(a+1,n.childCount)||!c.type.validContent(o))return!1}let s=i.indexAfter(a),c=r&&r[0];return i.node(a).canReplaceWith(s,s,c?c.type:i.node(a+1).type)}function Uf(e,t,n=1,r){let i=e.doc.resolve(t),a=V.empty,o=V.empty;for(let e=i.depth,t=i.depth-n,s=n-1;e>t;e--,s--){a=V.from(i.node(e).copy(a));let t=r&&r[s];o=V.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new Cf(t,t,new U(a.append(o),n,n),!0))}function Wf(e,t){let n=e.resolve(t),r=n.index();return Kf(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Gf(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let a=t.child(i),o=a.type==r?e.type.schema.nodes.text:a.type;if(n=n.matchType(o),!n||!e.type.allowsMarks(a.marks))return!1}return n.validEnd}function Kf(e,t){return!!(e&&t&&!e.isLeaf&&Gf(e,t))}function qf(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,a,o=r.index(e);if(e==r.depth?(i=r.nodeBefore,a=r.nodeAfter):n>0?(i=r.node(e+1),o++,a=r.node(e).maybeChild(o)):(i=r.node(e).maybeChild(o-1),a=r.node(e+1)),i&&!i.isTextblock&&Kf(i,a)&&r.node(e).canReplace(o,o+1))return t;if(e==0)break;t=n<0?r.before(e):r.after(e)}}function Jf(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){let e=o.whitespace==`pre`,t=!!o.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let s=e.steps.length;if(r===!1){let r=e.doc.resolve(t+n);zf(e,r.node(),r.before(),s)}o.inlineContent&&Of(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);let c=e.mapping.slice(s),l=c.map(t-n);if(e.step(new Cf(l,c.map(t+n,-1),U.empty,!0)),r===!0){let t=e.doc.resolve(l);Rf(e,t.node(),t.before(),e.steps.length)}return e}function Yf(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}function Xf(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(n.openStart==0&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,a=r.index(t)+ +(n>0),o=r.node(t),s=!1;if(e==1)s=o.canReplace(a,a,i);else{let e=o.contentMatchAt(a).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(a,a,e[0])}if(s)return n==0?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function Zf(e,t,n=t,r=U.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return Qf(i,a,r)?new Cf(t,n,r):new $f(i,a,r).fit()}function Qf(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var $f=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=V.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=V.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,a=n.depth,o=r.depth;for(;a&&o&&i.childCount==1;)i=i.firstChild.content,a--,o--;let s=new U(i,a,o);return e>-1?new wf(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new Cf(n.pos,r.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=np(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let{type:a,match:o}=this.frontier[e],s,c=null;if(t==1&&(i?o.matchType(i.type)||(c=o.fillBefore(V.from(i),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:c};if(t==2&&i&&(s=o.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:s};if(r&&o.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=np(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new U(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=np(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new U(ep(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new U(ep(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let a=this.unplaced,o=n?n.content:a.content,s=a.openStart-e,c=0,l=[],{match:u,type:d}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)l.push(r.child(e));u=u.matchFragment(r)}let f=o.size+e-(a.content.size-a.openEnd);for(;c<o.childCount;){let e=o.child(c),t=u.matchType(e.type);if(!t)break;c++,(c>1||s==0||e.content.size)&&(u=t,l.push(rp(e.mark(d.allowedMarks(e.marks)),c==1?s:0,c==o.childCount?f:-1)))}let p=c==o.childCount;p||(f=-1),this.placed=tp(this.placed,t,V.from(l)),this.frontier[t].match=u,p&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?e==0?U.empty:new U(ep(a.content,e-1,1),e-1,f<0?a.openEnd:e-1):new U(ep(a.content,e,c),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!ip(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){scan:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=ip(e,t,r,n,i);if(a){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=ip(e,n,r,t,!0);if(!i||i.childCount)continue scan}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=tp(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=tp(this.placed,this.depth,V.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(V.empty,!0);e.childCount&&(this.placed=tp(this.placed,this.frontier.length,e))}};function ep(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(ep(e.firstChild.content,t-1,n)))}function tp(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(tp(e.lastChild.content,t-1,n)))}function np(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function rp(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,rp(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(V.empty,!0)))),e.copy(r)}function ip(e,t,n,r,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let s=r.fillBefore(a.content,!0,o);return s&&!ap(n,a.content,o)?s:null}function ap(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function op(e){return e.spec.defining||e.spec.definingForContent}function sp(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),a=e.doc.resolve(n);if(Qf(i,a,r))return e.step(new Cf(t,n,r));let o=dp(i,a);o[o.length-1]==0&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==t&&o.splice(1,0,-e)}let c=o.indexOf(s),l=[],u=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(l.push(n),t==r.openStart)break;e=n.content}for(let e=u-1;e>=0;e--){let t=l[e],n=op(t.type);if(n&&!t.sameMarkup(i.node(Math.abs(s)-1)))u=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let s=(t+u+1)%(r.openStart+1),d=l[s];if(d)for(let t=0;t<o.length;t++){let l=o[(t+c)%o.length],u=!0;l<0&&(u=!1,l=-l);let f=i.node(l-1),p=i.index(l-1);if(f.canReplaceWith(p,p,d.type,d.marks))return e.replace(i.before(l),u?a.after(l):n,new U(cp(r.content,0,r.openStart,s),s,r.openEnd))}}let d=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(t,n,r),!(e.steps.length>d));s--){let e=o[s];e<0||(t=i.before(e),n=a.after(e))}}function cp(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(cp(i.content,t+1,n,r,i)))}if(t>r){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(V.empty,!0))}return e}function lp(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=Yf(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new U(V.from(r),0,0))}function up(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let a=r.sharedDepth(n),o=!1;for(let e=r.depth;e>a;e--)r.node(e).type.spec.isolating&&(o=!0);for(let e=i.depth;e>a;e--)i.node(e).type.spec.isolating&&(o=!0);if(!o){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let a=dp(r,i);for(let t=0;t<a.length;t++){let n=a[t],o=t==a.length-1;if(o&&n==0||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return e.delete(r.before(a),n);e.delete(t,n)}function dp(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}var fp=class e extends gf{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return _f.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return _f.fromReplace(e,this.pos,this.pos+1,new U(V.from(r),0,+!t.isLeaf))}getMap(){return pf.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};gf.jsonID(`attr`,fp);var pp=class e extends gf{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return _f.ok(n)}getMap(){return pf.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};gf.jsonID(`docAttr`,pp);var mp=class extends Error{};mp=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},mp.prototype=Object.create(Error.prototype),mp.prototype.constructor=mp,mp.prototype.name=`TransformError`;var hp=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new mf}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new mp(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,a)=>{e=Math.min(e,i),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=U.empty){let r=Zf(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new U(V.from(n),0,0))}delete(e,t){return this.replace(e,t,U.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return sp(this,e,t,n),this}replaceRangeWith(e,t,n){return lp(this,e,t,n),this}deleteRange(e,t){return up(this,e,t),this}lift(e,t){return jf(this,e,t),this}join(e,t=1){return Jf(this,e,t),this}wrap(e,t){return If(this,e,t),this}setBlockType(e,t=e,n,r=null){return Lf(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return Vf(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new fp(e,t,n)),this}setDocAttribute(e,t){return this.step(new pp(e,t)),this}addNodeMark(e,t){return this.step(new xf(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof H)t.isInSet(n.marks)&&this.step(new Sf(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new Sf(e,i)),r=i.removeFromSet(r);for(let e=a.length-1;e>=0;e--)this.step(a[e])}return this}split(e,t=1,n){return Uf(this,e,t,n),this}addMark(e,t,n){return Ef(this,e,t,n),this}removeMark(e,t,n){return Df(this,e,t,n),this}clearIncompatible(e,t,n){return Of(this,e,t,n),this}},gp=Object.create(null),W=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new _p(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=U.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?U.empty:t),o==0&&Tp(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),Tp(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new G(e):wp(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?wp(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):wp(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Sp(e.node(0))}static atStart(e){return wp(e,e,0,0,1)||new Sp(e)}static atEnd(e){return wp(e,e,e.content.size,e.childCount,-1)||new Sp(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=gp[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in gp)throw RangeError(`Duplicate use of selection JSON ID `+e);return gp[e]=t,t.prototype.jsonID=e,t}getBookmark(){return G.between(this.$anchor,this.$head).getBookmark()}};W.prototype.visible=!0;var _p=class{constructor(e,t){this.$from=e,this.$to=t}},vp=!1;function yp(e){!vp&&!e.parent.inlineContent&&(vp=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var G=class e extends W{constructor(e,t=e){yp(e),yp(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return W.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=U.empty){if(super.replace(e,t),t==U.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new bp(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=W.findFrom(n,r,!0)||W.findFrom(n,-r,!0);if(e)n=e.$head;else return W.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(W.findFrom(t,-r,!0)||W.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};W.jsonID(`text`,G);var bp=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return G.between(e.resolve(this.anchor),e.resolve(this.head))}},K=class e extends W{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?W.near(a):new e(a)}content(){return new U(V.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new xp(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};K.prototype.visible=!1,W.jsonID(`node`,K);var xp=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new bp(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&K.isSelectable(n)?new K(t):W.near(t)}},Sp=class e extends W{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=U.empty){if(t==U.empty){e.delete(0,e.doc.content.size);let t=W.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return Cp}};W.jsonID(`all`,Sp);var Cp={map(){return this},resolve(e){return new Sp(e)}};function wp(e,t,n,r,i,a=!1){if(t.inlineContent)return G.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=wp(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&K.isSelectable(r))return K.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function Tp(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof Cf||i instanceof wf))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(W.near(e.doc.resolve(o),n))}var Ep=1,Dp=2,Op=4,kp=class extends hp{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError(`Selection passed to setSelection must point at the current document`);return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Ep)&~Dp,this.storedMarks=null,this}get selectionSet(){return(this.updated&Ep)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Dp,this}ensureMarks(e){return H.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Dp)>0}addStep(e,t){super.addStep(e,t),this.updated&=~Dp,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||H.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(n??=t,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(W.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e==`string`?e:e.key]=t,this}getMeta(e){return this.meta[typeof e==`string`?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Op,this}get scrolledIntoView(){return(this.updated&Op)>0}};function Ap(e,t){return!t||!e?e:e.bind(t)}var jp=class{constructor(e,t,n){this.name=e,this.init=Ap(t.init,n),this.apply=Ap(t.apply,n)}},Mp=[new jp(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new jp(`selection`,{init(e,t){return e.selection||W.atStart(t.doc)},apply(e){return e.selection}}),new jp(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new jp(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],Np=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Mp.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError(`Adding different instances of a keyed plugin (`+e.key+`)`);this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new jp(e.key,e.spec.state,e))})}},Pp=class e{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let a=0;a<this.config.plugins.length;a++){let o=this.config.plugins[a];if(o.spec.appendTransaction){let s=r?r[a].n:0,c=r?r[a].state:this,l=s<t.length&&o.spec.appendTransaction.call(o,s?t.slice(s):t,c,n);if(l&&n.filterTransaction(l,a)){if(l.setMeta(`appendedTransaction`,e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<a?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[a]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(t){if(!t.before.eq(this.doc))throw RangeError(`Applying a mismatched transaction`);let n=new e(this.config),r=this.config.fields;for(let e=0;e<r.length;e++){let i=r[e];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new kp(this)}static create(t){let n=new Np(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n);for(let e=0;e<n.fields.length;e++)r[n.fields[e].name]=n.fields[e].init(t,r);return r}reconfigure(t){let n=new Np(this.schema,t.plugins),r=n.fields,i=new e(n);for(let e=0;e<r.length;e++){let n=r[e].name;i[n]=this.hasOwnProperty(n)?this[n]:r[e].init(t,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&typeof e==`object`)for(let n in e){if(n==`doc`||n==`selection`)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(t,n,r){if(!n)throw RangeError(`Invalid input for EditorState.fromJSON`);if(!t.schema)throw RangeError(`Required config field 'schema' missing`);let i=new Np(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=od.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=W.fromJSON(a.doc,n.selection);else if(e.name==`storedMarks`)n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let i in r){let o=r[i],s=o.spec.state;if(o.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){a[e.name]=s.fromJSON.call(o,t,n[i],a);return}}a[e.name]=e.init(t,a)}}),a}};function Fp(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=Fp(i,t,{})),n[r]=i}return n}var Ip=class{constructor(e){this.spec=e,this.props={},e.props&&Fp(e.props,this,this.props),this.key=e.key?e.key.key:Rp(`plugin`)}getState(e){return e[this.key]}},Lp=Object.create(null);function Rp(e){return e in Lp?e+`$`+ ++Lp[e]:(Lp[e]=0,e+`$`)}var zp=class{constructor(e=`key`){this.key=Rp(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},Bp=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Vp=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},Hp=null,Up=function(e,t,n){let r=Hp||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},Wp=function(){Hp=null},Gp=function(e,t,n,r){return n&&(qp(e,t,n,r,-1)||qp(e,t,n,r,1))},Kp=/^(img|br|input|textarea|hr)$/i;function qp(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Jp(e))){let n=e.parentNode;if(!n||n.nodeType!=1||Qp(e)||Kp.test(e.nodeName)||e.contentEditable==`false`)return!1;t=Bp(e)+(i<0?0:1),e=n}else if(e.nodeType==1){let n=e.childNodes[t+(i<0?-1:0)];if(n.nodeType==1&&n.contentEditable==`false`)if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1;else e=n,t=i<0?Jp(e):0}else return!1}}function Jp(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Yp(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=Jp(e)}else if(e.parentNode&&!Qp(e))t=Bp(e),e=e.parentNode;else return null}}function Xp(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!Qp(e))t=Bp(e)+1,e=e.parentNode;else return null}}function Zp(e,t,n){for(let r=t==0,i=t==Jp(e);r||i;){if(e==n)return!0;let t=Bp(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==Jp(e)}}function Qp(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var $p=function(e){return e.focusNode&&Gp(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function em(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function tm(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function nm(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Jp(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Jp(r.startContainer),r.startOffset)}}}var rm=typeof navigator<`u`?navigator:null,im=typeof document<`u`?document:null,am=rm&&rm.userAgent||``,om=/Edge\/(\d+)/.exec(am),sm=/MSIE \d/.exec(am),cm=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(am),lm=!!(sm||cm||om),um=sm?document.documentMode:cm?+cm[1]:om?+om[1]:0,dm=!lm&&/gecko\/(\d+)/i.test(am);dm&&+(/Firefox\/(\d+)/.exec(am)||[0,0])[1];var fm=!lm&&/Chrome\/(\d+)/.exec(am),pm=!!fm,mm=fm?+fm[1]:0,hm=!lm&&!!rm&&/Apple Computer/.test(rm.vendor),gm=hm&&(/Mobile\/\w+/.test(am)||!!rm&&rm.maxTouchPoints>2),_m=gm||(rm?/Mac/.test(rm.platform):!1),vm=rm?/Win/.test(rm.platform):!1,ym=/Android \d/.test(am),bm=!!im&&`webkitFontSmoothing`in im.documentElement.style,xm=bm?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Sm(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Cm(e,t){return typeof e==`number`?e:e[t]}function wm(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function Tm(e,t,n){let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(o.nodeType!=1){o=Vp(o);continue}let e=o,n=e==a.body,s=n?Sm(a):wm(e),c=0,l=0;if(t.top<s.top+Cm(r,`top`)?l=-(s.top-t.top+Cm(i,`top`)):t.bottom>s.bottom-Cm(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+Cm(i,`top`)-s.top:t.bottom-s.bottom+Cm(i,`bottom`)),t.left<s.left+Cm(r,`left`)?c=-(s.left-t.left+Cm(i,`left`)):t.right>s.right-Cm(r,`right`)&&(c=t.right-s.right+Cm(i,`right`)),c||l)if(n)a.defaultView.scrollBy(c,l);else{let n=e.scrollLeft,r=e.scrollTop;l&&(e.scrollTop+=l),c&&(e.scrollLeft+=c);let i=e.scrollLeft-n,a=e.scrollTop-r;t={left:t.left-i,top:t.top-a,right:t.right-i,bottom:t.bottom-a}}let u=n?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(u))break;o=u==`absolute`?o.offsetParent:Vp(o)}}function Em(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:Dm(e.dom)}}function Dm(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Vp(r));return t}function Om({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;km(n,r==0?0:r-t)}function km(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}var Am=null;function jm(e){if(e.setActive)return e.setActive();if(Am)return e.focus(Am);let t=Dm(e);e.focus(Am==null?{get preventScroll(){return Am={preventScroll:!0},!0}}:void 0),Am||(Am=!1,km(t,0))}function Mm(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(u.nodeType==1)e=u.getClientRects();else if(u.nodeType==3)e=Up(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&n.nodeType==3?{left:p.right<t.left?p.right:p.left,top:t.top}:t,u.nodeType==1&&e&&(a=d+ +(t.left>=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&n.nodeType==3?Nm(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:Mm(n,i)}function Nm(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a<n;a++){r.setEnd(e,a+1),r.setStart(e,a);let n=Vm(r,1);if(n.top!=n.bottom&&Pm(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function Pm(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Fm(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function Im(e,t,n){let{node:r,offset:i}=Mm(t,n),a=-1;if(r.nodeType==1&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function Lm(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(t.dom.nodeType==1&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function Rm(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(n.nodeType==1){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(Pm(t,i))return Rm(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function zm(e,t){let n=e.dom.ownerDocument,r,i=0,a=nm(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o.nodeType==1?o:o.parentNode)){let n=e.dom.getBoundingClientRect();if(!Pm(t,n)||(o=Rm(e.dom,t,n),!o))return null}if(hm)for(let e=o;r&&e;e=Vp(e))e.draggable&&(r=void 0);if(o=Fm(o,t),r){if(dm&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;bm&&i&&r.nodeType==1&&(n=r.childNodes[i-1]).nodeType==1&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!=`BR`)&&(s=Lm(e,r,i,t))}s??=Im(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function Bm(e){return e.top<e.bottom||e.left<e.right}function Vm(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Bm(e))return e}return Array.prototype.find.call(n,Bm)||e.getBoundingClientRect()}var Hm=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Um(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=bm||dm;if(r.nodeType==3)if(o&&(Hm.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=Vm(Up(r,i,i),n);if(dm&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=Vm(Up(r,i-1,i-1),-1);if(t.top==e.top){let n=Vm(Up(r,i,i+1),-1);if(n.top!=e.top)return Wm(n,n.left<t.left)}}return e}else{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,Wm(Vm(Up(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==Jp(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return Gm(e.getBoundingClientRect(),!1)}if(a==null&&i<Jp(r)){let e=r.childNodes[i];if(e.nodeType==1)return Gm(e.getBoundingClientRect(),!0)}return Gm(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==Jp(r))){let e=r.childNodes[i-1],t=e.nodeType==3?Up(e,Jp(e)-+!o):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return Wm(Vm(t,1),!1)}if(a==null&&i<Jp(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?e.nodeType==3?Up(e,0,+!o):e.nodeType==1?e:null:null;if(t)return Wm(Vm(t,-1),!0)}return Wm(Vm(r.nodeType==3?Up(r):r,-n),n>=0)}function Wm(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Gm(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Km(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function qm(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return Km(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Um(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(e.nodeType==1)t=e.getClientRects();else if(e.nodeType==3)t=Up(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var Jm=/[\u0590-\u08ac]/;function Ym(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!Jm.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:Km(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!l.contains(u.nodeType==1?u:u.parentNode)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var Xm=null,Zm=null,Qm=!1;function $m(e,t,n){return Xm==t&&Zm==n?Qm:(Xm=t,Zm=n,Qm=n==`up`||n==`down`?qm(e,t,n):Ym(e,t,n))}var eh=0,th=1,nh=2,rh=3,ih=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=eh,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>Bp(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node))if(n&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))n=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e||i instanceof dh){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof ah&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,!(!e||e.dom.parentNode==this.contentDOM);n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?Bp(e.dom)+1:0}}else{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,!(!e||e.dom.parentNode==this.contentDOM);n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?Bp(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=Bp(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=Bp(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(t.nodeType!=1||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),u=!1;if((dm||hm)&&e==t){let{node:e,offset:t}=o;if(e.nodeType==3){if(u=!!(t&&e.nodeValue[t-1]==`
|
|
7
|
+
`),u&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){n.nodeName==`BR`&&(o=s={node:n.parentNode,offset:Bp(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&(n.nodeName==`BR`||n.contentEditable==`false`)}}if(dm&&l.focusNode&&l.focusNode!=s.node&&l.focusNode.nodeType==1){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||u&&hm)&&Gp(o.node,o.offset,l.anchorNode,l.anchorOffset)&&Gp(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&dm)){c.collapse(o.node,o.offset);try{e!=t&&c.extend(s.node,s.offset),d=!0}catch{}}if(!d){if(e>t){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?nh:th,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=rh:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?nh:rh}n=a}this.dirty=nh}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?nh:th;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},ah=class extends ih{constructor(e,t,n,r){let i,a=t.type.toDOM;if(typeof a==`function`&&(a=a(n,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(a.nodeType!=1){let e=document.createElement(`span`);e.appendChild(a),a=e}a.contentEditable=`false`,a.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==eh&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},oh=class extends ih{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},sh=class e extends ih{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=Yd.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&rh||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=rh&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=eh){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=eh}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=Oh(a,n,o,r)),t>0&&(a=Oh(a,0,t,r));for(let e=0;e<a.length;e++)a[e].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},ch=class e extends ih{constructor(e,t,n,r,i,a,o,s,c){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,n,r,i,a,o){let s=a.nodeViews[n.type.name],c,l=s&&s(n,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=Yd.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=yh(u,r,n),l?c=new fh(t,n,r,i,u,d||null,f,l,a,o+1):n.isText?new uh(t,n,r,i,u,f,a):new e(t,n,r,i,u,d||null,f,a,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(e.preserveWhitespace=`full`),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>V.empty)}return e}matchesNode(e,t,n){return this.dirty==eh&&e.eq(this.node)&&bh(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new Sh(this,a&&a.node,e);Th(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?H.none:this.node.child(i).marks,n,e,i),s.placeWidget(t,e,r)},(t,a,c,l)=>{s.syncToMarks(t.marks,n,e,l);let u;s.findNodeMatch(t,a,c,l)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(t,a,c,u,e)||s.updateNextNode(t,a,c,e,l,r)||s.addNode(t,a,c,e,r),r+=t.nodeSize}),s.syncToMarks([],n,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==nh)&&(a&&this.protectLocalComposition(e,a),ph(this.contentDOM,this.children,e),gm&&Eh(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof G)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,a=Dh(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}else return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&=void 0}let a=new oh(this,i,t,r);e.input.compositionNodes.push(a),this.children=Oh(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==rh||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=eh}updateOuterDeco(e){if(bh(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=_h(this.dom,this.nodeDOM,gh(this.outerDeco,this.node,t),gh(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}};function lh(e,t,n,r,i){yh(r,t,e);let a=new ch(void 0,e,t,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}var uh=class e extends ch{constructor(e,t,n,r,i,a,o){super(e,t,n,r,i,null,a,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==rh||this.dirty!=eh&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=eh||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=eh,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=rh)}get domAtom(){return!1}isText(e){return this.node.text==e}},dh=class extends ih{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==eh&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},fh=class extends ch{constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,c,l),this.spec=s}update(e,t,n,r){if(this.dirty==rh)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}else if(!this.contentDOM&&!e.isLeaf)return!1;else return super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function ph(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=xh(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof sh){let t=r?r.previousSibling:e.lastChild;ph(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=xh(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var mh=function(e){e&&(this.nodeName=e)};mh.prototype=Object.create(null);var hh=[new mh];function gh(e,t,n){if(e.length==0)return hh;let r=n?hh[0]:new mh,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new mh(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new mh(t.isInline?`span`:`div`)),e==`class`?r.class=(r.class?r.class+` `:``)+a:e==`style`?r.style=(r.style?r.style+`;`:``)+a:e!=`nodeName`&&(r[e]=a))}}}return i}function _h(e,t,n,r){if(n==hh&&r==hh)return t;let i=t;for(let t=0;t<r.length;t++){let a=r[t],o=n[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName?i=t:(t=document.createElement(a.nodeName),t.pmIsDeco=!0,t.appendChild(i),o=hh[0],i=t)}vh(i,o||hh[0],a)}return i}function vh(e,t,n){for(let r in t)r!=`class`&&r!=`style`&&r!=`nodeName`&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!=`class`&&r!=`style`&&r!=`nodeName`&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(` `).filter(Boolean):[],i=n.class?n.class.split(` `).filter(Boolean):[];for(let t=0;t<r.length;t++)i.indexOf(r[t])==-1&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)r.indexOf(i[t])==-1&&e.classList.add(i[t]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}function yh(e,t,n){return _h(e,e,hh,gh(t,n,e.nodeType!=1))}function bh(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function xh(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var Sh=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Ch(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=eh,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[a])&&!this.isLocked(n.dom)){i=t;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=sh.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r<a;r++){let a=this.top.children[r];if(a.matchesNode(e,t,n)&&!this.preMatch.matched.has(a)){i=r;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let a=this.top.children[r];return a.dirty==rh&&a.dom==a.contentDOM&&(a.dirty=nh),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return-1}e=t}}updateNextNode(e,t,n,r,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof ch){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let l=s.dom,u,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=rh&&bh(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=nh,u.updateChildren(r,a+1),u.dirty=eh),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!bh(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=ch.create(this.top,t,n,r,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let a=ch.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new ah(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof sh;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof uh)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((hm||pm)&&e&&e.dom.contentEditable==`false`&&this.addHackNode(`IMG`,t),this.addHackNode(`BR`,this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);let r=new dh(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}};function Ch(e,t){let n=t,r=n.children.length,i=e.childCount,a=new Map,o=[];outer:for(;i>0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof sh)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function wh(e,t){return e.type.side-t.type.side}function Th(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(a,o),n),a+=o.nodeSize}return}let o=0,s=[],c=null;for(let l=0;;){let u,d;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(u?(d||=[u]).push(e):u=e)}if(u)if(d){d.sort(wh);for(let e=0;e<d.length;e++)n(d[e],l,!!c)}else n(u,l,!!c);let f,p;if(c)p=-1,f=c,c=null;else if(l<e.childCount)p=l,f=e.child(l++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<m&&(c=f.cut(e-a),f=f.cut(0,e-a),m=e,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let h=f.isInline&&!f.isLeaf?s.filter(e=>!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function Eh(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function Dh(e,t,n,r){for(let i=0,a=0;i<e.childCount&&a<=r;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;c+=t.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s<r?c.lastIndexOf(t,r-s-1):-1;if(e>=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function Oh(e,t,n,r,i){let a=[];for(let o=0,s=0;o<e.length;o++){let c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&=(a.push(i),void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function kh(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if($p(n)){for(c=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&K.isSelectable(e)&&i.parent&&!(e.isInline&&Zp(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new K(o==e?s:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let a=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[c,o]=i==e.state.selection.anchor?[i,t]:[t,i],s=r.resolve(o)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!l){let n=t==`pointer`||e.state.selection.head<s.pos&&!a?1:-1;l=Bh(e,u,s,n)}return l}function Ah(e){return e.editable?e.hasFocus():Hh(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function jh(e,t=!1){let n=e.state.selection;if(Rh(e,n),Ah(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&pm){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Gp(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)Lh(e);else{let{anchor:r,head:i}=n,a,o;Mh&&!(n instanceof G)&&(n.$from.parent.inlineContent||(a=Nh(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=Nh(e,n.to))),e.docView.setSelection(r,i,e,t),Mh&&(a&&Fh(a),o&&Fh(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&Ih(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var Mh=hm||pm&&mm<63;function Nh(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,a=r?n.childNodes[r-1]:null;if(hm&&i&&i.contentEditable==`false`)return Ph(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return Ph(i);if(a)return Ph(a)}}function Ph(e){return e.contentEditable=`true`,hm&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Fh(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function Ih(e){let t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!Ah(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function Lh(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,Bp(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&lm&&um<=11&&(n.disabled=!0,n.disabled=!1)}function Rh(e,t){if(t instanceof K){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(zh(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else zh(e)}function zh(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function Bh(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||G.between(t,n,r)}function Vh(e){return e.editable&&!e.hasFocus()?!1:Hh(e)}function Hh(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function Uh(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Gp(t.node,t.offset,n.anchorNode,n.anchorOffset)}function Wh(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&W.findFrom(a,t)}function Gh(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Kh(e,t,n){let r=e.state.selection;if(r instanceof G){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return Gh(e,new G(r.$anchor,a))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=Wh(e.state,t);return n&&n instanceof K?Gh(e,n):!1}else if(!(_m&&n.indexOf(`m`)>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?K.isSelectable(i)?Gh(e,new K(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):bm?Gh(e,new G(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1:!1}}else if(r instanceof K&&r.node.isInline)return Gh(e,new G(t>0?r.$to:r.$from));else{let n=Wh(e.state,t);return n?Gh(e,n):!1}}function qh(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Jh(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function Yh(e,t){return t<0?Xh(e):Zh(e)}function Xh(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(dm&&n.nodeType==1&&r<qh(n)&&Jh(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(Jh(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(Qh(n))break;else{let t=n.previousSibling;for(;t&&Jh(t,-1);)i=n.parentNode,a=Bp(t),t=t.previousSibling;if(t)n=t,r=qh(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?tg(e,n,r):i&&tg(e,i,a)}function Zh(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=qh(n),a,o;for(;;)if(r<i){if(n.nodeType!=1)break;let e=n.childNodes[r];if(Jh(e,1))a=n,o=++r;else break}else if(Qh(n))break;else{let t=n.nextSibling;for(;t&&Jh(t,1);)a=t.parentNode,o=Bp(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=qh(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&tg(e,a,o)}function Qh(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function $h(e,t){for(;e&&t==e.childNodes.length&&!Qp(e);)t=Bp(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=0}}function eg(e,t){for(;e&&!t&&!Qp(e);)t=Bp(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function tg(e,t,n){if(t.nodeType!=3){let e,r;(r=$h(t,n))?(t=r,n=0):(e=eg(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if($p(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&jh(e)},50)}function ng(e,t){let n=e.state.doc.resolve(t);if(!(pm||vm)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?`ltr`:`rtl`}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function rg(e,t,n){let r=e.state.selection;if(r instanceof G&&!r.empty||n.indexOf(`s`)>-1||_m&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=Wh(e.state,t);if(n&&n instanceof K)return Gh(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof Sp?W.near(n,t):W.findFrom(n,t);return o?Gh(e,o):!1}return!1}function ig(e,t){if(!(e.state.selection instanceof G))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function ag(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function og(e){if(!hm||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable==`false`){let n=t.firstChild;ag(e,n,`true`),setTimeout(()=>ag(e,n,`false`),20)}return!1}function sg(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function cg(e,t){let n=t.keyCode,r=sg(t);if(n==8||_m&&n==72&&r==`c`)return ig(e,-1)||Yh(e,-1);if(n==46&&!t.shiftKey||_m&&n==68&&r==`c`)return ig(e,1)||Yh(e,1);if(n==13||n==27)return!0;if(n==37||_m&&n==66&&r==`c`){let t=n==37?ng(e,e.state.selection.from)==`ltr`?-1:1:-1;return Kh(e,t,r)||Yh(e,t)}else if(n==39||_m&&n==70&&r==`c`){let t=n==39?ng(e,e.state.selection.from)==`ltr`?1:-1:1;return Kh(e,t,r)||Yh(e,t)}else if(n==38||_m&&n==80&&r==`c`)return rg(e,-1,r)||Yh(e,-1);else if(n==40||_m&&n==78&&r==`c`)return og(e)||rg(e,1,r)||Yh(e,1);else if(r==(_m?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function lg(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||Yd.fromSchema(e.state.schema),s=bg(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=vg[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&l.nodeType==1&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,`
|
|
8
|
+
|
|
9
|
+
`),slice:t}}function ug(e,t,n,r,i){let a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;let c=!!t&&(r||a||!n);if(c){if(e.someProp(`transformPastedText`,n=>{t=n(t,a||r,e)}),a)return s=new U(V.from(e.state.schema.text(t.replace(/\r\n?/g,`
|
|
10
|
+
`))),0,0),e.someProp(`transformPasted`,t=>{s=t(s,e,!0)}),s;let n=e.someProp(`clipboardTextParser`,n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,a=Yd.fromSchema(r);o=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement(`p`));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),o=Cg(n),bm&&wg(o);let l=o&&o.querySelector(`[data-pm-slice]`),u=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute(`data-pm-slice`)||``);if(u&&u[3])for(let e=+u[3];e>0;e--){let e=o.firstChild;for(;e&&e.nodeType!=1;)e=e.nextSibling;if(!e)break;o=e}if(s||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||Fd.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!dg.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=Tg(_g(s,+u[1],+u[2]),u[4]);else if(s=U.maxOpen(fg(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=_g(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var dg=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function fg(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,a=[];if(e.forEach(e=>{if(!a)return;let t=r.findWrapping(e.type),n;if(!t)return a=null;if(n=a.length&&i.length&&mg(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=hg(a[a.length-1],i.length));let n=pg(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return V.from(a)}return e}function pg(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,V.from(e));return e}function mg(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=mg(e,t,n,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(V.from(pg(n,e,i+1))))}}function hg(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,hg(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(V.empty,!0);return e.copy(n.append(r))}function gg(e,t,n,r,i,a){let o=t<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(a=0),i<r-1&&(s=gg(s,t,n,r,i+1,a)),i>=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(V.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function _g(e,t,n){return t<e.openStart&&(e=new U(gg(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new U(gg(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var vg={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]},yg=null;function bg(){return yg||=document.implementation.createHTMLDocument(`title`)}var xg=null;function Sg(e){let t=window.trustedTypes;return t?(xg||=t.defaultPolicy||t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e}),xg.createHTML(e)):e}function Cg(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=bg().createElement(`div`),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&vg[r[1].toLowerCase()])&&(e=i.map(e=>`<`+e+`>`).join(``)+e+i.map(e=>`</`+e+`>`).reverse().join(``)),n.innerHTML=Sg(e),i)for(let e=0;e<i.length;e++)n=n.querySelector(i[e])||n;return n}function wg(e){let t=e.querySelectorAll(pm?`span:not([class]):not([style])`:`span.Apple-converted-space`);for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==`\xA0`&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(` `),r)}}function Tg(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:a,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;i=V.from(t.create(r[e+1],i)),a++,o++}return new U(i,a,o)}var Eg={},Dg={},Og={touchstart:!0,touchmove:!0},kg=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:``,button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function Ag(e){for(let t in Eg){let n=Eg[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{Fg(e,t)&&!Pg(e,t)&&(e.editable||!(t.type in Dg))&&n(e,t)},Og[t]?{passive:!0}:void 0)}hm&&e.dom.addEventListener(`input`,()=>null),Ng(e)}function jg(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Mg(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function Ng(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>Pg(e,t))})}function Pg(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function Fg(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function Ig(e,t){!Pg(e,t)&&Eg[t.type]&&(e.editable||!(t.type in Dg))&&Eg[t.type](e,t)}Dg.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!Xg(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(ym&&pm&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),gm&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,em(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||cg(e,n)?n.preventDefault():jg(e,`key`)},Dg.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},Dg.keypress=(e,t)=>{let n=t;if(Xg(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||_m&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof G)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();!/[\r\n]/.test(t)&&!e.someProp(`handleTextInput`,n=>n(e,r.$from.pos,r.$to.pos,t,i))&&e.dispatch(i()),n.preventDefault()}};function Lg(e){return{left:e.clientX,top:e.clientY}}function Rg(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function zg(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function Bg(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);n==`pointer`&&r.setMeta(`pointer`,!0),e.dispatch(r)}function Vg(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&K.isSelectable(r)?(Bg(e,new K(n),`pointer`),!0):!1}function Hg(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof K&&(r=n.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(K.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(e);break}}return i==null?!1:(Bg(e,K.create(e.state.doc,i),`pointer`),!0)}function Ug(e,t,n,r,i){return zg(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?Hg(e,n):Vg(e,n))}function Wg(e,t,n,r){return zg(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function Gg(e,t,n,r){return zg(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||Kg(e,n,r)}function Kg(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(Bg(e,G.create(r,0,r.content.size),`pointer`),!0):!1;let i=r.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),a=i.before(t);if(n.inlineContent)Bg(e,G.create(r,a+1,a+1+n.content.size),`pointer`);else if(K.isSelectable(n))Bg(e,K.create(r,a),`pointer`);else continue;return!0}}function qg(e){return r_(e)}var Jg=_m?`metaKey`:`ctrlKey`;Eg.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=qg(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&Rg(n,e.input.lastClick)&&!n[Jg]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button};let o=e.posAtCoords(Lg(n));o&&(a==`singleClick`?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new Yg(e,o,n,!!r)):(a==`doubleClick`?Wg:Gg)(e,o.pos,o.inside,n)?n.preventDefault():jg(e,`pointer`))};var Yg=class{constructor(e,t,n,r){this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[Jg],this.allowDefault=n.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,a=n.depth?n.before():0}let o=r?null:n.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&s.nodeDOM.nodeType==1?s.nodeDOM:null;let{selection:c}=e.state;n.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof K&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&dm&&!this.target.hasAttribute(`contentEditable`))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute(`contentEditable`,`false`)},20),this.view.domObserver.start()),e.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),e.root.addEventListener(`mousemove`,this.move=this.move.bind(this)),jg(e,`pointer`)}done(){this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute(`draggable`),this.mightDrag.setUneditable&&this.target.removeAttribute(`contentEditable`),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>jh(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Lg(e))),this.updateAllowDefault(e),this.allowDefault||!t?jg(this.view,`pointer`):Ug(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||hm&&this.mightDrag&&!this.mightDrag.node.isAtom||pm&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Bg(this.view,W.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):jg(this.view,`pointer`)}move(e){this.updateAllowDefault(e),jg(this.view,`pointer`),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}};Eg.touchstart=e=>{e.input.lastTouch=Date.now(),qg(e),jg(e,`pointer`)},Eg.touchmove=e=>{e.input.lastTouch=Date.now(),jg(e,`pointer`)},Eg.contextmenu=e=>qg(e);function Xg(e,t){return e.composing?!0:hm&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var Zg=ym?5e3:-1;Dg.compositionstart=Dg.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof G&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||pm&&vm&&Qg(e)))e.markCursor=e.state.storedMarks||n.marks(),r_(e,!0),e.markCursor=null;else if(r_(e,!t.selection.empty),dm&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&n.nodeType==1&&r!=0;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(t.nodeType==3){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}else n=t,r=-1}}e.input.composing=!0}$g(e,Zg)};function Qg(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable==`false`}Dg.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,$g(e,20))};function $g(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>r_(e),t))}function e_(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=n_());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function t_(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=Yp(t.focusNode,t.focusOffset),r=Xp(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}function n_(){let e=document.createEvent(`Event`);return e.initEvent(`event`,!0,!0),e.timeStamp}function r_(e,t=!1){if(!(ym&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),e_(e),t||e.docView&&e.docView.dirty){let n=kh(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function i_(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement(`div`));n.appendChild(t),n.style.cssText=`position: fixed; left: -10000px; top: 10px`;let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var a_=lm&&um<15||gm&&xm<604;Eg.copy=Dg.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=a_?null:n.clipboardData,{dom:o,text:s}=lg(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):i_(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function o_(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function s_(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?`textarea`:`div`));n||(r.contentEditable=`true`),r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?c_(e,r.value,null,i,t):c_(e,r.textContent,r.innerHTML,i,t)},50)}function c_(e,t,n,r,i){let a=ug(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||U.empty)))return!0;if(!a)return!1;let o=o_(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function l_(e){let t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;let n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}Dg.paste=(e,t)=>{let n=t;if(e.composing&&!ym)return;let r=a_?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&c_(e,l_(r),r.getData(`text/html`),i,n)?n.preventDefault():s_(e,n)};var u_=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},d_=_m?`altKey`:`ctrlKey`;function f_(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[d_]:!n}Eg.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(Lg(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof K?i.to-1:i.to))){if(r&&r.mightDrag)o=K.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=K.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=lg(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!pm||mm>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(a_?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,a_||n.dataTransfer.setData(`text/plain`,c),e.dragging=new u_(l,f_(e,n),o)},Eg.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},Dg.dragover=Dg.dragenter=(e,t)=>t.preventDefault(),Dg.drop=(e,t)=>{try{p_(e,t,e.dragging)}finally{e.dragging=null}};function p_(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(Lg(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp(`transformPasted`,t=>{a=t(a,e,!1)}):a=ug(e,l_(t.dataTransfer),a_?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&f_(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||U.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?Xf(e.state.doc,i.pos,a):i.pos;s??=i.pos;let c=e.state.tr;if(o){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let l=c.mapping.map(s),u=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let f=c.doc.resolve(l);if(u&&K.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new K(f));else{let t=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),c.setSelection(Bh(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}Eg.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add(`ProseMirror-focused`),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&jh(e)},20))},Eg.blur=(e,t)=>{let n=t;e.focused&&=(e.domObserver.stop(),e.dom.classList.remove(`ProseMirror-focused`),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),!1)},Eg.beforeinput=(e,t)=>{if(pm&&ym&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp(`handleKeyDown`,t=>t(e,em(8,`Backspace`)))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in Dg)Eg[e]=Dg[e];function m_(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}var h_=class e{constructor(e,t){this.toDOM=e,this.spec=t||b_,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new v_(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&m_(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},g_=class e{constructor(e,t){this.attrs=e,this.spec=t||b_}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new v_(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&m_(this.attrs,t.attrs)&&m_(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},__=class e{constructor(e,t){this.attrs=e,this.spec=t||b_}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new v_(i.pos-n,a.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(t){return this==t||t instanceof e&&m_(this.attrs,t.attrs)&&m_(this.spec,t.spec)}destroy(){}},v_=class e{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(t,n){return new e(t,n,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(t,n,r){return new e(t,t,new h_(n,r))}static inline(t,n,r,i){return new e(t,n,new g_(r,i))}static node(t,n,r,i){return new e(t,n,new __(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof g_}get widget(){return this.type instanceof h_}},y_=[],b_={},x_=class e{constructor(e,t){this.local=e.length?e:y_,this.children=t.length?t:y_}static create(e,t){return t.length?k_(t,e,0,b_):S_}find(e,t,n){let r=[];return this.findInner(e??0,t??1e9,r,0,n),r}findInner(e,t,n,r,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==S_||e.maps.length==0?this:this.mapInner(e,t,0,0,n||b_)}mapInner(t,n,r,i,a){let o;for(let e=0;e<this.local.length;e++){let s=this.local[e].map(t,r,i);s&&s.type.valid(n,s)?(o||=[]).push(s):a.onRemove&&a.onRemove(this.local[e].spec)}return this.children.length?w_(this.children,o||[],t,n,r,i,a):o?new e(o.sort(A_),y_):S_}add(t,n){return n.length?this==S_?e.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,a=0;t.forEach((e,t)=>{let o=t+r,s;if(s=D_(n,e,o)){for(i||=this.children.slice();a<i.length&&i[a]<t;)a+=3;i[a]==t?i[a+2]=i[a+2].addInner(e,s,o+1):i.splice(a,0,t,t+e.nodeSize,k_(s,e,o+1,b_)),a+=3}});let o=T_(a?O_(n):n,-r);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||o.splice(e--,1);return new e(o.length?this.local.concat(o).sort(A_):this.local,i||this.children)}remove(e){return e.length==0||this==S_?this:this.removeInner(e,0)}removeInner(t,n){let r=this.children,i=this.local;for(let e=0;e<r.length;e+=3){let i,a=r[e]+n,o=r[e+1]+n;for(let e=0,n;e<t.length;e++)(n=t[e])&&n.from>a&&n.to<o&&(t[e]=null,(i||=[]).push(n));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[e+2].removeInner(i,a+1);s==S_?(r.splice(e,3),e-=3):r[e+2]=s}if(i.length){for(let e=0,r;e<t.length;e++)if(r=t[e])for(let e=0;e<i.length;e++)i[e].eq(r,n)&&(i==this.local&&(i=this.local.slice()),i.splice(e--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):S_}forChild(t,n){if(this==S_)return this;if(n.isLeaf)return e.empty;let r,i;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(r=this.children[e+2]);break}let a=t+1,o=a+n.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>a&&t.type instanceof g_){let e=Math.max(a,t.from)-a,n=Math.min(o,t.to)-a;e<n&&(i||=[]).push(t.copy(e,n))}}if(i){let t=new e(i.sort(A_),y_);return r?new C_([t,r]):t}return r||S_}eq(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(e){return j_(this.localsInner(e))}localsInner(e){if(this==S_)return y_;if(e.inlineContent||!this.local.some(g_.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof g_||t.push(this.local[e]);return t}forEachSet(e){e(this)}};x_.empty=new x_([],[]),x_.removeOverlap=j_;var S_=x_.empty,C_=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,b_));return e.from(r)}forChild(t,n){if(n.isLeaf)return x_.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=S_&&(a instanceof e?r=r.concat(a.members):r.push(a))}return e.from(r)}eq(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{n&&=(t=t.slice(),!1);for(let e=0;e<i.length;e++)t.push(i[e])}}return t?j_(n?t:t.sort(A_)):y_}static from(t){switch(t.length){case 0:return S_;case 1:return t[0];default:return new e(t.every(e=>e instanceof x_)?t:t.reduce((e,t)=>e.concat(t instanceof x_?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function w_(e,t,n,r,i,a,o){let s=e.slice();for(let e=0,t=a;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,a)=>{let o=a-i-(n-e);for(let i=0;i<s.length;i+=3){let a=s[i+1];if(a<0||e>a+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t<s.length;t+=3)if(s[t+1]<0){if(s[t+1]==-2){c=!0,s[t+1]=-1;continue}let l=n.map(e[t]+a),u=l-i;if(u<0||u>=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==S_?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=k_(E_(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<s.length&&s[t]<n;)t+=3;s.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new x_(t.sort(A_),s)}function T_(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new v_(i.from+t,i.to+t,i.type))}return n}function E_(e,t,n,r,i,a,o){function s(e,t){for(let a=0;a<e.local.length;a++){let s=e.local[a].map(r,i,t);s?n.push(s):o.onRemove&&o.onRemove(e.local[a].spec)}for(let n=0;n<e.children.length;n+=3)s(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)e[n+1]==-1&&s(e[n+2],t[n]+a+1);return n}function D_(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,a;t<e.length;t++)(a=e[t])&&a.from>n&&a.to<r&&((i||=[]).push(a),e[t]=null);return i}function O_(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function k_(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=D_(e,t,o+n);if(s){a=!0;let e=k_(s,t,n+o+1,r);e!=S_&&i.push(o,o+t.nodeSize,e)}});let o=T_(a?O_(e):e,-n).sort(A_);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(r.onRemove&&r.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new x_(o,i):S_}function A_(e,t){return e.from-t.from||e.to-t.to}function j_(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let a=t[i];if(a.from==r.from){a.to!=r.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,r.to),M_(t,i+1,a.copy(r.to,a.to)));continue}else{a.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,a.from),M_(t,i,r.copy(a.from,r.to)));break}}}return t}function M_(e,t,n){for(;t<e.length&&A_(n,e[t])>0;)t++;e.splice(t,0,n)}function N_(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=S_&&t.push(r)}),e.cursorWrapper&&t.push(x_.create(e.state.doc,[e.cursorWrapper.deco])),C_.from(t)}var P_={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},F_=lm&&um<=11,I_=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},L_=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new I_,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);lm&&um<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():hm&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),F_&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,P_)),this.onCharData&&this.view.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener(`selectionchange`,this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener(`selectionchange`,this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Vh(this.view)){if(this.suppressingSelectionUpdates)return jh(this.view);if(lm&&um<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Gp(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=Vp(n))t.add(n);for(let r=e.anchorNode;r;r=Vp(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Vh(e)&&!this.ignoreSelectionChange(n),i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],s);n&&(i=i<0?n.from:Math.min(n.from,i),a=a<0?n.to:Math.max(n.to,a),n.typeOver&&(o=!0))}if(s.some(e=>e.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let e of s)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;for(;t&&t.nodeType==1;){if(t.contentEditable==`false`){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(dm&&s.length){let t=s.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||U_(e,n)!=t)&&r.remove()}}}let c=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&$p(n)&&(c=kh(e))&&c.eq(W.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,jh(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),B_(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,W_(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||jh(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),r.nodeType==3&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(lm&&um<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:a}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!a||Array.prototype.indexOf.call(e.addedNodes,a)<0)&&(i=a)}let a=r&&r.parentNode==e.target?Bp(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?Bp(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,s,1)}}else if(e.type==`attributes`)return{from:n.posAtStart-n.border,to:n.posAtEnd+n.border};else return this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}},R_=new WeakMap,z_=!1;function B_(e){if(!R_.has(e)&&(R_.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=dm,z_)return;console.warn(`ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.`),z_=!0}}function V_(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return Gp(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function H_(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return V_(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,r,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,r,!0),n?V_(e,n):null}function U_(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function W_(e,t){let{focusNode:n,focusOffset:r}=e.domSelectionRange();for(let i of t)if(i.parentNode?.nodeName==`TR`){let t=i.nextSibling;for(;t&&t.nodeName!=`TD`&&t.nodeName!=`TH`;)t=t.nextSibling;if(t){let a=t;for(;;){let e=a.firstChild;if(!e||e.nodeType!=1||e.contentEditable==`false`||/^(BR|IMG)$/.test(e.nodeName))break;a=e}a.insertBefore(i,a.firstChild),n==i&&e.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function G_(e,t,n){let{node:r,fromOffset:i,toOffset:a,from:o,to:s}=e.docView.parseRange(t,n),c=e.domSelectionRange(),l,u=c.anchorNode;if(u&&e.dom.contains(u.nodeType==1?u:u.parentNode)&&(l=[{node:u,offset:c.anchorOffset}],$p(c)||l.push({node:c.focusNode,offset:c.focusOffset})),pm&&e.input.lastKeyCode===8)for(let e=a;e>i;e--){let t=r.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){a=e;break}if(!n||n.size)break}let d=e.state.doc,f=e.someProp(`domParser`)||Fd.fromSchema(e.state.schema),p=d.resolve(o),m=null,h=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:a,preserveWhitespace:p.parent.type.whitespace==`pre`?`full`:!0,findPositions:l,ruleFromNode:K_,context:p});if(l&&l[0].pos!=null){let e=l[0].pos,t=l[1]&&l[1].pos;t??=e,m={anchor:e+o,head:t+o}}return{doc:h,sel:m,from:o,to:s}}function K_(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName==`BR`&&e.parentNode){if(hm&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}else if(e.parentNode.lastChild==e||hm&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName==`IMG`&&e.getAttribute(`mark-placeholder`))return{ignore:!0};return null}var q_=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function J_(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=kh(e,t);if(n&&!e.state.selection.eq(n)){if(pm&&ym&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,em(13,`Enter`))))return;let r=e.state.tr.setSelection(n);t==`pointer`?r.setMeta(`pointer`,!0):t==`key`&&r.scrollIntoView(),a&&r.setMeta(`composition`,a),e.dispatch(r)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let c=e.state.selection,l=G_(e,t,n),u=e.state.doc,d=u.slice(l.from,l.to),f,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,p=`end`):(f=e.state.selection.from,p=`start`),e.input.lastKeyCode=null;let m=$_(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(gm&&e.input.lastIOSEnter>Date.now()-225||ym)&&i.some(e=>e.nodeType==1&&!q_.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,em(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof G&&!c.empty&&c.$head.sameParent(c.$anchor)&&!e.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let t=Y_(e,e.state.doc,l.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta(`composition`,a),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof G&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=l.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=l.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),lm&&um<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>l.from&&l.doc.textBetween(m.start-l.from-1,m.start-l.from+1)==` \xA0`&&(m.start--,m.endA--,m.endB--);let h=l.doc.resolveNoCache(m.start-l.from),g=l.doc.resolveNoCache(m.endB-l.from),_=u.resolve(m.start),v=h.sameParent(g)&&h.parent.inlineContent&&_.end()>=m.endA;if((gm&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!v&&h.pos<l.doc.content.size&&(!h.sameParent(g)||!h.parent.inlineContent)&&h.pos<g.pos&&!/\S/.test(l.doc.textBetween(h.pos,g.pos,``,``)))&&e.someProp(`handleKeyDown`,t=>t(e,em(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&Z_(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,em(8,`Backspace`)))){ym&&pm&&e.domObserver.suppressSelectionUpdates();return}pm&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),ym&&!v&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==m.endA&&(m.endB-=2,g=l.doc.resolveNoCache(m.endB-l.from),setTimeout(()=>{e.someProp(`handleKeyDown`,function(t){return t(e,em(13,`Enter`))})},20));let y=m.start,b=m.endA,x=t=>{let n=t||e.state.tr.replace(y,b,l.doc.slice(m.start-l.from,m.endB-l.from));if(l.sel){let t=Y_(e,n.doc,l.sel);t&&!(pm&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||lm&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v)if(h.pos==g.pos){lm&&um<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>jh(e),20));let t=x(e.state.tr.delete(y,b)),n=u.resolve(m.start).marksAcross(u.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(S=X_(h.parent.content.cut(h.parentOffset,g.parentOffset),_.parent.content.cut(_.parentOffset,m.endA-_.start())))){let t=x(e.state.tr);S.type==`add`?t.addMark(y,b,S.mark):t.removeMark(y,b,S.mark),e.dispatch(t)}else if(h.parent.child(h.index()).isText&&h.index()==g.index()-+!g.textOffset){let t=h.parent.textBetween(h.parentOffset,g.parentOffset),n=()=>x(e.state.tr.insertText(t,y,b));e.someProp(`handleTextInput`,r=>r(e,y,b,t,n))||e.dispatch(n())}else e.dispatch(x());else e.dispatch(x())}function Y_(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Bh(e,t.resolve(n.anchor),t.resolve(n.head))}function X_(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,c;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)a=n[e].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o=`add`,c=e=>e.mark(s.addToSet(e.marks));else if(i.length==0&&a.length==1)s=a[0],o=`remove`,c=e=>e.mark(s.removeFromSet(e.marks));else return null;let l=[];for(let e=0;e<t.childCount;e++)l.push(c(t.child(e)));if(V.from(l).eq(e))return{mark:s,type:o}}function Z_(e,t,n,r,i){if(n-t<=i.pos-r.pos||Q_(r,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!r.parent.isTextblock){let e=a.nodeAfter;return e!=null&&n==t+e.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=e.resolve(Q_(a,!0,!0));return!o.parent.isTextblock||o.pos>n||Q_(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Q_(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function $_(e,t,n,r,i){let a=e.findDiffStart(t,n);if(a==null)return null;let{a:o,b:s}=e.findDiffEnd(t,n+e.size,n+t.size);if(i==`end`){let e=Math.max(0,a-Math.min(o,s));r-=o+e-a}if(o<a&&e.size<t.size){let e=r<=a&&r>=o?a-r:0;a-=e,a&&a<t.size&&ev(t.textBetween(a-1,a+1))&&(a+=e?1:-1),s=a+(s-o),o=a}else if(s<a){let t=r<=a&&r>=s?a-r:0;a-=t,a&&a<e.size&&ev(e.textBetween(a-1,a+1))&&(a+=t?1:-1),o=a+(o-s),s=a}return{start:a,endA:o,endB:s}}function ev(e){if(e.length!=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}var tv=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new kg,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(cv),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement(`div`),e&&(e.appendChild?e.appendChild(this.dom):typeof e==`function`?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=iv(this),rv(this),this.nodeViews=ov(this),this.docView=lh(this.state.doc,nv(this),N_(this),this.dom,this),this.domObserver=new L_(this,(e,t,n,r)=>J_(this,e,t,n,r)),this.domObserver.start(),Ag(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ng(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(cv),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(e_(this),i=!0),this.state=e;let a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=ov(this);sv(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Ng(this),this.editable=iv(this),rv(this);let o=N_(this),s=nv(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,l=r||!this.docView.matchesNode(e.doc,s,o);(l||!e.selection.eq(n.selection))&&(i=!0);let u=c==`preserve`&&i&&this.dom.style.overflowAnchor==null&&Em(this);if(i){this.domObserver.stop();let t=l&&(lm||pm)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&av(n.selection,e.selection);if(l){let n=pm?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=t_(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=lh(e.doc,s,o,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Uh(this))?jh(this,t):(Rh(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c==`reset`?this.dom.scrollTop=0:c==`to selection`?this.scrollToSelection():u&&Om(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp(`handleScrollToSelection`,e=>e(this)))if(this.state.selection instanceof K){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Tm(this,t.getBoundingClientRect(),e)}else Tm(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new u_(e.slice,e.move,r<0?void 0:K.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(n!=null&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(i!=null&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let a=i[n].props[e];if(a!=null&&(r=t?t(a):a))return r}}hasFocus(){if(lm){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable==`false`)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&jm(this.dom),jh(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return zm(this,e)}coordsAtPos(e,t=1){return Um(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return $m(this,t||this.state,e)}pasteHTML(e,t){return c_(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return c_(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return lg(this,e)}destroy(){this.docView&&(Mg(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],N_(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Wp())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Ig(this,e)}domSelectionRange(){let e=this.domSelection();return e?hm&&this.root.nodeType===11&&tm(this.dom.ownerDocument)==this.dom&&H_(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};tv.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function nv(e){let t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,n=>{if(typeof n==`function`&&(n=n(e.state)),n)for(let e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||=`no`,[v_.node(0,e.state.doc.content.size,t)]}function rv(e){if(e.markCursor){let t=document.createElement(`img`);t.className=`ProseMirror-separator`,t.setAttribute(`mark-placeholder`,`true`),t.setAttribute(`alt`,``),e.cursorWrapper={dom:t,deco:v_.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function iv(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function av(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function ov(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function sv(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function cv(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}for(var lv={8:`Backspace`,9:`Tab`,10:`Enter`,12:`NumLock`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,44:`PrintScreen`,45:`Insert`,46:`Delete`,59:`;`,61:`=`,91:`Meta`,92:`Meta`,106:`*`,107:`+`,108:`,`,109:`-`,110:`.`,111:`/`,144:`NumLock`,145:`ScrollLock`,160:`Shift`,161:`Shift`,162:`Control`,163:`Control`,164:`Alt`,165:`Alt`,173:`-`,186:`;`,187:`=`,188:`,`,189:`-`,190:`.`,191:`/`,192:"`",219:`[`,220:`\\`,221:`]`,222:`'`},uv={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},dv=typeof navigator<`u`&&/Mac/.test(navigator.platform),fv=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),pv=0;pv<10;pv++)lv[48+pv]=lv[96+pv]=String(pv);for(var pv=1;pv<=24;pv++)lv[pv+111]=`F`+pv;for(var pv=65;pv<=90;pv++)lv[pv]=String.fromCharCode(pv+32),uv[pv]=String.fromCharCode(pv);for(var mv in lv)uv.hasOwnProperty(mv)||(uv[mv]=lv[mv]);function hv(e){var t=!(dv&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||fv&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?uv:lv)[e.keyCode]||e.key||`Unidentified`;return t==`Esc`&&(t=`Escape`),t==`Del`&&(t=`Delete`),t==`Left`&&(t=`ArrowLeft`),t==`Up`&&(t=`ArrowUp`),t==`Right`&&(t=`ArrowRight`),t==`Down`&&(t=`ArrowDown`),t}var gv=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),_v=typeof navigator<`u`&&/Win/.test(navigator.platform);function vv(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n==`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e++){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))gv?o=!0:i=!0;else throw Error(`Unrecognized modifier name: `+n)}return r&&(n=`Alt-`+n),i&&(n=`Ctrl-`+n),o&&(n=`Meta-`+n),a&&(n=`Shift-`+n),n}function yv(e){let t=Object.create(null);for(let n in e)t[vv(n)]=e[n];return t}function bv(e,t,n=!0){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n&&t.shiftKey&&(e=`Shift-`+e),e}function xv(e){return new Ip({props:{handleKeyDown:Sv(e)}})}function Sv(e){let t=yv(e);return function(e,n){let r=hv(n),i,a=t[bv(r,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(r.length==1&&r!=` `){if(n.shiftKey){let i=t[bv(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(_v&&n.ctrlKey&&n.altKey)&&(i=lv[n.keyCode])&&i!=r){let r=t[bv(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var Cv=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function wv(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var Tv=(e,t,n)=>{let r=wv(e,n);if(!r)return!1;let i=jv(r);if(!i){let n=r.blockRange(),i=n&&Af(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(Yv(e,i,t,-1))return!0;if(r.parent.content.size==0&&(kv(a,`end`)||K.isSelectable(a)))for(let n=r.depth;;n--){let o=Zf(e.doc,r.before(n),r.after(n),U.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(kv(a,`end`)?W.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):K.create(n.doc,i.pos-a.nodeSize)),t(n.scrollIntoView())}return!0}if(n==1||r.node(n-1).childCount>1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},Ev=(e,t,n)=>{let r=wv(e,n);if(!r)return!1;let i=jv(r);return i?Ov(e,i,t):!1},Dv=(e,t,n)=>{let r=Mv(e,n);if(!r)return!1;let i=Fv(r);return i?Ov(e,i,t):!1};function Ov(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=Zf(e.doc,i,o,U.empty);if(!s||s.from!=i||s instanceof Cf&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(G.create(t.doc,i)),n(t.scrollIntoView())}return!0}function kv(e,t,n=!1){for(let r=e;r;r=t==`start`?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var Av=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`backward`,e):r.parentOffset>0)return!1;a=jv(r)}let o=a&&a.nodeBefore;return!o||!K.isSelectable(o)?!1:(t&&t(e.tr.setSelection(K.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function jv(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Mv(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var Nv=(e,t,n)=>{let r=Mv(e,n);if(!r)return!1;let i=Fv(r);if(!i)return!1;let a=i.nodeAfter;if(Yv(e,i,t,1))return!0;if(r.parent.content.size==0&&(kv(a,`start`)||K.isSelectable(a))){let n=Zf(e.doc,r.before(),r.after(),U.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(kv(a,`start`)?W.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):K.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},Pv=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`forward`,e):r.parentOffset<r.parent.content.size)return!1;a=Fv(r)}let o=a&&a.nodeAfter;return!o||!K.isSelectable(o)?!1:(t&&t(e.tr.setSelection(K.create(e.doc,a.pos)).scrollIntoView()),!0)};function Fv(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var Iv=(e,t)=>{let n=e.selection,r=n instanceof K,i;if(r){if(n.node.isTextblock||!Wf(e.doc,n.from))return!1;i=n.from}else if(i=qf(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(K.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},Lv=(e,t)=>{let n=e.selection,r;if(n instanceof K){if(n.node.isTextblock||!Wf(e.doc,n.to))return!1;r=n.to}else if(r=qf(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},Rv=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&Af(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},zv=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
|
11
|
+
`).scrollIntoView()),!0)};function Bv(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var Vv=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=Bv(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(W.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},Hv=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof Sp||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=Bv(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,a.createAndFill());o.setSelection(G.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},Uv=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Hf(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Af(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function Wv(e){return(t,n)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof K&&t.selection.node.isBlock)return!r.parentOffset||!Hf(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let a=[],o,s,c=!1,l=!1;for(let t=r.depth;;t--)if(r.node(t).isBlock){c=r.end(t)==r.pos+(r.depth-t),l=r.start(t)==r.pos-(r.depth-t),s=Bv(r.node(t-1).contentMatchAt(r.indexAfter(t-1)));let n=e&&e(i.parent,c,r);a.unshift(n||(c&&s?{type:s}:null)),o=t;break}else{if(t==1)return!1;a.unshift(null)}let u=t.tr;(t.selection instanceof G||t.selection instanceof Sp)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Hf(u.doc,d,a.length,a);if(f||=(a[0]=s?{type:s}:null,Hf(u.doc,d,a.length,a)),!f)return!1;if(u.split(d,a.length,a),!c&&l&&r.node(o).type!=s){let e=u.mapping.map(r.before(o)),t=u.doc.resolve(e);s&&r.node(o-1).canReplaceWith(t.index(),t.index()+1,s)&&u.setNodeMarkup(u.mapping.map(r.before(o)),s)}return n&&n(u.scrollIntoView()),!0}}var Gv=Wv(),Kv=(e,t)=>{let{$from:n,to:r}=e.selection,i,a=n.sharedDepth(r);return a==0?!1:(i=n.before(a),t&&t(e.tr.setSelection(K.create(e.doc,i))),!0)},qv=(e,t)=>(t&&t(e.tr.setSelection(new Sp(e.doc))),!0);function Jv(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||Wf(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function Yv(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&Jv(e,t,n))return!0;let l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=V.empty;for(let e=o.length-1;e>=0;e--)s=V.from(o[e].create(null,s));s=V.from(i.copy(s));let c=e.tr.step(new wf(t.pos-1,r,t.pos,r,new U(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&Wf(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:W.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&Af(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&kv(a,`start`,!0)&&kv(i,`end`)){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=a,c=1;for(;!s.isTextblock;s=s.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=V.empty;for(let e=o.length-1;e>=0;e--)r=V.from(o[e].copy(r));n(e.tr.step(new wf(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new U(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Xv(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(G.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var Zv=Xv(-1),Qv=Xv(1);function $v(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&Mf(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function ey(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];n.doc.nodesBetween(a,o,(r,a)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(a),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];i.setBlockType(a,o,e,t)}r(i.scrollIntoView())}return!0}}function ty(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}var ny=ty(Cv,Tv,Av),ry=ty(Cv,Nv,Pv),iy={Enter:ty(zv,Hv,Uv,Gv),"Mod-Enter":Vv,Backspace:ny,"Mod-Backspace":ny,"Shift-Backspace":ny,Delete:ry,"Mod-Delete":ry,"Mod-a":qv},ay={"Ctrl-h":iy.Backspace,"Alt-Backspace":iy[`Mod-Backspace`],"Ctrl-d":iy.Delete,"Ctrl-Alt-Backspace":iy[`Mod-Delete`],"Alt-Delete":iy[`Mod-Delete`],"Alt-d":iy[`Mod-Delete`],"Ctrl-a":Zv,"Ctrl-e":Qv};for(let e in iy)ay[e]=iy[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function oy(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a);if(!o)return!1;let s=r?n.tr:null;return sy(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function sy(e,t,n,r=null){let i=!1,a=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let e=o.resolve(t.start-2);a=new id(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new id(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=Mf(a,n,r,t);return s?(e&&cy(e,t,s,i,n),!0):!1}function cy(e,t,n,r,i){let a=V.empty;for(let e=n.length-1;e>=0;e--)a=V.from(n[e].type.create(n[e].attrs,a));e.step(new wf(t.start-(r?2:0),t.end,t.start,t.end,new U(a,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let s=n.length-o,c=t.start+n.length-(r?2:0),l=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&Hf(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function ly(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?uy(t,n,e,a):dy(t,n,a):!0:!1}}function uy(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new wf(a-1,o,a,o,new U(V.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new id(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=Af(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return Wf(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function dy(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,a=n.startIndex;t>a;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?V.empty:V.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new wf(d-+!!s,f+ +!!c,d+1,f-1,new U((s?V.empty:V.from(i.copy(V.empty))).append(c?V.empty:V.from(i.copy(V.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function fy(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=V.from(r?e.create():null),o=new U(V.from(e.create(null,V.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new wf(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}function py(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var my=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:py({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},hy=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}};function q(e,t,n){return e.config[t]===void 0&&e.parent?q(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?q(e.parent,t,n):null}):e.config[t]}function gy(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function _y(e){let t=[],{nodeExtensions:n,markExtensions:r}=gy(e),i=[...n,...r],a={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(e=>{let n=q(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{e.types.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=q(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof i?.default==`function`&&(i.default=i.default()),i?.isRequired&&i?.default===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function vy(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}function yy(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=t?t.split(`;`).map(e=>e.trim()).filter(Boolean):[],i=n[e]?n[e].split(`;`).map(e=>e.trim()).filter(Boolean):[],a=new Map;i.forEach(e=>{let[t,n]=e.split(`:`).map(e=>e.trim());a.set(t,n)}),r.forEach(e=>{let[t,n]=e.split(`:`).map(e=>e.trim());a.set(t,n)}),n[e]=Array.from(a.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function by(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>yy(e,t),{})}function xy(e){return typeof e==`function`}function J(e,t=void 0,...n){return xy(e)?t?e.bind(t)(...n):e(...n):e}function Sy(e={}){return Object.keys(e).length===0&&e.constructor===Object}function Cy(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`?!0:e===`false`?!1:e:e}function wy(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):Cy(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function Ty(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&Sy(t)?!1:t!=null))}function Ey(e,t){let n=_y(e),{nodeExtensions:r,markExtensions:i}=gy(e);return new jd({topNode:r.find(e=>q(e,`topNode`))?.name,nodes:Object.fromEntries(r.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=Ty({...e.reduce((e,t)=>{let n=q(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:J(q(r,`content`,a)),marks:J(q(r,`marks`,a)),group:J(q(r,`group`,a)),inline:J(q(r,`inline`,a)),atom:J(q(r,`atom`,a)),selectable:J(q(r,`selectable`,a)),draggable:J(q(r,`draggable`,a)),code:J(q(r,`code`,a)),whitespace:J(q(r,`whitespace`,a)),linebreakReplacement:J(q(r,`linebreakReplacement`,a)),defining:J(q(r,`defining`,a)),isolating:J(q(r,`isolating`,a)),attrs:Object.fromEntries(i.map(e=>[e.name,{default:e?.attribute?.default}]))}),s=J(q(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>wy(e,i)));let c=q(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:by(e,i)}));let l=q(r,`renderText`,a);return l&&(o.toText=l),[r.name,o]})),marks:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=Ty({...e.reduce((e,t)=>{let n=q(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:J(q(r,`inclusive`,a)),excludes:J(q(r,`excludes`,a)),group:J(q(r,`group`,a)),spanning:J(q(r,`spanning`,a)),code:J(q(r,`code`,a)),attrs:Object.fromEntries(i.map(e=>[e.name,{default:e?.attribute?.default}]))}),s=J(q(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>wy(e,i)));let c=q(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:by(e,i)})),[r.name,o]}))})}function Dy(e,t){return t.nodes[e]||t.marks[e]||null}function Oy(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function ky(e,t){let n=Yd.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}var Ay=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n};function jy(e){return Object.prototype.toString.call(e)===`[object RegExp]`}var My=class{constructor(e){this.find=e.find,this.handler=e.handler}},Ny=(e,t)=>{if(jy(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn(`[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".`),r.push(n.replaceWith)),r};function Py(e){let{editor:t,from:n,to:r,text:i,rules:a,plugin:o}=e,{view:s}=t;if(s.composing)return!1;let c=s.state.doc.resolve(n);if(c.parent.type.spec.code||(c.nodeBefore||c.nodeAfter)?.marks.find(e=>e.type.spec.code))return!1;let l=!1,u=Ay(c)+i;return a.forEach(e=>{if(l)return;let a=Ny(u,e.find);if(!a)return;let c=s.state.tr,d=py({state:s.state,transaction:c}),f={from:n-(a[0].length-i.length),to:r},{commands:p,chain:m,can:h}=new my({editor:t,state:d});e.handler({state:d,range:f,match:a,commands:p,chain:m,can:h})===null||!c.steps.length||(c.setMeta(o,{transform:c,from:n,to:r,text:i}),s.dispatch(c),l=!0)}),l}function Fy(e){let{editor:t,rules:n}=e,r=new Ip({state:{init(){return null},apply(e,i,a){let o=e.getMeta(r);if(o)return o;let s=e.getMeta(`applyInputRules`);return s&&setTimeout(()=>{let{text:e}=s;e=typeof e==`string`?e:ky(V.from(e),a.schema);let{from:i}=s;Py({editor:t,from:i,to:i+e.length,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return Py({editor:t,from:i,to:a,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&Py({editor:t,from:i.pos,to:i.pos,text:``,rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if(i.key!==`Enter`)return!1;let{$cursor:a}=e.state.selection;return a?Py({editor:t,from:a.pos,to:a.pos,text:`
|
|
12
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function Iy(e){return Object.prototype.toString.call(e).slice(8,-1)}function Ly(e){return Iy(e)===`Object`?e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype:!1}function Ry(e,t){let n={...e};return Ly(e)&&Ly(t)&&Object.keys(t).forEach(r=>{Ly(t[r])&&Ly(e[r])?n[r]=Ry(e[r],t[r]):n[r]=t[r]}),n}var zy=class e{constructor(e={}){this.type=`mark`,this.name=`mark`,this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=J(q(this,`addOptions`,{name:this.name}))),this.storage=J(q(this,`addStorage`,{name:this.name,options:this.options}))||{}}static create(t={}){return new e(t)}configure(e={}){let t=this.extend({...this.config,addOptions:()=>Ry(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(t={}){let n=new e(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=J(q(n,`addOptions`,{name:n.name})),n.storage=J(q(n,`addStorage`,{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}};function By(e){return typeof e==`number`}var Vy=class{constructor(e){this.find=e.find,this.handler=e.handler}},Hy=(e,t,n)=>{if(jy(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn(`[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".`),n.push(t.replaceWith)),n}):[]};function Uy(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new my({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{if(!e.isTextblock||e.type.spec.code)return;let f=Math.max(r,t),p=Math.min(i,t+e.content.size);Hy(e.textBetween(f-t,p-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=f+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},p=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(p)})}),d.every(e=>e!==null)}var Wy=null,Gy=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function Ky(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr;if(!(!Uy({editor:t,state:py({state:e,transaction:c}),from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})||!c.steps.length)){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return n.map(e=>new Ip({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(Wy=t)},i=()=>{Wy&&=null};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=Wy;e?.isEditable&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{let n=t.clipboardData?.getData(`text/html`);return o=t,i=!!n?.includes(`data-pm-slice`),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:ky(V.from(t),r.schema);let{from:n}=d,i=n+t.length,a=Gy(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(!(!By(p)||!m||p===m.b))return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}function qy(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}var Jy=class e{constructor(t,n){this.splittableMarks=[],this.editor=n,this.extensions=e.resolve(t),this.schema=Ey(this.extensions,n),this.setupExtensions()}static resolve(t){let n=e.sort(e.flatten(t)),r=qy(n.map(e=>e.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),n}static flatten(e){return e.map(e=>{let t=q(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...this.flatten(t())]:e}).flat(10)}static sort(e){return e.sort((e,t)=>{let n=q(e,`priority`)||100,r=q(t,`priority`)||100;return n>r?-1:+(n<r)})}get commands(){return this.extensions.reduce((e,t)=>{let n=q(t,`addCommands`,{name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:Dy(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:t}=this,n=e.sort([...this.extensions].reverse()),r=[],i=[],a=n.map(e=>{let n={name:e.name,options:e.options,storage:e.storage,editor:t,type:Dy(e.name,this.schema)},a=[],o=q(e,`addKeyboardShortcuts`,n),s={};if(e.type===`mark`&&q(e,`exitable`,n)&&(s.ArrowRight=()=>zy.handleExit({editor:t,mark:e})),o){let e=Object.fromEntries(Object.entries(o()).map(([e,n])=>[e,()=>n({editor:t})]));s={...s,...e}}let c=xv(s);a.push(c);let l=q(e,`addInputRules`,n);Oy(e,t.options.enableInputRules)&&l&&r.push(...l());let u=q(e,`addPasteRules`,n);Oy(e,t.options.enablePasteRules)&&u&&i.push(...u());let d=q(e,`addProseMirrorPlugins`,n);if(d){let e=d();a.push(...e)}return a}).flat();return[Fy({editor:t,rules:r}),...Ky({editor:t,rules:i}),...a]}get attributes(){return _y(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=gy(this.extensions);return Object.fromEntries(t.filter(e=>!!q(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=q(t,`addNodeView`,{name:t.name,options:t.options,storage:t.storage,editor:e,type:vy(t.name,this.schema)});return r?[t.name,(i,a,o,s,c)=>{let l=by(i,n);return r()({node:i,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:l})}]:[]}))}setupExtensions(){this.extensions.forEach(e=>{this.editor.extensionStorage[e.name]=e.storage;let t={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Dy(e.name,this.schema)};e.type===`mark`&&(J(q(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name);let n=q(e,`onBeforeCreate`,t),r=q(e,`onCreate`,t),i=q(e,`onUpdate`,t),a=q(e,`onSelectionUpdate`,t),o=q(e,`onTransaction`,t),s=q(e,`onFocus`,t),c=q(e,`onBlur`,t),l=q(e,`onDestroy`,t);n&&this.editor.on(`beforeCreate`,n),r&&this.editor.on(`create`,r),i&&this.editor.on(`update`,i),a&&this.editor.on(`selectionUpdate`,a),o&&this.editor.on(`transaction`,o),s&&this.editor.on(`focus`,s),c&&this.editor.on(`blur`,c),l&&this.editor.on(`destroy`,l)})}},Yy=class e{constructor(e={}){this.type=`extension`,this.name=`extension`,this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=J(q(this,`addOptions`,{name:this.name}))),this.storage=J(q(this,`addStorage`,{name:this.name,options:this.options}))||{}}static create(t={}){return new e(t)}configure(e={}){let t=this.extend({...this.config,addOptions:()=>Ry(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(t={}){let n=new e({...this.config,...t});return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=J(q(n,`addOptions`,{name:n.name})),n.storage=J(q(n,`addStorage`,{name:n.name,options:n.options})),n}};function Xy(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`
|
|
13
|
+
|
|
14
|
+
`,textSerializers:o={}}=n||{},s=``;return e.nodesBetween(r,i,(e,n,c,l)=>{e.isBlock&&n>r&&(s+=a);let u=o?.[e.type.name];if(u)return c&&(s+=u({node:e,pos:n,parent:c,index:l,range:t})),!1;e.isText&&(s+=(e?.text)?.slice(Math.max(r,n)-n,i-n))}),s}function Zy(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}var Qy=Yy.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ip({key:new zp(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:a}=i,o=Math.min(...a.map(e=>e.$from.pos)),s=Math.max(...a.map(e=>e.$to.pos)),c=Zy(n);return Xy(r,{from:o,to:s},{...this.options.blockSeparator===void 0?{}:{blockSeparator:this.options.blockSeparator},textSerializers:c})}}})]}}),$y=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),eb=(e=!1)=>({commands:t})=>t.setContent(``,e),tb=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=Af(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},nb=e=>t=>e(t),rb=()=>({state:e,dispatch:t})=>Hv(e,t),ib=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new G(r.doc.resolve(Math.max(o-1,0)))),!0},ab=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1},ob=e=>({tr:t,state:n,dispatch:r})=>{let i=vy(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},sb=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},cb=()=>({state:e,dispatch:t})=>Cv(e,t),lb=()=>({commands:e})=>e.keyboardShortcut(`Enter`),ub=()=>({state:e,dispatch:t})=>Vv(e,t);function db(e,t,n={strict:!0}){let r=Object.keys(t);return r.length?r.every(r=>n.strict?t[r]===e[r]:jy(t[r])?t[r].test(e[r]):t[r]===e[r]):!0}function fb(e,t,n={}){return e.find(e=>e.type===t&&db(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function pb(e,t,n={}){return!!fb(e,t,n)}function mb(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(e=>e.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t)||(n||=r.node.marks[0]?.attrs,!fb([...r.node.marks],t,n)))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;for(;i>0&&pb([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&pb([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function hb(e,t){if(typeof e==`string`){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var gb=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=hb(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=mb(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=G.create(o,e.from,e.to);n.setSelection(t)}}return!0},_b=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function vb(e){return e instanceof G}function yb(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function bb(e,t=null){if(!t)return null;let n=W.atStart(e),r=W.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?G.create(e,yb(0,i,a),yb(e.content.size,i,a)):G.create(e,yb(t,i,a),yb(t,i,a))}function xb(){return navigator.platform===`Android`||/android/i.test(navigator.userAgent)}function Sb(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function Cb(){return typeof navigator<`u`?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var wb=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(Sb()||xb())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),Cb()&&!Sb()&&!xb()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&e===null||e===!1)return!0;if(a&&e===null&&!vb(n.state.selection))return o(),!0;let s=bb(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Tb=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),Eb=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),Db=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&Db(r)}return e};function Ob(e){let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return Db(n)}function kb(e,t,n){if(e instanceof od||e instanceof V)return e;n={slice:!0,parseOptions:{},...n};let r=typeof e==`object`&&!!e,i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return V.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error(`[tiptap error]: Invalid JSON content`,{cause:r});return console.warn(`[tiptap warn]: Invalid content.`,`Passed value:`,e,`Error:`,r),kb(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new jd({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:`inline*`,group:`block`,parseDOM:[{tag:`*`,getAttrs:e=>(r=!0,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?Fd.fromSchema(a).parseSlice(Ob(e),n.parseOptions):Fd.fromSchema(a).parse(Ob(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=Fd.fromSchema(t);return n.slice?r.parseSlice(Ob(e),n.parseOptions).content:r.parse(Ob(e),n.parseOptions)}return kb(``,t,n)}function Ab(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof Cf||i instanceof wf))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(W.near(e.doc.resolve(o),n))}var jb=e=>!(`type`in e),Mb=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{kb(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=kb(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0;if((jb(i)?i:[i]).forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let f;if(u){if(Array.isArray(t))f=t.map(e=>e.text||``).join(``);else if(t instanceof V){let e=``;t.forEach(t=>{t.text&&(e+=t.text)}),f=e}else f=typeof t==`object`&&t&&t.text?t.text:t;r.insertText(f,c,l)}else f=i,r.replaceWith(c,l,f);n.updateSelection&&Ab(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:f}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:f})}return!0},Nb=()=>({state:e,dispatch:t})=>Iv(e,t),Pb=()=>({state:e,dispatch:t})=>Lv(e,t),Fb=()=>({state:e,dispatch:t})=>Tv(e,t),Ib=()=>({state:e,dispatch:t})=>Nv(e,t),Lb=()=>({state:e,dispatch:t,tr:n})=>{try{let r=qf(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},Rb=()=>({state:e,dispatch:t,tr:n})=>{try{let r=qf(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},zb=()=>({state:e,dispatch:t})=>Ev(e,t),Bb=()=>({state:e,dispatch:t})=>Dv(e,t);function Vb(){return typeof navigator<`u`?/Mac/.test(navigator.platform):!1}function Hb(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e+=1){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))Sb()||Vb()?o=!0:i=!0;else throw Error(`Unrecognized modifier name: ${n}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var Ub=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=Hb(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function Wb(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?vy(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>o?o.name===e.node.type.name:!0).filter(e=>db(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var Gb=(e,t={})=>({state:n,dispatch:r})=>Wb(n,vy(e,n.schema),t)?Rv(n,r):!1,Kb=()=>({state:e,dispatch:t})=>Uv(e,t),qb=e=>({state:t,dispatch:n})=>ly(vy(e,t.schema))(t,n),Jb=()=>({state:e,dispatch:t})=>zv(e,t);function Yb(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function Xb(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var Zb=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=Yb(typeof e==`string`?e:e.name,r.schema);return s?(s===`node`&&(a=vy(e,r.schema)),s===`mark`&&(o=hb(e,r.schema)),i&&n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&n.setNodeMarkup(r,void 0,Xb(e.attrs,t)),o&&e.marks.length&&e.marks.forEach(i=>{o===i.type&&n.addMark(r,r+e.nodeSize,o.create(Xb(i.attrs,t)))})})}),!0):!1},Qb=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),$b=()=>({tr:e,dispatch:t})=>{if(t){let t=new Sp(e.doc);e.setSelection(t)}return!0},ex=()=>({state:e,dispatch:t})=>Av(e,t),tx=()=>({state:e,dispatch:t})=>Pv(e,t),nx=()=>({state:e,dispatch:t})=>Kv(e,t),rx=()=>({state:e,dispatch:t})=>Qv(e,t),ix=()=>({state:e,dispatch:t})=>Zv(e,t);function ax(e,t,n={},r={}){return kb(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var ox=(e,t=!1,n={},r={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(n.preserveWhitespace!==`full`){let s=ax(e,i.schema,n,{errorOnInvalidContent:r.errorOnInvalidContent??i.options.enableContentCheck});return o&&a.replaceWith(0,c.content.size,s).setMeta(`preventUpdate`,!t),!0}return o&&a.setMeta(`preventUpdate`,!t),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent??i.options.enableContentCheck})};function sx(e,t){let n=hb(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function cx(e,t){let n=new hp(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function lx(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function ux(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function dx(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function fx(e){return t=>dx(t.$from,e)}function px(e,t){return Xy(e,{from:0,to:e.content.size},t)}function mx(e,t){let n=vy(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function hx(e,t){let n=Yb(typeof t==`string`?t:t.name,e.schema);return n===`node`?mx(e,t):n===`mark`?sx(e,t):{}}function gx(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function _x(e){let t=gx(e);return t.length===1?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function vx(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,i)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(e===void 0||t===void 0)return;a.push({from:e,to:t})}a.forEach(({from:e,to:n})=>{let a=t.slice(i).map(e,-1),o=t.slice(i).map(n),s=t.invert().map(a,-1),c=t.invert().map(o);r.push({oldRange:{from:s,to:c},newRange:{from:a,to:o}})})}),_x(r)}function yx(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=mb(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{!e||e?.nodeSize===void 0||r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}function bx(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return r?r.attribute.keepOnSplit:!1}))}function xx(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?hb(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>a?a.name===e.type.name:!0).find(e=>db(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize),c=a-n;o+=c,s.push(...e.marks.map(e=>({mark:e,from:n,to:a})))})}),o===0)return!1;let c=s.filter(e=>a?a.name===e.mark.type.name:!0).filter(e=>db(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>a?e.mark.type!==a&&e.mark.type.excludes(a):!0).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}function Sx(e,t,n={}){if(!t)return Wb(e,null,n)||xx(e,null,n);let r=Yb(t,e.schema);return r===`node`?Wb(e,t,n):r===`mark`?xx(e,t,n):!1}function Cx(e,t){let{nodeExtensions:n}=gy(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=J(q(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`?i.split(` `).includes(`list`):!1}function wx(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return/^\s*$/m.test(e.text??``)}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(wx(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function Tx(e){return e instanceof K}function Ex(e,t,n){let{selection:r}=t,i=null;if(vb(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return!!n.isInSet(t)||!t.some(e=>e.type.excludes(n))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let i=t.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}var Dx=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=hb(e,r.schema);if(i)if(o){let e=sx(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})});return Ex(r,n,c)},Ox=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),kx=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=vy(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>ey(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>ey(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},Ax=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=yb(e,0,n.content.size),i=K.create(n,r);t.setSelection(i)}return!0},jx=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=G.atStart(n).from,o=G.atEnd(n).to,s=yb(r,a,o),c=yb(i,a,o),l=G.create(n,s,c);t.setSelection(l)}return!0},Mx=e=>({state:t,dispatch:n})=>fy(vy(e,t.schema))(t,n);function Nx(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>t?.includes(e.type.name));e.tr.ensureMarks(r)}}var Px=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=bx(l,s.node().type.name,s.node().attrs);if(a instanceof K&&a.node.isBlock)return!s.parentOffset||!Hf(o,s.pos)?!1:(r&&(e&&Nx(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:lx(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=Hf(t.doc,t.mapping.map(s.pos),1,p);if(!p&&!m&&Hf(t.doc,t.mapping.map(s.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(m&&(a instanceof G&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f)){let e=t.mapping.map(s.before()),n=t.doc.resolve(e);s.node(-1).canReplaceWith(n.index(),n.index()+1,f)&&t.setNodeMarkup(t.mapping.map(s.before()),f)}e&&Nx(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},Fx=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=vy(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=V.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=V.from(s.node(t).copy(e));let i=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3,a={...bx(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append(V.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new U(e,4-r,0));let u=-1;n.doc.nodesBetween(l,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(G.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...bx(d,u.type.name,u.attrs),...t},m={...bx(d,s.node().type.name,s.node().attrs),...t};n.delete(s.pos,c.pos);let h=f?[{type:o,attrs:p},{type:f,attrs:m}]:[{type:o,attrs:p}];if(!Hf(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,h).scrollIntoView(),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0},Ix=(e,t)=>{let n=fx(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&Wf(e.doc,n.pos)&&e.join(n.pos),!0},Lx=(e,t)=>{let n=fx(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&Wf(e.doc,r)&&e.join(r),!0},Rx=Object.freeze({__proto__:null,blur:$y,clearContent:eb,clearNodes:tb,command:nb,createParagraphNear:rb,cut:ib,deleteCurrentNode:ab,deleteNode:ob,deleteRange:sb,deleteSelection:cb,enter:lb,exitCode:ub,extendMarkRange:gb,first:_b,focus:wb,forEach:Tb,insertContent:Eb,insertContentAt:Mb,joinBackward:Fb,joinDown:Pb,joinForward:Ib,joinItemBackward:Lb,joinItemForward:Rb,joinTextblockBackward:zb,joinTextblockForward:Bb,joinUp:Nb,keyboardShortcut:Ub,lift:Gb,liftEmptyBlock:Kb,liftListItem:qb,newlineInCode:Jb,resetAttributes:Zb,scrollIntoView:Qb,selectAll:$b,selectNodeBackward:ex,selectNodeForward:tx,selectParentNode:nx,selectTextblockEnd:rx,selectTextblockStart:ix,setContent:ox,setMark:Dx,setMeta:Ox,setNode:kx,setNodeSelection:Ax,setTextSelection:jx,sinkListItem:Mx,splitBlock:Px,splitListItem:Fx,toggleList:(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=vy(e,o.schema),m=vy(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let x=fx(e=>Cx(e.type.name,d))(h);if(y.depth>=1&&x&&y.depth-x.depth<=1){if(x.node.type===p)return l.liftListItem(m);if(Cx(x.node.type.name,d)&&p.validContent(x.node.content)&&s)return c().command(()=>(a.setNodeMarkup(x.pos,p),!0)).command(()=>Ix(a,p)).command(()=>Lx(a,p)).run()}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>Ix(a,p)).command(()=>Lx(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>Ix(a,p)).command(()=>Lx(a,p)).run()},toggleMark:(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=hb(e,r.schema);return xx(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},toggleNode:(e,t,n={})=>({state:r,commands:i})=>{let a=vy(e,r.schema),o=vy(t,r.schema),s=Wb(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},toggleWrap:(e,t={})=>({state:n,commands:r})=>{let i=vy(e,n.schema);return Wb(n,i,t)?r.lift(i):r.wrapIn(i,t)},undoInputRule:()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let t=e.tr,n=a.transform;for(let e=n.steps.length-1;e>=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},unsetAllMarks:()=>({tr:e,dispatch:t})=>{let{selection:n}=e,{empty:r,ranges:i}=n;return r||t&&i.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0},unsetMark:(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=hb(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=mb(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},updateAttributes:(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=Yb(typeof e==`string`?e:e.name,r.schema);return s?(s===`node`&&(a=vy(e,r.schema)),s===`mark`&&(o=hb(e,r.schema)),i&&n.selection.ranges.forEach(e=>{let i=e.$from.pos,s=e.$to.pos,c,l,u,d;n.selection.empty?r.doc.nodesBetween(i,s,(e,t)=>{a&&a===e.type&&(u=Math.max(t,i),d=Math.min(t+e.nodeSize,s),c=t,l=e)}):r.doc.nodesBetween(i,s,(e,r)=>{r<i&&a&&a===e.type&&(u=Math.max(r,i),d=Math.min(r+e.nodeSize,s),c=r,l=e),r>=i&&r<=s&&(a&&a===e.type&&n.setNodeMarkup(r,void 0,{...e.attrs,...t}),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type){let c=Math.max(r,i),l=Math.min(r+e.nodeSize,s);n.addMark(c,l,o.create({...a.attrs,...t}))}}))}),l&&(c!==void 0&&n.setNodeMarkup(c,void 0,{...l.attrs,...t}),o&&l.marks.length&&l.marks.forEach(e=>{o===e.type&&n.addMark(u,d,o.create({...e.attrs,...t}))}))}),!0):!1},wrapIn:(e,t={})=>({state:n,dispatch:r})=>$v(vy(e,n.schema),t)(n,r),wrapInList:(e,t={})=>({state:n,dispatch:r})=>oy(vy(e,n.schema),t)(n,r)}),zx=Yy.create({name:`commands`,addCommands(){return{...Rx}}}),Bx=Yy.create({name:`drop`,addProseMirrorPlugins(){return[new Ip({key:new zp(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),Vx=Yy.create({name:`editable`,addProseMirrorPlugins(){return[new Ip({key:new zp(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),Hx=new zp(`focusEvents`),Ux=Yy.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new Ip({key:Hx,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta(`focus`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta(`blur`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1}}}})]}}),Wx=Yy.create({name:`keymap`,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:W.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Sb()||Vb()?i:r},addProseMirrorPlugins(){return[new Ip({key:new zp(`clearDocument`),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta(`composition`)))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=W.atStart(t.doc).from,l=W.atEnd(t.doc).to;if(a||!(o===c&&s===l)||!wx(n.doc))return;let u=n.tr,d=py({state:n,transaction:u}),{commands:f}=new my({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),Gx=Yy.create({name:`paste`,addProseMirrorPlugins(){return[new Ip({key:new zp(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),Kx=Yy.create({name:`tabindex`,addProseMirrorPlugins(){return[new Ip({key:new zp(`tabindex`),props:{attributes:()=>this.editor.isEditable?{tabindex:`0`}:{}}})]}}),qx=Object.freeze({__proto__:null,ClipboardTextSerializer:Qy,Commands:zx,Drop:Bx,Editable:Vx,FocusEvents:Ux,Keymap:Wx,Paste:Gx,Tabindex:Kx,focusEventsPluginKey:Hx}),Jx=class e{get name(){return this.node.type.name}constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){return this.actualDepth??this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=this.pos+r+ +!a;if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;let s=this.resolvedPos.doc.resolve(o);if(!i&&s.depth<=this.depth)return;let c=new e(s,this.editor,i,i?n:null);i&&(c.actualDepth=this.depth+1),t.push(new e(s,this.editor,i,i?n:null))}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||this.children.length===0)return r;let i=Object.keys(t);return this.children.forEach(a=>{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},Yx=`.ProseMirror {
|
|
15
15
|
position: relative;
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -85,64 +85,46 @@ img.ProseMirror-separator {
|
|
|
85
85
|
|
|
86
86
|
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
87
87
|
opacity: 0
|
|
88
|
-
}`;function
|
|
89
|
-
|
|
90
|
-
`,textSerializers:
|
|
91
|
-
`," "],Kw=["{","}","|","\\","^","`"].concat(Uw),Jw=["'"].concat(Kw),hp=["%","/","?",";","#"].concat(Jw),fp=["/","?","#"],Gw=255,pp=/^[+a-z0-9A-Z_-]{0,63}$/,Yw=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,mp={javascript:!0,"javascript:":!0},gp={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Ed(t,e){if(t&&t instanceof Wo)return t;const n=new Wo;return n.parse(t,e),n}Wo.prototype.parse=function(t,e){let n,r,i,s=t;if(s=s.trim(),!e&&t.split("#").length===1){const l=Ww.exec(s);if(l)return this.pathname=l[1],l[2]&&(this.search=l[2]),this}let o=Vw.exec(s);if(o&&(o=o[0],n=o.toLowerCase(),this.protocol=o,s=s.substr(o.length)),(e||o||s.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=s.substr(0,2)==="//",i&&!(o&&mp[o])&&(s=s.substr(2),this.slashes=!0)),!mp[o]&&(i||o&&!gp[o])){let l=-1;for(let p=0;p<fp.length;p++)r=s.indexOf(fp[p]),r!==-1&&(l===-1||r<l)&&(l=r);let c,d;l===-1?d=s.lastIndexOf("@"):d=s.lastIndexOf("@",l),d!==-1&&(c=s.slice(0,d),s=s.slice(d+1),this.auth=c),l=-1;for(let p=0;p<hp.length;p++)r=s.indexOf(hp[p]),r!==-1&&(l===-1||r<l)&&(l=r);l===-1&&(l=s.length),s[l-1]===":"&&l--;const h=s.slice(0,l);s=s.slice(l),this.parseHost(h),this.hostname=this.hostname||"";const f=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!f){const p=this.hostname.split(/\./);for(let m=0,g=p.length;m<g;m++){const b=p[m];if(b&&!b.match(pp)){let v="";for(let _=0,x=b.length;_<x;_++)b.charCodeAt(_)>127?v+="x":v+=b[_];if(!v.match(pp)){const _=p.slice(0,m),x=p.slice(m+1),y=b.match(Yw);y&&(_.push(y[1]),x.unshift(y[2])),x.length&&(s=x.join(".")+s),this.hostname=_.join(".");break}}}}this.hostname.length>Gw&&(this.hostname=""),f&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}const a=s.indexOf("#");a!==-1&&(this.hash=s.substr(a),s=s.slice(0,a));const u=s.indexOf("?");return u!==-1&&(this.search=s.substr(u),s=s.slice(0,u)),s&&(this.pathname=s),gp[n]&&this.hostname&&!this.pathname&&(this.pathname=""),this};Wo.prototype.parseHost=function(t){let e=qw.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};const Zw=Object.freeze(Object.defineProperty({__proto__:null,decode:oi,encode:_s,format:Cd,parse:Ed},Symbol.toStringTag,{value:"Module"})),T1=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,D1=/[\0-\x1F\x7F-\x9F]/,Xw=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,Sd=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,O1=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,R1=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,Qw=Object.freeze(Object.defineProperty({__proto__:null,Any:T1,Cc:D1,Cf:Xw,P:Sd,S:O1,Z:R1},Symbol.toStringTag,{value:"Module"})),e6=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(t=>t.charCodeAt(0))),t6=new Uint16Array("Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map(t=>t.charCodeAt(0)));var zu;const n6=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),r6=(zu=String.fromCodePoint)!==null&&zu!==void 0?zu:function(t){let e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|t&1023),e+=String.fromCharCode(t),e};function i6(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=n6.get(t))!==null&&e!==void 0?e:t}var Fe;(function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"})(Fe||(Fe={}));const s6=32;var $n;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})($n||($n={}));function fc(t){return t>=Fe.ZERO&&t<=Fe.NINE}function o6(t){return t>=Fe.UPPER_A&&t<=Fe.UPPER_F||t>=Fe.LOWER_A&&t<=Fe.LOWER_F}function a6(t){return t>=Fe.UPPER_A&&t<=Fe.UPPER_Z||t>=Fe.LOWER_A&&t<=Fe.LOWER_Z||fc(t)}function u6(t){return t===Fe.EQUALS||a6(t)}var Ne;(function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"})(Ne||(Ne={}));var Nn;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(Nn||(Nn={}));class l6{constructor(e,n,r){this.decodeTree=e,this.emitCodePoint=n,this.errors=r,this.state=Ne.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Nn.Strict}startEntity(e){this.decodeMode=e,this.state=Ne.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,n){switch(this.state){case Ne.EntityStart:return e.charCodeAt(n)===Fe.NUM?(this.state=Ne.NumericStart,this.consumed+=1,this.stateNumericStart(e,n+1)):(this.state=Ne.NamedEntity,this.stateNamedEntity(e,n));case Ne.NumericStart:return this.stateNumericStart(e,n);case Ne.NumericDecimal:return this.stateNumericDecimal(e,n);case Ne.NumericHex:return this.stateNumericHex(e,n);case Ne.NamedEntity:return this.stateNamedEntity(e,n)}}stateNumericStart(e,n){return n>=e.length?-1:(e.charCodeAt(n)|s6)===Fe.LOWER_X?(this.state=Ne.NumericHex,this.consumed+=1,this.stateNumericHex(e,n+1)):(this.state=Ne.NumericDecimal,this.stateNumericDecimal(e,n))}addToNumericResult(e,n,r,i){if(n!==r){const s=r-n;this.result=this.result*Math.pow(i,s)+parseInt(e.substr(n,s),i),this.consumed+=s}}stateNumericHex(e,n){const r=n;for(;n<e.length;){const i=e.charCodeAt(n);if(fc(i)||o6(i))n+=1;else return this.addToNumericResult(e,r,n,16),this.emitNumericEntity(i,3)}return this.addToNumericResult(e,r,n,16),-1}stateNumericDecimal(e,n){const r=n;for(;n<e.length;){const i=e.charCodeAt(n);if(fc(i))n+=1;else return this.addToNumericResult(e,r,n,10),this.emitNumericEntity(i,2)}return this.addToNumericResult(e,r,n,10),-1}emitNumericEntity(e,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===Fe.SEMI)this.consumed+=1;else if(this.decodeMode===Nn.Strict)return 0;return this.emitCodePoint(i6(this.result),this.consumed),this.errors&&(e!==Fe.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,n){const{decodeTree:r}=this;let i=r[this.treeIndex],s=(i&$n.VALUE_LENGTH)>>14;for(;n<e.length;n++,this.excess++){const o=e.charCodeAt(n);if(this.treeIndex=c6(r,i,this.treeIndex+Math.max(1,s),o),this.treeIndex<0)return this.result===0||this.decodeMode===Nn.Attribute&&(s===0||u6(o))?0:this.emitNotTerminatedNamedEntity();if(i=r[this.treeIndex],s=(i&$n.VALUE_LENGTH)>>14,s!==0){if(o===Fe.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==Nn.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:n,decodeTree:r}=this,i=(r[n]&$n.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,n,r){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[e]&~$n.VALUE_LENGTH:i[e+1],r),n===3&&this.emitCodePoint(i[e+2],r),r}end(){var e;switch(this.state){case Ne.NamedEntity:return this.result!==0&&(this.decodeMode!==Nn.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Ne.NumericDecimal:return this.emitNumericEntity(0,2);case Ne.NumericHex:return this.emitNumericEntity(0,3);case Ne.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Ne.EntityStart:return 0}}}function N1(t){let e="";const n=new l6(t,r=>e+=r6(r));return function(i,s){let o=0,a=0;for(;(a=i.indexOf("&",a))>=0;){e+=i.slice(o,a),n.startEntity(s);const l=n.write(i,a+1);if(l<0){o=a+n.end();break}o=a+l,a=l===0?o+1:o}const u=e+i.slice(o);return e="",u}}function c6(t,e,n,r){const i=(e&$n.BRANCH_LENGTH)>>7,s=e&$n.JUMP_TABLE;if(i===0)return s!==0&&r===s?n:-1;if(s){const u=r-s;return u<0||u>=i?-1:t[n+u]-1}let o=n,a=o+i-1;for(;o<=a;){const u=o+a>>>1,l=t[u];if(l<r)o=u+1;else if(l>r)a=u-1;else return t[u+i]}return-1}const d6=N1(e6);N1(t6);function F1(t,e=Nn.Legacy){return d6(t,e)}function h6(t){return Object.prototype.toString.call(t)}function Ad(t){return h6(t)==="[object String]"}const f6=Object.prototype.hasOwnProperty;function p6(t,e){return f6.call(t,e)}function Ha(t){return Array.prototype.slice.call(arguments,1).forEach(function(n){if(n){if(typeof n!="object")throw new TypeError(n+"must be object");Object.keys(n).forEach(function(r){t[r]=n[r]})}}),t}function I1(t,e,n){return[].concat(t.slice(0,e),n,t.slice(e+1))}function Md(t){return!(t>=55296&&t<=57343||t>=64976&&t<=65007||(t&65535)===65535||(t&65535)===65534||t>=0&&t<=8||t===11||t>=14&&t<=31||t>=127&&t<=159||t>1114111)}function Uo(t){if(t>65535){t-=65536;const e=55296+(t>>10),n=56320+(t&1023);return String.fromCharCode(e,n)}return String.fromCharCode(t)}const P1=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,m6=/&([a-z#][a-z0-9]{1,31});/gi,g6=new RegExp(P1.source+"|"+m6.source,"gi"),b6=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function v6(t,e){if(e.charCodeAt(0)===35&&b6.test(e)){const r=e[1].toLowerCase()==="x"?parseInt(e.slice(2),16):parseInt(e.slice(1),10);return Md(r)?Uo(r):t}const n=F1(t);return n!==t?n:t}function y6(t){return t.indexOf("\\")<0?t:t.replace(P1,"$1")}function ai(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(g6,function(e,n,r){return n||v6(e,r)})}const _6=/[&<>"]/,x6=/[&<>"]/g,k6={"&":"&","<":"<",">":">",'"':"""};function w6(t){return k6[t]}function Wn(t){return _6.test(t)?t.replace(x6,w6):t}const C6=/[.?*+^$[\]\\(){}|-]/g;function E6(t){return t.replace(C6,"\\$&")}function ue(t){switch(t){case 9:case 32:return!0}return!1}function ls(t){if(t>=8192&&t<=8202)return!0;switch(t){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function cs(t){return Sd.test(t)||O1.test(t)}function ds(t){switch(t){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function ja(t){return t=t.trim().replace(/\s+/g," "),"ẞ".toLowerCase()==="Ṿ"&&(t=t.replace(/ẞ/g,"ß")),t.toLowerCase().toUpperCase()}const S6={mdurl:Zw,ucmicro:Qw},A6=Object.freeze(Object.defineProperty({__proto__:null,arrayReplaceAt:I1,assign:Ha,escapeHtml:Wn,escapeRE:E6,fromCodePoint:Uo,has:p6,isMdAsciiPunct:ds,isPunctChar:cs,isSpace:ue,isString:Ad,isValidEntityCode:Md,isWhiteSpace:ls,lib:S6,normalizeReference:ja,unescapeAll:ai,unescapeMd:y6},Symbol.toStringTag,{value:"Module"}));function M6(t,e,n){let r,i,s,o;const a=t.posMax,u=t.pos;for(t.pos=e+1,r=1;t.pos<a;){if(s=t.src.charCodeAt(t.pos),s===93&&(r--,r===0)){i=!0;break}if(o=t.pos,t.md.inline.skipToken(t),s===91){if(o===t.pos-1)r++;else if(n)return t.pos=u,-1}}let l=-1;return i&&(l=t.pos),t.pos=u,l}function T6(t,e,n){let r,i=e;const s={ok:!1,pos:0,str:""};if(t.charCodeAt(i)===60){for(i++;i<n;){if(r=t.charCodeAt(i),r===10||r===60)return s;if(r===62)return s.pos=i+1,s.str=ai(t.slice(e+1,i)),s.ok=!0,s;if(r===92&&i+1<n){i+=2;continue}i++}return s}let o=0;for(;i<n&&(r=t.charCodeAt(i),!(r===32||r<32||r===127));){if(r===92&&i+1<n){if(t.charCodeAt(i+1)===32)break;i+=2;continue}if(r===40&&(o++,o>32))return s;if(r===41){if(o===0)break;o--}i++}return e===i||o!==0||(s.str=ai(t.slice(e,i)),s.pos=i,s.ok=!0),s}function D6(t,e,n,r){let i,s=e;const o={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(r)o.str=r.str,o.marker=r.marker;else{if(s>=n)return o;let a=t.charCodeAt(s);if(a!==34&&a!==39&&a!==40)return o;e++,s++,a===40&&(a=41),o.marker=a}for(;s<n;){if(i=t.charCodeAt(s),i===o.marker)return o.pos=s+1,o.str+=ai(t.slice(e,s)),o.ok=!0,o;if(i===40&&o.marker===41)return o;i===92&&s+1<n&&s++,s++}return o.can_continue=!0,o.str+=ai(t.slice(e,s)),o}const O6=Object.freeze(Object.defineProperty({__proto__:null,parseLinkDestination:T6,parseLinkLabel:M6,parseLinkTitle:D6},Symbol.toStringTag,{value:"Module"})),Zt={};Zt.code_inline=function(t,e,n,r,i){const s=t[e];return"<code"+i.renderAttrs(s)+">"+Wn(s.content)+"</code>"};Zt.code_block=function(t,e,n,r,i){const s=t[e];return"<pre"+i.renderAttrs(s)+"><code>"+Wn(t[e].content)+`</code></pre>
|
|
92
|
-
`}
|
|
93
|
-
`;if(o){
|
|
94
|
-
`}return`<pre><code${i.renderAttrs(s)}>${l}</code></pre>
|
|
95
|
-
`};Zt.image=function(t,e,n,r,i){const s=t[e];return s.attrs[s.attrIndex("alt")][1]=i.renderInlineAsText(s.children,n,r),i.renderToken(t,e,n)};Zt.hardbreak=function(t,e,n){return n.xhtmlOut?`<br />
|
|
88
|
+
}`;function Xx(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:``}]`);if(r!==null)return r;let i=document.createElement(`style`);return t&&i.setAttribute(`nonce`,t),i.setAttribute(`data-tiptap-style${n?`-${n}`:``}`,``),i.innerHTML=e,document.getElementsByTagName(`head`)[0].appendChild(i),i}var Zx=class extends hy{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement(`div`),content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit(`beforeCreate`,{editor:this}),this.on(`contentError`,this.options.onContentError),this.createView(),this.injectCSS(),this.on(`create`,this.options.onCreate),this.on(`update`,this.options.onUpdate),this.on(`selectionUpdate`,this.options.onSelectionUpdate),this.on(`transaction`,this.options.onTransaction),this.on(`focus`,this.options.onFocus),this.on(`blur`,this.options.onBlur),this.on(`destroy`,this.options.onDestroy),this.on(`drop`,({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit(`create`,{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=Xx(Yx,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit(`update`,{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){let n=xy(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t=typeof e==`string`?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){let e=[...this.options.enableCoreExtensions?[Vx,Qy.configure({blockSeparator:this.options.coreExtensionOptions?.clipboardTextSerializer?.blockSeparator}),zx,Ux,Wx,Kx,Bx,Gx].filter(e=>typeof this.options.enableCoreExtensions==`object`?this.options.enableCoreExtensions[e.name]!==!1:!0):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type));this.extensionManager=new Jy(e,this)}createCommandManager(){this.commandManager=new my({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){let e;try{e=ax(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||![`[tiptap error]: Invalid JSON content`,`[tiptap error]: Invalid HTML content`].includes(t.message))throw t;this.emit(`contentError`,{editor:this,error:t,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>e.name!==`collaboration`),this.createExtensionManager()}}),e=ax(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}let t=bb(e,this.options.autofocus);this.view=new tv(this.options.element,{...this.options.editorProps,attributes:{role:`textbox`,...this.options.editorProps?.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:Pp.create({doc:e,selection:t||void 0})});let n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.createNodeViews(),this.prependClass();let r=this.view.dom;r.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>this.capturedTransaction?.step(e));return}let t=this.state.apply(e),n=!this.state.selection.eq(t.selection);this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e}),n&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let r=e.getMeta(`focus`),i=e.getMeta(`blur`);r&&this.emit(`focus`,{editor:this,event:r.event,transaction:e}),i&&this.emit(`blur`,{editor:this,event:i.event,transaction:e}),!(!e.docChanged||e.getMeta(`preventUpdate`))&&this.emit(`update`,{editor:this,transaction:e})}getAttributes(e){return hx(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return Sx(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return ky(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
|
|
89
|
+
|
|
90
|
+
`,textSerializers:n={}}=e||{};return px(this.state.doc,{blockSeparator:t,textSerializers:{...Zy(this.schema),...n}})}get isEmpty(){return wx(this.state.doc)}getCharacterCount(){return console.warn(`[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.`),this.state.doc.content.size-2}destroy(){if(this.emit(`destroy`),this.view){let e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){return!this.view?.docView}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){return new Jx(this.state.doc.resolve(e),this)}get $doc(){return this.$pos(0)}};function Qx(e){return new My({find:e.find,handler:({state:t,range:n,match:r})=>{let i=J(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(yx(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}}})}function $x(e){return new My({find:e.find,handler:({state:t,range:n,match:r})=>{let i=J(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()}})}function eS(e){return new My({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=J(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)}})}function tS(e){return new My({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=J(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&Mf(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&Wf(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)}})}var Y=class e{constructor(e={}){this.type=`node`,this.name=`node`,this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=J(q(this,`addOptions`,{name:this.name}))),this.storage=J(q(this,`addStorage`,{name:this.name,options:this.options}))||{}}static create(t={}){return new e(t)}configure(e={}){let t=this.extend({...this.config,addOptions:()=>Ry(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(t={}){let n=new e(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=J(q(n,`addOptions`,{name:n.name})),n.storage=J(q(n,`addStorage`,{name:n.name,options:n.options})),n}};function nS(e){return new Vy({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=J(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let r=c.search(/\S/),i=n.from+c.indexOf(s),u=i+s.length;if(yx(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>i).length)return null;u<n.to&&o.delete(u,n.to),i>n.from&&o.delete(n.from+r,i),l=n.from+r+s.length,o.addMark(n.from+r,l,e.type.create(a||{})),o.removeStoredMark(e.type)}}})}function rS(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof K){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;--i}return!1}function iS(e){return new Vy({find:e.find,handler({match:t,chain:n,range:r,pasteEvent:i}){let a=J(e.getAttributes,void 0,t,i),o=J(e.getContent,void 0,a);if(a===!1||a===null)return null;let s={type:e.type.name,attrs:a};o&&(s.content=o),t.input&&n().deleteRange(r).insertContentAt(r.from,s)}})}var aS={};function oS(e){let t=aS[e];if(t)return t;t=aS[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);t.push(n)}for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[r]=`%`+(`0`+r.toString(16).toUpperCase()).slice(-2)}return t}function sS(e,t){typeof t!=`string`&&(t=sS.defaultChars);let n=oS(t);return e.replace(/(%[a-f0-9]{2})+/gi,function(e){let t=``;for(let r=0,i=e.length;r<i;r+=3){let a=parseInt(e.slice(r+1,r+3),16);if(a<128){t+=n[a];continue}if((a&224)==192&&r+3<i){let n=parseInt(e.slice(r+4,r+6),16);if((n&192)==128){let e=a<<6&1984|n&63;e<128?t+=`��`:t+=String.fromCharCode(e),r+=3;continue}}if((a&240)==224&&r+6<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16);if((n&192)==128&&(i&192)==128){let e=a<<12&61440|n<<6&4032|i&63;e<2048||e>=55296&&e<=57343?t+=`���`:t+=String.fromCharCode(e),r+=6;continue}}if((a&248)==240&&r+9<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16),o=parseInt(e.slice(r+10,r+12),16);if((n&192)==128&&(i&192)==128&&(o&192)==128){let e=a<<18&1835008|n<<12&258048|i<<6&4032|o&63;e<65536||e>1114111?t+=`����`:(e-=65536,t+=String.fromCharCode(55296+(e>>10),56320+(e&1023))),r+=9;continue}}t+=`�`}return t})}sS.defaultChars=`;/?:@&=+$,#`,sS.componentChars=``;var cS={};function lS(e){let t=cS[e];if(t)return t;t=cS[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);/^[0-9a-z]$/i.test(n)?t.push(n):t.push(`%`+(`0`+e.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<e.length;n++)t[e.charCodeAt(n)]=e[n];return t}function uS(e,t,n){typeof t!=`string`&&(n=t,t=uS.defaultChars),n===void 0&&(n=!0);let r=lS(t),i=``;for(let t=0,a=e.length;t<a;t++){let o=e.charCodeAt(t);if(n&&o===37&&t+2<a&&/^[0-9a-f]{2}$/i.test(e.slice(t+1,t+3))){i+=e.slice(t,t+3),t+=2;continue}if(o<128){i+=r[o];continue}if(o>=55296&&o<=57343){if(o>=55296&&o<=56319&&t+1<a){let n=e.charCodeAt(t+1);if(n>=56320&&n<=57343){i+=encodeURIComponent(e[t]+e[t+1]),t++;continue}}i+=`%EF%BF%BD`;continue}i+=encodeURIComponent(e[t])}return i}uS.defaultChars=`;/?:@&=+$,-_.!~*'()#`,uS.componentChars=`-_.!~*'()`;function dS(e){let t=``;return t+=e.protocol||``,t+=e.slashes?`//`:``,t+=e.auth?e.auth+`@`:``,e.hostname&&e.hostname.indexOf(`:`)!==-1?t+=`[`+e.hostname+`]`:t+=e.hostname||``,t+=e.port?`:`+e.port:``,t+=e.pathname||``,t+=e.search||``,t+=e.hash||``,t}function fS(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var pS=/^([a-z0-9.+-]+:)/i,mS=/:[0-9]*$/,hS=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,gS=[`%`,`/`,`?`,`;`,`#`,`'`,`{`,`}`,`|`,`\\`,`^`,"`",`<`,`>`,`"`,"`",` `,`\r`,`
|
|
91
|
+
`,` `],_S=[`/`,`?`,`#`],vS=255,yS=/^[+a-z0-9A-Z_-]{0,63}$/,bS=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,xS={javascript:!0,"javascript:":!0},SS={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function CS(e,t){if(e&&e instanceof fS)return e;let n=new fS;return n.parse(e,t),n}fS.prototype.parse=function(e,t){let n,r,i,a=e;if(a=a.trim(),!t&&e.split(`#`).length===1){let e=hS.exec(a);if(e)return this.pathname=e[1],e[2]&&(this.search=e[2]),this}let o=pS.exec(a);if(o&&(o=o[0],n=o.toLowerCase(),this.protocol=o,a=a.substr(o.length)),(t||o||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=a.substr(0,2)===`//`,i&&!(o&&xS[o])&&(a=a.substr(2),this.slashes=!0)),!xS[o]&&(i||o&&!SS[o])){let e=-1;for(let t=0;t<_S.length;t++)r=a.indexOf(_S[t]),r!==-1&&(e===-1||r<e)&&(e=r);let t,n;n=e===-1?a.lastIndexOf(`@`):a.lastIndexOf(`@`,e),n!==-1&&(t=a.slice(0,n),a=a.slice(n+1),this.auth=t),e=-1;for(let t=0;t<gS.length;t++)r=a.indexOf(gS[t]),r!==-1&&(e===-1||r<e)&&(e=r);e===-1&&(e=a.length),a[e-1]===`:`&&e--;let i=a.slice(0,e);a=a.slice(e),this.parseHost(i),this.hostname=this.hostname||``;let o=this.hostname[0]===`[`&&this.hostname[this.hostname.length-1]===`]`;if(!o){let e=this.hostname.split(/\./);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n&&!n.match(yS)){let r=``;for(let e=0,t=n.length;e<t;e++)n.charCodeAt(e)>127?r+=`x`:r+=n[e];if(!r.match(yS)){let r=e.slice(0,t),i=e.slice(t+1),o=n.match(bS);o&&(r.push(o[1]),i.unshift(o[2])),i.length&&(a=i.join(`.`)+a),this.hostname=r.join(`.`);break}}}}this.hostname.length>vS&&(this.hostname=``),o&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let s=a.indexOf(`#`);s!==-1&&(this.hash=a.substr(s),a=a.slice(0,s));let c=a.indexOf(`?`);return c!==-1&&(this.search=a.substr(c),a=a.slice(0,c)),a&&(this.pathname=a),SS[n]&&this.hostname&&!this.pathname&&(this.pathname=``),this},fS.prototype.parseHost=function(e){let t=mS.exec(e);t&&(t=t[0],t!==`:`&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var wS=r({decode:()=>sS,encode:()=>uS,format:()=>dS,parse:()=>CS}),TS=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,ES=/[\0-\x1F\x7F-\x9F]/,DS=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,OS=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,kS=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,AS=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,jS=r({Any:()=>TS,Cc:()=>ES,Cf:()=>DS,P:()=>OS,S:()=>kS,Z:()=>AS}),MS=new Uint16Array(`ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻\xA0ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌`.split(``).map(e=>e.charCodeAt(0))),NS=new Uint16Array(`Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢`.split(``).map(e=>e.charCodeAt(0))),PS=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),FS=String.fromCodePoint??function(e){let t=``;return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t};function IS(e){return e>=55296&&e<=57343||e>1114111?65533:PS.get(e)??e}var LS;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(LS||={});var RS=32,zS;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(zS||={});function BS(e){return e>=LS.ZERO&&e<=LS.NINE}function VS(e){return e>=LS.UPPER_A&&e<=LS.UPPER_F||e>=LS.LOWER_A&&e<=LS.LOWER_F}function HS(e){return e>=LS.UPPER_A&&e<=LS.UPPER_Z||e>=LS.LOWER_A&&e<=LS.LOWER_Z||BS(e)}function US(e){return e===LS.EQUALS||HS(e)}var WS;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(WS||={});var GS;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(GS||={});var KS=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=WS.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=GS.Strict}startEntity(e){this.decodeMode=e,this.state=WS.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case WS.EntityStart:return e.charCodeAt(t)===LS.NUM?(this.state=WS.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=WS.NamedEntity,this.stateNamedEntity(e,t));case WS.NumericStart:return this.stateNumericStart(e,t);case WS.NumericDecimal:return this.stateNumericDecimal(e,t);case WS.NumericHex:return this.stateNumericHex(e,t);case WS.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|RS)===LS.LOWER_X?(this.state=WS.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=WS.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*r**+i+parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(BS(r)||VS(r))t+=1;else return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(r,3)}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(BS(r))t+=1;else return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(r,2)}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)==null||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===LS.SEMI)this.consumed+=1;else if(this.decodeMode===GS.Strict)return 0;return this.emitCodePoint(IS(this.result),this.consumed),this.errors&&(e!==LS.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&zS.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let a=e.charCodeAt(t);if(this.treeIndex=JS(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===GS.Attribute&&(i===0||US(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&zS.VALUE_LENGTH)>>14,i!==0){if(a===LS.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==GS.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&zS.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~zS.VALUE_LENGTH:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case WS.NamedEntity:return this.result!==0&&(this.decodeMode!==GS.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case WS.NumericDecimal:return this.emitNumericEntity(0,2);case WS.NumericHex:return this.emitNumericEntity(0,3);case WS.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case WS.EntityStart:return 0}}};function qS(e){let t=``,n=new KS(e,e=>t+=FS(e));return function(e,r){let i=0,a=0;for(;(a=e.indexOf(`&`,a))>=0;){t+=e.slice(i,a),n.startEntity(r);let o=n.write(e,a+1);if(o<0){i=a+n.end();break}i=a+o,a=o===0?i+1:i}let o=t+e.slice(i);return t=``,o}}function JS(e,t,n,r){let i=(t&zS.BRANCH_LENGTH)>>7,a=t&zS.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=n,s=o+i-1;for(;o<=s;){let t=o+s>>>1,n=e[t];if(n<r)o=t+1;else if(n>r)s=t-1;else return e[t+i]}return-1}var YS=qS(MS);qS(NS);function XS(e,t=GS.Legacy){return YS(e,t)}var ZS=r({arrayReplaceAt:()=>rC,assign:()=>nC,escapeHtml:()=>gC,escapeRE:()=>vC,fromCodePoint:()=>aC,has:()=>tC,isMdAsciiPunct:()=>xC,isPunctChar:()=>bC,isSpace:()=>X,isString:()=>$S,isValidEntityCode:()=>iC,isWhiteSpace:()=>yC,lib:()=>CC,normalizeReference:()=>SC,unescapeAll:()=>dC,unescapeMd:()=>uC});function QS(e){return Object.prototype.toString.call(e)}function $S(e){return QS(e)===`[object String]`}var eC=Object.prototype.hasOwnProperty;function tC(e,t){return eC.call(e,t)}function nC(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){if(t){if(typeof t!=`object`)throw TypeError(t+`must be object`);Object.keys(t).forEach(function(n){e[n]=t[n]})}}),e}function rC(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function iC(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function aC(e){if(e>65535){e-=65536;let t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var oC=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,sC=RegExp(oC.source+`|&([a-z#][a-z0-9]{1,31});`,`gi`),cC=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function lC(e,t){if(t.charCodeAt(0)===35&&cC.test(t)){let n=t[1].toLowerCase()===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return iC(n)?aC(n):e}let n=XS(e);return n===e?e:n}function uC(e){return e.indexOf(`\\`)<0?e:e.replace(oC,`$1`)}function dC(e){return e.indexOf(`\\`)<0&&e.indexOf(`&`)<0?e:e.replace(sC,function(e,t,n){return t||lC(e,n)})}var fC=/[&<>"]/,pC=/[&<>"]/g,mC={"&":`&`,"<":`<`,">":`>`,'"':`"`};function hC(e){return mC[e]}function gC(e){return fC.test(e)?e.replace(pC,hC):e}var _C=/[.?*+^$[\]\\(){}|-]/g;function vC(e){return e.replace(_C,`\\$&`)}function X(e){switch(e){case 9:case 32:return!0}return!1}function yC(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function bC(e){return OS.test(e)||kS.test(e)}function xC(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function SC(e){return e=e.trim().replace(/\s+/g,` `),e.toLowerCase().toUpperCase()}var CC={mdurl:wS,ucmicro:jS};function wC(e,t,n){let r,i,a,o,s=e.posMax,c=e.pos;for(e.pos=t+1,r=1;e.pos<s;){if(a=e.src.charCodeAt(e.pos),a===93&&(r--,r===0)){i=!0;break}if(o=e.pos,e.md.inline.skipToken(e),a===91){if(o===e.pos-1)r++;else if(n)return e.pos=c,-1}}let l=-1;return i&&(l=e.pos),e.pos=c,l}function TC(e,t,n){let r,i=t,a={ok:!1,pos:0,str:``};if(e.charCodeAt(i)===60){for(i++;i<n;){if(r=e.charCodeAt(i),r===10||r===60)return a;if(r===62)return a.pos=i+1,a.str=dC(e.slice(t+1,i)),a.ok=!0,a;if(r===92&&i+1<n){i+=2;continue}i++}return a}let o=0;for(;i<n&&(r=e.charCodeAt(i),!(r===32||r<32||r===127));){if(r===92&&i+1<n){if(e.charCodeAt(i+1)===32)break;i+=2;continue}if(r===40&&(o++,o>32))return a;if(r===41){if(o===0)break;o--}i++}return t===i||o!==0?a:(a.str=dC(e.slice(t,i)),a.pos=i,a.ok=!0,a)}function EC(e,t,n,r){let i,a=t,o={ok:!1,can_continue:!1,pos:0,str:``,marker:0};if(r)o.str=r.str,o.marker=r.marker;else{if(a>=n)return o;let r=e.charCodeAt(a);if(r!==34&&r!==39&&r!==40)return o;t++,a++,r===40&&(r=41),o.marker=r}for(;a<n;){if(i=e.charCodeAt(a),i===o.marker)return o.pos=a+1,o.str+=dC(e.slice(t,a)),o.ok=!0,o;if(i===40&&o.marker===41)return o;i===92&&a+1<n&&a++,a++}return o.can_continue=!0,o.str+=dC(e.slice(t,a)),o}var DC=r({parseLinkDestination:()=>TC,parseLinkLabel:()=>wC,parseLinkTitle:()=>EC}),OC={};OC.code_inline=function(e,t,n,r,i){let a=e[t];return`<code`+i.renderAttrs(a)+`>`+gC(a.content)+`</code>`},OC.code_block=function(e,t,n,r,i){let a=e[t];return`<pre`+i.renderAttrs(a)+`><code>`+gC(e[t].content)+`</code></pre>
|
|
92
|
+
`},OC.fence=function(e,t,n,r,i){let a=e[t],o=a.info?dC(a.info).trim():``,s=``,c=``;if(o){let e=o.split(/(\s+)/g);s=e[0],c=e.slice(2).join(``)}let l;if(l=n.highlight&&n.highlight(a.content,s,c)||gC(a.content),l.indexOf(`<pre`)===0)return l+`
|
|
93
|
+
`;if(o){let e=a.attrIndex(`class`),t=a.attrs?a.attrs.slice():[];e<0?t.push([`class`,n.langPrefix+s]):(t[e]=t[e].slice(),t[e][1]+=` `+n.langPrefix+s);let r={attrs:t};return`<pre><code${i.renderAttrs(r)}>${l}</code></pre>\n`}return`<pre><code${i.renderAttrs(a)}>${l}</code></pre>\n`},OC.image=function(e,t,n,r,i){let a=e[t];return a.attrs[a.attrIndex(`alt`)][1]=i.renderInlineAsText(a.children,n,r),i.renderToken(e,t,n)},OC.hardbreak=function(e,t,n){return n.xhtmlOut?`<br />
|
|
96
94
|
`:`<br>
|
|
97
|
-
`}
|
|
95
|
+
`},OC.softbreak=function(e,t,n){return n.breaks?n.xhtmlOut?`<br />
|
|
98
96
|
`:`<br>
|
|
99
97
|
`:`
|
|
100
|
-
`}
|
|
101
|
-
`),
|
|
102
|
-
|
|
103
|
-
`;break}return r}
|
|
104
|
-
`),e=e.replace(N6,"�"),t.src=e}function I6(t){let e;t.inlineMode?(e=new t.Token("inline","",0),e.content=t.src,e.map=[0,1],e.children=[],t.tokens.push(e)):t.md.block.parse(t.src,t.md,t.env,t.tokens)}function P6(t){const e=t.tokens;for(let n=0,r=e.length;n<r;n++){const i=e[n];i.type==="inline"&&t.md.inline.parse(i.content,t.md,t.env,i.children)}}function L6(t){return/^<a[>\s]/i.test(t)}function B6(t){return/^<\/a\s*>/i.test(t)}function $6(t){const e=t.tokens;if(t.md.options.linkify)for(let n=0,r=e.length;n<r;n++){if(e[n].type!=="inline"||!t.md.linkify.pretest(e[n].content))continue;let i=e[n].children,s=0;for(let o=i.length-1;o>=0;o--){const a=i[o];if(a.type==="link_close"){for(o--;i[o].level!==a.level&&i[o].type!=="link_open";)o--;continue}if(a.type==="html_inline"&&(L6(a.content)&&s>0&&s--,B6(a.content)&&s++),!(s>0)&&a.type==="text"&&t.md.linkify.test(a.content)){const u=a.content;let l=t.md.linkify.match(u);const c=[];let d=a.level,h=0;l.length>0&&l[0].index===0&&o>0&&i[o-1].type==="text_special"&&(l=l.slice(1));for(let f=0;f<l.length;f++){const p=l[f].url,m=t.md.normalizeLink(p);if(!t.md.validateLink(m))continue;let g=l[f].text;l[f].schema?l[f].schema==="mailto:"&&!/^mailto:/i.test(g)?g=t.md.normalizeLinkText("mailto:"+g).replace(/^mailto:/,""):g=t.md.normalizeLinkText(g):g=t.md.normalizeLinkText("http://"+g).replace(/^http:\/\//,"");const b=l[f].index;if(b>h){const y=new t.Token("text","",0);y.content=u.slice(h,b),y.level=d,c.push(y)}const v=new t.Token("link_open","a",1);v.attrs=[["href",m]],v.level=d++,v.markup="linkify",v.info="auto",c.push(v);const _=new t.Token("text","",0);_.content=g,_.level=d,c.push(_);const x=new t.Token("link_close","a",-1);x.level=--d,x.markup="linkify",x.info="auto",c.push(x),h=l[f].lastIndex}if(h<u.length){const f=new t.Token("text","",0);f.content=u.slice(h),f.level=d,c.push(f)}e[n].children=i=I1(i,o,c)}}}}const B1=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,z6=/\((c|tm|r)\)/i,H6=/\((c|tm|r)\)/ig,j6={c:"©",r:"®",tm:"™"};function V6(t,e){return j6[e.toLowerCase()]}function q6(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];r.type==="text"&&!e&&(r.content=r.content.replace(H6,V6)),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function W6(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];r.type==="text"&&!e&&B1.test(r.content)&&(r.content=r.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1–")),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function U6(t){let e;if(t.md.options.typographer)for(e=t.tokens.length-1;e>=0;e--)t.tokens[e].type==="inline"&&(z6.test(t.tokens[e].content)&&q6(t.tokens[e].children),B1.test(t.tokens[e].content)&&W6(t.tokens[e].children))}const K6=/['"]/,bp=/['"]/g,vp="’";function zs(t,e,n){return t.slice(0,e)+n+t.slice(e+1)}function J6(t,e){let n;const r=[];for(let i=0;i<t.length;i++){const s=t[i],o=t[i].level;for(n=r.length-1;n>=0&&!(r[n].level<=o);n--);if(r.length=n+1,s.type!=="text")continue;let a=s.content,u=0,l=a.length;e:for(;u<l;){bp.lastIndex=u;const c=bp.exec(a);if(!c)break;let d=!0,h=!0;u=c.index+1;const f=c[0]==="'";let p=32;if(c.index-1>=0)p=a.charCodeAt(c.index-1);else for(n=i-1;n>=0&&!(t[n].type==="softbreak"||t[n].type==="hardbreak");n--)if(t[n].content){p=t[n].content.charCodeAt(t[n].content.length-1);break}let m=32;if(u<l)m=a.charCodeAt(u);else for(n=i+1;n<t.length&&!(t[n].type==="softbreak"||t[n].type==="hardbreak");n++)if(t[n].content){m=t[n].content.charCodeAt(0);break}const g=ds(p)||cs(String.fromCharCode(p)),b=ds(m)||cs(String.fromCharCode(m)),v=ls(p),_=ls(m);if(_?d=!1:b&&(v||g||(d=!1)),v?h=!1:g&&(_||b||(h=!1)),m===34&&c[0]==='"'&&p>=48&&p<=57&&(h=d=!1),d&&h&&(d=g,h=b),!d&&!h){f&&(s.content=zs(s.content,c.index,vp));continue}if(h)for(n=r.length-1;n>=0;n--){let x=r[n];if(r[n].level<o)break;if(x.single===f&&r[n].level===o){x=r[n];let y,k;f?(y=e.md.options.quotes[2],k=e.md.options.quotes[3]):(y=e.md.options.quotes[0],k=e.md.options.quotes[1]),s.content=zs(s.content,c.index,k),t[x.token].content=zs(t[x.token].content,x.pos,y),u+=k.length-1,x.token===i&&(u+=y.length-1),a=s.content,l=a.length,r.length=n;continue e}}d?r.push({token:i,pos:c.index,single:f,level:o}):h&&f&&(s.content=zs(s.content,c.index,vp))}}}function G6(t){if(t.md.options.typographer)for(let e=t.tokens.length-1;e>=0;e--)t.tokens[e].type!=="inline"||!K6.test(t.tokens[e].content)||J6(t.tokens[e].children,t)}function Y6(t){let e,n;const r=t.tokens,i=r.length;for(let s=0;s<i;s++){if(r[s].type!=="inline")continue;const o=r[s].children,a=o.length;for(e=0;e<a;e++)o[e].type==="text_special"&&(o[e].type="text");for(e=n=0;e<a;e++)o[e].type==="text"&&e+1<a&&o[e+1].type==="text"?o[e+1].content=o[e].content+o[e+1].content:(e!==n&&(o[n]=o[e]),n++);e!==n&&(o.length=n)}}const Hu=[["normalize",F6],["block",I6],["inline",P6],["linkify",$6],["replacements",U6],["smartquotes",G6],["text_join",Y6]];function Td(){this.ruler=new lt;for(let t=0;t<Hu.length;t++)this.ruler.push(Hu[t][0],Hu[t][1])}Td.prototype.process=function(t){const e=this.ruler.getRules("");for(let n=0,r=e.length;n<r;n++)e[n](t)};Td.prototype.State=L1;function Xt(t,e,n,r){this.src=t,this.md=e,this.env=n,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0;const i=this.src;for(let s=0,o=0,a=0,u=0,l=i.length,c=!1;o<l;o++){const d=i.charCodeAt(o);if(!c)if(ue(d)){a++,d===9?u+=4-u%4:u++;continue}else c=!0;(d===10||o===l-1)&&(d!==10&&o++,this.bMarks.push(s),this.eMarks.push(o),this.tShift.push(a),this.sCount.push(u),this.bsCount.push(0),c=!1,a=0,u=0,s=o+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}Xt.prototype.push=function(t,e,n){const r=new It(t,e,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r};Xt.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]};Xt.prototype.skipEmptyLines=function(e){for(let n=this.lineMax;e<n&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e};Xt.prototype.skipSpaces=function(e){for(let n=this.src.length;e<n;e++){const r=this.src.charCodeAt(e);if(!ue(r))break}return e};Xt.prototype.skipSpacesBack=function(e,n){if(e<=n)return e;for(;e>n;)if(!ue(this.src.charCodeAt(--e)))return e+1;return e};Xt.prototype.skipChars=function(e,n){for(let r=this.src.length;e<r&&this.src.charCodeAt(e)===n;e++);return e};Xt.prototype.skipCharsBack=function(e,n,r){if(e<=r)return e;for(;e>r;)if(n!==this.src.charCodeAt(--e))return e+1;return e};Xt.prototype.getLines=function(e,n,r,i){if(e>=n)return"";const s=new Array(n-e);for(let o=0,a=e;a<n;a++,o++){let u=0;const l=this.bMarks[a];let c=l,d;for(a+1<n||i?d=this.eMarks[a]+1:d=this.eMarks[a];c<d&&u<r;){const h=this.src.charCodeAt(c);if(ue(h))h===9?u+=4-(u+this.bsCount[a])%4:u++;else if(c-l<this.tShift[a])u++;else break;c++}u>r?s[o]=new Array(u-r+1).join(" ")+this.src.slice(c,d):s[o]=this.src.slice(c,d)}return s.join("")};Xt.prototype.Token=It;const Z6=65536;function ju(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];return t.src.slice(n,r)}function yp(t){const e=[],n=t.length;let r=0,i=t.charCodeAt(r),s=!1,o=0,a="";for(;r<n;)i===124&&(s?(a+=t.substring(o,r-1),o=r):(e.push(a+t.substring(o,r)),a="",o=r+1)),s=i===92,r++,i=t.charCodeAt(r);return e.push(a+t.substring(o)),e}function X6(t,e,n,r){if(e+2>n)return!1;let i=e+1;if(t.sCount[i]<t.blkIndent||t.sCount[i]-t.blkIndent>=4)return!1;let s=t.bMarks[i]+t.tShift[i];if(s>=t.eMarks[i])return!1;const o=t.src.charCodeAt(s++);if(o!==124&&o!==45&&o!==58||s>=t.eMarks[i])return!1;const a=t.src.charCodeAt(s++);if(a!==124&&a!==45&&a!==58&&!ue(a)||o===45&&ue(a))return!1;for(;s<t.eMarks[i];){const x=t.src.charCodeAt(s);if(x!==124&&x!==45&&x!==58&&!ue(x))return!1;s++}let u=ju(t,e+1),l=u.split("|");const c=[];for(let x=0;x<l.length;x++){const y=l[x].trim();if(!y){if(x===0||x===l.length-1)continue;return!1}if(!/^:?-+:?$/.test(y))return!1;y.charCodeAt(y.length-1)===58?c.push(y.charCodeAt(0)===58?"center":"right"):y.charCodeAt(0)===58?c.push("left"):c.push("")}if(u=ju(t,e).trim(),u.indexOf("|")===-1||t.sCount[e]-t.blkIndent>=4)return!1;l=yp(u),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop();const d=l.length;if(d===0||d!==c.length)return!1;if(r)return!0;const h=t.parentType;t.parentType="table";const f=t.md.block.ruler.getRules("blockquote"),p=t.push("table_open","table",1),m=[e,0];p.map=m;const g=t.push("thead_open","thead",1);g.map=[e,e+1];const b=t.push("tr_open","tr",1);b.map=[e,e+1];for(let x=0;x<l.length;x++){const y=t.push("th_open","th",1);c[x]&&(y.attrs=[["style","text-align:"+c[x]]]);const k=t.push("inline","",0);k.content=l[x].trim(),k.children=[],t.push("th_close","th",-1)}t.push("tr_close","tr",-1),t.push("thead_close","thead",-1);let v,_=0;for(i=e+2;i<n&&!(t.sCount[i]<t.blkIndent);i++){let x=!1;for(let k=0,w=f.length;k<w;k++)if(f[k](t,i,n,!0)){x=!0;break}if(x||(u=ju(t,i).trim(),!u)||t.sCount[i]-t.blkIndent>=4||(l=yp(u),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop(),_+=d-l.length,_>Z6))break;if(i===e+2){const k=t.push("tbody_open","tbody",1);k.map=v=[e+2,0]}const y=t.push("tr_open","tr",1);y.map=[i,i+1];for(let k=0;k<d;k++){const w=t.push("td_open","td",1);c[k]&&(w.attrs=[["style","text-align:"+c[k]]]);const C=t.push("inline","",0);C.content=l[k]?l[k].trim():"",C.children=[],t.push("td_close","td",-1)}t.push("tr_close","tr",-1)}return v&&(t.push("tbody_close","tbody",-1),v[1]=i),t.push("table_close","table",-1),m[1]=i,t.parentType=h,t.line=i,!0}function Q6(t,e,n){if(t.sCount[e]-t.blkIndent<4)return!1;let r=e+1,i=r;for(;r<n;){if(t.isEmpty(r)){r++;continue}if(t.sCount[r]-t.blkIndent>=4){r++,i=r;continue}break}t.line=i;const s=t.push("code_block","code",0);return s.content=t.getLines(e,i,4+t.blkIndent,!1)+`
|
|
105
|
-
`,s.map=[e,t.line],!0}function e4(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||i+3>s)return!1;const o=t.src.charCodeAt(i);if(o!==126&&o!==96)return!1;let a=i;i=t.skipChars(i,o);let u=i-a;if(u<3)return!1;const l=t.src.slice(a,i),c=t.src.slice(i,s);if(o===96&&c.indexOf(String.fromCharCode(o))>=0)return!1;if(r)return!0;let d=e,h=!1;for(;d++,!(d>=n||(i=a=t.bMarks[d]+t.tShift[d],s=t.eMarks[d],i<s&&t.sCount[d]<t.blkIndent));)if(t.src.charCodeAt(i)===o&&!(t.sCount[d]-t.blkIndent>=4)&&(i=t.skipChars(i,o),!(i-a<u)&&(i=t.skipSpaces(i),!(i<s)))){h=!0;break}u=t.sCount[e],t.line=d+(h?1:0);const f=t.push("fence","code",0);return f.info=c,f.content=t.getLines(e+1,d,u,!0),f.markup=l,f.map=[e,t.line],!0}function t4(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];const o=t.lineMax;if(t.sCount[e]-t.blkIndent>=4||t.src.charCodeAt(i)!==62)return!1;if(r)return!0;const a=[],u=[],l=[],c=[],d=t.md.block.ruler.getRules("blockquote"),h=t.parentType;t.parentType="blockquote";let f=!1,p;for(p=e;p<n;p++){const _=t.sCount[p]<t.blkIndent;if(i=t.bMarks[p]+t.tShift[p],s=t.eMarks[p],i>=s)break;if(t.src.charCodeAt(i++)===62&&!_){let y=t.sCount[p]+1,k,w;t.src.charCodeAt(i)===32?(i++,y++,w=!1,k=!0):t.src.charCodeAt(i)===9?(k=!0,(t.bsCount[p]+y)%4===3?(i++,y++,w=!1):w=!0):k=!1;let C=y;for(a.push(t.bMarks[p]),t.bMarks[p]=i;i<s;){const S=t.src.charCodeAt(i);if(ue(S))S===9?C+=4-(C+t.bsCount[p]+(w?1:0))%4:C++;else break;i++}f=i>=s,u.push(t.bsCount[p]),t.bsCount[p]=t.sCount[p]+1+(k?1:0),l.push(t.sCount[p]),t.sCount[p]=C-y,c.push(t.tShift[p]),t.tShift[p]=i-t.bMarks[p];continue}if(f)break;let x=!1;for(let y=0,k=d.length;y<k;y++)if(d[y](t,p,n,!0)){x=!0;break}if(x){t.lineMax=p,t.blkIndent!==0&&(a.push(t.bMarks[p]),u.push(t.bsCount[p]),c.push(t.tShift[p]),l.push(t.sCount[p]),t.sCount[p]-=t.blkIndent);break}a.push(t.bMarks[p]),u.push(t.bsCount[p]),c.push(t.tShift[p]),l.push(t.sCount[p]),t.sCount[p]=-1}const m=t.blkIndent;t.blkIndent=0;const g=t.push("blockquote_open","blockquote",1);g.markup=">";const b=[e,0];g.map=b,t.md.block.tokenize(t,e,p);const v=t.push("blockquote_close","blockquote",-1);v.markup=">",t.lineMax=o,t.parentType=h,b[1]=t.line;for(let _=0;_<c.length;_++)t.bMarks[_+e]=a[_],t.tShift[_+e]=c[_],t.sCount[_+e]=l[_],t.bsCount[_+e]=u[_];return t.blkIndent=m,!0}function n4(t,e,n,r){const i=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;let s=t.bMarks[e]+t.tShift[e];const o=t.src.charCodeAt(s++);if(o!==42&&o!==45&&o!==95)return!1;let a=1;for(;s<i;){const l=t.src.charCodeAt(s++);if(l!==o&&!ue(l))return!1;l===o&&a++}if(a<3)return!1;if(r)return!0;t.line=e+1;const u=t.push("hr","hr",0);return u.map=[e,t.line],u.markup=Array(a+1).join(String.fromCharCode(o)),!0}function _p(t,e){const n=t.eMarks[e];let r=t.bMarks[e]+t.tShift[e];const i=t.src.charCodeAt(r++);if(i!==42&&i!==45&&i!==43)return-1;if(r<n){const s=t.src.charCodeAt(r);if(!ue(s))return-1}return r}function xp(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];let i=n;if(i+1>=r)return-1;let s=t.src.charCodeAt(i++);if(s<48||s>57)return-1;for(;;){if(i>=r)return-1;if(s=t.src.charCodeAt(i++),s>=48&&s<=57){if(i-n>=10)return-1;continue}if(s===41||s===46)break;return-1}return i<r&&(s=t.src.charCodeAt(i),!ue(s))?-1:i}function r4(t,e){const n=t.level+2;for(let r=e+2,i=t.tokens.length-2;r<i;r++)t.tokens[r].level===n&&t.tokens[r].type==="paragraph_open"&&(t.tokens[r+2].hidden=!0,t.tokens[r].hidden=!0,r+=2)}function i4(t,e,n,r){let i,s,o,a,u=e,l=!0;if(t.sCount[u]-t.blkIndent>=4||t.listIndent>=0&&t.sCount[u]-t.listIndent>=4&&t.sCount[u]<t.blkIndent)return!1;let c=!1;r&&t.parentType==="paragraph"&&t.sCount[u]>=t.blkIndent&&(c=!0);let d,h,f;if((f=xp(t,u))>=0){if(d=!0,o=t.bMarks[u]+t.tShift[u],h=Number(t.src.slice(o,f-1)),c&&h!==1)return!1}else if((f=_p(t,u))>=0)d=!1;else return!1;if(c&&t.skipSpaces(f)>=t.eMarks[u])return!1;if(r)return!0;const p=t.src.charCodeAt(f-1),m=t.tokens.length;d?(a=t.push("ordered_list_open","ol",1),h!==1&&(a.attrs=[["start",h]])):a=t.push("bullet_list_open","ul",1);const g=[u,0];a.map=g,a.markup=String.fromCharCode(p);let b=!1;const v=t.md.block.ruler.getRules("list"),_=t.parentType;for(t.parentType="list";u<n;){s=f,i=t.eMarks[u];const x=t.sCount[u]+f-(t.bMarks[u]+t.tShift[u]);let y=x;for(;s<i;){const X=t.src.charCodeAt(s);if(X===9)y+=4-(y+t.bsCount[u])%4;else if(X===32)y++;else break;s++}const k=s;let w;k>=i?w=1:w=y-x,w>4&&(w=1);const C=x+w;a=t.push("list_item_open","li",1),a.markup=String.fromCharCode(p);const S=[u,0];a.map=S,d&&(a.info=t.src.slice(o,f-1));const D=t.tight,F=t.tShift[u],L=t.sCount[u],j=t.listIndent;if(t.listIndent=t.blkIndent,t.blkIndent=C,t.tight=!0,t.tShift[u]=k-t.bMarks[u],t.sCount[u]=y,k>=i&&t.isEmpty(u+1)?t.line=Math.min(t.line+2,n):t.md.block.tokenize(t,u,n,!0),(!t.tight||b)&&(l=!1),b=t.line-u>1&&t.isEmpty(t.line-1),t.blkIndent=t.listIndent,t.listIndent=j,t.tShift[u]=F,t.sCount[u]=L,t.tight=D,a=t.push("list_item_close","li",-1),a.markup=String.fromCharCode(p),u=t.line,S[1]=u,u>=n||t.sCount[u]<t.blkIndent||t.sCount[u]-t.blkIndent>=4)break;let V=!1;for(let X=0,ne=v.length;X<ne;X++)if(v[X](t,u,n,!0)){V=!0;break}if(V)break;if(d){if(f=xp(t,u),f<0)break;o=t.bMarks[u]+t.tShift[u]}else if(f=_p(t,u),f<0)break;if(p!==t.src.charCodeAt(f-1))break}return d?a=t.push("ordered_list_close","ol",-1):a=t.push("bullet_list_close","ul",-1),a.markup=String.fromCharCode(p),g[1]=u,t.line=u,t.parentType=_,l&&r4(t,m),!0}function s4(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e],o=e+1;if(t.sCount[e]-t.blkIndent>=4||t.src.charCodeAt(i)!==91)return!1;function a(v){const _=t.lineMax;if(v>=_||t.isEmpty(v))return null;let x=!1;if(t.sCount[v]-t.blkIndent>3&&(x=!0),t.sCount[v]<0&&(x=!0),!x){const w=t.md.block.ruler.getRules("reference"),C=t.parentType;t.parentType="reference";let S=!1;for(let D=0,F=w.length;D<F;D++)if(w[D](t,v,_,!0)){S=!0;break}if(t.parentType=C,S)return null}const y=t.bMarks[v]+t.tShift[v],k=t.eMarks[v];return t.src.slice(y,k+1)}let u=t.src.slice(i,s+1);s=u.length;let l=-1;for(i=1;i<s;i++){const v=u.charCodeAt(i);if(v===91)return!1;if(v===93){l=i;break}else if(v===10){const _=a(o);_!==null&&(u+=_,s=u.length,o++)}else if(v===92&&(i++,i<s&&u.charCodeAt(i)===10)){const _=a(o);_!==null&&(u+=_,s=u.length,o++)}}if(l<0||u.charCodeAt(l+1)!==58)return!1;for(i=l+2;i<s;i++){const v=u.charCodeAt(i);if(v===10){const _=a(o);_!==null&&(u+=_,s=u.length,o++)}else if(!ue(v))break}const c=t.md.helpers.parseLinkDestination(u,i,s);if(!c.ok)return!1;const d=t.md.normalizeLink(c.str);if(!t.md.validateLink(d))return!1;i=c.pos;const h=i,f=o,p=i;for(;i<s;i++){const v=u.charCodeAt(i);if(v===10){const _=a(o);_!==null&&(u+=_,s=u.length,o++)}else if(!ue(v))break}let m=t.md.helpers.parseLinkTitle(u,i,s);for(;m.can_continue;){const v=a(o);if(v===null)break;u+=v,i=s,s=u.length,o++,m=t.md.helpers.parseLinkTitle(u,i,s,m)}let g;for(i<s&&p!==i&&m.ok?(g=m.str,i=m.pos):(g="",i=h,o=f);i<s;){const v=u.charCodeAt(i);if(!ue(v))break;i++}if(i<s&&u.charCodeAt(i)!==10&&g)for(g="",i=h,o=f;i<s;){const v=u.charCodeAt(i);if(!ue(v))break;i++}if(i<s&&u.charCodeAt(i)!==10)return!1;const b=ja(u.slice(1,l));return b?(r||(typeof t.env.references>"u"&&(t.env.references={}),typeof t.env.references[b]>"u"&&(t.env.references[b]={title:g,href:d}),t.line=o),!0):!1}const o4=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],a4="[a-zA-Z_:][a-zA-Z0-9:._-]*",u4="[^\"'=<>`\\x00-\\x20]+",l4="'[^']*'",c4='"[^"]*"',d4="(?:"+u4+"|"+l4+"|"+c4+")",h4="(?:\\s+"+a4+"(?:\\s*=\\s*"+d4+")?)",$1="<[A-Za-z][A-Za-z0-9\\-]*"+h4+"*\\s*\\/?>",z1="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",f4="<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->",p4="<[?][\\s\\S]*?[?]>",m4="<![A-Za-z][^>]*>",g4="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",b4=new RegExp("^(?:"+$1+"|"+z1+"|"+f4+"|"+p4+"|"+m4+"|"+g4+")"),v4=new RegExp("^(?:"+$1+"|"+z1+")"),Rr=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+o4.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(v4.source+"\\s*$"),/^$/,!1]];function y4(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||!t.md.options.html||t.src.charCodeAt(i)!==60)return!1;let o=t.src.slice(i,s),a=0;for(;a<Rr.length&&!Rr[a][0].test(o);a++);if(a===Rr.length)return!1;if(r)return Rr[a][2];let u=e+1;if(!Rr[a][1].test(o)){for(;u<n&&!(t.sCount[u]<t.blkIndent);u++)if(i=t.bMarks[u]+t.tShift[u],s=t.eMarks[u],o=t.src.slice(i,s),Rr[a][1].test(o)){o.length!==0&&u++;break}}t.line=u;const l=t.push("html_block","",0);return l.map=[e,u],l.content=t.getLines(e,u,t.blkIndent,!0),!0}function _4(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;let o=t.src.charCodeAt(i);if(o!==35||i>=s)return!1;let a=1;for(o=t.src.charCodeAt(++i);o===35&&i<s&&a<=6;)a++,o=t.src.charCodeAt(++i);if(a>6||i<s&&!ue(o))return!1;if(r)return!0;s=t.skipSpacesBack(s,i);const u=t.skipCharsBack(s,35,i);u>i&&ue(t.src.charCodeAt(u-1))&&(s=u),t.line=e+1;const l=t.push("heading_open","h"+String(a),1);l.markup="########".slice(0,a),l.map=[e,t.line];const c=t.push("inline","",0);c.content=t.src.slice(i,s).trim(),c.map=[e,t.line],c.children=[];const d=t.push("heading_close","h"+String(a),-1);return d.markup="########".slice(0,a),!0}function x4(t,e,n){const r=t.md.block.ruler.getRules("paragraph");if(t.sCount[e]-t.blkIndent>=4)return!1;const i=t.parentType;t.parentType="paragraph";let s=0,o,a=e+1;for(;a<n&&!t.isEmpty(a);a++){if(t.sCount[a]-t.blkIndent>3)continue;if(t.sCount[a]>=t.blkIndent){let f=t.bMarks[a]+t.tShift[a];const p=t.eMarks[a];if(f<p&&(o=t.src.charCodeAt(f),(o===45||o===61)&&(f=t.skipChars(f,o),f=t.skipSpaces(f),f>=p))){s=o===61?1:2;break}}if(t.sCount[a]<0)continue;let h=!1;for(let f=0,p=r.length;f<p;f++)if(r[f](t,a,n,!0)){h=!0;break}if(h)break}if(!s)return!1;const u=t.getLines(e,a,t.blkIndent,!1).trim();t.line=a+1;const l=t.push("heading_open","h"+String(s),1);l.markup=String.fromCharCode(o),l.map=[e,t.line];const c=t.push("inline","",0);c.content=u,c.map=[e,t.line-1],c.children=[];const d=t.push("heading_close","h"+String(s),-1);return d.markup=String.fromCharCode(o),t.parentType=i,!0}function k4(t,e,n){const r=t.md.block.ruler.getRules("paragraph"),i=t.parentType;let s=e+1;for(t.parentType="paragraph";s<n&&!t.isEmpty(s);s++){if(t.sCount[s]-t.blkIndent>3||t.sCount[s]<0)continue;let l=!1;for(let c=0,d=r.length;c<d;c++)if(r[c](t,s,n,!0)){l=!0;break}if(l)break}const o=t.getLines(e,s,t.blkIndent,!1).trim();t.line=s;const a=t.push("paragraph_open","p",1);a.map=[e,t.line];const u=t.push("inline","",0);return u.content=o,u.map=[e,t.line],u.children=[],t.push("paragraph_close","p",-1),t.parentType=i,!0}const Hs=[["table",X6,["paragraph","reference"]],["code",Q6],["fence",e4,["paragraph","reference","blockquote","list"]],["blockquote",t4,["paragraph","reference","blockquote","list"]],["hr",n4,["paragraph","reference","blockquote","list"]],["list",i4,["paragraph","reference","blockquote"]],["reference",s4],["html_block",y4,["paragraph","reference","blockquote"]],["heading",_4,["paragraph","reference","blockquote"]],["lheading",x4],["paragraph",k4]];function Va(){this.ruler=new lt;for(let t=0;t<Hs.length;t++)this.ruler.push(Hs[t][0],Hs[t][1],{alt:(Hs[t][2]||[]).slice()})}Va.prototype.tokenize=function(t,e,n){const r=this.ruler.getRules(""),i=r.length,s=t.md.options.maxNesting;let o=e,a=!1;for(;o<n&&(t.line=o=t.skipEmptyLines(o),!(o>=n||t.sCount[o]<t.blkIndent));){if(t.level>=s){t.line=n;break}const u=t.line;let l=!1;for(let c=0;c<i;c++)if(l=r[c](t,o,n,!1),l){if(u>=t.line)throw new Error("block rule didn't increment state.line");break}if(!l)throw new Error("none of the block rules matched");t.tight=!a,t.isEmpty(t.line-1)&&(a=!0),o=t.line,o<n&&t.isEmpty(o)&&(a=!0,o++,t.line=o)}};Va.prototype.parse=function(t,e,n,r){if(!t)return;const i=new this.State(t,e,n,r);this.tokenize(i,i.line,i.lineMax)};Va.prototype.State=Xt;function xs(t,e,n,r){this.src=t,this.env=n,this.md=e,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}xs.prototype.pushPending=function(){const t=new It("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t};xs.prototype.push=function(t,e,n){this.pending&&this.pushPending();const r=new It(t,e,n);let i=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r};xs.prototype.scanDelims=function(t,e){const n=this.posMax,r=this.src.charCodeAt(t),i=t>0?this.src.charCodeAt(t-1):32;let s=t;for(;s<n&&this.src.charCodeAt(s)===r;)s++;const o=s-t,a=s<n?this.src.charCodeAt(s):32,u=ds(i)||cs(String.fromCharCode(i)),l=ds(a)||cs(String.fromCharCode(a)),c=ls(i),d=ls(a),h=!d&&(!l||c||u),f=!c&&(!u||d||l);return{can_open:h&&(e||!f||u),can_close:f&&(e||!h||l),length:o}};xs.prototype.Token=It;function w4(t){switch(t){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function C4(t,e){let n=t.pos;for(;n<t.posMax&&!w4(t.src.charCodeAt(n));)n++;return n===t.pos?!1:(e||(t.pending+=t.src.slice(t.pos,n)),t.pos=n,!0)}const E4=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function S4(t,e){if(!t.md.options.linkify||t.linkLevel>0)return!1;const n=t.pos,r=t.posMax;if(n+3>r||t.src.charCodeAt(n)!==58||t.src.charCodeAt(n+1)!==47||t.src.charCodeAt(n+2)!==47)return!1;const i=t.pending.match(E4);if(!i)return!1;const s=i[1],o=t.md.linkify.matchAtStart(t.src.slice(n-s.length));if(!o)return!1;let a=o.url;if(a.length<=s.length)return!1;let u=a.length;for(;u>0&&a.charCodeAt(u-1)===42;)u--;u!==a.length&&(a=a.slice(0,u));const l=t.md.normalizeLink(a);if(!t.md.validateLink(l))return!1;if(!e){t.pending=t.pending.slice(0,-s.length);const c=t.push("link_open","a",1);c.attrs=[["href",l]],c.markup="linkify",c.info="auto";const d=t.push("text","",0);d.content=t.md.normalizeLinkText(a);const h=t.push("link_close","a",-1);h.markup="linkify",h.info="auto"}return t.pos+=a.length-s.length,!0}function A4(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==10)return!1;const r=t.pending.length-1,i=t.posMax;if(!e)if(r>=0&&t.pending.charCodeAt(r)===32)if(r>=1&&t.pending.charCodeAt(r-1)===32){let s=r-1;for(;s>=1&&t.pending.charCodeAt(s-1)===32;)s--;t.pending=t.pending.slice(0,s),t.push("hardbreak","br",0)}else t.pending=t.pending.slice(0,-1),t.push("softbreak","br",0);else t.push("softbreak","br",0);for(n++;n<i&&ue(t.src.charCodeAt(n));)n++;return t.pos=n,!0}const Dd=[];for(let t=0;t<256;t++)Dd.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(t){Dd[t.charCodeAt(0)]=1});function M4(t,e){let n=t.pos;const r=t.posMax;if(t.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=t.src.charCodeAt(n);if(i===10){for(e||t.push("hardbreak","br",0),n++;n<r&&(i=t.src.charCodeAt(n),!!ue(i));)n++;return t.pos=n,!0}let s=t.src[n];if(i>=55296&&i<=56319&&n+1<r){const a=t.src.charCodeAt(n+1);a>=56320&&a<=57343&&(s+=t.src[n+1],n++)}const o="\\"+s;if(!e){const a=t.push("text_special","",0);i<256&&Dd[i]!==0?a.content=s:a.content=o,a.markup=o,a.info="escape"}return t.pos=n+1,!0}function T4(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==96)return!1;const i=n;n++;const s=t.posMax;for(;n<s&&t.src.charCodeAt(n)===96;)n++;const o=t.src.slice(i,n),a=o.length;if(t.backticksScanned&&(t.backticks[a]||0)<=i)return e||(t.pending+=o),t.pos+=a,!0;let u=n,l;for(;(l=t.src.indexOf("`",u))!==-1;){for(u=l+1;u<s&&t.src.charCodeAt(u)===96;)u++;const c=u-l;if(c===a){if(!e){const d=t.push("code_inline","code",0);d.markup=o,d.content=t.src.slice(n,l).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return t.pos=u,!0}t.backticks[c]=l}return t.backticksScanned=!0,e||(t.pending+=o),t.pos+=a,!0}function D4(t,e){const n=t.pos,r=t.src.charCodeAt(n);if(e||r!==126)return!1;const i=t.scanDelims(t.pos,!0);let s=i.length;const o=String.fromCharCode(r);if(s<2)return!1;let a;s%2&&(a=t.push("text","",0),a.content=o,s--);for(let u=0;u<s;u+=2)a=t.push("text","",0),a.content=o+o,t.delimiters.push({marker:r,length:0,token:t.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return t.pos+=i.length,!0}function kp(t,e){let n;const r=[],i=e.length;for(let s=0;s<i;s++){const o=e[s];if(o.marker!==126||o.end===-1)continue;const a=e[o.end];n=t.tokens[o.token],n.type="s_open",n.tag="s",n.nesting=1,n.markup="~~",n.content="",n=t.tokens[a.token],n.type="s_close",n.tag="s",n.nesting=-1,n.markup="~~",n.content="",t.tokens[a.token-1].type==="text"&&t.tokens[a.token-1].content==="~"&&r.push(a.token-1)}for(;r.length;){const s=r.pop();let o=s+1;for(;o<t.tokens.length&&t.tokens[o].type==="s_close";)o++;o--,s!==o&&(n=t.tokens[o],t.tokens[o]=t.tokens[s],t.tokens[s]=n)}}function O4(t){const e=t.tokens_meta,n=t.tokens_meta.length;kp(t,t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&kp(t,e[r].delimiters)}const H1={tokenize:D4,postProcess:O4};function R4(t,e){const n=t.pos,r=t.src.charCodeAt(n);if(e||r!==95&&r!==42)return!1;const i=t.scanDelims(t.pos,r===42);for(let s=0;s<i.length;s++){const o=t.push("text","",0);o.content=String.fromCharCode(r),t.delimiters.push({marker:r,length:i.length,token:t.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return t.pos+=i.length,!0}function wp(t,e){const n=e.length;for(let r=n-1;r>=0;r--){const i=e[r];if(i.marker!==95&&i.marker!==42||i.end===-1)continue;const s=e[i.end],o=r>0&&e[r-1].end===i.end+1&&e[r-1].marker===i.marker&&e[r-1].token===i.token-1&&e[i.end+1].token===s.token+1,a=String.fromCharCode(i.marker),u=t.tokens[i.token];u.type=o?"strong_open":"em_open",u.tag=o?"strong":"em",u.nesting=1,u.markup=o?a+a:a,u.content="";const l=t.tokens[s.token];l.type=o?"strong_close":"em_close",l.tag=o?"strong":"em",l.nesting=-1,l.markup=o?a+a:a,l.content="",o&&(t.tokens[e[r-1].token].content="",t.tokens[e[i.end+1].token].content="",r--)}}function N4(t){const e=t.tokens_meta,n=t.tokens_meta.length;wp(t,t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&wp(t,e[r].delimiters)}const j1={tokenize:R4,postProcess:N4};function F4(t,e){let n,r,i,s,o="",a="",u=t.pos,l=!0;if(t.src.charCodeAt(t.pos)!==91)return!1;const c=t.pos,d=t.posMax,h=t.pos+1,f=t.md.helpers.parseLinkLabel(t,t.pos,!0);if(f<0)return!1;let p=f+1;if(p<d&&t.src.charCodeAt(p)===40){for(l=!1,p++;p<d&&(n=t.src.charCodeAt(p),!(!ue(n)&&n!==10));p++);if(p>=d)return!1;if(u=p,i=t.md.helpers.parseLinkDestination(t.src,p,t.posMax),i.ok){for(o=t.md.normalizeLink(i.str),t.md.validateLink(o)?p=i.pos:o="",u=p;p<d&&(n=t.src.charCodeAt(p),!(!ue(n)&&n!==10));p++);if(i=t.md.helpers.parseLinkTitle(t.src,p,t.posMax),p<d&&u!==p&&i.ok)for(a=i.str,p=i.pos;p<d&&(n=t.src.charCodeAt(p),!(!ue(n)&&n!==10));p++);}(p>=d||t.src.charCodeAt(p)!==41)&&(l=!0),p++}if(l){if(typeof t.env.references>"u")return!1;if(p<d&&t.src.charCodeAt(p)===91?(u=p+1,p=t.md.helpers.parseLinkLabel(t,p),p>=0?r=t.src.slice(u,p++):p=f+1):p=f+1,r||(r=t.src.slice(h,f)),s=t.env.references[ja(r)],!s)return t.pos=c,!1;o=s.href,a=s.title}if(!e){t.pos=h,t.posMax=f;const m=t.push("link_open","a",1),g=[["href",o]];m.attrs=g,a&&g.push(["title",a]),t.linkLevel++,t.md.inline.tokenize(t),t.linkLevel--,t.push("link_close","a",-1)}return t.pos=p,t.posMax=d,!0}function I4(t,e){let n,r,i,s,o,a,u,l,c="";const d=t.pos,h=t.posMax;if(t.src.charCodeAt(t.pos)!==33||t.src.charCodeAt(t.pos+1)!==91)return!1;const f=t.pos+2,p=t.md.helpers.parseLinkLabel(t,t.pos+1,!1);if(p<0)return!1;if(s=p+1,s<h&&t.src.charCodeAt(s)===40){for(s++;s<h&&(n=t.src.charCodeAt(s),!(!ue(n)&&n!==10));s++);if(s>=h)return!1;for(l=s,a=t.md.helpers.parseLinkDestination(t.src,s,t.posMax),a.ok&&(c=t.md.normalizeLink(a.str),t.md.validateLink(c)?s=a.pos:c=""),l=s;s<h&&(n=t.src.charCodeAt(s),!(!ue(n)&&n!==10));s++);if(a=t.md.helpers.parseLinkTitle(t.src,s,t.posMax),s<h&&l!==s&&a.ok)for(u=a.str,s=a.pos;s<h&&(n=t.src.charCodeAt(s),!(!ue(n)&&n!==10));s++);else u="";if(s>=h||t.src.charCodeAt(s)!==41)return t.pos=d,!1;s++}else{if(typeof t.env.references>"u")return!1;if(s<h&&t.src.charCodeAt(s)===91?(l=s+1,s=t.md.helpers.parseLinkLabel(t,s),s>=0?i=t.src.slice(l,s++):s=p+1):s=p+1,i||(i=t.src.slice(f,p)),o=t.env.references[ja(i)],!o)return t.pos=d,!1;c=o.href,u=o.title}if(!e){r=t.src.slice(f,p);const m=[];t.md.inline.parse(r,t.md,t.env,m);const g=t.push("image","img",0),b=[["src",c],["alt",""]];g.attrs=b,g.children=m,g.content=r,u&&b.push(["title",u])}return t.pos=s,t.posMax=h,!0}const P4=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,L4=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function B4(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==60)return!1;const r=t.pos,i=t.posMax;for(;;){if(++n>=i)return!1;const o=t.src.charCodeAt(n);if(o===60)return!1;if(o===62)break}const s=t.src.slice(r+1,n);if(L4.test(s)){const o=t.md.normalizeLink(s);if(!t.md.validateLink(o))return!1;if(!e){const a=t.push("link_open","a",1);a.attrs=[["href",o]],a.markup="autolink",a.info="auto";const u=t.push("text","",0);u.content=t.md.normalizeLinkText(s);const l=t.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return t.pos+=s.length+2,!0}if(P4.test(s)){const o=t.md.normalizeLink("mailto:"+s);if(!t.md.validateLink(o))return!1;if(!e){const a=t.push("link_open","a",1);a.attrs=[["href",o]],a.markup="autolink",a.info="auto";const u=t.push("text","",0);u.content=t.md.normalizeLinkText(s);const l=t.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return t.pos+=s.length+2,!0}return!1}function $4(t){return/^<a[>\s]/i.test(t)}function z4(t){return/^<\/a\s*>/i.test(t)}function H4(t){const e=t|32;return e>=97&&e<=122}function j4(t,e){if(!t.md.options.html)return!1;const n=t.posMax,r=t.pos;if(t.src.charCodeAt(r)!==60||r+2>=n)return!1;const i=t.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!H4(i))return!1;const s=t.src.slice(r).match(b4);if(!s)return!1;if(!e){const o=t.push("html_inline","",0);o.content=s[0],$4(o.content)&&t.linkLevel++,z4(o.content)&&t.linkLevel--}return t.pos+=s[0].length,!0}const V4=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,q4=/^&([a-z][a-z0-9]{1,31});/i;function W4(t,e){const n=t.pos,r=t.posMax;if(t.src.charCodeAt(n)!==38||n+1>=r)return!1;if(t.src.charCodeAt(n+1)===35){const s=t.src.slice(n).match(V4);if(s){if(!e){const o=s[1][0].toLowerCase()==="x"?parseInt(s[1].slice(1),16):parseInt(s[1],10),a=t.push("text_special","",0);a.content=Md(o)?Uo(o):Uo(65533),a.markup=s[0],a.info="entity"}return t.pos+=s[0].length,!0}}else{const s=t.src.slice(n).match(q4);if(s){const o=F1(s[0]);if(o!==s[0]){if(!e){const a=t.push("text_special","",0);a.content=o,a.markup=s[0],a.info="entity"}return t.pos+=s[0].length,!0}}}return!1}function Cp(t){const e={},n=t.length;if(!n)return;let r=0,i=-2;const s=[];for(let o=0;o<n;o++){const a=t[o];if(s.push(0),(t[r].marker!==a.marker||i!==a.token-1)&&(r=o),i=a.token,a.length=a.length||0,!a.close)continue;e.hasOwnProperty(a.marker)||(e[a.marker]=[-1,-1,-1,-1,-1,-1]);const u=e[a.marker][(a.open?3:0)+a.length%3];let l=r-s[r]-1,c=l;for(;l>u;l-=s[l]+1){const d=t[l];if(d.marker===a.marker&&d.open&&d.end<0){let h=!1;if((d.close||a.open)&&(d.length+a.length)%3===0&&(d.length%3!==0||a.length%3!==0)&&(h=!0),!h){const f=l>0&&!t[l-1].open?s[l-1]+1:0;s[o]=o-l+f,s[l]=f,a.open=!1,d.end=o,d.close=!1,c=-1,i=-2;break}}}c!==-1&&(e[a.marker][(a.open?3:0)+(a.length||0)%3]=c)}}function U4(t){const e=t.tokens_meta,n=t.tokens_meta.length;Cp(t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&Cp(e[r].delimiters)}function K4(t){let e,n,r=0;const i=t.tokens,s=t.tokens.length;for(e=n=0;e<s;e++)i[e].nesting<0&&r--,i[e].level=r,i[e].nesting>0&&r++,i[e].type==="text"&&e+1<s&&i[e+1].type==="text"?i[e+1].content=i[e].content+i[e+1].content:(e!==n&&(i[n]=i[e]),n++);e!==n&&(i.length=n)}const Vu=[["text",C4],["linkify",S4],["newline",A4],["escape",M4],["backticks",T4],["strikethrough",H1.tokenize],["emphasis",j1.tokenize],["link",F4],["image",I4],["autolink",B4],["html_inline",j4],["entity",W4]],qu=[["balance_pairs",U4],["strikethrough",H1.postProcess],["emphasis",j1.postProcess],["fragments_join",K4]];function ks(){this.ruler=new lt;for(let t=0;t<Vu.length;t++)this.ruler.push(Vu[t][0],Vu[t][1]);this.ruler2=new lt;for(let t=0;t<qu.length;t++)this.ruler2.push(qu[t][0],qu[t][1])}ks.prototype.skipToken=function(t){const e=t.pos,n=this.ruler.getRules(""),r=n.length,i=t.md.options.maxNesting,s=t.cache;if(typeof s[e]<"u"){t.pos=s[e];return}let o=!1;if(t.level<i){for(let a=0;a<r;a++)if(t.level++,o=n[a](t,!0),t.level--,o){if(e>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}else t.pos=t.posMax;o||t.pos++,s[e]=t.pos};ks.prototype.tokenize=function(t){const e=this.ruler.getRules(""),n=e.length,r=t.posMax,i=t.md.options.maxNesting;for(;t.pos<r;){const s=t.pos;let o=!1;if(t.level<i){for(let a=0;a<n;a++)if(o=e[a](t,!1),o){if(s>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}if(o){if(t.pos>=r)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()};ks.prototype.parse=function(t,e,n,r){const i=new this.State(t,e,n,r);this.tokenize(i);const s=this.ruler2.getRules(""),o=s.length;for(let a=0;a<o;a++)s[a](i)};ks.prototype.State=xs;function J4(t){const e={};t=t||{},e.src_Any=T1.source,e.src_Cc=D1.source,e.src_Z=R1.source,e.src_P=Sd.source,e.src_ZPCc=[e.src_Z,e.src_P,e.src_Cc].join("|"),e.src_ZCc=[e.src_Z,e.src_Cc].join("|");const n="[><|]";return e.src_pseudo_letter="(?:(?!"+n+"|"+e.src_ZPCc+")"+e.src_Any+")",e.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",e.src_auth="(?:(?:(?!"+e.src_ZCc+"|[@/\\[\\]()]).)+@)?",e.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",e.src_host_terminator="(?=$|"+n+"|"+e.src_ZPCc+")(?!"+(t["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+e.src_ZPCc+"))",e.src_path="(?:[/?#](?:(?!"+e.src_ZCc+"|"+n+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+e.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+e.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+e.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+e.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+e.src_ZCc+"|[']).)+\\'|\\'(?="+e.src_pseudo_letter+"|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+e.src_ZCc+"|[.]|$)|"+(t["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+e.src_ZCc+"|$)|;(?!"+e.src_ZCc+"|$)|\\!+(?!"+e.src_ZCc+"|[!]|$)|\\?(?!"+e.src_ZCc+"|[?]|$))+|\\/)?",e.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',e.src_xn="xn--[a-z0-9\\-]{1,59}",e.src_domain_root="(?:"+e.src_xn+"|"+e.src_pseudo_letter+"{1,63})",e.src_domain="(?:"+e.src_xn+"|(?:"+e.src_pseudo_letter+")|(?:"+e.src_pseudo_letter+"(?:-|"+e.src_pseudo_letter+"){0,61}"+e.src_pseudo_letter+"))",e.src_host="(?:(?:(?:(?:"+e.src_domain+")\\.)*"+e.src_domain+"))",e.tpl_host_fuzzy="(?:"+e.src_ip4+"|(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%)))",e.tpl_host_no_ip_fuzzy="(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%))",e.src_host_strict=e.src_host+e.src_host_terminator,e.tpl_host_fuzzy_strict=e.tpl_host_fuzzy+e.src_host_terminator,e.src_host_port_strict=e.src_host+e.src_port+e.src_host_terminator,e.tpl_host_port_fuzzy_strict=e.tpl_host_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_port_no_ip_fuzzy_strict=e.tpl_host_no_ip_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+e.src_ZPCc+"|>|$))",e.tpl_email_fuzzy="(^|"+n+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}function pc(t){return Array.prototype.slice.call(arguments,1).forEach(function(n){n&&Object.keys(n).forEach(function(r){t[r]=n[r]})}),t}function qa(t){return Object.prototype.toString.call(t)}function G4(t){return qa(t)==="[object String]"}function Y4(t){return qa(t)==="[object Object]"}function Z4(t){return qa(t)==="[object RegExp]"}function Ep(t){return qa(t)==="[object Function]"}function X4(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const V1={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function Q4(t){return Object.keys(t||{}).reduce(function(e,n){return e||V1.hasOwnProperty(n)},!1)}const eC={"http:":{validate:function(t,e,n){const r=t.slice(e);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,n){const r=t.slice(e);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,n){const r=t.slice(e);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},tC="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",nC="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function rC(t){t.__index__=-1,t.__text_cache__=""}function iC(t){return function(e,n){const r=e.slice(n);return t.test(r)?r.match(t)[0].length:0}}function Sp(){return function(t,e){e.normalize(t)}}function Ko(t){const e=t.re=J4(t.__opts__),n=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||n.push(tC),n.push(e.src_xn),e.src_tlds=n.join("|");function r(a){return a.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(r(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(r(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(r(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(r(e.tpl_host_fuzzy_test),"i");const i=[];t.__compiled__={};function s(a,u){throw new Error('(LinkifyIt) Invalid schema "'+a+'": '+u)}Object.keys(t.__schemas__).forEach(function(a){const u=t.__schemas__[a];if(u===null)return;const l={validate:null,link:null};if(t.__compiled__[a]=l,Y4(u)){Z4(u.validate)?l.validate=iC(u.validate):Ep(u.validate)?l.validate=u.validate:s(a,u),Ep(u.normalize)?l.normalize=u.normalize:u.normalize?s(a,u):l.normalize=Sp();return}if(G4(u)){i.push(a);return}s(a,u)}),i.forEach(function(a){t.__compiled__[t.__schemas__[a]]&&(t.__compiled__[a].validate=t.__compiled__[t.__schemas__[a]].validate,t.__compiled__[a].normalize=t.__compiled__[t.__schemas__[a]].normalize)}),t.__compiled__[""]={validate:null,normalize:Sp()};const o=Object.keys(t.__compiled__).filter(function(a){return a.length>0&&t.__compiled__[a]}).map(X4).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+o+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+o+")","ig"),t.re.schema_at_start=RegExp("^"+t.re.schema_search.source,"i"),t.re.pretest=RegExp("("+t.re.schema_test.source+")|("+t.re.host_fuzzy_test.source+")|@","i"),rC(t)}function sC(t,e){const n=t.__index__,r=t.__last_index__,i=t.__text_cache__.slice(n,r);this.schema=t.__schema__.toLowerCase(),this.index=n+e,this.lastIndex=r+e,this.raw=i,this.text=i,this.url=i}function mc(t,e){const n=new sC(t,e);return t.__compiled__[n.schema].normalize(n,t),n}function gt(t,e){if(!(this instanceof gt))return new gt(t,e);e||Q4(t)&&(e=t,t={}),this.__opts__=pc({},V1,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=pc({},eC,t),this.__compiled__={},this.__tlds__=nC,this.__tlds_replaced__=!1,this.re={},Ko(this)}gt.prototype.add=function(e,n){return this.__schemas__[e]=n,Ko(this),this};gt.prototype.set=function(e){return this.__opts__=pc(this.__opts__,e),this};gt.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let n,r,i,s,o,a,u,l,c;if(this.re.schema_test.test(e)){for(u=this.re.schema_search,u.lastIndex=0;(n=u.exec(e))!==null;)if(s=this.testSchemaAt(e,n[2],u.lastIndex),s){this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+s;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(l=e.search(this.re.host_fuzzy_test),l>=0&&(this.__index__<0||l<this.__index__)&&(r=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(o=r.index+r[1].length,(this.__index__<0||o<this.__index__)&&(this.__schema__="",this.__index__=o,this.__last_index__=r.index+r[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(c=e.indexOf("@"),c>=0&&(i=e.match(this.re.email_fuzzy))!==null&&(o=i.index+i[1].length,a=i.index+i[0].length,(this.__index__<0||o<this.__index__||o===this.__index__&&a>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=o,this.__last_index__=a))),this.__index__>=0};gt.prototype.pretest=function(e){return this.re.pretest.test(e)};gt.prototype.testSchemaAt=function(e,n,r){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(e,r,this):0};gt.prototype.match=function(e){const n=[];let r=0;this.__index__>=0&&this.__text_cache__===e&&(n.push(mc(this,r)),r=this.__last_index__);let i=r?e.slice(r):e;for(;this.test(i);)n.push(mc(this,r)),i=i.slice(this.__last_index__),r+=this.__last_index__;return n.length?n:null};gt.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;const n=this.re.schema_at_start.exec(e);if(!n)return null;const r=this.testSchemaAt(e,n[2],n[0].length);return r?(this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+r,mc(this,0)):null};gt.prototype.tlds=function(e,n){return e=Array.isArray(e)?e:[e],n?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(r,i,s){return r!==s[i-1]}).reverse(),Ko(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,Ko(this),this)};gt.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)};gt.prototype.onCompile=function(){};const Gr=2147483647,Ut=36,Od=1,hs=26,oC=38,aC=700,q1=72,W1=128,U1="-",uC=/^xn--/,lC=/[^\0-\x7F]/,cC=/[\x2E\u3002\uFF0E\uFF61]/g,dC={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Wu=Ut-Od,Kt=Math.floor,Uu=String.fromCharCode;function Mn(t){throw new RangeError(dC[t])}function hC(t,e){const n=[];let r=t.length;for(;r--;)n[r]=e(t[r]);return n}function K1(t,e){const n=t.split("@");let r="";n.length>1&&(r=n[0]+"@",t=n[1]),t=t.replace(cC,".");const i=t.split("."),s=hC(i,e).join(".");return r+s}function J1(t){const e=[];let n=0;const r=t.length;for(;n<r;){const i=t.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){const s=t.charCodeAt(n++);(s&64512)==56320?e.push(((i&1023)<<10)+(s&1023)+65536):(e.push(i),n--)}else e.push(i)}return e}const fC=t=>String.fromCodePoint(...t),pC=function(t){return t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:Ut},Ap=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},G1=function(t,e,n){let r=0;for(t=n?Kt(t/aC):t>>1,t+=Kt(t/e);t>Wu*hs>>1;r+=Ut)t=Kt(t/Wu);return Kt(r+(Wu+1)*t/(t+oC))},Y1=function(t){const e=[],n=t.length;let r=0,i=W1,s=q1,o=t.lastIndexOf(U1);o<0&&(o=0);for(let a=0;a<o;++a)t.charCodeAt(a)>=128&&Mn("not-basic"),e.push(t.charCodeAt(a));for(let a=o>0?o+1:0;a<n;){const u=r;for(let c=1,d=Ut;;d+=Ut){a>=n&&Mn("invalid-input");const h=pC(t.charCodeAt(a++));h>=Ut&&Mn("invalid-input"),h>Kt((Gr-r)/c)&&Mn("overflow"),r+=h*c;const f=d<=s?Od:d>=s+hs?hs:d-s;if(h<f)break;const p=Ut-f;c>Kt(Gr/p)&&Mn("overflow"),c*=p}const l=e.length+1;s=G1(r-u,l,u==0),Kt(r/l)>Gr-i&&Mn("overflow"),i+=Kt(r/l),r%=l,e.splice(r++,0,i)}return String.fromCodePoint(...e)},Z1=function(t){const e=[];t=J1(t);const n=t.length;let r=W1,i=0,s=q1;for(const u of t)u<128&&e.push(Uu(u));const o=e.length;let a=o;for(o&&e.push(U1);a<n;){let u=Gr;for(const c of t)c>=r&&c<u&&(u=c);const l=a+1;u-r>Kt((Gr-i)/l)&&Mn("overflow"),i+=(u-r)*l,r=u;for(const c of t)if(c<r&&++i>Gr&&Mn("overflow"),c===r){let d=i;for(let h=Ut;;h+=Ut){const f=h<=s?Od:h>=s+hs?hs:h-s;if(d<f)break;const p=d-f,m=Ut-f;e.push(Uu(Ap(f+p%m,0))),d=Kt(p/m)}e.push(Uu(Ap(d,0))),s=G1(i,l,a===o),i=0,++a}++i,++r}return e.join("")},mC=function(t){return K1(t,function(e){return uC.test(e)?Y1(e.slice(4).toLowerCase()):e})},gC=function(t){return K1(t,function(e){return lC.test(e)?"xn--"+Z1(e):e})},X1={version:"2.3.1",ucs2:{decode:J1,encode:fC},decode:Y1,encode:Z1,toASCII:gC,toUnicode:mC},bC={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},vC={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},yC={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}},_C={default:bC,zero:vC,commonmark:yC},xC=/^(vbscript|javascript|file|data):/,kC=/^data:image\/(gif|png|jpeg|webp);/;function wC(t){const e=t.trim().toLowerCase();return xC.test(e)?kC.test(e):!0}const Q1=["http:","https:","mailto:"];function CC(t){const e=Ed(t,!0);if(e.hostname&&(!e.protocol||Q1.indexOf(e.protocol)>=0))try{e.hostname=X1.toASCII(e.hostname)}catch{}return _s(Cd(e))}function EC(t){const e=Ed(t,!0);if(e.hostname&&(!e.protocol||Q1.indexOf(e.protocol)>=0))try{e.hostname=X1.toUnicode(e.hostname)}catch{}return oi(Cd(e),oi.defaultChars+"%")}function ct(t,e){if(!(this instanceof ct))return new ct(t,e);e||Ad(t)||(e=t||{},t="default"),this.inline=new ks,this.block=new Va,this.core=new Td,this.renderer=new li,this.linkify=new gt,this.validateLink=wC,this.normalizeLink=CC,this.normalizeLinkText=EC,this.utils=A6,this.helpers=Ha({},O6),this.options={},this.configure(t),e&&this.set(e)}ct.prototype.set=function(t){return Ha(this.options,t),this};ct.prototype.configure=function(t){const e=this;if(Ad(t)){const n=t;if(t=_C[n],!t)throw new Error('Wrong `markdown-it` preset "'+n+'", check name')}if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");return t.options&&e.set(t.options),t.components&&Object.keys(t.components).forEach(function(n){t.components[n].rules&&e[n].ruler.enableOnly(t.components[n].rules),t.components[n].rules2&&e[n].ruler2.enableOnly(t.components[n].rules2)}),this};ct.prototype.enable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.enable(t,!0))},this),n=n.concat(this.inline.ruler2.enable(t,!0));const r=t.filter(function(i){return n.indexOf(i)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this};ct.prototype.disable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.disable(t,!0))},this),n=n.concat(this.inline.ruler2.disable(t,!0));const r=t.filter(function(i){return n.indexOf(i)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this};ct.prototype.use=function(t){const e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this};ct.prototype.parse=function(t,e){if(typeof t!="string")throw new Error("Input data should be a String");const n=new this.core.State(t,this,e);return this.core.process(n),n.tokens};ct.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)};ct.prototype.parseInline=function(t,e){const n=new this.core.State(t,this,e);return n.inlineMode=!0,this.core.process(n),n.tokens};ct.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};const SC=new Xc({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return["p",0]}},blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM(){return["blockquote",0]}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return["div",["hr"]]}},heading:{attrs:{level:{default:1}},content:"(text | image)*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM(t){return["h"+t.attrs.level,0]}},code_block:{content:"text*",group:"block",code:!0,defining:!0,marks:"",attrs:{params:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>({params:t.getAttribute("data-params")||""})}],toDOM(t){return["pre",t.attrs.params?{"data-params":t.attrs.params}:{},["code",0]]}},ordered_list:{content:"list_item+",group:"block",attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:"ol",getAttrs(t){return{order:t.hasAttribute("start")?+t.getAttribute("start"):1,tight:t.hasAttribute("data-tight")}}}],toDOM(t){return["ol",{start:t.attrs.order==1?null:t.attrs.order,"data-tight":t.attrs.tight?"true":null},0]}},bullet_list:{content:"list_item+",group:"block",attrs:{tight:{default:!1}},parseDOM:[{tag:"ul",getAttrs:t=>({tight:t.hasAttribute("data-tight")})}],toDOM(t){return["ul",{"data-tight":t.attrs.tight?"true":null},0]}},list_item:{content:"block+",defining:!0,parseDOM:[{tag:"li"}],toDOM(){return["li",0]}},text:{group:"inline"},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs(t){return{src:t.getAttribute("src"),title:t.getAttribute("title"),alt:t.getAttribute("alt")}}}],toDOM(t){return["img",t.attrs]}},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM(){return["br"]}}},marks:{em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"},{style:"font-style=normal",clearMark:t=>t.type.name=="em"}],toDOM(){return["em"]}},strong:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name=="strong"},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM(){return["strong"]}},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs(t){return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM(t){return["a",t.attrs]}},code:{code:!0,parseDOM:[{tag:"code"}],toDOM(){return["code"]}}}});function AC(t,e){if(t.isText&&e.isText&&ie.sameSet(t.marks,e.marks))return t.withText(t.text+e.text)}class MC{constructor(e,n){this.schema=e,this.tokenHandlers=n,this.stack=[{type:e.topNodeType,attrs:null,content:[],marks:ie.none}]}top(){return this.stack[this.stack.length-1]}push(e){this.stack.length&&this.top().content.push(e)}addText(e){if(!e)return;let n=this.top(),r=n.content,i=r[r.length-1],s=this.schema.text(e,n.marks),o;i&&(o=AC(i,s))?r[r.length-1]=o:r.push(s)}openMark(e){let n=this.top();n.marks=e.addToSet(n.marks)}closeMark(e){let n=this.top();n.marks=e.removeFromSet(n.marks)}parseTokens(e){for(let n=0;n<e.length;n++){let r=e[n],i=this.tokenHandlers[r.type];if(!i)throw new Error("Token type `"+r.type+"` not supported by Markdown parser");i(this,r,e,n)}}addNode(e,n,r){let i=this.top(),s=e.createAndFill(n,r,i?i.marks:[]);return s?(this.push(s),s):null}openNode(e,n){this.stack.push({type:e,attrs:n,content:[],marks:ie.none})}closeNode(){let e=this.stack.pop();return this.addNode(e.type,e.attrs,e.content)}}function yi(t,e,n,r){return t.getAttrs?t.getAttrs(e,n,r):t.attrs instanceof Function?t.attrs(e):t.attrs}function Ku(t,e){return t.noCloseToken||e=="code_inline"||e=="code_block"||e=="fence"}function Mp(t){return t[t.length-1]==`
|
|
106
|
-
`?
|
|
107
|
-
`),
|
|
108
|
-
`),
|
|
109
|
-
`);return}},text(t
|
|
110
|
-
`),e>1){let
|
|
111
|
-
`}this.closed=null}}getMark(e){let
|
|
112
|
-
`)}write(e){this.flushClose(),this.delim&&this.atBlank()&&(this.out+=this.delim),e&&(this.out+=e)}closeBlock(e){this.closed=e}text(e,
|
|
113
|
-
`);for(let
|
|
114
|
-
`)}render(e,n
|
|
115
|
-
${
|
|
98
|
+
`},OC.text=function(e,t){return gC(e[t].content)},OC.html_block=function(e,t){return e[t].content},OC.html_inline=function(e,t){return e[t].content};function kC(){this.rules=nC({},OC)}kC.prototype.renderAttrs=function(e){let t,n,r;if(!e.attrs)return``;for(r=``,t=0,n=e.attrs.length;t<n;t++)r+=` `+gC(e.attrs[t][0])+`="`+gC(e.attrs[t][1])+`"`;return r},kC.prototype.renderToken=function(e,t,n){let r=e[t],i=``;if(r.hidden)return``;r.block&&r.nesting!==-1&&t&&e[t-1].hidden&&(i+=`
|
|
99
|
+
`),i+=(r.nesting===-1?`</`:`<`)+r.tag,i+=this.renderAttrs(r),r.nesting===0&&n.xhtmlOut&&(i+=` /`);let a=!1;if(r.block&&(a=!0,r.nesting===1&&t+1<e.length)){let n=e[t+1];(n.type===`inline`||n.hidden||n.nesting===-1&&n.tag===r.tag)&&(a=!1)}return i+=a?`>
|
|
100
|
+
`:`>`,i},kC.prototype.renderInline=function(e,t,n){let r=``,i=this.rules;for(let a=0,o=e.length;a<o;a++){let o=e[a].type;i[o]===void 0?r+=this.renderToken(e,a,t):r+=i[o](e,a,t,n,this)}return r},kC.prototype.renderInlineAsText=function(e,t,n){let r=``;for(let i=0,a=e.length;i<a;i++)switch(e[i].type){case`text`:r+=e[i].content;break;case`image`:r+=this.renderInlineAsText(e[i].children,t,n);break;case`html_inline`:case`html_block`:r+=e[i].content;break;case`softbreak`:case`hardbreak`:r+=`
|
|
101
|
+
`;break;default:}return r},kC.prototype.render=function(e,t,n){let r=``,i=this.rules;for(let a=0,o=e.length;a<o;a++){let o=e[a].type;o===`inline`?r+=this.renderInline(e[a].children,t,n):i[o]===void 0?r+=this.renderToken(e,a,t,n):r+=i[o](e,a,t,n,this)}return r};function AC(){this.__rules__=[],this.__cache__=null}AC.prototype.__find__=function(e){for(let t=0;t<this.__rules__.length;t++)if(this.__rules__[t].name===e)return t;return-1},AC.prototype.__compile__=function(){let e=this,t=[``];e.__rules__.forEach(function(e){e.enabled&&e.alt.forEach(function(e){t.indexOf(e)<0&&t.push(e)})}),e.__cache__={},t.forEach(function(t){e.__cache__[t]=[],e.__rules__.forEach(function(n){n.enabled&&(t&&n.alt.indexOf(t)<0||e.__cache__[t].push(n.fn))})})},AC.prototype.at=function(e,t,n){let r=this.__find__(e),i=n||{};if(r===-1)throw Error(`Parser rule not found: `+e);this.__rules__[r].fn=t,this.__rules__[r].alt=i.alt||[],this.__cache__=null},AC.prototype.before=function(e,t,n,r){let i=this.__find__(e),a=r||{};if(i===-1)throw Error(`Parser rule not found: `+e);this.__rules__.splice(i,0,{name:t,enabled:!0,fn:n,alt:a.alt||[]}),this.__cache__=null},AC.prototype.after=function(e,t,n,r){let i=this.__find__(e),a=r||{};if(i===-1)throw Error(`Parser rule not found: `+e);this.__rules__.splice(i+1,0,{name:t,enabled:!0,fn:n,alt:a.alt||[]}),this.__cache__=null},AC.prototype.push=function(e,t,n){let r=n||{};this.__rules__.push({name:e,enabled:!0,fn:t,alt:r.alt||[]}),this.__cache__=null},AC.prototype.enable=function(e,t){Array.isArray(e)||(e=[e]);let n=[];return e.forEach(function(e){let r=this.__find__(e);if(r<0){if(t)return;throw Error(`Rules manager: invalid rule name `+e)}this.__rules__[r].enabled=!0,n.push(e)},this),this.__cache__=null,n},AC.prototype.enableOnly=function(e,t){Array.isArray(e)||(e=[e]),this.__rules__.forEach(function(e){e.enabled=!1}),this.enable(e,t)},AC.prototype.disable=function(e,t){Array.isArray(e)||(e=[e]);let n=[];return e.forEach(function(e){let r=this.__find__(e);if(r<0){if(t)return;throw Error(`Rules manager: invalid rule name `+e)}this.__rules__[r].enabled=!1,n.push(e)},this),this.__cache__=null,n},AC.prototype.getRules=function(e){return this.__cache__===null&&this.__compile__(),this.__cache__[e]||[]};function jC(e,t,n){this.type=e,this.tag=t,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content=``,this.markup=``,this.info=``,this.meta=null,this.block=!1,this.hidden=!1}jC.prototype.attrIndex=function(e){if(!this.attrs)return-1;let t=this.attrs;for(let n=0,r=t.length;n<r;n++)if(t[n][0]===e)return n;return-1},jC.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]},jC.prototype.attrSet=function(e,t){let n=this.attrIndex(e),r=[e,t];n<0?this.attrPush(r):this.attrs[n]=r},jC.prototype.attrGet=function(e){let t=this.attrIndex(e),n=null;return t>=0&&(n=this.attrs[t][1]),n},jC.prototype.attrJoin=function(e,t){let n=this.attrIndex(e);n<0?this.attrPush([e,t]):this.attrs[n][1]=this.attrs[n][1]+` `+t};function MC(e,t,n){this.src=e,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=t}MC.prototype.Token=jC;var NC=/\r\n?|\n/g,PC=/\0/g;function FC(e){let t;t=e.src.replace(NC,`
|
|
102
|
+
`),t=t.replace(PC,`�`),e.src=t}function IC(e){let t;e.inlineMode?(t=new e.Token(`inline`,``,0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function LC(e){let t=e.tokens;for(let n=0,r=t.length;n<r;n++){let r=t[n];r.type===`inline`&&e.md.inline.parse(r.content,e.md,e.env,r.children)}}function RC(e){return/^<a[>\s]/i.test(e)}function zC(e){return/^<\/a\s*>/i.test(e)}function BC(e){let t=e.tokens;if(e.md.options.linkify)for(let n=0,r=t.length;n<r;n++){if(t[n].type!==`inline`||!e.md.linkify.pretest(t[n].content))continue;let r=t[n].children,i=0;for(let a=r.length-1;a>=0;a--){let o=r[a];if(o.type===`link_close`){for(a--;r[a].level!==o.level&&r[a].type!==`link_open`;)a--;continue}if(o.type===`html_inline`&&(RC(o.content)&&i>0&&i--,zC(o.content)&&i++),!(i>0)&&o.type===`text`&&e.md.linkify.test(o.content)){let i=o.content,s=e.md.linkify.match(i),c=[],l=o.level,u=0;s.length>0&&s[0].index===0&&a>0&&r[a-1].type===`text_special`&&(s=s.slice(1));for(let t=0;t<s.length;t++){let n=s[t].url,r=e.md.normalizeLink(n);if(!e.md.validateLink(r))continue;let a=s[t].text;a=s[t].schema?s[t].schema===`mailto:`&&!/^mailto:/i.test(a)?e.md.normalizeLinkText(`mailto:`+a).replace(/^mailto:/,``):e.md.normalizeLinkText(a):e.md.normalizeLinkText(`http://`+a).replace(/^http:\/\//,``);let o=s[t].index;if(o>u){let t=new e.Token(`text`,``,0);t.content=i.slice(u,o),t.level=l,c.push(t)}let d=new e.Token(`link_open`,`a`,1);d.attrs=[[`href`,r]],d.level=l++,d.markup=`linkify`,d.info=`auto`,c.push(d);let f=new e.Token(`text`,``,0);f.content=a,f.level=l,c.push(f);let p=new e.Token(`link_close`,`a`,-1);p.level=--l,p.markup=`linkify`,p.info=`auto`,c.push(p),u=s[t].lastIndex}if(u<i.length){let t=new e.Token(`text`,``,0);t.content=i.slice(u),t.level=l,c.push(t)}t[n].children=r=rC(r,a,c)}}}}var VC=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,HC=/\((c|tm|r)\)/i,UC=/\((c|tm|r)\)/gi,WC={c:`©`,r:`®`,tm:`™`};function GC(e,t){return WC[t.toLowerCase()]}function KC(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&(r.content=r.content.replace(UC,GC)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function qC(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&VC.test(r.content)&&(r.content=r.content.replace(/\+-/g,`±`).replace(/\.{2,}/g,`…`).replace(/([?!])…/g,`$1..`).replace(/([?!]){4,}/g,`$1$1$1`).replace(/,{2,}/g,`,`).replace(/(^|[^-])---(?=[^-]|$)/gm,`$1—`).replace(/(^|\s)--(?=\s|$)/gm,`$1–`).replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,`$1–`)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function JC(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type===`inline`&&(HC.test(e.tokens[t].content)&&KC(e.tokens[t].children),VC.test(e.tokens[t].content)&&qC(e.tokens[t].children))}var YC=/['"]/,XC=/['"]/g,ZC=`’`;function QC(e,t,n){return e.slice(0,t)+n+e.slice(t+1)}function $C(e,t){let n,r=[];for(let i=0;i<e.length;i++){let a=e[i],o=e[i].level;for(n=r.length-1;n>=0&&!(r[n].level<=o);n--);if(r.length=n+1,a.type!==`text`)continue;let s=a.content,c=0,l=s.length;OUTER:for(;c<l;){XC.lastIndex=c;let u=XC.exec(s);if(!u)break;let d=!0,f=!0;c=u.index+1;let p=u[0]===`'`,m=32;if(u.index-1>=0)m=s.charCodeAt(u.index-1);else for(n=i-1;n>=0&&!(e[n].type===`softbreak`||e[n].type===`hardbreak`);n--)if(e[n].content){m=e[n].content.charCodeAt(e[n].content.length-1);break}let h=32;if(c<l)h=s.charCodeAt(c);else for(n=i+1;n<e.length&&!(e[n].type===`softbreak`||e[n].type===`hardbreak`);n++)if(e[n].content){h=e[n].content.charCodeAt(0);break}let g=xC(m)||bC(String.fromCharCode(m)),_=xC(h)||bC(String.fromCharCode(h)),v=yC(m),y=yC(h);if(y?d=!1:_&&(v||g||(d=!1)),v?f=!1:g&&(y||_||(f=!1)),h===34&&u[0]===`"`&&m>=48&&m<=57&&(f=d=!1),d&&f&&(d=g,f=_),!d&&!f){p&&(a.content=QC(a.content,u.index,ZC));continue}if(f)for(n=r.length-1;n>=0;n--){let d=r[n];if(r[n].level<o)break;if(d.single===p&&r[n].level===o){d=r[n];let o,f;p?(o=t.md.options.quotes[2],f=t.md.options.quotes[3]):(o=t.md.options.quotes[0],f=t.md.options.quotes[1]),a.content=QC(a.content,u.index,f),e[d.token].content=QC(e[d.token].content,d.pos,o),c+=f.length-1,d.token===i&&(c+=o.length-1),s=a.content,l=s.length,r.length=n;continue OUTER}}d?r.push({token:i,pos:u.index,single:p,level:o}):f&&p&&(a.content=QC(a.content,u.index,ZC))}}}function ew(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!==`inline`||!YC.test(e.tokens[t].content)||$C(e.tokens[t].children,e)}function tw(e){let t,n,r=e.tokens,i=r.length;for(let e=0;e<i;e++){if(r[e].type!==`inline`)continue;let i=r[e].children,a=i.length;for(t=0;t<a;t++)i[t].type===`text_special`&&(i[t].type=`text`);for(t=n=0;t<a;t++)i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}}var nw=[[`normalize`,FC],[`block`,IC],[`inline`,LC],[`linkify`,BC],[`replacements`,JC],[`smartquotes`,ew],[`text_join`,tw]];function rw(){this.ruler=new AC;for(let e=0;e<nw.length;e++)this.ruler.push(nw[e][0],nw[e][1])}rw.prototype.process=function(e){let t=this.ruler.getRules(``);for(let n=0,r=t.length;n<r;n++)t[n](e)},rw.prototype.State=MC;function iw(e,t,n,r){this.src=e,this.md=t,this.env=n,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType=`root`,this.level=0;let i=this.src;for(let e=0,t=0,n=0,r=0,a=i.length,o=!1;t<a;t++){let s=i.charCodeAt(t);if(!o)if(X(s)){n++,s===9?r+=4-r%4:r++;continue}else o=!0;(s===10||t===a-1)&&(s!==10&&t++,this.bMarks.push(e),this.eMarks.push(t),this.tShift.push(n),this.sCount.push(r),this.bsCount.push(0),o=!1,n=0,r=0,e=t+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}iw.prototype.push=function(e,t,n){let r=new jC(e,t,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r},iw.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]},iw.prototype.skipEmptyLines=function(e){for(let t=this.lineMax;e<t&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e},iw.prototype.skipSpaces=function(e){for(let t=this.src.length;e<t&&X(this.src.charCodeAt(e));e++);return e},iw.prototype.skipSpacesBack=function(e,t){if(e<=t)return e;for(;e>t;)if(!X(this.src.charCodeAt(--e)))return e+1;return e},iw.prototype.skipChars=function(e,t){for(let n=this.src.length;e<n&&this.src.charCodeAt(e)===t;e++);return e},iw.prototype.skipCharsBack=function(e,t,n){if(e<=n)return e;for(;e>n;)if(t!==this.src.charCodeAt(--e))return e+1;return e},iw.prototype.getLines=function(e,t,n,r){if(e>=t)return``;let i=Array(t-e);for(let a=0,o=e;o<t;o++,a++){let e=0,s=this.bMarks[o],c=s,l;for(l=o+1<t||r?this.eMarks[o]+1:this.eMarks[o];c<l&&e<n;){let t=this.src.charCodeAt(c);if(X(t))t===9?e+=4-(e+this.bsCount[o])%4:e++;else if(c-s<this.tShift[o])e++;else break;c++}e>n?i[a]=Array(e-n+1).join(` `)+this.src.slice(c,l):i[a]=this.src.slice(c,l)}return i.join(``)},iw.prototype.Token=jC;var aw=65536;function ow(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function sw(e){let t=[],n=e.length,r=0,i=e.charCodeAt(r),a=!1,o=0,s=``;for(;r<n;)i===124&&(a?(s+=e.substring(o,r-1),o=r):(t.push(s+e.substring(o,r)),s=``,o=r+1)),a=i===92,r++,i=e.charCodeAt(r);return t.push(s+e.substring(o)),t}function cw(e,t,n,r){if(t+2>n)return!1;let i=t+1;if(e.sCount[i]<e.blkIndent||e.sCount[i]-e.blkIndent>=4)return!1;let a=e.bMarks[i]+e.tShift[i];if(a>=e.eMarks[i])return!1;let o=e.src.charCodeAt(a++);if(o!==124&&o!==45&&o!==58||a>=e.eMarks[i])return!1;let s=e.src.charCodeAt(a++);if(s!==124&&s!==45&&s!==58&&!X(s)||o===45&&X(s))return!1;for(;a<e.eMarks[i];){let t=e.src.charCodeAt(a);if(t!==124&&t!==45&&t!==58&&!X(t))return!1;a++}let c=ow(e,t+1),l=c.split(`|`),u=[];for(let e=0;e<l.length;e++){let t=l[e].trim();if(!t){if(e===0||e===l.length-1)continue;return!1}if(!/^:?-+:?$/.test(t))return!1;t.charCodeAt(t.length-1)===58?u.push(t.charCodeAt(0)===58?`center`:`right`):t.charCodeAt(0)===58?u.push(`left`):u.push(``)}if(c=ow(e,t).trim(),c.indexOf(`|`)===-1||e.sCount[t]-e.blkIndent>=4)return!1;l=sw(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop();let d=l.length;if(d===0||d!==u.length)return!1;if(r)return!0;let f=e.parentType;e.parentType=`table`;let p=e.md.block.ruler.getRules(`blockquote`),m=e.push(`table_open`,`table`,1),h=[t,0];m.map=h;let g=e.push(`thead_open`,`thead`,1);g.map=[t,t+1];let _=e.push(`tr_open`,`tr`,1);_.map=[t,t+1];for(let t=0;t<l.length;t++){let n=e.push(`th_open`,`th`,1);u[t]&&(n.attrs=[[`style`,`text-align:`+u[t]]]);let r=e.push(`inline`,``,0);r.content=l[t].trim(),r.children=[],e.push(`th_close`,`th`,-1)}e.push(`tr_close`,`tr`,-1),e.push(`thead_close`,`thead`,-1);let v,y=0;for(i=t+2;i<n&&!(e.sCount[i]<e.blkIndent);i++){let r=!1;for(let t=0,a=p.length;t<a;t++)if(p[t](e,i,n,!0)){r=!0;break}if(r||(c=ow(e,i).trim(),!c)||e.sCount[i]-e.blkIndent>=4||(l=sw(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop(),y+=d-l.length,y>aw))break;if(i===t+2){let n=e.push(`tbody_open`,`tbody`,1);n.map=v=[t+2,0]}let a=e.push(`tr_open`,`tr`,1);a.map=[i,i+1];for(let t=0;t<d;t++){let n=e.push(`td_open`,`td`,1);u[t]&&(n.attrs=[[`style`,`text-align:`+u[t]]]);let r=e.push(`inline`,``,0);r.content=l[t]?l[t].trim():``,r.children=[],e.push(`td_close`,`td`,-1)}e.push(`tr_close`,`tr`,-1)}return v&&(e.push(`tbody_close`,`tbody`,-1),v[1]=i),e.push(`table_close`,`table`,-1),h[1]=i,e.parentType=f,e.line=i,!0}function lw(e,t,n){if(e.sCount[t]-e.blkIndent<4)return!1;let r=t+1,i=r;for(;r<n;){if(e.isEmpty(r)){r++;continue}if(e.sCount[r]-e.blkIndent>=4){r++,i=r;continue}break}e.line=i;let a=e.push(`code_block`,`code`,0);return a.content=e.getLines(t,i,4+e.blkIndent,!1)+`
|
|
103
|
+
`,a.map=[t,e.line],!0}function uw(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||i+3>a)return!1;let o=e.src.charCodeAt(i);if(o!==126&&o!==96)return!1;let s=i;i=e.skipChars(i,o);let c=i-s;if(c<3)return!1;let l=e.src.slice(s,i),u=e.src.slice(i,a);if(o===96&&u.indexOf(String.fromCharCode(o))>=0)return!1;if(r)return!0;let d=t,f=!1;for(;d++,!(d>=n||(i=s=e.bMarks[d]+e.tShift[d],a=e.eMarks[d],i<a&&e.sCount[d]<e.blkIndent));)if(e.src.charCodeAt(i)===o&&!(e.sCount[d]-e.blkIndent>=4)&&(i=e.skipChars(i,o),!(i-s<c)&&(i=e.skipSpaces(i),!(i<a)))){f=!0;break}c=e.sCount[t],e.line=d+ +!!f;let p=e.push(`fence`,`code`,0);return p.info=u,p.content=e.getLines(t+1,d,c,!0),p.markup=l,p.map=[t,e.line],!0}function dw(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=e.lineMax;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==62)return!1;if(r)return!0;let s=[],c=[],l=[],u=[],d=e.md.block.ruler.getRules(`blockquote`),f=e.parentType;e.parentType=`blockquote`;let p=!1,m;for(m=t;m<n;m++){let t=e.sCount[m]<e.blkIndent;if(i=e.bMarks[m]+e.tShift[m],a=e.eMarks[m],i>=a)break;if(e.src.charCodeAt(i++)===62&&!t){let t=e.sCount[m]+1,n,r;e.src.charCodeAt(i)===32?(i++,t++,r=!1,n=!0):e.src.charCodeAt(i)===9?(n=!0,(e.bsCount[m]+t)%4==3?(i++,t++,r=!1):r=!0):n=!1;let o=t;for(s.push(e.bMarks[m]),e.bMarks[m]=i;i<a;){let t=e.src.charCodeAt(i);if(X(t))t===9?o+=4-(o+e.bsCount[m]+ +!!r)%4:o++;else break;i++}p=i>=a,c.push(e.bsCount[m]),e.bsCount[m]=e.sCount[m]+1+ +!!n,l.push(e.sCount[m]),e.sCount[m]=o-t,u.push(e.tShift[m]),e.tShift[m]=i-e.bMarks[m];continue}if(p)break;let r=!1;for(let t=0,i=d.length;t<i;t++)if(d[t](e,m,n,!0)){r=!0;break}if(r){e.lineMax=m,e.blkIndent!==0&&(s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]-=e.blkIndent);break}s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]=-1}let h=e.blkIndent;e.blkIndent=0;let g=e.push(`blockquote_open`,`blockquote`,1);g.markup=`>`;let _=[t,0];g.map=_,e.md.block.tokenize(e,t,m);let v=e.push(`blockquote_close`,`blockquote`,-1);v.markup=`>`,e.lineMax=o,e.parentType=f,_[1]=e.line;for(let n=0;n<u.length;n++)e.bMarks[n+t]=s[n],e.tShift[n+t]=u[n],e.sCount[n+t]=l[n],e.bsCount[n+t]=c[n];return e.blkIndent=h,!0}function fw(e,t,n,r){let i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let a=e.bMarks[t]+e.tShift[t],o=e.src.charCodeAt(a++);if(o!==42&&o!==45&&o!==95)return!1;let s=1;for(;a<i;){let t=e.src.charCodeAt(a++);if(t!==o&&!X(t))return!1;t===o&&s++}if(s<3)return!1;if(r)return!0;e.line=t+1;let c=e.push(`hr`,`hr`,0);return c.map=[t,e.line],c.markup=Array(s+1).join(String.fromCharCode(o)),!0}function pw(e,t){let n=e.eMarks[t],r=e.bMarks[t]+e.tShift[t],i=e.src.charCodeAt(r++);return i!==42&&i!==45&&i!==43||r<n&&!X(e.src.charCodeAt(r))?-1:r}function mw(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t],i=n;if(i+1>=r)return-1;let a=e.src.charCodeAt(i++);if(a<48||a>57)return-1;for(;;){if(i>=r)return-1;if(a=e.src.charCodeAt(i++),a>=48&&a<=57){if(i-n>=10)return-1;continue}if(a===41||a===46)break;return-1}return i<r&&(a=e.src.charCodeAt(i),!X(a))?-1:i}function hw(e,t){let n=e.level+2;for(let r=t+2,i=e.tokens.length-2;r<i;r++)e.tokens[r].level===n&&e.tokens[r].type===`paragraph_open`&&(e.tokens[r+2].hidden=!0,e.tokens[r].hidden=!0,r+=2)}function gw(e,t,n,r){let i,a,o,s,c=t,l=!0;if(e.sCount[c]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[c]-e.listIndent>=4&&e.sCount[c]<e.blkIndent)return!1;let u=!1;r&&e.parentType===`paragraph`&&e.sCount[c]>=e.blkIndent&&(u=!0);let d,f,p;if((p=mw(e,c))>=0){if(d=!0,o=e.bMarks[c]+e.tShift[c],f=Number(e.src.slice(o,p-1)),u&&f!==1)return!1}else if((p=pw(e,c))>=0)d=!1;else return!1;if(u&&e.skipSpaces(p)>=e.eMarks[c])return!1;if(r)return!0;let m=e.src.charCodeAt(p-1),h=e.tokens.length;d?(s=e.push(`ordered_list_open`,`ol`,1),f!==1&&(s.attrs=[[`start`,f]])):s=e.push(`bullet_list_open`,`ul`,1);let g=[c,0];s.map=g,s.markup=String.fromCharCode(m);let _=!1,v=e.md.block.ruler.getRules(`list`),y=e.parentType;for(e.parentType=`list`;c<n;){a=p,i=e.eMarks[c];let t=e.sCount[c]+p-(e.bMarks[c]+e.tShift[c]),r=t;for(;a<i;){let t=e.src.charCodeAt(a);if(t===9)r+=4-(r+e.bsCount[c])%4;else if(t===32)r++;else break;a++}let u=a,f;f=u>=i?1:r-t,f>4&&(f=1);let h=t+f;s=e.push(`list_item_open`,`li`,1),s.markup=String.fromCharCode(m);let g=[c,0];s.map=g,d&&(s.info=e.src.slice(o,p-1));let y=e.tight,b=e.tShift[c],x=e.sCount[c],S=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=h,e.tight=!0,e.tShift[c]=u-e.bMarks[c],e.sCount[c]=r,u>=i&&e.isEmpty(c+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,c,n,!0),(!e.tight||_)&&(l=!1),_=e.line-c>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=S,e.tShift[c]=b,e.sCount[c]=x,e.tight=y,s=e.push(`list_item_close`,`li`,-1),s.markup=String.fromCharCode(m),c=e.line,g[1]=c,c>=n||e.sCount[c]<e.blkIndent||e.sCount[c]-e.blkIndent>=4)break;let C=!1;for(let t=0,r=v.length;t<r;t++)if(v[t](e,c,n,!0)){C=!0;break}if(C)break;if(d){if(p=mw(e,c),p<0)break;o=e.bMarks[c]+e.tShift[c]}else if(p=pw(e,c),p<0)break;if(m!==e.src.charCodeAt(p-1))break}return s=d?e.push(`ordered_list_close`,`ol`,-1):e.push(`bullet_list_close`,`ul`,-1),s.markup=String.fromCharCode(m),g[1]=c,e.line=c,e.parentType=y,l&&hw(e,h),!0}function _w(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=t+1;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==91)return!1;function s(t){let n=e.lineMax;if(t>=n||e.isEmpty(t))return null;let r=!1;if(e.sCount[t]-e.blkIndent>3&&(r=!0),e.sCount[t]<0&&(r=!0),!r){let r=e.md.block.ruler.getRules(`reference`),i=e.parentType;e.parentType=`reference`;let a=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,t,n,!0)){a=!0;break}if(e.parentType=i,a)return null}let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];return e.src.slice(i,a+1)}let c=e.src.slice(i,a+1);a=c.length;let l=-1;for(i=1;i<a;i++){let e=c.charCodeAt(i);if(e===91)return!1;if(e===93){l=i;break}else if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(e===92&&(i++,i<a&&c.charCodeAt(i)===10)){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}}if(l<0||c.charCodeAt(l+1)!==58)return!1;for(i=l+2;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!X(e))break}let u=e.md.helpers.parseLinkDestination(c,i,a);if(!u.ok)return!1;let d=e.md.normalizeLink(u.str);if(!e.md.validateLink(d))return!1;i=u.pos;let f=i,p=o,m=i;for(;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!X(e))break}let h=e.md.helpers.parseLinkTitle(c,i,a);for(;h.can_continue;){let t=s(o);if(t===null)break;c+=t,i=a,a=c.length,o++,h=e.md.helpers.parseLinkTitle(c,i,a,h)}let g;for(i<a&&m!==i&&h.ok?(g=h.str,i=h.pos):(g=``,i=f,o=p);i<a&&X(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10&&g)for(g=``,i=f,o=p;i<a&&X(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10)return!1;let _=SC(c.slice(1,l));return _?r?!0:(e.env.references===void 0&&(e.env.references={}),e.env.references[_]===void 0&&(e.env.references[_]={title:g,href:d}),e.line=o,!0):!1}var vw=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),yw=`<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,bw=RegExp(`^(?:`+yw+`|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`),xw=RegExp(`^(?:`+yw+`|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>)`),Sw=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[RegExp(`^</?(`+vw.join(`|`)+`)(?=(\\s|/?>|$))`,`i`),/^$/,!0],[RegExp(xw.source+`\\s*$`),/^$/,!1]];function Cw(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(i)!==60)return!1;let o=e.src.slice(i,a),s=0;for(;s<Sw.length&&!Sw[s][0].test(o);s++);if(s===Sw.length)return!1;if(r)return Sw[s][2];let c=t+1;if(!Sw[s][1].test(o)){for(;c<n&&!(e.sCount[c]<e.blkIndent);c++)if(i=e.bMarks[c]+e.tShift[c],a=e.eMarks[c],o=e.src.slice(i,a),Sw[s][1].test(o)){o.length!==0&&c++;break}}e.line=c;let l=e.push(`html_block`,``,0);return l.map=[t,c],l.content=e.getLines(t,c,e.blkIndent,!0),!0}function ww(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let o=e.src.charCodeAt(i);if(o!==35||i>=a)return!1;let s=1;for(o=e.src.charCodeAt(++i);o===35&&i<a&&s<=6;)s++,o=e.src.charCodeAt(++i);if(s>6||i<a&&!X(o))return!1;if(r)return!0;a=e.skipSpacesBack(a,i);let c=e.skipCharsBack(a,35,i);c>i&&X(e.src.charCodeAt(c-1))&&(a=c),e.line=t+1;let l=e.push(`heading_open`,`h`+String(s),1);l.markup=`########`.slice(0,s),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=e.src.slice(i,a).trim(),u.map=[t,e.line],u.children=[];let d=e.push(`heading_close`,`h`+String(s),-1);return d.markup=`########`.slice(0,s),!0}function Tw(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`);if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.parentType;e.parentType=`paragraph`;let a=0,o,s=t+1;for(;s<n&&!e.isEmpty(s);s++){if(e.sCount[s]-e.blkIndent>3)continue;if(e.sCount[s]>=e.blkIndent){let t=e.bMarks[s]+e.tShift[s],n=e.eMarks[s];if(t<n&&(o=e.src.charCodeAt(t),(o===45||o===61)&&(t=e.skipChars(t,o),t=e.skipSpaces(t),t>=n))){a=o===61?1:2;break}}if(e.sCount[s]<0)continue;let t=!1;for(let i=0,a=r.length;i<a;i++)if(r[i](e,s,n,!0)){t=!0;break}if(t)break}if(!a)return!1;let c=e.getLines(t,s,e.blkIndent,!1).trim();e.line=s+1;let l=e.push(`heading_open`,`h`+String(a),1);l.markup=String.fromCharCode(o),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=c,u.map=[t,e.line-1],u.children=[];let d=e.push(`heading_close`,`h`+String(a),-1);return d.markup=String.fromCharCode(o),e.parentType=i,!0}function Ew(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`),i=e.parentType,a=t+1;for(e.parentType=`paragraph`;a<n&&!e.isEmpty(a);a++){if(e.sCount[a]-e.blkIndent>3||e.sCount[a]<0)continue;let t=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,a,n,!0)){t=!0;break}if(t)break}let o=e.getLines(t,a,e.blkIndent,!1).trim();e.line=a;let s=e.push(`paragraph_open`,`p`,1);s.map=[t,e.line];let c=e.push(`inline`,``,0);return c.content=o,c.map=[t,e.line],c.children=[],e.push(`paragraph_close`,`p`,-1),e.parentType=i,!0}var Dw=[[`table`,cw,[`paragraph`,`reference`]],[`code`,lw],[`fence`,uw,[`paragraph`,`reference`,`blockquote`,`list`]],[`blockquote`,dw,[`paragraph`,`reference`,`blockquote`,`list`]],[`hr`,fw,[`paragraph`,`reference`,`blockquote`,`list`]],[`list`,gw,[`paragraph`,`reference`,`blockquote`]],[`reference`,_w],[`html_block`,Cw,[`paragraph`,`reference`,`blockquote`]],[`heading`,ww,[`paragraph`,`reference`,`blockquote`]],[`lheading`,Tw],[`paragraph`,Ew]];function Ow(){this.ruler=new AC;for(let e=0;e<Dw.length;e++)this.ruler.push(Dw[e][0],Dw[e][1],{alt:(Dw[e][2]||[]).slice()})}Ow.prototype.tokenize=function(e,t,n){let r=this.ruler.getRules(``),i=r.length,a=e.md.options.maxNesting,o=t,s=!1;for(;o<n&&(e.line=o=e.skipEmptyLines(o),!(o>=n||e.sCount[o]<e.blkIndent));){if(e.level>=a){e.line=n;break}let t=e.line,c=!1;for(let a=0;a<i;a++)if(c=r[a](e,o,n,!1),c){if(t>=e.line)throw Error(`block rule didn't increment state.line`);break}if(!c)throw Error(`none of the block rules matched`);e.tight=!s,e.isEmpty(e.line-1)&&(s=!0),o=e.line,o<n&&e.isEmpty(o)&&(s=!0,o++,e.line=o)}},Ow.prototype.parse=function(e,t,n,r){if(!e)return;let i=new this.State(e,t,n,r);this.tokenize(i,i.line,i.lineMax)},Ow.prototype.State=iw;function kw(e,t,n,r){this.src=e,this.env=n,this.md=t,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending=``,this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}kw.prototype.pushPending=function(){let e=new jC(`text`,``,0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending=``,e},kw.prototype.push=function(e,t,n){this.pending&&this.pushPending();let r=new jC(e,t,n),i=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r},kw.prototype.scanDelims=function(e,t){let n=this.posMax,r=this.src.charCodeAt(e),i=e>0?this.src.charCodeAt(e-1):32,a=e;for(;a<n&&this.src.charCodeAt(a)===r;)a++;let o=a-e,s=a<n?this.src.charCodeAt(a):32,c=xC(i)||bC(String.fromCharCode(i)),l=xC(s)||bC(String.fromCharCode(s)),u=yC(i),d=yC(s),f=!d&&(!l||u||c),p=!u&&(!c||d||l);return{can_open:f&&(t||!p||c),can_close:p&&(t||!f||l),length:o}},kw.prototype.Token=jC;function Aw(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function jw(e,t){let n=e.pos;for(;n<e.posMax&&!Aw(e.src.charCodeAt(n));)n++;return n===e.pos?!1:(t||(e.pending+=e.src.slice(e.pos,n)),e.pos=n,!0)}var Mw=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function Nw(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;let n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;let i=e.pending.match(Mw);if(!i)return!1;let a=i[1],o=e.md.linkify.matchAtStart(e.src.slice(n-a.length));if(!o)return!1;let s=o.url;if(s.length<=a.length)return!1;let c=s.length;for(;c>0&&s.charCodeAt(c-1)===42;)c--;c!==s.length&&(s=s.slice(0,c));let l=e.md.normalizeLink(s);if(!e.md.validateLink(l))return!1;if(!t){e.pending=e.pending.slice(0,-a.length);let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,l]],t.markup=`linkify`,t.info=`auto`;let n=e.push(`text`,``,0);n.content=e.md.normalizeLinkText(s);let r=e.push(`link_close`,`a`,-1);r.markup=`linkify`,r.info=`auto`}return e.pos+=s.length-a.length,!0}function Pw(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;let r=e.pending.length-1,i=e.posMax;if(!t)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){let t=r-1;for(;t>=1&&e.pending.charCodeAt(t-1)===32;)t--;e.pending=e.pending.slice(0,t),e.push(`hardbreak`,`br`,0)}else e.pending=e.pending.slice(0,-1),e.push(`softbreak`,`br`,0);else e.push(`softbreak`,`br`,0);for(n++;n<i&&X(e.src.charCodeAt(n));)n++;return e.pos=n,!0}var Fw=[];for(let e=0;e<256;e++)Fw.push(0);`\\!"#$%&'()*+,./:;<=>?@[]^_\`{|}~-`.split(``).forEach(function(e){Fw[e.charCodeAt(0)]=1});function Iw(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=e.src.charCodeAt(n);if(i===10){for(t||e.push(`hardbreak`,`br`,0),n++;n<r&&(i=e.src.charCodeAt(n),X(i));)n++;return e.pos=n,!0}let a=e.src[n];if(i>=55296&&i<=56319&&n+1<r){let t=e.src.charCodeAt(n+1);t>=56320&&t<=57343&&(a+=e.src[n+1],n++)}let o=`\\`+a;if(!t){let t=e.push(`text_special`,``,0);i<256&&Fw[i]!==0?t.content=a:t.content=o,t.markup=o,t.info=`escape`}return e.pos=n+1,!0}function Lw(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==96)return!1;let r=n;n++;let i=e.posMax;for(;n<i&&e.src.charCodeAt(n)===96;)n++;let a=e.src.slice(r,n),o=a.length;if(e.backticksScanned&&(e.backticks[o]||0)<=r)return t||(e.pending+=a),e.pos+=o,!0;let s=n,c;for(;(c=e.src.indexOf("`",s))!==-1;){for(s=c+1;s<i&&e.src.charCodeAt(s)===96;)s++;let r=s-c;if(r===o){if(!t){let t=e.push(`code_inline`,`code`,0);t.markup=a,t.content=e.src.slice(n,c).replace(/\n/g,` `).replace(/^ (.+) $/,`$1`)}return e.pos=s,!0}e.backticks[r]=c}return e.backticksScanned=!0,t||(e.pending+=a),e.pos+=o,!0}function Rw(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==126)return!1;let i=e.scanDelims(e.pos,!0),a=i.length,o=String.fromCharCode(r);if(a<2)return!1;let s;a%2&&(s=e.push(`text`,``,0),s.content=o,a--);for(let t=0;t<a;t+=2)s=e.push(`text`,``,0),s.content=o+o,e.delimiters.push({marker:r,length:0,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return e.pos+=i.length,!0}function zw(e,t){let n,r=[],i=t.length;for(let a=0;a<i;a++){let i=t[a];if(i.marker!==126||i.end===-1)continue;let o=t[i.end];n=e.tokens[i.token],n.type=`s_open`,n.tag=`s`,n.nesting=1,n.markup=`~~`,n.content=``,n=e.tokens[o.token],n.type=`s_close`,n.tag=`s`,n.nesting=-1,n.markup=`~~`,n.content=``,e.tokens[o.token-1].type===`text`&&e.tokens[o.token-1].content===`~`&&r.push(o.token-1)}for(;r.length;){let t=r.pop(),i=t+1;for(;i<e.tokens.length&&e.tokens[i].type===`s_close`;)i++;i--,t!==i&&(n=e.tokens[i],e.tokens[i]=e.tokens[t],e.tokens[t]=n)}}function Bw(e){let t=e.tokens_meta,n=e.tokens_meta.length;zw(e,e.delimiters);for(let r=0;r<n;r++)t[r]&&t[r].delimiters&&zw(e,t[r].delimiters)}var Vw={tokenize:Rw,postProcess:Bw};function Hw(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==95&&r!==42)return!1;let i=e.scanDelims(e.pos,r===42);for(let t=0;t<i.length;t++){let t=e.push(`text`,``,0);t.content=String.fromCharCode(r),e.delimiters.push({marker:r,length:i.length,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return e.pos+=i.length,!0}function Uw(e,t){let n=t.length;for(let r=n-1;r>=0;r--){let n=t[r];if(n.marker!==95&&n.marker!==42||n.end===-1)continue;let i=t[n.end],a=r>0&&t[r-1].end===n.end+1&&t[r-1].marker===n.marker&&t[r-1].token===n.token-1&&t[n.end+1].token===i.token+1,o=String.fromCharCode(n.marker),s=e.tokens[n.token];s.type=a?`strong_open`:`em_open`,s.tag=a?`strong`:`em`,s.nesting=1,s.markup=a?o+o:o,s.content=``;let c=e.tokens[i.token];c.type=a?`strong_close`:`em_close`,c.tag=a?`strong`:`em`,c.nesting=-1,c.markup=a?o+o:o,c.content=``,a&&(e.tokens[t[r-1].token].content=``,e.tokens[t[n.end+1].token].content=``,r--)}}function Ww(e){let t=e.tokens_meta,n=e.tokens_meta.length;Uw(e,e.delimiters);for(let r=0;r<n;r++)t[r]&&t[r].delimiters&&Uw(e,t[r].delimiters)}var Gw={tokenize:Hw,postProcess:Ww};function Kw(e,t){let n,r,i,a,o=``,s=``,c=e.pos,l=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;let u=e.pos,d=e.posMax,f=e.pos+1,p=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(p<0)return!1;let m=p+1;if(m<d&&e.src.charCodeAt(m)===40){for(l=!1,m++;m<d&&(n=e.src.charCodeAt(m),!(!X(n)&&n!==10));m++);if(m>=d)return!1;if(c=m,i=e.md.helpers.parseLinkDestination(e.src,m,e.posMax),i.ok){for(o=e.md.normalizeLink(i.str),e.md.validateLink(o)?m=i.pos:o=``,c=m;m<d&&(n=e.src.charCodeAt(m),!(!X(n)&&n!==10));m++);if(i=e.md.helpers.parseLinkTitle(e.src,m,e.posMax),m<d&&c!==m&&i.ok)for(s=i.str,m=i.pos;m<d&&(n=e.src.charCodeAt(m),!(!X(n)&&n!==10));m++);}(m>=d||e.src.charCodeAt(m)!==41)&&(l=!0),m++}if(l){if(e.env.references===void 0)return!1;if(m<d&&e.src.charCodeAt(m)===91?(c=m+1,m=e.md.helpers.parseLinkLabel(e,m),m>=0?r=e.src.slice(c,m++):m=p+1):m=p+1,r||=e.src.slice(f,p),a=e.env.references[SC(r)],!a)return e.pos=u,!1;o=a.href,s=a.title}if(!t){e.pos=f,e.posMax=p;let t=e.push(`link_open`,`a`,1),n=[[`href`,o]];t.attrs=n,s&&n.push([`title`,s]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push(`link_close`,`a`,-1)}return e.pos=m,e.posMax=d,!0}function qw(e,t){let n,r,i,a,o,s,c,l,u=``,d=e.pos,f=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;let p=e.pos+2,m=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(m<0)return!1;if(a=m+1,a<f&&e.src.charCodeAt(a)===40){for(a++;a<f&&(n=e.src.charCodeAt(a),!(!X(n)&&n!==10));a++);if(a>=f)return!1;for(l=a,s=e.md.helpers.parseLinkDestination(e.src,a,e.posMax),s.ok&&(u=e.md.normalizeLink(s.str),e.md.validateLink(u)?a=s.pos:u=``),l=a;a<f&&(n=e.src.charCodeAt(a),!(!X(n)&&n!==10));a++);if(s=e.md.helpers.parseLinkTitle(e.src,a,e.posMax),a<f&&l!==a&&s.ok)for(c=s.str,a=s.pos;a<f&&(n=e.src.charCodeAt(a),!(!X(n)&&n!==10));a++);else c=``;if(a>=f||e.src.charCodeAt(a)!==41)return e.pos=d,!1;a++}else{if(e.env.references===void 0)return!1;if(a<f&&e.src.charCodeAt(a)===91?(l=a+1,a=e.md.helpers.parseLinkLabel(e,a),a>=0?i=e.src.slice(l,a++):a=m+1):a=m+1,i||=e.src.slice(p,m),o=e.env.references[SC(i)],!o)return e.pos=d,!1;u=o.href,c=o.title}if(!t){r=e.src.slice(p,m);let t=[];e.md.inline.parse(r,e.md,e.env,t);let n=e.push(`image`,`img`,0),i=[[`src`,u],[`alt`,``]];n.attrs=i,n.children=t,n.content=r,c&&i.push([`title`,c])}return e.pos=a,e.posMax=f,!0}var Jw=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,Yw=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Xw(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==60)return!1;let r=e.pos,i=e.posMax;for(;;){if(++n>=i)return!1;let t=e.src.charCodeAt(n);if(t===60)return!1;if(t===62)break}let a=e.src.slice(r+1,n);if(Yw.test(a)){let n=e.md.normalizeLink(a);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}if(Jw.test(a)){let n=e.md.normalizeLink(`mailto:`+a);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}return!1}function Zw(e){return/^<a[>\s]/i.test(e)}function Qw(e){return/^<\/a\s*>/i.test(e)}function $w(e){let t=e|32;return t>=97&&t<=122}function eT(e,t){if(!e.md.options.html)return!1;let n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=n)return!1;let i=e.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!$w(i))return!1;let a=e.src.slice(r).match(bw);if(!a)return!1;if(!t){let t=e.push(`html_inline`,``,0);t.content=a[0],Zw(t.content)&&e.linkLevel++,Qw(t.content)&&e.linkLevel--}return e.pos+=a[0].length,!0}var tT=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,nT=/^&([a-z][a-z0-9]{1,31});/i;function rT(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){let r=e.src.slice(n).match(tT);if(r){if(!t){let t=r[1][0].toLowerCase()===`x`?parseInt(r[1].slice(1),16):parseInt(r[1],10),n=e.push(`text_special`,``,0);n.content=iC(t)?aC(t):aC(65533),n.markup=r[0],n.info=`entity`}return e.pos+=r[0].length,!0}}else{let r=e.src.slice(n).match(nT);if(r){let n=XS(r[0]);if(n!==r[0]){if(!t){let t=e.push(`text_special`,``,0);t.content=n,t.markup=r[0],t.info=`entity`}return e.pos+=r[0].length,!0}}}return!1}function iT(e){let t={},n=e.length;if(!n)return;let r=0,i=-2,a=[];for(let o=0;o<n;o++){let n=e[o];if(a.push(0),(e[r].marker!==n.marker||i!==n.token-1)&&(r=o),i=n.token,n.length=n.length||0,!n.close)continue;t.hasOwnProperty(n.marker)||(t[n.marker]=[-1,-1,-1,-1,-1,-1]);let s=t[n.marker][(n.open?3:0)+n.length%3],c=r-a[r]-1,l=c;for(;c>s;c-=a[c]+1){let t=e[c];if(t.marker===n.marker&&t.open&&t.end<0){let r=!1;if((t.close||n.open)&&(t.length+n.length)%3==0&&(t.length%3!=0||n.length%3!=0)&&(r=!0),!r){let r=c>0&&!e[c-1].open?a[c-1]+1:0;a[o]=o-c+r,a[c]=r,n.open=!1,t.end=o,t.close=!1,l=-1,i=-2;break}}}l!==-1&&(t[n.marker][(n.open?3:0)+(n.length||0)%3]=l)}}function aT(e){let t=e.tokens_meta,n=e.tokens_meta.length;iT(e.delimiters);for(let e=0;e<n;e++)t[e]&&t[e].delimiters&&iT(t[e].delimiters)}function oT(e){let t,n,r=0,i=e.tokens,a=e.tokens.length;for(t=n=0;t<a;t++)i[t].nesting<0&&r--,i[t].level=r,i[t].nesting>0&&r++,i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}var sT=[[`text`,jw],[`linkify`,Nw],[`newline`,Pw],[`escape`,Iw],[`backticks`,Lw],[`strikethrough`,Vw.tokenize],[`emphasis`,Gw.tokenize],[`link`,Kw],[`image`,qw],[`autolink`,Xw],[`html_inline`,eT],[`entity`,rT]],cT=[[`balance_pairs`,aT],[`strikethrough`,Vw.postProcess],[`emphasis`,Gw.postProcess],[`fragments_join`,oT]];function lT(){this.ruler=new AC;for(let e=0;e<sT.length;e++)this.ruler.push(sT[e][0],sT[e][1]);this.ruler2=new AC;for(let e=0;e<cT.length;e++)this.ruler2.push(cT[e][0],cT[e][1])}lT.prototype.skipToken=function(e){let t=e.pos,n=this.ruler.getRules(``),r=n.length,i=e.md.options.maxNesting,a=e.cache;if(a[t]!==void 0){e.pos=a[t];return}let o=!1;if(e.level<i){for(let i=0;i<r;i++)if(e.level++,o=n[i](e,!0),e.level--,o){if(t>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}else e.pos=e.posMax;o||e.pos++,a[t]=e.pos},lT.prototype.tokenize=function(e){let t=this.ruler.getRules(``),n=t.length,r=e.posMax,i=e.md.options.maxNesting;for(;e.pos<r;){let a=e.pos,o=!1;if(e.level<i){for(let r=0;r<n;r++)if(o=t[r](e,!1),o){if(a>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}if(o){if(e.pos>=r)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()},lT.prototype.parse=function(e,t,n,r){let i=new this.State(e,t,n,r);this.tokenize(i);let a=this.ruler2.getRules(``),o=a.length;for(let e=0;e<o;e++)a[e](i)},lT.prototype.State=kw;function uT(e){let t={};e||={},t.src_Any=TS.source,t.src_Cc=ES.source,t.src_Z=AS.source,t.src_P=OS.source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join(`|`),t.src_ZCc=[t.src_Z,t.src_Cc].join(`|`);let n=`[><|]`;return t.src_pseudo_letter=`(?:(?!`+n+`|`+t.src_ZPCc+`)`+t.src_Any+`)`,t.src_ip4=`(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)`,t.src_auth=`(?:(?:(?!`+t.src_ZCc+`|[@/\\[\\]()]).)+@)?`,t.src_port=`(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?`,t.src_host_terminator=`(?=$|`+n+`|`+t.src_ZPCc+`)(?!`+(e[`---`]?`-(?!--)|`:`-|`)+`_|:\\d|\\.-|\\.(?!$|`+t.src_ZPCc+`))`,t.src_path=`(?:[/?#](?:(?!`+t.src_ZCc+`|[><|]|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+t.src_ZCc+`|\\]).)*\\]|\\((?:(?!`+t.src_ZCc+`|[)]).)*\\)|\\{(?:(?!`+t.src_ZCc+`|[}]).)*\\}|\\"(?:(?!`+t.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+t.src_ZCc+`|[']).)+\\'|\\'(?=`+t.src_pseudo_letter+`|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!`+t.src_ZCc+`|[.]|$)|`+(e[`---`]?`\\-(?!--(?:[^-]|$))(?:-*)|`:`\\-+|`)+`,(?!`+t.src_ZCc+`|$)|;(?!`+t.src_ZCc+`|$)|\\!+(?!`+t.src_ZCc+`|[!]|$)|\\?(?!`+t.src_ZCc+`|[?]|$))+|\\/)?`,t.src_email_name=`[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*`,t.src_xn=`xn--[a-z0-9\\-]{1,59}`,t.src_domain_root=`(?:`+t.src_xn+`|`+t.src_pseudo_letter+`{1,63})`,t.src_domain=`(?:`+t.src_xn+`|(?:`+t.src_pseudo_letter+`)|(?:`+t.src_pseudo_letter+`(?:-|`+t.src_pseudo_letter+`){0,61}`+t.src_pseudo_letter+`))`,t.src_host=`(?:(?:(?:(?:`+t.src_domain+`)\\.)*`+t.src_domain+`))`,t.tpl_host_fuzzy=`(?:`+t.src_ip4+`|(?:(?:(?:`+t.src_domain+`)\\.)+(?:%TLDS%)))`,t.tpl_host_no_ip_fuzzy=`(?:(?:(?:`+t.src_domain+`)\\.)+(?:%TLDS%))`,t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test=`localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:`+t.src_ZPCc+`|>|$))`,t.tpl_email_fuzzy=`(^|`+n+`|"|\\(|`+t.src_ZCc+`)(`+t.src_email_name+`@`+t.tpl_host_fuzzy_strict+`)`,t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+`)`,t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+`)`,t}function dT(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}function fT(e){return Object.prototype.toString.call(e)}function pT(e){return fT(e)===`[object String]`}function mT(e){return fT(e)===`[object Object]`}function hT(e){return fT(e)===`[object RegExp]`}function gT(e){return fT(e)===`[object Function]`}function _T(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}var vT={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function yT(e){return Object.keys(e||{}).reduce(function(e,t){return e||vT.hasOwnProperty(t)},!1)}var bT={"http:":{validate:function(e,t,n){let r=e.slice(t);return n.re.http||(n.re.http=RegExp(`^\\/\\/`+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,`i`)),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":`http:`,"ftp:":`http:`,"//":{validate:function(e,t,n){let r=e.slice(t);return n.re.no_http||(n.re.no_http=RegExp(`^`+n.re.src_auth+`(?:localhost|(?:(?:`+n.re.src_domain+`)\\.)+`+n.re.src_domain_root+`)`+n.re.src_port+n.re.src_host_terminator+n.re.src_path,`i`)),n.re.no_http.test(r)?t>=3&&e[t-3]===`:`||t>=3&&e[t-3]===`/`?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){let r=e.slice(t);return n.re.mailto||(n.re.mailto=RegExp(`^`+n.re.src_email_name+`@`+n.re.src_host_strict,`i`)),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},xT=`a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]`,ST=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф`.split(`|`);function CT(e){e.__index__=-1,e.__text_cache__=``}function wT(e){return function(t,n){let r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function TT(){return function(e,t){t.normalize(e)}}function ET(e){let t=e.re=uT(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(xT),n.push(t.src_xn),t.src_tlds=n.join(`|`);function r(e){return e.replace(`%TLDS%`,t.src_tlds)}t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),`i`),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),`i`),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),`i`),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),`i`);let i=[];e.__compiled__={};function a(e,t){throw Error(`(LinkifyIt) Invalid schema "`+e+`": `+t)}Object.keys(e.__schemas__).forEach(function(t){let n=e.__schemas__[t];if(n===null)return;let r={validate:null,link:null};if(e.__compiled__[t]=r,mT(n)){hT(n.validate)?r.validate=wT(n.validate):gT(n.validate)?r.validate=n.validate:a(t,n),gT(n.normalize)?r.normalize=n.normalize:n.normalize?a(t,n):r.normalize=TT();return}if(pT(n)){i.push(t);return}a(t,n)}),i.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[``]={validate:null,normalize:TT()};let o=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(_T).join(`|`);e.re.schema_test=RegExp(`(^|(?!_)(?:[><|]|`+t.src_ZPCc+`))(`+o+`)`,`i`),e.re.schema_search=RegExp(`(^|(?!_)(?:[><|]|`+t.src_ZPCc+`))(`+o+`)`,`ig`),e.re.schema_at_start=RegExp(`^`+e.re.schema_search.source,`i`),e.re.pretest=RegExp(`(`+e.re.schema_test.source+`)|(`+e.re.host_fuzzy_test.source+`)|@`,`i`),CT(e)}function DT(e,t){let n=e.__index__,r=e.__last_index__,i=e.__text_cache__.slice(n,r);this.schema=e.__schema__.toLowerCase(),this.index=n+t,this.lastIndex=r+t,this.raw=i,this.text=i,this.url=i}function OT(e,t){let n=new DT(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function kT(e,t){if(!(this instanceof kT))return new kT(e,t);t||yT(e)&&(t=e,e={}),this.__opts__=dT({},vT,t),this.__index__=-1,this.__last_index__=-1,this.__schema__=``,this.__text_cache__=``,this.__schemas__=dT({},bT,e),this.__compiled__={},this.__tlds__=ST,this.__tlds_replaced__=!1,this.re={},ET(this)}kT.prototype.add=function(e,t){return this.__schemas__[e]=t,ET(this),this},kT.prototype.set=function(e){return this.__opts__=dT(this.__opts__,e),this},kT.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let t,n,r,i,a,o,s,c,l;if(this.re.schema_test.test(e)){for(s=this.re.schema_search,s.lastIndex=0;(t=s.exec(e))!==null;)if(i=this.testSchemaAt(e,t[2],s.lastIndex),i){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__[`http:`]&&(c=e.search(this.re.host_fuzzy_test),c>=0&&(this.__index__<0||c<this.__index__)&&(n=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(a=n.index+n[1].length,(this.__index__<0||a<this.__index__)&&(this.__schema__=``,this.__index__=a,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__[`mailto:`]&&(l=e.indexOf(`@`),l>=0&&(r=e.match(this.re.email_fuzzy))!==null&&(a=r.index+r[1].length,o=r.index+r[0].length,(this.__index__<0||a<this.__index__||a===this.__index__&&o>this.__last_index__)&&(this.__schema__=`mailto:`,this.__index__=a,this.__last_index__=o))),this.__index__>=0},kT.prototype.pretest=function(e){return this.re.pretest.test(e)},kT.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},kT.prototype.match=function(e){let t=[],n=0;this.__index__>=0&&this.__text_cache__===e&&(t.push(OT(this,n)),n=this.__last_index__);let r=n?e.slice(n):e;for(;this.test(r);)t.push(OT(this,n)),r=r.slice(this.__last_index__),n+=this.__last_index__;return t.length?t:null},kT.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;let t=this.re.schema_at_start.exec(e);if(!t)return null;let n=this.testSchemaAt(e,t[2],t[0].length);return n?(this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+n,OT(this,0)):null},kT.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,t,n){return e!==n[t-1]}).reverse(),ET(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,ET(this),this)},kT.prototype.normalize=function(e){e.schema||(e.url=`http://`+e.url),e.schema===`mailto:`&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:`+e.url)},kT.prototype.onCompile=function(){};var AT=2147483647,jT=36,MT=1,NT=26,PT=38,FT=700,IT=72,LT=128,RT=`-`,zT=/^xn--/,BT=/[^\0-\x7F]/,VT=/[\x2E\u3002\uFF0E\uFF61]/g,HT={overflow:`Overflow: input needs wider integers to process`,"not-basic":`Illegal input >= 0x80 (not a basic code point)`,"invalid-input":`Invalid input`},UT=jT-MT,WT=Math.floor,GT=String.fromCharCode;function KT(e){throw RangeError(HT[e])}function qT(e,t){let n=[],r=e.length;for(;r--;)n[r]=t(e[r]);return n}function JT(e,t){let n=e.split(`@`),r=``;n.length>1&&(r=n[0]+`@`,e=n[1]),e=e.replace(VT,`.`);let i=qT(e.split(`.`),t).join(`.`);return r+i}function YT(e){let t=[],n=0,r=e.length;for(;n<r;){let i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){let r=e.charCodeAt(n++);(r&64512)==56320?t.push(((i&1023)<<10)+(r&1023)+65536):(t.push(i),n--)}else t.push(i)}return t}var XT=e=>String.fromCodePoint(...e),ZT=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:jT},QT=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},$T=function(e,t,n){let r=0;for(e=n?WT(e/FT):e>>1,e+=WT(e/t);e>UT*NT>>1;r+=jT)e=WT(e/UT);return WT(r+(UT+1)*e/(e+PT))},eE=function(e){let t=[],n=e.length,r=0,i=LT,a=IT,o=e.lastIndexOf(RT);o<0&&(o=0);for(let n=0;n<o;++n)e.charCodeAt(n)>=128&&KT(`not-basic`),t.push(e.charCodeAt(n));for(let s=o>0?o+1:0;s<n;){let o=r;for(let t=1,i=jT;;i+=jT){s>=n&&KT(`invalid-input`);let o=ZT(e.charCodeAt(s++));o>=jT&&KT(`invalid-input`),o>WT((AT-r)/t)&&KT(`overflow`),r+=o*t;let c=i<=a?MT:i>=a+NT?NT:i-a;if(o<c)break;let l=jT-c;t>WT(AT/l)&&KT(`overflow`),t*=l}let c=t.length+1;a=$T(r-o,c,o==0),WT(r/c)>AT-i&&KT(`overflow`),i+=WT(r/c),r%=c,t.splice(r++,0,i)}return String.fromCodePoint(...t)},tE=function(e){let t=[];e=YT(e);let n=e.length,r=LT,i=0,a=IT;for(let n of e)n<128&&t.push(GT(n));let o=t.length,s=o;for(o&&t.push(RT);s<n;){let n=AT;for(let t of e)t>=r&&t<n&&(n=t);let c=s+1;n-r>WT((AT-i)/c)&&KT(`overflow`),i+=(n-r)*c,r=n;for(let n of e)if(n<r&&++i>AT&&KT(`overflow`),n===r){let e=i;for(let n=jT;;n+=jT){let r=n<=a?MT:n>=a+NT?NT:n-a;if(e<r)break;let i=e-r,o=jT-r;t.push(GT(QT(r+i%o,0))),e=WT(i/o)}t.push(GT(QT(e,0))),a=$T(i,c,s===o),i=0,++s}++i,++r}return t.join(``)},nE={version:`2.3.1`,ucs2:{decode:YT,encode:XT},decode:eE,encode:tE,toASCII:function(e){return JT(e,function(e){return BT.test(e)?`xn--`+tE(e):e})},toUnicode:function(e){return JT(e,function(e){return zT.test(e)?eE(e.slice(4).toLowerCase()):e})}},rE={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`inline`,`text_join`]},block:{rules:[`paragraph`]},inline:{rules:[`text`],rules2:[`balance_pairs`,`fragments_join`]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`inline`,`text_join`]},block:{rules:[`blockquote`,`code`,`fence`,`heading`,`hr`,`html_block`,`lheading`,`list`,`reference`,`paragraph`]},inline:{rules:[`autolink`,`backticks`,`emphasis`,`entity`,`escape`,`html_inline`,`image`,`link`,`newline`,`text`],rules2:[`balance_pairs`,`emphasis`,`fragments_join`]}}}},iE=/^(vbscript|javascript|file|data):/,aE=/^data:image\/(gif|png|jpeg|webp);/;function oE(e){let t=e.trim().toLowerCase();return iE.test(t)?aE.test(t):!0}var sE=[`http:`,`https:`,`mailto:`];function cE(e){let t=CS(e,!0);if(t.hostname&&(!t.protocol||sE.indexOf(t.protocol)>=0))try{t.hostname=nE.toASCII(t.hostname)}catch{}return uS(dS(t))}function lE(e){let t=CS(e,!0);if(t.hostname&&(!t.protocol||sE.indexOf(t.protocol)>=0))try{t.hostname=nE.toUnicode(t.hostname)}catch{}return sS(dS(t),sS.defaultChars+`%`)}function uE(e,t){if(!(this instanceof uE))return new uE(e,t);t||$S(e)||(t=e||{},e=`default`),this.inline=new lT,this.block=new Ow,this.core=new rw,this.renderer=new kC,this.linkify=new kT,this.validateLink=oE,this.normalizeLink=cE,this.normalizeLinkText=lE,this.utils=ZS,this.helpers=nC({},DC),this.options={},this.configure(e),t&&this.set(t)}uE.prototype.set=function(e){return nC(this.options,e),this},uE.prototype.configure=function(e){let t=this;if($S(e)){let t=e;if(e=rE[t],!e)throw Error('Wrong `markdown-it` preset "'+t+`", check name`)}if(!e)throw Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach(function(n){e.components[n].rules&&t[n].ruler.enableOnly(e.components[n].rules),e.components[n].rules2&&t[n].ruler2.enableOnly(e.components[n].rules2)}),this},uE.prototype.enable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(function(t){n=n.concat(this[t].ruler.enable(e,!0))},this),n=n.concat(this.inline.ruler2.enable(e,!0));let r=e.filter(function(e){return n.indexOf(e)<0});if(r.length&&!t)throw Error(`MarkdownIt. Failed to enable unknown rule(s): `+r);return this},uE.prototype.disable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(function(t){n=n.concat(this[t].ruler.disable(e,!0))},this),n=n.concat(this.inline.ruler2.disable(e,!0));let r=e.filter(function(e){return n.indexOf(e)<0});if(r.length&&!t)throw Error(`MarkdownIt. Failed to disable unknown rule(s): `+r);return this},uE.prototype.use=function(e){let t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this},uE.prototype.parse=function(e,t){if(typeof e!=`string`)throw Error(`Input data should be a String`);let n=new this.core.State(e,this,t);return this.core.process(n),n.tokens},uE.prototype.render=function(e,t){return t||={},this.renderer.render(this.parse(e,t),this.options,t)},uE.prototype.parseInline=function(e,t){let n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens},uE.prototype.renderInline=function(e,t){return t||={},this.renderer.render(this.parseInline(e,t),this.options,t)};var dE=new jd({nodes:{doc:{content:`block+`},paragraph:{content:`inline*`,group:`block`,parseDOM:[{tag:`p`}],toDOM(){return[`p`,0]}},blockquote:{content:`block+`,group:`block`,parseDOM:[{tag:`blockquote`}],toDOM(){return[`blockquote`,0]}},horizontal_rule:{group:`block`,parseDOM:[{tag:`hr`}],toDOM(){return[`div`,[`hr`]]}},heading:{attrs:{level:{default:1}},content:`(text | image)*`,group:`block`,defining:!0,parseDOM:[{tag:`h1`,attrs:{level:1}},{tag:`h2`,attrs:{level:2}},{tag:`h3`,attrs:{level:3}},{tag:`h4`,attrs:{level:4}},{tag:`h5`,attrs:{level:5}},{tag:`h6`,attrs:{level:6}}],toDOM(e){return[`h`+e.attrs.level,0]}},code_block:{content:`text*`,group:`block`,code:!0,defining:!0,marks:``,attrs:{params:{default:``}},parseDOM:[{tag:`pre`,preserveWhitespace:`full`,getAttrs:e=>({params:e.getAttribute(`data-params`)||``})}],toDOM(e){return[`pre`,e.attrs.params?{"data-params":e.attrs.params}:{},[`code`,0]]}},ordered_list:{content:`list_item+`,group:`block`,attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:`ol`,getAttrs(e){return{order:e.hasAttribute(`start`)?+e.getAttribute(`start`):1,tight:e.hasAttribute(`data-tight`)}}}],toDOM(e){return[`ol`,{start:e.attrs.order==1?null:e.attrs.order,"data-tight":e.attrs.tight?`true`:null},0]}},bullet_list:{content:`list_item+`,group:`block`,attrs:{tight:{default:!1}},parseDOM:[{tag:`ul`,getAttrs:e=>({tight:e.hasAttribute(`data-tight`)})}],toDOM(e){return[`ul`,{"data-tight":e.attrs.tight?`true`:null},0]}},list_item:{content:`block+`,defining:!0,parseDOM:[{tag:`li`}],toDOM(){return[`li`,0]}},text:{group:`inline`},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:`inline`,draggable:!0,parseDOM:[{tag:`img[src]`,getAttrs(e){return{src:e.getAttribute(`src`),title:e.getAttribute(`title`),alt:e.getAttribute(`alt`)}}}],toDOM(e){return[`img`,e.attrs]}},hard_break:{inline:!0,group:`inline`,selectable:!1,parseDOM:[{tag:`br`}],toDOM(){return[`br`]}}},marks:{em:{parseDOM:[{tag:`i`},{tag:`em`},{style:`font-style=italic`},{style:`font-style=normal`,clearMark:e=>e.type.name==`em`}],toDOM(){return[`em`]}},strong:{parseDOM:[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!=`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name==`strong`},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM(){return[`strong`]}},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:`a[href]`,getAttrs(e){return{href:e.getAttribute(`href`),title:e.getAttribute(`title`)}}}],toDOM(e){return[`a`,e.attrs]}},code:{code:!0,parseDOM:[{tag:`code`}],toDOM(){return[`code`]}}}});function fE(e,t){if(e.isText&&t.isText&&H.sameSet(e.marks,t.marks))return e.withText(e.text+t.text)}var pE=class{constructor(e,t){this.schema=e,this.tokenHandlers=t,this.stack=[{type:e.topNodeType,attrs:null,content:[],marks:H.none}]}top(){return this.stack[this.stack.length-1]}push(e){this.stack.length&&this.top().content.push(e)}addText(e){if(!e)return;let t=this.top(),n=t.content,r=n[n.length-1],i=this.schema.text(e,t.marks),a;r&&(a=fE(r,i))?n[n.length-1]=a:n.push(i)}openMark(e){let t=this.top();t.marks=e.addToSet(t.marks)}closeMark(e){let t=this.top();t.marks=e.removeFromSet(t.marks)}parseTokens(e){for(let t=0;t<e.length;t++){let n=e[t],r=this.tokenHandlers[n.type];if(!r)throw Error("Token type `"+n.type+"` not supported by Markdown parser");r(this,n,e,t)}}addNode(e,t,n){let r=this.top(),i=e.createAndFill(t,n,r?r.marks:[]);return i?(this.push(i),i):null}openNode(e,t){this.stack.push({type:e,attrs:t,content:[],marks:H.none})}closeNode(){let e=this.stack.pop();return this.addNode(e.type,e.attrs,e.content)}};function mE(e,t,n,r){return e.getAttrs?e.getAttrs(t,n,r):e.attrs instanceof Function?e.attrs(t):e.attrs}function hE(e,t){return e.noCloseToken||t==`code_inline`||t==`code_block`||t==`fence`}function gE(e){return e[e.length-1]==`
|
|
104
|
+
`?e.slice(0,e.length-1):e}function _E(){}function vE(e,t){let n=Object.create(null);for(let r in t){let i=t[r];if(i.block){let t=e.nodeType(i.block);hE(i,r)?n[r]=(e,n,r,a)=>{e.openNode(t,mE(i,n,r,a)),e.addText(gE(n.content)),e.closeNode()}:(n[r+`_open`]=(e,n,r,a)=>e.openNode(t,mE(i,n,r,a)),n[r+`_close`]=e=>e.closeNode())}else if(i.node){let t=e.nodeType(i.node);n[r]=(e,n,r,a)=>e.addNode(t,mE(i,n,r,a))}else if(i.mark){let t=e.marks[i.mark];hE(i,r)?n[r]=(e,n,r,a)=>{e.openMark(t.create(mE(i,n,r,a))),e.addText(gE(n.content)),e.closeMark(t)}:(n[r+`_open`]=(e,n,r,a)=>e.openMark(t.create(mE(i,n,r,a))),n[r+`_close`]=e=>e.closeMark(t))}else if(i.ignore)hE(i,r)?n[r]=_E:(n[r+`_open`]=_E,n[r+`_close`]=_E);else throw RangeError(`Unrecognized parsing spec `+JSON.stringify(i))}return n.text=(e,t)=>e.addText(t.content),n.inline=(e,t)=>e.parseTokens(t.children),n.softbreak=n.softbreak||(e=>e.addText(` `)),n}var yE=class{constructor(e,t,n){this.schema=e,this.tokenizer=t,this.tokens=n,this.tokenHandlers=vE(e,n)}parse(e,t={}){let n=new pE(this.schema,this.tokenHandlers),r;n.parseTokens(this.tokenizer.parse(e,t));do r=n.closeNode();while(n.stack.length);return r||this.schema.topNodeType.createAndFill()}};function bE(e,t){for(;++t<e.length;)if(e[t].type!=`list_item_open`)return e[t].hidden;return!1}new yE(dE,uE(`commonmark`,{html:!1}),{blockquote:{block:`blockquote`},paragraph:{block:`paragraph`},list_item:{block:`list_item`},bullet_list:{block:`bullet_list`,getAttrs:(e,t,n)=>({tight:bE(t,n)})},ordered_list:{block:`ordered_list`,getAttrs:(e,t,n)=>({order:+e.attrGet(`start`)||1,tight:bE(t,n)})},heading:{block:`heading`,getAttrs:e=>({level:+e.tag.slice(1)})},code_block:{block:`code_block`,noCloseToken:!0},fence:{block:`code_block`,getAttrs:e=>({params:e.info||``}),noCloseToken:!0},hr:{node:`horizontal_rule`},image:{node:`image`,getAttrs:e=>({src:e.attrGet(`src`),title:e.attrGet(`title`)||null,alt:e.children[0]&&e.children[0].content||null})},hardbreak:{node:`hard_break`},em:{mark:`em`},strong:{mark:`strong`},link:{mark:`link`,getAttrs:e=>({href:e.attrGet(`href`),title:e.attrGet(`title`)||null})},code_inline:{mark:`code`,noCloseToken:!0}});var xE={open:``,close:``,mixable:!0},SE=new class{constructor(e,t,n={}){this.nodes=e,this.marks=t,this.options=n}serialize(e,t={}){t=Object.assign({},this.options,t);let n=new TE(this.nodes,this.marks,t);return n.renderContent(e),n.out}}({blockquote(e,t){e.wrapBlock(`> `,null,t,()=>e.renderContent(t))},code_block(e,t){let n=t.textContent.match(/`{3,}/gm),r=n?n.sort().slice(-1)[0]+"`":"```";e.write(r+(t.attrs.params||``)+`
|
|
105
|
+
`),e.text(t.textContent,!1),e.write(`
|
|
106
|
+
`),e.write(r),e.closeBlock(t)},heading(e,t){e.write(e.repeat(`#`,t.attrs.level)+` `),e.renderInline(t,!1),e.closeBlock(t)},horizontal_rule(e,t){e.write(t.attrs.markup||`---`),e.closeBlock(t)},bullet_list(e,t){e.renderList(t,` `,()=>(t.attrs.bullet||`*`)+` `)},ordered_list(e,t){let n=t.attrs.order||1,r=String(n+t.childCount-1).length,i=e.repeat(` `,r+2);e.renderList(t,i,t=>{let i=String(n+t);return e.repeat(` `,r-i.length)+i+`. `})},list_item(e,t){e.renderContent(t)},paragraph(e,t){e.renderInline(t),e.closeBlock(t)},image(e,t){e.write(`]/g,`\\$&`)+(t.attrs.title?` "`+t.attrs.title.replace(/"/g,`\\"`)+`"`:``)+`)`)},hard_break(e,t,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=t.type){e.write(`\\
|
|
107
|
+
`);return}},text(e,t){e.text(t.text,!e.inAutolink)}},{em:{open:`*`,close:`*`,mixable:!0,expelEnclosingWhitespace:!0},strong:{open:`**`,close:`**`,mixable:!0,expelEnclosingWhitespace:!0},link:{open(e,t,n,r){return e.inAutolink=wE(t,n,r),e.inAutolink?`<`:`[`},close(e,t,n,r){let{inAutolink:i}=e;return e.inAutolink=void 0,i?`>`:`](`+t.attrs.href.replace(/[\(\)"]/g,`\\$&`)+(t.attrs.title?` "${t.attrs.title.replace(/"/g,`\\"`)}"`:``)+`)`},mixable:!0},code:{open(e,t,n,r){return CE(n.child(r),-1)},close(e,t,n,r){return CE(n.child(r-1),1)},escape:!1}});function CE(e,t){let n=/`+/g,r,i=0;if(e.isText)for(;r=n.exec(e.text);)i=Math.max(i,r[0].length);let a=i>0&&t>0?" `":"`";for(let e=0;e<i;e++)a+="`";return i>0&&t<0&&(a+=` `),a}function wE(e,t,n){if(e.attrs.title||!/^\w+:/.test(e.attrs.href))return!1;let r=t.child(n);return!r.isText||r.text!=e.attrs.href||r.marks[r.marks.length-1]!=e?!1:n==t.childCount-1||!e.isInSet(t.child(n+1).marks)}var TE=class{constructor(e,t,n){this.nodes=e,this.marks=t,this.options=n,this.delim=``,this.out=``,this.closed=null,this.inAutolink=void 0,this.atBlockStart=!1,this.inTightList=!1,this.options.tightLists===void 0&&(this.options.tightLists=!1),this.options.hardBreakNodeName===void 0&&(this.options.hardBreakNodeName=`hard_break`)}flushClose(e=2){if(this.closed){if(this.atBlank()||(this.out+=`
|
|
108
|
+
`),e>1){let t=this.delim,n=/\s+$/.exec(t);n&&(t=t.slice(0,t.length-n[0].length));for(let n=1;n<e;n++)this.out+=t+`
|
|
109
|
+
`}this.closed=null}}getMark(e){let t=this.marks[e];if(!t){if(this.options.strict!==!1)throw Error(`Mark type \`${e}\` not supported by Markdown renderer`);t=xE}return t}wrapBlock(e,t,n,r){let i=this.delim;this.write(t??e),this.delim+=e,r(),this.delim=i,this.closeBlock(n)}atBlank(){return/(^|\n)$/.test(this.out)}ensureNewLine(){this.atBlank()||(this.out+=`
|
|
110
|
+
`)}write(e){this.flushClose(),this.delim&&this.atBlank()&&(this.out+=this.delim),e&&(this.out+=e)}closeBlock(e){this.closed=e}text(e,t=!0){let n=e.split(`
|
|
111
|
+
`);for(let e=0;e<n.length;e++)this.write(),!t&&n[e][0]==`[`&&/(^|[^\\])\!$/.test(this.out)&&(this.out=this.out.slice(0,this.out.length-1)+`\\!`),this.out+=t?this.esc(n[e],this.atBlockStart):n[e],e!=n.length-1&&(this.out+=`
|
|
112
|
+
`)}render(e,t,n){if(this.nodes[e.type.name])this.nodes[e.type.name](this,e,t,n);else if(this.options.strict!==!1)throw Error("Token type `"+e.type.name+"` not supported by Markdown renderer");else e.type.isLeaf||(e.type.inlineContent?this.renderInline(e):this.renderContent(e),e.isBlock&&this.closeBlock(e))}renderContent(e){e.forEach((t,n,r)=>this.render(t,e,r))}renderInline(e,t=!0){this.atBlockStart=t;let n=[],r=``,i=(t,i,a)=>{let o=t?t.marks:[];t&&t.type.name===this.options.hardBreakNodeName&&(o=o.filter(t=>{if(a+1==e.childCount)return!1;let n=e.child(a+1);return t.isInSet(n.marks)&&(!n.isText||/\S/.test(n.text))}));let s=r;if(r=``,t&&t.isText&&o.some(e=>{let t=this.getMark(e.type.name);return t&&t.expelEnclosingWhitespace&&!e.isInSet(n)})){let[e,r,i]=/^(\s*)(.*)$/m.exec(t.text);r&&(s+=r,t=i?t.withText(i):null,t||(o=n))}if(t&&t.isText&&o.some(t=>{let n=this.getMark(t.type.name);return n&&n.expelEnclosingWhitespace&&!this.isMarkAhead(e,a+1,t)})){let[e,i,a]=/^(.*?)(\s*)$/m.exec(t.text);a&&(r=a,t=i?t.withText(i):null,t||(o=n))}let c=o.length?o[o.length-1]:null,l=c&&this.getMark(c.type.name).escape===!1,u=o.length-+!!l;outer:for(let e=0;e<u;e++){let t=o[e];if(!this.getMark(t.type.name).mixable)break;for(let r=0;r<n.length;r++){let i=n[r];if(!this.getMark(i.type.name).mixable)break;if(t.eq(i)){e>r?o=o.slice(0,r).concat(t).concat(o.slice(r,e)).concat(o.slice(e+1,u)):r>e&&(o=o.slice(0,e).concat(o.slice(e+1,r)).concat(t).concat(o.slice(r,u)));continue outer}}}let d=0;for(;d<Math.min(n.length,u)&&o[d].eq(n[d]);)++d;for(;d<n.length;)this.text(this.markString(n.pop(),!1,e,a),!1);if(s&&this.text(s),t){for(;n.length<u;){let t=o[n.length];n.push(t),this.text(this.markString(t,!0,e,a),!1),this.atBlockStart=!1}l&&t.isText?this.text(this.markString(c,!0,e,a)+t.text+this.markString(c,!1,e,a+1),!1):this.render(t,e,a),this.atBlockStart=!1}t?.isText&&t.nodeSize>0&&(this.atBlockStart=!1)};e.forEach(i),i(null,0,e.childCount),this.atBlockStart=!1}renderList(e,t,n){this.closed&&this.closed.type==e.type?this.flushClose(3):this.inTightList&&this.flushClose(1);let r=e.attrs.tight===void 0?this.options.tightLists:e.attrs.tight,i=this.inTightList;this.inTightList=r,e.forEach((i,a,o)=>{o&&r&&this.flushClose(1),this.wrapBlock(t,n(o),e,()=>this.render(i,e,o))}),this.inTightList=i}esc(e,t=!1){return e=e.replace(/[`*\\~\[\]_]/g,(t,n)=>t==`_`&&n>0&&n+1<e.length&&e[n-1].match(/\w/)&&e[n+1].match(/\w/)?t:`\\`+t),t&&(e=e.replace(/^(\+[ ]|[\-*>])/,`\\$&`).replace(/^(\s*)(#{1,6})(\s|$)/,`$1\\$2$3`).replace(/^(\s*\d+)\.\s/,`$1\\. `)),this.options.escapeExtraCharacters&&(e=e.replace(this.options.escapeExtraCharacters,`\\$&`)),e}quote(e){let t=e.indexOf(`"`)==-1?`""`:e.indexOf(`'`)==-1?`''`:`()`;return t[0]+e+t[1]}repeat(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}markString(e,t,n,r){let i=this.getMark(e.type.name),a=t?i.open:i.close;return typeof a==`string`?a:a(this,e,n,r)}getEnclosingWhitespace(e){return{leading:(e.match(/^(\s+)/)||[void 0])[0],trailing:(e.match(/(\s+)$/)||[void 0])[0]}}isMarkAhead(e,t,n){for(;;t++){if(t>=e.childCount)return!1;let r=e.child(t);if(r.type.name!=this.options.hardBreakNodeName)return n.isInSet(r.marks);t++}}},EE=e(i(((e,t)=>{var n=!0,r=!1,i=!1;t.exports=function(e,t){t&&(n=!t.enabled,r=!!t.label,i=!!t.labelAfter),e.core.ruler.after(`inline`,`github-task-lists`,function(e){for(var t=e.tokens,r=2;r<t.length;r++)s(t,r)&&(c(t[r],e.Token),a(t[r-2],`class`,`task-list-item`+(n?``:` enabled`)),a(t[o(t,r-2)],`class`,`contains-task-list`))})};function a(e,t,n){var r=e.attrIndex(t),i=[t,n];r<0?e.attrPush(i):e.attrs[r]=i}function o(e,t){for(var n=e[t].level-1,r=t-1;r>=0;r--)if(e[r].level===n)return r;return-1}function s(e,t){return p(e[t])&&m(e[t-1])&&h(e[t-2])&&g(e[t])}function c(e,t){if(e.children.unshift(l(e,t)),e.children[1].content=e.children[1].content.slice(3),e.content=e.content.slice(3),r)if(i){e.children.pop();var n=`task-item-`+Math.ceil(1e4*1e3*Math.random()-1e3);e.children[0].content=e.children[0].content.slice(0,-1)+` id="`+n+`">`,e.children.push(f(e.content,n,t))}else e.children.unshift(u(t)),e.children.push(d(t))}function l(e,t){var r=new t(`html_inline`,``,0),i=n?` disabled="" `:``;return e.content.indexOf(`[ ] `)===0?r.content=`<input class="task-list-item-checkbox"`+i+`type="checkbox">`:(e.content.indexOf(`[x] `)===0||e.content.indexOf(`[X] `)===0)&&(r.content=`<input class="task-list-item-checkbox" checked=""`+i+`type="checkbox">`),r}function u(e){var t=new e(`html_inline`,``,0);return t.content=`<label>`,t}function d(e){var t=new e(`html_inline`,``,0);return t.content=`</label>`,t}function f(e,t,n){var r=new n(`html_inline`,``,0);return r.content=`<label class="task-list-item-label" for="`+t+`">`+e+`</label>`,r.attrs=[{for:t}],r}function p(e){return e.type===`inline`}function m(e){return e.type===`paragraph_open`}function h(e){return e.type===`list_item_open`}function g(e){return e.content.indexOf(`[ ] `)===0||e.content.indexOf(`[x] `)===0||e.content.indexOf(`[X] `)===0}}))(),1),DE=Object.defineProperty,OE=(e,t,n)=>t in e?DE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kE=(e,t,n)=>(OE(e,typeof t==`symbol`?t:t+``,n),n),AE=Yy.create({name:`markdownTightLists`,addOptions:()=>({tight:!0,tightClass:`tight`,listTypes:[`bulletList`,`orderedList`]}),addGlobalAttributes(){return[{types:this.options.listTypes,attributes:{tight:{default:this.options.tight,parseHTML:e=>e.getAttribute(`data-tight`)===`true`||!e.querySelector(`p`),renderHTML:e=>({class:e.tight?this.options.tightClass:null,"data-tight":e.tight?`true`:null})}}}]},addCommands(){var e=this;return{toggleTight:function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return n=>{let{editor:r,commands:i}=n;function a(e){if(!r.isActive(e))return!1;let n=r.getAttributes(e);return i.updateAttributes(e,{tight:t??!(n!=null&&n.tight)})}return e.options.listTypes.some(e=>a(e))}}}}}),jE=uE();function ME(e,t){return jE.inline.State.prototype.scanDelims.call({src:e,posMax:e.length}),new jE.inline.State(e,null,null,[]).scanDelims(t,!0)}function NE(e,t,n,r){let i=e.substring(0,n)+e.substring(n+t.length);return i=i.substring(0,n+r)+t+i.substring(n+r),i}function PE(e,t,n,r){let i=n,a=e;for(;i<r&&!ME(a,i).can_open;)a=NE(a,t,i,1),i++;return{text:a,from:i,to:r}}function FE(e,t,n,r){let i=r,a=e;for(;i>n&&!ME(a,i).can_close;)a=NE(a,t,i,-1),i--;return{text:a,from:n,to:i}}function IE(e,t,n,r){let i={text:e,from:n,to:r};return i=PE(i.text,t,i.from,i.to),i=FE(i.text,t,i.from,i.to),i.to-i.from<t.length+1&&(i.text=i.text.substring(0,i.from)+i.text.substring(i.to+t.length)),i.text}var LE=class extends TE{constructor(e,t,n){super(e,t,n??{}),kE(this,`inTable`,!1),this.inlines=[]}render(e,t,n){super.render(e,t,n);let r=this.inlines[this.inlines.length-1];if(r!=null&&r.start&&r!=null&&r.end){let{delimiter:e,start:t,end:n}=this.normalizeInline(r);this.out=IE(this.out,e,t,n),this.inlines.pop()}}markString(e,t,n,r){let i=this.marks[e.type.name];if(i.expelEnclosingWhitespace)if(t)this.inlines.push({start:this.out.length,delimiter:i.open});else{let e=this.inlines.pop();this.inlines.push({...e,end:this.out.length})}return super.markString(e,t,n,r)}normalizeInline(e){let{start:t,end:n}=e;for(;this.out.charAt(t).match(/\s/);)t++;return{...e,start:t}}},RE=zy.create({name:`markdownHTMLMark`,addStorage(){return{markdown:{serialize:{open(e,t){return this.editor.storage.markdown.options.html?zE(t)?.[0]??``:(console.warn(`Tiptap Markdown: "${t.type.name}" mark is only available in html mode`),``)},close(e,t){return this.editor.storage.markdown.options.html?zE(t)?.[1]??``:``}},parse:{}}}}});function zE(e){let t=e.type.schema,n=t.text(` `,[e]),r=ky(V.from(n),t).match(/^(<.*?>) (<\/.*?>)$/);return r?[r[1],r[2]]:null}function BE(e){let t=`<body>${e}</body>`;return new window.DOMParser().parseFromString(t,`text/html`).body}function VE(e){return e?.replace(/</g,`<`).replace(/>/g,`>`)}function HE(e){let t=e.parentElement,n=t.cloneNode();for(;t.firstChild&&t.firstChild!==e;)n.appendChild(t.firstChild);n.childNodes.length>0&&t.parentElement.insertBefore(n,t),t.parentElement.insertBefore(e,t),t.childNodes.length===0&&t.remove()}function UE(e){let t=e.parentNode;for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}var WE=Y.create({name:`markdownHTMLNode`,addStorage(){return{markdown:{serialize(e,t,n){this.editor.storage.markdown.options.html?e.write(GE(t,n)):(console.warn(`Tiptap Markdown: "${t.type.name}" node is only available in html mode`),e.write(`[${t.type.name}]`)),t.isBlock&&e.closeBlock(t)},parse:{}}}}});function GE(e,t){let n=e.type.schema,r=ky(V.from(e),n);return e.isBlock&&(t instanceof V||t.type.name===n.topNodeType.name)?KE(r):r}function KE(e){let t=BE(e).firstElementChild;return t.innerHTML=t.innerHTML.trim()?`
|
|
113
|
+
${t.innerHTML}
|
|
116
114
|
`:`
|
|
117
|
-
`,
|
|
118
|
-
`),
|
|
119
|
-
`);return}},parse:{}}}}}),
|
|
120
|
-
`?
|
|
121
|
-
`?
|
|
122
|
-
|
|
123
|
-
`);return!
|
|
124
|
-
`));return
|
|
125
|
-
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,u=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:l,dispatch:c})=>{if(c&&u&&o){const d=u.filter(h=>a.includes(h.type.name));l.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),kS=te.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,ge(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>dc({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Yo=200,Pe=function(){};Pe.prototype.append=function(e){return e.length?(e=Pe.from(e),!this.length&&e||e.length<Yo&&this.leafAppend(e)||this.length<Yo&&e.leafPrepend(this)||this.appendInner(e)):this};Pe.prototype.prepend=function(e){return e.length?Pe.from(e).append(this):this};Pe.prototype.appendInner=function(e){return new wS(this,e)};Pe.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Pe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Pe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Pe.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Pe.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i};Pe.from=function(e){return e instanceof Pe?e:e&&e.length?new lb(e):Pe.empty};var lb=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var u=s;u<o;u++)if(i(this.values[u],a+u)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var u=s-1;u>=o;u--)if(i(this.values[u],a+u)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Yo)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Yo)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Pe);Pe.empty=new lb([]);var wS=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Pe);const CS=500;class Nt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,u,l=[],c=[];return this.items.forEach((d,h)=>{if(!d.step){i||(i=this.remapping(r,h+1),s=i.maps.length),s--,c.push(d);return}if(i){c.push(new Lt(d.map));let f=d.step.map(i.slice(s)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],l.push(new Lt(p,void 0,void 0,l.length+c.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(s)):d.selection,u=new Nt(this.items.slice(0,r).append(c.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:o,selection:a}}addTransform(e,n,r,i){let s=[],o=this.eventCount,a=this.items,u=!i&&a.length?a.get(a.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),h=new Lt(e.mapping.maps[c],d,n),f;(f=u&&u.merge(h))&&(h=f,c?s.pop():a=a.slice(0,a.length-1)),s.push(h),n&&(o++,n=void 0),i||(u=h)}let l=o-r.depth;return l>SS&&(a=ES(a,l),o-=l),new Nt(a.append(s),o)}remapping(e,n){let r=new es;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Nt(this.items.append(e.map(n=>new Lt(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let u=n;this.items.forEach(h=>{let f=s.getMirror(--u);if(f==null)return;o=Math.min(o,f);let p=s.maps[f];if(h.step){let m=e.steps[f].invert(e.docs[f]),g=h.selection&&h.selection.map(s.slice(u+1,f));g&&a++,r.push(new Lt(p,m,g))}else r.push(new Lt(p))},i);let l=[];for(let h=n;h<o;h++)l.push(new Lt(s.maps[h]));let c=this.items.slice(0,i).append(l).append(r),d=new Nt(c,a);return d.emptyItemCount()>CS&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let u=o.step.map(n.slice(r)),l=u&&u.getMap();if(r--,l&&n.appendMap(l,r),u){let c=o.selection&&o.selection.map(n.slice(r));c&&s++;let d=new Lt(l.invert(),u,c),h,f=i.length-1;(h=i.length&&i[f].merge(d))?i[f]=h:i.push(d)}}else o.map&&r--},this.items.length,0),new Nt(Pe.from(i.reverse()),s)}}Nt.empty=new Nt(Pe.empty,0);function ES(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class Lt{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Lt(n.getMap().invert(),n,this.selection)}}}class Tn{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const SS=20;function AS(t,e,n,r){let i=n.getMeta(fr),s;if(i)return i.historyState;n.getMeta(DS)&&(t=new Tn(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(fr))return o.getMeta(fr).redo?new Tn(t.done.addTransform(n,void 0,r,io(e)),t.undone,Lp(n.mapping.maps),t.prevTime,t.prevComposition):new Tn(t.done,t.undone.addTransform(n,void 0,r,io(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),u=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!MS(n,t.prevRanges)),l=o?Yu(t.prevRanges,n.mapping):Lp(n.mapping.maps);return new Tn(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,io(e)),Nt.empty,l,n.time,a??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Tn(t.done.rebased(n,s),t.undone.rebased(n,s),Yu(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Tn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Yu(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function MS(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function Lp(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,o)=>e.push(s,o));return e}function Yu(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function TS(t,e,n){let r=io(e),i=fr.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),u=new Tn(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(fr,{redo:n,historyState:u})}let Zu=!1,Bp=null;function io(t){let e=t.plugins;if(Bp!=e){Zu=!1,Bp=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Zu=!0;break}}return Zu}const fr=new $e("history"),DS=new $e("closeHistory");function OS(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new we({key:fr,state:{init(){return new Tn(Nt.empty,Nt.empty,null,0,-1)},apply(e,n,r){return AS(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?db:r=="historyRedo"?hb:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function cb(t,e){return(n,r)=>{let i=fr.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=TS(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const db=cb(!1,!0),hb=cb(!0,!0),RS=Be.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>db(t,e),redo:()=>({state:t,dispatch:e})=>hb(t,e)}},addProseMirrorPlugins(){return[OS(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),NS=te.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",ge(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!$w(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$from:r,$to:i}=n,s=t();return r.parentOffset===0?s.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):pw(n)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:o,dispatch:a})=>{var u;if(a){const{$to:l}=o.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection(H.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection(z.create(o.doc,l.pos)):o.setSelection(H.create(o.doc,l.pos));else{const d=(u=l.parent.type.contentMatch.defaultType)===null||u===void 0?void 0:u.create();d&&(o.insert(c,d),o.setSelection(H.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[M1({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),FS=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,IS=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,PS=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,LS=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,BS=it.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",ge(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[si({find:FS,type:this.type}),si({find:PS,type:this.type})]},addPasteRules(){return[_r({find:IS,type:this.type}),_r({find:LS,type:this.type})]}}),$S=te.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",ge(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),zS="listItem",$p="textStyle",zp=/^(\d+)\.\s$/,HS=te.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",ge(this.options.HTMLAttributes,n),0]:["ol",ge(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(zS,this.editor.getAttributes($p)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=us({find:zp,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=us({find:zp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes($p)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),fb=te.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",ge(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),jS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,VS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,qS=it.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",ge(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[si({find:jS,type:this.type})]},addPasteRules(){return[_r({find:VS,type:this.type})]}}),WS=te.create({name:"text",group:"inline"}),US=Be.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(eS.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(GE.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(nS.configure(this.options.bulletList)),this.options.code!==!1&&t.push(sS.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(uS.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(lS.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(hS.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(_S.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(xS.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(kS.configure(this.options.heading)),this.options.history!==!1&&t.push(RS.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(NS.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(BS.configure(this.options.italic)),this.options.listItem!==!1&&t.push($S.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(HS.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(fb.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(qS.configure(this.options.strike)),this.options.text!==!1&&t.push(WS.configure(this.options.text)),t}});let bc,vc;if(typeof WeakMap<"u"){let t=new WeakMap;bc=e=>t.get(e),vc=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;bc=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},vc=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var xe=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,o=i+1;for(let a=1;s<this.width&&this.map[e+a]==n;a++)s++;for(let a=1;o<this.height&&this.map[e+this.width*a]==n;a++)o++;return{left:r,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:s,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:o==this.height)?null:this.map[r+this.width*(n<0?s-1:o)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:o,right:a,top:u,bottom:l}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(i,u),right:Math.max(r,a),bottom:Math.max(s,l)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,o=this.map[s];n[o]||(n[o]=!0,!(i==t.left&&i&&this.map[s-1]==o||r==t.top&&r&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let o=e+t*this.width;const a=(t+1)*this.width;for(;o<a&&this.map[o]<i;)o++;return o==a?s-1:this.map[o]}i=s}}static get(t){return bc(t)||vc(t,KS(t))}};function KS(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=JS(t),n=t.childCount,r=[];let i=0,s=null;const o=[];for(let l=0,c=e*n;l<c;l++)r[l]=0;for(let l=0,c=0;l<n;l++){const d=t.child(l);c++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==d.childCount)break;const m=d.child(p),{colspan:g,rowspan:b,colwidth:v}=m.attrs;for(let _=0;_<b;_++){if(_+l>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:c,n:b-_});break}const x=i+_*e;for(let y=0;y<g;y++){r[x+y]==0?r[x+y]=c:(s||(s=[])).push({type:"collision",row:l,pos:c,n:g-y});const k=v&&v[y];if(k){const w=(x+y)%e*2,C=o[w];C==null||C!=k&&o[w+1]==1?(o[w]=k,o[w+1]=1):C==k&&o[w+1]++}}}i+=g,c+=m.nodeSize}const h=(l+1)*e;let f=0;for(;i<h;)r[i++]==0&&f++;f&&(s||(s=[])).push({type:"missing",row:l,n:f}),c++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const a=new xe(e,n,r,s);let u=!1;for(let l=0;!u&&l<o.length;l+=2)o[l]!=null&&o[l+1]<n&&(u=!0);return u&&GS(a,o,t),a}function JS(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let o=0;o<r;o++){const a=t.child(o);for(let u=0;u<a.childCount;u++){const l=a.child(u);o+l.attrs.rowspan>r&&(s+=l.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const a=i.child(o);s+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function GS(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const o=n.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let a=null;const u=o.attrs;for(let l=0;l<u.colspan;l++){const c=e[(i+l)%t.width*2];c!=null&&(!u.colwidth||u.colwidth[l]!=c)&&((a||(a=YS(u)))[l]=c)}a&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:a})}}function YS(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Ye(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const Fn=new $e("selectingCells");function xr(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function ZS(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function Pt(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Ua(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=xr(e.$head)||XS(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function XS(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function yc(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function QS(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Fd(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function pb(t,e,n){const r=t.node(-1),i=xe.get(r),s=t.start(-1),o=i.nextCell(t.pos-s,e,n);return o==null?null:t.node(0).resolve(s+o)}function kr(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function mb(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function e8(t,e,n){const r=Ye(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var le=class un extends q{constructor(e,n=e){const r=e.node(-1),i=xe.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,n.pos-s),a=e.node(0),u=i.cellsInRect(o).filter(c=>c!=n.pos-s);u.unshift(n.pos-s);const l=u.map(c=>{const d=r.nodeAt(c);if(!d)throw new RangeError(`No cell with offset ${c} found`);const h=s+c+1;return new cg(a.resolve(h),a.resolve(h+d.content.size))});super(l[0].$from,l[0].$to,l),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(yc(r)&&yc(i)&&Fd(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?un.rowSelection(r,i):s&&this.isColSelection()?un.colSelection(r,i):new un(r,i)}return H.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=xe.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let u=i.top;u<i.bottom;u++){const l=[];for(let c=u*n.width+i.left,d=i.left;d<i.right;d++,c++){const h=n.map[c];if(s[h])continue;s[h]=!0;const f=n.findCell(h);let p=e.nodeAt(h);if(!p)throw new RangeError(`No cell with offset ${h} found`);const m=i.left-f.left,g=f.right-i.right;if(m>0||g>0){let b=p.attrs;if(m>0&&(b=kr(b,0,m)),g>0&&(b=kr(b,b.colspan-g,g)),f.left<i.left){if(p=p.type.createAndFill(b),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else p=p.type.create(b,p.content)}if(f.top<i.top||f.bottom>i.bottom){const b={...p.attrs,rowspan:Math.min(f.bottom,i.bottom)-Math.max(f.top,i.top)};f.top<i.top?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}l.push(p)}o.push(e.child(u).copy(A.from(l)))}const a=this.isColSelection()&&this.isRowSelection()?e:o;return new R(A.from(a),1,1)}replace(e,n=R.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:a,$to:u}=i[o],l=e.mapping.slice(r);e.replace(l.map(a.pos),l.map(u.pos),o?R.empty:n)}const s=q.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new R(A.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=xe.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(n.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=xe.get(r),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(n.pos-s),u=e.node(0);return o.top<=a.top?(o.top>0&&(e=u.resolve(s+i.map[o.left])),a.bottom<i.height&&(n=u.resolve(s+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=u.resolve(s+i.map[a.left])),o.bottom<i.height&&(e=u.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new un(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=xe.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,a=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,a)==n.width}eq(e){return e instanceof un&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=xe.get(r),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(n.pos-s),u=e.node(0);return o.left<=a.left?(o.left>0&&(e=u.resolve(s+i.map[o.top*i.width])),a.right<i.width&&(n=u.resolve(s+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=u.resolve(s+i.map[a.top*i.width])),o.right<i.width&&(e=u.resolve(s+i.map[i.width*(o.top+1)-1]))),new un(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new un(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new un(e.resolve(n),e.resolve(r))}getBookmark(){return new t8(this.$anchorCell.pos,this.$headCell.pos)}};le.prototype.visible=!1;q.jsonID("cell",le);var t8=class gb{constructor(e,n){this.anchor=e,this.head=n}map(e){return new gb(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&Fd(n,r)?new le(n,r):q.near(r,1)}};function n8(t){if(!(t.selection instanceof le))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(tt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ye.create(t.doc,e)}function r8({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function i8({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function s8(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,o;if(r instanceof z&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=le.create(i,r.from);else if(o=="row"){const a=i.resolve(r.from+1);s=le.rowSelection(a,a)}else if(!n){const a=xe.get(r.node),u=r.from+1,l=u+a.map[a.width*a.height-1];s=le.create(i,u+1,l)}}else r instanceof H&&r8(r)?s=H.create(i,r.from):r instanceof H&&i8(r)&&(s=H.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const o8=new $e("fix-tables");function bb(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let o=0,a=0;o<s;o++){const u=e.child(o);for(let l=a,c=Math.min(i,o+3);l<c;l++)if(t.child(l)==u){a=l+1,n+=u.nodeSize;continue e}r(u,n),a<i&&t.child(a).sameMarkup(u)?bb(t.child(a),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function vb(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=a8(t,i,s,n))};return e?e.doc!=t.doc&&bb(e.doc,t.doc,0,r):t.doc.descendants(r),n}function a8(t,e,n,r){const i=xe.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let u=0;u<i.height;u++)s.push(0);for(let u=0;u<i.problems.length;u++){const l=i.problems[u];if(l.type=="collision"){const c=e.nodeAt(l.pos);if(!c)continue;const d=c.attrs;for(let h=0;h<d.rowspan;h++)s[l.row+h]+=l.n;r.setNodeMarkup(r.mapping.map(n+1+l.pos),null,kr(d,d.colspan-l.n,l.n))}else if(l.type=="missing")s[l.row]+=l.n;else if(l.type=="overlong_rowspan"){const c=e.nodeAt(l.pos);if(!c)continue;r.setNodeMarkup(r.mapping.map(n+1+l.pos),null,{...c.attrs,rowspan:c.attrs.rowspan-l.n})}else if(l.type=="colwidth mismatch"){const c=e.nodeAt(l.pos);if(!c)continue;r.setNodeMarkup(r.mapping.map(n+1+l.pos),null,{...c.attrs,colwidth:l.colwidth})}else if(l.type=="zero_sized"){const c=r.mapping.map(n);r.delete(c,c+e.nodeSize)}}let o,a;for(let u=0;u<s.length;u++)s[u]&&(o==null&&(o=u),a=u);for(let u=0,l=n+1;u<i.height;u++){const c=e.child(u),d=l+c.nodeSize,h=s[u];if(h>0){let f="cell";c.firstChild&&(f=c.firstChild.type.spec.tableRole);const p=[];for(let g=0;g<h;g++){const b=Ye(t.schema)[f].createAndFill();b&&p.push(b)}const m=(u==0||o==u-1)&&a==u?l+1:d-1;r.insert(r.mapping.map(m),p)}l=d}return r.setMeta(o8,{fixTables:!0})}function en(t){const e=t.selection,n=Ua(t),r=n.node(-1),i=n.start(-1),s=xe.get(r);return{...e instanceof le?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function yb(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;e8(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const a=o*e.width+i;if(i>0&&i<e.width&&e.map[a-1]==e.map[a]){const u=e.map[a],l=r.nodeAt(u);t.setNodeMarkup(t.mapping.map(n+u),null,mb(l.attrs,i-e.colCount(u))),o+=l.attrs.rowspan-1}else{const u=s==null?Ye(r.type.schema).cell:r.nodeAt(e.map[a+s]).type,l=e.positionAt(o,i,r);t.insert(t.mapping.map(n+l),u.createAndFill())}}return t}function u8(t,e){if(!Pt(t))return!1;if(e){const n=en(t);e(yb(t.tr,n,n.left))}return!0}function l8(t,e){if(!Pt(t))return!1;if(e){const n=en(t);e(yb(t.tr,n,n.right))}return!0}function c8(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let o=0;o<e.height;){const a=o*e.width+i,u=e.map[a],l=n.nodeAt(u),c=l.attrs;if(i>0&&e.map[a-1]==u||i<e.width-1&&e.map[a+1]==u)t.setNodeMarkup(t.mapping.slice(s).map(r+u),null,kr(c,i-e.colCount(u)));else{const d=t.mapping.slice(s).map(r+u);t.delete(d,d+l.nodeSize)}o+=c.rowspan}}function d8(t,e){if(!Pt(t))return!1;if(e){const n=en(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;c8(r,n,i),i!=n.left;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=xe.get(s)}e(r)}return!0}function h8(t,e,n){var r;const i=Ye(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))===null||r===void 0?void 0:r.type)!=i)return!1;return!0}function _b(t,{map:e,tableStart:n,table:r},i){let s=n;for(let l=0;l<i;l++)s+=r.child(l).nodeSize;const o=[];let a=i>0?-1:0;h8(e,r,i+a)&&(a=i==0||i==e.height?null:0);for(let l=0,c=e.width*i;l<e.width;l++,c++)if(i>0&&i<e.height&&e.map[c]==e.map[c-e.width]){const d=e.map[c],h=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...h,rowspan:h.rowspan+1}),l+=h.colspan-1}else{var u;const d=a==null?Ye(r.type.schema).cell:(u=r.nodeAt(e.map[c+a*e.width]))===null||u===void 0?void 0:u.type,h=d?.createAndFill();h&&o.push(h)}return t.insert(s,Ye(r.type.schema).row.create(null,o)),t}function f8(t,e){if(!Pt(t))return!1;if(e){const n=en(t);e(_b(t.tr,n,n.top))}return!0}function p8(t,e){if(!Pt(t))return!1;if(e){const n=en(t);e(_b(t.tr,n,n.bottom))}return!0}function m8(t,{map:e,table:n,tableStart:r},i){let s=0;for(let l=0;l<i;l++)s+=n.child(l).nodeSize;const o=s+n.child(i).nodeSize,a=t.mapping.maps.length;t.delete(s+r,o+r);const u=new Set;for(let l=0,c=i*e.width;l<e.width;l++,c++){const d=e.map[c];if(!u.has(d)){if(u.add(d),i>0&&d==e.map[c-e.width]){const h=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...h,rowspan:h.rowspan-1}),l+=h.colspan-1}else if(i<e.height&&d==e.map[c+e.width]){const h=n.nodeAt(d),f=h.attrs,p=h.type.create({...f,rowspan:h.attrs.rowspan-1},h.content),m=e.positionAt(i+1,l,n);t.insert(t.mapping.slice(a).map(r+m),p),l+=f.colspan-1}}}}function g8(t,e){if(!Pt(t))return!1;if(e){const n=en(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;m8(r,n,i),i!=n.top;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=xe.get(n.table)}e(r)}return!0}function Hp(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function b8({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,o=(r.bottom-1)*t+r.left,a=i+(r.right-r.left-1);for(let u=r.top;u<r.bottom;u++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[a]==n[a+1])return!0;s+=t,a+=t}for(let u=r.left;u<r.right;u++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[o]==n[o+t])return!0;i++,o++}return!1}function jp(t,e){const n=t.selection;if(!(n instanceof le)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=en(t),{map:i}=r;if(b8(i,r))return!1;if(e){const s=t.tr,o={};let a=A.empty,u,l;for(let c=r.top;c<r.bottom;c++)for(let d=r.left;d<r.right;d++){const h=i.map[c*i.width+d],f=r.table.nodeAt(h);if(!(o[h]||!f))if(o[h]=!0,u==null)u=h,l=f;else{Hp(f)||(a=a.append(f.content));const p=s.mapping.map(h+r.tableStart);s.delete(p,p+f.nodeSize)}}if(u==null||l==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{...mb(l.attrs,l.attrs.colspan,r.right-r.left-l.attrs.colspan),rowspan:r.bottom-r.top}),a.size>0){const c=u+1+l.content.size,d=Hp(l)?u+1:c;s.replaceWith(d+r.tableStart,c+r.tableStart,a)}s.setSelection(new le(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function Vp(t,e){const n=Ye(t.schema);return v8(({node:r})=>n[r.type.spec.tableRole])(t,e)}function v8(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof le){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var o;if(i=ZS(r.$from),!i)return!1;s=(o=xr(r.$from))===null||o===void 0?void 0:o.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let a=i.attrs;const u=[],l=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const c=en(e),d=e.tr;for(let f=0;f<c.right-c.left;f++)u.push(l?{...a,colwidth:l&&l[f]?[l[f]]:null}:a);let h;for(let f=c.top;f<c.bottom;f++){let p=c.map.positionAt(f,c.left,c.table);f==c.top&&(p+=i.nodeSize);for(let m=c.left,g=0;m<c.right;m++,g++)m==c.left&&f==c.top||d.insert(h=d.mapping.map(p+c.tableStart,1),t({node:i,row:f,col:m}).createAndFill(u[g]))}d.setNodeMarkup(s,t({node:i,row:c.top,col:c.left}),u[0]),r instanceof le&&d.setSelection(new le(d.doc.resolve(r.$anchorCell.pos),h?d.doc.resolve(h):void 0)),n(d)}return!0}}function y8(t,e){return function(n,r){if(!Pt(n))return!1;const i=Ua(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof le?n.selection.forEachCell((o,a)=>{o.attrs[t]!==e&&s.setNodeMarkup(a,null,{...o.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function _8(t){return function(e,n){if(!Pt(e))return!1;if(n){const r=Ye(e.schema),i=en(e),s=e.tr,o=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=o.map(u=>i.table.nodeAt(u));for(let u=0;u<o.length;u++)a[u].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[u],r.cell,a[u].attrs);if(s.steps.length===0)for(let u=0;u<o.length;u++)s.setNodeMarkup(i.tableStart+o[u],r.header_cell,a[u].attrs);n(s)}return!0}}function qp(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function fs(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?_8(t):function(n,r){if(!Pt(n))return!1;if(r){const i=Ye(n.schema),s=en(n),o=n.tr,a=qp("row",s,i),u=qp("column",s,i),l=(t==="column"?a:t==="row"&&u)?1:0,c=t=="column"?{left:0,top:l,right:1,bottom:s.map.height}:t=="row"?{left:l,top:0,right:s.map.width,bottom:1}:s,d=t=="column"?u?i.cell:i.header_cell:t=="row"?a?i.cell:i.header_cell:i.cell;s.map.cellsInRect(c).forEach(h=>{const f=h+s.tableStart,p=o.doc.nodeAt(f);p&&o.setNodeMarkup(f,d,p.attrs)}),r(o)}return!0}}fs("row",{useDeprecatedLogic:!0});fs("column",{useDeprecatedLogic:!0});const x8=fs("cell",{useDeprecatedLogic:!0});function k8(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const s=t.node(-1).child(r),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function Wp(t){return function(e,n){if(!Pt(e))return!1;const r=k8(Ua(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(H.between(i,QS(i))).scrollIntoView())}return!0}}function w8(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Vs(t,e){const n=t.selection;if(!(n instanceof le))return!1;if(e){const r=t.tr,i=Ye(t.schema).cell.createAndFill().content;n.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new R(i,0,0))}),r.docChanged&&e(r)}return!0}function C8(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,o=i.type.schema,a=[];if(s=="row")for(let u=0;u<e.childCount;u++){let l=e.child(u).content;const c=u?0:Math.max(0,n-1),d=u<e.childCount-1?0:Math.max(0,r-1);(c||d)&&(l=_c(Ye(o).row,new R(l,c,d)).content),a.push(l)}else if(s=="cell"||s=="header_cell")a.push(n||r?_c(Ye(o).row,new R(e,n,r)).content:e);else return null;return E8(o,a)}function E8(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let o=s.childCount-1;o>=0;o--){const{rowspan:a,colspan:u}=s.child(o).attrs;for(let l=i;l<i+a;l++)n[l]=(n[l]||0)+u}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(A.empty),n[i]<r){const s=Ye(t).cell.createAndFill(),o=[];for(let a=n[i];a<r;a++)o.push(s);e[i]=e[i].append(A.from(o))}return{height:e.length,width:r,rows:e}}function _c(t,e){const n=t.createAndFill();return new nd(n).replace(0,n.content.size,e).doc}function S8({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],o=[];for(let a=0;a<n.length;a++){const u=n[a],l=[];for(let c=s[a]||0,d=0;c<r;d++){let h=u.child(d%u.childCount);c+h.attrs.colspan>r&&(h=h.type.createChecked(kr(h.attrs,h.attrs.colspan,c+h.attrs.colspan-r),h.content)),l.push(h),c+=h.attrs.colspan;for(let f=1;f<h.attrs.rowspan;f++)s[a+f]=(s[a+f]||0)+h.attrs.colspan}o.push(A.from(l))}n=o,t=r}if(e!=i){const s=[];for(let o=0,a=0;o<i;o++,a++){const u=[],l=n[a%e];for(let c=0;c<l.childCount;c++){let d=l.child(c);o+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),u.push(d)}s.push(A.from(u))}n=s,e=i}return{width:t,height:e,rows:n}}function A8(t,e,n,r,i,s,o){const a=t.doc.type.schema,u=Ye(a);let l,c;if(i>e.width)for(let d=0,h=0;d<e.height;d++){const f=n.child(d);h+=f.nodeSize;const p=[];let m;f.lastChild==null||f.lastChild.type==u.cell?m=l||(l=u.cell.createAndFill()):m=c||(c=u.header_cell.createAndFill());for(let g=e.width;g<i;g++)p.push(m);t.insert(t.mapping.slice(o).map(h-1+r),p)}if(s>e.height){const d=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,i);p++){const g=p>=e.width?!1:n.nodeAt(e.map[m+p]).type==u.header_cell;d.push(g?c||(c=u.header_cell.createAndFill()):l||(l=u.cell.createAndFill()))}const h=u.row.create(null,A.from(d)),f=[];for(let p=e.height;p<s;p++)f.push(h);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||c)}function Up(t,e,n,r,i,s,o,a){if(o==0||o==e.height)return!1;let u=!1;for(let l=i;l<s;l++){const c=o*e.width+l,d=e.map[c];if(e.map[c-e.width]==d){u=!0;const h=n.nodeAt(d),{top:f,left:p}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...h.attrs,rowspan:o-f}),t.insert(t.mapping.slice(a).map(e.positionAt(o,p,n)),h.type.createAndFill({...h.attrs,rowspan:f+h.attrs.rowspan-o})),l+=h.attrs.colspan-1}}return u}function Kp(t,e,n,r,i,s,o,a){if(o==0||o==e.width)return!1;let u=!1;for(let l=i;l<s;l++){const c=l*e.width+o,d=e.map[c];if(e.map[c-1]==d){u=!0;const h=n.nodeAt(d),f=e.colCount(d),p=t.mapping.slice(a).map(d+r);t.setNodeMarkup(p,null,kr(h.attrs,o-f,h.attrs.colspan-(o-f))),t.insert(p+h.nodeSize,h.type.createAndFill(kr(h.attrs,0,o-f))),l+=h.attrs.rowspan-1}}return u}function Jp(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let o=xe.get(s);const{top:a,left:u}=r,l=u+i.width,c=a+i.height,d=t.tr;let h=0;function f(){if(s=n?d.doc.nodeAt(n-1):d.doc,!s)throw new Error("No table found");o=xe.get(s),h=d.mapping.maps.length}A8(d,o,s,n,l,c,h)&&f(),Up(d,o,s,n,u,l,a,h)&&f(),Up(d,o,s,n,u,l,c,h)&&f(),Kp(d,o,s,n,a,c,u,h)&&f(),Kp(d,o,s,n,a,c,l,h)&&f();for(let p=a;p<c;p++){const m=o.positionAt(p,u,s),g=o.positionAt(p,l,s);d.replace(d.mapping.slice(h).map(m+n),d.mapping.slice(h).map(g+n),new R(i.rows[p-a],0,0))}f(),d.setSelection(new le(d.doc.resolve(n+o.positionAt(a,u,s)),d.doc.resolve(n+o.positionAt(c-1,l-1,s)))),e(d)}const M8=fd({ArrowLeft:qs("horiz",-1),ArrowRight:qs("horiz",1),ArrowUp:qs("vert",-1),ArrowDown:qs("vert",1),"Shift-ArrowLeft":Ws("horiz",-1),"Shift-ArrowRight":Ws("horiz",1),"Shift-ArrowUp":Ws("vert",-1),"Shift-ArrowDown":Ws("vert",1),Backspace:Vs,"Mod-Backspace":Vs,Delete:Vs,"Mod-Delete":Vs});function so(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function qs(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof le)return so(n,r,q.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const o=xb(i,t,e);if(o==null)return!1;if(t=="horiz")return so(n,r,q.near(n.doc.resolve(s.head+e),e));{const a=n.doc.resolve(o),u=pb(a,t,e);let l;return u?l=q.near(u,1):e<0?l=q.near(n.doc.resolve(a.before(-1)),-1):l=q.near(n.doc.resolve(a.after(-1)),1),so(n,r,l)}}}function Ws(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let o;if(s instanceof le)o=s;else{const u=xb(i,t,e);if(u==null)return!1;o=new le(n.doc.resolve(u))}const a=pb(o.$headCell,t,e);return a?so(n,r,new le(o.$anchorCell,a)):!1}}function T8(t,e){const n=t.state.doc,r=xr(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new le(r))),!0):!1}function D8(t,e,n){if(!Pt(t.state))return!1;let r=C8(n);const i=t.state.selection;if(i instanceof le){r||(r={width:1,height:1,rows:[A.from(_c(Ye(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),a=xe.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=S8(r,a.right-a.left,a.bottom-a.top),Jp(t.state,t.dispatch,o,a,r),!0}else if(r){const s=Ua(t.state),o=s.start(-1);return Jp(t.state,t.dispatch,o,xe.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function O8(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=Gp(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof le)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=xr(t.state.selection.$anchor))!=null&&((n=Xu(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(u,l){let c=Xu(t,l);const d=Fn.getState(t.state)==null;if(!c||!Fd(u,c))if(d)c=u;else return;const h=new le(u,c);if(d||!t.state.selection.eq(h)){const f=t.state.tr.setSelection(h);d&&f.setMeta(Fn,u.pos),t.dispatch(f)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",a),Fn.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Fn,-1))}function a(u){const l=u,c=Fn.getState(t.state);let d;if(c!=null)d=t.state.doc.resolve(c);else if(Gp(t,l.target)!=r&&(d=Xu(t,e),!d))return o();d&&s(d,l)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",a)}function xb(t,e,n){if(!(t.state.selection instanceof H))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=r.before(i),a=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(a)?o:null}}return null}function Gp(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Xu(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&xr(t.state.doc.resolve(r))||xr(t.state.doc.resolve(i))}var R8=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),xc(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,xc(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function xc(t,e,n,r,i,s){let o=0,a=!0,u=e.firstChild;const l=t.firstChild;if(l){for(let d=0,h=0;d<l.childCount;d++){const{colspan:f,colwidth:p}=l.child(d).attrs;for(let m=0;m<f;m++,h++){const g=i==h?s:p&&p[m],b=g?g+"px":"";if(o+=g||r,g||(a=!1),u)u.style.width!=b&&(u.style.width=b),u=u.nextSibling;else{const v=document.createElement("col");v.style.width=b,e.appendChild(v)}}}for(;u;){var c;const d=u.nextSibling;(c=u.parentNode)===null||c===void 0||c.removeChild(u),u=d}a?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}const ht=new $e("tableColumnResizing");function N8({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=R8,lastColumnResizable:i=!0}={}){const s=new we({key:ht,state:{init(o,a){var u;const l=(u=s.spec)===null||u===void 0||(u=u.props)===null||u===void 0?void 0:u.nodeViews,c=Ye(a.schema).table.name;return r&&l&&(l[c]=(d,h)=>new r(d,n,h)),new F8(-1,!1)},apply(o,a){return a.apply(o)}},props:{attributes:o=>{const a=ht.getState(o);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,a)=>{I8(o,a,t,i)},mouseleave:o=>{P8(o)},mousedown:(o,a)=>{L8(o,a,e,n)}},decorations:o=>{const a=ht.getState(o);if(a&&a.activeHandle>-1)return j8(o,a.activeHandle)},nodeViews:{}}});return s}var F8=class oo{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(ht);if(r&&r.setHandle!=null)return new oo(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new oo(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return yc(e.doc.resolve(i))||(i=-1),new oo(i,n.dragging)}return n}};function I8(t,e,n,r){if(!t.editable)return;const i=ht.getState(t.state);if(i&&!i.dragging){const s=$8(e.target);let o=-1;if(s){const{left:a,right:u}=s.getBoundingClientRect();e.clientX-a<=n?o=Yp(t,e,"left",n):u-e.clientX<=n&&(o=Yp(t,e,"right",n))}if(o!=i.activeHandle){if(!r&&o!==-1){const a=t.state.doc.resolve(o),u=a.node(-1),l=xe.get(u),c=a.start(-1);if(l.colCount(a.pos-c)+a.nodeAfter.attrs.colspan-1==l.width-1)return}kb(t,o)}}}function P8(t){if(!t.editable)return;const e=ht.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&kb(t,-1)}function L8(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,o=ht.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const a=t.state.doc.nodeAt(o.activeHandle),u=B8(t,o.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(ht,{setDragging:{startX:e.clientX,startWidth:u}}));function l(d){s.removeEventListener("mouseup",l),s.removeEventListener("mousemove",c);const h=ht.getState(t.state);h?.dragging&&(z8(t,h.activeHandle,Zp(h.dragging,d,n)),t.dispatch(t.state.tr.setMeta(ht,{setDragging:null})))}function c(d){if(!d.which)return l(d);const h=ht.getState(t.state);if(h&&h.dragging){const f=Zp(h.dragging,d,n);Xp(t,h.activeHandle,f,r)}}return Xp(t,o.activeHandle,u,r),s.addEventListener("mouseup",l),s.addEventListener("mousemove",c),e.preventDefault(),!0}function B8(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let o=s.node.childNodes[s.offset].offsetWidth,a=n;if(r)for(let u=0;u<n;u++)r[u]&&(o-=r[u],a--);return o/a}function $8(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Yp(t,e,n,r){const i=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:o}=s,a=xr(t.state.doc.resolve(o));if(!a)return-1;if(n=="right")return a.pos;const u=xe.get(a.node(-1)),l=a.start(-1),c=u.map.indexOf(a.pos-l);return c%u.width==0?-1:l+u.map[c-1]}function Zp(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function kb(t,e){t.dispatch(t.state.tr.setMeta(ht,{setHandle:e}))}function z8(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=xe.get(i),o=r.start(-1),a=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,u=t.state.tr;for(let l=0;l<s.height;l++){const c=l*s.width+a;if(l&&s.map[c]==s.map[c-s.width])continue;const d=s.map[c],h=i.nodeAt(d).attrs,f=h.colspan==1?0:a-s.colCount(d);if(h.colwidth&&h.colwidth[f]==n)continue;const p=h.colwidth?h.colwidth.slice():H8(h.colspan);p[f]=n,u.setNodeMarkup(o+d,null,{...h,colwidth:p})}u.docChanged&&t.dispatch(u)}function Xp(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),a=xe.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;let u=t.domAtPos(i.start(-1)).node;for(;u&&u.nodeName!="TABLE";)u=u.parentNode;u&&xc(s,u.firstChild,u,r,a,n)}function H8(t){return Array(t).fill(0)}function j8(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return ye.empty;const s=xe.get(i),o=r.start(-1),a=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let l=0;l<s.height;l++){const c=a+l*s.width;if((a==s.width-1||s.map[c]!=s.map[c+1])&&(l==0||s.map[c]!=s.map[c-s.width])){var u;const d=s.map[c],h=o+d+i.nodeAt(d).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",!((u=ht.getState(t))===null||u===void 0)&&u.dragging&&n.push(tt.node(o+d,o+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(tt.widget(h,f))}}return ye.create(t.doc,n)}function V8({allowTableNodeSelection:t=!1}={}){return new we({key:Fn,state:{init(){return null},apply(e,n){const r=e.getMeta(Fn);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:n8,handleDOMEvents:{mousedown:O8},createSelectionBetween(e){return Fn.getState(e.state)!=null?e.state.selection:null},handleTripleClick:T8,handleKeyDown:M8,handlePaste:D8},appendTransaction(e,n,r){return s8(r,vb(r,n),t)}})}function kc(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Qp(t,e,n,r,i,s){var o;let a=0,u=!0,l=e.firstChild;const c=t.firstChild;if(c!==null)for(let d=0,h=0;d<c.childCount;d+=1){const{colspan:f,colwidth:p}=c.child(d).attrs;for(let m=0;m<f;m+=1,h+=1){const g=i===h?s:p&&p[m],b=g?`${g}px`:"";if(a+=g||r,g||(u=!1),l){if(l.style.width!==b){const[v,_]=kc(r,g);l.style.setProperty(v,_)}l=l.nextSibling}else{const v=document.createElement("col"),[_,x]=kc(r,g);v.style.setProperty(_,x),e.appendChild(v)}}}for(;l;){const d=l.nextSibling;(o=l.parentNode)===null||o===void 0||o.removeChild(l),l=d}u?(n.style.width=`${a}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${a}px`)}class q8{constructor(e,n){this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Qp(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,Qp(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function W8(t,e,n,r){let i=0,s=!0;const o=[],a=t.firstChild;if(!a)return{};for(let d=0,h=0;d<a.childCount;d+=1){const{colspan:f,colwidth:p}=a.child(d).attrs;for(let m=0;m<f;m+=1,h+=1){const g=n===h?r:p&&p[m];i+=g||e,g||(s=!1);const[b,v]=kc(e,g);o.push(["col",{style:`${b}: ${v}`}])}}const u=s?`${i}px`:"",l=s?"":`${i}px`;return{colgroup:["colgroup",{},...o],tableWidth:u,tableMinWidth:l}}function e0(t,e){return t.createAndFill()}function U8(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function K8(t,e,n,r,i){const s=U8(t),o=[],a=[];for(let l=0;l<n;l+=1){const c=e0(s.cell);if(c&&a.push(c),r){const d=e0(s.header_cell);d&&o.push(d)}}const u=[];for(let l=0;l<e;l+=1)u.push(s.row.createChecked(null,r&&l===0?o:a));return s.table.createChecked(null,u)}function J8(t){return t instanceof le}const Us=({editor:t})=>{const{selection:e}=t.state;if(!J8(e))return!1;let n=0;const r=v1(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},G8=te.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:q8,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:i}=W8(t,this.options.cellMinWidth),s=["table",ge(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},s]:s},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const o=K8(s.schema,t,e,n);if(i){const a=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(H.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>u8(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>l8(t,e),deleteColumn:()=>({state:t,dispatch:e})=>d8(t,e),addRowBefore:()=>({state:t,dispatch:e})=>f8(t,e),addRowAfter:()=>({state:t,dispatch:e})=>p8(t,e),deleteRow:()=>({state:t,dispatch:e})=>g8(t,e),deleteTable:()=>({state:t,dispatch:e})=>w8(t,e),mergeCells:()=>({state:t,dispatch:e})=>jp(t,e),splitCell:()=>({state:t,dispatch:e})=>Vp(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>fs("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>fs("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>x8(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>jp(t,e)?!0:Vp(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>y8(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Wp(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Wp(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&vb(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=le.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Us,"Mod-Backspace":Us,Delete:Us,"Mod-Delete":Us}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[N8({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],V8({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:U(B(t,"tableRole",e))}}}),Y8=te.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",ge(this.options.HTMLAttributes,t),0]}}),Z8=te.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",ge(this.options.HTMLAttributes,t),0]}}),X8=te.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",ge(this.options.HTMLAttributes,t),0]}}),Q8="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",e5="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",wc="numeric",Cc="ascii",Ec="alpha",Hi="asciinumeric",Oi="alphanumeric",Sc="domain",wb="emoji",t5="scheme",n5="slashscheme",Qu="whitespace";function r5(t,e){return t in e||(e[t]=[]),e[t]}function ar(t,e,n){e[wc]&&(e[Hi]=!0,e[Oi]=!0),e[Cc]&&(e[Hi]=!0,e[Ec]=!0),e[Hi]&&(e[Oi]=!0),e[Ec]&&(e[Oi]=!0),e[Oi]&&(e[Sc]=!0),e[wb]&&(e[Sc]=!0);for(const r in e){const i=r5(r,n);i.indexOf(t)<0&&i.push(t)}}function i5(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function ot(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}ot.groups={};ot.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||ot.groups;let i;return e&&e.j?i=e:(i=new ot(e),n&&r&&ar(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(t[o]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||ot.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let o,a=i.go(t);if(a?(o=new ot,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new ot,s){if(r)if(o.t&&typeof o.t=="string"){const u=Object.assign(i5(o.t,r),n);ar(s,u,r)}else n&&ar(s,n,r);o.t=s}return i.j[t]=o,o}};const K=(t,e,n,r,i)=>t.ta(e,n,r,i),be=(t,e,n,r,i)=>t.tr(e,n,r,i),t0=(t,e,n,r,i)=>t.ts(e,n,r,i),T=(t,e,n,r,i)=>t.tt(e,n,r,i),ln="WORD",Ac="UWORD",Cb="ASCIINUMERICAL",Eb="ALPHANUMERICAL",ps="LOCALHOST",Mc="TLD",Tc="UTLD",ao="SCHEME",$r="SLASH_SCHEME",Id="NUM",Dc="WS",Pd="NL",ji="OPENBRACE",Vi="CLOSEBRACE",Zo="OPENBRACKET",Xo="CLOSEBRACKET",Qo="OPENPAREN",ea="CLOSEPAREN",ta="OPENANGLEBRACKET",na="CLOSEANGLEBRACKET",ra="FULLWIDTHLEFTPAREN",ia="FULLWIDTHRIGHTPAREN",sa="LEFTCORNERBRACKET",oa="RIGHTCORNERBRACKET",aa="LEFTWHITECORNERBRACKET",ua="RIGHTWHITECORNERBRACKET",la="FULLWIDTHLESSTHAN",ca="FULLWIDTHGREATERTHAN",da="AMPERSAND",ha="APOSTROPHE",fa="ASTERISK",Dn="AT",pa="BACKSLASH",ma="BACKTICK",ga="CARET",In="COLON",Ld="COMMA",ba="DOLLAR",Bt="DOT",va="EQUALS",Bd="EXCLAMATION",xt="HYPHEN",qi="PERCENT",ya="PIPE",_a="PLUS",xa="POUND",Wi="QUERY",$d="QUOTE",Sb="FULLWIDTHMIDDLEDOT",zd="SEMI",$t="SLASH",Ui="TILDE",ka="UNDERSCORE",Ab="EMOJI",wa="SYM";var Mb=Object.freeze({__proto__:null,ALPHANUMERICAL:Eb,AMPERSAND:da,APOSTROPHE:ha,ASCIINUMERICAL:Cb,ASTERISK:fa,AT:Dn,BACKSLASH:pa,BACKTICK:ma,CARET:ga,CLOSEANGLEBRACKET:na,CLOSEBRACE:Vi,CLOSEBRACKET:Xo,CLOSEPAREN:ea,COLON:In,COMMA:Ld,DOLLAR:ba,DOT:Bt,EMOJI:Ab,EQUALS:va,EXCLAMATION:Bd,FULLWIDTHGREATERTHAN:ca,FULLWIDTHLEFTPAREN:ra,FULLWIDTHLESSTHAN:la,FULLWIDTHMIDDLEDOT:Sb,FULLWIDTHRIGHTPAREN:ia,HYPHEN:xt,LEFTCORNERBRACKET:sa,LEFTWHITECORNERBRACKET:aa,LOCALHOST:ps,NL:Pd,NUM:Id,OPENANGLEBRACKET:ta,OPENBRACE:ji,OPENBRACKET:Zo,OPENPAREN:Qo,PERCENT:qi,PIPE:ya,PLUS:_a,POUND:xa,QUERY:Wi,QUOTE:$d,RIGHTCORNERBRACKET:oa,RIGHTWHITECORNERBRACKET:ua,SCHEME:ao,SEMI:zd,SLASH:$t,SLASH_SCHEME:$r,SYM:wa,TILDE:Ui,TLD:Mc,UNDERSCORE:ka,UTLD:Tc,UWORD:Ac,WORD:ln,WS:Dc});const sn=/[a-z]/,_i=/\p{L}/u,el=/\p{Emoji}/u,on=/\d/,tl=/\s/,n0="\r",nl=`
|
|
126
|
-
`,
|
|
115
|
+
`,t.outerHTML}var qE=Y.create({name:`blockquote`}).extend({addStorage(){return{markdown:{serialize:SE.nodes.blockquote,parse:{}}}}}),JE=Y.create({name:`bulletList`}).extend({addStorage(){return{markdown:{serialize(e,t){return e.renderList(t,` `,()=>(this.editor.storage.markdown.options.bulletListMarker||`-`)+` `)},parse:{}}}}}),YE=Y.create({name:`codeBlock`}).extend({addStorage(){return{markdown:{serialize(e,t){e.write("```"+(t.attrs.language||``)+`
|
|
116
|
+
`),e.text(t.textContent,!1),e.ensureNewLine(),e.write("```"),e.closeBlock(t)},parse:{setup(e){e.set({langPrefix:this.options.languageClassPrefix??`language-`})},updateDOM(e){e.innerHTML=e.innerHTML.replace(/\n<\/code><\/pre>/g,`</code></pre>`)}}}}}}),XE=Y.create({name:`hardBreak`}).extend({addStorage(){return{markdown:{serialize(e,t,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=t.type){e.write(e.inTable?WE.storage.markdown.serialize.call(this,e,t,n):`\\
|
|
117
|
+
`);return}},parse:{}}}}}),ZE=Y.create({name:`heading`}).extend({addStorage(){return{markdown:{serialize:SE.nodes.heading,parse:{}}}}}),QE=Y.create({name:`horizontalRule`}).extend({addStorage(){return{markdown:{serialize:SE.nodes.horizontal_rule,parse:{}}}}}),$E=Y.create({name:`image`}).extend({addStorage(){return{markdown:{serialize:SE.nodes.image,parse:{}}}}}),eD=Y.create({name:`listItem`}).extend({addStorage(){return{markdown:{serialize:SE.nodes.list_item,parse:{}}}}}),tD=Y.create({name:`orderedList`});function nD(e,t,n){let r=0;for(;n-r>0&&t.child(n-r-1).type.name===e.type.name;r++);return r}var rD=tD.extend({addStorage(){return{markdown:{serialize(e,t,n,r){let i=t.attrs.start||1,a=String(i+t.childCount-1).length,o=e.repeat(` `,a+2),s=nD(t,n,r)%2?`) `:`. `;e.renderList(t,o,t=>{let n=String(i+t);return e.repeat(` `,a-n.length)+n+s})},parse:{}}}}}),iD=Y.create({name:`paragraph`}).extend({addStorage(){return{markdown:{serialize:SE.nodes.paragraph,parse:{}}}}});function aD(e){var t;return(e==null||(t=e.content)==null?void 0:t.content)??[]}var oD=Y.create({name:`table`}).extend({addStorage(){return{markdown:{serialize(e,t,n){if(!cD(t)){WE.storage.markdown.serialize.call(this,e,t,n);return}e.inTable=!0,t.forEach((t,n,r)=>{if(e.write(`| `),t.forEach((t,n,r)=>{r&&e.write(` | `);let i=t.firstChild;i.textContent.trim()&&e.renderInline(i)}),e.write(` |`),e.ensureNewLine(),!r){let n=Array.from({length:t.childCount}).map(()=>`---`).join(` | `);e.write(`| ${n} |`),e.ensureNewLine()}}),e.closeBlock(t),e.inTable=!1},parse:{}}}}});function sD(e){return e.attrs.colspan>1||e.attrs.rowspan>1}function cD(e){let t=aD(e),n=t[0],r=t.slice(1);return!(aD(n).some(e=>e.type.name!==`tableHeader`||sD(e)||e.childCount>1)||r.some(e=>aD(e).some(e=>e.type.name===`tableHeader`||sD(e)||e.childCount>1)))}var lD=[qE,JE,YE,XE,ZE,QE,WE,$E,eD,rD,iD,oD,Y.create({name:`taskItem`}).extend({addStorage(){return{markdown:{serialize(e,t){let n=t.attrs.checked?`[x]`:`[ ]`;e.write(`${n} `),e.renderContent(t)},parse:{updateDOM(e){[...e.querySelectorAll(`.task-list-item`)].forEach(e=>{let t=e.querySelector(`input`);e.setAttribute(`data-type`,`taskItem`),t&&(e.setAttribute(`data-checked`,t.checked),t.remove())})}}}}}}),Y.create({name:`taskList`}).extend({addStorage(){return{markdown:{serialize:JE.storage.markdown.serialize,parse:{setup(e){e.use(EE.default)},updateDOM(e){[...e.querySelectorAll(`.contains-task-list`)].forEach(e=>{e.setAttribute(`data-type`,`taskList`)})}}}}}}),Y.create({name:`text`}).extend({addStorage(){return{markdown:{serialize(e,t){e.text(VE(t.text))},parse:{}}}}}),zy.create({name:`bold`}).extend({addStorage(){return{markdown:{serialize:SE.marks.strong,parse:{}}}}}),zy.create({name:`code`}).extend({addStorage(){return{markdown:{serialize:SE.marks.code,parse:{}}}}}),RE,zy.create({name:`italic`}).extend({addStorage(){return{markdown:{serialize:SE.marks.em,parse:{}}}}}),zy.create({name:`link`}).extend({addStorage(){return{markdown:{serialize:SE.marks.link,parse:{}}}}}),zy.create({name:`strike`}).extend({addStorage(){return{markdown:{serialize:{open:`~~`,close:`~~`,expelEnclosingWhitespace:!0},parse:{}}}}})];function uD(e){let t=e.storage?.markdown,n=lD.find(t=>t.name===e.name)?.storage.markdown;return t||n?{...n,...t}:null}var dD=class{constructor(e){kE(this,`editor`,null),this.editor=e}serialize(e){let t=new LE(this.nodes,this.marks,{hardBreakNodeName:XE.name});return t.renderContent(e),t.out}get nodes(){return{...Object.fromEntries(Object.keys(this.editor.schema.nodes).map(e=>[e,this.serializeNode(WE)])),...Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type===`node`&&this.serializeNode(e)).map(e=>[e.name,this.serializeNode(e)])??[])}}get marks(){return{...Object.fromEntries(Object.keys(this.editor.schema.marks).map(e=>[e,this.serializeMark(RE)])),...Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type===`mark`&&this.serializeMark(e)).map(e=>[e.name,this.serializeMark(e)])??[])}}serializeNode(e){var t;return(t=uD(e))==null||(t=t.serialize)==null?void 0:t.bind({editor:this.editor,options:e.options})}serializeMark(e){let t=uD(e)?.serialize;return t?{...t,open:typeof t.open==`function`?t.open.bind({editor:this.editor,options:e.options}):t.open,close:typeof t.close==`function`?t.close.bind({editor:this.editor,options:e.options}):t.close}:null}},fD=class{constructor(e,t){kE(this,`editor`,null),kE(this,`md`,null);let{html:n,linkify:r,breaks:i}=t;this.editor=e,this.md=this.withPatchedRenderer(uE({html:n,linkify:r,breaks:i}))}parse(e){let{inline:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e==`string`){this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=uD(e))==null||(t=t.parse)==null||(t=t.setup)==null?void 0:t.call({editor:this.editor,options:e.options},this.md)});let n=BE(this.md.render(e));return this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=uD(e))==null||(t=t.parse)==null||(t=t.updateDOM)==null?void 0:t.call({editor:this.editor,options:e.options},n)}),this.normalizeDOM(n,{inline:t,content:e}),n.innerHTML}return e}normalizeDOM(e,t){let{inline:n,content:r}=t;return this.normalizeBlocks(e),e.querySelectorAll(`*`).forEach(e=>{e.nextSibling?.nodeType===Node.TEXT_NODE&&!e.closest(`pre`)&&(e.nextSibling.textContent=e.nextSibling.textContent.replace(/^\n/,``))}),n&&this.normalizeInline(e,r),e}normalizeBlocks(e){let t=Object.values(this.editor.schema.nodes).filter(e=>e.isBlock).map(e=>e.spec.parseDOM?.map(e=>e.tag)).flat().filter(Boolean).join(`,`);t&&[...e.querySelectorAll(t)].forEach(e=>{e.parentElement.matches(`p`)&&HE(e)})}normalizeInline(e,t){var n;if((n=e.firstElementChild)!=null&&n.matches(`p`)){let n=e.firstElementChild,{nextElementSibling:r}=n,i=t.match(/^\s+/)?.[0]??``,a=r?``:t.match(/\s+$/)?.[0]??``;if(t.match(/^\n\n/)){n.innerHTML=`${n.innerHTML}${a}`;return}UE(n),e.innerHTML=`${i}${e.innerHTML}${a}`}}withPatchedRenderer(e){let t=e=>function(){let t=e(...arguments);return t===`
|
|
118
|
+
`?t:t[t.length-1]===`
|
|
119
|
+
`?t.slice(0,-1):t};return e.renderer.rules.hardbreak=t(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=t(e.renderer.rules.softbreak),e.renderer.rules.fence=t(e.renderer.rules.fence),e.renderer.rules.code_block=t(e.renderer.rules.code_block),e.renderer.renderToken=t(e.renderer.renderToken.bind(e.renderer)),e}},pD=Yy.create({name:`markdownClipboard`,addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new Ip({key:new zp(`markdownClipboard`),props:{clipboardTextParser:(e,t,n)=>{if(n||!this.options.transformPastedText)return null;let r=this.editor.storage.markdown.parser.parse(e,{inline:!0});return Fd.fromSchema(this.editor.schema).parseSlice(BE(r),{preserveWhitespace:!0,context:t})},clipboardTextSerializer:e=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(e.content):null}})]}}),mD=Yy.create({name:`markdown`,priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:`tight`,bulletListMarker:`-`,linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){let e=qx.Commands.config.addCommands();return{setContent:(t,n,r)=>i=>e.setContent(i.editor.storage.markdown.parser.parse(t),n,r)(i),insertContentAt:(t,n,r)=>i=>e.insertContentAt(t,i.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new fD(this.editor,this.options),serializer:new dD(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[AE.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),pD.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}}),hD=/^\s*>\s$/,gD=Y.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return[`blockquote`,yy(this.options.HTMLAttributes,e),0]},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[tS({find:hD,type:this.type})]}}),_D=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,vD=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,yD=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,bD=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,xD=zy.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return[`strong`,yy(this.options.HTMLAttributes,e),0]},addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Qx({find:_D,type:this.type}),Qx({find:yD,type:this.type})]},addPasteRules(){return[nS({find:vD,type:this.type}),nS({find:bD,type:this.type})]}}),SD=`listItem`,CD=`textStyle`,wD=/^\s*([-+*])\s$/,TD=Y.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,yy(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(SD,this.editor.getAttributes(CD)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=tS({find:wD,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=tS({find:wD,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(CD),editor:this.editor})),[e]}}),ED=/(^|[^`])`([^`]+)`(?!`)/,DD=/(^|[^`])`([^`]+)`(?!`)/g,OD=zy.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,yy(this.options.HTMLAttributes,e),0]},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Qx({find:ED,type:this.type})]},addPasteRules(){return[nS({find:DD,type:this.type})]}}),kD=/^```([a-z]+)?[\s\n]$/,AD=/^~~~([a-z]+)?[\s\n]$/,jD=Y.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,yy(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
120
|
+
|
|
121
|
+
`);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(W.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[eS({find:kD,type:this.type,getAttributes:e=>({language:e[1]})}),eS({find:AD,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Ip({key:new zp(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,`
|
|
122
|
+
`));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(G.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),MD=Y.create({name:`doc`,topNode:!0,content:`block+`});function ND(e={}){return new Ip({view(t){return new PD(t,e)}})}var PD=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=Xf(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},FD=Yy.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[ND(this.options)]}}),ID=class e extends W{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):W.near(r)}content(){return U.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new LD(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!zD(e)||!BD(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!K.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};ID.prototype.visible=!1,ID.findFrom=ID.findGapCursorFrom,W.jsonID(`gapcursor`,ID);var LD=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ID.valid(t)?new ID(t):W.near(t)}};function RD(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function zD(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||RD(e.type))return!0;if(e.inlineContent)return!1}}return!0}function BD(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||RD(e.type))return!0;if(e.inlineContent)return!1}}return!0}function VD(){return new Ip({props:{decorations:KD,createSelectionBetween(e,t,n){return t.pos==n.pos&&ID.valid(n)?new ID(n):null},handleClick:WD,handleKeyDown:HD,handleDOMEvents:{beforeinput:GD}}})}var HD=Sv({ArrowLeft:UD(`horiz`,-1),ArrowRight:UD(`horiz`,1),ArrowUp:UD(`vert`,-1),ArrowDown:UD(`vert`,1)});function UD(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof G){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=ID.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new ID(c))),!0):!1}}function WD(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!ID.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&K.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new ID(r))),!0)}function GD(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof ID))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=V.empty;for(let e=r.length-1;e>=0;e--)i=V.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new U(i,0,0));return a.setSelection(G.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function KD(e){if(!(e.selection instanceof ID))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,x_.create(e.doc,[v_.widget(e.selection.head,t,{key:`gapcursor`})])}var qD=Yy.create({name:`gapCursor`,addProseMirrorPlugins(){return[VD()]},extendNodeSchema(e){return{allowGapCursor:J(q(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),JD=Y.create({name:`hardBreak`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,yy(this.options.HTMLAttributes,e)]},renderText(){return`
|
|
123
|
+
`},addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),YD=Y.create({name:`heading`,addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:`inline*`,group:`block`,defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,yy(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>eS({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),XD=200,ZD=function(){};ZD.prototype.append=function(e){return e.length?(e=ZD.from(e),!this.length&&e||e.length<XD&&this.leafAppend(e)||this.length<XD&&e.leafPrepend(this)||this.appendInner(e)):this},ZD.prototype.prepend=function(e){return e.length?ZD.from(e).append(this):this},ZD.prototype.appendInner=function(e){return new $D(this,e)},ZD.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?ZD.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},ZD.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},ZD.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},ZD.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},ZD.from=function(e){return e instanceof ZD?e:e&&e.length?new QD(e):ZD.empty};var QD=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=XD)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=XD)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(ZD);ZD.empty=new QD([]);var $D=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(ZD),eO=500,tO=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new rO(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new rO(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new rO(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>aO&&(s=nO(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new mf;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new rO(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new rO(i,o,l))}else r.push(new rO(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new rO(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>eO&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new rO(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(ZD.from(i.reverse()),a)}};tO.empty=new tO(ZD.empty,0);function nO(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var rO=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},iO=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},aO=20;function oO(e,t,n,r){let i=n.getMeta(mO),a;if(i)return i.historyState;n.getMeta(hO)&&(e=new iO(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(mO))return o.getMeta(mO).redo?new iO(e.done.addTransform(n,void 0,r,pO(t)),e.undone,cO(n.mapping.maps),e.prevTime,e.prevComposition):new iO(e.done,e.undone.addTransform(n,void 0,r,pO(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!sO(n,e.prevRanges)),s=o?lO(e.prevRanges,n.mapping):cO(n.mapping.maps);return new iO(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,pO(t)),tO.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new iO(e.done.rebased(n,a),e.undone.rebased(n,a),lO(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new iO(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),lO(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function sO(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function cO(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function lO(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function uO(e,t,n){let r=pO(t),i=mO.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new iO(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(mO,{redo:n,historyState:c})}var dO=!1,fO=null;function pO(e){let t=e.plugins;if(fO!=t){dO=!1,fO=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){dO=!0;break}}return dO}var mO=new zp(`history`),hO=new zp(`closeHistory`);function gO(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Ip({key:mO,state:{init(){return new iO(tO.empty,tO.empty,null,0,-1)},apply(t,n,r){return oO(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?vO:n==`historyRedo`?yO:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function _O(e,t){return(n,r)=>{let i=mO.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=uO(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var vO=_O(!1,!0),yO=_O(!0,!0),bO=Yy.create({name:`history`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>vO(e,t),redo:()=>({state:e,dispatch:t})=>yO(e,t)}},addProseMirrorPlugins(){return[gO(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),xO=Y.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{}}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,yy(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!rS(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$from:r,$to:i}=n,a=e();return r.parentOffset===0?a.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):Tx(n)?a.insertContentAt(i.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({tr:e,dispatch:t})=>{if(t){let{$to:t}=e.selection,n=t.end();if(t.nodeAfter)t.nodeAfter.isTextblock?e.setSelection(G.create(e.doc,t.pos+1)):t.nodeAfter.isBlock?e.setSelection(K.create(e.doc,t.pos)):e.setSelection(G.create(e.doc,t.pos));else{let r=t.parent.type.contentMatch.defaultType?.create();r&&(e.insert(n,r),e.setSelection(G.create(e.doc,n+1)))}e.scrollIntoView()}return!0}).run()}}},addInputRules(){return[$x({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),SO=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,CO=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,wO=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,TO=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,EO=zy.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,yy(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Qx({find:SO,type:this.type}),Qx({find:wO,type:this.type})]},addPasteRules(){return[nS({find:CO,type:this.type}),nS({find:TO,type:this.type})]}}),DO=Y.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,yy(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),OO=`listItem`,kO=`textStyle`,AO=/^(\d+)\.\s$/,jO=Y.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>e.getAttribute(`type`)}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,...n}=e;return t===1?[`ol`,yy(this.options.HTMLAttributes,n),0]:[`ol`,yy(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(OO,this.editor.getAttributes(kO)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=tS({find:AO,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=tS({find:AO,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(kO)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),MO=Y.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,yy(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),NO=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,PO=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,FO=zy.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,yy(this.options.HTMLAttributes,e),0]},addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Qx({find:NO,type:this.type})]},addPasteRules(){return[nS({find:PO,type:this.type})]}}),IO=Y.create({name:`text`,group:`inline`}),LO=Yy.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(xD.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(gD.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(TD.configure(this.options.bulletList)),this.options.code!==!1&&e.push(OD.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(jD.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(MD.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(FD.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(qD.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(JD.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(YD.configure(this.options.heading)),this.options.history!==!1&&e.push(bO.configure(this.options.history)),this.options.horizontalRule!==!1&&e.push(xO.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(EO.configure(this.options.italic)),this.options.listItem!==!1&&e.push(DO.configure(this.options.listItem)),this.options.orderedList!==!1&&e.push(jO.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(MO.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(FO.configure(this.options.strike)),this.options.text!==!1&&e.push(IO.configure(this.options.text)),e}}),RO,zO;if(typeof WeakMap<`u`){let e=new WeakMap;RO=t=>e.get(t),zO=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;RO=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},zO=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var BO=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return RO(e)||zO(e,VO(e))}};function VO(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=HO(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new BO(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&UO(s,o,e),s}function HO(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function UO(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=WO(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function WO(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function GO(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var KO=new zp(`selectingCells`);function qO(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function JO(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`)return e.node(t)}return null}function YO(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function XO(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=qO(t.$head)||ZO(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function ZO(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function QO(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function $O(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function ek(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function tk(e,t,n){let r=e.node(-1),i=BO.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function nk(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function rk(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function ik(e,t,n){let r=GO(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var Z=class e extends W{constructor(e,t=e){let n=e.node(-1),r=BO.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new _p(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(QO(r)&&QO(i)&&ek(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return G.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=BO.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=nk(e,0,l)),u>0&&(e=nk(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(V.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new U(V.from(o),1,1)}replace(e,t=U.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?U.empty:t)}let i=W.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new U(V.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=BO.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=BO.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=BO.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=BO.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new ak(this.$anchorCell.pos,this.$headCell.pos)}};Z.prototype.visible=!1,W.jsonID(`cell`,Z);var ak=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&ek(t,n)?new Z(t,n):W.near(n,1)}};function ok(e){if(!(e.selection instanceof Z))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(v_.node(n,n+e.nodeSize,{class:`selectedCell`}))}),x_.create(e.doc,t)}function sk({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function ck({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function lk(e,t,n){let r=(t||e).selection,i=(t||e).doc,a,o;if(r instanceof K&&(o=r.node.type.spec.tableRole)){if(o==`cell`||o==`header_cell`)a=Z.create(i,r.from);else if(o==`row`){let e=i.resolve(r.from+1);a=Z.rowSelection(e,e)}else if(!n){let e=BO.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];a=Z.create(i,t+1,n)}}else r instanceof G&&sk(r)?a=G.create(i,r.from):r instanceof G&&ck(r)&&(a=G.create(i,r.$from.start(),r.$from.end()));return a&&(t||=e.tr).setSelection(a),t}var uk=new zp(`fix-tables`);function dk(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o<a;o++){let a=t.child(o);for(let t=s,r=Math.min(i,o+3);t<r;t++)if(e.child(t)==a){s=t+1,n+=a.nodeSize;continue outer}r(a,n),s<i&&e.child(s).sameMarkup(a)?dk(e.child(s),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function fk(e,t){let n,r=(t,r)=>{t.type.spec.tableRole==`table`&&(n=pk(e,t,r,n))};return t?t.doc!=e.doc&&dk(t.doc,e.doc,0,r):e.doc.descendants(r),n}function pk(e,t,n,r){let i=BO.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e<i.height;e++)a.push(0);for(let e=0;e<i.problems.length;e++){let o=i.problems[e];if(o.type==`collision`){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,nk(i,i.colspan-o.n,o.n))}else if(o.type==`missing`)a[o.row]+=o.n;else if(o.type==`overlong_rowspan`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if(o.type==`colwidth mismatch`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}else if(o.type==`zero_sized`){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let o,s;for(let e=0;e<a.length;e++)a[e]&&(o??=e,s=e);for(let c=0,l=n+1;c<i.height;c++){let n=t.child(c),i=l+n.nodeSize,u=a[c];if(u>0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<u;n++){let n=GO(e.schema)[t].createAndFill();n&&a.push(n)}let d=(c==0||o==c-1)&&s==c?l+1:i-1;r.insert(r.mapping.map(d),a)}l=i}return r.setMeta(uk,{fixTables:!0})}function mk(e){let t=e.selection,n=XO(e),r=n.node(-1),i=n.start(-1),a=BO.get(r);return{...t instanceof Z?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function hk(e,{map:t,tableStart:n,table:r},i){let a=i>0?-1:0;ik(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o<t.height;o++){let s=o*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,rk(c.attrs,i-t.colCount(a))),o+=c.attrs.rowspan-1}else{let c=a==null?GO(r.type.schema).cell:r.nodeAt(t.map[s+a]).type,l=t.positionAt(o,i,r);e.insert(e.mapping.map(n+l),c.createAndFill())}}return e}function gk(e,t){if(!YO(e))return!1;if(t){let n=mk(e);t(hk(e.tr,n,n.left))}return!0}function _k(e,t){if(!YO(e))return!1;if(t){let n=mk(e);t(hk(e.tr,n,n.right))}return!0}function vk(e,{map:t,table:n,tableStart:r},i){let a=e.mapping.maps.length;for(let o=0;o<t.height;){let s=o*t.width+i,c=t.map[s],l=n.nodeAt(c),u=l.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(r+c),null,nk(u,i-t.colCount(c)));else{let t=e.mapping.slice(a).map(r+c);e.delete(t,t+l.nodeSize)}o+=u.rowspan}}function yk(e,t){if(!YO(e))return!1;if(t){let n=mk(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let e=n.right-1;vk(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=BO.get(e)}t(r)}return!0}function bk(e,t,n){let r=GO(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(t.nodeAt(e.map[i+n*e.width])?.type!=r)return!1;return!0}function xk(e,{map:t,tableStart:n,table:r},i){let a=n;for(let e=0;e<i;e++)a+=r.child(e).nodeSize;let o=[],s=i>0?-1:0;bk(t,r,i+s)&&(s=i==0||i==t.height?null:0);for(let a=0,c=t.width*i;a<t.width;a++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),a+=o.colspan-1}else{let e=(s==null?GO(r.type.schema).cell:r.nodeAt(t.map[c+s*t.width])?.type)?.createAndFill();e&&o.push(e)}return e.insert(a,GO(r.type.schema).row.create(null,o)),e}function Sk(e,t){if(!YO(e))return!1;if(t){let n=mk(e);t(xk(e.tr,n,n.top))}return!0}function Ck(e,t){if(!YO(e))return!1;if(t){let n=mk(e);t(xk(e.tr,n,n.bottom))}return!0}function wk(e,{map:t,table:n,tableStart:r},i){let a=0;for(let e=0;e<i;e++)a+=n.child(e).nodeSize;let o=a+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(a+r,o+r);let c=new Set;for(let a=0,o=i*t.width;a<t.width;a++,o++){let l=t.map[o];if(!c.has(l)){if(c.add(l),i>0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i<t.height&&l==t.map[o+t.width]){let o=n.nodeAt(l),c=o.attrs,u=o.type.create({...c,rowspan:o.attrs.rowspan-1},o.content),d=t.positionAt(i+1,a,n);e.insert(e.mapping.slice(s).map(r+d),u),a+=c.colspan-1}}}}function Tk(e,t){if(!YO(e))return!1;if(t){let n=mk(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;wk(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=BO.get(n.table)}t(r)}return!0}function Ek(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function Dk({width:e,height:t,map:n},r){let i=r.top*e+r.left,a=i,o=(r.bottom-1)*e+r.left,s=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[a]==n[a-1]||r.right<e&&n[s]==n[s+1])return!0;a+=e,s+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}function Ok(e,t){let n=e.selection;if(!(n instanceof Z)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=mk(e),{map:i}=r;if(Dk(i,r))return!1;if(t){let n=e.tr,a={},o=V.empty,s,c;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let l=i.map[e*i.width+t],u=r.table.nodeAt(l);if(!(a[l]||!u))if(a[l]=!0,s==null)s=l,c=u;else{Ek(u)||(o=o.append(u.content));let e=n.mapping.map(l+r.tableStart);n.delete(e,e+u.nodeSize)}}if(s==null||c==null)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...rk(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),o.size>0){let e=s+1+c.content.size,t=Ek(c)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,o)}n.setSelection(new Z(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function kk(e,t){let n=GO(e.schema);return Ak(({node:e})=>n[e.type.spec.tableRole])(e,t)}function Ak(e){return(t,n)=>{let r=t.selection,i,a;if(r instanceof Z){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{if(i=JO(r.$from),!i)return!1;a=qO(r.$from)?.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,s=[],c=o.colwidth;o.rowspan>1&&(o={...o,rowspan:1}),o.colspan>1&&(o={...o,colspan:1});let l=mk(t),u=t.tr;for(let e=0;e<l.right-l.left;e++)s.push(c?{...o,colwidth:c&&c[e]?[c[e]]:null}:o);let d;for(let t=l.top;t<l.bottom;t++){let n=l.map.positionAt(t,l.left,l.table);t==l.top&&(n+=i.nodeSize);for(let r=l.left,a=0;r<l.right;r++,a++)r==l.left&&t==l.top||u.insert(d=u.mapping.map(n+l.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[a]))}u.setNodeMarkup(a,e({node:i,row:l.top,col:l.left}),s[0]),r instanceof Z&&u.setSelection(new Z(u.doc.resolve(r.$anchorCell.pos),d?u.doc.resolve(d):void 0)),n(u)}return!0}}function jk(e,t){return function(n,r){if(!YO(n))return!1;let i=XO(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let a=n.tr;n.selection instanceof Z?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function Mk(e){return function(t,n){if(!YO(t))return!1;if(n){let r=GO(t.schema),i=mk(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function Nk(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function Pk(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?Mk(e):function(t,n){if(!YO(t))return!1;if(n){let r=GO(t.schema),i=mk(t),a=t.tr,o=Nk(`row`,i,r),s=Nk(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}Pk(`row`,{useDeprecatedLogic:!0}),Pk(`column`,{useDeprecatedLogic:!0});var Fk=Pk(`cell`,{useDeprecatedLogic:!0});function Ik(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}function Lk(e){return function(t,n){if(!YO(t))return!1;let r=Ik(XO(t),e);if(r==null)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(G.between(e,$O(e))).scrollIntoView())}return!0}}function Rk(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function zk(e,t){let n=e.selection;if(!(n instanceof Z))return!1;if(t){let r=e.tr,i=GO(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new U(i,0,0))}),r.docChanged&&t(r)}return!0}function Bk(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,a=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(a||c)&&(i=Hk(GO(o).row,new U(i,a,c)).content),s.push(i)}else if(a==`cell`||a==`header_cell`)s.push(n||r?Hk(GO(o).row,new U(t,n,r)).content:t);else return null;return Vk(o,s)}function Vk(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+a}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(V.empty),n[i]<r){let a=GO(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(a);t[i]=t[i].append(V.from(o))}return{height:t.length,width:r,rows:t}}function Hk(e,t){let n=e.createAndFill();return new hp(n).replace(0,n.content.size,t).doc}function Uk({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let a=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let s=a.child(i%a.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(nk(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}i.push(V.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,a=0;r<i;r++,a++){let o=[],s=n[a%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(V.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function Wk(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=GO(s),l,u;if(i>t.width)for(let a=0,s=0;a<t.height;a++){let d=n.child(a);s+=d.nodeSize;let f=[],p;p=d.lastChild==null||d.lastChild.type==c.cell?l||=c.cell.createAndFill():u||=c.header_cell.createAndFill();for(let e=t.width;e<i;e++)f.push(p);e.insert(e.mapping.slice(o).map(s-1+r),f)}if(a>t.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=e>=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,V.from(s)),f=[];for(let e=t.height;e<a;e++)f.push(d);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||u)}function Gk(e,t,n,r,i,a,o,s){if(o==0||o==t.height)return!1;let c=!1;for(let l=i;l<a;l++){let i=o*t.width+l,a=t.map[i];if(t.map[i-t.width]==a){c=!0;let i=n.nodeAt(a),{top:u,left:d}=t.findCell(a);e.setNodeMarkup(e.mapping.slice(s).map(a+r),null,{...i.attrs,rowspan:o-u}),e.insert(e.mapping.slice(s).map(t.positionAt(o,d,n)),i.type.createAndFill({...i.attrs,rowspan:u+i.attrs.rowspan-o})),l+=i.attrs.colspan-1}}return c}function Kk(e,t,n,r,i,a,o,s){if(o==0||o==t.width)return!1;let c=!1;for(let l=i;l<a;l++){let i=l*t.width+o,a=t.map[i];if(t.map[i-1]==a){c=!0;let i=n.nodeAt(a),u=t.colCount(a),d=e.mapping.slice(s).map(a+r);e.setNodeMarkup(d,null,nk(i.attrs,o-u,i.attrs.colspan-(o-u))),e.insert(d+i.nodeSize,i.type.createAndFill(nk(i.attrs,0,o-u))),l+=i.attrs.rowspan-1}}return c}function qk(e,t,n,r,i){let a=n?e.doc.nodeAt(n-1):e.doc;if(!a)throw Error(`No table found`);let o=BO.get(a),{top:s,left:c}=r,l=c+i.width,u=s+i.height,d=e.tr,f=0;function p(){if(a=n?d.doc.nodeAt(n-1):d.doc,!a)throw Error(`No table found`);o=BO.get(a),f=d.mapping.maps.length}Wk(d,o,a,n,l,u,f)&&p(),Gk(d,o,a,n,c,l,s,f)&&p(),Gk(d,o,a,n,c,l,u,f)&&p(),Kk(d,o,a,n,s,u,c,f)&&p(),Kk(d,o,a,n,s,u,l,f)&&p();for(let e=s;e<u;e++){let t=o.positionAt(e,c,a),r=o.positionAt(e,l,a);d.replace(d.mapping.slice(f).map(t+n),d.mapping.slice(f).map(r+n),new U(i.rows[e-s],0,0))}p(),d.setSelection(new Z(d.doc.resolve(n+o.positionAt(s,c,a)),d.doc.resolve(n+o.positionAt(u-1,l-1,a)))),t(d)}var Jk=Sv({ArrowLeft:Xk(`horiz`,-1),ArrowRight:Xk(`horiz`,1),ArrowUp:Xk(`vert`,-1),ArrowDown:Xk(`vert`,1),"Shift-ArrowLeft":Zk(`horiz`,-1),"Shift-ArrowRight":Zk(`horiz`,1),"Shift-ArrowUp":Zk(`vert`,-1),"Shift-ArrowDown":Zk(`vert`,1),Backspace:zk,"Mod-Backspace":zk,Delete:zk,"Mod-Delete":zk});function Yk(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function Xk(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof Z)return Yk(n,r,W.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=tA(i,e,t);if(o==null)return!1;if(e==`horiz`)return Yk(n,r,W.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=tk(i,e,t),s;return s=a?W.near(a,1):t<0?W.near(n.doc.resolve(i.before(-1)),-1):W.near(n.doc.resolve(i.after(-1)),1),Yk(n,r,s)}}}function Zk(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof Z)o=a;else{let r=tA(i,e,t);if(r==null)return!1;o=new Z(n.doc.resolve(r))}let s=tk(o.$headCell,e,t);return s?Yk(n,r,new Z(o.$anchorCell,s)):!1}}function Qk(e,t){let n=e.state.doc,r=qO(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new Z(r))),!0):!1}function $k(e,t,n){if(!YO(e.state))return!1;let r=Bk(n),i=e.state.selection;if(i instanceof Z){r||={width:1,height:1,rows:[V.from(Hk(GO(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=BO.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=Uk(r,o.right-o.left,o.bottom-o.top),qk(e.state,e.dispatch,a,o,r),!0}else if(r){let t=XO(e.state),n=t.start(-1);return qk(e.state,e.dispatch,n,BO.get(t.node(-1)).findCell(t.pos-n),r),!0}else return!1}function eA(e,t){if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=nA(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof Z)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=qO(e.state.selection.$anchor))!=null&&rA(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=rA(e,n),i=KO.getState(e.state)==null;if(!r||!ek(t,r))if(i)r=t;else return;let a=new Z(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(KO,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),KO.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(KO,-1))}function o(r){let o=r,s=KO.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);else if(nA(e,o.target)!=n&&(c=rA(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function tA(e,t,n){if(!(e.state.selection instanceof G))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function nA(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function rA(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&qO(e.state.doc.resolve(r))||qO(e.state.doc.resolve(i))}var iA=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),aA(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type?(this.node=e,aA(e,this.colgroup,this.table,this.defaultCellMinWidth),!0):!1}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function aA(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l){for(let e=0,n=0;e<l.childCount;e++){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e++,n++){let l=i==n?a:d&&d[e],u=l?l+`px`:``;if(o+=l||r,l||(s=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{let e=document.createElement(`col`);e.style.width=u,t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}s?(n.style.width=o+`px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=o+`px`)}}var oA=new zp(`tableColumnResizing`);function sA({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=iA,lastColumnResizable:i=!0}={}){let a=new Ip({key:oA,state:{init(e,t){var i;let o=(i=a.spec)==null||(i=i.props)==null?void 0:i.nodeViews,s=GO(t.schema).table.name;return r&&o&&(o[s]=(e,t)=>new r(e,n,t)),new cA(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=oA.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{lA(t,n,e,i)},mouseleave:e=>{uA(e)},mousedown:(e,r)=>{dA(e,r,t,n)}},decorations:e=>{let t=oA.getState(e);if(t&&t.activeHandle>-1)return bA(e,t.activeHandle)},nodeViews:{}}});return a}var cA=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=this,r=t.getMeta(oA);if(r&&r.setHandle!=null)return new e(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return QO(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function lA(e,t,n,r){if(!e.editable)return;let i=oA.getState(e.state);if(i&&!i.dragging){let a=pA(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=mA(e,t,`left`,n):i-t.clientX<=n&&(o=mA(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=BO.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}gA(e,o)}}}function uA(e){if(!e.editable)return;let t=oA.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&gA(e,-1)}function dA(e,t,n,r){if(!e.editable)return!1;let i=e.dom.ownerDocument.defaultView??window,a=oA.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=fA(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(oA,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=oA.getState(e.state);r?.dragging&&(_A(e,r.activeHandle,hA(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(oA,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=oA.getState(e.state);if(i&&i.dragging){let a=hA(i.dragging,t,n);vA(e,i.activeHandle,a,r)}}return vA(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function fA(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],s--);return o/s}function pA(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function mA(e,t,n,r){let i=n==`right`?-r:r,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:o}=a,s=qO(e.state.doc.resolve(o));if(!s)return-1;if(n==`right`)return s.pos;let c=BO.get(s.node(-1)),l=s.start(-1),u=c.map.indexOf(s.pos-l);return u%c.width==0?-1:l+c.map[u-1]}function hA(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function gA(e,t){e.dispatch(e.state.tr.setMeta(oA,{setHandle:t}))}function _A(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),a=BO.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let e=0;e<a.height;e++){let t=e*a.width+s;if(e&&a.map[t]==a.map[t-a.width])continue;let r=a.map[t],l=i.nodeAt(r).attrs,u=l.colspan==1?0:s-a.colCount(r);if(l.colwidth&&l.colwidth[u]==n)continue;let d=l.colwidth?l.colwidth.slice():yA(l.colspan);d[u]=n,c.setNodeMarkup(o+r,null,{...l,colwidth:d})}c.docChanged&&e.dispatch(c)}function vA(e,t,n,r){let i=e.state.doc.resolve(t),a=i.node(-1),o=i.start(-1),s=BO.get(a).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!=`TABLE`;)c=c.parentNode;c&&aA(a,c.firstChild,c,r,s,n)}function yA(e){return Array(e).fill(0)}function bA(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return x_.empty;let a=BO.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){let r=s+t*a.width;if((s==a.width-1||a.map[r]!=a.map[r+1])&&(t==0||a.map[r]!=a.map[r-a.width])){let t=a.map[r],s=o+t+i.nodeAt(t).nodeSize-1,c=document.createElement(`div`);c.className=`column-resize-handle`,oA.getState(e)?.dragging&&n.push(v_.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),n.push(v_.widget(s,c))}}return x_.create(e.doc,n)}function xA({allowTableNodeSelection:e=!1}={}){return new Ip({key:KO,state:{init(){return null},apply(e,t){let n=e.getMeta(KO);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:ok,handleDOMEvents:{mousedown:eA},createSelectionBetween(e){return KO.getState(e.state)==null?null:e.state.selection},handleTripleClick:Qk,handleKeyDown:Jk,handlePaste:$k},appendTransaction(t,n,r){return lk(r,fk(r,n),e)}})}function SA(e,t){return t?[`width`,`${Math.max(t,e)}px`]:[`min-width`,`${e}px`]}function CA(e,t,n,r,i,a){var o;let s=0,c=!0,l=t.firstChild,u=e.firstChild;if(u!==null)for(let e=0,n=0;e<u.childCount;e+=1){let{colspan:o,colwidth:d}=u.child(e).attrs;for(let e=0;e<o;e+=1,n+=1){let o=i===n?a:d&&d[e],u=o?`${o}px`:``;if(s+=o||r,o||(c=!1),l){if(l.style.width!==u){let[e,t]=SA(r,o);l.style.setProperty(e,t)}l=l.nextSibling}else{let e=document.createElement(`col`),[n,i]=SA(r,o);e.style.setProperty(n,i),t.appendChild(e)}}}for(;l;){let e=l.nextSibling;(o=l.parentNode)==null||o.removeChild(l),l=e}c?(n.style.width=`${s}px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=`${s}px`)}var wA=class{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),CA(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type===this.node.type?(this.node=e,CA(e,this.colgroup,this.table,this.cellMinWidth),!0):!1}ignoreMutation(e){return e.type===`attributes`&&(e.target===this.table||this.colgroup.contains(e.target))}};function TA(e,t,n,r){let i=0,a=!0,o=[],s=e.firstChild;if(!s)return{};for(let e=0,c=0;e<s.childCount;e+=1){let{colspan:l,colwidth:u}=s.child(e).attrs;for(let e=0;e<l;e+=1,c+=1){let s=n===c?r:u&&u[e];i+=s||t,s||(a=!1);let[l,d]=SA(t,s);o.push([`col`,{style:`${l}: ${d}`}])}}let c=a?`${i}px`:``,l=a?``:`${i}px`;return{colgroup:[`colgroup`,{},...o],tableWidth:c,tableMinWidth:l}}function EA(e,t){return t?e.createChecked(null,t):e.createAndFill()}function DA(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(n=>{let r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function OA(e,t,n,r,i){let a=DA(e),o=[],s=[];for(let e=0;e<n;e+=1){let e=EA(a.cell,i);if(e&&s.push(e),r){let e=EA(a.header_cell,i);e&&o.push(e)}}let c=[];for(let e=0;e<t;e+=1)c.push(a.row.createChecked(null,r&&e===0?o:s));return a.table.createChecked(null,c)}function kA(e){return e instanceof Z}var AA=({editor:e})=>{let{selection:t}=e.state;if(!kA(t))return!1;let n=0;return dx(t.ranges[0].$from,e=>e.type.name===`table`)?.node.descendants(e=>{if(e.type.name===`table`)return!1;[`tableCell`,`tableHeader`].includes(e.type.name)&&(n+=1)}),n===t.ranges.length?(e.commands.deleteTable(),!0):!1},jA=Y.create({name:`table`,addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:wA,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:`tableRow+`,tableRole:`table`,isolating:!0,group:`block`,parseHTML(){return[{tag:`table`}]},renderHTML({node:e,HTMLAttributes:t}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=TA(e,this.options.cellMinWidth),a=[`table`,yy(this.options.HTMLAttributes,t,{style:r?`width: ${r}`:`min-width: ${i}`}),n,[`tbody`,0]];return this.options.renderWrapper?[`div`,{class:`tableWrapper`},a]:a},addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:a})=>{let o=OA(a.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(G.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>gk(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>_k(e,t),deleteColumn:()=>({state:e,dispatch:t})=>yk(e,t),addRowBefore:()=>({state:e,dispatch:t})=>Sk(e,t),addRowAfter:()=>({state:e,dispatch:t})=>Ck(e,t),deleteRow:()=>({state:e,dispatch:t})=>Tk(e,t),deleteTable:()=>({state:e,dispatch:t})=>Rk(e,t),mergeCells:()=>({state:e,dispatch:t})=>Ok(e,t),splitCell:()=>({state:e,dispatch:t})=>kk(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>Pk(`column`)(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>Pk(`row`)(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>Fk(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>Ok(e,t)?!0:kk(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>jk(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>Lk(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>Lk(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&fk(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=Z.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:AA,"Mod-Backspace":AA,Delete:AA,"Mod-Delete":AA}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[sA({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],xA({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(e){return{tableRole:J(q(e,`tableRole`,{name:e.name,options:e.options,storage:e.storage}))}}}),MA=Y.create({name:`tableCell`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute(`colwidth`);return t?t.split(`,`).map(e=>parseInt(e,10)):null}}}},tableRole:`cell`,isolating:!0,parseHTML(){return[{tag:`td`}]},renderHTML({HTMLAttributes:e}){return[`td`,yy(this.options.HTMLAttributes,e),0]}}),NA=Y.create({name:`tableHeader`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute(`colwidth`);return t?t.split(`,`).map(e=>parseInt(e,10)):null}}}},tableRole:`header_cell`,isolating:!0,parseHTML(){return[{tag:`th`}]},renderHTML({HTMLAttributes:e}){return[`th`,yy(this.options.HTMLAttributes,e),0]}}),PA=Y.create({name:`tableRow`,addOptions(){return{HTMLAttributes:{}}},content:`(tableCell | tableHeader)*`,tableRole:`row`,parseHTML(){return[{tag:`tr`}]},renderHTML({HTMLAttributes:e}){return[`tr`,yy(this.options.HTMLAttributes,e),0]}}),FA=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,IA=`ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2`,LA=`numeric`,RA=`ascii`,zA=`alpha`,BA=`asciinumeric`,VA=`alphanumeric`,HA=`domain`,UA=`emoji`,WA=`scheme`,GA=`slashscheme`,KA=`whitespace`;function qA(e,t){return e in t||(t[e]=[]),t[e]}function JA(e,t,n){t[LA]&&(t[BA]=!0,t[VA]=!0),t[RA]&&(t[BA]=!0,t[zA]=!0),t[BA]&&(t[VA]=!0),t[zA]&&(t[VA]=!0),t[VA]&&(t[HA]=!0),t[UA]&&(t[HA]=!0);for(let r in t){let t=qA(r,n);t.indexOf(e)<0&&t.push(e)}}function YA(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function XA(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}XA.groups={},XA.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=XA.groups;let i;return t&&t.j?i=t:(i=new XA(t),n&&r&&JA(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=XA.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new XA,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new XA,a&&(r&&(o.t&&typeof o.t==`string`?JA(a,Object.assign(YA(o.t,r),n),r):n&&JA(a,n,r)),o.t=a),i.j[e]=o,o}};var Q=(e,t,n,r,i)=>e.ta(t,n,r,i),ZA=(e,t,n,r,i)=>e.tr(t,n,r,i),QA=(e,t,n,r,i)=>e.ts(t,n,r,i),$=(e,t,n,r,i)=>e.tt(t,n,r,i),$A=`WORD`,ej=`UWORD`,tj=`ASCIINUMERICAL`,nj=`ALPHANUMERICAL`,rj=`LOCALHOST`,ij=`TLD`,aj=`UTLD`,oj=`SCHEME`,sj=`SLASH_SCHEME`,cj=`NUM`,lj=`WS`,uj=`NL`,dj=`OPENBRACE`,fj=`CLOSEBRACE`,pj=`OPENBRACKET`,mj=`CLOSEBRACKET`,hj=`OPENPAREN`,gj=`CLOSEPAREN`,_j=`OPENANGLEBRACKET`,vj=`CLOSEANGLEBRACKET`,yj=`FULLWIDTHLEFTPAREN`,bj=`FULLWIDTHRIGHTPAREN`,xj=`LEFTCORNERBRACKET`,Sj=`RIGHTCORNERBRACKET`,Cj=`LEFTWHITECORNERBRACKET`,wj=`RIGHTWHITECORNERBRACKET`,Tj=`FULLWIDTHLESSTHAN`,Ej=`FULLWIDTHGREATERTHAN`,Dj=`AMPERSAND`,Oj=`APOSTROPHE`,kj=`ASTERISK`,Aj=`AT`,jj=`BACKSLASH`,Mj=`BACKTICK`,Nj=`CARET`,Pj=`COLON`,Fj=`COMMA`,Ij=`DOLLAR`,Lj=`DOT`,Rj=`EQUALS`,zj=`EXCLAMATION`,Bj=`HYPHEN`,Vj=`PERCENT`,Hj=`PIPE`,Uj=`PLUS`,Wj=`POUND`,Gj=`QUERY`,Kj=`QUOTE`,qj=`FULLWIDTHMIDDLEDOT`,Jj=`SEMI`,Yj=`SLASH`,Xj=`TILDE`,Zj=`UNDERSCORE`,Qj=`EMOJI`,$j=`SYM`,eM=Object.freeze({__proto__:null,ALPHANUMERICAL:nj,AMPERSAND:Dj,APOSTROPHE:Oj,ASCIINUMERICAL:tj,ASTERISK:kj,AT:Aj,BACKSLASH:jj,BACKTICK:Mj,CARET:Nj,CLOSEANGLEBRACKET:vj,CLOSEBRACE:fj,CLOSEBRACKET:mj,CLOSEPAREN:gj,COLON:Pj,COMMA:Fj,DOLLAR:Ij,DOT:Lj,EMOJI:Qj,EQUALS:Rj,EXCLAMATION:zj,FULLWIDTHGREATERTHAN:Ej,FULLWIDTHLEFTPAREN:yj,FULLWIDTHLESSTHAN:Tj,FULLWIDTHMIDDLEDOT:qj,FULLWIDTHRIGHTPAREN:bj,HYPHEN:Bj,LEFTCORNERBRACKET:xj,LEFTWHITECORNERBRACKET:Cj,LOCALHOST:rj,NL:uj,NUM:cj,OPENANGLEBRACKET:_j,OPENBRACE:dj,OPENBRACKET:pj,OPENPAREN:hj,PERCENT:Vj,PIPE:Hj,PLUS:Uj,POUND:Wj,QUERY:Gj,QUOTE:Kj,RIGHTCORNERBRACKET:Sj,RIGHTWHITECORNERBRACKET:wj,SCHEME:oj,SEMI:Jj,SLASH:Yj,SLASH_SCHEME:sj,SYM:$j,TILDE:Xj,TLD:ij,UNDERSCORE:Zj,UTLD:aj,UWORD:ej,WORD:$A,WS:lj}),tM=/[a-z]/,nM=/\p{L}/u,rM=/\p{Emoji}/u,iM=/\d/,aM=/\s/,oM=`\r`,sM=`
|
|
124
|
+
`,cM=`️`,lM=``,uM=``,dM=null,fM=null;function pM(e=[]){let t={};XA.groups=t;let n=new XA;dM??=_M(FA),fM??=_M(IA),$(n,`'`,Oj),$(n,`{`,dj),$(n,`}`,fj),$(n,`[`,pj),$(n,`]`,mj),$(n,`(`,hj),$(n,`)`,gj),$(n,`<`,_j),$(n,`>`,vj),$(n,`(`,yj),$(n,`)`,bj),$(n,`「`,xj),$(n,`」`,Sj),$(n,`『`,Cj),$(n,`』`,wj),$(n,`<`,Tj),$(n,`>`,Ej),$(n,`&`,Dj),$(n,`*`,kj),$(n,`@`,Aj),$(n,"`",Mj),$(n,`^`,Nj),$(n,`:`,Pj),$(n,`,`,Fj),$(n,`$`,Ij),$(n,`.`,Lj),$(n,`=`,Rj),$(n,`!`,zj),$(n,`-`,Bj),$(n,`%`,Vj),$(n,`|`,Hj),$(n,`+`,Uj),$(n,`#`,Wj),$(n,`?`,Gj),$(n,`"`,Kj),$(n,`/`,Yj),$(n,`;`,Jj),$(n,`~`,Xj),$(n,`_`,Zj),$(n,`\\`,jj),$(n,`・`,qj);let r=ZA(n,iM,cj,{[LA]:!0});ZA(r,iM,r);let i=ZA(r,tM,tj,{[BA]:!0}),a=ZA(r,nM,nj,{[VA]:!0}),o=ZA(n,tM,$A,{[RA]:!0});ZA(o,iM,i),ZA(o,tM,o),ZA(i,iM,i),ZA(i,tM,i);let s=ZA(n,nM,ej,{[zA]:!0});ZA(s,tM),ZA(s,iM,a),ZA(s,nM,s),ZA(a,iM,a),ZA(a,tM),ZA(a,nM,a);let c=$(n,sM,uj,{[KA]:!0}),l=$(n,oM,lj,{[KA]:!0}),u=ZA(n,aM,lj,{[KA]:!0});$(n,uM,u),$(l,sM,c),$(l,uM,u),ZA(l,aM,u),$(u,oM),$(u,sM),ZA(u,aM,u),$(u,uM,u);let d=ZA(n,rM,Qj,{[UA]:!0});$(d,`#`),ZA(d,rM,d),$(d,cM,d);let f=$(d,lM);$(f,`#`),ZA(f,rM,d);let p=[[tM,o],[iM,i]],m=[[tM,null],[nM,s],[iM,a]];for(let e=0;e<dM.length;e++)gM(n,dM[e],ij,$A,p);for(let e=0;e<fM.length;e++)gM(n,fM[e],aj,ej,m);JA(ij,{tld:!0,ascii:!0},t),JA(aj,{utld:!0,alpha:!0},t),gM(n,`file`,oj,$A,p),gM(n,`mailto`,oj,$A,p),gM(n,`http`,sj,$A,p),gM(n,`https`,sj,$A,p),gM(n,`ftp`,sj,$A,p),gM(n,`ftps`,sj,$A,p),JA(oj,{scheme:!0,ascii:!0},t),JA(sj,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[WA]:!0}:{[GA]:!0};r.indexOf(`-`)>=0?i[HA]=!0:tM.test(r)?iM.test(r)?i[BA]=!0:i[RA]=!0:i[LA]=!0,QA(n,r,r,i)}return QA(n,`localhost`,rj,{ascii:!0}),n.jd=new XA($j),{start:n,tokens:Object.assign({groups:t},eM)}}function mM(e,t){let n=hM(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function hM(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function gM(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new XA(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new XA(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function _M(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var vM={defaultProtocol:`http`,events:null,format:bM,formatHref:bM,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function yM(e,t=null){let n=Object.assign({},vM);e&&(n=Object.assign(n,e instanceof yM?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}yM.prototype={o:vM,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:vM[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function bM(e){return e}function xM(e,t){this.t=`token`,this.v=e,this.tk=t}xM.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=vM.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}};function SM(e,t){class n extends xM{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}var CM=SM(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),wM=SM(`text`),TM=SM(`nl`),EM=SM(`url`,{isLink:!0,toHref(e=vM.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==rj&&e[1].t===Pj}}),DM=e=>new XA(e);function OM({groups:e}){let t=e.domain.concat([Dj,kj,Aj,jj,Mj,Nj,Ij,Rj,Bj,cj,Vj,Hj,Uj,Wj,Yj,$j,Xj,Zj]),n=[Oj,Pj,Fj,Lj,zj,Vj,Gj,Kj,Jj,_j,vj,dj,fj,mj,pj,hj,gj,yj,bj,xj,Sj,Cj,wj,Tj,Ej],r=[Dj,Oj,kj,jj,Mj,Nj,Ij,Rj,Bj,dj,fj,Vj,Hj,Uj,Wj,Gj,Yj,$j,Xj,Zj],i=DM(),a=$(i,Xj);Q(a,r,a),Q(a,e.domain,a);let o=DM(),s=DM(),c=DM();Q(i,e.domain,o),Q(i,e.scheme,s),Q(i,e.slashscheme,c),Q(o,r,a),Q(o,e.domain,o);let l=$(o,Aj);$(a,Aj,l),$(s,Aj,l),$(c,Aj,l);let u=$(a,Lj);Q(u,r,a),Q(u,e.domain,a);let d=DM();Q(l,e.domain,d),Q(d,e.domain,d);let f=$(d,Lj);Q(f,e.domain,d);let p=DM(CM);Q(f,e.tld,p),Q(f,e.utld,p),$(l,rj,p);let m=$(d,Bj);$(m,Bj,m),Q(m,e.domain,d),Q(p,e.domain,d),$(p,Lj,f),$(p,Bj,m),Q($(p,Pj),e.numeric,CM);let h=$(o,Bj),g=$(o,Lj);$(h,Bj,h),Q(h,e.domain,o),Q(g,r,a),Q(g,e.domain,o);let _=DM(EM);Q(g,e.tld,_),Q(g,e.utld,_),Q(_,e.domain,o),Q(_,r,a),$(_,Lj,g),$(_,Bj,h),$(_,Aj,l);let v=$(_,Pj),y=DM(EM);Q(v,e.numeric,y);let b=DM(EM),x=DM();Q(b,t,b),Q(b,n,x),Q(x,t,b),Q(x,n,x),$(_,Yj,b),$(y,Yj,b);let S=$(s,Pj),C=$($($(c,Pj),Yj),Yj);Q(s,e.domain,o),$(s,Lj,g),$(s,Bj,h),Q(c,e.domain,o),$(c,Lj,g),$(c,Bj,h),Q(S,e.domain,b),$(S,Yj,b),$(S,Gj,b),Q(C,e.domain,b),Q(C,t,b),$(C,Yj,b);let w=[[dj,fj],[pj,mj],[hj,gj],[_j,vj],[yj,bj],[xj,Sj],[Cj,wj],[Tj,Ej]];for(let e=0;e<w.length;e++){let[r,i]=w[e],a=$(b,r);$(x,r,a),$(a,i,b);let o=DM(EM);Q(a,t,o);let s=DM();Q(a,n),Q(o,t,o),Q(o,n,s),Q(s,t,o),Q(s,n,s),$(o,i,b),$(s,i,b)}return $(i,rj,_),$(i,uj,TM),{start:i,tokens:eM}}function kM(e,t,n){let r=n.length,i=0,a=[],o=[];for(;i<r;){let s=e,c=null,l=null,u=0,d=null,f=-1;for(;i<r&&!(c=s.go(n[i].t));)o.push(n[i++]);for(;i<r&&(l=c||s.go(n[i].t));)c=null,s=l,s.accepts()?(f=0,d=s):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(AM(wM,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(AM(e,t,r))}}return o.length>0&&a.push(AM(wM,t,o)),a}function AM(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var jM=typeof console<`u`&&console&&console.warn||(()=>{}),MM=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,NM={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function PM(){return XA.groups={},NM.scanner=null,NM.parser=null,NM.tokenQueue=[],NM.pluginQueue=[],NM.customSchemes=[],NM.initialized=!1,NM}function FM(e,t=!1){if(NM.initialized&&jM(`linkifyjs: already initialized - will not register custom scheme "${e}" ${MM}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
|
|
127
125
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
128
126
|
2. Cannot start or end with "-"
|
|
129
|
-
3. "-" cannot repeat`);ce.customSchemes.push([t,e])}function m5(){ce.scanner=a5(ce.customSchemes);for(let t=0;t<ce.tokenQueue.length;t++)ce.tokenQueue[t][1]({scanner:ce.scanner});ce.parser=c5(ce.scanner.tokens);for(let t=0;t<ce.pluginQueue.length;t++)ce.pluginQueue[t][1]({scanner:ce.scanner,parser:ce.parser});return ce.initialized=!0,ce}function jd(t){return ce.initialized||m5(),d5(ce.parser.start,t,Tb(ce.scanner.start,t))}jd.scan=Tb;function Ob(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Hd(n),i=jd(t),s=[];for(let o=0;o<i.length;o++){const a=i[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}const Vd="[\0- -\u2029 ]",g5=new RegExp(Vd),b5=new RegExp(`${Vd}$`),v5=new RegExp(Vd,"g");function y5(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function _5(t){return new we({key:new $e("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(l=>l.docChanged)&&!n.doc.eq(r.doc),s=e.some(l=>l.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,a=sw(n.doc,[...e]);if(hw(a).forEach(({newRange:l})=>{const c=aw(r.doc,l,f=>f.isTextblock);let d,h;if(c.length>1)d=c[0],h=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(c.length){const f=r.doc.textBetween(l.from,l.to," "," ");if(!b5.test(f))return;d=c[0],h=r.doc.textBetween(d.pos,l.to,void 0," ")}if(d&&h){const f=h.split(g5).filter(Boolean);if(f.length<=0)return!1;const p=f[f.length-1],m=d.pos+h.lastIndexOf(p);if(!p)return!1;const g=jd(p).map(b=>b.toObject(t.defaultProtocol));if(!y5(g))return!1;g.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>t.validate(b.value)).filter(b=>t.shouldAutoLink(b.value)).forEach(b=>{kd(b.from,b.to,r.doc).some(v=>v.mark.type===t.type)||o.addMark(b.from,b.to,t.type.create({href:b.href}))})}}),!!o.steps.length)return o}})}function x5(t){return new we({key:new $e("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=r.target;const a=[];for(;o.nodeName!=="DIV";)a.push(o),o=o.parentNode;if(!a.find(h=>h.nodeName==="A"))return!1;const u=y1(e.state,t.type.name),l=r.target,c=(i=l?.href)!==null&&i!==void 0?i:u.href,d=(s=l?.target)!==null&&s!==void 0?s:u.target;return l&&c?(window.open(c,d),!0):!1}}})}function k5(t){return new we({key:new $e("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:i}=e,{selection:s}=i,{empty:o}=s;if(o)return!1;let a="";r.content.forEach(l=>{a+=l.textContent});const u=Ob(a,{defaultProtocol:t.defaultProtocol}).find(l=>l.isLink&&l.value===a);return!a||!u?!1:t.editor.commands.setMark(t.type,{href:u.href})}}})}function Qn(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(v5,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const w5=it.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){a0(t);return}a0(t.scheme,t.optionalSlashes)})},onDestroy(){p5()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Qn(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Qn(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Qn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ge(this.options.HTMLAttributes,t),0]:["a",ge(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Qn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Qn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[_r({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=Ob(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!Qn(o,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(_5({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Qn(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(x5({type:this.type})),this.options.linkOnPaste&&t.push(k5({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),C5=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/,E5=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/g,Rb=t=>t.match(C5),S5=(t,e)=>e?"https://www.youtube-nocookie.com/embed/videoseries?list=":t?"https://www.youtube-nocookie.com/embed/":"https://www.youtube.com/embed/",A5=t=>t.searchParams.has("v")?{id:t.searchParams.get("v")}:t.hostname==="youtu.be"||t.pathname.includes("shorts")||t.pathname.includes("live")?{id:t.pathname.split("/").pop()}:t.searchParams.has("list")?{id:t.searchParams.get("list"),isPlaylist:!0}:null,M5=t=>{var e;const{url:n,allowFullscreen:r,autoplay:i,ccLanguage:s,ccLoadPolicy:o,controls:a,disableKBcontrols:u,enableIFrameApi:l,endTime:c,interfaceLanguage:d,ivLoadPolicy:h,loop:f,modestBranding:p,nocookie:m,origin:g,playlist:b,progressBarColor:v,startAt:_,rel:x}=t;if(!Rb(n))return null;if(n.includes("/embed/"))return n;const y=new URL(n),{id:k,isPlaylist:w}=(e=A5(y))!==null&&e!==void 0?e:{};if(!k)return null;const C=new URL(`${S5(m,w)}${k}`);return y.searchParams.has("t")&&C.searchParams.set("start",y.searchParams.get("t").replaceAll("s","")),r===!1&&C.searchParams.set("fs","0"),i&&C.searchParams.set("autoplay","1"),s&&C.searchParams.set("cc_lang_pref",s),o&&C.searchParams.set("cc_load_policy","1"),a||C.searchParams.set("controls","0"),u&&C.searchParams.set("disablekb","1"),l&&C.searchParams.set("enablejsapi","1"),c&&C.searchParams.set("end",c.toString()),d&&C.searchParams.set("hl",d),h&&C.searchParams.set("iv_load_policy",h.toString()),f&&C.searchParams.set("loop","1"),p&&C.searchParams.set("modestbranding","1"),g&&C.searchParams.set("origin",g),b&&C.searchParams.set("playlist",b),_&&C.searchParams.set("start",_.toString()),v&&C.searchParams.set("color",v),x!==void 0&&C.searchParams.set("rel",x.toString()),C.toString()},T5=te.create({name:"youtube",addOptions(){return{addPasteHandler:!0,allowFullscreen:!0,autoplay:!1,ccLanguage:void 0,ccLoadPolicy:void 0,controls:!0,disableKBcontrols:!1,enableIFrameApi:!1,endTime:0,height:480,interfaceLanguage:void 0,ivLoadPolicy:0,loop:!1,modestBranding:!1,HTMLAttributes:{},inline:!1,nocookie:!1,origin:"",playlist:"",progressBarColor:void 0,width:640,rel:1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},start:{default:0},width:{default:this.options.width},height:{default:this.options.height}}},parseHTML(){return[{tag:"div[data-youtube-video] iframe"}]},addCommands(){return{setYoutubeVideo:t=>({commands:e})=>Rb(t.src)?e.insertContent({type:this.name,attrs:t}):!1}},addPasteRules(){return this.options.addPasteHandler?[zw({find:E5,type:this.type,getAttributes:t=>({src:t.input})})]:[]},renderHTML({HTMLAttributes:t}){const e=M5({url:t.src,allowFullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,controls:this.options.controls,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,nocookie:this.options.nocookie,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,startAt:t.start||0,rel:this.options.rel});return t.src=e,["div",{"data-youtube-video":""},["iframe",ge(this.options.HTMLAttributes,{width:this.options.width,height:this.options.height,allowfullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,rel:this.options.rel},t)]]}});function D5(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Nb={exports:{}},sl={};/**
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
134
|
-
*
|
|
135
|
-
* This source code is licensed under the MIT license found in the
|
|
136
|
-
* LICENSE file in the root directory of this source tree.
|
|
137
|
-
*/var u0;function O5(){if(u0)return sl;u0=1;var t=ae;function e(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue;function a(d,h){var f=h(),p=r({inst:{value:f,getSnapshot:h}}),m=p[0].inst,g=p[1];return s(function(){m.value=f,m.getSnapshot=h,u(m)&&g({inst:m})},[d,f,h]),i(function(){return u(m)&&g({inst:m}),d(function(){u(m)&&g({inst:m})})},[d]),o(f),f}function u(d){var h=d.getSnapshot;d=d.value;try{var f=h();return!n(d,f)}catch{return!0}}function l(d,h){return h()}var c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return sl.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:c,sl}Nb.exports=O5();var qd=Nb.exports;const R5=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},N5=({contentComponent:t})=>{const e=qd.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return ae.createElement(ae.Fragment,null,Object.values(e))};function F5(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:Jb.createPortal(r.reactElement,r.element,n)},t.forEach(i=>i())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(i=>i())}}}class I5 extends ae.Component{constructor(e){var n;super(e),this.editorContentRef=ae.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((n=e.editor)===null||n===void 0)&&n.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.options.element.childNodes),e.setOptions({element:n}),e.contentComponent=F5(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null,!e.options.element.firstChild))return;const n=document.createElement("div");n.append(...e.options.element.childNodes),e.setOptions({element:n})}render(){const{editor:e,innerRef:n,...r}=this.props;return ae.createElement(ae.Fragment,null,ae.createElement("div",{ref:R5(n,this.editorContentRef),...r}),e?.contentComponent&&ae.createElement(N5,{contentComponent:e.contentComponent}))}}const P5=p0((t,e)=>{const n=ae.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return ae.createElement(I5,{key:n,innerRef:e,...t})}),L5=ae.memo(P5);var B5=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(i of e.entries())if(!n.has(i[0]))return!1;for(i of e.entries())if(!t(i[1],n.get(i[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(i of e.entries())if(!n.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(e[i]!==n[i])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;i--!==0;){var o=s[i];if(!(o==="_owner"&&e.$$typeof)&&!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n},$5=D5(B5),Fb={exports:{}},ol={};/**
|
|
138
|
-
* @license React
|
|
139
|
-
* use-sync-external-store-shim/with-selector.production.min.js
|
|
140
|
-
*
|
|
141
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
142
|
-
*
|
|
143
|
-
* This source code is licensed under the MIT license found in the
|
|
144
|
-
* LICENSE file in the root directory of this source tree.
|
|
145
|
-
*/var l0;function z5(){if(l0)return ol;l0=1;var t=ae,e=qd;function n(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,a=t.useMemo,u=t.useDebugValue;return ol.useSyncExternalStoreWithSelector=function(l,c,d,h,f){var p=s(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function b(k){if(!v){if(v=!0,_=k,k=h(k),f!==void 0&&m.hasValue){var w=m.value;if(f(w,k))return x=w}return x=k}if(w=x,r(_,k))return w;var C=h(k);return f!==void 0&&f(w,C)?w:(_=k,x=C)}var v=!1,_,x,y=d===void 0?null:d;return[function(){return b(c())},y===null?void 0:function(){return b(y())}]},[c,d,h,f]);var g=i(l,p[0],p[1]);return o(function(){m.hasValue=!0,m.value=g},[g]),u(g),g},ol}Fb.exports=z5();var H5=Fb.exports;const j5=typeof window<"u"?f0:J;class V5{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const n=()=>{this.transactionNumber+=1,this.subscribers.forEach(i=>i())},r=this.editor;return r.on("transaction",n),()=>{r.off("transaction",n)}}}}function q5(t){var e;const[n]=Z(()=>new V5(t.editor)),r=H5.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:$5);return j5(()=>n.watch(t.editor),[t.editor,n]),m0(r),r}const W5=!1,Oc=typeof window>"u",U5=Oc||!!(typeof window<"u"&&window.next);class Wd{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Oc||U5?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)===null||s===void 0?void 0:s.call(i,...r)},onBlur:(...r)=>{var i,s;return(s=(i=this.options.current).onBlur)===null||s===void 0?void 0:s.call(i,...r)},onCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onCreate)===null||s===void 0?void 0:s.call(i,...r)},onDestroy:(...r)=>{var i,s;return(s=(i=this.options.current).onDestroy)===null||s===void 0?void 0:s.call(i,...r)},onFocus:(...r)=>{var i,s;return(s=(i=this.options.current).onFocus)===null||s===void 0?void 0:s.call(i,...r)},onSelectionUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)===null||s===void 0?void 0:s.call(i,...r)},onTransaction:(...r)=>{var i,s;return(s=(i=this.options.current).onTransaction)===null||s===void 0?void 0:s.call(i,...r)},onUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onUpdate)===null||s===void 0?void 0:s.call(i,...r)},onContentError:(...r)=>{var i,s;return(s=(i=this.options.current).onContentError)===null||s===void 0?void 0:s.call(i,...r)},onDrop:(...r)=>{var i,s;return(s=(i=this.options.current).onDrop)===null||s===void 0?void 0:s.call(i,...r)},onPaste:(...r)=>{var i,s;return(s=(i=this.options.current).onPaste)===null||s===void 0?void 0:s.call(i,...r)}};return new Bw(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,s)=>{var o;return i===((o=n.extensions)===null||o===void 0?void 0:o[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Wd.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}}function K5(t={},e=[]){const n=Oe(t);n.current=t;const[r]=Z(()=>new Wd(n)),i=qd.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return m0(i),J(r.onRender(e)),q5({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&s===0?0:s+1}),i}const J5=Fc({editor:null});J5.Consumer;const G5=Fc({onDragStart:void 0}),Y5=()=>h0(G5);ae.forwardRef((t,e)=>{const{onDragStart:n}=Y5(),r=t.as||"div";return ae.createElement(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function Z5(t){return ee({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M58.34,101.66l-32-32a8,8,0,0,1,0-11.32l32-32A8,8,0,0,1,69.66,37.66L43.31,64,69.66,90.34a8,8,0,0,1-11.32,11.32Zm40,0a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0,0-11.32l-32-32A8,8,0,0,0,98.34,37.66L124.69,64,98.34,90.34A8,8,0,0,0,98.34,101.66ZM200,40H176a8,8,0,0,0,0,16h24V200H56V136a8,8,0,0,0-16,0v64a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Z"},child:[]}]})(t)}function X5(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M16 8l-4 -4l-4 4"},child:[]},{tag:"path",attr:{d:"M12 20v-16"},child:[]},{tag:"path",attr:{d:"M18 18c-4 -1.333 -6 -4.667 -6 -10"},child:[]},{tag:"path",attr:{d:"M6 18c4 -1.333 6 -4.667 6 -10"},child:[]}]})(t)}function Q5(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M6 15h15"},child:[]},{tag:"path",attr:{d:"M21 19h-15"},child:[]},{tag:"path",attr:{d:"M15 11h6"},child:[]},{tag:"path",attr:{d:"M21 7h-6"},child:[]},{tag:"path",attr:{d:"M9 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"},child:[]},{tag:"path",attr:{d:"M3 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"},child:[]}]})(t)}function eA(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M2 8a4 4 0 0 1 4 -4h12a4 4 0 0 1 4 4v8a4 4 0 0 1 -4 4h-12a4 4 0 0 1 -4 -4v-8z"},child:[]},{tag:"path",attr:{d:"M10 9l5 3l-5 3z"},child:[]}]})(t)}function tA(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M6 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1z"},child:[]},{tag:"path",attr:{d:"M15 12l4 0"},child:[]},{tag:"path",attr:{d:"M17 10l0 4"},child:[]}]})(t)}function nA(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M6 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1z"},child:[]},{tag:"path",attr:{d:"M16 10l4 4"},child:[]},{tag:"path",attr:{d:"M16 14l4 -4"},child:[]}]})(t)}function rA(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M15 8h.01"},child:[]},{tag:"path",attr:{d:"M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12z"},child:[]},{tag:"path",attr:{d:"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5"},child:[]},{tag:"path",attr:{d:"M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3"},child:[]}]})(t)}function iA(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M20 6v4a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1z"},child:[]},{tag:"path",attr:{d:"M12 15l0 4"},child:[]},{tag:"path",attr:{d:"M14 17l-4 0"},child:[]}]})(t)}function sA(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M20 6v4a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1z"},child:[]},{tag:"path",attr:{d:"M10 16l4 4"},child:[]},{tag:"path",attr:{d:"M10 20l4 -4"},child:[]}]})(t)}function oA(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"},child:[]},{tag:"path",attr:{d:"M3 10h18"},child:[]},{tag:"path",attr:{d:"M10 3v18"},child:[]}]})(t)}function aA(t){return ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M3.604 3.089A.75.75 0 0 1 4 3.75V8.5h.75a.75.75 0 0 1 0 1.5h-3a.75.75 0 1 1 0-1.5h.75V5.151l-.334.223a.75.75 0 0 1-.832-1.248l1.5-1a.75.75 0 0 1 .77-.037ZM8.75 5.5a.75.75 0 0 0 0 1.5h11.5a.75.75 0 0 0 0-1.5H8.75Zm0 6a.75.75 0 0 0 0 1.5h11.5a.75.75 0 0 0 0-1.5H8.75Zm0 6a.75.75 0 0 0 0 1.5h11.5a.75.75 0 0 0 0-1.5H8.75ZM5.5 15.75c0-.704-.271-1.286-.72-1.686a2.302 2.302 0 0 0-1.53-.564c-.535 0-1.094.178-1.53.565-.449.399-.72.982-.72 1.685a.75.75 0 0 0 1.5 0c0-.296.104-.464.217-.564A.805.805 0 0 1 3.25 15c.215 0 .406.072.533.185.113.101.217.268.217.565 0 .332-.069.48-.21.657-.092.113-.216.24-.403.419l-.147.14c-.152.144-.33.313-.52.504l-1.5 1.5a.75.75 0 0 0-.22.53v.25c0 .414.336.75.75.75H5A.75.75 0 0 0 5 19H3.31l.47-.47c.176-.176.333-.324.48-.465l.165-.156a5.98 5.98 0 0 0 .536-.566c.358-.447.539-.925.539-1.593Z"},child:[]}]})(t)}function uA(t){return ee({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 1 0-112 0z"},child:[]}]})(t)}const lA=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,cA=te.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",ge(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[M1({find:lA,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),c0=1920,d0=1080;function dA(t){return new Promise((e,n)=>{const r=new Image,i=URL.createObjectURL(t);r.onload=()=>{URL.revokeObjectURL(i);let{width:s,height:o}=r;if(s>c0||o>d0){const l=Math.min(c0/s,d0/o);s=Math.round(s*l),o=Math.round(o*l)}const a=document.createElement("canvas");a.width=s,a.height=o;const u=a.getContext("2d");if(!u)return n(new Error("Could not get 2D canvas context"));u.drawImage(r,0,0,s,o),a.toBlob(l=>{l?e(l):n(new Error("canvas.toBlob returned null"))},"image/png")},r.onerror=()=>{URL.revokeObjectURL(i),n(new Error("Failed to load image for conversion"))},r.src=i})}function hA(t){const e=/!\[[^\]]*\]\(([^)\s]+)\)/g,n=[];let r;for(;(r=e.exec(t))!==null;)n.push(r[1]);return n}var Ib=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};const fA=new $e("imageUpload"),pA=t=>cA.extend({addProseMirrorPlugins(){const e=this.editor;return[new we({key:fA,props:{handleDrop(n,r){var i,s;if(!t)return!1;const a=Array.from((s=(i=r.dataTransfer)===null||i===void 0?void 0:i.files)!==null&&s!==void 0?s:[]).find(u=>u.type.startsWith("image/"));return a?(r.preventDefault(),Rc(a,t,e),!0):!1},handlePaste(n,r){var i,s;if(!t)return!1;const a=Array.from((s=(i=r.clipboardData)===null||i===void 0?void 0:i.items)!==null&&s!==void 0?s:[]).find(l=>l.type.startsWith("image/"));if(!a)return!1;const u=a.getAsFile();return u?(r.preventDefault(),Rc(u,t,e),!0):!1}}})]}}).configure({HTMLAttributes:{class:"max-w-full h-auto rounded-lg my-4"}});function Rc(t,e,n){return Ib(this,void 0,void 0,function*(){try{const r=yield dA(t),i=yield e(r);i&&n.chain().focus().setImage({src:i}).run()}catch{}})}function mA(t,e){const n=document.createElement("input");n.type="file",n.accept="image/*",n.onchange=()=>Ib(this,void 0,void 0,function*(){var r;const i=(r=n.files)===null||r===void 0?void 0:r[0];i&&(yield Rc(i,t,e))}),n.click()}var Nc=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};const gA=fb.extend({addStorage(){return{markdown:{serialize(t,e){e.childCount===0?t.write("<p></p>"):t.renderInline(e),t.closeBlock(e)},parse:{}}}}});function uo(t){return t.storage.markdown.getMarkdown()}const _t=({editor:t,action:e,isActive:n,label:r,disabled:i,title:s})=>{const o="w-8 h-8 flex items-center justify-center rounded-md transition-colors duration-150 "+(n?"bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground");if(e.toLowerCase().includes("heading")){const a=parseInt(e[e.length-1]);return M("button",{type:"button",title:s,onClick:()=>t.chain().focus().toggleHeading({level:a}).run(),className:o,children:r})}return M("button",{type:"button",title:s,onClick:()=>t.chain().focus()[e]().run(),disabled:i?!t.can().chain()[e]().run():!1,className:o,children:r})},bA=({panel:t,onClose:e,editor:n,onUpdate:r,labels:i,onTransform:s,isTransforming:o})=>{const[a,u]=Z("");if(J(()=>{if(t==="link"){const f=n.getAttributes("link").href;u(typeof f=="string"?f:"https://")}else u("")},[t,n]),!t)return null;const l=()=>{if(t==="link"){const f=a.trim();f&&f!=="https://"&&n.chain().focus().setLink({href:f}).run(),e()}else if(t==="youtube"){const f=a.trim();f&&n.commands.setYoutubeVideo({src:f}),e()}else if(t==="markdown"){if(!a.trim())return;const p=uo(n)+`
|
|
146
|
-
|
|
147
|
-
`+a.trim();n.commands.setContent(p),n.commands.focus("end"),r(p),e()}else if(t==="transform"){if(!a.trim()||!s)return;s(a.trim())}},c=f=>{f.key==="Enter"&&l(),f.key==="Escape"&&e()},d=t==="markdown",h=t==="transform";return Ae("div",{className:"bg-muted/80 border-b border-border px-2 py-1.5 flex flex-col gap-1.5",children:[M("p",{className:"text-xs text-muted-foreground",children:t==="link"?i.setLinkTitle:t==="youtube"?i.addYoutubeTitle:t==="transform"?i.transformSelectionTitle:i.appendMarkdownTitle}),h?M("input",{autoFocus:!0,type:"text",value:a,onChange:f=>u(f.target.value),onKeyDown:c,placeholder:i.transformSelectionPlaceholder,className:"w-full text-sm font-mono rounded border border-border bg-background px-2 py-1 outline-none focus:ring-1 focus:ring-ring"}):d?M("textarea",{autoFocus:!0,rows:4,value:a,onChange:f=>u(f.target.value),onKeyDown:f=>f.key==="Escape"&&e(),placeholder:i.appendMarkdownPlaceholder,className:"w-full text-sm font-mono rounded border border-border bg-background px-2 py-1 resize-y outline-none focus:ring-1 focus:ring-ring"}):M("input",{autoFocus:!0,type:"url",value:a,onChange:f=>u(f.target.value),onKeyDown:c,placeholder:t==="link"?i.setLinkUrlPlaceholder:i.addYoutubeUrlPlaceholder,className:"w-full text-sm font-mono rounded border border-border bg-background px-2 py-1 outline-none focus:ring-1 focus:ring-ring"}),Ae("div",{className:"flex gap-2 justify-end",children:[M("button",{type:"button",onClick:e,disabled:o,className:"text-xs px-3 py-1 rounded border border-border hover:bg-accent transition-colors disabled:opacity-40",children:i.cancel}),Ae("button",{type:"button",onClick:l,disabled:!a.trim()||t==="link"&&a.trim()==="https://"||o,className:"text-xs px-3 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-40 transition-colors flex items-center gap-1",children:[o&&M(Ky,{size:12,className:"animate-spin"}),t==="link"?i.setLinkConfirm:t==="youtube"?i.addYoutubeConfirm:t==="transform"?i.transformSelectionConfirm:i.appendMarkdownConfirm]})]})]})},vA=({editor:t,onUpdate:e,uploadImage:n,labels:r,onCopy:i,copied:s,isFullscreen:o,onToggleFullscreen:a,hasSelection:u,onTransform:l,isTransforming:c})=>{const[d,h]=Z(null),f=b=>h(v=>v===b?null:b),p=t.isActive("table"),m=t.isActive("link"),g="w-8 h-8 flex items-center justify-center rounded-md transition-colors duration-150 text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40 disabled:pointer-events-none";return Ae(Yd,{children:[Ae("div",{className:"bg-muted/50 border-b border-border text-base flex flex-row flex-wrap items-center gap-0.5 p-1.5",children:[M(_t,{editor:t,action:"toggleBold",isActive:t.isActive("bold"),label:M(xy,{}),disabled:!0,title:r.bold}),M(_t,{editor:t,action:"toggleItalic",isActive:t.isActive("italic"),label:M(wy,{}),disabled:!0,title:r.italic}),M(_t,{editor:t,action:"toggleStrike",isActive:t.isActive("strike"),label:M(Ay,{}),disabled:!0,title:r.strike}),M(_t,{editor:t,action:"toggleCode",isActive:t.isActive("code"),label:M(ky,{}),disabled:!0,title:r.code}),M(_t,{editor:t,action:"setParagraph",isActive:t.isActive("paragraph"),label:M(Cy,{}),title:r.paragraph}),M(_t,{editor:t,action:"setHeading1",isActive:t.isActive("heading",{level:1}),label:M(Vy,{size:"24px"}),title:r.heading1}),M(_t,{editor:t,action:"setHeading2",isActive:t.isActive("heading",{level:2}),label:M(qy,{size:"24px"}),title:r.heading2}),M(_t,{editor:t,action:"setHeading3",isActive:t.isActive("heading",{level:3}),label:M(Wy,{size:"24px"}),title:r.heading3}),M(_t,{editor:t,action:"toggleBulletList",isActive:t.isActive("bulletList"),label:M(uA,{size:"24px"}),title:r.bulletList}),M(_t,{editor:t,action:"toggleOrderedList",isActive:t.isActive("orderedList"),label:M(aA,{size:"24px"}),title:r.orderedList}),M(_t,{editor:t,action:"toggleCodeBlock",isActive:t.isActive("codeBlock"),label:M(Z5,{size:"24px"}),title:r.codeBlock}),M(_t,{editor:t,action:"toggleBlockquote",isActive:t.isActive("blockquote"),label:M(Q5,{size:"24px"}),title:r.blockquote}),M("div",{className:"w-px h-5 bg-border mx-0.5"}),M("button",{type:"button",onClick:()=>{m?t.chain().focus().unsetLink().run():f("link")},title:m?r.unsetLink:r.setLink,className:"w-8 h-8 flex items-center justify-center rounded-md transition-colors duration-150 "+(m?"bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary-foreground hover:bg-destructive/10 hover:text-destructive":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:M(Uy,{size:18})}),M("button",{type:"button",onClick:()=>f("youtube"),className:g,title:r.addYoutube,children:M(eA,{size:18})}),n&&M("button",{type:"button",onClick:()=>mA(n,t),className:g,title:r.insertImage,children:M(rA,{size:18})}),M("div",{className:"w-px h-5 bg-border mx-0.5"}),M("button",{type:"button",onClick:()=>t.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),className:g,title:r.insertTable,children:M(oA,{size:18})}),p&&Ae(Yd,{children:[M("button",{type:"button",onClick:()=>t.chain().focus().addColumnAfter().run(),className:g,title:r.addColumnAfter,children:M(tA,{size:18})}),M("button",{type:"button",onClick:()=>t.chain().focus().addRowAfter().run(),className:g,title:r.addRowAfter,children:M(iA,{size:18})}),M("button",{type:"button",onClick:()=>t.chain().focus().deleteColumn().run(),className:g,title:r.deleteColumn,children:M(nA,{size:18})}),M("button",{type:"button",onClick:()=>t.chain().focus().deleteRow().run(),className:g,title:r.deleteRow,children:M(sA,{size:18})}),M("button",{type:"button",onClick:()=>t.chain().focus().mergeOrSplit().run(),className:g,title:r.mergeOrSplit,children:M(X5,{size:18})})]}),Ae("div",{className:"ml-auto flex items-center gap-0.5 "+(o?"pr-10":""),children:[u&&M("button",{type:"button",onClick:()=>f("transform"),className:g+(d==="transform"?" bg-primary/10 text-primary":""),title:r.transformSelection,children:M(Yy,{size:16})}),M("button",{type:"button",onClick:()=>f("markdown"),className:g,title:r.appendMarkdown,children:M(Hy,{size:18,style:{transform:"scaleX(-1)"}})}),M("button",{type:"button",onClick:i,title:"Copy as Markdown",className:g,children:s?M(zy,{size:16,className:"text-green-500"}):M(jy,{size:16})}),M("button",{type:"button",onClick:a,title:o?"Exit fullscreen":"Fullscreen",className:g,children:o?M(Gy,{size:16}):M(Jy,{size:16})})]})]}),M(bA,{panel:d,onClose:()=>!c&&h(null),editor:t,onUpdate:e,labels:r,onTransform:b=>Nc(void 0,void 0,void 0,function*(){yield l(b),h(null)}),isTransforming:c})]})},yA={bold:"Bold",italic:"Italic",strike:"Strikethrough",code:"Inline code",paragraph:"Paragraph",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",bulletList:"Bullet list",orderedList:"Ordered list",codeBlock:"Code block",blockquote:"Blockquote",setLink:"Set link",setLinkTitle:"Set link",setLinkUrlPlaceholder:"https://example.com",setLinkConfirm:"Apply",unsetLink:"Remove link",insertImage:"Insert image",addYoutube:"Add YouTube video",addYoutubeTitle:"Add YouTube video",addYoutubeUrlPlaceholder:"https://www.youtube.com/watch?v=…",addYoutubeConfirm:"Insert",insertTable:"Insert table",addColumnAfter:"Add column",addRowAfter:"Add row",deleteColumn:"Delete column",deleteRow:"Delete row",mergeOrSplit:"Merge or split cells",appendMarkdown:"Append markdown",appendMarkdownTitle:"Append Markdown",appendMarkdownPlaceholder:"Paste markdown here…",appendMarkdownConfirm:"Append",transformSelection:"Transform selection with AI",transformSelectionTitle:"Transform selected text with AI",transformSelectionPlaceholder:'e.g. "Fix grammar", "Make more formal", "Translate to Spanish"…',transformSelectionConfirm:"Transform",cancel:"Cancel"},_A=({content:t,editable:e,className:n,onUpdate:r,labels:i,onContentClick:s})=>{const{storage:o,ai:a}=Yt(),u=Object.assign(Object.assign({},yA),i),l=Oe(t??""),[c,d]=Z(!1),[h,f]=Z(!1),[p,m]=Z(!1),[g,b]=Z(!1),v=Ht(C=>Nc(void 0,void 0,void 0,function*(){const{data:S,error:D}=yield o.uploadImage(C);return D?null:S.url}),[o]),_=Ic(()=>[US.configure({paragraph:!1}),gA,G8.configure({resizable:!1}),X8,Z8,Y8,w5.configure({defaultProtocol:"https"}),T5,KE,pA(v)],[v]),x=K5({extensions:_,content:t,editable:e,autofocus:!1,editorProps:{attributes:{class:(e?"p-3 min-h-[200px] ":"")+"outline-none"}},onUpdate:({editor:C})=>{const S=uo(C);l.current=S,r?.(S)},onSelectionUpdate:({editor:C})=>{const{from:S,to:D}=C.state.selection;m(S!==D)}}),y=Ht(C=>Nc(void 0,void 0,void 0,function*(){if(!x)return;const{from:S,to:D}=x.state.selection;if(S===D)return;const F=x.state.doc.textBetween(S,D,`
|
|
148
|
-
`);b(!0);const L=yield a.getText({messages:[],prompt:"global.editor.transform-text",variables:{instruction:C,text:F}});if(b(!1),!L)return;x.chain().focus().deleteRange({from:S,to:D}).insertContentAt(S,L).run();const j=uo(x);l.current=j,r?.(j)}),[x,a,r]),k=Ht(()=>{x&&navigator.clipboard.writeText(uo(x)).then(()=>{f(!0),setTimeout(()=>f(!1),2e3)})},[x]);J(()=>{if(!x)return;const C=t??"";C!==l.current&&(l.current=C,x.commands.setContent(C,!1))},[x,t]),J(()=>{x&&x.setEditable(e)},[x,e]);const w=c?"text-md overflow-hidden rounded-lg border border-border bg-card shadow-sm fixed inset-0 z-50 flex flex-col":"text-md overflow-hidden rounded-lg "+(e?"border border-border bg-card shadow-sm":"bg-transparent")+" "+(n??"");return Ae("div",{className:w,onClick:s,children:[x&&e&&M(vA,{editor:x,onUpdate:r??(()=>{}),uploadImage:v,labels:u,onCopy:k,copied:h,isFullscreen:c,onToggleFullscreen:()=>d(C=>!C),hasSelection:p,onTransform:y,isTransforming:g}),M(L5,{editor:x,className:c?"flex-1 overflow-y-auto":""})]})};function xA(t,e){if(typeof document>"u"||!e)return;const n=`${t}-css`;if(document.getElementById(n))return;const r=document.createElement("style");r.id=n,r.textContent=e;const i=document.head.querySelector('style, link[rel="stylesheet"]');i?document.head.insertBefore(r,i):document.head.appendChild(r)}const kA=Object.freeze(Object.defineProperty({__proto__:null,AudioPlayOptions:Rm,AudioPlayer:Ty,Avatar:Fy,BuddyAssistant:$y,MarkdownEditor:_A,PluginProvider:ay,VoiceRecorder:Zc,extractImageUrls:hA,injectFederationCss:xA,useChat:Tm,useExerciseTracker:fy,useRimori:Yt,useSettings:hy,useTranslation:Iy},Symbol.toStringTag,{value:"Module"})),Ja="__mf_module_cache__";globalThis[Ja]||={share:{},remote:{}};globalThis[Ja].share||={};globalThis[Ja].remote||={};const Pb=globalThis[Ja];let mn=Pb.share["@rimori/react-client"];mn===void 0&&(mn=kA,Pb.share["@rimori/react-client"]=mn);const wA=mn,CA=mn.__esModule?mn.default:mn.default??mn,{useTranslation:EA,Avatar:SA,BuddyAssistant:AA,VoiceRecorder:MA,MarkdownEditor:TA,extractImageUrls:DA,injectFederationCss:OA,useChat:RA,useSettings:NA,useExerciseTracker:FA,PluginProvider:IA,useRimori:PA,AudioPlayOptions:LA,AudioPlayer:BA}=mn,JA=Gb({__proto__:null,AudioPlayOptions:LA,AudioPlayer:BA,Avatar:SA,BuddyAssistant:AA,MarkdownEditor:TA,PluginProvider:IA,VoiceRecorder:MA,default:CA,extractImageUrls:DA,injectFederationCss:OA,useChat:RA,useExerciseTracker:FA,useRimori:PA,useSettings:NA,useTranslation:EA},[wA]);export{JA as _,IA as a,kA as b};
|
|
127
|
+
3. "-" cannot repeat`);NM.customSchemes.push([e,t])}function IM(){NM.scanner=pM(NM.customSchemes);for(let e=0;e<NM.tokenQueue.length;e++)NM.tokenQueue[e][1]({scanner:NM.scanner});NM.parser=OM(NM.scanner.tokens);for(let e=0;e<NM.pluginQueue.length;e++)NM.pluginQueue[e][1]({scanner:NM.scanner,parser:NM.parser});return NM.initialized=!0,NM}function LM(e){return NM.initialized||IM(),kM(NM.parser.start,e,mM(NM.scanner.start,e))}LM.scan=mM;function RM(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new yM(n),i=LM(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var zM=`[\0- \xA0 -\u2029 ]`,BM=new RegExp(zM),VM=RegExp(`${zM}$`),HM=new RegExp(zM,`g`);function UM(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function WM(e){return new Ip({key:new zp(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r;if(vx(cx(n.doc,[...t])).forEach(({newRange:t})=>{let n=ux(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!VM.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(BM).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=LM(n).map(t=>t.toObject(e.defaultProtocol));if(!UM(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>r.schema.marks.code?!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code):!0).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{yx(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function GM(e){return new Ip({key:new zp(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=r.target,a=[];for(;i.nodeName!==`DIV`;)a.push(i),i=i.parentNode;if(!a.find(e=>e.nodeName===`A`))return!1;let o=hx(t.state,e.type.name),s=r.target,c=s?.href??o.href,l=s?.target??o.target;return s&&c?(window.open(c,l),!0):!1}}})}function KM(e){return new Ip({key:new zp(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{state:i}=t,{selection:a}=i,{empty:o}=a;if(o)return!1;let s=``;r.content.forEach(e=>{s+=e.textContent});let c=RM(s,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===s);return!s||!c?!1:e.editor.commands.setMark(e.type,{href:c.href})}}})}function qM(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(HM,``).match(RegExp(`^(?:(?:${n.join(`|`)}):|[^a-z]|[a-z0-9+.\-]+(?:[^a-z+.\-:]|$))`,`i`))}var JM=zy.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e==`string`){FM(e);return}FM(e.scheme,e.optionalSlashes)})},onDestroy(){PM()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!qM(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>!!e}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!qM(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!qM(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,yy(this.options.HTMLAttributes,e),0]:[`a`,yy(this.options.HTMLAttributes,{...e,href:``}),0]},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!qM(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!qM(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run():!1},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addPasteRules(){return[nS({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=RM(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!qM(e,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(e=>t.push({text:e.value,data:{href:e.href},index:e.start}))}return t},type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(WM({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!qM(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&e.push(GM({type:this.type})),this.options.linkOnPaste&&e.push(KM({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),e}}),YM=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/,XM=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/g,ZM=e=>e.match(YM),QM=(e,t)=>t?`https://www.youtube-nocookie.com/embed/videoseries?list=`:e?`https://www.youtube-nocookie.com/embed/`:`https://www.youtube.com/embed/`,$M=e=>e.searchParams.has(`v`)?{id:e.searchParams.get(`v`)}:e.hostname===`youtu.be`||e.pathname.includes(`shorts`)||e.pathname.includes(`live`)?{id:e.pathname.split(`/`).pop()}:e.searchParams.has(`list`)?{id:e.searchParams.get(`list`),isPlaylist:!0}:null,eN=e=>{let{url:t,allowFullscreen:n,autoplay:r,ccLanguage:i,ccLoadPolicy:a,controls:o,disableKBcontrols:s,enableIFrameApi:c,endTime:l,interfaceLanguage:u,ivLoadPolicy:d,loop:f,modestBranding:p,nocookie:m,origin:h,playlist:g,progressBarColor:_,startAt:v,rel:y}=e;if(!ZM(t))return null;if(t.includes(`/embed/`))return t;let b=new URL(t),{id:x,isPlaylist:S}=$M(b)??{};if(!x)return null;let C=new URL(`${QM(m,S)}${x}`);return b.searchParams.has(`t`)&&C.searchParams.set(`start`,b.searchParams.get(`t`).replaceAll(`s`,``)),n===!1&&C.searchParams.set(`fs`,`0`),r&&C.searchParams.set(`autoplay`,`1`),i&&C.searchParams.set(`cc_lang_pref`,i),a&&C.searchParams.set(`cc_load_policy`,`1`),o||C.searchParams.set(`controls`,`0`),s&&C.searchParams.set(`disablekb`,`1`),c&&C.searchParams.set(`enablejsapi`,`1`),l&&C.searchParams.set(`end`,l.toString()),u&&C.searchParams.set(`hl`,u),d&&C.searchParams.set(`iv_load_policy`,d.toString()),f&&C.searchParams.set(`loop`,`1`),p&&C.searchParams.set(`modestbranding`,`1`),h&&C.searchParams.set(`origin`,h),g&&C.searchParams.set(`playlist`,g),v&&C.searchParams.set(`start`,v.toString()),_&&C.searchParams.set(`color`,_),y!==void 0&&C.searchParams.set(`rel`,y.toString()),C.toString()},tN=Y.create({name:`youtube`,addOptions(){return{addPasteHandler:!0,allowFullscreen:!0,autoplay:!1,ccLanguage:void 0,ccLoadPolicy:void 0,controls:!0,disableKBcontrols:!1,enableIFrameApi:!1,endTime:0,height:480,interfaceLanguage:void 0,ivLoadPolicy:0,loop:!1,modestBranding:!1,HTMLAttributes:{},inline:!1,nocookie:!1,origin:``,playlist:``,progressBarColor:void 0,width:640,rel:1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},start:{default:0},width:{default:this.options.width},height:{default:this.options.height}}},parseHTML(){return[{tag:`div[data-youtube-video] iframe`}]},addCommands(){return{setYoutubeVideo:e=>({commands:t})=>ZM(e.src)?t.insertContent({type:this.name,attrs:e}):!1}},addPasteRules(){return this.options.addPasteHandler?[iS({find:XM,type:this.type,getAttributes:e=>({src:e.input})})]:[]},renderHTML({HTMLAttributes:e}){return e.src=eN({url:e.src,allowFullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,controls:this.options.controls,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,nocookie:this.options.nocookie,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,startAt:e.start||0,rel:this.options.rel}),[`div`,{"data-youtube-video":``},[`iframe`,yy(this.options.HTMLAttributes,{width:this.options.width,height:this.options.height,allowfullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,rel:this.options.rel},e)]]}});Ne(),rt();function nN(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var rN={exports:{}},iN={},aN;function oN(){if(aN)return iN;aN=1;var e=y;function t(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var n=typeof Object.is==`function`?Object.is:t,r=e.useState,i=e.useEffect,a=e.useLayoutEffect,o=e.useDebugValue;function s(e,t){var n=t(),s=r({inst:{value:n,getSnapshot:t}}),l=s[0].inst,u=s[1];return a(function(){l.value=n,l.getSnapshot=t,c(l)&&u({inst:l})},[e,n,t]),i(function(){return c(l)&&u({inst:l}),e(function(){c(l)&&u({inst:l})})},[e]),o(n),n}function c(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch{return!0}}function l(e,t){return t()}var u=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?l:s;return iN.useSyncExternalStore=e.useSyncExternalStore===void 0?u:e.useSyncExternalStore,iN}rN.exports=oN();var sN=rN.exports,cN=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},lN=({contentComponent:e})=>{let t=sN.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return y.createElement(y.Fragment,null,Object.values(t))};function uN(){let e=new Set,t={};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:He.createPortal(r.reactElement,r.element,n)},e.forEach(e=>e())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(e=>e())}}}var dN=class extends y.Component{constructor(e){super(e),this.editorContentRef=y.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!e.editor?.contentComponent}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.options.element.childNodes),e.setOptions({element:t}),e.contentComponent=uN(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(e=>e.hasContentComponentInitialized?e:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){let e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null,!e.options.element.firstChild))return;let t=document.createElement(`div`);t.append(...e.options.element.childNodes),e.setOptions({element:t})}render(){let{editor:e,innerRef:t,...n}=this.props;return y.createElement(y.Fragment,null,y.createElement(`div`,{ref:cN(t,this.editorContentRef),...n}),e?.contentComponent&&y.createElement(lN,{contentComponent:e.contentComponent}))}},fN=le((e,t)=>{let n=y.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return y.createElement(dN,{key:n,innerRef:t,...e})}),pN=y.memo(fN),mN=nN(function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;for(i of t.entries())if(!e(i[1],n.get(i[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(t[i]!==n[i])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!(o===`_owner`&&t.$$typeof)&&!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}),hN={exports:{}},gN={},_N;function vN(){if(_N)return gN;_N=1;var e=y,t=sN;function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useSyncExternalStore,a=e.useRef,o=e.useEffect,s=e.useMemo,c=e.useDebugValue;return gN.useSyncExternalStoreWithSelector=function(e,t,n,l,u){var d=a(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=s(function(){function e(e){if(!i){if(i=!0,a=e,e=l(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return o=t}return o=e}if(t=o,r(a,e))return t;var n=l(e);return u!==void 0&&u(t,n)?t:(a=e,o=n)}var i=!1,a,o,s=n===void 0?null:n;return[function(){return e(t())},s===null?void 0:function(){return e(s())}]},[t,n,l,u]);var p=i(e,d[0],d[1]);return o(function(){f.hasValue=!0,f.value=p},[p]),c(p),p},gN}hN.exports=vN();var yN=hN.exports,bN=typeof window<`u`?Te:D,xN=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on(`transaction`,e),()=>{t.off(`transaction`,e)}}}};function SN(e){let[t]=O(()=>new xN(e.editor)),n=yN.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??mN);return bN(()=>t.watch(e.editor),[e.editor,t]),ye(n),n}var CN=typeof window>`u`,wN=CN||!!(typeof window<`u`&&window.next),TN=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId=``,this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?CN||wN?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){return new Zx({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length?e.extensions.every((e,n)=>e===t.extensions?.[n]):!1:e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function EN(e={},t=[]){let n=ke(e);n.current=e;let[r]=O(()=>new TN(n)),i=sN.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return ye(i),D(r.onRender(t)),SN({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1?null:e.immediatelyRender&&t===0?0:t+1}),i}E({editor:null}).Consumer;var DN=E({onDragStart:void 0}),ON=()=>ve(DN);y.forwardRef((e,t)=>{let{onDragStart:n}=ON(),r=e.as||`div`;return y.createElement(r,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})});function kN(e){return B({tag:`svg`,attr:{viewBox:`0 0 256 256`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M58.34,101.66l-32-32a8,8,0,0,1,0-11.32l32-32A8,8,0,0,1,69.66,37.66L43.31,64,69.66,90.34a8,8,0,0,1-11.32,11.32Zm40,0a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0,0-11.32l-32-32A8,8,0,0,0,98.34,37.66L124.69,64,98.34,90.34A8,8,0,0,0,98.34,101.66ZM200,40H176a8,8,0,0,0,0,16h24V200H56V136a8,8,0,0,0-16,0v64a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Z`},child:[]}]})(e)}function AN(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M16 8l-4 -4l-4 4`},child:[]},{tag:`path`,attr:{d:`M12 20v-16`},child:[]},{tag:`path`,attr:{d:`M18 18c-4 -1.333 -6 -4.667 -6 -10`},child:[]},{tag:`path`,attr:{d:`M6 18c4 -1.333 6 -4.667 6 -10`},child:[]}]})(e)}function jN(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M6 15h15`},child:[]},{tag:`path`,attr:{d:`M21 19h-15`},child:[]},{tag:`path`,attr:{d:`M15 11h6`},child:[]},{tag:`path`,attr:{d:`M21 7h-6`},child:[]},{tag:`path`,attr:{d:`M9 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2`},child:[]},{tag:`path`,attr:{d:`M3 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2`},child:[]}]})(e)}function MN(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M2 8a4 4 0 0 1 4 -4h12a4 4 0 0 1 4 4v8a4 4 0 0 1 -4 4h-12a4 4 0 0 1 -4 -4v-8z`},child:[]},{tag:`path`,attr:{d:`M10 9l5 3l-5 3z`},child:[]}]})(e)}function NN(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M6 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1z`},child:[]},{tag:`path`,attr:{d:`M15 12l4 0`},child:[]},{tag:`path`,attr:{d:`M17 10l0 4`},child:[]}]})(e)}function PN(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M6 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1z`},child:[]},{tag:`path`,attr:{d:`M16 10l4 4`},child:[]},{tag:`path`,attr:{d:`M16 14l4 -4`},child:[]}]})(e)}function FN(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M15 8h.01`},child:[]},{tag:`path`,attr:{d:`M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12z`},child:[]},{tag:`path`,attr:{d:`M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5`},child:[]},{tag:`path`,attr:{d:`M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3`},child:[]}]})(e)}function IN(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M20 6v4a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1z`},child:[]},{tag:`path`,attr:{d:`M12 15l0 4`},child:[]},{tag:`path`,attr:{d:`M14 17l-4 0`},child:[]}]})(e)}function LN(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M20 6v4a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1z`},child:[]},{tag:`path`,attr:{d:`M10 16l4 4`},child:[]},{tag:`path`,attr:{d:`M10 20l4 -4`},child:[]}]})(e)}function RN(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z`},child:[]},{tag:`path`,attr:{d:`M3 10h18`},child:[]},{tag:`path`,attr:{d:`M10 3v18`},child:[]}]})(e)}function zN(e){return B({tag:`svg`,attr:{viewBox:`0 0 24 24`},child:[{tag:`path`,attr:{d:`M3.604 3.089A.75.75 0 0 1 4 3.75V8.5h.75a.75.75 0 0 1 0 1.5h-3a.75.75 0 1 1 0-1.5h.75V5.151l-.334.223a.75.75 0 0 1-.832-1.248l1.5-1a.75.75 0 0 1 .77-.037ZM8.75 5.5a.75.75 0 0 0 0 1.5h11.5a.75.75 0 0 0 0-1.5H8.75Zm0 6a.75.75 0 0 0 0 1.5h11.5a.75.75 0 0 0 0-1.5H8.75Zm0 6a.75.75 0 0 0 0 1.5h11.5a.75.75 0 0 0 0-1.5H8.75ZM5.5 15.75c0-.704-.271-1.286-.72-1.686a2.302 2.302 0 0 0-1.53-.564c-.535 0-1.094.178-1.53.565-.449.399-.72.982-.72 1.685a.75.75 0 0 0 1.5 0c0-.296.104-.464.217-.564A.805.805 0 0 1 3.25 15c.215 0 .406.072.533.185.113.101.217.268.217.565 0 .332-.069.48-.21.657-.092.113-.216.24-.403.419l-.147.14c-.152.144-.33.313-.52.504l-1.5 1.5a.75.75 0 0 0-.22.53v.25c0 .414.336.75.75.75H5A.75.75 0 0 0 5 19H3.31l.47-.47c.176-.176.333-.324.48-.465l.165-.156a5.98 5.98 0 0 0 .536-.566c.358-.447.539-.925.539-1.593Z`},child:[]}]})(e)}function BN(e){return B({tag:`svg`,attr:{viewBox:`0 0 1024 1024`},child:[{tag:`path`,attr:{d:`M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 1 0-112 0z`},child:[]}]})(e)}var VN=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,HN=Y.create({name:`image`,addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?`img[src]`:`img[src]:not([src^="data:"])`}]},renderHTML({HTMLAttributes:e}){return[`img`,yy(this.options.HTMLAttributes,e)]},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[$x({find:VN,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),UN=1920,WN=1080;function GN(e){return new Promise((t,n)=>{let r=new Image,i=URL.createObjectURL(e);r.onload=()=>{URL.revokeObjectURL(i);let{width:e,height:a}=r;if(e>UN||a>WN){let t=Math.min(UN/e,WN/a);e=Math.round(e*t),a=Math.round(a*t)}let o=document.createElement(`canvas`);o.width=e,o.height=a;let s=o.getContext(`2d`);if(!s)return n(Error(`Could not get 2D canvas context`));s.drawImage(r,0,0,e,a),o.toBlob(e=>{e?t(e):n(Error(`canvas.toBlob returned null`))},`image/png`)},r.onerror=()=>{URL.revokeObjectURL(i),n(Error(`Failed to load image for conversion`))},r.src=i})}function KN(e){let t=/!\[[^\]]*\]\(([^)\s]+)\)/g,n=[],r;for(;(r=t.exec(e))!==null;)n.push(r[1]);return n}var qN=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},JN=new zp(`imageUpload`),YN=e=>HN.extend({addProseMirrorPlugins(){let t=this.editor;return[new Ip({key:JN,props:{handleDrop(n,r){if(!e)return!1;let i=Array.from(r.dataTransfer?.files??[]).find(e=>e.type.startsWith(`image/`));return i?(r.preventDefault(),XN(i,e,t),!0):!1},handlePaste(n,r){if(!e)return!1;let i=Array.from(r.clipboardData?.items??[]).find(e=>e.type.startsWith(`image/`));if(!i)return!1;let a=i.getAsFile();return a?(r.preventDefault(),XN(a,e,t),!0):!1}}})]}}).configure({HTMLAttributes:{class:`max-w-full h-auto rounded-lg my-4`}});function XN(e,t,n){return qN(this,void 0,void 0,function*(){try{let r=yield t(yield GN(e));r&&n.chain().focus().setImage({src:r}).run()}catch{}})}function ZN(e,t){let n=document.createElement(`input`);n.type=`file`,n.accept=`image/*`,n.onchange=()=>qN(this,void 0,void 0,function*(){let r=n.files?.[0];r&&(yield XN(r,e,t))}),n.click()}Ne();var QN=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},$N=MO.extend({addStorage(){return{markdown:{serialize(e,t){t.childCount===0?e.write(`<p></p>`):e.renderInline(t),e.closeBlock(t)},parse:{}}}}});function eP(e){return e.storage.markdown.getMarkdown()}var tP=({editor:e,action:t,isActive:n,label:r,disabled:i,title:a})=>{let o=`w-8 h-8 flex items-center justify-center rounded-md transition-colors duration-150 `+(n?`bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary-foreground`:`text-muted-foreground hover:bg-accent hover:text-accent-foreground`);if(t.toLowerCase().includes(`heading`)){let n=parseInt(t[t.length-1]);return k(`button`,{type:`button`,title:a,onClick:()=>e.chain().focus().toggleHeading({level:n}).run(),className:o,children:r})}return k(`button`,{type:`button`,title:a,onClick:()=>e.chain().focus()[t]().run(),disabled:i?!e.can().chain()[t]().run():!1,className:o,children:r})},nP=({panel:e,onClose:t,editor:n,onUpdate:r,labels:i,onTransform:a,isTransforming:o})=>{let[s,c]=O(``);if(D(()=>{if(e===`link`){let e=n.getAttributes(`link`).href;c(typeof e==`string`?e:`https://`)}else c(``)},[e,n]),!e)return null;let l=()=>{if(e===`link`){let e=s.trim();e&&e!==`https://`&&n.chain().focus().setLink({href:e}).run(),t()}else if(e===`youtube`){let e=s.trim();e&&n.commands.setYoutubeVideo({src:e}),t()}else if(e===`markdown`){if(!s.trim())return;let e=eP(n)+`
|
|
128
|
+
|
|
129
|
+
`+s.trim();n.commands.setContent(e),n.commands.focus(`end`),r(e),t()}else if(e===`transform`){if(!s.trim()||!a)return;a(s.trim())}},u=e=>{e.key===`Enter`&&l(),e.key===`Escape`&&t()},d=e===`markdown`,f=e===`transform`;return mt(`div`,{className:`bg-muted/80 border-b border-border px-2 py-1.5 flex flex-col gap-1.5`,children:[k(`p`,{className:`text-xs text-muted-foreground`,children:e===`link`?i.setLinkTitle:e===`youtube`?i.addYoutubeTitle:e===`transform`?i.transformSelectionTitle:i.appendMarkdownTitle}),f?k(`input`,{autoFocus:!0,type:`text`,value:s,onChange:e=>c(e.target.value),onKeyDown:u,placeholder:i.transformSelectionPlaceholder,className:`w-full text-sm font-mono rounded border border-border bg-background px-2 py-1 outline-none focus:ring-1 focus:ring-ring`}):d?k(`textarea`,{autoFocus:!0,rows:4,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>e.key===`Escape`&&t(),placeholder:i.appendMarkdownPlaceholder,className:`w-full text-sm font-mono rounded border border-border bg-background px-2 py-1 resize-y outline-none focus:ring-1 focus:ring-ring`}):k(`input`,{autoFocus:!0,type:`url`,value:s,onChange:e=>c(e.target.value),onKeyDown:u,placeholder:e===`link`?i.setLinkUrlPlaceholder:i.addYoutubeUrlPlaceholder,className:`w-full text-sm font-mono rounded border border-border bg-background px-2 py-1 outline-none focus:ring-1 focus:ring-ring`}),mt(`div`,{className:`flex gap-2 justify-end`,children:[k(`button`,{type:`button`,onClick:t,disabled:o,className:`text-xs px-3 py-1 rounded border border-border hover:bg-accent transition-colors disabled:opacity-40`,children:i.cancel}),mt(`button`,{type:`button`,onClick:l,disabled:!s.trim()||e===`link`&&s.trim()===`https://`||o,className:`text-xs px-3 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-40 transition-colors flex items-center gap-1`,children:[o&&k(ju,{size:12,className:`animate-spin`}),e===`link`?i.setLinkConfirm:e===`youtube`?i.addYoutubeConfirm:e===`transform`?i.transformSelectionConfirm:i.appendMarkdownConfirm]})]})]})},rP=({editor:e,onUpdate:t,uploadImage:n,labels:r,onCopy:i,copied:a,isFullscreen:o,onToggleFullscreen:s,hasSelection:c,onTransform:l,isTransforming:u})=>{let[d,f]=O(null),p=e=>f(t=>t===e?null:e),m=e.isActive(`table`),h=e.isActive(`link`),g=`w-8 h-8 flex items-center justify-center rounded-md transition-colors duration-150 text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40 disabled:pointer-events-none`;return mt(pt,{children:[mt(`div`,{className:`bg-muted/50 border-b border-border text-base flex flex-row flex-wrap items-center gap-0.5 p-1.5`,children:[k(tP,{editor:e,action:`toggleBold`,isActive:e.isActive(`bold`),label:k(eu,{}),disabled:!0,title:r.bold}),k(tP,{editor:e,action:`toggleItalic`,isActive:e.isActive(`italic`),label:k(nu,{}),disabled:!0,title:r.italic}),k(tP,{editor:e,action:`toggleStrike`,isActive:e.isActive(`strike`),label:k(ou,{}),disabled:!0,title:r.strike}),k(tP,{editor:e,action:`toggleCode`,isActive:e.isActive(`code`),label:k(tu,{}),disabled:!0,title:r.code}),k(tP,{editor:e,action:`setParagraph`,isActive:e.isActive(`paragraph`),label:k(ru,{}),title:r.paragraph}),k(tP,{editor:e,action:`setHeading1`,isActive:e.isActive(`heading`,{level:1}),label:k(Du,{size:`24px`}),title:r.heading1}),k(tP,{editor:e,action:`setHeading2`,isActive:e.isActive(`heading`,{level:2}),label:k(Ou,{size:`24px`}),title:r.heading2}),k(tP,{editor:e,action:`setHeading3`,isActive:e.isActive(`heading`,{level:3}),label:k(ku,{size:`24px`}),title:r.heading3}),k(tP,{editor:e,action:`toggleBulletList`,isActive:e.isActive(`bulletList`),label:k(BN,{size:`24px`}),title:r.bulletList}),k(tP,{editor:e,action:`toggleOrderedList`,isActive:e.isActive(`orderedList`),label:k(zN,{size:`24px`}),title:r.orderedList}),k(tP,{editor:e,action:`toggleCodeBlock`,isActive:e.isActive(`codeBlock`),label:k(kN,{size:`24px`}),title:r.codeBlock}),k(tP,{editor:e,action:`toggleBlockquote`,isActive:e.isActive(`blockquote`),label:k(jN,{size:`24px`}),title:r.blockquote}),k(`div`,{className:`w-px h-5 bg-border mx-0.5`}),k(`button`,{type:`button`,onClick:()=>{h?e.chain().focus().unsetLink().run():p(`link`)},title:h?r.unsetLink:r.setLink,className:`w-8 h-8 flex items-center justify-center rounded-md transition-colors duration-150 `+(h?`bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary-foreground hover:bg-destructive/10 hover:text-destructive`:`text-muted-foreground hover:bg-accent hover:text-accent-foreground`),children:k(Au,{size:18})}),k(`button`,{type:`button`,onClick:()=>p(`youtube`),className:g,title:r.addYoutube,children:k(MN,{size:18})}),n&&k(`button`,{type:`button`,onClick:()=>ZN(n,e),className:g,title:r.insertImage,children:k(FN,{size:18})}),k(`div`,{className:`w-px h-5 bg-border mx-0.5`}),k(`button`,{type:`button`,onClick:()=>e.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),className:g,title:r.insertTable,children:k(RN,{size:18})}),m&&mt(pt,{children:[k(`button`,{type:`button`,onClick:()=>e.chain().focus().addColumnAfter().run(),className:g,title:r.addColumnAfter,children:k(NN,{size:18})}),k(`button`,{type:`button`,onClick:()=>e.chain().focus().addRowAfter().run(),className:g,title:r.addRowAfter,children:k(IN,{size:18})}),k(`button`,{type:`button`,onClick:()=>e.chain().focus().deleteColumn().run(),className:g,title:r.deleteColumn,children:k(PN,{size:18})}),k(`button`,{type:`button`,onClick:()=>e.chain().focus().deleteRow().run(),className:g,title:r.deleteRow,children:k(LN,{size:18})}),k(`button`,{type:`button`,onClick:()=>e.chain().focus().mergeOrSplit().run(),className:g,title:r.mergeOrSplit,children:k(AN,{size:18})})]}),mt(`div`,{className:`ml-auto flex items-center gap-0.5 `+(o?`pr-10`:``),children:[c&&k(`button`,{type:`button`,onClick:()=>p(`transform`),className:g+(d===`transform`?` bg-primary/10 text-primary`:``),title:r.transformSelection,children:k(Pu,{size:16})}),k(`button`,{type:`button`,onClick:()=>p(`markdown`),className:g,title:r.appendMarkdown,children:k(Tu,{size:18,style:{transform:`scaleX(-1)`}})}),k(`button`,{type:`button`,onClick:i,title:`Copy as Markdown`,className:g,children:a?k(wu,{size:16,className:`text-green-500`}):k(Eu,{size:16})}),k(`button`,{type:`button`,onClick:s,title:o?`Exit fullscreen`:`Fullscreen`,className:g,children:k(o?Nu:Mu,{size:16})})]})]}),k(nP,{panel:d,onClose:()=>!u&&f(null),editor:e,onUpdate:t,labels:r,onTransform:e=>QN(void 0,void 0,void 0,function*(){yield l(e),f(null)}),isTransforming:u})]})},iP={bold:`Bold`,italic:`Italic`,strike:`Strikethrough`,code:`Inline code`,paragraph:`Paragraph`,heading1:`Heading 1`,heading2:`Heading 2`,heading3:`Heading 3`,bulletList:`Bullet list`,orderedList:`Ordered list`,codeBlock:`Code block`,blockquote:`Blockquote`,setLink:`Set link`,setLinkTitle:`Set link`,setLinkUrlPlaceholder:`https://example.com`,setLinkConfirm:`Apply`,unsetLink:`Remove link`,insertImage:`Insert image`,addYoutube:`Add YouTube video`,addYoutubeTitle:`Add YouTube video`,addYoutubeUrlPlaceholder:`https://www.youtube.com/watch?v=…`,addYoutubeConfirm:`Insert`,insertTable:`Insert table`,addColumnAfter:`Add column`,addRowAfter:`Add row`,deleteColumn:`Delete column`,deleteRow:`Delete row`,mergeOrSplit:`Merge or split cells`,appendMarkdown:`Append markdown`,appendMarkdownTitle:`Append Markdown`,appendMarkdownPlaceholder:`Paste markdown here…`,appendMarkdownConfirm:`Append`,transformSelection:`Transform selection with AI`,transformSelectionTitle:`Transform selected text with AI`,transformSelectionPlaceholder:`e.g. "Fix grammar", "Make more formal", "Translate to Spanish"…`,transformSelectionConfirm:`Transform`,cancel:`Cancel`},aP=({content:e,editable:t,className:n,onUpdate:r,labels:i,onContentClick:a})=>{let{storage:o,ai:s}=Ml(),c=Object.assign(Object.assign({},iP),i),l=ke(e??``),[u,d]=O(!1),[f,p]=O(!1),[m,h]=O(!1),[g,_]=O(!1),v=_e(e=>QN(void 0,void 0,void 0,function*(){let{data:t,error:n}=yield o.uploadImage(e);return n?null:t.url}),[o]),y=EN({extensions:Ee(()=>[LO.configure({paragraph:!1}),$N,jA.configure({resizable:!1}),PA,NA,MA,JM.configure({defaultProtocol:`https`}),tN,mD,YN(v)],[v]),content:e,editable:t,autofocus:!1,editorProps:{attributes:{class:(t?`p-3 min-h-[200px] `:``)+`outline-none`}},onUpdate:({editor:e})=>{let t=eP(e);l.current=t,r?.(t)},onSelectionUpdate:({editor:e})=>{let{from:t,to:n}=e.state.selection;h(t!==n)}}),b=_e(e=>QN(void 0,void 0,void 0,function*(){if(!y)return;let{from:t,to:n}=y.state.selection;if(t===n)return;let i=y.state.doc.textBetween(t,n,`
|
|
130
|
+
`);_(!0);let a=yield s.getText({messages:[],prompt:`global.editor.transform-text`,variables:{instruction:e,text:i}});if(_(!1),!a)return;y.chain().focus().deleteRange({from:t,to:n}).insertContentAt(t,a).run();let o=eP(y);l.current=o,r?.(o)}),[y,s,r]),x=_e(()=>{y&&navigator.clipboard.writeText(eP(y)).then(()=>{p(!0),setTimeout(()=>p(!1),2e3)})},[y]);return D(()=>{if(!y)return;let t=e??``;t!==l.current&&(l.current=t,y.commands.setContent(t,!1))},[y,e]),D(()=>{y&&y.setEditable(t)},[y,t]),mt(`div`,{className:u?`text-md overflow-hidden rounded-lg border border-border bg-card shadow-sm fixed inset-0 z-50 flex flex-col`:`text-md overflow-hidden rounded-lg `+(t?`border border-border bg-card shadow-sm`:`bg-transparent`)+` `+(n??``),onClick:a,children:[y&&t&&k(rP,{editor:y,onUpdate:r??(()=>{}),uploadImage:v,labels:c,onCopy:x,copied:f,isFullscreen:u,onToggleFullscreen:()=>d(e=>!e),hasSelection:m,onTransform:b,isTransforming:g}),k(pN,{editor:y,className:u?`flex-1 overflow-y-auto`:``})]})};function oP(e,t){if(typeof document>`u`||!t)return;let n=`${e}-css`;if(document.getElementById(n))return;let r=document.createElement(`style`);r.id=n,r.textContent=t;let i=document.head.querySelector(`style, link[rel="stylesheet"]`);i?document.head.insertBefore(r,i):document.head.appendChild(r)}var sP=r({AudioPlayOptions:()=>cu,AudioPlayer:()=>uu,Avatar:()=>vu,BuddyAssistant:()=>Cu,MarkdownEditor:()=>aP,PluginProvider:()=>jl,VoiceRecorder:()=>hu,extractImageUrls:()=>KN,injectFederationCss:()=>oP,useChat:()=>Il,useExerciseTracker:()=>Bl,useRimori:()=>Ml,useSettings:()=>Rl,useTranslation:()=>yu}),cP=r({AudioPlayOptions:()=>EP,AudioPlayer:()=>DP,Avatar:()=>hP,BuddyAssistant:()=>gP,MarkdownEditor:()=>vP,PluginProvider:()=>wP,VoiceRecorder:()=>_P,__moduleExports:()=>fP,default:()=>pP,extractImageUrls:()=>yP,injectFederationCss:()=>bP,useChat:()=>xP,useExerciseTracker:()=>CP,useRimori:()=>TP,useSettings:()=>SP,useTranslation:()=>mP}),lP=`__mf_module_cache__`;globalThis[lP]||={share:{},remote:{}},globalThis[lP].share||={},globalThis[lP].remote||={};var uP=globalThis[lP],dP=uP.share[`@rimori/react-client`];dP===void 0&&(dP=sP,uP.share[`@rimori/react-client`]=dP);var fP=dP,pP=dP.__esModule?dP.default:dP.default??dP,{useTranslation:mP,Avatar:hP,BuddyAssistant:gP,VoiceRecorder:_P,MarkdownEditor:vP,extractImageUrls:yP,injectFederationCss:bP,useChat:xP,useSettings:SP,useExerciseTracker:CP,PluginProvider:wP,useRimori:TP,AudioPlayOptions:EP,AudioPlayer:DP}=dP;export{Ae as _,ot as a,f as b,rt as c,_e as d,ve as f,O as g,ke as h,k as i,Fe as l,Ee as m,cP as n,at as o,D as p,sP as r,Ie as s,wP as t,E as u,p as v,Ne as y};
|