Files
lucent-laravel/front/dist/assets/main-D9joEh0I.js
T

343 lines
2.7 MiB
JavaScript
Raw Normal View History

2024-08-30 13:38:34 +03:00
var AK=Object.defineProperty;var PK=(_n,Ce,ke)=>Ce in _n?AK(_n,Ce,{enumerable:!0,configurable:!0,writable:!0,value:ke}):_n[Ce]=ke;var LY=(_n,Ce,ke)=>(PK(_n,typeof Ce!="symbol"?Ce+"":Ce,ke),ke);function bind$1(_n,Ce){return function(){return _n.apply(Ce,arguments)}}const{toString:toString$1}=Object.prototype,{getPrototypeOf}=Object,kindOf=(_n=>Ce=>{const ke=toString$1.call(Ce);return _n[ke]||(_n[ke]=ke.slice(8,-1).toLowerCase())})(Object.create(null)),kindOfTest=_n=>(_n=_n.toLowerCase(),Ce=>kindOf(Ce)===_n),typeOfTest=_n=>Ce=>typeof Ce===_n,{isArray:isArray$2}=Array,isUndefined=typeOfTest("undefined");function isBuffer(_n){return _n!==null&&!isUndefined(_n)&&_n.constructor!==null&&!isUndefined(_n.constructor)&&isFunction$1(_n.constructor.isBuffer)&&_n.constructor.isBuffer(_n)}const isArrayBuffer=kindOfTest("ArrayBuffer");function isArrayBufferView(_n){let Ce;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?Ce=ArrayBuffer.isView(_n):Ce=_n&&_n.buffer&&isArrayBuffer(_n.buffer),Ce}const isString$1=typeOfTest("string"),isFunction$1=typeOfTest("function"),isNumber$1=typeOfTest("number"),isObject$1=_n=>_n!==null&&typeof _n=="object",isBoolean$1=_n=>_n===!0||_n===!1,isPlainObject=_n=>{if(kindOf(_n)!=="object")return!1;const Ce=getPrototypeOf(_n);return(Ce===null||Ce===Object.prototype||Object.getPrototypeOf(Ce)===null)&&!(Symbol.toStringTag in _n)&&!(Symbol.iterator in _n)},isDate$1=kindOfTest("Date"),isFile=kindOfTest("File"),isBlob=kindOfTest("Blob"),isFileList=kindOfTest("FileList"),isStream=_n=>isObject$1(_n)&&isFunction$1(_n.pipe),isFormData=_n=>{let Ce;return _n&&(typeof FormData=="function"&&_n instanceof FormData||isFunction$1(_n.append)&&((Ce=kindOf(_n))==="formdata"||Ce==="object"&&isFunction$1(_n.toString)&&_n.toString()==="[object FormData]"))},isURLSearchParams=kindOfTest("URLSearchParams"),[isReadableStream,isRequest,isResponse,isHeaders]=["ReadableStream","Request","Response","Headers"].map(kindOfTest),trim=_n=>_n.trim?_n.trim():_n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function forEach(_n,Ce,{allOwnKeys:ke=!1}={}){if(_n===null||typeof _n>"u")return;let $n,Hn;if(typeof _n!="object"&&(_n=[_n]),isArray$2(_n))for($n=0,Hn=_n.length;$n<Hn;$n++)Ce.call(null,_n[$n],$n,_n);else{const zn=ke?Object.getOwnPropertyNames(_n):Object.keys(_n),Zn=zn.length;let qn;for($n=0;$n<Zn;$n++)qn=zn[$n],Ce.call(null,_n[qn],qn,_n)}}function findKey$1(_n,Ce){Ce=Ce.toLowerCase();const ke=Object.keys(_n);let $n=ke.length,Hn;for(;$n-- >0;)if(Hn=ke[$n],Ce===Hn.toLowerCase())return Hn;return null}const _global=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,isContextDefined=_n=>!isUndefined(_n)&&_n!==_global;function merge(){const{caseless:_n}=isContextDefined(this)&&this||{},Ce={},ke=($n,Hn)=>{const zn=_n&&findKey$1(Ce,Hn)||Hn;isPlainObject(Ce[zn])&&isPlainObject($n)?Ce[zn]=merge(Ce[zn],$n):isPlainObject($n)?Ce[zn]=merge({},$n):isArray$2($n)?Ce[zn]=$n.slice():Ce[zn]=$n};for(let $n=0,Hn=arguments.length;$n<Hn;$n++)arguments[$n]&&forEach(arguments[$n],ke);return Ce}const extend$2=(_n,Ce,ke,{allOwnKeys:$n}={})=>(forEach(Ce,(Hn,zn)=>{ke&&isFunction$1(Hn)?_n[zn]=bind$1(Hn,ke):_n[zn]=Hn},{allOwnKeys:$n}),_n),stripBOM=_n=>(_n.charCodeAt(0)===65279&&(_n=_n.slice(1)),_n),inherits=(_n,Ce,ke,$n)=>{_n.prototype=Object.create(Ce.prototype,$n),_n.prototype.constructor=_n,Object.defineProperty(_n,"super",{value:Ce.prototype}),ke&&Object.assign(_n.prototype,ke)},toFlatObject=(_n,Ce,ke,$n)=>{let Hn,zn,Zn;const qn={};if(Ce=Ce||{},_n==null)return Ce;do{for(Hn=Object.getOwnPropertyNames(_n),zn=Hn.length;zn-- >0;)Zn=Hn[zn],(!$n||$n(Zn,_n,Ce))&&!qn[Zn]&&(Ce[Zn]=_n[Zn],qn[Zn]=!0);_n=ke!==!1&&getPrototypeOf(_n)}while(_n&&(!ke||ke(_n,Ce))&&_n!==Object.prototype);return Ce},endsWith=(_n,Ce,ke)=>{_n=String(_n),(ke===void 0||ke>_n.length)&&(ke=_n.length),ke-=Ce.length;const $n=_n.indexOf(Ce,ke);return $n!==-1&&$n===ke},toArray=_n=>{if(!_n)return null;if(isArray$2(_n))return _n;let Ce=_n.length;if(!isNumber$1(Ce))return null;const ke=new Array(Ce);for(;Ce-- >0;)ke[Ce]=_n[Ce];return ke},isTypedArray=(_n=>Ce=>_n&&Ce instanceof _
2024-08-27 12:25:42 +03:00
`).forEach(function(Zn){Hn=Zn.indexOf(":"),ke=Zn.substring(0,Hn).trim().toLowerCase(),$n=Zn.substring(Hn+1).trim(),!(!ke||Ce[ke]&&ignoreDuplicateOf[ke])&&(ke==="set-cookie"?Ce[ke]?Ce[ke].push($n):Ce[ke]=[$n]:Ce[ke]=Ce[ke]?Ce[ke]+", "+$n:$n)}),Ce},$internals=Symbol("internals");function normalizeHeader(_n){return _n&&String(_n).trim().toLowerCase()}function normalizeValue(_n){return _n===!1||_n==null?_n:utils$1.isArray(_n)?_n.map(normalizeValue):String(_n)}function parseTokens(_n){const Ce=Object.create(null),ke=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let $n;for(;$n=ke.exec(_n);)Ce[$n[1]]=$n[2];return Ce}const isValidHeaderName=_n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(_n.trim());function matchHeaderValue(_n,Ce,ke,$n,Hn){if(utils$1.isFunction($n))return $n.call(this,Ce,ke);if(Hn&&(Ce=ke),!!utils$1.isString(Ce)){if(utils$1.isString($n))return Ce.indexOf($n)!==-1;if(utils$1.isRegExp($n))return $n.test(Ce)}}function formatHeader(_n){return _n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(Ce,ke,$n)=>ke.toUpperCase()+$n)}function buildAccessors(_n,Ce){const ke=utils$1.toCamelCase(" "+Ce);["get","set","has"].forEach($n=>{Object.defineProperty(_n,$n+ke,{value:function(Hn,zn,Zn){return this[$n].call(this,Ce,Hn,zn,Zn)},configurable:!0})})}class AxiosHeaders{constructor(Ce){Ce&&this.set(Ce)}set(Ce,ke,$n){const Hn=this;function zn(qn,Yn,Jn){const to=normalizeHeader(Yn);if(!to)throw new Error("header name must be a non-empty string");const io=utils$1.findKey(Hn,to);(!io||Hn[io]===void 0||Jn===!0||Jn===void 0&&Hn[io]!==!1)&&(Hn[io||Yn]=normalizeValue(qn))}const Zn=(qn,Yn)=>utils$1.forEach(qn,(Jn,to)=>zn(Jn,to,Yn));if(utils$1.isPlainObject(Ce)||Ce instanceof this.constructor)Zn(Ce,ke);else if(utils$1.isString(Ce)&&(Ce=Ce.trim())&&!isValidHeaderName(Ce))Zn(parseHeaders(Ce),ke);else if(utils$1.isHeaders(Ce))for(const[qn,Yn]of Ce.entries())zn(Yn,qn,$n);else Ce!=null&&zn(ke,Ce,$n);return this}get(Ce,ke){if(Ce=normalizeHeader(Ce),Ce){const $n=utils$1.findKey(this,Ce);if($n){const Hn=this[$n];if(!ke)return Hn;if(ke===!0)return parseTokens(Hn);if(utils$1.isFunction(ke))return ke.call(this,Hn,$n);if(utils$1.isRegExp(ke))return ke.exec(Hn);throw new TypeError("parser must be boolean|regexp|function")}}}has(Ce,ke){if(Ce=normalizeHeader(Ce),Ce){const $n=utils$1.findKey(this,Ce);return!!($n&&this[$n]!==void 0&&(!ke||matchHeaderValue(this,this[$n],$n,ke)))}return!1}delete(Ce,ke){const $n=this;let Hn=!1;function zn(Zn){if(Zn=normalizeHeader(Zn),Zn){const qn=utils$1.findKey($n,Zn);qn&&(!ke||matchHeaderValue($n,$n[qn],qn,ke))&&(delete $n[qn],Hn=!0)}}return utils$1.isArray(Ce)?Ce.forEach(zn):zn(Ce),Hn}clear(Ce){const ke=Object.keys(this);let $n=ke.length,Hn=!1;for(;$n--;){const zn=ke[$n];(!Ce||matchHeaderValue(this,this[zn],zn,Ce,!0))&&(delete this[zn],Hn=!0)}return Hn}normalize(Ce){const ke=this,$n={};return utils$1.forEach(this,(Hn,zn)=>{const Zn=utils$1.findKey($n,zn);if(Zn){ke[Zn]=normalizeValue(Hn),delete ke[zn];return}const qn=Ce?formatHeader(zn):String(zn).trim();qn!==zn&&delete ke[zn],ke[qn]=normalizeValue(Hn),$n[qn]=!0}),this}concat(...Ce){return this.constructor.concat(this,...Ce)}toJSON(Ce){const ke=Object.create(null);return utils$1.forEach(this,($n,Hn)=>{$n!=null&&$n!==!1&&(ke[Hn]=Ce&&utils$1.isArray($n)?$n.join(", "):$n)}),ke}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([Ce,ke])=>Ce+": "+ke).join(`
2024-08-30 13:38:34 +03:00
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(Ce){return Ce instanceof this?Ce:new this(Ce)}static concat(Ce,...ke){const $n=new this(Ce);return ke.forEach(Hn=>$n.set(Hn)),$n}static accessor(Ce){const $n=(this[$internals]=this[$internals]={accessors:{}}).accessors,Hn=this.prototype;function zn(Zn){const qn=normalizeHeader(Zn);$n[qn]||(buildAccessors(Hn,Zn),$n[qn]=!0)}return utils$1.isArray(Ce)?Ce.forEach(zn):zn(Ce),this}}AxiosHeaders.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);utils$1.reduceDescriptors(AxiosHeaders.prototype,({value:_n},Ce)=>{let ke=Ce[0].toUpperCase()+Ce.slice(1);return{get:()=>_n,set($n){this[ke]=$n}}});utils$1.freezeMethods(AxiosHeaders);function transformData(_n,Ce){const ke=this||defaults$4,$n=Ce||ke,Hn=AxiosHeaders.from($n.headers);let zn=$n.data;return utils$1.forEach(_n,function(qn){zn=qn.call(ke,zn,Hn.normalize(),Ce?Ce.status:void 0)}),Hn.normalize(),zn}function isCancel(_n){return!!(_n&&_n.__CANCEL__)}function CanceledError(_n,Ce,ke){AxiosError.call(this,_n??"canceled",AxiosError.ERR_CANCELED,Ce,ke),this.name="CanceledError"}utils$1.inherits(CanceledError,AxiosError,{__CANCEL__:!0});function settle(_n,Ce,ke){const $n=ke.config.validateStatus;!ke.status||!$n||$n(ke.status)?_n(ke):Ce(new AxiosError("Request failed with status code "+ke.status,[AxiosError.ERR_BAD_REQUEST,AxiosError.ERR_BAD_RESPONSE][Math.floor(ke.status/100)-4],ke.config,ke.request,ke))}function parseProtocol(_n){const Ce=/^([-+\w]{1,25})(:?\/\/|:)/.exec(_n);return Ce&&Ce[1]||""}function speedometer(_n,Ce){_n=_n||10;const ke=new Array(_n),$n=new Array(_n);let Hn=0,zn=0,Zn;return Ce=Ce!==void 0?Ce:1e3,function(Yn){const Jn=Date.now(),to=$n[zn];Zn||(Zn=Jn),ke[Hn]=Yn,$n[Hn]=Jn;let io=zn,uo=0;for(;io!==Hn;)uo+=ke[io++],io=io%_n;if(Hn=(Hn+1)%_n,Hn===zn&&(zn=(zn+1)%_n),Jn-Zn<Ce)return;const ho=to&&Jn-to;return ho?Math.round(uo*1e3/ho):void 0}}function throttle$1(_n,Ce){let ke=0,$n=1e3/Ce,Hn,zn;const Zn=(Jn,to=Date.now())=>{ke=to,Hn=null,zn&&(clearTimeout(zn),zn=null),_n.apply(null,Jn)};return[(...Jn)=>{const to=Date.now(),io=to-ke;io>=$n?Zn(Jn,to):(Hn=Jn,zn||(zn=setTimeout(()=>{zn=null,Zn(Hn)},$n-io)))},()=>Hn&&Zn(Hn)]}const progressEventReducer=(_n,Ce,ke=3)=>{let $n=0;const Hn=speedometer(50,250);return throttle$1(zn=>{const Zn=zn.loaded,qn=zn.lengthComputable?zn.total:void 0,Yn=Zn-$n,Jn=Hn(Yn),to=Zn<=qn;$n=Zn;const io={loaded:Zn,total:qn,progress:qn?Zn/qn:void 0,bytes:Yn,rate:Jn||void 0,estimated:Jn&&qn&&to?(qn-Zn)/Jn:void 0,event:zn,lengthComputable:qn!=null,[Ce?"download":"upload"]:!0};_n(io)},ke)},progressEventDecorator=(_n,Ce)=>{const ke=_n!=null;return[$n=>Ce[0]({lengthComputable:ke,total:_n,loaded:$n}),Ce[1]]},asyncDecorator=_n=>(...Ce)=>utils$1.asap(()=>_n(...Ce)),isURLSameOrigin=platform.hasStandardBrowserEnv?function(){const Ce=/(msie|trident)/i.test(navigator.userAgent),ke=document.createElement("a");let $n;function Hn(zn){let Zn=zn;return Ce&&(ke.setAttribute("href",Zn),Zn=ke.href),ke.setAttribute("href",Zn),{href:ke.href,protocol:ke.protocol?ke.protocol.replace(/:$/,""):"",host:ke.host,search:ke.search?ke.search.replace(/^\?/,""):"",hash:ke.hash?ke.hash.replace(/^#/,""):"",hostname:ke.hostname,port:ke.port,pathname:ke.pathname.charAt(0)==="/"?ke.pathname:"/"+ke.pathname}}return $n=Hn(window.location.href),function(Zn){const qn=utils$1.isString(Zn)?Hn(Zn):Zn;return qn.protocol===$n.protocol&&qn.host===$n.host}}():function(){return function(){return!0}}(),cookies=platform.hasStandardBrowserEnv?{write(_n,Ce,ke,$n,Hn,zn){const Zn=[_n+"="+encodeURIComponent(Ce)];utils$1.isNumber(ke)&&Zn.push("expires="+new Date(ke).toGMTString()),utils$1.isString($n)&&Zn.push("path="+$n),utils$1.isString(Hn)&&Zn.push("domain="+Hn),zn===!0&&Zn.push("secure"),document.cookie=Zn.join("; ")},read(_n){const Ce=document.cookie.match(new RegExp("(^|;\\s*)("+_n+")=([^;]*)"));return Ce?decodeURIComponent(Ce[3]):null},remove(_n){this.write(_n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function isAbsoluteURL(_n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(_n)}func
2024-08-27 12:25:42 +03:00
`+zn.map(renderReason).join(`
`):" "+renderReason(zn[0]):"as no adapter specified";throw new AxiosError("There is no suitable adapter to dispatch the request "+Zn,"ERR_NOT_SUPPORT")}return $n},adapters:knownAdapters};function throwIfCancellationRequested(_n){if(_n.cancelToken&&_n.cancelToken.throwIfRequested(),_n.signal&&_n.signal.aborted)throw new CanceledError(null,_n)}function dispatchRequest(_n){return throwIfCancellationRequested(_n),_n.headers=AxiosHeaders.from(_n.headers),_n.data=transformData.call(_n,_n.transformRequest),["post","put","patch"].indexOf(_n.method)!==-1&&_n.headers.setContentType("application/x-www-form-urlencoded",!1),adapters.getAdapter(_n.adapter||defaults$4.adapter)(_n).then(function($n){return throwIfCancellationRequested(_n),$n.data=transformData.call(_n,_n.transformResponse,$n),$n.headers=AxiosHeaders.from($n.headers),$n},function($n){return isCancel($n)||(throwIfCancellationRequested(_n),$n&&$n.response&&($n.response.data=transformData.call(_n,_n.transformResponse,$n.response),$n.response.headers=AxiosHeaders.from($n.response.headers))),Promise.reject($n)})}const VERSION="1.7.4",validators$1={};["object","boolean","number","function","string","symbol"].forEach((_n,Ce)=>{validators$1[_n]=function($n){return typeof $n===_n||"a"+(Ce<1?"n ":" ")+_n}});const deprecatedWarnings={};validators$1.transitional=function(Ce,ke,$n){function Hn(zn,Zn){return"[Axios v"+VERSION+"] Transitional option '"+zn+"'"+Zn+($n?". "+$n:"")}return(zn,Zn,qn)=>{if(Ce===!1)throw new AxiosError(Hn(Zn," has been removed"+(ke?" in "+ke:"")),AxiosError.ERR_DEPRECATED);return ke&&!deprecatedWarnings[Zn]&&(deprecatedWarnings[Zn]=!0,console.warn(Hn(Zn," has been deprecated since v"+ke+" and will be removed in the near future"))),Ce?Ce(zn,Zn,qn):!0}};function assertOptions(_n,Ce,ke){if(typeof _n!="object")throw new AxiosError("options must be an object",AxiosError.ERR_BAD_OPTION_VALUE);const $n=Object.keys(_n);let Hn=$n.length;for(;Hn-- >0;){const zn=$n[Hn],Zn=Ce[zn];if(Zn){const qn=_n[zn],Yn=qn===void 0||Zn(qn,zn,_n);if(Yn!==!0)throw new AxiosError("option "+zn+" must be "+Yn,AxiosError.ERR_BAD_OPTION_VALUE);continue}if(ke!==!0)throw new AxiosError("Unknown option "+zn,AxiosError.ERR_BAD_OPTION)}}const validator={assertOptions,validators:validators$1},validators=validator.validators;class Axios{constructor(Ce){this.defaults=Ce,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}async request(Ce,ke){try{return await this._request(Ce,ke)}catch($n){if($n instanceof Error){let Hn;Error.captureStackTrace?Error.captureStackTrace(Hn={}):Hn=new Error;const zn=Hn.stack?Hn.stack.replace(/^.+\n/,""):"";try{$n.stack?zn&&!String($n.stack).endsWith(zn.replace(/^.+\n.+\n/,""))&&($n.stack+=`
2024-08-30 13:38:34 +03:00
`+zn):$n.stack=zn}catch{}}throw $n}}_request(Ce,ke){typeof Ce=="string"?(ke=ke||{},ke.url=Ce):ke=Ce||{},ke=mergeConfig(this.defaults,ke);const{transitional:$n,paramsSerializer:Hn,headers:zn}=ke;$n!==void 0&&validator.assertOptions($n,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1),Hn!=null&&(utils$1.isFunction(Hn)?ke.paramsSerializer={serialize:Hn}:validator.assertOptions(Hn,{encode:validators.function,serialize:validators.function},!0)),ke.method=(ke.method||this.defaults.method||"get").toLowerCase();let Zn=zn&&utils$1.merge(zn.common,zn[ke.method]);zn&&utils$1.forEach(["delete","get","head","post","put","patch","common"],bo=>{delete zn[bo]}),ke.headers=AxiosHeaders.concat(Zn,zn);const qn=[];let Yn=!0;this.interceptors.request.forEach(function(Oo){typeof Oo.runWhen=="function"&&Oo.runWhen(ke)===!1||(Yn=Yn&&Oo.synchronous,qn.unshift(Oo.fulfilled,Oo.rejected))});const Jn=[];this.interceptors.response.forEach(function(Oo){Jn.push(Oo.fulfilled,Oo.rejected)});let to,io=0,uo;if(!Yn){const bo=[dispatchRequest.bind(this),void 0];for(bo.unshift.apply(bo,qn),bo.push.apply(bo,Jn),uo=bo.length,to=Promise.resolve(ke);io<uo;)to=to.then(bo[io++],bo[io++]);return to}uo=qn.length;let ho=ke;for(io=0;io<uo;){const bo=qn[io++],Oo=qn[io++];try{ho=bo(ho)}catch(So){Oo.call(this,So);break}}try{to=dispatchRequest.call(this,ho)}catch(bo){return Promise.reject(bo)}for(io=0,uo=Jn.length;io<uo;)to=to.then(Jn[io++],Jn[io++]);return to}getUri(Ce){Ce=mergeConfig(this.defaults,Ce);const ke=buildFullPath(Ce.baseURL,Ce.url);return buildURL(ke,Ce.params,Ce.paramsSerializer)}}utils$1.forEach(["delete","get","head","options"],function(Ce){Axios.prototype[Ce]=function(ke,$n){return this.request(mergeConfig($n||{},{method:Ce,url:ke,data:($n||{}).data}))}});utils$1.forEach(["post","put","patch"],function(Ce){function ke($n){return function(zn,Zn,qn){return this.request(mergeConfig(qn||{},{method:Ce,headers:$n?{"Content-Type":"multipart/form-data"}:{},url:zn,data:Zn}))}}Axios.prototype[Ce]=ke(),Axios.prototype[Ce+"Form"]=ke(!0)});class CancelToken{constructor(Ce){if(typeof Ce!="function")throw new TypeError("executor must be a function.");let ke;this.promise=new Promise(function(zn){ke=zn});const $n=this;this.promise.then(Hn=>{if(!$n._listeners)return;let zn=$n._listeners.length;for(;zn-- >0;)$n._listeners[zn](Hn);$n._listeners=null}),this.promise.then=Hn=>{let zn;const Zn=new Promise(qn=>{$n.subscribe(qn),zn=qn}).then(Hn);return Zn.cancel=function(){$n.unsubscribe(zn)},Zn},Ce(function(zn,Zn,qn){$n.reason||($n.reason=new CanceledError(zn,Zn,qn),ke($n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(Ce){if(this.reason){Ce(this.reason);return}this._listeners?this._listeners.push(Ce):this._listeners=[Ce]}unsubscribe(Ce){if(!this._listeners)return;const ke=this._listeners.indexOf(Ce);ke!==-1&&this._listeners.splice(ke,1)}static source(){let Ce;return{token:new CancelToken(function(Hn){Ce=Hn}),cancel:Ce}}}function spread(_n){return function(ke){return _n.apply(null,ke)}}function isAxiosError(_n){return utils$1.isObject(_n)&&_n.isAxiosError===!0}const HttpStatusCode={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,Precondi
`;for(let So=0;So<=1;So+=Yn){const $o=Ce+(ke-Ce)*zn(So);Jn+=So*100+`%{${Zn($o,1-$o)}}
2024-08-27 12:25:42 +03:00
`}const to=Jn+`100% {${Zn(ke,1-ke)}}
2024-08-30 13:38:34 +03:00
}`,io=`__svelte_${hash$1(to)}_${qn}`,uo=get_root_for_style(_n),{stylesheet:ho,rules:bo}=managed_styles.get(uo)||create_style_information(uo,_n);bo[io]||(bo[io]=!0,ho.insertRule(`@keyframes ${io} ${to}`,ho.cssRules.length));const Oo=_n.style.animation||"";return _n.style.animation=`${Oo?`${Oo}, `:""}${io} ${$n}ms linear ${Hn}ms 1 both`,active+=1,io}function delete_rule(_n,Ce){const ke=(_n.style.animation||"").split(", "),$n=ke.filter(Ce?zn=>zn.indexOf(Ce)<0:zn=>zn.indexOf("__svelte")===-1),Hn=ke.length-$n.length;Hn&&(_n.style.animation=$n.join(", "),active-=Hn,active||clear_rules())}function clear_rules(){raf(()=>{active||(managed_styles.forEach(_n=>{const{ownerNode:Ce}=_n.stylesheet;Ce&&detach(Ce)}),managed_styles.clear())})}let current_component;function set_current_component(_n){current_component=_n}function get_current_component(){if(!current_component)throw new Error("Function called outside component initialization");return current_component}function onMount(_n){get_current_component().$$.on_mount.push(_n)}function afterUpdate(_n){get_current_component().$$.after_update.push(_n)}function onDestroy(_n){get_current_component().$$.on_destroy.push(_n)}function createEventDispatcher(){const _n=get_current_component();return(Ce,ke,{cancelable:$n=!1}={})=>{const Hn=_n.$$.callbacks[Ce];if(Hn){const zn=custom_event(Ce,ke,{cancelable:$n});return Hn.slice().forEach(Zn=>{Zn.call(_n,zn)}),!zn.defaultPrevented}return!0}}function setContext(_n,Ce){return get_current_component().$$.context.set(_n,Ce),Ce}function getContext$1(_n){return get_current_component().$$.context.get(_n)}function bubble(_n,Ce){const ke=_n.$$.callbacks[Ce.type];ke&&ke.slice().forEach($n=>$n.call(this,Ce))}const dirty_components=[],binding_callbacks=[];let render_callbacks=[];const flush_callbacks=[],resolved_promise=Promise.resolve();let update_scheduled=!1;function schedule_update(){update_scheduled||(update_scheduled=!0,resolved_promise.then(flush))}function add_render_callback(_n){render_callbacks.push(_n)}function add_flush_callback(_n){flush_callbacks.push(_n)}const seen_callbacks=new Set;let flushidx=0;function flush(){if(flushidx!==0)return;const _n=current_component;do{try{for(;flushidx<dirty_components.length;){const Ce=dirty_components[flushidx];flushidx++,set_current_component(Ce),update(Ce.$$)}}catch(Ce){throw dirty_components.length=0,flushidx=0,Ce}for(set_current_component(null),dirty_components.length=0,flushidx=0;binding_callbacks.length;)binding_callbacks.pop()();for(let Ce=0;Ce<render_callbacks.length;Ce+=1){const ke=render_callbacks[Ce];seen_callbacks.has(ke)||(seen_callbacks.add(ke),ke())}render_callbacks.length=0}while(dirty_components.length);for(;flush_callbacks.length;)flush_callbacks.pop()();update_scheduled=!1,seen_callbacks.clear(),set_current_component(_n)}function update(_n){if(_n.fragment!==null){_n.update(),run_all(_n.before_update);const Ce=_n.dirty;_n.dirty=[-1],_n.fragment&&_n.fragment.p(_n.ctx,Ce),_n.after_update.forEach(add_render_callback)}}function flush_render_callbacks(_n){const Ce=[],ke=[];render_callbacks.forEach($n=>_n.indexOf($n)===-1?Ce.push($n):ke.push($n)),ke.forEach($n=>$n()),render_callbacks=Ce}let promise;function wait(){return promise||(promise=Promise.resolve(),promise.then(()=>{promise=null})),promise}function dispatch(_n,Ce,ke){_n.dispatchEvent(custom_event(`${Ce?"intro":"outro"}${ke}`))}const outroing=new Set;let outros;function group_outros(){outros={r:0,c:[],p:outros}}function check_outros(){outros.r||run_all(outros.c),outros=outros.p}function transition_in(_n,Ce){_n&&_n.i&&(outroing.delete(_n),_n.i(Ce))}function transition_out(_n,Ce,ke,$n){if(_n&&_n.o){if(outroing.has(_n))return;outroing.add(_n),outros.c.push(()=>{outroing.delete(_n),$n&&(ke&&_n.d(1),$n())}),_n.o(Ce)}else $n&&$n()}const null_transition={duration:0};function create_bidirectional_transition(_n,Ce,ke,$n){let zn=Ce(_n,ke,{direction:"both"}),Zn=$n?0:1,qn=null,Yn=null,Jn=null,to;function io(){Jn&&delete_rule(_n,Jn)}function uo(bo,Oo){const So=bo.b-Zn;return Oo*=Math.abs(So),{a:Zn,b:bo.b,d:So,duration:Oo,start:bo.start,end:bo.start+Oo,group:
transform: ${Jn} translate(${(1-Oo)*io}${uo}, ${(1-Oo)*ho}${bo});
opacity: ${Yn-to*So}`}}function create_if_block$U(_n){let Ce,ke,$n,Hn,zn,Zn,qn;return{c(){Ce=element("div"),ke=element("div"),ke.textContent="Success",$n=space$3(),Hn=element("div"),zn=text(_n[1]),attr(ke,"class","title"),attr(Hn,"class","content"),attr(Ce,"class","notice notice-success"),attr(Ce,"role","alert")},m(Yn,Jn){insert$1(Yn,Ce,Jn),append(Ce,ke),append(Ce,$n),append(Ce,Hn),append(Hn,zn),qn=!0},p(Yn,Jn){(!qn||Jn&2)&&set_data(zn,Yn[1])},i(Yn){qn||(Yn&&add_render_callback(()=>{qn&&(Zn||(Zn=create_bidirectional_transition(Ce,fly,{duration:500},!0)),Zn.run(1))}),qn=!0)},o(Yn){Yn&&(Zn||(Zn=create_bidirectional_transition(Ce,fly,{duration:500},!1)),Zn.run(0)),qn=!1},d(Yn){Yn&&detach(Ce),Yn&&Zn&&Zn.end()}}}function create_fragment$1n(_n){let Ce,ke=_n[0]&&create_if_block$U(_n);return{c(){ke&&ke.c(),Ce=empty$1()},m($n,Hn){ke&&ke.m($n,Hn),insert$1($n,Ce,Hn)},p($n,[Hn]){$n[0]?ke?(ke.p($n,Hn),Hn&1&&transition_in(ke,1)):(ke=create_if_block$U($n),ke.c(),transition_in(ke,1),ke.m(Ce.parentNode,Ce)):ke&&(group_outros(),transition_out(ke,1,1,()=>{ke=null}),check_outros())},i($n){transition_in(ke)},o($n){transition_out(ke)},d($n){$n&&detach(Ce),ke&&ke.d($n)}}}function instance$1n(_n,Ce,ke){let $n,Hn;function zn(Zn="Saved"){ke(1,$n=Zn),ke(0,Hn=!0),setTimeout(function(){ke(0,Hn=!1)},2e3)}return ke(1,$n="Saved"),ke(0,Hn=!1),[Hn,$n,zn]}class SuccessAlert extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$1n,create_fragment$1n,safe_not_equal,{show:2})}get show(){return this.$$.ctx[2]}}function create_fragment$1m(_n){let Ce,ke,$n,Hn,zn,Zn,qn,Yn,Jn,to,io,uo,ho,bo,Oo={};return Ce=new SuccessAlert({props:Oo}),_n[4](Ce),io=new SpinnerButton({props:{label:"Enter"}}),{c(){create_component(Ce.$$.fragment),ke=space$3(),$n=element("div"),Hn=element("form"),zn=element("div"),Zn=element("h3"),qn=text("Login as "),Yn=text(_n[0]),Jn=space$3(),to=element("div"),create_component(io.$$.fragment),attr(zn,"class","mb-3 text-center"),attr(to,"class","text-center mt-5 d-block"),attr($n,"class","wrapper-tiny")},m(So,$o){mount_component(Ce,So,$o),insert$1(So,ke,$o),insert$1(So,$n,$o),append($n,Hn),append(Hn,zn),append(zn,Zn),append(Zn,qn),append(Zn,Yn),append(Hn,Jn),append(Hn,to),mount_component(io,to,null),uo=!0,ho||(bo=listen(Hn,"submit",_n[2]),ho=!0)},p(So,[$o]){const Do={};Ce.$set(Do),(!uo||$o&1)&&set_data(Yn,So[0])},i(So){uo||(transition_in(Ce.$$.fragment,So),transition_in(io.$$.fragment,So),uo=!0)},o(So){transition_out(Ce.$$.fragment,So),transition_out(io.$$.fragment,So),uo=!1},d(So){So&&(detach(ke),detach($n)),_n[4](null),destroy_component(Ce,So),destroy_component(io),ho=!1,bo()}}}function instance$1m(_n,Ce,ke){const $n=getContext$1("channel");let{email:Hn}=Ce,{token:zn}=Ce,Zn;function qn(Jn){Jn.preventDefault(),axios.post($n.lucentUrl+"/verify",{email:Hn,token:zn}).then(to=>{window.location=$n.lucentUrl}).catch(to=>{})}function Yn(Jn){binding_callbacks[Jn?"unshift":"push"](()=>{Zn=Jn,ke(1,Zn)})}return _n.$$set=Jn=>{"email"in Jn&&ke(0,Hn=Jn.email),"token"in Jn&&ke(3,zn=Jn.token)},[Hn,Zn,qn,zn,Yn]}class Verify extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$1m,create_fragment$1m,safe_not_equal,{email:0,token:3})}}function create_fragment$1l(_n){let Ce,ke,$n;return{c(){Ce=element("div"),ke=element("div"),$n=text(_n[2]),attr(ke,"class","avatar__letters"),attr(Ce,"class","avatar"),attr(Ce,"title",_n[0]),set_style(Ce,"background-color",_n[3][_n[4]]),set_style(Ce,"height",_n[1]+"px"),set_style(Ce,"width",_n[1]+"px"),set_style(Ce,"font-size",_n[1]/2+"px")},m(Hn,zn){insert$1(Hn,Ce,zn),append(Ce,ke),append(ke,$n)},p(Hn,[zn]){zn&4&&set_data($n,Hn[2]),zn&1&&attr(Ce,"title",Hn[0]),zn&2&&set_style(Ce,"height",Hn[1]+"px"),zn&2&&set_style(Ce,"width",Hn[1]+"px"),zn&2&&set_style(Ce,"font-size",Hn[1]/2+"px")},i:noop,o:noop,d(Hn){Hn&&detach(Ce)}}}function instance$1l(_n,Ce,ke){let{name:$n}=Ce,{side:Hn=48}=Ce;const zn=["#00AA55","#009FD4","#B381B3","#939393","#E3BC00","#D47500","#DC2A2A","#3ede91","#377dd4","#0256b0","#053d82","#3d026e","#b378e3","#c4065c","#543208","#d97811","#0c6b40"];let Zn="";$n.split(" ").length>1?Zn=$n.sp
device`),attr(Zn,"class","header-small mb-5"),attr(io,"type","text"),attr(io,"class","form-control mb-3"),attr(io,"placeholder","Name"),io.required=!0,attr(to,"class","input-group mb-5"),attr($o,"type","email"),attr($o,"class","form-control mb-3"),attr($o,"placeholder","Email"),$o.required=!0,attr(So,"class","input-group mb-5"),attr(Ko,"class","list-group-item list-group-item-action"),attr(Ko,"href",_n[5].lucentUrl+"/logout"),attr(Vo,"class","list-group"),attr(Ce,"class","wrapper-tiny")},m(Yo,Ys){insert$1(Yo,Ce,Ys),mount_component(ke,Ce,null),append(Ce,$n),mount_component(Hn,Ce,null),append(Ce,zn),append(Ce,Zn),mount_component(qn,Zn,null),append(Ce,Yn),append(Ce,Jn),append(Jn,to),append(to,io),set_input_value(io,_n[0]),append(to,uo),mount_component(ho,to,null),append(Ce,bo),append(Ce,Oo),append(Oo,So),append(So,$o),set_input_value($o,_n[1]),append(So,Do),mount_component(xo,So,null),append(Ce,Io),append(Ce,Vo),append(Vo,Ko),append(Ko,Mo),es=!0,ls||(ps=[listen(io,"input",_n[9]),listen(Jn,"submit",_n[6]),listen($o,"input",_n[10]),listen(Oo,"submit",_n[7])],ls=!0)},p(Yo,[Ys]){const sr={};Ys&4&&(sr.message=Yo[2]),ke.$set(sr);const Js={};Hn.$set(Js),Ys&1&&io.value!==Yo[0]&&set_input_value(io,Yo[0]),Ys&2&&$o.value!==Yo[1]&&set_input_value($o,Yo[1])},i(Yo){es||(transition_in(ke.$$.fragment,Yo),transition_in(Hn.$$.fragment,Yo),transition_in(qn.$$.fragment,Yo),transition_in(ho.$$.fragment,Yo),transition_in(xo.$$.fragment,Yo),es=!0)},o(Yo){transition_out(ke.$$.fragment,Yo),transition_out(Hn.$$.fragment,Yo),transition_out(qn.$$.fragment,Yo),transition_out(ho.$$.fragment,Yo),transition_out(xo.$$.fragment,Yo),es=!1},d(Yo){Yo&&detach(Ce),destroy_component(ke),_n[8](null),destroy_component(Hn),destroy_component(qn),destroy_component(ho),destroy_component(xo),ls=!1,run_all(ps)}}}function instance$1k(_n,Ce,ke){const $n=getContext$1("user"),Hn=getContext$1("channel");let zn=$n.name,Zn=$n.email,qn="",Yn;function Jn(bo){bo.preventDefault(),ke(2,qn=""),axios.post(Hn.lucentUrl+"/account/update-name",{name:zn}).then(Oo=>{Yn.show()}).catch(Oo=>{var So;ke(2,qn=(So=Oo.response)==null?void 0:So.data.error),console.log({errorMessage:qn})})}function to(bo){bo.preventDefault(),ke(2,qn=""),axios.post(Hn.lucentUrl+"/account/update-email",{email:Zn}).then(Oo=>{Yn.show()}).catch(Oo=>{var So;ke(2,qn=(So=Oo.response)==null?void 0:So.data.error),console.log({errorMessage:qn})})}function io(bo){binding_callbacks[bo?"unshift":"push"](()=>{Yn=bo,ke(3,Yn)})}function uo(){zn=this.value,ke(0,zn)}function ho(){Zn=this.value,ke(1,Zn)}return[zn,Zn,qn,Yn,$n,Hn,Jn,to,io,uo,ho]}class Profile extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$1k,create_fragment$1k,safe_not_equal,{})}}function create_fragment$1j(_n){let Ce,ke,$n,Hn=_n[3].name+"",zn,Zn,qn,Yn,Jn,to;const io=[{title:_n[0]},_n[2]];var uo=_n[4][_n[1]];function ho(bo,Oo){let So={};for(let $o=0;$o<io.length;$o+=1)So=assign(So,io[$o]);return Oo!==void 0&&Oo&5&&(So=assign(So,get_spread_update(io,[Oo&1&&{title:bo[0]},Oo&4&&get_spread_object(bo[2])]))),{props:So}}return uo&&(Jn=construct_svelte_component(uo,ho(_n))),{c(){Ce=element("div"),ke=element("h1"),$n=element("a"),zn=text(Hn),qn=space$3(),Yn=element("div"),Jn&&create_component(Jn.$$.fragment),attr($n,"class","text-decoration-none"),attr($n,"href",Zn=_n[3].lucentUrl),set_style(Ce,"text-align","center"),set_style(Ce,"background","var(--p20)"),set_style(Ce,"padding","20px"),set_style(Ce,"color","var(--p90)")},m(bo,Oo){insert$1(bo,Ce,Oo),append(Ce,ke),append(ke,$n),append($n,zn),insert$1(bo,qn,Oo),insert$1(bo,Yn,Oo),Jn&&mount_component(Jn,Yn,null),to=!0},p(bo,[Oo]){if((!to||Oo&8)&&Hn!==(Hn=bo[3].name+"")&&set_data(zn,Hn),(!to||Oo&8&&Zn!==(Zn=bo[3].lucentUrl))&&attr($n,"href",Zn),Oo&2&&uo!==(uo=bo[4][bo[1]])){if(Jn){group_outros();const So=Jn;transition_out(So.$$.fragment,1,0,()=>{destroy_component(So,1)}),check_outros()}uo?(Jn=construct_svelte_component(uo,ho(bo,Oo)),create_component(Jn.$$.fragment),transition_in(Jn.$$.fragment,1),mount_component(Jn,Yn,null)):Jn=null}else if(uo){const So=Oo&5?get_spread_update(io,[Oo&1&&{title:bo[0
2024-08-27 12:25:42 +03:00
* @license
* Lodash <https://lodash.com/>
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
2024-08-30 13:38:34 +03:00
*/lodash.exports;(function(_n,Ce){(function(){var ke,$n="4.17.21",Hn=200,zn="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",Zn="Expected a function",qn="Invalid `variable` option passed into `_.template`",Yn="__lodash_hash_undefined__",Jn=500,to="__lodash_placeholder__",io=1,uo=2,ho=4,bo=1,Oo=2,So=1,$o=2,Do=4,xo=8,Io=16,Vo=32,Ko=64,Mo=128,es=256,ls=512,ps=30,rs="...",Yo=800,Ys=16,sr=1,Js=2,ko=3,gs=1/0,xs=9007199254740991,Qr=17976931348623157e292,cr=NaN,ws=4294967295,Fs=ws-1,Br=ws>>>1,_r=[["ary",Mo],["bind",So],["bindKey",$o],["curry",xo],["curryRight",Io],["flip",ls],["partial",Vo],["partialRight",Ko],["rearg",es]],ha="[object Arguments]",hs="[object Array]",Qs="[object AsyncFunction]",zo="[object Boolean]",el="[object Date]",ga="[object DOMException]",Ca="[object Error]",za="[object Function]",Il="[object GeneratorFunction]",Zs="[object Map]",Sr="[object Number]",Us="[object Null]",fs="[object Object]",dr="[object Promise]",Vr="[object Proxy]",nr="[object RegExp]",Kr="[object Set]",ra="[object String]",Ml="[object Symbol]",xa="[object Undefined]",Nl="[object WeakMap]",Zc="[object WeakSet]",cc="[object ArrayBuffer]",gc="[object DataView]",nc="[object Float32Array]",Ed="[object Float64Array]",Zl="[object Int8Array]",Vl="[object Int16Array]",Fc="[object Int32Array]",qa="[object Uint8Array]",Ya="[object Uint8ClampedArray]",kc="[object Uint16Array]",Yl="[object Uint32Array]",rd=/\b__p \+= '';/g,Al=/\b(__p \+=) '' \+/g,gd=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Rr=/&(?:amp|lt|gt|quot|#39);/g,Pl=/[&<>"']/g,Su=RegExp(Rr.source),vs=RegExp(Pl.source),Es=/<%-([\s\S]+?)%>/g,Ks=/<%([\s\S]+?)%>/g,pr=/<%=([\s\S]+?)%>/g,ia=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ka=/^\w*$/,Ma=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Mr=/[\\^$.*+?()[\]{}|]/g,il=RegExp(Mr.source),Na=/^\s+/,vl=/\s/,Rc=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Vc=/\{\n\/\* \[wrapped with (.+)\] \*/,xc=/,? & /,zc=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ad=/[()=,{}\[\]\/\s]/,Bh=/\\(\\)?/g,Vu=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ts=/\w*$/,ks=/^[-+]0x[0-9a-f]+$/i,ir=/^0b[01]+$/i,br=/^\[object .+?Constructor\]$/,Aa=/^0o[0-7]+$/i,Ba=/^(?:0|[1-9]\d*)$/,_l=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Hc=/($^)/,Ds=/['\n\r\u2028\u2029\\]/g,tl="\\ud800-\\udfff",wu="\\u0300-\\u036f",qu="\\ufe20-\\ufe2f",Md="\\u20d0-\\u20ff",bc=wu+qu+Md,nm="\\u2700-\\u27bf",Ff="a-z\\xdf-\\xf6\\xf8-\\xff",Ud="\\xac\\xb1\\xd7\\xf7",ld="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",oc="\\u2000-\\u206f",Dc=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",bd="A-Z\\xc0-\\xd6\\xd8-\\xde",Nd="\\ufe0e\\ufe0f",ih=Ud+ld+oc+Dc,om="[']",sm="["+tl+"]",fc="["+ih+"]",Td="["+bc+"]",Jd="\\d+",Em="["+nm+"]",ef="["+Ff+"]",Cu="[^"+tl+ih+Jd+nm+Ff+bd+"]",Qc="\\ud83c[\\udffb-\\udfff]",Cf="(?:"+Td+"|"+Qc+")",qm="[^"+tl+"]",Oc="(?:\\ud83c[\\udde6-\\uddff]){2}",cd="[\\ud800-\\udbff][\\udc00-\\udfff]",vd="["+bd+"]",ju="\\u200d",Xf="(?:"+ef+"|"+Cu+")",Sh="(?:"+vd+"|"+Cu+")",Zd="(?:"+om+"(?:d|ll|m|re|s|t|ve))?",ah="(?:"+om+"(?:D|LL|M|RE|S|T|VE))?",lh=Cf+"?",Bp="["+Nd+"]?",ch="(?:"+ju+"(?:"+[qm,Oc,cd].join("|")+")"+Bp+lh+")*",bp="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",kf="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Fh=Bp+lh+ch,jm="(?:"+[Em,Oc,cd].join("|")+")"+Fh,Fp="(?:"+[qm+Td+"?",Td,Oc,cd,sm].join("|")+")",Eg=RegExp(om,"g"),ss=RegExp(Td,"g"),As=RegExp(Qc+"(?="+Qc+")|"+Fp+Fh,"g"),Ws=RegExp([vd+"?"+ef+"+"+Zd+"(?="+[fc,vd,"$"].join("|")+")",Sh+"+"+ah+"(?="+[fc,vd+Xf,"$"].join("|")+")",vd+"?"+Xf+"+"+Zd,vd+"+"+ah,kf,bp,Jd,jm].join("|"),"g"),rr=RegExp("["+ju+tl+bc+Nd+"]"),Fr=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Wa=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTim
2024-08-27 12:25:42 +03:00
/* [wrapped with `+co+`] */
2024-08-30 13:38:34 +03:00
`)}function gS(so){return $l(so)||bf(so)||!!(Ag&&so&&so[Ag])}function K1(so,co){var wo=typeof so;return co=co??xs,!!co&&(wo=="number"||wo!="symbol"&&Ba.test(so))&&so>-1&&so%1==0&&so<co}function gm(so,co,wo){if(!Vd(wo))return!1;var Ho=typeof co;return(Ho=="number"?bu(wo)&&K1(co,wo.length):Ho=="string"&&co in wo)?Dd(wo[co],so):!1}function J1(so,co){if($l(so))return!1;var wo=typeof so;return wo=="number"||wo=="symbol"||wo=="boolean"||so==null||Cd(so)?!0:ka.test(so)||!ia.test(so)||co!=null&&so in Uc(co)}function Dv(so){var co=typeof so;return co=="string"||co=="number"||co=="symbol"||co=="boolean"?so!=="__proto__":so===null}function $0(so){var co=$v(so),wo=os[co];if(typeof wo!="function"||!(co in Xc.prototype))return!1;if(so===wo)return!0;var Ho=ig(wo);return!!Ho&&so===Ho[0]}function Mv(so){return!!Af&&Af in so}var HO=Ku?f1:W0;function Ep(so){var co=so&&so.constructor,wo=typeof co=="function"&&co.prototype||Id;return so===wo}function ag(so){return so===so&&!Vd(so)}function Nv(so,co){return function(wo){return wo==null?!1:wo[so]===co&&(co!==ke||so in Uc(wo))}}function Tp(so){var co=Pp(so,function(Ho){return wo.size===Jn&&wo.clear(),Ho}),wo=co.cache;return co}function QO(so,co){var wo=so[1],Ho=co[1],ts=wo|Ho,Os=ts<(So|$o|Mo),Is=Ho==Mo&&wo==xo||Ho==Mo&&wo==es&&so[7].length<=co[8]||Ho==(Mo|es)&&co[7].length<=co[8]&&wo==xo;if(!(Os||Is))return so;Ho&So&&(so[2]=co[2],ts|=wo&So?0:Do);var qs=co[3];if(qs){var mr=so[3];so[3]=mr?Hy(mr,qs,co[4]):qs,so[4]=mr?Vf(so[3],to):co[4]}return qs=co[5],qs&&(mr=so[5],so[5]=mr?Z1(mr,qs,co[6]):qs,so[6]=mr?Vf(so[5],to):co[6]),qs=co[7],qs&&(so[7]=qs),Ho&Mo&&(so[8]=so[8]==null?co[8]:df(so[8],co[8])),so[9]==null&&(so[9]=co[9]),so[0]=co[0],so[1]=ts,so}function dC(so){var co=[];if(so!=null)for(var wo in Uc(so))co.push(wo);return co}function Lv(so){return e1.call(so)}function i1(so,co,wo){return co=Sd(co===ke?so.length-1:co,0),function(){for(var Ho=arguments,ts=-1,Os=Sd(Ho.length-co,0),Is=Tr(Os);++ts<Os;)Is[ts]=Ho[co+ts];ts=-1;for(var qs=Tr(co+1);++ts<co;)qs[ts]=Ho[ts];return qs[co]=wo(Is),jc(so,this,qs)}}function fC(so,co){return co.length<2?so:Pf(so,Fl(co,0,-1))}function Iv(so,co){for(var wo=so.length,Ho=df(co.length,wo),ts=Ah(so);Ho--;){var Os=co[Ho];so[Ho]=K1(Os,wo)?ts[Os]:ke}return so}function eb(so,co){if(!(co==="constructor"&&typeof so[co]=="function")&&co!="__proto__")return so[co]}var Ap=yS(mm),ph=tf||function(so,co){return Uo.setTimeout(so,co)},bS=yS(Nb);function vS(so,co,wo){var Ho=co+"";return bS(so,P2(Ho,VO(ET(Ho),wo)))}function yS(so){var co=0,wo=0;return function(){var Ho=vv(),ts=Ys-(Ho-wo);if(wo=Ho,ts>0){if(++co>=Yo)return arguments[0]}else co=0;return so.apply(ke,arguments)}}function Bv(so,co){var wo=-1,Ho=so.length,ts=Ho-1;for(co=co===ke?Ho:co;++wo<co;){var Os=Jp(wo,ts),Is=so[Os];so[Os]=so[wo],so[wo]=Is}return so.length=co,so}var bm=Tp(function(so){var co=[];return so.charCodeAt(0)===46&&co.push(""),so.replace(Ma,function(wo,Ho,ts,Os){co.push(ts?Os.replace(Bh,"$1"):Ho||wo)}),co});function Bm(so){if(typeof so=="string"||Cd(so))return so;var co=so+"";return co=="0"&&1/so==-gs?"-0":co}function a1(so){if(so!=null){try{return Rm.call(so)}catch{}try{return so+""}catch{}}return""}function VO(so,co){return El(_r,function(wo){var Ho="_."+wo[0];co&wo[1]&&!cu(so,Ho)&&so.push(Ho)}),so.sort()}function hC(so){if(so instanceof Xc)return so.clone();var co=new Ch(so.__wrapped__,so.__chain__);return co.__actions__=Ah(so.__actions__),co.__index__=so.__index__,co.__values__=so.__values__,co}function mC(so,co,wo){(wo?gm(so,co,wo):co===ke)?co=1:co=Sd(Ic(co),0);var Ho=so==null?0:so.length;if(!Ho||co<1)return[];for(var ts=0,Os=0,Is=Tr(lm(Ho/co));ts<Ho;)Is[Os++]=Fl(so,ts,ts+=co);return Is}function OS(so){for(var co=-1,wo=so==null?0:so.length,Ho=0,ts=[];++co<wo;){var Os=so[co];Os&&(ts[Ho++]=Os)}return ts}function Fv(){var so=arguments.length;if(!so)return[];for(var co=Tr(so-1),wo=arguments[0],Ho=so;Ho--;)co[Ho-1]=arguments[Ho];return vp($l(wo)?Ah(wo):[wo],hd(co,1))}var Hv=Sc(function(so,co){return vf(so)?Bd(so,hd(co,1,vf,!0)):[]}),zO=Sc(function(so,co){var wo=lg(co);return vf(wo)&&(wo=ke),vf(so)?Bd(so,hd(co,1,vf,!0
2024-08-27 12:25:42 +03:00
`;so.replace(ja,function(Ul,nu,vu,nh,Mh,Rp){return vu||(vu=nh),ua+=so.slice(Xr,Rp).replace(Ds,Yf),nu&&(qs=!0,ua+=`' +
__e(`+nu+`) +
'`),Mh&&(mr=!0,ua+=`';
`+Mh+`;
__p += '`),vu&&(ua+=`' +
((__t = (`+vu+`)) == null ? '' : __t) +
'`),Xr=Rp+Ul.length,Ul}),ua+=`';
`;var Kl=iu.call(co,"variable")&&co.variable;if(!Kl)ua=`with (obj) {
`+ua+`
}
`;else if(ad.test(Kl))throw new zl(qn);ua=(mr?ua.replace(rd,""):ua).replace(Al,"$1").replace(gd,"$1;"),ua="function("+(Kl||"obj")+`) {
`+(Kl?"":`obj || (obj = {});
`)+"var __t, __p = ''"+(qs?", __e = _.escape":"")+(mr?`, __j = Array.prototype.join;
function print() { __p += __j.call(arguments, '') }
`:`;
`)+ua+`return __p
2024-08-30 13:38:34 +03:00
}`;var Pc=zC(function(){return _c(Os,wl+"return "+ua).apply(ke,Is)});if(Pc.source=ua,NS(Pc))throw Pc;return Pc}function lx(so){return Zu(so).toLowerCase()}function f_(so){return Zu(so).toUpperCase()}function cx(so,co,wo){if(so=Zu(so),so&&(wo||co===ke))return Tf(so);if(!so||!(co=Wu(co)))return so;var Ho=zf(so),ts=zf(co),Os=Vh(Ho,ts),Is=zp(Ho,ts)+1;return Cp(Ho,Os,Is).join("")}function VC(so,co,wo){if(so=Zu(so),so&&(wo||co===ke))return so.slice(0,b0(so)+1);if(!so||!(co=Wu(co)))return so;var Ho=zf(so),ts=zp(Ho,zf(co))+1;return Cp(Ho,0,ts).join("")}function sy(so,co,wo){if(so=Zu(so),so&&(wo||co===ke))return so.replace(Na,"");if(!so||!(co=Wu(co)))return so;var Ho=zf(so),ts=Vh(Ho,zf(co));return Cp(Ho,ts).join("")}function jS(so,co){var wo=ps,Ho=rs;if(Vd(co)){var ts="separator"in co?co.separator:ts;wo="length"in co?Ic(co.length):wo,Ho="omission"in co?Wu(co.omission):Ho}so=Zu(so);var Os=so.length;if(jd(so)){var Is=zf(so);Os=Is.length}if(wo>=Os)return so;var qs=wo-Wp(Ho);if(qs<1)return Ho;var mr=Is?Cp(Is,0,qs).join(""):so.slice(0,qs);if(ts===ke)return mr+Ho;if(Is&&(qs+=mr.length-qs),Jy(ts)){if(so.slice(qs).search(ts)){var Xr,jr=mr;for(ts.global||(ts=D1(ts.source,Zu(Ts.exec(ts))+"g")),ts.lastIndex=0;Xr=ts.exec(jr);)var ua=Xr.index;mr=mr.slice(0,ua===ke?qs:ua)}}else if(so.indexOf(Wu(ts),qs)!=qs){var ja=mr.lastIndexOf(ts);ja>-1&&(mr=mr.slice(0,ja))}return mr+Ho}function XS(so){return so=Zu(so),so&&Su.test(so)?so.replace(Rr,Cs):so}var YS=j1(function(so,co,wo){return so+(wo?" ":"")+co.toUpperCase()}),h_=kv("toUpperCase");function m_(so,co,wo){return so=Zu(so),co=wo?ke:co,co===ke?$m(so)?Kg(so):A1(so):so.match(co)||[]}var zC=Sc(function(so,co){try{return jc(so,ke,co)}catch(wo){return NS(wo)?wo:new zl(wo)}}),p_=Y1(function(so,co){return El(co,function(wo){wo=Bm(wo),Nm(so,wo,Yd(so[wo],so))}),so});function g_(so){var co=so==null?0:so.length,wo=Ll();return so=co?ud(so,function(Ho){if(typeof Ho[1]!="function")throw new _d(Zn);return[wo(Ho[0]),Ho[1]]}):[],Sc(function(Ho){for(var ts=-1;++ts<co;){var Os=so[ts];if(jc(Os[0],this,Ho))return jc(Os[1],this,Ho)}})}function ux(so){return Gf(td(so,io))}function rO(so){return function(){return so}}function WC(so,co){return so==null||so!==so?co:so}var dx=Tv(),GS=Tv(!0);function lp(so){return so}function jb(so){return _o(typeof so=="function"?so:td(so,io))}function fx(so){return vr(td(so,io))}function KS(so,co){return zr(so,td(co,io))}var hx=Sc(function(so,co){return function(wo){return np(wo,so,co)}}),mx=Sc(function(so,co){return function(wo){return np(so,wo,co)}});function JS(so,co,wo){var Ho=th(co),ts=Mb(co,Ho);wo==null&&!(Vd(co)&&(ts.length||!Ho.length))&&(wo=co,co=so,so=this,ts=Mb(co,th(co)));var Os=!(Vd(wo)&&"chain"in wo)||!!wo.chain,Is=f1(so);return El(ts,function(qs){var mr=co[qs];so[qs]=mr,Is&&(so.prototype[qs]=function(){var Xr=this.__chain__;if(Os||Xr){var jr=so(this.__wrapped__),ua=jr.__actions__=Ah(this.__actions__);return ua.push({func:mr,args:arguments,thisArg:so}),jr.__chain__=Xr,jr}return mr.apply(so,vp([this.value()],arguments))})}),so}function UC(){return Uo._===this&&(Uo._=M1),this}function ew(){}function Zf(so){return so=Ic(so),Sc(function(co){return Ol(co,so)})}var DT=Av(ud),ry=Av(hu),b_=Av(Pm);function tw(so){return J1(so)?qd(Bm(so)):Uh(so)}function nw(so){return function(co){return so==null?ke:Pf(so,co)}}var ZC=LO(),qC=LO(!0);function cb(){return[]}function W0(){return!1}function px(){return{}}function gx(){return""}function iO(){return!0}function ow(so,co){if(so=Ic(so),so<1||so>xs)return[];var wo=ws,Ho=df(so,ws);co=Ll(co),so-=ws;for(var ts=Gc(Ho,co);++wo<so;)co(wo);return ts}function jC(so){return $l(so)?ud(so,Bm):Cd(so)?[so]:Ah(bm(Zu(so)))}function _f(so){var co=++am;return Zu(so)+co}var XC=og(function(so,co){return so+co},0),sw=Qy("ceil"),MT=og(function(so,co){return so/co},1),iy=Qy("floor");function bx(so){return so&&so.length?Kf(so,lp,Mg):ke}function YC(so,co){return so&&so.length?Kf(so,Ll(co,2),Mg):ke}function rw(so){return lf(so,lp)}function aO(so,co){return lf(so,Ll(co,2))}function v_(so){return so&&so.length?Kf(so,lp,is):ke}function ay(so,co){return so&&so.length?Kf(so,Ll
2024-08-27 12:25:42 +03:00
* mustache.js - Logic-less {{mustache}} templates with JavaScript
* http://github.com/janl/mustache.js
2024-08-30 13:38:34 +03:00
*/var objectToString=Object.prototype.toString,isArray=Array.isArray||function(Ce){return objectToString.call(Ce)==="[object Array]"};function isFunction(_n){return typeof _n=="function"}function typeStr(_n){return isArray(_n)?"array":typeof _n}function escapeRegExp(_n){return _n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function hasProperty(_n,Ce){return _n!=null&&typeof _n=="object"&&Ce in _n}function primitiveHasOwnProperty(_n,Ce){return _n!=null&&typeof _n!="object"&&_n.hasOwnProperty&&_n.hasOwnProperty(Ce)}var regExpTest=RegExp.prototype.test;function testRegExp(_n,Ce){return regExpTest.call(_n,Ce)}var nonSpaceRe=/\S/;function isWhitespace(_n){return!testRegExp(nonSpaceRe,_n)}var entityMap={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function escapeHtml(_n){return String(_n).replace(/[&<>"'`=\/]/g,function(ke){return entityMap[ke]})}var whiteRe=/\s*/,spaceRe=/\s+/,equalsRe=/\s*=/,curlyRe=/\s*\}/,tagRe=/#|\^|\/|>|\{|&|=|!/;function parseTemplate(_n,Ce){if(!_n)return[];var ke=!1,$n=[],Hn=[],zn=[],Zn=!1,qn=!1,Yn="",Jn=0;function to(){if(Zn&&!qn)for(;zn.length;)delete Hn[zn.pop()];else zn=[];Zn=!1,qn=!1}var io,uo,ho;function bo(es){if(typeof es=="string"&&(es=es.split(spaceRe,2)),!isArray(es)||es.length!==2)throw new Error("Invalid tags: "+es);io=new RegExp(escapeRegExp(es[0])+"\\s*"),uo=new RegExp("\\s*"+escapeRegExp(es[1])),ho=new RegExp("\\s*"+escapeRegExp("}"+es[1]))}bo(Ce||mustache.tags);for(var Oo=new Scanner(_n),So,$o,Do,xo,Io,Vo;!Oo.eos();){if(So=Oo.pos,Do=Oo.scanUntil(io),Do)for(var Ko=0,Mo=Do.length;Ko<Mo;++Ko)xo=Do.charAt(Ko),isWhitespace(xo)?(zn.push(Hn.length),Yn+=xo):(qn=!0,ke=!0,Yn+=" "),Hn.push(["text",xo,So,So+1]),So+=1,xo===`
`&&(to(),Yn="",Jn=0,ke=!1);if(!Oo.scan(io))break;if(Zn=!0,$o=Oo.scan(tagRe)||"name",Oo.scan(whiteRe),$o==="="?(Do=Oo.scanUntil(equalsRe),Oo.scan(equalsRe),Oo.scanUntil(uo)):$o==="{"?(Do=Oo.scanUntil(ho),Oo.scan(curlyRe),Oo.scanUntil(uo),$o="&"):Do=Oo.scanUntil(uo),!Oo.scan(uo))throw new Error("Unclosed tag at "+Oo.pos);if($o==">"?Io=[$o,Do,So,Oo.pos,Yn,Jn,ke]:Io=[$o,Do,So,Oo.pos],Jn++,Hn.push(Io),$o==="#"||$o==="^")$n.push(Io);else if($o==="/"){if(Vo=$n.pop(),!Vo)throw new Error('Unopened section "'+Do+'" at '+So);if(Vo[1]!==Do)throw new Error('Unclosed section "'+Vo[1]+'" at '+So)}else $o==="name"||$o==="{"||$o==="&"?qn=!0:$o==="="&&bo(Do)}if(to(),Vo=$n.pop(),Vo)throw new Error('Unclosed section "'+Vo[1]+'" at '+Oo.pos);return nestTokens(squashTokens(Hn))}function squashTokens(_n){for(var Ce=[],ke,$n,Hn=0,zn=_n.length;Hn<zn;++Hn)ke=_n[Hn],ke&&(ke[0]==="text"&&$n&&$n[0]==="text"?($n[1]+=ke[1],$n[3]=ke[3]):(Ce.push(ke),$n=ke));return Ce}function nestTokens(_n){for(var Ce=[],ke=Ce,$n=[],Hn,zn,Zn=0,qn=_n.length;Zn<qn;++Zn)switch(Hn=_n[Zn],Hn[0]){case"#":case"^":ke.push(Hn),$n.push(Hn),ke=Hn[4]=[];break;case"/":zn=$n.pop(),zn[5]=Hn[2],ke=$n.length>0?$n[$n.length-1][4]:Ce;break;default:ke.push(Hn)}return Ce}function Scanner(_n){this.string=_n,this.tail=_n,this.pos=0}Scanner.prototype.eos=function(){return this.tail===""};Scanner.prototype.scan=function(Ce){var ke=this.tail.match(Ce);if(!ke||ke.index!==0)return"";var $n=ke[0];return this.tail=this.tail.substring($n.length),this.pos+=$n.length,$n};Scanner.prototype.scanUntil=function(Ce){var ke=this.tail.search(Ce),$n;switch(ke){case-1:$n=this.tail,this.tail="";break;case 0:$n="";break;default:$n=this.tail.substring(0,ke),this.tail=this.tail.substring(ke)}return this.pos+=$n.length,$n};function Context$1(_n,Ce){this.view=_n,this.cache={".":this.view},this.parent=Ce}Context$1.prototype.push=function(Ce){return new Context$1(Ce,this)};Context$1.prototype.lookup=function(Ce){var ke=this.cache,$n;if(ke.hasOwnProperty(Ce))$n=ke[Ce];else{for(var Hn=this,zn,Zn,qn,Yn=!1;Hn;){if(Ce.indexOf(".")>0)for(zn=Hn.view,Zn=Ce.split("."),qn=0;zn!=null&&qn<Zn.length;)qn===Zn.length-1&&(Yn=hasProperty(zn,Zn[qn])||primitiveHasOwnProperty(zn,Zn[qn])),zn=zn[Zn[qn++]];else zn=Hn.view[Ce],Yn=hasProperty(Hn.view,Ce);if(Yn){$n=zn;break}Hn=Hn.parent}ke[Ce]=$n}return isFunction($n)&&($n=$n.call(this.view)),$n};function Writer(){this.templateCache={_cache:{},set:function(Ce,ke){this._cache[Ce]=ke},get:function(Ce){return this._cache[Ce]},clear:function(){this._cache={}}}}Writer.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Writer.prototype.parse=function(Ce,ke){var $n=this.templateCache,Hn=Ce+":"+(ke||mustache.tags).join(":"),zn=typeof $n<"u",Zn=zn?$n.get(Hn):void 0;return Zn==null&&(Zn=parseTemplate(Ce,ke),zn&&$n.set(Hn,Zn)),Zn};Writer.prototype.render=function(Ce,ke,$n,Hn){var zn=this.getConfigTags(Hn),Zn=this.parse(Ce,zn),qn=ke instanceof Context$1?ke:new Context$1(ke,void 0);return this.renderTokens(Zn,qn,$n,Ce,Hn)};Writer.prototype.renderTokens=function(Ce,ke,$n,Hn,zn){for(var Zn="",qn,Yn,Jn,to=0,io=Ce.length;to<io;++to)Jn=void 0,qn=Ce[to],Yn=qn[0],Yn==="#"?Jn=this.renderSection(qn,ke,$n,Hn,zn):Yn==="^"?Jn=this.renderInverted(qn,ke,$n,Hn,zn):Yn===">"?Jn=this.renderPartial(qn,ke,$n,zn):Yn==="&"?Jn=this.unescapedValue(qn,ke):Yn==="name"?Jn=this.escapedValue(qn,ke,zn):Yn==="text"&&(Jn=this.rawValue(qn)),Jn!==void 0&&(Zn+=Jn);return Zn};Writer.prototype.renderSection=function(Ce,ke,$n,Hn,zn){var Zn=this,qn="",Yn=ke.lookup(Ce[1]);function Jn(uo){return Zn.render(uo,ke,$n,zn)}if(Yn){if(isArray(Yn))for(var to=0,io=Yn.length;to<io;++to)qn+=this.renderTokens(Ce[4],ke.push(Yn[to]),$n,Hn,zn);else if(typeof Yn=="object"||typeof Yn=="string"||typeof Yn=="number")qn+=this.renderTokens(Ce[4],ke.push(Yn),$n,Hn,zn);else if(isFunction(Yn)){if(typeof Hn!="string")throw new Error("Cannot use higher-order sections without the original template");Yn=Yn.call(ke.view,Hn.slice(Ce[3],Ce[5]),Jn),Yn!=null&&(qn+=Yn)}else qn+=this.renderTokens(Ce[4],ke,$n,Hn,zn);return qn}};Writer.protot
2024-08-27 12:25:42 +03:00
`),Zn=0;Zn<zn.length;Zn++)zn[Zn].length&&(Zn>0||!$n)&&(zn[Zn]=Hn+zn[Zn]);return zn.join(`
`)};Writer.prototype.renderPartial=function(Ce,ke,$n,Hn){if($n){var zn=this.getConfigTags(Hn),Zn=isFunction($n)?$n(Ce[1]):$n[Ce[1]];if(Zn!=null){var qn=Ce[6],Yn=Ce[5],Jn=Ce[4],to=Zn;Yn==0&&Jn&&(to=this.indentPartial(Zn,Jn,qn));var io=this.parse(to,zn);return this.renderTokens(io,ke,$n,to,Hn)}}};Writer.prototype.unescapedValue=function(Ce,ke){var $n=ke.lookup(Ce[1]);if($n!=null)return $n};Writer.prototype.escapedValue=function(Ce,ke,$n){var Hn=this.getConfigEscape($n)||mustache.escape,zn=ke.lookup(Ce[1]);if(zn!=null)return typeof zn=="number"&&Hn===mustache.escape?String(zn):Hn(zn)};Writer.prototype.rawValue=function(Ce){return Ce[1]};Writer.prototype.getConfigTags=function(Ce){return isArray(Ce)?Ce:Ce&&typeof Ce=="object"?Ce.tags:void 0};Writer.prototype.getConfigEscape=function(Ce){if(Ce&&typeof Ce=="object"&&!isArray(Ce))return Ce.escape};var mustache={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(_n){defaultWriter.templateCache=_n},get templateCache(){return defaultWriter.templateCache}},defaultWriter=new Writer;mustache.clearCache=function(){return defaultWriter.clearCache()};mustache.parse=function(Ce,ke){return defaultWriter.parse(Ce,ke)};mustache.render=function(Ce,ke,$n,Hn){if(typeof Ce!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+typeStr(Ce)+'" was given as the first argument for mustache#render(template, view, partials)');return defaultWriter.render(Ce,ke,$n,Hn)};mustache.escape=escapeHtml;mustache.Scanner=Scanner;mustache.Context=Context$1;mustache.Writer=Writer;function previewTitle(_n,Ce,ke){let $n=_n.find(Zn=>Zn.name===(Ce==null?void 0:Ce.schema));if(!($n!=null&&$n.cardTitle))return noTemplate($n,Ce);let Hn=Ce.data,zn=mustache.render($n.cardTitle,Hn);return!zn||zn===""?noTemplate($n,Ce):stripHtml(zn.slice(0,300))}function noTemplate(_n,Ce){var $n;if((_n==null?void 0:_n.type)==="files")return Ce._file.path;let ke=stripHtml(Ce==null?void 0:Ce.data[($n=_n.fields.filter(Hn=>Hn.info.name==="text")[0])==null?void 0:$n.name]).slice(0,300);return ke.trim()===""?"~Untitled~":ke}function create_else_block$j(_n){let Ce;return{c(){Ce=text("New Record")},m(ke,$n){insert$1(ke,Ce,$n)},p:noop,d(ke){ke&&detach(Ce)}}}function create_if_block$J(_n){let Ce=previewTitle(_n[3].schemas,_n[1])+"",ke;return{c(){ke=text(Ce)},m($n,Hn){insert$1($n,ke,Hn)},p($n,Hn){Hn&2&&Ce!==(Ce=previewTitle($n[3].schemas,$n[1])+"")&&set_data(ke,Ce)},d($n){$n&&detach(ke)}}}function create_fragment$13(_n){let Ce,ke,$n=_n[0].label.toUpperCase()+"",Hn,zn,Zn,qn;function Yn(io,uo){return io[2]?create_else_block$j:create_if_block$J}let Jn=Yn(_n),to=Jn(_n);return{c(){Ce=element("div"),ke=element("a"),Hn=text($n),Zn=space$3(),qn=element("span"),to.c(),attr(ke,"class","schema-name"),attr(ke,"href",zn=_n[3].lucentUrl+"/content/"+_n[0].name),attr(qn,"class","record-title"),attr(Ce,"class","record-header")},m(io,uo){insert$1(io,Ce,uo),append(Ce,ke),append(ke,Hn),append(Ce,Zn),append(Ce,qn),to.m(qn,null)},p(io,[uo]){uo&1&&$n!==($n=io[0].label.toUpperCase()+"")&&set_data(Hn,$n),uo&1&&zn!==(zn=io[3].lucentUrl+"/content/"+io[0].name)&&attr(ke,"href",zn),Jn===(Jn=Yn(io))&&to?to.p(io,uo):(to.d(1),to=Jn(io),to&&(to.c(),to.m(qn,null)))},i:noop,o:noop,d(io){io&&detach(Ce),to.d()}}}function instance$13(_n,Ce,ke){const $n=getContext$1("channel");let{schema:Hn}=Ce,{record:zn}=Ce,{isCreateMode:Zn}=Ce;return _n.$$set=qn=>{"schema"in qn&&ke(0,Hn=qn.schema),"record"in qn&&ke(1,zn=qn.record),"isCreateMode"in qn&&ke(2,Zn=qn.isCreateMode)},[Hn,zn,Zn,$n]}class Title extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$13,create_fragment$13,safe_not_equal,{schema:0,record:1,isCreateMode:2})}}function get_each_context$m(_n,Ce,ke){const $n=_n.slice();return $n[24]=Ce[ke],$n}function create_if_block_2$b(_n){let Ce,ke,$n;return{c(){Ce=element("button"),Ce.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
Save`,attr(Ce,"type","button"),attr(Ce,"class","button primary ms-2 btn btn-primary btn-spinner")},m(Hn,zn){insert$1(Hn,Ce,zn),ke||($n=listen(Ce,"click",_n[10]),ke=!0)},p:noop,d(Hn){Hn&&detach(Ce),ke=!1,$n()}}}function create_if_block_1$n(_n){let Ce,ke,$n;return{c(){Ce=element("button"),Ce.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
2024-08-30 13:38:34 +03:00
Create`,attr(Ce,"class","button primary btn-spinner")},m(Hn,zn){insert$1(Hn,Ce,zn),ke||($n=listen(Ce,"click",_n[10]),ke=!0)},p:noop,d(Hn){Hn&&detach(Ce),ke=!1,$n()}}}function create_if_block$I(_n){let Ce,ke,$n,Hn;function zn(Yn){_n[14](Yn)}function Zn(Yn){_n[15](Yn)}let qn={field:_n[24],schema:_n[2],record:_n[0],validationErrors:_n[4],isCreateMode:_n[3]};return _n[0].data!==void 0&&(qn.data=_n[0].data),_n[1]!==void 0&&(qn.graph=_n[1]),Ce=new FormField({props:qn}),binding_callbacks.push(()=>bind(Ce,"data",zn)),binding_callbacks.push(()=>bind(Ce,"graph",Zn)),{c(){create_component(Ce.$$.fragment)},m(Yn,Jn){mount_component(Ce,Yn,Jn),Hn=!0},p(Yn,Jn){const to={};Jn&4&&(to.schema=Yn[2]),Jn&1&&(to.record=Yn[0]),Jn&16&&(to.validationErrors=Yn[4]),Jn&8&&(to.isCreateMode=Yn[3]),!ke&&Jn&1&&(ke=!0,to.data=Yn[0].data,add_flush_callback(()=>ke=!1)),!$n&&Jn&2&&($n=!0,to.graph=Yn[1],add_flush_callback(()=>$n=!1)),Ce.$set(to)},i(Yn){Hn||(transition_in(Ce.$$.fragment,Yn),Hn=!0)},o(Yn){transition_out(Ce.$$.fragment,Yn),Hn=!1},d(Yn){destroy_component(Ce,Yn)}}}function create_each_block$m(_n,Ce){let ke,$n,Hn,zn=Ce[5]===Ce[24].group&&create_if_block$I(Ce);return{key:_n,first:null,c(){ke=empty$1(),zn&&zn.c(),$n=empty$1(),this.first=ke},m(Zn,qn){insert$1(Zn,ke,qn),zn&&zn.m(Zn,qn),insert$1(Zn,$n,qn),Hn=!0},p(Zn,qn){Ce=Zn,Ce[5]===Ce[24].group?zn?(zn.p(Ce,qn),qn&32&&transition_in(zn,1)):(zn=create_if_block$I(Ce),zn.c(),transition_in(zn,1),zn.m($n.parentNode,$n)):zn&&(group_outros(),transition_out(zn,1,1,()=>{zn=null}),check_outros())},i(Zn){Hn||(transition_in(zn),Hn=!0)},o(Zn){transition_out(zn),Hn=!1},d(Zn){Zn&&(detach(ke),detach($n)),zn&&zn.d(Zn)}}}function create_fragment$12(_n){let Ce,ke,$n,Hn,zn,Zn,qn,Yn,Jn,to,io,uo,ho,bo,Oo,So,$o,Do=[],xo=new Map,Io,Vo,Ko;function Mo(gs){_n[11](gs)}function es(gs){_n[12](gs)}let ls={schema:_n[2],isCreateMode:_n[3]};_n[0]!==void 0&&(ls.record=_n[0]),_n[5]!==void 0&&(ls.activeContentTab=_n[5]),$n=new EditHeader({props:ls}),binding_callbacks.push(()=>bind($n,"record",Mo)),binding_callbacks.push(()=>bind($n,"activeContentTab",es));function ps(gs,xs){if(gs[3])return create_if_block_1$n;if(gs[6])return create_if_block_2$b}let rs=ps(_n),Yo=rs&&rs(_n);Yn=new Title({props:{schema:_n[2],record:_n[0],isCreateMode:_n[3]}}),to=new ErrorAlert({props:{message:_n[7]}});function Ys(gs){_n[13](gs)}let sr={schema:_n[2],isCreateMode:_n[3]};_n[5]!==void 0&&(sr.active=_n[5]),ho=new ContentTabs({props:sr}),binding_callbacks.push(()=>bind(ho,"active",Ys)),So=new FilePreview({props:{record:_n[0],schema:_n[2]}});let Js=ensure_array_like(_n[8]);const ko=gs=>gs[24].name;for(let gs=0;gs<Js.length;gs+=1){let xs=get_each_context$m(_n,Js,gs),Qr=ko(xs);xo.set(Qr,Do[gs]=create_each_block$m(Qr,xs))}return{c(){Ce=element("div"),ke=element("div"),create_component($n.$$.fragment),Zn=space$3(),Yo&&Yo.c(),qn=space$3(),create_component(Yn.$$.fragment),Jn=space$3(),create_component(to.$$.fragment),io=space$3(),uo=element("div"),create_component(ho.$$.fragment),Oo=space$3(),create_component(So.$$.fragment),$o=space$3();for(let gs=0;gs<Do.length;gs+=1)Do[gs].c();attr(ke,"class","tools-header"),attr(uo,"class","mt-4"),set_style(uo,"margin-bottom","150px"),set_style(uo,"position","relative"),attr(Ce,"class","inline-edit record-edit")},m(gs,xs){insert$1(gs,Ce,xs),append(Ce,ke),mount_component($n,ke,null),append(ke,Zn),Yo&&Yo.m(ke,null),append(Ce,qn),mount_component(Yn,Ce,null),append(Ce,Jn),mount_component(to,Ce,null),append(Ce,io),append(Ce,uo),mount_component(ho,uo,null),append(uo,Oo),mount_component(So,uo,null),append(uo,$o);for(let Qr=0;Qr<Do.length;Qr+=1)Do[Qr]&&Do[Qr].m(uo,null);Io=!0,Vo||(Ko=listen(window,"beforeunload",_n[9]),Vo=!0)},p(gs,[xs]){const Qr={};xs&4&&(Qr.schema=gs[2]),xs&8&&(Qr.isCreateMode=gs[3]),!Hn&&xs&1&&(Hn=!0,Qr.record=gs[0],add_flush_callback(()=>Hn=!1)),!zn&&xs&32&&(zn=!0,Qr.activeContentTab=gs[5],add_flush_callback(()=>zn=!1)),$n.$set(Qr),rs===(rs=ps(gs))&&Yo?Yo.p(gs,xs):(Yo&&Yo.d(1),Yo=rs&&rs(gs),Yo&&(Yo.c(),Yo.m(ke,null)));const cr={};xs&4&&(cr.schema=gs[2]),xs&1&&(cr.record=gs[0]),xs&8&&(cr.isCreateMode=gs[
`,attr(Ce,"class","start-typing")},m(ke,$n){insert$1(ke,Ce,$n)},p:noop,d(ke){ke&&detach(Ce)}}}function create_each_block$l(_n,Ce){let ke,$n=previewTitle(Ce[3].schemas,Ce[11])+"",Hn,zn,Zn,qn;function Yn(...to){return Ce[8](Ce[11],...to)}function Jn(...to){return Ce[9](Ce[11],...to)}return{key:_n,first:null,c(){ke=element("div"),Hn=text($n),zn=space$3(),attr(ke,"class","reference-tags-option"),attr(ke,"role","button"),attr(ke,"tabindex","0"),this.first=ke},m(to,io){insert$1(to,ke,io),append(ke,Hn),append(ke,zn),Zn||(qn=[listen(ke,"click",Yn),listen(ke,"keypress",Jn)],Zn=!0)},p(to,io){Ce=to,io&4&&$n!==($n=previewTitle(Ce[3].schemas,Ce[11])+"")&&set_data(Hn,$n)},d(to){to&&detach(ke),Zn=!1,run_all(qn)}}}function create_fragment$11(_n){let Ce,ke,$n,Hn,zn,Zn,qn,Yn=_n[2]&&create_if_block$H(_n);return{c(){Ce=element("div"),ke=element("input"),Hn=space$3(),zn=element("div"),Yn&&Yn.c(),attr(ke,"type","search"),attr(ke,"placeholder",$n="Search for "+_n[0].label),attr(ke,"autocomplete","off"),attr(zn,"class","reference-tags-results"),attr(Ce,"class","reference-tags")},m(Jn,to){insert$1(Jn,Ce,to),append(Ce,ke),set_input_value(ke,_n[1]),append(Ce,Hn),append(Ce,zn),Yn&&Yn.m(zn,null),Zn||(qn=[listen(ke,"keyup",_n[4]),listen(ke,"input",_n[7])],Zn=!0)},p(Jn,[to]){to&1&&$n!==($n="Search for "+Jn[0].label)&&attr(ke,"placeholder",$n),to&2&&ke.value!==Jn[1]&&set_input_value(ke,Jn[1]),Jn[2]?Yn?Yn.p(Jn,to):(Yn=create_if_block$H(Jn),Yn.c(),Yn.m(zn,null)):Yn&&(Yn.d(1),Yn=null)},i:noop,o:noop,d(Jn){Jn&&detach(Ce),Yn&&Yn.d(),Zn=!1,run_all(qn)}}}function instance$11(_n,Ce,ke){let $n;const Hn=getContext$1("channel"),zn=createEventDispatcher();let{value:Zn=""}=Ce,{field:qn}=Ce,Yn="";const Jn=lodashExports.debounce(bo=>{axios.get(Hn.lucentUrl+"/records/suggestions",{params:{schema:qn.collections[0],field:"search",value:Yn,ui:"search"}}).then(Oo=>{ke(2,$n=Oo.data)}).catch(Oo=>{ke(2,$n=[]),console.log(Oo)})},500);function to(bo,Oo){bo.preventDefault(),ke(6,Zn=Oo.id),zn("addFilter"),ke(6,Zn="")}function io(){Yn=this.value,ke(1,Yn)}const uo=(bo,Oo)=>to(Oo,bo),ho=(bo,Oo)=>to(Oo,bo);return _n.$$set=bo=>{"value"in bo&&ke(6,Zn=bo.value),"field"in bo&&ke(0,qn=bo.field)},ke(2,$n=[]),[qn,Yn,$n,Hn,Jn,to,Zn,io,uo,ho]}class FilterReferenceInput extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$11,create_fragment$11,safe_not_equal,{value:6,field:0})}}function get_each_context$k(_n,Ce,ke){const $n=_n.slice();return $n[39]=Ce[ke],$n}function get_each_context_1$7(_n,Ce,ke){const $n=_n.slice();return $n[42]=Ce[ke],$n}function get_each_context_2$2(_n,Ce,ke){const $n=_n.slice();return $n[39]=Ce[ke],$n}function create_if_block_4$5(_n){let Ce,ke,$n,Hn,zn,Zn,qn,Yn;ke=new Icon({props:{icon:"arrow-left"}});let Jn=ensure_array_like(_n[9]),to=[];for(let io=0;io<Jn.length;io+=1)to[io]=create_each_block_2$2(get_each_context_2$2(_n,Jn,io));return{c(){Ce=element("button"),create_component(ke.$$.fragment),$n=text(`
Back`),Hn=space$3();for(let io=0;io<to.length;io+=1)to[io].c();zn=empty$1(),attr(Ce,"class","dropdown-item button")},m(io,uo){insert$1(io,Ce,uo),mount_component(ke,Ce,null),append(Ce,$n),insert$1(io,Hn,uo);for(let ho=0;ho<to.length;ho+=1)to[ho]&&to[ho].m(io,uo);insert$1(io,zn,uo),Zn=!0,qn||(Yn=listen(Ce,"click",_n[23]),qn=!0)},p(io,uo){if(uo[0]&2560){Jn=ensure_array_like(io[9]);let ho;for(ho=0;ho<Jn.length;ho+=1){const bo=get_each_context_2$2(io,Jn,ho);to[ho]?to[ho].p(bo,uo):(to[ho]=create_each_block_2$2(bo),to[ho].c(),to[ho].m(zn.parentNode,zn))}for(;ho<to.length;ho+=1)to[ho].d(1);to.length=Jn.length}},i(io){Zn||(transition_in(ke.$$.fragment,io),Zn=!0)},o(io){transition_out(ke.$$.fragment,io),Zn=!1},d(io){io&&(detach(Ce),detach(Hn),detach(zn)),destroy_component(ke),destroy_each(to,io),qn=!1,Yn()}}}function create_each_block_2$2(_n){let Ce,ke,$n;function Hn(...zn){return _n[24](_n[39],...zn)}return{c(){Ce=element("button"),Ce.textContent=`${_n[39].label} `,attr(Ce,"class","dropdown-item button")},m(zn,Zn){insert$1(zn,Ce,Zn),ke||($n=listen(Ce,"click",Hn),ke=!0)},p(zn,Zn){_n=zn},d(zn){zn&&detach(Ce),ke=!1,$n()}}}function create_if_block_3$8(_n){let Ce,ke,$n,Hn,zn,Zn,qn=_n[3].label+"",Yn,Jn,to,io,uo,ho;ke=new Icon({props:{icon:"arrow-left"}});let bo=ensure_array_like(_n[7]),Oo=[];for(let So=0;So<bo.length;So+=1)Oo[So]=create_each_block_1$7(get_each_context_1$7(_n,bo,So));return{c(){Ce=element("button"),create_component(ke.$$.fragment),$n=text(`
Back`),Hn=space$3(),zn=element("div"),Zn=text("field: "),Yn=text(qn),Jn=space$3();for(let So=0;So<Oo.length;So+=1)Oo[So].c();to=empty$1(),attr(Ce,"class","dropdown-item button"),attr(zn,"class","selected-filter")},m(So,$o){insert$1(So,Ce,$o),mount_component(ke,Ce,null),append(Ce,$n),insert$1(So,Hn,$o),insert$1(So,zn,$o),append(zn,Zn),append(zn,Yn),insert$1(So,Jn,$o);for(let Do=0;Do<Oo.length;Do+=1)Oo[Do]&&Oo[Do].m(So,$o);insert$1(So,to,$o),io=!0,uo||(ho=listen(Ce,"click",_n[25]),uo=!0)},p(So,$o){if((!io||$o[0]&8)&&qn!==(qn=So[3].label+"")&&set_data(Yn,qn),$o[0]&8320){bo=ensure_array_like(So[7]);let Do;for(Do=0;Do<bo.length;Do+=1){const xo=get_each_context_1$7(So,bo,Do);Oo[Do]?Oo[Do].p(xo,$o):(Oo[Do]=create_each_block_1$7(xo),Oo[Do].c(),Oo[Do].m(to.parentNode,to))}for(;Do<Oo.length;Do+=1)Oo[Do].d(1);Oo.length=bo.length}},i(So){io||(transition_in(ke.$$.fragment,So),io=!0)},o(So){transition_out(ke.$$.fragment,So),io=!1},d(So){So&&(detach(Ce),detach(Hn),detach(zn),detach(Jn),detach(to)),destroy_component(ke),destroy_each(Oo,So),uo=!1,ho()}}}function create_each_block_1$7(_n){let Ce,ke=_n[42].label+"",$n,Hn,zn,Zn;function qn(...Yn){return _n[26](_n[42],...Yn)}return{c(){Ce=element("button"),$n=text(ke),Hn=space$3(),attr(Ce,"class","dropdown-item button")},m(Yn,Jn){insert$1(Yn,Ce,Jn),append(Ce,$n),append(Ce,Hn),zn||(Zn=listen(Ce,"click",qn),zn=!0)},p(Yn,Jn){_n=Yn,Jn[0]&128&&ke!==(ke=_n[42].label+"")&&set_data($n,ke)},d(Yn){Yn&&detach(Ce),zn=!1,Zn()}}}function create_if_block_2$a(_n){let Ce,ke,$n,Hn,zn,Zn,qn=_n[3].label+"",Yn,Jn,to=_n[5].label+"",io,uo,ho,bo,Oo,So,$o,Do,xo;return ke=new Icon({props:{icon:"arrow-left"}}),{c(){Ce=element("button"),create_component(ke.$$.fragment),$n=text(`
Back`),Hn=space$3(),zn=element("div"),Zn=text("field: "),Yn=text(qn),Jn=text(" operator: "),io=text(to),uo=space$3(),ho=element("div"),bo=element("input"),Oo=space$3(),So=element("button"),So.textContent="Add filter",attr(Ce,"class","dropdown-item button"),attr(zn,"class","selected-filter"),attr(bo,"type","text"),attr(bo,"class","form-control"),attr(ho,"class","filter-input"),attr(So,"class","button applied-filter"),attr(So,"type","button")},m(Io,Vo){insert$1(Io,Ce,Vo),mount_component(ke,Ce,null),append(Ce,$n),insert$1(Io,Hn,Vo),insert$1(Io,zn,Vo),append(zn,Zn),append(zn,Yn),append(zn,Jn),append(zn,io),insert$1(Io,uo,Vo),insert$1(Io,ho,Vo),append(ho,bo),set_input_value(bo,_n[2]),insert$1(Io,Oo,Vo),insert$1(Io,So,Vo),$o=!0,Do||(xo=[listen(Ce,"click",_n[27]),listen(bo,"input",_n[28]),listen(So,"click",_n[14])],Do=!0)},p(Io,Vo){(!$o||Vo[0]&8)&&qn!==(qn=Io[3].label+"")&&set_data(Yn,qn),(!$o||Vo[0]&32)&&to!==(to=Io[5].label+"")&&set_data(io,to),Vo[0]&4&&bo.value!==Io[2]&&set_input_value(bo,Io[2])},i(Io){$o||(transition_in(ke.$$.fragment,Io),$o=!0)},o(Io){transition_out(ke.$$.fragment,Io),$o=!1},d(Io){Io&&(detach(Ce),detach(Hn),detach(zn),detach(uo),detach(ho),detach(Oo),detach(So)),destroy_component(ke),Do=!1,run_all(xo)}}}function create_if_block_1$m(_n){let Ce,ke,$n,Hn,zn,Zn,qn,Yn;ke=new Icon({props:{icon:"arrow-left"}});let Jn=ensure_array_like(_n[10]),to=[];for(let io=0;io<Jn.length;io+=1)to[io]=create_each_block$k(get_each_context$k(_n,Jn,io));return{c(){Ce=element("button"),create_component(ke.$$.fragment),$n=text(`
Back`),Hn=space$3();for(let io=0;io<to.length;io+=1)to[io].c();zn=empty$1(),attr(Ce,"class","dropdown-item button")},m(io,uo){insert$1(io,Ce,uo),mount_component(ke,Ce,null),append(Ce,$n),insert$1(io,Hn,uo);for(let ho=0;ho<to.length;ho+=1)to[ho]&&to[ho].m(io,uo);insert$1(io,zn,uo),Zn=!0,qn||(Yn=listen(Ce,"click",_n[29]),qn=!0)},p(io,uo){if(uo[0]&5120){Jn=ensure_array_like(io[10]);let ho;for(ho=0;ho<Jn.length;ho+=1){const bo=get_each_context$k(io,Jn,ho);to[ho]?to[ho].p(bo,uo):(to[ho]=create_each_block$k(bo),to[ho].c(),to[ho].m(zn.parentNode,zn))}for(;ho<to.length;ho+=1)to[ho].d(1);to.length=Jn.length}},i(io){Zn||(transition_in(ke.$$.fragment,io),Zn=!0)},o(io){transition_out(ke.$$.fragment,io),Zn=!1},d(io){io&&(detach(Ce),detach(Hn),detach(zn)),destroy_component(ke),destroy_each(to,io),qn=!1,Yn()}}}function create_each_block$k(_n){let Ce,ke,$n;function Hn(...zn){return _n[30](_n[39],...zn)}return{c(){Ce=element("button"),Ce.textContent=`${_n[39].label} `,attr(Ce,"class","dropdown-item button")},m(zn,Zn){insert$1(zn,Ce,Zn),ke||($n=listen(Ce,"click",Hn),ke=!0)},p(zn,Zn){_n=zn},d(zn){zn&&detach(Ce),ke=!1,$n()}}}function create_if_block$G(_n){let Ce,ke,$n,Hn,zn,Zn,qn=_n[4].label+"",Yn,Jn,to,io,uo,ho,bo,Oo;ke=new Icon({props:{icon:"arrow-left"}});function So(Do){_n[32](Do)}let $o={field:_n[4]};return _n[2]!==void 0&&($o.value=_n[2]),io=new FilterReferenceInput({props:$o}),binding_callbacks.push(()=>bind(io,"value",So)),io.$on("addFilter",_n[14]),{c(){Ce=element("button"),create_component(ke.$$.fragment),$n=text(`
Back`),Hn=space$3(),zn=element("div"),Zn=text("field: "),Yn=text(qn),Jn=space$3(),to=element("div"),create_component(io.$$.fragment),attr(Ce,"class","dropdown-item button"),attr(zn,"class","selected-filter"),attr(to,"class","mt-2")},m(Do,xo){insert$1(Do,Ce,xo),mount_component(ke,Ce,null),append(Ce,$n),insert$1(Do,Hn,xo),insert$1(Do,zn,xo),append(zn,Zn),append(zn,Yn),insert$1(Do,Jn,xo),insert$1(Do,to,xo),mount_component(io,to,null),ho=!0,bo||(Oo=listen(Ce,"click",_n[31]),bo=!0)},p(Do,xo){(!ho||xo[0]&16)&&qn!==(qn=Do[4].label+"")&&set_data(Yn,qn);const Io={};xo[0]&16&&(Io.field=Do[4]),!uo&&xo[0]&4&&(uo=!0,Io.value=Do[2],add_flush_callback(()=>uo=!1)),io.$set(Io)},i(Do){ho||(transition_in(ke.$$.fragment,Do),transition_in(io.$$.fragment,Do),ho=!0)},o(Do){transition_out(ke.$$.fragment,Do),transition_out(io.$$.fragment,Do),ho=!1},d(Do){Do&&(detach(Ce),detach(Hn),detach(zn),detach(Jn),detach(to)),destroy_component(ke),destroy_component(io),bo=!1,Oo()}}}function create_default_slot$8(_n){let Ce,ke,$n,Hn,zn,Zn,qn,Yn,Jn,to,io,uo,ho,bo,Oo,So,$o,Do,xo,Io,Vo,Ko,Mo,es,ls,ps,rs=!_n[3]&&create_if_block_4$5(_n),Yo=_n[3]&&!_n[5]&&create_if_block_3$8(_n),Ys=_n[3]&&_n[5]&&create_if_block_2$a(_n),sr=!_n[4]&&create_if_block_1$m(_n),Js=_n[4]&&create_if_block$G(_n);return $o=new Icon({props:{icon:"arrow-left"}}),{c(){Ce=element("div"),ke=element("button"),ke.textContent="Filter by field",$n=space$3(),Hn=element("button"),Hn.textContent="Filter by Reference",zn=space$3(),Zn=element("button"),Zn.textContent="Advanced filter",qn=space$3(),Yn=element("div"),rs&&rs.c(),Jn=space$3(),Yo&&Yo.c(),to=space$3(),Ys&&Ys.c(),io=space$3(),uo=element("div"),sr&&sr.c(),ho=space$3(),Js&&Js.c(),bo=space$3(),Oo=element("div"),So=element("button"),create_component($o.$$.fragment),Do=text(`
Back`),xo=space$3(),Io=element("form"),Vo=element("input"),Ko=space$3(),Mo=element("button"),Mo.textContent="Submit",attr(ke,"class","dropdown-item button"),attr(Hn,"class","dropdown-item button"),attr(Zn,"class","dropdown-item button"),toggle_class(Ce,"hide",_n[6]!=="main"),toggle_class(Yn,"hide",_n[6]!=="byField"),toggle_class(uo,"hide",_n[6]!=="byReference"),attr(So,"class","dropdown-item button"),attr(Vo,"type","search"),attr(Vo,"class","mb-2 mt-2"),attr(Vo,"placeholder","Advanced filters"),Vo.required=!0,attr(Mo,"class","button applied-filter"),toggle_class(Oo,"hide",_n[6]!=="advanced")},m(ko,gs){insert$1(ko,Ce,gs),append(Ce,ke),append(Ce,$n),append(Ce,Hn),append(Ce,zn),append(Ce,Zn),insert$1(ko,qn,gs),insert$1(ko,Yn,gs),rs&&rs.m(Yn,null),append(Yn,Jn),Yo&&Yo.m(Yn,null),append(Yn,to),Ys&&Ys.m(Yn,null),insert$1(ko,io,gs),insert$1(ko,uo,gs),sr&&sr.m(uo,null),append(uo,ho),Js&&Js.m(uo,null),insert$1(ko,bo,gs),insert$1(ko,Oo,gs),append(Oo,So),mount_component($o,So,null),append(So,Do),append(Oo,xo),append(Oo,Io),append(Io,Vo),set_input_value(Vo,_n[1]),append(Io,Ko),append(Io,Mo),es=!0,ls||(ps=[listen(ke,"click",_n[20]),listen(Hn,"click",_n[21]),listen(Zn,"click",_n[22]),listen(So,"click",_n[33]),listen(Vo,"input",_n[34]),listen(Io,"submit",_n[8])],ls=!0)},p(ko,gs){(!es||gs[0]&64)&&toggle_class(Ce,"hide",ko[6]!=="main"),ko[3]?rs&&(group_outros(),transition_out(rs,1,1,()=>{rs=null}),check_outros()):rs?(rs.p(ko,gs),gs[0]&8&&transition_in(rs,1)):(rs=create_if_block_4$5(ko),rs.c(),transition_in(rs,1),rs.m(Yn,Jn)),ko[3]&&!ko[5]?Yo?(Yo.p(ko,gs),gs[0]&40&&transition_in(Yo,1)):(Yo=create_if_block_3$8(ko),Yo.c(),transition_in(Yo,1),Yo.m(Yn,to)):Yo&&(group_outros(),transition_out(Yo,1,1,()=>{Yo=null}),check_outros()),ko[3]&&ko[5]?Ys?(Ys.p(ko,gs),gs[0]&40&&transition_in(Ys,1)):(Ys=create_if_block_2$a(ko),Ys.c(),transition_in(Ys,1),Ys.m(Yn,null)):Ys&&(group_outros(),transition_out(Ys,1,1,()=>{Ys=null}),check_outros()),(!es||gs[0]&64)&&toggle_class(Yn,"hide",ko[6]!=="byField"),ko[4]?sr&&(group_outros(),transition_out(sr,1,1,()=>{sr=null}),check_outros()):sr?(sr.p(ko,gs),gs[0]&16&&transition_in(sr,1)):(sr=create_if_block_1$m(ko),sr.c(),transition_in(sr,1),sr.m(uo,ho)),ko[4]?Js?(Js.p(ko,gs),gs[0]&16&&transition_in(Js,1)):(Js=create_if_block$G(ko),Js.c(),transition_in(Js,1),Js.m(uo,null)):Js&&(group_outros(),transition_out(Js,1,1,()=>{Js=null}),check_outros()),(!es||gs[0]&64)&&toggle_class(uo,"hide",ko[6]!=="byReference"),gs[0]&2&&Vo.value!==ko[1]&&set_input_value(Vo,ko[1]),(!es||gs[0]&64)&&toggle_class(Oo,"hide",ko[6]!=="advanced")},i(ko){es||(transition_in(rs),transition_in(Yo),transition_in(Ys),transition_in(sr),transition_in(Js),transition_in($o.$$.fragment,ko),es=!0)},o(ko){transition_out(rs),transition_out(Yo),transition_out(Ys),transition_out(sr),transition_out(Js),transition_out($o.$$.fragment,ko),es=!1},d(ko){ko&&(detach(Ce),detach(qn),detach(Yn),detach(io),detach(uo),detach(bo),detach(Oo)),rs&&rs.d(),Yo&&Yo.d(),Ys&&Ys.d(),sr&&sr.d(),Js&&Js.d(),destroy_component($o),ls=!1,run_all(ps)}}}function create_button_slot$7(_n){let Ce,ke,$n,Hn,zn;return ke=new Icon({props:{icon:"filter"}}),{c(){Ce=element("div"),create_component(ke.$$.fragment),$n=space$3(),Hn=element("span"),Hn.textContent="Filter",attr(Hn,"class","ms-1"),attr(Ce,"slot","button")},m(Zn,qn){insert$1(Zn,Ce,qn),mount_component(ke,Ce,null),append(Ce,$n),append(Ce,Hn),zn=!0},p:noop,i(Zn){zn||(transition_in(ke.$$.fragment,Zn),zn=!0)},o(Zn){transition_out(ke.$$.fragment,Zn),zn=!1},d(Zn){Zn&&detach(Ce),destroy_component(ke)}}}function create_fragment$10(_n){let Ce,ke,$n,Hn={$$slots:{button:[create_button_slot$7],default:[create_default_slot$8]},$$scope:{ctx:_n}};return ke=new Dropdown({props:Hn}),_n[35](ke),{c(){Ce=element("div"),create_component(ke.$$.fragment)},m(zn,Zn){insert$1(zn,Ce,Zn),mount_component(ke,Ce,null),$n=!0},p(zn,Zn){const qn={};Zn[0]&254|Zn[1]&65536&&(qn.$$scope={dirty:Zn,ctx:zn}),ke.$set(qn)},i(zn){$n||(transition_in(ke.$$.fragment,zn),$n=!0)},o(zn){transition_out(ke.$$.fragment,zn),$n=!1},d(zn){zn&&detach(Ce),_n[35](null),destroy_component(k
2024-08-27 12:25:42 +03:00
Upload file
2024-08-30 13:38:34 +03:00
`),zn=element("input"),attr($n,"class","spinner-border spinner-border-sm"),attr($n,"role","status"),attr($n,"aria-hidden","true"),attr(zn,"class","form-control"),attr(zn,"type","file"),attr(zn,"id","formFile"),zn.multiple=!0,attr(zn,"accept",mimeTypes),zn.disabled=_n[0],zn.hidden=!0,attr(ke,"class","button primary btn-spinner "),attr(Ce,"class","upload-button"),Ce.disabled=_n[0]},m(Yn,Jn){insert$1(Yn,Ce,Jn),append(Ce,ke),append(ke,$n),append(ke,Hn),append(ke,zn),Zn||(qn=listen(zn,"input",_n[1]),Zn=!0)},p(Yn,[Jn]){Jn&1&&(zn.disabled=Yn[0]),Jn&1&&(Ce.disabled=Yn[0])},i:noop,o:noop,d(Yn){Yn&&detach(Ce),Zn=!1,qn()}}}let mimeTypes="";function instance$$(_n,Ce,ke){const $n=createEventDispatcher(),Hn=getContext$1("channel");let{schema:zn}=Ce,Zn=[],qn=!1;function Yn(Jn){ke(0,qn=!0),Zn=Jn.target.files?[...Jn.target.files]:[];let to=new FormData;to.append("schema",zn.name),Array.from(Zn).forEach(function(io){to.append("files[]",io)}),$n("beforeUpload",Zn),axios.post(Hn.lucentUrl+"/files/upload",to,{headers:{"Content-Type":"multipart/form-data"}}).then(io=>{io.data.error?$n("uploadError",io.data.error):$n("uploadComplete",io.data),ke(0,qn=!1)}).catch(io=>{ke(0,qn=!1),console.log(io.response.data)})}return _n.$$set=Jn=>{"schema"in Jn&&ke(2,zn=Jn.schema)},[qn,Yn,zn]}class Uploader extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$$,create_fragment$$,safe_not_equal,{schema:2})}}function get_each_context$j(_n,Ce,ke){const $n=_n.slice();return $n[18]=Ce[ke],$n}function get_each_context_1$6(_n,Ce,ke){const $n=_n.slice();return $n[18]=Ce[ke],$n}function create_each_block_1$6(_n){let Ce,ke,$n,Hn,zn,Zn,qn,Yn,Jn,to,io=_n[18].label+"",uo,ho,bo,Oo;$n=new Icon({props:{icon:"arrow-up-short-wide"}});function So(...xo){return _n[10](_n[18],...xo)}qn=new Icon({props:{icon:"arrow-down-wide-short"}});function $o(...xo){return _n[11](_n[18],...xo)}function Do(...xo){return _n[12](_n[18],...xo)}return{c(){Ce=element("div"),ke=element("button"),create_component($n.$$.fragment),zn=space$3(),Zn=element("button"),create_component(qn.$$.fragment),Jn=space$3(),to=element("button"),uo=text(io),attr(ke,"title","Sort Ascending"),attr(ke,"class",Hn="button button-icon "+(_n[18].name==_n[1].name&&!_n[0].startsWith("-")?"active":"")),attr(Zn,"title","Sort Descending"),attr(Zn,"class",Yn="button button-icon "+(_n[18].name==_n[1].name&&_n[0].startsWith("-")?"active":"")),attr(to,"title","Sort Ascending"),attr(to,"class","button"),attr(Ce,"class","dropdown-item")},m(xo,Io){insert$1(xo,Ce,Io),append(Ce,ke),mount_component($n,ke,null),append(Ce,zn),append(Ce,Zn),mount_component(qn,Zn,null),append(Ce,Jn),append(Ce,to),append(to,uo),ho=!0,bo||(Oo=[listen(ke,"click",So),listen(Zn,"click",$o),listen(to,"click",Do)],bo=!0)},p(xo,Io){_n=xo,(!ho||Io&11&&Hn!==(Hn="button button-icon "+(_n[18].name==_n[1].name&&!_n[0].startsWith("-")?"active":"")))&&attr(ke,"class",Hn),(!ho||Io&11&&Yn!==(Yn="button button-icon "+(_n[18].name==_n[1].name&&_n[0].startsWith("-")?"active":"")))&&attr(Zn,"class",Yn),(!ho||Io&8)&&io!==(io=_n[18].label+"")&&set_data(uo,io)},i(xo){ho||(transition_in($n.$$.fragment,xo),transition_in(qn.$$.fragment,xo),ho=!0)},o(xo){transition_out($n.$$.fragment,xo),transition_out(qn.$$.fragment,xo),ho=!1},d(xo){xo&&detach(Ce),destroy_component($n),destroy_component(qn),bo=!1,run_all(Oo)}}}function create_each_block$j(_n){let Ce,ke,$n,Hn,zn,Zn,qn,Yn,Jn,to,io=_n[18].label+"",uo,ho,bo,Oo,So;$n=new Icon({props:{icon:"arrow-up-short-wide"}});function $o(...Io){return _n[13](_n[18],...Io)}qn=new Icon({props:{icon:"arrow-down-wide-short"}});function Do(...Io){return _n[14](_n[18],...Io)}function xo(...Io){return _n[15](_n[18],...Io)}return{c(){Ce=element("div"),ke=element("button"),create_component($n.$$.fragment),zn=space$3(),Zn=element("button"),create_component(qn.$$.fragment),Jn=space$3(),to=element("button"),uo=text(io),ho=space$3(),attr(ke,"title","Sort Ascending"),attr(ke,"class",Hn="button button-icon "+(_n[18].name==_n[0]?"active":"")),attr(Zn,"title","Sort Descending"),attr(Zn,"class",Yn="button button-icon "+("-"+_n[18].name==_n[0]?"acti
2024-08-27 12:25:42 +03:00
2024-08-30 13:38:34 +03:00
`),$n=element("button"),create_component(Hn.$$.fragment),attr($n,"type","button"),attr($n,"class","button-text"),attr($n,"aria-label","Close"),attr(Ce,"class","applied-filter")},m(Yn,Jn){insert$1(Yn,Ce,Jn),append(Ce,ke),append(Ce,$n),mount_component(Hn,$n,null),zn=!0,Zn||(qn=listen($n,"click",prevent_default(_n[4])),Zn=!0)},p:noop,i(Yn){zn||(transition_in(Hn.$$.fragment,Yn),zn=!0)},o(Yn){transition_out(Hn.$$.fragment,Yn),zn=!1},d(Yn){Yn&&detach(Ce),destroy_component(Hn),Zn=!1,qn()}}}function create_fragment$Y(_n){let Ce=_n[0].searchParams.get("notlinked"),ke,$n,Hn=Ce&&create_if_block$D(_n);return{c(){Hn&&Hn.c(),ke=empty$1()},m(zn,Zn){Hn&&Hn.m(zn,Zn),insert$1(zn,ke,Zn),$n=!0},p(zn,[Zn]){Ce&&Hn.p(zn,Zn)},i(zn){$n||(transition_in(Hn),$n=!0)},o(zn){transition_out(Hn),$n=!1},d(zn){zn&&detach(ke),Hn&&Hn.d(zn)}}}function instance$Y(_n,Ce,ke){getContext$1("channel");const $n=createEventDispatcher();let{inModal:Hn}=Ce,{modalUrl:zn}=Ce;const Zn=new URL(zn??window.location.href);function qn(Jn){const to=new URL(zn??window.location.href);to.searchParams.set("skip","0"),to.searchParams.delete("notlinked"),Hn?$n("refresh",to):window.location.replace(to)}const Yn=()=>qn();return _n.$$set=Jn=>{"inModal"in Jn&&ke(2,Hn=Jn.inModal),"modalUrl"in Jn&&ke(3,zn=Jn.modalUrl)},[Zn,qn,Hn,zn,Yn]}class AppliedFilterNotLinked extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$Y,create_fragment$Y,safe_not_equal,{inModal:2,modalUrl:3})}}function get_each_context$i(_n,Ce,ke){const $n=_n.slice();return $n[22]=Ce[ke][0],$n[23]=Ce[ke][1],$n}function create_else_block_1$2(_n){let Ce,ke,$n;return ke=new Uploader({props:{schema:_n[0]}}),ke.$on("uploadComplete",_n[13]),{c(){Ce=element("div"),create_component(ke.$$.fragment)},m(Hn,zn){insert$1(Hn,Ce,zn),mount_component(ke,Ce,null),$n=!0},p(Hn,zn){const Zn={};zn&1&&(Zn.schema=Hn[0]),ke.$set(Zn)},i(Hn){$n||(transition_in(ke.$$.fragment,Hn),$n=!0)},o(Hn){transition_out(ke.$$.fragment,Hn),$n=!1},d(Hn){Hn&&detach(Ce),destroy_component(ke)}}}function create_if_block_4$4(_n){let Ce,ke=!_n[5]&&_n[7]&&create_if_block_5$2(_n);return{c(){ke&&ke.c(),Ce=empty$1()},m($n,Hn){ke&&ke.m($n,Hn),insert$1($n,Ce,Hn)},p($n,Hn){!$n[5]&&$n[7]?ke?ke.p($n,Hn):(ke=create_if_block_5$2($n),ke.c(),ke.m(Ce.parentNode,Ce)):ke&&(ke.d(1),ke=null)},i:noop,o:noop,d($n){$n&&detach(Ce),ke&&ke.d($n)}}}function create_if_block_5$2(_n){let Ce,ke,$n;return{c(){Ce=element("a"),ke=text("New Record"),attr(Ce,"href",$n=_n[10].lucentUrl+"/records/new?schema="+_n[0].name),attr(Ce,"class","button")},m(Hn,zn){insert$1(Hn,Ce,zn),append(Ce,ke)},p(Hn,zn){zn&1&&$n!==($n=Hn[10].lucentUrl+"/records/new?schema="+Hn[0].name)&&attr(Ce,"href",$n)},d(Hn){Hn&&detach(Ce)}}}function create_if_block_1$l(_n){let Ce,ke;return Ce=new Dropdown({props:{orientation:"right",$$slots:{button:[create_button_slot$5],default:[create_default_slot$6]},$$scope:{ctx:_n}}}),{c(){create_component(Ce.$$.fragment)},m($n,Hn){mount_component(Ce,$n,Hn),ke=!0},p($n,Hn){const zn={};Hn&67109009&&(zn.$$scope={dirty:Hn,ctx:$n}),Ce.$set(zn)},i($n){ke||(transition_in(Ce.$$.fragment,$n),ke=!0)},o($n){transition_out(Ce.$$.fragment,$n),ke=!1},d($n){destroy_component(Ce,$n)}}}function create_else_block$f(_n){let Ce,ke,$n,Hn,zn,Zn,qn,Yn,Jn,to;return{c(){Ce=element("a"),ke=text("Export to CSV"),$n=space$3(),Hn=element("a"),zn=text("View trashed records"),qn=space$3(),Yn=element("a"),Jn=text("View unlinked records"),attr(Ce,"class","dropdown-item"),attr(Ce,"href",_n[11]),attr(Hn,"class","dropdown-item"),attr(Hn,"href",Zn=_n[10].lucentUrl+"/content/"+_n[0].name+"?filter[status_in]=trashed"),attr(Yn,"class","dropdown-item"),attr(Yn,"href",to=_n[10].lucentUrl+"/content/"+_n[0].name+"?notlinked=*")},m(io,uo){insert$1(io,Ce,uo),append(Ce,ke),insert$1(io,$n,uo),insert$1(io,Hn,uo),append(Hn,zn),insert$1(io,qn,uo),insert$1(io,Yn,uo),append(Yn,Jn)},p(io,uo){uo&1&&Zn!==(Zn=io[10].lucentUrl+"/content/"+io[0].name+"?filter[status_in]=trashed")&&attr(Hn,"href",Zn),uo&1&&to!==(to=io[10].lucentUrl+"/content/"+io[0].name+"?notlinked=*")&&attr(Yn,"href",to)},d(io){io&&(detach(Ce),detach($n),detach(Hn)
2024-08-27 12:25:42 +03:00
`),Zn=element("span"),Yn=text(qn),Jn=text(`
to
2024-08-30 13:38:34 +03:00
`),to=element("span"),uo=text(io),ho=text(`
2024-08-27 12:25:42 +03:00
of
2024-08-30 13:38:34 +03:00
`),bo=element("span"),Oo=text(_n[4]),So=text(`
total`),attr(ke,"class","pagination"),attr(Zn,"class","font-medium"),attr(to,"class","font-medium"),attr(bo,"class","font-medium"),set_style(Hn,"display","flex"),set_style(Hn,"justify-content","center"),set_style(Hn,"gap","4px")},m(xo,Io){insert$1(xo,Ce,Io),append(Ce,ke),Do&&Do.m(ke,null),insert$1(xo,$n,Io),insert$1(xo,Hn,Io),append(Hn,zn),append(Hn,Zn),append(Zn,Yn),append(Hn,Jn),append(Hn,to),append(to,uo),append(Hn,ho),append(Hn,bo),append(bo,Oo),append(Hn,So),$o=!0},p(xo,[Io]){xo[5]>1?Do?(Do.p(xo,Io),Io&32&&transition_in(Do,1)):(Do=create_if_block$A(xo),Do.c(),transition_in(Do,1),Do.m(ke,null)):Do&&(group_outros(),transition_out(Do,1,1,()=>{Do=null}),check_outros()),(!$o||Io&8)&&qn!==(qn=+xo[3]+1+"")&&set_data(Yn,qn),(!$o||Io&28)&&io!==(io=(+xo[3]+xo[2]>xo[4]?xo[4]:+xo[3]+xo[2])+"")&&set_data(uo,io),(!$o||Io&16)&&set_data(Oo,xo[4])},i(xo){$o||(transition_in(Do),$o=!0)},o(xo){transition_out(Do),$o=!1},d(xo){xo&&(detach(Ce),detach($n),detach(Hn)),Do&&Do.d()}}}function instance$V(_n,Ce,ke){let $n,Hn,zn;const Zn=createEventDispatcher();let{inModal:qn}=Ce,{modalUrl:Yn}=Ce,{limit:Jn}=Ce,{skip:to}=Ce,{total:io}=Ce;function uo(So){So.preventDefault(),bo($n)}function ho(So){So.preventDefault(),bo(1)}function bo(So){const $o=new URL(Yn??window.location.href);let Do=So*Jn-Jn;$o.searchParams.set("skip",Do),qn?Zn("refresh",$o):window.location=$o}function Oo(So){bubble.call(this,_n,So)}return _n.$$set=So=>{"inModal"in So&&ke(0,qn=So.inModal),"modalUrl"in So&&ke(1,Yn=So.modalUrl),"limit"in So&&ke(2,Jn=So.limit),"skip"in So&&ke(3,to=So.skip),"total"in So&&ke(4,io=So.total)},_n.$$.update=()=>{_n.$$.dirty&20&&ke(5,$n=Math.ceil(io/Jn)),_n.$$.dirty&12&&ke(6,Hn=Math.ceil((to-1)/Jn)+1),_n.$$.dirty&96&&ke(7,zn=lodashExports.range(Hn-3,Hn+4).filter(So=>So>0&&So<=$n))},[qn,Yn,Jn,to,io,$n,Hn,zn,uo,ho,Oo]}class Pagination extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$V,create_fragment$V,safe_not_equal,{inModal:0,modalUrl:1,limit:2,skip:3,total:4})}}function create_else_block$d(_n){let Ce,ke,$n;return{c(){Ce=element("button"),Ce.textContent="Move to trash",attr(Ce,"type","button"),attr(Ce,"class","button")},m(Hn,zn){insert$1(Hn,Ce,zn),ke||($n=listen(Ce,"click",prevent_default(_n[9])),ke=!0)},p:noop,d(Hn){Hn&&detach(Ce),ke=!1,$n()}}}function create_if_block$z(_n){let Ce,ke,$n,Hn,zn,Zn,qn=_n[1].hasDrafts&&create_if_block_1$k(_n);return{c(){Ce=element("button"),Ce.textContent="Publish",ke=space$3(),qn&&qn.c(),$n=space$3(),Hn=element("button"),Hn.textContent="Delete forever",attr(Ce,"type","button"),attr(Ce,"class","button"),attr(Hn,"type","button"),attr(Hn,"class","button")},m(Yn,Jn){insert$1(Yn,Ce,Jn),insert$1(Yn,ke,Jn),qn&&qn.m(Yn,Jn),insert$1(Yn,$n,Jn),insert$1(Yn,Hn,Jn),zn||(Zn=[listen(Ce,"click",prevent_default(_n[7])),listen(Hn,"click",prevent_default(_n[3]))],zn=!0)},p(Yn,Jn){Yn[1].hasDrafts?qn?qn.p(Yn,Jn):(qn=create_if_block_1$k(Yn),qn.c(),qn.m($n.parentNode,$n)):qn&&(qn.d(1),qn=null)},d(Yn){Yn&&(detach(Ce),detach(ke),detach($n),detach(Hn)),qn&&qn.d(Yn),zn=!1,run_all(Zn)}}}function create_if_block_1$k(_n){let Ce,ke,$n;return{c(){Ce=element("button"),Ce.textContent="Make Draft",attr(Ce,"type","button"),attr(Ce,"class","button")},m(Hn,zn){insert$1(Hn,Ce,zn),ke||($n=listen(Ce,"click",prevent_default(_n[8])),ke=!0)},p:noop,d(Hn){Hn&&detach(Ce),ke=!1,$n()}}}function create_fragment$U(_n){let Ce,ke,$n=_n[0].length+"",Hn,zn,Zn,qn,Yn,Jn,to,io,uo;function ho(So,$o){return So[2].status_in==="trashed"?create_if_block$z:create_else_block$d}let bo=ho(_n),Oo=bo(_n);return{c(){Ce=element("div"),ke=element("span"),Hn=text($n),zn=text(" records selected"),Zn=space$3(),qn=element("button"),qn.textContent="Publish",Yn=space$3(),Jn=element("button"),Jn.textContent="Make Draft",to=space$3(),Oo.c(),attr(ke,"class","me-2"),attr(qn,"type","button"),attr(qn,"class","button"),attr(Jn,"type","button"),attr(Jn,"class","button"),set_style(Ce,"display","flex"),set_style(Ce,"align-items","center"),set_style(Ce,"gap","8px")},m(So,$o){insert$1(So,Ce,$o),append(Ce,ke),append(ke,Hn),append(ke,zn),append(Ce,Zn),append(Ce,qn),append(Ce,Yn),append(
2024-08-27 12:25:42 +03:00
* Sortable 1.15.2
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
2024-08-30 13:38:34 +03:00
*/function ownKeys(_n,Ce){var ke=Object.keys(_n);if(Object.getOwnPropertySymbols){var $n=Object.getOwnPropertySymbols(_n);Ce&&($n=$n.filter(function(Hn){return Object.getOwnPropertyDescriptor(_n,Hn).enumerable})),ke.push.apply(ke,$n)}return ke}function _objectSpread2(_n){for(var Ce=1;Ce<arguments.length;Ce++){var ke=arguments[Ce]!=null?arguments[Ce]:{};Ce%2?ownKeys(Object(ke),!0).forEach(function($n){_defineProperty(_n,$n,ke[$n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(_n,Object.getOwnPropertyDescriptors(ke)):ownKeys(Object(ke)).forEach(function($n){Object.defineProperty(_n,$n,Object.getOwnPropertyDescriptor(ke,$n))})}return _n}function _typeof(_n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof=function(Ce){return typeof Ce}:_typeof=function(Ce){return Ce&&typeof Symbol=="function"&&Ce.constructor===Symbol&&Ce!==Symbol.prototype?"symbol":typeof Ce},_typeof(_n)}function _defineProperty(_n,Ce,ke){return Ce in _n?Object.defineProperty(_n,Ce,{value:ke,enumerable:!0,configurable:!0,writable:!0}):_n[Ce]=ke,_n}function _extends(){return _extends=Object.assign||function(_n){for(var Ce=1;Ce<arguments.length;Ce++){var ke=arguments[Ce];for(var $n in ke)Object.prototype.hasOwnProperty.call(ke,$n)&&(_n[$n]=ke[$n])}return _n},_extends.apply(this,arguments)}function _objectWithoutPropertiesLoose(_n,Ce){if(_n==null)return{};var ke={},$n=Object.keys(_n),Hn,zn;for(zn=0;zn<$n.length;zn++)Hn=$n[zn],!(Ce.indexOf(Hn)>=0)&&(ke[Hn]=_n[Hn]);return ke}function _objectWithoutProperties(_n,Ce){if(_n==null)return{};var ke=_objectWithoutPropertiesLoose(_n,Ce),$n,Hn;if(Object.getOwnPropertySymbols){var zn=Object.getOwnPropertySymbols(_n);for(Hn=0;Hn<zn.length;Hn++)$n=zn[Hn],!(Ce.indexOf($n)>=0)&&Object.prototype.propertyIsEnumerable.call(_n,$n)&&(ke[$n]=_n[$n])}return ke}var version="1.15.2";function userAgent(_n){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(_n)}var IE11OrLess=userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Edge=userAgent(/Edge/i),FireFox=userAgent(/firefox/i),Safari=userAgent(/safari/i)&&!userAgent(/chrome/i)&&!userAgent(/android/i),IOS=userAgent(/iP(ad|od|hone)/i),ChromeForAndroid=userAgent(/chrome/i)&&userAgent(/android/i),captureMode={capture:!1,passive:!1};function on$1(_n,Ce,ke){_n.addEventListener(Ce,ke,!IE11OrLess&&captureMode)}function off(_n,Ce,ke){_n.removeEventListener(Ce,ke,!IE11OrLess&&captureMode)}function matches(_n,Ce){if(Ce){if(Ce[0]===">"&&(Ce=Ce.substring(1)),_n)try{if(_n.matches)return _n.matches(Ce);if(_n.msMatchesSelector)return _n.msMatchesSelector(Ce);if(_n.webkitMatchesSelector)return _n.webkitMatchesSelector(Ce)}catch{return!1}return!1}}function getParentOrHost(_n){return _n.host&&_n!==document&&_n.host.nodeType?_n.host:_n.parentNode}function closest(_n,Ce,ke,$n){if(_n){ke=ke||document;do{if(Ce!=null&&(Ce[0]===">"?_n.parentNode===ke&&matches(_n,Ce):matches(_n,Ce))||$n&&_n===ke)return _n;if(_n===ke)break}while(_n=getParentOrHost(_n))}return null}var R_SPACE=/\s+/g;function toggleClass$1(_n,Ce,ke){if(_n&&Ce)if(_n.classList)_n.classList[ke?"add":"remove"](Ce);else{var $n=(" "+_n.className+" ").replace(R_SPACE," ").replace(" "+Ce+" "," ");_n.className=($n+(ke?" "+Ce:"")).replace(R_SPACE," ")}}function css$1(_n,Ce,ke){var $n=_n&&_n.style;if($n){if(ke===void 0)return document.defaultView&&document.defaultView.getComputedStyle?ke=document.defaultView.getComputedStyle(_n,""):_n.currentStyle&&(ke=_n.currentStyle),Ce===void 0?ke:ke[Ce];!(Ce in $n)&&Ce.indexOf("webkit")===-1&&(Ce="-webkit-"+Ce),$n[Ce]=ke+(typeof ke=="string"?"":"px")}}function matrix(_n,Ce){var ke="";if(typeof _n=="string")ke=_n;else do{var $n=css$1(_n,"transform");$n&&$n!=="none"&&(ke=$n+" "+ke)}while(!Ce&&(_n=_n.parentNode));var Hn=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return Hn&&new Hn(ke)}function find$1(_n,Ce,ke){if(_n){var $n=_n.getElementsByTagName(Ce),Hn=0,zn=$n.length;if(ke)for(;Hn<zn;Hn++)ke($n[Hn],Hn);return $n}return[]}function getWindowScrollingElement(){var _n=document.scrolling
2024-08-27 12:25:42 +03:00
<span class='flatpickr-weekday'>
`+Es.join("</span><span class='flatpickr-weekday'>")+`
</span>
2024-08-30 13:38:34 +03:00
`}}function cr(){ke.calendarContainer.classList.add("hasWeeks");var vs=createElement("div","flatpickr-weekwrapper");vs.appendChild(createElement("span","flatpickr-weekday",ke.l10n.weekAbbreviation));var Es=createElement("div","flatpickr-weeks");return vs.appendChild(Es),{weekWrapper:vs,weekNumbers:Es}}function ws(vs,Es){Es===void 0&&(Es=!0);var Ks=Es?vs:vs-ke.currentMonth;Ks<0&&ke._hidePrevMonthArrow===!0||Ks>0&&ke._hideNextMonthArrow===!0||(ke.currentMonth+=Ks,(ke.currentMonth<0||ke.currentMonth>11)&&(ke.currentYear+=ke.currentMonth>11?1:-1,ke.currentMonth=(ke.currentMonth+12)%12,Ya("onYearChange"),Ys()),Yo(),Ya("onMonthChange"),Al())}function Fs(vs,Es){if(vs===void 0&&(vs=!0),Es===void 0&&(Es=!0),ke.input.value="",ke.altInput!==void 0&&(ke.altInput.value=""),ke.mobileInput!==void 0&&(ke.mobileInput.value=""),ke.selectedDates=[],ke.latestSelectedDateObj=void 0,Es===!0&&(ke.currentYear=ke._initialDate.getFullYear(),ke.currentMonth=ke._initialDate.getMonth()),ke.config.enableTime===!0){var Ks=getDefaultHours(ke.config),pr=Ks.hours,ia=Ks.minutes,ka=Ks.seconds;ho(pr,ia,ka)}ke.redraw(),vs&&Ya("onChange")}function Br(){ke.isOpen=!1,ke.isMobile||(ke.calendarContainer!==void 0&&ke.calendarContainer.classList.remove("open"),ke._input!==void 0&&ke._input.classList.remove("active")),Ya("onClose")}function _r(){ke.config!==void 0&&Ya("onDestroy");for(var vs=ke._handlers.length;vs--;)ke._handlers[vs].remove();if(ke._handlers=[],ke.mobileInput)ke.mobileInput.parentNode&&ke.mobileInput.parentNode.removeChild(ke.mobileInput),ke.mobileInput=void 0;else if(ke.calendarContainer&&ke.calendarContainer.parentNode)if(ke.config.static&&ke.calendarContainer.parentNode){var Es=ke.calendarContainer.parentNode;if(Es.lastChild&&Es.removeChild(Es.lastChild),Es.parentNode){for(;Es.firstChild;)Es.parentNode.insertBefore(Es.firstChild,Es);Es.parentNode.removeChild(Es)}}else ke.calendarContainer.parentNode.removeChild(ke.calendarContainer);ke.altInput&&(ke.input.type="text",ke.altInput.parentNode&&ke.altInput.parentNode.removeChild(ke.altInput),delete ke.altInput),ke.input&&(ke.input.type=ke.input._type,ke.input.classList.remove("flatpickr-input"),ke.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(Ks){try{delete ke[Ks]}catch{}})}function ha(vs){return ke.calendarContainer.contains(vs)}function hs(vs){if(ke.isOpen&&!ke.config.inline){var Es=getEventTarget(vs),Ks=ha(Es),pr=Es===ke.input||Es===ke.altInput||ke.element.contains(Es)||vs.path&&vs.path.indexOf&&(~vs.path.indexOf(ke.input)||~vs.path.indexOf(ke.altInput)),ia=!pr&&!Ks&&!ha(vs.relatedTarget),ka=!ke.config.ignoredFocusElements.some(function(Ma){return Ma.contains(Es)});ia&&ka&&(ke.config.allowInput&&ke.setDate(ke._input.value,!1,ke.config.altInput?ke.config.altFormat:ke.config.dateFormat),ke.timeContainer!==void 0&&ke.minuteElement!==void 0&&ke.hourElement!==void 0&&ke.input.value!==""&&ke.input.value!==void 0&&Yn(),ke.close(),ke.config&&ke.config.mode==="range"&&ke.selectedDates.length===1&&ke.clear(!1))}}function Qs(vs){if(!(!vs||ke.config.minDate&&vs<ke.config.minDate.getFullYear()||ke.config.maxDate&&vs>ke.config.maxDate.getFullYear())){var Es=vs,Ks=ke.currentYear!==Es;ke.currentYear=Es||ke.currentYear,ke.config.maxDate&&ke.currentYear===ke.config.maxDate.getFullYear()?ke.currentMonth=Math.min(ke.config.maxDate.getMonth(),ke.currentMonth):ke.config.minDate&&ke.currentYear===ke.config.minDate.getFullYear()&&(ke.currentMonth=Math.max(ke.config.minDate.getMonth(),ke.currentMonth)),Ks&&(ke.redraw(),Ya("onYearChange"),Ys())}}function zo(vs,Es){var Ks;Es===void 0&&(Es=!0);var pr=ke.parseDate(vs,
`||Mn==="\r",lC=(Mn,Vn)=>Vn<Mn.length&&Vn>=0?Lg(Mn[Vn]):!1,V1=(Mn,Vn=4,Wn=!0,jn=!0)=>{const Gn=Jd(" ",Vn),no=Mn.replace(/\t/g,Gn);return ra(no,(po,vo)=>E0(vo)||vo===hc?po.pcIsSpace||po.str===""&&Wn||po.str.length===no.length-1&&jn||lC(no,po.str.length+1)?{pcIsSpace:!1,str:po.str+hc}:{pcIsSpace:!0,str:po.str+" "}:{pcIsSpace:Lg(vo),str:po.str+vo},{pcIsSpace:!1,str:""}).str},By=(Mn,Vn)=>{const Wn=Cs.fromDom(Vn),jn=Cs.fromDom(Mn);return fS(jn,"pre,code",ws(Vs,Wn))},z1=(Mn,Vn)=>Ir(Mn)&&Q1(Mn.data)&&!By(Mn,Vn),Pd=Mn=>Oa(Mn)&&Mn.nodeName==="A"&&!Mn.hasAttribute("href")&&(Mn.hasAttribute("name")||Mn.hasAttribute("id")),Cp=(Mn,Vn)=>Xl(Mn)&&!z1(Mn,Vn)||Pd(Mn)||tg(Mn),tg=w0("data-mce-bookmark"),W1=w0("data-mce-bogus"),U1=nf("data-mce-bogus","all"),T0=Mn=>Uc(Cs.fromDom(Mn)).exists(Vn=>!yl(Vn)),Im=(Mn,Vn)=>{let Wn=0;if(Cp(Mn,Mn))return!1;{let jn=Mn.firstChild;if(!jn)return!0;const Gn=new mu(jn,Mn);do{if(Vn){if(U1(jn)){jn=Gn.next(!0);continue}if(W1(jn)){jn=Gn.next();continue}}if(Gf(jn)&&T0(jn))return!1;if(Ec(jn)){Wn++,jn=Gn.next();continue}if(Cp(jn,Mn))return!1;jn=Gn.next()}while(jn);return Wn<=1}},md=(Mn,Vn=!0)=>Im(Mn.dom,Vn),ng=Mn=>Mn.toLowerCase()==="svg",DO=Mn=>ng(Mn.nodeName),Fy=Mn=>(Mn==null?void 0:Mn.nodeName)==="svg"?"svg":"html",Hy=["svg"],Z1=()=>{let Mn=[];const Vn=()=>Mn[Mn.length-1];return{track:no=>{DO(no)&&Mn.push(no);let ao=Vn();return ao&&!ao.contains(no)&&(Mn.pop(),ao=Vn()),Fy(ao)},current:()=>Fy(Vn()),reset:()=>{Mn=[]}}},Ah="data-mce-block",kp=Mn=>nr(Al(Mn),Vn=>!/[A-Z]/.test(Vn)),s1=Mn=>Us(kp(Mn),Vn=>`${Vn}:`+Us(Hy,Wn=>`not(${Wn} ${Vn})`).join(":")).join(","),Ig=(Mn,Vn)=>rs(Vn.querySelector(Mn))?(Vn.setAttribute(Ah,"true"),Vn.getAttribute("data-mce-selected")==="inline-boundary"&&Vn.removeAttribute("data-mce-selected"),!0):(Vn.removeAttribute(Ah),!1),Zh=(Mn,Vn)=>{const Wn=s1(Mn.getTransparentElements()),jn=s1(Mn.getBlockElements());return nr(Vn.querySelectorAll(Wn),Gn=>Ig(jn,Gn))},xp=(Mn,Vn)=>{var Wn;const jn=Vn?"lastChild":"firstChild";for(let Gn=Mn[jn];Gn;Gn=Gn[jn])if(md(Cs.fromDom(Gn))){(Wn=Gn.parentNode)===null||Wn===void 0||Wn.removeChild(Gn);return}},q1=(Mn,Vn)=>{const Wn=document.createRange(),jn=Mn.parentNode;if(jn){Wn.setStartBefore(Mn),Wn.setEndBefore(Vn);const Gn=Wn.extractContents();xp(Gn,!0),Wn.setStartAfter(Vn),Wn.setEndAfter(Mn);const no=Wn.extractContents();xp(no,!1),md(Cs.fromDom(Gn))||jn.insertBefore(Gn,Mn),md(Cs.fromDom(Vn))||jn.insertBefore(Vn,Mn),md(Cs.fromDom(no))||jn.insertBefore(no,Mn),jn.removeChild(Mn)}},hS=(Mn,Vn,Wn)=>{const jn=Mn.getBlockElements(),Gn=Cs.fromDom(Vn),no=po=>ql(po)in jn,ao=po=>Vs(po,Gn);fs(Km(Wn),po=>{au(po,no,ao).each(vo=>{const Ao=kh(po,Fo=>no(Fo)&&!Mn.isValidChild(ql(vo),ql(Fo)));if(Ao.length>0){const Fo=Uc(vo);fs(Ao,Qo=>{au(Qo,no,ao).each(qo=>{q1(qo.dom,Qo.dom)})}),Fo.each(Qo=>Zh(Mn,Qo.dom))}})})},MO=(Mn,Vn,Wn)=>{fs([...Wn,...Wl(Mn,Vn)?[Vn]:[]],jn=>fs(mf(Cs.fromDom(jn),jn.nodeName.toLowerCase()),Gn=>{Qa(Mn,Gn.dom)&&hf(Gn)}))},kv=(Mn,Vn)=>{const Wn=Zh(Mn,Vn);hS(Mn,Vn,Wn),MO(Mn,Vn,Wn)},j1=(Mn,Vn)=>{if(Tv(Mn,Vn)){const Wn=s1(Mn.getBlockElements());Ig(Wn,Vn)}},xv=(Mn,Vn,Wn)=>{const jn=no=>Vs(no,Cs.fromDom(Vn)),Gn=D1(Cs.fromDom(Wn),jn);Fc(Gn,Gn.length-2).filter(lf).fold(()=>kv(Mn,Vn),no=>kv(Mn,no.dom))},NO=Mn=>Mn.hasAttribute(Ah),Ev=(Mn,Vn)=>Mr(Mn.getTransparentElements(),Vn),Tv=(Mn,Vn)=>Oa(Vn)&&Ev(Mn,Vn.nodeName),Wl=(Mn,Vn)=>Tv(Mn,Vn)&&NO(Vn),Qa=(Mn,Vn)=>Tv(Mn,Vn)&&!NO(Vn),og=(Mn,Vn)=>Vn.type===1&&Ev(Mn,Vn.name)&&xo(Vn.attr(Ah)),Av=xl().browser,Lb=Mn=>xa(Mn,lf),T2=Mn=>Av.isFirefox()&&ql(Mn)==="table"?Lb(Ku(Mn)).filter(Vn=>ql(Vn)==="caption").bind(Vn=>Lb(Id(Vn)).map(Wn=>{const jn=Wn.dom.offsetTop,Gn=Vn.dom.offsetTop,no=Vn.dom.offsetHeight;return jn<=Gn?-no:0})).getOr(0):0,LO=(Mn,Vn)=>Mn.children&&Zs(Mn.children,Vn),Jc=(Mn,Vn,Wn)=>{let jn=0,Gn=0;const no=Mn.ownerDocument;if(Wn=Wn||Mn,Vn){if(Wn===Mn&&Vn.getBoundingClientRect&&Ju(Cs.fromDom(Mn),"position")==="static"){const po=Vn.getBoundingClientRect();return jn=po.left+(no.documentElement.scrollLeft||Mn.scrollLeft)-no.documentElement.clientLeft,Gn=po.top+(no.documentElement.scrollTop||Mn.scrollTop)-no.documentElement.clientTo
2024-08-27 12:25:42 +03:00
Actual: `+qo.join(","));if(!gc(Vn,bs=>Zs(qo,bs)))throw new Error("Not all branches were specified when using match. Specified: "+qo.join(", ")+`
2024-08-30 13:38:34 +03:00
Required: `+Vn.join(", "));return Qo[ao].apply(null,vo)},log:Qo=>{console.log(Qo,{constructors:Vn,constructor:ao,params:vo})}}}}),Wn}};Qg.generate([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const Zr=Mn=>{const Vn=[],Wn=[];return fs(Mn,jn=>{jn.fold(Gn=>{Vn.push(Gn)},Gn=>{Wn.push(Gn)})}),{errors:Vn,values:Wn}},LS=Mn=>Mn.type==="inline-command"||Mn.type==="inline-format",Of=Mn=>Mn.type==="block-command"||Mn.type==="block-format",IS=Mn=>{const Vn=jn=>ym.error({message:jn,pattern:Mn}),Wn=(jn,Gn,no)=>{if(Mn.format!==void 0){let ao;if(Ko(Mn.format)){if(!gc(Mn.format,xo))return Vn(jn+" pattern has non-string items in the `format` array");ao=Mn.format}else if(xo(Mn.format))ao=[Mn.format];else return Vn(jn+" pattern has non-string `format` parameter");return ym.value(Gn(ao))}else return Mn.cmd!==void 0?xo(Mn.cmd)?ym.value(no(Mn.cmd,Mn.value)):Vn(jn+" pattern has non-string `cmd` parameter"):Vn(jn+" pattern is missing both `format` and `cmd` parameters")};if(!Io(Mn))return Vn("Raw pattern is not an object");if(!xo(Mn.start))return Vn("Raw pattern is missing `start` parameter");if(Mn.end!==void 0){if(!xo(Mn.end))return Vn("Inline pattern has non-string `end` parameter");if(Mn.start.length===0&&Mn.end.length===0)return Vn("Inline pattern has empty `start` and `end` parameters");let jn=Mn.start,Gn=Mn.end;return Gn.length===0&&(Gn=jn,jn=""),Wn("Inline",no=>({type:"inline-format",start:jn,end:Gn,format:no}),(no,ao)=>({type:"inline-command",start:jn,end:Gn,cmd:no,value:ao}))}else return Mn.replacement!==void 0?xo(Mn.replacement)?Mn.start.length===0?Vn("Replacement pattern has empty `start` parameter"):ym.value({type:"inline-command",start:"",end:Mn.start,cmd:"mceInsertContent",value:Mn.replacement}):Vn("Replacement pattern has non-string `replacement` parameter"):Mn.start.length===0?Vn("Block pattern has empty `start` parameter"):Wn("Block",jn=>({type:"block-format",start:Mn.start,format:jn[0]}),(jn,Gn)=>({type:"block-command",start:Mn.start,cmd:jn,value:Gn}))},Ub=Mn=>nr(Mn,Of),Jy=Mn=>nr(Mn,LS),Om=(Mn,Vn)=>({inlinePatterns:Jy(Mn),blockPatterns:Ub(Mn),dynamicPatternsLookup:Vn}),TC=Mn=>{const Vn=Zr(Us(Mn,IS));return fs(Vn.errors,Wn=>console.error(Wn.message,Wn.pattern)),Vn.values},eO=Mn=>Vn=>{const Wn=Mn(Vn);return TC(Wn)},Cd=xl().deviceType,Vg=Cd.isTouch(),tO=Eu.DOM,h1=Mn=>{const Vn=Mn.indexOf("=")>0?Mn.split(/[;,](?![^=;,]*(?:[;,]|$))/):Mn.split(",");return ra(Vn,(Wn,jn)=>{const Gn=jn.split("="),no=Gn[0],ao=Gn.length>1?Gn[1]:no;return Wn[ih(no)]=ih(ao),Wn},{})},dg=Mn=>Do(Mn,RegExp),ma=Mn=>Vn=>Vn.options.get(Mn),ip=Mn=>xo(Mn)||Io(Mn),BS=(Mn,Vn="")=>Wn=>{const jn=xo(Wn);if(jn)if(Wn.indexOf("=")!==-1){const Gn=h1(Wn);return{value:Ma(Gn,Mn.id).getOr(Vn),valid:jn}}else return{value:Wn,valid:jn};else return{valid:!1,message:"Must be a string."}},m1=Mn=>{const Vn=Mn.options.register;Vn("id",{processor:"string",default:Mn.id}),Vn("selector",{processor:"string"}),Vn("target",{processor:"object"}),Vn("suffix",{processor:"string"}),Vn("cache_suffix",{processor:"string"}),Vn("base_url",{processor:"string"}),Vn("referrer_policy",{processor:"string",default:""}),Vn("language_load",{processor:"boolean",default:!0}),Vn("inline",{processor:"boolean",default:!1}),Vn("iframe_attrs",{processor:"object",default:{}}),Vn("doctype",{processor:"string",default:"<!DOCTYPE html>"}),Vn("document_base_url",{processor:"string",default:Mn.documentBaseUrl}),Vn("body_id",{processor:BS(Mn,"tinymce"),default:"tinymce"}),Vn("body_class",{processor:BS(Mn),default:""}),Vn("content_security_policy",{processor:"string",default:""}),Vn("br_in_pre",{processor:"boolean",default:!0}),Vn("forced_root_block",{processor:Wn=>{const jn=xo(Wn)&&fc(Wn);return jn?{value:Wn,valid:jn}:{valid:!1,message:"Must be a non-empty string."}},default:"p"}),Vn("forced_root_block_attrs",{processor:"object",default:{}}),Vn("newline_behavior",{processor:Wn=>{const jn=Zs(["block","linebreak","invert","default"],Wn);return jn?{value:Wn,valid:jn}:{valid:!1,message:"Must be one of: block, linebreak, invert or defau
\r \v`.indexOf(Mn)!==-1,uy=Mn=>!k_(Mn)&&!ok(Mn)&&!hd(Mn),sk=Mn=>{const Vn=[];if(Mn)for(let Wn=0;Wn<Mn.rangeCount;Wn++)Vn.push(Mn.getRangeAt(Wn));return Vn},rk=Mn=>cc(Mn,Vn=>{const Wn=jv(Vn);return Wn?[Cs.fromDom(Wn)]:[]}),dO=Mn=>sk(Mn).length>1,y3=Mn=>nr(rk(Mn),Eh),QT=Mn=>mf(Mn,"td[data-mce-selected],th[data-mce-selected]"),O3=(Mn,Vn)=>{const Wn=QT(Vn);return Wn.length>0?Wn:y3(Mn)},x_=Mn=>O3(sk(Mn.selection.getSel()),Cs.fromDom(Mn.getBody())),q0=(Mn,Vn)=>lm(Mn,"table",Vn),_3=Mn=>{const Vn=Mn.startContainer,Wn=Mn.startOffset;return Ir(Vn)?Wn===0?zo.some(Cs.fromDom(Vn)):zo.none():zo.from(Vn.childNodes[Wn]).map(Cs.fromDom)},S3=Mn=>{const Vn=Mn.endContainer,Wn=Mn.endOffset;return Ir(Vn)?Wn===Vn.data.length?zo.some(Cs.fromDom(Vn)):zo.none():zo.from(Vn.childNodes[Wn-1]).map(Cs.fromDom)},VT=Mn=>iu(Mn).fold(xs([Mn]),Vn=>[Mn].concat(VT(Vn))),Cx=Mn=>am(Mn).fold(xs([Mn]),Vn=>ql(Vn)==="br"?_d(Vn).map(Wn=>[Mn].concat(Cx(Wn))).getOr([]):[Mn].concat(Cx(Vn))),kx=(Mn,Vn)=>jc(_3(Vn),S3(Vn),(Wn,jn)=>{const Gn=xa(VT(Mn),ws(Vs,Wn)),no=xa(Cx(Mn),ws(Vs,jn));return Gn.isSome()&&no.isSome()}).getOr(!1),xx=(Mn,Vn,Wn,jn)=>{const Gn=Wn,no=new mu(Wn,Gn),ao=pr(Mn.schema.getMoveCaretBeforeOnEnterElements(),(vo,Ao)=>!Zs(["td","th","table"],Ao.toLowerCase()));let po=Wn;do{if(Ir(po)&&Lr.trim(po.data).length!==0){jn?Vn.setStart(po,0):Vn.setEnd(po,po.data.length);return}if(ao[po.nodeName]){jn?Vn.setStartBefore(po):po.nodeName==="BR"?Vn.setEndBefore(po):Vn.setEndAfter(po);return}}while(po=jn?no.next():no.prev());Gn.nodeName==="BODY"&&(jn?Vn.setStart(Gn,0):Vn.setEnd(Gn,Gn.childNodes.length))},ik=Mn=>{const Vn=Mn.selection.getSel();return rs(Vn)&&Vn.rangeCount>0},dy=(Mn,Vn)=>{const Wn=x_(Mn);Wn.length>0?fs(Wn,jn=>{const Gn=jn.dom,no=Mn.dom.createRng();no.setStartBefore(Gn),no.setEndAfter(Gn),Vn(no,!0)}):Vn(Mn.selection.getRng(),!1)},zT=(Mn,Vn,Wn)=>{const jn=f1(Mn,Vn);Wn(jn),Mn.moveToBookmark(jn)},uw=Mn=>Ys(Mn==null?void 0:Mn.nodeType),Ex=Mn=>Oa(Mn)&&!hg(Mn)&&!fg(Mn)&&!Jm(Mn),w3=(Mn,Vn)=>{if(Ex(Vn)&&!/^(TD|TH)$/.test(Vn.nodeName)){const Wn=Mn.getAttrib(Vn,"data-mce-selected"),jn=parseInt(Wn,10);return!isNaN(jn)&&jn>0}else return!1},dw=(Mn,Vn,Wn)=>{const{selection:jn,dom:Gn}=Mn,no=jn.getNode(),ao=jl(no);zT(jn,!0,()=>{Vn()}),ao&&jl(no)&&Gn.isChildOf(no,Mn.getBody())?Mn.selection.select(no):Wn(jn.getStart())&&C3(Gn,jn)},C3=(Mn,Vn)=>{var Wn,jn;const Gn=Vn.getRng(),{startContainer:no,startOffset:ao}=Gn,po=Vn.getNode();if(!w3(Mn,po)&&Oa(no)){const vo=no.childNodes,Ao=Mn.getRoot();let Fo;if(ao<vo.length){const Qo=vo[ao];Fo=new mu(Qo,(Wn=Mn.getParent(Qo,Mn.isBlock))!==null&&Wn!==void 0?Wn:Ao)}else{const Qo=vo[vo.length-1];Fo=new mu(Qo,(jn=Mn.getParent(Qo,Mn.isBlock))!==null&&jn!==void 0?jn:Ao),Fo.next(!0)}for(let Qo=Fo.current();Qo;Qo=Fo.next()){if(Mn.getContentEditable(Qo)==="false")return;if(Ir(Qo)&&!sf(Qo)){Gn.setStart(Qo,0),Vn.setRng(Gn);return}}}},da=(Mn,Vn,Wn)=>{if(Mn){const jn=Vn?"nextSibling":"previousSibling";for(Mn=Mn[jn];Mn;Mn=Mn[jn])if(Oa(Mn)||!sf(Mn))return Mn}},Nf=(Mn,Vn)=>!!Mn.getTextBlockElements()[Vn.nodeName.toLowerCase()]||Wl(Mn,Vn),j0=(Mn,Vn,Wn)=>Mn.schema.isValidChild(Vn,Wn),sf=(Mn,Vn=!1)=>{if(rs(Mn)&&Ir(Mn)){const Wn=Vn?Mn.data.replace(/ /g," "):Mn.data;return Q1(Wn)}else return!1},Wg=Mn=>rs(Mn)&&Ir(Mn)&&Mn.length===0,ak=(Mn,Vn)=>{const Wn="[data-mce-cef-wrappable]",jn=zg(Mn),Gn=Td(jn)?Wn:`${Wn},${jn}`;return zh(Cs.fromDom(Vn),Gn)},fw=(Mn,Vn)=>{const Wn=Mn.dom;return Ex(Vn)&&Wn.getContentEditable(Vn)==="false"&&ak(Mn,Vn)&&Wn.select('[contenteditable="true"]',Vn).length===0},fb=(Mn,Vn)=>Yo(Mn)?Mn(Vn):(rs(Vn)&&(Mn=Mn.replace(/%(\w+)/g,(Wn,jn)=>Vn[jn]||Wn)),Mn),lk=(Mn,Vn)=>(Mn=Mn||"",Vn=Vn||"",Mn=""+(Mn.nodeName||Mn),Vn=""+(Vn.nodeName||Vn),Mn.toLowerCase()===Vn.toLowerCase()),ck=(Mn,Vn)=>{if(ps(Mn))return null;{let Wn=String(Mn);return(Vn==="color"||Vn==="backgroundColor")&&(Wn=Bm(Wn)),Vn==="fontWeight"&&Mn===700&&(Wn="bold"),Vn==="fontFamily"&&(Wn=Wn.replace(/[\'\"]/g,"").replace(/,\s+/g,",")),Wn}},E_=(Mn,Vn,Wn)=>{const jn=Mn.getStyle(Vn,Wn);return ck(jn,Wn)},WT=(Mn,Vn)=>{let Wn;return Mn.getParent(Vn,jn=>Oa(jn)?(Wn=Mn.getStyle(jn,"text-decorati
2024-08-27 12:25:42 +03:00
]*|<br \\/>[\r
]*)$`);return Vn.replace(jn,"")},BY=(Mn,Vn)=>{const Wn=Mn.getDoc(),jn=Wf(Cs.fromDom(Mn.getBody())),Gn=Cs.fromTag("div",Wn);Gc(Gn,"data-mce-bogus","all"),ff(Gn,{position:"fixed",left:"-9999999px",top:"0"}),dm(Gn,Vn.innerHTML),Rl(Gn),eR(Gn);const no=Ny(jn);Fu(no,Gn);const ao=Xo(Gn.dom.innerText);return sc(Gn),ao},XH=(Mn,Vn,Wn)=>{let jn;return Vn.format==="raw"?jn=Lr.trim(Xo(sL(Wn,Mn.serializer.getTempAttrs()).innerHTML)):Vn.format==="text"?jn=BY(Mn,Wn):Vn.format==="tree"?jn=Mn.serializer.serialize(Wn,Vn):jn=IY(Mn,Mn.serializer.serialize(Wn,Vn)),Vn.format!=="text"&&!Xd(Cs.fromDom(Wn))&&xo(jn)?Lr.trim(jn):jn},FY=(Mn,Vn)=>zo.from(Mn.getBody()).fold(xs(Vn.format==="tree"?new fp("body",11):""),Wn=>XH(Mn,Vn,Wn)),YH=Lr.makeMap,rL=Mn=>{const Vn=[];Mn=Mn||{};const Wn=Mn.indent,jn=YH(Mn.indent_before||""),Gn=YH(Mn.indent_after||""),no=P0.getEncodeFunc(Mn.entity_encoding||"raw",Mn.entities),ao=Mn.element_format!=="xhtml";return{start:(po,vo,Ao)=>{if(Wn&&jn[po]&&Vn.length>0){const Fo=Vn[Vn.length-1];Fo.length>0&&Fo!==`
`&&Vn.push(`
`)}if(Vn.push("<",po),vo)for(let Fo=0,Qo=vo.length;Fo<Qo;Fo++){const qo=vo[Fo];Vn.push(" ",qo.name,'="',no(qo.value,!0),'"')}if(!Ao||ao?Vn[Vn.length]=">":Vn[Vn.length]=" />",Ao&&Wn&&Gn[po]&&Vn.length>0){const Fo=Vn[Vn.length-1];Fo.length>0&&Fo!==`
`&&Vn.push(`
`)}},end:po=>{let vo;Vn.push("</",po,">"),Wn&&Gn[po]&&Vn.length>0&&(vo=Vn[Vn.length-1],vo.length>0&&vo!==`
`&&Vn.push(`
`))},text:(po,vo)=>{po.length>0&&(Vn[Vn.length]=vo?po:no(po))},cdata:po=>{Vn.push("<![CDATA[",po,"]]>")},comment:po=>{Vn.push("<!--",po,"-->")},pi:(po,vo)=>{vo?Vn.push("<?",po," ",no(vo),"?>"):Vn.push("<?",po,"?>"),Wn&&Vn.push(`
`)},doctype:po=>{Vn.push("<!DOCTYPE",po,">",Wn?`
`:"")},reset:()=>{Vn.length=0},getContent:()=>Vn.join("").replace(/\n$/,"")}},I_=(Mn={},Vn=i1())=>{const Wn=rL(Mn);return Mn.validate="validate"in Mn?Mn.validate:!0,{serialize:Gn=>{const no=Mn.validate,ao={3:vo=>{var Ao;Wn.text((Ao=vo.value)!==null&&Ao!==void 0?Ao:"",vo.raw)},8:vo=>{var Ao;Wn.comment((Ao=vo.value)!==null&&Ao!==void 0?Ao:"")},7:vo=>{Wn.pi(vo.name,vo.value)},10:vo=>{var Ao;Wn.doctype((Ao=vo.value)!==null&&Ao!==void 0?Ao:"")},4:vo=>{var Ao;Wn.cdata((Ao=vo.value)!==null&&Ao!==void 0?Ao:"")},11:vo=>{let Ao=vo;if(Ao=Ao.firstChild)do po(Ao);while(Ao=Ao.next)}};Wn.reset();const po=vo=>{var Ao;const Fo=ao[vo.type];if(Fo)Fo(vo);else{const Qo=vo.name,qo=Qo in Vn.getVoidElements();let ds=vo.attributes;if(no&&ds&&ds.length>1){const bs=[];bs.map={};const as=Vn.getElementRule(vo.name);if(as){for(let ys=0,Ls=as.attributesOrder.length;ys<Ls;ys++){const zs=as.attributesOrder[ys];if(zs in ds.map){const Hs=ds.map[zs];bs.map[zs]=Hs,bs.push({name:zs,value:Hs})}}for(let ys=0,Ls=ds.length;ys<Ls;ys++){const zs=ds[ys].name;if(!(zs in bs.map)){const Hs=ds.map[zs];bs.map[zs]=Hs,bs.push({name:zs,value:Hs})}}ds=bs}}if(Wn.start(Qo,ds,qo),ng(Qo))xo(vo.value)&&Wn.text(vo.value,!0),Wn.end(Qo);else if(!qo){let bs=vo.firstChild;if(bs){(Qo==="pre"||Qo==="textarea")&&bs.type===3&&((Ao=bs.value)===null||Ao===void 0?void 0:Ao[0])===`
`&&Wn.text(`
2024-08-30 13:38:34 +03:00
`,!0);do po(bs);while(bs=bs.next)}Wn.end(Qo)}}};return Gn.type===1&&!Mn.inner?po(Gn):Gn.type===3?ao[3](Gn):ao[11](Gn),Wn.getContent()}}},ol=new Set;fs(["margin","margin-left","margin-right","margin-top","margin-bottom","padding","padding-left","padding-right","padding-top","padding-bottom","border","border-width","border-style","border-color","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","float","position","left","right","top","bottom","z-index","display","transform","width","max-width","min-width","height","max-height","min-height","overflow","overflow-x","overflow-y","text-overflow","vertical-align","transition","transition-delay","transition-duration","transition-property","transition-timing-function"],Vn=>{ol.add(Vn)});const iL=["font","text-decoration","text-emphasis"],tR=(Mn,Vn)=>Al(Mn.parseStyle(Mn.getAttrib(Vn,"style"))),GH=Mn=>ol.has(Mn),qx=(Mn,Vn)=>gc(tR(Mn,Vn),Wn=>!GH(Wn)),aL=Mn=>nr(Mn,Vn=>Sr(iL,Wn=>Dc(Vn,Wn))),KH=(Mn,Vn,Wn)=>{const jn=tR(Mn,Vn),Gn=tR(Mn,Wn),no=ao=>{var po,vo;const Ao=(po=Mn.getStyle(Vn,ao))!==null&&po!==void 0?po:"",Fo=(vo=Mn.getStyle(Wn,ao))!==null&&vo!==void 0?vo:"";return fc(Ao)&&fc(Fo)&&Ao!==Fo};return Sr(jn,ao=>{const po=vo=>Sr(vo,Ao=>Ao===ao);if(!po(Gn)&&po(iL)){const vo=aL(Gn);return Sr(vo,no)}else return no(ao)})},lL=(Mn,Vn,Wn)=>zo.from(Wn.container()).filter(Ir).exists(jn=>{const Gn=Mn?0:-1;return Vn(jn.data.charAt(Wn.offset()+Gn))}),nR=ws(lL,!0,k_),OA=ws(lL,!1,k_),JH=Mn=>{const Vn=Mn.container();return Ir(Vn)&&(Vn.data.length===0||Po(Vn.data)&&fO.isBookmarkNode(Vn.parentNode))},Aw=(Mn,Vn)=>Wn=>ua(Mn?0:-1,Wn).filter(Vn).isSome(),e9=Mn=>td(Mn)&&Ju(Cs.fromDom(Mn),"display")==="block",cL=Mn=>jl(Mn)&&!_v(Mn),t9=Aw(!0,e9),n9=Aw(!1,e9),jx=Aw(!0,pu),wk=Aw(!1,pu),uL=Aw(!0,Gp),Ql=Aw(!1,Gp),bO=Aw(!0,cL),tv=Aw(!1,cL),dL=Mn=>Mn.slice(0,-1),fL=(Mn,Vn,Wn)=>Dr(Vn,Mn)?dL(D1(Mn,jn=>Wn(jn)||Vs(jn,Vn))):[],oR=(Mn,Vn)=>fL(Mn,Vn,hs),py=(Mn,Vn)=>[Mn].concat(oR(Mn,Vn)),_A=(Mn,Vn,Wn)=>g1(Mn,Vn,Wn,JH),o9=Mn=>Vn=>Mn.isBlock(ql(Vn)),sR=(Mn,Vn,Wn)=>xa(py(Cs.fromDom(Vn.container()),Mn),o9(Wn)),hL=(Mn,Vn,Wn,jn)=>_A(Mn,Vn.dom,Wn).forall(Gn=>sR(Vn,Wn,jn).fold(()=>!jr(Gn,Wn,Vn.dom),no=>!jr(Gn,Wn,Vn.dom)&&Dr(no,Cs.fromDom(Gn.container())))),mL=(Mn,Vn,Wn,jn)=>sR(Vn,Wn,jn).fold(()=>_A(Mn,Vn.dom,Wn).forall(Gn=>!jr(Gn,Wn,Vn.dom)),Gn=>_A(Mn,Gn.dom,Wn).isNone()),rR=ws(mL,!1),pL=ws(mL,!0),s9=ws(hL,!1),r9=ws(hL,!0),i9=Mn=>Mh(Mn).exists(np),SA=(Mn,Vn,Wn,jn)=>{const Gn=nr(py(Cs.fromDom(Wn.container()),Vn),ao=>jn.isBlock(ql(ao))),no=qa(Gn).getOr(Vn);return vh(Mn,no.dom,Wn).filter(i9)},Xx=(Mn,Vn,Wn)=>Mh(Vn).exists(np)||SA(!0,Mn,Vn,Wn).isSome(),Yx=(Mn,Vn,Wn)=>Rp(Vn).exists(np)||SA(!1,Mn,Vn,Wn).isSome(),a9=ws(SA,!1),l9=ws(SA,!0),gL=Mn=>lr.isTextPosition(Mn)&&!Mn.isAtStart()&&!Mn.isAtEnd(),bL=(Mn,Vn,Wn)=>{const jn=nr(py(Cs.fromDom(Vn.container()),Mn),Gn=>Wn.isBlock(ql(Gn)));return qa(jn).getOr(Mn)},vL=(Mn,Vn,Wn)=>gL(Vn)?OA(Vn):OA(Vn)||cp(bL(Mn,Vn,Wn).dom,Vn).exists(OA),yL=(Mn,Vn,Wn)=>gL(Vn)?nR(Vn):nR(Vn)||Sm(bL(Mn,Vn,Wn).dom,Vn).exists(nR),c9=Mn=>Zs(["pre","pre-wrap"],Mn),iR=Mn=>Mh(Mn).bind(Vn=>cf(Vn,lf)).exists(Vn=>c9(Ju(Vn,"white-space"))),OL=(Mn,Vn)=>cp(Mn.dom,Vn).isNone(),u9=(Mn,Vn)=>Sm(Mn.dom,Vn).isNone(),d9=(Mn,Vn,Wn)=>OL(Mn,Vn)||u9(Mn,Vn)||rR(Mn,Vn,Wn)||pL(Mn,Vn,Wn)||Yx(Mn,Vn,Wn)||Xx(Mn,Vn,Wn),Pw=Mn=>rs(Mn)&&jl(Mn)&&Yb(Mn),_L=(Mn,Vn)=>Wn=>Pw(new mu(Wn,Mn)[Vn]()),SL=(Mn,Vn)=>{const Wn=Sm(Mn.dom,Vn).getOr(Vn),jn=_L(Mn.dom,"next");return Vn.isAtEnd()&&(jn(Vn.container())||jn(Wn.container()))},f9=(Mn,Vn)=>{const Wn=cp(Mn.dom,Vn).getOr(Vn),jn=_L(Mn.dom,"prev");return Vn.isAtStart()&&(jn(Vn.container())||jn(Wn.container()))},wL=(Mn,Vn,Wn)=>iR(Vn)?!1:d9(Mn,Vn,Wn)||vL(Mn,Vn,Wn)||yL(Mn,Vn,Wn),Ck=(Mn,Vn,Wn)=>iR(Vn)?!1:rR(Mn,Vn,Wn)||s9(Mn,Vn,Wn)||Yx(Mn,Vn,Wn)||vL(Mn,Vn,Wn)||f9(Mn,Vn),CL=Mn=>{const Vn=Mn.container(),Wn=Mn.offset();return Ir(Vn)&&Wn<Vn.data.length?lr(Vn,Wn+1):Mn},kk=(Mn,Vn,Wn)=>iR(Vn)?!1:pL(Mn,Vn,Wn)||r9(Mn,Vn,Wn)||Xx(Mn,Vn,Wn)||yL(Mn,Vn,Wn)||SL(Mn,Vn),wA=(Mn,Vn,Wn)=>Ck(Mn,Vn,Wn)||kk(Mn,CL(Vn),W
`+_h),du&&(_h=r0(_h,wa," "),_h=r0(_h,Va," "),_h=r0(_h,Tl," ")),Hs&&Sl?Hs.createHTML(_h):_h},Vn.setConfig=function(ec){ST(ec),h0=!0},Vn.clearConfig=function(){cS=null,h0=!1},Vn.isValidAttribute=function(ec,hr,Da){cS||ST({});const sl=xm(ec),af=xm(hr);return kN(sl,af,Da)},Vn.addHook=function(ec,hr){typeof hr=="function"&&(Ar[ec]=Ar[ec]||[],Sy(Ar[ec],hr))},Vn.removeHook=function(ec){if(Ar[ec])return Hk(Ar[ec])},Vn.removeHooks=function(ec){Ar[ec]&&(Ar[ec]=[])},Vn.removeAllHooks=function(){Ar={}},Vn}var oI=OE();const sI=Lr.each,Q_=Lr.trim,bD=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],rI={ftp:21,http:80,https:443,mailto:25},_E=["img","video"],iI=(Mn,Vn)=>rs(Mn)?!Mn:rs(Vn)?!Zs(_E,Vn):!0,vD=Mn=>{try{return decodeURIComponent(Mn)}catch{return unescape(Mn)}},yD=(Mn,Vn,Wn)=>{const jn=vD(Vn).replace(/\s/g,"");return Mn.allow_script_urls?!1:/((java|vb)script|mhtml):/i.test(jn)?!0:Mn.allow_html_data_urls?!1:/^data:image\//i.test(jn)?iI(Mn.allow_svg_data_urls,Wn)&&/^data:image\/svg\+xml/i.test(jn):/^data:/i.test(jn)};class bb{static parseDataUri(Vn){let Wn;const jn=decodeURIComponent(Vn).split(","),Gn=/data:([^;]+)/.exec(jn[0]);return Gn&&(Wn=Gn[1]),{type:Wn,data:jn[1]}}static isDomSafe(Vn,Wn,jn={}){if(jn.allow_script_urls)return!0;{const Gn=P0.decode(Vn).replace(/[\s\u0000-\u001F]+/g,"");return!yD(jn,Gn,Wn)}}static getDocumentBaseUrl(Vn){var Wn;let jn;return Vn.protocol.indexOf("http")!==0&&Vn.protocol!=="file:"?jn=(Wn=Vn.href)!==null&&Wn!==void 0?Wn:"":jn=Vn.protocol+"//"+Vn.host+Vn.pathname,/^[^:]+:\/\/\/?[^\/]+\//.test(jn)&&(jn=jn.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(jn)||(jn+="/")),jn}constructor(Vn,Wn={}){this.path="",this.directory="",Vn=Q_(Vn),this.settings=Wn;const jn=Wn.base_uri,Gn=this;if(/^([\w\-]+):([^\/]{2})/i.test(Vn)||/^\s*#/.test(Vn)){Gn.source=Vn;return}const no=Vn.indexOf("//")===0;if(Vn.indexOf("/")===0&&!no&&(Vn=(jn&&jn.protocol||"http")+"://mce_host"+Vn),!/^[\w\-]*:?\/\//.test(Vn)){const po=jn?jn.path:new bb(document.location.href).directory;if((jn==null?void 0:jn.protocol)==="")Vn="//mce_host"+Gn.toAbsPath(po,Vn);else{const vo=/([^#?]*)([#?]?.*)/.exec(Vn);vo&&(Vn=(jn&&jn.protocol||"http")+"://mce_host"+Gn.toAbsPath(po,vo[1])+vo[2])}}Vn=Vn.replace(/@@/g,"(mce_at)");const ao=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?(\[[a-zA-Z0-9:.%]+\]|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(Vn);ao&&sI(bD,(po,vo)=>{let Ao=ao[vo];Ao&&(Ao=Ao.replace(/\(mce_at\)/g,"@@")),Gn[po]=Ao}),jn&&(Gn.protocol||(Gn.protocol=jn.protocol),Gn.userInfo||(Gn.userInfo=jn.userInfo),!Gn.port&&Gn.host==="mce_host"&&(Gn.port=jn.port),(!Gn.host||Gn.host==="mce_host")&&(Gn.host=jn.host),Gn.source=""),no&&(Gn.protocol="")}setPath(Vn){const Wn=/^(.*?)\/?(\w+)?$/.exec(Vn);Wn&&(this.path=Wn[0],this.directory=Wn[1],this.file=Wn[2]),this.source="",this.getURI()}toRelative(Vn){if(Vn==="./")return Vn;const Wn=new bb(Vn,{base_uri:this});if(Wn.host!=="mce_host"&&this.host!==Wn.host&&Wn.host||this.port!==Wn.port||this.protocol!==Wn.protocol&&Wn.protocol!=="")return Wn.getURI();const jn=this.getURI(),Gn=Wn.getURI();if(jn===Gn||jn.charAt(jn.length-1)==="/"&&jn.substr(0,jn.length-1)===Gn)return jn;let no=this.toRelPath(this.path,Wn.path);return Wn.query&&(no+="?"+Wn.query),Wn.anchor&&(no+="#"+Wn.anchor),no}toAbsolute(Vn,Wn){const jn=new bb(Vn,{base_uri:this});return jn.getURI(Wn&&this.isSameOrigin(jn))}isSameOrigin(Vn){if(this.host==Vn.host&&this.protocol==Vn.protocol){if(this.port==Vn.port)return!0;const Wn=this.protocol?rI[this.protocol]:null;if(Wn&&(this.port||Wn)==(Vn.port||Wn))return!0}return!1}toRelPath(Vn,Wn){let jn=0,Gn="",no,ao;const po=Vn.substring(0,Vn.lastIndexOf("/")).split("/"),vo=Wn.split("/");if(po.length>=vo.length){for(no=0,ao=po.length;no<ao;no++)if(no>=vo.length||po[no]!==vo[no]){jn=no+1;break}}if(po.length<vo.length){for(no=0,ao=vo.length;no<ao;no++)if(no>=po.length||po[no]!==vo[no]){jn=no+1;break}}if(jn===1)return Wn;f
2024-08-27 12:25:42 +03:00
`).replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*((<!--)?(\s*\/\/)?\s*<!\[CDATA\[|(<!--\s*)?\/\*\s*<!\[CDATA\[\s*\*\/|(\/\/)?\s*<!--|\/\*\s*<!--\s*\*\/)\s*[\r\n]*/gi,"").replace(/\s*(\/\*\s*\]\]>\s*\*\/(-->)?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"");let po=jn.length;for(;po--;){const vo=jn[po],Ao=vo.firstChild,Fo=(no=Ao==null?void 0:Ao.value)!==null&&no!==void 0?no:"";if(Gn==="script"){const Qo=vo.attr("type");Qo&&vo.attr("type",Qo==="mce-no/type"?null:Qo.replace(/^mce\-/,"")),Vn.element_format==="xhtml"&&Ao&&Fo.length>0&&(Ao.value=`// <![CDATA[
`+ao(Fo)+`
// ]]>`)}else Vn.element_format==="xhtml"&&Ao&&Fo.length>0&&(Ao.value=`<!--
`+ao(Fo)+`
-->`)}}),Mn.addNodeFilter("#comment",jn=>{let Gn=jn.length;for(;Gn--;){const no=jn[Gn],ao=no.value;Vn.preserve_cdata&&(ao==null?void 0:ao.indexOf("[CDATA["))===0?(no.name="#cdata",no.type=4,no.value=Wn.decode(ao.replace(/^\[CDATA\[|\]\]$/g,""))):(ao==null?void 0:ao.indexOf("mce:protected "))===0&&(no.name="#text",no.type=3,no.raw=!0,no.value=unescape(ao).substr(14))}}),Mn.addNodeFilter("xml:namespace,input",(jn,Gn)=>{let no=jn.length;for(;no--;){const ao=jn[no];ao.type===7?ao.remove():ao.type===1&&Gn==="input"&&!ao.attr("type")&&ao.attr("type","text")}}),Mn.addAttributeFilter("data-mce-type",jn=>{fs(jn,Gn=>{Gn.attr("data-mce-type")==="format-caret"&&(Gn.isEmpty(Mn.schema.getNonEmptyElements())?Gn.remove():Gn.unwrap())})}),Mn.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style,data-mce-selected,data-mce-expando,data-mce-block,data-mce-type,data-mce-resize,data-mce-placeholder",(jn,Gn)=>{let no=jn.length;for(;no--;)jn[no].attr(Gn,null)}),Vn.remove_trailing_brs&&lD(Vn,Mn,Mn.schema)},xE=Mn=>{const Vn=jn=>(jn==null?void 0:jn.name)==="br",Wn=Mn.lastChild;if(Vn(Wn)){const jn=Wn.prev;Vn(jn)&&(Wn.remove(),jn.remove())}},FI=(Mn,Vn,Wn)=>{let jn;const Gn=Mn.dom;let no=Vn.cloneNode(!0);const ao=document.implementation;if(ao.createHTMLDocument){const po=ao.createHTMLDocument("");Lr.each(no.nodeName==="BODY"?no.childNodes:[no],vo=>{po.body.appendChild(po.importNode(vo,!0))}),no.nodeName!=="BODY"?no=po.body.firstChild:no=po.body,jn=Gn.doc,Gn.doc=po}return Nx(Mn,{...Wn,node:no}),jn&&(Gn.doc=jn),no},HI=(Mn,Vn)=>rs(Mn)&&Mn.hasEventListeners("PreProcess")&&!Vn.no_events,NV=(Mn,Vn,Wn)=>HI(Mn,Wn)?FI(Mn,Vn,Wn):Vn,QI=(Mn,Vn,Wn)=>{Lr.inArray(Vn,Wn)===-1&&(Mn.addAttributeFilter(Wn,(jn,Gn)=>{let no=jn.length;for(;no--;)jn[no].attr(Gn,null)}),Vn.push(Wn))},LV=(Mn,Vn,Wn)=>!Vn.no_events&&Mn?E3(Mn,{...Vn,content:Wn}).content:Wn,IV=(Mn,Vn,Wn)=>{const jn=Xo(Wn.getInner?Vn.innerHTML:Mn.getOuterHTML(Vn));return Wn.selection||Xd(Cs.fromDom(Vn))?jn:Lr.trim(jn)},BV=(Mn,Vn,Wn)=>{const jn=Wn.selection?{forced_root_block:!1,...Wn}:Wn,Gn=Mn.parse(Vn,jn);return xE(Gn),Gn},FV=(Mn,Vn,Wn)=>I_(Mn,Vn).serialize(Wn),VI=(Mn,Vn,Wn,jn,Gn)=>{const no=FV(Vn,Wn,jn);return LV(Mn,Gn,no)},HV=(Mn,Vn)=>{const Wn=["data-mce-selected"],jn={entity_encoding:"named",remove_trailing_brs:!0,pad_empty_with_br:!1,...Mn},Gn=Vn&&Vn.dom?Vn.dom:Eu.DOM,no=Vn&&Vn.schema?Vn.schema:i1(jn),ao=a0(jn,no);Wk(ao,jn,Gn);const po=(vo,Ao={})=>{const Fo={format:"html",...Ao},Qo=NV(Vn,vo,Fo),qo=IV(Gn,Qo,Fo),ds=BV(ao,qo,Fo);return Fo.format==="tree"?ds:VI(Vn,jn,no,ds,Fo)};return{schema:no,addNodeFilter:ao.addNodeFilter,addAttributeFilter:ao.addAttributeFilter,serialize:po,addRules:no.addValidElements,setRules:no.setValidElements,addTempAttr:ws(QI,ao,Wn),getTempAttrs:xs(Wn),getNodeFilters:ao.getNodeFilters,getAttributeFilters:ao.getAttributeFilters,removeNodeFilter:ao.removeNodeFilter,removeAttributeFilter:ao.removeAttributeFilter}},zI=(Mn,Vn)=>{const Wn=HV(Mn,Vn);return{schema:Wn.schema,addNodeFilter:Wn.addNodeFilter,addAttributeFilter:Wn.addAttributeFilter,serialize:Wn.serialize,addRules:Wn.addRules,setRules:Wn.setRules,addTempAttr:Wn.addTempAttr,getTempAttrs:Wn.getTempAttrs,getNodeFilters:Wn.getNodeFilters,getAttributeFilters:Wn.getAttributeFilters,removeNodeFilter:Wn.removeNodeFilter,removeAttributeFilter:Wn.removeAttributeFilter}},EE="html",WI=(Mn,Vn)=>({...Mn,format:Vn,get:!0,getInner:!0}),UI=(Mn,Vn={})=>{const Wn=Vn.format?Vn.format:EE,jn=WI(Vn,Wn);return V_(Mn,jn).fold(Qr,Gn=>{const no=_V(Mn,Gn);return SD(Mn,no,Gn)})},QV="html",VV=(Mn,Vn)=>({format:QV,...Mn,set:!0,content:Vn}),ZD=(Mn,Vn,Wn={})=>{const jn=VV(Wn,Vn);return wD(Mn,jn).map(Gn=>{const no=SV(Mn,Gn.content,Gn);return iP(Mn,no.html,Gn),no.content}).getOr(Vn)},ZI="autoresize_on_init,content_editable_state,padd_empty_with_br,block_elements,boolean_attributes,editor_deselector,editor_selector,elements,file_browser_callback_types,filepicker_validator_handler,force_hex_style_colors,force_p_newlines,gecko_spellcheck,images_dataimg_filter,media_scripts,mode,move_caret_before_on_enter_elements,non_empty_elements,self_closing_elements,short
- `,vo=ao?`
Themes:${po}mobile`:"",Ao=Gn?`
Plugins:${po}${jn.join(po)}`:"",Fo=no?`
Options:${po}${Wn.join(po)}`:"";console.warn("The following deprecated features are currently enabled and have been removed in TinyMCE 6.0. These features will no longer work and should be removed from the TinyMCE configuration. See https://www.tiny.cloud/docs/tinymce/6/migration-from-5x/ for more information."+vo+Ao+Fo)}},jV=Mn=>xa(qI,Vn=>Vn.name===Mn).fold(()=>Mn,Vn=>Vn.replacedWith?`${Mn}, replaced by ${Vn.replacedWith}`:Mn),su=(Mn,Vn)=>{const Wn=rv(Mn),jn=ZV(Vn),Gn=jn.length>0,no=Wn.length>0;if(Gn||no){const ao=`
- `,po=Gn?`
Plugins:${ao}${jn.map(jV).join(ao)}`:"",vo=no?`
2024-08-30 13:38:34 +03:00
Options:${ao}${Wn.join(ao)}`:"";console.warn("The following deprecated features are currently enabled but will be removed soon."+po+vo)}},eG=(Mn,Vn)=>{qV(Mn,Vn),su(Mn,Vn)},vP=Eu.DOM,XV=Mn=>{vP.setStyle(Mn.id,"display",Mn.orgDisplay)},sd=Mn=>zo.from(Mn).each(Vn=>Vn.destroy()),YV=Mn=>{const Vn=Mn;Vn.contentAreaContainer=Vn.formElement=Vn.container=Vn.editorContainer=null,Vn.bodyElement=Vn.contentDocument=Vn.contentWindow=null,Vn.iframeElement=Vn.targetElm=null;const Wn=Mn.selection;if(Wn){const jn=Wn.dom;Vn.selection=Wn.win=Wn.dom=jn.doc=null}},TE=Mn=>{const Vn=Mn.formElement;Vn&&(Vn._mceOldSubmit&&(Vn.submit=Vn._mceOldSubmit,delete Vn._mceOldSubmit),vP.unbind(Vn,"submit reset",Mn.formEventDelegate))},GV=Mn=>{if(!Mn.removed){const{_selectionOverrides:Vn,editorUpload:Wn}=Mn,jn=Mn.getBody(),Gn=Mn.getElement();jn&&Mn.save({is_removing:!0}),Mn.removed=!0,Mn.unbindAllNativeEvents(),Mn.hasHiddenInput&&rs(Gn==null?void 0:Gn.nextSibling)&&vP.remove(Gn.nextSibling),P_(Mn),Mn.editorManager.remove(Mn),!Mn.inline&&jn&&XV(Mn),$_(Mn),vP.remove(Mn.getContainer()),sd(Vn),sd(Wn),Mn.destroy()}},KV=(Mn,Vn)=>{const{selection:Wn,dom:jn}=Mn;if(!Mn.destroyed){if(!Vn&&!Mn.removed){Mn.remove();return}Vn||(Mn.editorManager.off("beforeunload",Mn._beforeUnload),Mn.theme&&Mn.theme.destroy&&Mn.theme.destroy(),sd(Wn),sd(jn)),TE(Mn),YV(Mn),Mn.destroyed=!0}},AE=(()=>{const Mn={};return{add:(Gn,no)=>{Mn[Gn]=no},get:Gn=>Mn[Gn]?Mn[Gn]:{icons:{}},has:Gn=>Mr(Mn,Gn)}})(),yb=$h.ModelManager,vg=(Mn,Vn)=>Vn.dom[Mn],Uk=(Mn,Vn)=>parseInt(Ju(Vn,Mn),10),U_=ws(vg,"clientWidth"),Cy=ws(vg,"clientHeight"),PE=ws(Uk,"margin-top"),qD=ws(Uk,"margin-left"),jD=Mn=>Mn.dom.getBoundingClientRect(),XI=(Mn,Vn,Wn)=>{const jn=U_(Mn),Gn=Cy(Mn);return Vn>=0&&Wn>=0&&Vn<=jn&&Wn<=Gn},YI=(Mn,Vn,Wn,jn)=>{const Gn=jD(Vn),no=Mn?Gn.left+Vn.dom.clientLeft+qD(Vn):0,ao=Mn?Gn.top+Vn.dom.clientTop+PE(Vn):0,po=Wn-no,vo=jn-ao;return{x:po,y:vo}},JV=(Mn,Vn,Wn)=>{const jn=Cs.fromDom(Mn.getBody()),Gn=Mn.inline?jn:zl(jn),no=YI(Mn.inline,Gn,Vn,Wn);return XI(Gn,no.x,no.y)},ez=Mn=>zo.from(Mn).map(Cs.fromDom),GI=Mn=>{const Vn=Mn.inline?Mn.getBody():Mn.getContentAreaContainer();return ez(Vn).map(Ag).getOr(!1)};var KI=()=>{const Mn=()=>{throw new Error("Theme did not provide a NotificationManager implementation.")};return{open:Mn,close:Mn,getArgs:Mn}};const XD=Mn=>{const Vn=[],Wn=()=>{const qo=Mn.theme;return qo&&qo.getNotificationManagerImpl?qo.getNotificationManagerImpl():KI()},jn=()=>zo.from(Vn[0]),Gn=(qo,ds)=>qo.type===ds.type&&qo.text===ds.text&&!qo.progressBar&&!qo.timeout&&!ds.progressBar&&!ds.timeout,no=()=>{fs(Vn,qo=>{qo.reposition()})},ao=qo=>{Vn.push(qo)},po=qo=>{Nl(Vn,ds=>ds===qo).each(ds=>{Vn.splice(ds,1)})},vo=(qo,ds=!0)=>Mn.removed||!GI(Mn)?{}:(ds&&Mn.dispatch("BeforeOpenNotification",{notification:qo}),xa(Vn,bs=>Gn(Wn().getArgs(bs),qo)).getOrThunk(()=>{Mn.editorManager.setActive(Mn);const bs=Wn().open(qo,()=>{po(bs),no(),UN(Mn)&&jn().fold(()=>Mn.focus(),as=>lA(Cs.fromDom(as.getEl())))});return ao(bs),no(),Mn.dispatch("OpenNotification",{notification:{...bs}}),bs})),Ao=()=>{jn().each(qo=>{Wn().close(qo),po(qo),no()})},Fo=xs(Vn);return(qo=>{qo.on("SkinLoaded",()=>{const ds=K2(qo);ds&&vo({text:ds,type:"warning",timeout:0},!1),no()}),qo.on("show ResizeEditor ResizeWindow NodeChange",()=>{requestAnimationFrame(no)}),qo.on("remove",()=>{fs(Vn.slice(),ds=>{Wn().close(ds)})})})(Mn),{open:vo,close:Ao,getNotifications:Fo}},Hw=$h.PluginManager,CO=$h.ThemeManager;var nG=()=>{const Mn=()=>{throw new Error("Theme did not provide a WindowManager implementation.")};return{open:Mn,openUrl:Mn,alert:Mn,confirm:Mn,close:Mn}};const JI=Mn=>{let Vn=[];const Wn=()=>{const as=Mn.theme;return as&&as.getWindowManagerImpl?as.getWindowManagerImpl():nG()},jn=(as,ys)=>(...Ls)=>ys?ys.apply(as,Ls):void 0,Gn=as=>{Mn.dispatch("OpenWindow",{dialog:as})},no=as=>{Mn.dispatch("CloseWindow",{dialog:as})},ao=as=>{Vn.push(as),Gn(as)},po=as=>{no(as),Vn=nr(Vn,ys=>ys!==as),Vn.length===0&&Mn.focus()},vo=()=>zo.from(Vn[Vn.length-1]),Ao=as=>{Mn.editorManager.setActive(Mn),Sk(Mn),Mn.ui.show();const ys=as();return ao(ys),ys},Fo=(as,ys)=>Ao(()=>
\r \v`.indexOf(Mn)!==-1,Zw=(Mn,Vn)=>Mn.substring(Vn.length),GE=(Mn,Vn,Wn)=>{let jn;const Gn=Wn.charAt(0);for(jn=Vn-1;jn>=0;jn--){const no=Mn.charAt(jn);if(YE(no))return zo.none();if(Gn===no&&oc(Mn,Wn,jn,Vn))break}return zo.some(jn)},f0=(Mn,Vn,Wn,jn=0)=>{if(!FF(Vn))return zo.none();const Gn={text:"",offset:0},no=(po,vo,Ao)=>(Gn.text=Ao+Gn.text,Gn.offset+=vo,GE(Gn.text,Gn.offset,Wn).getOr(vo)),ao=Mn.getParent(Vn.startContainer,Mn.isBlock)||Mn.getRoot();return jE(Mn,Vn.startContainer,Vn.startOffset,no,ao).bind(po=>{const vo=Vn.cloneRange();if(vo.setStart(po.container,po.offset),vo.setEnd(Vn.endContainer,Vn.endOffset),vo.collapsed)return zo.none();const Ao=XE(vo);return Ao.lastIndexOf(Wn)!==0||Zw(Ao,Wn).length<jn?zo.none():zo.some({text:Zw(Ao,Wn),range:vo,trigger:Wn})})},s2=(Mn,Vn,Wn,jn=0)=>HH(Cs.fromDom(Vn.startContainer)).fold(()=>f0(Mn,Vn,Wn,jn),Gn=>{const no=Mn.createRng();no.selectNode(Gn.dom);const ao=XE(no);return zo.some({range:no,text:Zw(ao,Wn),trigger:Wn})}),HF=Mn=>Mn.nodeType===A1,QF=Mn=>Mn.nodeType===Hh,VF=Mn=>{if(HF(Mn))return d0(Mn,Mn.data.length);{const Vn=Mn.childNodes;return Vn.length>0?VF(Vn[Vn.length-1]):d0(Mn,Vn.length)}},GM=(Mn,Vn)=>{const Wn=Mn.childNodes;return Wn.length>0&&Vn<Wn.length?GM(Wn[Vn],0):Wn.length>0&&QF(Mn)&&Wn.length===Vn?VF(Wn[Wn.length-1]):d0(Mn,Vn)},SU=(Mn,Vn)=>{var Wn;const jn=(Wn=Mn.getParent(Vn.container,Mn.isBlock))!==null&&Wn!==void 0?Wn:Mn.getRoot();return jE(Mn,Vn.container,Vn.offset,(Gn,no)=>no===0?-1:no,jn).filter(Gn=>{const no=Gn.container.data.charAt(Gn.offset-1);return!YE(no)}).isSome()},wU=Mn=>Vn=>{const Wn=GM(Vn.startContainer,Vn.startOffset);return!SU(Mn,Wn)},KE=(Mn,Vn,Wn)=>Yl(Wn.triggers,jn=>s2(Mn,Vn,jn)),CU=(Mn,Vn)=>{const Wn=Vn(),jn=Mn.selection.getRng();return KE(Mn.dom,jn,Wn).bind(Gn=>zF(Mn,Vn,Gn))},zF=(Mn,Vn,Wn,jn={})=>{var Gn;const no=Vn(),po=(Gn=Mn.selection.getRng().startContainer.nodeValue)!==null&&Gn!==void 0?Gn:"",vo=nr(no.lookupByTrigger(Wn.trigger),Fo=>Wn.text.length>=Fo.minChars&&Fo.matches.getOrThunk(()=>wU(Mn.dom))(Wn.range,po,Wn.text));if(vo.length===0)return zo.none();const Ao=Promise.all(Us(vo,Fo=>Fo.fetch(Wn.text,Fo.maxResults,jn).then(qo=>({matchText:Wn.text,items:qo,columns:Fo.columns,onAction:Fo.onAction,highlightOn:Fo.highlightOn}))));return zo.some({lookupData:Ao,context:Wn})};var lv;(function(Mn){Mn[Mn.Error=0]="Error",Mn[Mn.Value=1]="Value"})(lv||(lv={}));const KM=(Mn,Vn,Wn)=>Mn.stype===lv.Error?Vn(Mn.serror):Wn(Mn.svalue),kU=Mn=>{const Vn=[],Wn=[];return fs(Mn,jn=>{KM(jn,Gn=>Wn.push(Gn),Gn=>Vn.push(Gn))}),{values:Vn,errors:Wn}},xU=(Mn,Vn)=>Mn.stype===lv.Error?{stype:lv.Error,serror:Vn(Mn.serror)}:Mn,EU=(Mn,Vn)=>Mn.stype===lv.Value?{stype:lv.Value,svalue:Vn(Mn.svalue)}:Mn,TU=(Mn,Vn)=>Mn.stype===lv.Value?Vn(Mn.svalue):Mn,AU=(Mn,Vn)=>Mn.stype===lv.Error?Vn(Mn.serror):Mn,WF=Mn=>({stype:lv.Value,svalue:Mn}),UF=Mn=>({stype:lv.Error,serror:Mn}),km={fromResult:Mn=>Mn.fold(UF,WF),toResult:Mn=>KM(Mn,ym.error,ym.value),svalue:WF,partition:kU,serror:UF,bind:TU,bindError:AU,map:EU,mapError:xU,fold:KM},KP=Mn=>Io(Mn)&&Al(Mn).length>100?" removed due to size":JSON.stringify(Mn,null,2),ZF=Mn=>{const Vn=Mn.length>10?Mn.slice(0,10).concat([{path:[],getErrorInfo:xs("... (only showing first ten failures)")}]):Mn;return Us(Vn,Wn=>"Failed path: ("+Wn.path.join(" > ")+`)
2024-08-27 12:25:42 +03:00
`+Wn.getErrorInfo())},JE=(Mn,Vn)=>km.serror([{path:Mn,getErrorInfo:Vn}]),PU=(Mn,Vn,Wn)=>JE(Mn,()=>'Could not find valid *required* value for "'+Vn+'" in '+KP(Wn)),$U=(Mn,Vn)=>JE(Mn,()=>'Choice schema did not contain choice key: "'+Vn+'"'),RU=(Mn,Vn,Wn)=>JE(Mn,()=>'The chosen schema: "'+Wn+'" did not exist in branches: '+KP(Vn)),DU=(Mn,Vn)=>JE(Mn,xs(Vn)),qF=(Mn,Vn,Wn,jn)=>Ma(Wn,jn).fold(()=>RU(Mn,Wn,jn),no=>no.extract(Mn.concat(["branch: "+jn]),Vn)),MU=(Mn,Vn)=>({extract:(Gn,no)=>Ma(no,Mn).fold(()=>$U(Gn,Mn),po=>qF(Gn,no,Vn,po)),toString:()=>"chooseOn("+Mn+"). Possible values: "+Al(Vn)}),jF=(Mn,Vn)=>Vn,NU=(Mn,Vn)=>Vo(Mn)&&Vo(Vn)?eT(Mn,Vn):Vn,JM=Mn=>(...Vn)=>{if(Vn.length===0)throw new Error("Can't merge zero objects");const Wn={};for(let jn=0;jn<Vn.length;jn++){const Gn=Vn[jn];for(const no in Gn)Mr(Gn,no)&&(Wn[no]=Mn(Wn[no],Gn[no]))}return Wn},eT=JM(NU),LU=JM(jF),XF=()=>({tag:"required",process:{}}),IU=Mn=>({tag:"defaultedThunk",process:Mn}),e4=Mn=>IU(xs(Mn)),BU=()=>({tag:"option",process:{}}),FU=(Mn,Vn)=>Mn.length>0?km.svalue(eT(Vn,LU.apply(void 0,Mn))):km.svalue(Vn),t4=Mn=>ko(km.serror,Zc)(Mn),YF={consolidateObj:(Mn,Vn)=>{const Wn=km.partition(Mn);return Wn.errors.length>0?t4(Wn.errors):FU(Wn.values,Vn)},consolidateArr:Mn=>{const Vn=km.partition(Mn);return Vn.errors.length>0?t4(Vn.errors):km.svalue(Vn.values)}},HU=(Mn,Vn,Wn,jn)=>({tag:"field",key:Mn,newKey:Vn,presence:Wn,prop:jn}),QU=(Mn,Vn)=>({tag:"custom",newKey:Mn,instantiator:Vn}),GF=(Mn,Vn,Wn)=>{switch(Mn.tag){case"field":return Vn(Mn.key,Mn.newKey,Mn.presence,Mn.prop);case"custom":return Wn(Mn.newKey,Mn.instantiator)}},JP=Mn=>{const Vn=(jn,Gn)=>km.bindError(Mn(Gn),no=>DU(jn,no)),Wn=xs("val");return{extract:Vn,toString:Wn}},KF=JP(km.svalue),VU=(Mn,Vn,Wn,jn)=>Ma(Vn,Wn).fold(()=>PU(Mn,Wn,Vn),jn),JF=(Mn,Vn,Wn,jn)=>{const Gn=Ma(Mn,Vn).getOrThunk(()=>Wn(Mn));return jn(Gn)},zU=(Mn,Vn,Wn)=>Wn(Ma(Mn,Vn)),WU=(Mn,Vn,Wn,jn)=>{const Gn=Ma(Mn,Vn).map(no=>no===!0?Wn(Mn):no);return jn(Gn)},UU=(Mn,Vn,Wn,jn,Gn)=>{const no=po=>Gn.extract(Vn.concat([jn]),po),ao=po=>po.fold(()=>km.svalue(zo.none()),vo=>{const Ao=Gn.extract(Vn.concat([jn]),vo);return km.map(Ao,zo.some)});switch(Mn.tag){case"required":return VU(Vn,Wn,jn,no);case"defaultedThunk":return JF(Wn,jn,Mn.process,no);case"option":return zU(Wn,jn,ao);case"defaultedOptionThunk":return WU(Wn,jn,Mn.process,ao);case"mergeWithThunk":return JF(Wn,jn,xs({}),po=>{const vo=eT(Mn.process(Wn),po);return no(vo)})}},ZU=(Mn,Vn,Wn)=>{const jn={},Gn=[];for(const no of Wn)GF(no,(ao,po,vo,Ao)=>{const Fo=UU(vo,Mn,Vn,ao,Ao);km.fold(Fo,Qo=>{Gn.push(...Qo)},Qo=>{jn[po]=Qo})},(ao,po)=>{jn[ao]=po(Vn)});return Gn.length>0?km.serror(Gn):km.svalue(jn)},n4=Mn=>({extract:(jn,Gn)=>ZU(jn,Gn,Mn),toString:()=>`obj{
`+Us(Mn,Gn=>GF(Gn,(no,ao,po,vo)=>no+" -> "+vo.toString(),(no,ao)=>"state("+no+")")).join(`
`)+"}"}),e6=Mn=>({extract:(jn,Gn)=>{const no=Us(Gn,(ao,po)=>Mn.extract(jn.concat(["["+po+"]"]),ao));return YF.consolidateArr(no)},toString:()=>"array("+Mn.toString()+")"}),bG=Mn=>JP(Vn=>Mn(Vn).fold(km.serror,km.svalue)),qU=(Mn,Vn,Wn)=>{const jn=Vn.extract([Mn],Wn);return km.mapError(jn,Gn=>({input:Wn,errors:Gn}))},e$=(Mn,Vn,Wn)=>km.toResult(qU(Mn,Vn,Wn)),t6=Mn=>`Errors:
`+ZF(Mn.errors).join(`
`)+`
2024-08-30 13:38:34 +03:00
Input object: `+KP(Mn.input),o4=(Mn,Vn)=>MU(Mn,Pl(Vn,n4)),jU=xs(KF),tT=(Mn,Vn)=>JP(Wn=>{const jn=typeof Wn;return Mn(Wn)?km.svalue(Wn):km.serror(`Expected type: ${Vn} but got: ${jn}`)}),n6=tT(Ys,"number"),t$=tT(xo,"string"),XU=tT(es,"boolean"),s4=tT(Yo,"function"),r2=HU,o6=QU,r4=Mn=>bG(Vn=>Zs(Mn,Vn)?ym.value(Vn):ym.error(`Unsupported value: "${Vn}", choose one of "${Mn.join(", ")}".`)),s6=(Mn,Vn)=>r2(Mn,Mn,XF(),Vn),r6=Mn=>s6(Mn,t$),i6=Mn=>s6(Mn,s4),a6=(Mn,Vn)=>r2(Mn,Mn,XF(),e6(Vn)),i4=(Mn,Vn)=>r2(Mn,Mn,BU(),Vn),n$=Mn=>i4(Mn,t$),YU=Mn=>i4(Mn,s4),GU=(Mn,Vn)=>r2(Mn,Mn,e4(Vn),jU()),i2=(Mn,Vn,Wn)=>r2(Mn,Mn,e4(Vn),Wn),rh=(Mn,Vn)=>i2(Mn,Vn,n6),Ty=(Mn,Vn)=>i2(Mn,Vn,t$),l6=(Mn,Vn,Wn)=>i2(Mn,Vn,r4(Wn)),c6=(Mn,Vn)=>i2(Mn,Vn,XU),a4=(Mn,Vn)=>i2(Mn,Vn,s4),KU=(Mn,Vn,Wn)=>i2(Mn,Vn,e6(Wn)),JU=r6("type"),eZ=i6("fetch"),o$=i6("onAction"),a2=a4("onSetup",()=>Js),vG=n$("text"),tZ=n$("icon"),nZ=n$("tooltip"),cv=n$("label"),oZ=c6("active",!1),sZ=c6("enabled",!0),l4=c6("primary",!1),rZ=Mn=>GU("columns",Mn),qw=Mn=>Ty("type",Mn),u6=n4([JU,r6("trigger"),rh("minChars",1),rZ(1),rh("maxResults",10),YU("matches"),eZ,o$,KU("highlightOn",[],t$)]),iZ=Mn=>e$("Autocompleter",u6,{trigger:Mn.ch,...Mn}),c4=[sZ,nZ,tZ,vG,a2],d6=[oZ].concat(c4),f6=[a4("predicate",hs),l6("scope","node",["node","editor"]),l6("position","selection",["node","selection","line"])],h6=c4.concat([qw("contextformbutton"),l4,o$,o6("original",Qr)]),u4=d6.concat([qw("contextformbutton"),l4,o$,o6("original",Qr)]),d4=c4.concat([qw("contextformbutton")]),f4=d6.concat([qw("contextformtogglebutton")]),aZ=o4("type",{contextformbutton:h6,contextformtogglebutton:u4});n4([qw("contextform"),a4("initValue",xs("")),cv,a6("commands",aZ),i4("launch",o4("type",{contextformbutton:d4,contextformtogglebutton:f4}))].concat(f6));const lZ=Mn=>{const Vn=Mn.ui.registry.getAll().popups,Wn=Pl(Vn,ao=>iZ(ao).fold(po=>{throw new Error(t6(po))},Qr)),jn=vl(ia(Wn,ao=>ao.trigger)),Gn=ka(Wn);return{dataset:Wn,triggers:jn,lookupByTrigger:ao=>nr(Gn,po=>po.trigger===ao)}},cZ=(Mn,Vn)=>{const Wn=jO(Vn.load,50);Mn.on("keypress compositionend",jn=>{jn.which!==27&&Wn.throttle()}),Mn.on("keydown",jn=>{const Gn=jn.which;Gn===8?Wn.throttle():Gn===27&&Vn.cancelIfNecessary()}),Mn.on("remove",Wn.cancel)},uZ=Mn=>{const Vn=Fb(),Wn=od(!1),jn=Vn.isSet,Gn=()=>{jn()&&(EV(Mn),Fx(Mn),Wn.set(!1),Vn.clear())},no=Ao=>{jn()||(xV(Mn,Ao.range),Vn.set({trigger:Ao.trigger,matchLength:Ao.text.length}))},ao=br(()=>lZ(Mn)),po=Ao=>Vn.get().map(Fo=>s2(Mn.dom,Mn.selection.getRng(),Fo.trigger).bind(Qo=>zF(Mn,ao,Qo,Ao))).getOrThunk(()=>CU(Mn,ao)),vo=Ao=>{po(Ao).fold(Gn,Fo=>{no(Fo.context),Fo.lookupData.then(Qo=>{Vn.get().map(qo=>{const ds=Fo.context;qo.trigger===ds.trigger&&(ds.text.length-qo.matchLength>=10?Gn():(Vn.set({...qo,matchLength:ds.text.length}),Wn.get()?eA(Mn,{lookupData:Qo}):(Wn.set(!0),Bx(Mn,{lookupData:Qo}))))})})})};Mn.addCommand("mceAutocompleterReload",(Ao,Fo)=>{const Qo=Io(Fo)?Fo.fetchOptions:{};vo(Qo)}),Mn.addCommand("mceAutocompleterClose",Gn),cZ(Mn,{cancelIfNecessary:Gn,load:vo})},p6=xl().browser.isSafari(),g6=Mn=>Kp(Cs.fromDom(Mn)),h4=(Mn,Vn)=>{var Wn;return Mn.startOffset===0&&Mn.endOffset===((Wn=Vn.textContent)===null||Wn===void 0?void 0:Wn.length)},s$=(Mn,Vn)=>zo.from(Mn.getParent(Vn.container(),"details")),r$=(Mn,Vn)=>s$(Mn,Vn).isSome(),dZ=(Mn,Vn)=>{const Wn=zo.from(Mn.getParent(Vn.startContainer,"details")),jn=zo.from(Mn.getParent(Vn.endContainer,"details"));if(Wn.isSome()||jn.isSome()){const Gn=Wn.bind(no=>zo.from(Mn.select("summary",no)[0]));return zo.some({startSummary:Gn,startDetails:Wn,endDetails:jn})}else return zo.none()},fZ=(Mn,Vn)=>zm(Vn).exists(Wn=>Wn.isEqual(Mn)),hZ=(Mn,Vn)=>b1(Vn).exists(Wn=>Ec(Wn.getNode())&&cp(Vn,Wn).exists(jn=>jn.isEqual(Mn))||Wn.isEqual(Mn)),mZ=(Mn,Vn)=>Vn.startSummary.exists(Wn=>fZ(Mn,Wn)),pZ=(Mn,Vn)=>Vn.startSummary.exists(Wn=>hZ(Mn,Wn)),b6=(Mn,Vn)=>Vn.startDetails.exists(Wn=>cp(Wn,Mn).forall(jn=>Vn.startSummary.exists(Gn=>!Gn.contains(Mn.container())&&Gn.contains(jn.container())))),m4=(Mn,Vn,Wn)=>Wn.startDetails.exists(jn=>Sm(Mn,Vn).forall(Gn=>!jn.contains(Gn.container()))),p4=(Mn,Vn)=>{const Wn=
2024-08-27 12:25:42 +03:00
`;return}if(Ao!=="wbr"){if(Gn[Ao]&&(jn+=" "),no[Ao]){jn+=" ";return}if(vo.type===3&&(jn+=vo.value),!(vo.name in Vn.getVoidElements())){let Qo=vo.firstChild;if(Qo)do po(Qo);while(Qo=Qo.next)}ao[Ao]&&Fo.next&&(jn+=`
`,Ao==="p"&&(jn+=`
`))}};return Mn=s7(Mn,[/<!\[[^\]]+\]>/g]),po(Wn.parse(Mn)),jn},r7=Mn=>(Mn=s7(Mn,[/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/ig,/<!--StartFragment-->|<!--EndFragment-->/g,[/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,(Wn,jn,Gn)=>!jn&&!Gn?" ":hc],/<br class="Apple-interchange-newline">/g,/<br>$/i]),Mn),wq=Mn=>{let Vn=0;return()=>Mn+Vn++},Cq=Mn=>{const Vn=Mn.toLowerCase(),Wn={jpg:"jpeg",jpe:"jpeg",jfi:"jpeg",jif:"jpeg",jfif:"jpeg",pjpeg:"jpeg",pjp:"jpeg",svg:"svg+xml"};return Lr.hasOwn(Wn,Vn)?"image/"+Wn[Vn]:"image/"+Vn},Hu=(Mn,Vn)=>{const Wn=a0({sanitize:jb(Mn),sandbox_iframes:b_(Mn)},Mn.schema);Wn.addNodeFilter("meta",Gn=>{Lr.each(Gn,no=>{no.remove()})});const jn=Wn.parse(Vn,{forced_root_block:!1,isRootContent:!0});return I_({validate:!0},Mn.schema).serialize(jn)},i7=(Mn,Vn)=>({content:Mn,cancelled:Vn}),a7=(Mn,Vn,Wn)=>{const jn=Mn.dom.create("div",{style:"display:none"},Vn),Gn=R3(Mn,jn,Wn);return i7(Gn.node.innerHTML,Gn.isDefaultPrevented())},kq=(Mn,Vn,Wn)=>{const jn=$3(Mn,Vn,Wn),Gn=Hu(Mn,jn.content);return Mn.hasEventListeners("PastePostProcess")&&!jn.isDefaultPrevented()?a7(Mn,Gn,Wn):i7(Gn,jn.isDefaultPrevented())},F4=(Mn,Vn,Wn)=>kq(Mn,Vn,Wn),k$=(Mn,Vn)=>(Mn.insertContent(Vn,{merge:YS(Mn),paste:!0}),!0),H4=Mn=>/^https?:\/\/[\w\-\/+=.,!;:&%@^~(){}?#]+$/i.test(Mn),xq=(Mn,Vn)=>H4(Vn)&&Sr(UC(Mn),Wn=>bd(Vn.toLowerCase(),`.${Wn.toLowerCase()}`)),l7=(Mn,Vn,Wn)=>(Mn.undoManager.extra(()=>{Wn(Mn,Vn)},()=>{Mn.insertContent('<img src="'+Vn+'">')}),!0),Q4=(Mn,Vn,Wn)=>(Mn.undoManager.extra(()=>{Wn(Mn,Vn)},()=>{Mn.execCommand("mceInsertLink",!1,Vn)}),!0),Eq=(Mn,Vn,Wn)=>!Mn.selection.isCollapsed()&&H4(Vn)?Q4(Mn,Vn,Wn):!1,Tq=(Mn,Vn,Wn)=>xq(Mn,Vn)?l7(Mn,Vn,Wn):!1,Aq=(Mn,Vn)=>{Lr.each([Eq,Tq,k$],Wn=>!Wn(Mn,Vn,k$))},c7=(Mn,Vn,Wn)=>{Wn||!h_(Mn)?k$(Mn,Vn):Aq(Mn,Vn)},Pq=wq("mceclip"),$q=Mn=>{const Vn=N4();return J6(Vn,Mn),M4(Vn),Vn},Xw=(Mn,Vn,Wn,jn,Gn)=>{const no=F4(Mn,Vn,Wn);if(!no.cancelled){const ao=no.content,po=()=>c7(Mn,ao,jn);Gn?b4(Mn,"insertFromPaste",{dataTransfer:$q(ao)}).isDefaultPrevented()||(po(),nT(Mn,"insertFromPaste")):po()}},x$=(Mn,Vn,Wn,jn)=>{const Gn=Wn||t7(Vn);Xw(Mn,e7(Vn),Gn,!1,jn)},nS=(Mn,Vn,Wn)=>{const jn=Mn.dom.encode(Vn).replace(/\r\n/g,`
`),Gn=V1(jn,zC(Mn)),no=C$(Gn,bh(Mn),Zb(Mn));Xw(Mn,no,!1,!0,Wn)},d2=Mn=>{const Vn={};if(Mn&&Mn.types)for(let Wn=0;Wn<Mn.types.length;Wn++){const jn=Mn.types[Wn];try{Vn[jn]=Mn.getData(jn)}catch{Vn[jn]=""}}return Vn},oS=(Mn,Vn)=>Vn in Mn&&Mn[Vn].length>0,u7=Mn=>oS(Mn,"text/html")||oS(Mn,"text/plain"),f2=(Mn,Vn)=>{const Wn=Vn.match(/([\s\S]+?)(?:\.[a-z0-9.]+)$/i);return rs(Wn)?Mn.dom.encode(Wn[1]):void 0},Rq=(Mn,Vn,Wn,jn)=>{const Gn=Pq(),no=nO(Mn)&&rs(Wn.name),ao=no?f2(Mn,Wn.name):Gn,po=no?Wn.name:void 0,vo=Vn.create(Gn,Wn,jn,ao,po);return Vn.add(vo),vo},V4=(Mn,Vn)=>{JA(Vn.uri).each(({data:Wn,type:jn,base64Encoded:Gn})=>{const no=Gn?Wn:btoa(Wn),ao=Vn.file,po=Mn.editorUpload.blobCache,vo=po.getByData(no,jn),Ao=vo??Rq(Mn,po,ao,no);x$(Mn,`<img src="${Ao.blobUri()}">`,!1,!0)})},Dq=Mn=>Mn.type==="paste",d7=Mn=>Promise.all(Us(Mn,Vn=>_Q(Vn).then(Wn=>({file:Vn,uri:Wn})))),f7=Mn=>{const Vn=UC(Mn);return Wn=>Dc(Wn.type,"image/")&&Sr(Vn,jn=>Cq(jn)===Wn.type)},z4=(Mn,Vn)=>{const Wn=Vn.items?cc(kc(Vn.items),Gn=>Gn.kind==="file"?[Gn.getAsFile()]:[]):[],jn=Vn.files?kc(Vn.files):[];return nr(Wn.length>0?Wn:jn,f7(Mn))},W4=(Mn,Vn,Wn)=>{const jn=Dq(Vn)?Vn.clipboardData:Vn.dataTransfer;if(f_(Mn)&&jn){const Gn=z4(Mn,jn);if(Gn.length>0)return Vn.preventDefault(),d7(Gn).then(no=>{Wn&&Mn.selection.setRng(Wn),fs(no,ao=>{V4(Mn,ao)})}),!0}return!1},Mq=Mn=>{var Vn,Wn;return aa.os.isAndroid()&&((Wn=(Vn=Mn.clipboardData)===null||Vn===void 0?void 0:Vn.items)===null||Wn===void 0?void 0:Wn.length)===0},Nq=Mn=>va.metaKeyPressed(Mn)&&Mn.keyCode===86||Mn.shiftKey&&Mn.keyCode===45,E$=(Mn,Vn,Wn,jn,Gn)=>{let no=r7(Wn);const ao=oS(Vn,w$())||t7(Wn),po=!ao&&gq(no),vo=H4(no);(o7(no)||!no.length||po&&!vo)&&(jn=!0),(jn||vo)&&(oS(Vn,"text/plain")&&po?no=Vn["text/plain"]:no=Sq(no)),!o7(no)&&(jn?nS(Mn,no,Gn):x$(Mn,no,ao,Gn))},Lq=(Mn,Vn,Wn)=>{let jn;const Gn=()=>Vn.getLastRng()||Mn.selection.getRng();Mn.on("keydown",no=>{Nq(no)&&!no.isDefaultPrevented()&&(jn=no.shiftKey&&no.keyCode===86)}),Mn.on("paste",no=>{if(no.isDefaultPrevented()||Mq(no))return;const ao=Wn.get()==="text"||jn;jn=!1;const po=d2(no.clipboardData);!u7(po)&&W4(Mn,no,Gn())||(oS(po,"text/html")?(no.preventDefault(),E$(Mn,po,po["text/html"],ao,!0)):oS(po,"text/plain")&&oS(po,"text/uri-list")?(no.preventDefault(),E$(Mn,po,po["text/plain"],ao,!0)):(Vn.create(),O1.setEditorTimeout(Mn,()=>{const vo=Vn.getHtml();Vn.remove(),E$(Mn,po,vo,ao,!1)},0)))})},h7=Mn=>{const Vn=Gn=>Dc(Gn,"webkit-fake-url"),Wn=Gn=>Dc(Gn,"data:"),jn=Gn=>{var no;return((no=Gn.data)===null||no===void 0?void 0:no.paste)===!0};Mn.parser.addNodeFilter("img",(Gn,no,ao)=>{if(!f_(Mn)&&jn(ao))for(const po of Gn){const vo=po.attr("src");xo(vo)&&!po.attr("data-mce-object")&&vo!==aa.transparentSrc&&(Vn(vo)||!p_(Mn)&&Wn(vo))&&po.remove()}})},U4=(Mn,Vn,Wn)=>{Lq(Mn,Vn,Wn),h7(Mn)},m7=(Mn,Vn)=>{Vn.get()==="text"?(Vn.set("html"),tA(Mn,!1)):(Vn.set("text"),tA(Mn,!0)),Mn.focus()},Iq=(Mn,Vn)=>{Mn.addCommand("mceTogglePlainTextPaste",()=>{m7(Mn,Vn)}),Mn.addCommand("mceInsertClipboardContent",(Wn,jn)=>{jn.html&&x$(Mn,jn.html,jn.internal,!1),jn.text&&nS(Mn,jn.text,!1)})},Bq=(Mn,Vn,Wn)=>{if(Mn)try{return Mn.clearData(),Mn.setData("text/html",Vn),Mn.setData("text/plain",Wn),Mn.setData(w$(),Vn),!0}catch{return!1}else return!1},p7=(Mn,Vn,Wn,jn)=>{Bq(Mn.clipboardData,Vn.html,Vn.text)?(Mn.preventDefault(),jn()):Wn(Vn.html,jn)},Z4=Mn=>(Vn,Wn)=>{const{dom:jn,selection:Gn}=Mn,no=jn.create("div",{contenteditable:"false","data-mce-bogus":"all"}),ao=jn.create("div",{contenteditable:"true"},Vn);jn.setStyles(no,{position:"fixed",top:"0",left:"-3000px",width:"1000px",overflow:"hidden"}),no.appendChild(ao),jn.add(Mn.getBody(),no);const po=Gn.getRng();ao.focus();const vo=jn.createRng();vo.selectNodeContents(ao),Gn.setRng(vo),O1.setEditorTimeout(Mn,()=>{Gn.setRng(po),jn.remove(no),Wn()},0)},T$=Mn=>({html:pq(Mn.selection.getContent({contextual:!0})),text:Mn.selection.getContent({format:"text"})}),Fq=Mn=>!!Mn.dom.getParent(Mn.selection.getStart(),"td[data-mce-selected],th[data-mce-selected]",Mn.getBody()),q4=Mn=>!Mn.selection.isCollapsed()||Fq(Mn),g7=Mn=>Vn=>{!Vn.isDefaultPrevented()&
2024-08-30 13:38:34 +03:00
`}),Mn.dom.addStyle(vo)}const ao=Promise.all(Zj(Mn,jn,Wn)).then(no).catch(no),po=l_(Mn);return po&&Qj(Mn,po),ao},qj=Mn=>{const Vn=Mn.getDoc(),Wn=Mn.getBody();fy(Mn),ax(Mn)||(Vn.body.spellcheck=!1,Q$.setAttrib(Wn,"spellcheck","false")),Mn.quirks=Hj(Mn),T3(Mn);const jn=G2(Mn);jn!==void 0&&(Wn.dir=jn);const Gn=QC(Mn);Gn&&Mn.on("BeforeSetContent",no=>{Lr.each(Gn,ao=>{no.content=no.content.replace(ao,po=>"<!--mce:protected "+escape(po)+"-->")})}),Mn.on("SetContent",()=>{Mn.addVisual(Mn.getBody())}),Mn.on("compositionstart compositionend",no=>{Mn.composing=no.type==="compositionstart"})},jj=Mn=>{wO(Mn)||Mn.load({initial:!0,format:"html"}),Mn.startContent=Mn.getContent({format:"raw"})},aN=Mn=>{Mn.removed!==!0&&(jj(Mn),Uj(Mn))},Xj=Mn=>{let Vn=!1;const Wn=setTimeout(()=>{Vn||Mn.setProgressState(!0)},500);return()=>{clearTimeout(Wn),Vn=!0,Mn.setProgressState(!1)}},p8=Mn=>{const Vn=Mn.getElement();let Wn=Mn.getDoc();Mn.inline&&(Q$.addClass(Vn,"mce-content-body"),Mn.contentDocument=Wn=document,Mn.contentWindow=window,Mn.bodyElement=Vn,Mn.contentAreaContainer=Vn);const jn=Mn.getBody();jn.disabled=!0,Mn.readonly=oO(Mn),Mn._editableRoot=$p(Mn),!Mn.readonly&&Mn.hasEditableRoot()&&(Mn.inline&&Q$.getStyle(jn,"position",!0)==="static"&&(jn.style.position="relative"),jn.contentEditable="true"),jn.disabled=!1,Mn.editorUpload=vz(Mn),Mn.schema=i1(h8(Mn)),Mn.dom=Eu(Wn,{keep_values:!0,url_converter:Mn.convertURL,url_converter_scope:Mn,update_styles:!0,root_element:Mn.inline?Mn.getBody():null,collect:Mn.inline,schema:Mn.schema,contentCssCors:ab(Mn),referrerPolicy:Hl(Mn),onSetAttrib:ao=>{Mn.dispatch("SetAttrib",ao)},force_hex_color:ry(Mn)}),Mn.parser=zj(Mn),Mn.serializer=zI(Vj(Mn),Mn),Mn.selection=W_(Mn.dom,Mn.getWin(),Mn.serializer,Mn),Mn.annotator=Dx(Mn),Mn.formatter=eM(Mn),Mn.undoManager=tM(Mn),Mn._nodeChangeDispatcher=new U6(Mn),Mn._selectionOverrides=xj(Mn),BW(Mn),Gq(Mn),iG(Mn),wO(Mn)||(T7(Mn),Fj(Mn));const Gn=sq(Mn);Uw(Mn,Gn),VW(Mn),c0(Mn),jq(Mn);const no=hV(Mn);qj(Mn),no.fold(()=>{const ao=Xj(Mn);m8(Mn).then(()=>{aN(Mn),ao()})},ao=>{Mn.setProgressState(!0),m8(Mn).then(()=>{ao().then(po=>{Mn.setProgressState(!1),aN(Mn),WD(Mn)},po=>{Mn.notificationManager.open({type:"error",text:String(po)}),aN(Mn),WD(Mn)})})})},g8=Qs,Yj=(Mn,Vn,Wn)=>S0(Mn,Vn,g8,Wn),z$=Eu.DOM,Gj=(Mn,Vn,Wn,jn)=>{const Gn=Cs.fromTag("iframe");return jn.each(no=>Gc(Gn,"tabindex",no)),im(Gn,Wn),im(Gn,{id:Mn+"_ifr",frameBorder:"0",allowTransparency:"true",title:Vn}),Xm(Gn,"tox-edit-area__iframe"),Gn},Kj=Mn=>{let Vn=FS(Mn)+"<html><head>";ap(Mn)!==Mn.documentBaseUrl&&(Vn+='<base href="'+Mn.documentBaseURI.getURI()+'" />'),Vn+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';const Wn=i_(Mn),jn=W2(Mn),Gn=Mn.translate(sx(Mn));return Zu(Mn)&&(Vn+='<meta http-equiv="Content-Security-Policy" content="'+Zu(Mn)+'" />'),Vn+=`</head><body id="${Wn}" class="mce-content-body ${jn}" data-id="${Mn.id}" aria-label="${Gn}"><br></body></html>`,Vn},b8=(Mn,Vn)=>{const Wn=Mn.translate("Rich Text Area"),jn=Ld(Cs.fromDom(Mn.getElement()),"tabindex").bind(Em),Gn=Gj(Mn.id,Wn,Ic(Mn),jn).dom;Gn.onload=()=>{Gn.onload=null,Mn.dispatch("load")},Mn.contentAreaContainer=Vn.iframeContainer,Mn.iframeElement=Gn,Mn.iframeHTML=Kj(Mn),z$.add(Vn.iframeContainer,Gn)},fT=Mn=>{const Vn=Mn.iframeElement,Wn=()=>{Mn.contentDocument=Vn.contentDocument,p8(Mn)};if(fx(Mn)||aa.browser.isFirefox()){const jn=Mn.getDoc();jn.open(),jn.write(Mn.iframeHTML),jn.close(),Wn()}else{const jn=Yj(Cs.fromDom(Vn),"load",()=>{jn.unbind(),Wn()});Vn.srcdoc=Mn.iframeHTML}},Jj=(Mn,Vn)=>{b8(Mn,Vn),Vn.editorContainer&&(Vn.editorContainer.style.display=Mn.orgDisplay,Mn.hidden=z$.isHidden(Vn.editorContainer)),Mn.getElement().style.display="none",z$.setAttrib(Mn.id,"aria-hidden","true"),Mn.getElement().style.visibility=Mn.orgVisibility,fT(Mn)},lN=Eu.DOM,eX=(Mn,Vn,Wn)=>{const jn=Hw.get(Wn),Gn=Hw.urls[Wn]||Mn.documentBaseUrl.replace(/\/$/,"");if(Wn=Lr.trim(Wn),jn&&Lr.inArray(Vn,Wn)===-1){if(Mn.plugins[Wn])return;try{const no=jn(Mn,Gn)||{};Mn.plugins[Wn]=no,Yo(no.init)&&(no.init(Mn,Gn),Vn.push(Wn))}catch(no){tB(Mn,Wn,no)}}},tX=Mn=>Mn.r
2024-08-27 12:25:42 +03:00
Actual: `+la.join(","));if(!za(ro,xr=>gs(la,xr)))throw new Error("Not all branches were specified when using match. Specified: "+la.join(", ")+`
2024-08-30 13:38:34 +03:00
Required: `+ro.join(", "));return Nr[Zo].apply(null,ms)},log:Nr=>{console.log(Nr,{constructors:ro,constructor:Zo,params:ms})}}}}),fo}},Xv={...Qm.generate([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}])},kC=(eo,ro)=>eo.length===0?Xv.none():eo.length===1?Xv.only(0):ro===0?Xv.left(0,1):ro===eo.length-1?Xv.right(ro-1,ro):ro>0&&ro<eo.length-1?Xv.middle(ro-1,ro,ro+1):Xv.none(),F2=(eo,ro,fo,go,To)=>{const No=eo.slice(0),Zo=kC(eo,ro),ns=xo(cr(No,xo(0))),ms=la=>go.singleColumnWidth(No[la],fo),$s=(la,sa)=>To.calcLeftEdgeDeltas(No,la,sa,fo,go.minCellWidth(),go.isRelative),js=(la,sa,xr)=>To.calcMiddleDeltas(No,la,sa,xr,fo,go.minCellWidth(),go.isRelative),Nr=(la,sa)=>To.calcRightEdgeDeltas(No,la,sa,fo,go.minCellWidth(),go.isRelative);return Zo.fold(ns,ms,$s,js,Nr)},qy=(eo,ro,fo)=>{let go=0;for(let To=eo;To<ro;To++)go+=fo[To]!==void 0?fo[To]:0;return go},Wb=(eo,ro)=>{const fo=os.justCells(eo);return cr(fo,go=>{const To=qy(go.column,go.column+go.colspan,ro);return{element:go.element,width:To,colspan:go.colspan}})},JO=(eo,ro)=>{const fo=os.justColumns(eo);return cr(fo,(go,To)=>({element:go.element,width:ro[To],colspan:go.colspan}))},rc=(eo,ro)=>{const fo=os.justCells(eo);return cr(fo,go=>{const To=qy(go.row,go.row+go.rowspan,ro);return{element:go.element,height:To,rowspan:go.rowspan}})},Vm=(eo,ro)=>cr(eo.all,(fo,go)=>({element:fo.element,height:ro[go]})),Fg=eo=>ha(eo,(ro,fo)=>ro+fo,0),Yv=(eo,ro)=>os.hasColumns(eo)?JO(eo,ro):Wb(eo,ro),tu=(eo,ro,fo)=>{const go=Yv(eo,ro);ws(go,To=>{fo.setElementWidth(To.element,To.width)})},Gv=(eo,ro,fo,go,To)=>{const No=os.fromTable(eo),Zo=To.getCellDelta(ro),ns=To.getWidths(No,To),ms=fo===No.grid.columns-1,$s=go.clampTableDelta(ns,fo,Zo,To.minCellWidth(),ms),js=F2(ns,fo,$s,To,go),Nr=cr(js,(la,sa)=>la+ns[sa]);tu(No,Nr,To),go.resizeTable(To.adjustTableWidth,$s,ms)},e_=(eo,ro,fo,go)=>{const To=os.fromTable(eo),No=Gs(To,eo,go),Zo=cr(No,(js,Nr)=>fo===Nr?Math.max(ro+js,Vh()):js),ns=rc(To,Zo),ms=Vm(To,Zo);ws(ms,js=>{Rg(js.element,js.height)}),ws(ns,js=>{Rg(js.element,js.height)});const $s=Fg(Zo);Rg(eo,$s)},Yd=(eo,ro,fo,go,To)=>{const No=os.generate(ro),Zo=go.getWidths(No,go),ns=go.pixelWidth(),{newSizes:ms,delta:$s}=To.calcRedestributedWidths(Zo,ns,fo.pixelDelta,go.isRelative);tu(No,ms,go),go.adjustTableWidth($s)},Hg=(eo,ro,fo,go)=>{const To=os.generate(ro),No=go.getWidths(To,go);tu(To,No,go)},sb=eo=>hs(eo,(fo,go)=>xs(fo,No=>No.column===go.column)?fo:fo.concat([go]),[]).sort((fo,go)=>fo.column-go.column),t_=Vc("col"),jy=Vc("colgroup"),Xy=eo=>pr(eo)==="tr"||jy(eo),TS=eo=>{const ro=Gc(eo,"colspan",1),fo=Gc(eo,"rowspan",1);return{element:eo,colspan:ro,rowspan:fo}},n_=(eo,ro=TS)=>{const fo=ns=>t_(ns.element)?eo.col(ns):eo.cell(ns),go=ns=>jy(ns.element)?eo.colgroup(ns):eo.row(ns),To=ns=>{if(Xy(ns))return go({element:ns});{const ms=ns,$s=fo(ro(ms));return No=Yo.some({item:ms,replacement:$s}),$s}};let No=Yo.none();return{getOrInit:(ns,ms)=>No.fold(()=>To(ns),$s=>ms(ns,$s.item)?$s.replacement:To(ns))}},Pp=eo=>ro=>{const fo=[],go=(Zo,ns)=>zo(fo,ms=>ns(ms.item,Zo)),To=Zo=>{const ns=eo==="td"?{scope:null}:{},ms=ro.replace(Zo,eo,ns);return fo.push({item:Zo,sub:ms}),ms};return{replaceOrInit:(Zo,ns)=>{if(Xy(Zo)||t_(Zo))return Zo;{const ms=Zo;return go(ms,ns).fold(()=>To(ms),$s=>ns(Zo,$s.item)?$s.sub:To(ms))}}}},ug=eo=>Ts(eo,"scope").map(ro=>ro.substr(0,3)),lr={modification:n_,transform:Pp,merging:eo=>({unmerge:go=>{const To=ug(go);return To.each(No=>zc(go,"scope",No)),()=>{const No=eo.cell({element:go,colspan:1,rowspan:1});return Qh(No,"width"),Qh(go,"width"),To.each(Zo=>zc(No,"scope",Zo)),No}},merge:go=>{const To=()=>{const No=cu(cr(go,ug));if(No.length===0)return Yo.none();{const Zo=No[0],ns=["row","col"];return xs(No,$s=>$s!==Zo&&gs(ns,$s))?Yo.none():Yo.from(Zo)}};return Qh(go[0],"width"),To().fold(()=>ks(go[0],"scope"),No=>zc(go[0],"scope",No+"group")),xo(go[0])}})},H0=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","table","thead","tfoot","tbody","caption","tr","td","th","h1","h2","h3","h4","h5","h6","b
`+Xn.getErrorInfo())},Eo=(Qn,Un)=>xu.serror([{path:Qn,getErrorInfo:Un}]),Bo=(Qn,Un,Xn)=>Eo(Qn,()=>'Could not find valid *required* value for "'+Un+'" in '+S0(Xn)),Go=(Qn,Un)=>Eo(Qn,()=>'Choice schema did not contain choice key: "'+Un+'"'),Ss=(Qn,Un,Xn)=>Eo(Qn,()=>'The chosen schema: "'+Xn+'" did not exist in branches: '+S0(Un)),Rs=(Qn,Un)=>Eo(Qn,()=>"There are unsupported fields: ["+Un.join(", ")+"] specified"),$r=(Qn,Un)=>Eo(Qn,Mo(Un)),Ea=Qn=>{const Un=(Kn,oo)=>xu.bindError(Qn(oo),lo=>$r(Kn,lo)),Xn=Mo("val");return{extract:Un,toString:Xn}},ll=Ea(xu.svalue),nl=(Qn,Un,Xn,Kn)=>Rr(Un,Xn).fold(()=>Bo(Qn,Xn,Un),Kn),Xa=(Qn,Un,Xn,Kn)=>{const oo=Rr(Qn,Un).getOrThunk(()=>Xn(Qn));return Kn(oo)},Nu=(Qn,Un,Xn)=>Xn(Rr(Qn,Un)),zu=(Qn,Un,Xn,Kn)=>{const oo=Rr(Qn,Un).map(lo=>lo===!0?Xn(Qn):lo);return Kn(oo)},kh=(Qn,Un,Xn,Kn,oo)=>{const lo=yo=>oo.extract(Un.concat([Kn]),yo),mo=yo=>yo.fold(()=>xu.svalue(ko.none()),Co=>{const Ro=oo.extract(Un.concat([Kn]),Co);return xu.map(Ro,ko.some)});switch(Qn.tag){case"required":return nl(Un,Xn,Kn,lo);case"defaultedThunk":return Xa(Xn,Kn,Qn.process,lo);case"option":return Nu(Xn,Kn,mo);case"defaultedOptionThunk":return zu(Xn,Kn,Qn.process,mo);case"mergeWithThunk":return Xa(Xn,Kn,Mo({}),yo=>{const Co=Lc(Qn.process(Xn),yo);return lo(Co)})}},Sp=(Qn,Un,Xn)=>{const Kn={},oo=[];for(const lo of Xn)Gm(lo,(mo,yo,Co,Ro)=>{const Lo=kh(Co,Qn,Un,mo,Ro);xu.fold(Lo,Wo=>{oo.push(...Wo)},Wo=>{Kn[yo]=Wo})},(mo,yo)=>{Kn[mo]=yo(Un)});return oo.length>0?xu.serror(oo):xu.svalue(Kn)},mf=Qn=>({extract:(Kn,oo)=>Qn().extract(Kn,oo),toString:()=>Qn().toString()}),fS=Qn=>nc(Yl(Qn,Oo)),mu=Qn=>{const Un=Ta(Qn),Xn=Ca(Qn,(oo,lo)=>Gm(lo,mo=>Lc(oo,{[mo]:!0}),Mo(oo)),{});return{extract:(oo,lo)=>{const mo=uo(lo)?[]:fS(lo),yo=ga(mo,Co=>!Su(Xn,Co));return yo.length===0?Un.extract(oo,lo):Rs(oo,yo)},toString:Un.toString}},Ta=Qn=>({extract:(Kn,oo)=>Sp(Kn,oo,Qn),toString:()=>`obj{
`+hs(Qn,oo=>Gm(oo,(lo,mo,yo,Co)=>lo+" -> "+Co.toString(),(lo,mo)=>"state("+lo+")")).join(`
`)+"}"}),Xp=Qn=>({extract:(Kn,oo)=>{const lo=hs(oo,(mo,yo)=>Qn.extract(Kn.concat(["["+yo+"]"]),mo));return Db.consolidateArr(lo)},toString:()=>"array("+Qn.toString()+")"}),Oa=(Qn,Un)=>{const Xn=Un!==void 0?Un:es;return{extract:(lo,mo)=>{const yo=[];for(const Co of Qn){const Ro=Co.extract(lo,mo);if(Ro.stype===dh.Value)return{stype:dh.Value,svalue:Xn(Ro.svalue)};yo.push(Ro)}return Db.consolidateArr(yo)},toString:()=>"oneOf("+hs(Qn,lo=>lo.toString()).join(", ")+")"}},pf=(Qn,Un)=>{const Xn=(lo,mo)=>Xp(Ea(Qn)).extract(lo,mo);return{extract:(lo,mo)=>{const yo=nc(mo),Co=Xn(lo,yo);return xu.bind(Co,Ro=>{const Lo=hs(Ro,Wo=>ed(Wo,Wo,sc(),Un));return Ta(Lo).extract(lo,mo)})},toString:()=>"setOf("+Un.toString()+")"}},$O=(Qn,Un)=>{const Xn=Du(Un);return{extract:(lo,mo)=>Xn().extract(lo,mo),toString:()=>Xn().toString()}},Yp=Vo(Xp,Ta),Ad=Mo(ll),Pg=(Qn,Un)=>Ea(Xn=>{const Kn=typeof Xn;return Qn(Xn)?xu.svalue(Xn):xu.serror(`Expected type: ${Un} but got: ${Kn}`)}),w0=Pg($o,"number"),nf=Pg(qn,"string"),Jm=Pg(uo,"boolean"),_v=Pg(So,"function"),Gp=Qn=>{if(Object(Qn)!==Qn)return!0;switch({}.toString.call(Qn).slice(8,-1)){case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return!0;case"Array":case"Object":return Object.keys(Qn).every(Un=>Gp(Qn[Un]));default:return!1}},Sv=Ea(Qn=>Gp(Qn)?xu.svalue(Qn):xu.serror("Expected value to be acceptable for sending via postMessage")),$g=(Qn,Un,Xn,Kn)=>Rr(Xn,Kn).fold(()=>Ss(Qn,Xn,Kn),lo=>lo.extract(Qn.concat(["branch: "+Kn]),Un)),Ir=(Qn,Un)=>({extract:(oo,lo)=>Rr(lo,Qn).fold(()=>Go(oo,Qn),yo=>$g(oo,lo,Un,yo)),toString:()=>"chooseOn("+Qn+"). Possible values: "+nc(Un)}),RO=()=>Xp(ll),Rg=Qn=>Ea(Un=>Qn(Un).fold(xu.serror,xu.svalue)),Dg=(Qn,Un)=>pf(Xn=>xu.fromResult(Qn(Xn)),Un),Nm=(Qn,Un,Xn)=>{const Kn=Un.extract([Qn],Xn);return xu.mapError(Kn,oo=>({input:Xn,errors:oo}))},Lu=(Qn,Un,Xn)=>xu.toResult(Nm(Qn,Un,Xn)),Ec=Qn=>Qn.fold(Un=>{throw new Error(Gf(Un))},es),td=(Qn,Un,Xn)=>Ec(Lu(Qn,Un,Xn)),Gf=Qn=>`Errors:
2024-08-27 12:25:42 +03:00
`+Mm(Qn.errors).join(`
`)+`
2024-08-30 13:38:34 +03:00
Input object: `+S0(Qn.input),jl=(Qn,Un)=>Ir(Qn,Vl(Un,Ta)),L1=(Qn,Un)=>$O(Qn,Un),Bd=ed,pu=fh,C0=Qn=>Rg(Un=>Fs(Qn,Un)?yl.value(Un):yl.error(`Unsupported value: "${Un}", choose one of "${Qn.join(", ")}".`)),Er=Qn=>Bd(Qn,Qn,sc(),Ad()),Kf=(Qn,Un)=>Bd(Qn,Qn,sc(),Un),k0=Qn=>Kf(Qn,w0),hc=Qn=>Kf(Qn,nf),hd=(Qn,Un)=>Bd(Qn,Qn,sc(),C0(Un)),wv=Qn=>Kf(Qn,Jm),ep=Qn=>Kf(Qn,_v),tp=(Qn,Un)=>Bd(Qn,Qn,Km(),Ea(Xn=>xu.serror("The field: "+Qn+" is forbidden. "+Un))),fm=(Qn,Un)=>Bd(Qn,Qn,sc(),Ta(Un)),Mb=(Qn,Un)=>Bd(Qn,Qn,sc(),Yp(Un)),Pf=(Qn,Un)=>Bd(Qn,Qn,sc(),Xp(Un)),Tc=Qn=>Bd(Qn,Qn,Km(),Ad()),Fd=(Qn,Un)=>Bd(Qn,Qn,Km(),Un),Mg=Qn=>Fd(Qn,w0),$f=Qn=>Fd(Qn,nf),Ly=(Qn,Un)=>Fd(Qn,C0(Un)),I1=Qn=>Fd(Qn,_v),Ng=(Qn,Un)=>Fd(Qn,Xp(Un)),hh=(Qn,Un)=>Fd(Qn,Ta(Un)),np=(Qn,Un)=>Fd(Qn,mu(Un)),Gs=(Qn,Un)=>Bd(Qn,Qn,um(Un),Ad()),xh=(Qn,Un,Xn)=>Bd(Qn,Qn,um(Un),Xn),Lm=(Qn,Un)=>xh(Qn,Un,w0),mh=(Qn,Un)=>xh(Qn,Un,nf),Eh=(Qn,Un,Xn)=>xh(Qn,Un,C0(Xn)),Xd=(Qn,Un)=>xh(Qn,Un,Jm),Hd=(Qn,Un)=>xh(Qn,Un,_v),Iy=(Qn,Un)=>xh(Qn,Un,Sv),Th=(Qn,Un,Xn)=>xh(Qn,Un,Xp(Xn)),Kp=(Qn,Un,Xn)=>xh(Qn,Un,Ta(Xn)),Ua=Qn=>{let Un=Qn;return{get:()=>Un,set:oo=>{Un=oo}}},Po={generate:Qn=>{if(!to(Qn))throw new Error("cases must be an array");if(Qn.length===0)throw new Error("there must be at least one case");const Un=[],Xn={};return Qs(Qn,(Kn,oo)=>{const lo=nc(Kn);if(lo.length!==1)throw new Error("one and only one name per case");const mo=lo[0],yo=Kn[mo];if(Xn[mo]!==void 0)throw new Error("duplicate key detected:"+mo);if(mo==="cata")throw new Error("cannot have a case named cata (sorry)");if(!to(yo))throw new Error("case arguments must be an array");Un.push(mo),Xn[mo]=(...Co)=>{const Ro=Co.length;if(Ro!==yo.length)throw new Error("Wrong number of arguments to case "+mo+". Expected "+yo.length+" ("+yo+"), got "+Ro);return{fold:(...Wo)=>{if(Wo.length!==Qn.length)throw new Error("Wrong number of arguments to fold. Expected "+Qn.length+", got "+Wo.length);return Wo[oo].apply(null,Co)},match:Wo=>{const jo=nc(Wo);if(Un.length!==jo.length)throw new Error("Wrong number of arguments to match. Expected: "+Un.join(",")+`
2024-08-27 12:25:42 +03:00
Actual: `+jo.join(","));if(!dr(Un,us=>Fs(jo,us)))throw new Error("Not all branches were specified when using match. Specified: "+jo.join(", ")+`
2024-08-30 13:38:34 +03:00
Required: `+Un.join(", "));return Wo[mo].apply(null,Co)},log:Wo=>{console.log(Wo,{constructors:Un,constructor:mo,params:Co})}}}}),Xn}};Po.generate([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const Xo=Qn=>{const Un=[],Xn=[];return Qs(Qn,Kn=>{Kn.fold(oo=>{Un.push(oo)},oo=>{Xn.push(oo)})}),{errors:Un,values:Xn}},is=(Qn,Un)=>{const Xn={};return Zl(Qn,(Kn,oo)=>{Fs(Un,oo)||(Xn[oo]=Kn)}),Xn},Ms=(Qn,Un)=>({[Qn]:Un}),vr=Qn=>{const Un={};return Qs(Qn,Xn=>{Un[Xn.key]=Xn.value}),Un},zr=(Qn,Un)=>is(Qn,Un),Jr=(Qn,Un)=>Ms(Qn,Un),La=Qn=>vr(Qn),Ol=(Qn,Un)=>Qn.length===0?yl.value(Un):yl.value(Lc(Un,Dm.apply(void 0,Qn))),Xu=Qn=>yl.error(Us(Qn)),Ac=(Qn,Un)=>{const Xn=Xo(Qn);return Xn.errors.length>0?Xu(Xn.errors):Ol(Xn.values,Un)},gu=Qn=>So(Qn)?Qn:sr,Uh=(Qn,Un,Xn)=>{let Kn=Qn.dom;const oo=gu(Xn);for(;Kn.parentNode;){Kn=Kn.parentNode;const lo=Ds.fromDom(Kn),mo=Un(lo);if(mo.isSome())return mo;if(oo(lo))break}return ko.none()},Jf=(Qn,Un,Xn)=>{const Kn=Un(Qn),oo=gu(Xn);return Kn.orThunk(()=>oo(Qn)?ko.none():Uh(Qn,Un,oo))},hm=(Qn,Un)=>Oc(Qn.element,Un.event.target),Jp={can:Js,abort:sr,run:xo},wp=Qn=>{if(!Su(Qn,"can")&&!Su(Qn,"abort")&&!Su(Qn,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(Qn,null,2)+" does not have can, abort, or run!");return{...Jp,...Qn}},B1=(Qn,Un)=>(...Xn)=>za(Qn,(Kn,oo)=>Kn&&Un(oo).apply(void 0,Xn),!0),Sc=(Qn,Un)=>(...Xn)=>za(Qn,(Kn,oo)=>Kn||Un(oo).apply(void 0,Xn),!1),F1=Qn=>So(Qn)?{can:Js,abort:sr,run:Qn}:Qn,x0=Qn=>{const Un=B1(Qn,oo=>oo.can),Xn=Sc(Qn,oo=>oo.abort);return{can:Un,abort:Xn,run:(...oo)=>{Qs(Qn,lo=>{lo.run.apply(void 0,oo)})}}},nd=Mo,mm=nd("touchstart"),Nb=nd("touchmove"),H1=nd("touchend"),Fl=nd("touchcancel"),Xl=nd("mousedown"),Qd=nd("mousemove"),Rf=nd("mouseout"),Cv=nd("mouseup"),eg=nd("mouseover"),Wu=nd("focusin"),pm=nd("focusout"),op=nd("keydown"),Q1=nd("keyup"),o1=nd("input"),E0=nd("change"),Lg=nd("click"),lC=nd("transitioncancel"),V1=nd("transitionend"),By=nd("transitionstart"),z1=nd("selectstart"),Pd=Qn=>Mo("alloy."+Qn),Cp={tap:Pd("tap")},tg=Pd("focus"),W1=Pd("blur.post"),U1=Pd("paste.post"),T0=Pd("receive"),Im=Pd("execute"),md=Pd("focus.item"),ng=Cp.tap,DO=Pd("longpress"),Fy=Pd("sandbox.close"),Hy=Pd("typeahead.cancel"),Z1=Pd("system.init"),Ah=Pd("system.touchmove"),kp=Pd("system.touchend"),s1=Pd("system.scroll"),Ig=Pd("system.resize"),Zh=Pd("system.attached"),xp=Pd("system.detached"),q1=Pd("system.dismissRequested"),hS=Pd("system.repositionRequested"),MO=Pd("focusmanager.shifted"),kv=Pd("slotcontainer.visibility"),j1=Pd("system.external.element.scroll"),xv=Pd("change.tab"),NO=Pd("dismiss.tab"),Ev=Pd("highlight"),Tv=Pd("dehighlight"),Wl=(Qn,Un)=>{Lb(Qn,Qn.element,Un,{})},Qa=(Qn,Un,Xn)=>{Lb(Qn,Qn.element,Un,Xn)},og=Qn=>{Wl(Qn,Im())},Av=(Qn,Un,Xn)=>{Lb(Qn,Un,Xn,{})},Lb=(Qn,Un,Xn,Kn)=>{const oo={target:Un,...Kn};Qn.getSystem().triggerEvent(Xn,Un,oo)},T2=(Qn,Un,Xn,Kn)=>{const oo={...Kn,target:Un};Qn.getSystem().triggerEvent(Xn,Un,oo)},LO=(Qn,Un,Xn,Kn)=>{Qn.getSystem().triggerEvent(Xn,Un,Kn.event)},Jc=Qn=>La(Qn),IO=(Qn,Un)=>({key:Qn,value:wp({abort:Un})}),Qy=(Qn,Un)=>({key:Qn,value:wp({can:Un})}),mS=Qn=>({key:Qn,value:wp({run:(Un,Xn)=>{Xn.event.prevent()}})}),wr=(Qn,Un)=>({key:Qn,value:wp({run:Un})}),sg=(Qn,Un,Xn)=>({key:Qn,value:wp({run:(Kn,oo)=>{Un.apply(void 0,[Kn,oo].concat(Xn))}})}),cC=Qn=>Un=>wr(Qn,Un),Pv=Qn=>Un=>({key:Qn,value:wp({run:(Xn,Kn)=>{hm(Xn,Kn)&&Un(Xn,Kn)}})}),A2=(Qn,Un)=>wr(Qn,(Xn,Kn)=>{Xn.getSystem().getByUid(Un).each(oo=>{LO(oo,oo.element,Qn,Kn)})}),A0=(Qn,Un,Xn)=>{const Kn=Un.partUids[Xn];return A2(Qn,Kn)},pS=(Qn,Un)=>wr(Qn,(Xn,Kn)=>{const oo=Kn.event,lo=Xn.getSystem().getByDom(oo.target).getOrThunk(()=>Jf(oo.target,yo=>Xn.getSystem().getByDom(yo).toOptional(),sr).getOr(Xn));Un(Xn,lo,Kn)}),X1=Qn=>wr(Qn,(Un,Xn)=>{Xn.cut()}),Y1=Qn=>wr(Qn,(Un,Xn)=>{Xn.stop()}),rg=(Qn,Un)=>Pv(Qn)(Un),eu=Pv(Zh()),ig=Pv(xp()),$v=Pv(Z1()),qh=cC(Im()),Ll=(Qn,Un)=>{const Kn=(Un||document).createElement("div");return Kn.innerHTML=Qn,kf(Ds.fromDom(Kn))},Rv=Qn=>Qn.dom.innerHTML,G1=(Qn,Un)=>{const Kn=vd(Qn
2024-08-27 12:25:42 +03:00
Originator: `+r1(Kn)+`
Target: `+r1(oo)+`
Check the `+tg()+" event handlers"),!1):!0})]);var P0=Object.freeze({__proto__:null,events:FO});let Uf=0;const ba=Qn=>{const Xn=new Date().getTime(),Kn=Math.floor(Math.random()*1e9);return Uf++,Qn+"_"+Kn+Uf+String(Xn)},P2=Mo("alloy-id-"),gS=Mo("data-alloy-id"),K1=P2(),gm=gS(),J1=(Qn,Un)=>{const Xn=ba(K1+Qn);return Dv(Un,Xn),Xn},Dv=(Qn,Un)=>{Object.defineProperty(Qn.dom,gm,{value:Un,writable:!0})},$0=Qn=>{const Un=fc(Qn)?Qn.dom[gm]:null;return ko.from(Un)},Mv=Qn=>ba(Qn),HO=es,Ep=Qn=>{const Un=oo=>`The component must be in a context to execute: ${oo}`+(Qn?`
2024-08-30 13:38:34 +03:00
`+r1(Qn().element)+" is not in context.":""),Xn=oo=>()=>{throw new Error(Un(oo))},Kn=oo=>()=>{console.warn(Un(oo))};return{debugInfo:Mo("fake"),triggerEvent:Kn("triggerEvent"),triggerFocus:Kn("triggerFocus"),triggerEscape:Kn("triggerEscape"),broadcast:Kn("broadcast"),broadcastOn:Kn("broadcastOn"),broadcastEvent:Kn("broadcastEvent"),build:Xn("build"),buildOrPatch:Xn("buildOrPatch"),addToWorld:Xn("addToWorld"),removeFromWorld:Xn("removeFromWorld"),addToGui:Xn("addToGui"),removeFromGui:Xn("removeFromGui"),getByUid:Xn("getByUid"),getByDom:Xn("getByDom"),isConnected:sr}},ag=Ep(),Nv=(Qn,Un,Xn)=>{const Kn=Xn.toString(),oo=Kn.indexOf(")")+1,lo=Kn.indexOf("("),mo=Kn.substring(lo+1,oo-1).split(/,\s*/);return Qn.toFunctionAnnotation=()=>({name:Un,parameters:Tp(mo.slice(0,1).concat(mo.slice(3)))}),Qn},Tp=Qn=>hs(Qn,Un=>ad(Un,"/*")?Un.substring(0,Un.length-2):Un),QO=(Qn,Un)=>{const Xn=Qn.toString(),Kn=Xn.indexOf(")")+1,oo=Xn.indexOf("("),lo=Xn.substring(oo+1,Kn-1).split(/,\s*/);return Qn.toFunctionAnnotation=()=>({name:Un,parameters:Tp(lo)}),Qn},dC=(Qn,Un)=>{const Xn=Un.toString(),Kn=Xn.indexOf(")")+1,oo=Xn.indexOf("("),lo=Xn.substring(oo+1,Kn-1).split(/,\s*/);return Qn.toFunctionAnnotation=()=>({name:"OVERRIDE",parameters:Tp(lo.slice(1))}),Qn},Lv=ba("alloy-premade"),i1=Qn=>(Object.defineProperty(Qn.element.dom,Lv,{value:Qn.uid,writable:!0}),Jr(Lv,Qn)),fC=Qn=>Pl(Qn.dom,Lv),Iv=Qn=>Rr(Qn,Lv),eb=Qn=>dC((Un,...Xn)=>Qn(Un.getApis(),Un,...Xn),Qn),Ap={init:()=>ph({readState:Mo("No State required")})},ph=Qn=>Qn,bS=(Qn,Un)=>{const Xn=hs(Un,oo=>hh(oo.name(),[Er("config"),Gs("state",Ap)])),Kn=Lu("component.behaviours",Ta(Xn),Qn.behaviours).fold(oo=>{throw new Error(Gf(oo)+`
2024-08-27 12:25:42 +03:00
Complete spec:
2024-08-30 13:38:34 +03:00
`+JSON.stringify(Qn,null,2))},es);return{list:Un,data:Vl(Kn,oo=>{const lo=oo.map(mo=>({config:mo.config,state:mo.state.init(mo.config)}));return Mo(lo)})}},vS=Qn=>Qn.list,yS=Qn=>Qn.data,Bv=(Qn,Un)=>{const Xn={};return Zl(Qn,(Kn,oo)=>{Zl(Kn,(lo,mo)=>{const yo=Rr(Xn,mo).getOr([]);Xn[mo]=yo.concat([Un(oo,lo)])})}),Xn},bm=Qn=>({classes:ho(Qn.classes)?[]:Qn.classes,attributes:ho(Qn.attributes)?{}:Qn.attributes,styles:ho(Qn.styles)?{}:Qn.styles}),Bm=(Qn,Un)=>({...Qn,attributes:{...Qn.attributes,...Un.attributes},styles:{...Qn.styles,...Un.styles},classes:Qn.classes.concat(Un.classes)}),a1=(Qn,Un,Xn,Kn)=>{const oo={...Un};Qs(Xn,Lo=>{oo[Lo.name()]=Lo.exhibit(Qn,Kn)});const lo=Bv(oo,(Lo,Wo)=>({name:Lo,modification:Wo})),mo=Lo=>Ca(Lo,(Wo,jo)=>({...jo.modification,...Wo}),{}),yo=Ca(lo.classes,(Lo,Wo)=>Wo.modification.concat(Lo),[]),Co=mo(lo.attributes),Ro=mo(lo.styles);return bm({classes:yo,attributes:Co,styles:Ro})},VO=(Qn,Un,Xn,Kn)=>{try{const oo=Ml(Xn,(lo,mo)=>{const yo=lo[Un],Co=mo[Un],Ro=Kn.indexOf(yo),Lo=Kn.indexOf(Co);if(Ro===-1)throw new Error("The ordering for "+Qn+" does not have an entry for "+yo+`.
2024-08-27 12:25:42 +03:00
Order specified: `+JSON.stringify(Kn,null,2));if(Lo===-1)throw new Error("The ordering for "+Qn+" does not have an entry for "+Co+`.
Order specified: `+JSON.stringify(Kn,null,2));return Ro<Lo?-1:Lo<Ro?1:0});return yl.value(oo)}catch(oo){return yl.error([oo])}},hC=(Qn,Un)=>({handler:Qn,purpose:Un}),mC=(Qn,Un)=>({cHandler:Qn,purpose:Un}),OS=(Qn,Un)=>mC(ps.apply(void 0,[Qn.handler].concat(Un)),Qn.purpose),Fv=Qn=>Qn.cHandler,Hv=(Qn,Un)=>({name:Qn,handler:Un}),zO=(Qn,Un)=>{const Xn={};return Qs(Qn,Kn=>{Xn[Kn.name()]=Kn.handlers(Un)}),Xn},$2=(Qn,Un,Xn)=>{const Kn={...Xn,...zO(Un,Qn)};return Bv(Kn,Hv)},WO=(Qn,Un,Xn,Kn)=>{const oo=$2(Qn,Xn,Kn);return _S(oo,Un)},Qv=Qn=>{const Un=F1(Qn);return(Xn,Kn,...oo)=>{const lo=[Xn,Kn].concat(oo);Un.abort.apply(void 0,lo)?Kn.stop():Un.can.apply(void 0,lo)&&Un.run.apply(void 0,lo)}},R2=(Qn,Un)=>yl.error(["The event ("+Qn+`) has more than one behaviour that listens to it.
When this occurs, you must specify an event ordering for the behaviours in your spec (e.g. [ "listing", "toggling" ]).
2024-08-30 13:38:34 +03:00
The behaviours that can trigger it are: `+JSON.stringify(hs(Un,Xn=>Xn.name),null,2)]),zy=(Qn,Un,Xn)=>{const Kn=Un[Xn];return Kn?VO("Event: "+Xn,"name",Qn,Kn).map(oo=>{const lo=hs(oo,mo=>mo.handler);return x0(lo)}):R2(Xn,Qn)},_S=(Qn,Un)=>{const Xn=rd(Qn,(Kn,oo)=>(Kn.length===1?yl.value(Kn[0].handler):zy(Kn,Un,oo)).map(mo=>{const yo=Qv(mo),Co=Kn.length>1?ga(Un[oo],Ro=>Br(Kn,Lo=>Lo.name===Ro)).join(" > "):Kn[0].name;return Jr(oo,hC(yo,Co))}));return Ac(Xn,{})},vm="alloy.base.behaviour",Wy=Ta([Bd("dom","dom",sc(),Ta([Er("tag"),Gs("styles",{}),Gs("classes",[]),Gs("attributes",{}),Tc("value"),Tc("innerHtml")])),Er("components"),Er("uid"),Gs("events",{}),Gs("apis",{}),Bd("eventOrder","eventOrder",dm({[Im()]:["disabling",vm,"toggling","typeaheadevents"],[tg()]:[vm,"focusing","keying"],[Z1()]:[vm,"disabling","toggling","representing"],[o1()]:[vm,"representing","streaming","invalidating"],[xp()]:[vm,"representing","item-events","tooltipping"],[Xl()]:["focusing",vm,"item-type-events"],[mm()]:["focusing",vm,"item-type-events"],[eg()]:["item-type-events","tooltipping"],[T0()]:["receiving","reflecting","tooltipping"]}),Ad()),Tc("domModification")]),SS=Qn=>Lu("custom.definition",Wy,Qn),UO=Qn=>({...Qn.dom,uid:Qn.uid,domChildren:hs(Qn.components,Un=>Un.element)}),TT=Qn=>Qn.domModification.fold(()=>bm({}),bm),ZO=Qn=>Qn.events,tb=(Qn,Un)=>{const Xn=Bu(Qn,Un);return Xn===void 0||Xn===""?[]:Xn.split(" ")},l1=(Qn,Un,Xn)=>{const oo=tb(Qn,Un).concat([Xn]);return aa(Qn,Un,oo.join(" ")),!0},wS=(Qn,Un,Xn)=>{const Kn=ga(tb(Qn,Un),oo=>oo!==Xn);return Kn.length>0?aa(Qn,Un,Kn.join(" ")):_s(Qn,Un),!1},Vv=Qn=>Qn.dom.classList!==void 0,qO=Qn=>tb(Qn,"class"),pC=(Qn,Un)=>l1(Qn,"class",Un),Eu=(Qn,Un)=>wS(Qn,"class",Un),lg=(Qn,Un)=>Fs(qO(Qn),Un)?Eu(Qn,Un):pC(Qn,Un),$d=(Qn,Un)=>{Vv(Qn)?Qn.dom.classList.add(Un):pC(Qn,Un)},gC=Qn=>{(Vv(Qn)?Qn.dom.classList:qO(Qn)).length===0&&_s(Qn,"class")},Yu=(Qn,Un)=>{Vv(Qn)?Qn.dom.classList.remove(Un):Eu(Qn,Un),gC(Qn)},R0=(Qn,Un)=>{const Xn=Vv(Qn)?Qn.dom.classList.toggle(Un):lg(Qn,Un);return gC(Qn),Xn},of=(Qn,Un)=>Vv(Qn)&&Qn.dom.classList.contains(Un),od=(Qn,Un)=>{Qs(Un,Xn=>{$d(Qn,Xn)})},sp=(Qn,Un)=>{Qs(Un,Xn=>{Yu(Qn,Xn)})},CS=(Qn,Un)=>{Qs(Un,Xn=>{R0(Qn,Xn)})},Df=(Qn,Un)=>dr(Un,Xn=>of(Qn,Xn)),Uy=Qn=>{const Un=Qn.dom.classList,Xn=new Array(Un.length);for(let Kn=0;Kn<Un.length;Kn++){const oo=Un.item(Kn);oo!==null&&(Xn[Kn]=oo)}return Xn},zv=Qn=>Vv(Qn)?Uy(Qn):qO(Qn),c1=Qn=>Qn.dom.value,Wv=(Qn,Un)=>{if(Un===void 0)throw new Error("Value.set was undefined");Qn.dom.value=Un},Bb=(Qn,Un,Xn)=>Fh(Qn,Un).map(oo=>{if(Xn.exists(mo=>!Oc(mo,oo))){const mo=Xn.map(Nd).getOr("span"),yo=Ds.fromTag(mo);return _d(oo,yo),yo}else return oo}),nb=(Qn,Un,Xn)=>{Xn.fold(()=>Id(Qn,Un),Kn=>{Oc(Kn,Un)||(_d(Kn,Un),am(Kn))})},D2=(Qn,Un,Xn)=>{const Kn=hs(Un,Xn),oo=kf(Qn);return Qs(oo.slice(Kn.length),am),Kn},bC=(Qn,Un,Xn,Kn)=>{const oo=Fh(Qn,Un),lo=Kn(Xn,oo),mo=Bb(Qn,Un,oo);return nb(Qn,lo.element,mo),lo},AT=(Qn,Un,Xn)=>D2(Qn,Un,(Kn,oo)=>bC(Qn,oo,Kn,Xn)),PT=(Qn,Un)=>D2(Qn,Un,(Xn,Kn)=>{const oo=Fh(Qn,Kn);return nb(Qn,Xn,oo),Xn}),cg=(Qn,Un)=>{const Xn=nc(Qn),Kn=nc(Un),oo=nr(Kn,Xn),lo=kc(Qn,(mo,yo)=>!Pl(Un,yo)||mo!==Un[yo]).t;return{toRemove:oo,toSet:lo}},$h=(Qn,Un)=>{const{class:Xn,style:Kn,...oo}=ar(Un),{toSet:lo,toRemove:mo}=cg(Qn.attributes,oo),yo=()=>{Qs(mo,Xs=>_s(Un,Xs)),Qp(Un,lo)},Co=jc(Un),{toSet:Ro,toRemove:Lo}=cg(Qn.styles,Co),Wo=()=>{Qs(Lo,Xs=>El(Un,Xs)),fu(Un,Ro)},jo=zv(Un),Jo=nr(jo,Qn.classes),us=nr(Qn.classes,jo),Ps=()=>{od(Un,us),sp(Un,Jo)},er=Xs=>{G1(Un,Xs)},Bs=()=>{const Xs=Qn.domChildren;PT(Un,Xs)},Ns=()=>{const Xs=Un,Hr=Qn.value.getOrUndefined();Hr!==c1(Xs)&&Wv(Xs,Hr??"")};return yo(),Ps(),Wo(),Qn.innerHtml.fold(Bs,er),Ns(),Un},M2=Qn=>{const Un=Ds.fromTag(Qn.tag);Qp(Un,Qn.attributes),od(Un,Qn.classes),fu(Un,Qn.styles),Qn.innerHtml.each(Kn=>G1(Un,Kn));const Xn=Qn.domChildren;return Rm(Un,Xn),Qn.value.each(Kn=>{Wv(Un,Kn)}),Un},N2=(Qn,Un)=>{try{const Xn=$h(Qn,Un);return ko.some(Xn)}catch{return ko.none()}},Fb=Qn=>Qn.innerHtml.isSome()&&Qn.domChildren.length>0,Zy=(Qn,Un)=>{const Xn=oo=>Nd(oo)===Qn.tag&&!Fb(Qn)&&!fC(oo),Kn=Un.filter(Xn).bind(oo=>N
`);return Zs(Un,Xn=>Xn.indexOf("alloy")>0&&!Br(I2,Kn=>Xn.indexOf(Kn)>-1)).getOr(wC)}else return wC},B2={logEventCut:xo,logEventStopped:xo,logNoParent:xo,logEventNoHandlers:xo,logEventResponse:xo,write:xo},KO=(Qn,Un,Xn)=>xS(Qn,Un,Xn),jv=Mo(B2),Qm=Mo([Er("menu"),Er("selectedMenu")]),CC=Mo([Er("item"),Er("selectedItem")]);Mo(Ta(CC().concat(Qm())));const Xv=Mo(Ta(CC())),kC=fm("initSize",[Er("numColumns"),Er("numRows")]),F2=()=>Kf("markers",Xv()),qy=()=>fm("markers",[Er("backgroundMenu")].concat(Qm()).concat(CC())),Wb=Qn=>fm("markers",hs(Qn,Er)),JO=(Qn,Un,Xn)=>(ES(),Bd(Un,Un,Xn,Rg(Kn=>yl.value((...oo)=>Kn.apply(void 0,oo))))),rc=Qn=>JO("onHandler",Qn,um(xo)),Vm=Qn=>JO("onKeyboardHandler",Qn,um(ko.none)),Fg=Qn=>JO("onHandler",Qn,sc()),Yv=Qn=>JO("onKeyboardHandler",Qn,sc()),tu=(Qn,Un)=>pu(Qn,Mo(Un)),Gv=Qn=>pu(Qn,es),e_=Mo(kC),Yd=(Qn,Un,Xn,Kn,oo,lo,mo,yo=!1)=>({x:Qn,y:Un,bubble:Xn,direction:Kn,placement:oo,restriction:lo,label:`${mo}-${oo}`,alwaysFit:yo}),Hg=Po.generate([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),sb=(Qn,Un,Xn,Kn,oo,lo,mo,yo,Co)=>Qn.fold(Un,Xn,Kn,oo,lo,mo,yo,Co),t_=(Qn,Un,Xn,Kn)=>Qn.fold(Un,Un,Kn,Kn,Un,Kn,Xn,Xn),jy=(Qn,Un,Xn,Kn)=>Qn.fold(Un,Kn,Un,Kn,Xn,Xn,Un,Kn),Xy=Hg.southeast,TS=Hg.southwest,n_=Hg.northeast,Pp=Hg.northwest,ug=Hg.south,H2=Hg.north,lr=Hg.east,H0=Hg.west,Q0=(Qn,Un,Xn,Kn)=>{const oo=Qn+Un;return oo>Kn?Xn:oo<Xn?Kn:oo},rp=(Qn,Un,Xn)=>Math.min(Math.max(Qn,Un),Xn),AS=(Qn,Un)=>{switch(Un){case 1:return Qn.x;case 0:return Qn.x+Qn.width;case 2:return Qn.y;case 3:return Qn.y+Qn.height}},Uu=(Qn,Un)=>Kr(["left","right","top","bottom"],Xn=>Rr(Un,Xn).map(Kn=>AS(Qn,Kn))),o_=(Qn,Un,Xn)=>{const Kn=(Co,Ro)=>Un[Co].map(Lo=>{const Wo=Co==="top"||Co==="bottom",jo=Wo?Xn.top:Xn.left,us=(Co==="left"||Co==="top"?Math.max:Math.min)(Lo,Ro)+jo;return Wo?rp(us,Qn.y,Qn.bottom):rp(us,Qn.x,Qn.right)}).getOr(Ro),oo=Kn("left",Qn.x),lo=Kn("top",Qn.y),mo=Kn("right",Qn.right),yo=Kn("bottom",Qn.bottom);return Kc(oo,lo,mo-oo,yo-lo)},rb="layout",PS=Qn=>Qn.x,s_=(Qn,Un)=>Qn.x+Qn.width/2-Un.width/2,$S=(Qn,Un)=>Qn.x+Qn.width-Un.width,Yy=(Qn,Un)=>Qn.y-Un.height,Kv=Qn=>Qn.y+Qn.height,RS=(Qn,Un)=>Qn.y+Qn.height/2-Un.height/2,Q2=Qn=>Qn.x+Qn.width,Dd=(Qn,Un)=>Qn.x-Un.width,gf=(Qn,Un,Xn)=>Yd(PS(Qn),Kv(Qn),Xn.southeast(),Xy(),"southeast",Uu(Qn,{left:1,top:3}),rb),eh=(Qn,Un,Xn)=>Yd($S(Qn,Un),Kv(Qn),Xn.southwest(),TS(),"southwest",Uu(Qn,{right:0,top:3}),rb),bf=(Qn,Un,Xn)=>Yd(PS(Qn),Yy(Qn,Un),Xn.northeast(),n_(),"northeast",Uu(Qn,{left:1,bottom:2}),rb),$l=(Qn,Un,Xn)=>Yd($S(Qn,Un),Yy(Qn,Un),Xn.northwest(),Pp(),"northwest",Uu(Qn,{right:0,bottom:2}),rb),Rh=(Qn,Un,Xn)=>Yd(s_(Qn,Un),Yy(Qn,Un),Xn.north(),H2(),"north",Uu(Qn,{bottom:2}),rb),bu=(Qn,Un,Xn)=>Yd(s_(Qn,Un),Kv(Qn),Xn.south(),ug(),"south",Uu(Qn,{top:3}),rb),vf=(Qn,Un,Xn)=>Yd(Q2(Qn),RS(Qn,Un),Xn.east(),lr(),"east",Uu(Qn,{left:0}),rb),Gy=(Qn,Un,Xn)=>Yd(Dd(Qn,Un),RS(Qn,Un),Xn.west(),H0(),"west",Uu(Qn,{right:1}),rb),d1=()=>[gf,eh,bf,$l,bu,Rh,vf,Gy],Ky=()=>[eh,gf,$l,bf,bu,Rh,vf,Gy],DS=()=>[bf,$l,gf,eh,Rh,bu],xC=()=>[$l,bf,eh,gf,Rh,bu],r_=()=>[gf,eh,bf,$l,bu,Rh],MS=()=>[eh,gf,$l,bf,bu,Rh],NS=(Qn,Un)=>Un.universal?Qn:ga(Qn,Xn=>Fs(Un.channels,Xn));var f1=Object.freeze({__proto__:null,events:Qn=>Jc([wr(T0(),(Un,Xn)=>{const Kn=Qn.channels,oo=nc(Kn),lo=Xn,mo=NS(oo,lo);Qs(mo,yo=>{const Co=Kn[yo],Ro=Co.schema,Lo=td("channel["+yo+`] data
Receiver: `+r1(Un.element),Ro,lo.data);Co.onReceive(Un,Lo)})})])}),EC=[Kf("channels",Dg(yl.value,mu([Fg("onReceive"),Gs("schema",Ad())])))];const ib=(Qn,Un,Xn)=>qh(Kn=>{Xn(Kn,Qn,Un)}),Vd=(Qn,Un,Xn)=>$v((Kn,oo)=>{Xn(Kn,Qn,Un)}),yf=(Qn,Un,Xn,Kn,oo,lo)=>{const mo=mu(Qn),yo=hh(Un,[np("config",Qn)]);return Qg(mo,yo,Un,Xn,Kn,oo,lo)},z2=(Qn,Un,Xn,Kn,oo,lo)=>{const mo=Qn,yo=hh(Un,[Fd("config",Qn)]);return Qg(mo,yo,Un,Xn,Kn,oo,lo)},ym=(Qn,Un,Xn)=>Nv((oo,...lo)=>{const mo=[oo].concat(lo);return oo.config({name:Mo(Qn)}).fold(()=>{throw new Error("We could not find any behaviour configuration for: "+Qn+". Using API: "+Xn)},yo=>{const Co=Array.prototype.slice.call(mo,1);return Un.apply(void 0,[oo,yo.config,yo.state].concat(Co))})},Xn,Un),$T=Qn=>({key:Qn,value:void 0}),Qg=(Qn,Un,Xn,Kn,oo,lo,mo)=>{const yo=Wo=>Su(Wo,Xn)?Wo[Xn]():ko.none(),Co=Vl(oo,(Wo,jo)=>ym(Xn,Wo,jo)),Lo={...Vl(lo,(Wo,jo)=>QO(Wo,jo)),...Co,revoke:ps($T,Xn),config:Wo=>{const jo=td(Xn+"-config",Qn,Wo);return{key:Xn,value:{config:jo,me:Lo,configAsRaw:Du(()=>td(Xn+"-config",Qn,Wo)),initialConfig:Wo,state:mo}}},schema:Mo(Un),exhibit:(Wo,jo)=>ia(yo(Wo),Rr(Kn,"exhibit"),(Jo,us)=>us(jo,Jo.config,Jo.state)).getOrThunk(()=>bm({})),name:Mo(Xn),handlers:Wo=>yo(Wo).map(jo=>Rr(Kn,"events").getOr(()=>({}))(jo.config,jo.state)).getOr({})};return Lo},Zr=Qn=>La(Qn),LS=mu([Er("fields"),Er("name"),Gs("active",{}),Gs("apis",{}),Gs("state",Ap),Gs("extra",{})]),Of=Qn=>{const Un=td("Creating behaviour: "+Qn.name,LS,Qn);return yf(Un.fields,Un.name,Un.active,Un.apis,Un.extra,Un.state)},IS=mu([Er("branchKey"),Er("branches"),Er("name"),Gs("active",{}),Gs("apis",{}),Gs("state",Ap),Gs("extra",{})]),Ub=Qn=>{const Un=td("Creating behaviour: "+Qn.name,IS,Qn);return z2(jl(Un.branchKey,Un.branches),Un.name,Un.active,Un.apis,Un.extra,Un.state)},Jy=Mo(void 0),Om=Of({fields:EC,name:"receiving",active:f1});var eO=Object.freeze({__proto__:null,exhibit:(Qn,Un)=>bm({classes:[],styles:Un.useFixed()?{}:{position:"relative"}})});const Cd=(Qn,Un=!1)=>Qn.dom.focus({preventScroll:Un}),Vg=Qn=>Qn.dom.blur(),tO=Qn=>{const Un=rr(Qn).dom;return Qn.dom===Un.activeElement},h1=(Qn=Op())=>ko.from(Qn.dom.activeElement).map(Ds.fromDom),dg=Qn=>h1(rr(Qn)).filter(Un=>Qn.dom.contains(Un.dom)),ma=(Qn,Un)=>{const Xn=rr(Un),Kn=h1(Xn).bind(lo=>{const mo=yo=>Oc(lo,yo);return mo(Un)?ko.some(Un):SC(Un,mo)}),oo=Qn(Un);return Kn.each(lo=>{h1(Xn).filter(mo=>Oc(mo,lo)).fold(()=>{Cd(lo)},xo)}),oo},ip=(Qn,Un,Xn,Kn,oo)=>{const lo=mo=>mo+"px";return{position:Qn,left:Un.map(lo),top:Xn.map(lo),right:Kn.map(lo),bottom:oo.map(lo)}},BS=Qn=>({...Qn,position:ko.some(Qn.position)}),m1=(Qn,Un)=>{Lr(Qn,BS(Un))},Ic=Po.generate([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),FS=(Qn,Un,Xn,Kn,oo,lo)=>{const mo=Un.rect,yo=mo.x-Xn,Co=mo.y-Kn,Ro=mo.width,Lo=mo.height,Wo=oo-(yo+Ro),jo=lo-(Co+Lo),Jo=ko.some(yo),us=ko.some(Co),Ps=ko.some(Wo),er=ko.some(jo),Bs=ko.none();return sb(Un.direction,()=>ip(Qn,Jo,us,Bs,Bs),()=>ip(Qn,Bs,us,Ps,Bs),()=>ip(Qn,Jo,Bs,Bs,er),()=>ip(Qn,Bs,Bs,Ps,er),()=>ip(Qn,Jo,us,Bs,Bs),()=>ip(Qn,Jo,Bs,Bs,er),()=>ip(Qn,Jo,us,Bs,Bs),()=>ip(Qn,Bs,us,Ps,Bs))},ap=(Qn,Un)=>Qn.fold(()=>{const Xn=Un.rect;return ip("absolute",ko.some(Xn.x),ko.some(Xn.y),ko.none(),ko.none())},(Xn,Kn,oo,lo)=>FS("absolute",Un,Xn,Kn,oo,lo),(Xn,Kn,oo,lo)=>FS("fixed",Un,Xn,Kn,oo,lo)),i_=(Qn,Un)=>{const Xn=ps(Zp,Un),Kn=Qn.fold(Xn,Xn,()=>{const mo=Af();return Zp(Un).translate(-mo.left,-mo.top)}),oo=yd(Un),lo=Vp(Un);return Kc(Kn.left,Kn.top,oo,lo)},W2=(Qn,Un)=>Un.fold(()=>Qn.fold(tf,tf,Kc),Xn=>Qn.fold(Mo(Xn),Mo(Xn),()=>{const Kn=Zu(Qn,Xn.x,Xn.y);return Kc(Kn.left,Kn.top,Xn.width,Xn.height)})),Zu=(Qn,Un,Xn)=>{const Kn=vc(Un,Xn),oo=()=>{const lo=Af();return Kn.translate(-lo.left,-lo.top)};return Qn.fold(Mo(Kn),Mo(Kn),oo)},U2=(Qn,Un,Xn,Kn)=>Qn.fold(Un,Xn,Kn);Ic.none;const bh=Ic.relative,Zb=Ic.fixed,Z2=(Qn,Un)=>({anchorBox:Qn,origin:Un}),q2=(Qn,Un)=>Z2(Qn,Un),HS="data-alloy-placement",j2=(Qn,Un)=>{aa(Qn,HS,Un)},AC=Qn=>Uo(Qn,HS),PC=Qn=>_s(Qn,HS),nO=Po.generate([{fit:["reposition"]},{nofit:["reposition","visibleW","visibleH","isVisible"]}]),$C=(Q
2024-08-27 12:25:42 +03:00
Known: [`+nc(Kn)+`]
Namespace: `+Qn.getOr("none")+`
2024-08-30 13:38:34 +03:00
Spec: `+JSON.stringify(Xn,null,2))},oo=>oo.replace()),ck=(Qn,Un,Xn,Kn)=>fb(Xn)&&Xn.uiType===ak?lk(Qn,Un,Xn,Kn):fw.single(!1,Mo(Xn)),E_=(Qn,Un,Xn,Kn)=>ck(Qn,Un,Xn,Kn).fold((lo,mo)=>{const yo=fb(Xn)?mo(Un,Xn.config,Xn.validated):mo(Un),Co=Rr(yo,"components").getOr([]),Ro=fs(Co,Lo=>E_(Qn,Un,Lo,Kn));return[{...yo,components:Ro}]},(lo,mo)=>{if(fb(Xn)){const yo=mo(Un,Xn.config,Xn.validated);return Xn.validated.preprocess.getOr(es)(yo)}else return mo(Un)}),WT=(Qn,Un,Xn,Kn)=>fs(Xn,oo=>E_(Qn,Un,oo,Kn)),hw=(Qn,Un)=>{let Xn=!1;const Kn=()=>Xn,oo=()=>{if(Xn)throw new Error("Trying to use the same placeholder more than once: "+Qn);return Xn=!0,Un},lo=()=>Un.fold((mo,yo)=>mo,(mo,yo)=>mo);return{name:Mo(Qn),required:lo,used:Kn,replace:oo}},Tx=(Qn,Un,Xn,Kn)=>{const oo=Vl(Kn,(mo,yo)=>hw(yo,mo)),lo=WT(Qn,Un,Xn,oo);return Zl(oo,mo=>{if(mo.used()===!1&&mo.required())throw new Error("Placeholder: "+mo.name()+` was not found in components list
2024-08-27 12:25:42 +03:00
Namespace: `+Qn.getOr("none")+`
2024-08-30 13:38:34 +03:00
Components: `+JSON.stringify(Un.components,null,2))}),lo},Ax=fw.single,k3=fw.multiple,hb=Mo(ak),uk=Po.generate([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),T_=Gs("factory",{sketch:es}),Nh=Gs("schema",[]),Sf=Er("name"),dk=Bd("pname","pname",hf(Qn=>"<alloy."+ba(Qn.name)+">"),Ad()),mw=pu("schema",()=>[Tc("preprocess")]),fk=Gs("defaults",Mo({})),pw=Gs("overrides",Mo({})),gw=Ta([T_,Nh,Sf,dk,fk,pw]),A_=Ta([T_,Nh,Sf,fk,pw]),UT=Ta([T_,Nh,Sf,dk,fk,pw]),bw=Ta([T_,mw,Sf,Er("unit"),dk,fk,pw]),ZT=Qn=>Qn.fold(ko.some,ko.none,ko.some,ko.some),qT=Qn=>{const Un=Xn=>Xn.name;return Qn.fold(Un,Un,Un,Un)},jT=Qn=>Qn.fold(es,es,es,es),Ug=(Qn,Un)=>Xn=>{const Kn=td("Converting part type",Un,Xn);return Qn(Kn)},Xh=Ug(uk.required,gw),v1=Ug(uk.external,A_),up=Ug(uk.optional,UT),vw=Ug(uk.group,bw),hk=Mo("entirety");var XT=Object.freeze({__proto__:null,required:Xh,external:v1,optional:up,group:vw,asNamedPart:ZT,name:qT,asCommon:jT,original:hk});const yw=(Qn,Un,Xn,Kn)=>Lc(Un.defaults(Qn,Xn,Kn),Xn,{uid:Qn.partUids[Un.name]},Un.overrides(Qn,Xn,Kn)),x3=(Qn,Un,Xn)=>{const Kn={},oo={};return Qs(Xn,lo=>{lo.fold(mo=>{Kn[mo.pname]=Ax(!0,(yo,Co,Ro)=>mo.factory.sketch(yw(yo,mo,Co,Ro)))},mo=>{const yo=Un.parts[mo.name];oo[mo.name]=Mo(mo.factory.sketch(yw(Un,mo,yo[hk()]),yo))},mo=>{Kn[mo.pname]=Ax(!1,(yo,Co,Ro)=>mo.factory.sketch(yw(yo,mo,Co,Ro)))},mo=>{Kn[mo.pname]=k3(!0,(yo,Co,Ro)=>{const Lo=yo[mo.name];return hs(Lo,Wo=>mo.factory.sketch(Lc(mo.defaults(yo,Wo,Ro),Wo,mo.overrides(yo,Wo))))})})}),{internals:Mo(Kn),externals:Mo(oo)}},X0=(Qn,Un)=>{const Xn={};return Qs(Un,Kn=>{ZT(Kn).each(oo=>{const lo=Ow(Qn,oo.pname);Xn[oo.name]=mo=>{const yo=td("Part: "+oo.name+" in "+Qn,Ta(oo.schema),mo);return{...lo,config:mo,validated:yo}}})}),Xn},Ow=(Qn,Un)=>({uiType:hb(),owner:Qn,name:Un}),Px=(Qn,Un,Xn)=>({uiType:hb(),owner:Qn,name:Un,config:Xn,validated:{}}),YT=Qn=>fs(Qn,Un=>Un.fold(ko.none,ko.some,ko.none,ko.none).map(Xn=>fm(Xn.name,Xn.schema.concat([Gv(hk())]))).toArray()),GT=Qn=>hs(Qn,qT),$x=(Qn,Un,Xn)=>x3(Qn,Un,Xn),mk=(Qn,Un,Xn)=>Tx(ko.some(Qn),Un,Un.components,Xn),Au=(Qn,Un,Xn)=>{const Kn=Un.partUids[Xn];return Qn.getSystem().getByUid(Kn).toOptional()},Y0=(Qn,Un,Xn)=>Au(Qn,Un,Xn).getOrDie("Could not find part: "+Xn),KT=(Qn,Un,Xn)=>{const Kn={},oo=Un.partUids,lo=Qn.getSystem();return Qs(Xn,mo=>{Kn[mo]=Mo(lo.getByUid(oo[mo]))}),Kn},Rx=(Qn,Un)=>{const Xn=Qn.getSystem();return Vl(Un.partUids,(Kn,oo)=>Mo(Xn.getByUid(Kn)))},Dx=Qn=>nc(Qn.partUids),fO=(Qn,Un,Xn)=>{const Kn={},oo=Un.partUids,lo=Qn.getSystem();return Qs(Xn,mo=>{Kn[mo]=Mo(lo.getByUid(oo[mo]).getOrDie())}),Kn},Mx=(Qn,Un)=>{const Xn=GT(Un);return La(hs(Xn,Kn=>({key:Kn,value:Qn+"-"+Kn})))},Nx=Qn=>Bd("partUids","partUids",os(Un=>Mx(Un.uid,Qn)),Ad());var E3=Object.freeze({__proto__:null,generate:X0,generateOne:Px,schemas:YT,names:GT,substitutes:$x,components:mk,defaultUids:Mx,defaultUidsSchema:Nx,getAllParts:Rx,getAllPartNames:Dx,getPart:Au,getPartOrDie:Y0,getParts:KT,getPartsOrDie:fO});const P_=(Qn,Un)=>(Qn.length>0?[fm("parts",Qn)]:[]).concat([Er("uid"),Gs("dom",{}),Gs("components",[]),Gv("originalSpec"),Gs("debug.sketcher",{})]).concat(Un),$_=(Qn,Un,Xn,Kn,oo)=>{const lo=P_(Kn,oo);return td(Qn+" [SpecSchema]",mu(lo.concat(Un)),Xn)},Lx=(Qn,Un,Xn,Kn)=>{const oo=fy(Kn),lo=$_(Qn,Un,oo,[],[]);return Xn(lo,oo)},Ix=(Qn,Un,Xn,Kn,oo)=>{const lo=fy(oo),mo=YT(Xn),yo=Nx(Xn),Co=$_(Qn,Un,lo,mo,[yo]),Ro=$x(Qn,Co,Xn),Lo=mk(Qn,Co,Ro.internals());return Kn(Co,Lo,lo,Ro.externals())},y1=Qn=>Pl(Qn,"uid"),fy=Qn=>y1(Qn)?Qn:{...Qn,uid:Mv("uid")},T3=Qn=>Qn.uid!==void 0,_w=mu([Er("name"),Er("factory"),Er("configFields"),Gs("apis",{}),Gs("extraApis",{})]),A3=mu([Er("name"),Er("factory"),Er("configFields"),Er("partFields"),Gs("apis",{}),Gs("extraApis",{})]),Mp=Qn=>{const Un=td("Sketcher for "+Qn.name,_w,Qn),Xn=lo=>Lx(Un.name,Un.configFields,Un.factory,lo),Kn=Vl(Un.apis,eb),oo=Vl(Un.extraApis,(lo,mo)=>QO(lo,mo));return{name:Un.name,configFields:Un.configFields,sketch:Xn,...Kn,...oo}},Yh=Qn=>{const Un=td("Sketcher for "+Qn.name,A3,Qn),Xn=mo=>Ix(Un.name,Un.configFields,Un.partFields,Un.factory,mo),Kn=X0(Un.name,U
`+tm),hv&&(tm=ov(tm,fl," "),tm=ov(tm,rl," "),tm=ov(tm,Yc," ")),Xs&&sH?Xs.createHTML(tm):tm},Un.setConfig=function(lc){DY(lc),CT=!0},Un.clearConfig=function(){f3=null,CT=!1},Un.isValidAttribute=function(lc,gr,Ia){f3||DY({});const bl=kg(lc),Bf=kg(gr);return tK(bl,Bf,Ia)},Un.addHook=function(lc,gr){typeof gr=="function"&&(Sa[lc]=Sa[lc]||[],Gx(Sa[lc],gr))},Un.removeHook=function(lc){if(Sa[lc])return k9(Sa[lc])},Un.removeHooks=function(lc){Sa[lc]&&(Sa[lc]=[])},Un.removeAllHooks=function(){Sa={}},Un}var $L=oE();const gR=Qn=>$L().sanitize(Qn);var _1=tinymce.util.Tools.resolve("tinymce.util.I18n");const L9={indent:!0,outdent:!0,"table-insert-column-after":!0,"table-insert-column-before":!0,"paste-column-after":!0,"paste-column-before":!0,"unordered-list":!0,"list-bull-circle":!0,"list-bull-default":!0,"list-bull-square":!0},RL="temporary-placeholder",bR=Qn=>()=>Rr(Qn,RL).getOr("!not found!"),sE=(Qn,Un)=>{const Xn=Qn.toLowerCase();if(_1.isRtl()){const Kn=Vc(Xn,"-rtl");return Pl(Un,Kn)?Kn:Xn}else return Xn},vR=(Qn,Un)=>Rr(Un,sE(Qn,Un)),yR=(Qn,Un)=>{const Xn=Un();return vR(Qn,Xn).getOrThunk(bR(Xn))},OR=(Qn,Un,Xn)=>{const Kn=Un();return vR(Qn,Kn).or(Xn).getOrThunk(bR(Kn))},I9=Qn=>_1.isRtl()?Pl(L9,Qn):!1,AA=()=>Rl("add-focusable",[eu(Qn=>{GO(Qn.element,"svg").each(Un=>aa(Un,"focusable","false"))})]),DL=(Qn,Un,Xn,Kn)=>{var oo,lo;const mo=I9(Un)?["tox-icon--flip"]:[],yo=Rr(Xn,sE(Un,Xn)).or(Kn).getOrThunk(bR(Xn));return{dom:{tag:Qn.tag,attributes:(oo=Qn.attributes)!==null&&oo!==void 0?oo:{},classes:Qn.classes.concat(mo),innerHtml:yo},behaviours:Zr([...(lo=Qn.behaviours)!==null&&lo!==void 0?lo:[],AA()])}},s0=(Qn,Un,Xn,Kn=ko.none())=>DL(Un,Qn,Xn(),Kn),B9=(Qn,Un,Xn)=>{const Kn=Xn(),oo=Zs(Qn,lo=>Pl(Kn,sE(lo,Kn)));return DL(Un,oo.getOr(RL),Kn,ko.none())},ML={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},_R=Mp({name:"Notification",factory:Qn=>{const Un=ou({dom:vO(`<p>${gR(Qn.translationProvider(Qn.text))}</p>`),behaviours:Zr([Cl.config({})])}),Xn=Jo=>({dom:{tag:"div",classes:["tox-bar"],styles:{width:`${Jo}%`}}}),Kn=Jo=>({dom:{tag:"div",classes:["tox-text"],innerHtml:`${Jo}%`}}),oo=ou({dom:{tag:"div",classes:Qn.progress?["tox-progress-bar","tox-progress-indicator"]:["tox-progress-bar"]},components:[{dom:{tag:"div",classes:["tox-bar-container"]},components:[Xn(0)]},Kn(0)],behaviours:Zr([Cl.config({})])}),yo={updateProgress:(Jo,us)=>{Jo.getSystem().isConnected()&&oo.getOpt(Jo).each(Ps=>{Cl.set(Ps,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[Xn(us)]},Kn(us)])})},updateText:(Jo,us)=>{if(Jo.getSystem().isConnected()){const Ps=Un.get(Jo);Cl.set(Ps,[wd(us)])}}},Co=Us([Qn.icon.toArray(),Qn.level.toArray(),Qn.level.bind(Jo=>ko.from(ML[Jo])).toArray()]),Ro=ou(yh.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"]},components:[s0("close",{tag:"span",classes:["tox-icon"],attributes:{"aria-label":Qn.translationProvider("Close")}},Qn.iconProvider)],action:Jo=>{Qn.onAction(Jo)}})),Lo=B9(Co,{tag:"div",classes:["tox-notification__icon"]},Qn.iconProvider),Wo={dom:{tag:"div",classes:["tox-notification__body"]},components:[Un.asSpec()],behaviours:Zr([Cl.config({})])},jo=[Lo,Wo];return{uid:Qn.uid,dom:{tag:"div",attributes:{role:"alert"},classes:Qn.level.map(Jo=>["tox-notification","tox-notification--in",`tox-notification--${Jo}`]).getOr(["tox-notification","tox-notification--in"])},behaviours:Zr([ol.config({}),Rl("notification-events",[wr(Wu(),Jo=>{Ro.getOpt(Jo).each(ol.focus)})])]),components:jo.concat(Qn.progress?[oo.asSpec()]:[]).concat(Qn.closeButton?[Ro.asSpec()]:[]),apis:yo}},configFields:[Tc("level"),Er("progress"),Tc("icon"),Er("onAction"),Er("text"),Er("iconProvider"),Er("translationProvider"),Xd("closeButton",!0)],apis:{updateProgress:(Qn,Un,Xn)=>{Qn.updateProgress(Un,Xn)},updateText:(Qn,Un,Xn)=>{Qn.updateText(Un,Xn)}}});var SR=(Qn,Un,Xn)=>{const Kn=Un.backstage.shared,oo=()=>{const Co=au(Ds.fromDom(Qn.getContentAreaContainer())),Ro=tf(),Lo=rp(Ro.x,Co.x,Co.right),Wo=rp(Ro.y,Co.y,Co.bottom),jo=Math.max(Co.right,Ro.right),Jo=Math
2024-08-27 12:25:42 +03:00
Cannot use it for: `+r1(Ro.element)+`
2024-08-30 13:38:34 +03:00
The conflicting element is`+(Gl(Wo.element)?" ":" not ")+"already in the DOM")},oo=Ro=>{const Lo=Xn(Ro);Su(Un,Lo)&&Kn(Ro,Lo);const Wo=[Ro];Qn.registerId(Wo,Lo,Ro.events),Un[Lo]=Ro},lo=Ro=>{$0(Ro.element).each(Lo=>{delete Un[Lo],Qn.unregisterId(Lo)})};return{find:(Ro,Lo,Wo)=>Qn.find(Ro,Lo,Wo),filter:Ro=>Qn.filterByType(Ro),register:oo,unregister:lo,getById:Ro=>Rr(Un,Ro)}},rv=Mp({name:"Container",factory:Qn=>{const{attributes:Un,...Xn}=Qn.dom;return{uid:Qn.uid,dom:{tag:"div",attributes:{role:"presentation",...Un},...Xn},components:Qn.components,behaviours:j0(Qn.containerBehaviours),events:Qn.events,domModification:Qn.domModification,eventOrder:Qn.eventOrder}},configFields:[Gs("components",[]),Nf("containerBehaviours",[]),Gs("events",{}),Gs("domModification",{}),Gs("eventOrder",{})]}),bP=Qn=>{const Un=Bs=>Zd(Qn.element).fold(Js,Ns=>Oc(Bs,Ns)),Xn=jI(),Kn=(Bs,Ns)=>Xn.find(Un,Bs,Ns),oo=FV(Qn.element,{triggerEvent:(Bs,Ns)=>KO(Bs,Ns.target,Xs=>ZD(Kn,Bs,Ns,Xs))}),lo={debugInfo:Mo("real"),triggerEvent:(Bs,Ns,Xs)=>{KO(Bs,Ns,Hr=>ZI(Kn,Bs,Xs,Ns,Hr))},triggerFocus:(Bs,Ns)=>{$0(Bs).fold(()=>{Cd(Bs)},Xs=>{KO(tg(),Bs,Hr=>(QV(Kn,tg(),{originator:Ns,kill:xo,prevent:xo,target:Bs},Bs,Hr),!1))})},triggerEscape:(Bs,Ns)=>{lo.triggerEvent("keydown",Bs.element,Ns.event)},getByUid:Bs=>Ps(Bs),getByDom:Bs=>er(Bs),build:gh,buildOrPatch:YO,addToGui:Bs=>{Co(Bs)},removeFromGui:Bs=>{Ro(Bs)},addToWorld:Bs=>{mo(Bs)},removeFromWorld:Bs=>{yo(Bs)},broadcast:Bs=>{jo(Bs)},broadcastOn:(Bs,Ns)=>{Jo(Bs,Ns)},broadcastEvent:(Bs,Ns)=>{us(Bs,Ns)},isConnected:Js},mo=Bs=>{Bs.connect(lo),Td(Bs.element)||(Xn.register(Bs),Qs(Bs.components(),mo),lo.triggerEvent(Z1(),Bs.element,{target:Bs.element}))},yo=Bs=>{Td(Bs.element)||(Qs(Bs.components(),yo),Xn.unregister(Bs)),Bs.disconnect()},Co=Bs=>{cy(Qn,Bs)},Ro=Bs=>{Kb(Bs)},Lo=()=>{oo.unbind(),am(Qn.element)},Wo=Bs=>{const Ns=Xn.filter(T0());Qs(Ns,Xs=>{const Hr=Xs.descHandler;Fv(Hr)(Bs)})},jo=Bs=>{Wo({universal:!0,data:Bs})},Jo=(Bs,Ns)=>{Wo({universal:!1,channels:Bs,data:Ns})},us=(Bs,Ns)=>{const Xs=Xn.filter(Bs);return VV(Xs,Ns)},Ps=Bs=>Xn.getById(Bs).fold(()=>yl.error(new Error('Could not find component with uid: "'+Bs+'" in system.')),yl.value),er=Bs=>{const Ns=$0(Bs).getOr("not found");return Ps(Ns)};return mo(Qn),{root:Qn,element:Qn.element,destroy:Lo,add:Co,remove:Ro,getByUid:Ps,getByDom:er,addToWorld:mo,removeFromWorld:yo,broadcast:jo,broadcastOn:Jo,broadcastEvent:us}},UV=(Qn,Un)=>({dom:{tag:"div",classes:["tox-bar","tox-form__controls-h-stack"]},components:hs(Qn.items,Un.interpreter)}),ZV=Mo([Gs("prefix","form-field"),Nf("fieldBehaviours",[ic,da])]),qV=Mo([up({schema:[Er("dom")],name:"label"}),up({factory:{sketch:Qn=>({uid:Qn.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:Qn.text}})},schema:[Er("text")],name:"aria-descriptor"}),Xh({factory:{sketch:Qn=>{const Un=zr(Qn,["factory"]);return Qn.factory.sketch(Un)}},schema:[Er("factory")],name:"field"})]),jV=(Qn,Un,Xn,Kn)=>{const oo=sf(Qn.fieldBehaviours,[ic.config({find:yo=>Au(yo,Qn,"field")}),da.config({store:{mode:"manual",getValue:yo=>ic.getCurrent(yo).bind(da.getValue),setValue:(yo,Co)=>{ic.getCurrent(yo).each(Ro=>{da.setValue(Ro,Co)})}}})]),lo=Jc([eu((yo,Co)=>{const Ro=KT(yo,Qn,["label","field","aria-descriptor"]);Ro.field().each(Lo=>{const Wo=ba(Qn.prefix);Ro.label().each(jo=>{aa(jo.element,"for",Wo),aa(Lo.element,"id",Wo)}),Ro["aria-descriptor"]().each(jo=>{const Jo=ba(Qn.prefix);aa(jo.element,"id",Jo),aa(Lo.element,"aria-describedby",Jo)})})})]),mo={getField:yo=>Au(yo,Qn,"field"),getLabel:yo=>Au(yo,Qn,"label")};return{uid:Qn.uid,dom:Qn.dom,components:Un,behaviours:oo,events:lo,apis:mo}},su=Yh({name:"FormField",configFields:ZV(),partFields:qV(),factory:jV,apis:{getField:(Qn,Un)=>Qn.getField(Un),getLabel:(Qn,Un)=>Qn.getLabel(Un)}});var vP=Object.freeze({__proto__:null,exhibit:(Qn,Un)=>bm({attributes:La([{key:Un.tabAttr,value:"true"}])})}),XV=[Gs("tabAttr","data-alloy-tabstop")];const sd=Of({fields:XV,name:"tabstopping",active:vP});var YV=tinymce.util.Tools.resolve("tinymce.html.Entities");const TE=(Qn,Un,Xn,Kn)=>{const oo=KV(Qn,Un,X
`+JSON.stringify(Qn));V_.setItem(e$,JSON.stringify(Qn))},XU=Qn=>{const Un=n6();return Rr(Un,Qn).getOr([])},s4=(Qn,Un)=>{if(!o4(Qn))return;const Xn=n6(),Kn=Rr(Xn,Un).getOr([]),oo=ga(Kn,lo=>lo!==Qn);Xn[Un]=[Qn].concat(oo).slice(0,t6),t$(Xn)},r2=Qn=>!!Qn,o6=Qn=>Vl(xO.makeMap(Qn,/[, ]/),r2),r4=Qn=>ko.from(WL(Qn)),s6=Qn=>{const Un=ko.from(TR(Qn)).filter(r2).map(o6);return r4(Qn).fold(sr,Xn=>Un.fold(Js,Kn=>nc(Kn).length>0?Kn:!1))},r6=(Qn,Un)=>{const Xn=s6(Qn);return uo(Xn)?Xn?r4(Qn):ko.none():Xn[Un]?r4(Qn):ko.none()},i6=(Qn,Un)=>r6(Qn,Un).map(Xn=>Kn=>Cm.nu(oo=>{const lo=(yo,Co)=>{if(!qn(yo))throw new Error("Expected value to be string");if(Co!==void 0&&!Yn(Co))throw new Error("Expected meta to be a object");oo({value:yo,meta:Co})},mo={filetype:Un,fieldname:Kn.fieldname,...ko.from(Kn.meta).getOr({})};Xn.call(Qn,lo,Kn.value,mo)})),a6=Qn=>ko.from(Qn).filter(qn).getOrUndefined(),i4=Qn=>AR(Qn)?ko.some({targets:qU.find(Qn.getBody()),anchorTop:a6(MA(Qn)),anchorBottom:a6(ZL(Qn))}):ko.none(),n$=Qn=>ko.from(ER(Qn)),YU=Qn=>({getHistory:XU,addToHistory:s4,getLinkInformation:()=>i4(Qn),getValidationHandler:()=>n$(Qn),getUrlPicker:Un=>i6(Qn,Un)}),GU=(Qn,Un,Xn,Kn)=>{const oo=Ua(!1),lo=km(Un),mo={icons:()=>Un.ui.registry.getAll().icons,menuItems:()=>Un.ui.registry.getAll().menuItems,translate:_1.translate,isDisabled:()=>Un.mode.isReadOnly()||!Un.ui.isEnabled(),getOption:Un.options.get},yo=YU(Un),Co=LU(Un),Ro=UF(Un),Lo=mG(Un),Wo=()=>oo.get(),jo=er=>oo.set(er),Jo={shared:{providers:mo,anchors:xU(Un,Xn,Kn,lo.isPositionedAtTop),header:lo},urlinput:yo,styles:Co,colorinput:Ro,dialog:Lo,isContextMenuOpen:Wo,setContextMenuState:jo},us={...Jo,shared:{...Jo.shared,interpreter:er=>UE(er,{},us),getSink:Qn.popup}},Ps={...Jo,shared:{...Jo.shared,interpreter:er=>UE(er,{},Ps),getSink:Qn.dialog}};return{popup:us,dialog:Ps}},i2=(Qn,Un,Xn)=>{const Kn=(Or,qr)=>{Qs([Un,...Xn],na=>{na.broadcastEvent(Or,qr)})},oo=(Or,qr)=>{Qs([Un,...Xn],na=>{na.broadcastOn([Or],qr)})},lo=Or=>oo(db(),{target:Or.target}),mo=Op(),yo=Dh(mo,"touchstart",lo),Co=Dh(mo,"touchmove",Or=>Kn(Ah(),Or)),Ro=Dh(mo,"touchend",Or=>Kn(kp(),Or)),Lo=Dh(mo,"mousedown",lo),Wo=Dh(mo,"mouseup",Or=>{Or.raw.button===0&&oo(wx(),{target:Or.target})}),jo=Or=>oo(db(),{target:Ds.fromDom(Or.target)}),Jo=Or=>{Or.button===0&&oo(wx(),{target:Ds.fromDom(Or.target)})},us=()=>{Qs(Qn.editorManager.get(),Or=>{Qn!==Or&&Or.dispatch("DismissPopups",{relatedTarget:Qn})})},Ps=Or=>Kn(s1(),th(Or)),er=Or=>{oo(uO(),{}),Kn(Ig(),th(Or))},Bs=rr(Ds.fromDom(Qn.getElement())),Ns=a_(Bs,"scroll",Or=>{requestAnimationFrame(()=>{const qr=Qn.getContainer();if(qr!=null){const Dl=W_(Qn,Un.element).map(Sa=>[Sa.element,...Sa.others]).getOr([]);Br(Dl,Sa=>Oc(Sa,Or.target))&&(Qn.dispatch("ElementScroll",{target:Or.target.dom}),Kn(j1(),Or))}})}),Xs=()=>oo(uO(),{}),Hr=Or=>{Or.state&&oo(db(),{target:Ds.fromDom(Qn.getContainer())})},kr=Or=>{oo(db(),{target:Ds.fromDom(Or.relatedTarget.getContainer())})};Qn.on("PostRender",()=>{Qn.on("click",jo),Qn.on("tap",jo),Qn.on("mouseup",Jo),Qn.on("mousedown",us),Qn.on("ScrollWindow",Ps),Qn.on("ResizeWindow",er),Qn.on("ResizeEditor",Xs),Qn.on("AfterProgressState",Hr),Qn.on("DismissPopups",kr)}),Qn.on("remove",()=>{Qn.off("click",jo),Qn.off("tap",jo),Qn.off("mouseup",Jo),Qn.off("mousedown",us),Qn.off("ScrollWindow",Ps),Qn.off("ResizeWindow",er),Qn.off("ResizeEditor",Xs),Qn.off("AfterProgressState",Hr),Qn.off("DismissPopups",kr),Lo.unbind(),yo.unbind(),Co.unbind(),Ro.unbind(),Wo.unbind(),Ns.unbind()}),Qn.on("detach",()=>{Qs([Un,...Xn],w_),Qs([Un,...Xn],Or=>Or.destroy())})},rh=E3,Ty=XT,l6=Mo([Gs("shell",!1),Er("makeItem"),Gs("setupItem",xo),Wg.field("listBehaviours",[Cl])]),a4=up({name:"items",overrides:()=>({behaviours:Zr([Cl.config({})])})}),KU=Mo([a4]),JU=Mo("CustomList"),eZ=(Qn,Un,Xn,Kn)=>{const oo=(yo,Co)=>{mo(yo).fold(()=>{throw console.error("Custom List was defined to not be a shell, but no item container was specified in components"),new Error("Custom List was defined to not be a shell, but no item container was specified in components")},Ro=>{const Lo=Cl.contents(Ro),Wo=Co.length,jo=Wo-Lo.length,Jo=jo>0?_r(
2024-08-27 12:25:42 +03:00
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.143 0c2.608.015 5.186 2.178 5.186 5.331 0 0 .077 3.812-.084 4.87-.361 2.41-2.164 4.074-4.65 4.496-1.453.284-2.523.49-3.212.623-.373.071-.634.122-.785.152-.184.038-.997.145-1.35.145-2.732 0-5.21-2.04-5.248-5.33 0 0 0-3.514.03-4.442.093-2.4 1.758-4.342 4.926-4.963 0 0 3.875-.752 4.036-.782.368-.07.775-.1 1.15-.1Zm1.826 2.8L5.83 3.989v2.393l-2.455.475v5.968l6.137-1.189V9.243l2.456-.476V2.8ZM5.83 6.382l3.682-.713v3.574l-3.682.713V6.382Zm27.173-1.64-.084-1.066h-2.226v9.132h2.456V7.743c-.008-1.151.998-2.064 2.149-2.072 1.15-.008 1.987.92 1.995 2.072v5.065h2.455V7.359c-.015-2.18-1.657-3.929-3.837-3.913a3.993 3.993 0 0 0-2.908 1.296Zm-6.3-4.266L29.16 0v2.387l-2.456.475V.476Zm0 3.2v9.132h2.456V3.676h-2.456Zm18.179 11.787L49.11 3.676H46.58l-1.612 4.527-.46 1.382-.384-1.382-1.611-4.527H39.98l3.3 9.132L42.15 16l2.732-.537ZM22.867 9.738c0 .752.568 1.075.921 1.075.353 0 .668-.047.998-.154l.537 1.765c-.23.154-.92.537-2.225.537-1.305 0-2.655-.997-2.686-2.686a136.877 136.877 0 0 1 0-4.374H18.8V3.676h1.612v-1.98l2.455-.476v2.456h2.302V5.9h-2.302v3.837Z"/>
</svg>
2024-08-30 13:38:34 +03:00
`;const vN=Qn=>Qn.nodeName==="BR"||!!Qn.getAttribute("data-mce-bogus")||Qn.getAttribute("data-mce-type")==="bookmark",X$=(Qn,Un,Xn)=>{var Kn;const oo=(Kn=Un.delimiter)!==null&&Kn!==void 0?Kn:"",lo=(Ro,Lo,Wo)=>yh.sketch({dom:{tag:"div",classes:["tox-statusbar__path-item"],attributes:{"data-index":Wo,"aria-level":Wo+1}},components:[wd(Ro)],action:jo=>{Qn.focus(),Qn.selection.select(Lo),Qn.nodeChanged()},buttonBehaviours:Zr([Lf.button(Xn.isDisabled),jf()])}),mo=()=>({dom:{tag:"div",classes:["tox-statusbar__path-divider"],attributes:{"aria-hidden":!0}},components:[wd(` ${oo} `)]}),yo=Ro=>za(Ro,(Lo,Wo,jo)=>{const Jo=lo(Wo.name,Wo.element,jo);return jo===0?Lo.concat([Jo]):Lo.concat([mo(),Jo])},[]),Co=Ro=>{const Lo=[];let Wo=Ro.length;for(;Wo-- >0;){const jo=Ro[Wo];if(jo.nodeType===1&&!vN(jo)){const Jo=cI(Qn,jo);if(Jo.isDefaultPrevented()||Lo.push({name:Jo.name,element:jo}),Jo.isPropagationStopped())break}}return Lo};return{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:Zr([Za.config({mode:"flow",selector:"div[role=button]"}),Ja.config({disabled:Xn.isDisabled}),jf(),sd.config({}),Cl.config({}),Rl("elementPathEvents",[eu((Ro,Lo)=>{Qn.shortcuts.add("alt+F11","focus statusbar elementpath",()=>Za.focusIn(Ro)),Qn.on("NodeChange",Wo=>{const jo=Co(Wo.parents),Jo=jo.length>0?yo(jo):[];Cl.set(Ro,Jo)})})])]),components:[]}};var rS;(function(Qn){Qn[Qn.None=0]="None",Qn[Qn.Both=1]="Both",Qn[Qn.Vertical=2]="Vertical"})(rS||(rS={}));const UX=(Qn,Un,Xn,Kn,oo)=>{const lo={height:cT(Kn+Un.top,Ek(Qn),CR(Qn))};return Xn===rS.Both&&(lo.width=cT(oo+Un.left,wR(Qn),$A(Qn))),lo},H8=(Qn,Un,Xn)=>{const Kn=Ds.fromDom(Qn.getContainer()),oo=UX(Qn,Un,Xn,cu(Kn),dd(Kn));Zl(oo,(lo,mo)=>{$o(lo)&&ya(Kn,mo,Y4(lo))}),aI(Qn)},ZX=Qn=>{const Un=jL(Qn);return Un===!1?rS.None:Un==="both"?rS.Both:rS.Vertical},Y$=(Qn,Un,Xn,Kn)=>{const lo=vc(Xn*20,Kn*20);return H8(Qn,lo,Un),ko.some(!0)},tC=(Qn,Un)=>{const Xn=ZX(Qn);if(Xn===rS.None)return ko.none();const Kn=Xn===rS.Both?"Press the arrow keys to resize the editor.":"Press the Up and Down arrow keys to resize the editor.";return ko.some(s0("resize-handle",{tag:"div",classes:["tox-statusbar__resize-handle"],attributes:{title:Un.translate("Resize"),"aria-label":Un.translate(Kn)},behaviours:[Jw.config({mode:"mouse",repositionTarget:!1,onDrag:(oo,lo,mo)=>H8(Qn,mo,Xn),blockerClass:"tox-blocker"}),Za.config({mode:"special",onLeft:()=>Y$(Qn,Xn,-1,0),onRight:()=>Y$(Qn,Xn,1,0),onUp:()=>Y$(Qn,Xn,0,-1),onDown:()=>Y$(Qn,Xn,0,1)}),sd.config({}),ol.config({})]},Un.icons))},Q8=(Qn,Un)=>{const Xn=(Kn,oo,lo)=>Cl.set(Kn,[wd(Un.translate(["{0} "+lo,oo[lo]]))]);return yh.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:Zr([Lf.button(Un.isDisabled),jf(),sd.config({}),Cl.config({}),da.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),Rl("wordcount-events",[qh(Kn=>{const oo=da.getValue(Kn),lo=oo.mode==="words"?"characters":"words";da.setValue(Kn,{mode:lo,count:oo.count}),Xn(Kn,oo.count,lo)}),eu(Kn=>{Qn.on("wordCountUpdate",oo=>{const{mode:lo}=da.getValue(Kn);da.setValue(Kn,{mode:lo,count:oo.wordCount}),Xn(Kn,oo.wordCount,lo)})})])]),eventOrder:{[Im()]:["disabling","alloy.base.behaviour","wordcount-events"]}})},qX=(Qn,Un)=>{const Xn=()=>({dom:{tag:"span",classes:["tox-statusbar__branding"]},components:[{dom:{tag:"a",attributes:{href:"https://www.tiny.cloud/powered-by-tiny?utm_campaign=poweredby&utm_source=tiny&utm_medium=referral&utm_content=v6",rel:"noopener",target:"_blank","aria-label":_1.translate(["Powered by {0}","Tiny"])},innerHtml:WX.trim()},behaviours:Zr([ol.config({})])}]}),Kn=()=>{const yo=tP("Alt+0");return{dom:{tag:"div",classes:["tox-statusbar__help-text"]},components:[wd(_1.translate(["Press {0} for help",yo]))]}},oo=()=>{const yo=[];return Qn.hasPlugin("wordcount")&&yo.push(Q8(Qn,Un)),$R(Qn)&&yo.push(Xn()),{dom:{tag:"div",classes:["tox-statusbar__right-container"]},components:yo}},lo=()=>{const yo=[],Co=IA(Qn),Ro=Ak(Qn),Lo=$R(Qn)||Qn.hasPlugin("wordcount"),Wo=()=>{const jo="tox-statusbar__text-container
`+JSON.stringify(Un,null,2)).message),getBounds:Qn.getDragBounds})])})}),Xh({schema:[Er("dom")],name:"title"}),Xh({factory:yN,schema:[Er("dom")],name:"close"}),Xh({factory:yN,schema:[Er("dom")],name:"body"}),up({factory:yN,schema:[Er("dom")],name:"footer"}),v1({factory:{sketch:(Qn,Un)=>({...Qn,dom:Un.dom,components:Un.components})},schema:[Gs("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),Gs("components",[])],name:"blocker"})]),KX=(Qn,Un,Xn,Kn)=>{const oo=Hl(),lo=Jo=>{oo.set(Jo);const us=Qn.lazySink(Jo).getOrDie(),Ps=Kn.blocker(),er=us.getSystem().build({...Ps,components:Ps.components.concat([Fm(Jo)]),behaviours:Zr([ol.config({}),Rl("dialog-blocker-events",[rg(Wu(),()=>{uv.isBlocked(Jo)?xo():Za.focusIn(Jo)})])])});cy(us,er),Za.focusIn(Jo)},mo=Jo=>{oo.clear(),Zd(Jo.element).each(us=>{Jo.getSystem().getByDom(us).each(Ps=>{Kb(Ps)})})},yo=Jo=>Y0(Jo,Qn,"body"),Co=Jo=>Au(Jo,Qn,"footer"),Ro=(Jo,us)=>{uv.block(Jo,us)},Lo=Jo=>{uv.unblock(Jo)},Wo=ba("modal-events"),jo={...Qn.eventOrder,[Zh()]:[Wo].concat(Qn.eventOrder["alloy.system.attached"]||[])};return{uid:Qn.uid,dom:Qn.dom,components:Un,apis:{show:lo,hide:mo,getBody:yo,getFooter:Co,setIdle:Lo,setBusy:Ro},eventOrder:jo,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:sf(Qn.modalBehaviours,[Cl.config({}),Za.config({mode:"cyclic",onEnter:Qn.onExecute,onEscape:Qn.onEscape,useTabstopAt:Qn.useTabstopAt,firstTabstop:Qn.firstTabstop}),uv.config({getRoot:oo.get}),Rl(Wo,[eu(Jo=>{XX(Jo.element,Y0(Jo,Qn,"title").element)})])])}},If=Yh({name:"ModalDialog",configFields:YX(),partFields:GX(),factory:KX,apis:{show:(Qn,Un)=>{Qn.show(Un)},hide:(Qn,Un)=>{Qn.hide(Un)},getBody:(Qn,Un)=>Qn.getBody(Un),getFooter:(Qn,Un)=>Qn.getFooter(Un),setBusy:(Qn,Un,Xn)=>{Qn.setBusy(Un,Xn)},setIdle:(Qn,Un)=>{Qn.setIdle(Un)}}}),gT=Ta([wf,KR].concat(Bw)),ON=Jm,v2=[GA("button"),S1,Eh("align","end",["start","end"]),Oy,pb,Ly("buttonType",["primary","secondary"])],iS=[...v2,_O],y2=[hd("type",["submit","cancel","custom"]),...iS],JX=[hd("type",["menu"]),yy,mE,S1,Pf("items",gT),...v2],z8=[...v2,hd("type",["togglebutton"]),hc("tooltip"),S1,yy,Xd("active",!1)],W8=jl("type",{submit:y2,cancel:y2,custom:y2,menu:JX,togglebutton:z8}),U8=[wf,_O,hd("level",["info","warn","error","success"]),JR,Gs("url","")],eY=Ta(U8),tY=Qn=>[wf,Qn],nY=[wf,_O,pb,GA("button"),S1,y5,Ly("buttonType",["primary","secondary","toolbar"]),Oy],Z8=Ta(nY),nC=[wf,KR],_b=nC.concat([XA]),oY=nC.concat([jA,pb]),sY=Ta(oY),rY=Jm,q8=_b.concat([O5("auto")]),iY=Ta(q8),aY=Yp([Nk,_O,JR]),lY=_b.concat([mh("storageKey","default")]),_N=Ta(lY),SN=nf,j8=Ta(_b),cY=nf,uY=nC.concat([mh("tag","textarea"),hc("scriptId"),hc("scriptUrl"),Iy("settings",void 0)]),X8=nC.concat([mh("tag","textarea"),ep("init")]),dY=Rg(Qn=>Lu("customeditor.old",mu(X8),Qn).orThunk(()=>Lu("customeditor.new",mu(uY),Qn))),fY=nf,Y8=Ta(_b),hY=RO(),G$=Qn=>[wf,k0("columns"),Qn],_2=[wf,hc("html"),Eh("presets","presentation",["presentation","document"])],K$=Ta(_2),G8=_b.concat([Xd("border",!1),Xd("sandboxed",!0),Xd("streamContent",!1),Xd("transparent",!0)]),J$=Ta(G8),Sg=nf,e3=Ta(nC.concat([$f("height")])),K8=Ta([hc("url"),Mg("zoom"),Mg("cachedWidth"),Mg("cachedHeight")]),J8=_b.concat([$f("inputMode"),$f("placeholder"),Xd("maximized",!1),pb]),mY=Ta(J8),pY=nf,aS=Qn=>[wf,jA,Qn,Eh("align","start",["start","center","end"])],LG=[_O,Nk],gY=[_O,Pf("items",L1("items",()=>wN))],wN=Oa([Ta(LG),Ta(gY)]),S2=_b.concat([Pf("items",wN),pb]),t3=Ta(S2),eH=nf,bY=_b.concat([Mb("items",[_O,Nk]),Lm("size",1),pb]),vY=Ta(bY),yY=nf,OY=_b.concat([Xd("constrain",!0),pb]),w2=Ta(OY),_Y=Ta([hc("width"),hc("height")]),SY=nC.concat([jA,Lm("min",0),Lm("max",0)]),wY=Ta(SY),IG=w0,CY=[wf,Pf("header",nf),Pf("cells",Xp(nf))],kY=Ta(CY),bT=_b.concat([$f("placeholder"),Xd("maximized",!1),pb]),xY=Ta(bT),EY=nf,CN=[hd("type",["directory","leaf"]),g5,hc("id"),Fd("menu",oT)],TY=Ta(CN),Mn=CN.concat([Pf("children",L1("children",()=>Ir("type",{directory:Vn,leaf:TY})))]),Vn=Ta(Mn),Wn=Ir("type",{directory:Vn,leaf:TY}),jn=[wf,Pf("items",Wn),I1("onLeafAction"),I1("onToggleExpand"),Th("defaultExpan
2024-08-27 12:25:42 +03:00
Actual: `+gu.join(","));if(!dr(Po,Jf=>_r(gu,Jf)))throw new Error("Not all branches were specified when using match. Specified: "+gu.join(", ")+`
2024-08-30 13:38:34 +03:00
Required: `+Po.join(", "));return Ac[zr].apply(null,La)},log:Ac=>{console.log(Ac,{constructors:Po,constructor:zr,params:La})}}}}),Xo}}.generate([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}])});const Oa=(_o,Po)=>{const Xo=Am.fromTable(_o);return Nu(Xo,Po).bind(Ms=>{const vr=Ms[Ms.length-1],zr=Ms[0].row,Jr=vr.row+vr.rowspan,La=Xo.all.slice(zr,Jr);return Rs(La)}).getOr("")},pf=_o=>ah(_o,"rgb")?fh(_o):_o,$O=_o=>{const Po=qa.fromDom(_o);return{borderwidth:rr(Po,"border-width").getOr(""),borderstyle:rr(Po,"border-style").getOr(""),bordercolor:rr(Po,"border-color").map(pf).getOr(""),backgroundcolor:rr(Po,"background-color").map(pf).getOr("")}},Yp=_o=>{const Po=_o[0],Xo=_o.slice(1);return zo(Xo,is=>{zo(es(Po),Ms=>{ps(is,(vr,zr)=>{const Jr=Po[Ms];Jr!==""&&Ms===zr&&Jr!==vr&&(Po[Ms]="")})})}),Po},Ad=(_o,Po,Xo,is)=>Sr(_o,Ms=>!Jn(Xo.formatter.matchNode(is,Po+Ms))).getOr(""),Pg=xo(Ad,["left","center","right"],"align"),w0=xo(Ad,["top","middle","bottom"],"valign"),nf=(_o,Po)=>{const Xo=Wp(_o),is=zf(_o),Ms=()=>({borderstyle:gs(Xo,"border-style").getOr(""),bordercolor:pf(gs(Xo,"border-color").getOr("")),backgroundcolor:pf(gs(Xo,"background-color").getOr(""))}),vr={height:"",width:"100%",cellspacing:"",cellpadding:"",caption:!1,class:"",align:"",border:""},zr=()=>{const Xu=Xo["border-width"];return $m(_o)&&Xu?{border:Xu}:gs(is,"border").fold(()=>({}),Ac=>({border:Ac}))},Jr=Po?Ms():{},La=()=>{const Xu=gs(Xo,"border-spacing").or(gs(is,"cellspacing")).fold(()=>({}),gu=>({cellspacing:gu})),Ac=gs(Xo,"border-padding").or(gs(is,"cellpadding")).fold(()=>({}),gu=>({cellpadding:gu}));return{...Xu,...Ac}};return{...vr,...Xo,...is,...Jr,...zr(),...La()}},Jm=_o=>ta(qa.fromDom(_o)).map(Po=>{const Xo={selection:t1(_o.cells)};return Oa(Po,Xo)}).getOr(""),_v=(_o,Po,Xo)=>{const is=(Jr,La)=>{const Ol=rr(qa.fromDom(La),"border-width");return $m(_o)&&Ol.isSome()?Ol.getOr(""):Jr.getAttrib(La,"border")||uh(_o.dom,La,"border-width")||uh(_o.dom,La,"border")||""},Ms=_o.dom,vr=$m(_o)?Ms.getStyle(Po,"border-spacing")||Ms.getAttrib(Po,"cellspacing"):Ms.getAttrib(Po,"cellspacing")||Ms.getStyle(Po,"border-spacing"),zr=$m(_o)?uh(Ms,Po,"padding")||Ms.getAttrib(Po,"cellpadding"):Ms.getAttrib(Po,"cellpadding")||uh(Ms,Po,"padding");return{width:Ms.getStyle(Po,"width")||Ms.getAttrib(Po,"width"),height:Ms.getStyle(Po,"height")||Ms.getAttrib(Po,"height"),cellspacing:vr??"",cellpadding:zr??"",border:is(Ms,Po),caption:!!Ms.select("caption",Po)[0],class:Ms.getAttrib(Po,"class",""),align:Pg(_o,Po),...Xo?$O(Po):{}}},Gp=(_o,Po,Xo)=>{const is=_o.dom;return{height:is.getStyle(Po,"height")||is.getAttrib(Po,"height"),class:is.getAttrib(Po,"class",""),type:Jm(Po),align:Pg(_o,Po),...Xo?$O(Po):{}}},Sv=(_o,Po,Xo,is)=>{const Ms=_o.dom,vr=is.getOr(Po),zr=(Jr,La)=>Ms.getStyle(Jr,La)||Ms.getAttrib(Jr,La);return{width:zr(vr,"width"),height:zr(Po,"height"),scope:Ms.getAttrib(Po,"scope"),celltype:nm(Po),class:Ms.getAttrib(Po,"class",""),halign:Pg(_o,Po),valign:w0(_o,Po),...Xo?$O(Po):{}}},$g=(_o,Po)=>{const Xo=Am.fromTable(_o),is=Am.justCells(Xo),Ms=Ca(is,vr=>ha(Po,zr=>Al(vr.element,zr)));return Qs(Ms,vr=>({element:vr.element.dom,column:Am.getColumnAt(Xo,vr.column).map(zr=>zr.element.dom)}))},Ir=(_o,Po,Xo,is)=>{is("scope")&&_o.setAttrib("scope",Xo.scope),is("class")&&_o.setAttrib("class",Xo.class),is("height")&&_o.setStyle("height",oc(Xo.height)),is("width")&&Po.setStyle("width",oc(Xo.width))},RO=(_o,Po,Xo)=>{Xo("backgroundcolor")&&_o.setFormat("tablecellbackgroundcolor",Po.backgroundcolor),Xo("bordercolor")&&_o.setFormat("tablecellbordercolor",Po.bordercolor),Xo("borderstyle")&&_o.setFormat("tablecellborderstyle",Po.borderstyle),Xo("borderwidth")&&_o.setFormat("tablecellborderwidth",oc(Po.borderwidth))},Rg=(_o,Po,Xo,is)=>{const Ms=Po.length===1;zo(Po,vr=>{const zr=vr.element,Jr=Ms?Ko:is,La=Mm.normal(_o,zr),Ol=vr.column.map(Xu=>Mm.normal(_o,Xu)).getOr(La);Ir(La,Ol,Xo,Jr),Ab(_o)&&RO(La,Xo,Jr),is("halign")&&Hh(_o,zr,Xo.halign),is("valign")&&A1(_o,zr,Xo.valign)})},Dg=(_o,Po)=>{_o.execCommand("mceTableCellType",!1,{type:Po.celltype,no_eve
`),ws)}),Qr.innerHTML=gs.encode((cr=Qr.textContent)!==null&&cr!==void 0?cr:""),Oo(ko).highlightElement(Qr),gs.setAttrib(Qr,"data-mce-highlighted",!0),Qr.className=ls(Qr.className)})})}),ko.on("PreInit",()=>{ko.parser.addNodeFilter("pre",gs=>{var xs;for(let Qr=0,cr=gs.length;Qr<cr;Qr++){const ws=gs[Qr];((xs=ws.attr("class"))!==null&&xs!==void 0?xs:"").indexOf("language-")!==-1&&(ws.attr("contenteditable","false"),ws.attr("data-mce-highlighted","false"))}})})},Yo=(ko,gs=$n)=>xs=>{const Qr=()=>{xs.setEnabled(ko.selection.isEditable()),gs(xs)};return ko.on("NodeChange",Qr),Qr(),()=>{ko.off("NodeChange",Qr)}},Ys=ko=>{const gs=ko.selection.getStart();return ko.dom.is(gs,'pre[class*="language-"]')},sr=ko=>{const gs=()=>ko.execCommand("codesample");ko.ui.registry.addToggleButton("codesample",{icon:"code-sample",tooltip:"Insert/edit code sample",onAction:gs,onSetup:Yo(ko,xs=>{xs.setActive(Ys(ko))})}),ko.ui.registry.addMenuItem("codesample",{text:"Code sample...",icon:"code-sample",onAction:gs,onSetup:Yo(ko)})};var Js=()=>{_n.add("codesample",ko=>{uo(ko),rs(ko),sr(ko),Mo(ko),ko.on("dblclick",gs=>{So(gs.target)&&Ko(ko)})})};Js()})();(function(){var _n=tinymce.util.Tools.resolve("tinymce.PluginManager");const Ce=(Ts,ks,ir)=>{var br;return ir(Ts,ks.prototype)?!0:((br=Ts.constructor)===null||br===void 0?void 0:br.name)===ks.name},ke=Ts=>{const ks=typeof Ts;return Ts===null?"null":ks==="object"&&Array.isArray(Ts)?"array":ks==="object"&&Ce(Ts,String,(ir,br)=>br.isPrototypeOf(ir))?"string":ks},$n=Ts=>ks=>ke(ks)===Ts,Hn=$n("string"),zn=$n("object"),Zn=$n("array"),qn=Ts=>Ts==null,Yn=Ts=>!qn(Ts);class Jn{constructor(ks,ir){this.tag=ks,this.value=ir}static some(ks){return new Jn(!0,ks)}static none(){return Jn.singletonNone}fold(ks,ir){return this.tag?ir(this.value):ks()}isSome(){return this.tag}isNone(){return!this.tag}map(ks){return this.tag?Jn.some(ks(this.value)):Jn.none()}bind(ks){return this.tag?ks(this.value):Jn.none()}exists(ks){return this.tag&&ks(this.value)}forall(ks){return!this.tag||ks(this.value)}filter(ks){return!this.tag||ks(this.value)?this:Jn.none()}getOr(ks){return this.tag?this.value:ks}or(ks){return this.tag?this:ks}getOrThunk(ks){return this.tag?this.value:ks()}orThunk(ks){return this.tag?this:ks()}getOrDie(ks){if(this.tag)return this.value;throw new Error(ks??"Called getOrDie on None")}static from(ks){return Yn(ks)?Jn.some(ks):Jn.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(ks){this.tag&&ks(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}Jn.singletonNone=new Jn(!1);const to=Array.prototype.push,io=(Ts,ks)=>{for(let ir=0,br=Ts.length;ir<br;ir++){const Aa=Ts[ir];ks(Aa,ir)}},uo=Ts=>{const ks=[];for(let ir=0,br=Ts.length;ir<br;++ir){if(!Zn(Ts[ir]))throw new Error("Arr.flatten item "+ir+" was not an array, input: "+Ts);to.apply(ks,Ts[ir])}return ks},ho=Ts=>{let ks=Ts;return{get:()=>ks,set:Aa=>{ks=Aa}}},bo=Object.keys,Oo=Object.hasOwnProperty,So=(Ts,ks)=>{const ir=bo(Ts);for(let br=0,Aa=ir.length;br<Aa;br++){const Ba=ir[br],_l=Ts[Ba];ks(_l,Ba)}},$o=(Ts,ks)=>Do(Ts,ks)?Jn.from(Ts[ks]):Jn.none(),Do=(Ts,ks)=>Oo.call(Ts,ks),xo=Ts=>ks=>ks.options.get(Ts),Io=Ts=>{const ks=Ts.options.register;ks("audio_template_callback",{processor:"function"}),ks("video_template_callback",{processor:"function"}),ks("iframe_template_callback",{processor:"function"}),ks("media_live_embeds",{processor:"boolean",default:!0}),ks("media_filter_html",{processor:"boolean",default:!0}),ks("media_url_resolver",{processor:"function"}),ks("media_alt_source",{processor:"boolean",default:!0}),ks("media_poster",{processor:"boolean",default:!0}),ks("media_dimensions",{processor:"boolean",default:!0})},Vo=xo("audio_template_callback"),Ko=xo("video_template_callback"),Mo=xo("iframe_template_callback"),es=xo("media_live_embeds"),ls=xo("media_filter_html"),ps=xo("media_url_resolver"),rs=xo("media_alt_source"),Yo=xo("media_poster"),Ys=xo("media_dimensions");var sr=tinymce.util.Tools.resolve("tinymce.util.Tools"),Js=tinymce.util.Tools.resolve("tinymce.dom.DOMUt
2024-08-27 12:25:42 +03:00
<source src="`+Ts.altsource+'"'+(Ts.altsourcemime?' type="'+Ts.altsourcemime+'"':"")+` />
`:"")+"</audio>",fs=(Ts,ks)=>ks?ks(Ts):'<video width="'+Ts.width+'" height="'+Ts.height+'"'+(Ts.poster?' poster="'+Ts.poster+'"':"")+` controls="controls">
<source src="`+Ts.source+'"'+(Ts.sourcemime?' type="'+Ts.sourcemime+'"':"")+` />
`+(Ts.altsource?'<source src="'+Ts.altsource+'"'+(Ts.altsourcemime?' type="'+Ts.altsourcemime+'"':"")+` />
2024-08-30 13:38:34 +03:00
`:"")+"</video>",dr=(Ts,ks)=>{var ir;const br=sr.extend({},ks);if(!br.source&&(sr.extend(br,cr((ir=br.embed)!==null&&ir!==void 0?ir:"",Ts.schema)),!br.source))return"";br.altsource||(br.altsource=""),br.poster||(br.poster=""),br.source=Ts.convertURL(br.source,"source"),br.altsource=Ts.convertURL(br.altsource,"source"),br.sourcemime=ws(br.source),br.altsourcemime=ws(br.altsource),br.poster=Ts.convertURL(br.poster,"poster");const Aa=Il(br.source);if(Aa&&(br.source=Aa.url,br.type=Aa.type,br.allowfullscreen=Aa.allowFullscreen,br.width=br.width||String(Aa.w),br.height=br.height||String(Aa.h)),br.embed)return el(br.embed,br,!0,Ts.schema);{const Ba=Vo(Ts),_l=Ko(Ts),Hc=Mo(Ts);return br.width=br.width||"300",br.height=br.height||"150",sr.each(br,(Ds,tl)=>{br[tl]=Ts.dom.encode(""+Ds)}),br.type==="iframe"?Zs(br,Hc):br.sourcemime==="application/x-shockwave-flash"?Sr(br):br.sourcemime.indexOf("audio")!==-1?Us(br,Ba):fs(br,_l)}},Vr=Ts=>Ts.hasAttribute("data-mce-object")||Ts.hasAttribute("data-ephox-embed-iri"),nr=Ts=>{Ts.on("click keyup touchend",()=>{const ks=Ts.selection.getNode();ks&&Ts.dom.hasClass(ks,"mce-preview-object")&&Ts.dom.getAttrib(ks,"data-mce-selected")&&ks.setAttribute("data-mce-selected","2")}),Ts.on("ObjectResized",ks=>{const ir=ks.target;if(ir.getAttribute("data-mce-object")){let br=ir.getAttribute("data-mce-html");br&&(br=unescape(br),ir.setAttribute("data-mce-html",escape(el(br,{width:String(ks.width),height:String(ks.height)},!1,Ts.schema))))}})},Kr={},ra=(Ts,ks,ir)=>new Promise((br,Aa)=>{const Ba=_l=>(_l.html&&(Kr[Ts.source]=_l),br({url:Ts.source,html:_l.html?_l.html:ks(Ts)}));Kr[Ts.source]?Ba(Kr[Ts.source]):ir({url:Ts.source},Ba,Aa)}),Ml=(Ts,ks)=>Promise.resolve({html:ks(Ts),url:Ts.source}),xa=Ts=>ks=>dr(Ts,ks),Nl=(Ts,ks)=>{const ir=ps(Ts);return ir?ra(ks,xa(Ts),ir):Ml(ks,xa(Ts))},Zc=Ts=>Do(Kr,Ts),cc=(Ts,ks)=>$o(ks,Ts).bind(ir=>$o(ir,"meta")),gc=(Ts,ks,ir)=>br=>{const Aa=()=>$o(Ts,br),Ba=()=>$o(ks,br),_l=tl=>$o(tl,"value").bind(wu=>wu.length>0?Jn.some(wu):Jn.none()),Hc=()=>Aa().bind(tl=>zn(tl)?_l(tl).orThunk(Ba):Ba().orThunk(()=>Jn.from(tl))),Ds=()=>Ba().orThunk(()=>Aa().bind(tl=>zn(tl)?_l(tl):Jn.from(tl)));return{[br]:(br===ir?Hc():Ds()).getOr("")}},nc=(Ts,ks)=>{const ir={};return $o(Ts,"dimensions").each(br=>{io(["width","height"],Aa=>{$o(ks,Aa).orThunk(()=>$o(br,Aa)).each(Ba=>ir[Aa]=Ba)})}),ir},Ed=(Ts,ks)=>{const ir=ks&&ks!=="dimensions"?cc(ks,Ts).getOr({}):{},br=gc(Ts,ir,ks);return{...br("source"),...br("altsource"),...br("poster"),...br("embed"),...nc(Ts,ir)}},Zl=Ts=>{const ks={...Ts,source:{value:$o(Ts,"source").getOr("")},altsource:{value:$o(Ts,"altsource").getOr("")},poster:{value:$o(Ts,"poster").getOr("")}};return io(["width","height"],ir=>{$o(Ts,ir).each(br=>{const Aa=ks.dimensions||{};Aa[ir]=br,ks.dimensions=Aa})}),ks},Vl=Ts=>ks=>{const ir=ks&&ks.msg?"Media embed handler error: "+ks.msg:"Media embed handler threw unknown error.";Ts.notificationManager.open({type:"error",text:ir})},Fc=Ts=>{const ks=Ts.selection.getNode(),ir=Vr(ks)?Ts.serializer.serialize(ks,{selection:!0}):"",br=cr(ir,Ts.schema),Ba=(()=>{if(Yl(br.source,br.type)){const _l=Ts.dom.getRect(ks);return{width:_l.w.toString().replace(/px$/,""),height:_l.h.toString().replace(/px$/,"")}}else return{}})();return{embed:ir,...br,...Ba}},qa=(Ts,ks)=>ir=>{if(Hn(ir.url)&&ir.url.trim().length>0){const br=ir.html,Ba={...cr(br,ks.schema),source:ir.url,embed:br};Ts.setData(Zl(Ba))}},Ya=(Ts,ks)=>{const ir=Ts.dom.select("*[data-mce-object]");for(let br=0;br<ks.length;br++)for(let Aa=ir.length-1;Aa>=0;Aa--)ks[br]===ir[Aa]&&ir.splice(Aa,1);Ts.selection.select(ir[0])},kc=(Ts,ks)=>{const ir=Ts.dom.select("*[data-mce-object]");Ts.insertContent(ks),Ya(Ts,ir),Ts.nodeChanged()},Yl=(Ts,ks)=>Yn(ks)&&ks==="ephox-embed-iri"&&Yn(Il(Ts)),rd=(Ts,ks)=>((br,Aa)=>br.width!==Aa.width||br.height!==Aa.height)(Ts,ks)&&Yl(ks.source,Ts.type),Al=(Ts,ks,ir)=>{var br;ks.embed=rd(Ts,ks)&&Ys(ir)?dr(ir,{...ks,embed:""}):el((br=ks.embed)!==null&&br!==void 0?br:"",ks,!1,ir.schema),ks.embed&&(Ts.source===ks.source||Zc(ks.source))?kc(ir,ks.embed):Nl(ir,ks).then(Aa=>{kc(ir,Aa.html)}).catc
`));return Yo(Us.split(""),$n).length},Qr=(Zs,Sr)=>{const Us=Js(Zs,Sr).join("");return gs(Us)},cr=(Zs,Sr)=>{const Us=Js(Zs,Sr).join("").replace(/\s/g,"");return gs(Us)},ws=(Zs,Sr)=>()=>Sr(Zs.getBody(),Zs.schema),Fs=(Zs,Sr)=>()=>Sr(Zs.selection.getRng().cloneContents(),Zs.schema),Br=Zs=>ws(Zs,xs),_r=Zs=>({body:{getWordCount:Br(Zs),getCharacterCount:ws(Zs,Qr),getCharacterCountWithoutSpaces:ws(Zs,cr)},selection:{getWordCount:Fs(Zs,xs),getCharacterCount:Fs(Zs,Qr),getCharacterCountWithoutSpaces:Fs(Zs,cr)},getCount:Br(Zs)}),ha=(Zs,Sr)=>{Zs.windowManager.open({title:"Word Count",body:{type:"panel",items:[{type:"table",header:["Count","Document","Selection"],cells:[["Words",String(Sr.body.getWordCount()),String(Sr.selection.getWordCount())],["Characters (no spaces)",String(Sr.body.getCharacterCountWithoutSpaces()),String(Sr.selection.getCharacterCountWithoutSpaces())],["Characters",String(Sr.body.getCharacterCount()),String(Sr.selection.getCharacterCount())]]}]},buttons:[{type:"cancel",name:"close",text:"Close",primary:!0}]})},hs=(Zs,Sr)=>{Zs.addCommand("mceWordCount",()=>ha(Zs,Sr))},Qs=(Zs,Sr)=>{let Us=null;return{cancel:()=>{ke(Us)||(clearTimeout(Us),Us=null)},throttle:(...Vr)=>{ke(Us)&&(Us=setTimeout(()=>{Us=null,Zs.apply(null,Vr)},Sr))}}};var zo=tinymce.util.Tools.resolve("tinymce.util.Delay");const el=(Zs,Sr)=>{Zs.dispatch("wordCountUpdate",{wordCount:{words:Sr.body.getWordCount(),characters:Sr.body.getCharacterCount(),charactersWithoutSpaces:Sr.body.getCharacterCountWithoutSpaces()}})},ga=(Zs,Sr)=>{el(Zs,Sr)},Ca=(Zs,Sr,Us)=>{const fs=Qs(()=>ga(Zs,Sr),Us);Zs.on("init",()=>{ga(Zs,Sr),zo.setEditorTimeout(Zs,()=>{Zs.on("SetContent BeforeAddUndo Undo Redo ViewUpdate keyup",fs.throttle)},0),Zs.on("remove",fs.cancel)})},za=Zs=>{const Sr=()=>Zs.execCommand("mceWordCount");Zs.ui.registry.addButton("wordcount",{tooltip:"Word count",icon:"character-count",onAction:Sr}),Zs.ui.registry.addMenuItem("wordcount",{text:"Word count",icon:"character-count",onAction:Sr})};var Il=(Zs=300)=>{_n.add("wordcount",Sr=>{const Us=_r(Sr);return hs(Sr,Us),za(Sr),Ca(Sr,Us,Zs),Us})};Il()})();function get_each_context$8(_n,Ce,ke){const $n=_n.slice();return $n[14]=Ce[ke],$n}function get_each_context_1$2(_n,Ce,ke){const $n=_n.slice();return $n[17]=Ce[ke],$n}function create_else_block$7(_n){let Ce,ke;return Ce=new Dropdown({props:{$$slots:{button:[create_button_slot$1],default:[create_default_slot$1]},$$scope:{ctx:_n}}}),{c(){create_component(Ce.$$.fragment)},m($n,Hn){mount_component(Ce,$n,Hn),ke=!0},p($n,Hn){const zn={};Hn&1048576&&(zn.$$scope={dirty:Hn,ctx:$n}),Ce.$set(zn)},i($n){ke||(transition_in(Ce.$$.fragment,$n),ke=!0)},o($n){transition_out(Ce.$$.fragment,$n),ke=!1},d($n){destroy_component(Ce,$n)}}}function create_if_block_1$9(_n){let Ce,ke,$n;return{c(){Ce=element("button"),Ce.textContent="Browse",attr(Ce,"class","button")},m(Hn,zn){insert$1(Hn,Ce,zn),ke||($n=listen(Ce,"click",_n[9]),ke=!0)},p:noop,i:noop,o:noop,d(Hn){Hn&&detach(Ce),ke=!1,$n()}}}function create_each_block_1$2(_n){let Ce,ke,$n;function Hn(...zn){return _n[10](_n[17],...zn)}return{c(){Ce=element("a"),Ce.textContent=`${_n[17].label}`,attr(Ce,"class","dropdown-item"),attr(Ce,"href","/")},m(zn,Zn){insert$1(zn,Ce,Zn),ke||($n=listen(Ce,"click",Hn),ke=!0)},p(zn,Zn){_n=zn},d(zn){zn&&detach(Ce),ke=!1,$n()}}}function create_default_slot$1(_n){let Ce,ke=ensure_array_like(_n[3]),$n=[];for(let Hn=0;Hn<ke.length;Hn+=1)$n[Hn]=create_each_block_1$2(get_each_context_1$2(_n,ke,Hn));return{c(){for(let Hn=0;Hn<$n.length;Hn+=1)$n[Hn].c();Ce=empty$1()},m(Hn,zn){for(let Zn=0;Zn<$n.length;Zn+=1)$n[Zn]&&$n[Zn].m(Hn,zn);insert$1(Hn,Ce,zn)},p(Hn,zn){if(zn&40){ke=ensure_array_like(Hn[3]);let Zn;for(Zn=0;Zn<ke.length;Zn+=1){const qn=get_each_context_1$2(Hn,ke,Zn);$n[Zn]?$n[Zn].p(qn,zn):($n[Zn]=create_each_block_1$2(qn),$n[Zn].c(),$n[Zn].m(Ce.parentNode,Ce))}for(;Zn<$n.length;Zn+=1)$n[Zn].d(1);$n.length=ke.length}},d(Hn){Hn&&detach(Ce),destroy_each($n,Hn)}}}function create_button_slot$1(_n){let Ce;return{c(){Ce=element("div"),Ce.textContent="Browse",attr(Ce,"slot","button")},m(ke,$n){insert$1(ke,Ce,$n)},p:noop,d(
2024-08-27 12:25:42 +03:00
`},W={bold:{tagName:"strong",inheritable:!0,parser(_n){const Ce=window.getComputedStyle(_n);return Ce.fontWeight==="bold"||Ce.fontWeight>=600}},italic:{tagName:"em",inheritable:!0,parser:_n=>window.getComputedStyle(_n).fontStyle==="italic"},href:{groupTagName:"a",parser(_n){const Ce="a:not(".concat(e,")"),ke=_n.closest(Ce);if(ke)return ke.getAttribute("href")}},strike:{tagName:"del",inheritable:!0},frozen:{style:{backgroundColor:"highlight"}}},U={getDefaultHTML:()=>`<div class="trix-button-row">
<span class="trix-button-group trix-button-group--text-tools" data-trix-button-group="text-tools">
<button type="button" class="trix-button trix-button--icon trix-button--icon-bold" data-trix-attribute="bold" data-trix-key="b" title="`.concat(l.bold,'" tabindex="-1">').concat(l.bold,`</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-italic" data-trix-attribute="italic" data-trix-key="i" title="`).concat(l.italic,'" tabindex="-1">').concat(l.italic,`</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-strike" data-trix-attribute="strike" title="`).concat(l.strike,'" tabindex="-1">').concat(l.strike,`</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-link" data-trix-attribute="href" data-trix-action="link" data-trix-key="k" title="`).concat(l.link,'" tabindex="-1">').concat(l.link,`</button>
</span>
<span class="trix-button-group trix-button-group--block-tools" data-trix-button-group="block-tools">
<button type="button" class="trix-button trix-button--icon trix-button--icon-heading-1" data-trix-attribute="heading1" title="`).concat(l.heading1,'" tabindex="-1">').concat(l.heading1,`</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-quote" data-trix-attribute="quote" title="`).concat(l.quote,'" tabindex="-1">').concat(l.quote,`</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-code" data-trix-attribute="code" title="`).concat(l.code,'" tabindex="-1">').concat(l.code,`</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-bullet-list" data-trix-attribute="bullet" title="`).concat(l.bullets,'" tabindex="-1">').concat(l.bullets,`</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-number-list" data-trix-attribute="number" title="`).concat(l.numbers,'" tabindex="-1">').concat(l.numbers,`</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-decrease-nesting-level" data-trix-action="decreaseNestingLevel" title="`).concat(l.outdent,'" tabindex="-1">').concat(l.outdent,`</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-increase-nesting-level" data-trix-action="increaseNestingLevel" title="`).concat(l.indent,'" tabindex="-1">').concat(l.indent,`</button>
</span>
<span class="trix-button-group trix-button-group--file-tools" data-trix-button-group="file-tools">
<button type="button" class="trix-button trix-button--icon trix-button--icon-attach" data-trix-action="attachFiles" title="`).concat(l.attachFiles,'" tabindex="-1">').concat(l.attachFiles,`</button>
</span>
<span class="trix-button-group-spacer"></span>
<span class="trix-button-group trix-button-group--history-tools" data-trix-button-group="history-tools">
<button type="button" class="trix-button trix-button--icon trix-button--icon-undo" data-trix-action="undo" data-trix-key="z" title="`).concat(l.undo,'" tabindex="-1">').concat(l.undo,`</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-redo" data-trix-action="redo" data-trix-key="shift+z" title="`).concat(l.redo,'" tabindex="-1">').concat(l.redo,`</button>
</span>
</div>
<div class="trix-dialogs" data-trix-dialogs>
<div class="trix-dialog trix-dialog--link" data-trix-dialog="href" data-trix-dialog-attribute="href">
<div class="trix-dialog__link-fields">
<input type="url" name="href" class="trix-input trix-input--dialog" placeholder="`).concat(l.urlPlaceholder,'" aria-label="').concat(l.url,`" required data-trix-input>
<div class="trix-button-group">
<input type="button" class="trix-button trix-button--dialog" value="`).concat(l.link,`" data-trix-method="setAttribute">
<input type="button" class="trix-button trix-button--dialog" value="`).concat(l.unlink,`" data-trix-method="removeAttribute">
</div>
</div>
</div>
</div>`)};const q={interval:5e3};var V=Object.freeze({__proto__:null,attachments:i$1,blockAttributes:n,browser:a,css:{attachment:"attachment",attachmentCaption:"attachment__caption",attachmentCaptionEditor:"attachment__caption-editor",attachmentMetadata:"attachment__metadata",attachmentMetadataContainer:"attachment__metadata-container",attachmentName:"attachment__name",attachmentProgress:"attachment__progress",attachmentSize:"attachment__size",attachmentToolbar:"attachment__toolbar",attachmentGallery:"attachment-gallery"},fileSize:u,input:M,keyNames:{8:"backspace",9:"tab",13:"return",27:"escape",37:"left",39:"right",46:"delete",68:"d",72:"h",79:"o"},lang:l,parser:j,textAttributes:W,toolbar:U,undo:q});class H{static proxyMethod(Ce){const{name:ke,toMethod:$n,toProperty:Hn,optional:zn}=z(Ce);this.prototype[ke]=function(){let Zn,qn;var Yn,Jn;return $n?qn=zn?(Yn=this[$n])===null||Yn===void 0?void 0:Yn.call(this):this[$n]():Hn&&(qn=this[Hn]),zn?(Zn=(Jn=qn)===null||Jn===void 0?void 0:Jn[ke],Zn?_.call(Zn,qn,arguments):void 0):(Zn=qn[ke],_.call(Zn,qn,arguments))}}}const z=function(_n){const Ce=_n.match(J);if(!Ce)throw new Error("can't parse @proxyMethod expression: ".concat(_n));const ke={name:Ce[4]};return Ce[2]!=null?ke.toMethod=Ce[1]:ke.toProperty=Ce[1],Ce[3]!=null&&(ke.optional=!0),ke},{apply:_}=Function.prototype,J=new RegExp("^(.+?)(\\(\\))?(\\?)?\\.(.+?)$");var K,G,$;class X extends H{static box(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return Ce instanceof this?Ce:this.fromUCS2String(Ce==null?void 0:Ce.toString())}static fromUCS2String(Ce){return new this(Ce,tt(Ce))}static fromCodepoints(Ce){return new this(et(Ce),Ce)}constructor(Ce,ke){super(...arguments),this.ucs2String=Ce,this.codepoints=ke,this.length=this.codepoints.length,this.ucs2Length=this.ucs2String.length}offsetToUCS2Offset(Ce){return et(this.codepoints.slice(0,Math.max(0,Ce))).length}offsetFromUCS2Offset(Ce){return tt(this.ucs2String.slice(0,Math.max(0,Ce))).length}slice(){return this.constructor.fromCodepoints(this.codepoints.slice(...arguments))}charAt(Ce){return this.slice(Ce,Ce+1)}isEqualTo(Ce){return this.constructor.box(Ce).ucs2String===this.ucs2String}toJSON(){return this.ucs2String}getCacheKey(){return this.ucs2String}toString(){return this.ucs2String}}const Y=((K=Array.from)===null||K===void 0?void 0:K.call(Array,"👼").length)===1,Q=((G=" ".codePointAt)===null||G===void 0?void 0:G.call(" ",0))!=null,Z=(($=String.fromCodePoint)===null||$===void 0?void 0:$.call(String,32,128124))===" 👼";let tt,et;tt=Y&&Q?_n=>Array.from(_n).map(Ce=>Ce.codePointAt(0)):function(_n){const Ce=[];let ke=0;const{length:$n}=_n;for(;ke<$n;){let Hn=_n.charCodeAt(ke++);if(55296<=Hn&&Hn<=56319&&ke<$n){const zn=_n.charCodeAt(ke++);(64512&zn)==56320?Hn=((1023&Hn)<<10)+(1023&zn)+65536:ke--}Ce.push(Hn)}return Ce},et=Z?_n=>String.fromCodePoint(...Array.from(_n||[])):function(_n){return(()=>{const Ce=[];return Array.from(_n).forEach(ke=>{let $n="";ke>65535&&(ke-=65536,$n+=String.fromCharCode(ke>>>10&1023|55296),ke=56320|1023&ke),Ce.push($n+String.fromCharCode(ke))}),Ce})().join("")};let it=0;class nt extends H{static fromJSONString(Ce){return this.fromJSON(JSON.parse(Ce))}constructor(){super(...arguments),this.id=++it}hasSameConstructorAs(Ce){return this.constructor===(Ce==null?void 0:Ce.constructor)}isEqualTo(Ce){return this===Ce}inspect(){const Ce=[],ke=this.contentsForInspection()||{};for(const $n in ke){const Hn=ke[$n];Ce.push("".concat($n,"=").concat(Hn))}return"#<".concat(this.constructor.name,":").concat(this.id).concat(Ce.length?" ".concat(Ce.join(", ")):"",">")}contentsForInspection(){}toJSONString(){return JSON.stringify(this)}toUTF16String(){return X.box(this)}getCacheKey(){return this.id.toString()}}const rt=function(){let _n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(_n.length!==Ce.length)return!1;for(let ke=0;ke<_n.length;ke++)if(_n[ke]!==Ce[ke])return!1;return!0},ot=function(_n){const Ce=_n.slice(0);for(var ke=arguments.length,$n=new Array(ke>1?ke-1:0),Hn=1;Hn<
`);for(let Hn=0;Hn<$n.length;Hn++){const zn=$n[Hn];if(Hn>0){const Zn=S$1("br");ke.push(Zn)}if(zn.length){const Zn=document.createTextNode(this.preserveSpaces(zn));ke.push(Zn)}}return ke}}createElement(){let Ce,ke,$n;const Hn={};for(ke in this.attributes){$n=this.attributes[ke];const Zn=pt(ke);if(Zn){if(Zn.tagName){var zn;const qn=S$1(Zn.tagName);zn?(zn.appendChild(qn),zn=qn):Ce=zn=qn}if(Zn.styleProperty&&(Hn[Zn.styleProperty]=$n),Zn.style)for(ke in Zn.style)$n=Zn.style[ke],Hn[ke]=$n}}if(Object.keys(Hn).length)for(ke in Ce||(Ce=S$1("span")),Hn)$n=Hn[ke],Ce.style[ke]=$n;return Ce}createContainerElement(){for(const Ce in this.attributes){const ke=this.attributes[Ce],$n=pt(Ce);if($n&&$n.groupTagName){const Hn={};return Hn[Ce]=ke,S$1($n.groupTagName,Hn)}}}preserveSpaces(Ce){return this.context.isLast&&(Ce=Ce.replace(/\ $/,d)),Ce=Ce.replace(/(\S)\ {3}(\S)/g,"$1 ".concat(d," $2")).replace(/\ {2}/g,"".concat(d," ")).replace(/\ {2}/g," ".concat(d)),(this.context.isFirst||this.context.followsWhitespace)&&(Ce=Ce.replace(/^\ /,d)),Ce}}class me extends ee{constructor(){super(...arguments),this.text=this.object,this.textConfig=this.options.textConfig}createNodes(){const Ce=[],ke=Xt.groupObjects(this.getPieces()),$n=ke.length-1;for(let zn=0;zn<ke.length;zn++){const Zn=ke[zn],qn={};zn===0&&(qn.isFirst=!0),zn===$n&&(qn.isLast=!0),pe(Hn)&&(qn.followsWhitespace=!0);const Yn=this.findOrCreateCachedChildView(ge,Zn,{textConfig:this.textConfig,context:qn});Ce.push(...Array.from(Yn.getNodes()||[]));var Hn=Zn}return Ce}getPieces(){return Array.from(this.text.getPieces()).filter(Ce=>!Ce.hasAttribute("blockBreak"))}}const pe=_n=>/\s$/.test(_n==null?void 0:_n.toString()),{css:fe}=V;class be extends ee{constructor(){super(...arguments),this.block=this.object,this.attributes=this.block.getAttributes()}createNodes(){const Ce=[document.createComment("block")];if(this.block.isEmpty())Ce.push(S$1("br"));else{var ke;const $n=(ke=gt(this.block.getLastAttribute()))===null||ke===void 0?void 0:ke.text,Hn=this.findOrCreateCachedChildView(me,this.block.text,{textConfig:$n});Ce.push(...Array.from(Hn.getNodes()||[])),this.shouldAddExtraNewlineElement()&&Ce.push(S$1("br"))}if(this.attributes.length)return Ce;{let $n;const{tagName:Hn}=n.default;this.block.isRTL()&&($n={dir:"rtl"});const zn=S$1({tagName:Hn,attributes:$n});return Ce.forEach(Zn=>zn.appendChild(Zn)),[zn]}}createContainerElement(Ce){const ke={};let $n;const Hn=this.attributes[Ce],{tagName:zn,htmlAttributes:Zn=[]}=gt(Hn);if(Ce===0&&this.block.isRTL()&&Object.assign(ke,{dir:"rtl"}),Hn==="attachmentGallery"){const qn=this.block.getBlockBreakPosition();$n="".concat(fe.attachmentGallery," ").concat(fe.attachmentGallery,"--").concat(qn)}return Object.entries(this.block.htmlAttributes).forEach(qn=>{let[Yn,Jn]=qn;Zn.includes(Yn)&&(ke[Yn]=Jn)}),S$1({tagName:zn,className:$n,attributes:ke})}shouldAddExtraNewlineElement(){return/\n\n$/.test(this.block.toString())}}class ve extends ee{static render(Ce){const ke=S$1("div"),$n=new this(Ce,{element:ke});return $n.render(),$n.sync(),ke}constructor(){super(...arguments),this.element=this.options.element,this.elementStore=new Qt,this.setDocument(this.object)}setDocument(Ce){Ce.isEqualTo(this.document)||(this.document=this.object=Ce)}render(){if(this.childViews=[],this.shadowElement=S$1("div"),!this.document.isEmpty()){const Ce=Xt.groupObjects(this.document.getBlocks(),{asTree:!0});Array.from(Ce).forEach(ke=>{const $n=this.findOrCreateCachedChildView(be,ke);Array.from($n.getNodes()).map(Hn=>this.shadowElement.appendChild(Hn))})}}isSynced(){return xe(this.shadowElement,this.element)}sync(){const Ce=this.createDocumentFragmentForSync();for(;this.element.lastChild;)this.element.removeChild(this.element.lastChild);return this.element.appendChild(Ce),this.didSync()}didSync(){return this.elementStore.reset(Ae(this.element)),Rt(()=>this.garbageCollectCachedViews())}createDocumentFragmentForSync(){const Ce=document.createDocumentFragment();return Array.from(this.shadowElement.childNodes).forEach(ke=>{Ce.appendChild(ke.cloneNode(!0))}),Array.from(Ae(Ce)).forEach(ke=>{const $n=this
`))(Ce),this.length=this.string.length}getValue(){return this.string}toString(){return this.string.toString()}isBlockBreak(){return this.toString()===`
`&&this.getAttribute("blockBreak")===!0}toJSON(){const Ce=super.toJSON(...arguments);return Ce.string=this.string,Ce}canBeConsolidatedWith(Ce){return Ce&&this.hasSameConstructorAs(Ce)&&this.hasSameAttributesAsPiece(Ce)}consolidateWith(Ce){return new this.constructor(this.toString()+Ce.toString(),this.attributes)}splitAtOffset(Ce){let ke,$n;return Ce===0?(ke=null,$n=this):Ce===this.length?(ke=this,$n=null):(ke=new this.constructor(this.string.slice(0,Ce),this.attributes),$n=new this.constructor(this.string.slice(Ce),this.attributes)),[ke,$n]}toConsole(){let{string:Ce}=this;return Ce.length>15&&(Ce=Ce.slice(0,14)+"…"),JSON.stringify(Ce.toString())}}Se.registerType("string",Te);class Be extends nt{static box(Ce){return Ce instanceof this?Ce:new this(Ce)}constructor(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),this.objects=Ce.slice(0),this.length=this.objects.length}indexOf(Ce){return this.objects.indexOf(Ce)}splice(){for(var Ce=arguments.length,ke=new Array(Ce),$n=0;$n<Ce;$n++)ke[$n]=arguments[$n];return new this.constructor(ot(this.objects,...ke))}eachObject(Ce){return this.objects.map((ke,$n)=>Ce(ke,$n))}insertObjectAtIndex(Ce,ke){return this.splice(ke,0,Ce)}insertSplittableListAtIndex(Ce,ke){return this.splice(ke,0,...Ce.objects)}insertSplittableListAtPosition(Ce,ke){const[$n,Hn]=this.splitObjectAtPosition(ke);return new this.constructor($n).insertSplittableListAtIndex(Ce,Hn)}editObjectAtIndex(Ce,ke){return this.replaceObjectAtIndex(ke(this.objects[Ce]),Ce)}replaceObjectAtIndex(Ce,ke){return this.splice(ke,1,Ce)}removeObjectAtIndex(Ce){return this.splice(Ce,1)}getObjectAtIndex(Ce){return this.objects[Ce]}getSplittableListInRange(Ce){const[ke,$n,Hn]=this.splitObjectsAtRange(Ce);return new this.constructor(ke.slice($n,Hn+1))}selectSplittableList(Ce){const ke=this.objects.filter($n=>Ce($n));return new this.constructor(ke)}removeObjectsInRange(Ce){const[ke,$n,Hn]=this.splitObjectsAtRange(Ce);return new this.constructor(ke).splice($n,Hn-$n+1)}transformObjectsInRange(Ce,ke){const[$n,Hn,zn]=this.splitObjectsAtRange(Ce),Zn=$n.map((qn,Yn)=>Hn<=Yn&&Yn<=zn?ke(qn):qn);return new this.constructor(Zn)}splitObjectsAtRange(Ce){let ke,[$n,Hn,zn]=this.splitObjectAtPosition(Pe(Ce));return[$n,ke]=new this.constructor($n).splitObjectAtPosition(Ie(Ce)+zn),[$n,Hn,ke-1]}getObjectAtPosition(Ce){const{index:ke}=this.findIndexAndOffsetAtPosition(Ce);return this.objects[ke]}splitObjectAtPosition(Ce){let ke,$n;const{index:Hn,offset:zn}=this.findIndexAndOffsetAtPosition(Ce),Zn=this.objects.slice(0);if(Hn!=null)if(zn===0)ke=Hn,$n=0;else{const qn=this.getObjectAtIndex(Hn),[Yn,Jn]=qn.splitAtOffset(zn);Zn.splice(Hn,1,Yn,Jn),ke=Hn+1,$n=Yn.getLength()-zn}else ke=Zn.length,$n=0;return[Zn,ke,$n]}consolidate(){const Ce=[];let ke=this.objects[0];return this.objects.slice(1).forEach($n=>{var Hn,zn;(Hn=(zn=ke).canBeConsolidatedWith)!==null&&Hn!==void 0&&Hn.call(zn,$n)?ke=ke.consolidateWith($n):(Ce.push(ke),ke=$n)}),ke&&Ce.push(ke),new this.constructor(Ce)}consolidateFromIndexToIndex(Ce,ke){const $n=this.objects.slice(0).slice(Ce,ke+1),Hn=new this.constructor($n).consolidate().toArray();return this.splice(Ce,$n.length,...Hn)}findIndexAndOffsetAtPosition(Ce){let ke,$n=0;for(ke=0;ke<this.objects.length;ke++){const Hn=$n+this.objects[ke].getLength();if($n<=Ce&&Ce<Hn)return{index:ke,offset:Ce-$n};$n=Hn}return{index:null,offset:null}}findPositionAtIndexAndOffset(Ce,ke){let $n=0;for(let Hn=0;Hn<this.objects.length;Hn++){const zn=this.objects[Hn];if(Hn<Ce)$n+=zn.getLength();else if(Hn===Ce){$n+=ke;break}}return $n}getEndPosition(){return this.endPosition==null&&(this.endPosition=0,this.objects.forEach(Ce=>this.endPosition+=Ce.getLength())),this.endPosition}toString(){return this.objects.join("")}toArray(){return this.objects.slice(0)}toJSON(){return this.toArray()}isEqualTo(Ce){return super.isEqualTo(...arguments)||Fe(this.objects,Ce==null?void 0:Ce.objects)}contentsForInspection(){return{objects:"[".concat(this.objects.map(Ce=>Ce.inspect()).join(", "),"]")}}}const Fe=function(_n){let Ce=arguments.length>1&&arguments[1]!==voi
`,ke);break;case"backward":Hn=$n.slice(0,ke).lastIndexOf(`
`)}if(Hn!==-1)return Hn}contentsForInspection(){return{text:this.text.inspect(),attributes:this.attributes}}toString(){return this.text.toString()}toJSON(){return{text:this.text,attributes:this.attributes,htmlAttributes:this.htmlAttributes}}getDirection(){return this.text.getDirection()}isRTL(){return this.text.isRTL()}getLength(){return this.text.getLength()}canBeConsolidatedWith(Ce){return!this.hasAttributes()&&!Ce.hasAttributes()&&this.getDirection()===Ce.getDirection()}consolidateWith(Ce){const ke=Ne.textForStringWithAttributes(`
`),$n=this.getTextWithoutBlockBreak().appendText(ke);return this.copyWithText($n.appendText(Ce.text))}splitAtOffset(Ce){let ke,$n;return Ce===0?(ke=null,$n=this):Ce===this.getLength()?(ke=this,$n=null):(ke=this.copyWithText(this.text.getTextAtRange([0,Ce])),$n=this.copyWithText(this.text.getTextAtRange([Ce,this.getLength()]))),[ke,$n]}getBlockBreakPosition(){return this.text.getLength()-1}getTextWithoutBlockBreak(){return qe(this.text)?this.text.getTextAtRange([0,this.getBlockBreakPosition()]):this.text.copy()}canBeGrouped(Ce){return this.attributes[Ce]}canBeGroupedWith(Ce,ke){const $n=Ce.getAttributes(),Hn=$n[ke],zn=this.attributes[ke];return zn===Hn&&!(gt(zn).group===!1&&!(()=>{if(!ht){ht=[];for(const Zn in n){const{listAttribute:qn}=n[Zn];qn!=null&&ht.push(qn)}}return ht})().includes($n[ke+1]))&&(this.getDirection()===Ce.getDirection()||Ce.isEmpty())}}const Me=function(_n){return _n=je(_n),_n=Ue(_n)},je=function(_n){let Ce=!1;const ke=_n.getPieces();let $n=ke.slice(0,ke.length-1);const Hn=ke[ke.length-1];return Hn?($n=$n.map(zn=>zn.isBlockBreak()?(Ce=!0,Ve(zn)):zn),Ce?new Ne([...$n,Hn]):_n):_n},We=Ne.textForStringWithAttributes(`
2024-08-30 13:38:34 +03:00
`,{blockBreak:!0}),Ue=function(_n){return qe(_n)?_n:_n.appendText(We)},qe=function(_n){const Ce=_n.getLength();return Ce===0?!1:_n.getTextAtRange([Ce-1,Ce]).isBlockBreak()},Ve=_n=>_n.copyWithoutAttribute("blockBreak"),He=function(_n){const{listAttribute:Ce}=gt(_n);return Ce?[Ce,_n]:[_n]},ze=_n=>_n.slice(-1)[0],_e=function(_n,Ce){const ke=_n.lastIndexOf(Ce);return ke===-1?_n:ot(_n,ke,1)};class Je extends nt{static fromJSON(Ce){return new this(Array.from(Ce).map(ke=>Oe.fromJSON(ke)))}static fromString(Ce,ke){const $n=Ne.textForStringWithAttributes(Ce,ke);return new this([new Oe($n)])}constructor(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),Ce.length===0&&(Ce=[new Oe]),this.blockList=Be.box(Ce)}isEmpty(){const Ce=this.getBlockAtIndex(0);return this.blockList.length===1&&Ce.isEmpty()&&!Ce.hasAttributes()}copy(){const Ce=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).consolidateBlocks?this.blockList.consolidate().toArray():this.blockList.toArray();return new this.constructor(Ce)}copyUsingObjectsFromDocument(Ce){const ke=new Yt(Ce.getObjects());return this.copyUsingObjectMap(ke)}copyUsingObjectMap(Ce){const ke=this.getBlocks().map($n=>Ce.find($n)||$n.copyUsingObjectMap(Ce));return new this.constructor(ke)}copyWithBaseBlockAttributes(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];const ke=this.getBlocks().map($n=>{const Hn=Ce.concat($n.getAttributes());return $n.copyWithAttributes(Hn)});return new this.constructor(ke)}replaceBlock(Ce,ke){const $n=this.blockList.indexOf(Ce);return $n===-1?this:new this.constructor(this.blockList.replaceObjectAtIndex(ke,$n))}insertDocumentAtRange(Ce,ke){const{blockList:$n}=Ce;ke=Lt(ke);let[Hn]=ke;const{index:zn,offset:Zn}=this.locationFromPosition(Hn);let qn=this;const Yn=this.getBlockAtPosition(Hn);return Dt(ke)&&Yn.isEmpty()&&!Yn.hasAttributes()?qn=new this.constructor(qn.blockList.removeObjectAtIndex(zn)):Yn.getBlockBreakPosition()===Zn&&Hn++,qn=qn.removeTextAtRange(ke),new this.constructor(qn.blockList.insertSplittableListAtPosition($n,Hn))}mergeDocumentAtRange(Ce,ke){let $n,Hn;ke=Lt(ke);const[zn]=ke,Zn=this.locationFromPosition(zn),qn=this.getBlockAtIndex(Zn.index).getAttributes(),Yn=Ce.getBaseBlockAttributes(),Jn=qn.slice(-Yn.length);if(rt(Yn,Jn)){const uo=qn.slice(0,-Yn.length);$n=Ce.copyWithBaseBlockAttributes(uo)}else $n=Ce.copy({consolidateBlocks:!0}).copyWithBaseBlockAttributes(qn);const to=$n.getBlockCount(),io=$n.getBlockAtIndex(0);if(rt(qn,io.getAttributes())){const uo=io.getTextWithoutBlockBreak();if(Hn=this.insertTextAtRange(uo,ke),to>1){$n=new this.constructor($n.getBlocks().slice(1));const ho=zn+uo.getLength();Hn=Hn.insertDocumentAtRange($n,ho)}}else Hn=this.insertDocumentAtRange($n,ke);return Hn}insertTextAtRange(Ce,ke){ke=Lt(ke);const[$n]=ke,{index:Hn,offset:zn}=this.locationFromPosition($n),Zn=this.removeTextAtRange(ke);return new this.constructor(Zn.blockList.editObjectAtIndex(Hn,qn=>qn.copyWithText(qn.text.insertTextAtPosition(Ce,zn))))}removeTextAtRange(Ce){let ke;Ce=Lt(Ce);const[$n,Hn]=Ce;if(Dt(Ce))return this;const[zn,Zn]=Array.from(this.locationRangeFromRange(Ce)),qn=zn.index,Yn=zn.offset,Jn=this.getBlockAtIndex(qn),to=Zn.index,io=Zn.offset,uo=this.getBlockAtIndex(to);if(Hn-$n==1&&Jn.getBlockBreakPosition()===Yn&&uo.getBlockBreakPosition()!==io&&uo.text.getStringAtPosition(io)===`
`)ke=this.blockList.editObjectAtIndex(to,ho=>ho.copyWithText(ho.text.removeTextAtRange([io,io+1])));else{let ho;const bo=Jn.text.getTextAtRange([0,Yn]),Oo=uo.text.getTextAtRange([io,uo.getLength()]),So=bo.appendText(Oo);ho=qn!==to&&Yn===0&&Jn.getAttributeLevel()>=uo.getAttributeLevel()?uo.copyWithText(So):Jn.copyWithText(So);const $o=to+1-qn;ke=this.blockList.splice(qn,$o,ho)}return new this.constructor(ke)}moveTextFromRangeToPosition(Ce,ke){let $n;Ce=Lt(Ce);const[Hn,zn]=Ce;if(Hn<=ke&&ke<=zn)return this;let Zn=this.getDocumentAtRange(Ce),qn=this.removeTextAtRange(Ce);const Yn=Hn<ke;Yn&&(ke-=Zn.getLength());const[Jn,...to]=Zn.getBlocks();return to.length===0?($n=Jn.getTextWithoutBlockBreak(),Yn&&(ke+=1)):$n=Jn.text,qn=qn.insertTextAtRange($n,ke),to.length===0?qn:(Zn=new this.constructor(to),ke+=$n.getLength(),qn.insertDocumentAtRange(Zn,ke))}addAttributeAtRange(Ce,ke,$n){let{blockList:Hn}=this;return this.eachBlockAtRange($n,(zn,Zn,qn)=>Hn=Hn.editObjectAtIndex(qn,function(){return gt(Ce)?zn.addAttribute(Ce,ke):Zn[0]===Zn[1]?zn:zn.copyWithText(zn.text.addAttributeAtRange(Ce,ke,Zn))})),new this.constructor(Hn)}addAttribute(Ce,ke){let{blockList:$n}=this;return this.eachBlock((Hn,zn)=>$n=$n.editObjectAtIndex(zn,()=>Hn.addAttribute(Ce,ke))),new this.constructor($n)}removeAttributeAtRange(Ce,ke){let{blockList:$n}=this;return this.eachBlockAtRange(ke,function(Hn,zn,Zn){gt(Ce)?$n=$n.editObjectAtIndex(Zn,()=>Hn.removeAttribute(Ce)):zn[0]!==zn[1]&&($n=$n.editObjectAtIndex(Zn,()=>Hn.copyWithText(Hn.text.removeAttributeAtRange(Ce,zn))))}),new this.constructor($n)}updateAttributesForAttachment(Ce,ke){const $n=this.getRangeOfAttachment(ke),[Hn]=Array.from($n),{index:zn}=this.locationFromPosition(Hn),Zn=this.getTextAtIndex(zn);return new this.constructor(this.blockList.editObjectAtIndex(zn,qn=>qn.copyWithText(Zn.updateAttributesForAttachment(Ce,ke))))}removeAttributeForAttachment(Ce,ke){const $n=this.getRangeOfAttachment(ke);return this.removeAttributeAtRange(Ce,$n)}setHTMLAttributeAtPosition(Ce,ke,$n){const Hn=this.getBlockAtPosition(Ce),zn=Hn.addHTMLAttribute(ke,$n);return this.replaceBlock(Hn,zn)}insertBlockBreakAtRange(Ce){let ke;Ce=Lt(Ce);const[$n]=Ce,{offset:Hn}=this.locationFromPosition($n),zn=this.removeTextAtRange(Ce);return Hn===0&&(ke=[new Oe]),new this.constructor(zn.blockList.insertSplittableListAtPosition(new Be(ke),$n))}applyBlockAttributeAtRange(Ce,ke,$n){const Hn=this.expandRangeToLineBreaksAndSplitBlocks($n);let zn=Hn.document;$n=Hn.range;const Zn=gt(Ce);if(Zn.listAttribute){zn=zn.removeLastListAttributeAtRange($n,{exceptAttributeName:Ce});const qn=zn.convertLineBreaksToBlockBreaksInRange($n);zn=qn.document,$n=qn.range}else zn=Zn.exclusive?zn.removeBlockAttributesAtRange($n):Zn.terminal?zn.removeLastTerminalAttributeAtRange($n):zn.consolidateBlocksAtRange($n);return zn.addAttributeAtRange(Ce,ke,$n)}removeLastListAttributeAtRange(Ce){let ke=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{blockList:$n}=this;return this.eachBlockAtRange(Ce,function(Hn,zn,Zn){const qn=Hn.getLastAttribute();qn&&gt(qn).listAttribute&&qn!==ke.exceptAttributeName&&($n=$n.editObjectAtIndex(Zn,()=>Hn.removeAttribute(qn)))}),new this.constructor($n)}removeLastTerminalAttributeAtRange(Ce){let{blockList:ke}=this;return this.eachBlockAtRange(Ce,function($n,Hn,zn){const Zn=$n.getLastAttribute();Zn&&gt(Zn).terminal&&(ke=ke.editObjectAtIndex(zn,()=>$n.removeAttribute(Zn)))}),new this.constructor(ke)}removeBlockAttributesAtRange(Ce){let{blockList:ke}=this;return this.eachBlockAtRange(Ce,function($n,Hn,zn){$n.hasAttributes()&&(ke=ke.editObjectAtIndex(zn,()=>$n.copyWithoutAttributes()))}),new this.constructor(ke)}expandRangeToLineBreaksAndSplitBlocks(Ce){let ke;Ce=Lt(Ce);let[$n,Hn]=Ce;const zn=this.locationFromPosition($n),Zn=this.locationFromPosition(Hn);let qn=this;const Yn=qn.getBlockAtIndex(zn.index);if(zn.offset=Yn.findLineBreakInDirectionFromPosition("backward",zn.offset),zn.offset!=null&&(ke=qn.positionFromLocation(zn),qn=qn.insertBlockBreakAtRange([ke,ke+1]),Zn.index+=1,Zn.offset-=qn.getBlockAtIndex(zn.index).getLength(),zn.index+=1),z
2024-08-27 12:25:42 +03:00
`?Zn.offset-=1:Zn.offset=Jn.findLineBreakInDirectionFromPosition("forward",Zn.offset),Zn.offset!==Jn.getBlockBreakPosition()&&(ke=qn.positionFromLocation(Zn),qn=qn.insertBlockBreakAtRange([ke,ke+1]))}return $n=qn.positionFromLocation(zn),Hn=qn.positionFromLocation(Zn),{document:qn,range:Ce=Lt([$n,Hn])}}convertLineBreaksToBlockBreaksInRange(Ce){Ce=Lt(Ce);let[ke]=Ce;const $n=this.getStringAtRange(Ce).slice(0,-1);let Hn=this;return $n.replace(/.*?\n/g,function(zn){ke+=zn.length,Hn=Hn.insertBlockBreakAtRange([ke-1,ke])}),{document:Hn,range:Ce}}consolidateBlocksAtRange(Ce){Ce=Lt(Ce);const[ke,$n]=Ce,Hn=this.locationFromPosition(ke).index,zn=this.locationFromPosition($n).index;return new this.constructor(this.blockList.consolidateFromIndexToIndex(Hn,zn))}getDocumentAtRange(Ce){Ce=Lt(Ce);const ke=this.blockList.getSplittableListInRange(Ce).toArray();return new this.constructor(ke)}getStringAtRange(Ce){let ke;const $n=Ce=Lt(Ce);return $n[$n.length-1]!==this.getLength()&&(ke=-1),this.getDocumentAtRange(Ce).toString().slice(0,ke)}getBlockAtIndex(Ce){return this.blockList.getObjectAtIndex(Ce)}getBlockAtPosition(Ce){const{index:ke}=this.locationFromPosition(Ce);return this.getBlockAtIndex(ke)}getTextAtIndex(Ce){var ke;return(ke=this.getBlockAtIndex(Ce))===null||ke===void 0?void 0:ke.text}getTextAtPosition(Ce){const{index:ke}=this.locationFromPosition(Ce);return this.getTextAtIndex(ke)}getPieceAtPosition(Ce){const{index:ke,offset:$n}=this.locationFromPosition(Ce);return this.getTextAtIndex(ke).getPieceAtPosition($n)}getCharacterAtPosition(Ce){const{index:ke,offset:$n}=this.locationFromPosition(Ce);return this.getTextAtIndex(ke).getStringAtRange([$n,$n+1])}getLength(){return this.blockList.getEndPosition()}getBlocks(){return this.blockList.toArray()}getBlockCount(){return this.blockList.length}getEditCount(){return this.editCount}eachBlock(Ce){return this.blockList.eachObject(Ce)}eachBlockAtRange(Ce,ke){let $n,Hn;Ce=Lt(Ce);const[zn,Zn]=Ce,qn=this.locationFromPosition(zn),Yn=this.locationFromPosition(Zn);if(qn.index===Yn.index)return $n=this.getBlockAtIndex(qn.index),Hn=[qn.offset,Yn.offset],ke($n,Hn,qn.index);for(let Jn=qn.index;Jn<=Yn.index;Jn++)if($n=this.getBlockAtIndex(Jn),$n){switch(Jn){case qn.index:Hn=[qn.offset,$n.text.getLength()];break;case Yn.index:Hn=[0,Yn.offset];break;default:Hn=[0,$n.text.getLength()]}ke($n,Hn,Jn)}}getCommonAttributesAtRange(Ce){Ce=Lt(Ce);const[ke]=Ce;if(Dt(Ce))return this.getCommonAttributesAtPosition(ke);{const $n=[],Hn=[];return this.eachBlockAtRange(Ce,function(zn,Zn){if(Zn[0]!==Zn[1])return $n.push(zn.text.getCommonAttributesAtRange(Zn)),Hn.push(Ke(zn))}),zt.fromCommonAttributesOfObjects($n).merge(zt.fromCommonAttributesOfObjects(Hn)).toObject()}}getCommonAttributesAtPosition(Ce){let ke,$n;const{index:Hn,offset:zn}=this.locationFromPosition(Ce),Zn=this.getBlockAtIndex(Hn);if(!Zn)return{};const qn=Ke(Zn),Yn=Zn.text.getAttributesAtPosition(zn),Jn=Zn.text.getAttributesAtPosition(zn-1),to=Object.keys(W).filter(io=>W[io].inheritable);for(ke in Jn)$n=Jn[ke],($n===Yn[ke]||to.includes(ke))&&(qn[ke]=$n);return qn}getRangeOfCommonAttributeAtPosition(Ce,ke){const{index:$n,offset:Hn}=this.locationFromPosition(ke),zn=this.getTextAtIndex($n),[Zn,qn]=Array.from(zn.getExpandedRangeForAttributeAtOffset(Ce,Hn)),Yn=this.positionFromLocation({index:$n,offset:Zn}),Jn=this.positionFromLocation({index:$n,offset:qn});return Lt([Yn,Jn])}getBaseBlockAttributes(){let Ce=this.getBlockAtIndex(0).getAttributes();for(let ke=1;ke<this.getBlockCount();ke++){const $n=this.getBlockAtIndex(ke).getAttributes(),Hn=Math.min(Ce.length,$n.length);Ce=(()=>{const zn=[];for(let Zn=0;Zn<Hn&&$n[Zn]===Ce[Zn];Zn++)zn.push($n[Zn]);return zn})()}return Ce}getAttachmentById(Ce){for(const ke of this.getAttachments())if(ke.id===Ce)return ke}getAttachmentPieces(){let Ce=[];return this.blockList.eachObject(ke=>{let{text:$n}=ke;return Ce=Ce.concat($n.getAttachmentPieces())}),Ce}getAttachments(){return this.getAttachmentPieces().map(Ce=>Ce.attachment)}getRangeOfAttachment(Ce){let ke=0;const $n=this.blockList.toArray();for(let Hn=0;Hn<$n.length;Hn++){cons
`);if(ke===this.containerElement||this.isBlockElement(ke)){var $n;const Hn=this.getBlockAttributes(ke),zn=this.getBlockHTMLAttributes(ke);rt(Hn,($n=this.currentBlock)===null||$n===void 0?void 0:$n.attributes)||(this.currentBlock=this.appendBlockForAttributesWithElement(Hn,ke,zn),this.currentBlockElement=ke)}}appendBlockForElement(Ce){const ke=this.isBlockElement(Ce),$n=y(this.currentBlockElement,Ce);if(ke&&!this.isBlockElement(Ce.firstChild)){if(!this.isInsignificantTextNode(Ce.firstChild)||!this.isBlockElement(Ce.firstElementChild)){const Hn=this.getBlockAttributes(Ce),zn=this.getBlockHTMLAttributes(Ce);if(Ce.firstChild){if($n&&rt(Hn,this.currentBlock.attributes))return this.appendStringWithAttributes(`
`);this.currentBlock=this.appendBlockForAttributesWithElement(Hn,Ce,zn),this.currentBlockElement=Ce}}}else if(this.currentBlockElement&&!$n&&!ke){const Hn=this.findParentBlockElement(Ce);if(Hn)return this.appendBlockForElement(Hn);this.currentBlock=this.appendEmptyBlock(),this.currentBlockElement=null}}findParentBlockElement(Ce){let{parentElement:ke}=Ce;for(;ke&&ke!==this.containerElement;){if(this.isBlockElement(ke)&&this.blockElements.includes(ke))return ke;ke=ke.parentElement}return null}processTextNode(Ce){let ke=Ce.data;var $n;return Ye(Ce.parentNode)||(ke=qt(ke),ni(($n=Ce.previousSibling)===null||$n===void 0?void 0:$n.textContent)&&(ke=ei(ke))),this.appendStringWithAttributes(ke,this.getTextAttributes(Ce.parentNode))}processElement(Ce){let ke;if(I(Ce)){if(ke=$e(Ce,"attachment"),Object.keys(ke).length){const $n=this.getTextAttributes(Ce);this.appendAttachmentWithAttributes(ke,$n),Ce.innerHTML=""}return this.processedElements.push(Ce)}switch(E(Ce)){case"br":return this.isExtraBR(Ce)||this.isBlockElement(Ce.nextSibling)||this.appendStringWithAttributes(`
`,this.getTextAttributes(Ce)),this.processedElements.push(Ce);case"img":ke={url:Ce.getAttribute("src"),contentType:"image"};const $n=(Hn=>{const zn=Hn.getAttribute("width"),Zn=Hn.getAttribute("height"),qn={};return zn&&(qn.width=parseInt(zn,10)),Zn&&(qn.height=parseInt(Zn,10)),qn})(Ce);for(const Hn in $n){const zn=$n[Hn];ke[Hn]=zn}return this.appendAttachmentWithAttributes(ke,this.getTextAttributes(Ce)),this.processedElements.push(Ce);case"tr":if(this.needsTableSeparator(Ce))return this.appendStringWithAttributes(j.tableRowSeparator);break;case"td":if(this.needsTableSeparator(Ce))return this.appendStringWithAttributes(j.tableCellSeparator)}}appendBlockForAttributesWithElement(Ce,ke){let $n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.blockElements.push(ke);const Hn=function(){return{text:[],attributes:arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},htmlAttributes:arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}}}(Ce,$n);return this.blocks.push(Hn),Hn}appendEmptyBlock(){return this.appendBlockForAttributesWithElement([],null)}appendStringWithAttributes(Ce,ke){return this.appendPiece(Ge(Ce,ke))}appendAttachmentWithAttributes(Ce,ke){return this.appendPiece(function($n){return{attachment:$n,attributes:arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},type:"attachment"}}(Ce,ke))}appendPiece(Ce){return this.blocks.length===0&&this.appendEmptyBlock(),this.blocks[this.blocks.length-1].text.push(Ce)}appendStringToTextAtIndex(Ce,ke){const{text:$n}=this.blocks[ke],Hn=$n[$n.length-1];if((Hn==null?void 0:Hn.type)!=="string")return $n.push(Ge(Ce));Hn.string+=Ce}prependStringToTextAtIndex(Ce,ke){const{text:$n}=this.blocks[ke],Hn=$n[0];if((Hn==null?void 0:Hn.type)!=="string")return $n.unshift(Ge(Ce));Hn.string=Ce+Hn.string}getTextAttributes(Ce){let ke;const $n={};for(const Hn in W){const zn=W[Hn];if(zn.tagName&&A(Ce,{matchingSelector:zn.tagName,untilNode:this.containerElement}))$n[Hn]=!0;else if(zn.parser){if(ke=zn.parser(Ce),ke){let Zn=!1;for(const qn of this.findBlockElementAncestors(Ce))if(zn.parser(qn)===ke){Zn=!0;break}Zn||($n[Hn]=ke)}}else zn.styleProperty&&(ke=Ce.style[zn.styleProperty],ke&&($n[Hn]=ke))}if(I(Ce)){const Hn=$e(Ce,"attributes");for(const zn in Hn)ke=Hn[zn],$n[zn]=ke}return $n}getBlockAttributes(Ce){const ke=[];for(;Ce&&Ce!==this.containerElement;){for(const Hn in n){const zn=n[Hn];var $n;zn.parse!==!1&&E(Ce)===zn.tagName&&(($n=zn.test)!==null&&$n!==void 0&&$n.call(zn,Ce)||!zn.test)&&(ke.push(Hn),zn.listAttribute&&ke.push(zn.listAttribute))}Ce=Ce.parentNode}return ke.reverse()}getBlockHTMLAttributes(Ce){const ke={},$n=Object.values(n).find(Hn=>Hn.tagName===E(Ce));return(($n==null?void 0:$n.htmlAttributes)||[]).forEach(Hn=>{Ce.hasAttribute(Hn)&&(ke[Hn]=Ce.getAttribute(Hn))}),ke}findBlockElementAncestors(Ce){const ke=[];for(;Ce&&Ce!==this.containerElement;){const $n=E(Ce);D().includes($n)&&ke.push(Ce),Ce=Ce.parentNode}return ke}isBlockElement(Ce){if((Ce==null?void 0:Ce.nodeType)===Node.ELEMENT_NODE&&!I(Ce)&&!A(Ce,{matchingSelector:"td",untilNode:this.containerElement}))return D().includes(E(Ce))||window.getComputedStyle(Ce).display==="block"}isInsignificantTextNode(Ce){if((Ce==null?void 0:Ce.nodeType)!==Node.TEXT_NODE||!ii(Ce.data))return;const{parentNode:ke,previousSibling:$n,nextSibling:Hn}=Ce;return Qe(ke.previousSibling)&&!this.isBlockElement(ke.previousSibling)||Ye(ke)?void 0:!$n||this.isBlockElement($n)||!Hn||this.isBlockElement(Hn)}isExtraBR(Ce){return E(Ce)==="br"&&this.isBlockElement(Ce.parentNode)&&Ce.parentNode.lastChild===Ce}needsTableSeparator(Ce){if(j.removeBlankTableCells){var ke;const $n=(ke=Ce.previousSibling)===null||ke===void 0?void 0:ke.textContent;return $n&&/\S/.test($n)}return Ce.previousSibling}translateBlockElementMarginsToNewlines(){const Ce=this.getMarginOfDefaultBlockElement();for(let ke=0;ke<this.blocks.length;ke++){const $n=this.getMarginOfBlockElementAtIndex(ke);$n&&($n.top>2*Ce.top&&this.prependStringToTextAtIndex(`
`,ke),$n.bottom>2*Ce.bottom&&this.appendStringToTextAtIndex(`
`,ke))}}getMarginOfBlockElementAtIndex(Ce){const ke=this.blockElements[Ce];if(ke&&ke.textContent&&!D().includes(E(ke))&&!this.processedElements.includes(ke))return Ze(ke)}getMarginOfDefaultBlockElement(){const Ce=S$1(n.default.tagName);return this.containerElement.appendChild(Ce),Ze(Ce)}}const Ye=function(_n){const{whiteSpace:Ce}=window.getComputedStyle(_n);return["pre","pre-wrap","pre-line"].includes(Ce)},Qe=_n=>_n&&!ni(_n.textContent),Ze=function(_n){const Ce=window.getComputedStyle(_n);if(Ce.display==="block")return{top:parseInt(Ce.marginTop),bottom:parseInt(Ce.marginBottom)}},ti=function(_n){return E(_n)==="style"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},ei=_n=>_n.replace(new RegExp("^".concat(Ut.source,"+")),""),ii=_n=>new RegExp("^".concat(Ut.source,"*$")).test(_n),ni=_n=>/\s$/.test(_n),ri=["contenteditable","data-trix-id","data-trix-store-key","data-trix-mutable","data-trix-placeholder","tabindex"],oi="data-trix-serialized-attributes",si="[".concat(oi,"]"),ai=new RegExp("<!--block-->","g"),li={"application/json":function(_n){let Ce;if(_n instanceof Je)Ce=_n;else{if(!(_n instanceof HTMLElement))throw new Error("unserializable object");Ce=Xe.parse(_n.innerHTML).getDocument()}return Ce.toSerializableDocument().toJSONString()},"text/html":function(_n){let Ce;if(_n instanceof Je)Ce=ve.render(_n);else{if(!(_n instanceof HTMLElement))throw new Error("unserializable object");Ce=_n.cloneNode(!0)}return Array.from(Ce.querySelectorAll("[data-trix-serialize=false]")).forEach(ke=>{k(ke)}),ri.forEach(ke=>{Array.from(Ce.querySelectorAll("[".concat(ke,"]"))).forEach($n=>{$n.removeAttribute(ke)})}),Array.from(Ce.querySelectorAll(si)).forEach(ke=>{try{const $n=JSON.parse(ke.getAttribute(oi));ke.removeAttribute(oi);for(const Hn in $n){const zn=$n[Hn];ke.setAttribute(Hn,zn)}}catch{}}),Ce.innerHTML.replace(ai,"")}};var ci=Object.freeze({__proto__:null});class ui extends H{constructor(Ce,ke){super(...arguments),this.attachmentManager=Ce,this.attachment=ke,this.id=this.attachment.id,this.file=this.attachment.file}remove(){return this.attachmentManager.requestRemovalOfAttachment(this.attachment)}}ui.proxyMethod("attachment.getAttribute"),ui.proxyMethod("attachment.hasAttribute"),ui.proxyMethod("attachment.setAttribute"),ui.proxyMethod("attachment.getAttributes"),ui.proxyMethod("attachment.setAttributes"),ui.proxyMethod("attachment.isPending"),ui.proxyMethod("attachment.isPreviewable"),ui.proxyMethod("attachment.getURL"),ui.proxyMethod("attachment.getHref"),ui.proxyMethod("attachment.getFilename"),ui.proxyMethod("attachment.getFilesize"),ui.proxyMethod("attachment.getFormattedFilesize"),ui.proxyMethod("attachment.getExtension"),ui.proxyMethod("attachment.getContentType"),ui.proxyMethod("attachment.getFile"),ui.proxyMethod("attachment.setFile"),ui.proxyMethod("attachment.releaseFile"),ui.proxyMethod("attachment.getUploadProgress"),ui.proxyMethod("attachment.setUploadProgress");class hi extends H{constructor(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),this.managedAttachments={},Array.from(Ce).forEach(ke=>{this.manageAttachment(ke)})}getAttachments(){const Ce=[];for(const ke in this.managedAttachments){const $n=this.managedAttachments[ke];Ce.push($n)}return Ce}manageAttachment(Ce){return this.managedAttachments[Ce.id]||(this.managedAttachments[Ce.id]=new ui(this,Ce)),this.managedAttachments[Ce.id]}attachmentIsManaged(Ce){return Ce.id in this.managedAttachments}requestRemovalOfAttachment(Ce){var ke,$n;if(this.attachmentIsManaged(Ce))return(ke=this.delegate)===null||ke===void 0||($n=ke.attachmentManagerDidRequestRemovalOfAttachment)===null||$n===void 0?void 0:$n.call(ke,Ce)}unmanageAttachment(Ce){const ke=this.managedAttachments[Ce.id];return delete this.managedAttachments[Ce.id],ke}}class di{constructor(Ce){this.composition=Ce,this.document=this.composition.document;const ke=this.composition.getSelectedRange();this.startPosition=ke[0],this.endPosition=ke[1],this.startLocation=this.document.locationFromPosition(this.startPosition),this.endLocation=this.document.locationFromPosition(this.end
`}shouldBreakFormattedBlock(){return this.block.hasAttributes()&&!this.block.isListItem()&&(this.breaksOnReturn&&this.nextCharacter===`
`||this.previousCharacter===`
`)}shouldDecreaseListLevel(){return this.block.hasAttributes()&&this.block.isListItem()&&this.block.isEmpty()}shouldPrependListItem(){return this.block.isListItem()&&this.startLocation.offset===0&&!this.block.isEmpty()}shouldRemoveLastBlockAttribute(){return this.block.hasAttributes()&&!this.block.isListItem()&&this.block.isEmpty()}}class gi extends H{constructor(){super(...arguments),this.document=new Je,this.attachments=[],this.currentAttributes={},this.revision=0}setDocument(Ce){var ke,$n;if(!Ce.isEqualTo(this.document))return this.document=Ce,this.refreshAttachments(),this.revision++,(ke=this.delegate)===null||ke===void 0||($n=ke.compositionDidChangeDocument)===null||$n===void 0?void 0:$n.call(ke,Ce)}getSnapshot(){return{document:this.document,selectedRange:this.getSelectedRange()}}loadSnapshot(Ce){var ke,$n,Hn,zn;let{document:Zn,selectedRange:qn}=Ce;return(ke=this.delegate)===null||ke===void 0||($n=ke.compositionWillLoadSnapshot)===null||$n===void 0||$n.call(ke),this.setDocument(Zn??new Je),this.setSelection(qn??[0,0]),(Hn=this.delegate)===null||Hn===void 0||(zn=Hn.compositionDidLoadSnapshot)===null||zn===void 0?void 0:zn.call(Hn)}insertText(Ce){let{updatePosition:ke}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{updatePosition:!0};const $n=this.getSelectedRange();this.setDocument(this.document.insertTextAtRange(Ce,$n));const Hn=$n[0],zn=Hn+Ce.getLength();return ke&&this.setSelection(zn),this.notifyDelegateOfInsertionAtRange([Hn,zn])}insertBlock(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Oe;const ke=new Je([Ce]);return this.insertDocument(ke)}insertDocument(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Je;const ke=this.getSelectedRange();this.setDocument(this.document.insertDocumentAtRange(Ce,ke));const $n=ke[0],Hn=$n+Ce.getLength();return this.setSelection(Hn),this.notifyDelegateOfInsertionAtRange([$n,Hn])}insertString(Ce,ke){const $n=this.getCurrentTextAttributes(),Hn=Ne.textForStringWithAttributes(Ce,$n);return this.insertText(Hn,ke)}insertBlockBreak(){const Ce=this.getSelectedRange();this.setDocument(this.document.insertBlockBreakAtRange(Ce));const ke=Ce[0],$n=ke+1;return this.setSelection($n),this.notifyDelegateOfInsertionAtRange([ke,$n])}insertLineBreak(){const Ce=new di(this);if(Ce.shouldDecreaseListLevel())return this.decreaseListLevel(),this.setSelection(Ce.startPosition);if(Ce.shouldPrependListItem()){const ke=new Je([Ce.block.copyWithoutText()]);return this.insertDocument(ke)}return Ce.shouldInsertBlockBreak()?this.insertBlockBreak():Ce.shouldRemoveLastBlockAttribute()?this.removeLastBlockAttribute():Ce.shouldBreakFormattedBlock()?this.breakFormattedBlock(Ce):this.insertString(`
`)}insertHTML(Ce){const ke=Xe.parse(Ce).getDocument(),$n=this.getSelectedRange();this.setDocument(this.document.mergeDocumentAtRange(ke,$n));const Hn=$n[0],zn=Hn+ke.getLength()-1;return this.setSelection(zn),this.notifyDelegateOfInsertionAtRange([Hn,zn])}replaceHTML(Ce){const ke=Xe.parse(Ce).getDocument().copyUsingObjectsFromDocument(this.document),$n=this.getLocationRange({strict:!1}),Hn=this.document.rangeFromLocationRange($n);return this.setDocument(ke),this.setSelection(Hn)}insertFile(Ce){return this.insertFiles([Ce])}insertFiles(Ce){const ke=[];return Array.from(Ce).forEach($n=>{var Hn;if((Hn=this.delegate)!==null&&Hn!==void 0&&Hn.compositionShouldAcceptFile($n)){const zn=De.attachmentForFile($n);ke.push(zn)}}),this.insertAttachments(ke)}insertAttachment(Ce){return this.insertAttachments([Ce])}insertAttachments(Ce){let ke=new Ne;return Array.from(Ce).forEach($n=>{var Hn;const zn=$n.getType(),Zn=(Hn=i$1[zn])===null||Hn===void 0?void 0:Hn.presentation,qn=this.getCurrentTextAttributes();Zn&&(qn.presentation=Zn);const Yn=Ne.textForAttachmentWithAttributes($n,qn);ke=ke.appendText(Yn)}),this.insertText(ke)}shouldManageDeletingInDirection(Ce){const ke=this.getLocationRange();if(Dt(ke)){if(Ce==="backward"&&ke[0].offset===0||this.shouldManageMovingCursorInDirection(Ce))return!0}else if(ke[0].index!==ke[1].index)return!0;return!1}deleteInDirection(Ce){let ke,$n,Hn,{length:zn}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const Zn=this.getLocationRange();let qn=this.getSelectedRange();const Yn=Dt(qn);if(Yn?$n=Ce==="backward"&&Zn[0].offset===0:Hn=Zn[0].index!==Zn[1].index,$n&&this.canDecreaseBlockAttributeLevel()){const Jn=this.getBlock();if(Jn.isListItem()?this.decreaseListLevel():this.decreaseBlockAttributeLevel(),this.setSelection(qn[0]),Jn.isEmpty())return!1}return Yn&&(qn=this.getExpandedRangeInDirection(Ce,{length:zn}),Ce==="backward"&&(ke=this.getAttachmentAtRange(qn))),ke?(this.editAttachment(ke),!1):(this.setDocument(this.document.removeTextAtRange(qn)),this.setSelection(qn[0]),!$n&&!Hn&&void 0)}moveTextFromRange(Ce){const[ke]=Array.from(this.getSelectedRange());return this.setDocument(this.document.moveTextFromRangeToPosition(Ce,ke)),this.setSelection(ke)}removeAttachment(Ce){const ke=this.document.getRangeOfAttachment(Ce);if(ke)return this.stopEditingAttachment(),this.setDocument(this.document.removeTextAtRange(ke)),this.setSelection(ke[0])}removeLastBlockAttribute(){const[Ce,ke]=Array.from(this.getSelectedRange()),$n=this.document.getBlockAtPosition(ke);return this.removeCurrentAttribute($n.getLastAttribute()),this.setSelection(Ce)}insertPlaceholder(){return this.placeholderPosition=this.getPosition(),this.insertString(" ")}selectPlaceholder(){if(this.placeholderPosition!=null)return this.setSelectedRange([this.placeholderPosition,this.placeholderPosition+1]),this.getSelectedRange()}forgetPlaceholder(){this.placeholderPosition=null}hasCurrentAttribute(Ce){const ke=this.currentAttributes[Ce];return ke!=null&&ke!==!1}toggleCurrentAttribute(Ce){const ke=!this.currentAttributes[Ce];return ke?this.setCurrentAttribute(Ce,ke):this.removeCurrentAttribute(Ce)}canSetCurrentAttribute(Ce){return gt(Ce)?this.canSetCurrentBlockAttribute(Ce):this.canSetCurrentTextAttribute(Ce)}canSetCurrentTextAttribute(Ce){const ke=this.getSelectedDocument();if(ke){for(const $n of Array.from(ke.getAttachments()))if(!$n.hasContent())return!1;return!0}}canSetCurrentBlockAttribute(Ce){const ke=this.getBlock();if(ke)return!ke.isTerminalBlock()}setCurrentAttribute(Ce,ke){return gt(Ce)?this.setBlockAttribute(Ce,ke):(this.setTextAttribute(Ce,ke),this.currentAttributes[Ce]=ke,this.notifyDelegateOfCurrentAttributesChange())}setHTMLAtributeAtPosition(Ce,ke,$n){var Hn;const zn=this.document.getBlockAtPosition(Ce),Zn=(Hn=gt(zn.getLastAttribute()))===null||Hn===void 0?void 0:Hn.htmlAttributes;if(zn&&Zn!=null&&Zn.includes(ke)){const qn=this.document.setHTMLAttributeAtPosition(Ce,ke,$n);this.setDocument(qn)}}setTextAttribute(Ce,ke){const $n=this.getSelectedRange();if(!$n)return;const[Hn,zn]=Array.from($n);if(Hn!==zn)return this.setDocument(this.doc
`?Hn+=1:ke=ke.removeTextAtRange(zn),zn=[Hn,Hn]):Ce.nextCharacter===`
`?Ce.previousCharacter===`
`?zn=[Hn-1,Hn+1]:(zn=[Hn,Hn+1],Hn+=1):Ce.startLocation.offset-1!=0&&(Hn+=1);const Zn=new Je([$n.removeLastAttribute().copyWithoutText()]);return this.setDocument(ke.insertDocumentAtRange(Zn,zn)),this.setSelection(Hn)}getPreviousBlock(){const Ce=this.getLocationRange();if(Ce){const{index:ke}=Ce[0];if(ke>0)return this.document.getBlockAtIndex(ke-1)}}getBlock(){const Ce=this.getLocationRange();if(Ce)return this.document.getBlockAtIndex(Ce[0].index)}getAttachmentAtRange(Ce){const ke=this.document.getDocumentAtRange(Ce);if(ke.toString()==="".concat("",`
`))return ke.getAttachments()[0]}notifyDelegateOfCurrentAttributesChange(){var Ce,ke;return(Ce=this.delegate)===null||Ce===void 0||(ke=Ce.compositionDidChangeCurrentAttributes)===null||ke===void 0?void 0:ke.call(Ce,this.currentAttributes)}notifyDelegateOfInsertionAtRange(Ce){var ke,$n;return(ke=this.delegate)===null||ke===void 0||($n=ke.compositionDidPerformInsertionAtRange)===null||$n===void 0?void 0:$n.call(ke,Ce)}translateUTF16PositionFromOffset(Ce,ke){const $n=this.document.toUTF16String(),Hn=$n.offsetFromUCS2Offset(Ce);return $n.offsetToUCS2Offset(Hn+ke)}}gi.proxyMethod("getSelectionManager().getPointRange"),gi.proxyMethod("getSelectionManager().setLocationRangeFromPointRange"),gi.proxyMethod("getSelectionManager().createLocationRangeFromDOMRange"),gi.proxyMethod("getSelectionManager().locationIsCursorTarget"),gi.proxyMethod("getSelectionManager().selectionIsExpanded"),gi.proxyMethod("delegate?.getSelectionManager");class mi extends H{constructor(Ce){super(...arguments),this.composition=Ce,this.undoEntries=[],this.redoEntries=[]}recordUndoEntry(Ce){let{context:ke,consolidatable:$n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const Hn=this.undoEntries.slice(-1)[0];if(!$n||!pi(Hn,Ce,ke)){const zn=this.createEntry({description:Ce,context:ke});this.undoEntries.push(zn),this.redoEntries=[]}}undo(){const Ce=this.undoEntries.pop();if(Ce){const ke=this.createEntry(Ce);return this.redoEntries.push(ke),this.composition.loadSnapshot(Ce.snapshot)}}redo(){const Ce=this.redoEntries.pop();if(Ce){const ke=this.createEntry(Ce);return this.undoEntries.push(ke),this.composition.loadSnapshot(Ce.snapshot)}}canUndo(){return this.undoEntries.length>0}canRedo(){return this.redoEntries.length>0}createEntry(){let{description:Ce,context:ke}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{description:Ce==null?void 0:Ce.toString(),context:JSON.stringify(ke),snapshot:this.composition.getSnapshot()}}}const pi=(_n,Ce,ke)=>(_n==null?void 0:_n.description)===(Ce==null?void 0:Ce.toString())&&(_n==null?void 0:_n.context)===JSON.stringify(ke),fi="attachmentGallery";class bi{constructor(Ce){this.document=Ce.document,this.selectedRange=Ce.selectedRange}perform(){return this.removeBlockAttribute(),this.applyBlockAttribute()}getSnapshot(){return{document:this.document,selectedRange:this.selectedRange}}removeBlockAttribute(){return this.findRangesOfBlocks().map(Ce=>this.document=this.document.removeAttributeAtRange(fi,Ce))}applyBlockAttribute(){let Ce=0;this.findRangesOfPieces().forEach(ke=>{ke[1]-ke[0]>1&&(ke[0]+=Ce,ke[1]+=Ce,this.document.getCharacterAtPosition(ke[1])!==`
`&&(this.document=this.document.insertBlockBreakAtRange(ke[1]),ke[1]<this.selectedRange[1]&&this.moveSelectedRangeForward(),ke[1]++,Ce++),ke[0]!==0&&this.document.getCharacterAtPosition(ke[0]-1)!==`
`&&(this.document=this.document.insertBlockBreakAtRange(ke[0]),ke[0]<this.selectedRange[0]&&this.moveSelectedRangeForward(),ke[0]++,Ce++),this.document=this.document.applyBlockAttributeAtRange(fi,!0,ke))})}findRangesOfBlocks(){return this.document.findRangesForBlockAttribute(fi)}findRangesOfPieces(){return this.document.findRangesForTextAttribute("presentation",{withValue:"gallery"})}moveSelectedRangeForward(){this.selectedRange[0]+=1,this.selectedRange[1]+=1}}const vi=function(_n){const Ce=new bi(_n);return Ce.perform(),Ce.getSnapshot()},Ai=[vi];class xi{constructor(Ce,ke,$n){this.insertFiles=this.insertFiles.bind(this),this.composition=Ce,this.selectionManager=ke,this.element=$n,this.undoManager=new mi(this.composition),this.filters=Ai.slice(0)}loadDocument(Ce){return this.loadSnapshot({document:Ce,selectedRange:[0,0]})}loadHTML(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";const ke=Xe.parse(Ce,{referenceElement:this.element}).getDocument();return this.loadDocument(ke)}loadJSON(Ce){let{document:ke,selectedRange:$n}=Ce;return ke=Je.fromJSON(ke),this.loadSnapshot({document:ke,selectedRange:$n})}loadSnapshot(Ce){return this.undoManager=new mi(this.composition),this.composition.loadSnapshot(Ce)}getDocument(){return this.composition.document}getSelectedDocument(){return this.composition.getSelectedDocument()}getSnapshot(){return this.composition.getSnapshot()}toJSON(){return this.getSnapshot()}deleteInDirection(Ce){return this.composition.deleteInDirection(Ce)}insertAttachment(Ce){return this.composition.insertAttachment(Ce)}insertAttachments(Ce){return this.composition.insertAttachments(Ce)}insertDocument(Ce){return this.composition.insertDocument(Ce)}insertFile(Ce){return this.composition.insertFile(Ce)}insertFiles(Ce){return this.composition.insertFiles(Ce)}insertHTML(Ce){return this.composition.insertHTML(Ce)}insertString(Ce){return this.composition.insertString(Ce)}insertText(Ce){return this.composition.insertText(Ce)}insertLineBreak(){return this.composition.insertLineBreak()}getSelectedRange(){return this.composition.getSelectedRange()}getPosition(){return this.composition.getPosition()}getClientRectAtPosition(Ce){const ke=this.getDocument().locationRangeFromRange([Ce,Ce+1]);return this.selectionManager.getClientRectAtLocationRange(ke)}expandSelectionInDirection(Ce){return this.composition.expandSelectionInDirection(Ce)}moveCursorInDirection(Ce){return this.composition.moveCursorInDirection(Ce)}setSelectedRange(Ce){return this.composition.setSelectedRange(Ce)}activateAttribute(Ce){let ke=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return this.composition.setCurrentAttribute(Ce,ke)}attributeIsActive(Ce){return this.composition.hasCurrentAttribute(Ce)}canActivateAttribute(Ce){return this.composition.canSetCurrentAttribute(Ce)}deactivateAttribute(Ce){return this.composition.removeCurrentAttribute(Ce)}setHTMLAtributeAtPosition(Ce,ke,$n){this.composition.setHTMLAtributeAtPosition(Ce,ke,$n)}canDecreaseNestingLevel(){return this.composition.canDecreaseNestingLevel()}canIncreaseNestingLevel(){return this.composition.canIncreaseNestingLevel()}decreaseNestingLevel(){if(this.canDecreaseNestingLevel())return this.composition.decreaseNestingLevel()}increaseNestingLevel(){if(this.canIncreaseNestingLevel())return this.composition.increaseNestingLevel()}canRedo(){return this.undoManager.canRedo()}canUndo(){return this.undoManager.canUndo()}recordUndoEntry(Ce){let{context:ke,consolidatable:$n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.undoManager.recordUndoEntry(Ce,{context:ke,consolidatable:$n})}redo(){if(this.canRedo())return this.undoManager.redo()}undo(){if(this.canUndo())return this.undoManager.undo()}}class yi{constructor(Ce){this.element=Ce}findLocationFromContainerAndOffset(Ce,ke){let{strict:$n}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{strict:!0},Hn=0,zn=!1;const Zn={index:0,offset:0},qn=this.findAttachmentElementParentForNode(Ce);qn&&(Ce=qn.parentNode,ke=C$1(qn));const Yn=R(this.element,{usingFilter:Ei});for(;Yn.nextNode();){const Jn=Yn.currentNo
`]):(Ce=qi($n),ke=qi(Hn)),{additions:Ce.filter((zn,Zn)=>zn!==ke[Zn]).map(Wt),deletions:ke.filter((zn,Zn)=>zn!==Ce[Zn]).map(Wt)}}getTextChangesFromCharacterData(){let Ce,ke;const $n=this.getMutationsByType("characterData");if($n.length){const Hn=$n[0],zn=$n[$n.length-1],Zn=function(qn,Yn){let Jn,to;return qn=X.box(qn),(Yn=X.box(Yn)).length<qn.length?[to,Jn]=Vt(qn,Yn):[Jn,to]=Vt(Yn,qn),{added:Jn,removed:to}}(Wt(Hn.oldValue),Wt(zn.target.data));Ce=Zn.added,ke=Zn.removed}return{additions:Ce?[Ce]:[],deletions:ke?[ke]:[]}}}const qi=function(){let _n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];const Ce=[];for(const ke of Array.from(_n))switch(ke.nodeType){case Node.TEXT_NODE:Ce.push(ke.data);break;case Node.ELEMENT_NODE:E(ke)==="br"?Ce.push(`
`):Ce.push(...Array.from(qi(ke.childNodes)||[]))}return Ce};class Vi extends te{constructor(Ce){super(...arguments),this.file=Ce}perform(Ce){const ke=new FileReader;return ke.onerror=()=>Ce(!1),ke.onload=()=>{ke.onerror=null;try{ke.abort()}catch{}return Ce(!0,this.file)},ke.readAsArrayBuffer(this.file)}}class Hi{constructor(Ce){this.element=Ce}shouldIgnore(Ce){return!!a.samsungAndroid&&(this.previousEvent=this.event,this.event=Ce,this.checkSamsungKeyboardBuggyModeStart(),this.checkSamsungKeyboardBuggyModeEnd(),this.buggyMode)}checkSamsungKeyboardBuggyModeStart(){this.insertingLongTextAfterUnidentifiedChar()&&zi(this.element.innerText,this.event.data)&&(this.buggyMode=!0,this.event.preventDefault())}checkSamsungKeyboardBuggyModeEnd(){this.buggyMode&&this.event.inputType!=="insertText"&&(this.buggyMode=!1)}insertingLongTextAfterUnidentifiedChar(){var Ce;return this.isBeforeInputInsertText()&&this.previousEventWasUnidentifiedKeydown()&&((Ce=this.event.data)===null||Ce===void 0?void 0:Ce.length)>50}isBeforeInputInsertText(){return this.event.type==="beforeinput"&&this.event.inputType==="insertText"}previousEventWasUnidentifiedKeydown(){var Ce,ke;return((Ce=this.previousEvent)===null||Ce===void 0?void 0:Ce.type)==="keydown"&&((ke=this.previousEvent)===null||ke===void 0?void 0:ke.key)==="Unidentified"}}const zi=(_n,Ce)=>Ji(_n)===Ji(Ce),_i=new RegExp("(".concat("","|").concat(h,"|").concat(d,"|\\s)+"),"g"),Ji=_n=>_n.replace(_i," ").trim();class Ki extends H{constructor(Ce){super(...arguments),this.element=Ce,this.mutationObserver=new Ui(this.element),this.mutationObserver.delegate=this,this.flakyKeyboardDetector=new Hi(this.element);for(const ke in this.constructor.events)f(ke,{onElement:this.element,withCallback:this.handlerFor(ke)})}elementDidMutate(Ce){}editorWillSyncDocumentView(){return this.mutationObserver.stop()}editorDidSyncDocumentView(){return this.mutationObserver.start()}requestRender(){var Ce,ke;return(Ce=this.delegate)===null||Ce===void 0||(ke=Ce.inputControllerDidRequestRender)===null||ke===void 0?void 0:ke.call(Ce)}requestReparse(){var Ce,ke;return(Ce=this.delegate)===null||Ce===void 0||(ke=Ce.inputControllerDidRequestReparse)===null||ke===void 0||ke.call(Ce),this.requestRender()}attachFiles(Ce){const ke=Array.from(Ce).map($n=>new Vi($n));return Promise.all(ke).then($n=>{this.handleInput(function(){var Hn,zn;return(Hn=this.delegate)===null||Hn===void 0||Hn.inputControllerWillAttachFiles(),(zn=this.responder)===null||zn===void 0||zn.insertFiles($n),this.requestRender()})})}handlerFor(Ce){return ke=>{ke.defaultPrevented||this.handleInput(()=>{if(!x(this.element)){if(this.flakyKeyboardDetector.shouldIgnore(ke))return;this.eventName=Ce,this.constructor.events[Ce].call(this,ke)}})}}handleInput(Ce){try{var ke;(ke=this.delegate)===null||ke===void 0||ke.inputControllerWillHandleInput(),Ce.call(this)}finally{var $n;($n=this.delegate)===null||$n===void 0||$n.inputControllerDidHandleInput()}}createLinkHTML(Ce,ke){const $n=document.createElement("a");return $n.href=Ce,$n.textContent=ke||Ce,$n.outerHTML}}var Gi;Re(Ki,"events",{});const{browser:$i,keyNames:Xi}=V;let Yi=0;class Qi extends Ki{constructor(){super(...arguments),this.resetInputSummary()}setInputSummary(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.inputSummary.eventName=this.eventName;for(const ke in Ce){const $n=Ce[ke];this.inputSummary[ke]=$n}return this.inputSummary}resetInputSummary(){this.inputSummary={}}reset(){return this.resetInputSummary(),Pt.reset()}elementDidMutate(Ce){var ke,$n;return this.isComposing()?(ke=this.delegate)===null||ke===void 0||($n=ke.inputControllerDidAllowUnhandledInput)===null||$n===void 0?void 0:$n.call(ke):this.handleInput(function(){return this.mutationIsSignificant(Ce)&&(this.mutationIsExpected(Ce)?this.requestRender():this.requestReparse()),this.reset()})}mutationIsExpected(Ce){let{textAdded:ke,textDeleted:$n}=Ce;if(this.inputSummary.preferDocument)return!0;const Hn=ke!=null?ke===this.inputSummary.textAdded:!this.inputSummary.textAdded,zn=$n!=null?this.inputSummary.didDelete:!this.inputSummary.didDe
`,`
`].includes(ke)&&!Hn,qn=$n===`
2024-08-30 13:38:34 +03:00
`&&!zn;if(Zn&&!qn||qn&&!Zn){const Jn=this.getSelectedRange();if(Jn){var Yn;const to=Zn?ke.replace(/\n$/,"").length||-1:(ke==null?void 0:ke.length)||1;if((Yn=this.responder)!==null&&Yn!==void 0&&Yn.positionIsBlockBreak(Jn[1]+to))return!0}}return Hn&&zn}mutationIsSignificant(Ce){var ke;const $n=Object.keys(Ce).length>0,Hn=((ke=this.compositionInput)===null||ke===void 0?void 0:ke.getEndData())==="";return $n||!Hn}getCompositionInput(){if(this.isComposing())return this.compositionInput;this.compositionInput=new rn(this)}isComposing(){return this.compositionInput&&!this.compositionInput.isEnded()}deleteInDirection(Ce,ke){var $n;return(($n=this.responder)===null||$n===void 0?void 0:$n.deleteInDirection(Ce))!==!1?this.setInputSummary({didDelete:!0}):ke?(ke.preventDefault(),this.requestRender()):void 0}serializeSelectionToDataTransfer(Ce){var ke;if(!function(Hn){if(Hn==null||!Hn.setData)return!1;for(const zn in yt){const Zn=yt[zn];try{if(Hn.setData(zn,Zn),!Hn.getData(zn)===Zn)return!1}catch{return!1}}return!0}(Ce))return;const $n=(ke=this.responder)===null||ke===void 0?void 0:ke.getSelectedDocument().toSerializableDocument();return Ce.setData("application/x-trix-document",JSON.stringify($n)),Ce.setData("text/html",ve.render($n).innerHTML),Ce.setData("text/plain",$n.toString().replace(/\n$/,"")),!0}canAcceptDataTransfer(Ce){const ke={};return Array.from((Ce==null?void 0:Ce.types)||[]).forEach($n=>{ke[$n]=!0}),ke.Files||ke["application/x-trix-document"]||ke["text/html"]||ke["text/plain"]}getPastedHTMLUsingHiddenElement(Ce){const ke=this.getSelectedRange(),$n={position:"absolute",left:"".concat(window.pageXOffset,"px"),top:"".concat(window.pageYOffset,"px"),opacity:0},Hn=S$1({style:$n,tagName:"div",editable:!0});return document.body.appendChild(Hn),Hn.focus(),requestAnimationFrame(()=>{const zn=Hn.innerHTML;return k(Hn),this.setSelectedRange(ke),Ce(zn)})}}Re(Qi,"events",{keydown(_n){this.isComposing()||this.resetInputSummary(),this.inputSummary.didInput=!0;const Ce=Xi[_n.keyCode];if(Ce){var ke;let Hn=this.keys;["ctrl","alt","shift","meta"].forEach(zn=>{var Zn;_n["".concat(zn,"Key")]&&(zn==="ctrl"&&(zn="control"),Hn=(Zn=Hn)===null||Zn===void 0?void 0:Zn[zn])}),((ke=Hn)===null||ke===void 0?void 0:ke[Ce])!=null&&(this.setInputSummary({keyName:Ce}),Pt.reset(),Hn[Ce].call(this,_n))}if(kt(_n)){const Hn=String.fromCharCode(_n.keyCode).toLowerCase();if(Hn){var $n;const zn=["alt","shift"].map(Zn=>{if(_n["".concat(Zn,"Key")])return Zn}).filter(Zn=>Zn);zn.push(Hn),($n=this.delegate)!==null&&$n!==void 0&&$n.inputControllerDidReceiveKeyboardCommand(zn)&&_n.preventDefault()}}},keypress(_n){if(this.inputSummary.eventName!=null||_n.metaKey||_n.ctrlKey&&!_n.altKey)return;const Ce=en(_n);var ke,$n;return Ce?((ke=this.delegate)===null||ke===void 0||ke.inputControllerWillPerformTyping(),($n=this.responder)===null||$n===void 0||$n.insertString(Ce),this.setInputSummary({textAdded:Ce,didDelete:this.selectionIsExpanded()})):void 0},textInput(_n){const{data:Ce}=_n,{textAdded:ke}=this.inputSummary;if(ke&&ke!==Ce&&ke.toUpperCase()===Ce){var $n;const Hn=this.getSelectedRange();return this.setSelectedRange([Hn[0],Hn[1]+ke.length]),($n=this.responder)===null||$n===void 0||$n.insertString(Ce),this.setInputSummary({textAdded:Ce}),this.setSelectedRange(Hn)}},dragenter(_n){_n.preventDefault()},dragstart(_n){var Ce,ke;return this.serializeSelectionToDataTransfer(_n.dataTransfer),this.draggedRange=this.getSelectedRange(),(Ce=this.delegate)===null||Ce===void 0||(ke=Ce.inputControllerDidStartDrag)===null||ke===void 0?void 0:ke.call(Ce)},dragover(_n){if(this.draggedRange||this.canAcceptDataTransfer(_n.dataTransfer)){_n.preventDefault();const $n={x:_n.clientX,y:_n.clientY};var Ce,ke;if(!St($n,this.draggingPoint))return this.draggingPoint=$n,(Ce=this.delegate)===null||Ce===void 0||(ke=Ce.inputControllerDidReceiveDragOverPoint)===null||ke===void 0?void 0:ke.call(Ce,this.draggingPoint)}},dragend(_n){var Ce,ke;(Ce=this.delegate)===null||Ce===void 0||(ke=Ce.inputControllerDidCancelDrag)===null||ke===void 0||ke.call(Ce),this.draggedRange=null,this.draggingPoint=null},drop(_n)
2024-08-27 12:25:42 +03:00
`,{updatePosition:!1}),this.requestRender()}},shift:{return(_n){var Ce,ke;(Ce=this.delegate)===null||Ce===void 0||Ce.inputControllerWillPerformTyping(),(ke=this.responder)===null||ke===void 0||ke.insertString(`
`),this.requestRender(),_n.preventDefault()},tab(_n){var Ce,ke;(Ce=this.responder)!==null&&Ce!==void 0&&Ce.canDecreaseNestingLevel()&&((ke=this.responder)===null||ke===void 0||ke.decreaseNestingLevel(),this.requestRender(),_n.preventDefault())},left(_n){if(this.selectionIsInCursorTarget())return _n.preventDefault(),this.expandSelectionInDirection("backward")},right(_n){if(this.selectionIsInCursorTarget())return _n.preventDefault(),this.expandSelectionInDirection("forward")}},alt:{backspace(_n){var Ce;return this.setInputSummary({preferDocument:!1}),(Ce=this.delegate)===null||Ce===void 0?void 0:Ce.inputControllerWillPerformTyping()}},meta:{backspace(_n){var Ce;return this.setInputSummary({preferDocument:!1}),(Ce=this.delegate)===null||Ce===void 0?void 0:Ce.inputControllerWillPerformTyping()}}}),Qi.proxyMethod("responder?.getSelectedRange"),Qi.proxyMethod("responder?.setSelectedRange"),Qi.proxyMethod("responder?.expandSelectionInDirection"),Qi.proxyMethod("responder?.selectionIsInCursorTarget"),Qi.proxyMethod("responder?.selectionIsExpanded");const Zi=_n=>{var Ce;return(Ce=_n.type)===null||Ce===void 0||(Ce=Ce.match(/\/(\w+)$/))===null||Ce===void 0?void 0:Ce[1]},tn=!((Gi=" ".codePointAt)===null||Gi===void 0||!Gi.call(" ",0)),en=function(_n){if(_n.key&&tn&&_n.key.codePointAt(0)===_n.keyCode)return _n.key;{let Ce;if(_n.which===null?Ce=_n.keyCode:_n.which!==0&&_n.charCode!==0&&(Ce=_n.charCode),Ce!=null&&Xi[Ce]!=="escape")return X.fromCodepoints([Ce]).toString()}},nn=function(_n){const Ce=_n.clipboardData;if(Ce){if(Ce.types.includes("text/html")){for(const ke of Ce.types){const $n=/^CorePasteboardFlavorType/.test(ke),Hn=/^dyn\./.test(ke)&&Ce.getData(ke);if($n||Hn)return!0}return!1}{const ke=Ce.types.includes("com.apple.webarchive"),$n=Ce.types.includes("com.apple.flat-rtfd");return ke||$n}}};class rn extends H{constructor(Ce){super(...arguments),this.inputController=Ce,this.responder=this.inputController.responder,this.delegate=this.inputController.delegate,this.inputSummary=this.inputController.inputSummary,this.data={}}start(Ce){if(this.data.start=Ce,this.isSignificant()){var ke,$n;this.inputSummary.eventName==="keypress"&&this.inputSummary.textAdded&&(($n=this.responder)===null||$n===void 0||$n.deleteInDirection("left")),this.selectionIsExpanded()||(this.insertPlaceholder(),this.requestRender()),this.range=(ke=this.responder)===null||ke===void 0?void 0:ke.getSelectedRange()}}update(Ce){if(this.data.update=Ce,this.isSignificant()){const ke=this.selectPlaceholder();ke&&(this.forgetPlaceholder(),this.range=ke)}}end(Ce){return this.data.end=Ce,this.isSignificant()?(this.forgetPlaceholder(),this.canApplyToDocument()?(this.setInputSummary({preferDocument:!0,didInput:!1}),(ke=this.delegate)===null||ke===void 0||ke.inputControllerWillPerformTyping(),($n=this.responder)===null||$n===void 0||$n.setSelectedRange(this.range),(Hn=this.responder)===null||Hn===void 0||Hn.insertString(this.data.end),(zn=this.responder)===null||zn===void 0?void 0:zn.setSelectedRange(this.range[0]+this.data.end.length)):this.data.start!=null||this.data.update!=null?(this.requestReparse(),this.inputController.reset()):void 0):this.inputController.reset();var ke,$n,Hn,zn}getEndData(){return this.data.end}isEnded(){return this.getEndData()!=null}isSignificant(){return!$i.composesExistingText||this.inputSummary.didInput}canApplyToDocument(){var Ce,ke;return((Ce=this.data.start)===null||Ce===void 0?void 0:Ce.length)===0&&((ke=this.data.end)===null||ke===void 0?void 0:ke.length)>0&&this.range}}rn.proxyMethod("inputController.setInputSummary"),rn.proxyMethod("inputController.requestRender"),rn.proxyMethod("inputController.requestReparse"),rn.proxyMethod("responder?.selectionIsExpanded"),rn.proxyMethod("responder?.insertPlaceholder"),rn.proxyMethod("responder?.selectPlaceholder"),rn.proxyMethod("responder?.forgetPlaceholder");class on extends Ki{constructor(){super(...arguments),this.render=this.render.bind(this)}elementDidMutate(){return this.scheduledRender?this.composing?(Ce=this.delegate)===null||Ce===void 0||(ke=Ce.inputControllerDidAllowUnhandledInput)===null|
`)},insertLink(){return this.activateAttributeIfSupported("href",this.event.data)},insertOrderedList(){return this.toggleAttributeIfSupported("number")},insertParagraph(){var _n;return(_n=this.delegate)===null||_n===void 0||_n.inputControllerWillPerformTyping(),this.withTargetDOMRange(function(){var Ce;return(Ce=this.responder)===null||Ce===void 0?void 0:Ce.insertLineBreak()})},insertReplacementText(){const _n=this.event.dataTransfer.getData("text/plain"),Ce=this.event.getTargetRanges()[0];this.withTargetDOMRange(Ce,()=>{this.insertString(_n,{updatePosition:!1})})},insertText(){var _n;return this.insertString(this.event.data||((_n=this.event.dataTransfer)===null||_n===void 0?void 0:_n.getData("text/plain")))},insertTranspose(){return this.insertString(this.event.data)},insertUnorderedList(){return this.toggleAttributeIfSupported("bullet")}});const sn=function(_n){const Ce=document.createRange();return Ce.setStart(_n.startContainer,_n.startOffset),Ce.setEnd(_n.endContainer,_n.endOffset),Ce},an=_n=>{var Ce;return Array.from(((Ce=_n.dataTransfer)===null||Ce===void 0?void 0:Ce.types)||[]).includes("Files")},ln=_n=>{var Ce;return((Ce=_n.dataTransfer.files)===null||Ce===void 0?void 0:Ce[0])&&!cn(_n)&&!(ke=>{let{dataTransfer:$n}=ke;return $n.types.includes("Files")&&$n.types.includes("text/html")&&$n.getData("text/html").includes("urn:schemas-microsoft-com:office:office")})(_n)},cn=function(_n){const Ce=_n.clipboardData;if(Ce)return Array.from(Ce.types).filter(ke=>ke.match(/file/i)).length===Ce.types.length&&Ce.files.length>=1},un=function(_n){const Ce=_n.clipboardData;if(Ce)return Ce.types.includes("text/plain")&&Ce.types.length===1},hn=function(_n){const Ce=[];return _n.altKey&&Ce.push("alt"),_n.shiftKey&&Ce.push("shift"),Ce.push(_n.key),Ce},dn=_n=>({x:_n.clientX,y:_n.clientY}),gn="[data-trix-attribute]",mn="[data-trix-action]",pn="".concat(gn,", ").concat(mn),fn="[data-trix-dialog]",bn="".concat(fn,"[data-trix-active]"),vn="".concat(fn," [data-trix-method]"),An="".concat(fn," [data-trix-input]"),xn=(_n,Ce)=>(Ce||(Ce=Cn(_n)),_n.querySelector("[data-trix-input][name='".concat(Ce,"']"))),yn=_n=>_n.getAttribute("data-trix-action"),Cn=_n=>_n.getAttribute("data-trix-attribute")||_n.getAttribute("data-trix-dialog-attribute");class kn extends H{constructor(Ce){super(Ce),this.didClickActionButton=this.didClickActionButton.bind(this),this.didClickAttributeButton=this.didClickAttributeButton.bind(this),this.didClickDialogButton=this.didClickDialogButton.bind(this),this.didKeyDownDialogInput=this.didKeyDownDialogInput.bind(this),this.element=Ce,this.attributes={},this.actions={},this.resetDialogInputs(),f("mousedown",{onElement:this.element,matchingSelector:mn,withCallback:this.didClickActionButton}),f("mousedown",{onElement:this.element,matchingSelector:gn,withCallback:this.didClickAttributeButton}),f("click",{onElement:this.element,matchingSelector:pn,preventDefault:!0}),f("click",{onElement:this.element,matchingSelector:vn,withCallback:this.didClickDialogButton}),f("keydown",{onElement:this.element,matchingSelector:An,withCallback:this.didKeyDownDialogInput})}didClickActionButton(Ce,ke){var $n;($n=this.delegate)===null||$n===void 0||$n.toolbarDidClickButton(),Ce.preventDefault();const Hn=yn(ke);return this.getDialog(Hn)?this.toggleDialog(Hn):(zn=this.delegate)===null||zn===void 0?void 0:zn.toolbarDidInvokeAction(Hn,ke);var zn}didClickAttributeButton(Ce,ke){var $n;($n=this.delegate)===null||$n===void 0||$n.toolbarDidClickButton(),Ce.preventDefault();const Hn=Cn(ke);var zn;return this.getDialog(Hn)?this.toggleDialog(Hn):(zn=this.delegate)===null||zn===void 0||zn.toolbarDidToggleAttribute(Hn),this.refreshAttributeButtons()}didClickDialogButton(Ce,ke){const $n=A(ke,{matchingSelector:fn});return this[ke.getAttribute("data-trix-method")].call(this,$n)}didKeyDownDialogInput(Ce,ke){if(Ce.keyCode===13){Ce.preventDefault();const $n=ke.getAttribute("name"),Hn=this.getDialog($n);this.setAttribute(Hn)}if(Ce.keyCode===27)return Ce.preventDefault(),this.hideDialog()}updateActions(Ce){return this.actions=Ce,this.refreshActionButtons()}refreshAction
display: block;
}
%t {
white-space: nowrap;
}
%t [data-trix-dialog] {
display: none;
}
%t [data-trix-dialog][data-trix-active] {
display: block;
}
%t [data-trix-dialog] [data-trix-validate]:invalid {
background-color: #ffdddd;
}`);class Dn extends HTMLElement{connectedCallback(){this.innerHTML===""&&(this.innerHTML=U.getDefaultHTML())}}let wn=0;const Tn=function(_n){if(!_n.hasAttribute("contenteditable"))return _n.setAttribute("contenteditable",""),function(Ce){let ke=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return ke.times=1,f(Ce,ke)}("focus",{onElement:_n,withCallback:()=>Bn(_n)})},Bn=function(_n){return Fn(_n),Pn()},Fn=function(_n){var Ce,ke;if((Ce=(ke=document).queryCommandSupported)!==null&&Ce!==void 0&&Ce.call(ke,"enableObjectResizing"))return document.execCommand("enableObjectResizing",!1,!1),f("mscontrolselect",{onElement:_n,preventDefault:!0})},Pn=function(_n){var Ce,ke;if((Ce=(ke=document).queryCommandSupported)!==null&&Ce!==void 0&&Ce.call(ke,"DefaultParagraphSeparator")){const{tagName:$n}=n.default;if(["div","p"].includes($n))return document.execCommand("DefaultParagraphSeparator",!1,$n)}},In=a.forcesObjectResizing?{display:"inline",width:"auto"}:{display:"inline-block",width:"1px"};bt("trix-editor",`%t {
display: block;
}
%t:empty::before {
content: attr(placeholder);
color: graytext;
cursor: text;
pointer-events: none;
white-space: pre-line;
}
%t a[contenteditable=false] {
cursor: text;
}
%t img {
max-width: 100%;
height: auto;
}
%t `.concat(e,` figcaption textarea {
resize: none;
}
%t `).concat(e,` figcaption textarea.trix-autoresize-clone {
position: absolute;
left: -9999px;
max-height: 0px;
}
%t `).concat(e,` figcaption[data-trix-placeholder]:empty::before {
content: attr(data-trix-placeholder);
color: graytext;
}
%t [data-trix-cursor-target] {
display: `).concat(In.display,` !important;
width: `).concat(In.width,` !important;
padding: 0 !important;
margin: 0 !important;
border: none !important;
}
%t [data-trix-cursor-target=left] {
vertical-align: top !important;
margin-left: -1px !important;
}
%t [data-trix-cursor-target=right] {
vertical-align: bottom !important;
margin-right: -1px !important;
2024-08-30 13:38:34 +03:00
}`));class Nn extends HTMLElement{get trixId(){return this.hasAttribute("trix-id")?this.getAttribute("trix-id"):(this.setAttribute("trix-id",++wn),this.trixId)}get labels(){const Ce=[];this.id&&this.ownerDocument&&Ce.push(...Array.from(this.ownerDocument.querySelectorAll("label[for='".concat(this.id,"']"))||[]));const ke=A(this,{matchingSelector:"label"});return ke&&[this,null].includes(ke.control)&&Ce.push(ke),Ce}get toolbarElement(){var Ce;if(this.hasAttribute("toolbar"))return(Ce=this.ownerDocument)===null||Ce===void 0?void 0:Ce.getElementById(this.getAttribute("toolbar"));if(this.parentNode){const ke="trix-toolbar-".concat(this.trixId);this.setAttribute("toolbar",ke);const $n=S$1("trix-toolbar",{id:ke});return this.parentNode.insertBefore($n,this),$n}}get form(){var Ce;return(Ce=this.inputElement)===null||Ce===void 0?void 0:Ce.form}get inputElement(){var Ce;if(this.hasAttribute("input"))return(Ce=this.ownerDocument)===null||Ce===void 0?void 0:Ce.getElementById(this.getAttribute("input"));if(this.parentNode){const ke="trix-input-".concat(this.trixId);this.setAttribute("input",ke);const $n=S$1("input",{type:"hidden",id:ke});return this.parentNode.insertBefore($n,this.nextElementSibling),$n}}get editor(){var Ce;return(Ce=this.editorController)===null||Ce===void 0?void 0:Ce.editor}get name(){var Ce;return(Ce=this.inputElement)===null||Ce===void 0?void 0:Ce.name}get value(){var Ce;return(Ce=this.inputElement)===null||Ce===void 0?void 0:Ce.value}set value(Ce){var ke;this.defaultValue=Ce,(ke=this.editor)===null||ke===void 0||ke.loadHTML(this.defaultValue)}notify(Ce,ke){if(this.editorController)return b("trix-".concat(Ce),{onElement:this,attributes:ke})}setInputElementValue(Ce){this.inputElement&&(this.inputElement.value=Ce)}connectedCallback(){this.hasAttribute("data-trix-internal")||(Tn(this),function(Ce){Ce.hasAttribute("role")||Ce.setAttribute("role","textbox")}(this),function(Ce){if(Ce.hasAttribute("aria-label")||Ce.hasAttribute("aria-labelledby"))return;const ke=function(){const $n=Array.from(Ce.labels).map(zn=>{if(!zn.contains(Ce))return zn.textContent}).filter(zn=>zn),Hn=$n.join(" ");return Hn?Ce.setAttribute("aria-label",Hn):Ce.removeAttribute("aria-label")};ke(),f("focus",{onElement:Ce,withCallback:ke})}(this),this.editorController||(b("trix-before-initialize",{onElement:this}),this.editorController=new Rn({editorElement:this,html:this.defaultValue=this.value}),requestAnimationFrame(()=>b("trix-initialize",{onElement:this}))),this.editorController.registerSelectionManager(),this.registerResetListener(),this.registerClickListener(),function(Ce){!document.querySelector(":focus")&&Ce.hasAttribute("autofocus")&&document.querySelector("[autofocus]")===Ce&&Ce.focus()}(this))}disconnectedCallback(){var Ce;return(Ce=this.editorController)===null||Ce===void 0||Ce.unregisterSelectionManager(),this.unregisterResetListener(),this.unregisterClickListener()}registerResetListener(){return this.resetListener=this.resetBubbled.bind(this),window.addEventListener("reset",this.resetListener,!1)}unregisterResetListener(){return window.removeEventListener("reset",this.resetListener,!1)}registerClickListener(){return this.clickListener=this.clickBubbled.bind(this),window.addEventListener("click",this.clickListener,!1)}unregisterClickListener(){return window.removeEventListener("click",this.clickListener,!1)}resetBubbled(Ce){if(!Ce.defaultPrevented&&Ce.target===this.form)return this.reset()}clickBubbled(Ce){if(Ce.defaultPrevented||this.contains(Ce.target))return;const ke=A(Ce.target,{matchingSelector:"label"});return ke&&Array.from(this.labels).includes(ke)?this.focus():void 0}reset(){this.value=this.defaultValue}}const On={VERSION:t$1,config:V,core:ci,models:Di,views:wi,controllers:En,observers:Sn,operations:Ln,elements:Object.freeze({__proto__:null,TrixEditorElement:Nn,TrixToolbarElement:Dn}),filters:Object.freeze({__proto__:null,Filter:bi,attachmentGalleryFilter:vi})};Object.assign(On,Di),window.Trix=On,setTimeout(function(){customElements.get("trix-toolbar")||customElements.define("trix-toolbar",Dn),customElements.get("trix-editor")|
2024-08-27 12:25:42 +03:00
`){[Ce,ke]=clip(this,Ce,ke);let Hn="";for(let zn=0,Zn=0;zn<=ke&&Zn<this.text.length;Zn++){let qn=this.text[Zn],Yn=zn+qn.length;zn>Ce&&Zn&&(Hn+=$n),Ce<Yn&&ke>zn&&(Hn+=qn.slice(Math.max(0,Ce-zn),ke-zn)),zn=Yn+1}return Hn}flatten(Ce){for(let ke of this.text)Ce.push(ke)}scanIdentical(){return 0}static split(Ce,ke){let $n=[],Hn=-1;for(let zn of Ce)$n.push(zn),Hn+=zn.length+1,$n.length==32&&(ke.push(new TextLeaf($n,Hn)),$n=[],Hn=-1);return Hn>-1&&ke.push(new TextLeaf($n,Hn)),ke}}class TextNode extends Text{constructor(Ce,ke){super(),this.children=Ce,this.length=ke,this.lines=0;for(let $n of Ce)this.lines+=$n.lines}lineInner(Ce,ke,$n,Hn){for(let zn=0;;zn++){let Zn=this.children[zn],qn=Hn+Zn.length,Yn=$n+Zn.lines-1;if((ke?Yn:qn)>=Ce)return Zn.lineInner(Ce,ke,$n,Hn);Hn=qn+1,$n=Yn+1}}decompose(Ce,ke,$n,Hn){for(let zn=0,Zn=0;Zn<=ke&&zn<this.children.length;zn++){let qn=this.children[zn],Yn=Zn+qn.length;if(Ce<=Yn&&ke>=Zn){let Jn=Hn&((Zn<=Ce?1:0)|(Yn>=ke?2:0));Zn>=Ce&&Yn<=ke&&!Jn?$n.push(qn):qn.decompose(Ce-Zn,ke-Zn,$n,Jn)}Zn=Yn+1}}replace(Ce,ke,$n){if([Ce,ke]=clip(this,Ce,ke),$n.lines<this.lines)for(let Hn=0,zn=0;Hn<this.children.length;Hn++){let Zn=this.children[Hn],qn=zn+Zn.length;if(Ce>=zn&&ke<=qn){let Yn=Zn.replace(Ce-zn,ke-zn,$n),Jn=this.lines-Zn.lines+Yn.lines;if(Yn.lines<Jn>>4&&Yn.lines>Jn>>6){let to=this.children.slice();return to[Hn]=Yn,new TextNode(to,this.length-(ke-Ce)+$n.length)}return super.replace(zn,qn,Yn)}zn=qn+1}return super.replace(Ce,ke,$n)}sliceString(Ce,ke=this.length,$n=`
2024-08-30 13:38:34 +03:00
`){[Ce,ke]=clip(this,Ce,ke);let Hn="";for(let zn=0,Zn=0;zn<this.children.length&&Zn<=ke;zn++){let qn=this.children[zn],Yn=Zn+qn.length;Zn>Ce&&zn&&(Hn+=$n),Ce<Yn&&ke>Zn&&(Hn+=qn.sliceString(Ce-Zn,ke-Zn,$n)),Zn=Yn+1}return Hn}flatten(Ce){for(let ke of this.children)ke.flatten(Ce)}scanIdentical(Ce,ke){if(!(Ce instanceof TextNode))return 0;let $n=0,[Hn,zn,Zn,qn]=ke>0?[0,0,this.children.length,Ce.children.length]:[this.children.length-1,Ce.children.length-1,-1,-1];for(;;Hn+=ke,zn+=ke){if(Hn==Zn||zn==qn)return $n;let Yn=this.children[Hn],Jn=Ce.children[zn];if(Yn!=Jn)return $n+Yn.scanIdentical(Jn,ke);$n+=Yn.length+1}}static from(Ce,ke=Ce.reduce(($n,Hn)=>$n+Hn.length+1,-1)){let $n=0;for(let ho of Ce)$n+=ho.lines;if($n<32){let ho=[];for(let bo of Ce)bo.flatten(ho);return new TextLeaf(ho,ke)}let Hn=Math.max(32,$n>>5),zn=Hn<<1,Zn=Hn>>1,qn=[],Yn=0,Jn=-1,to=[];function io(ho){let bo;if(ho.lines>zn&&ho instanceof TextNode)for(let Oo of ho.children)io(Oo);else ho.lines>Zn&&(Yn>Zn||!Yn)?(uo(),qn.push(ho)):ho instanceof TextLeaf&&Yn&&(bo=to[to.length-1])instanceof TextLeaf&&ho.lines+bo.lines<=32?(Yn+=ho.lines,Jn+=ho.length+1,to[to.length-1]=new TextLeaf(bo.text.concat(ho.text),bo.length+1+ho.length)):(Yn+ho.lines>Hn&&uo(),Yn+=ho.lines,Jn+=ho.length+1,to.push(ho))}function uo(){Yn!=0&&(qn.push(to.length==1?to[0]:TextNode.from(to,Jn)),Jn=-1,Yn=to.length=0)}for(let ho of Ce)io(ho);return uo(),qn.length==1?qn[0]:new TextNode(qn,ke)}}Text.empty=new TextLeaf([""],0);function textLength(_n){let Ce=-1;for(let ke of _n)Ce+=ke.length+1;return Ce}function appendText(_n,Ce,ke=0,$n=1e9){for(let Hn=0,zn=0,Zn=!0;zn<_n.length&&Hn<=$n;zn++){let qn=_n[zn],Yn=Hn+qn.length;Yn>=ke&&(Yn>$n&&(qn=qn.slice(0,$n-Hn)),Hn<ke&&(qn=qn.slice(ke-Hn)),Zn?(Ce[Ce.length-1]+=qn,Zn=!1):Ce.push(qn)),Hn=Yn+1}return Ce}function sliceText(_n,Ce,ke){return appendText(_n,[""],Ce,ke)}class RawTextCursor{constructor(Ce,ke=1){this.dir=ke,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[Ce],this.offsets=[ke>0?1:(Ce instanceof TextLeaf?Ce.text.length:Ce.children.length)<<1]}nextInner(Ce,ke){for(this.done=this.lineBreak=!1;;){let $n=this.nodes.length-1,Hn=this.nodes[$n],zn=this.offsets[$n],Zn=zn>>1,qn=Hn instanceof TextLeaf?Hn.text.length:Hn.children.length;if(Zn==(ke>0?qn:0)){if($n==0)return this.done=!0,this.value="",this;ke>0&&this.offsets[$n-1]++,this.nodes.pop(),this.offsets.pop()}else if((zn&1)==(ke>0?0:1)){if(this.offsets[$n]+=ke,Ce==0)return this.lineBreak=!0,this.value=`
`,this;Ce--}else if(Hn instanceof TextLeaf){let Yn=Hn.text[Zn+(ke<0?-1:0)];if(this.offsets[$n]+=ke,Yn.length>Math.max(0,Ce))return this.value=Ce==0?Yn:ke>0?Yn.slice(Ce):Yn.slice(0,Yn.length-Ce),this;Ce-=Yn.length}else{let Yn=Hn.children[Zn+(ke<0?-1:0)];Ce>Yn.length?(Ce-=Yn.length,this.offsets[$n]+=ke):(ke<0&&this.offsets[$n]--,this.nodes.push(Yn),this.offsets.push(ke>0?1:(Yn instanceof TextLeaf?Yn.text.length:Yn.children.length)<<1))}}}next(Ce=0){return Ce<0&&(this.nextInner(-Ce,-this.dir),Ce=this.value.length),this.nextInner(Ce,this.dir)}}class PartialTextCursor{constructor(Ce,ke,$n){this.value="",this.done=!1,this.cursor=new RawTextCursor(Ce,ke>$n?-1:1),this.pos=ke>$n?Ce.length:0,this.from=Math.min(ke,$n),this.to=Math.max(ke,$n)}nextInner(Ce,ke){if(ke<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;Ce+=Math.max(0,ke<0?this.pos-this.to:this.from-this.pos);let $n=ke<0?this.pos-this.from:this.to-this.pos;Ce>$n&&(Ce=$n),$n-=Ce;let{value:Hn}=this.cursor.next(Ce);return this.pos+=(Hn.length+Ce)*ke,this.value=Hn.length<=$n?Hn:ke<0?Hn.slice(Hn.length-$n):Hn.slice(0,$n),this.done=!this.value,this}next(Ce=0){return Ce<0?Ce=Math.max(Ce,this.from-this.pos):Ce>0&&(Ce=Math.min(Ce,this.to-this.pos)),this.nextInner(Ce,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class LineCursor{constructor(Ce){this.inner=Ce,this.afterBreak=!0,this.value="",this.done=!1}next(Ce=0){let{done:ke,lineBreak:$n,value:Hn}=this.inner.next(Ce);return ke&&this.afterBreak?(this.value="",this.afterBreak=!1):ke?(this.done=!0,this.value=""):$n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=Hn,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Text.prototype[Symbol.iterator]=function(){return this.iter()},RawTextCursor.prototype[Symbol.iterator]=PartialTextCursor.prototype[Symbol.iterator]=LineCursor.prototype[Symbol.iterator]=function(){return this});let Line$1=class{constructor(Ce,ke,$n,Hn){this.from=Ce,this.to=ke,this.number=$n,this.text=Hn}get length(){return this.to-this.from}};function clip(_n,Ce,ke){return Ce=Math.max(0,Math.min(_n.length,Ce)),[Ce,Math.max(Ce,Math.min(_n.length,ke))]}let extend="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(_n=>_n?parseInt(_n,36):1);for(let _n=1;_n<extend.length;_n++)extend[_n]+=extend[_n-1];function isExtendingChar(_n){for(let Ce=1;Ce<extend.length;Ce+=2)if(extend[Ce]>_n)return extend[Ce-1]<=_n;return!1}function isRegionalIndicator(_n){return _n>=127462&&_n<=127487}const ZWJ=8205;function findClusterBreak(_n,Ce,ke=!0,$n=!0){return(ke?nextClusterBreak:prevClusterBreak)(_n,Ce,$n)}function nextClusterBreak(_n,Ce,ke){if(Ce==_n.length)return Ce;Ce&&surrogateLow(_n.charCodeAt(Ce))&&surrogateHigh(_n.charCodeAt(Ce-1))&&Ce--;let $n=codePointAt(_n,Ce)
`}get readOnly(){return this.facet(readOnly)}phrase(Ce,...ke){for(let $n of this.facet(EditorState.phrases))if(Object.prototype.hasOwnProperty.call($n,Ce)){Ce=$n[Ce];break}return ke.length&&(Ce=Ce.replace(/\$(\$|\d*)/g,($n,Hn)=>{if(Hn=="$")return"$";let zn=+(Hn||1);return!zn||zn>ke.length?$n:ke[zn-1]})),Ce}languageDataAt(Ce,ke,$n=-1){let Hn=[];for(let zn of this.facet(languageData))for(let Zn of zn(this,ke,$n))Object.prototype.hasOwnProperty.call(Zn,Ce)&&Hn.push(Zn[Ce]);return Hn}charCategorizer(Ce){return makeCategorizer(this.languageDataAt("wordChars",Ce).join(""))}wordAt(Ce){let{text:ke,from:$n,length:Hn}=this.doc.lineAt(Ce),zn=this.charCategorizer(Ce),Zn=Ce-$n,qn=Ce-$n;for(;Zn>0;){let Yn=findClusterBreak(ke,Zn,!1);if(zn(ke.slice(Yn,Zn))!=CharCategory.Word)break;Zn=Yn}for(;qn<Hn;){let Yn=findClusterBreak(ke,qn);if(zn(ke.slice(qn,Yn))!=CharCategory.Word)break;qn=Yn}return Zn==qn?null:EditorSelection.range(Zn+$n,qn+$n)}}EditorState.allowMultipleSelections=allowMultipleSelections;EditorState.tabSize=Facet.define({combine:_n=>_n.length?_n[0]:4});EditorState.lineSeparator=lineSeparator;EditorState.readOnly=readOnly;EditorState.phrases=Facet.define({compare(_n,Ce){let ke=Object.keys(_n),$n=Object.keys(Ce);return ke.length==$n.length&&ke.every(Hn=>_n[Hn]==Ce[Hn])}});EditorState.languageData=languageData;EditorState.changeFilter=changeFilter;EditorState.transactionFilter=transactionFilter;EditorState.transactionExtender=transactionExtender;Compartment.reconfigure=StateEffect.define();function combineConfig(_n,Ce,ke={}){let $n={};for(let Hn of _n)for(let zn of Object.keys(Hn)){let Zn=Hn[zn],qn=$n[zn];if(qn===void 0)$n[zn]=Zn;else if(!(qn===Zn||Zn===void 0))if(Object.hasOwnProperty.call(ke,zn))$n[zn]=ke[zn](qn,Zn);else throw new Error("Config merge conflict for field "+zn)}for(let Hn in Ce)$n[Hn]===void 0&&($n[Hn]=Ce[Hn]);return $n}class RangeValue{eq(Ce){return this==Ce}range(Ce,ke=Ce){return Range$2.create(Ce,ke,this)}}RangeValue.prototype.startSide=RangeValue.prototype.endSide=0;RangeValue.prototype.point=!1;RangeValue.prototype.mapMode=MapMode.TrackDel;let Range$2=class rK{constructor(Ce,ke,$n){this.from=Ce,this.to=ke,this.value=$n}static create(Ce,ke,$n){return new rK(Ce,ke,$n)}};function cmpRange(_n,Ce){return _n.from-Ce.from||_n.value.startSide-Ce.value.startSide}class Chunk{constructor(Ce,ke,$n,Hn){this.from=Ce,this.to=ke,this.value=$n,this.maxPoint=Hn}get length(){return this.to[this.to.length-1]}findIndex(Ce,ke,$n,Hn=0){let zn=$n?this.to:this.from;for(let Zn=Hn,qn=zn.length;;){if(Zn==qn)return Zn;let Yn=Zn+qn>>1,Jn=zn[Yn]-Ce||($n?this.value[Yn].endSide:this.value[Yn].startSide)-ke;if(Yn==Zn)return Jn>=0?Zn:qn;Jn>=0?qn=Yn:Zn=Yn+1}}between(Ce,ke,$n,Hn){for(let zn=this.findIndex(ke,-1e9,!0),Zn=this.findIndex($n,1e9,!1,zn);zn<Zn;zn++)if(Hn(this.from[zn]+Ce,this.to[zn]+Ce,this.value[zn])===!1)return!1}map(Ce,ke){let $n=[],Hn=[],zn=[],Zn=-1,qn=-1;for(let Yn=0;Yn<this.value.length;Yn++){let Jn=this.value[Yn],to=this.from[Yn]+Ce,io=this.to[Yn]+Ce,uo,ho;if(to==io){let bo=ke.mapPos(to,Jn.startSide,Jn.mapMode);if(bo==null||(uo=ho=bo,Jn.startSide!=Jn.endSide&&(ho=ke.mapPos(to,Jn.endSide),ho<uo)))continue}else if(uo=ke.mapPos(to,Jn.startSide),ho=ke.mapPos(io,Jn.endSide),uo>ho||uo==ho&&Jn.startSide>0&&Jn.endSide<=0)continue;(ho-uo||Jn.endSide-Jn.startSide)<0||(Zn<0&&(Zn=uo),Jn.point&&(qn=Math.max(qn,ho-uo)),$n.push(Jn),Hn.push(uo-Zn),zn.push(ho-Zn))}return{mapped:$n.length?new Chunk(Hn,zn,$n,qn):null,pos:Zn}}}class RangeSet{constructor(Ce,ke,$n,Hn){this.chunkPos=Ce,this.chunk=ke,this.nextLayer=$n,this.maxPoint=Hn}static create(Ce,ke,$n,Hn){return new RangeSet(Ce,ke,$n,Hn)}get length(){let Ce=this.chunk.length-1;return Ce<0?0:Math.max(this.chunkEnd(Ce),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let Ce=this.nextLayer.size;for(let ke of this.chunk)Ce+=ke.value.length;return Ce}chunkEnd(Ce){return this.chunkPos[Ce]+this.chunk[Ce].length}update(Ce){let{add:ke=[],sort:$n=!1,filterFrom:Hn=0,filterTo:zn=this.length}=Ce,Zn=Ce.filter;if(ke.length==0&&!Zn)return this;if($n&&(ke=ke.slice().sort(cmpRange)),this.isEmpty)return k
2024-08-27 12:25:42 +03:00
`)}static newName(){let Ce=top[COUNT]||1;return top[COUNT]=Ce+1,C+Ce.toString(36)}static mount(Ce,ke,$n){let Hn=Ce[SET],zn=$n&&$n.nonce;Hn?zn&&Hn.setNonce(zn):Hn=new StyleSet(Ce,zn),Hn.mount(Array.isArray(ke)?ke:[ke],Ce)}}let adoptedSet=new Map;class StyleSet{constructor(Ce,ke){let $n=Ce.ownerDocument||Ce,Hn=$n.defaultView;if(!Ce.head&&Ce.adoptedStyleSheets&&Hn.CSSStyleSheet){let zn=adoptedSet.get($n);if(zn)return Ce[SET]=zn;this.sheet=new Hn.CSSStyleSheet,adoptedSet.set($n,this)}else this.styleTag=$n.createElement("style"),ke&&this.styleTag.setAttribute("nonce",ke);this.modules=[],Ce[SET]=this}mount(Ce,ke){let $n=this.sheet,Hn=0,zn=0;for(let Zn=0;Zn<Ce.length;Zn++){let qn=Ce[Zn],Yn=this.modules.indexOf(qn);if(Yn<zn&&Yn>-1&&(this.modules.splice(Yn,1),zn--,Yn=-1),Yn==-1){if(this.modules.splice(zn++,0,qn),$n)for(let Jn=0;Jn<qn.rules.length;Jn++)$n.insertRule(qn.rules[Jn],Hn++)}else{for(;zn<Yn;)Hn+=this.modules[zn++].rules.length;Hn+=qn.rules.length,zn++}}if($n)ke.adoptedStyleSheets.indexOf(this.sheet)<0&&(ke.adoptedStyleSheets=[this.sheet,...ke.adoptedStyleSheets]);else{let Zn="";for(let Yn=0;Yn<this.modules.length;Yn++)Zn+=this.modules[Yn].getRules()+`
2024-08-30 13:38:34 +03:00
`;this.styleTag.textContent=Zn;let qn=ke.head||ke;this.styleTag.parentNode!=qn&&qn.insertBefore(this.styleTag,qn.firstChild)}}setNonce(Ce){this.styleTag&&this.styleTag.getAttribute("nonce")!=Ce&&this.styleTag.setAttribute("nonce",Ce)}}var base={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:"'"},shift={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},mac=typeof navigator<"u"&&/Mac/.test(navigator.platform),ie$1=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var i=0;i<10;i++)base[48+i]=base[96+i]=String(i);for(var i=1;i<=24;i++)base[i+111]="F"+i;for(var i=65;i<=90;i++)base[i]=String.fromCharCode(i+32),shift[i]=String.fromCharCode(i);for(var code in base)shift.hasOwnProperty(code)||(shift[code]=base[code]);function keyName(_n){var Ce=mac&&_n.metaKey&&_n.shiftKey&&!_n.ctrlKey&&!_n.altKey||ie$1&&_n.shiftKey&&_n.key&&_n.key.length==1||_n.key=="Unidentified",ke=!Ce&&_n.key||(_n.shiftKey?shift:base)[_n.keyCode]||_n.key||"Unidentified";return ke=="Esc"&&(ke="Escape"),ke=="Del"&&(ke="Delete"),ke=="Left"&&(ke="ArrowLeft"),ke=="Up"&&(ke="ArrowUp"),ke=="Right"&&(ke="ArrowRight"),ke=="Down"&&(ke="ArrowDown"),ke}function getSelection(_n){let Ce;return _n.nodeType==11?Ce=_n.getSelection?_n:_n.ownerDocument:Ce=_n,Ce.getSelection()}function contains(_n,Ce){return Ce?_n==Ce||_n.contains(Ce.nodeType!=1?Ce.parentNode:Ce):!1}function deepActiveElement(_n){let Ce=_n.activeElement;for(;Ce&&Ce.shadowRoot;)Ce=Ce.shadowRoot.activeElement;return Ce}function hasSelection(_n,Ce){if(!Ce.anchorNode)return!1;try{return contains(_n,Ce.anchorNode)}catch{return!1}}function clientRectsFor(_n){return _n.nodeType==3?textRange(_n,0,_n.nodeValue.length).getClientRects():_n.nodeType==1?_n.getClientRects():[]}function isEquivalentPosition(_n,Ce,ke,$n){return ke?scanFor(_n,Ce,ke,$n,-1)||scanFor(_n,Ce,ke,$n,1):!1}function domIndex(_n){for(var Ce=0;;Ce++)if(_n=_n.previousSibling,!_n)return Ce}function isBlockElement(_n){return _n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(_n.nodeName)}function scanFor(_n,Ce,ke,$n,Hn){for(;;){if(_n==ke&&Ce==$n)return!0;if(Ce==(Hn<0?0:maxOffset(_n))){if(_n.nodeName=="DIV")return!1;let zn=_n.parentNode;if(!zn||zn.nodeType!=1)return!1;Ce=domIndex(_n)+(Hn<0?0:1),_n=zn}else if(_n.nodeType==1){if(_n=_n.childNodes[Ce+(Hn<0?-1:0)],_n.nodeType==1&&_n.contentEditable=="false")return!1;Ce=Hn<0?maxOffset(_n):0}else return!1}}function maxOffset(_n){return _n.nodeType==3?_n.nodeValue.length:_n.childNodes.length}function flattenRect(_n,Ce){let ke=Ce?_n.left:_n.right;return{left:ke,right:ke,top:_n.top,bottom:_n.bottom}}function windowRect(_n){let Ce=_n.visualViewport;return Ce?{left:0,right:Ce.width,top:0,bottom:Ce.height}:{left:0,right:_n.innerWidth,top:0,bottom:_n.innerHeight}}function getScale(_n,Ce){let ke=Ce.width/_n.offsetWidth,$n=Ce.height/_n.offsetHeight;return(ke>.995&&ke<1.005||!isFinite(ke)||Math.abs(Ce.width-_n.offsetWidth)<1)&&(ke=1),($n>.995&&$n<1.005||!isFinite($n)||Math.abs(Ce.height-_n.offsetHeight)<1)&&($n=1),{scaleX:ke,scaleY:$n}}function scrollRectIntoView(_n,Ce,ke,$n,Hn,zn,Zn,qn){let Yn=_n.ownerDocument,Jn=Yn.defaultView||window;for(let to=_n,io=!1;to&&!io;)if(to.nodeType==1){let uo,ho=to==Yn.body,bo=1,Oo=1;if(ho)uo=windowRect(Jn);else{if(/^(fixed|sticky)$/.test(getComputedStyle(to).position)&&(io=!0),to.scrollHeight<=to.clientHeight&&to.scrollWidth<=to.clientWidth){to=to.assignedSlot||to.parentNode;continue}let Do=to.getBoundi
`,Hn=_n.state.doc.line(Hn.number+(ke?1:-1)),zn=_n.bidiSpans(Hn),Jn=_n.visualLineSide(Hn,!ke)}if(Yn){if(!Yn(to))return qn}else{if(!$n)return Jn;Yn=$n(to)}qn=Jn}}function byGroup(_n,Ce,ke){let $n=_n.state.charCategorizer(Ce),Hn=$n(ke);return zn=>{let Zn=$n(zn);return Hn==CharCategory.Space&&(Hn=Zn),Hn==Zn}}function moveVertically(_n,Ce,ke,$n){let Hn=Ce.head,zn=ke?1:-1;if(Hn==(ke?_n.state.doc.length:0))return EditorSelection.cursor(Hn,Ce.assoc);let Zn=Ce.goalColumn,qn,Yn=_n.contentDOM.getBoundingClientRect(),Jn=_n.coordsAtPos(Hn,Ce.assoc||-1),to=_n.documentTop;if(Jn)Zn==null&&(Zn=Jn.left-Yn.left),qn=zn<0?Jn.top:Jn.bottom;else{let ho=_n.viewState.lineBlockAt(Hn);Zn==null&&(Zn=Math.min(Yn.right-Yn.left,_n.defaultCharacterWidth*(Hn-ho.from))),qn=(zn<0?ho.top:ho.bottom)+to}let io=Yn.left+Zn,uo=$n??_n.viewState.heightOracle.textHeight>>1;for(let ho=0;;ho+=10){let bo=qn+(uo+ho)*zn,Oo=posAtCoords(_n,{x:io,y:bo},!1,zn);if(bo<Yn.top||bo>Yn.bottom||(zn<0?Oo<Hn:Oo>Hn)){let So=_n.docView.coordsForChar(Oo),$o=!So||bo<So.top?-1:1;return EditorSelection.cursor(Oo,$o,void 0,Zn)}}}function skipAtomicRanges(_n,Ce,ke){for(;;){let $n=0;for(let Hn of _n)Hn.between(Ce-1,Ce+1,(zn,Zn,qn)=>{if(Ce>zn&&Ce<Zn){let Yn=$n||ke||(Ce-zn<Zn-Ce?-1:1);Ce=Yn<0?zn:Zn,$n=Yn}});if(!$n)return Ce}}function skipAtoms(_n,Ce,ke){let $n=skipAtomicRanges(_n.state.facet(atomicRanges).map(Hn=>Hn(_n)),ke.from,Ce.head>ke.from?-1:1);return $n==ke.from?ke:EditorSelection.cursor($n,$n<ke.from?1:-1)}const LineBreakPlaceholder="￿";class DOMReader{constructor(Ce,ke){this.points=Ce,this.text="",this.lineSeparator=ke.facet(EditorState.lineSeparator)}append(Ce){this.text+=Ce}lineBreak(){this.text+=LineBreakPlaceholder}readRange(Ce,ke){if(!Ce)return this;let $n=Ce.parentNode;for(let Hn=Ce;;){this.findPointBefore($n,Hn);let zn=this.text.length;this.readNode(Hn);let Zn=Hn.nextSibling;if(Zn==ke)break;let qn=ContentView.get(Hn),Yn=ContentView.get(Zn);(qn&&Yn?qn.breakAfter:(qn?qn.breakAfter:isBlockElement(Hn))||isBlockElement(Zn)&&(Hn.nodeName!="BR"||Hn.cmIgnore)&&this.text.length>zn)&&this.lineBreak(),Hn=Zn}return this.findPointBefore($n,ke),this}readTextNode(Ce){let ke=Ce.nodeValue;for(let $n of this.points)$n.node==Ce&&($n.pos=this.text.length+Math.min($n.offset,ke.length));for(let $n=0,Hn=this.lineSeparator?null:/\r\n?|\n/g;;){let zn=-1,Zn=1,qn;if(this.lineSeparator?(zn=ke.indexOf(this.lineSeparator,$n),Zn=this.lineSeparator.length):(qn=Hn.exec(ke))&&(zn=qn.index,Zn=qn[0].length),this.append(ke.slice($n,zn<0?ke.length:zn)),zn<0)break;if(this.lineBreak(),Zn>1)for(let Yn of this.points)Yn.node==Ce&&Yn.pos>this.text.length&&(Yn.pos-=Zn-1);$n=zn+Zn}}readNode(Ce){if(Ce.cmIgnore)return;let ke=ContentView.get(Ce),$n=ke&&ke.overrideDOMText;if($n!=null){this.findPointInside(Ce,$n.length);for(let Hn=$n.iter();!Hn.next().done;)Hn.lineBreak?this.lineBreak():this.append(Hn.value)}else Ce.nodeType==3?this.readTextNode(Ce):Ce.nodeName=="BR"?Ce.nextSibling&&this.lineBreak():Ce.nodeType==1&&this.readRange(Ce.firstChild,null)}findPointBefore(Ce,ke){for(let $n of this.points)$n.node==Ce&&Ce.childNodes[$n.offset]==ke&&($n.pos=this.text.length)}findPointInside(Ce,ke){for(let $n of this.points)(Ce.nodeType==3?$n.node==Ce:Ce.contains($n.node))&&($n.pos=this.text.length+(isAtEnd(Ce,$n.node,$n.offset)?ke:0))}}function isAtEnd(_n,Ce,ke){for(;;){if(!Ce||ke<maxOffset(Ce))return!1;if(Ce==_n)return!0;ke=domIndex(Ce)+1,Ce=Ce.parentNode}}class DOMPoint{constructor(Ce,ke){this.node=Ce,this.offset=ke,this.pos=-1}}class DOMChange{constructor(Ce,ke,$n,Hn){this.typeOver=Hn,this.bounds=null,this.text="",this.domChanged=ke>-1;let{impreciseHead:zn,impreciseAnchor:Zn}=Ce.docView;if(Ce.state.readOnly&&ke>-1)this.newSel=null;else if(ke>-1&&(this.bounds=Ce.docView.domBoundsAround(ke,$n,0))){let qn=zn||Zn?[]:selectionPoints(Ce),Yn=new DOMReader(qn,Ce.state);Yn.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=Yn.text,this.newSel=selectionFromPoints(qn,this.bounds.from)}else{let qn=Ce.observer.selectionRange,Yn=zn&&zn.node==qn.focusNode&&zn.offset==qn.focusOffset||!contains(Ce.contentDOM,qn.focusNode)?Ce.state.selec
`&&_n.lineWrapping&&($n&&($n=EditorSelection.single($n.main.anchor-1,$n.main.head-1)),ke={from:Hn.from,to:Hn.to,insert:Text.of([" "])}),ke)return applyDOMChangeInner(_n,ke,$n,zn);if($n&&!$n.main.eq(Hn)){let Zn=!1,qn="select";return _n.inputState.lastSelectionTime>Date.now()-50&&(_n.inputState.lastSelectionOrigin=="select"&&(Zn=!0),qn=_n.inputState.lastSelectionOrigin),_n.dispatch({selection:$n,scrollIntoView:Zn,userEvent:qn}),!0}else return!1}function applyDOMChangeInner(_n,Ce,ke,$n=-1){if(browser.ios&&_n.inputState.flushIOSKey(Ce))return!0;let Hn=_n.state.selection.main;if(browser.android&&(Ce.to==Hn.to&&(Ce.from==Hn.from||Ce.from==Hn.from-1&&_n.state.sliceDoc(Ce.from,Hn.from)==" ")&&Ce.insert.length==1&&Ce.insert.lines==2&&dispatchKey(_n.contentDOM,"Enter",13)||(Ce.from==Hn.from-1&&Ce.to==Hn.to&&Ce.insert.length==0||$n==8&&Ce.insert.length<Ce.to-Ce.from&&Ce.to>Hn.head)&&dispatchKey(_n.contentDOM,"Backspace",8)||Ce.from==Hn.from&&Ce.to==Hn.to+1&&Ce.insert.length==0&&dispatchKey(_n.contentDOM,"Delete",46)))return!0;let zn=Ce.insert.toString();_n.inputState.composing>=0&&_n.inputState.composing++;let Zn,qn=()=>Zn||(Zn=applyDefaultInsert(_n,Ce,ke));return _n.state.facet(inputHandler$1).some(Yn=>Yn(_n,Ce.from,Ce.to,zn,qn))||_n.dispatch(qn()),!0}function applyDefaultInsert(_n,Ce,ke){let $n,Hn=_n.state,zn=Hn.selection.main;if(Ce.from>=zn.from&&Ce.to<=zn.to&&Ce.to-Ce.from>=(zn.to-zn.from)/3&&(!ke||ke.main.empty&&ke.main.from==Ce.from+Ce.insert.length)&&_n.inputState.composing<0){let qn=zn.from<Ce.from?Hn.sliceDoc(zn.from,Ce.from):"",Yn=zn.to>Ce.to?Hn.sliceDoc(Ce.to,zn.to):"";$n=Hn.replaceSelection(_n.state.toText(qn+Ce.insert.sliceString(0,void 0,_n.state.lineBreak)+Yn))}else{let qn=Hn.changes(Ce),Yn=ke&&ke.main.to<=qn.newLength?ke.main:void 0;if(Hn.selection.ranges.length>1&&_n.inputState.composing>=0&&Ce.to<=zn.to&&Ce.to>=zn.to-10){let Jn=_n.state.sliceDoc(Ce.from,Ce.to),to,io=ke&&findCompositionNode(_n,ke.main.head);if(io){let bo=Ce.insert.length-(Ce.to-Ce.from);to={from:io.from,to:io.to-bo}}else to=_n.state.doc.lineAt(zn.head);let uo=zn.to-Ce.to,ho=zn.to-zn.from;$n=Hn.changeByRange(bo=>{if(bo.from==zn.from&&bo.to==zn.to)return{changes:qn,range:Yn||bo.map(qn)};let Oo=bo.to-uo,So=Oo-Jn.length;if(bo.to-bo.from!=ho||_n.state.sliceDoc(So,Oo)!=Jn||bo.to>=to.from&&bo.from<=to.to)return{range:bo};let $o=Hn.changes({from:So,to:Oo,insert:Ce.insert}),Do=bo.to-zn.to;return{changes:$o,range:Yn?EditorSelection.range(Math.max(0,Yn.anchor+Do),Math.max(0,Yn.head+Do)):bo.map($o)}})}else $n={changes:qn,selection:Yn&&Hn.selection.replaceRange(Yn)}}let Zn="input.type";return(_n.composing||_n.inputState.compositionPendingChange&&_n.inputState.compositionEndedAt>Date.now()-50)&&(_n.inputState.compositionPendingChange=!1,Zn+=".compose",_n.inputState.compositionFirstChange&&(Zn+=".start",_n.inputState.compositionFirstChange=!1)),Hn.update($n,{userEvent:Zn,scrollIntoView:!0})}function findDiff(_n,Ce,ke,$n){let Hn=Math.min(_n.length,Ce.length),zn=0;for(;zn<Hn&&_n.charCodeAt(zn)==Ce.charCodeAt(zn);)zn++;if(zn==Hn&&_n.length==Ce.length)return null;let Zn=_n.length,qn=Ce.length;for(;Zn>0&&qn>0&&_n.charCodeAt(Zn-1)==Ce.charCodeAt(qn-1);)Zn--,qn--;if($n=="end"){let Yn=Math.max(0,zn-Math.min(Zn,qn));ke-=Zn+Yn-zn}if(Zn<zn&&_n.length<Ce.length){let Yn=ke<=zn&&ke>=Zn?zn-ke:0;zn-=Yn,qn=zn+(qn-Zn),Zn=zn}else if(qn<zn){let Yn=ke<=zn&&ke>=qn?zn-ke:0;zn-=Yn,Zn=zn+(Zn-qn),qn=zn}return{from:zn,toA:Zn,toB:qn}}function selectionPoints(_n){let Ce=[];if(_n.root.activeElement!=_n.contentDOM)return Ce;let{anchorNode:ke,anchorOffset:$n,focusNode:Hn,focusOffset:zn}=_n.observer.selectionRange;return ke&&(Ce.push(new DOMPoint(ke,$n)),(Hn!=ke||zn!=$n)&&Ce.push(new DOMPoint(Hn,zn))),Ce}function selectionFromPoints(_n,Ce){if(_n.length==0)return null;let ke=_n[0].pos,$n=_n.length==2?_n[1].pos:ke;return ke>-1&&$n>-1?EditorSelection.single(ke+Ce,$n+Ce):null}class InputState{setSelectionOrigin(Ce){this.lastSelectionOrigin=Ce,this.lastSelectionTime=Date.now()}constructor(Ce){this.view=Ce,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrol
`))};zn.from==this.from&&Hn<this.from?zn.from=Hn:zn.to==this.to&&Hn>this.to&&(zn.to=Hn),!(zn.from==zn.to&&!zn.insert.length)&&(this.pendingContextChange=zn,Ce.state.readOnly||applyDOMChangeInner(Ce,zn,EditorSelection.single(this.toEditorPos($n.selectionStart),this.toEditorPos($n.selectionEnd))),this.pendingContextChange&&(this.revertPending(Ce.state),this.setSelection(Ce.state)))},this.handlers.characterboundsupdate=$n=>{let Hn=[],zn=null;for(let Zn=this.toEditorPos($n.rangeStart),qn=this.toEditorPos($n.rangeEnd);Zn<qn;Zn++){let Yn=Ce.coordsForChar(Zn);zn=Yn&&new DOMRect(Yn.left,Yn.top,Yn.right-Yn.left,Yn.bottom-Yn.top)||zn||new DOMRect,Hn.push(zn)}ke.updateCharacterBounds($n.rangeStart,Hn)},this.handlers.textformatupdate=$n=>{let Hn=[];for(let zn of $n.getTextFormats()){let Zn=zn.underlineStyle,qn=zn.underlineThickness;if(Zn!="None"&&qn!="None"){let Yn=`text-decoration: underline ${Zn=="Dashed"?"dashed ":Zn=="Squiggle"?"wavy ":""}${qn=="Thin"?1:2}px`;Hn.push(Decoration.mark({attributes:{style:Yn}}).range(this.toEditorPos(zn.rangeStart),this.toEditorPos(zn.rangeEnd)))}}Ce.dispatch({effects:setEditContextFormatting.of(Decoration.set(Hn))})},this.handlers.compositionstart=()=>{Ce.inputState.composing<0&&(Ce.inputState.composing=0,Ce.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{Ce.inputState.composing=-1,Ce.inputState.compositionFirstChange=null};for(let $n in this.handlers)ke.addEventListener($n,this.handlers[$n]);this.measureReq={read:$n=>{this.editContext.updateControlBounds($n.contentDOM.getBoundingClientRect());let Hn=getSelection($n.root);Hn&&Hn.rangeCount&&this.editContext.updateSelectionBounds(Hn.getRangeAt(0).getBoundingClientRect())}}}applyEdits(Ce){let ke=0,$n=!1,Hn=this.pendingContextChange;return Ce.changes.iterChanges((zn,Zn,qn,Yn,Jn)=>{if($n)return;let to=Jn.length-(Zn-zn);if(Hn&&Zn>=Hn.to)if(Hn.from==zn&&Hn.to==Zn&&Hn.insert.eq(Jn)){Hn=this.pendingContextChange=null,ke+=to,this.to+=to;return}else Hn=null,this.revertPending(Ce.state);if(zn+=ke,Zn+=ke,Zn<=this.from)this.from+=to,this.to+=to;else if(zn<this.to){if(zn<this.from||Zn>this.to||this.to-this.from+Jn.length>3e4){$n=!0;return}this.editContext.updateText(this.toContextPos(zn),this.toContextPos(Zn),Jn.toString()),this.to+=to}ke+=to}),Hn&&!$n&&this.revertPending(Ce.state),!$n}update(Ce){let ke=this.pendingContextChange;!this.applyEdits(Ce)||!this.rangeIsValid(Ce.state)?(this.pendingContextChange=null,this.resetRange(Ce.state),this.editContext.updateText(0,this.editContext.text.length,Ce.state.doc.sliceString(this.from,this.to)),this.setSelection(Ce.state)):(Ce.docChanged||Ce.selectionSet||ke)&&this.setSelection(Ce.state),(Ce.geometryChanged||Ce.docChanged||Ce.selectionSet)&&Ce.view.requestMeasure(this.measureReq)}resetRange(Ce){let{head:ke}=Ce.selection.main;this.from=Math.max(0,ke-1e4),this.to=Math.min(Ce.doc.length,ke+1e4)}revertPending(Ce){let ke=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(ke.from),this.toContextPos(ke.from+ke.insert.length),Ce.doc.sliceString(ke.from,ke.to))}setSelection(Ce){let{main:ke}=Ce.selection,$n=this.toContextPos(Math.max(this.from,Math.min(this.to,ke.anchor))),Hn=this.toContextPos(ke.head);(this.editContext.selectionStart!=$n||this.editContext.selectionEnd!=Hn)&&this.editContext.updateSelection($n,Hn)}rangeIsValid(Ce){let{head:ke}=Ce.selection.main;return!(this.from>0&&ke-this.from<500||this.to<Ce.doc.length&&this.to-ke<500||this.to-this.from>1e4*3)}toEditorPos(Ce){return Ce+this.from}toContextPos(Ce){return Ce-this.from}destroy(){for(let Ce in this.handlers)this.editContext.removeEventListener(Ce,this.handlers[Ce])}}class EditorView{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(Ce={}){var ke;th
--Ÿ­؜\u2028\u2029\uFEFF-]`,UnicodeRegexpSupport),Names={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let _supportsTabSize=null;function supportsTabSize(){var _n;if(_supportsTabSize==null&&typeof document<"u"&&document.body){let Ce=document.body.style;_supportsTabSize=((_n=Ce.tabSize)!==null&&_n!==void 0?_n:Ce.MozTabSize)!=null}return _supportsTabSize||!1}const specialCharConfig=Facet.define({combine(_n){let Ce=combineConfig(_n,{render:null,specialChars:Specials,addSpecialChars:null});return(Ce.replaceTabs=!supportsTabSize())&&(Ce.specialChars=new RegExp(" |"+Ce.specialChars.source,UnicodeRegexpSupport)),Ce.addSpecialChars&&(Ce.specialChars=new RegExp(Ce.specialChars.source+"|"+Ce.addSpecialChars.source,UnicodeRegexpSupport)),Ce}});function highlightSpecialChars(_n={}){return[specialCharConfig.of(_n),specialCharPlugin()]}let _plugin=null;function specialCharPlugin(){return _plugin||(_plugin=ViewPlugin.fromClass(class{constructor(_n){this.view=_n,this.decorations=Decoration.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(_n.state.facet(specialCharConfig)),this.decorations=this.decorator.createDeco(_n)}makeDecorator(_n){return new MatchDecorator({regexp:_n.specialChars,decoration:(Ce,ke,$n)=>{let{doc:Hn}=ke.state,zn=codePointAt(Ce[0],0);if(zn==9){let Zn=Hn.lineAt($n),qn=ke.state.tabSize,Yn=countColumn(Zn.text,qn,$n-Zn.from);return Decoration.replace({widget:new TabWidget((qn-Yn%qn)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[zn]||(this.decorationCache[zn]=Decoration.replace({widget:new SpecialCharWidget(_n,zn)}))},boundary:_n.replaceTabs?void 0:/[^]/})}update(_n){let Ce=_n.state.facet(specialCharConfig);_n.startState.facet(specialCharConfig)!=Ce?(this.decorator=this.makeDecorator(Ce),this.decorations=this.decorator.createDeco(_n.view)):this.decorations=this.decorator.updateDeco(_n,this.decorations)}},{decorations:_n=>_n.decorations}))}const DefaultPlaceholder="";function placeholder$1(_n){return _n>=32?DefaultPlaceholder:_n==10?"":String.fromCharCode(9216+_n)}class SpecialCharWidget extends WidgetType{constructor(Ce,ke){super(),this.options=Ce,this.code=ke}eq(Ce){return Ce.code==this.code}toDOM(Ce){let ke=placeholder$1(this.code),$n=Ce.state.phrase("Control character")+" "+(Names[this.code]||"0x"+this.code.toString(16)),Hn=this.options.render&&this.options.render(this.code,$n,ke);if(Hn)return Hn;let zn=document.createElement("span");return zn.textContent=ke,zn.title=$n,zn.setAttribute("aria-label",$n),zn.className="cm-specialChar",zn}ignoreEvent(){return!1}}class TabWidget extends WidgetType{constructor(Ce){super(),this.width=Ce}eq(Ce){return Ce.width==this.width}toDOM(){let Ce=document.createElement("span");return Ce.textContent=" ",Ce.className="cm-tab",Ce.style.width=this.width+"px",Ce}ignoreEvent(){return!1}}function highlightActiveLine(){return activeLineHighlighter}const lineDeco=Decoration.line({class:"cm-activeLine"}),activeLineHighlighter=ViewPlugin.fromClass(class{constructor(_n){this.decorations=this.getDeco(_n)}update(_n){(_n.docChanged||_n.selectionSet)&&(this.decorations=this.getDeco(_n.view))}getDeco(_n){let Ce=-1,ke=[];for(let $n of _n.state.selection.ranges){let Hn=_n.lineBlockAt($n.head);Hn.from>Ce&&(ke.push(lineDeco.range(Hn.from)),Ce=Hn.from)}return Decoration.set(ke)}},{decorations:_n=>_n.decorations}),MaxOff=2e3;function rectangleFor(_n,Ce,ke){let $n=Math.min(Ce.line,ke.line),Hn=Math.max(Ce.line,ke.line),zn=[];if(Ce.off>MaxOff||ke.off>MaxOff||Ce.col<0||ke.col<0){let Zn=Math.min(Ce.off,ke.off),qn=Math.max(Ce.off,ke.off);for(let Yn=$n;Yn<=Hn;Yn++){let Jn=_n.doc.li
`:$n=="r"?"\r":$n=="t"?" ":"\\")}eq(Ce){return this.search==Ce.search&&this.replace==Ce.replace&&this.caseSensitive==Ce.caseSensitive&&this.regexp==Ce.regexp&&this.wholeWord==Ce.wholeWord}create(){return this.regexp?new RegExpQuery(this):new StringQuery(this)}getCursor(Ce,ke=0,$n){let Hn=Ce.doc?Ce:EditorState.create({doc:Ce});return $n==null&&($n=Hn.doc.length),this.regexp?regexpCursor(this,Hn,ke,$n):stringCursor(this,Hn,ke,$n)}}class QueryType{constructor(Ce){this.spec=Ce}}function stringCursor(_n,Ce,ke,$n){return new SearchCursor(Ce.doc,_n.unquoted,ke,$n,_n.caseSensitive?void 0:Hn=>Hn.toLowerCase(),_n.wholeWord?stringWordTest(Ce.doc,Ce.charCategorizer(Ce.selection.main.head)):void 0)}function stringWordTest(_n,Ce){return(ke,$n,Hn,zn)=>((zn>ke||zn+Hn.length<$n)&&(zn=Math.max(0,ke-2),Hn=_n.sliceString(zn,Math.min(_n.length,$n+2))),(Ce(charBefore(Hn,ke-zn))!=CharCategory.Word||Ce(charAfter(Hn,ke-zn))!=CharCategory.Word)&&(Ce(charAfter(Hn,$n-zn))!=CharCategory.Word||Ce(charBefore(Hn,$n-zn))!=CharCategory.Word))}class StringQuery extends QueryType{constructor(Ce){super(Ce)}nextMatch(Ce,ke,$n){let Hn=stringCursor(this.spec,Ce,$n,Ce.doc.length).nextOverlapping();return Hn.done&&(Hn=stringCursor(this.spec,Ce,0,ke).nextOverlapping()),Hn.done?null:Hn.value}prevMatchInRange(Ce,ke,$n){for(let Hn=$n;;){let zn=Math.max(ke,Hn-1e4-this.spec.unquoted.length),Zn=stringCursor(this.spec,Ce,zn,Hn),qn=null;for(;!Zn.nextOverlapping().done;)qn=Zn.value;if(qn)return qn;if(zn==ke)return null;Hn-=1e4}}prevMatch(Ce,ke,$n){return this.prevMatchInRange(Ce,0,ke)||this.prevMatchInRange(Ce,$n,Ce.doc.length)}getReplacement(Ce){return this.spec.unquote(this.spec.replace)}matchAll(Ce,ke){let $n=stringCursor(this.spec,Ce,0,Ce.doc.length),Hn=[];for(;!$n.next().done;){if(Hn.length>=ke)return null;Hn.push($n.value)}return Hn}highlight(Ce,ke,$n,Hn){let zn=stringCursor(this.spec,Ce,Math.max(0,ke-this.spec.unquoted.length),Math.min($n+this.spec.unquoted.length,Ce.doc.length));for(;!zn.next().done;)Hn(zn.value.from,zn.value.to)}}function regexpCursor(_n,Ce,ke,$n){return new RegExpCursor(Ce.doc,_n.search,{ignoreCase:!_n.caseSensitive,test:_n.wholeWord?regexpWordTest(Ce.charCategorizer(Ce.selection.main.head)):void 0},ke,$n)}function charBefore(_n,Ce){return _n.slice(findClusterBreak(_n,Ce,!1),Ce)}function charAfter(_n,Ce){return _n.slice(Ce,findClusterBreak(_n,Ce))}function regexpWordTest(_n){return(Ce,ke,$n)=>!$n[0].length||(_n(charBefore($n.input,$n.index))!=CharCategory.Word||_n(charAfter($n.input,$n.index))!=CharCategory.Word)&&(_n(charAfter($n.input,$n.index+$n[0].length))!=CharCategory.Word||_n(charBefore($n.input,$n.index+$n[0].length))!=CharCategory.Word)}class RegExpQuery extends QueryType{nextMatch(Ce,ke,$n){let Hn=regexpCursor(this.spec,Ce,$n,Ce.doc.length).next();return Hn.done&&(Hn=regexpCursor(this.spec,Ce,0,ke).next()),Hn.done?null:Hn.value}prevMatchInRange(Ce,ke,$n){for(let Hn=1;;Hn++){let zn=Math.max(ke,$n-Hn*1e4),Zn=regexpCursor(this.spec,Ce,zn,$n),qn=null;for(;!Zn.next().done;)qn=Zn.value;if(qn&&(zn==ke||qn.from>zn+10))return qn;if(zn==ke)return null}}prevMatch(Ce,ke,$n){return this.prevMatchInRange(Ce,0,ke)||this.prevMatchInRange(Ce,$n,Ce.doc.length)}getReplacement(Ce){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(ke,$n)=>$n=="$"?"$":$n=="&"?Ce.match[0]:$n!="0"&&+$n<Ce.match.length?Ce.match[$n]:ke)}matchAll(Ce,ke){let $n=regexpCursor(this.spec,Ce,0,Ce.doc.length),Hn=[];for(;!$n.next().done;){if(Hn.length>=ke)return null;Hn.push($n.value)}return Hn}highlight(Ce,ke,$n,Hn){let zn=regexpCursor(this.spec,Ce,Math.max(0,ke-250),Math.min($n+250,Ce.doc.length));for(;!zn.next().done;)Hn(zn.value.from,zn.value.to)}}const setSearchQuery=StateEffect.define(),togglePanel$1=StateEffect.define(),searchState=StateField.define({create(_n){return new SearchState(defaultQuery(_n).create(),null)},update(_n,Ce){for(let ke of Ce.effects)ke.is(setSearchQuery)?_n=new SearchState(ke.value.create(),_n.panel):ke.is(togglePanel$1)&&(_n=new SearchState(_n.query,ke.value?createSearchPanel:null));return _n},provide:_n=>showPanel.from(_n,Ce=>Ce.panel)})
2024-08-27 12:25:42 +03:00
`+ke.scrub(),zn=this.advance(Hn);return zn>-1&&zn<Hn.length?this.complete(Ce,$n,zn):!1}finish(Ce,ke){return(this.stage==2||this.stage==3)&&skipSpace(ke.content,this.pos)==ke.content.length?this.complete(Ce,ke,ke.content.length):!1}complete(Ce,ke,$n){return Ce.addLeafElement(ke,elt(Type.LinkReference,this.start,this.start+$n,this.elts)),!0}nextStage(Ce){return Ce?(this.pos=Ce.to-this.start,this.elts.push(Ce),this.stage++,!0):(Ce===!1&&(this.stage=-1),!1)}advance(Ce){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(parseLinkLabel(Ce,this.pos,this.start,!0)))return-1;if(Ce.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(elt(Type.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(parseURL(Ce,skipSpace(Ce,this.pos),this.start)))return-1}else if(this.stage==2){let ke=skipSpace(Ce,this.pos),$n=0;if(ke>this.pos){let Hn=parseLinkTitle(Ce,ke,this.start);if(Hn){let zn=lineEnd(Ce,Hn.to-this.start);zn>0&&(this.nextStage(Hn),$n=zn)}}return $n||($n=lineEnd(Ce,this.pos)),$n>0&&$n<Ce.length?$n:-1}else return lineEnd(Ce,this.pos)}}}function lineEnd(_n,Ce){for(;Ce<_n.length;Ce++){let ke=_n.charCodeAt(Ce);if(ke==10)break;if(!space$2(ke))return-1}return Ce}class SetextHeadingParser{nextLine(Ce,ke,$n){let Hn=ke.depth<Ce.stack.length?-1:isSetextUnderline(ke),zn=ke.next;if(Hn<0)return!1;let Zn=elt(Type.HeaderMark,Ce.lineStart+ke.pos,Ce.lineStart+Hn);return Ce.nextLine(),Ce.addLeafElement($n,elt(zn==61?Type.SetextHeading1:Type.SetextHeading2,$n.start,Ce.prevLineEnd(),[...Ce.parser.parseInline($n.content,$n.start),Zn])),!0}finish(){return!1}}const DefaultLeafBlocks={LinkReference(_n,Ce){return Ce.content.charCodeAt(0)==91?new LinkReferenceParser(Ce):null},SetextHeading(){return new SetextHeadingParser}},DefaultEndLeaf=[(_n,Ce)=>isAtxHeading(Ce)>=0,(_n,Ce)=>isFencedCode(Ce)>=0,(_n,Ce)=>isBlockquote(Ce)>=0,(_n,Ce)=>isBulletList(Ce,_n,!0)>=0,(_n,Ce)=>isOrderedList(Ce,_n,!0)>=0,(_n,Ce)=>isHorizontalRule(Ce,_n,!0)>=0,(_n,Ce)=>isHTMLBlock(Ce,_n,!0)>=0],scanLineResult={text:"",end:0};class BlockContext{constructor(Ce,ke,$n,Hn){this.parser=Ce,this.input=ke,this.ranges=Hn,this.line=new Line,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=Hn[Hn.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=Hn[0].from,this.block=CompositeBlock.create(Type.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=$n.length?new FragmentCursor($n,ke):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:Ce}=this;for(;;){for(let $n=0;;){let Hn=Ce.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;$n<Ce.markers.length&&(!Hn||Ce.markers[$n].from<Hn.end);){let zn=Ce.markers[$n++];this.addNode(zn.type,zn.from,zn.to)}if(!Hn)break;this.finishContext()}if(Ce.pos<Ce.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(Ce.basePos))return null;e:for(;;){for(let $n of this.parser.blockParsers)if($n){let Hn=$n(this,Ce);if(Hn!=!1){if(Hn==!0)return null;Ce.forward();continue e}}break}let ke=new LeafBlock(this.lineStart+Ce.pos,Ce.text.slice(Ce.pos));for(let $n of this.parser.leafBlockParsers)if($n){let Hn=$n(this,ke);Hn&&ke.parsers.push(Hn)}e:for(;this.nextLine()&&Ce.pos!=Ce.text.length;){if(Ce.indent<Ce.baseIndent+4){for(let $n of this.parser.endLeafBlock)if($n(this,Ce,ke))break e}for(let $n of ke.parsers)if($n.nextLine(this,Ce,ke))return null;ke.content+=`
`+Ce.scrub();for(let $n of Ce.markers)ke.marks.push($n)}return this.finishLeaf(ke),null}stopAt(Ce){if(this.stoppedAt!=null&&this.stoppedAt<Ce)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=Ce}reuseFragment(Ce){if(!this.fragments.moveTo(this.absoluteLineStart+Ce,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let ke=this.fragments.takeNodes(this);return ke?(this.absoluteLineStart+=ke,this.lineStart=toRelative(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(Ce=this.depth-1){return this.parser.nodeSet.types[this.stack[Ce].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(Ce){let ke=scanLineResult;if(ke.end=Ce,Ce>=this.to)ke.text="";else if(ke.text=this.lineChunkAt(Ce),ke.end+=ke.text.length,this.ranges.length>1){let $n=this.absoluteLineStart,Hn=this.rangeI;for(;this.ranges[Hn].to<ke.end;){Hn++;let zn=this.ranges[Hn].from,Zn=this.lineChunkAt(zn);ke.end=zn+Zn.length,ke.text=ke.text.slice(0,this.ranges[Hn-1].to-$n)+Zn,$n=ke.end-ke.text.length}}return ke}readLine(){let{line:Ce}=this,{text:ke,end:$n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=$n,Ce.reset(ke);Ce.depth<this.stack.length;Ce.depth++){let Hn=this.stack[Ce.depth],zn=this.parser.skipContextMarkup[Hn.type];if(!zn)throw new Error("Unhandled block context "+Type[Hn.type]);if(!zn(Hn,this,Ce))break;Ce.forward()}}lineChunkAt(Ce){let ke=this.input.chunk(Ce),$n;if(this.input.lineChunks)$n=ke==`
`?"":ke;else{let Hn=ke.indexOf(`
2024-08-30 13:38:34 +03:00
`);$n=Hn<0?ke:ke.slice(0,Hn)}return Ce+$n.length>this.to?$n.slice(0,this.to-Ce):$n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(Ce,ke,$n=0){this.block=CompositeBlock.create(Ce,$n,this.lineStart+ke,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(Ce,ke,$n=0){this.startContext(this.parser.getNodeType(Ce),ke,$n)}addNode(Ce,ke,$n){typeof Ce=="number"&&(Ce=new Tree(this.parser.nodeSet.types[Ce],none,none,($n??this.prevLineEnd())-ke)),this.block.addChild(Ce,ke-this.block.from)}addElement(Ce){this.block.addChild(Ce.toTree(this.parser.nodeSet),Ce.from-this.block.from)}addLeafElement(Ce,ke){this.addNode(this.buffer.writeElements(injectMarks(ke.children,Ce.marks),-ke.from).finish(ke.type,ke.to-ke.from),ke.from)}finishContext(){let Ce=this.stack.pop(),ke=this.stack[this.stack.length-1];ke.addChild(Ce.toTree(this.parser.nodeSet),Ce.from-ke.from),this.block=ke}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(Ce){return this.ranges.length>1?injectGaps(this.ranges,0,Ce.topNode,this.ranges[0].from,this.reusePlaceholders):Ce}finishLeaf(Ce){for(let $n of Ce.parsers)if($n.finish(this,Ce))return;let ke=injectMarks(this.parser.parseInline(Ce.content,Ce.start),Ce.marks);this.addNode(this.buffer.writeElements(ke,-Ce.start).finish(Type.Paragraph,Ce.content.length),Ce.start)}elt(Ce,ke,$n,Hn){return typeof Ce=="string"?elt(this.parser.getNodeType(Ce),ke,$n,Hn):new TreeElement(Ce,ke)}get buffer(){return new Buffer$1(this.parser.nodeSet)}}function injectGaps(_n,Ce,ke,$n,Hn){let zn=_n[Ce].to,Zn=[],qn=[],Yn=ke.from+$n;function Jn(to,io){for(;io?to>=zn:to>zn;){let uo=_n[Ce+1].from-zn;$n+=uo,to+=uo,Ce++,zn=_n[Ce].to}}for(let to=ke.firstChild;to;to=to.nextSibling){Jn(to.from+$n,!0);let io=to.from+$n,uo,ho=Hn.get(to.tree);ho?uo=ho:to.to+$n>zn?(uo=injectGaps(_n,Ce,to,$n,Hn),Jn(to.to+$n,!1)):uo=to.toTree(),Zn.push(uo),qn.push(io-Yn)}return Jn(ke.to+$n,!1),new Tree(ke.type,Zn,qn,ke.to+$n-Yn,ke.tree?ke.tree.propValues:void 0)}class MarkdownParser extends Parser{constructor(Ce,ke,$n,Hn,zn,Zn,qn,Yn,Jn){super(),this.nodeSet=Ce,this.blockParsers=ke,this.leafBlockParsers=$n,this.blockNames=Hn,this.endLeafBlock=zn,this.skipContextMarkup=Zn,this.inlineParsers=qn,this.inlineNames=Yn,this.wrappers=Jn,this.nodeTypes=Object.create(null);for(let to of Ce.types)this.nodeTypes[to.name]=to.id}createParse(Ce,ke,$n){let Hn=new BlockContext(this,Ce,ke,$n);for(let zn of this.wrappers)Hn=zn(Hn,Ce,ke,$n);return Hn}configure(Ce){let ke=resolveConfig(Ce);if(!ke)return this;let{nodeSet:$n,skipContextMarkup:Hn}=this,zn=this.blockParsers.slice(),Zn=this.leafBlockParsers.slice(),qn=this.blockNames.slice(),Yn=this.inlineParsers.slice(),Jn=this.inlineNames.slice(),to=this.endLeafBlock.slice(),io=this.wrappers;if(nonEmpty(ke.defineNodes)){Hn=Object.assign({},Hn);let uo=$n.types.slice(),ho;for(let bo of ke.defineNodes){let{name:Oo,block:So,composite:$o,style:Do}=typeof bo=="string"?{name:bo}:bo;if(uo.some(Vo=>Vo.name==Oo))continue;$o&&(Hn[uo.length]=(Vo,Ko,Mo)=>$o(Ko,Mo,Vo.value));let xo=uo.length,Io=$o?["Block","BlockContext"]:So?xo>=Type.ATXHeading1&&xo<=Type.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;uo.push(NodeType.define({id:xo,name:Oo,props:Io&&[[NodeProp.group,Io]]})),Do&&(ho||(ho={}),Array.isArray(Do)||Do instanceof Tag?ho[Oo]=Do:Object.assign(ho,Do))}$n=new NodeSet(uo),ho&&($n=$n.extend(styleTags(ho)))}if(nonEmpty(ke.props)&&($n=$n.extend(...ke.props)),nonEmpty(ke.remove))for(let uo of ke.remove){let ho=this.blockNames.indexOf(uo),bo=this.inlineNames.indexOf(uo);ho>-1&&(zn[ho]=Zn[ho]=void 0),bo>-1&&(Yn[bo]=void 0)}if(nonEmpty(ke.parseBlock))for(let uo of ke.parseBlock){let ho=qn.indexOf(uo.name);if(ho>-1)zn[ho]=uo.parse,Zn[ho]=uo.leaf;else{let bo=uo.before?findName(qn,uo.before):uo.after?findName(qn,uo.after)+1:qn.length-1;zn.splice(bo,0,uo.parse),Zn.splice(bo,0,uo.leaf),qn.splice(bo,0,uo.name)}uo.endLeaf&&to.push(uo.endLeaf)}if(nonEmpty(ke.parseInline))for(let uo of ke.parseInl
`;)zn--;this.fragmentEnd=zn?zn-1:0}let $n=this.cursor;$n||($n=this.cursor=this.fragment.tree.cursor(),$n.firstChild());let Hn=Ce+this.fragment.offset;for(;$n.to<=Hn;)if(!$n.parent())return!1;for(;;){if($n.from>=Hn)return this.fragment.from<=ke;if(!$n.childAfter(Hn))return!1}}matches(Ce){let ke=this.cursor.tree;return ke&&ke.prop(NodeProp.contextHash)==Ce}takeNodes(Ce){let ke=this.cursor,$n=this.fragment.offset,Hn=this.fragmentEnd-(this.fragment.openEnd?1:0),zn=Ce.absoluteLineStart,Zn=zn,qn=Ce.block.children.length,Yn=Zn,Jn=qn;for(;;){if(ke.to-$n>Hn){if(ke.type.isAnonymous&&ke.firstChild())continue;break}let to=toRelative(ke.from-$n,Ce.ranges);if(ke.to-$n<=Ce.ranges[Ce.rangeI].to)Ce.addNode(ke.tree,to);else{let io=new Tree(Ce.parser.nodeSet.types[Type.Paragraph],[],[],0,Ce.block.hashProp);Ce.reusePlaceholders.set(io,ke.tree),Ce.addNode(io,to)}if(ke.type.is("Block")&&(NotLast.indexOf(ke.type.id)<0?(Zn=ke.to-$n,qn=Ce.block.children.length):(Zn=Yn,qn=Jn,Yn=ke.to-$n,Jn=Ce.block.children.length)),!ke.nextSibling())break}for(;Ce.block.children.length>qn;)Ce.block.children.pop(),Ce.block.positions.pop();return Zn-zn}}function toRelative(_n,Ce){let ke=_n;for(let $n=1;$n<Ce.length;$n++){let Hn=Ce[$n-1].to,zn=Ce[$n].from;Hn<_n&&(ke-=zn-Hn)}return ke}const markdownHighlighting=styleTags({"Blockquote/...":tags$1.quote,HorizontalRule:tags$1.contentSeparator,"ATXHeading1/... SetextHeading1/...":tags$1.heading1,"ATXHeading2/... SetextHeading2/...":tags$1.heading2,"ATXHeading3/...":tags$1.heading3,"ATXHeading4/...":tags$1.heading4,"ATXHeading5/...":tags$1.heading5,"ATXHeading6/...":tags$1.heading6,"Comment CommentBlock":tags$1.comment,Escape:tags$1.escape,Entity:tags$1.character,"Emphasis/...":tags$1.emphasis,"StrongEmphasis/...":tags$1.strong,"Link/... Image/...":tags$1.link,"OrderedList/... BulletList/...":tags$1.list,"BlockQuote/...":tags$1.quote,"InlineCode CodeText":tags$1.monospace,"URL Autolink":tags$1.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":tags$1.processingInstruction,"CodeInfo LinkLabel":tags$1.labelName,LinkTitle:tags$1.string,Paragraph:tags$1.content}),parser$3=new MarkdownParser(new NodeSet(nodeTypes).extend(markdownHighlighting),Object.keys(DefaultBlockParsers).map(_n=>DefaultBlockParsers[_n]),Object.keys(DefaultBlockParsers).map(_n=>DefaultLeafBlocks[_n]),Object.keys(DefaultBlockParsers),DefaultEndLeaf,DefaultSkipMarkup,Object.keys(DefaultInline).map(_n=>DefaultInline[_n]),Object.keys(DefaultInline),[]);function leftOverSpace(_n,Ce,ke){let $n=[];for(let Hn=_n.firstChild,zn=Ce;;Hn=Hn.nextSibling){let Zn=Hn?Hn.from:ke;if(Zn>zn&&$n.push({from:zn,to:Zn}),!Hn)break;zn=Hn.to}return $n}function parseCode(_n){let{codeParser:Ce,htmlParser:ke}=_n;return{wrap:parseMixed((Hn,zn)=>{let Zn=Hn.type.id;if(Ce&&(Zn==Type.CodeBlock||Zn==Type.FencedCode)){let qn="";if(Zn==Type.FencedCode){let Jn=Hn.node.getChild(Type.CodeInfo);Jn&&(qn=zn.read(Jn.from,Jn.to))}let Yn=Ce(qn);if(Yn)return{parser:Yn,overlay:Jn=>Jn.type.id==Type.CodeText}}else if(ke&&(Zn==Type.HTMLBlock||Zn==Type.HTMLTag))return{parser:ke,overlay:leftOverSpace(Hn.node,Hn.from,Hn.to)};return null})}}const StrikethroughDelim={resolve:"Strikethrough",mark:"StrikethroughMark"},Strikethrough={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":tags$1.strikethrough}},{name:"StrikethroughMark",style:tags$1.processingInstruction}],parseInline:[{name:"Strikethrough",parse(_n,Ce,ke){if(Ce!=126||_n.char(ke+1)!=126||_n.char(ke+2)==126)return-1;let $n=_n.slice(ke-1,ke),Hn=_n.slice(ke+2,ke+3),zn=/\s|^$/.test($n),Zn=/\s|^$/.test(Hn),qn=Punctuation.test($n),Yn=Punctuation.test(Hn);return _n.addDelimiter(StrikethroughDelim,ke,ke+2,!Zn&&(!Yn||zn||qn),!zn&&(!qn||Zn||Yn))},after:"Emphasis"}]};function parseRow(_n,Ce,ke=0,$n,Hn=0){let zn=0,Zn=!0,qn=-1,Yn=-1,Jn=!1,to=()=>{$n.push(_n.elt("TableCell",Hn+qn,Hn+Yn,_n.parser.parseInline(Ce.slice(qn,Yn),Hn+qn)))};for(let io=ke;io<Ce.length;io++){let uo=Ce.charCodeAt(io);uo==124&&!Jn?((!Zn||qn>-1)&&zn++,Zn=!1,$n&&(qn>-1&&to(),$n.push(_n.elt("TableDelimiter",io+Hn,io+Hn+1))),qn=Yn=-1):(Jn||uo!=32&&uo!=9)&&(qn<0&&(
2024-08-27 12:25:42 +03:00
\${}
} catch (\${error}) {
\${}
}`,{label:"try",detail:"/ catch block",type:"keyword"}),snippetCompletion("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),snippetCompletion(`if (\${}) {
\${}
} else {
\${}
}`,{label:"if",detail:"/ else block",type:"keyword"}),snippetCompletion(`class \${name} {
constructor(\${params}) {
\${}
}
2024-08-30 13:38:34 +03:00
}`,{label:"class",detail:"definition",type:"keyword"}),snippetCompletion('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),snippetCompletion('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],typescriptSnippets=snippets.concat([snippetCompletion("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),snippetCompletion("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),snippetCompletion("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),cache=new NodeWeakMap,ScopeNodes=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function defID(_n){return(Ce,ke)=>{let $n=Ce.node.getChild("VariableDefinition");return $n&&ke($n,_n),!0}}const functionContext=["FunctionDeclaration"],gatherCompletions={FunctionDeclaration:defID("function"),ClassDeclaration:defID("class"),ClassExpression:()=>!0,EnumDeclaration:defID("constant"),TypeAliasDeclaration:defID("type"),NamespaceDeclaration:defID("namespace"),VariableDefinition(_n,Ce){_n.matchContext(functionContext)||Ce(_n,"variable")},TypeDefinition(_n,Ce){Ce(_n,"type")},__proto__:null};function getScope(_n,Ce){let ke=cache.get(Ce);if(ke)return ke;let $n=[],Hn=!0;function zn(Zn,qn){let Yn=_n.sliceString(Zn.from,Zn.to);$n.push({label:Yn,type:qn})}return Ce.cursor(IterMode.IncludeAnonymous).iterate(Zn=>{if(Hn)Hn=!1;else if(Zn.name){let qn=gatherCompletions[Zn.name];if(qn&&qn(Zn,zn)||ScopeNodes.has(Zn.name))return!1}else if(Zn.to-Zn.from>8192){for(let qn of getScope(_n,Zn.node))$n.push(qn);return!1}}),cache.set(Ce,$n),$n}const Identifier=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,dontComplete=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function localCompletionSource(_n){let Ce=syntaxTree(_n.state).resolveInner(_n.pos,-1);if(dontComplete.indexOf(Ce.name)>-1)return null;let ke=Ce.name=="VariableName"||Ce.to-Ce.from<20&&Identifier.test(_n.state.sliceDoc(Ce.from,Ce.to));if(!ke&&!_n.explicit)return null;let $n=[];for(let Hn=Ce;Hn;Hn=Hn.parent)ScopeNodes.has(Hn.name)&&($n=$n.concat(getScope(_n.state.doc,Hn)));return{options:$n,from:ke?Ce.from:_n.pos,validFor:Identifier}}const javascriptLanguage=LRLanguage.define({name:"javascript",parser:parser.configure({props:[indentNodeProp.add({IfStatement:continuedIndent({except:/^\s*({|else\b)/}),TryStatement:continuedIndent({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:flatIndent,SwitchBody:_n=>{let Ce=_n.textAfter,ke=/^\s*\}/.test(Ce),$n=/^\s*(case|default)\b/.test(Ce);return _n.baseIndent+(ke?0:$n?1:2)*_n.unit},Block:delimitedIndent({closing:"}"}),ArrowFunction:_n=>_n.baseIndent+_n.unit,"TemplateString BlockComment":()=>null,"Statement Property":continuedIndent({except:/^{/}),JSXElement(_n){let Ce=/^\s*<\//.test(_n.textAfter);return _n.lineIndent(_n.node.from)+(Ce?0:_n.unit)},JSXEscape(_n){let Ce=/\s*\}/.test(_n.textAfter);return _n.lineIndent(_n.node.from)+(Ce?0:_n.unit)},"JSXOpenTag JSXSelfClosingTag"(_n){return _n.column(_n.node.from)+_n.unit}}),foldNodeProp.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":foldInside,BlockComment(_n){return{from:_n.from+2,to:_n.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),jsxSublanguage={test:_n=>/^JSX/.test(_n.name),facet:defineLanguageFacet({commentTokens:{block:{open:"{/*",close:"*/}"}}})},typescriptLanguage=javascriptLanguage.configure({dialect:"ts"},"typescript"),jsxLanguage=javascriptLanguage.configure({dialect:"jsx",props:[sublanguageProp.add(_n=>_n.isTop?[jsxSublanguage]:void 0)]}),tsxLanguage=javascriptLanguage.configure({dialect:"jsx ts",props:[sublanguageProp.add(_n=>_n.isTop?[jsxSublanguage]:void 0)]},"typescript");let kwComplet
`,attr(Ce,"class","start-typing")},m(ke,$n){insert$1(ke,Ce,$n)},p:noop,d(ke){ke&&detach(Ce)}}}function create_each_block_1$1(_n,Ce){let ke,$n=previewTitle(Ce[9].schemas,Ce[24],Ce[0])+"",Hn,zn,Zn,qn;function Yn(...to){return Ce[17](Ce[24],...to)}function Jn(...to){return Ce[18](Ce[24],...to)}return{key:_n,first:null,c(){ke=element("div"),Hn=text($n),zn=space$3(),attr(ke,"class","reference-tags-option"),attr(ke,"role","button"),attr(ke,"tabindex","0"),this.first=ke},m(to,io){insert$1(to,ke,io),append(ke,Hn),append(ke,zn),Zn||(qn=[listen(ke,"click",Yn),listen(ke,"keypress",Jn)],Zn=!0)},p(to,io){Ce=to,io&65&&$n!==($n=previewTitle(Ce[9].schemas,Ce[24],Ce[0])+"")&&set_data(Hn,$n)},d(to){to&&detach(ke),Zn=!1,run_all(qn)}}}function create_if_block_1$7(_n){let Ce,ke,$n,Hn,zn,Zn;return{c(){Ce=element("div"),ke=text('Add "'),$n=text(_n[5]),Hn=text('"'),attr(Ce,"class","reference-tags-option"),attr(Ce,"role","button"),attr(Ce,"tabindex","0")},m(qn,Yn){insert$1(qn,Ce,Yn),append(Ce,ke),append(Ce,$n),append(Ce,Hn),zn||(Zn=[listen(Ce,"click",_n[19]),listen(Ce,"keypress",_n[20])],zn=!0)},p(qn,Yn){Yn&32&&set_data($n,qn[5])},d(qn){qn&&detach(Ce),zn=!1,run_all(Zn)}}}function create_if_block$9(_n){let Ce,ke=[],$n=new Map,Hn,zn=ensure_array_like(_n[7]);const Zn=qn=>qn[3].id;for(let qn=0;qn<zn.length;qn+=1){let Yn=get_each_context$7(_n,zn,qn),Jn=Zn(Yn);$n.set(Jn,ke[qn]=create_each_block$7(Jn,Yn))}return{c(){Ce=element("div");for(let qn=0;qn<ke.length;qn+=1)ke[qn].c();set_style(Ce,"display","flex"),set_style(Ce,"align-items","center"),set_style(Ce,"gap","4px")},m(qn,Yn){insert$1(qn,Ce,Yn);for(let Jn=0;Jn<ke.length;Jn+=1)ke[Jn]&&ke[Jn].m(Ce,null);Hn=!0},p(qn,Yn){Yn&1664&&(zn=ensure_array_like(qn[7]),group_outros(),ke=update_keyed_each(ke,Yn,Zn,1,qn,zn,$n,Ce,outro_and_destroy_block,create_each_block$7,null,get_each_context$7),check_outros())},i(qn){if(!Hn){for(let Yn=0;Yn<zn.length;Yn+=1)transition_in(ke[Yn]);Hn=!0}},o(qn){for(let Yn=0;Yn<ke.length;Yn+=1)transition_out(ke[Yn]);Hn=!1},d(qn){qn&&detach(Ce);for(let Yn=0;Yn<ke.length;Yn+=1)ke[Yn].d()}}}function create_each_block$7(_n,Ce){let ke,$n,Hn=previewTitle(Ce[9].schemas,Ce[3])+"",zn,Zn,qn,Yn,Jn,to,io,uo,ho;Jn=new Icon({props:{width:12,height:12,icon:"close"}});function bo(...Oo){return Ce[21](Ce[3],...Oo)}return{key:_n,first:null,c(){ke=element("span"),$n=element("a"),zn=text(Hn),qn=space$3(),Yn=element("button"),create_component(Jn.$$.fragment),to=space$3(),attr($n,"class","record-title"),attr($n,"href",Zn=Ce[9].lucentUrl+"/records/"+Ce[3].id),attr(Yn,"type","button"),attr(Yn,"class","button-text"),attr(Yn,"aria-label","Close"),attr(ke,"class","reference-tags-selected-value"),this.first=ke},m(Oo,So){insert$1(Oo,ke,So),append(ke,$n),append($n,zn),append(ke,qn),append(ke,Yn),mount_component(Jn,Yn,null),append(ke,to),io=!0,uo||(ho=listen(Yn,"click",prevent_default(bo)),uo=!0)},p(Oo,So){Ce=Oo,(!io||So&128)&&Hn!==(Hn=previewTitle(Ce[9].schemas,Ce[3])+"")&&set_data(zn,Hn),(!io||So&128&&Zn!==(Zn=Ce[9].lucentUrl+"/records/"+Ce[3].id))&&attr($n,"href",Zn)},i(Oo){io||(transition_in(Jn.$$.fragment,Oo),io=!0)},o(Oo){transition_out(Jn.$$.fragment,Oo),io=!1},d(Oo){Oo&&detach(ke),destroy_component(Jn),uo=!1,ho()}}}function create_fragment$d(_n){let Ce,ke,$n,Hn,zn,Zn,qn,Yn,Jn,to,io,uo,ho=_n[8]&&create_if_block_3$4(_n),bo=_n[6]&&create_if_block_2$4(_n),Oo=_n[5]&&create_if_block_1$7(_n),So=_n[7].length>0&&create_if_block$9(_n);return{c(){Ce=element("div"),ho&&ho.c(),ke=space$3(),$n=element("input"),zn=space$3(),Zn=element("div"),bo&&bo.c(),qn=space$3(),Oo&&Oo.c(),Yn=space$3(),So&&So.c(),Jn=empty$1(),attr($n,"type","search"),attr($n,"id",_n[2]),attr($n,"placeholder",Hn="Search for "+_n[1].label),attr($n,"autocomplete","off"),toggle_class($n,"is-invalid",_n[8]),attr(Zn,"class","reference-tags-results"),attr(Ce,"class","reference-tags")},m($o,Do){insert$1($o,Ce,Do),ho&&ho.m(Ce,null),append(Ce,ke),append(Ce,$n),_n[15]($n),set_input_value($n,_n[5]),append(Ce,zn),append(Ce,Zn),bo&&bo.m(Zn,null),append(Zn,qn),Oo&&Oo.m(Zn,null),insert$1($o,Yn,Do),So&&So.m($o,Do),insert$1($o,Jn,Do),to=!0,io||(uo=[liste
versions`),ha=space$3(),hs=element("div"),zo.c(),el=space$3(),ga=element("div"),Sr&&Sr.c(),attr(zn,"class","label text-end text-muted"),attr(uo,"class","label text-end text-muted"),attr(Do,"class","label text-end text-muted"),attr(ps,"class","label text-end text-muted"),attr($n,"class","col-8"),attr(xs,"class","label d-block text-muted "),attr(gs,"class","col-4"),attr(ke,"class","row"),attr(Ce,"class","lx-card "),attr(hs,"class","revisions")},m(Us,fs){insert$1(Us,Ce,fs),append(Ce,ke),append(ke,$n),append($n,Hn),append(Hn,zn),append(Hn,Zn),append(Hn,qn),append(qn,Jn),append($n,to),append($n,io),append(io,uo),append(io,ho),append(io,Oo),append($n,So),append($n,$o),append($o,Do),append($o,xo),mount_component(Io,$o,null),append($o,Vo),append($o,Mo),append($n,es),append($n,ls),append(ls,ps),append(ls,rs),mount_component(Yo,ls,null),append(ls,Ys),append(ls,Js),append(ke,ko),append(ke,gs),append(gs,xs),append(gs,Qr),append(gs,cr),append(cr,ws),append(cr,Br),append(cr,_r),insert$1(Us,ha,fs),insert$1(Us,hs,fs),Il[Qs].m(hs,null),insert$1(Us,el,fs),insert$1(Us,ga,fs),Sr&&Sr.m(ga,null),_n[13](ga),Ca=!0},p(Us,[fs]){(!Ca||fs&1)&&Yn!==(Yn=Us[0].id+"")&&set_data(Jn,Yn),(!Ca||fs&1)&&bo!==(bo=Us[0]._sys.version+"")&&set_data(Oo,bo);const dr={};fs&3&&(dr.name=usernameById(Us[1],Us[0]._sys.createdBy)),Io.$set(dr),(!Ca||fs&1)&&Ko!==(Ko=friendlyDate(Us[0]._sys.createdAt)+"")&&set_data(Mo,Ko);const Vr={};fs&3&&(Vr.name=usernameById(Us[1],Us[0]._sys.updatedBy)),Yo.$set(Vr),(!Ca||fs&1)&&sr!==(sr=friendlyDate(Us[0]._sys.updatedAt)+"")&&set_data(Js,sr),(!Ca||fs&4)&&Fs!==(Fs=Us[2].revisions+"")&&set_data(Br,Fs);let nr=Qs;Qs=Zs(Us),Qs===nr?Il[Qs].p(Us,fs):(group_outros(),transition_out(Il[nr],1,1,()=>{Il[nr]=null}),check_outros(),zo=Il[Qs],zo?zo.p(Us,fs):(zo=Il[Qs]=za[Qs](Us),zo.c()),transition_in(zo,1),zo.m(hs,null)),Us[5]?Sr?(Sr.p(Us,fs),fs&32&&transition_in(Sr,1)):(Sr=create_if_block$6(Us),Sr.c(),transition_in(Sr,1),Sr.m(ga,null)):Sr&&(group_outros(),transition_out(Sr,1,1,()=>{Sr=null}),check_outros())},i(Us){Ca||(transition_in(Io.$$.fragment,Us),transition_in(Yo.$$.fragment,Us),transition_in(zo),transition_in(Sr),Ca=!0)},o(Us){transition_out(Io.$$.fragment,Us),transition_out(Yo.$$.fragment,Us),transition_out(zo),transition_out(Sr),Ca=!1},d(Us){Us&&(detach(Ce),detach(ha),detach(hs),detach(el),detach(ga)),destroy_component(Io),destroy_component(Yo),Il[Qs].d(),Sr&&Sr.d(),_n[13](null)}}}function instance$8(_n,Ce,ke){let $n,Hn,zn,Zn;const qn=getContext$1("channel");let{record:Yn}=Ce,{graph:Jn}=Ce,{users:to}=Ce,{schema:io}=Ce,uo,ho="";axios.get(`${qn.lucentUrl}/records/${Yn.id}/revisions`).then(xo=>{ke(8,$n=xo.data)}).catch(xo=>{console.log(xo)});function bo(xo,Io){ke(7,Zn=Jn.edges.filter(Vo=>Vo.depth===1).reduce((Vo,Ko)=>(Vo[Ko.field]||(Vo[Ko.field]={record:[],revision:[]}),Vo[Ko.field].record.push(Ko),Vo),{})),ke(7,Zn=Io._edges.reduce((Vo,Ko)=>(Vo[Ko.field]||(Vo[Ko.field]={record:[],revision:[]}),Vo[Ko.field].revision.push(Ko),Vo),Zn))}function Oo(xo,Io){xo.preventDefault(),ke(5,zn=Io),ke(6,Hn=io.fields.filter(Vo=>!lodashExports.isEqual(zn.data[Vo.name],Yn.data[Vo.name]))),bo(Hn,Io),uo.scrollIntoView()}function So(xo){xo.preventDefault(),ke(4,ho=""),axios.post(`${qn.lucentUrl}/records/${Yn.id}/rollback/${zn._sys.version}`).then(Io=>{window.location.reload()}).catch(Io=>{const Vo=Io.response.data.error;ke(4,ho=Vo.fieldLabel+": "+Vo.message)})}const $o=(xo,Io)=>Oo(Io,xo);function Do(xo){binding_callbacks[xo?"unshift":"push"](()=>{uo=xo,ke(3,uo)})}return _n.$$set=xo=>{"record"in xo&&ke(0,Yn=xo.record),"graph"in xo&&ke(11,Jn=xo.graph),"users"in xo&&ke(1,to=xo.users),"schema"in xo&&ke(2,io=xo.schema)},ke(8,$n=[]),ke(6,Hn=[]),ke(5,zn=null),ke(7,Zn={}),[Yn,to,io,uo,ho,zn,Hn,Zn,$n,Oo,So,Jn,$o,Do]}class Info extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$8,create_fragment$8,safe_not_equal,{record:0,graph:11,users:1,schema:2})}}const{window:window_1}=globals;function get_each_context$3(_n,Ce,ke){const $n=_n.slice();return $n[21]=Ce[ke],$n}function create_if_block_5(_n){let Ce,ke,$n;return{c(){Ce=element("button"),Ce.inn
2024-08-27 12:25:42 +03:00
Save`,attr(Ce,"type","button"),attr(Ce,"class","button primary ms-2 btn btn-primary btn-spinner")},m(Hn,zn){insert$1(Hn,Ce,zn),ke||($n=listen(Ce,"click",_n[11]),ke=!0)},p:noop,d(Hn){Hn&&detach(Ce),ke=!1,$n()}}}function create_if_block_4(_n){let Ce,ke,$n;return{c(){Ce=element("button"),Ce.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
2024-08-30 13:38:34 +03:00
Create`,attr(Ce,"class","button primary btn-spinner")},m(Hn,zn){insert$1(Hn,Ce,zn),ke||($n=listen(Ce,"click",_n[11]),ke=!0)},p:noop,d(Hn){Hn&&detach(Ce),ke=!1,$n()}}}function create_if_block_3(_n){let Ce,ke;return Ce=new Info({props:{record:_n[0],graph:_n[1],users:_n[4],schema:_n[2]}}),{c(){create_component(Ce.$$.fragment)},m($n,Hn){mount_component(Ce,$n,Hn),ke=!0},p($n,Hn){const zn={};Hn&1&&(zn.record=$n[0]),Hn&2&&(zn.graph=$n[1]),Hn&16&&(zn.users=$n[4]),Hn&4&&(zn.schema=$n[2]),Ce.$set(zn)},i($n){ke||(transition_in(Ce.$$.fragment,$n),ke=!0)},o($n){transition_out(Ce.$$.fragment,$n),ke=!1},d($n){destroy_component(Ce,$n)}}}function create_if_block_2(_n){let Ce,ke;return Ce=new Graph({props:{graph:_n[1],record:_n[0]}}),{c(){create_component(Ce.$$.fragment)},m($n,Hn){mount_component(Ce,$n,Hn),ke=!0},p($n,Hn){const zn={};Hn&2&&(zn.graph=$n[1]),Hn&1&&(zn.record=$n[0]),Ce.$set(zn)},i($n){ke||(transition_in(Ce.$$.fragment,$n),ke=!0)},o($n){transition_out(Ce.$$.fragment,$n),ke=!1},d($n){destroy_component(Ce,$n)}}}function create_if_block$5(_n){let Ce,ke,$n=[],Hn=new Map,zn,Zn;Ce=new FilePreview({props:{record:_n[0],schema:_n[2]}});let qn=ensure_array_like(_n[9]);const Yn=Jn=>Jn[21].name;for(let Jn=0;Jn<qn.length;Jn+=1){let to=get_each_context$3(_n,qn,Jn),io=Yn(to);Hn.set(io,$n[Jn]=create_each_block$3(io,to))}return{c(){create_component(Ce.$$.fragment),ke=space$3();for(let Jn=0;Jn<$n.length;Jn+=1)$n[Jn].c();zn=empty$1()},m(Jn,to){mount_component(Ce,Jn,to),insert$1(Jn,ke,to);for(let io=0;io<$n.length;io+=1)$n[io]&&$n[io].m(Jn,to);insert$1(Jn,zn,to),Zn=!0},p(Jn,to){const io={};to&1&&(io.record=Jn[0]),to&4&&(io.schema=Jn[2]),Ce.$set(io),to&623&&(qn=ensure_array_like(Jn[9]),group_outros(),$n=update_keyed_each($n,to,Yn,1,Jn,qn,Hn,zn.parentNode,outro_and_destroy_block,create_each_block$3,zn,get_each_context$3),check_outros())},i(Jn){if(!Zn){transition_in(Ce.$$.fragment,Jn);for(let to=0;to<qn.length;to+=1)transition_in($n[to]);Zn=!0}},o(Jn){transition_out(Ce.$$.fragment,Jn);for(let to=0;to<$n.length;to+=1)transition_out($n[to]);Zn=!1},d(Jn){Jn&&(detach(ke),detach(zn)),destroy_component(Ce,Jn);for(let to=0;to<$n.length;to+=1)$n[to].d(Jn)}}}function create_if_block_1$3(_n){let Ce,ke,$n,Hn;function zn(Yn){_n[15](Yn)}function Zn(Yn){_n[16](Yn)}let qn={field:_n[21],schema:_n[2],record:_n[0],validationErrors:_n[5],isCreateMode:_n[3]};return _n[0].data!==void 0&&(qn.data=_n[0].data),_n[1]!==void 0&&(qn.graph=_n[1]),Ce=new FormField({props:qn}),binding_callbacks.push(()=>bind(Ce,"data",zn)),binding_callbacks.push(()=>bind(Ce,"graph",Zn)),{c(){create_component(Ce.$$.fragment)},m(Yn,Jn){mount_component(Ce,Yn,Jn),Hn=!0},p(Yn,Jn){const to={};Jn&4&&(to.schema=Yn[2]),Jn&1&&(to.record=Yn[0]),Jn&32&&(to.validationErrors=Yn[5]),Jn&8&&(to.isCreateMode=Yn[3]),!ke&&Jn&1&&(ke=!0,to.data=Yn[0].data,add_flush_callback(()=>ke=!1)),!$n&&Jn&2&&($n=!0,to.graph=Yn[1],add_flush_callback(()=>$n=!1)),Ce.$set(to)},i(Yn){Hn||(transition_in(Ce.$$.fragment,Yn),Hn=!0)},o(Yn){transition_out(Ce.$$.fragment,Yn),Hn=!1},d(Yn){destroy_component(Ce,Yn)}}}function create_each_block$3(_n,Ce){let ke,$n,Hn,zn=Ce[6]===Ce[21].group&&create_if_block_1$3(Ce);return{key:_n,first:null,c(){ke=empty$1(),zn&&zn.c(),$n=empty$1(),this.first=ke},m(Zn,qn){insert$1(Zn,ke,qn),zn&&zn.m(Zn,qn),insert$1(Zn,$n,qn),Hn=!0},p(Zn,qn){Ce=Zn,Ce[6]===Ce[21].group?zn?(zn.p(Ce,qn),qn&64&&transition_in(zn,1)):(zn=create_if_block_1$3(Ce),zn.c(),transition_in(zn,1),zn.m($n.parentNode,$n)):zn&&(group_outros(),transition_out(zn,1,1,()=>{zn=null}),check_outros())},i(Zn){Hn||(transition_in(zn),Hn=!0)},o(Zn){transition_out(zn),Hn=!1},d(Zn){Zn&&(detach(ke),detach($n)),zn&&zn.d(Zn)}}}function create_fragment$7(_n){let Ce,ke,$n,Hn,zn,Zn,qn,Yn,Jn,to,io,uo,ho,bo,Oo,So,$o,Do,xo,Io,Vo;function Ko(gs){_n[12](gs)}function Mo(gs){_n[13](gs)}let es={schema:_n[2],isCreateMode:_n[3]};_n[0]!==void 0&&(es.record=_n[0]),_n[6]!==void 0&&(es.activeContentTab=_n[6]),$n=new EditHeader({props:es}),binding_callbacks.push(()=>bind($n,"record",Ko)),binding_callbacks.push(()=>bind($n,"activeContentTab",Mo));function ls(gs,xs){
`),Oo=element("div"),Oo.textContent=" ",So=text(`
`),attr($n,"class","header-small mb-5"),attr(Zn,"class","button primary mb-3"),Zn.disabled=_n[2],attr(Jn,"class","mb-3"),attr(uo,"class","logs svelte-a3cwpi"),attr(ke,"class","lx-card mt-5"),attr(Ce,"class","common-wrapper")},m(Vo,Ko){insert$1(Vo,Ce,Ko),append(Ce,ke),append(ke,$n),append($n,Hn),append(ke,zn),append(ke,Zn),append(Zn,qn),append(ke,Yn),append(ke,Jn),xo&&xo.m(Jn,null),append(Jn,to),Io&&Io.m(Jn,null),append(ke,io),append(ke,uo),append(uo,ho),append(uo,bo),append(uo,Oo),_n[6](Oo),append(uo,So),$o||(Do=listen(Zn,"click",_n[4]),$o=!0)},p(Vo,[Ko]){Ko&1&&set_data(Hn,Vo[0]),Ko&4&&(Zn.disabled=Vo[2]),Vo[2]?xo||(xo=create_if_block_1(),xo.c(),xo.m(Jn,to)):xo&&(xo.d(1),xo=null),!Vo[2]&&Vo[3]?Io||(Io=create_if_block$1(),Io.c(),Io.m(Jn,null)):Io&&(Io.d(1),Io=null),Ko&8&&set_data(ho,Vo[3])},i:noop,o:noop,d(Vo){Vo&&detach(Ce),xo&&xo.d(),Io&&Io.d(),_n[6](null),$o=!1,Do()}}}function instance$2(_n,Ce,ke){let $n;const Hn=getContext$1("channel");let{title:zn}=Ce,{command:Zn}=Ce,qn,Yn=!1;function Jn(){const uo=new EventSource(Hn.lucentUrl+"/command-report-source/"+Zn.signature);uo.onmessage=function(ho){ke(2,Yn=!0);const bo=JSON.parse(ho.data);bo.date,ke(3,$n=bo.logs),qn.scrollIntoView()},uo.onerror=ho=>{console.log(ho),uo.close(),ke(2,Yn=!1)}}function to(uo){uo.preventDefault(),ke(2,Yn=!0),axios$1.post(Hn.lucentUrl+"/command/"+Zn.signature).then(ho=>{Jn()})}onMount(()=>{Jn()});function io(uo){binding_callbacks[uo?"unshift":"push"](()=>{qn=uo,ke(1,qn)})}return _n.$$set=uo=>{"title"in uo&&ke(0,zn=uo.title),"command"in uo&&ke(5,Zn=uo.command)},ke(3,$n=""),[zn,qn,Yn,$n,to,Zn,io]}class Report extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$2,create_fragment$2,safe_not_equal,{title:0,command:5})}}function get_each_context(_n,Ce,ke){const $n=_n.slice();return $n[2]=Ce[ke],$n}function create_if_block(_n){let Ce,ke;return Ce=new Dropdown({props:{$$slots:{button:[create_button_slot],default:[create_default_slot]},$$scope:{ctx:_n}}}),{c(){create_component(Ce.$$.fragment)},m($n,Hn){mount_component(Ce,$n,Hn),ke=!0},p($n,Hn){const zn={};Hn&32&&(zn.$$scope={dirty:Hn,ctx:$n}),Ce.$set(zn)},i($n){ke||(transition_in(Ce.$$.fragment,$n),ke=!0)},o($n){transition_out(Ce.$$.fragment,$n),ke=!1},d($n){destroy_component(Ce,$n)}}}function create_each_block(_n){let Ce,ke=_n[2].name+"",$n;return{c(){Ce=element("a"),$n=text(ke),attr(Ce,"href",_n[0].lucentUrl+"/command-report/"+_n[2].signature),attr(Ce,"class","top-nav-item")},m(Hn,zn){insert$1(Hn,Ce,zn),append(Ce,$n)},p:noop,d(Hn){Hn&&detach(Ce)}}}function create_default_slot(_n){let Ce,ke=ensure_array_like(_n[0].commands),$n=[];for(let Hn=0;Hn<ke.length;Hn+=1)$n[Hn]=create_each_block(get_each_context(_n,ke,Hn));return{c(){for(let Hn=0;Hn<$n.length;Hn+=1)$n[Hn].c();Ce=empty$1()},m(Hn,zn){for(let Zn=0;Zn<$n.length;Zn+=1)$n[Zn]&&$n[Zn].m(Hn,zn);insert$1(Hn,Ce,zn)},p(Hn,zn){if(zn&1){ke=ensure_array_like(Hn[0].commands);let Zn;for(Zn=0;Zn<ke.length;Zn+=1){const qn=get_each_context(Hn,ke,Zn);$n[Zn]?$n[Zn].p(qn,zn):($n[Zn]=create_each_block(qn),$n[Zn].c(),$n[Zn].m(Ce.parentNode,Ce))}for(;Zn<$n.length;Zn+=1)$n[Zn].d(1);$n.length=ke.length}},d(Hn){Hn&&detach(Ce),destroy_each($n,Hn)}}}function create_button_slot(_n){let Ce;return{c(){Ce=element("div"),Ce.textContent="Actions",attr(Ce,"slot","button")},m(ke,$n){insert$1(ke,Ce,$n)},p:noop,d(ke){ke&&detach(Ce)}}}function create_fragment$1(_n){let Ce,ke,$n,Hn,zn,Zn,qn,Yn,Jn=_n[0].commands.length>0&&create_if_block(_n);return qn=new Avatar({props:{side:"28",name:_n[1].name}}),{c(){Ce=element("div"),ke=element("a"),$n=text("Members"),Hn=space$3(),Jn&&Jn.c(),zn=space$3(),Zn=element("a"),create_component(qn.$$.fragment),attr(ke,"class","top-nav-item"),attr(ke,"href",_n[0].lucentUrl+"/members"),attr(Zn,"href",_n[0].lucentUrl+"/profile"),attr(Ce,"class","top-nav ")},m(to,io){insert$1(to,Ce,io),append(Ce,ke),append(ke,$n),append(Ce,Hn),Jn&&Jn.m(Ce,null),append(Ce,zn),append(Ce,Zn),mount_component(qn,Zn,null),Yn=!0},p(to,[io]){to[0].commands.length>0&&Jn.p(to,io)},i(to){Yn||(transition_in(Jn),transition_in(qn.$$.fragment,to),Yn=!0)},o(to){transitio