(function(g,Vd){typeof exports=="object"&&typeof module<"u"?module.exports=Vd(require("vue")):typeof define=="function"&&define.amd?define(["vue"],Vd):(g=typeof globalThis<"u"?globalThis:g||self,g.VueUI=Vd(g.Vue))})(this,function(g){"use strict";function Vd(t,e){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function K3(t,e){return function(){return t.apply(e,arguments)}}const{toString:zK}=Object.prototype,{getPrototypeOf:LA}=Object,{iterator:gE,toStringTag:J3}=Symbol,yE=(t=>e=>{const n=zK.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),qu=t=>(t=t.toLowerCase(),e=>yE(e)===t),vE=t=>e=>typeof e===t,{isArray:uv}=Array,lb=vE("undefined");function VK(t){return t!==null&&!lb(t)&&t.constructor!==null&&!lb(t.constructor)&&zl(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Q3=qu("ArrayBuffer");function jK(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Q3(t.buffer),e}const UK=vE("string"),zl=vE("function"),eB=vE("number"),_E=t=>t!==null&&typeof t=="object",HK=t=>t===!0||t===!1,bE=t=>{if(yE(t)!=="object")return!1;const e=LA(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(J3 in t)&&!(gE in t)},WK=qu("Date"),GK=qu("File"),qK=qu("Blob"),YK=qu("FileList"),ZK=t=>_E(t)&&zl(t.pipe),XK=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||zl(t.append)&&((e=yE(t))==="formdata"||e==="object"&&zl(t.toString)&&t.toString()==="[object FormData]"))},KK=qu("URLSearchParams"),[JK,QK,eJ,tJ]=["ReadableStream","Request","Response","Headers"].map(qu),nJ=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function cb(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,i;if(typeof t!="object"&&(t=[t]),uv(t))for(r=0,i=t.length;r0;)if(i=n[r],e===i.toLowerCase())return i;return null}const Gm=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,nB=t=>!lb(t)&&t!==Gm;function PA(){const{caseless:t}=nB(this)&&this||{},e={},n=(r,i)=>{const o=t&&tB(e,i)||i;bE(e[o])&&bE(r)?e[o]=PA(e[o],r):bE(r)?e[o]=PA({},r):uv(r)?e[o]=r.slice():e[o]=r};for(let r=0,i=arguments.length;r(cb(e,(i,o)=>{n&&zl(i)?t[o]=K3(i,n):t[o]=i},{allOwnKeys:r}),t),iJ=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),oJ=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},sJ=(t,e,n,r)=>{let i,o,s;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)s=i[o],(!r||r(s,t,e))&&!a[s]&&(e[s]=t[s],a[s]=!0);t=n!==!1&&LA(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},aJ=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},lJ=t=>{if(!t)return null;if(uv(t))return t;let e=t.length;if(!eB(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},cJ=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&LA(Uint8Array)),uJ=(t,e)=>{const r=(t&&t[gE]).call(t);let i;for(;(i=r.next())&&!i.done;){const o=i.value;e.call(t,o[0],o[1])}},hJ=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},dJ=qu("HTMLFormElement"),fJ=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),rB=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),pJ=qu("RegExp"),iB=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};cb(n,(i,o)=>{let s;(s=e(i,o,t))!==!1&&(r[o]=s||i)}),Object.defineProperties(t,r)},mJ=t=>{iB(t,(e,n)=>{if(zl(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(zl(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},gJ=(t,e)=>{const n={},r=i=>{i.forEach(o=>{n[o]=!0})};return uv(t)?r(t):r(String(t).split(e)),n},yJ=()=>{},vJ=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function _J(t){return!!(t&&zl(t.append)&&t[J3]==="FormData"&&t[gE])}const bJ=t=>{const e=new Array(10),n=(r,i)=>{if(_E(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const o=uv(r)?[]:{};return cb(r,(s,a)=>{const l=n(s,i+1);!lb(l)&&(o[a]=l)}),e[i]=void 0,o}}return r};return n(t,0)},wJ=qu("AsyncFunction"),xJ=t=>t&&(_E(t)||zl(t))&&zl(t.then)&&zl(t.catch),oB=((t,e)=>t?setImmediate:e?((n,r)=>(Gm.addEventListener("message",({source:i,data:o})=>{i===Gm&&o===n&&r.length&&r.shift()()},!1),i=>{r.push(i),Gm.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",zl(Gm.postMessage)),EJ=typeof queueMicrotask<"u"?queueMicrotask.bind(Gm):typeof process<"u"&&process.nextTick||oB,_t={isArray:uv,isArrayBuffer:Q3,isBuffer:VK,isFormData:XK,isArrayBufferView:jK,isString:UK,isNumber:eB,isBoolean:HK,isObject:_E,isPlainObject:bE,isReadableStream:JK,isRequest:QK,isResponse:eJ,isHeaders:tJ,isUndefined:lb,isDate:WK,isFile:GK,isBlob:qK,isRegExp:pJ,isFunction:zl,isStream:ZK,isURLSearchParams:KK,isTypedArray:cJ,isFileList:YK,forEach:cb,merge:PA,extend:rJ,trim:nJ,stripBOM:iJ,inherits:oJ,toFlatObject:sJ,kindOf:yE,kindOfTest:qu,endsWith:aJ,toArray:lJ,forEachEntry:uJ,matchAll:hJ,isHTMLForm:dJ,hasOwnProperty:rB,hasOwnProp:rB,reduceDescriptors:iB,freezeMethods:mJ,toObjectSet:gJ,toCamelCase:fJ,noop:yJ,toFiniteNumber:vJ,findKey:tB,global:Gm,isContextDefined:nB,isSpecCompliantForm:_J,toJSONObject:bJ,isAsyncFn:wJ,isThenable:xJ,setImmediate:oB,asap:EJ,isIterable:t=>t!=null&&zl(t[gE])};function cr(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}_t.inherits(cr,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:_t.toJSONObject(this.config),code:this.code,status:this.status}}});const sB=cr.prototype,aB={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{aB[t]={value:t}}),Object.defineProperties(cr,aB),Object.defineProperty(sB,"isAxiosError",{value:!0}),cr.from=(t,e,n,r,i,o)=>{const s=Object.create(sB);return _t.toFlatObject(t,s,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),cr.call(s,t.message,e,n,r,i),s.cause=t,s.name=t.name,o&&Object.assign(s,o),s};const SJ=null;function NA(t){return _t.isPlainObject(t)||_t.isArray(t)}function lB(t){return _t.endsWith(t,"[]")?t.slice(0,-2):t}function cB(t,e,n){return t?t.concat(e).map(function(i,o){return i=lB(i),!n&&o?"["+i+"]":i}).join(n?".":""):e}function CJ(t){return _t.isArray(t)&&!t.some(NA)}const kJ=_t.toFlatObject(_t,{},null,function(e){return/^is[A-Z]/.test(e)});function wE(t,e,n){if(!_t.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=_t.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,x){return!_t.isUndefined(x[w])});const r=n.metaTokens,i=n.visitor||u,o=n.dots,s=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&_t.isSpecCompliantForm(e);if(!_t.isFunction(i))throw new TypeError("visitor must be a function");function c(y){if(y===null)return"";if(_t.isDate(y))return y.toISOString();if(_t.isBoolean(y))return y.toString();if(!l&&_t.isBlob(y))throw new cr("Blob is not supported. Use a Buffer instead.");return _t.isArrayBuffer(y)||_t.isTypedArray(y)?l&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function u(y,w,x){let C=y;if(y&&!x&&typeof y=="object"){if(_t.endsWith(w,"{}"))w=r?w:w.slice(0,-2),y=JSON.stringify(y);else if(_t.isArray(y)&&CJ(y)||(_t.isFileList(y)||_t.endsWith(w,"[]"))&&(C=_t.toArray(y)))return w=lB(w),C.forEach(function(M,E){!(_t.isUndefined(M)||M===null)&&e.append(s===!0?cB([w],E,o):s===null?w:w+"[]",c(M))}),!1}return NA(y)?!0:(e.append(cB(x,w,o),c(y)),!1)}const d=[],p=Object.assign(kJ,{defaultVisitor:u,convertValue:c,isVisitable:NA});function m(y,w){if(!_t.isUndefined(y)){if(d.indexOf(y)!==-1)throw Error("Circular reference detected in "+w.join("."));d.push(y),_t.forEach(y,function(C,S){(!(_t.isUndefined(C)||C===null)&&i.call(e,C,_t.isString(S)?S.trim():S,w,p))===!0&&m(C,w?w.concat(S):[S])}),d.pop()}}if(!_t.isObject(t))throw new TypeError("data must be an object");return m(t),e}function uB(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function OA(t,e){this._pairs=[],t&&wE(t,this,e)}const hB=OA.prototype;hB.append=function(e,n){this._pairs.push([e,n])},hB.toString=function(e){const n=e?function(r){return e.call(this,r,uB)}:uB;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function TJ(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function dB(t,e,n){if(!e)return t;const r=n&&n.encode||TJ;_t.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let o;if(i?o=i(e,n):o=_t.isURLSearchParams(e)?e.toString():new OA(e,n).toString(r),o){const s=t.indexOf("#");s!==-1&&(t=t.slice(0,s)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class fB{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){_t.forEach(this.handlers,function(r){r!==null&&e(r)})}}const pB={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},MJ={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:OA,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},DA=typeof window<"u"&&typeof document<"u",RA=typeof navigator=="object"&&navigator||void 0,AJ=DA&&(!RA||["ReactNative","NativeScript","NS"].indexOf(RA.product)<0),IJ=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",LJ=DA&&window.location.href||"http://localhost",Ba={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:DA,hasStandardBrowserEnv:AJ,hasStandardBrowserWebWorkerEnv:IJ,navigator:RA,origin:LJ},Symbol.toStringTag,{value:"Module"})),...MJ};function PJ(t,e){return wE(t,new Ba.classes.URLSearchParams,Object.assign({visitor:function(n,r,i,o){return Ba.isNode&&_t.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},e))}function NJ(t){return _t.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function OJ(t){const e={},n=Object.keys(t);let r;const i=n.length;let o;for(r=0;r=n.length;return s=!s&&_t.isArray(i)?i.length:s,l?(_t.hasOwnProp(i,s)?i[s]=[i[s],r]:i[s]=r,!a):((!i[s]||!_t.isObject(i[s]))&&(i[s]=[]),e(n,r,i[s],o)&&_t.isArray(i[s])&&(i[s]=OJ(i[s])),!a)}if(_t.isFormData(t)&&_t.isFunction(t.entries)){const n={};return _t.forEachEntry(t,(r,i)=>{e(NJ(r),i,n,0)}),n}return null}function DJ(t,e,n){if(_t.isString(t))try{return(e||JSON.parse)(t),_t.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const ub={transitional:pB,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,o=_t.isObject(e);if(o&&_t.isHTMLForm(e)&&(e=new FormData(e)),_t.isFormData(e))return i?JSON.stringify(mB(e)):e;if(_t.isArrayBuffer(e)||_t.isBuffer(e)||_t.isStream(e)||_t.isFile(e)||_t.isBlob(e)||_t.isReadableStream(e))return e;if(_t.isArrayBufferView(e))return e.buffer;if(_t.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return PJ(e,this.formSerializer).toString();if((a=_t.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return wE(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return o||i?(n.setContentType("application/json",!1),DJ(e)):e}],transformResponse:[function(e){const n=this.transitional||ub.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(_t.isResponse(e)||_t.isReadableStream(e))return e;if(e&&_t.isString(e)&&(r&&!this.responseType||i)){const s=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?cr.from(a,cr.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ba.classes.FormData,Blob:Ba.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};_t.forEach(["delete","get","head","post","put","patch"],t=>{ub.headers[t]={}});const RJ=_t.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),BJ=t=>{const e={};let n,r,i;return t&&t.split(` `).forEach(function(s){i=s.indexOf(":"),n=s.substring(0,i).trim().toLowerCase(),r=s.substring(i+1).trim(),!(!n||e[n]&&RJ[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},gB=Symbol("internals");function hb(t){return t&&String(t).trim().toLowerCase()}function xE(t){return t===!1||t==null?t:_t.isArray(t)?t.map(xE):String(t)}function FJ(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const $J=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function BA(t,e,n,r,i){if(_t.isFunction(r))return r.call(this,e,n);if(i&&(e=n),!!_t.isString(e)){if(_t.isString(r))return e.indexOf(r)!==-1;if(_t.isRegExp(r))return r.test(e)}}function zJ(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function VJ(t,e){const n=_t.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(i,o,s){return this[r].call(this,e,i,o,s)},configurable:!0})})}let Vl=class{constructor(e){e&&this.set(e)}set(e,n,r){const i=this;function o(a,l,c){const u=hb(l);if(!u)throw new Error("header name must be a non-empty string");const d=_t.findKey(i,u);(!d||i[d]===void 0||c===!0||c===void 0&&i[d]!==!1)&&(i[d||l]=xE(a))}const s=(a,l)=>_t.forEach(a,(c,u)=>o(c,u,l));if(_t.isPlainObject(e)||e instanceof this.constructor)s(e,n);else if(_t.isString(e)&&(e=e.trim())&&!$J(e))s(BJ(e),n);else if(_t.isObject(e)&&_t.isIterable(e)){let a={},l,c;for(const u of e){if(!_t.isArray(u))throw TypeError("Object iterator must return a key-value pair");a[c=u[0]]=(l=a[c])?_t.isArray(l)?[...l,u[1]]:[l,u[1]]:u[1]}s(a,n)}else e!=null&&o(n,e,r);return this}get(e,n){if(e=hb(e),e){const r=_t.findKey(this,e);if(r){const i=this[r];if(!n)return i;if(n===!0)return FJ(i);if(_t.isFunction(n))return n.call(this,i,r);if(_t.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=hb(e),e){const r=_t.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||BA(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let i=!1;function o(s){if(s=hb(s),s){const a=_t.findKey(r,s);a&&(!n||BA(r,r[a],a,n))&&(delete r[a],i=!0)}}return _t.isArray(e)?e.forEach(o):o(e),i}clear(e){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const o=n[r];(!e||BA(this,this[o],o,e,!0))&&(delete this[o],i=!0)}return i}normalize(e){const n=this,r={};return _t.forEach(this,(i,o)=>{const s=_t.findKey(r,o);if(s){n[s]=xE(i),delete n[o];return}const a=e?zJ(o):String(o).trim();a!==o&&delete n[o],n[a]=xE(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return _t.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=e&&_t.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(` `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[gB]=this[gB]={accessors:{}}).accessors,i=this.prototype;function o(s){const a=hb(s);r[a]||(VJ(i,s),r[a]=!0)}return _t.isArray(e)?e.forEach(o):o(e),this}};Vl.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),_t.reduceDescriptors(Vl.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}}),_t.freezeMethods(Vl);function FA(t,e){const n=this||ub,r=e||n,i=Vl.from(r.headers);let o=r.data;return _t.forEach(t,function(a){o=a.call(n,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function yB(t){return!!(t&&t.__CANCEL__)}function hv(t,e,n){cr.call(this,t??"canceled",cr.ERR_CANCELED,e,n),this.name="CanceledError"}_t.inherits(hv,cr,{__CANCEL__:!0});function vB(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new cr("Request failed with status code "+n.status,[cr.ERR_BAD_REQUEST,cr.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function jJ(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function UJ(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i=0,o=0,s;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=r[o];s||(s=c),n[i]=l,r[i]=c;let d=o,p=0;for(;d!==i;)p+=n[d++],d=d%t;if(i=(i+1)%t,i===o&&(o=(o+1)%t),c-s{n=u,i=null,o&&(clearTimeout(o),o=null),t.apply(null,c)};return[(...c)=>{const u=Date.now(),d=u-n;d>=r?s(c,u):(i=c,o||(o=setTimeout(()=>{o=null,s(i)},r-d)))},()=>i&&s(i)]}const EE=(t,e,n=3)=>{let r=0;const i=UJ(50,250);return HJ(o=>{const s=o.loaded,a=o.lengthComputable?o.total:void 0,l=s-r,c=i(l),u=s<=a;r=s;const d={loaded:s,total:a,progress:a?s/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&u?(a-s)/c:void 0,event:o,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(d)},n)},_B=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},bB=t=>(...e)=>_t.asap(()=>t(...e)),WJ=Ba.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Ba.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Ba.origin),Ba.navigator&&/(msie|trident)/i.test(Ba.navigator.userAgent)):()=>!0,GJ=Ba.hasStandardBrowserEnv?{write(t,e,n,r,i,o){const s=[t+"="+encodeURIComponent(e)];_t.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),_t.isString(r)&&s.push("path="+r),_t.isString(i)&&s.push("domain="+i),o===!0&&s.push("secure"),document.cookie=s.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function qJ(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function YJ(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function wB(t,e,n){let r=!qJ(e);return t&&(r||n==!1)?YJ(t,e):e}const xB=t=>t instanceof Vl?{...t}:t;function qm(t,e){e=e||{};const n={};function r(c,u,d,p){return _t.isPlainObject(c)&&_t.isPlainObject(u)?_t.merge.call({caseless:p},c,u):_t.isPlainObject(u)?_t.merge({},u):_t.isArray(u)?u.slice():u}function i(c,u,d,p){if(_t.isUndefined(u)){if(!_t.isUndefined(c))return r(void 0,c,d,p)}else return r(c,u,d,p)}function o(c,u){if(!_t.isUndefined(u))return r(void 0,u)}function s(c,u){if(_t.isUndefined(u)){if(!_t.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function a(c,u,d){if(d in e)return r(c,u);if(d in t)return r(void 0,c)}const l={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(c,u,d)=>i(xB(c),xB(u),d,!0)};return _t.forEach(Object.keys(Object.assign({},t,e)),function(u){const d=l[u]||i,p=d(t[u],e[u],u);_t.isUndefined(p)&&d!==a||(n[u]=p)}),n}const EB=t=>{const e=qm({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=e;e.headers=s=Vl.from(s),e.url=dB(wB(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let l;if(_t.isFormData(n)){if(Ba.hasStandardBrowserEnv||Ba.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if((l=s.getContentType())!==!1){const[c,...u]=l?l.split(";").map(d=>d.trim()).filter(Boolean):[];s.setContentType([c||"multipart/form-data",...u].join("; "))}}if(Ba.hasStandardBrowserEnv&&(r&&_t.isFunction(r)&&(r=r(e)),r||r!==!1&&WJ(e.url))){const c=i&&o&&GJ.read(o);c&&s.set(i,c)}return e},ZJ=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(n,r){const i=EB(t);let o=i.data;const s=Vl.from(i.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=i,u,d,p,m,y;function w(){m&&m(),y&&y(),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let x=new XMLHttpRequest;x.open(i.method.toUpperCase(),i.url,!0),x.timeout=i.timeout;function C(){if(!x)return;const M=Vl.from("getAllResponseHeaders"in x&&x.getAllResponseHeaders()),A={data:!a||a==="text"||a==="json"?x.responseText:x.response,status:x.status,statusText:x.statusText,headers:M,config:t,request:x};vB(function(O){n(O),w()},function(O){r(O),w()},A),x=null}"onloadend"in x?x.onloadend=C:x.onreadystatechange=function(){!x||x.readyState!==4||x.status===0&&!(x.responseURL&&x.responseURL.indexOf("file:")===0)||setTimeout(C)},x.onabort=function(){x&&(r(new cr("Request aborted",cr.ECONNABORTED,t,x)),x=null)},x.onerror=function(){r(new cr("Network Error",cr.ERR_NETWORK,t,x)),x=null},x.ontimeout=function(){let E=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const A=i.transitional||pB;i.timeoutErrorMessage&&(E=i.timeoutErrorMessage),r(new cr(E,A.clarifyTimeoutError?cr.ETIMEDOUT:cr.ECONNABORTED,t,x)),x=null},o===void 0&&s.setContentType(null),"setRequestHeader"in x&&_t.forEach(s.toJSON(),function(E,A){x.setRequestHeader(A,E)}),_t.isUndefined(i.withCredentials)||(x.withCredentials=!!i.withCredentials),a&&a!=="json"&&(x.responseType=i.responseType),c&&([p,y]=EE(c,!0),x.addEventListener("progress",p)),l&&x.upload&&([d,m]=EE(l),x.upload.addEventListener("progress",d),x.upload.addEventListener("loadend",m)),(i.cancelToken||i.signal)&&(u=M=>{x&&(r(!M||M.type?new hv(null,t,x):M),x.abort(),x=null)},i.cancelToken&&i.cancelToken.subscribe(u),i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u)));const S=jJ(i.url);if(S&&Ba.protocols.indexOf(S)===-1){r(new cr("Unsupported protocol "+S+":",cr.ERR_BAD_REQUEST,t));return}x.send(o||null)})},XJ=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,i;const o=function(c){if(!i){i=!0,a();const u=c instanceof Error?c:this.reason;r.abort(u instanceof cr?u:new hv(u instanceof Error?u.message:u))}};let s=e&&setTimeout(()=>{s=null,o(new cr(`timeout ${e} of ms exceeded`,cr.ETIMEDOUT))},e);const a=()=>{t&&(s&&clearTimeout(s),s=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(o):c.removeEventListener("abort",o)}),t=null)};t.forEach(c=>c.addEventListener("abort",o));const{signal:l}=r;return l.unsubscribe=()=>_t.asap(a),l}},KJ=function*(t,e){let n=t.byteLength;if(n{const i=JJ(t,e);let o=0,s,a=l=>{s||(s=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await i.next();if(c){a(),l.close();return}let d=u.byteLength;if(n){let p=o+=d;n(p)}l.enqueue(new Uint8Array(u))}catch(c){throw a(c),c}},cancel(l){return a(l),i.return()}},{highWaterMark:2})},SE=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",CB=SE&&typeof ReadableStream=="function",eQ=SE&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),kB=(t,...e)=>{try{return!!t(...e)}catch{return!1}},tQ=CB&&kB(()=>{let t=!1;const e=new Request(Ba.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),TB=64*1024,$A=CB&&kB(()=>_t.isReadableStream(new Response("").body)),CE={stream:$A&&(t=>t.body)};SE&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!CE[e]&&(CE[e]=_t.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new cr(`Response type '${e}' is not supported`,cr.ERR_NOT_SUPPORT,r)})})})(new Response);const nQ=async t=>{if(t==null)return 0;if(_t.isBlob(t))return t.size;if(_t.isSpecCompliantForm(t))return(await new Request(Ba.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(_t.isArrayBufferView(t)||_t.isArrayBuffer(t))return t.byteLength;if(_t.isURLSearchParams(t)&&(t=t+""),_t.isString(t))return(await eQ(t)).byteLength},rQ=async(t,e)=>{const n=_t.toFiniteNumber(t.getContentLength());return n??nQ(e)},zA={http:SJ,xhr:ZJ,fetch:SE&&(async t=>{let{url:e,method:n,data:r,signal:i,cancelToken:o,timeout:s,onDownloadProgress:a,onUploadProgress:l,responseType:c,headers:u,withCredentials:d="same-origin",fetchOptions:p}=EB(t);c=c?(c+"").toLowerCase():"text";let m=XJ([i,o&&o.toAbortSignal()],s),y;const w=m&&m.unsubscribe&&(()=>{m.unsubscribe()});let x;try{if(l&&tQ&&n!=="get"&&n!=="head"&&(x=await rQ(u,r))!==0){let A=new Request(e,{method:"POST",body:r,duplex:"half"}),I;if(_t.isFormData(r)&&(I=A.headers.get("content-type"))&&u.setContentType(I),A.body){const[O,z]=_B(x,EE(bB(l)));r=SB(A.body,TB,O,z)}}_t.isString(d)||(d=d?"include":"omit");const C="credentials"in Request.prototype;y=new Request(e,{...p,signal:m,method:n.toUpperCase(),headers:u.normalize().toJSON(),body:r,duplex:"half",credentials:C?d:void 0});let S=await fetch(y,p);const M=$A&&(c==="stream"||c==="response");if($A&&(a||M&&w)){const A={};["status","statusText","headers"].forEach($=>{A[$]=S[$]});const I=_t.toFiniteNumber(S.headers.get("content-length")),[O,z]=a&&_B(I,EE(bB(a),!0))||[];S=new Response(SB(S.body,TB,O,()=>{z&&z(),w&&w()}),A)}c=c||"text";let E=await CE[_t.findKey(CE,c)||"text"](S,t);return!M&&w&&w(),await new Promise((A,I)=>{vB(A,I,{data:E,headers:Vl.from(S.headers),status:S.status,statusText:S.statusText,config:t,request:y})})}catch(C){throw w&&w(),C&&C.name==="TypeError"&&/Load failed|fetch/i.test(C.message)?Object.assign(new cr("Network Error",cr.ERR_NETWORK,t,y),{cause:C.cause||C}):cr.from(C,C&&C.code,t,y)}})};_t.forEach(zA,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const MB=t=>`- ${t}`,iQ=t=>_t.isFunction(t)||t===null||t===!1,AB={getAdapter:t=>{t=_t.isArray(t)?t:[t];const{length:e}=t;let n,r;const i={};for(let o=0;o`adapter ${a} `+(l===!1?"is not supported by the environment":"is not available in the build"));let s=e?o.length>1?`since : `+o.map(MB).join(` `):" "+MB(o[0]):"as no adapter specified";throw new cr("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return r},adapters:zA};function VA(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new hv(null,t)}function IB(t){return VA(t),t.headers=Vl.from(t.headers),t.data=FA.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),AB.getAdapter(t.adapter||ub.adapter)(t).then(function(r){return VA(t),r.data=FA.call(t,t.transformResponse,r),r.headers=Vl.from(r.headers),r},function(r){return yB(r)||(VA(t),r&&r.response&&(r.response.data=FA.call(t,t.transformResponse,r.response),r.response.headers=Vl.from(r.response.headers))),Promise.reject(r)})}const LB="1.10.0",kE={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{kE[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const PB={};kE.transitional=function(e,n,r){function i(o,s){return"[Axios v"+LB+"] Transitional option '"+o+"'"+s+(r?". "+r:"")}return(o,s,a)=>{if(e===!1)throw new cr(i(s," has been removed"+(n?" in "+n:"")),cr.ERR_DEPRECATED);return n&&!PB[s]&&(PB[s]=!0,console.warn(i(s," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(o,s,a):!0}},kE.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function oQ(t,e,n){if(typeof t!="object")throw new cr("options must be an object",cr.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const o=r[i],s=e[o];if(s){const a=t[o],l=a===void 0||s(a,o,t);if(l!==!0)throw new cr("option "+o+" must be "+l,cr.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new cr("Unknown option "+o,cr.ERR_BAD_OPTION)}}const TE={assertOptions:oQ,validators:kE},Bh=TE.validators;let Ym=class{constructor(e){this.defaults=e||{},this.interceptors={request:new fB,response:new fB}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const o=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=` `+o):r.stack=o}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=qm(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:o}=n;r!==void 0&&TE.assertOptions(r,{silentJSONParsing:Bh.transitional(Bh.boolean),forcedJSONParsing:Bh.transitional(Bh.boolean),clarifyTimeoutError:Bh.transitional(Bh.boolean)},!1),i!=null&&(_t.isFunction(i)?n.paramsSerializer={serialize:i}:TE.assertOptions(i,{encode:Bh.function,serialize:Bh.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),TE.assertOptions(n,{baseUrl:Bh.spelling("baseURL"),withXsrfToken:Bh.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=o&&_t.merge(o.common,o[n.method]);o&&_t.forEach(["delete","get","head","post","put","patch","common"],y=>{delete o[y]}),n.headers=Vl.concat(s,o);const a=[];let l=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(n)===!1||(l=l&&w.synchronous,a.unshift(w.fulfilled,w.rejected))});const c=[];this.interceptors.response.forEach(function(w){c.push(w.fulfilled,w.rejected)});let u,d=0,p;if(!l){const y=[IB.bind(this),void 0];for(y.unshift.apply(y,a),y.push.apply(y,c),p=y.length,u=Promise.resolve(n);d{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](i);r._listeners=null}),this.promise.then=i=>{let o;const s=new Promise(a=>{r.subscribe(a),o=a}).then(i);return s.cancel=function(){r.unsubscribe(o)},s},e(function(o,s,a){r.reason||(r.reason=new hv(o,s,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new DK(function(i){e=i}),cancel:e}}};function aQ(t){return function(n){return t.apply(null,n)}}function lQ(t){return _t.isObject(t)&&t.isAxiosError===!0}const jA={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,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(jA).forEach(([t,e])=>{jA[e]=t});function NB(t){const e=new Ym(t),n=K3(Ym.prototype.request,e);return _t.extend(n,Ym.prototype,e,{allOwnKeys:!0}),_t.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return NB(qm(t,i))},n}const un=NB(ub);un.Axios=Ym,un.CanceledError=hv,un.CancelToken=sQ,un.isCancel=yB,un.VERSION=LB,un.toFormData=wE,un.AxiosError=cr,un.Cancel=un.CanceledError,un.all=function(e){return Promise.all(e)},un.spread=aQ,un.isAxiosError=lQ,un.mergeConfig=qm,un.AxiosHeaders=Vl,un.formToJSON=t=>mB(_t.isHTMLForm(t)?new FormData(t):t),un.getAdapter=AB.getAdapter,un.HttpStatusCode=jA,un.default=un;const{Axios:_7e,AxiosError:b7e,CanceledError:w7e,isCancel:x7e,CancelToken:E7e,VERSION:S7e,all:C7e,Cancel:k7e,isAxiosError:T7e,spread:M7e,toFormData:A7e,AxiosHeaders:I7e,HttpStatusCode:L7e,formToJSON:P7e,getAdapter:N7e,mergeConfig:O7e}=un,xt=(t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n},cQ={},uQ={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-reload"};function hQ(t,e){return g.openBlock(),g.createElementBlock("svg",uQ,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M19.933 13.041a8 8 0 1 1 -9.925 -8.788c3.899 -1 7.935 1.007 9.425 4.747"},null,-1),g.createElementVNode("path",{d:"M20 4v5h-5"},null,-1)]))}const dQ={props:{type:{type:String,default:()=>""},title:{type:String,default:()=>""},color:{type:String,default:"blue"},size:{type:String,default:()=>""},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},icon:{type:String,default:()=>""},circle:Boolean,square:Boolean},components:{IconReload:xt(cQ,[["render",hQ]])},data(){return{buttonClass:{}}},computed:{buttonData(){var t;return((t=this.buttonClass)==null?void 0:t[this.type])||this.buttonClass.default}},watch:{color:{immediate:!0,handler(t){this.buttonClass={primary:{params:{"border-1 border-transparent text-white":!0,[`bg-${t}-500`]:!0,[`hover:bg-${t}-600`]:!0,[`focus:ring-${t}-500`]:!0}},text:{params:{"border border-transparent":!0,[`text-${t}-500`]:!0,[`hover:bg-${t}-100`]:!0,[`focus:ring-${t}-500`]:!0}},plain:{params:{"border border-transparent hover:text-white ring-offset-white":!0,[`bg-${t}-100`]:!0,[`text-${t}-500`]:!0,[`hover:bg-${t}-500`]:!0,[`focus:ring-${t}-500`]:!0}},border:{params:{"border font-medium bg-white shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white":!0,[`text-${t}-700`]:!0,[`focus:ring-${t}-600`]:!0}},link:{params:{"border border-transparent ring-offset-white":!0,[`text-${t}-600`]:!0,[`hover:text-${t}-700`]:!0,[`focus:ring-${t}-600`]:!0}},default:{params:{"border !border-gray-200 hover:text-white bg-white":!0,[`text-${t}-500`]:!0,[`hover:border-${t}-500`]:!0,[`hover:bg-${t}-500`]:!0,[`focus:ring-${t}-500`]:!0}}}}}}},fQ=["disabled"],pQ={key:0,class:"pointer-events-none"},mQ={key:2,role:"status"};function gQ(t,e,n,r,i,o){const s=g.resolveComponent("IconReload");return g.openBlock(),g.createElementBlock("button",{type:"button",class:g.normalizeClass(["vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all",{...o.buttonData.params,[n.size==="mini"?"py-1 px-3":n.size==="large"?"py-3 px-7":"py-1.5 px-5"]:!0,[n.disabled?"disabled opacity-50 focus:ring-0 focus:ring-offset-0 cursor-not-allowed":"focus:ring-1 focus:ring-offset-1"]:!0,"!px-2 !py-2 !rounded-full":n.circle,"!px-2 !py-2 !rounded-md":n.square}]),disabled:n.disabled},[g.renderSlot(t.$slots,"default",{},()=>[g.createTextVNode(g.toDisplayString(n.title),1)],!0),n.icon&&n.icon==="ti-reload"?(g.openBlock(),g.createElementBlock("div",pQ,[g.createVNode(s,{width:"15px",height:"15px",class:"stroke-gray-500 transition-all"})])):n.icon?(g.openBlock(),g.createElementBlock("i",{key:1,class:g.normalizeClass(["ti "+n.icon,"pointer-events-none"])},null,2)):g.createCommentVNode("",!0),n.loading?(g.openBlock(),g.createElementBlock("div",mQ,e[0]||(e[0]=[g.createElementVNode("svg",{"aria-hidden":"true",class:"inline w-4 h-4 text-gray-200 animate-spin fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[g.createElementVNode("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),g.createElementVNode("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1)]))):g.createCommentVNode("",!0)],10,fQ)}const Fh=xt(dQ,[["render",gQ],["__scopeId","data-v-6bfc24e8"]]),yQ={},vQ={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function _Q(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",vQ,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),g.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const Fa=xt(yQ,[["render",_Q]]),bQ={},wQ={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search"};function xQ(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",wQ,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),g.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const UA=xt(bQ,[["render",xQ]]),EQ={},SQ={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-mail"};function CQ(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",SQ,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"},null,-1),g.createElementVNode("path",{d:"M3 7l9 6l9 -6"},null,-1)]))}const kQ=xt(EQ,[["render",CQ]]),TQ=g.defineComponent({components:{IconClose:Fa,IconSearch:UA,IconEmail:kQ},props:{icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},modelValue:{type:String,default:()=>""},placeholder:{type:String,default:()=>""},iconPosition:{type:String,default:()=>"right"},type:{type:String,default:()=>"text"},style:{type:Object,default:()=>null},size:{type:String,default:()=>"md"},attrs:{type:Object,default:()=>{}}},emits:["onInput","update:modelValue","blur","focus"],computed:{checkSize(){var t,e,n;if((((t=this.style)==null?void 0:t.size)||this.size)==="xs")return"h-[32px] text-sm";if((((e=this.style)==null?void 0:e.size)||this.size)==="md")return"h-[38px] text-sm";(n=this.style)!=null&&n.size||this.size},value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t.trim())}},clearIconStyle(){return[{"right-8":this.icon&&this.iconPosition==="right","right-3":!this.icon||this.iconPosition!=="right","pointer-events-none":this.disabled}]},iconStylePosition(){return[{"left-3":this.icon&&this.iconPosition==="left","right-3":this.icon&&this.iconPosition==="right"}]},inputStyle(){return[{"!pr-8":this.clearable&&!this.icon,"!pr-7":this.clearable,"!pr-16":this.clearable&&this.icon&&this.iconPosition==="right","!pl-8":this.icon&&this.iconPosition==="left","!pr-[50px]":this.clearable&&this.value&&this.icon&&this.iconPosition==="right","!cursor-not-allowed bg-slate-100":this.disabled,"bg-white":!this.disabled}]}},methods:{handleInput(){this.$emit("onInput",this.modelValue)},handleBlur(){this.$emit("blur")},handleFocus(){this.$emit("focus")},clearInput(){this.$emit("update:modelValue",""),this.$emit("onInput","")},async inputFocus(){const{vsText:t}=await this.$refs;await t.focus()}}}),MQ={class:"vs-form-text relative bg-white rounded-lg"},AQ={key:2,class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},IQ=["disabled","type","placeholder"];function LQ(t,e,n,r,i,o){var c;const s=g.resolveComponent("IconClose"),a=g.resolveComponent("IconSearch"),l=g.resolveComponent("IconEmail");return g.openBlock(),g.createElementBlock("div",MQ,[t.clearable&&t.value?(g.openBlock(),g.createElementBlock("div",{key:0,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:e[0]||(e[0]=(...u)=>t.clearInput&&t.clearInput(...u))},[g.createVNode(s,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500 transition-all"})])):g.createCommentVNode("",!0),t.icon&&t.icon==="search"?(g.openBlock(),g.createElementBlock("div",{key:1,class:g.normalizeClass(["absolute bottom-2/4 translate-y-2/4 cursor-pointer",t.iconStylePosition])},[g.createVNode(a,{width:"15px",height:"15px",class:"stroke-gray-500 transition-all"})],2)):t.icon&&t.icon==="email"?(g.openBlock(),g.createElementBlock("div",AQ,[g.createVNode(l,{width:"16",height:"16",class:"stroke-gray-500 transition-all"})])):(g.openBlock(),g.createElementBlock("i",{key:3,class:g.normalizeClass(["absolute bottom-2/4 translate-y-2/4 text-gray-500 cursor-pointer",["ti "+t.icon,t.iconStylePosition]])},null,2)),t.clearable&&t.value?(g.openBlock(),g.createElementBlock("div",{key:4,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:e[1]||(e[1]=(...u)=>t.clearInput&&t.clearInput(...u))},[g.createVNode(s,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500 transition-all"})])):g.createCommentVNode("",!0),g.withDirectives(g.createElementVNode("input",g.mergeProps({ref:"vsText",disabled:t.disabled,type:t.type,onInput:e[2]||(e[2]=(...u)=>t.handleInput&&t.handleInput(...u)),placeholder:t.placeholder,"onUpdate:modelValue":e[3]||(e[3]=u=>t.value=u)},((c=t.style)==null?void 0:c.attrs)||t.attrs||{},{onFocus:e[4]||(e[4]=(...u)=>t.handleFocus&&t.handleFocus(...u)),onBlur:e[5]||(e[5]=(...u)=>t.handleBlur&&t.handleBlur(...u)),class:[[t.inputStyle,t.checkSize],"py-2 px-3 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg text-sm text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"]}),null,16,IQ),[[g.vModelDynamic,t.value]])])}const Yu=xt(TQ,[["render",LQ],["__scopeId","data-v-57c239b9"]]);var as=63710088e-1,ME={centimeters:as*100,centimetres:as*100,degrees:as/111325,feet:as*3.28084,inches:as*39.37,kilometers:as/1e3,kilometres:as/1e3,meters:as,metres:as,miles:as/1609.344,millimeters:as*1e3,millimetres:as*1e3,nauticalmiles:as/1852,radians:1,yards:as*1.0936},OB={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/as,yards:1.0936133},AE={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Ko(t,e,n){n===void 0&&(n={});var r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function DB(t,e,n){switch(t){case"Point":return Qn(e).geometry;case"LineString":return li(e).geometry;case"Polygon":return ur(e).geometry;case"MultiPoint":return db(e).geometry;case"MultiLineString":return lp(e).geometry;case"MultiPolygon":return pl(e).geometry;default:throw new Error(t+" is invalid")}}function Qn(t,e,n){if(n===void 0&&(n={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!cs(t[0])||!cs(t[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:t};return Ko(r,e,n)}function RB(t,e,n){return n===void 0&&(n={}),Pn(t.map(function(r){return Qn(r,e)}),n)}function ur(t,e,n){n===void 0&&(n={});for(var r=0,i=t;r=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n}function dv(t,e){e===void 0&&(e="kilometers");var n=ME[e];if(!n)throw new Error(e+" units is invalid");return t*n}function Zm(t,e){e===void 0&&(e="kilometers");var n=ME[e];if(!n)throw new Error(e+" units is invalid");return t/n}function IE(t,e){return cp(Zm(t,e))}function Xm(t){var e=t%360;return e<0&&(e+=360),e}function cp(t){var e=t%(2*Math.PI);return e*180/Math.PI}function ls(t){var e=t%360;return e*Math.PI/180}function Km(t,e,n){if(e===void 0&&(e="kilometers"),n===void 0&&(n="kilometers"),!(t>=0))throw new Error("length must be a positive number");return dv(Zm(t,e),n)}function WA(t,e,n){if(e===void 0&&(e="meters"),n===void 0&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var r=AE[e];if(!r)throw new Error("invalid original units");var i=AE[n];if(!i)throw new Error("invalid final units");return t/r*i}function cs(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function yi(t){return!!t&&t.constructor===Object}function zB(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(t.length!==4&&t.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(function(e){if(!cs(e))throw new Error("bbox must only contain numbers")})}function VB(t){if(!t)throw new Error("id is required");if(["string","number"].indexOf(typeof t)===-1)throw new Error("id must be a number or a string")}const jB=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:AE,bearingToAzimuth:Xm,convertArea:WA,convertLength:Km,degreesToRadians:ls,earthRadius:as,factors:ME,feature:Ko,featureCollection:Pn,geometry:DB,geometryCollection:HA,isNumber:cs,isObject:yi,lengthToDegrees:IE,lengthToRadians:Zm,lineString:li,lineStrings:FB,multiLineString:lp,multiPoint:db,multiPolygon:pl,point:Qn,points:RB,polygon:ur,polygons:BB,radiansToDegrees:cp,radiansToLength:dv,round:$B,unitsFactors:OB,validateBBox:zB,validateId:VB},Symbol.toStringTag,{value:"Module"}));function Eo(t,e,n){if(t!==null)for(var r,i,o,s,a,l,c,u=0,d=0,p,m=t.type,y=m==="FeatureCollection",w=m==="Feature",x=y?t.features.length:1,C=0;Cl||y>c||w>u){a=d,l=r,c=y,u=w,o=0;return}var x=li([a,d],n.properties);if(e(x,r,i,w,o)===!1)return!1;o++,a=d})===!1)return!1}}})}function XA(t,e,n){var r=n,i=!1;return jd(t,function(o,s,a,l,c){i===!1&&n===void 0?r=o:r=e(r,o,s,a,l,c),i=!0}),r}function KA(t,e){if(!t)throw new Error("geojson is required");Os(t,function(n,r,i){if(n.geometry!==null){var o=n.geometry.type,s=n.geometry.coordinates;switch(o){case"LineString":if(e(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var a=0;an[0]&&(e[0]=n[0]),e[1]>n[1]&&(e[1]=n[1]),e[2]=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function $n(t){if(Array.isArray(t))return t;if(t.type==="Feature"){if(t.geometry!==null)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function QA(t){if(t.length>1&&cs(t[0])&&cs(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return QA(t[0]);throw new Error("coordinates must only contain numbers")}function YB(t,e,n){if(!e||!n)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.type)}function fb(t,e,n){if(!t)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!t||t.type!=="Feature"||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)}function Ud(t,e,n){if(!t)throw new Error("No featureCollection passed");if(!n)throw new Error(".collectionOf() requires a name");if(!t||t.type!=="FeatureCollection")throw new Error("Invalid input to "+n+", FeatureCollection required");for(var r=0,i=t.features;r * v. 1.2.0 * https://github.com/RaumZeit/MarchingSquares.js * * MarchingSquaresJS is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * MarchingSquaresJS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * As additional permission under GNU Affero General Public License version 3 * section 7, third-party projects (personal or commercial) may distribute, * include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the * requirement that said third-party project for that reason alone becomes * subject to any requirement of the GNU Affero General Public License version 3. * Any modifications to MarchingSquaresJS, however, must be shared with the public * and made available. * * In summary this: * - allows you to use MarchingSquaresJS at no cost * - allows you to use MarchingSquaresJS for both personal and commercial purposes * - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any * license as long as this license notice is included * - enables you to keep the source code of your program that uses MarchingSquaresJS * undisclosed * - forces you to share any modifications you have made to MarchingSquaresJS, * e.g. bug-fixes * * You should have received a copy of the GNU Affero General Public License * along with MarchingSquaresJS. If not, see . */var XB={successCallback:null,verbose:!1},PE={};function $Q(t,e,n){n=n||{};for(var r=Object.keys(XB),i=0;i=e?8:0,a|=c>=e?4:0,a|=u>=e?2:0,a|=d>=e?1:0;var p=!1;if(a===5||a===10){var m=(l+c+u+d)/4;a===5&&m=0;p--)if(Math.abs(e[p][0][0]-u)<=r&&Math.abs(e[p][0][1]-d)<=r){for(var m=l.path.length-2;m>=0;--m)e[p].unshift(l.path[m]);c=!0;break}}c||(e[n++]=l.path)}})}),e}function UQ(t,e,n){var r=t.length,i=[],o=[0,0,1,1,0,0,0,0,-1,0,1,1,-1,0,-1,0],s=[0,-1,0,0,1,1,1,1,0,-1,0,0,0,-1,0,0],a,l,c=["none","left","bottom","left","right","none","bottom","left","top","top","none","top","right","right","bottom","none"],u=["none","bottom","right","right","top","top","top","top","left","bottom","right","right","left","bottom","left","none"],m,d=t[e][n],p=d.cval,m=c[p],y=tI(d,m);i.push([n+y[0],e+y[1]]),m=u[p],y=tI(d,m),i.push([n+y[0],e+y[1]]),JB(d);for(var w=n+o[p],x=e+s[p],C=p;w>=0&&x>=0&&x"u"));){if(p=d.cval,p===0||p===15)return{path:i,info:"mergeable"};m=u[p],a=o[p],l=s[p],(p===5||p===10)&&(p===5?d.flipped?s[C]===-1?(m="left",a=-1,l=0):(m="right",a=1,l=0):o[C]===-1&&(m="bottom",a=0,l=-1):p===10&&(d.flipped?o[C]===-1?(m="top",a=0,l=1):(m="bottom",a=0,l=-1):s[C]===1&&(m="left",a=-1,l=0))),y=tI(d,m),i.push([w+y[0],x+y[1]]),JB(d),w+=a,x+=l,C=p}return{path:i,info:"closed"}}function HQ(t,e){if(e=e||{},!yi(e))throw new Error("options is invalid");var n=e.zProperty||"elevation",r=e.flip,i=e.flags;Ud(t,"Point","input must contain Points");for(var o=WQ(t,r),s=[],a=0;aW;){if(J-W>600){var q=J-W+1,j=$-W+1,G=Math.log(q),U=.5*Math.exp(2*G/3),Q=.5*Math.sqrt(G*U*(q-U)/q)*(j-q/2<0?-1:1),re=Math.max(W,Math.floor($-j*U/q+Q)),le=Math.min(J,Math.floor($+(q-j)*U/q+Q));O(z,$,re,le,Z)}var oe=z[$],he=W,xe=J;for(r(z,W,$),Z(z[J],oe)>0&&r(z,W,J);he0;)xe--}Z(z[W],oe)===0?r(z,W,xe):r(z,++xe,J),xe<=$&&(W=xe+1),$<=xe&&(J=xe-1)}})(S,M,E||0,A||S.length-1,I||i)}function r(S,M,E){var A=S[M];S[M]=S[E],S[E]=A}function i(S,M){return SM?1:0}var o=function(S){S===void 0&&(S=9),this._maxEntries=Math.max(4,S),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function s(S,M,E){if(!E)return M.indexOf(S);for(var A=0;A=S.minX&&M.maxY>=S.minY}function x(S){return{children:S,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function C(S,M,E,A,I){for(var O=[M,E];O.length;)if(!((E=O.pop())-(M=O.pop())<=A)){var z=M+Math.ceil((E-M)/A/2)*A;n(S,z,M,E,I),O.push(M,z,z,E)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(S){var M=this.data,E=[];if(!w(S,M))return E;for(var A=this.toBBox,I=[];M;){for(var O=0;O=0&&I[M].children.length>this._maxEntries;)this._split(I,M),M--;this._adjustParentBBoxes(A,I,M)},o.prototype._split=function(S,M){var E=S[M],A=E.children.length,I=this._minEntries;this._chooseSplitAxis(E,I,A);var O=this._chooseSplitIndex(E,I,A),z=x(E.children.splice(O,E.children.length-O));z.height=E.height,z.leaf=E.leaf,a(E,this.toBBox),a(z,this.toBBox),M?S[M-1].children.push(z):this._splitRoot(E,z)},o.prototype._splitRoot=function(S,M){this.data=x([S,M]),this.data.height=S.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(S,M,E){for(var A,I,O,z,$,W,J,Z=1/0,q=1/0,j=M;j<=E-M;j++){var G=l(S,0,j,this.toBBox),U=l(S,j,E,this.toBBox),Q=(I=G,O=U,z=void 0,$=void 0,W=void 0,J=void 0,z=Math.max(I.minX,O.minX),$=Math.max(I.minY,O.minY),W=Math.min(I.maxX,O.maxX),J=Math.min(I.maxY,O.maxY),Math.max(0,W-z)*Math.max(0,J-$)),re=p(G)+p(U);Q=M;Z--){var q=S.children[Z];c(z,S.leaf?I(q):q),$+=m(z)}return $},o.prototype._adjustParentBBoxes=function(S,M,E){for(var A=E;A>=0;A--)c(M[A],S)},o.prototype._condense=function(S){for(var M=S.length-1,E=void 0;M>=0;M--)S[M].children.length===0?M>0?(E=S[M-1].children).splice(E.indexOf(S[M]),1):this.clear():a(S[M],this.toBBox)},o})})(QB);var ZQ=QB.exports;class XQ{constructor(e=[],n=KQ){if(this.data=e,this.length=this.data.length,this.compare=n,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:n,compare:r}=this,i=n[e];for(;e>0;){const o=e-1>>1,s=n[o];if(r(i,s)>=0)break;n[e]=s,e=o}n[e]=i}_down(e){const{data:n,compare:r}=this,i=this.length>>1,o=n[e];for(;e=0)break;n[e]=a,e=s}n[e]=o}}function KQ(t,e){return te?1:0}const JQ=LE(Object.freeze(Object.defineProperty({__proto__:null,default:XQ},Symbol.toStringTag,{value:"Module"})));var NE={exports:{}},QQ=function(e,n,r,i){var o=e[0],s=e[1],a=!1;r===void 0&&(r=0),i===void 0&&(i=n.length);for(var l=(i-r)/2,c=0,u=l-1;cs!=y>s&&o<(m-d)*(s-p)/(y-p)+d;w&&(a=!a)}return a},eee=function(e,n,r,i){var o=e[0],s=e[1],a=!1;r===void 0&&(r=0),i===void 0&&(i=n.length);for(var l=i-r,c=0,u=l-1;cs!=y>s&&o<(m-d)*(s-p)/(y-p)+d;w&&(a=!a)}return a},eF=QQ,tF=eee;NE.exports=function(e,n,r,i){return n.length>0&&Array.isArray(n[0])?tF(e,n,r,i):eF(e,n,r,i)},NE.exports.nested=tF,NE.exports.flat=eF;var tee=NE.exports,rI={exports:{}};(function(t,e){(function(n,r){r(e)})(pb,function(n){const i=33306690738754706e-32;function o(w,x,C,S,M){let E,A,I,O,z=x[0],$=S[0],W=0,J=0;$>z==$>-z?(E=z,z=x[++W]):(E=$,$=S[++J]);let Z=0;if(Wz==$>-z?(I=E-((A=z+E)-z),z=x[++W]):(I=E-((A=$+E)-$),$=S[++J]),E=A,I!==0&&(M[Z++]=I);Wz==$>-z?(I=E-((A=E+z)-(O=A-E))+(z-O),z=x[++W]):(I=E-((A=E+$)-(O=A-E))+($-O),$=S[++J]),E=A,I!==0&&(M[Z++]=I);for(;W0!=I>0)return O;const z=Math.abs(A+I);return Math.abs(O)>=a*z?O:-function($,W,J,Z,q,j,G){let U,Q,re,le,oe,he,xe,Ee,Ie,Oe,$e,Ze,lt,pt,yt,Lt,hn,Ht;const wn=$-q,cn=J-q,Hn=W-j,Bn=Z-j;oe=(yt=(Ee=wn-(xe=(he=134217729*wn)-(he-wn)))*(Oe=Bn-(Ie=(he=134217729*Bn)-(he-Bn)))-((pt=wn*Bn)-xe*Ie-Ee*Ie-xe*Oe))-($e=yt-(hn=(Ee=Hn-(xe=(he=134217729*Hn)-(he-Hn)))*(Oe=cn-(Ie=(he=134217729*cn)-(he-cn)))-((Lt=Hn*cn)-xe*Ie-Ee*Ie-xe*Oe))),u[0]=yt-($e+oe)+(oe-hn),oe=(lt=pt-((Ze=pt+$e)-(oe=Ze-pt))+($e-oe))-($e=lt-Lt),u[1]=lt-($e+oe)+(oe-Lt),oe=(Ht=Ze+$e)-Ze,u[2]=Ze-(Ht-oe)+($e-oe),u[3]=Ht;let Ue=function(it,St){let an=St[0];for(let Ne=1;Ne=qe||-Ue>=qe||(U=$-(wn+(oe=$-wn))+(oe-q),re=J-(cn+(oe=J-cn))+(oe-q),Q=W-(Hn+(oe=W-Hn))+(oe-j),le=Z-(Bn+(oe=Z-Bn))+(oe-j),U===0&&Q===0&&re===0&&le===0)||(qe=c*G+i*Math.abs(Ue),(Ue+=wn*le+Bn*U-(Hn*re+cn*Q))>=qe||-Ue>=qe))return Ue;oe=(yt=(Ee=U-(xe=(he=134217729*U)-(he-U)))*(Oe=Bn-(Ie=(he=134217729*Bn)-(he-Bn)))-((pt=U*Bn)-xe*Ie-Ee*Ie-xe*Oe))-($e=yt-(hn=(Ee=Q-(xe=(he=134217729*Q)-(he-Q)))*(Oe=cn-(Ie=(he=134217729*cn)-(he-cn)))-((Lt=Q*cn)-xe*Ie-Ee*Ie-xe*Oe))),y[0]=yt-($e+oe)+(oe-hn),oe=(lt=pt-((Ze=pt+$e)-(oe=Ze-pt))+($e-oe))-($e=lt-Lt),y[1]=lt-($e+oe)+(oe-Lt),oe=(Ht=Ze+$e)-Ze,y[2]=Ze-(Ht-oe)+($e-oe),y[3]=Ht;const Et=o(4,u,4,y,d);oe=(yt=(Ee=wn-(xe=(he=134217729*wn)-(he-wn)))*(Oe=le-(Ie=(he=134217729*le)-(he-le)))-((pt=wn*le)-xe*Ie-Ee*Ie-xe*Oe))-($e=yt-(hn=(Ee=Hn-(xe=(he=134217729*Hn)-(he-Hn)))*(Oe=re-(Ie=(he=134217729*re)-(he-re)))-((Lt=Hn*re)-xe*Ie-Ee*Ie-xe*Oe))),y[0]=yt-($e+oe)+(oe-hn),oe=(lt=pt-((Ze=pt+$e)-(oe=Ze-pt))+($e-oe))-($e=lt-Lt),y[1]=lt-($e+oe)+(oe-Lt),oe=(Ht=Ze+$e)-Ze,y[2]=Ze-(Ht-oe)+($e-oe),y[3]=Ht;const qt=o(Et,d,4,y,p);oe=(yt=(Ee=U-(xe=(he=134217729*U)-(he-U)))*(Oe=le-(Ie=(he=134217729*le)-(he-le)))-((pt=U*le)-xe*Ie-Ee*Ie-xe*Oe))-($e=yt-(hn=(Ee=Q-(xe=(he=134217729*Q)-(he-Q)))*(Oe=re-(Ie=(he=134217729*re)-(he-re)))-((Lt=Q*re)-xe*Ie-Ee*Ie-xe*Oe))),y[0]=yt-($e+oe)+(oe-hn),oe=(lt=pt-((Ze=pt+$e)-(oe=Ze-pt))+($e-oe))-($e=lt-Lt),y[1]=lt-($e+oe)+(oe-Lt),oe=(Ht=Ze+$e)-Ze,y[2]=Ze-(Ht-oe)+($e-oe),y[3]=Ht;const rn=o(qt,p,4,y,m);return m[rn-1]}(w,x,C,S,M,E,z)},n.orient2dfast=function(w,x,C,S,M,E){return(x-E)*(C-M)-(w-M)*(S-E)},Object.defineProperty(n,"__esModule",{value:!0})})})(rI,rI.exports);var nee=rI.exports,nF=ZQ,OE=JQ,ree=tee,iee=nee.orient2d;OE.default&&(OE=OE.default),nI.exports=rF,nI.exports.default=rF;function rF(t,e,n){e=Math.max(0,e===void 0?2:e),n=n||0;var r=cee(t),i=new nF(16);i.toBBox=function(S){return{minX:S[0],minY:S[1],maxX:S[0],maxY:S[1]}},i.compareMinX=function(S,M){return S[0]-M[0]},i.compareMinY=function(S,M){return S[1]-M[1]},i.load(t);for(var o=[],s=0,a;so||a.push({node:u,dist:d})}for(;a.length&&!a.peek().node.children;){var p=a.pop(),m=p.node,y=sI(m,e,n),w=sI(m,r,i);if(p.dist=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function oF(t,e,n){for(var r=Math.min(t[0],e[0]),i=Math.min(t[1],e[1]),o=Math.max(t[0],e[0]),s=Math.max(t[1],e[1]),a=n.search({minX:r,minY:i,maxX:o,maxY:s}),l=0;l0!=pv(t,e,r)>0&&pv(n,r,t)>0!=pv(n,r,e)>0}function iI(t){var e=t.p,n=t.next.p;return t.minX=Math.min(e[0],n[0]),t.minY=Math.min(e[1],n[1]),t.maxX=Math.max(e[0],n[0]),t.maxY=Math.max(e[1],n[1]),t}function cee(t){for(var e=t[0],n=t[0],r=t[0],i=t[0],o=0;or[0]&&(r=s),s[1]i[1]&&(i=s)}var a=[e,n,r,i],l=a.slice();for(o=0;o1?(r=n[0],i=n[1]):a>0&&(r+=o*a,i+=s*a)}return o=t[0]-r,s=t[1]-i,o*o+s*s}function DE(t,e,n,r,i,o,s,a){var l=n-t,c=r-e,u=s-i,d=a-o,p=t-i,m=e-o,y=l*l+c*c,w=l*u+c*d,x=u*u+d*d,C=l*p+c*m,S=u*p+d*m,M=y*x-w*w,E,A,I,O,z=M,$=M;M===0?(A=0,z=1,O=S,$=x):(A=w*S-x*C,O=y*S-w*C,A<0?(A=0,O=S,$=x):A>z&&(A=z,O=S+w,$=x)),O<0?(O=0,-C<0?A=0:-C>y?A=z:(A=-C,z=y)):O>$&&(O=$,-C+w<0?A=0:-C+w>y?A=z:(A=-C+w,z=y)),E=A===0?0:A/z,I=O===0?0:O/$;var W=(1-E)*t+E*n,J=(1-E)*e+E*r,Z=(1-I)*i+I*s,q=(1-I)*o+I*a,j=Z-W,G=q-J;return j*j+G*G}function uee(t,e){return t[0]===e[0]?t[1]-e[1]:t[0]-e[0]}function hee(t){t.sort(uee);for(var e=[],n=0;n=2&&pv(e[e.length-2],e[e.length-1],t[n])<=0;)e.pop();e.push(t[n])}for(var r=[],i=t.length-1;i>=0;i--){for(;r.length>=2&&pv(r[r.length-2],r[r.length-1],t[i])<=0;)r.pop();r.push(t[i])}return r.pop(),e.pop(),e.concat(r)}var dee=nI.exports;const fee=gl(dee);function aF(t,e){e===void 0&&(e={}),e.concavity=e.concavity||1/0;var n=[];if(Eo(t,function(i){n.push([i[0],i[1]])}),!n.length)return null;var r=fee(n,e.concavity);return r.length>3?ur([r]):null}function Fi(t,e,n){if(n===void 0&&(n={}),!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var r=Ti(t),i=Bi(e),o=i.type,s=e.bbox,a=i.coordinates;if(s&&pee(r,s)===!1)return!1;o==="Polygon"&&(a=[a]);for(var l=!1,c=0;ct[1]!=c>t[1]&&t[0]<(l-s)*(t[1]-a)/(c-a)+s;d&&(r=!r)}return r}function pee(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}function aI(t,e){var n=[];return ii(t,function(r){var i=!1;if(r.geometry.type==="Point")jl(e,function(s){Fi(r,s)&&(i=!0)}),i&&n.push(r);else if(r.geometry.type==="MultiPoint"){var o=[];jl(e,function(s){Eo(r,function(a){Fi(a,s)&&(i=!0,o.push(a))})}),i&&n.push(db(o))}else throw new Error("Input geometry must be a Point or MultiPoint")}),Pn(n)}function vi(t,e,n){n===void 0&&(n={});var r=Ti(t),i=Ti(e),o=ls(i[1]-r[1]),s=ls(i[0]-r[0]),a=ls(r[1]),l=ls(i[1]),c=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(l);return dv(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),n.units)}function cF(t,e){var n=!1;return Pn(yee(t.features.map(function(r){var i={x:r.geometry.coordinates[0],y:r.geometry.coordinates[1]};return e?i.z=r.properties[e]:r.geometry.coordinates.length===3&&(n=!0,i.z=r.geometry.coordinates[2]),i})).map(function(r){var i=[r.a.x,r.a.y],o=[r.b.x,r.b.y],s=[r.c.x,r.c.y],a={};return n?(i.push(r.a.z),o.push(r.b.z),s.push(r.c.z)):a={a:r.a.z,b:r.b.z,c:r.c.z},ur([[i,o,s,i]],a)}))}var uF=function(){function t(e,n,r){this.a=e,this.b=n,this.c=r;var i=n.x-e.x,o=n.y-e.y,s=r.x-e.x,a=r.y-e.y,l=i*(e.x+n.x)+o*(e.y+n.y),c=s*(e.x+r.x)+a*(e.y+r.y),u=2*(i*(r.y-n.y)-o*(r.x-n.x)),d,p;this.x=(a*l-o*c)/u,this.y=(i*c-s*l)/u,d=this.x-e.x,p=this.y-e.y,this.r=d*d+p*p}return t}();function mee(t,e){return e.x-t.x}function gee(t){var e=t.length,n,r,i,o,s;e:for(;e;)for(r=t[--e],n=t[--e],i=e;i;)if(s=t[--i],o=t[--i],n===o&&r===s||n===s&&r===o){t.splice(e,2),t.splice(i,2),e-=2;continue e}}function yee(t){if(t.length<3)return[];t.sort(mee);for(var e=t.length-1,n=t[e].x,r=t[0].x,i=t[e].y,o=i,s=1e-12,a,l,c,u,d,p;e--;)t[e].yo&&(o=t[e].y);var m=r-n,y=o-i,w=m>y?m:y,x=(r+n)*.5,C=(o+i)*.5,S=[new uF({__sentinel:!0,x:x-20*w,y:C-w},{__sentinel:!0,x,y:C+20*w},{__sentinel:!0,x:x+20*w,y:C-w})],M=[],E=[],A;for(e=t.length;e--;){for(E.length=0,A=S.length;A--;){if(m=t[e].x-S[A].x,m>0&&m*m>S[A].r){M.push(S[A]),S.splice(A,1);continue}y=t[e].y-S[A].y,!(m*m+y*y>S[A].r)&&(E.push(S[A].a,S[A].b,S[A].b,S[A].c,S[A].c,S[A].a),S.splice(A,1))}for(gee(E),A=E.length;A;)l=E[--A],a=E[--A],c=t[e],u=l.x-a.x,d=l.y-a.y,p=2*(u*(c.y-l.y)-d*(c.x-l.x)),Math.abs(p)>s&&S.push(new uF(a,l,c))}for(Array.prototype.push.apply(M,S),e=M.length;e--;)(M[e].a.__sentinel||M[e].b.__sentinel||M[e].c.__sentinel)&&M.splice(e,1);return M}function Ks(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return hF(t);case"FeatureCollection":return vee(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return lI(t);default:throw new Error("unknown GeoJSON type")}}function hF(t){var e={type:"Feature"};return Object.keys(t).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:e[n]=t[n]}}),e.properties=dF(t.properties),e.geometry=lI(t.geometry),e}function dF(t){var e={};return t&&Object.keys(t).forEach(function(n){var r=t[n];typeof r=="object"?r===null?e[n]=null:Array.isArray(r)?e[n]=r.map(function(i){return i}):e[n]=dF(r):e[n]=r}),e}function vee(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach(function(n){switch(n){case"type":case"features":return;default:e[n]=t[n]}}),e.features=t.features.map(function(n){return hF(n)}),e}function lI(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),t.type==="GeometryCollection"?(e.geometries=t.geometries.map(function(n){return lI(n)}),e):(e.coordinates=fF(t.coordinates),e)}function fF(t){var e=t;return typeof e[0]!="object"?e.slice():e.map(function(n){return fF(n)})}function _ee(t,e){if(e===void 0&&(e={}),e=e||{},!yi(e))throw new Error("options is invalid");var n=e.mutate;if(ml(t)!=="FeatureCollection")throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");(n===!1||n===void 0)&&(t=Ks(t));var r=[],i=JA(t,function(o,s){var a=bee(o,s);return a||(r.push(o),s)});return i&&r.push(i),r.length?r.length===1?r[0]:lp(r.map(function(o){return o.coordinates})):null}function RE(t){return t[0].toString()+","+t[1].toString()}function bee(t,e){var n=t.geometry.coordinates,r=e.geometry.coordinates,i=RE(n[0]),o=RE(n[n.length-1]),s=RE(r[0]),a=RE(r[r.length-1]),l;if(i===a)l=r.concat(n.slice(1));else if(s===o)l=n.concat(r.slice(1));else if(i===s)l=n.slice(1).reverse().concat(r);else if(o===a)l=n.concat(r.reverse().slice(1));else return null;return li(l)}function wee(t){return t}function xee(t){if(t==null)return wee;var e,n,r=t.scale[0],i=t.scale[1],o=t.translate[0],s=t.translate[1];return function(a,l){l||(e=n=0);var c=2,u=a.length,d=new Array(u);for(d[0]=(e+=a[0])*r+o,d[1]=(n+=a[1])*i+s;c1)for(var d=1,p=a(c[0]),m,y;dp&&(y=c[0],c[0]=c[d],c[d]=y,p=m);return c}).filter(function(l){return l.length>0})}}var cI=Object.prototype.hasOwnProperty;function Mee(t){var e=1/0,n=1/0,r=-1/0,i=-1/0;function o(d){d!=null&&cI.call(s,d.type)&&s[d.type](d)}var s={GeometryCollection:function(d){d.geometries.forEach(o)},Point:function(d){a(d.coordinates)},MultiPoint:function(d){d.coordinates.forEach(a)},LineString:function(d){l(d.arcs)},MultiLineString:function(d){d.arcs.forEach(l)},Polygon:function(d){d.arcs.forEach(l)},MultiPolygon:function(d){d.arcs.forEach(c)}};function a(d){var p=d[0],m=d[1];pr&&(r=p),mi&&(i=m)}function l(d){d.forEach(a)}function c(d){d.forEach(l)}for(var u in t)o(t[u]);return r>=e&&i>=n?[e,n,r,i]:void 0}function Aee(t,e,n,r,i){arguments.length===3&&(r=Array,i=null);for(var o=new r(t=1<=t)throw new Error("full hashset");m=o[p=p+1&s]}return o[p]=d,!0}function c(d){for(var p=e(d)&s,m=o[p],y=0;m!=i;){if(n(m,d))return!0;if(++y>=t)break;m=o[p=p+1&s]}return!1}function u(){for(var d=[],p=0,m=o.length;p=t)throw new Error("full hashmap");C=s[x=x+1&l]}return s[x]=y,a[x]=w,w}function d(y,w){for(var x=e(y)&l,C=s[x],S=0;C!=i;){if(n(C,y))return a[x];if(++S>=t)throw new Error("full hashmap");C=s[x=x+1&l]}return s[x]=y,a[x]=w,w}function p(y,w){for(var x=e(y)&l,C=s[x],S=0;C!=i;){if(n(C,y))return a[x];if(++S>=t)break;C=s[x=x+1&l]}return w}function m(){for(var y=[],w=0,x=s.length;w>7^BE[2]^BE[3],e&2147483647}function Iee(t){var e=t.coordinates,n=t.lines,r=t.rings,i=I(),o=new Int32Array(e.length),s=new Int32Array(e.length),a=new Int32Array(e.length),l=new Int8Array(e.length),c=0,u,d,p,m,y;for(u=0,d=e.length;u=0){var U=a[q];(G!==Z||U!==j)&&(G!==j||U!==Z)&&(++c,l[q]=1)}else s[q]=Z,a[q]=j}}function I(){for(var J=uI(e.length*1.4,O,z,Int32Array,-1,Int32Array),Z=new Int32Array(e.length),q=0,j=e.length;q>1),i;el;){if(c-l>600){var d=c-l+1,p=a-l+1,m=Math.log(d),y=.5*Math.exp(2*m/3),w=.5*Math.sqrt(m*y*(d-y)/d)*(p-d/2<0?-1:1),x=Math.max(l,Math.floor(a-p*y/d+w)),C=Math.min(c,Math.floor(a+(d-p)*y/d+w));r(s,a,x,C,u)}var S=s[a],M=l,E=c;for(i(s,l,a),u(s[c],S)>0&&i(s,l,c);M0;)E--}u(s[l],S)===0?i(s,l,E):(E++,i(s,E,c)),E<=a&&(l=E+1),a<=E&&(c=E-1)}}function i(s,a,l){var c=s[a];s[a]=s[l],s[l]=c}function o(s,a){return sa?1:0}return n})})(vF);var Gee=vF.exports;pI.exports=mb,pI.exports.default=mb;var qee=Gee;function mb(t,e){if(!(this instanceof mb))return new mb(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),e&&this._initFormat(e),this.clear()}mb.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,n=[],r=this.toBBox;if(!$E(t,e))return n;for(var i=[],o,s,a,l;e;){for(o=0,s=e.children.length;o=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(i,o,e)},_split:function(t,e){var n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);var o=this._chooseSplitIndex(n,i,r),s=gv(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,mv(n,this.toBBox),mv(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)},_splitRoot:function(t,e){this.data=gv([t,e]),this.data.height=t.height+1,this.data.leaf=!1,mv(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,n){var r,i,o,s,a,l,c,u;for(l=c=1/0,r=e;r<=n-e;r++)i=gb(t,0,r,this.toBBox),o=gb(t,r,n,this.toBBox),s=Xee(i,o),a=mI(i)+mI(o),s=e;l--)c=t.children[l],yb(s,t.leaf?i(c):c),a+=FE(s);return a},_adjustParentBBoxes:function(t,e,n){for(var r=n;r>=0;r--)yb(e[r],t)},_condense:function(t){for(var e=t.length-1,n;e>=0;e--)t[e].children.length===0?e>0?(n=t[e-1].children,n.splice(n.indexOf(t[e]),1)):this.clear():mv(t[e],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}};function Yee(t,e,n){if(!n)return e.indexOf(t);for(var r=0;r=t.minX&&e.maxY>=t.minY}function gv(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function wF(t,e,n,r,i){for(var o=[e,n],s;o.length;)n=o.pop(),e=o.pop(),!(n-e<=r)&&(s=e+Math.ceil((n-e)/r/2)*r,qee(t,s,e,n,i),o.push(e,s,s,n))}var Kee=pI.exports;const yI=gl(Kee);function Jee(t,e,n,r){var i=yI(6),o=e.features.map(function(s){var a;return{minX:s.geometry.coordinates[0],minY:s.geometry.coordinates[1],maxX:s.geometry.coordinates[0],maxY:s.geometry.coordinates[1],property:(a=s.properties)===null||a===void 0?void 0:a[n]}});return i.load(o),t.features.forEach(function(s){s.properties||(s.properties={});var a=Ri(s),l=i.search({minX:a[0],minY:a[1],maxX:a[2],maxY:a[3]}),c=[];l.forEach(function(u){Fi([u.minX,u.minY],s)&&c.push(u.property)}),s.properties[r]=c}),t}function Qee(t,e){if(e=e||{},!yi(e))throw new Error("options is invalid");var n=e.mutate;if(!t)throw new Error("geojson is required");return(n===!1||n===void 0)&&(t=Ks(t)),Eo(t,function(r){var i=r[0],o=r[1];r[0]=o,r[1]=i}),t}function Qm(t,e){e===void 0&&(e={});var n=typeof e=="object"?e.mutate:e;if(!t)throw new Error("geojson is required");var r=ml(t),i=[];switch(r){case"LineString":i=vI(t);break;case"MultiLineString":case"Polygon":$n(t).forEach(function(s){i.push(vI(s))});break;case"MultiPolygon":$n(t).forEach(function(s){var a=[];s.forEach(function(l){a.push(vI(l))}),i.push(a)});break;case"Point":return t;case"MultiPoint":var o={};$n(t).forEach(function(s){var a=s.join("-");Object.prototype.hasOwnProperty.call(o,a)||(i.push(s),o[a]=!0)});break;default:throw new Error(r+" geometry not supported")}return t.coordinates?n===!0?(t.coordinates=i,t):{type:r,coordinates:i}:n===!0?(t.geometry.coordinates=i,t):Ko({type:r,coordinates:i},t.properties,{bbox:t.bbox,id:t.id})}function vI(t){var e=$n(t);if(e.length===2&&!xF(e[0],e[1]))return e;var n=[],r=e.length-1,i=n.length;n.push(e[0]);for(var o=1;o2&&EF(n[i-3],n[i-1],n[i-2])&&n.splice(n.length-2,1))}if(n.push(e[e.length-1]),i=n.length,xF(e[0],e[e.length-1])&&i<4)throw new Error("invalid polygon");return EF(n[i-3],n[i-1],n[i-2])&&n.splice(n.length-2,1),n}function xF(t,e){return t[0]===e[0]&&t[1]===e[1]}function EF(t,e,n){var r=n[0],i=n[1],o=t[0],s=t[1],a=e[0],l=e[1],c=r-o,u=i-s,d=a-o,p=l-s,m=c*p-u*d;return m!==0?!1:Math.abs(d)>=Math.abs(p)?d>0?o<=r&&r<=a:a<=r&&r<=o:p>0?s<=i&&i<=l:l<=i&&i<=s}function ete(t,e){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r}function tte(t,e,n){var r=e.x,i=e.y,o=n.x-r,s=n.y-i;if(o!==0||s!==0){var a=((t.x-r)*o+(t.y-i)*s)/(o*o+s*s);a>1?(r=n.x,i=n.y):a>0&&(r+=o*a,i+=s*a)}return o=t.x-r,s=t.y-i,o*o+s*s}function nte(t,e){for(var n=t[0],r=[n],i,o=1,s=t.length;oe&&(r.push(i),n=i);return n!==i&&r.push(i),r}function _I(t,e,n,r,i){for(var o=r,s,a=e+1;ao&&(s=a,o=l)}o>r&&(s-e>1&&_I(t,e,s,r,i),i.push(t[s]),n-s>1&&_I(t,s,n,r,i))}function rte(t,e){var n=t.length-1,r=[t[0]];return _I(t,0,n,e,r),r.push(t[n]),r}function bI(t,e,n){if(t.length<=2)return t;var r=e!==void 0?e*e:1;return t=n?t:nte(t,r),t=rte(t,r),t}function ite(t,e){if(e=e||{},!yi(e))throw new Error("options is invalid");var n=e.tolerance!==void 0?e.tolerance:1,r=e.highQuality||!1,i=e.mutate||!1;if(!t)throw new Error("geojson is required");if(n&&n<0)throw new Error("invalid tolerance");return i!==!0&&(t=Ks(t)),jl(t,function(o){ote(o,n,r)}),t}function ote(t,e,n){var r=t.type;if(r==="Point"||r==="MultiPoint")return t;Qm(t,!0);var i=t.coordinates;switch(r){case"LineString":t.coordinates=SF(i,e,n);break;case"MultiLineString":t.coordinates=i.map(function(o){return SF(o,e,n)});break;case"Polygon":t.coordinates=CF(i,e,n);break;case"MultiPolygon":t.coordinates=i.map(function(o){return CF(o,e,n)})}return t}function SF(t,e,n){return bI(t.map(function(r){return{x:r[0],y:r[1],z:r[2]}}),e,n).map(function(r){return r.z?[r.x,r.y,r.z]:[r.x,r.y]})}function CF(t,e,n){return t.map(function(r){var i=r.map(function(s){return{x:s[0],y:s[1]}});if(i.length<4)throw new Error("invalid polygon");for(var o=bI(i,e,n).map(function(s){return[s.x,s.y]});!ste(o);)e-=e*.01,o=bI(i,e,n).map(function(s){return[s.x,s.y]});return(o[o.length-1][0]!==o[0][0]||o[o.length-1][1]!==o[0][1])&&o.push(o[0]),o})}function ste(t){return t.length<3?!1:!(t.length===3&&t[2][0]===t[0][0]&&t[2][1]===t[0][1])}var ate=function(){function t(e){this.points=e.points||[],this.duration=e.duration||1e4,this.sharpness=e.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=e.stepLength||60,this.length=this.points.length,this.delay=0;for(var n=0;ne&&(n.push(i),r=o)}return n},t.prototype.vector=function(e){var n=this.pos(e+10),r=this.pos(e-10);return{angle:180*Math.atan2(n.y-r.y,n.x-r.x)/3.14,speed:Math.sqrt((r.x-n.x)*(r.x-n.x)+(r.y-n.y)*(r.y-n.y)+(r.z-n.z)*(r.z-n.z))}},t.prototype.pos=function(e){var n=e-this.delay;n<0&&(n=0),n>this.duration&&(n=this.duration-1);var r=n/this.duration;if(r>=1)return this.points[this.length-1];var i=Math.floor((this.points.length-1)*r),o=(this.length-1)*r-i;return lte(o,this.points[i],this.controls[i][1],this.controls[i+1][0],this.points[i+1])},t}();function lte(t,e,n,r,i){var o=cte(t),s={x:i.x*o[0]+r.x*o[1]+n.x*o[2]+e.x*o[3],y:i.y*o[0]+r.y*o[1]+n.y*o[2]+e.y*o[3],z:i.z*o[0]+r.z*o[1]+n.z*o[2]+e.z*o[3]};return s}function cte(t){var e=t*t,n=e*t;return[n,3*e*(1-t),3*t*(1-t)*(1-t),(1-t)*(1-t)*(1-t)]}function kF(t,e){e===void 0&&(e={});for(var n=e.resolution||1e4,r=e.sharpness||.85,i=[],o=Bi(t).coordinates.map(function(c){return{x:c[0],y:c[1]}}),s=new ate({duration:n,points:o,sharpness:r}),a=function(c){var u=s.pos(c);Math.floor(c/100)%2===0&&i.push([u.x,u.y])},l=0;li;)s=Math.floor((r+1)*Math.random()),o=n[s],n[s]=n[r],n[r]=o;return n.slice(i)}function wI(t,e){e===void 0&&(e={});var n=Number(t[0]),r=Number(t[1]),i=Number(t[2]),o=Number(t[3]);if(t.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var s=[n,r],a=[n,o],l=[i,o],c=[i,r];return ur([[s,c,l,a,s]],e.properties,{bbox:t,id:e.id})}function TF(t){return wI(Ri(t))}function MF(t){var e=t[0],n=t[1],r=t[2],i=t[3],o=vi(t.slice(0,2),[r,n]),s=vi(t.slice(0,2),[e,i]);if(o>=s){var a=(n+i)/2;return[e,a-(r-e)/2,r,a+(r-e)/2]}else{var l=(e+r)/2;return[l-(i-n)/2,n,l+(i-n)/2,i]}}function $h(t,e,n,r){r===void 0&&(r={});var i=Ti(t),o=ls(i[0]),s=ls(i[1]),a=ls(n),l=Zm(e,r.units),c=Math.asin(Math.sin(s)*Math.cos(l)+Math.cos(s)*Math.sin(l)*Math.cos(a)),u=o+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(s),Math.cos(l)-Math.sin(s)*Math.sin(c)),d=cp(u),p=cp(c);return Qn([d,p],r.properties)}function xI(t,e,n){n===void 0&&(n={});for(var r=n.steps||64,i=n.properties?n.properties:!Array.isArray(t)&&t.type==="Feature"&&t.properties?t.properties:{},o=[],s=0;s80*n){a=c=t[0],l=u=t[1];for(var y=n;yc&&(c=d),p>u&&(u=p);m=Math.max(c-a,u-l),m=m!==0?32767/m:0}return vb(o,s,n,a,l,m,0),s}function IF(t,e,n,r,i){var o,s;if(i===kI(t,e,n,r)>0)for(o=e;o=e;o-=r)s=NF(o,t[o],t[o+1],s);return s&&jE(s,s.next)&&(bb(s),s=s.next),s}function eg(t,e){if(!t)return t;e||(e=t);var n=t,r;do if(r=!1,!n.steiner&&(jE(n,n.next)||Lo(n.prev,n,n.next)===0)){if(bb(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function vb(t,e,n,r,i,o,s){if(t){!s&&o&&Cte(t,r,i,o);for(var a=t,l,c;t.prev!==t.next;){if(l=t.prev,c=t.next,o?yte(t,r,i,o):gte(t)){e.push(l.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),bb(t),t=c.next,a=c.next;continue}if(t=c,t===a){s?s===1?(t=vte(eg(t),e,n),vb(t,e,n,r,i,o,2)):s===2&&_te(t,e,n,r,i,o):vb(eg(t),e,n,r,i,o,1);break}}}}function gte(t){var e=t.prev,n=t,r=t.next;if(Lo(e,n,r)>=0)return!1;for(var i=e.x,o=n.x,s=r.x,a=e.y,l=n.y,c=r.y,u=io?i>s?i:s:o>s?o:s,m=a>l?a>c?a:c:l>c?l:c,y=r.next;y!==e;){if(y.x>=u&&y.x<=p&&y.y>=d&&y.y<=m&&yv(i,a,o,l,s,c,y.x,y.y)&&Lo(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function yte(t,e,n,r){var i=t.prev,o=t,s=t.next;if(Lo(i,o,s)>=0)return!1;for(var a=i.x,l=o.x,c=s.x,u=i.y,d=o.y,p=s.y,m=al?a>c?a:c:l>c?l:c,x=u>d?u>p?u:p:d>p?d:p,C=SI(m,y,e,n,r),S=SI(w,x,e,n,r),M=t.prevZ,E=t.nextZ;M&&M.z>=C&&E&&E.z<=S;){if(M.x>=m&&M.x<=w&&M.y>=y&&M.y<=x&&M!==i&&M!==s&&yv(a,u,l,d,c,p,M.x,M.y)&&Lo(M.prev,M,M.next)>=0||(M=M.prevZ,E.x>=m&&E.x<=w&&E.y>=y&&E.y<=x&&E!==i&&E!==s&&yv(a,u,l,d,c,p,E.x,E.y)&&Lo(E.prev,E,E.next)>=0))return!1;E=E.nextZ}for(;M&&M.z>=C;){if(M.x>=m&&M.x<=w&&M.y>=y&&M.y<=x&&M!==i&&M!==s&&yv(a,u,l,d,c,p,M.x,M.y)&&Lo(M.prev,M,M.next)>=0)return!1;M=M.prevZ}for(;E&&E.z<=S;){if(E.x>=m&&E.x<=w&&E.y>=y&&E.y<=x&&E!==i&&E!==s&&yv(a,u,l,d,c,p,E.x,E.y)&&Lo(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function vte(t,e,n){var r=t;do{var i=r.prev,o=r.next.next;!jE(i,o)&&LF(i,r,r.next,o)&&_b(i,o)&&_b(o,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(o.i/n|0),bb(r),bb(r.next),r=t=o),r=r.next}while(r!==t);return eg(r)}function _te(t,e,n,r,i,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&Mte(s,a)){var l=PF(s,a);s=eg(s,s.next),l=eg(l,l.next),vb(s,e,n,r,i,o,0),vb(l,e,n,r,i,o,0);return}a=a.next}s=s.next}while(s!==t)}function bte(t,e,n,r){var i=[],o,s,a,l,c;for(o=0,s=e.length;o=n.next.y&&n.next.y!==n.y){var a=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=r&&a>o&&(o=a,s=n.x=n.x&&n.x>=c&&r!==n.x&&yv(is.x||n.x===s.x&&Ste(s,n)))&&(s=n,d=p)),n=n.next;while(n!==l);return s}function Ste(t,e){return Lo(t.prev,t,e.prev)<0&&Lo(e.next,t,t.next)<0}function Cte(t,e,n,r){var i=t;do i.z===0&&(i.z=SI(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,kte(i)}function kte(t){var e,n,r,i,o,s,a,l,c=1;do{for(n=t,t=null,o=null,s=0;n;){for(s++,r=n,a=0,e=0;e0||l>0&&r;)a!==0&&(l===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,c*=2}while(s>1);return t}function SI(t,e,n,r,i){return t=(t-n)*i|0,e=(e-r)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Tte(t){var e=t,n=t;do(e.x=(t-s)*(o-a)&&(t-s)*(r-a)>=(n-s)*(e-a)&&(n-s)*(o-a)>=(i-s)*(r-a)}function Mte(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Ate(t,e)&&(_b(t,e)&&_b(e,t)&&Ite(t,e)&&(Lo(t.prev,t,e.prev)||Lo(t,e.prev,e))||jE(t,e)&&Lo(t.prev,t,t.next)>0&&Lo(e.prev,e,e.next)>0)}function Lo(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function jE(t,e){return t.x===e.x&&t.y===e.y}function LF(t,e,n,r){var i=HE(Lo(t,e,n)),o=HE(Lo(t,e,r)),s=HE(Lo(n,r,t)),a=HE(Lo(n,r,e));return!!(i!==o&&s!==a||i===0&&UE(t,n,e)||o===0&&UE(t,r,e)||s===0&&UE(n,t,r)||a===0&&UE(n,e,r))}function UE(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function HE(t){return t>0?1:t<0?-1:0}function Ate(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&LF(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function _b(t,e){return Lo(t.prev,t,t.next)<0?Lo(t,e,t.next)>=0&&Lo(t,t.prev,e)>=0:Lo(t,e,t.prev)<0||Lo(t,t.next,e)<0}function Ite(t,e){var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==t);return r}function PF(t,e){var n=new CI(t.i,t.x,t.y),r=new CI(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function NF(t,e,n,r){var i=new CI(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function bb(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function CI(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}VE.deviation=function(t,e,n,r){var i=e&&e.length,o=i?e[0]*n:t.length,s=Math.abs(kI(t,0,o,n));if(i)for(var a=0,l=e.length;a0&&(r+=t[i-1].length,n.holes.push(r))}return n};var Lte=EI.exports;const Pte=gl(Lte);function Nte(t){if(!t.geometry||t.geometry.type!=="Polygon"&&t.geometry.type!=="MultiPolygon")throw new Error("input must be a Polygon or MultiPolygon");var e={type:"FeatureCollection",features:[]};return t.geometry.type==="Polygon"?e.features=OF(t.geometry.coordinates):t.geometry.coordinates.forEach(function(n){e.features=e.features.concat(OF(n))}),e}function OF(t){var e=Ote(t),n=2,r=Pte(e.vertices,e.holes,n),i=[],o=[];r.forEach(function(l,c){var u=r[c];o.push([e.vertices[u*n],e.vertices[u*n+1]])});for(var s=0;s0&&(r+=t[i-1].length,n.holes.push(r))}return n}function WE(t,e){if(!t)throw new Error("targetPoint is required");if(!e)throw new Error("points is required");var n,r=1/0,i=0;return ii(e,function(o,s){var a=vi(t,o);ai?n:i,c=r>o?r:o;return[s,a,l,c]}var TI={exports:{}},DF={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(pb,function(){function n(S,M,E,A,I){(function O(z,$,W,J,Z){for(;J>W;){if(J-W>600){var q=J-W+1,j=$-W+1,G=Math.log(q),U=.5*Math.exp(2*G/3),Q=.5*Math.sqrt(G*U*(q-U)/q)*(j-q/2<0?-1:1),re=Math.max(W,Math.floor($-j*U/q+Q)),le=Math.min(J,Math.floor($+(q-j)*U/q+Q));O(z,$,re,le,Z)}var oe=z[$],he=W,xe=J;for(r(z,W,$),Z(z[J],oe)>0&&r(z,W,J);he0;)xe--}Z(z[W],oe)===0?r(z,W,xe):r(z,++xe,J),xe<=$&&(W=xe+1),$<=xe&&(J=xe-1)}})(S,M,E||0,A||S.length-1,I||i)}function r(S,M,E){var A=S[M];S[M]=S[E],S[E]=A}function i(S,M){return SM?1:0}var o=function(S){S===void 0&&(S=9),this._maxEntries=Math.max(4,S),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function s(S,M,E){if(!E)return M.indexOf(S);for(var A=0;A=S.minX&&M.maxY>=S.minY}function x(S){return{children:S,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function C(S,M,E,A,I){for(var O=[M,E];O.length;)if(!((E=O.pop())-(M=O.pop())<=A)){var z=M+Math.ceil((E-M)/A/2)*A;n(S,z,M,E,I),O.push(M,z,z,E)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(S){var M=this.data,E=[];if(!w(S,M))return E;for(var A=this.toBBox,I=[];M;){for(var O=0;O=0&&I[M].children.length>this._maxEntries;)this._split(I,M),M--;this._adjustParentBBoxes(A,I,M)},o.prototype._split=function(S,M){var E=S[M],A=E.children.length,I=this._minEntries;this._chooseSplitAxis(E,I,A);var O=this._chooseSplitIndex(E,I,A),z=x(E.children.splice(O,E.children.length-O));z.height=E.height,z.leaf=E.leaf,a(E,this.toBBox),a(z,this.toBBox),M?S[M-1].children.push(z):this._splitRoot(E,z)},o.prototype._splitRoot=function(S,M){this.data=x([S,M]),this.data.height=S.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(S,M,E){for(var A,I,O,z,$,W,J,Z=1/0,q=1/0,j=M;j<=E-M;j++){var G=l(S,0,j,this.toBBox),U=l(S,j,E,this.toBBox),Q=(I=G,O=U,z=void 0,$=void 0,W=void 0,J=void 0,z=Math.max(I.minX,O.minX),$=Math.max(I.minY,O.minY),W=Math.min(I.maxX,O.maxX),J=Math.min(I.maxY,O.maxY),Math.max(0,W-z)*Math.max(0,J-$)),re=p(G)+p(U);Q=M;Z--){var q=S.children[Z];c(z,S.leaf?I(q):q),$+=m(z)}return $},o.prototype._adjustParentBBoxes=function(S,M,E){for(var A=E;A>=0;A--)c(M[A],S)},o.prototype._condense=function(S){for(var M=S.length-1,E=void 0;M>=0;M--)S[M].children.length===0?M>0?(E=S[M-1].children).splice(E.indexOf(S[M]),1):this.clear():a(S[M],this.toBBox)},o})})(DF);var Fte=DF.exports;const $te=LE(jB),zte=LE(qB),Vte=LE(PQ);var zh=Fte,RF=$te,BF=zte,vv=Vte.default,jte=BF.featureEach;BF.coordEach,RF.polygon;var FF=RF.featureCollection;function $F(t){var e=new zh(t);return e.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:vv(n),zh.prototype.insert.call(this,n)},e.load=function(n){var r=[];return Array.isArray(n)?n.forEach(function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:vv(i),r.push(i)}):jte(n,function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:vv(i),r.push(i)}),zh.prototype.load.call(this,r)},e.remove=function(n,r){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:vv(n),zh.prototype.remove.call(this,n,r)},e.clear=function(){return zh.prototype.clear.call(this)},e.search=function(n){var r=zh.prototype.search.call(this,this.toBBox(n));return FF(r)},e.collides=function(n){return zh.prototype.collides.call(this,this.toBBox(n))},e.all=function(){var n=zh.prototype.all.call(this);return FF(n)},e.toJSON=function(){return zh.prototype.toJSON.call(this)},e.fromJSON=function(n){return zh.prototype.fromJSON.call(this,n)},e.toBBox=function(n){var r;if(n.bbox)r=n.bbox;else if(Array.isArray(n)&&n.length===4)r=n;else if(Array.isArray(n)&&n.length===6)r=[n[0],n[1],n[3],n[4]];else if(n.type==="Feature")r=vv(n);else if(n.type==="FeatureCollection")r=vv(n);else throw new Error("invalid geojson");return{minX:r[0],minY:r[1],maxX:r[2],maxY:r[3]}},e}TI.exports=$F,TI.exports.default=$F;var Ute=TI.exports;const GE=gl(Ute);function Gd(t,e){var n={},r=[];if(t.type==="LineString"&&(t=Ko(t)),e.type==="LineString"&&(e=Ko(e)),t.type==="Feature"&&e.type==="Feature"&&t.geometry!==null&&e.geometry!==null&&t.geometry.type==="LineString"&&e.geometry.type==="LineString"&&t.geometry.coordinates.length===2&&e.geometry.coordinates.length===2){var i=zF(t,e);return i&&r.push(i),Pn(r)}var o=GE();return o.load(tg(e)),ii(tg(t),function(s){ii(o.search(s),function(a){var l=zF(s,a);if(l){var c=$n(l).join(",");n[c]||(n[c]=!0,r.push(l))}})}),Pn(r)}function zF(t,e){var n=$n(t),r=$n(e);if(n.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(r.length!==2)throw new Error(" line2 must only contain 2 coordinates");var i=n[0][0],o=n[0][1],s=n[1][0],a=n[1][1],l=r[0][0],c=r[0][1],u=r[1][0],d=r[1][1],p=(d-c)*(s-i)-(u-l)*(a-o),m=(u-l)*(o-c)-(d-c)*(i-l),y=(s-i)*(o-c)-(a-o)*(i-l);if(p===0)return null;var w=m/p,x=y/p;if(w>=0&&w<=1&&x>=0&&x<=1){var C=i+w*(s-i),S=o+w*(a-o);return Qn([C,S])}return null}function qd(t,e,n){n===void 0&&(n={});var r=Qn([1/0,1/0],{dist:1/0}),i=0;return Os(t,function(o){for(var s=$n(o),a=0;a0&&(x=w.features[0],x.properties.dist=vi(e,x,n),x.properties.location=i+vi(l,x,n)),l.properties.dist180?-360:r[0]-i[0]>180?360:0;var o=Hte(r,i),s=Km(o,"meters",n.units);return s}function Hte(t,e,n){n=n===void 0?as:Number(n);var r=n,i=t[1]*Math.PI/180,o=e[1]*Math.PI/180,s=o-i,a=Math.abs(e[0]-t[0])*Math.PI/180;a>Math.PI&&(a-=2*Math.PI);var l=Math.log(Math.tan(o/2+Math.PI/4)/Math.tan(i/2+Math.PI/4)),c=Math.abs(l)>1e-11?s/l:Math.cos(i),u=Math.sqrt(s*s+c*c*a*a),d=u*r;return d}function VF(t,e,n){if(n===void 0&&(n={}),n.method||(n.method="geodesic"),n.units||(n.units="kilometers"),!t)throw new Error("pt is required");if(Array.isArray(t)?t=Qn(t):t.type==="Point"?t=Ko(t):fb(t,"Point","point"),!e)throw new Error("line is required");Array.isArray(e)?e=li(e):e.type==="LineString"?e=Ko(e):fb(e,"LineString","line");var r=1/0,i=t.geometry.coordinates;return jd(e,function(o){var s=o.geometry.coordinates[0],a=o.geometry.coordinates[1],l=Wte(i,s,a,n);l=0&&c<=1&&(m.onLine1=!0),u>=0&&u<=1&&(m.onLine2=!0),m.onLine1&&m.onLine2?[m.x,m.y]:!1)}function UF(t){for(var e=Kte(t),n=Wd(e),r=!1,i=0;!r&&i0){e+=Math.abs(qF(t[0]));for(var n=1;n2){for(a=0;a=o&&s===i.length-1);s++)if(o>=e){var a=e-o;if(a){var l=Hd(i[s],i[s-1])-180,c=$h(i[s],a,l,n);return c}else return Qn(i[s])}else o+=vi(i[s],i[s+1],n);return Qn(i[i.length-1])}function ZE(t,e){return e===void 0&&(e={}),XA(t,function(n,r){var i=r.geometry.coordinates;return n+vi(i[0],i[1],e)},0)}function ene(t,e,n){var r=$n(n);if(ml(n)!=="LineString")throw new Error("line must be a LineString");var i=qd(n,t),o=qd(n,e),s;i.properties.index<=o.properties.index?s=[i,o]:s=[o,i];for(var a=[s[0].geometry.coordinates],l=s[0].properties.index+1;l=a&&d===i.length-1);d++){if(a>e&&o.length===0){if(l=e-a,!l)return o.push(i[d]),li(o);c=Hd(i[d],i[d-1])-180,u=$h(i[d],l,c,r),o.push(u.geometry.coordinates)}if(a>=n)return l=n-a,l?(c=Hd(i[d],i[d-1])-180,u=$h(i[d],l,c,r),o.push(u.geometry.coordinates),li(o)):(o.push(i[d]),li(o));if(a>=e&&o.push(i[d]),d===i.length-1)return li(o);a+=vi(i[d],i[d+1],r)}if(a"u"?null:n.epsilon))return!0}return!1}function tne(t,e,n,r,i){var o=n[0],s=n[1],a=t[0],l=t[1],c=e[0],u=e[1],d=n[0]-a,p=n[1]-l,m=c-a,y=u-l,w=d*y-p*m;if(i!==null){if(Math.abs(w)>i)return!1}else if(w!==0)return!1;if(r){if(r==="start")return Math.abs(m)>=Math.abs(y)?m>0?a0?l=Math.abs(y)?m>0?a<=o&&o0?l<=s&&s=Math.abs(y)?m>0?a0?l=Math.abs(y)?m>0?a<=o&&o<=c:c<=o&&o<=a:y>0?l<=s&&s<=u:u<=s&&s<=l;return!1}function ZF(t,e){var n=Bi(t),r=Bi(e),i=n.type,o=r.type;switch(i){case"Point":switch(o){case"MultiPoint":return nne(n,r);case"LineString":return Ul(n,r,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return Fi(n,r,{ignoreBoundary:!0});default:throw new Error("feature2 "+o+" geometry not supported")}case"MultiPoint":switch(o){case"MultiPoint":return rne(n,r);case"LineString":return ine(n,r);case"Polygon":case"MultiPolygon":return one(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"LineString":return sne(n,r);case"Polygon":case"MultiPolygon":return ane(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Polygon":case"MultiPolygon":return lne(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}}function nne(t,e){var n,r=!1;for(n=0;ne[0]||t[2]e[1]||t[3] is required");if(typeof n!="number")throw new Error(" must be a number");if(typeof r!="number")throw new Error(" must be a number");(i===!1||i===void 0)&&(t=JSON.parse(JSON.stringify(t)));var o=Math.pow(10,n);return Eo(t,function(s){une(s,o,r)}),t}function une(t,e,n){t.length>n&&t.splice(n,t.length);for(var r=0;r=1||W<=0||J>=1||J<=0)){var Z=$,q=!o[Z];q&&(o[Z]=!0),e?i.push(e($,C,S,A,I,W,M,E,O,z,J,q)):i.push($)}}}function x(C,S){var M=r[C][S],E=r[C][S+1],A,I,O,z;return M[0]l[Ie.isect].coord?-1:1});for(var O=[];C.length>0;){var z=C.pop(),$=z.isect,W=z.parent,J=z.winding,Z=O.length,q=[l[$].coord],j=$;if(l[$].ringAndEdge1Walkable)var G=l[$].ringAndEdge1,U=l[$].nxtIsectAlongRingAndEdge1;else var G=l[$].ringAndEdge2,U=l[$].nxtIsectAlongRingAndEdge2;for(;!xb(l[$].coord,l[U].coord);){q.push(l[U].coord);for(var Q=void 0,S=0;S1)for(var Ie=0;Ie"u"&&(e=!0),t.length!=3)throw new Error("This function requires an array of three points [x,y]");var n=(t[1][0]-t[0][0])*(t[2][1]-t[0][1])-(t[1][1]-t[0][1])*(t[2][0]-t[0][0]);return n>=0==e}function gne(t){for(var e=0,n=0;np&&(w>u&&yu&&wl&&(l=x)}var C=[];if(a&&l0&&Math.abs(E-n[M-1][0])>p){var A=parseFloat(n[M-1][0]),I=parseFloat(n[M-1][1]),O=parseFloat(n[M][0]),z=parseFloat(n[M][1]);if(A>-180&&A-180&&n[M-1][0]u&&A<180&&O===-180&&M+1u&&n[M-1][0]<180){S.push([180,n[M][1]]),M++,S.push([n[M][0],n[M][1]]);continue}if(Au){var $=A;A=O,O=$;var W=I;I=z,z=W}if(A>u&&O=180&&Au?180:-180,Z]),S=[],S.push([n[M-1][0]>u?-180:180,Z]),C.push(S)}else S=[],C.push(S);S.push([E,n[M][1]])}else S.push([n[M][0],n[M][1]])}}else{var q=[];C.push(q);for(var j=0;j1&&n.push(li(u)),Pn(n)}function s5(t,e){if(!e.features.length)throw new Error("lines must contain features");if(e.features.length===1)return e.features[0];var n,r=1/0;return ii(e,function(i){var o=qd(i,t),s=o.properties.dist;su&&p.push($h(t,e,u,i).geometry.coordinates),li(p,l)}function l5(t){var e=t%360;return e<0&&(e+=360),e}function Sb(t,e){e===void 0&&(e={});var n=Bi(t);switch(!e.properties&&t.type==="Feature"&&(e.properties=t.properties),n.type){case"Polygon":return c5(n,e);case"MultiPolygon":return wne(n,e);default:throw new Error("invalid poly")}}function c5(t,e){e===void 0&&(e={});var n=Bi(t),r=n.coordinates,i=e.properties?e.properties:t.type==="Feature"?t.properties:{};return u5(r,i)}function wne(t,e){e===void 0&&(e={});var n=Bi(t),r=n.coordinates,i=e.properties?e.properties:t.type==="Feature"?t.properties:{},o=[];return r.forEach(function(s){o.push(u5(s,i))}),Pn(o)}function u5(t,e){return t.length>1?lp(t,e):li(t[0],e)}function h5(t,e){e===void 0&&(e={});var n,r,i,o=e.properties,s=(n=e.autoComplete)!==null&&n!==void 0?n:!0,a=(r=e.orderCoords)!==null&&r!==void 0?r:!0,l=(i=e.mutate)!==null&&i!==void 0?i:!1;switch(l||(t=Ks(t)),t.type){case"FeatureCollection":var c=[];return t.features.forEach(function(u){c.push($n(d5(u,{},s,a)))}),pl(c,o);default:return d5(t,o,s,a)}}function d5(t,e,n,r){e=e||(t.type==="Feature"?t.properties:{});var i=Bi(t),o=i.coordinates,s=i.type;if(!o.length)throw new Error("line must contain coordinates");switch(s){case"LineString":return n&&(o=f5(o)),ur([o],e);case"MultiLineString":var a=[],l=0;return o.forEach(function(c){if(n&&(c=f5(c)),r){var u=xne(Ri(li(c)));u>l?(a.unshift(c),l=u):a.push(c)}else a.push(c)}),ur(a,e);default:throw new Error("geometry type "+s+" is not supported")}}function f5(t){var e=t[0],n=e[0],r=e[1],i=t[t.length-1],o=i[0],s=i[1];return(n!==o||r!==s)&&t.push(e),t}function xne(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.abs(e-r)*Math.abs(n-i)}function Ene(t,e,n){var r=t.length,i=bv(t[0],e),o=[],s,a,l,c,u;for(n||(n=[]),s=1;se[2]&&(n|=2),t[1]e[3]&&(n|=8),n}function Cne(t,e){var n=Bi(t),r=n.type,i=t.type==="Feature"?t.properties:{},o=n.coordinates;switch(r){case"LineString":case"MultiLineString":{var s=[];return r==="LineString"&&(o=[o]),o.forEach(function(a){Ene(a,e,s)}),s.length===1?li(s[0],i):lp(s,i)}case"Polygon":return ur(p5(o,e),i);case"MultiPolygon":return pl(o.map(function(a){return p5(a,e)}),i);default:throw new Error("geometry "+r+" not supported")}}function p5(t,e){for(var n=[],r=0,i=t;r0&&((s[0][0]!==s[s.length-1][0]||s[0][1]!==s[s.length-1][1])&&s.push(s[0]),s.length>=4&&n.push(s))}return n}var m5=Object.prototype.toString,g5=function(e){var n=m5.call(e),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&m5.call(e.callee)==="[object Function]"),r},RI,y5;function kne(){if(y5)return RI;y5=1;var t;if(!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=g5,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),s=i.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(p){var m=p.constructor;return m&&m.prototype===p},c={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},u=function(){if(typeof window>"u")return!1;for(var p in window)try{if(!c["$"+p]&&e.call(window,p)&&window[p]!==null&&typeof window[p]=="object")try{l(window[p])}catch{return!0}}catch{return!0}return!1}(),d=function(p){if(typeof window>"u"||!u)return l(p);try{return l(p)}catch{return!1}};t=function(m){var y=m!==null&&typeof m=="object",w=n.call(m)==="[object Function]",x=r(m),C=y&&n.call(m)==="[object String]",S=[];if(!y&&!w&&!x)throw new TypeError("Object.keys called on a non-object");var M=s&&w;if(C&&m.length>0&&!e.call(m,0))for(var E=0;E0)for(var A=0;A"u"||!Js?Qr:Js(Uint8Array),ng={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Qr:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Qr:ArrayBuffer,"%ArrayIteratorPrototype%":Cv&&Js?Js([][Symbol.iterator]()):Qr,"%AsyncFromSyncIteratorPrototype%":Qr,"%AsyncFunction%":kv,"%AsyncGenerator%":kv,"%AsyncGeneratorFunction%":kv,"%AsyncIteratorPrototype%":kv,"%Atomics%":typeof Atomics>"u"?Qr:Atomics,"%BigInt%":typeof BigInt>"u"?Qr:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Qr:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Qr:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Qr:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":mre,"%eval%":eval,"%EvalError%":gre,"%Float16Array%":typeof Float16Array>"u"?Qr:Float16Array,"%Float32Array%":typeof Float32Array>"u"?Qr:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Qr:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Qr:FinalizationRegistry,"%Function%":$5,"%GeneratorFunction%":kv,"%Int8Array%":typeof Int8Array>"u"?Qr:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Qr:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Qr:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Cv&&Js?Js(Js([][Symbol.iterator]())):Qr,"%JSON%":typeof JSON=="object"?JSON:Qr,"%Map%":typeof Map>"u"?Qr:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Cv||!Js?Qr:Js(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":pre,"%Object.getOwnPropertyDescriptor%":kb,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Qr:Promise,"%Proxy%":typeof Proxy>"u"?Qr:Proxy,"%RangeError%":yre,"%ReferenceError%":vre,"%Reflect%":typeof Reflect>"u"?Qr:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Qr:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Cv||!Js?Qr:Js(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Qr:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Cv&&Js?Js(""[Symbol.iterator]()):Qr,"%Symbol%":Cv?Symbol:Qr,"%SyntaxError%":Ev,"%ThrowTypeError%":Mre,"%TypedArray%":Lre,"%TypeError%":Sv,"%Uint8Array%":typeof Uint8Array>"u"?Qr:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Qr:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Qr:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Qr:Uint32Array,"%URIError%":_re,"%WeakMap%":typeof WeakMap>"u"?Qr:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Qr:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Qr:WeakSet,"%Function.prototype.call%":Tb,"%Function.prototype.apply%":z5,"%Object.defineProperty%":Tre,"%Object.getPrototypeOf%":Are,"%Math.abs%":bre,"%Math.floor%":wre,"%Math.max%":xre,"%Math.min%":Ere,"%Math.pow%":Sre,"%Math.round%":Cre,"%Math.sign%":kre,"%Reflect.getPrototypeOf%":Ire};if(Js)try{null.error}catch(t){var Pre=Js(Js(t));ng["%Error.prototype%"]=Pre}var Nre=function t(e){var n;if(e==="%AsyncFunction%")n=UI("async function () {}");else if(e==="%GeneratorFunction%")n=UI("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=UI("async function* () {}");else if(e==="%AsyncGenerator%"){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Js&&(n=Js(i.prototype))}return ng[e]=n,n},V5={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Mb=Cb,tS=F5,Ore=Mb.call(Tb,Array.prototype.concat),Dre=Mb.call(z5,Array.prototype.splice),j5=Mb.call(Tb,String.prototype.replace),nS=Mb.call(Tb,String.prototype.slice),Rre=Mb.call(Tb,RegExp.prototype.exec),Bre=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Fre=/\\(\\)?/g,$re=function(e){var n=nS(e,0,1),r=nS(e,-1);if(n==="%"&&r!=="%")throw new Ev("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new Ev("invalid intrinsic syntax, expected opening `%`");var i=[];return j5(e,Bre,function(o,s,a,l){i[i.length]=a?j5(l,Fre,"$1"):s||o}),i},zre=function(e,n){var r=e,i;if(tS(V5,r)&&(i=V5[r],r="%"+i[0]+"%"),tS(ng,r)){var o=ng[r];if(o===kv&&(o=Nre(r)),typeof o>"u"&&!n)throw new Sv("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new Ev("intrinsic "+e+" does not exist!")},U5=function(e,n){if(typeof e!="string"||e.length===0)throw new Sv("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new Sv('"allowMissing" argument must be a boolean');if(Rre(/^%?[^%]*%?$/,e)===null)throw new Ev("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=$re(e),i=r.length>0?r[0]:"",o=zre("%"+i+"%",n),s=o.name,a=o.value,l=!1,c=o.alias;c&&(i=c[0],Dre(r,Ore([0,1],c)));for(var u=1,d=!0;u=r.length){var w=kb(a,p);d=!!w,d&&"get"in w&&!("originalValue"in w.get)?a=w.get:a=a[p]}else d=tS(a,p),a=a[p];d&&!l&&(ng[s]=a)}}return a},H5=U5,W5=VI,Vre=W5([H5("%String.prototype.indexOf%")]),WI=function(e,n){var r=H5(e,!!n);return typeof r=="function"&&Vre(e,".prototype.")>-1?W5([r]):r},jre=BI(),Ure=WI,GI=Ure("Object.prototype.toString"),rS=function(e){return jre&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:GI(e)==="[object Arguments]"},G5=function(e){return rS(e)?!0:e!==null&&typeof e=="object"&&"length"in e&&typeof e.length=="number"&&e.length>=0&&GI(e)!=="[object Array]"&&"callee"in e&&GI(e.callee)==="[object Function]"},Hre=function(){return rS(arguments)}();rS.isLegacyArguments=G5;var Wre=Hre?rS:G5,q5=eS,Gre=S5,Tv=wv,Y5=xv,qI=function(e,n,r){if(!e||typeof e!="object"&&typeof e!="function")throw new Tv("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new Tv("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Tv("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Tv("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Tv("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Tv("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,s=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,l=!!Y5&&Y5(e,n);if(q5)q5(e,n,{configurable:s===null&&l?l.configurable:!s,enumerable:i===null&&l?l.enumerable:!i,value:r,writable:o===null&&l?l.writable:!o});else if(a||!i&&!o&&!s)e[n]=r;else throw new Gre("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},YI=eS,Z5=function(){return!!YI};Z5.hasArrayLengthDefineBug=function(){if(!YI)return null;try{return YI([],"length",{value:1}).length!==1}catch{return!0}};var ZI=Z5,qre=b5,Yre=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Zre=Object.prototype.toString,Xre=Array.prototype.concat,X5=qI,Kre=function(t){return typeof t=="function"&&Zre.call(t)==="[object Function]"},K5=ZI(),Jre=function(t,e,n,r){if(e in t){if(r===!0){if(t[e]===n)return}else if(!Kre(r)||!r())return}K5?X5(t,e,n,!0):X5(t,e,n)},J5=function(t,e){var n=arguments.length>2?arguments[2]:{},r=qre(e);Yre&&(r=Xre.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i4294967295||tie(n)!==n)throw new n$("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,o=!0;if("length"in e&&t$){var s=t$(e,"length");s&&!s.configurable&&(i=!1),s&&!s.writable&&(o=!1)}return(i||o||!r)&&(eie?e$(e,"length",n,!0,!0):e$(e,"length",n)),e},rie=Cb,iie=zI,oie=A5,sie=function(){return oie(rie,iie,arguments)};(function(t){var e=nie,n=eS,r=VI,i=sie;t.exports=function(s){var a=r(arguments),l=s.length-(arguments.length-1);return e(a,1+(l>0?l:0),!0)},n?n(t.exports,"apply",{value:i}):t.exports.apply=i})(Q5);var r$=Q5.exports,i$=function(t){return t!==t},o$=function(e,n){return e===0&&n===0?1/e===1/n:!!(e===n||i$(e)&&i$(n))},aie=o$,s$=function(){return typeof Object.is=="function"?Object.is:aie},lie=s$,cie=Ab,uie=function(){var e=lie();return cie(Object,{is:e},{is:function(){return Object.is!==e}}),e},hie=Ab,die=r$,fie=o$,a$=s$,pie=uie,l$=die(a$(),Object);hie(l$,{getPolyfill:a$,implementation:fie,shim:pie});var mie=l$,c$=WI,gie=BI(),yie=F5,vie=xv,XI;if(gie){var _ie=c$("RegExp.prototype.exec"),u$={},KI=function(){throw u$},h$={toString:KI,valueOf:KI};typeof Symbol.toPrimitive=="symbol"&&(h$[Symbol.toPrimitive]=KI),XI=function(e){if(!e||typeof e!="object")return!1;var n=vie(e,"lastIndex"),r=n&&yie(n,"value");if(!r)return!1;try{_ie(e,h$)}catch(i){return i===u$}}}else{var bie=c$("Object.prototype.toString"),wie="[object RegExp]";XI=function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:bie(e)===wie}}var xie=XI,Ib=function(){return typeof(function(){}).name=="string"},Lb=Object.getOwnPropertyDescriptor;if(Lb)try{Lb([],"length")}catch{Lb=null}Ib.functionsHaveConfigurableNames=function(){if(!Ib()||!Lb)return!1;var e=Lb(function(){},"name");return!!e&&!!e.configurable};var Eie=Function.prototype.bind;Ib.boundFunctionsHaveNames=function(){return Ib()&&typeof Eie=="function"&&(function(){}).bind().name!==""};var Sie=Ib,d$=qI,Cie=ZI(),kie=Sie.functionsHaveConfigurableNames(),Tie=wv,Mie=function(e,n){if(typeof e!="function")throw new Tie("`fn` is not a function");var r=arguments.length>2&&!!arguments[2];return(!r||kie)&&(Cie?d$(e,"name",n,!0,!0):d$(e,"name",n)),e},Aie=Mie,Iie=wv,Lie=Object,f$=Aie(function(){if(this==null||this!==Lie(this))throw new Iie("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0),Pie=f$,Nie=Ab.supportsDescriptors,Oie=Object.getOwnPropertyDescriptor,p$=function(){if(Nie&&/a/mig.flags==="gim"){var e=Oie(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var n="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){n+="d"}}),Object.defineProperty(r,"sticky",{get:function(){n+="y"}}),e.get.call(r),n==="dy")return e.get}}return Pie},Die=Ab.supportsDescriptors,Rie=p$,Bie=xv,Fie=Object.defineProperty,$ie=E5,m$=B5,zie=/a/,Vie=function(){if(!Die||!m$)throw new $ie("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=Rie(),n=m$(zie),r=Bie(n,"flags");return(!r||r.get!==e)&&Fie(n,"flags",{configurable:!0,enumerable:!1,get:e}),e},jie=Ab,Uie=r$,Hie=f$,g$=p$,Wie=Vie,y$=Uie(g$());jie(y$,{getPolyfill:g$,implementation:Hie,shim:Wie});var Gie=y$,v$=WI,qie=v$("Date.prototype.getDay"),Yie=function(e){try{return qie(e),!0}catch{return!1}},Zie=v$("Object.prototype.toString"),Xie="[object Date]",Kie=BI(),Jie=function(e){return typeof e!="object"||e===null?!1:Kie?Yie(e):Zie(e)===Xie},_$=b5,b$=Wre,w$=mie,x$=xie,E$=Gie,S$=Jie,C$=Date.prototype.getTime;function k$(t,e,n){var r=n||{};return(r.strict?w$(t,e):t===e)?!0:!t||!e||typeof t!="object"&&typeof e!="object"?r.strict?w$(t,e):t==e:Qie(t,e,r)}function T$(t){return t==null}function M$(t){return!(!t||typeof t!="object"||typeof t.length!="number"||typeof t.copy!="function"||typeof t.slice!="function"||t.length>0&&typeof t[0]!="number")}function Qie(t,e,n){var r,i;if(typeof t!=typeof e||T$(t)||T$(e)||t.prototype!==e.prototype||b$(t)!==b$(e))return!1;var o=x$(t),s=x$(e);if(o!==s)return!1;if(o||s)return t.source===e.source&&E$(t)===E$(e);if(S$(t)&&S$(e))return C$.call(t)===C$.call(e);var a=M$(t),l=M$(e);if(a!==l)return!1;if(a||l){if(t.length!==e.length)return!1;for(r=0;r=0;r--)if(c[r]!=u[r])return!1;for(r=c.length-1;r>=0;r--)if(i=c[r],!k$(t[i],e[i],n))return!1;return!0}var A$=k$;const Pb=gl(A$);function I$(t,e,n){if(n===void 0&&(n={}),n=n||{},!yi(n))throw new Error("options is invalid");var r=n.tolerance||0,i=[],o=GE(),s=tg(t);o.load(s);var a;return jd(e,function(l){var c=!1;l&&(ii(o.search(l),function(u){if(c===!1){var d=$n(l).sort(),p=$n(u).sort();Pb(d,p)||(r===0?Ul(d[0],u)&&Ul(d[1],u):qd(u,d[0]).properties.dist<=r&&qd(u,d[1]).properties.dist<=r)?(c=!0,a?a=JI(a,l):a=l):(r===0?Ul(p[0],l)&&Ul(p[1],l):qd(l,p[0]).properties.dist<=r&&qd(l,p[1]).properties.dist<=r)&&(a?a=JI(a,u):a=u)}}),c===!1&&a&&(i.push(a),a=void 0))}),a&&i.push(a),Pn(i)}function JI(t,e){var n=$n(e),r=$n(t),i=r[0],o=r[r.length-1],s=t.geometry.coordinates;return Pb(n[0],i)?s.unshift(n[1]):Pb(n[0],o)?s.push(n[1]):Pb(n[1],i)?s.unshift(n[0]):Pb(n[1],o)&&s.push(n[0]),t}function eoe(t,e,n,r,i){if(i=i||{},!yi(i))throw new Error("options is invalid");var o=i.properties;if(!t)throw new Error("center is required");if(n==null)throw new Error("bearing1 is required");if(r==null)throw new Error("bearing2 is required");if(!e)throw new Error("radius is required");if(typeof i!="object")throw new Error("options must be an object");if(L$(n)===L$(r))return xI(t,e,i);var s=$n(t),a=a5(t,e,n,r,i),l=[[s]];return Eo(a,function(c){l[0].push(c)}),l[0].push(s),ur(l,o)}function L$(t){var e=t%360;return e<0&&(e+=360),e}function rg(t,e,n){n===void 0&&(n={});var r;n.final?r=P$(Ti(e),Ti(t)):r=P$(Ti(t),Ti(e));var i=r>180?-(360-r):r;return i}function P$(t,e){var n=ls(t[1]),r=ls(e[1]),i=ls(e[0]-t[0]);i>Math.PI&&(i-=2*Math.PI),i<-Math.PI&&(i+=2*Math.PI);var o=Math.log(Math.tan(r/2+Math.PI/4)/Math.tan(n/2+Math.PI/4)),s=Math.atan2(i,o);return(cp(s)+360)%360}function Mv(t,e,n,r){r===void 0&&(r={});var i=e<0,o=Km(Math.abs(e),r.units,"meters");i&&(o=-Math.abs(o));var s=Ti(t),a=toe(s,o,n);return a[0]+=a[0]-s[0]>180?-360:s[0]-a[0]>180?360:0,Qn(a,r.properties)}function toe(t,e,n,r){r=r===void 0?as:Number(r);var i=e/r,o=t[0]*Math.PI/180,s=ls(t[1]),a=ls(n),l=i*Math.cos(a),c=s+l;Math.abs(c)>Math.PI/2&&(c=c>0?Math.PI-c:-Math.PI-c);var u=Math.log(Math.tan(c/2+Math.PI/4)/Math.tan(s/2+Math.PI/4)),d=Math.abs(u)>1e-11?l/u:Math.cos(s),p=i*Math.sin(a)/d,m=o+p;return[(m*180/Math.PI+540)%360-180,c*180/Math.PI]}function noe(t,e){var n=$n(t),r=$n(e),i,o,s,a,l=Ri(e),c=0,u=null;n[0]>l[0]&&n[0]l[1]&&n[1]0?ioe(e,a,i)||(i=a):n>0&&r<=0&&(roe(e,a,o)||(o=a)),n=r}return[i,o]}function roe(t,e,n){return Nb(t,e,n)>0}function ioe(t,e,n){return Nb(t,e,n)<0}function Nb(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(n[0]-t[0])*(e[1]-t[1])}function iS(t){for(var e=$n(t),n=0,r=1,i,o;r0}function ooe(t,e){if(e=e||{},!yi(e))throw new Error("options is invalid");var n=e.reverse||!1,r=e.mutate||!1;if(!t)throw new Error(" is required");if(typeof n!="boolean")throw new Error(" must be a boolean");if(typeof r!="boolean")throw new Error(" must be a boolean");r===!1&&(t=Ks(t));var i=[];switch(t.type){case"GeometryCollection":return jl(t,function(o){oS(o,n)}),t;case"FeatureCollection":return ii(t,function(o){ii(oS(o,n),function(s){i.push(s)})}),Pn(i)}return oS(t,n)}function oS(t,e){var n=t.type==="Feature"?t.geometry.type:t.type;switch(n){case"GeometryCollection":return jl(t,function(r){oS(r,e)}),t;case"LineString":return O$($n(t),e),t;case"Polygon":return D$($n(t),e),t;case"MultiLineString":return $n(t).forEach(function(r){O$(r,e)}),t;case"MultiPolygon":return $n(t).forEach(function(r){D$(r,e)}),t;case"Point":case"MultiPoint":return t}}function O$(t,e){iS(t)===e&&t.reverse()}function D$(t,e){iS(t[0])!==e&&t[0].reverse();for(var n=1;n * v. 1.2.0 * https://github.com/RaumZeit/MarchingSquares.js * * MarchingSquaresJS is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * MarchingSquaresJS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * As additional permission under GNU Affero General Public License version 3 * section 7, third-party projects (personal or commercial) may distribute, * include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the * requirement that said third-party project for that reason alone becomes * subject to any requirement of the GNU Affero General Public License version 3. * Any modifications to MarchingSquaresJS, however, must be shared with the public * and made available. * * In summary this: * - allows you to use MarchingSquaresJS at no cost * - allows you to use MarchingSquaresJS for both personal and commercial purposes * - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any * license as long as this license notice is included * - enables you to keep the source code of your program that uses MarchingSquaresJS * undisclosed * - forces you to share any modifications you have made to MarchingSquaresJS, * e.g. bug-fixes * * You should have received a copy of the GNU Affero General Public License * along with MarchingSquaresJS. If not, see . */var R$={successCallback:null,verbose:!1,polygons:!1},ig={};function loe(t,e,n,r){r=r||{};for(var i=Object.keys(R$),o=0;o-1}function Voe(t,e,n){for(var r=t.length-1,i=t[0].length-1,o={rows:r,cols:i,cells:[]},s=e+Math.abs(n),a=0;as?128:64,c|=ds?32:16,c|=ps?8:4,c|=ms?2:1;var y=+c,w=0;if(c===17||c===18||c===33||c===34||c===38||c===68||c===72||c===98||c===102||c===132||c===136||c===137||c===152||c===153){var x=(u+d+p+m)/4;w=x>s?2:x0?(c=156,w=4):c=152:c===33?w>0?(c=139,w=4):c=137:c===72?w>0?(c=99,w=4):c=98:c===132&&(w>0?(c=39,w=4):c=38)}if(c!=0&&c!=170){var C,S,M,E,A,I,O,z;C=S=M=E=A=I=O=z=.5;var $=[];c===1?(M=1-we(e,p,m),z=1-we(e,u,m),$.push(vn[c])):c===169?(M=we(s,m,p),z=we(s,m,u),$.push(vn[c])):c===4?(I=1-we(e,d,p),E=we(e,m,p),$.push(nn[c])):c===166?(I=we(s,p,d),E=1-we(s,p,m),$.push(nn[c])):c===16?(A=we(e,p,d),S=we(e,u,d),$.push(on[c])):c===154?(A=1-we(s,d,p),S=1-we(s,d,u),$.push(on[c])):c===64?(O=we(e,m,u),C=1-we(e,d,u),$.push(Dn[c])):c===106?(O=1-we(s,u,m),C=we(s,u,d),$.push(Dn[c])):c===168?(E=we(s,m,p),M=we(e,m,p),z=we(e,m,u),O=we(s,m,u),$.push(Sn[c]),$.push(vn[c])):c===2?(E=1-we(e,p,m),M=1-we(s,p,m),z=1-we(s,u,m),O=1-we(e,u,m),$.push(Sn[c]),$.push(vn[c])):c===162?(A=we(s,p,d),I=we(e,p,d),E=1-we(e,p,m),M=1-we(s,p,m),$.push(Sn[c]),$.push(vn[c])):c===8?(A=1-we(e,d,p),I=1-we(s,d,p),E=we(s,m,p),M=we(e,m,p),$.push(on[c]),$.push(nn[c])):c===138?(A=1-we(e,d,p),I=1-we(s,d,p),C=1-we(s,d,u),S=1-we(e,d,u),$.push(on[c]),$.push(nn[c])):c===32?(A=we(s,p,d),I=we(e,p,d),C=we(e,u,d),S=we(s,u,d),$.push(on[c]),$.push(nn[c])):c===42?(z=1-we(s,u,m),O=1-we(e,u,m),C=we(e,u,d),S=we(s,u,d),$.push(zn[c]),$.push(Dn[c])):c===128&&(z=we(e,m,u),O=we(s,m,u),C=1-we(s,d,u),S=1-we(e,d,u),$.push(zn[c]),$.push(Dn[c])),c===5?(I=1-we(e,d,p),z=1-we(e,u,m),$.push(nn[c])):c===165?(I=we(s,p,d),z=we(s,m,u),$.push(nn[c])):c===20?(E=we(e,m,p),S=we(e,u,d),$.push(Sn[c])):c===150?(E=1-we(s,p,m),S=1-we(s,d,u),$.push(Sn[c])):c===80?(A=we(e,p,d),O=we(e,m,u),$.push(on[c])):c===90?(A=1-we(s,d,p),O=1-we(s,u,m),$.push(on[c])):c===65?(M=1-we(e,p,m),C=1-we(e,d,u),$.push(vn[c])):c===105?(M=we(s,m,p),C=we(s,u,d),$.push(vn[c])):c===160?(A=we(s,p,d),I=we(e,p,d),z=we(e,m,u),O=we(s,m,u),$.push(on[c]),$.push(nn[c])):c===10?(A=1-we(e,d,p),I=1-we(s,d,p),z=1-we(s,u,m),O=1-we(e,u,m),$.push(on[c]),$.push(nn[c])):c===130?(E=1-we(e,p,m),M=1-we(s,p,m),C=1-we(s,d,u),S=1-we(e,d,u),$.push(Sn[c]),$.push(vn[c])):c===40?(E=we(s,m,p),M=we(e,m,p),C=we(e,u,d),S=we(s,u,d),$.push(Sn[c]),$.push(vn[c])):c===101?(I=we(s,p,d),C=we(s,u,d),$.push(nn[c])):c===69?(I=1-we(e,d,p),C=1-we(e,d,u),$.push(nn[c])):c===149?(z=we(s,m,u),S=1-we(s,d,u),$.push(zn[c])):c===21?(z=1-we(e,u,m),S=we(e,u,d),$.push(zn[c])):c===86?(E=1-we(s,p,m),O=1-we(s,u,m),$.push(Sn[c])):c===84?(E=we(e,m,p),O=we(e,m,u),$.push(Sn[c])):c===89?(A=1-we(s,d,p),M=we(s,m,p),$.push(vn[c])):c===81?(A=we(e,p,d),M=1-we(e,p,m),$.push(vn[c])):c===96?(A=we(s,p,d),I=we(e,p,d),O=we(e,m,u),C=we(s,u,d),$.push(on[c]),$.push(nn[c])):c===74?(A=1-we(e,d,p),I=1-we(s,d,p),O=1-we(s,u,m),C=1-we(e,d,u),$.push(on[c]),$.push(nn[c])):c===24?(A=1-we(s,d,p),E=we(s,m,p),M=we(e,m,p),S=we(e,u,d),$.push(on[c]),$.push(vn[c])):c===146?(A=we(e,p,d),E=1-we(e,p,m),M=1-we(s,p,m),S=1-we(s,d,u),$.push(on[c]),$.push(vn[c])):c===6?(I=1-we(e,d,p),E=1-we(s,p,m),z=1-we(s,u,m),O=1-we(e,u,m),$.push(nn[c]),$.push(Sn[c])):c===164?(I=we(s,p,d),E=we(e,m,p),z=we(e,m,u),O=we(s,m,u),$.push(nn[c]),$.push(Sn[c])):c===129?(M=1-we(e,p,m),z=we(s,m,u),C=1-we(s,d,u),S=1-we(e,d,u),$.push(vn[c]),$.push(zn[c])):c===41?(M=we(s,m,p),z=1-we(e,u,m),C=we(e,u,d),S=we(s,u,d),$.push(vn[c]),$.push(zn[c])):c===66?(E=1-we(e,p,m),M=1-we(s,p,m),O=1-we(s,u,m),C=1-we(e,d,u),$.push(Sn[c]),$.push(vn[c])):c===104?(E=we(s,m,p),M=we(e,m,p),O=we(e,m,u),C=we(s,u,d),$.push(vn[c]),$.push(Zr[c])):c===144?(A=we(e,p,d),z=we(e,m,u),O=we(s,m,u),S=1-we(s,d,u),$.push(on[c]),$.push(Dn[c])):c===26?(A=1-we(s,d,p),z=1-we(s,u,m),O=1-we(e,u,m),S=we(e,u,d),$.push(on[c]),$.push(Dn[c])):c===36?(I=we(s,p,d),E=we(e,m,p),C=we(e,u,d),S=we(s,u,d),$.push(nn[c]),$.push(Sn[c])):c===134?(I=1-we(e,d,p),E=1-we(s,p,m),C=1-we(s,d,u),S=1-we(e,d,u),$.push(nn[c]),$.push(Sn[c])):c===9?(A=1-we(e,d,p),I=1-we(s,d,p),M=we(s,m,p),z=1-we(e,u,m),$.push(on[c]),$.push(nn[c])):c===161?(A=we(s,p,d),I=we(e,p,d),M=1-we(e,p,m),z=we(s,m,u),$.push(on[c]),$.push(nn[c])):c===37?(I=we(s,p,d),z=1-we(e,u,m),C=we(e,u,d),S=we(s,u,d),$.push(nn[c]),$.push(zn[c])):c===133?(I=1-we(e,d,p),z=we(s,m,u),C=1-we(s,d,u),S=1-we(e,d,u),$.push(nn[c]),$.push(zn[c])):c===148?(E=we(e,m,p),z=we(e,m,u),O=we(s,m,u),S=1-we(s,d,u),$.push(Sn[c]),$.push(Dn[c])):c===22?(E=1-we(s,p,m),z=1-we(s,u,m),O=1-we(e,u,m),S=we(e,u,d),$.push(Sn[c]),$.push(Dn[c])):c===82?(A=we(e,p,d),E=1-we(e,p,m),M=1-we(s,p,m),O=1-we(s,u,m),$.push(on[c]),$.push(vn[c])):c===88?(A=1-we(s,d,p),E=we(s,m,p),M=we(e,m,p),O=we(e,m,u),$.push(on[c]),$.push(vn[c])):c===73?(A=1-we(e,d,p),I=1-we(s,d,p),M=we(s,m,p),C=1-we(e,d,u),$.push(on[c]),$.push(nn[c])):c===97?(A=we(s,p,d),I=we(e,p,d),M=1-we(e,p,m),C=we(s,u,d),$.push(on[c]),$.push(nn[c])):c===145?(A=we(e,p,d),M=1-we(e,p,m),z=we(s,m,u),S=1-we(s,d,u),$.push(on[c]),$.push(zn[c])):c===25?(A=1-we(s,d,p),M=we(s,m,p),z=1-we(e,u,m),S=we(e,u,d),$.push(on[c]),$.push(zn[c])):c===70?(I=1-we(e,d,p),E=1-we(s,p,m),O=1-we(s,u,m),C=1-we(e,d,u),$.push(nn[c]),$.push(Sn[c])):c===100?(I=we(s,p,d),E=we(e,m,p),O=we(e,m,u),C=we(s,u,d),$.push(nn[c]),$.push(Sn[c])):c===34?(w===0?(A=1-we(e,d,p),I=1-we(s,d,p),E=we(s,m,p),M=we(e,m,p),z=we(e,m,u),O=we(s,m,u),C=1-we(s,d,u),S=1-we(e,d,u)):(A=we(s,p,d),I=we(e,p,d),E=1-we(e,p,m),M=1-we(s,p,m),z=1-we(s,u,m),O=1-we(e,u,m),C=we(e,u,d),S=we(s,u,d)),$.push(on[c]),$.push(nn[c]),$.push(zn[c]),$.push(Dn[c])):c===35?(w===4?(A=1-we(e,d,p),I=1-we(s,d,p),E=we(s,m,p),M=we(e,m,p),z=we(e,m,u),O=we(s,m,u),C=1-we(s,d,u),S=1-we(e,d,u)):(A=we(s,p,d),I=we(e,p,d),E=1-we(e,p,m),M=1-we(s,p,m),z=1-we(s,u,m),O=1-we(e,u,m),C=we(e,u,d),S=we(s,u,d)),$.push(on[c]),$.push(nn[c]),$.push(vn[c]),$.push(Dn[c])):c===136?(w===0?(A=we(s,p,d),I=we(e,p,d),E=1-we(e,p,m),M=1-we(s,p,m),z=1-we(s,u,m),O=1-we(e,u,m),C=we(e,u,d),S=we(s,u,d)):(A=1-we(e,d,p),I=1-we(s,d,p),E=we(s,m,p),M=we(e,m,p),z=we(e,m,u),O=we(s,m,u),C=1-we(s,d,u),S=1-we(e,d,u)),$.push(on[c]),$.push(nn[c]),$.push(zn[c]),$.push(Dn[c])):c===153?(w===0?(A=we(e,p,d),M=1-we(e,p,m),z=1-we(e,u,m),S=we(e,u,d)):(A=1-we(s,d,p),M=we(s,m,p),z=we(s,m,u),S=1-we(s,d,u)),$.push(on[c]),$.push(vn[c])):c===102?(w===0?(I=1-we(e,d,p),E=we(e,m,p),O=we(e,m,u),C=1-we(e,d,u)):(I=we(s,p,d),E=1-we(s,p,m),O=1-we(s,u,m),C=we(s,u,d)),$.push(nn[c]),$.push(Dn[c])):c===155?(w===4?(A=we(e,p,d),M=1-we(e,p,m),z=1-we(e,u,m),S=we(e,u,d)):(A=1-we(s,d,p),M=we(s,m,p),z=we(s,m,u),S=1-we(s,d,u)),$.push(on[c]),$.push(zn[c])):c===103?(w===4?(I=1-we(e,d,p),E=we(e,m,p),O=we(e,m,u),C=1-we(e,d,u)):(I=we(s,p,d),E=1-we(s,p,m),O=1-we(s,u,m),C=we(s,u,d)),$.push(nn[c]),$.push(Sn[c])):c===152?(w===0?(A=we(e,p,d),E=1-we(e,p,m),M=1-we(s,p,m),z=1-we(s,u,m),O=1-we(e,u,m),S=we(e,u,d)):(A=1-we(s,d,p),E=we(s,m,p),M=we(e,m,p),z=we(e,m,u),O=we(s,m,u),S=1-we(s,d,u)),$.push(on[c]),$.push(Sn[c]),$.push(vn[c])):c===156?(w===4?(A=we(e,p,d),E=1-we(e,p,m),M=1-we(s,p,m),z=1-we(s,u,m),O=1-we(e,u,m),S=we(e,u,d)):(A=1-we(s,d,p),E=we(s,m,p),M=we(e,m,p),z=we(e,m,u),O=we(s,m,u),S=1-we(s,d,u)),$.push(on[c]),$.push(vn[c]),$.push(Dn[c])):c===137?(w===0?(A=we(s,p,d),I=we(e,p,d),M=1-we(e,p,m),z=1-we(e,u,m),C=we(e,u,d),S=we(s,u,d)):(A=1-we(e,d,p),I=1-we(s,d,p),M=we(s,m,p),z=we(s,m,u),C=1-we(s,d,u),S=1-we(e,d,u)),$.push(on[c]),$.push(nn[c]),$.push(vn[c])):c===139?(w===4?(A=we(s,p,d),I=we(e,p,d),M=1-we(e,p,m),z=1-we(e,u,m),C=we(e,u,d),S=we(s,u,d)):(A=1-we(e,d,p),I=1-we(s,d,p),M=we(s,m,p),z=we(s,m,u),C=1-we(s,d,u),S=1-we(e,d,u)),$.push(on[c]),$.push(nn[c]),$.push(zn[c])):c===98?(w===0?(A=1-we(e,d,p),I=1-we(s,d,p),E=we(s,m,p),M=we(e,m,p),O=we(e,m,u),C=1-we(e,d,u)):(A=we(s,p,d),I=we(e,p,d),E=1-we(e,p,m),M=1-we(s,p,m),O=1-we(s,u,m),C=we(s,u,d)),$.push(on[c]),$.push(nn[c]),$.push(Dn[c])):c===99?(w===4?(A=1-we(e,d,p),I=1-we(s,d,p),E=we(s,m,p),M=we(e,m,p),O=we(e,m,u),C=1-we(e,d,u)):(A=we(s,p,d),I=we(e,p,d),E=1-we(e,p,m),M=1-we(s,p,m),O=1-we(s,u,m),C=we(s,u,d)),$.push(on[c]),$.push(nn[c]),$.push(vn[c])):c===38?(w===0?(I=1-we(e,d,p),E=we(e,m,p),z=we(e,m,u),O=we(s,m,u),C=1-we(s,d,u),S=1-we(e,d,u)):(I=we(s,p,d),E=1-we(s,p,m),z=1-we(s,u,m),O=1-we(e,u,m),C=we(e,u,d),S=we(s,u,d)),$.push(nn[c]),$.push(zn[c]),$.push(Dn[c])):c===39?(w===4?(I=1-we(e,d,p),E=we(e,m,p),z=we(e,m,u),O=we(s,m,u),C=1-we(s,d,u),S=1-we(e,d,u)):(I=we(s,p,d),E=1-we(s,p,m),z=1-we(s,u,m),O=1-we(e,u,m),C=we(e,u,d),S=we(s,u,d)),$.push(nn[c]),$.push(Sn[c]),$.push(Dn[c])):c===85&&(A=1,I=0,E=1,M=0,z=0,O=1,C=0,S=1),(C<0||C>1||S<0||S>1||A<0||A>1||E<0||E>1||z<0||z>1||O<0||O>1)&&console.log("MarchingSquaresJS-isoBands: "+c+" "+y+" "+u+","+d+","+p+","+m+" "+w+" "+C+" "+S+" "+A+" "+I+" "+E+" "+M+" "+z+" "+O),o.cells[a][l]={cval:c,cval_real:y,flipped:w,topleft:C,topright:S,righttop:A,rightbottom:I,bottomright:E,bottomleft:M,leftbottom:z,lefttop:O,edges:$}}}}}return o}function joe(t){for(var e=[],n=t.rows,r=t.cols,i=[],o=0;o0){var a=t.cells[o][s],l=Woe(a),c=null,u=s,d=o;l!==null&&i.push([l.p[0]+u,l.p[1]+d]);do{if(c=Goe(t.cells[d][u],l.x,l.y,l.o),c!==null)i.push([c.p[0]+u,c.p[1]+d]),u+=c.x,d+=c.y,l=c;else break;if(d<0||d>=n||u<0||u>=r||typeof t.cells[d][u]>"u"){u-=c.x,d-=c.y;var p=Uoe(t,u,d,c.x,c.y,c.o);if(p!==null)p.path.forEach(function(m){i.push(m)}),u=p.i,d=p.j,l=p;else break}}while(typeof t.cells[d][u]<"u"&&t.cells[d][u].edges.length>0);e.push(i),i=[],t.cells[o][s].edges.length>0&&s--}return e}function Uoe(t,e,n,r,i,o){for(var s=t.cells[n][e],a=s.cval_real,l=e+r,c=n+i,u=[],d=!1;!d;){if(typeof t.cells[c]>"u"||typeof t.cells[c][l]>"u")if(c-=i,l-=r,s=t.cells[c][l],a=s.cval_real,i===-1)if(o===0)if(a&Qs)u.push([l,c]),r=-1,i=0,o=0;else if(a&Ds)u.push([l+1,c]),r=1,i=0,o=0;else{u.push([l+s.bottomright,c]),r=0,i=1,o=1,d=!0;break}else if(a&Qs)u.push([l,c]),r=-1,i=0,o=0;else if(a&Ds){u.push([l+s.bottomright,c]),r=0,i=1,o=1,d=!0;break}else{u.push([l+s.bottomleft,c]),r=0,i=1,o=0,d=!0;break}else if(i===1)if(o===0)if(a&Jc)u.push([l+1,c+1]),r=1,i=0,o=1;else if(a&wa){u.push([l+s.topleft,c+1]),r=0,i=-1,o=0,d=!0;break}else{u.push([l+s.topright,c+1]),r=0,i=-1,o=1,d=!0;break}else a&Jc?(u.push([l+1,c+1]),r=1,i=0,o=1):(u.push([l+1,c+1]),r=1,i=0,o=1);else if(r===-1)if(o===0)if(a&wa)u.push([l,c+1]),r=0,i=1,o=0;else if(a&Qs){u.push([l,c+s.leftbottom]),r=1,i=0,o=0,d=!0;break}else{u.push([l,c+s.lefttop]),r=1,i=0,o=1,d=!0;break}else if(a&wa)u.push([l,c+1]),r=0,i=1,o=0;else{console.log("MarchingSquaresJS-isoBands: wtf");break}else if(r===1)if(o===0)if(a&Ds)u.push([l+1,c]),r=0,i=-1,o=1;else{u.push([l+1,c+s.rightbottom]),r=-1,i=0,o=0,d=!0;break}else if(a&Ds)u.push([l+1,c]),r=0,i=-1,o=1;else if(a&Jc){u.push([l+1,c+s.righttop]),r=-1,i=0,o=1;break}else{u.push([l+1,c+s.rightbottom]),r=-1,i=0,o=0,d=!0;break}else{console.log("MarchingSquaresJS-isoBands: we came from nowhere!");break}else if(s=t.cells[c][l],a=s.cval_real,r===-1)if(o===0)if(typeof t.cells[c-1]<"u"&&typeof t.cells[c-1][l]<"u")r=0,i=-1,o=1;else if(a&Qs)u.push([l,c]);else{u.push([l+s.bottomright,c]),r=0,i=1,o=1,d=!0;break}else if(a&wa)console.log("MarchingSquaresJS-isoBands: proceeding in x-direction!");else{console.log("MarchingSquaresJS-isoBands: found entry from top at "+l+","+c);break}else if(r===1)if(o===0){console.log("MarchingSquaresJS-isoBands: wtf");break}else if(typeof t.cells[c+1]<"u"&&typeof t.cells[c+1][l]<"u")r=0,i=1,o=0;else if(a&Jc)u.push([l+1,c+1]),r=1,i=0,o=1;else{u.push([l+s.topleft,c+1]),r=0,i=-1,o=0,d=!0;break}else if(i===-1)if(o===1)if(typeof t.cells[c][l+1]<"u")r=1,i=0,o=1;else if(a&Ds)u.push([l+1,c]),r=0,i=-1,o=1;else{u.push([l+1,c+s.righttop]),r=-1,i=0,o=1,d=!0;break}else{console.log("MarchingSquaresJS-isoBands: wtf");break}else if(i===1)if(o===0)if(typeof t.cells[c][l-1]<"u")r=-1,i=0,o=0;else if(a&wa)u.push([l,c+1]),r=0,i=1,o=0;else{u.push([l,c+s.leftbottom]),r=1,i=0,o=0,d=!0;break}else{console.log("MarchingSquaresJS-isoBands: wtf");break}else{console.log("MarchingSquaresJS-isoBands: where did we came from???");break}if(l+=r,c+=i,l===e&&c===n)break}return{path:u,i:l,j:c,x:r,y:i,o}}function Hoe(t,e){delete t.edges[e];for(var n=e+1;n0){var e=t.edges[t.edges.length-1],n=t.cval_real;switch(e){case 0:return n&Jc?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 1:return n&Ds?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 2:return n&Ds?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 3:return n&Qs?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 4:return n&Jc?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 5:return n&Ds?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 6:return n&Ds?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 7:return n&Qs?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 8:return n&Ds?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.righttop],x:-1,y:0,o:1};case 9:return n&Qs?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 10:return n&Qs?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.righttop],x:-1,y:0,o:1};case 11:return n&wa?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 12:return n&Ds?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 13:return n&Qs?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 14:return n&Qs?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 15:return n&wa?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 16:return n&Ds?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 17:return n&wa?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 18:return n&Qs?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 19:return n&wa?{p:[t.bottomleft,0],x:0,y:1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 20:return n&wa?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 21:return n&Jc?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.topright,1],x:0,y:-1,o:1};case 22:return n&wa?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 23:return n&Jc?{p:[0,t.lefttop],x:1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};default:console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(t);break}}return null}function Goe(t,e,n,r){var i,o,s,a,l=t.cval,c;switch(e){case-1:switch(r){case 0:i=nn[l],s=Or[l],a=Dr[l],c=Rr[l];break;default:i=on[l],s=Lr[l],a=Pr[l],c=Nr[l];break}break;case 1:switch(r){case 0:i=zn[l],s=Gr[l],a=qr[l],c=Yr[l];break;default:i=Dn[l],s=Ur[l],a=Hr[l],c=Wr[l];break}break;default:switch(n){case-1:switch(r){case 0:i=Zr[l],s=Cr[l],a=kr[l],c=Tr[l];break;default:i=Kr[l],s=Mr[l],a=Ar[l],c=Ir[l];break}break;case 1:switch(r){case 0:i=vn[l],s=Br[l],a=Fr[l],c=$r[l];break;default:i=Sn[l],s=zr[l],a=Vr[l],c=jr[l];break}break}break}if(o=t.edges.indexOf(i),typeof t.edges[o]<"u")Hoe(t,o);else return null;switch(l=t.cval_real,i){case 0:l&Jc?(e=t.topleft,n=1):(e=1,n=t.righttop);break;case 1:l&Ds?(e=1,n=t.rightbottom):(e=t.topleft,n=1);break;case 2:l&Ds?(e=t.topleft,n=1):(e=t.bottomright,n=0);break;case 3:l&Qs?(e=t.bottomleft,n=0):(e=t.topleft,n=1);break;case 4:l&Jc?(e=t.topright,n=1):(e=1,n=t.righttop);break;case 5:l&Ds?(e=1,n=t.rightbottom):(e=t.topright,n=1);break;case 6:l&Ds?(e=t.topright,n=1):(e=t.bottomright,n=0);break;case 7:l&Qs?(e=t.bottomleft,n=0):(e=t.topright,n=1);break;case 8:l&Ds?(e=1,n=t.righttop):(e=t.bottomright,n=0);break;case 9:l&Qs?(e=t.bottomleft,n=0):(e=1,n=t.righttop);break;case 10:l&Qs?(e=1,n=t.righttop):(e=0,n=t.leftbottom);break;case 11:l&wa?(e=0,n=t.lefttop):(e=1,n=t.righttop);break;case 12:l&Ds?(e=1,n=t.rightbottom):(e=t.bottomright,n=0);break;case 13:l&Qs?(e=t.bottomleft,n=0):(e=1,n=t.rightbottom);break;case 14:l&Qs?(e=1,n=t.rightbottom):(e=0,n=t.leftbottom);break;case 15:l&wa?(e=0,n=t.lefttop):(e=1,n=t.rightbottom);break;case 16:l&Ds?(e=0,n=t.leftbottom):(e=t.bottomright,n=0);break;case 17:l&wa?(e=0,n=t.lefttop):(e=t.bottomright,n=0);break;case 18:l&Qs?(e=t.bottomleft,n=0):(e=0,n=t.leftbottom);break;case 19:l&wa?(e=0,n=t.lefttop):(e=t.bottomleft,n=0);break;case 20:l&wa?(e=0,n=t.leftbottom):(e=t.topleft,n=1);break;case 21:l&Jc?(e=t.topright,n=1):(e=0,n=t.leftbottom);break;case 22:l&wa?(e=0,n=t.lefttop):(e=t.topleft,n=1);break;case 23:l&Jc?(e=t.topright,n=1):(e=0,n=t.lefttop);break;default:return console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(t),null}return(typeof e>"u"||typeof n>"u"||typeof s>"u"||typeof a>"u"||typeof c>"u")&&(console.log("MarchingSquaresJS-isoBands: undefined value!"),console.log(t),console.log(e+" "+n+" "+s+" "+a+" "+c)),{p:[e,n],x:s,y:a,o:c}}function qoe(t){var e=[],n=0;return t.cells.forEach(function(r,i){r.forEach(function(o,s){if(typeof o<"u"){var a=Gt[o.cval](o);typeof a=="object"&&aL(a)?typeof a[0]=="object"&&aL(a[0])?typeof a[0][0]=="object"&&aL(a[0][0])?a.forEach(function(l){l.forEach(function(c){c[0]+=s,c[1]+=i}),e[n++]=l}):(a.forEach(function(l){l[0]+=s,l[1]+=i}),e[n++]=a):console.log("MarchingSquaresJS-isoBands: bandcell polygon with malformed coordinates"):console.log("MarchingSquaresJS-isoBands: bandcell polygon with null coordinates")}})}),e}function Yoe(t,e,n){if(n=n||{},!yi(n))throw new Error("options is invalid");var r=n.zProperty||"elevation",i=n.commonProperties||{},o=n.breaksProperties||[];if(Ud(t,"Point","Input must contain Points"),!e)throw new Error("breaks is required");if(!Array.isArray(e))throw new Error("breaks is not an Array");if(!yi(i))throw new Error("commonProperties is not an Object");if(!Array.isArray(o))throw new Error("breaksProperties is not an Array");var s=soe(t,{zProperty:r,flip:!0}),a=Zoe(s,e,r);a=Xoe(a,s,t);var l=a.map(function(c,u){if(o[u]&&!yi(o[u]))throw new Error("Each mappedProperty is required to be an Object");var d=eI({},i,o[u]);d[r]=c[r];var p=pl(c.groupedRings,d);return p});return Pn(l)}function Zoe(t,e,n){for(var r=[],i=1;i0){var u=r[l-1],d=lse(c,u);d!==!1&&(u[1]=d,c[0]=d),s.push(u[0]),l===o.length-2&&(s.push(c[0]),s.push(c[1]))}o.length===2&&(s.push(c[0]),s.push(c[1]))}}),li(s,t.properties)}function use(t,e,n){var r=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),i=t[0]+n*(e[1]-t[1])/r,o=e[0]+n*(e[1]-t[1])/r,s=t[1]+n*(t[0]-e[0])/r,a=e[1]+n*(t[0]-e[0])/r;return[[i,s],[o,a]]}function hse(t){return(t>0)-(t<0)||+t}function cL(t,e,n){var r=e[0]-t[0],i=e[1]-t[1],o=n[0]-e[0],s=n[1]-e[1];return hse(r*s-o*i)}function dse(t,e){var n=t.geometry.coordinates[0].map(function(s){return s[0]}),r=t.geometry.coordinates[0].map(function(s){return s[1]}),i=e.geometry.coordinates[0].map(function(s){return s[0]}),o=e.geometry.coordinates[0].map(function(s){return s[1]});return Math.max.apply(null,n)===Math.max.apply(null,i)&&Math.max.apply(null,r)===Math.max.apply(null,o)&&Math.min.apply(null,n)===Math.min.apply(null,i)&&Math.min.apply(null,r)===Math.min.apply(null,o)}function V$(t,e){return e.geometry.coordinates[0].every(function(n){return Fi(Qn(n),t)})}function fse(t,e){return t[0]===e[0]&&t[1]===e[1]}var j$=function(){function t(e){this.id=t.buildId(e),this.coordinates=e,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return t.buildId=function(e){return e.join(",")},t.prototype.removeInnerEdge=function(e){this.innerEdges=this.innerEdges.filter(function(n){return n.from.id!==e.from.id})},t.prototype.removeOuterEdge=function(e){this.outerEdges=this.outerEdges.filter(function(n){return n.to.id!==e.to.id})},t.prototype.addOuterEdge=function(e){this.outerEdges.push(e),this.outerEdgesSorted=!1},t.prototype.sortOuterEdges=function(){var e=this;this.outerEdgesSorted||(this.outerEdges.sort(function(n,r){var i=n.to,o=r.to;if(i.coordinates[0]-e.coordinates[0]>=0&&o.coordinates[0]-e.coordinates[0]<0)return 1;if(i.coordinates[0]-e.coordinates[0]<0&&o.coordinates[0]-e.coordinates[0]>=0)return-1;if(i.coordinates[0]-e.coordinates[0]===0&&o.coordinates[0]-e.coordinates[0]===0)return i.coordinates[1]-e.coordinates[1]>=0||o.coordinates[1]-e.coordinates[1]>=0?i.coordinates[1]-o.coordinates[1]:o.coordinates[1]-i.coordinates[1];var s=cL(e.coordinates,i.coordinates,o.coordinates);if(s<0)return 1;if(s>0)return-1;var a=Math.pow(i.coordinates[0]-e.coordinates[0],2)+Math.pow(i.coordinates[1]-e.coordinates[1],2),l=Math.pow(o.coordinates[0]-e.coordinates[0],2)+Math.pow(o.coordinates[1]-e.coordinates[1],2);return a-l}),this.outerEdgesSorted=!0)},t.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},t.prototype.getOuterEdge=function(e){return this.sortOuterEdges(),this.outerEdges[e]},t.prototype.addInnerEdge=function(e){this.innerEdges.push(e)},t}(),pse=function(){function t(e,n){this.from=e,this.to=n,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return t.prototype.getSymetric=function(){return this.symetric||(this.symetric=new t(this.to,this.from),this.symetric.symetric=this),this.symetric},t.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},t.prototype.isEqual=function(e){return this.from.id===e.from.id&&this.to.id===e.to.id},t.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},t.prototype.toLineString=function(){return li([this.from.coordinates,this.to.coordinates])},t.prototype.compareTo=function(e){return cL(e.from.coordinates,e.to.coordinates,this.to.coordinates)},t}(),U$=function(){function t(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return t.prototype.push=function(e){this.edges.push(e),this.polygon=this.envelope=void 0},t.prototype.get=function(e){return this.edges[e]},Object.defineProperty(t.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),t.prototype.forEach=function(e){this.edges.forEach(e)},t.prototype.map=function(e){return this.edges.map(e)},t.prototype.some=function(e){return this.edges.some(e)},t.prototype.isValid=function(){return!0},t.prototype.isHole=function(){var e=this,n=this.edges.reduce(function(s,a,l){return a.from.coordinates[1]>e.edges[s].from.coordinates[1]&&(s=l),s},0),r=(n===0?this.length:n)-1,i=(n+1)%this.length,o=cL(this.edges[r].from.coordinates,this.edges[n].from.coordinates,this.edges[i].from.coordinates);return o===0?this.edges[r].from.coordinates[0]>this.edges[i].from.coordinates[0]:o>0},t.prototype.toMultiPoint=function(){return db(this.edges.map(function(e){return e.from.coordinates}))},t.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var e=this.edges.map(function(n){return n.from.coordinates});return e.push(this.edges[0].from.coordinates),this.polygon=ur([e])},t.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=TF(this.toPolygon())},t.findEdgeRingContaining=function(e,n){var r=e.getEnvelope(),i,o;return n.forEach(function(s){var a=s.getEnvelope();if(o&&(i=o.getEnvelope()),!dse(a,r)&&V$(a,r)){for(var l=e.map(function(y){return y.from.coordinates}),c=void 0,u=function(y){s.some(function(w){return fse(y,w.from.coordinates)})||(c=y)},d=0,p=l;d"u"?Object.keys(this.nodes).forEach(function(r){return n._computeNextCWEdges(n.nodes[r])}):e.getOuterEdges().forEach(function(r,i){e.getOuterEdge((i===0?e.getOuterEdges().length:i)-1).symetric.next=r})},t.prototype._computeNextCCWEdges=function(e,n){for(var r=e.getOuterEdges(),i,o,s=r.length-1;s>=0;--s){var a=r[s],l=a.symetric,c=void 0,u=void 0;a.label===n&&(c=a),l.label===n&&(u=l),!(!c||!u)&&(u&&(o=u),c&&(o&&(o.next=c,o=void 0),i||(i=c)))}o&&(o.next=i)},t.prototype._findLabeledEdgeRings=function(){var e=[],n=0;return this.edges.forEach(function(r){if(!(r.label>=0)){e.push(r);var i=r;do i.label=n,i=i.next;while(!r.isEqual(i));n++}}),e},t.prototype.getEdgeRings=function(){var e=this;this._computeNextCWEdges(),this.edges.forEach(function(r){r.label=void 0}),this._findLabeledEdgeRings().forEach(function(r){e._findIntersectionNodes(r).forEach(function(i){e._computeNextCCWEdges(i,r.label)})});var n=[];return this.edges.forEach(function(r){r.ring||n.push(e._findEdgeRing(r))}),n},t.prototype._findIntersectionNodes=function(e){var n=[],r=e,i=function(){var o=0;r.from.getOuterEdges().forEach(function(s){s.label===e.label&&++o}),o>1&&n.push(r.from),r=r.next};do i();while(!e.isEqual(r));return n},t.prototype._findEdgeRing=function(e){var n=e,r=new U$;do r.push(n),n.ring=r,n=n.next;while(!e.isEqual(n));return r},t.prototype.removeNode=function(e){var n=this;e.getOuterEdges().forEach(function(r){return n.removeEdge(r)}),e.innerEdges.forEach(function(r){return n.removeEdge(r)}),delete this.nodes[e.id]},t.prototype.removeEdge=function(e){this.edges=this.edges.filter(function(n){return!n.isEqual(e)}),e.deleteEdge()},t}();function yse(t){var e=gse.fromGeoJson(t);e.deleteDangles(),e.deleteCutEdges();var n=[],r=[];return e.getEdgeRings().filter(function(i){return i.isValid()}).forEach(function(i){i.isHole()?n.push(i):r.push(i)}),n.forEach(function(i){U$.findEdgeRingContaining(i,r)&&r.push(i)}),Pn(r.map(function(i){return i.toPolygon()}))}function H$(t,e){var n=!0;return Os(t,function(r){Os(e,function(i){if(n===!1)return!1;n=vse(r.geometry,i.geometry)})}),n}function vse(t,e){switch(t.type){case"Point":switch(e.type){case"Point":return!xse(t.coordinates,e.coordinates);case"LineString":return!W$(e,t);case"Polygon":return!Fi(t,e)}break;case"LineString":switch(e.type){case"Point":return!W$(t,e);case"LineString":return!_se(t,e);case"Polygon":return!G$(e,t)}break;case"Polygon":switch(e.type){case"Point":return!Fi(e,t);case"LineString":return!G$(t,e);case"Polygon":return!bse(e,t)}}return!1}function W$(t,e){for(var n=0;n0}function G$(t,e){for(var n=0,r=e.coordinates;n0}function bse(t,e){for(var n=0,r=t.coordinates[0];n0}function wse(t,e,n){var r=n[0]-t[0],i=n[1]-t[1],o=e[0]-t[0],s=e[1]-t[1],a=r*s-i*o;return a!==0?!1:Math.abs(o)>=Math.abs(s)?o>0?t[0]<=n[0]&&n[0]<=e[0]:e[0]<=n[0]&&n[0]<=t[0]:s>0?t[1]<=n[1]&&n[1]<=e[1]:e[1]<=n[1]&&n[1]<=t[1]}function xse(t,e){return t[0]===e[0]&&t[1]===e[1]}function Ese(t,e){var n=Bi(t),r=Bi(e),i=n.type,o=r.type,s=n.coordinates,a=r.coordinates;switch(i){case"Point":switch(o){case"Point":return uL(s,a);default:throw new Error("feature2 "+o+" geometry not supported")}case"MultiPoint":switch(o){case"Point":return Sse(n,r);case"MultiPoint":return Cse(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"Point":return Ul(r,n,{ignoreEndVertices:!0});case"LineString":return Mse(n,r);case"MultiPoint":return kse(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Point":return Fi(r,n,{ignoreBoundary:!0});case"LineString":return Ase(n,r);case"Polygon":return Ise(n,r);case"MultiPoint":return Tse(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}}function Sse(t,e){var n,r=!1;for(n=0;ne[0]||t[2]e[1]||t[3]0)for(var r=0;r0}function X$(t,e){for(var n=!1,r=!1,i=t.coordinates.length,o=0;o=Math.abs(a)?s>0?t[0]<=n[0]&&n[0]<=e[0]:e[0]<=n[0]&&n[0]<=t[0]:a>0?t[1]<=n[1]&&n[1]<=e[1]:e[1]<=n[1]&&n[1]<=t[1]:Math.abs(s)>=Math.abs(a)?s>0?t[0]0?t[1]=0&&(n=[].concat(t.slice(r,t.length),t.slice(1,r+1))),n},Vh.prototype.comparePath=function(t,e){var n=this;return t.every(function(r,i){return n.compareCoord(r,this[i])},e)},Vh.prototype.comparePolygon=function(t,e){if(this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)){var n=t.coordinates.slice(1,t.coordinates.length),r=e.coordinates.slice(1,e.coordinates.length),i=this;return n.every(function(o){return this.some(function(s){return i.compareLine(o,s,1,!0)})},r)}else return!1},Vh.prototype.compareFeature=function(t,e){return t.id!==e.id||!this.objectComparator(t.properties,e.properties)||!this.compareBBox(t,e)?!1:this.compare(t.geometry,e.geometry)},Vh.prototype.compareBBox=function(t,e){return!!(!t.bbox&&!e.bbox||t.bbox&&e.bbox&&this.compareCoord(t.bbox,e.bbox))},Vh.prototype.removePseudo=function(t){return t};function Dse(t,e){return Ose(t,e,{strict:!0})}var Rse=Vh;const e4=gl(Rse);function Bse(t,e){var n=Bi(t),r=Bi(e),i=n.type,o=r.type;if(i==="MultiPoint"&&o!=="MultiPoint"||(i==="LineString"||i==="MultiLineString")&&o!=="LineString"&&o!=="MultiLineString"||(i==="Polygon"||i==="MultiPolygon")&&o!=="Polygon"&&o!=="MultiPolygon")throw new Error("features must be of the same type");if(i==="Point")throw new Error("Point geometry not supported");var s=new e4({precision:6});if(s.compare(t,e))return!1;var a=0;switch(i){case"MultiPoint":for(var l=0;l0}function Fse(t,e){var n=Bi(t).type,r=Bi(e).type;if(n!==r)return!1;var i=new e4({precision:6});return i.compare(Qm(t),Qm(e))}function t4(t,e){var n=!1;return Os(t,function(r){Os(e,function(i){if(n===!0)return!0;n=!H$(r.geometry,i.geometry)})}),n}var n4={exports:{}},hL={exports:{}},r4;function $se(){return r4||(r4=1,function(t){function e(n,r,i,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(n,r,i,o)}e.prototype.run=function(n,r,i,o){this._init(n,r,i,o);for(var s=0;s=this.minPts&&(r=this._mergeArrays(r,s))}this._assigned[o]!==1&&this._addToCluster(o,n)}},e.prototype._addToCluster=function(n,r){this.clusters[r].push(n),this._assigned[n]=1},e.prototype._regionQuery=function(n){for(var r=[],i=0;i0){for(var u=0;u=0);return r},e.prototype.assign=function(){for(var n=!1,r=this.dataset.length,i,o=0;o"u"&&(n[r]=[]),n[r].push(i);return n},e.prototype.argmin=function(n,r,i){for(var o=Number.MAX_VALUE,s=0,a=r.length,l,c=0;cs&&(i=o):r=this.minPts)return o}},n.prototype._regionQuery=function(r,i){i=i||this.epsilon;for(var o=[],s=0,a=this.dataset.length;s0;i.length0;){var l=e[Math.floor(Math.random()*s)],c=a?l.join("_"):""+l;r[c]||(r[c]=!0,i.push(l))}if(i.length0,a=e[Math.floor(Math.random()*o)];for(s?a.join("_"):""+a,i.push(a);i.length0,m=[];if(n)n=="kmrand"?i=Zse(t,e):n=="kmpp"?i=Xse(t,e):i=n;else for(var y={};i.lengthn&&(e.numberOfClusters=n),e.mutate!==!0&&(t=Ks(t));var r=fv(t),i=r.slice(0,e.numberOfClusters),o=Qse(r,e.numberOfClusters,i),s={};return o.centroids.forEach(function(a,l){s[l]=a}),ii(t,function(a,l){var c=o.idxs[l];a.properties.cluster=c,a.properties.centroid=s[c]}),t}function tae(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");var n=f4(t,"line1");if(n!=="LineString")throw new Error("line1 must be a LineString");var r=f4(e,"line2");if(r!=="LineString")throw new Error("line2 must be a LineString");for(var i=tg(Qm(t)).features,o=tg(Qm(e)).features,s=0;s0;){var l=s.pop();if(l===n)return p4(l);l.closed=!0;for(var c=t.neighbors(l),u=0,d=c.length;u0&&(this.content[0]=e,this.bubbleUp(0)),t},remove:function(t){var e=this.content.indexOf(t),n=this.content.pop();e!==this.content.length-1&&(this.content[e]=n,this.scoreFunction(n)0;){var n=(t+1>>1)-1,r=this.content[n];if(this.scoreFunction(e)=p;){for(var Q=[],re=[],le=d+O,oe=0;le<=m;){var he=Qn([le,G]),xe=oae(he,o);Q.push(xe?0:1),re.push(le+"|"+G);var Ee=vi(he,t);!xe&&Ee0)){if(w/=m,m<0){if(w0){if(w>p)return;w>d&&(d=w)}if(w=r-a,!(!m&&w<0)){if(w/=m,m<0){if(w>p)return;w>d&&(d=w)}else if(m>0){if(w0)){if(w/=y,y<0){if(w0){if(w>p)return;w>d&&(d=w)}if(w=i-l,!(!y&&w<0)){if(w/=y,y<0){if(w>p)return;w>d&&(d=w)}else if(y>0){if(w0)&&!(p<1)||(d>0&&(t[0]=[a+d*m,l+d*y]),p<1&&(t[1]=[a+p*m,l+p*y])),!0}}}}}function cae(t,e,n,r,i){var o=t[1];if(o)return!0;var s=t[0],a=t.left,l=t.right,c=a[0],u=a[1],d=l[0],p=l[1],m=(c+d)/2,y=(u+p)/2,w,x;if(p===u){if(m=r)return;if(c>d){if(!s)s=[m,n];else if(s[1]>=i)return;o=[m,i]}else{if(!s)s=[m,i];else if(s[1]1)if(c>d){if(!s)s=[(n-x)/w,n];else if(s[1]>=i)return;o=[(i-x)/w,i]}else{if(!s)s=[(i-x)/w,i];else if(s[1]=r)return;o=[r,w*r+x]}else{if(!s)s=[r,w*r+x];else if(s[0]Vi||Math.abs(o[0][1]-o[1][1])>Vi))&&delete $a[i]}function hae(t){return _c[t.index]={site:t,halfedges:[]}}function dae(t,e){var n=t.site,r=e.left,i=e.right;return n===i&&(i=r,r=n),i?Math.atan2(i[1]-r[1],i[0]-r[0]):(n===r?(r=e[1],i=e[0]):(r=e[0],i=e[1]),Math.atan2(r[0]-i[0],i[1]-r[1]))}function v4(t,e){return e[+(e.left!==t.site)]}function fae(t,e){return e[+(e.left===t.site)]}function pae(){for(var t=0,e=_c.length,n,r,i,o;tVi||Math.abs(x-m)>Vi)&&(c.splice(l,0,$a.push(Bb(a,y,Math.abs(w-t)Vi?[t,Math.abs(p-t)Vi?[Math.abs(m-r)Vi?[n,Math.abs(p-n)Vi?[Math.abs(m-e)=-1e-12)){var m=l*l+c*c,y=u*u+d*d,w=(d*m-c*y)/p,x=(l*y-u*m)/p,C=_4.pop()||new gae;C.arc=t,C.site=i,C.x=w+s,C.y=(C.cy=x+a)+Math.sqrt(w*w+x*x),t.circle=C;for(var S=null,M=Fb._;M;)if(C.yVi)a=a.L;else if(s=e-bae(a,n),s>Vi){if(!a.R){r=a;break}a=a.R}else{o>-Vi?(r=a.P,i=a):s>-Vi?(r=a,i=a.N):r=i=a;break}hae(t);var l=w4(t);if(Pv.insert(r,l),!(!r&&!i)){if(r===i){Lv(r),i=w4(r.site),Pv.insert(l,i),l.edge=i.edge=Rb(r.site,l.site),Iv(r),Iv(i);return}if(!i){l.edge=Rb(r.site,l.site);return}Lv(r),Lv(i);var c=r.site,u=c[0],d=c[1],p=t[0]-u,m=t[1]-d,y=i.site,w=y[0]-u,x=y[1]-d,C=2*(p*x-m*w),S=p*p+m*m,M=w*w+x*x,E=[(x*S-m*M)/C+u,(p*M-w*S)/C+d];hS(i.edge,c,y,E),l.edge=Rb(c,t,null,E),i.edge=Rb(t,y,null,E),Iv(r),Iv(i)}}function x4(t,e){var n=t.site,r=n[0],i=n[1],o=i-e;if(!o)return r;var s=t.P;if(!s)return-1/0;n=s.site;var a=n[0],l=n[1],c=l-e;if(!c)return a;var u=a-r,d=1/o-1/c,p=u/c;return d?(-p+Math.sqrt(p*p-2*d*(u*u/(-2*c)-l+c/2+i-o/2)))/d+r:(r+a)/2}function bae(t,e){var n=t.N;if(n)return x4(n,e);var r=t.site;return r[1]===e?r[0]:1/0}var Vi=1e-6,Pv,_c,Fb,$a;function wae(t,e,n){return(t[0]-n[0])*(e[1]-t[1])-(t[0]-e[0])*(n[1]-t[1])}function xae(t,e){return e[1]-t[1]||e[0]-t[0]}function vL(t,e){var n=t.sort(xae).pop(),r,i,o;for($a=[],_c=new Array(t.length),Pv=new cS,Fb=new cS;;)if(o=gL,n&&(!o||n[1]=s)return null;var l=t-a.site[0],c=e-a.site[1],u=l*l+c*c;do a=r.cells[i=o],o=null,a.halfedges.forEach(function(d){var p=r.edges[d],m=p.left;if(!((m===a.site||!m)&&!(m=p.right))){var y=t-m[0],w=e-m[1],x=y*y+w*w;x=-270&&(y=-y),m<-180&&m>=-360&&(w=-w),o==="degrees"){var x=y*Math.cos(u)+w*Math.sin(u),C=w*Math.cos(u)-y*Math.sin(u);y=x,w=C}d.push([y+c[0],w+c[1]])}return d.push(d[0]),o==="degrees"?ur([d],l):B$(ur([d],l),s,{pivot:a})}function S4(t){var e=t*Math.PI/180;return Math.tan(e)}function _L(t,e){e===void 0&&(e={});var n=0,r=0,i=0;return jl(t,function(o,s,a){var l=e.weight?a==null?void 0:a[e.weight]:void 0;if(l=l??1,!cs(l))throw new Error("weight value must be a number for feature index "+s);l=Number(l),l>0&&Eo(o,function(c){n+=c[0]*l,r+=c[1]*l,i+=l})}),Qn([n/i,r/i],e.properties,e)}function kae(t,e){if(e===void 0&&(e={}),e=e||{},!yi(e))throw new Error("options is invalid");var n=e.counter||10;if(!cs(n))throw new Error("counter must be a number");var r=e.weight,i=_L(t,{weight:e.weight}),o=Pn([]);ii(t,function(a){var l;o.features.push(up(a,{properties:{weight:(l=a.properties)===null||l===void 0?void 0:l[r]}}))});var s={tolerance:e.tolerance,medianCandidates:[]};return C4(i.geometry.coordinates,[0,0],o,s,n)}function C4(t,e,n,r,i){var o=r.tolerance||.001,s=0,a=0,l=0,c=0;if(ii(n,function(p){var m,y=(m=p.properties)===null||m===void 0?void 0:m.weight,w=y??1;if(w=Number(w),!cs(w))throw new Error("weight value must be a number");if(w>0){c+=1;var x=w*vi(p,t);x===0&&(x=1);var C=w/x;s+=p.geometry.coordinates[0]*C,a+=p.geometry.coordinates[1]*C,l+=C}}),c<1)throw new Error("no features to measure");var u=s/l,d=a/l;return c===1||i===0||Math.abs(u-e[0])0&&(l=ur(a).geometry),Iae(l,c),a=c.slice(0);n.push(ur(a,s));break;case"MultiPolygon":a=[[[]]];for(var d=0;d0&&(l=pl(a).geometry),Lae(l,c),a=c.slice(0);n.push(pl(a,s));break;default:throw new Error("geometry is invalid, must be Polygon or MultiPolygon")}}),Pn(n)}function Iae(t,e){var n=0,r=0;Eo(t,function(i,o,s,a,l){l>n&&(n=l,r=o,e.push([]));var c=o-r,u=t.coordinates[l][c+1],d=i[0],p=i[1],m=u[0],y=u[1];e[l].push([.75*d+.25*m,.75*p+.25*y]),e[l].push([.25*d+.75*m,.25*p+.75*y])},!0),e.forEach(function(i){i.push(i[0])})}function Lae(t,e){var n=0,r=0,i=0;Eo(t,function(o,s,a,l,c){l>i&&(i=l,r=s,e.push([[]])),c>n&&(n=c,r=s,e[l].push([]));var u=s-r,d=t.coordinates[l][c][u+1],p=o[0],m=o[1],y=d[0],w=d[1];e[l][c].push([.75*p+.25*y,.75*m+.25*w]),e[l][c].push([.25*p+.75*y,.25*m+.75*w])},!0),e.forEach(function(o){o.forEach(function(s){s.push(s[0])})})}function Pae(t,e,n){n===void 0&&(n=2);var r=Ti(t),i=Ti(e),o=r[0]-i[0],s=r[1]-i[1];return n===1?Math.abs(o)+Math.abs(s):Math.pow(Math.pow(o,n)+Math.pow(s,n),1/n)}function T4(t,e){e=e||{};var n=e.threshold||1e4,r=e.p||2,i=e.binary||!1,o=e.alpha||-1,s=e.standardization||!1,a=[];ii(t,function(m){a.push(up(m))});for(var l=[],c=0;cr&&(o[0]=r),o[0]<-r&&(o[0]=-r),o[1]>r&&(o[1]=r),o[1]<-r&&(o[1]=-r),o}function N4(t){var e=180/Math.PI,n=6378137;return[t[0]*e/n,(Math.PI*.5-2*Math.atan(Math.exp(-t[1]/n)))*e]}function Dae(t){return t<0?-1:t>0?1:0}const Rae=Object.freeze(Object.defineProperty({__proto__:null,toMercator:A4,toWgs84:I4},Symbol.toStringTag,{value:"Module"}));var Bae=function(){for(var t=0,e=0,n=arguments.length;e0?l+u[c-1]:l}),a.forEach(function(l){l=l*2*Math.PI/a[a.length-1];var c=Math.random();s.push([c*(e.max_radial_length||10)*Math.sin(l),c*(e.max_radial_length||10)*Math.cos(l)])}),s[s.length-1]=s[0],s=s.map(Fae($b(e.bbox))),n.push(ur([s]))},i=0;i * @license MIT * @preserve *//*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */function Uae(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(u){return l([c,u])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]e?1:t0){if(e.right===null)break;if(n(t,e.right.key)>0){var a=e.right;if(e.right=a.left,a.left=e,e=a,e.right===null)break}i.right=e,i=e,e=e.right}else break}return i.right=e.left,o.left=e.right,e.left=r.right,e.right=r.left,e}function EL(t,e,n,r){var i=new hp(t,e);if(n===null)return i.left=i.right=null,i;n=dp(t,n,r);var o=r(t,n.key);return o<0?(i.left=n.left,i.right=n,n.left=null):o>=0&&(i.right=n.right,i.left=n,n.right=null),i}function j4(t,e,n){var r=null,i=null;if(e){e=dp(t,e,n);var o=n(e.key,t);o===0?(r=e.left,i=e.right):o<0?(i=e.right,e.right=null,r=e):(r=e.left,e.left=null,i=e)}return{left:r,right:i}}function Wae(t,e,n){return e===null?t:(t===null||(e=dp(t.key,e,n),e.left=t),e)}function SL(t,e,n,r,i){if(t){r(""+e+(n?"└── ":"├── ")+i(t)+` `);var o=e+(n?" ":"│ ");t.left&&SL(t.left,o,!1,r,i),t.right&&SL(t.right,o,!0,r,i)}}var CL=function(){function t(e){e===void 0&&(e=Hae),this._root=null,this._size=0,this._comparator=e}return t.prototype.insert=function(e,n){return this._size++,this._root=EL(e,n,this._root,this._comparator)},t.prototype.add=function(e,n){var r=new hp(e,n);this._root===null&&(r.left=r.right=null,this._size++,this._root=r);var i=this._comparator,o=dp(e,this._root,i),s=i(e,o.key);return s===0?this._root=o:(s<0?(r.left=o.left,r.right=o,o.left=null):s>0&&(r.right=o.right,r.left=o,o.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)},t.prototype._remove=function(e,n,r){var i;if(n===null)return null;n=dp(e,n,r);var o=r(e,n.key);return o===0?(n.left===null?i=n.right:(i=dp(e,n.left,r),i.right=n.right),this._size--,i):n},t.prototype.pop=function(){var e=this._root;if(e){for(;e.left;)e=e.left;return this._root=dp(e.key,this._root,this._comparator),this._root=this._remove(e.key,this._root,this._comparator),{key:e.key,data:e.data}}return null},t.prototype.findStatic=function(e){for(var n=this._root,r=this._comparator;n;){var i=r(e,n.key);if(i===0)return n;i<0?n=n.left:n=n.right}return null},t.prototype.find=function(e){return this._root&&(this._root=dp(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},t.prototype.contains=function(e){for(var n=this._root,r=this._comparator;n;){var i=r(e,n.key);if(i===0)return!0;i<0?n=n.left:n=n.right}return!1},t.prototype.forEach=function(e,n){for(var r=this._root,i=[],o=!1;!o;)r!==null?(i.push(r),r=r.left):i.length!==0?(r=i.pop(),e.call(n,r),r=r.right):o=!0;return this},t.prototype.range=function(e,n,r,i){for(var o=[],s=this._comparator,a=this._root,l;o.length!==0||a;)if(a)o.push(a),a=a.left;else{if(a=o.pop(),l=s(a.key,n),l>0)break;if(s(a.key,e)>=0&&r.call(i,a))return this;a=a.right}return this},t.prototype.keys=function(){var e=[];return this.forEach(function(n){var r=n.key;return e.push(r)}),e},t.prototype.values=function(){var e=[];return this.forEach(function(n){var r=n.data;return e.push(r)}),e},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},t.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},t.prototype.at=function(e){for(var n=this._root,r=!1,i=0,o=[];!r;)if(n)o.push(n),n=n.left;else if(o.length>0){if(n=o.pop(),i===e)return n;i++,n=n.right}else r=!0;return null},t.prototype.next=function(e){var n=this._root,r=null;if(e.right){for(r=e.right;r.left;)r=r.left;return r}for(var i=this._comparator;n;){var o=i(e.key,n.key);if(o===0)break;o<0?(r=n,n=n.left):n=n.right}return r},t.prototype.prev=function(e){var n=this._root,r=null;if(e.left!==null){for(r=e.left;r.right;)r=r.right;return r}for(var i=this._comparator;n;){var o=i(e.key,n.key);if(o===0)break;o<0?n=n.left:(r=n,n=n.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return qae(this._root)},t.prototype.load=function(e,n,r){n===void 0&&(n=[]),r===void 0&&(r=!1);var i=e.length,o=this._comparator;if(r&&ML(e,n,0,i-1,o),this._root===null)this._root=kL(e,n,0,i),this._size=i;else{var s=Yae(this.toList(),Gae(e,n),o);i=this._size+i,this._root=TL({head:s},0,i)}return this},t.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(e){e===void 0&&(e=function(r){return String(r.key)});var n=[];return SL(this._root,"",!0,function(r){return n.push(r)},e),n.join("")},t.prototype.update=function(e,n,r){var i=this._comparator,o=j4(e,this._root,i),s=o.left,a=o.right;i(e,n)<0?a=EL(n,r,a,i):s=EL(n,r,s,i),this._root=Wae(s,a,i)},t.prototype.split=function(e){return j4(e,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var e,n,r;return Uae(this,function(i){switch(i.label){case 0:e=this._root,n=[],r=!1,i.label=1;case 1:return r?[3,6]:e===null?[3,2]:(n.push(e),e=e.left,[3,5]);case 2:return n.length===0?[3,4]:(e=n.pop(),[4,e]);case 3:return i.sent(),e=e.right,[3,5];case 4:r=!0,i.label=5;case 5:return[3,1];case 6:return[2]}})},t}();function kL(t,e,n,r){var i=r-n;if(i>0){var o=n+Math.floor(i/2),s=t[o],a=e[o],l=new hp(s,a);return l.left=kL(t,e,n,o),l.right=kL(t,e,o+1,r),l}return null}function Gae(t,e){for(var n=new hp(null,null),r=n,i=0;i0?(e=o=o.next=n.pop(),e=e.right):r=!0;return o.next=null,i.next}function TL(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),o=TL(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=TL(t,i+1,n),s}return null}function Yae(t,e,n){for(var r=new hp(null,null),i=r,o=t,s=e;o!==null&&s!==null;)n(o.key,s.key)<0?(i.next=o,o=o.next):(i.next=s,s=s.next),i=i.next;return o!==null?i.next=o:s!==null&&(i.next=s),r.next}function ML(t,e,n,r,i){if(!(n>=r)){for(var o=t[n+r>>1],s=n-1,a=r+1;;){do s++;while(i(t[s],o)<0);do a--;while(i(t[a],o)>0);if(s>=a)break;var l=t[s];t[s]=t[a],t[a]=l,l=e[s],e[s]=e[a],e[a]=l}ML(t,e,n,a,i),ML(t,e,a+1,r,i)}}const Yd=11102230246251565e-32,za=134217729,Zae=(3+8*Yd)*Yd;function AL(t,e,n,r,i){let o,s,a,l,c=e[0],u=r[0],d=0,p=0;u>c==u>-c?(o=c,c=e[++d]):(o=u,u=r[++p]);let m=0;if(dc==u>-c?(s=c+o,a=o-(s-c),c=e[++d]):(s=u+o,a=o-(s-u),u=r[++p]),o=s,a!==0&&(i[m++]=a);dc==u>-c?(s=o+c,l=s-o,a=o-(s-l)+(c-l),c=e[++d]):(s=o+u,l=s-o,a=o-(s-l)+(u-l),u=r[++p]),o=s,a!==0&&(i[m++]=a);for(;d=j||-q>=j||(d=t-$,a=t-($+d)+(d-i),d=n-W,c=n-(W+d)+(d-i),d=e-J,l=e-(J+d)+(d-o),d=r-Z,u=r-(Z+d)+(d-o),a===0&&l===0&&c===0&&u===0)||(j=Qae*s+Zae*Math.abs(q),q+=$*u+Z*a-(J*c+W*l),q>=j||-q>=j))return q;E=a*Z,p=za*a,m=p-(p-a),y=a-m,p=za*Z,w=p-(p-Z),x=Z-w,A=y*x-(E-m*w-y*w-m*x),I=l*W,p=za*l,m=p-(p-l),y=l-m,p=za*W,w=p-(p-W),x=W-w,O=y*x-(I-m*w-y*w-m*x),C=A-O,d=A-C,yl[0]=A-(C+d)+(d-O),S=E+C,d=S-E,M=E-(S-d)+(C-d),C=M-I,d=M-C,yl[1]=M-(C+d)+(d-I),z=S+C,d=z-S,yl[2]=S-(z-d)+(C-d),yl[3]=z;const G=AL(4,Nv,4,yl,U4);E=$*u,p=za*$,m=p-(p-$),y=$-m,p=za*u,w=p-(p-u),x=u-w,A=y*x-(E-m*w-y*w-m*x),I=J*c,p=za*J,m=p-(p-J),y=J-m,p=za*c,w=p-(p-c),x=c-w,O=y*x-(I-m*w-y*w-m*x),C=A-O,d=A-C,yl[0]=A-(C+d)+(d-O),S=E+C,d=S-E,M=E-(S-d)+(C-d),C=M-I,d=M-C,yl[1]=M-(C+d)+(d-I),z=S+C,d=z-S,yl[2]=S-(z-d)+(C-d),yl[3]=z;const U=AL(G,U4,4,yl,H4);E=a*u,p=za*a,m=p-(p-a),y=a-m,p=za*u,w=p-(p-u),x=u-w,A=y*x-(E-m*w-y*w-m*x),I=l*c,p=za*l,m=p-(p-l),y=l-m,p=za*c,w=p-(p-c),x=c-w,O=y*x-(I-m*w-y*w-m*x),C=A-O,d=A-C,yl[0]=A-(C+d)+(d-O),S=E+C,d=S-E,M=E-(S-d)+(C-d),C=M-I,d=M-C,yl[1]=M-(C+d)+(d-I),z=S+C,d=z-S,yl[2]=S-(z-d)+(C-d),yl[3]=z;const Q=AL(U,H4,4,yl,W4);return W4[Q-1]}function tle(t,e,n,r,i,o){const s=(e-o)*(n-i),a=(t-i)*(r-o),l=s-a,c=Math.abs(s+a);return Math.abs(l)>=Kae*c?l:-ele(t,e,n,r,i,o,c)}var G4={};const Vb=(t,e)=>t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y,IL=(t,e)=>{if(e.ur.x{if(-fpt.x*e.y-t.y*e.x,Z4=(t,e)=>t.x*e.x+t.y*e.y,X4=(t,e,n)=>{const r=tle(t.x,t.y,e.x,e.y,n.x,n.y);return r>0?-1:r<0?1:0},pS=t=>Math.sqrt(Z4(t,t)),ile=(t,e,n)=>{const r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return fS(i,r)/pS(i)/pS(r)},ole=(t,e,n)=>{const r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return Z4(i,r)/pS(i)/pS(r)},K4=(t,e,n)=>e.y===0?null:{x:t.x+e.x/e.y*(n-t.y),y:n},J4=(t,e,n)=>e.x===0?null:{x:n,y:t.y+e.y/e.x*(n-t.x)},sle=(t,e,n,r)=>{if(e.x===0)return J4(n,r,t.x);if(r.x===0)return J4(t,e,n.x);if(e.y===0)return K4(n,r,t.y);if(r.y===0)return K4(t,e,n.y);const i=fS(e,r);if(i==0)return null;const o={x:n.x-t.x,y:n.y-t.y},s=fS(o,e)/i,a=fS(o,r)/i,l=t.x+a*e.x,c=n.x+s*r.x,u=t.y+a*e.y,d=n.y+s*r.y,p=(l+c)/2,m=(u+d)/2;return{x:p,y:m}};class Qc{static compare(e,n){const r=Qc.comparePoints(e.point,n.point);return r!==0?r:(e.point!==n.point&&e.link(n),e.isLeft!==n.isLeft?e.isLeft?1:-1:pp.compare(e.segment,n.segment))}static comparePoints(e,n){return e.xn.x?1:e.yn.y?1:0}constructor(e,n){e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}link(e){if(e.point===this.point)throw new Error("Tried to link already linked events");const n=e.point.events;for(let r=0,i=n.length;r{const o=i.otherSE;n.set(i,{sine:ile(this.point,e.point,o.point),cosine:ole(this.point,e.point,o.point)})};return(i,o)=>{n.has(i)||r(i),n.has(o)||r(o);const{sine:s,cosine:a}=n.get(i),{sine:l,cosine:c}=n.get(o);return s>=0&&l>=0?ac?-1:0:s<0&&l<0?ac?1:0:ls?1:0}}}let ale=0;class pp{static compare(e,n){const r=e.leftSE.point.x,i=n.leftSE.point.x,o=e.rightSE.point.x,s=n.rightSE.point.x;if(sa&&l>c)return-1;const d=e.comparePoint(n.leftSE.point);if(d<0)return 1;if(d>0)return-1;const p=n.comparePoint(e.rightSE.point);return p!==0?p:-1}if(r>i){if(al&&a>u)return 1;const d=n.comparePoint(e.leftSE.point);if(d!==0)return d;const p=e.comparePoint(n.rightSE.point);return p<0?1:p>0?-1:1}if(al)return 1;if(os){const d=e.comparePoint(n.rightSE.point);if(d<0)return 1;if(d>0)return-1}if(o!==s){const d=c-a,p=o-r,m=u-l,y=s-i;if(d>p&&my)return-1}return o>s?1:ou?1:e.idn.id?1:0}constructor(e,n,r,i){this.id=++ale,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=r,this.windings=i}static fromRing(e,n,r){let i,o,s;const a=Qc.comparePoints(e,n);if(a<0)i=e,o=n,s=1;else if(a>0)i=n,o=e,s=-1;else throw new Error(`Tried to create degenerate segment at [${e.x}, ${e.y}]`);const l=new Qc(i,!0),c=new Qc(o,!1);return new pp(l,c,[r],[s])}replaceRightSE(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const e=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:en?e:n}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(e){return e.x===this.leftSE.point.x&&e.y===this.leftSE.point.y||e.x===this.rightSE.point.x&&e.y===this.rightSE.point.y}comparePoint(e){if(this.isAnEndpoint(e))return 0;const n=this.leftSE.point,r=this.rightSE.point,i=this.vector();if(n.x===r.x)return e.x===n.x?0:e.x0&&a.swapEvents(),Qc.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),o.checkForConsuming()),n}swapEvents(){const e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let n=0,r=this.windings.length;n0){const o=n;n=r,r=o}if(n.prev===r){const o=n;n=r,r=o}for(let o=0,s=r.rings.length;oi.length===1&&i[0].isSubject;this._isInResult=r(e)!==r(n);break}default:throw new Error(`Unrecognized operation type found ${Zu.type}`)}return this._isInResult}}class Q4{constructor(e,n,r){if(!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=r,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const i=jb.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};let o=i;for(let s=1,a=e.length;sthis.bbox.ur.x&&(this.bbox.ur.x=l.x),l.y>this.bbox.ur.y&&(this.bbox.ur.y=l.y),o=l)}(i.x!==o.x||i.y!==o.y)&&this.segments.push(pp.fromRing(o,i,this))}getSweepEvents(){const e=[];for(let n=0,r=this.segments.length;nthis.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=n}getSweepEvents(){const e=this.exteriorRing.getSweepEvents();for(let n=0,r=this.interiorRings.length;nthis.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=n}getSweepEvents(){const e=[];for(let n=0,r=this.polys.length;n0&&(e=s)}let n=e.segment.prevInResult(),r=n?n.prevInResult():null;for(;;){if(!n)return null;if(!r)return n.ringOut;if(r.ringOut!==n.ringOut)return r.ringOut.enclosingRing()!==n.ringOut?n.ringOut:n.ringOut.enclosingRing();n=r.prevInResult(),r=n?n.prevInResult():null}}}class tz{constructor(e){this.exteriorRing=e,e.poly=this,this.interiorRings=[]}addInterior(e){this.interiorRings.push(e),e.poly=this}getGeom(){const e=[this.exteriorRing.getGeom()];if(e[0]===null)return null;for(let n=0,r=this.interiorRings.length;n1&&arguments[1]!==void 0?arguments[1]:pp.compare;this.queue=e,this.tree=new CL(n),this.segments=[]}process(e){const n=e.segment,r=[];if(e.consumedBy)return e.isLeft?this.queue.remove(e.otherSE):this.tree.remove(n),r;const i=e.isLeft?this.tree.add(n):this.tree.find(n);if(!i)throw new Error(`Unable to find segment #${n.id} [${n.leftSE.point.x}, ${n.leftSE.point.y}] -> [${n.rightSE.point.x}, ${n.rightSE.point.y}] in SweepLine tree.`);let o=i,s=i,a,l;for(;a===void 0;)o=this.tree.prev(o),o===null?a=null:o.key.consumedBy===void 0&&(a=o.key);for(;l===void 0;)s=this.tree.next(s),s===null?l=null:s.key.consumedBy===void 0&&(l=s.key);if(e.isLeft){let c=null;if(a){const d=a.getIntersection(n);if(d!==null&&(n.isAnEndpoint(d)||(c=d),!a.isAnEndpoint(d))){const p=this._splitSafely(a,d);for(let m=0,y=p.length;m0?(this.tree.remove(n),r.push(e)):(this.segments.push(n),n.prev=a)}else{if(a&&l){const c=a.getIntersection(l);if(c!==null){if(!a.isAnEndpoint(c)){const u=this._splitSafely(a,c);for(let d=0,p=u.length;dnz)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const s=new ule(o);let a=o.size,l=o.pop();for(;l;){const d=l.key;if(o.size===a){const m=d.segment;throw new Error(`Unable to pop() ${d.isLeft?"left":"right"} SweepEvent [${d.point.x}, ${d.point.y}] from segment #${m.id} [${m.leftSE.point.x}, ${m.leftSE.point.y}] -> [${m.rightSE.point.x}, ${m.rightSE.point.y}] from queue.`)}if(o.size>nz)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(s.segments.length>hle)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const p=s.process(d);for(let m=0,y=p.length;m1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;rn.x?1:this.yn.y?1:0},et.prototype.clone=function(){},et.prototype.copy=function(){return new et(this)},et.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},et.prototype.distance3D=function(e){var n=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return Math.sqrt(n*n+r*r+i*i)},et.prototype.distance=function(e){var n=this.x-e.x,r=this.y-e.y;return Math.sqrt(n*n+r*r)},et.prototype.hashCode=function(){var e=17;return e=37*e+et.hashCode(this.x),e=37*e+et.hashCode(this.y),e},et.prototype.setCoordinate=function(e){this.x=e.x,this.y=e.y,this.z=e.z},et.prototype.interfaces_=function(){return[Hl,gS,Wl]},et.prototype.getClass=function(){return et},et.hashCode=function(){if(arguments.length===1){var e=arguments[0],n=Un.doubleToLongBits(e);return Math.trunc((n^n)>>>32)}},sg.DimensionalComparator.get=function(){return Xd},sg.serialVersionUID.get=function(){return 6683108902428367e3},sg.NULL_ORDINATE.get=function(){return Un.NaN},sg.X.get=function(){return 0},sg.Y.get=function(){return 1},sg.Z.get=function(){return 2},Object.defineProperties(et,sg);var Xd=function(e){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var n=arguments[0];if(n!==2&&n!==3)throw new ji("only 2 or 3 dimensions may be specified");this._dimensionsToTest=n}}};Xd.prototype.compare=function(e,n){var r=e,i=n,o=Xd.compare(r.x,i.x);if(o!==0)return o;var s=Xd.compare(r.y,i.y);if(s!==0)return s;if(this._dimensionsToTest<=2)return 0;var a=Xd.compare(r.z,i.z);return a},Xd.prototype.interfaces_=function(){return[Ov]},Xd.prototype.getClass=function(){return Xd},Xd.compare=function(e,n){return en?1:Un.isNaN(e)?Un.isNaN(n)?0:-1:Un.isNaN(n)?1:0};var Dv=function(){};Dv.prototype.create=function(){},Dv.prototype.interfaces_=function(){return[]},Dv.prototype.getClass=function(){return Dv};var st=function(){},Ub={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};st.prototype.interfaces_=function(){return[]},st.prototype.getClass=function(){return st},st.toLocationSymbol=function(e){switch(e){case st.EXTERIOR:return"e";case st.BOUNDARY:return"b";case st.INTERIOR:return"i";case st.NONE:return"-"}throw new ji("Unknown location value: "+e)},Ub.INTERIOR.get=function(){return 0},Ub.BOUNDARY.get=function(){return 1},Ub.EXTERIOR.get=function(){return 2},Ub.NONE.get=function(){return-1},Object.defineProperties(st,Ub);var Mn=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},vl=function(){},iz={LOG_10:{configurable:!0}};vl.prototype.interfaces_=function(){return[]},vl.prototype.getClass=function(){return vl},vl.log10=function(e){var n=Math.log(e);return Un.isInfinite(n)||Un.isNaN(n)?n:n/vl.LOG_10},vl.min=function(e,n,r,i){var o=e;return nr?r:e}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var i=arguments[0],o=arguments[1],s=arguments[2];return is?s:i}},vl.wrap=function(e,n){return e<0?n- -e%n:e%n},vl.max=function(){if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2],i=e;return n>i&&(i=n),r>i&&(i=r),i}else if(arguments.length===4){var o=arguments[0],s=arguments[1],a=arguments[2],l=arguments[3],c=o;return s>c&&(c=s),a>c&&(c=a),l>c&&(c=l),c}},vl.average=function(e,n){return(e+n)/2},iz.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(vl,iz);var eu=function(e){this.str=e};eu.prototype.append=function(e){this.str+=e},eu.prototype.setCharAt=function(e,n){this.str=this.str.substr(0,e)+n+this.str.substr(e+1)},eu.prototype.toString=function(e){return this.str};var tu=function(e){this.value=e};tu.prototype.intValue=function(){return this.value},tu.prototype.compareTo=function(e){return this.valuee?1:0},tu.isNaN=function(e){return Number.isNaN(e)};var Hb=function(){};Hb.isWhitespace=function(e){return e<=32&&e>=0||e===127},Hb.toUpperCase=function(e){return e.toUpperCase()};var ft=function t(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var r=arguments[0];t.call(this,t.parse(r))}}else if(arguments.length===2){var i=arguments[0],o=arguments[1];this.init(i,o)}},bc={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};ft.prototype.le=function(e){return(this._hi9?(d=!0,p="9"):p="0"+u,a.append(p),r=r.subtract(ft.valueOf(u)).multiply(ft.TEN),d&&r.selfAdd(ft.TEN);var m=!0,y=ft.magnitude(r._hi);if(y<0&&Math.abs(y)>=l-c&&(m=!1),!m)break}return n[0]=i,a.toString()},ft.prototype.sqr=function(){return this.multiply(this)},ft.prototype.doubleValue=function(){return this._hi+this._lo},ft.prototype.subtract=function(){if(arguments[0]instanceof ft){var e=arguments[0];return this.add(e.negate())}else if(typeof arguments[0]=="number"){var n=arguments[0];return this.add(-n)}},ft.prototype.equals=function(){if(arguments.length===1){var e=arguments[0];return this._hi===e._hi&&this._lo===e._lo}},ft.prototype.isZero=function(){return this._hi===0&&this._lo===0},ft.prototype.selfSubtract=function(){if(arguments[0]instanceof ft){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e._hi,-e._lo)}else if(typeof arguments[0]=="number"){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n,0)}},ft.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},ft.prototype.min=function(e){return this.le(e)?this:e},ft.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof ft){var e=arguments[0];return this.selfDivide(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var n=arguments[0];return this.selfDivide(n,0)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1],o=null,s=null,a=null,l=null,c=null,u=null,d=null,p=null;return c=this._hi/r,u=ft.SPLIT*c,o=u-c,p=ft.SPLIT*r,o=u-o,s=c-o,a=p-r,d=c*r,a=p-a,l=r-a,p=o*a-d+o*l+s*a+s*l,u=(this._hi-d-p+this._lo-c*i)/r,p=c+u,this._hi=p,this._lo=c-p+u,this}},ft.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},ft.prototype.divide=function(){if(arguments[0]instanceof ft){var e=arguments[0],n=null,r=null,i=null,o=null,s=null,a=null,l=null,c=null;s=this._hi/e._hi,a=ft.SPLIT*s,n=a-s,c=ft.SPLIT*e._hi,n=a-n,r=s-n,i=c-e._hi,l=s*e._hi,i=c-i,o=e._hi-i,c=n*i-l+n*o+r*i+r*o,a=(this._hi-l-c+this._lo-s*e._lo)/e._hi,c=s+a;var u=c,d=s-c+a;return new ft(u,d)}else if(typeof arguments[0]=="number"){var p=arguments[0];return Un.isNaN(p)?ft.createNaN():ft.copy(this).selfDivide(p,0)}},ft.prototype.ge=function(e){return(this._hi>e._hi||this._hi===e._hi)&&this._lo>=e._lo},ft.prototype.pow=function(e){if(e===0)return ft.valueOf(1);var n=new ft(this),r=ft.valueOf(1),i=Math.abs(e);if(i>1)for(;i>0;)i%2===1&&r.selfMultiply(n),i/=2,i>0&&(n=n.sqr());else r=n;return e<0?r.reciprocal():r},ft.prototype.ceil=function(){if(this.isNaN())return ft.NaN;var e=Math.ceil(this._hi),n=0;return e===this._hi&&(n=Math.ceil(this._lo)),new ft(e,n)},ft.prototype.compareTo=function(e){var n=e;return this._hin._hi?1:this._lon._lo?1:0},ft.prototype.rint=function(){if(this.isNaN())return this;var e=this.add(.5);return e.floor()},ft.prototype.setValue=function(){if(arguments[0]instanceof ft){var e=arguments[0];return this.init(e),this}else if(typeof arguments[0]=="number"){var n=arguments[0];return this.init(n),this}},ft.prototype.max=function(e){return this.ge(e)?this:e},ft.prototype.sqrt=function(){if(this.isZero())return ft.valueOf(0);if(this.isNegative())return ft.NaN;var e=1/Math.sqrt(this._hi),n=this._hi*e,r=ft.valueOf(n),i=this.subtract(r.sqr()),o=i._hi*(e*.5);return r.add(o)},ft.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof ft){var e=arguments[0];return this.selfAdd(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var n=arguments[0],r=null,i=null,o=null,s=null,a=null,l=null;return o=this._hi+n,a=o-this._hi,s=o-a,s=n-a+(this._hi-s),l=s+this._lo,r=o+l,i=l+(o-r),this._hi=r+i,this._lo=i+(r-this._hi),this}}else if(arguments.length===2){var c=arguments[0],u=arguments[1],d=null,p=null,m=null,y=null,w=null,x=null,C=null,S=null;w=this._hi+c,m=this._lo+u,C=w-this._hi,S=m-this._lo,x=w-C,y=m-S,x=c-C+(this._hi-x),y=u-S+(this._lo-y),C=x+m,d=w+C,p=C+(w-d),C=y+p;var M=d+C,E=C+(d-M);return this._hi=M,this._lo=E,this}},ft.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof ft){var e=arguments[0];return this.selfMultiply(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var n=arguments[0];return this.selfMultiply(n,0)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1],o=null,s=null,a=null,l=null,c=null,u=null;c=ft.SPLIT*this._hi,o=c-this._hi,u=ft.SPLIT*r,o=c-o,s=this._hi-o,a=u-r,c=this._hi*r,a=u-a,l=r-a,u=o*a-c+o*l+s*a+s*l+(this._hi*i+this._lo*r);var d=c+u;o=c-d;var p=u+o;return this._hi=d,this._lo=p,this}},ft.prototype.selfSqr=function(){return this.selfMultiply(this)},ft.prototype.floor=function(){if(this.isNaN())return ft.NaN;var e=Math.floor(this._hi),n=0;return e===this._hi&&(n=Math.floor(this._lo)),new ft(e,n)},ft.prototype.negate=function(){return this.isNaN()?this:new ft(-this._hi,-this._lo)},ft.prototype.clone=function(){},ft.prototype.multiply=function(){if(arguments[0]instanceof ft){var e=arguments[0];return e.isNaN()?ft.createNaN():ft.copy(this).selfMultiply(e)}else if(typeof arguments[0]=="number"){var n=arguments[0];return Un.isNaN(n)?ft.createNaN():ft.copy(this).selfMultiply(n,0)}},ft.prototype.isNaN=function(){return Un.isNaN(this._hi)},ft.prototype.intValue=function(){return Math.trunc(this._hi)},ft.prototype.toString=function(){var e=ft.magnitude(this._hi);return e>=-3&&e<=20?this.toStandardNotation():this.toSciNotation()},ft.prototype.toStandardNotation=function(){var e=this.getSpecialNumberString();if(e!==null)return e;var n=new Array(1).fill(null),r=this.extractSignificantDigits(!0,n),i=n[0]+1,o=r;if(r.charAt(0)===".")o="0"+r;else if(i<0)o="0."+ft.stringOfChar("0",-i)+r;else if(r.indexOf(".")===-1){var s=i-r.length,a=ft.stringOfChar("0",s);o=r+a+".0"}return this.isNegative()?"-"+o:o},ft.prototype.reciprocal=function(){var e=null,n=null,r=null,i=null,o=null,s=null,a=null,l=null;o=1/this._hi,s=ft.SPLIT*o,e=s-o,l=ft.SPLIT*this._hi,e=s-e,n=o-e,r=l-this._hi,a=o*this._hi,r=l-r,i=this._hi-r,l=e*r-a+e*i+n*r+n*i,s=(1-a-l-o*this._lo)/this._hi;var c=o+s,u=o-c+s;return new ft(c,u)},ft.prototype.toSciNotation=function(){if(this.isZero())return ft.SCI_NOT_ZERO;var e=this.getSpecialNumberString();if(e!==null)return e;var n=new Array(1).fill(null),r=this.extractSignificantDigits(!1,n),i=ft.SCI_NOT_EXPONENT_CHAR+n[0];if(r.charAt(0)==="0")throw new Error("Found leading zero: "+r);var o="";r.length>1&&(o=r.substring(1));var s=r.charAt(0)+"."+o;return this.isNegative()?"-"+s+i:s+i},ft.prototype.abs=function(){return this.isNaN()?ft.NaN:this.isNegative()?this.negate():new ft(this)},ft.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},ft.prototype.lt=function(e){return(this._hie._hi||this._hi===e._hi)&&this._lo>e._lo},ft.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},ft.prototype.trunc=function(){return this.isNaN()?ft.NaN:this.isPositive()?this.floor():this.ceil()},ft.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},ft.prototype.interfaces_=function(){return[Wl,Hl,gS]},ft.prototype.getClass=function(){return ft},ft.sqr=function(e){return ft.valueOf(e).selfMultiply(e)},ft.valueOf=function(){if(typeof arguments[0]=="string"){var e=arguments[0];return ft.parse(e)}else if(typeof arguments[0]=="number"){var n=arguments[0];return new ft(n)}},ft.sqrt=function(e){return ft.valueOf(e).sqrt()},ft.parse=function(e){for(var n=0,r=e.length;Hb.isWhitespace(e.charAt(n));)n++;var i=!1;if(n=r);){var u=e.charAt(n);if(n++,Hb.isDigit(u)){var d=u-"0";s.selfMultiply(ft.TEN),s.selfAdd(d),a++;continue}if(u==="."){l=a;continue}if(u==="e"||u==="E"){var p=e.substring(n);try{c=tu.parseInt(p)}catch(C){throw C instanceof Error?new Error("Invalid exponent "+p+" in string "+e):C}finally{}break}throw new Error("Unexpected character '"+u+"' at position "+n+" in string "+e)}var m=s,y=a-l-c;if(y===0)m=s;else if(y>0){var w=ft.TEN.pow(y);m=s.divide(w)}else if(y<0){var x=ft.TEN.pow(-y);m=s.multiply(x)}return i?m.negate():m},ft.createNaN=function(){return new ft(Un.NaN,Un.NaN)},ft.copy=function(e){return new ft(e)},ft.magnitude=function(e){var n=Math.abs(e),r=Math.log(n)/Math.log(10),i=Math.trunc(Math.floor(r)),o=Math.pow(10,i);return o*10<=n&&(i+=1),i},ft.stringOfChar=function(e,n){for(var r=new eu,i=0;i0){if(s<=0)return xa.signum(a);i=o+s}else if(o<0){if(s>=0)return xa.signum(a);i=-o-s}else return xa.signum(a);var l=xa.DP_SAFE_EPSILON*i;return a>=l||-a>=l?xa.signum(a):2},xa.signum=function(e){return e>0?1:e<0?-1:0},oz.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(xa,oz);var _r=function(){},Wb={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Wb.X.get=function(){return 0},Wb.Y.get=function(){return 1},Wb.Z.get=function(){return 2},Wb.M.get=function(){return 3},_r.prototype.setOrdinate=function(e,n,r){},_r.prototype.size=function(){},_r.prototype.getOrdinate=function(e,n){},_r.prototype.getCoordinate=function(){},_r.prototype.getCoordinateCopy=function(e){},_r.prototype.getDimension=function(){},_r.prototype.getX=function(e){},_r.prototype.clone=function(){},_r.prototype.expandEnvelope=function(e){},_r.prototype.copy=function(){},_r.prototype.getY=function(e){},_r.prototype.toCoordinateArray=function(){},_r.prototype.interfaces_=function(){return[gS]},_r.prototype.getClass=function(){return _r},Object.defineProperties(_r,Wb);var sz=function(){},Rv=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(sz),us=function(){};us.arraycopy=function(e,n,r,i,o){for(var s=0,a=n;ae._minx?this._minx:e._minx,r=this._miny>e._miny?this._miny:e._miny,i=this._maxx=this._minx&&n.getMaxX()<=this._maxx&&n.getMinY()>=this._miny&&n.getMaxY()<=this._maxy}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];return this.isNull()?!1:r>=this._minx&&r<=this._maxx&&i>=this._miny&&i<=this._maxy}},fn.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof fn){var e=arguments[0];return this.isNull()||e.isNull()?!1:!(e._minx>this._maxx||e._maxxthis._maxy||e._maxythis._maxx||rthis._maxy||ithis._maxx&&(this._maxx=n._maxx),n._minythis._maxy&&(this._maxy=n._maxy))}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.isNull()?(this._minx=r,this._maxx=r,this._miny=i,this._maxy=i):(rthis._maxx&&(this._maxx=r),ithis._maxy&&(this._maxy=i))}},fn.prototype.minExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),n=this.getHeight();return en._minx?1:this._minyn._miny?1:this._maxxn._maxx?1:this._maxyn._maxy?1:0},fn.prototype.translate=function(e,n){if(this.isNull())return null;this.init(this.getMinX()+e,this.getMaxX()+e,this.getMinY()+n,this.getMaxY()+n)},fn.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},fn.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},fn.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},fn.prototype.maxExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),n=this.getHeight();return e>n?e:n},fn.prototype.expandBy=function(){if(arguments.length===1){var e=arguments[0];this.expandBy(e,e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];if(this.isNull())return null;this._minx-=n,this._maxx+=n,this._miny-=r,this._maxy+=r,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},fn.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof fn){var e=arguments[0];return this.covers(e)}else if(arguments[0]instanceof et){var n=arguments[0];return this.covers(n)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];return this.covers(r,i)}},fn.prototype.centre=function(){return this.isNull()?null:new et((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},fn.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof et){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof fn){var n=arguments[0];this._minx=n._minx,this._maxx=n._maxx,this._miny=n._miny,this._maxy=n._maxy}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.init(r.x,i.x,r.y,i.y)}else if(arguments.length===4){var o=arguments[0],s=arguments[1],a=arguments[2],l=arguments[3];oe._maxx&&(n=this._minx-e._maxx);var r=0;return this._maxye._maxy&&(r=this._miny-e._maxy),n===0?r:r===0?n:Math.sqrt(n*n+r*r)},fn.prototype.hashCode=function(){var e=17;return e=37*e+et.hashCode(this._minx),e=37*e+et.hashCode(this._maxx),e=37*e+et.hashCode(this._miny),e=37*e+et.hashCode(this._maxy),e},fn.prototype.interfaces_=function(){return[Hl,Wl]},fn.prototype.getClass=function(){return fn},fn.intersects=function(){if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2];return r.x>=(e.xn.x?e.x:n.x)&&r.y>=(e.yn.y?e.y:n.y)}else if(arguments.length===4){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],l=Math.min(s.x,a.x),c=Math.max(s.x,a.x),u=Math.min(i.x,o.x),d=Math.max(i.x,o.x);return!(u>c||dc)||dr?(this._intLineIndex[e][0]=0,this._intLineIndex[e][1]=1):(this._intLineIndex[e][0]=1,this._intLineIndex[e][1]=0)}},Yi.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},Yi.prototype.setPrecisionModel=function(e){this._precisionModel=e},Yi.prototype.isInteriorIntersection=function(){var e=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var n=arguments[0],r=0;ro?s=i:s=o;else{var a=Math.abs(e.x-n.x),l=Math.abs(e.y-n.y);i>o?s=a:s=l,s===0&&!e.equals(n)&&(s=Math.max(a,l))}return Yn.isTrue(!(s===0&&!e.equals(n)),"Bad distance calculation"),s},Yi.nonRobustComputeEdgeDistance=function(e,n,r){var i=e.x-n.x,o=e.y-n.y,s=Math.sqrt(i*i+o*o);return Yn.isTrue(!(s===0&&!e.equals(n)),"Invalid distance calculation"),s},ag.DONT_INTERSECT.get=function(){return 0},ag.DO_INTERSECT.get=function(){return 1},ag.COLLINEAR.get=function(){return 2},ag.NO_INTERSECTION.get=function(){return 0},ag.POINT_INTERSECTION.get=function(){return 1},ag.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(Yi,ag);var mp=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(r){var i=new fn(this._inputLines[0][0],this._inputLines[0][1]),o=new fn(this._inputLines[1][0],this._inputLines[1][1]);return i.contains(r)&&o.contains(r)},e.prototype.computeIntersection=function(){if(arguments.length===3){var r=arguments[0],i=arguments[1],o=arguments[2];if(this._isProper=!1,fn.intersects(i,o,r)&&Ut.orientationIndex(i,o,r)===0&&Ut.orientationIndex(o,i,r)===0)return this._isProper=!0,(r.equals(i)||r.equals(o))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION}else return t.prototype.computeIntersection.apply(this,arguments)},e.prototype.normalizeToMinimum=function(r,i,o,s,a){a.x=this.smallestInAbsValue(r.x,i.x,o.x,s.x),a.y=this.smallestInAbsValue(r.y,i.y,o.y,s.y),r.x-=a.x,r.y-=a.y,i.x-=a.x,i.y-=a.y,o.x-=a.x,o.y-=a.y,s.x-=a.x,s.y-=a.y},e.prototype.safeHCoordinateIntersection=function(r,i,o,s){var a=null;try{a=wc.intersection(r,i,o,s)}catch(l){if(l instanceof Rv)a=e.nearestEndpoint(r,i,o,s);else throw l}finally{}return a},e.prototype.intersection=function(r,i,o,s){var a=this.intersectionWithNormalization(r,i,o,s);return this.isInSegmentEnvelopes(a)||(a=new et(e.nearestEndpoint(r,i,o,s))),this._precisionModel!==null&&this._precisionModel.makePrecise(a),a},e.prototype.smallestInAbsValue=function(r,i,o,s){var a=r,l=Math.abs(a);return Math.abs(i)1e-4&&us.out.println("Distance = "+a.distance(l))},e.prototype.intersectionWithNormalization=function(r,i,o,s){var a=new et(r),l=new et(i),c=new et(o),u=new et(s),d=new et;this.normalizeToEnvCentre(a,l,c,u,d);var p=this.safeHCoordinateIntersection(a,l,c,u);return p.x+=d.x,p.y+=d.y,p},e.prototype.computeCollinearIntersection=function(r,i,o,s){var a=fn.intersects(r,i,o),l=fn.intersects(r,i,s),c=fn.intersects(o,s,r),u=fn.intersects(o,s,i);return a&&l?(this._intPt[0]=o,this._intPt[1]=s,t.COLLINEAR_INTERSECTION):c&&u?(this._intPt[0]=r,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):a&&c?(this._intPt[0]=o,this._intPt[1]=r,o.equals(r)&&!l&&!u?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):a&&u?(this._intPt[0]=o,this._intPt[1]=i,o.equals(i)&&!l&&!c?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):l&&c?(this._intPt[0]=s,this._intPt[1]=r,s.equals(r)&&!a&&!u?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):l&&u?(this._intPt[0]=s,this._intPt[1]=i,s.equals(i)&&!a&&!c?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(r,i,o,s,a){var l=r.xi.x?r.x:i.x,d=r.y>i.y?r.y:i.y,p=o.xs.x?o.x:s.x,w=o.y>s.y?o.y:s.y,x=l>p?l:p,C=um?c:m,M=d0&&l>0||a<0&&l<0)return t.NO_INTERSECTION;var c=Ut.orientationIndex(o,s,r),u=Ut.orientationIndex(o,s,i);if(c>0&&u>0||c<0&&u<0)return t.NO_INTERSECTION;var d=a===0&&l===0&&c===0&&u===0;return d?this.computeCollinearIntersection(r,i,o,s):(a===0||l===0||c===0||u===0?(this._isProper=!1,r.equals2D(o)||r.equals2D(s)?this._intPt[0]=r:i.equals2D(o)||i.equals2D(s)?this._intPt[0]=i:a===0?this._intPt[0]=new et(o):l===0?this._intPt[0]=new et(s):c===0?this._intPt[0]=new et(r):u===0&&(this._intPt[0]=new et(i))):(this._isProper=!0,this._intPt[0]=this.intersection(r,i,o,s)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(r,i,o,s){var a=r,l=Ut.distancePointLine(r,o,s),c=Ut.distancePointLine(i,o,s);return c0?r>0?-o:o:r>0?o:-o;if(n===0||r===0)return i>0?e>0?o:-o:e>0?-o:o;if(n>0?i>0?n<=i||(o=-o,s=e,e=r,r=s,s=n,n=i,i=s):n<=-i?(o=-o,r=-r,i=-i):(s=e,e=-r,r=s,s=n,n=-i,i=s):i>0?-n<=i?(o=-o,e=-e,n=-n):(s=-e,e=r,r=s,s=-n,n=i,i=s):n>=i?(e=-e,n=-n,r=-r,i=-i):(o=-o,s=-e,e=-r,r=s,s=-n,n=-i,i=s),e>0)if(r>0){if(!(e<=r))return o}else return o;else{if(r>0)return-o;if(e>=r)o=-o,e=-e,r=-r;else return-o}for(;;){if(a=Math.floor(r/e),r=r-a*e,i=i-a*n,i<0)return-o;if(i>n)return o;if(e>r+r){if(ni+i)return-o;r=e-r,i=n-i,o=-o}if(i===0)return r===0?0:-o;if(r===0||(a=Math.floor(e/r),e=e-a*r,n=n-a*i,n<0))return o;if(n>i)return-o;if(r>e+e){if(in+n)return o;e=r-e,n=i-n,o=-o}if(n===0)return e===0?0:o;if(e===0)return-o}};var ru=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var e=arguments[0];this._p=e};ru.prototype.countSegment=function(e,n){if(e.xi&&(r=n.x,i=e.x),this._p.x>=r&&this._p.x<=i&&(this._isPointOnSegment=!0),null}if(e.y>this._p.y&&n.y<=this._p.y||n.y>this._p.y&&e.y<=this._p.y){var o=e.x-this._p.x,s=e.y-this._p.y,a=n.x-this._p.x,l=n.y-this._p.y,c=lg.signOfDet2x2(o,s,a,l);if(c===0)return this._isPointOnSegment=!0,null;l0&&this._crossingCount++}},ru.prototype.isPointInPolygon=function(){return this.getLocation()!==st.EXTERIOR},ru.prototype.getLocation=function(){return this._isPointOnSegment?st.BOUNDARY:this._crossingCount%2===1?st.INTERIOR:st.EXTERIOR},ru.prototype.isOnSegment=function(){return this._isPointOnSegment},ru.prototype.interfaces_=function(){return[]},ru.prototype.getClass=function(){return ru},ru.locatePointInRing=function(){if(arguments[0]instanceof et&&Mn(arguments[1],_r)){for(var e=arguments[0],n=arguments[1],r=new ru(e),i=new et,o=new et,s=1;s1||c<0||c>1)&&(o=!0)}}return o?vl.min(Ut.distancePointLine(e,r,i),Ut.distancePointLine(n,r,i),Ut.distancePointLine(r,e,n),Ut.distancePointLine(i,e,n)):0},Ut.isPointInRing=function(e,n){return Ut.locatePointInRing(e,n)!==st.EXTERIOR},Ut.computeLength=function(e){var n=e.size();if(n<=1)return 0;var r=0,i=new et;e.getCoordinate(0,i);for(var o=i.x,s=i.y,a=1;ar.y&&(r=s,i=o)}var a=i;do a=a-1,a<0&&(a=n);while(e[a].equals2D(r)&&a!==i);var l=i;do l=(l+1)%n;while(e[l].equals2D(r)&&l!==i);var c=e[a],u=e[l];if(c.equals2D(r)||u.equals2D(r)||c.equals2D(u))return!1;var d=Ut.computeOrientation(c,r,u),p=!1;return d===0?p=c.x>u.x:p=d>0,p},Ut.locatePointInRing=function(e,n){return ru.locatePointInRing(e,n)},Ut.distancePointLinePerpendicular=function(e,n,r){var i=(r.x-n.x)*(r.x-n.x)+(r.y-n.y)*(r.y-n.y),o=((n.y-e.y)*(r.x-n.x)-(n.x-e.x)*(r.y-n.y))/i;return Math.abs(o)*Math.sqrt(i)},Ut.computeOrientation=function(e,n,r){return Ut.orientationIndex(e,n,r)},Ut.distancePointLine=function(){if(arguments.length===2){var e=arguments[0],n=arguments[1];if(n.length===0)throw new ji("Line array must contain at least one vertex");for(var r=e.distance(n[0]),i=0;i=1)return s.distance(l);var d=((a.y-s.y)*(l.x-a.x)-(a.x-s.x)*(l.y-a.y))/c;return Math.abs(d)*Math.sqrt(c)}},Ut.isOnLine=function(e,n){for(var r=new mp,i=1;i0},$v.prototype.interfaces_=function(){return[Gl]},$v.prototype.getClass=function(){return $v};var zv=function(){};zv.prototype.isInBoundary=function(e){return e>1},zv.prototype.interfaces_=function(){return[Gl]},zv.prototype.getClass=function(){return zv};var Vv=function(){};Vv.prototype.isInBoundary=function(e){return e===1},Vv.prototype.interfaces_=function(){return[Gl]},Vv.prototype.getClass=function(){return Vv};var Po=function(){};Po.prototype.add=function(){},Po.prototype.addAll=function(){},Po.prototype.isEmpty=function(){},Po.prototype.iterator=function(){},Po.prototype.size=function(){},Po.prototype.toArray=function(){},Po.prototype.remove=function(){};function PL(t){this.message=t||""}PL.prototype=new Error,PL.prototype.name="IndexOutOfBoundsException";var jv=function(){};jv.prototype.hasNext=function(){},jv.prototype.next=function(){},jv.prototype.remove=function(){};var Ec=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(Po);function Uv(t){this.message=t||""}Uv.prototype=new Error,Uv.prototype.name="NoSuchElementException";var $t=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof Po&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,Po]},e.prototype.add=function(r){return arguments.length===1?this.array_.push(r):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(r){for(var i=this,o=r.iterator();o.hasNext();)i.add(o.next());return!0},e.prototype.set=function(r,i){var o=this.array_[r];return this.array_[r]=i,o},e.prototype.iterator=function(){return new ple(this)},e.prototype.get=function(r){if(r<0||r>=this.size())throw new PL;return this.array_[r]},e.prototype.isEmpty=function(){return this.array_.length===0},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var r=this,i=[],o=0,s=this.array_.length;o=1){var u=this.get(this.size()-1);if(u.equals2D(l))return null}t.prototype.add.call(this,l)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var d=arguments[0],p=arguments[1];return this.add(d,p),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var m=arguments[0],y=arguments[1],w=arguments[2];if(w)for(var x=0;x=0;C--)i.add(m[C],y);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof et){var S=arguments[0],M=arguments[1],E=arguments[2];if(!E){var A=this.size();if(A>0){if(S>0){var I=this.get(S-1);if(I.equals2D(M))return null}if(SJ&&(Z=-1);for(var q=W;q!==J;q+=Z)i.add(z[q],$);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new et(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}($t),or=function(){},_S={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};_S.ForwardComparator.get=function(){return qb},_S.BidirectionalComparator.get=function(){return Hv},_S.coordArrayType.get=function(){return new Array(0).fill(null)},or.prototype.interfaces_=function(){return[]},or.prototype.getClass=function(){return or},or.isRing=function(e){return!(e.length<4||!e[0].equals2D(e[e.length-1]))},or.ptNotInList=function(e,n){for(var r=0;r=e?n:[]},or.indexOf=function(e,n){for(var r=0;r0)&&(n=e[r]);return n},or.extract=function(e,n,r){n=vl.clamp(n,0,e.length),r=vl.clamp(r,-1,e.length);var i=r-n+1;r<0&&(i=0),n>=e.length&&(i=0),ri.length)return 1;if(r.length===0)return 0;var o=or.compare(r,i),s=or.isEqualReversed(r,i);return s?0:o},Hv.prototype.OLDcompare=function(e,n){var r=e,i=n;if(r.lengthi.length)return 1;if(r.length===0)return 0;for(var o=or.increasingDirection(r),s=or.increasingDirection(i),a=o>0?0:r.length-1,l=s>0?0:r.length-1,c=0;c0)e=e.right;else return e.value}return null},Rs.prototype.put=function(t,e){if(this.root_===null)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:Gh,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,r,i;do if(r=n,i=t.compareTo(n.key),i<0)n=n.left;else if(i>0)n=n.right;else{var o=n.value;return n.value=e,o}while(n!==null);var s={key:t,left:null,right:null,value:e,parent:r,color:Gh,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?r.left=s:r.right=s,this.fixAfterInsertion(s),this.size_++,null},Rs.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=gp;t!=null&&t!==this.root_&&t.parent.color===gp;)if(Mi(t)===OL(Mi(Mi(t)))){var n=cz(Mi(Mi(t)));lz(n)===gp?(qh(Mi(t),Gh),qh(n,Gh),qh(Mi(Mi(t)),gp),t=Mi(Mi(t))):(t===cz(Mi(t))&&(t=Mi(t),e.rotateLeft(t)),qh(Mi(t),Gh),qh(Mi(Mi(t)),gp),e.rotateRight(Mi(Mi(t))))}else{var r=OL(Mi(Mi(t)));lz(r)===gp?(qh(Mi(t),Gh),qh(r,Gh),qh(Mi(Mi(t)),gp),t=Mi(Mi(t))):(t===OL(Mi(t))&&(t=Mi(t),e.rotateRight(t)),qh(Mi(t),Gh),qh(Mi(Mi(t)),gp),e.rotateLeft(Mi(Mi(t))))}this.root_.color=Gh},Rs.prototype.values=function(){var t=new $t,e=this.getFirstEntry();if(e!==null)for(t.add(e.value);(e=Rs.successor(e))!==null;)t.add(e.value);return t},Rs.prototype.entrySet=function(){var t=new NL,e=this.getFirstEntry();if(e!==null)for(t.add(e);(e=Rs.successor(e))!==null;)t.add(e);return t},Rs.prototype.rotateLeft=function(t){if(t!=null){var e=t.right;t.right=e.left,e.left!=null&&(e.left.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}},Rs.prototype.rotateRight=function(t){if(t!=null){var e=t.left;t.left=e.right,e.right!=null&&(e.right.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}},Rs.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t},Rs.successor=function(t){if(t===null)return null;if(t.right!==null){for(var e=t.right;e.left!==null;)e=e.left;return e}else{for(var n=t.parent,r=t;n!==null&&r===n.right;)r=n,n=n.parent;return n}},Rs.prototype.size=function(){return this.size_};var Zb=function(){};Zb.prototype.interfaces_=function(){return[]},Zb.prototype.getClass=function(){return Zb};function uz(){}uz.prototype=new bS;function iu(){this.array_=[],arguments[0]instanceof Po&&this.addAll(arguments[0])}iu.prototype=new uz,iu.prototype.contains=function(t){for(var e=this,n=0,r=this.array_.length;n=0;){var a=o.substring(0,s);i.add(a),o=o.substring(s+r),s=o.indexOf(n)}o.length>0&&i.add(o);for(var l=new Array(i.size()).fill(null),c=0;c0)for(var s=o;s0&&i.append(" ");for(var s=0;s0&&i.append(","),i.append(Yl.toString(e.getOrdinate(o,s)))}return i.append(")"),i.toString()}},fo.ensureValidRing=function(e,n){var r=n.size();if(r===0)return n;if(r<=3)return fo.createClosedRing(e,n,4);var i=n.getOrdinate(0,_r.X)===n.getOrdinate(r-1,_r.X)&&n.getOrdinate(0,_r.Y)===n.getOrdinate(r-1,_r.Y);return i?n:fo.createClosedRing(e,n,r+1)},fo.createClosedRing=function(e,n,r){var i=e.create(r,n.getDimension()),o=n.size();fo.copy(n,0,i,0,o);for(var s=o;s0&&fo.reverse(i._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?ei.FALSE:0},e.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return Ut.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var i=this._points.copy();fo.reverse(i);var o=this.getFactory().createLineString(i);return o},e.prototype.compareToSameClass=function(){var i=this;if(arguments.length===1){for(var o=arguments[0],s=o,a=0,l=0;a= 2)");this._points=i},e.prototype.isCoordinate=function(i){for(var o=this,s=0;s=1&&this.getCoordinateSequence().size()= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,n),e}(eo),Qu=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return kn.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(arguments.length===2){var i=arguments[0],o=arguments[1];return this.isEquivalentClass(i)?t.prototype.equalsExact.call(this,i,o):!1}else return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var i=this,o=this._geometries.length,s=new Array(o).fill(null),a=0;a0?n.createPoint(r[0]):n.createPoint():e},Jb.prototype.interfaces_=function(){return[Zl.GeometryEditorOperation]},Jb.prototype.getClass=function(){return Jb};var Qb=function(){};Qb.prototype.edit=function(e,n){return e instanceof Ju?n.createLinearRing(this.edit(e.getCoordinateSequence(),e)):e instanceof eo?n.createLineString(this.edit(e.getCoordinateSequence(),e)):e instanceof Va?n.createPoint(this.edit(e.getCoordinateSequence(),e)):e},Qb.prototype.interfaces_=function(){return[Zl.GeometryEditorOperation]},Qb.prototype.getClass=function(){return Qb};var po=function(){var e=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var n=arguments[0];this._coordinates=new Array(n).fill(null);for(var r=0;r0){var n=new eu(17*this._coordinates.length);n.append("("),n.append(this._coordinates[0]);for(var r=1;r3&&(i=3),i<2?new po(r):new po(r,i)}},eh.prototype.interfaces_=function(){return[Dv,Wl]},eh.prototype.getClass=function(){return eh},eh.instance=function(){return eh.instanceObject},RL.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},RL.instanceObject.get=function(){return new eh},Object.defineProperties(eh,RL);var dz=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(r){return this.map_.get(r)||null},e.prototype.put=function(r,i){return this.map_.set(r,i),i},e.prototype.values=function(){for(var r=new $t,i=this.map_.values(),o=i.next();!o.done;)r.add(o.value),o=i.next();return r},e.prototype.entrySet=function(){var r=new NL;return this.map_.entries().forEach(function(i){return r.add(i)}),r},e.prototype.size=function(){return this.map_.size()},e}(ug),ti=function t(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=t.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof su){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=t.FIXED,this.setScale(n)}else if(arguments[0]instanceof t){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}}},BL={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};ti.prototype.equals=function(e){if(!(e instanceof ti))return!1;var n=e;return this._modelType===n._modelType&&this._scale===n._scale},ti.prototype.compareTo=function(e){var n=e,r=this.getMaximumSignificantDigits(),i=n.getMaximumSignificantDigits();return new tu(r).compareTo(new tu(i))},ti.prototype.getScale=function(){return this._scale},ti.prototype.isFloating=function(){return this._modelType===ti.FLOATING||this._modelType===ti.FLOATING_SINGLE},ti.prototype.getType=function(){return this._modelType},ti.prototype.toString=function(){var e="UNKNOWN";return this._modelType===ti.FLOATING?e="Floating":this._modelType===ti.FLOATING_SINGLE?e="Floating-Single":this._modelType===ti.FIXED&&(e="Fixed (Scale="+this.getScale()+")"),e},ti.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var e=arguments[0];if(Un.isNaN(e))return e;if(this._modelType===ti.FLOATING_SINGLE){var n=e;return n}return this._modelType===ti.FIXED?Math.round(e*this._scale)/this._scale:e}else if(arguments[0]instanceof et){var r=arguments[0];if(this._modelType===ti.FLOATING)return null;r.x=this.makePrecise(r.x),r.y=this.makePrecise(r.y)}},ti.prototype.getMaximumSignificantDigits=function(){var e=16;return this._modelType===ti.FLOATING?e=16:this._modelType===ti.FLOATING_SINGLE?e=6:this._modelType===ti.FIXED&&(e=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),e},ti.prototype.setScale=function(e){this._scale=Math.abs(e)},ti.prototype.interfaces_=function(){return[Wl,Hl]},ti.prototype.getClass=function(){return ti},ti.mostPrecise=function(e,n){return e.compareTo(n)>=0?e:n},BL.serialVersionUID.get=function(){return 7777263578777804e3},BL.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(ti,BL);var su=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},FL={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};su.prototype.readResolve=function(){return su.nameToTypeMap.get(this._name)},su.prototype.toString=function(){return this._name},su.prototype.interfaces_=function(){return[Wl]},su.prototype.getClass=function(){return su},FL.serialVersionUID.get=function(){return-552860263173159e4},FL.nameToTypeMap.get=function(){return new dz},Object.defineProperties(su,FL),ti.Type=su,ti.FIXED=new su("FIXED"),ti.FLOATING=new su("FLOATING"),ti.FLOATING_SINGLE=new su("FLOATING SINGLE");var sr=function t(){this._precisionModel=new ti,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Mn(arguments[0],Dv)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof ti&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},fz={serialVersionUID:{configurable:!0}};sr.prototype.toGeometry=function(e){return e.isNull()?this.createPoint(null):e.getMinX()===e.getMaxX()&&e.getMinY()===e.getMaxY()?this.createPoint(new et(e.getMinX(),e.getMinY())):e.getMinX()===e.getMaxX()||e.getMinY()===e.getMaxY()?this.createLineString([new et(e.getMinX(),e.getMinY()),new et(e.getMaxX(),e.getMaxY())]):this.createPolygon(this.createLinearRing([new et(e.getMinX(),e.getMinY()),new et(e.getMinX(),e.getMaxY()),new et(e.getMaxX(),e.getMaxY()),new et(e.getMaxX(),e.getMinY()),new et(e.getMinX(),e.getMinY())]),null)},sr.prototype.createLineString=function(e){if(e){if(e instanceof Array)return new eo(this.getCoordinateSequenceFactory().create(e),this);if(Mn(e,_r))return new eo(e,this)}else return new eo(this.getCoordinateSequenceFactory().create([]),this)},sr.prototype.createMultiLineString=function(){if(arguments.length===0)return new vp(null,this);if(arguments.length===1){var e=arguments[0];return new vp(e,this)}},sr.prototype.buildGeometry=function(e){for(var n=null,r=!1,i=!1,o=e.iterator();o.hasNext();){var s=o.next(),a=s.getClass();n===null&&(n=a),a!==n&&(r=!0),s.isGeometryCollectionOrDerived()&&(i=!0)}if(n===null)return this.createGeometryCollection();if(r||i)return this.createGeometryCollection(sr.toGeometryArray(e));var l=e.iterator().next(),c=e.size()>1;if(c){if(l instanceof No)return this.createMultiPolygon(sr.toPolygonArray(e));if(l instanceof eo)return this.createMultiLineString(sr.toLineStringArray(e));if(l instanceof Va)return this.createMultiPoint(sr.toPointArray(e));Yn.shouldNeverReachHere("Unhandled class: "+l.getClass().getName())}return l},sr.prototype.createMultiPointFromCoords=function(e){return this.createMultiPoint(e!==null?this.getCoordinateSequenceFactory().create(e):null)},sr.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof et){var e=arguments[0];return this.createPoint(e!==null?this.getCoordinateSequenceFactory().create([e]):null)}else if(Mn(arguments[0],_r)){var n=arguments[0];return new Va(n,this)}}},sr.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},sr.prototype.createPolygon=function(){if(arguments.length===0)return new No(null,null,this);if(arguments.length===1){if(Mn(arguments[0],_r)){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createPolygon(this.createLinearRing(n))}else if(arguments[0]instanceof Ju){var r=arguments[0];return this.createPolygon(r,null)}}else if(arguments.length===2){var i=arguments[0],o=arguments[1];return new No(i,o,this)}},sr.prototype.getSRID=function(){return this._SRID},sr.prototype.createGeometryCollection=function(){if(arguments.length===0)return new ea(null,this);if(arguments.length===1){var e=arguments[0];return new ea(e,this)}},sr.prototype.createGeometry=function(e){var n=new Zl(this);return n.edit(e,{edit:function(){if(arguments.length===2){var r=arguments[0];return this._coordinateSequenceFactory.create(r)}}})},sr.prototype.getPrecisionModel=function(){return this._precisionModel},sr.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return this.createLinearRing(e!==null?this.getCoordinateSequenceFactory().create(e):null)}else if(Mn(arguments[0],_r)){var n=arguments[0];return new Ju(n,this)}}},sr.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Qu(null,this);if(arguments.length===1){var e=arguments[0];return new Qu(e,this)}},sr.prototype.createMultiPoint=function(){var e=this;if(arguments.length===0)return new Wv(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new Wv(n,this)}else if(arguments[0]instanceof Array){var r=arguments[0];return this.createMultiPoint(r!==null?this.getCoordinateSequenceFactory().create(r):null)}else if(Mn(arguments[0],_r)){var i=arguments[0];if(i===null)return this.createMultiPoint(new Array(0).fill(null));for(var o=new Array(i.size()).fill(null),s=0;s=this.size())throw new Error;return this.array_[t]},lu.prototype.push=function(t){return this.array_.push(t),t},lu.prototype.pop=function(t){if(this.array_.length===0)throw new kS;return this.array_.pop()},lu.prototype.peek=function(){if(this.array_.length===0)throw new kS;return this.array_[this.array_.length-1]},lu.prototype.empty=function(){return this.array_.length===0},lu.prototype.isEmpty=function(){return this.empty()},lu.prototype.search=function(t){return this.array_.indexOf(t)},lu.prototype.size=function(){return this.array_.length},lu.prototype.toArray=function(){for(var t=this,e=[],n=0,r=this.array_.length;n0&&this._minIndexthis._minCoord.y&&r.y>this._minCoord.y&&i===Ut.CLOCKWISE)&&(o=!0),o&&(this._minIndex=this._minIndex-1)},cu.prototype.getRightmostSideOfSegment=function(e,n){var r=e.getEdge(),i=r.getCoordinates();if(n<0||n+1>=i.length||i[n].y===i[n+1].y)return-1;var o=Nt.LEFT;return i[n].yn._minCoord.x)&&(n._minDe=e,n._minIndex=i,n._minCoord=r[i])},cu.prototype.findRightmostEdgeAtNode=function(){var e=this._minDe.getNode(),n=e.getEdges();this._minDe=n.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},cu.prototype.findEdge=function(e){for(var n=this,r=e.iterator();r.hasNext();){var i=r.next();i.isForward()&&n.checkForRightmostCoordinate(i)}Yn.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;var o=this.getRightmostSide(this._minDe,this._minIndex);o===Nt.LEFT&&(this._orientedDe=this._minDe.getSym())},cu.prototype.interfaces_=function(){return[]},cu.prototype.getClass=function(){return cu};var Zh=function(t){function e(n,r){t.call(this,e.msgWithCoord(n,r)),this.pt=r?new et(r):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(r,i){return i?r:r+" [ "+i+" ]"},e}(Uh),TS=function(){this.array_=[]};TS.prototype.addLast=function(e){this.array_.push(e)},TS.prototype.removeFirst=function(){return this.array_.shift()},TS.prototype.isEmpty=function(){return this.array_.length===0};var ta=function(){this._finder=null,this._dirEdgeList=new $t,this._nodes=new $t,this._rightMostCoord=null,this._env=null,this._finder=new cu};ta.prototype.clearVisitedEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var n=e.next();n.setVisited(!1)}},ta.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},ta.prototype.computeNodeDepth=function(e){for(var n=this,r=null,i=e.getEdges().iterator();i.hasNext();){var o=i.next();if(o.isVisited()||o.getSym().isVisited()){r=o;break}}if(r===null)throw new Zh("unable to find edge to compute depths at "+e.getCoordinate());e.getEdges().computeDepths(r);for(var s=e.getEdges().iterator();s.hasNext();){var a=s.next();a.setVisited(!0),n.copySymDepths(a)}},ta.prototype.computeDepth=function(e){this.clearVisitedEdges();var n=this._finder.getEdge();n.setEdgeDepths(Nt.RIGHT,e),this.copySymDepths(n),this.computeDepths(n)},ta.prototype.create=function(e){this.addReachable(e),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},ta.prototype.findResultEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var n=e.next();n.getDepth(Nt.RIGHT)>=1&&n.getDepth(Nt.LEFT)<=0&&!n.isInteriorAreaEdge()&&n.setInResult(!0)}},ta.prototype.computeDepths=function(e){var n=this,r=new NL,i=new TS,o=e.getNode();for(i.addLast(o),r.add(o),e.setVisited(!0);!i.isEmpty();){var s=i.removeFirst();r.add(s),n.computeNodeDepth(s);for(var a=s.getEdges().iterator();a.hasNext();){var l=a.next(),c=l.getSym();if(!c.isVisited()){var u=c.getNode();r.contains(u)||(i.addLast(u),r.add(u))}}}},ta.prototype.compareTo=function(e){var n=e;return this._rightMostCoord.xn._rightMostCoord.x?1:0},ta.prototype.getEnvelope=function(){if(this._env===null){for(var e=new fn,n=this._dirEdgeList.iterator();n.hasNext();)for(var r=n.next(),i=r.getEdge().getCoordinates(),o=0;othis.location.length){var r=new Array(3).fill(null);r[Nt.ON]=this.location[Nt.ON],r[Nt.LEFT]=st.NONE,r[Nt.RIGHT]=st.NONE,this.location=r}for(var i=0;i1&&e.append(st.toLocationSymbol(this.location[Nt.LEFT])),e.append(st.toLocationSymbol(this.location[Nt.ON])),this.location.length>1&&e.append(st.toLocationSymbol(this.location[Nt.RIGHT])),e.toString()},Ai.prototype.setLocations=function(e,n,r){this.location[Nt.ON]=e,this.location[Nt.LEFT]=n,this.location[Nt.RIGHT]=r},Ai.prototype.get=function(e){return e1},Ai.prototype.isAnyNull=function(){for(var e=this,n=0;ne._maxNodeDegree&&(e._maxNodeDegree=i),n=e.getNext(n)}while(n!==this._startDe);this._maxNodeDegree*=2},So.prototype.addPoints=function(e,n,r){var i=this,o=e.getCoordinates();if(n){var s=1;r&&(s=0);for(var a=s;a=0;c--)i._pts.add(o[c])}},So.prototype.isHole=function(){return this._isHole},So.prototype.setInResult=function(){var e=this._startDe;do e.getEdge().setInResult(!0),e=e.getNext();while(e!==this._startDe)},So.prototype.containsPoint=function(e){var n=this.getLinearRing(),r=n.getEnvelopeInternal();if(!r.contains(e)||!Ut.isPointInRing(e,n.getCoordinates()))return!1;for(var i=this._holes.iterator();i.hasNext();){var o=i.next();if(o.containsPoint(e))return!1}return!0},So.prototype.addHole=function(e){this._holes.add(e)},So.prototype.isShell=function(){return this._shell===null},So.prototype.getLabel=function(){return this._label},So.prototype.getEdges=function(){return this._edges},So.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},So.prototype.getShell=function(){return this._shell},So.prototype.mergeLabel=function(){if(arguments.length===1){var e=arguments[0];this.mergeLabel(e,0),this.mergeLabel(e,1)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=n.getLocation(r,Nt.RIGHT);if(i===st.NONE)return null;if(this._label.getLocation(r)===st.NONE)return this._label.setLocation(r,i),null}},So.prototype.setShell=function(e){this._shell=e,e!==null&&e.addHole(this)},So.prototype.toPolygon=function(e){for(var n=this,r=new Array(this._holes.size()).fill(null),i=0;i=2,"found partial label"),this.computeIM(e)},_l.prototype.isInResult=function(){return this._isInResult},_l.prototype.isVisited=function(){return this._isVisited},_l.prototype.interfaces_=function(){return[]},_l.prototype.getClass=function(){return _l};var MS=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var n=arguments[0],r=arguments[1];this._coord=n,this._edges=r,this._label=new ci(0,st.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var r=this.getEdges().getEdges().iterator();r.hasNext();){var i=r.next();if(i.getEdge().isInResult())return!0}return!1},e.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(r){r.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(r){},e.prototype.computeMergedLocation=function(r,i){var o=st.NONE;if(o=this._label.getLocation(i),!r.isNull(i)){var s=r.getLocation(i);o!==st.BOUNDARY&&(o=s)}return o},e.prototype.setLabel=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];this._label===null?this._label=new ci(r,i):this._label.setLocation(r,i)}else return t.prototype.setLabel.apply(this,arguments)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var r=this;if(arguments[0]instanceof e){var i=arguments[0];this.mergeLabel(i._label)}else if(arguments[0]instanceof ci)for(var o=arguments[0],s=0;s<2;s++){var a=r.computeMergedLocation(o,s),l=r._label.getLocation(s);l===st.NONE&&r._label.setLocation(s,a)}},e.prototype.add=function(r){this._edges.insert(r),r.setNode(this)},e.prototype.setLabelBoundary=function(r){if(this._label===null)return null;var i=st.NONE;this._label!==null&&(i=this._label.getLocation(r));var o=null;switch(i){case st.BOUNDARY:o=st.INTERIOR;break;case st.INTERIOR:o=st.BOUNDARY;break;default:o=st.BOUNDARY;break}this._label.setLocation(r,o)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(_l),uu=function(){this.nodeMap=new Rs,this.nodeFact=null;var e=arguments[0];this.nodeFact=e};uu.prototype.find=function(e){return this.nodeMap.get(e)},uu.prototype.addNode=function(){if(arguments[0]instanceof et){var e=arguments[0],n=this.nodeMap.get(e);return n===null&&(n=this.nodeFact.createNode(e),this.nodeMap.put(e,n)),n}else if(arguments[0]instanceof MS){var r=arguments[0],i=this.nodeMap.get(r.getCoordinate());return i===null?(this.nodeMap.put(r.getCoordinate(),r),r):(i.mergeLabel(r),i)}},uu.prototype.print=function(e){for(var n=this.iterator();n.hasNext();){var r=n.next();r.print(e)}},uu.prototype.iterator=function(){return this.nodeMap.values().iterator()},uu.prototype.values=function(){return this.nodeMap.values()},uu.prototype.getBoundaryNodes=function(e){for(var n=new $t,r=this.iterator();r.hasNext();){var i=r.next();i.getLabel().getLocation(e)===st.BOUNDARY&&n.add(i)}return n},uu.prototype.add=function(e){var n=e.getCoordinate(),r=this.addNode(n);r.add(e)},uu.prototype.interfaces_=function(){return[]},uu.prototype.getClass=function(){return uu};var _i=function(){},e1={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};_i.prototype.interfaces_=function(){return[]},_i.prototype.getClass=function(){return _i},_i.isNorthern=function(e){return e===_i.NE||e===_i.NW},_i.isOpposite=function(e,n){if(e===n)return!1;var r=(e-n+4)%4;return r===2},_i.commonHalfPlane=function(e,n){if(e===n)return e;var r=(e-n+4)%4;if(r===2)return-1;var i=en?e:n;return i===0&&o===3?3:i},_i.isInHalfPlane=function(e,n){return n===_i.SE?e===_i.SE||e===_i.SW:e===n||e===n+1},_i.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],n=arguments[1];if(e===0&&n===0)throw new ji("Cannot compute the quadrant for point ( "+e+", "+n+" )");return e>=0?n>=0?_i.NE:_i.SE:n>=0?_i.NW:_i.SW}else if(arguments[0]instanceof et&&arguments[1]instanceof et){var r=arguments[0],i=arguments[1];if(i.x===r.x&&i.y===r.y)throw new ji("Cannot compute the quadrant for two identical points "+r);return i.x>=r.x?i.y>=r.y?_i.NE:_i.SE:i.y>=r.y?_i.NW:_i.SW}},e1.NE.get=function(){return 0},e1.NW.get=function(){return 1},e1.SW.get=function(){return 2},e1.SE.get=function(){return 3},Object.defineProperties(_i,e1);var Bs=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var e=arguments[0];this._edge=e}else if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2],o=null;this._edge=n,this.init(r,i),this._label=o}else if(arguments.length===4){var s=arguments[0],a=arguments[1],l=arguments[2],c=arguments[3];this._edge=s,this.init(a,l),this._label=c}};Bs.prototype.compareDirection=function(e){return this._dx===e._dx&&this._dy===e._dy?0:this._quadrant>e._quadrant?1:this._quadrant2){a.linkDirectedEdgesForMinimalEdgeRings();var l=a.buildMinimalRings(),c=i.findShell(l);c!==null?(i.placePolygonHoles(c,l),n.add(c)):r.addAll(l)}else o.add(a)}return o},ja.prototype.containsPoint=function(e){for(var n=this._shellList.iterator();n.hasNext();){var r=n.next();if(r.containsPoint(e))return!0}return!1},ja.prototype.buildMaximalEdgeRings=function(e){for(var n=this,r=new $t,i=e.iterator();i.hasNext();){var o=i.next();if(o.isInResult()&&o.getLabel().isArea()&&o.getEdgeRing()===null){var s=new Cle(o,n._geometryFactory);r.add(s),s.setInResult()}}return r},ja.prototype.placePolygonHoles=function(e,n){for(var r=n.iterator();r.hasNext();){var i=r.next();i.isHole()&&i.setShell(e)}},ja.prototype.getPolygons=function(){var e=this.computePolygons(this._shellList);return e},ja.prototype.findEdgeRingContaining=function(e,n){for(var r=e.getLinearRing(),i=r.getEnvelopeInternal(),o=r.getCoordinateN(0),s=null,a=null,l=n.iterator();l.hasNext();){var c=l.next(),u=c.getLinearRing(),d=u.getEnvelopeInternal();s!==null&&(a=s.getLinearRing().getEnvelopeInternal());var p=!1;d.contains(i)&&Ut.isPointInRing(o,u.getCoordinates())&&(p=!0),p&&(s===null||a.contains(d))&&(s=c)}return s},ja.prototype.findShell=function(e){for(var n=0,r=null,i=e.iterator();i.hasNext();){var o=i.next();o.isHole()||(r=o,n++)}return Yn.isTrue(n<=1,"found two shells in MinimalEdgeRing list"),r},ja.prototype.add=function(){if(arguments.length===1){var e=arguments[0];this.add(e.getEdgeEnds(),e.getNodes())}else if(arguments.length===2){var n=arguments[0],r=arguments[1];Zi.linkResultDirectedEdges(r);var i=this.buildMaximalEdgeRings(n),o=new $t,s=this.buildMinimalEdgeRings(i,this._shellList,o);this.sortShellsAndHoles(s,this._shellList,o),this.placeFreeHoles(this._shellList,o)}},ja.prototype.interfaces_=function(){return[]},ja.prototype.getClass=function(){return ja};var qv=function(){};qv.prototype.getBounds=function(){},qv.prototype.interfaces_=function(){return[]},qv.prototype.getClass=function(){return qv};var kc=function(){this._bounds=null,this._item=null;var e=arguments[0],n=arguments[1];this._bounds=e,this._item=n};kc.prototype.getItem=function(){return this._item},kc.prototype.getBounds=function(){return this._bounds},kc.prototype.interfaces_=function(){return[qv,Wl]},kc.prototype.getClass=function(){return kc};var Xh=function(){this._size=null,this._items=null,this._size=0,this._items=new $t,this._items.add(null)};Xh.prototype.poll=function(){if(this.isEmpty())return null;var e=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),e},Xh.prototype.size=function(){return this._size},Xh.prototype.reorder=function(e){for(var n=this,r=null,i=this._items.get(e);e*2<=this._size&&(r=e*2,r!==n._size&&n._items.get(r+1).compareTo(n._items.get(r))<0&&r++,n._items.get(r).compareTo(i)<0);e=r)n._items.set(e,n._items.get(r));this._items.set(e,i)},Xh.prototype.clear=function(){this._size=0,this._items.clear()},Xh.prototype.isEmpty=function(){return this._size===0},Xh.prototype.add=function(e){var n=this;this._items.add(null),this._size+=1;var r=this._size;for(this._items.set(0,e);e.compareTo(this._items.get(Math.trunc(r/2)))<0;r/=2)n._items.set(r,n._items.get(Math.trunc(r/2)));this._items.set(r,e)},Xh.prototype.interfaces_=function(){return[]},Xh.prototype.getClass=function(){return Xh};var Jd=function(){};Jd.prototype.visitItem=function(e){},Jd.prototype.interfaces_=function(){return[]},Jd.prototype.getClass=function(){return Jd};var hg=function(){};hg.prototype.insert=function(e,n){},hg.prototype.remove=function(e,n){},hg.prototype.query=function(){},hg.prototype.interfaces_=function(){return[]},hg.prototype.getClass=function(){return hg};var Oo=function(){if(this._childBoundables=new $t,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this._level=e}}},mz={serialVersionUID:{configurable:!0}};Oo.prototype.getLevel=function(){return this._level},Oo.prototype.size=function(){return this._childBoundables.size()},Oo.prototype.getChildBoundables=function(){return this._childBoundables},Oo.prototype.addChildBoundable=function(e){Yn.isTrue(this._bounds===null),this._childBoundables.add(e)},Oo.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Oo.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Oo.prototype.interfaces_=function(){return[qv,Wl]},Oo.prototype.getClass=function(){return Oo},mz.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Oo,mz);var Tc=function(){};Tc.reverseOrder=function(){return{compare:function(n,r){return r.compareTo(n)}}},Tc.min=function(e){return Tc.sort(e),e.get(0)},Tc.sort=function(e,n){var r=e.toArray();n?yp.sort(r,n):yp.sort(r);for(var i=e.iterator(),o=0,s=r.length;oCo.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,e,n),null):(this.expand(this._boundable2,this._boundable1,e,n),null);if(r)return this.expand(this._boundable1,this._boundable2,e,n),null;if(i)return this.expand(this._boundable2,this._boundable1,e,n),null;throw new ji("neither boundable is composite")},Co.prototype.isLeaves=function(){return!(Co.isComposite(this._boundable1)||Co.isComposite(this._boundable2))},Co.prototype.compareTo=function(e){var n=e;return this._distancen._distance?1:0},Co.prototype.expand=function(e,n,r,i){for(var o=this,s=e.getChildBoundables(),a=s.iterator();a.hasNext();){var l=a.next(),c=new Co(l,n,o._itemDistance);c.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},AS={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Jo.prototype.getNodeCapacity=function(){return this._nodeCapacity},Jo.prototype.lastNode=function(e){return e.get(e.size()-1)},Jo.prototype.size=function(){var e=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var n=arguments[0],r=0,i=n.getChildBoundables().iterator();i.hasNext();){var o=i.next();o instanceof Oo?r+=e.size(o):o instanceof kc&&(r+=1)}return r}},Jo.prototype.removeItem=function(e,n){for(var r=null,i=e.getChildBoundables().iterator();i.hasNext();){var o=i.next();o instanceof kc&&o.getItem()===n&&(r=o)}return r!==null?(e.getChildBoundables().remove(r),!0):!1},Jo.prototype.itemsTree=function(){var e=this;if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new $t:n}else if(arguments.length===1){for(var r=arguments[0],i=new $t,o=r.getChildBoundables().iterator();o.hasNext();){var s=o.next();if(s instanceof Oo){var a=e.itemsTree(s);a!==null&&i.add(a)}else s instanceof kc?i.add(s.getItem()):Yn.shouldNeverReachHere()}return i.size()<=0?null:i}},Jo.prototype.insert=function(e,n){Yn.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new kc(e,n))},Jo.prototype.boundablesAtLevel=function(){var e=this;if(arguments.length===1){var n=arguments[0],r=new $t;return this.boundablesAtLevel(n,this._root,r),r}else if(arguments.length===3){var i=arguments[0],o=arguments[1],s=arguments[2];if(Yn.isTrue(i>-2),o.getLevel()===i)return s.add(o),null;for(var a=o.getChildBoundables().iterator();a.hasNext();){var l=a.next();l instanceof Oo?e.boundablesAtLevel(i,l,s):(Yn.isTrue(l instanceof kc),i===-1&&s.add(l))}return null}},Jo.prototype.query=function(){var e=this;if(arguments.length===1){var n=arguments[0];this.build();var r=new $t;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,r),r}else if(arguments.length===2){var i=arguments[0],o=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),i)&&this.query(i,this._root,o)}else if(arguments.length===3){if(Mn(arguments[2],Jd)&&arguments[0]instanceof Object&&arguments[1]instanceof Oo)for(var s=arguments[0],a=arguments[1],l=arguments[2],c=a.getChildBoundables(),u=0;ur&&(r=s)}}return r+1}},Jo.prototype.createParentBoundables=function(e,n){var r=this;Yn.isTrue(!e.isEmpty());var i=new $t;i.add(this.createNode(n));var o=new $t(e);Tc.sort(o,this.getComparator());for(var s=o.iterator();s.hasNext();){var a=s.next();r.lastNode(i).getChildBoundables().size()===r.getNodeCapacity()&&i.add(r.createNode(n)),r.lastNode(i).addChildBoundable(a)}return i},Jo.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Jo.prototype.interfaces_=function(){return[Wl]},Jo.prototype.getClass=function(){return Jo},Jo.compareDoubles=function(e,n){return e>n?1:e0);for(var a=new $t,l=0;l0;){var w=y.poll(),x=w.getDistance();if(x>=p)break;w.isLeaves()?(p=x,m=w):w.expandToQueue(y,p)}return[m.getBoundable(0).getItem(),m.getBoundable(1).getItem()]}}else if(arguments.length===3){var C=arguments[0],S=arguments[1],M=arguments[2],E=new kc(C,S),A=new Co(this.getRoot(),E,M);return this.nearestNeighbour(A)[0]}},e.prototype.interfaces_=function(){return[hg,Wl]},e.prototype.getClass=function(){return e},e.centreX=function(i){return e.avg(i.getMinX(),i.getMaxX())},e.avg=function(i,o){return(i+o)/2},e.centreY=function(i){return e.avg(i.getMinY(),i.getMaxY())},n.STRtreeNode.get=function(){return yz},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[Ov]},compare:function(r,i){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(i.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[Ov]},compare:function(r,i){return t.compareDoubles(e.centreY(r.getBounds()),e.centreY(i.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(r,i){return r.intersects(i)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,n),e}(Jo),yz=function(t){function e(){var n=arguments[0];t.call(this,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var r=null,i=this.getChildBoundables().iterator();i.hasNext();){var o=i.next();r===null?r=new fn(o.getBounds()):r.expandToInclude(o.getBounds())}return r},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Oo),Ea=function(){};Ea.prototype.interfaces_=function(){return[]},Ea.prototype.getClass=function(){return Ea},Ea.relativeSign=function(e,n){return en?1:0},Ea.compare=function(e,n,r){if(n.equals2D(r))return 0;var i=Ea.relativeSign(n.x,r.x),o=Ea.relativeSign(n.y,r.y);switch(e){case 0:return Ea.compareValue(i,o);case 1:return Ea.compareValue(o,i);case 2:return Ea.compareValue(o,-i);case 3:return Ea.compareValue(-i,o);case 4:return Ea.compareValue(-i,-o);case 5:return Ea.compareValue(-o,-i);case 6:return Ea.compareValue(-o,i);case 7:return Ea.compareValue(i,-o)}return Yn.shouldNeverReachHere("invalid octant value"),0},Ea.compareValue=function(e,n){return e<0?-1:e>0?1:n<0?-1:n>0?1:0};var Qd=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var e=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3];this._segString=e,this.coord=new et(n),this.segmentIndex=r,this._segmentOctant=i,this._isInterior=!n.equals2D(e.getCoordinate(r))};Qd.prototype.getCoordinate=function(){return this.coord},Qd.prototype.print=function(e){e.print(this.coord),e.print(" seg # = "+this.segmentIndex)},Qd.prototype.compareTo=function(e){var n=e;return this.segmentIndexn.segmentIndex?1:this.coord.equals2D(n.coord)?0:Ea.compare(this._segmentOctant,this.coord,n.coord)},Qd.prototype.isEndPoint=function(e){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===e},Qd.prototype.isInterior=function(){return this._isInterior},Qd.prototype.interfaces_=function(){return[Hl]},Qd.prototype.getClass=function(){return Qd};var na=function(){this._nodeMap=new Rs,this._edge=null;var e=arguments[0];this._edge=e};na.prototype.getSplitCoordinates=function(){var e=this,n=new Gb;this.addEndpoints();for(var r=this.iterator(),i=r.next();r.hasNext();){var o=r.next();e.addEdgeCoordinates(i,o,n),i=o}return n.toCoordinateArray()},na.prototype.addCollapsedNodes=function(){var e=this,n=new $t;this.findCollapsesFromInsertedNodes(n),this.findCollapsesFromExistingVertices(n);for(var r=n.iterator();r.hasNext();){var i=r.next().intValue();e.add(e._edge.getCoordinate(i),i)}},na.prototype.print=function(e){e.println("Intersections:");for(var n=this.iterator();n.hasNext();){var r=n.next();r.print(e)}},na.prototype.findCollapsesFromExistingVertices=function(e){for(var n=this,r=0;r=0?n>=0?r>=i?0:1:r>=i?7:6:n>=0?r>=i?3:2:r>=i?4:5}else if(arguments[0]instanceof et&&arguments[1]instanceof et){var o=arguments[0],s=arguments[1],a=s.x-o.x,l=s.y-o.y;if(a===0&&l===0)throw new ji("Cannot compute the octant for two identical points "+o);return dg.octant(a,l)}};var th=function(){};th.prototype.getCoordinates=function(){},th.prototype.size=function(){},th.prototype.getCoordinate=function(e){},th.prototype.isClosed=function(){},th.prototype.setData=function(e){},th.prototype.getData=function(){},th.prototype.interfaces_=function(){return[]},th.prototype.getClass=function(){return th};var t1=function(){};t1.prototype.addIntersection=function(e,n){},t1.prototype.interfaces_=function(){return[th]},t1.prototype.getClass=function(){return t1};var mo=function(){this._nodeList=new na(this),this._pts=null,this._data=null;var e=arguments[0],n=arguments[1];this._pts=e,this._data=n};mo.prototype.getCoordinates=function(){return this._pts},mo.prototype.size=function(){return this._pts.length},mo.prototype.getCoordinate=function(e){return this._pts[e]},mo.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},mo.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(e),this.getCoordinate(e+1))},mo.prototype.setData=function(e){this._data=e},mo.prototype.safeOctant=function(e,n){return e.equals2D(n)?0:dg.octant(e,n)},mo.prototype.getData=function(){return this._data},mo.prototype.addIntersection=function(){if(arguments.length===2){var e=arguments[0],n=arguments[1];this.addIntersectionNode(e,n)}else if(arguments.length===4){var r=arguments[0],i=arguments[1],o=arguments[3],s=new et(r.getIntersection(o));this.addIntersection(s,i)}},mo.prototype.toString=function(){return xc.toLineString(new po(this._pts))},mo.prototype.getNodeList=function(){return this._nodeList},mo.prototype.addIntersectionNode=function(e,n){var r=n,i=r+1;if(i=0&&r>=0||n<=0&&r<=0?Math.max(n,r):0}else if(arguments[0]instanceof et){var i=arguments[0];return Ut.orientationIndex(this.p0,this.p1,i)}},pn.prototype.toGeometry=function(e){return e.createLineString([this.p0,this.p1])},pn.prototype.isVertical=function(){return this.p0.x===this.p1.x},pn.prototype.equals=function(e){if(!(e instanceof pn))return!1;var n=e;return this.p0.equals(n.p0)&&this.p1.equals(n.p1)},pn.prototype.intersection=function(e){var n=new mp;return n.computeIntersection(this.p0,this.p1,e.p0,e.p1),n.hasIntersection()?n.getIntersection(0):null},pn.prototype.project=function(){if(arguments[0]instanceof et){var e=arguments[0];if(e.equals(this.p0)||e.equals(this.p1))return new et(e);var n=this.projectionFactor(e),r=new et;return r.x=this.p0.x+n*(this.p1.x-this.p0.x),r.y=this.p0.y+n*(this.p1.y-this.p0.y),r}else if(arguments[0]instanceof pn){var i=arguments[0],o=this.projectionFactor(i.p0),s=this.projectionFactor(i.p1);if(o>=1&&s>=1||o<=0&&s<=0)return null;var a=this.project(i.p0);o<0&&(a=this.p0),o>1&&(a=this.p1);var l=this.project(i.p1);return s<0&&(l=this.p0),s>1&&(l=this.p1),new pn(a,l)}},pn.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},pn.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},pn.prototype.getCoordinate=function(e){return e===0?this.p0:this.p1},pn.prototype.distancePerpendicular=function(e){return Ut.distancePointLinePerpendicular(e,this.p0,this.p1)},pn.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},pn.prototype.midPoint=function(){return pn.midPoint(this.p0,this.p1)},pn.prototype.projectionFactor=function(e){if(e.equals(this.p0))return 0;if(e.equals(this.p1))return 1;var n=this.p1.x-this.p0.x,r=this.p1.y-this.p0.y,i=n*n+r*r;if(i<=0)return Un.NaN;var o=((e.x-this.p0.x)*n+(e.y-this.p0.y)*r)/i;return o},pn.prototype.closestPoints=function(e){var n=this.intersection(e);if(n!==null)return[n,n];var r=new Array(2).fill(null),i=Un.MAX_VALUE,o=null,s=this.closestPoint(e.p0);i=s.distance(e.p0),r[0]=s,r[1]=e.p0;var a=this.closestPoint(e.p1);o=a.distance(e.p1),o0&&n<1)return this.project(e);var r=this.p0.distance(e),i=this.p1.distance(e);return r1||Un.isNaN(n))&&(n=1),n},pn.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},pn.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},pn.prototype.distance=function(){if(arguments[0]instanceof pn){var e=arguments[0];return Ut.distanceLineLine(this.p0,this.p1,e.p0,e.p1)}else if(arguments[0]instanceof et){var n=arguments[0];return Ut.distancePointLine(n,this.p0,this.p1)}},pn.prototype.pointAlong=function(e){var n=new et;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n},pn.prototype.hashCode=function(){var e=Un.doubleToLongBits(this.p0.x);e^=Un.doubleToLongBits(this.p0.y)*31;var n=Math.trunc(e)^Math.trunc(e>>32),r=Un.doubleToLongBits(this.p1.x);r^=Un.doubleToLongBits(this.p1.y)*31;var i=Math.trunc(r)^Math.trunc(r>>32);return n^i},pn.prototype.interfaces_=function(){return[Hl,Wl]},pn.prototype.getClass=function(){return pn},pn.midPoint=function(e,n){return new et((e.x+n.x)/2,(e.y+n.y)/2)},vz.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(pn,vz);var n1=function(){this.tempEnv1=new fn,this.tempEnv2=new fn,this._overlapSeg1=new pn,this._overlapSeg2=new pn};n1.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var e=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3];e.getLineSegment(n,this._overlapSeg1),r.getLineSegment(i,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},n1.prototype.interfaces_=function(){return[]},n1.prototype.getClass=function(){return n1};var Ua=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var e=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3];this._pts=e,this._start=n,this._end=r,this._context=i};Ua.prototype.getLineSegment=function(e,n){n.p0=this._pts[e],n.p1=this._pts[e+1]},Ua.prototype.computeSelect=function(e,n,r,i){var o=this._pts[n],s=this._pts[r];if(i.tempEnv1.init(o,s),r-n===1)return i.select(this,n),null;if(!e.intersects(i.tempEnv1))return null;var a=Math.trunc((n+r)/2);n=e.length-1)return e.length-1;for(var i=_i.quadrant(e[r],e[r+1]),o=n+1;oa.getId()&&(a.computeOverlaps(u,o),i._nOverlaps++),i._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return _z},Object.defineProperties(e,n),e}(r1),_z=function(t){function e(){t.call(this),this._si=null;var n=arguments[0];this._si=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(arguments.length===4){var r=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=r.getContext(),l=o.getContext();this._si.processIntersections(a,i,l,s)}else return t.prototype.overlap.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(n1),ni=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.setQuadrantSegments(e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(arguments.length===4){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}}},Kh={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};ni.prototype.getEndCapStyle=function(){return this._endCapStyle},ni.prototype.isSingleSided=function(){return this._isSingleSided},ni.prototype.setQuadrantSegments=function(e){this._quadrantSegments=e,this._quadrantSegments===0&&(this._joinStyle=ni.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=ni.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),e<=0&&(this._quadrantSegments=1),this._joinStyle!==ni.JOIN_ROUND&&(this._quadrantSegments=ni.DEFAULT_QUADRANT_SEGMENTS)},ni.prototype.getJoinStyle=function(){return this._joinStyle},ni.prototype.setJoinStyle=function(e){this._joinStyle=e},ni.prototype.setSimplifyFactor=function(e){this._simplifyFactor=e<0?0:e},ni.prototype.getSimplifyFactor=function(){return this._simplifyFactor},ni.prototype.getQuadrantSegments=function(){return this._quadrantSegments},ni.prototype.setEndCapStyle=function(e){this._endCapStyle=e},ni.prototype.getMitreLimit=function(){return this._mitreLimit},ni.prototype.setMitreLimit=function(e){this._mitreLimit=e},ni.prototype.setSingleSided=function(e){this._isSingleSided=e},ni.prototype.interfaces_=function(){return[]},ni.prototype.getClass=function(){return ni},ni.bufferDistanceError=function(e){var n=Math.PI/2/e;return 1-Math.cos(n/2)},Kh.CAP_ROUND.get=function(){return 1},Kh.CAP_FLAT.get=function(){return 2},Kh.CAP_SQUARE.get=function(){return 3},Kh.JOIN_ROUND.get=function(){return 1},Kh.JOIN_MITRE.get=function(){return 2},Kh.JOIN_BEVEL.get=function(){return 3},Kh.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},Kh.DEFAULT_MITRE_LIMIT.get=function(){return 5},Kh.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(ni,Kh);var to=function(e){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=Ut.COUNTERCLOCKWISE,this._inputLine=e||null},i1={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};to.prototype.isDeletable=function(e,n,r,i){var o=this._inputLine[e],s=this._inputLine[n],a=this._inputLine[r];return!this.isConcave(o,s,a)||!this.isShallow(o,s,a,i)?!1:this.isShallowSampled(o,s,e,r,i)},to.prototype.deleteShallowConcavities=function(){for(var e=this,n=1,r=this.findNextNonDeletedIndex(n),i=this.findNextNonDeletedIndex(r),o=!1;i=0;o--)r.addPt(e[o])},bl.prototype.isRedundant=function(e){if(this._ptList.size()<1)return!1;var n=this._ptList.get(this._ptList.size()-1),r=e.distance(n);return rMath.PI;)e-=gr.PI_TIMES_2;for(;e<=-Math.PI;)e+=gr.PI_TIMES_2;return e},gr.angle=function(){if(arguments.length===1){var e=arguments[0];return Math.atan2(e.y,e.x)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=r.x-n.x,o=r.y-n.y;return Math.atan2(o,i)}},gr.isAcute=function(e,n,r){var i=e.x-n.x,o=e.y-n.y,s=r.x-n.x,a=r.y-n.y,l=i*s+o*a;return l>0},gr.isObtuse=function(e,n,r){var i=e.x-n.x,o=e.y-n.y,s=r.x-n.x,a=r.y-n.y,l=i*s+o*a;return l<0},gr.interiorAngle=function(e,n,r){var i=gr.angle(n,e),o=gr.angle(n,r);return Math.abs(o-i)},gr.normalizePositive=function(e){if(e<0){for(;e<0;)e+=gr.PI_TIMES_2;e>=gr.PI_TIMES_2&&(e=0)}else{for(;e>=gr.PI_TIMES_2;)e-=gr.PI_TIMES_2;e<0&&(e=0)}return e},gr.angleBetween=function(e,n,r){var i=gr.angle(n,e),o=gr.angle(n,r);return gr.diff(i,o)},gr.diff=function(e,n){var r=null;return eMath.PI&&(r=2*Math.PI-r),r},gr.toRadians=function(e){return e*Math.PI/180},gr.getTurn=function(e,n){var r=Math.sin(n-e);return r>0?gr.COUNTERCLOCKWISE:r<0?gr.CLOCKWISE:gr.NONE},gr.angleBetweenOriented=function(e,n,r){var i=gr.angle(n,e),o=gr.angle(n,r),s=o-i;return s<=-Math.PI?s+gr.PI_TIMES_2:s>Math.PI?s-gr.PI_TIMES_2:s},fg.PI_TIMES_2.get=function(){return 2*Math.PI},fg.PI_OVER_2.get=function(){return Math.PI/2},fg.PI_OVER_4.get=function(){return Math.PI/4},fg.COUNTERCLOCKWISE.get=function(){return Ut.COUNTERCLOCKWISE},fg.CLOCKWISE.get=function(){return Ut.CLOCKWISE},fg.NONE.get=function(){return Ut.COLLINEAR},Object.defineProperties(gr,fg);var $i=function t(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new pn,this._seg1=new pn,this._offset0=new pn,this._offset1=new pn,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=e,this._bufParams=n,this._li=new mp,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===ni.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},o1={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};$i.prototype.addNextSegment=function(e,n){if(this._s0=this._s1,this._s1=this._s2,this._s2=e,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var r=Ut.computeOrientation(this._s0,this._s1,this._s2),i=r===Ut.CLOCKWISE&&this._side===Nt.LEFT||r===Ut.COUNTERCLOCKWISE&&this._side===Nt.RIGHT;r===0?this.addCollinear(n):i?this.addOutsideTurn(r,n):this.addInsideTurn(r,n)},$i.prototype.addLineEndCap=function(e,n){var r=new pn(e,n),i=new pn;this.computeOffsetSegment(r,Nt.LEFT,this._distance,i);var o=new pn;this.computeOffsetSegment(r,Nt.RIGHT,this._distance,o);var s=n.x-e.x,a=n.y-e.y,l=Math.atan2(a,s);switch(this._bufParams.getEndCapStyle()){case ni.CAP_ROUND:this._segList.addPt(i.p1),this.addFilletArc(n,l+Math.PI/2,l-Math.PI/2,Ut.CLOCKWISE,this._distance),this._segList.addPt(o.p1);break;case ni.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(o.p1);break;case ni.CAP_SQUARE:var c=new et;c.x=Math.abs(this._distance)*Math.cos(l),c.y=Math.abs(this._distance)*Math.sin(l);var u=new et(i.p1.x+c.x,i.p1.y+c.y),d=new et(o.p1.x+c.x,o.p1.y+c.y);this._segList.addPt(u),this._segList.addPt(d);break}},$i.prototype.getCoordinates=function(){var e=this._segList.getCoordinates();return e},$i.prototype.addMitreJoin=function(e,n,r,i){var o=!0,s=null;try{s=wc.intersection(n.p0,n.p1,r.p0,r.p1);var a=i<=0?1:s.distance(e)/Math.abs(i);a>this._bufParams.getMitreLimit()&&(o=!1)}catch(l){if(l instanceof Rv)s=new et(0,0),o=!1;else throw l}finally{}o?this._segList.addPt(s):this.addLimitedMitreJoin(n,r,i,this._bufParams.getMitreLimit())},$i.prototype.addFilletCorner=function(e,n,r,i,o){var s=n.x-e.x,a=n.y-e.y,l=Math.atan2(a,s),c=r.x-e.x,u=r.y-e.y,d=Math.atan2(u,c);i===Ut.CLOCKWISE?l<=d&&(l+=2*Math.PI):l>=d&&(l-=2*Math.PI),this._segList.addPt(n),this.addFilletArc(e,l,d,i,o),this._segList.addPt(r)},$i.prototype.addOutsideTurn=function(e,n){if(this._offset0.p1.distance(this._offset1.p0)0){var r=new et((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r);var i=new et((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(i)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},$i.prototype.createCircle=function(e){var n=new et(e.x+this._distance,e.y);this._segList.addPt(n),this.addFilletArc(e,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},$i.prototype.addBevelJoin=function(e,n){this._segList.addPt(e.p1),this._segList.addPt(n.p0)},$i.prototype.init=function(e){this._distance=e,this._maxCurveSegmentError=e*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new bl,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(e*$i.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},$i.prototype.addCollinear=function(e){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var n=this._li.getIntersectionNum();n>=2&&(this._bufParams.getJoinStyle()===ni.JOIN_BEVEL||this._bufParams.getJoinStyle()===ni.JOIN_MITRE?(e&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,Ut.CLOCKWISE,this._distance))},$i.prototype.closeRing=function(){this._segList.closeRing()},$i.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},$i.prototype.interfaces_=function(){return[]},$i.prototype.getClass=function(){return $i},o1.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},o1.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},o1.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},o1.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties($i,o1);var Sa=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var e=arguments[0],n=arguments[1];this._precisionModel=e,this._bufParams=n};Sa.prototype.getOffsetCurve=function(e,n){if(this._distance=n,n===0)return null;var r=n<0,i=Math.abs(n),o=this.getSegGen(i);e.length<=1?this.computePointCurve(e[0],o):this.computeOffsetCurve(e,r,o);var s=o.getCoordinates();return r&&or.reverse(s),s},Sa.prototype.computeSingleSidedBufferCurve=function(e,n,r){var i=this.simplifyTolerance(this._distance);if(n){r.addSegments(e,!0);var o=to.simplify(e,-i),s=o.length-1;r.initSideSegments(o[s],o[s-1],Nt.LEFT),r.addFirstSegment();for(var a=s-2;a>=0;a--)r.addNextSegment(o[a],!0)}else{r.addSegments(e,!1);var l=to.simplify(e,i),c=l.length-1;r.initSideSegments(l[0],l[1],Nt.LEFT),r.addFirstSegment();for(var u=2;u<=c;u++)r.addNextSegment(l[u],!0)}r.addLastSegment(),r.closeRing()},Sa.prototype.computeRingBufferCurve=function(e,n,r){var i=this.simplifyTolerance(this._distance);n===Nt.RIGHT&&(i=-i);var o=to.simplify(e,i),s=o.length-1;r.initSideSegments(o[s-1],o[0],n);for(var a=1;a<=s;a++){var l=a!==1;r.addNextSegment(o[a],l)}r.closeRing()},Sa.prototype.computeLineBufferCurve=function(e,n){var r=this.simplifyTolerance(this._distance),i=to.simplify(e,r),o=i.length-1;n.initSideSegments(i[0],i[1],Nt.LEFT);for(var s=2;s<=o;s++)n.addNextSegment(i[s],!0);n.addLastSegment(),n.addLineEndCap(i[o-1],i[o]);var a=to.simplify(e,-r),l=a.length-1;n.initSideSegments(a[l],a[l-1],Nt.LEFT);for(var c=l-2;c>=0;c--)n.addNextSegment(a[c],!0);n.addLastSegment(),n.addLineEndCap(a[1],a[0]),n.closeRing()},Sa.prototype.computePointCurve=function(e,n){switch(this._bufParams.getEndCapStyle()){case ni.CAP_ROUND:n.createCircle(e);break;case ni.CAP_SQUARE:n.createSquare(e);break}},Sa.prototype.getLineCurve=function(e,n){if(this._distance=n,n<0&&!this._bufParams.isSingleSided()||n===0)return null;var r=Math.abs(n),i=this.getSegGen(r);if(e.length<=1)this.computePointCurve(e[0],i);else if(this._bufParams.isSingleSided()){var o=n<0;this.computeSingleSidedBufferCurve(e,o,i)}else this.computeLineBufferCurve(e,i);var s=i.getCoordinates();return s},Sa.prototype.getBufferParameters=function(){return this._bufParams},Sa.prototype.simplifyTolerance=function(e){return e*this._bufParams.getSimplifyFactor()},Sa.prototype.getRingCurve=function(e,n,r){if(this._distance=r,e.length<=2)return this.getLineCurve(e,r);if(r===0)return Sa.copyCoordinates(e);var i=this.getSegGen(r);return this.computeRingBufferCurve(e,n,i),i.getCoordinates()},Sa.prototype.computeOffsetCurve=function(e,n,r){var i=this.simplifyTolerance(this._distance);if(n){var o=to.simplify(e,-i),s=o.length-1;r.initSideSegments(o[s],o[s-1],Nt.LEFT),r.addFirstSegment();for(var a=s-2;a>=0;a--)r.addNextSegment(o[a],!0)}else{var l=to.simplify(e,i),c=l.length-1;r.initSideSegments(l[0],l[1],Nt.LEFT),r.addFirstSegment();for(var u=2;u<=c;u++)r.addNextSegment(l[u],!0)}r.addLastSegment()},Sa.prototype.getSegGen=function(e){return new $i(this._precisionModel,this._bufParams,e)},Sa.prototype.interfaces_=function(){return[]},Sa.prototype.getClass=function(){return Sa},Sa.copyCoordinates=function(e){for(var n=new Array(e.length).fill(null),r=0;rs.getMaxY()||e.findStabbedSegments(n,o.getDirectedEdges(),r)}return r}else if(arguments.length===3){if(Mn(arguments[2],Ec)&&arguments[0]instanceof et&&arguments[1]instanceof zL)for(var a=arguments[0],l=arguments[1],c=arguments[2],u=l.getEdge().getCoordinates(),d=0;de._seg.p1.y&&e._seg.reverse();var p=Math.max(e._seg.p0.x,e._seg.p1.x);if(!(pe._seg.p1.y)&&Ut.computeOrientation(e._seg.p0,e._seg.p1,a)!==Ut.RIGHT){var m=l.getDepth(Nt.LEFT);e._seg.p0.equals(u[d])||(m=l.getDepth(Nt.RIGHT));var y=new bp(e._seg,m);c.add(y)}}else if(Mn(arguments[2],Ec)&&arguments[0]instanceof et&&Mn(arguments[1],Ec))for(var w=arguments[0],x=arguments[1],C=arguments[2],S=x.iterator();S.hasNext();){var M=S.next();M.isForward()&&e.findStabbedSegments(w,M,C)}}},pg.prototype.getDepth=function(e){var n=this.findStabbedSegments(e);if(n.size()===0)return 0;var r=Tc.min(n);return r._leftDepth},pg.prototype.interfaces_=function(){return[]},pg.prototype.getClass=function(){return pg},wz.DepthSegment.get=function(){return bp},Object.defineProperties(pg,wz);var bp=function(){this._upwardSeg=null,this._leftDepth=null;var e=arguments[0],n=arguments[1];this._upwardSeg=new pn(e),this._leftDepth=n};bp.prototype.compareTo=function(e){var n=e;if(this._upwardSeg.minX()>=n._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=n._upwardSeg.minX())return-1;var r=this._upwardSeg.orientationIndex(n._upwardSeg);return r!==0||(r=-1*n._upwardSeg.orientationIndex(this._upwardSeg),r!==0)?r:this._upwardSeg.compareTo(n._upwardSeg)},bp.prototype.compareX=function(e,n){var r=e.p0.compareTo(n.p0);return r!==0?r:e.p1.compareTo(n.p1)},bp.prototype.toString=function(){return this._upwardSeg.toString()},bp.prototype.interfaces_=function(){return[Hl]},bp.prototype.getClass=function(){return bp};var ri=function(e,n,r){this.p0=e||null,this.p1=n||null,this.p2=r||null};ri.prototype.area=function(){return ri.area(this.p0,this.p1,this.p2)},ri.prototype.signedArea=function(){return ri.signedArea(this.p0,this.p1,this.p2)},ri.prototype.interpolateZ=function(e){if(e===null)throw new ji("Supplied point is null.");return ri.interpolateZ(e,this.p0,this.p1,this.p2)},ri.prototype.longestSideLength=function(){return ri.longestSideLength(this.p0,this.p1,this.p2)},ri.prototype.isAcute=function(){return ri.isAcute(this.p0,this.p1,this.p2)},ri.prototype.circumcentre=function(){return ri.circumcentre(this.p0,this.p1,this.p2)},ri.prototype.area3D=function(){return ri.area3D(this.p0,this.p1,this.p2)},ri.prototype.centroid=function(){return ri.centroid(this.p0,this.p1,this.p2)},ri.prototype.inCentre=function(){return ri.inCentre(this.p0,this.p1,this.p2)},ri.prototype.interfaces_=function(){return[]},ri.prototype.getClass=function(){return ri},ri.area=function(e,n,r){return Math.abs(((r.x-e.x)*(n.y-e.y)-(n.x-e.x)*(r.y-e.y))/2)},ri.signedArea=function(e,n,r){return((r.x-e.x)*(n.y-e.y)-(n.x-e.x)*(r.y-e.y))/2},ri.det=function(e,n,r,i){return e*i-n*r},ri.interpolateZ=function(e,n,r,i){var o=n.x,s=n.y,a=r.x-o,l=i.x-o,c=r.y-s,u=i.y-s,d=a*u-l*c,p=e.x-o,m=e.y-s,y=(u*p-l*m)/d,w=(-c*p+a*m)/d,x=n.z+y*(r.z-n.z)+w*(i.z-n.z);return x},ri.longestSideLength=function(e,n,r){var i=e.distance(n),o=n.distance(r),s=r.distance(e),a=i;return o>a&&(a=o),s>a&&(a=s),a},ri.isAcute=function(e,n,r){return!(!gr.isAcute(e,n,r)||!gr.isAcute(n,r,e)||!gr.isAcute(r,e,n))},ri.circumcentre=function(e,n,r){var i=r.x,o=r.y,s=e.x-i,a=e.y-o,l=n.x-i,c=n.y-o,u=2*ri.det(s,a,l,c),d=ri.det(a,s*s+a*a,c,l*l+c*c),p=ri.det(s,s*s+a*a,l,l*l+c*c),m=i-d/u,y=o+p/u;return new et(m,y)},ri.perpendicularBisector=function(e,n){var r=n.x-e.x,i=n.y-e.y,o=new wc(e.x+r/2,e.y+i/2,1),s=new wc(e.x-i+r/2,e.y+r+i/2,1);return new wc(o,s)},ri.angleBisector=function(e,n,r){var i=n.distance(e),o=n.distance(r),s=i/(i+o),a=r.x-e.x,l=r.y-e.y,c=new et(e.x+s*a,e.y+s*l);return c},ri.area3D=function(e,n,r){var i=n.x-e.x,o=n.y-e.y,s=n.z-e.z,a=r.x-e.x,l=r.y-e.y,c=r.z-e.z,u=o*c-s*l,d=s*a-i*c,p=i*l-o*a,m=u*u+d*d+p*p,y=Math.sqrt(m)/2;return y},ri.centroid=function(e,n,r){var i=(e.x+n.x+r.x)/3,o=(e.y+n.y+r.y)/3;return new et(i,o)},ri.inCentre=function(e,n,r){var i=n.distance(r),o=e.distance(r),s=e.distance(n),a=i+o+s,l=(i*e.x+o*n.x+s*r.x)/a,c=(i*e.y+o*n.y+s*r.y)/a;return new et(l,c)};var Xl=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new $t;var e=arguments[0],n=arguments[1],r=arguments[2];this._inputGeom=e,this._distance=n,this._curveBuilder=r};Xl.prototype.addPoint=function(e){if(this._distance<=0)return null;var n=e.getCoordinates(),r=this._curveBuilder.getLineCurve(n,this._distance);this.addCurve(r,st.EXTERIOR,st.INTERIOR)},Xl.prototype.addPolygon=function(e){var n=this,r=this._distance,i=Nt.LEFT;this._distance<0&&(r=-this._distance,i=Nt.RIGHT);var o=e.getExteriorRing(),s=or.removeRepeatedPoints(o.getCoordinates());if(this._distance<0&&this.isErodedCompletely(o,this._distance)||this._distance<=0&&s.length<3)return null;this.addPolygonRing(s,r,i,st.EXTERIOR,st.INTERIOR);for(var a=0;a0&&n.isErodedCompletely(l,-n._distance)||n.addPolygonRing(c,r,Nt.opposite(i),st.INTERIOR,st.EXTERIOR)}},Xl.prototype.isTriangleErodedCompletely=function(e,n){var r=new ri(e[0],e[1],e[2]),i=r.inCentre(),o=Ut.distancePointLine(i,r.p0,r.p1);return o=Ju.MINIMUM_VALID_SIZE&&Ut.isCCW(e)&&(s=o,a=i,r=Nt.opposite(r));var l=this._curveBuilder.getRingCurve(e,r,n);this.addCurve(l,s,a)},Xl.prototype.add=function(e){if(e.isEmpty())return null;e instanceof No?this.addPolygon(e):e instanceof eo?this.addLineString(e):e instanceof Va?this.addPoint(e):e instanceof Wv?this.addCollection(e):e instanceof vp?this.addCollection(e):e instanceof Qu?this.addCollection(e):e instanceof ea&&this.addCollection(e)},Xl.prototype.isErodedCompletely=function(e,n){var r=e.getCoordinates();if(r.length<4)return n<0;if(r.length===4)return this.isTriangleErodedCompletely(r,n);var i=e.getEnvelopeInternal(),o=Math.min(i.getHeight(),i.getWidth());return n<0&&2*Math.abs(n)>o},Xl.prototype.addCollection=function(e){for(var n=this,r=0;r=this._max)throw new Uv;var e=this._parent.getGeometryN(this._index++);return e instanceof ea?(this._subcollectionIterator=new nh(e),this._subcollectionIterator.next()):e},nh.prototype.remove=function(){throw new Error(this.getClass().getName())},nh.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},nh.prototype.interfaces_=function(){return[jv]},nh.prototype.getClass=function(){return nh},nh.isAtomic=function(e){return!(e instanceof ea)};var wl=function(){this._geom=null;var e=arguments[0];this._geom=e};wl.prototype.locate=function(e){return wl.locate(e,this._geom)},wl.prototype.interfaces_=function(){return[Zv]},wl.prototype.getClass=function(){return wl},wl.isPointInRing=function(e,n){return n.getEnvelopeInternal().intersects(e)?Ut.isPointInRing(e,n.getCoordinates()):!1},wl.containsPointInPolygon=function(e,n){if(n.isEmpty())return!1;var r=n.getExteriorRing();if(!wl.isPointInRing(e,r))return!1;for(var i=0;i=0;s--){var a=r._edgeList.get(s),l=a.getSym();o===null&&(o=l),i!==null&&l.setNext(i),i=a}o.setNext(i)},e.prototype.computeDepths=function(){var r=this;if(arguments.length===1){var i=arguments[0],o=this.findIndex(i),s=i.getDepth(Nt.LEFT),a=i.getDepth(Nt.RIGHT),l=this.computeDepths(o+1,this._edgeList.size(),s),c=this.computeDepths(0,o,l);if(c!==a)throw new Zh("depth mismatch at "+i.getCoordinate())}else if(arguments.length===3){for(var u=arguments[0],d=arguments[1],p=arguments[2],m=p,y=u;y=0;l--){var c=i._resultAreaEdgeList.get(l),u=c.getSym();switch(o===null&&c.getEdgeRing()===r&&(o=c),a){case i._SCANNING_FOR_INCOMING:if(u.getEdgeRing()!==r)continue;s=u,a=i._LINKING_TO_OUTGOING;break;case i._LINKING_TO_OUTGOING:if(c.getEdgeRing()!==r)continue;s.setNextMin(c),a=i._SCANNING_FOR_INCOMING;break}}a===this._LINKING_TO_OUTGOING&&(Yn.isTrue(o!==null,"found null for first outgoing dirEdge"),Yn.isTrue(o.getEdgeRing()===r,"unable to link last incoming dirEdge"),s.setNextMin(o))},e.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var r=0,i=this.iterator();i.hasNext();){var o=i.next();o.isInResult()&&r++}return r}else if(arguments.length===1){for(var s=arguments[0],a=0,l=this.iterator();l.hasNext();){var c=l.next();c.getEdgeRing()===s&&a++}return a}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var r=st.NONE,i=this.iterator();i.hasNext();){var o=i.next(),s=o.getSym();if(!o.isLineEdge()){if(o.isInResult()){r=st.INTERIOR;break}if(s.isInResult()){r=st.EXTERIOR;break}}}if(r===st.NONE)return null;for(var a=r,l=this.iterator();l.hasNext();){var c=l.next(),u=c.getSym();c.isLineEdge()?c.getEdge().setCovered(a===st.INTERIOR):(c.isInResult()&&(a=st.EXTERIOR),u.isInResult()&&(a=st.INTERIOR))}},e.prototype.computeLabelling=function(r){var i=this;t.prototype.computeLabelling.call(this,r),this._label=new ci(st.NONE);for(var o=this.iterator();o.hasNext();)for(var s=o.next(),a=s.getEdge(),l=a.getLabel(),c=0;c<2;c++){var u=l.getLocation(c);(u===st.INTERIOR||u===st.BOUNDARY)&&i._label.setLocation(c,st.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Fs),xz=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(r){return new MS(r,new Tle)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Gv),ef=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};ef.prototype.compareTo=function(e){var n=e,r=ef.compareOriented(this._pts,this._orientation,n._pts,n._orientation);return r},ef.prototype.interfaces_=function(){return[Hl]},ef.prototype.getClass=function(){return ef},ef.orientation=function(e){return or.increasingDirection(e)===1},ef.compareOriented=function(e,n,r,i){for(var o=n?1:-1,s=i?1:-1,a=n?e.length:-1,l=i?r.length:-1,c=n?0:e.length-1,u=i?0:r.length-1;;){var d=e[c].compareTo(r[u]);if(d!==0)return d;c+=o,u+=s;var p=c===a,m=u===l;if(p&&!m)return-1;if(!p&&m)return 1;if(p&&m)return 0}};var Mc=function(){this._edges=new $t,this._ocaMap=new Rs};Mc.prototype.print=function(e){var n=this;e.print("MULTILINESTRING ( ");for(var r=0;r0&&e.print(","),e.print("(");for(var o=i.getCoordinates(),s=0;s0&&e.print(","),e.print(o[s].x+" "+o[s].y);e.println(")")}e.print(") ")},Mc.prototype.addAll=function(e){for(var n=this,r=e.iterator();r.hasNext();)n.add(r.next())},Mc.prototype.findEdgeIndex=function(e){for(var n=this,r=0;r0||!n.coord.equals2D(o);s||i--;var a=new Array(i).fill(null),l=0;a[l++]=new et(e.coord);for(var c=e.segmentIndex+1;c<=n.segmentIndex;c++)a[l++]=r.edge.pts[c];return s&&(a[l]=n.coord),new IS(a,new ci(this.edge._label))},rh.prototype.add=function(e,n,r){var i=new du(e,n,r),o=this._nodeMap.get(i);return o!==null?o:(this._nodeMap.put(i,i),i)},rh.prototype.isIntersection=function(e){for(var n=this.iterator();n.hasNext();){var r=n.next();if(r.coord.equals(e))return!0}return!1},rh.prototype.interfaces_=function(){return[]},rh.prototype.getClass=function(){return rh};var xp=function(){};xp.prototype.getChainStartIndices=function(e){var n=this,r=0,i=new $t;i.add(new tu(r));do{var o=n.findChainEnd(e,r);i.add(new tu(o)),r=o}while(rr?n:r},Jh.prototype.getMinX=function(e){var n=this.pts[this.startIndex[e]].x,r=this.pts[this.startIndex[e+1]].x;return nr&&(o=1),e._depth[n][i]=o}}},hs.prototype.getDelta=function(e){return this._depth[e][Nt.RIGHT]-this._depth[e][Nt.LEFT]},hs.prototype.getLocation=function(e,n){return this._depth[e][n]<=0?st.EXTERIOR:st.INTERIOR},hs.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},hs.prototype.add=function(){var e=this;if(arguments.length===1)for(var n=arguments[0],r=0;r<2;r++)for(var i=1;i<3;i++){var o=n.getLocation(r,i);(o===st.EXTERIOR||o===st.INTERIOR)&&(e.isNull(r,i)?e._depth[r][i]=hs.depthAtLocation(o):e._depth[r][i]+=hs.depthAtLocation(o))}else if(arguments.length===3){var s=arguments[0],a=arguments[1],l=arguments[2];l===st.INTERIOR&&this._depth[s][a]++}},hs.prototype.interfaces_=function(){return[]},hs.prototype.getClass=function(){return hs},hs.depthAtLocation=function(e){return e===st.EXTERIOR?0:e===st.INTERIOR?1:hs.NULL_VALUE},Ez.NULL_VALUE.get=function(){return-1},Object.defineProperties(hs,Ez);var IS=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new rh(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new hs,this._depthDelta=0,arguments.length===1){var n=arguments[0];e.call(this,n,null)}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.pts=r,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var r=new Array(2).fill(null);r[0]=this.pts[0],r[1]=this.pts[1];var i=new e(r,ci.toLineLabel(this._label));return i},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(r){this._isIsolated=r},e.prototype.setName=function(r){this._name=r},e.prototype.equals=function(r){var i=this;if(!(r instanceof e))return!1;var o=r;if(this.pts.length!==o.pts.length)return!1;for(var s=!0,a=!0,l=this.pts.length,c=0;c0?this.pts[0]:null;if(arguments.length===1){var r=arguments[0];return this.pts[r]}},e.prototype.print=function(r){var i=this;r.print("edge "+this._name+": "),r.print("LINESTRING (");for(var o=0;o0&&r.print(","),r.print(i.pts[o].x+" "+i.pts[o].y);r.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(r){e.updateIM(this._label,r)},e.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(r){var i=this;r.print("edge "+this._name+": ");for(var o=this.pts.length-1;o>=0;o--)r.print(i.pts[o]+" ");r.println("")},e.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new Jh(this)),this._mce},e.prototype.getEnvelope=function(){var r=this;if(this._env===null){this._env=new fn;for(var i=0;i0&&i.append(","),i.append(r.pts[o].x+" "+r.pts[o].y);return i.append(") "+this._label+" "+this._depthDelta),i.toString()},e.prototype.isPointwiseEqual=function(r){var i=this;if(this.pts.length!==r.pts.length)return!1;for(var o=0;oi||this._maxys;if(a)return!1;var l=this.intersectsToleranceSquare(e,n);return Yn.isTrue(!(a&&l),"Found bad envelope test"),l},Ca.prototype.initCorners=function(e){var n=.5;this._minx=e.x-n,this._maxx=e.x+n,this._miny=e.y-n,this._maxy=e.y+n,this._corner[0]=new et(this._maxx,this._maxy),this._corner[1]=new et(this._minx,this._maxy),this._corner[2]=new et(this._minx,this._miny),this._corner[3]=new et(this._maxx,this._miny)},Ca.prototype.intersects=function(e,n){return this._scaleFactor===1?this.intersectsScaled(e,n):(this.copyScaled(e,this._p0Scaled),this.copyScaled(n,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},Ca.prototype.scale=function(e){return Math.round(e*this._scaleFactor)},Ca.prototype.getCoordinate=function(){return this._originalPt},Ca.prototype.copyScaled=function(e,n){n.x=this.scale(e.x),n.y=this.scale(e.y)},Ca.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var e=Ca.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new fn(this._originalPt.x-e,this._originalPt.x+e,this._originalPt.y-e,this._originalPt.y+e)}return this._safeEnv},Ca.prototype.intersectsPixelClosure=function(e,n){return this._li.computeIntersection(e,n,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(e,n,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(e,n,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(e,n,this._corner[3],this._corner[0]),this._li.hasIntersection()))},Ca.prototype.intersectsToleranceSquare=function(e,n){var r=!1,i=!1;return this._li.computeIntersection(e,n,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(e,n,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(e,n,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(e,n,this._corner[3],this._corner[0]),this._li.isProper())||r&&i||e.equals(this._pt)||n.equals(this._pt))},Ca.prototype.addSnappedNode=function(e,n){var r=e.getCoordinate(n),i=e.getCoordinate(n+1);return this.intersects(r,i)?(e.addIntersection(this.getCoordinate(),n),!0):!1},Ca.prototype.interfaces_=function(){return[]},Ca.prototype.getClass=function(){return Ca},Cz.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(Ca,Cz);var s1=function(){this.tempEnv1=new fn,this.selectedSegment=new pn};s1.prototype.select=function(){if(arguments.length!==1){if(arguments.length===2){var e=arguments[0],n=arguments[1];e.getLineSegment(n,this.selectedSegment),this.select(this.selectedSegment)}}},s1.prototype.interfaces_=function(){return[]},s1.prototype.getClass=function(){return s1};var Xv=function(){this._index=null;var e=arguments[0];this._index=e},kz={HotPixelSnapAction:{configurable:!0}};Xv.prototype.snap=function(){if(arguments.length===1){var e=arguments[0];return this.snap(e,null,-1)}else if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2],o=n.getSafeEnvelope(),s=new Tz(n,r,i);return this._index.query(o,{interfaces_:function(){return[Jd]},visitItem:function(a){var l=a;l.select(o,s)}}),s.isNodeAdded()}},Xv.prototype.interfaces_=function(){return[]},Xv.prototype.getClass=function(){return Xv},kz.HotPixelSnapAction.get=function(){return Tz},Object.defineProperties(Xv,kz);var Tz=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],r=arguments[1],i=arguments[2];this._hotPixel=n,this._parentEdge=r,this._hotPixelVertexIndex=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1],o=r.getContext();if(this._parentEdge!==null&&o===this._parentEdge&&i===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(o,i)}else return t.prototype.select.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(s1),mg=function(){this._li=null,this._interiorIntersections=null;var e=arguments[0];this._li=e,this._interiorIntersections=new $t};mg.prototype.processIntersections=function(e,n,r,i){var o=this;if(e===r&&n===i)return null;var s=e.getCoordinates()[n],a=e.getCoordinates()[n+1],l=r.getCoordinates()[i],c=r.getCoordinates()[i+1];if(this._li.computeIntersection(s,a,l,c),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var u=0;u=0;n--){try{e.bufferReducedPrecision(n)}catch(s){if(s instanceof Zh)e._saveException=s;else throw s}finally{}if(e._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var r=arguments[0],i=ds.precisionScaleFactor(this._argGeom,this._distance,r),o=new ti(i);this.bufferFixedPrecision(o)}},ds.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var e=this._argGeom.getFactory().getPrecisionModel();e.getType()===ti.FIXED?this.bufferFixedPrecision(e):this.bufferReducedPrecision()},ds.prototype.setQuadrantSegments=function(e){this._bufParams.setQuadrantSegments(e)},ds.prototype.bufferOriginalPrecision=function(){try{var e=new ra(this._bufParams);this._resultGeometry=e.buffer(this._argGeom,this._distance)}catch(n){if(n instanceof Uh)this._saveException=n;else throw n}finally{}},ds.prototype.getResultGeometry=function(e){return this._distance=e,this.computeGeometry(),this._resultGeometry},ds.prototype.setEndCapStyle=function(e){this._bufParams.setEndCapStyle(e)},ds.prototype.interfaces_=function(){return[]},ds.prototype.getClass=function(){return ds},ds.bufferOp=function(){if(arguments.length===2){var e=arguments[0],n=arguments[1],r=new ds(e),i=r.getResultGeometry(n);return i}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof kn&&typeof arguments[1]=="number"){var o=arguments[0],s=arguments[1],a=arguments[2],l=new ds(o);l.setQuadrantSegments(a);var c=l.getResultGeometry(s);return c}else if(arguments[2]instanceof ni&&arguments[0]instanceof kn&&typeof arguments[1]=="number"){var u=arguments[0],d=arguments[1],p=arguments[2],m=new ds(u,p),y=m.getResultGeometry(d);return y}}else if(arguments.length===4){var w=arguments[0],x=arguments[1],C=arguments[2],S=arguments[3],M=new ds(w);M.setQuadrantSegments(C),M.setEndCapStyle(S);var E=M.getResultGeometry(x);return E}},ds.precisionScaleFactor=function(e,n,r){var i=e.getEnvelopeInternal(),o=vl.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY())),s=n>0?n:0,a=o+2*s,l=Math.trunc(Math.log(a)/Math.log(10)+1),c=r-l,u=Math.pow(10,c);return u},Kv.CAP_ROUND.get=function(){return ni.CAP_ROUND},Kv.CAP_BUTT.get=function(){return ni.CAP_FLAT},Kv.CAP_FLAT.get=function(){return ni.CAP_FLAT},Kv.CAP_SQUARE.get=function(){return ni.CAP_SQUARE},Kv.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(ds,Kv);var ia=function(){this._pt=[new et,new et],this._distance=Un.NaN,this._isNull=!0};ia.prototype.getCoordinates=function(){return this._pt},ia.prototype.getCoordinate=function(e){return this._pt[e]},ia.prototype.setMinimum=function(){if(arguments.length===1){var e=arguments[0];this.setMinimum(e._pt[0],e._pt[1])}else if(arguments.length===2){var n=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(n,r),null;var i=n.distance(r);ithis._distance&&this.initialize(n,r,i)}},ia.prototype.interfaces_=function(){return[]},ia.prototype.getClass=function(){return ia};var oh=function(){};oh.prototype.interfaces_=function(){return[]},oh.prototype.getClass=function(){return oh},oh.computeDistance=function(){if(arguments[2]instanceof ia&&arguments[0]instanceof eo&&arguments[1]instanceof et)for(var e=arguments[0],n=arguments[1],r=arguments[2],i=e.getCoordinates(),o=new pn,s=0;s0||this._isIn?st.INTERIOR:st.EXTERIOR)},Ac.prototype.interfaces_=function(){return[]},Ac.prototype.getClass=function(){return Ac};var oa=function t(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var e=arguments[0],n=arguments[1];t.call(this,e,t.INSIDE_AREA,n)}else if(arguments.length===3){var r=arguments[0],i=arguments[1],o=arguments[2];this._component=r,this._segIndex=i,this._pt=o}},Mz={INSIDE_AREA:{configurable:!0}};oa.prototype.isInsideArea=function(){return this._segIndex===oa.INSIDE_AREA},oa.prototype.getCoordinate=function(){return this._pt},oa.prototype.getGeometryComponent=function(){return this._component},oa.prototype.getSegmentIndex=function(){return this._segIndex},oa.prototype.interfaces_=function(){return[]},oa.prototype.getClass=function(){return oa},Mz.INSIDE_AREA.get=function(){return-1},Object.defineProperties(oa,Mz);var rf=function(e){this._pts=e||null};rf.prototype.filter=function(e){e instanceof Va&&this._pts.add(e)},rf.prototype.interfaces_=function(){return[ou]},rf.prototype.getClass=function(){return rf},rf.getPoints=function(){if(arguments.length===1){var e=arguments[0];return e instanceof Va?Tc.singletonList(e):rf.getPoints(e,new $t)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return n instanceof Va?r.add(n):n instanceof ea&&n.apply(new rf(r)),r}};var yg=function(){this._locations=null;var e=arguments[0];this._locations=e};yg.prototype.filter=function(e){(e instanceof Va||e instanceof eo||e instanceof No)&&this._locations.add(new oa(e,0,e.getCoordinate()))},yg.prototype.interfaces_=function(){return[ou]},yg.prototype.getClass=function(){return yg},yg.getLocations=function(e){var n=new $t;return e.apply(new yg(n)),n};var ps=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Ac,this._minDistanceLocation=null,this._minDistance=Un.MAX_VALUE,arguments.length===2){var e=arguments[0],n=arguments[1];this._geom=[e,n],this._terminateDistance=0}else if(arguments.length===3){var r=arguments[0],i=arguments[1],o=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=i,this._terminateDistance=o}};ps.prototype.computeContainmentDistance=function(){var e=this;if(arguments.length===0){var n=new Array(2).fill(null);if(this.computeContainmentDistance(0,n),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,n)}else if(arguments.length===2){var r=arguments[0],i=arguments[1],o=1-r,s=Qh.getPolygons(this._geom[r]);if(s.size()>0){var a=yg.getLocations(this._geom[o]);if(this.computeContainmentDistance(a,s,i),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[o]=i[0],this._minDistanceLocation[r]=i[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Mn(arguments[0],Ec)&&Mn(arguments[1],Ec)){for(var l=arguments[0],c=arguments[1],u=arguments[2],d=0;dthis._minDistance)return null;for(var o=n.getCoordinates(),s=r.getCoordinate(),a=0;athis._minDistance)return null;for(var y=d.getCoordinates(),w=p.getCoordinates(),x=0;xthis._distance&&this.initialize(n,r,i)}},$s.prototype.interfaces_=function(){return[]},$s.prototype.getClass=function(){return $s};var pu=function(){};pu.prototype.interfaces_=function(){return[]},pu.prototype.getClass=function(){return pu},pu.computeDistance=function(){if(arguments[2]instanceof $s&&arguments[0]instanceof eo&&arguments[1]instanceof et)for(var e=arguments[0],n=arguments[1],r=arguments[2],i=new pn,o=e.getCoordinates(),s=0;s1||e<=0)throw new ji("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=e},Kl.prototype.compute=function(e,n){this.computeOrientedDistance(e,n,this._ptDist),this.computeOrientedDistance(n,e,this._ptDist)},Kl.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Kl.prototype.computeOrientedDistance=function(e,n,r){var i=new vg(n);if(e.apply(i),r.setMaximum(i.getMaxPointDistance()),this._densifyFrac>0){var o=new of(n,this._densifyFrac);e.apply(o),r.setMaximum(o.getMaxPointDistance())}},Kl.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Kl.prototype.interfaces_=function(){return[]},Kl.prototype.getClass=function(){return Kl},Kl.distance=function(){if(arguments.length===2){var e=arguments[0],n=arguments[1],r=new Kl(e,n);return r.distance()}else if(arguments.length===3){var i=arguments[0],o=arguments[1],s=arguments[2],a=new Kl(i,o);return a.setDensifyFraction(s),a.distance()}},UL.MaxPointDistanceFilter.get=function(){return vg},UL.MaxDensifiedByFractionDistanceFilter.get=function(){return of},Object.defineProperties(Kl,UL);var vg=function(){this._maxPtDist=new $s,this._minPtDist=new $s,this._euclideanDist=new pu,this._geom=null;var e=arguments[0];this._geom=e};vg.prototype.filter=function(e){this._minPtDist.initialize(),pu.computeDistance(this._geom,e,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},vg.prototype.getMaxPointDistance=function(){return this._maxPtDist},vg.prototype.interfaces_=function(){return[Ku]},vg.prototype.getClass=function(){return vg};var of=function(){this._maxPtDist=new $s,this._minPtDist=new $s,this._geom=null,this._numSubSegs=0;var e=arguments[0],n=arguments[1];this._geom=e,this._numSubSegs=Math.trunc(Math.round(1/n))};of.prototype.filter=function(e,n){var r=this;if(n===0)return null;for(var i=e.getCoordinate(n-1),o=e.getCoordinate(n),s=(o.x-i.x)/this._numSubSegs,a=(o.y-i.y)/this._numSubSegs,l=0;lr){this._isValid=!1;var o=i.getCoordinates();this._errorLocation=o[1],this._errorIndicator=e.getFactory().createLineString(o),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+xc.toLineString(o[0],o[1])+")"}},Ha.prototype.isValid=function(){var e=Math.abs(this._bufDistance),n=Ha.MAX_DISTANCE_DIFF_FRAC*e;return this._minValidDistance=e-n,this._maxValidDistance=e+n,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Ha.VERBOSE&&us.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Ha.prototype.checkNegativeValid=function(){if(!(this._input instanceof No||this._input instanceof Qu||this._input instanceof ea))return null;var e=this.getPolygonLines(this._input);if(this.checkMinimumDistance(e,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(e,this._result,this._maxValidDistance)},Ha.prototype.getErrorIndicator=function(){return this._errorIndicator},Ha.prototype.checkMinimumDistance=function(e,n,r){var i=new ps(e,n,r);if(this._minDistanceFound=i.distance(),this._minDistanceFound0&&e>n&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&e=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")},ms.prototype.report=function(e){if(!ms.VERBOSE)return null;us.out.println("Check "+e+": "+(this._isValid?"passed":"FAILED"))},ms.prototype.getErrorMessage=function(){return this._errorMsg},ms.prototype.interfaces_=function(){return[]},ms.prototype.getClass=function(){return ms},ms.isValidMsg=function(e,n,r){var i=new ms(e,n,r);return i.isValid()?null:i.getErrorMessage()},ms.isValid=function(e,n,r){var i=new ms(e,n,r);return!!i.isValid()},WL.VERBOSE.get=function(){return!1},WL.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(ms,WL);var mu=function(){this._pts=null,this._data=null;var e=arguments[0],n=arguments[1];this._pts=e,this._data=n};mu.prototype.getCoordinates=function(){return this._pts},mu.prototype.size=function(){return this._pts.length},mu.prototype.getCoordinate=function(e){return this._pts[e]},mu.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},mu.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:dg.octant(this.getCoordinate(e),this.getCoordinate(e+1))},mu.prototype.setData=function(e){this._data=e},mu.prototype.getData=function(){return this._data},mu.prototype.toString=function(){return xc.toLineString(new po(this._pts))},mu.prototype.interfaces_=function(){return[th]},mu.prototype.getClass=function(){return mu};var Qo=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new $t,this._intersectionCount=0,this._keepIntersections=!0;var e=arguments[0];this._li=e,this._interiorIntersection=null};Qo.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Qo.prototype.setCheckEndSegmentsOnly=function(e){this._isCheckEndSegmentsOnly=e},Qo.prototype.getIntersectionSegments=function(){return this._intSegments},Qo.prototype.count=function(){return this._intersectionCount},Qo.prototype.getIntersections=function(){return this._intersections},Qo.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e},Qo.prototype.setKeepIntersections=function(e){this._keepIntersections=e},Qo.prototype.processIntersections=function(e,n,r,i){if(!this._findAllIntersections&&this.hasIntersection()||e===r&&n===i)return null;if(this._isCheckEndSegmentsOnly){var o=this.isEndSegment(e,n)||this.isEndSegment(r,i);if(!o)return null}var s=e.getCoordinates()[n],a=e.getCoordinates()[n+1],l=r.getCoordinates()[i],c=r.getCoordinates()[i+1];this._li.computeIntersection(s,a,l,c),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=s,this._intSegments[1]=a,this._intSegments[2]=l,this._intSegments[3]=c,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},Qo.prototype.isEndSegment=function(e,n){return n===0||n>=e.size()-2},Qo.prototype.hasIntersection=function(){return this._interiorIntersection!==null},Qo.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null},Qo.prototype.interfaces_=function(){return[wp]},Qo.prototype.getClass=function(){return Qo},Qo.createAllIntersectionsFinder=function(e){var n=new Qo(e);return n.setFindAllIntersections(!0),n},Qo.createAnyIntersectionFinder=function(e){return new Qo(e)},Qo.createIntersectionCounter=function(e){var n=new Qo(e);return n.setFindAllIntersections(!0),n.setKeepIntersections(!1),n};var Ic=function(){this._li=new mp,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var e=arguments[0];this._segStrings=e};Ic.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},Ic.prototype.getIntersections=function(){return this._segInt.getIntersections()},Ic.prototype.isValid=function(){return this.execute(),this._isValid},Ic.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e},Ic.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Qo(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var e=new VL;if(e.setSegmentIntersector(this._segInt),e.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Ic.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Zh(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Ic.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var e=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+xc.toLineString(e[0],e[1])+" and "+xc.toLineString(e[2],e[3])},Ic.prototype.interfaces_=function(){return[]},Ic.prototype.getClass=function(){return Ic},Ic.computeIntersections=function(e){var n=new Ic(e);return n.setFindAllIntersections(!0),n.isValid(),n.getIntersections()};var Sp=function t(){this._nv=null;var e=arguments[0];this._nv=new Ic(t.toSegmentStrings(e))};Sp.prototype.checkValid=function(){this._nv.checkValid()},Sp.prototype.interfaces_=function(){return[]},Sp.prototype.getClass=function(){return Sp},Sp.toSegmentStrings=function(e){for(var n=new $t,r=e.iterator();r.hasNext();){var i=r.next();n.add(new mu(i.getCoordinates(),i))}return n},Sp.checkValid=function(e){var n=new Sp(e);n.checkValid()};var _g=function(e){this._mapOp=e};_g.prototype.map=function(e){for(var n=this,r=new $t,i=0;i0&&i<4&&!this._preserveType?this._factory.createLineString(r):this._factory.createLinearRing(r)},ka.prototype.interfaces_=function(){return[]},ka.prototype.getClass=function(){return ka};var sh=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new pn,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof eo&&typeof arguments[1]=="number"){var e=arguments[0],n=arguments[1];t.call(this,e.getCoordinates(),n)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=i}};sh.prototype.snapVertices=function(e,n){for(var r=this,i=this._isClosed?e.size()-1:e.size(),o=0;o=0&&e.add(a+1,new et(s),!1)}},sh.prototype.findSegmentIndexToSnap=function(e,n){for(var r=this,i=Un.MAX_VALUE,o=-1,s=0;sn&&(n=i)}return n}else if(arguments.length===2){var o=arguments[0],s=arguments[1];return Math.min(go.computeOverlaySnapTolerance(o),go.computeOverlaySnapTolerance(s))}},go.computeSizeBasedSnapTolerance=function(e){var n=e.getEnvelopeInternal(),r=Math.min(n.getHeight(),n.getWidth()),i=r*go.SNAP_PRECISION_FACTOR;return i},go.snapToSelf=function(e,n,r){var i=new go(e);return i.snapToSelf(n,r)},Az.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(go,Az);var Iz=function(t){function e(n,r,i){t.call(this),this._snapTolerance=n||null,this._snapPts=r||null,this._isSelfSnap=i!==void 0?i:!1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(r,i){var o=new sh(r,this._snapTolerance);return o.setAllowSnappingToSourceVertices(this._isSelfSnap),o.snapTo(i)},e.prototype.transformCoordinates=function(r,i){var o=r.toCoordinateArray(),s=this.snapLine(o,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(s)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ka),sa=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};sa.prototype.getCommon=function(){return Un.longBitsToDouble(this._commonBits)},sa.prototype.add=function(e){var n=Un.doubleToLongBits(e);if(this._isFirst)return this._commonBits=n,this._commonSignExp=sa.signExpBits(this._commonBits),this._isFirst=!1,null;var r=sa.signExpBits(n);if(r!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=sa.numCommonMostSigMantissaBits(this._commonBits,n),this._commonBits=sa.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},sa.prototype.toString=function(){if(arguments.length===1){var e=arguments[0],n=Un.longBitsToDouble(e),r=Un.toBinaryString(e),i="0000000000000000000000000000000000000000000000000000000000000000"+r,o=i.substring(i.length-64),s=o.substring(0,1)+" "+o.substring(1,12)+"(exp) "+o.substring(12)+" [ "+n+" ]";return s}},sa.prototype.interfaces_=function(){return[]},sa.prototype.getClass=function(){return sa},sa.getBit=function(e,n){var r=1<>52},sa.zeroLowerBits=function(e,n){var r=(1<=0;i--){if(sa.getBit(e,i)!==sa.getBit(n,i))return r;r++}return 52};var sf=function(){this._commonCoord=null,this._ccFilter=new wg},GL={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};sf.prototype.addCommonBits=function(e){var n=new af(this._commonCoord);e.apply(n),e.geometryChanged()},sf.prototype.removeCommonBits=function(e){if(this._commonCoord.x===0&&this._commonCoord.y===0)return e;var n=new et(this._commonCoord);n.x=-n.x,n.y=-n.y;var r=new af(n);return e.apply(r),e.geometryChanged(),e},sf.prototype.getCommonCoordinate=function(){return this._commonCoord},sf.prototype.add=function(e){e.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},sf.prototype.interfaces_=function(){return[]},sf.prototype.getClass=function(){return sf},GL.CommonCoordinateFilter.get=function(){return wg},GL.Translater.get=function(){return af},Object.defineProperties(sf,GL);var wg=function(){this._commonBitsX=new sa,this._commonBitsY=new sa};wg.prototype.filter=function(e){this._commonBitsX.add(e.x),this._commonBitsY.add(e.y)},wg.prototype.getCommonCoordinate=function(){return new et(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},wg.prototype.interfaces_=function(){return[Ku]},wg.prototype.getClass=function(){return wg};var af=function(){this.trans=null;var e=arguments[0];this.trans=e};af.prototype.filter=function(e,n){var r=e.getOrdinate(n,0)+this.trans.x,i=e.getOrdinate(n,1)+this.trans.y;e.setOrdinate(n,0,r),e.setOrdinate(n,1,i)},af.prototype.isDone=function(){return!1},af.prototype.isGeometryChanged=function(){return!0},af.prototype.interfaces_=function(){return[Cc]},af.prototype.getClass=function(){return af};var es=function(e,n){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=e,this._geom[1]=n,this.computeSnapTolerance()};es.prototype.selfSnap=function(e){var n=new go(e),r=n.snapTo(e,this._snapTolerance);return r},es.prototype.removeCommonBits=function(e){this._cbr=new sf,this._cbr.add(e[0]),this._cbr.add(e[1]);var n=new Array(2).fill(null);return n[0]=this._cbr.removeCommonBits(e[0].copy()),n[1]=this._cbr.removeCommonBits(e[1].copy()),n},es.prototype.prepareResult=function(e){return this._cbr.addCommonBits(e),e},es.prototype.getResultGeometry=function(e){var n=this.snap(this._geom),r=Wn.overlayOp(n[0],n[1],e);return this.prepareResult(r)},es.prototype.checkValid=function(e){e.isValid()||us.out.println("Snapped geometry is invalid")},es.prototype.computeSnapTolerance=function(){this._snapTolerance=go.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},es.prototype.snap=function(e){var n=this.removeCommonBits(e),r=go.snap(n[0],n[1],this._snapTolerance);return r},es.prototype.interfaces_=function(){return[]},es.prototype.getClass=function(){return es},es.overlayOp=function(e,n,r){var i=new es(e,n);return i.getResultGeometry(r)},es.union=function(e,n){return es.overlayOp(e,n,Wn.UNION)},es.intersection=function(e,n){return es.overlayOp(e,n,Wn.INTERSECTION)},es.symDifference=function(e,n){return es.overlayOp(e,n,Wn.SYMDIFFERENCE)},es.difference=function(e,n){return es.overlayOp(e,n,Wn.DIFFERENCE)};var aa=function(e,n){this._geom=new Array(2).fill(null),this._geom[0]=e,this._geom[1]=n};aa.prototype.getResultGeometry=function(e){var n=null,r=!1,i=null;try{n=Wn.overlayOp(this._geom[0],this._geom[1],e);var o=!0;o&&(r=!0)}catch(s){if(s instanceof Uh)i=s;else throw s}finally{}if(!r)try{n=es.overlayOp(this._geom[0],this._geom[1],e)}catch(s){throw s instanceof Uh?i:s}finally{}return n},aa.prototype.interfaces_=function(){return[]},aa.prototype.getClass=function(){return aa},aa.overlayOp=function(e,n,r){var i=new aa(e,n);return i.getResultGeometry(r)},aa.union=function(e,n){return aa.overlayOp(e,n,Wn.UNION)},aa.intersection=function(e,n){return aa.overlayOp(e,n,Wn.INTERSECTION)},aa.symDifference=function(e,n){return aa.overlayOp(e,n,Wn.SYMDIFFERENCE)},aa.difference=function(e,n){return aa.overlayOp(e,n,Wn.DIFFERENCE)};var a1=function(){this.mce=null,this.chainIndex=null;var e=arguments[0],n=arguments[1];this.mce=e,this.chainIndex=n};a1.prototype.computeIntersections=function(e,n){this.mce.computeIntersectsForChain(this.chainIndex,e.mce,e.chainIndex,n)},a1.prototype.interfaces_=function(){return[]},a1.prototype.getClass=function(){return a1};var Wa=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var e=arguments[0],n=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=r,this._xValue=i,this._obj=o}},qL={INSERT:{configurable:!0},DELETE:{configurable:!0}};Wa.prototype.isDelete=function(){return this._eventType===Wa.DELETE},Wa.prototype.setDeleteEventIndex=function(e){this._deleteEventIndex=e},Wa.prototype.getObject=function(){return this._obj},Wa.prototype.compareTo=function(e){var n=e;return this._xValuen._xValue?1:this._eventTypen._eventType?1:0},Wa.prototype.getInsertEvent=function(){return this._insertEvent},Wa.prototype.isInsert=function(){return this._eventType===Wa.INSERT},Wa.prototype.isSameLabel=function(e){return this._label===null?!1:this._label===e._label},Wa.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},Wa.prototype.interfaces_=function(){return[Hl]},Wa.prototype.getClass=function(){return Wa},qL.INSERT.get=function(){return 1},qL.DELETE.get=function(){return 2},Object.defineProperties(Wa,qL);var LS=function(){};LS.prototype.interfaces_=function(){return[]},LS.prototype.getClass=function(){return LS};var gs=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._li=e,this._includeProper=n,this._recordIsolated=r};gs.prototype.isTrivialIntersection=function(e,n,r,i){if(e===r&&this._li.getIntersectionNum()===1){if(gs.isAdjacentSegments(n,i))return!0;if(e.isClosed()){var o=e.getNumPoints()-1;if(n===0&&i===o||i===0&&n===o)return!0}}return!1},gs.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},gs.prototype.setIsDoneIfProperInt=function(e){this._isDoneWhenProperInt=e},gs.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},gs.prototype.isBoundaryPointInternal=function(e,n){for(var r=n.iterator();r.hasNext();){var i=r.next(),o=i.getCoordinate();if(e.isIntersection(o))return!0}return!1},gs.prototype.hasProperIntersection=function(){return this._hasProper},gs.prototype.hasIntersection=function(){return this._hasIntersection},gs.prototype.isDone=function(){return this._isDone},gs.prototype.isBoundaryPoint=function(e,n){return n===null?!1:!!(this.isBoundaryPointInternal(e,n[0])||this.isBoundaryPointInternal(e,n[1]))},gs.prototype.setBoundaryNodes=function(e,n){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=e,this._bdyNodes[1]=n},gs.prototype.addIntersections=function(e,n,r,i){if(e===r&&n===i)return null;this.numTests++;var o=e.getCoordinates()[n],s=e.getCoordinates()[n+1],a=r.getCoordinates()[i],l=r.getCoordinates()[i+1];this._li.computeIntersection(o,s,a,l),this._li.hasIntersection()&&(this._recordIsolated&&(e.setIsolated(!1),r.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(e,n,r,i)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(e.addIntersections(this._li,n,0),r.addIntersections(this._li,i,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},gs.prototype.interfaces_=function(){return[]},gs.prototype.getClass=function(){return gs},gs.isAdjacentSegments=function(e,n){return Math.abs(e-n)===1};var Mle=function(t){function e(){t.call(this),this.events=new $t,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){var r=this;Tc.sort(this.events);for(var i=0;in||this._maxs?1:0},l1.prototype.interfaces_=function(){return[Ov]},l1.prototype.getClass=function(){return l1};var Ale=function(t){function e(){t.call(this),this._item=null;var n=arguments[0],r=arguments[1],i=arguments[2];this._min=n,this._max=r,this._item=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(r,i,o){if(!this.intersects(r,i))return null;o.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ah),Ile=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var n=arguments[0],r=arguments[1];this._node1=n,this._node2=r,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(r,i){this._min=Math.min(r._min,i._min),this._max=Math.max(r._max,i._max)},e.prototype.query=function(r,i,o){if(!this.intersects(r,i))return null;this._node1!==null&&this._node1.query(r,i,o),this._node2!==null&&this._node2.query(r,i,o)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ah),lh=function(){this._leaves=new $t,this._root=null,this._level=0};lh.prototype.buildTree=function(){var e=this;Tc.sort(this._leaves,new ah.NodeComparator);for(var n=this._leaves,r=null,i=new $t;;){if(e.buildLevel(n,i),i.size()===1)return i.get(0);r=n,n=i,i=r}},lh.prototype.insert=function(e,n,r){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new Ale(e,n,r))},lh.prototype.query=function(e,n,r){this.init(),this._root.query(e,n,r)},lh.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},lh.prototype.printNode=function(e){us.out.println(xc.toLineString(new et(e._min,this._level),new et(e._max,this._level)))},lh.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},lh.prototype.buildLevel=function(e,n){this._level++,n.clear();for(var r=0;r=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,i[0]),this.insertBoundaryPoint(this._argIndex,i[i.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var r=this.getBoundaryNodes(),i=new Array(r.size()).fill(null),o=0,s=r.iterator();s.hasNext();){var a=s.next();i[o++]=a.getCoordinate().copy()}return i},e.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(r,i,o){if(this.isBoundaryNode(r,i))return null;o===st.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(r,i):this.insertPoint(r,i,o)},e.prototype.addPolygonRing=function(r,i,o){if(r.isEmpty())return null;var s=or.removeRepeatedPoints(r.getCoordinates());if(s.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=s[0],null;var a=i,l=o;Ut.isCCW(s)&&(a=o,l=i);var c=new IS(s,new ci(this._argIndex,st.BOUNDARY,a,l));this._lineEdgeMap.put(r,c),this.insertEdge(c),this.insertPoint(this._argIndex,s[0],st.BOUNDARY)},e.prototype.insertPoint=function(r,i,o){var s=this._nodes.addNode(i),a=s.getLabel();a===null?s._label=new ci(r,o):a.setLocation(r,o)},e.prototype.createEdgeSetIntersector=function(){return new Mle},e.prototype.addSelfIntersectionNodes=function(r){for(var i=this,o=this._edges.iterator();o.hasNext();)for(var s=o.next(),a=s.getLabel().getLocation(r),l=s.eiList.iterator();l.hasNext();){var c=l.next();i.addSelfIntersectionNode(r,c.coord,a)}},e.prototype.add=function(){if(arguments.length===1){var r=arguments[0];if(r.isEmpty())return null;if(r instanceof Qu&&(this._useBoundaryDeterminationRule=!1),r instanceof No)this.addPolygon(r);else if(r instanceof eo)this.addLineString(r);else if(r instanceof Va)this.addPoint(r);else if(r instanceof Wv)this.addCollection(r);else if(r instanceof vp)this.addCollection(r);else if(r instanceof Qu)this.addCollection(r);else if(r instanceof ea)this.addCollection(r);else throw new Error(r.getClass().getName())}else return t.prototype.add.apply(this,arguments)},e.prototype.addCollection=function(r){for(var i=this,o=0;o50?(this._areaPtLocator===null&&(this._areaPtLocator=new Qv(this._parentGeom)),this._areaPtLocator.locate(r)):this._ptLocator.locate(r,this._parentGeom)},e.prototype.findEdge=function(){if(arguments.length===1){var r=arguments[0];return this._lineEdgeMap.get(r)}else return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(r,i){return r.isInBoundary(i)?st.BOUNDARY:st.INTERIOR},e}(Zi),t0=function(){if(this._li=new mp,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var e=arguments[0];this.setComputationPrecision(e.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new c1(0,e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=Gl.OGC_SFS_BOUNDARY_RULE;n.getPrecisionModel().compareTo(r.getPrecisionModel())>=0?this.setComputationPrecision(n.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new c1(0,n,i),this._arg[1]=new c1(1,r,i)}else if(arguments.length===3){var o=arguments[0],s=arguments[1],a=arguments[2];o.getPrecisionModel().compareTo(s.getPrecisionModel())>=0?this.setComputationPrecision(o.getPrecisionModel()):this.setComputationPrecision(s.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new c1(0,o,a),this._arg[1]=new c1(1,s,a)}};t0.prototype.getArgGeometry=function(e){return this._arg[e].getGeometry()},t0.prototype.setComputationPrecision=function(e){this._resultPrecisionModel=e,this._li.setPrecisionModel(this._resultPrecisionModel)},t0.prototype.interfaces_=function(){return[]},t0.prototype.getClass=function(){return t0};var kp=function(){};kp.prototype.interfaces_=function(){return[]},kp.prototype.getClass=function(){return kp},kp.map=function(){if(arguments[0]instanceof kn&&Mn(arguments[1],kp.MapOp)){for(var e=arguments[0],n=arguments[1],r=new $t,i=0;i=e.size()?null:e.get(n)},ko.union=function(e){var n=new ko(e);return n.union()},Nz.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(ko,Nz);var PS=function(){};PS.prototype.interfaces_=function(){return[]},PS.prototype.getClass=function(){return PS},PS.union=function(e,n){if(e.isEmpty()||n.isEmpty()){if(e.isEmpty()&&n.isEmpty())return Wn.createEmptyResult(Wn.UNION,e,n,e.getFactory());if(e.isEmpty())return n.copy();if(n.isEmpty())return e.copy()}return e.checkNotGeometryCollection(e),e.checkNotGeometryCollection(n),aa.overlayOp(e,n,Wn.UNION)};function Mp(){return new NS}function NS(){this.reset()}NS.prototype={constructor:NS,reset:function(){this.s=this.t=0},add:function(t){Oz(OS,t,this.t),Oz(this,OS.s,this.s),this.s?this.t+=OS.t:this.s=OS.t},valueOf:function(){return this.s}};var OS=new NS;function Oz(t,e,n){var r=t.s=e+n,i=r-e,o=r-i;t.t=e-o+(n-i)}var no=1e-6,Si=Math.PI,ed=Si/2,Dz=Si/4,td=Si*2,Ap=180/Si,yu=Si/180,la=Math.abs,Lle=Math.atan,r0=Math.atan2,Do=Math.cos,Ro=Math.sin,i0=Math.sqrt;function Rz(t){return t>1?0:t<-1?Si:Math.acos(t)}function xg(t){return t>1?ed:t<-1?-ed:Math.asin(t)}function u1(){}function DS(t,e){t&&Fz.hasOwnProperty(t.type)&&Fz[t.type](t,e)}var Bz={Feature:function(t,e){DS(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++rSi?t-td:t<-Si?t+td:t,e]}QL.invert=QL;function Nle(t,e,n){return(t%=td)?e||n?zz(jz(t),Uz(e,n)):jz(t):e||n?Uz(e,n):QL}function Vz(t){return function(e,n){return e+=t,[e>Si?e-td:e<-Si?e+td:e,n]}}function jz(t){var e=Vz(t);return e.invert=Vz(-t),e}function Uz(t,e){var n=Do(t),r=Ro(t),i=Do(e),o=Ro(e);function s(a,l){var c=Do(l),u=Do(a)*c,d=Ro(a)*c,p=Ro(l),m=p*n+u*r;return[r0(d*i-m*o,u*n-p*r),xg(m*i+d*o)]}return s.invert=function(a,l){var c=Do(l),u=Do(a)*c,d=Ro(a)*c,p=Ro(l),m=p*i-d*o;return[r0(d*i+p*o,u*n+m*r),xg(m*n-u*r)]},s}function Ole(t,e,n,r,i,o){if(n){var s=Do(e),a=Ro(e),l=r*n;i==null?(i=e+r*td,o=e-l/2):(i=Hz(s,i),o=Hz(s,o),(r>0?io)&&(i+=r*td));for(var c,u=i;r>0?u>o:u1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function Dle(t,e,n,r,i,o){var s=t[0],a=t[1],l=e[0],c=e[1],u=0,d=1,p=l-s,m=c-a,y;if(y=n-s,!(!p&&y>0)){if(y/=p,p<0){if(y0){if(y>d)return;y>u&&(u=y)}if(y=i-s,!(!p&&y<0)){if(y/=p,p<0){if(y>d)return;y>u&&(u=y)}else if(p>0){if(y0)){if(y/=m,m<0){if(y0){if(y>d)return;y>u&&(u=y)}if(y=o-a,!(!m&&y<0)){if(y/=m,m<0){if(y>d)return;y>u&&(u=y)}else if(m>0){if(y0&&(t[0]=s+u*p,t[1]=a+u*m),d<1&&(e[0]=s+d*p,e[1]=a+d*m),!0}}}}}function $S(t,e){return la(t[0]-e[0])=0;--a)i.point((d=u[a])[0],d[1]);else r(p.x,p.p.x,-1,i);p=p.p}p=p.o,u=p.z,m=!m}while(!p.v);i.lineEnd()}}}function qz(t){if(e=t.length){for(var e,n=0,r=t[0],i;++ne?1:t>=e?0:NaN}function Rle(t){return t.length===1&&(t=Ble(t)),{left:function(e,n,r,i){for(r==null&&(r=0),i==null&&(i=e.length);r>>1;t(e[o],n)<0?r=o+1:i=o}return r},right:function(e,n,r,i){for(r==null&&(r=0),i==null&&(i=e.length);r>>1;t(e[o],n)>0?i=o:r=o+1}return r}}}function Ble(t){return function(e,n){return Yz(t(e),n)}}Rle(Yz);function Zz(t){for(var e=t.length,n,r=-1,i=0,o,s;++r=0;)for(s=t[e],n=s.length;--n>=0;)o[--i]=s[n];return o}var h1=1e9,VS=-h1;function Fle(t,e,n,r){function i(c,u){return t<=c&&c<=n&&e<=u&&u<=r}function o(c,u,d,p){var m=0,y=0;if(c==null||(m=s(c,d))!==(y=s(u,d))||l(c,u)<0^d>0)do p.point(m===0||m===3?t:n,m>1?r:e);while((m=(m+d+4)%4)!==y);else p.point(u[0],u[1])}function s(c,u){return la(c[0]-t)0?0:3:la(c[0]-n)0?2:1:la(c[1]-e)0?1:0:u>0?3:2}function a(c,u){return l(c.x,u.x)}function l(c,u){var d=s(c,1),p=s(u,1);return d!==p?d-p:d===0?u[1]-c[1]:d===1?c[0]-u[0]:d===2?c[1]-u[1]:u[0]-c[0]}return function(c){var u=c,d=Wz(),p,m,y,w,x,C,S,M,E,A,I,O={point:z,lineStart:Z,lineEnd:q,polygonStart:W,polygonEnd:J};function z(G,U){i(G,U)&&u.point(G,U)}function $(){for(var G=0,U=0,Q=m.length;Ur&&(Ie-xe)*(r-Ee)>(Oe-Ee)*(t-xe)&&++G:Oe<=r&&(Ie-xe)*(r-Ee)<(Oe-Ee)*(t-xe)&&--G;return G}function W(){u=d,p=[],m=[],I=!0}function J(){var G=$(),U=I&&G,Q=(p=Zz(p)).length;(U||Q)&&(c.polygonStart(),U&&(c.lineStart(),o(null,null,1,c),c.lineEnd()),Q&&Gz(p,a,G,o,c),c.polygonEnd()),u=c,p=m=y=null}function Z(){O.point=j,m&&m.push(y=[]),A=!0,E=!1,S=M=NaN}function q(){p&&(j(w,x),C&&E&&d.rejoin(),p.push(d.result())),O.point=z,E&&u.lineEnd()}function j(G,U){var Q=i(G,U);if(m&&y.push([G,U]),A)w=G,x=U,C=Q,A=!1,Q&&(u.lineStart(),u.point(G,U));else if(Q&&E)u.point(G,U);else{var re=[S=Math.max(VS,Math.min(h1,S)),M=Math.max(VS,Math.min(h1,M))],le=[G=Math.max(VS,Math.min(h1,G)),U=Math.max(VS,Math.min(h1,U))];Dle(re,le,t,e,n,r)?(E||(u.lineStart(),u.point(re[0],re[1])),u.point(le[0],le[1]),Q||u.lineEnd(),I=!1):Q&&(u.lineStart(),u.point(G,U),I=!1)}S=G,M=U,E=Q}return O}}var eP=Mp();function $le(t,e){var n=e[0],r=e[1],i=[Ro(n),-Do(n),0],o=0,s=0;eP.reset();for(var a=0,l=t.length;a=0?1:-1,z=O*I,$=z>Si,W=y*E;if(eP.add(r0(W*O*Ro(z),w*A+W*Do(z))),o+=$?I+O*td:I,$^p>=n^S>=n){var J=BS(o0(d),o0(C));JL(J);var Z=BS(i,J);JL(Z);var q=($^I>=0?-1:1)*xg(Z[2]);(r>q||r===q&&(J[0]||J[1]))&&(s+=$^I>=0?1:-1)}}return(o<-no||od1&&(d1=t),eUS&&(US=e)}Mp();function Jz(t,e,n,r){return function(i,o){var s=e(o),a=i.invert(r[0],r[1]),l=Wz(),c=e(l),u=!1,d,p,m,y={point:w,lineStart:C,lineEnd:S,polygonStart:function(){y.point=M,y.lineStart=E,y.lineEnd=A,p=[],d=[]},polygonEnd:function(){y.point=w,y.lineStart=C,y.lineEnd=S,p=Zz(p);var I=$le(d,a);p.length?(u||(o.polygonStart(),u=!0),Gz(p,jle,I,n,o)):I&&(u||(o.polygonStart(),u=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),u&&(o.polygonEnd(),u=!1),p=d=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function w(I,O){var z=i(I,O);t(I=z[0],O=z[1])&&o.point(I,O)}function x(I,O){var z=i(I,O);s.point(z[0],z[1])}function C(){y.point=x,s.lineStart()}function S(){y.point=w,s.lineEnd()}function M(I,O){m.push([I,O]);var z=i(I,O);c.point(z[0],z[1])}function E(){c.lineStart(),m=[]}function A(){M(m[0][0],m[0][1]),c.lineEnd();var I=c.clean(),O=l.result(),z,$=O.length,W,J,Z;if(m.pop(),d.push(m),m=null,!!$){if(I&1){if(J=O[0],(W=J.length-1)>0){for(u||(o.polygonStart(),u=!0),o.lineStart(),z=0;z1&&I&2&&O.push(O.pop().concat(O.shift())),p.push(O.filter(Vle))}}return y}}function Vle(t){return t.length>1}function jle(t,e){return((t=t.x)[0]<0?t[1]-ed-no:ed-t[1])-((e=e.x)[0]<0?e[1]-ed-no:ed-e[1])}const Qz=Jz(function(){return!0},Ule,Wle,[-Si,-ed]);function Ule(t){var e=NaN,n=NaN,r=NaN,i;return{lineStart:function(){t.lineStart(),i=1},point:function(o,s){var a=o>0?Si:-Si,l=la(o-e);la(l-Si)0?ed:-ed),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(a,n),t.point(o,n),i=0):r!==a&&l>=Si&&(la(e-r)no?Lle((Ro(e)*(o=Do(r))*Ro(n)-Ro(r)*(i=Do(e))*Ro(t))/(i*o*s)):(e+r)/2}function Wle(t,e,n,r){var i;if(t==null)i=n*ed,r.point(-Si,i),r.point(0,i),r.point(Si,i),r.point(Si,0),r.point(Si,-i),r.point(0,-i),r.point(-Si,-i),r.point(-Si,0),r.point(-Si,i);else if(la(t[0]-e[0])>no){var o=t[0]0,i=la(n)>no;function o(u,d,p,m){Ole(m,t,e,p,u,d)}function s(u,d){return Do(u)*Do(d)>n}function a(u){var d,p,m,y,w;return{lineStart:function(){y=m=!1,w=1},point:function(x,C){var S=[x,C],M,E=s(x,C),A=r?E?0:c(x,C):E?c(x+(x<0?Si:-Si),C):0;if(!d&&(y=m=E)&&u.lineStart(),E!==m&&(M=l(d,S),(!M||$S(d,M)||$S(S,M))&&(S[0]+=no,S[1]+=no,E=s(S[0],S[1]))),E!==m)w=0,E?(u.lineStart(),M=l(S,d),u.point(M[0],M[1])):(M=l(d,S),u.point(M[0],M[1]),u.lineEnd()),d=M;else if(i&&d&&r^E){var I;!(A&p)&&(I=l(S,d,!0))&&(w=0,r?(u.lineStart(),u.point(I[0][0],I[0][1]),u.point(I[1][0],I[1][1]),u.lineEnd()):(u.point(I[1][0],I[1][1]),u.lineEnd(),u.lineStart(),u.point(I[0][0],I[0][1])))}E&&(!d||!$S(d,S))&&u.point(S[0],S[1]),d=S,m=E,p=A},lineEnd:function(){m&&u.lineEnd(),d=null},clean:function(){return w|(y&&m)<<1}}}function l(u,d,p){var m=o0(u),y=o0(d),w=[1,0,0],x=BS(m,y),C=RS(x,x),S=x[0],M=C-S*S;if(!M)return!p&&u;var E=n*C/M,A=-n*S/M,I=BS(w,x),O=FS(w,E),z=FS(x,A);KL(O,z);var $=I,W=RS(O,$),J=RS($,$),Z=W*W-J*(RS(O,O)-1);if(!(Z<0)){var q=i0(Z),j=FS($,(-W-q)/J);if(KL(j,O),j=XL(j),!p)return j;var G=u[0],U=d[0],Q=u[1],re=d[1],le;U0^j[1]<(la(j[0]-G)Si^(G<=j[0]&&j[0]<=U)){var Ee=FS($,(-W+q)/J);return KL(Ee,O),[j,XL(Ee)]}}}function c(u,d){var p=r?t:Si-t,m=0;return u<-p?m|=1:u>p&&(m|=2),d<-p?m|=4:d>p&&(m|=8),m}return Jz(s,a,o,r?[0,-t]:[-Si,t-Si])}function eV(t){return function(e){var n=new tP;for(var r in t)n[r]=t[r];return n.stream=e,n}}function tP(){}tP.prototype={constructor:tP,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function tV(t,e,n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),o!=null&&t.clipExtent(null),Ple(n,t.stream(Kz));var s=Kz.result(),a=Math.min(r/(s[1][0]-s[0][0]),i/(s[1][1]-s[0][1])),l=+e[0][0]+(r-a*(s[1][0]+s[0][0]))/2,c=+e[0][1]+(i-a*(s[1][1]+s[0][1]))/2;return o!=null&&t.clipExtent(o),t.scale(a*150).translate([l,c])}function qle(t,e,n){return tV(t,[[0,0],e],n)}var nV=16,Yle=Do(30*yu);function rV(t,e){return+e?Xle(t,e):Zle(t)}function Zle(t){return eV({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function Xle(t,e){function n(r,i,o,s,a,l,c,u,d,p,m,y,w,x){var C=c-r,S=u-i,M=C*C+S*S;if(M>4*e&&w--){var E=s+p,A=a+m,I=l+y,O=i0(E*E+A*A+I*I),z=xg(I/=O),$=la(la(I)-1)e||la((C*q+S*j)/M-.5)>.3||s*p+a*m+l*y2?j[2]%360*yu:0,Z()):[c*Ap,u*Ap,d*Ap]},$.precision=function(j){return arguments.length?(I=rV(J,A=j*j),q()):i0(A)},$.fitExtent=function(j,G){return tV($,j,G)},$.fitSize=function(j,G){return qle($,j,G)};function Z(){m=zz(p=Nle(c,u,d),e);var j=e(a,l);return o=r-j[0]*n,s=i+j[1]*n,q()}function q(){return O=z=null,$}return function(){return e=t.apply(this,arguments),$.invert=e.invert&&W,Z()}}function iV(t){return function(e,n){var r=Do(e),i=Do(n),o=t(r*i);return[o*i*Ro(e),o*Ro(n)]}}function oV(t){return function(e,n){var r=i0(e*e+n*n),i=t(r),o=Ro(i),s=Do(i);return[r0(e*o,r*s),xg(r&&n*o/r)]}}var ece=iV(function(t){return i0(2/(1+t))});ece.invert=oV(function(t){return 2*xg(t/2)});var sV=iV(function(t){return(t=Rz(t))&&t/Ro(t)});sV.invert=oV(function(t){return t});function tce(){return Jle(sV).scale(79.4188).clipAngle(180-.001)}function aV(t,e){return[t,e]}aV.invert=aV;function nce(t,e,n){n=n||{};var r=n.units||"kilometers",i=n.steps||8;if(!t)throw new Error("geojson is required");if(typeof n!="object")throw new Error("options must be an object");if(typeof i!="number")throw new Error("steps must be an number");if(e===void 0)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var o=[];switch(t.type){case"GeometryCollection":return jl(t,function(s){var a=HS(s,e,r,i);a&&o.push(a)}),Pn(o);case"FeatureCollection":return ii(t,function(s){var a=HS(s,e,r,i);a&&ii(a,function(l){l&&o.push(l)})}),Pn(o)}return HS(t,e,r,i)}function HS(t,e,n,r){var i=t.properties||{},o=t.type==="Feature"?t.geometry:t;if(o.type==="GeometryCollection"){var s=[];return jl(t,function(w){var x=HS(w,e,n,r);x&&s.push(x)}),Pn(s)}var a=rce(o),l={type:o.type,coordinates:cV(o.coordinates,a)},c=new $L,u=c.read(l),d=dv(Zm(e,n),"meters"),p=ds.bufferOp(u,d,r),m=new pz;if(p=m.write(p),!lV(p.coordinates)){var y={type:p.type,coordinates:uV(p.coordinates,a)};return Ko(y,i)}}function lV(t){return Array.isArray(t[0])?lV(t[0]):isNaN(t[0])}function cV(t,e){return typeof t[0]!="object"?e(t):t.map(function(n){return cV(n,e)})}function uV(t,e){return typeof t[0]!="object"?e.invert(t):t.map(function(n){return uV(n,e)})}function rce(t){var e=Wd(t).geometry.coordinates,n=[-e[0],-e[1]];return tce().rotate(n).scale(as)}function ice(t,e,n){n===void 0&&(n={});var r=Bi(t),i=Bi(e),o=Zd.union(r.coordinates,i.coordinates);return o.length===0?null:o.length===1?ur(o[0],n.properties):pl(o,n.properties)}function f1(t,e,n){n===void 0&&(n={});var r=Bi(t),i=Bi(e),o=Zd.intersection(r.coordinates,i.coordinates);return o.length===0?null:o.length===1?ur(o[0],n.properties):pl(o,n.properties)}function oce(t,e){if(e=e||{},!yi(e))throw new Error("options is invalid");var n=e.propertyName;Ud(t,"Polygon","dissolve");var r=[];if(e.propertyName){var i={};ii(t,function(l){Object.prototype.hasOwnProperty.call(i,l.properties[n])||(i[l.properties[n]]=[]),i[l.properties[n]].push(l)});for(var o=Object.keys(i),s=0;sx/2;W&&($-=x/4);for(var J=[],Z=[],q=0;q<6;q++){var j=2*Math.PI/6*q;J.push(Math.cos(j)),Z.push(Math.sin(j))}for(var G=[],U=0;U<=I;U++)for(var Q=0;Q<=z;Q++){var re=U%2===1;if(!(Q===0&&re)&&!(Q===0&&W)){var le=U*M+i-O,oe=Q*E+o+$;if(re&&(oe-=x/2),n.triangles===!0)lce([le,oe],d/2,m/2,JSON.parse(r),J,Z).forEach(function(xe){n.mask?f1(n.mask,xe)&&G.push(xe):G.push(xe)});else{var he=sce([le,oe],d/2,m/2,JSON.parse(r),J,Z);n.mask?f1(n.mask,he)&&G.push(he):G.push(he)}}}return Pn(G)}function sce(t,e,n,r,i,o){for(var s=[],a=0;a<6;a++){var l=t[0]+e*i[a],c=t[1]+n*o[a];s.push([l,c])}return s.push(s[0].slice()),ur([s],r)}function lce(t,e,n,r,i,o){for(var s=[],a=0;a<6;a++){var l=[];l.push(t),l.push([t[0]+e*i[a],t[1]+n*o[a]]),l.push([t[0]+e*i[(a+1)%6],t[1]+n*o[(a+1)%6]]),l.push(t),s.push(ur([l],r))}return s}function cce(t,e){var n=hce(e),r=null;return t.type==="FeatureCollection"?r=uce(t):r=dV(Zd.union(t.geometry.coordinates)),r.geometry.coordinates.forEach(function(i){n.geometry.coordinates.push(i[0])}),n}function uce(t){var e=t.features.length===2?Zd.union(t.features[0].geometry.coordinates,t.features[1].geometry.coordinates):Zd.union.apply(Zd,t.features.map(function(n){return n.geometry.coordinates}));return dV(e)}function dV(t){return pl(t)}function hce(t){var e=[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]],n=t&&t.geometry.coordinates||e;return ur(n)}function dce(t,e,n,r){r===void 0&&(r={});for(var i=[],o=t[0],s=t[1],a=t[2],l=t[3],c=e/vi([o,s],[a,s],r),u=c*(a-o),d=n/vi([o,s],[o,l],r),p=d*(l-s),m=a-o,y=l-s,w=Math.floor(m/u),x=Math.floor(y/p),C=(m-w*u)/2,S=(y-x*p)/2,M=o+C,E=0;E!1},placeholder:{type:String,default:()=>"Обрати"},clearable:{type:Boolean,default:()=>!1},modelValue:{type:[String,Array,Number],default:()=>""},multiple:{type:Boolean,default:()=>!1},searchable:{type:Boolean,default:()=>!1},searchPlaceholder:{type:String,default:()=>"Пошук.."},searchIcon:{type:String,default:()=>"ti-search"},lazyLoad:{type:Function,default:null},searchHighlight:{type:Boolean,default:()=>!1},optionsList:{type:Array,default:()=>[]}},watch:{modelValue:{handler(t){this.currentOption=null,this.getValue(),this.searchValue="",this.handleSearch(),t&&(this.currentOption=t,this.getValue())}}},computed:{tooltip(){return this.selectedOptions.map(t=>{var e;return(e=t==null?void 0:t.label)==null?void 0:e.toString()}).join(",")||void 0}},data(){return{list:{canClose:!1,visible:!1},currentOption:null,searchValue:"",selectedOptions:[],highlightedIndex:0}},async mounted(){window.addEventListener("keydown",this.handleKeyDown),window.addEventListener("click",this.clickOnBody,!1),window.addEventListener("resize",this.boundList),window.addEventListener("scroll",this.handleScroll,!0),window.addEventListener("popstate",this.handleBrowserBackButton),this.lazyLoad!==null&&typeof this.lazyLoad=="function"?this.lazyLoad().then(async()=>{this.getValue()}):this.getValue()},beforeUnmount(){window.removeEventListener("keydown",this.handleKeyDown),window.removeEventListener("click",this.clickOnBody),window.removeEventListener("resize",this.boundList),window.removeEventListener("popstate",this.handleBrowserBackButton)},methods:{handleScroll(t){const e=this.$refs.list,n=this.$refs.button;this.list.visible&&e&&n&&!e.contains(t.target)&&!n.contains(t.target)&&this.closeList()},toggleDropdown(){var t;if(!this.disabled&&(this.list.visible=!this.list.visible,this.list.visible)){this.$nextTick(()=>{this.boundList()});const e=(t=this.$refs.autocompleteSearch.$el)==null?void 0:t.querySelector("input");e&&this.$nextTick(()=>{setTimeout(()=>{e.focus()},50)})}},handleKeyDown(t){if(this.list.visible){const{keyCode:e}=t;switch([38,40].includes(e)&&t.preventDefault(),e){case 38:this.$emit("menuKeyUp");break;case 40:this.$emit("menuKeyDown");break;case 13:this.$emit("menuEnterSelect"),this.multiple||this.closeList();break}}},clickOnBody(){this.list.canClose&&(this.list.visible=!1)},handleBrowserBackButton(){this.list.visible&&(this.list.visible=!1)},boundList(){var s,a;const t=(s=this.$refs)==null?void 0:s.button,e=t==null?void 0:t.getBoundingClientRect(),n=t.getBoundingClientRect(),r=window==null?void 0:window.innerHeight,i=288;if(!this.list.visible)return;const o=(a=this.$refs)==null?void 0:a.list;if(o){const l=e.top,c=o.clientHeight,u=window.innerHeight>=e.bottom+c+15?l+38:l-c-8;rs.reduce((a,l)=>{const c=l==null?void 0:l.children;return Array.isArray(c)&&!l.dynamicProps&&!l.key?a.concat(n(c)):a.concat(l)},[]),r=(o=this.optionsList)==null?void 0:o.length,i=r?this.optionsList:n(e);this.multiple?r?this.setMultipleOption(i):this.setSlotMultipleOption(i):r?this.setSingleOption(i):this.setSlotSingleOption(i)},setMultipleOption(t){const e=t.filter(n=>{var r;return((r=this.modelValue)==null?void 0:r.includes(n.id))&&!this.selectedOptions.some(i=>i.id===n.id)});this.selectedOptions=this.selectedOptions.concat(e),this.selectedOptions=this.selectedOptions.filter(n=>{var r;return(r=this.modelValue)==null?void 0:r.includes(n.id)})},setSingleOption(t){const e=t.find(n=>{const r=n==null?void 0:n.id;if(typeof this.modelValue!="object")return r==this.modelValue});if(e){const n=e;this.currentOption=n,this.closeList()}},clearValue(){this.$emit("update:modelValue",this.multiple?[]:null)},closeList(){this.list.visible=!1},setSlotSingleOption(t){const e=t.find(n=>{var i,o,s,a;const r=((i=n==null?void 0:n.props)==null?void 0:i.id)||((o=n==null?void 0:n.props)==null?void 0:o.value)||((s=n==null?void 0:n.props)==null?void 0:s.label)||((a=n==null?void 0:n.props)==null?void 0:a.text);if(typeof this.modelValue!="object")return r==this.modelValue});if(e){const n=e==null?void 0:e.props;this.currentOption=n}this.closeList()},setSlotMultipleOption(t){this.selectedOptions=t.reduce((e,n)=>{var i,o,s;const r=((i=n==null?void 0:n.props)==null?void 0:i.value)||((o=n==null?void 0:n.props)==null?void 0:o.label);return this.modelValue&&((s=this.modelValue)!=null&&s.includes(r))?e.concat(n.props):e},[])},returnLabel(t){var n,r,i;const e=(n=this.optionsList)==null?void 0:n.find(o=>{var s;return((s=o==null?void 0:o.id)==null?void 0:s.toString())===(t==null?void 0:t.toString())});return e?String(e.text||e.label||""):((r=t==null?void 0:t.text)==null?void 0:r.toString())||((i=t==null?void 0:t.label)==null?void 0:i.toString())||(t==null?void 0:t.toString())||""},handleSearch(){this.$emit("onSearch",this.searchValue)}}}),vce=["title"],_ce={key:0,class:"flex items-center w-full"},bce={class:"max-w-[90%] truncate"},wce={key:2,class:"opacity-50 truncate pr-4"},xce={key:1,class:"opacity-50 truncate pr-4"},Ece={class:"vsTailwind",ref:"list",style:{position:"fixed","z-index":"10002"}},Sce={ref:"listWrapper",class:"form-autocomplete__list vsTailwind px-2 pb-2 pt-0 max-h-200 relative [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500 dark:bg-neutral-900"};function Cce(t,e,n,r,i,o){var c,u,d,p;const s=g.resolveComponent("IconClose"),a=g.resolveComponent("IconChevronDown"),l=g.resolveComponent("VsFormText");return g.openBlock(),g.createElementBlock("div",{class:g.normalizeClass(["form-autocomplete relative min-w-[6rem] vsTailwind",{"cursor-not-allowed":t.disabled}]),onMouseenter:e[6]||(e[6]=(...m)=>t.disallowBodyClick&&t.disallowBodyClick(...m)),onMouseleave:e[7]||(e[7]=(...m)=>t.disallowBodyClick&&t.disallowBodyClick(...m))},[g.createElementVNode("button",{title:t.tooltip||t.returnLabel(t.currentOption),class:g.normalizeClass(["hs-select-disabled:pointer-events-none h-[40px] hs-select-disabled:opacity-50 relative py-2 px-4 pe-9 flex text-nowrap w-full cursor-pointer bg-white border border-solid focus:ring-blue-600 rounded-lg text-start text-sm text-stone-800 focus:outline-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-200 dark:focus:outline-none dark:focus:ring-1 dark:focus:ring-neutral-600",{"opacity-50 pointer-events-none":t.disabled," border-blue-500 border-2":t.list.visible," border-stone-200":!t.list.visible}]),ref:"button",type:"button",onClick:e[1]||(e[1]=(...m)=>t.toggleDropdown&&t.toggleDropdown(...m))},[t.selectedOptions.length||t.currentOption?(g.openBlock(),g.createElementBlock(g.Fragment,{key:0},[t.multiple?t.selectedOptions.length?(g.openBlock(),g.createElementBlock(g.Fragment,{key:1},[g.createTextVNode(g.toDisplayString(`Обрано: ${t.selectedOptions.length}`),1)],64)):(g.openBlock(),g.createElementBlock("div",wce,g.toDisplayString(t.placeholder),1)):(g.openBlock(),g.createElementBlock("div",_ce,[typeof t.currentOption=="object"&&((c=t.currentOption)!=null&&c.color)?(g.openBlock(),g.createElementBlock("div",{key:0,class:"w-4 h-4 rounded-md mr-2",style:g.normalizeStyle({"background-color":t.currentOption.color})},null,4)):g.createCommentVNode("",!0),g.createElementVNode("span",bce,g.toDisplayString(t.returnLabel(t.currentOption)),1)]))],64)):(g.openBlock(),g.createElementBlock("div",xce,g.toDisplayString(t.placeholder),1)),g.withDirectives(g.createElementVNode("div",{class:"absolute bottom-2/4 z-50 translate-y-2/4 right-8",onClick:e[0]||(e[0]=g.withModifiers((...m)=>t.clearValue&&t.clearValue(...m),["stop"]))},[g.createVNode(s,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500"})],512),[[g.vShow,t.clearable&&t.modelValue&&(((d=(u=t.modelValue)==null?void 0:u.text)==null?void 0:d.length)||((p=t.modelValue)==null?void 0:p.length))]]),g.createVNode(a,{width:"15px",height:"15px",class:g.normalizeClass(["stroke-gray-500 absolute right-3 translate-y-2/4 bottom-1/2",{"rotate-180":t.list.visible}])},null,8,["class"])],10,vce),(g.openBlock(),g.createBlock(g.Teleport,{to:"#modal"},[g.createElementVNode("div",Ece,[g.withDirectives(g.createElementVNode("div",{class:"form-autocomplete__wrapper mt-[10px] z-50 w-full min-w-36 max-h-72 p-0 space-y-0.5 bg-white rounded-xl shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] dark:bg-neutral-900 top-full opened",onMouseenter:e[4]||(e[4]=(...m)=>t.disallowBodyClick&&t.disallowBodyClick(...m)),onMouseleave:e[5]||(e[5]=(...m)=>t.disallowBodyClick&&t.disallowBodyClick(...m))},[g.createElementVNode("div",Sce,[g.withDirectives(g.createVNode(l,{modelValue:t.searchValue,"onUpdate:modelValue":e[2]||(e[2]=m=>t.searchValue=m),placeholder:t.searchPlaceholder,ref:"autocompleteSearch",onClick:e[3]||(e[3]=g.withModifiers(()=>{},["stop","self"])),onOnInput:t.handleSearch,class:"mb-2 bg-white px-1 pt-2 -mx-1 !sticky top-0 dark:bg-neutral-900"},null,8,["modelValue","placeholder","onOnInput"]),[[g.vShow,t.searchable]]),g.renderSlot(t.$slots,"default")],512)],544),[[g.vShow,t.list.visible]])],512)]))],34)}const nP=xt(yce,[["render",Cce]]),kce=g.defineComponent({props:{isHighlighted:{type:Boolean,default:()=>!1},value:{type:String,default:()=>""},label:{type:String,default:()=>""},color:{type:String,default:()=>""}},computed:{parentInstance(){return this.$parent},parentValue(){return this.parentInstance.modelValue},parentSearchValue(){return this.parentInstance.searchValue},parentMultiple(){return this.parentInstance.multiple},isValueEqualParentValue(){var e;const t=this.value||this.label;return this.parentMultiple?(e=this.parentValue)==null?void 0:e.toString().includes(t):this.parentValue==t},activeClass(){return`${this.parentMultiple?"":"cursor-default"}`},highlightedText(){var t;return!this.parentSearchValue||!((t=this.parentInstance)!=null&&t.searchHighlight)?this.label:this.label.replace(new RegExp(this.parentSearchValue,"gi"),e=>`${e}`)}},methods:{handleClick(){var n;const t=this.value||this.label,e=this.parentInstance;if(t===this.parentValue&&!this.parentMultiple){e.closeList();return}if(this.parentMultiple){const r=Array.isArray(this.parentValue)?this.parentValue:[];(n=this.parentValue)!=null&&n.includes(t)?e.$emit("update:modelValue",r.filter(i=>i!==t)):e.$emit("update:modelValue",r.concat(t))}else e.$emit("update:modelValue",t)}}}),Tce={class:"flex justify-between items-center w-full"},Mce={class:"flex items-center"},Ace=["innerHTML"],Ice={key:0,class:"flex-shrink-0 w-3.5 h-3.5 text-blue-600",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Lce(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",{class:g.normalizeClass(["form-autocomplete__item cursor-pointer hs-selected:bg-stone-100 dark:hs-selected:bg-neutral-800 py-2 px-4 w-full text-sm text-gray-800 hover:bg-gray-100 rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:hover:bg-neutral-800 dark:text-neutral-200 dark:focus:bg-neutral-800",{[t.activeClass]:t.isValueEqualParentValue,"bg-gray-100":t.isHighlighted}]),onClick:e[0]||(e[0]=g.withModifiers((...s)=>t.handleClick&&t.handleClick(...s),["stop"]))},[g.createElementVNode("div",Tce,[g.createElementVNode("div",Mce,[t.color?(g.openBlock(),g.createElementBlock("div",{key:0,class:"w-4 h-4 rounded-md mr-2",style:g.normalizeStyle({"background-color":t.color})},null,4)):g.createCommentVNode("",!0),g.createElementVNode("div",{innerHTML:t.highlightedText,class:g.normalizeClass({"font-medium":t.isValueEqualParentValue})},null,10,Ace)]),t.isValueEqualParentValue?(g.openBlock(),g.createElementBlock("svg",Ice,e[1]||(e[1]=[g.createElementVNode("polyline",{points:"20 6 9 17 4 12"},null,-1)]))):g.createCommentVNode("",!0)])],2)}const rP=xt(kce,[["render",Lce]]),WS=(t,e=300)=>{let n;return function(...i){clearTimeout(n),n=setTimeout(()=>{t.apply(this,i)},e)}},Pce={components:{VsText:Yu,VsAutocomplete:nP,VsAutocompleteOption:rP},props:{map:{type:Object,default:()=>{}},hideAddressSearch:{type:Boolean,default:!1},atuSearchApi:{type:String},prefix:{type:String,default:""}},created(){this.debouncedSearch=WS(()=>this.searchOnMap(),500)},data(){return{searchable:"",searchType:"atu",debouncedSearch:null,searchOptions:[{name:"Пошук по координатам",placeholder:"50.44920, 30.52359",id:"coords"},{name:"Адреса",placeholder:"Шевченка, 10",id:"address"},{name:"АТУ",placeholder:"Київська область",id:"atu"},{name:"Пошук HERE",placeholder:"50.44920, 30.52359",id:"here"}],marker:null,placeholder:"Київська область",searchData:null}},watch:{searchType(){this.searchable="",this.searchData=null,this.placeholder=this.searchOptions.find(t=>t.id===this.searchType).placeholder},searchable(t){this.marker&&this.marker.remove(),t?this.debouncedSearch():this.searchData=null}},mounted(){this.hideAddressSearch&&(this.searchOptions=this.searchOptions.filter(t=>t.id!=="address"))},methods:{async searchOnMap(){switch(this.searchData=null,this.searchType){case"address":{this.searchAddress();break}case"atu":{this.searchAtu();break}case"here":{this.searchHere();break}case"coords":{this.searchCoords();break}}},async zoomToGeom(t){t.text&&(this.searchable=t.text);const n=typeof t.geom=="string"?JSON.parse(t.geom):t.geom,r=Ri(n);await this.map.fitBounds(r,{duration:0,maxZoom:17,padding:30}),this.searchData=null,await this.createMarker(n)},createMarker(t){const{geometry:e}=Wd(t),n=e.coordinates;this.marker=new window.maplibregl.Marker({color:"#3b82f6"}).setLngLat(n).addTo(this.map)},async requestData(t){try{const{data:e}=await un.get(t);return e}catch(e){return console.error(e),this.$notify({type:"error",title:"Помилка!",message:"Під час пошуку сталась помилка"}),null}},searchCoords(){const t=r=>{const i=r.replaceAll(" ","").trim();if(i.includes(".")||i.length<=2)return i;const o=i.slice(0,2),s=i.slice(2,i.length-1);return`${o}.${s}`},e=this.searchable.split(",").map(r=>+t(r)),n=Qn(e.reverse());this.zoomToGeom({geom:n})},async searchAddress(){const t=await this.requestData(`/${this.prefix}/suggest/map.address_id?limit=20&key=${this.searchable}`);this.searchData=t.map(e=>({...e,geom:Qn([e.x,e.y])}))},async searchHere(){var n,r;this.searchData=await this.requestData(`${this.atuSearchApi}/${this.prefix}/gis-url-proxy?searchtext=${this.searchable}`);const t=Object.values(((r=(n=this.searchData)==null?void 0:n.Location)==null?void 0:r.DisplayPosition)||{}).reverse(),e=Qn(t);this.zoomToGeom({geom:e})},async searchAtu(){this.searchData=await this.requestData(`${this.atuSearchApi}/${this.prefix}/suggest/atu.nsdi.ato_level?key=${this.searchable}`)}}},Nce={class:"map-search w-[calc(100%-20px)] sm:w-[350px]"},Oce={class:"map-search__input"},Dce={class:"flex flex-nowrap relative"},Rce={class:"relative w-full"},Bce={key:0,class:"map-search__input-list"},Fce=["onClick"];function $ce(t,e,n,r,i,o){const s=g.resolveComponent("VsAutocompleteOption"),a=g.resolveComponent("VsAutocomplete"),l=g.resolveComponent("VsText");return g.openBlock(),g.createElementBlock("div",Nce,[g.createElementVNode("div",Oce,[g.createElementVNode("div",Dce,[g.createVNode(a,{modelValue:i.searchType,"onUpdate:modelValue":e[0]||(e[0]=c=>i.searchType=c),class:"map-search__select"},{default:g.withCtx(()=>[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(i.searchOptions,c=>(g.openBlock(),g.createBlock(s,{key:c.id,value:c.id,label:c.name},null,8,["value","label"]))),128))]),_:1},8,["modelValue"]),g.createElementVNode("div",Rce,[g.createVNode(l,{modelValue:i.searchable,"onUpdate:modelValue":e[1]||(e[1]=c=>i.searchable=c),icon:t.ti-t.x,clearable:!0,placeholder:"Пошук..."},null,8,["modelValue","icon"]),i.searchData?(g.openBlock(),g.createElementBlock("div",Bce,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(i.searchData,(c,u)=>g.withDirectives((g.openBlock(),g.createElementBlock("div",{key:u,class:"map-search__input-list__item",onClick:d=>o.zoomToGeom(c)},g.toDisplayString(c.text),9,Fce)),[[g.vShow,i.searchData]])),128))])):g.createCommentVNode("",!0)])])])])}const gV=xt(Pce,[["render",$ce],["__scopeId","data-v-844536de"]]);function zce(t){const e=[{type:"fill",minzoom:t.pointZoom||0,paint:{"fill-color":t.color||"#ccc","fill-outline-color":t.stroke||"blue","fill-opacity":t.opacity||1}}];return t.pointZoom&&e.push({type:"circle",maxzoom:t.pointZoom,paint:{"circle-color":t.color||"#ccc","circle-stroke-color":t.stroke||"#ccc","circle-stroke-width":t.width||1,"circle-opacity":t.opacity||1}}),t.label&&e.push({type:"symbol",layout:{"text-field":["get",t.label],"text-font":["Open Sans Regular"],"text-size":12,"text-anchor":"center"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),e}function Vce(t){const e=[{type:"line",paint:{"line-color":t.color||"#ccc","line-opacity":t.opacity||1}}];return t.label&&e.push({type:"symbol",layout:{"text-field":["get",t.label],"text-font":["Open Sans Regular"],"text-size":12,"symbol-placement":"line-center"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),e}function jce(t){const e=[{type:"circle",maxzoom:t.icon&&+t.iconZoom||22,paint:{"circle-radius":t.radius||6,"circle-stroke-color":t.stroke||"#ccc","circle-stroke-width":t.width||1,"circle-color":t.color||"blue","circle-opacity":t.opacity||1}}];return t!=null&&t.clusterZoom&&(e.push({type:"circle",filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],"#51bbd6",100,"#f1f075",750,"#f28cb1"],"circle-radius":["step",["get","point_count"],20,100,30,750,40]}}),e.push({type:"symbol",filter:["has","point_count"],layout:{"text-field":["get","point_count"],"text-font":["Open Sans Regular"],"text-size":12}})),t.icon&&e.push({type:"symbol",minzoom:+t.iconZoom||16,layout:{"icon-image":t.icon,"icon-allow-overlap":!0}}),t.label&&e.push({type:"symbol",layout:{"text-field":["get",t.label],"text-font":["Open Sans Regular"],"text-size":12,"text-anchor":"top"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),e}function Uce(t){if(!t)return null;const e=t.type||"point";return e==="polygon"?zce(t):e==="line"?Vce(t):jce(t)}const yV=["#69D2E7","yellow","#FE4365","#125B9A","#41B3A2","#D7C3F1","#F1D3CE"],Hce=["ma-star","ma-water","ma-swimming","fa-home","fa-search","fa-trash","fa-check"],vV={};async function _V(t,e,n="api"){const r=[`${n}/gis-layer/${t}/${e}`,`${n}/gis-ir/${t}/${e}`];for(const i of r)try{const o=await fetch(i);if(!o.ok)continue;const s=await o.json();if(Array.isArray(s==null?void 0:s.rows)&&s.rows.length>0)return s.rows.filter(a=>a.id)}catch(o){console.error(`Fetch failed for ${i}:`,o)}return[]}async function iP(t,e,n,r){if(!t)return null;const i=JSON.parse(JSON.stringify(t)),o=i.colorAttr?await _V(e,i.colorAttr,r):null;o==null||o.forEach((a,l)=>{var c,u;a.color=a.color||((c=i.colorSet)==null?void 0:c[a.id])||((u=i.colorSet)==null?void 0:u[l])||yV[l%yV.length],a.icon=i.icon?i.icon.split("+")[0]+"+"+a.color.replace("#","")+".png":null});const s=i.iconAttr?await _V(e,i.iconAttr,r):null;if(s==null||s.forEach((a,l)=>{var m,y,w,x;const c=a.icon||((m=i.iconSet)==null?void 0:m[a.id])||((y=i.iconPattern)==null?void 0:y.replace("{id}",a.id))||((w=i.iconSet)==null?void 0:w[l])||(i.iconPrefix?null:Hce[l]);if(!c)return;const u=a.color||((x=i.color)==null?void 0:x.replace("#",""))||"red",[d="pin6",p="m"]=i.icon&&!i.icon.includes(".")?i.icon.split("-"):[];a.icon=i.iconPrefix||c!=null&&c.includes("/")?(i.iconPrefix||"")+c:`${d}-${p}-${c}+${u}${c.endsWith(".png")?"":".png"}`}),i.colorAttr&&o){const a=["match",["get",i.colorAttr]];o.filter(l=>l.id).forEach(l=>{a.push(l.id),a.push(l.color)}),a.push(i.color||"gray"),i.color=a}if(i.icon&&i.iconAttr&&s){const a=["match",["get",i.iconAttr]];s.filter(l=>l.icon).forEach(({id:l,icon:c})=>{if(i.colorAttr&&o){a.push(l);const u=["match",["get",i.colorAttr]];o.forEach(d=>{u.push(d.id);const p=c.split("+")[0]+"+"+d.color.replace("#","")+".png";u.push(p),a0(p,n,r)}),u.push(i.icon),a.push(u)}else a.push(l),a.push(c),a0(c,n,r)}),a.push((i.iconPrefix||"")+i.icon),a0((i.iconPrefix||"")+i.icon,n,r),i.icon=a}else if(i.icon&&i.colorAttr&&o){const a=["match",["get",i.colorAttr]];o.forEach(l=>{a.push(l.id),a.push(l.icon),a0(l.icon,n,r)}),a.push(i.icon),a0(i.icon,n,r),i.icon=a}else i.icon&&await a0(i.icon,n,r);return Wce({style:t,colors:o,icons:s,map:n,id:e}),Uce(i)}async function a0(t="pin4-sm-mi-plumber+f45942.png",e=null,n){if(vV[t])return null;vV[t]=!0;const r=await(e==null?void 0:e.loadImage(t!=null&&t.startsWith("/")||t!=null&&t.includes("//")?t:`/${n}/marker_icon/${t.replace(".png","")}.png`));e==null||e.addImage(t,r.data)}function Wce({style:t,colors:e,icons:n,map:r,id:i}){r.legend||Object.assign(r,{legend:{}}),window.map||(window.map=r),Object.assign(r.legend,{[i]:{icon:t.icon,colors:e,icons:n,color:t.color||"blue",type:t.type||"point"}})}const oP={data(){return{layerList:[],activeLayer:""}},computed:{interactiveSources(){return this.layerList.filter(t=>t==null?void 0:t.interactive).map(t=>t.id)}},methods:{moveLayer(t,e=this.map){e.getStyle().layers.forEach(n=>{n.id.match(t)&&e.moveLayer(n.id)})},async setVisible(t,e=!0,n=this.map,r="api"){if(!t)return;const i=(t==null?void 0:t.id)||t,o=this.layerList.find(a=>a.id===t)||await this.getLayerById(i)||t;if(!(o!=null&&o.id))throw new Error("MixinError: Layer has no id");const s=n.getStyle().layers.filter(a=>a.id.match(i));s.forEach(a=>{n.setLayoutProperty(a.id,"visibility",e?"visible":"none")}),!s.length&&e&&await this.addLayer(o,n,r)},async getLayerById(t,e=null,n){var i;const r=(t==null?void 0:t.id)||t;try{const o=(i=this.layerList)==null?void 0:i.find(a=>a.id===r);if(o)return o;const s=await fetch(`/${n}/gis-ir/${r}${t!=null&&t.service?`?service=${t==null?void 0:t.service}`:""}`);if(s.ok){const a=await s.json();return!e||await e(a),a}return console.error(`Шар ${r} не було знайдено!`),null}catch{console.error(`Шар ${r} не було знайдено!`)}},async addLayer(t,e=this==null?void 0:this.map,n="api"){var o,s;const r=this.layerList.find(a=>a.id===t)||t;!this.map.getStyle()||this.map.getStyle().layers.find(a=>a.id===r.id)||(this.layerList.find(a=>a.id===r.id)||this.layerList.push(r),(r.service==="vtile"||r.service==="vector"||(o=r.url)!=null&&o.includes(".vmt"))&&await this.addVtileLayer(r,e,n),r.service==="geojson"&&this.addGeoJsonLayer(r,e,n),((s=r.url)!=null&&s.includes(".png")||["tms","raster"].includes(r.service))&&await this.addRasterLayer(r,e,n))},async addRasterLayer(t,e=this==null?void 0:this.map,n="api"){var r;e.getSource(t.id)||(typeof t.bounds=="string"&&Object.assign(t,{bounds:t.bounds.split(",")}),await e.addSource(t.id,{type:"raster",tiles:[(r=t==null?void 0:t.url)!=null&&r.startsWith("http")?t==null?void 0:t.url:`/${n?t==null?void 0:t.url.replace(/(\/api[^\/]*)/,n):t==null?void 0:t.url}${t!=null&&t.url.includes("?")?"&":"?"}dt=${new Date().toISOString().split("T")[0]}`],tileSize:256,...t.bounds?{bounds:t.bounds.map(i=>i-0)}:{},...t!=null&&t.scheme?{scheme:t==null?void 0:t.scheme}:{}}),await e.addLayer({id:t.id,type:"raster",source:t.id,minzoom:0,maxzoom:(t==null?void 0:t.maxzoom)||22}))},async updateStyle(t,e=this==null?void 0:this.map,n="api"){const r=t.id;e.getStyle().layers.forEach(async o=>{o.source===r&&await e.removeLayer(o.id)}),(await iP(t.style,t.source||t.id,e,n)||t.layers||[]).forEach((o,s)=>{const a={...o,id:`${t.id}-${s}`,source:t.id,"source-layer":o["source-layer"]||t.source||t.id,maxzoom:+o.maxzoom||24,minzoom:+o.minzoom||0};e.addLayer(a)})},async addVtileLayer(t,e=this==null?void 0:this.map,n="api"){var s;const r=["props","pointZoom","clusterZoom"].filter(a=>t[a]).map(a=>`&${a}=${t[a]}`),i={type:"vector",tiles:[`${(s=t==null?void 0:t.url)!=null&&s.startsWith("http")?"":window.location.origin}${t==null?void 0:t.url}${r}`],minzoom:t.minzoom||5,maxzoom:t.maxzoom||24};e.addSource(t.id,i),(t.layers||await iP(t.style,t.source||t.id,e,n)||[]).forEach((a,l)=>{const c={};a.paint&&Object.entries(a.paint).forEach(([d,p])=>{var m,y;if(d==="fill-color"||d==="circle-color")if((m=t.style)!=null&&m.colorAttr&&((y=t.style)!=null&&y.colorSet)){const w=["match",["get",t.style.colorAttr]];Object.entries(t.style.colorSet).forEach(([x,C])=>{w.push(x,C)}),w.push(t.style.color||"#ff0000"),c[d]=w,t.style.opacity!==void 0&&(c[`${d.split("-")[0]}-opacity`]=t.style.opacity),t.style.stroke&&d==="fill-color"&&(c["fill-outline-color"]=t.style.stroke)}else c[d]=p;else c[d]=p});const u={...a,paint:c,id:`${t.id}-${l}`,source:t.id,"source-layer":a["source-layer"]||t.source||t.id,maxzoom:+a.maxzoom||24,minzoom:+a.minzoom||0};console.log("Final layer paint:",JSON.stringify(u.paint,null,2)),e.addLayer(u)})},async addGeoJsonLayer(t,e=this.map,n="api"){t!=null&&t.imported&&this.addAllGeometryLayers(t.id);const r=t.data??(t!=null&&t.url?t.url.startsWith("http")?t.url:window.location.origin+t.url:`/${n}/geojson/${t.id}.json`);e.addSource(t.id,{type:"geojson",data:r}),(await iP(t.style,r.source||t.id,e,n)||t.layers||[]).forEach(o=>{const s={...o,source:t.id,id:o.id||t.id,maxzoom:+o.maxzoom||24,minzoom:+o.minzoom||0,type:o.type||"circle"};e.addLayer(s)})},setLayerData(t,e){this.layerList=this.layerList.map(n=>n.id===t?{...n,...e}:n)},addAllGeometryLayers(t){[{id:"points",type:"circle",geometry:"Point"},{id:"lines",type:"line",geometry:"LineString"},{id:"polygons",type:"fill",geometry:"Polygon"}].forEach(n=>{const r=`${t}-${n.id}`;this.map.getLayer(r)||this.map.addLayer({id:r,type:n.type,source:t,paint:this.getPaintProperties(n.type),filter:["==","$type",n.geometry]})})},getPaintProperties(t){return{circle:{"circle-radius":5,"circle-color":"#FF0000"},line:{"line-width":2,"line-color":"#0000FF"},fill:{"fill-color":"#00FF00","fill-opacity":.5}}[t]||{}},async removeLayer(t,e=this.map){e.getSource(t)&&(await e.getStyle().layers.forEach(async n=>{n.source===t&&await e.removeLayer(n.id)}),await e.removeSource(t))},async setFilter(t,e){const n=this.layerList.find(i=>i.id===t),r=await this.map.getSource(t);if((n==null?void 0:n.service)==="vtile"){await r.setTiles([`${window.location.origin}${n.url}${n.url.includes("?")?"&":"?"}filter=${e}${n.props?`&props=${n.props}`:""}`]);return}n==null||n.service},async changeBaseLayer(t){t!==this.activeLayer&&(this.activeLayer&&this.map.setLayoutProperty(this.activeLayer,"visibility","none"),await this.setVisible(this.activeLayer,!1),await this.setVisible(t,!0),this.map.getStyle().layers.forEach(e=>{e.source!==t&&e.type!=="background"&&this.map.moveLayer(e.id)}),this.activeLayer=t)},async refreshLayer(t,e=this.map){await e.getStyle().layers.forEach(n=>{n.source===t&&e.removeLayer(n.id)}),await e.removeSource(t),this.setVisible(t)}}};function Gce(t){return[{type:"fill",paint:{"fill-color":t.color||"#ccc","fill-outline-color":t.stroke||"blue","fill-opacity":parseFloat(t.opacity)||1}}]}function qce(t){return[{type:"line",paint:{"line-color":t.color||"#ccc","line-opacity":parseFloat(t.opacity)||1}}]}function Yce(t){const e=[];return t!=null&&t.icon&&e.push({type:"symbol",minzoom:t.pointZoom||15,layout:{"icon-image":t.icon,"icon-size":1,"icon-allow-overlap":!0}}),e.push({type:"circle",maxzoom:t!=null&&t.icon?t.pointZoom:null,paint:{"circle-radius":t.radius||6,"circle-stroke-color":["case",["boolean",["feature-state","hover"],!1],"#000",(t==null?void 0:t.stroke)||"#d0d0d0"],"circle-stroke-width":2,"circle-color":t.color||"blue"}}),e}function bV(t){if(!t)return null;const e=t.type||"point";return e==="polygon"?Gce(t):e==="line"?qce(t):Yce(t)}function Zce(t){const e=g.ref([]),n=g.ref(""),r=g.computed(()=>e.value.filter(C=>C==null?void 0:C.interactive).map(C=>C.id)),i=C=>{t.value.getStyle().layers.forEach(S=>{S.id.match(C)&&t.value.moveLayer(S.id)})},o=()=>{const S=t.value.getStyle().layers.filter(M=>M.order!==void 0).sort((M,E)=>(E.order||Number.MAX_SAFE_INTEGER)-(M.order||Number.MAX_SAFE_INTEGER));S.forEach((M,E)=>{var A;t.value.getLayer(M.id)?t.value.moveLayer(M.id,(A=S[E+1])==null?void 0:A.id):t.value.addLayer(M)})},s=async(C,S=!0)=>{var A,I;if(!C)return;const M=(C==null?void 0:C.id)||C,E=(I=(A=t.value)==null?void 0:A.getStyle())==null?void 0:I.layers.filter(O=>{var z;return(z=O==null?void 0:O.id)==null?void 0:z.match(M)});E==null||E.forEach(O=>{t.value.setLayoutProperty(O.id,"visibility",S?"visible":"none")})},a=async C=>{var E,A,I,O,z;const S=((E=e.value)==null?void 0:E.find($=>$.id===C))||C;(I=(A=t.value)==null?void 0:A.getStyle())!=null&&I.layers.find($=>$.id===S.id)||(e.value.find($=>$.id===S.id)||e.value.push(S),(S.service==="vtile"||S.service==="vector"||(O=S.url)!=null&&O.includes(".vmt"))&&u(S),S.service==="geojson"&&d(S),((z=S.url)!=null&&z.includes(".png")||["tms","raster","wms"].includes(S.service))&&await l(S))},l=async C=>{var M,E,A,I;const S=C.url.startsWith("http")?C.url:C.url.replace("/api-user","/api");(M=t.value)!=null&&M.getSource(C.id)||await((E=t.value)==null?void 0:E.addSource(C.id,{type:"raster",tiles:[S],tileSize:256,...C!=null&&C.scheme?{scheme:C==null?void 0:C.scheme}:{}})),(A=t.value)!=null&&A.getLayer(C.id)||await((I=t.value)==null?void 0:I.addLayer({id:C.id,type:"raster",source:C.id,minzoom:0,maxzoom:(C==null?void 0:C.maxzoom)||22}))},c=async(C="pin6-m-ar-A+a52a2a")=>{if(t.value.hasImage(C))return;const S=`http://editor.local.softpro.ua/api/marker_icon/${C}.png`;try{const M=await t.value.loadImage(S);t.value.addImage(C,M.data)}catch(M){console.error(`Error loading image "${C}":`,M)}},u=async C=>{var A,I;const S=["props","pointZoom"].filter(O=>C[O]).map(O=>`&${O}=${C[O]}`),M={type:"vector",tiles:[`${(A=C==null?void 0:C.url)!=null&&A.startsWith("http")?"":window.location.origin}${C==null?void 0:C.url}${S}`],minzoom:C.minzoom||5,maxzoom:C.maxzoom||24};t.value.addSource(C==null?void 0:C.id,M),(I=C==null?void 0:C.style)!=null&&I.icon&&await c(C.style.icon),(bV(C.style)||C.layers||[]).forEach((O,z)=>{const $={...O,id:`${C.id}-${z}`,source:C.id,"source-layer":O["source-layer"]||C.source||C.id,maxzoom:+O.maxzoom||24,minzoom:+O.minzoom||0};t.value.addLayer($)})},d=async C=>{var E,A;if(!t.value||t.value.getSource(C.id))return;let S;try{C!=null&&C.imported?S=C.geojsonData||(await un.get(C.url)).data:S=(await un.get(`/geojson/${C==null?void 0:C.id}`)).data}catch(I){console.error(`Помилка при завантаженні даних для джерела "${C.id}":`,I);return}C.filterTable=(A=(E=S==null?void 0:S.meta)==null?void 0:E.meta)==null?void 0:A.view,t.value.getSource(C.id)&&t.value.removeSource(C.id),t.value.addSource(C.id,{type:"geojson",data:S}),(await bV(C.style)||C.layers||[]).forEach(I=>{const O=I.id||C.id;t.value.getLayer(O)&&t.value.removeLayer(O);const z={...I,source:C.id,id:O,maxzoom:+I.maxzoom||24,minzoom:+I.minzoom||0,type:I.type||"circle"};t.value.addLayer(z)})};return{layerList:e,interactiveSources:r,moveLayer:i,reorderLayers:o,setVisible:s,addLayer:a,addRasterLayer:l,loadImage:c,addVtileLayer:u,addGeoJsonLayer:d,removeLayer:async C=>{t.value.getStyle().layers.forEach(S=>{S.source===C&&t.value.removeLayer(S.id)}),t.value.getSource(C)&&t.value.removeSource(C)},setFilter:async(C,S,M)=>{const E=e.value.find(I=>I.id===C);if(!E)return;const A=t.value.getSource(C);if(A){if(E.service==="vtile"||E.service==="vector")await A.setTiles([`${window.location.origin}${E.url}${E.url.includes("?")?"&":"?"}filter=${S}${E.props?`&props=${E.props}`:""}${M?`&custom=${M}`:""}`]);else if(E.service==="geojson")try{const{data:I}=await un(`/geojson/${C}?filter=${S}${M?`&custom=${M}`:""}`);A.setData(I)}catch(I){console.error(`Error fetching GeoJSON data for layer "${C.id}":`,I)}}},refreshLayer:async C=>{t.value.getStyle().layers.forEach(S=>{S.source===C&&t.value.removeLayer(S.id)}),t.value.removeSource(C),s(C)},isLayerInFocus:C=>C.id===n.value,toggleLayerVisibility:C=>{t.value&&(t.value.getLayer(C.id)||(n.value&&(t.value.removeLayer(n.value),t.value.removeSource(n.value)),t.value.addSource(C.id,{type:"raster",tiles:[C.url],tileSize:256}),t.value.addLayer({id:C.id,type:"raster",source:C.id,minzoom:0,maxzoom:22}),n.value=C.id,t.value.getStyle().layers.forEach(S=>{(C==null?void 0:C.id)!==(S==null?void 0:S.id)&&t.value.moveLayer(S.id)})))}}}const Xce=["name","value","disabled"],Kce={class:"flex items-center gap-[6px] text-[14px]"},Jce={key:0,class:"text-[16px]"},Qce=["src"],eue=g.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{type:[String,Number],default:""},modelValue:{type:[Array,String,Boolean],default:""},disabled:{type:Boolean,default:!1},id:{type:[String,Number]},icon:{type:String},imgUrl:{type:String},style:{type:Object,default:()=>null}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=g.computed({get:()=>n.modelValue,set:a=>{r("update:modelValue",a)}}),o=g.computed(()=>Array.isArray(i.value)?i.value.includes(n.value):i.value===!0||i.value===n.value),s=g.computed(()=>{var a,l;return((a=n.style)==null?void 0:a.size)==="xs"?"p-1.5 text-xs":((l=n.style)==null?void 0:l.size)==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs"});return(a,l)=>(g.openBlock(),g.createElementBlock("label",{class:g.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 cursor-pointer rounded-lg",[s.value,o.value?"border-blue-600 border-1":"border border-gray-200"]])},[g.withDirectives(g.createElementVNode("input",{type:"checkbox",class:"hidden",name:t.id,value:t.value,"onUpdate:modelValue":l[0]||(l[0]=c=>i.value=c),disabled:t.disabled},null,8,Xce),[[g.vModelCheckbox,i.value]]),g.createElementVNode("span",Kce,[t.icon||t.imgUrl?(g.openBlock(),g.createElementBlock("span",Jce,[t.icon?(g.openBlock(),g.createElementBlock("i",{key:0,class:g.normalizeClass(t.icon)},null,2)):g.createCommentVNode("",!0),t.imgUrl?(g.openBlock(),g.createElementBlock("img",{key:1,src:t.imgUrl,width:"16",height:"16",alt:"icon"},null,8,Qce)):g.createCommentVNode("",!0)])):g.createCommentVNode("",!0),g.renderSlot(a.$slots,"default",{},()=>[g.createTextVNode(g.toDisplayString(t.label),1)])])],2))}}),tue={},nue={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function rue(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",nue,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const cf=xt(tue,[["render",rue]]),iue={},oue={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-info-circle"};function sue(t,e){return g.openBlock(),g.createElementBlock("svg",oue,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0"},null,-1),g.createElementVNode("path",{d:"M12 9h.01"},null,-1),g.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1)]))}const wV=xt(iue,[["render",sue]]),aue={props:{content:{type:String,default:()=>""},position:{type:String,default:()=>"top"},gap:{type:Number,default:8}},data(){return{tooltipVisible:!1,tooltipStyles:{top:"0px",left:"0px",position:"fixed"}}},methods:{showTooltip(){this.tooltipVisible=!0,this.getTooltipPosition()},hideTooltip(){this.tooltipVisible=!1},getTooltipPosition(){this.$nextTick(()=>{const{position:t,gap:e}=this,n=this.$refs.tooltipContent,r=this.$el,i=n.getBoundingClientRect(),o=r.getBoundingClientRect();let s,a;switch(t){case"top":s=o.top-i.height-e,a=o.left+o.width/2-i.width/2;break;case"bottom":s=o.bottom+e,a=o.left+o.width/2-i.width/2;break;case"left":s=o.top+o.height/2-i.height/2,a=o.left-i.width-e;break;case"right":s=o.top+o.height/2-i.height/2,a=o.right+e;break;default:s=o.top-i.height-e,a=o.left+o.width/2-i.width/2;break}this.tooltipStyles.top=`${s}px`,this.tooltipStyles.left=`${a}px`})}}};function lue(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",{onMouseenter:e[0]||(e[0]=(...s)=>o.showTooltip&&o.showTooltip(...s)),onMouseleave:e[1]||(e[1]=(...s)=>o.hideTooltip&&o.hideTooltip(...s)),class:"vs-tooltip relative self-center cursor-pointer"},[g.renderSlot(t.$slots,"reference",{},()=>[e[2]||(e[2]=g.createElementVNode("button",null,"Hover Me",-1))]),(g.openBlock(),g.createBlock(g.Teleport,{to:"#modal"},[g.createVNode(g.Transition,{name:"fade"},{default:g.withCtx(()=>[i.tooltipVisible?(g.openBlock(),g.createElementBlock("span",{key:0,class:"inline-block absolute max-w-md z-[90] p-4 bg-white text-[13px] font-medium text-gray-500 rounded-md border border-[#dcdfe6]",ref:"tooltipContent",style:g.normalizeStyle(i.tooltipStyles)},g.toDisplayString(n.content),5)):g.createCommentVNode("",!0)]),_:1})]))],32)}const p1=xt(aue,[["render",lue]]),cue={class:"flex items-center gap-[4px]"},uue=["value","id","disabled"],hue=["for"],due={class:"text-[13px] text-gray-500 flex items-center gap-x-1 ml-1 dark:text-neutral-400"},fue={"vs-checkbox-default":{__name:"vs-checkbox-default",props:{value:{type:[String,Number],default:""},label:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},id:{type:[String,Number]},modelValue:Boolean,info:{type:String,default:()=>""}},emits:["update:modelValue"],setup(t,{emit:e}){const n=e,r=t,i=g.computed({get:()=>r.modelValue,set:o=>n("update:modelValue",o)});return(o,s)=>(g.openBlock(),g.createElementBlock("div",cue,[g.withDirectives(g.createElementVNode("input",{type:"checkbox",value:t.value,"onUpdate:modelValue":s[0]||(s[0]=a=>i.value=a),class:g.normalizeClass(["shrink-0 border border-solid hidden border-gray-200 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":t.disabled}]),id:t.id,disabled:t.disabled},null,10,uue),[[g.vModelCheckbox,i.value]]),g.createElementVNode("label",{for:t.id,class:g.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-3 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":t.disabled}])},[g.createElementVNode("div",{class:g.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[i.value?"bg-blue-600":"bg-white"]])},[g.createVNode(cf,{height:"12",width:"12"})],2),g.createElementVNode("span",due,[g.renderSlot(o.$slots,"default",{},()=>[g.createTextVNode(g.toDisplayString(t.label),1)]),t.info?(g.openBlock(),g.createBlock(p1,{key:0,content:t.info,position:"right"},{reference:g.withCtx(()=>[g.createVNode(wV,{class:"ml-1",height:"14",width:"14"})]),_:1},8,["content"])):g.createCommentVNode("",!0)])],10,hue)]))}},"vs-checkbox-buttons":eue};var Jl;(t=>{(e=>{e.Equal="==",e.Inequal="!=",e.Higer=">",e.HigerOrEqual=">=",e.Lower="<",e.LowerOrEqual="<=",e.Between="between",e.StartWith="^",e.EndWith="$",e.Contain="*",e.In="in",e.NotIn="not_in"})(t.Types||(t.Types={}))})(Jl||(Jl={}));var vu;(t=>{(e=>{e.Min="min",e.Max="max",e.Required="required",e.Email="email",e.RegExp="regex",e.NotRegExp="not_regex",e.Same="same",e.Numeric="numeric",e.Integer="integer",e.Between="between"})(t.Types||(t.Types={}))})(vu||(vu={}));class Eg{static checkConditions(e,n,r){var c,u;const[i,o,s]=n,a=(c=e[i])==null?void 0:c.toString();let l=null;if(i!=null&&i.includes(".")){const[d="a",p="b"]=i==null?void 0:i.split(".");l=(u=r==null?void 0:r[d])==null?void 0:u[p]}if(!a&&!l)return console.warn(`${i} is not exist in "formData"`),!1;switch(o){case Jl.Types.Equal:return this.checkValueEqual(a,l,s.toString());case Jl.Types.Inequal:return this.checkValueInequal(a,s.toString());case Jl.Types.Higer:return this.checkValueHiger(a,s.toString());case Jl.Types.HigerOrEqual:return this.checkValueHigerOrEqual(a,s.toString());case Jl.Types.Lower:return this.checkValueLower(a,s.toString());case Jl.Types.LowerOrEqual:return this.checkValueLowerOrEqual(a,s.toString());case Jl.Types.Between:return this.checkValueBetween(a,s.toString());case Jl.Types.StartWith:return this.checkValueStartWith(a,s.toString());case Jl.Types.EndWith:return this.checkValueEndWith(a,s.toString());case Jl.Types.Contain:return this.checkValueContain(a,s.toString());case Jl.Types.In:return this.checkValueIn(a,s.toString());case Jl.Types.NotIn:return this.checkValueNotIn(a,s.toString());default:return!1}}static checkValueEqual(e,n,r){return e===r||n===r}static checkValueInequal(e,n){return e!==n}static checkValueHiger(e,n){return e>n}static checkValueHigerOrEqual(e,n){return e>=n}static checkValueLower(e,n){return en[0]&&e`${i}`):n.includes(",")?r=n.split(",").map(i=>i.trim()):r=[n]:r=n.map(i=>`${i}`)}catch(i){return console.error("Error parsing expectedValue in checkValueIn: ",i),!1}return r.includes(`${e}`)}static checkValueNotIn(e,n){let r;try{typeof n=="string"?n.startsWith("[")?r=JSON.parse(n).map(i=>`${i}`):n.includes(",")?r=n.split(",").map(i=>i.trim()):r=[n]:r=n.map(i=>`${i}`)}catch(i){return console.error("Error parsing expectedValue in checkValueNotIn: ",i),!1}return!r.includes(`${e}`)}}class sP{static check({data:e,components:n,disabledFields:r}){const i=new Map,o=(a,l)=>{for(let c=0;c{if(typeof a!="string")return;const[c]=a==null?void 0:a.split(":"),u={rule:a,data:e,field:l};switch(c){case vu.Types.Required:return this.required(u);case vu.Types.Min:return this.min(u);case vu.Types.Max:return this.max(u);case vu.Types.Email:return this.email(u);case vu.Types.NotRegExp:return this.notRegExp(u);case vu.Types.RegExp:return this.regExp(u);case vu.Types.Numeric:return this.numeric(u);case vu.Types.Integer:return this.integer(u);case vu.Types.Between:return this.between(u);case vu.Types.Same:return this.same(u)}};return n.forEach(({rules:a,key:l})=>{if(!a)return;const c=o(a,u=>s(u,l));if(r.get(l)===!1){i.delete(l);return}!c&&i.has(l)&&i.delete(l),c&&!i.has(l)&&i.set(l,c)}),i}static required({field:e,data:n,rule:r}){const[,i]=r.split(":"),o=i||e;return n[o]||""?"":`The ${o} field is required`}static email({field:e,data:n,rule:r}){const[,i]=r.split(":"),s=n[i||e];return/^[\w\.-]+@[a-zA-Z\d\.-]+\.[a-zA-Z]{2,}$/.test(s)?"":`${i||"The value"} must be a valid email format.`}static same({field:e,data:n,rule:r}){const[,i,o]=r.split(":"),s=o||e;return n[s]!=n[i]?`Field ${s} must be the same as the ${i} field value`:""}static numeric({field:e,data:n,rule:r}){const[,i]=r.split(":"),s=n[i||e];return/^-?\d+(\.\d+)?$/.test(s)?"":"Value must be a numeric."}static between({field:e,data:n,rule:r}){const[,i,o]=r.split(":"),[s,a]=i.split(","),c=n[o||e];return c<+s||c>+a?`Value must be between the size of ${s} and ${a}. `:""}static integer({field:e,data:n,rule:r}){const[,i]=r.split(":"),s=n[i||e];return/^-?\d+$/.test(s)?"":"Value must be an integer."}static max({field:e,data:n,rule:r}){const[,i,o]=r.split(":");return(n[o||e]||"").length>+i?`Field may not be greater than ${i} characters.`:""}static min({field:e,data:n,rule:r}){const[,i,o]=r.split(":");return(n[o||e]||"").length<+i?`${o||"Field"} value must be at least ${i}.`:""}static regExp({field:e,data:n,rule:r}){const i=this.regexParser(r);if(!i)return;const s=n[e];return i.test(s)?"":"Field must match the provided regex pattern."}static notRegExp({field:e,data:n,rule:r}){const i=this.regexParser(r);if(!i)return;const s=n[e];return i.test(s)?"Field must not match the provided regex pattern.":""}static regexParser(e){const[,n]=e.split(":"),r=n.match(/\/(.*)\/([gimsuy]*)/);if(!r)return;const i=r[1],o=r[2];return new RegExp(i,o)}}const uf=(t,e,n)=>{const r=g.getCurrentInstance();return r?(r.appContext.app.component(t,g.defineAsyncComponent(async()=>({template:e,props:n}))),t):""},Lc=async(t,e,n,r=10)=>{var w,x,C,S;if(!e||!n)return;await g.nextTick();const i=await(n==null?void 0:n.getBoundingClientRect()),o=await(e==null?void 0:e.getBoundingClientRect());if(!o||!i)return;const s=await parseInt((w=e==null?void 0:e.getBoundingClientRect())==null?void 0:w.height),a=await parseInt((x=e==null?void 0:e.getBoundingClientRect())==null?void 0:x.width),l=await parseInt((C=n==null?void 0:n.getBoundingClientRect())==null?void 0:C.height),c=await parseInt((S=n==null?void 0:n.getBoundingClientRect())==null?void 0:S.width),u=await window.innerHeight,d=await window.innerWidth;let p=0,m=0;const y=o.bottom+r+l;switch(t){case"top":o.top-i.height-r<0?p=o.top-i.height+r+l+s:p=o.top-i.height-r,d>c+o.right+30?m=o.left-i.width/2+o.width/2:m=d-30-c;break;case"bottom":u>y?p=o.bottom+r:p=o.bottom-r-l-s,m=o.left-i.width/2+o.width/2;break;case"left":p=o.top-i.height/2+o.height/2,o.left-i.width-r>0?m=o.left-i.width-r:m=10;break;case"right":p=o.top-i.height/2+o.height/2,d-a>c?m=o.right+r:m=d-30-c;break;case"top-right":o.top-i.height-r<0?p=o.top-i.height+r+l+s:p=o.top-i.height-r,d-a>c?m=o.right+r:m=d-30-c;break;case"top-left":o.top-i.height-r<0?p=o.top-i.height+r+l+s:p=o.top-i.height-r,o.left-i.width-r>0?m=o.left-i.width-r:m=10;break;case"top-start":o.top-i.height-r<0?p=o.top-i.height+r+l+s:p=o.top-i.height-r,o.left>0?m=o.left:m=10;break;case"bottom-right":u>y?p=o.bottom+r:p=o.bottom-r-l-s,d-a>c?m=o.left:m=d-30-c;break;case"bottom-left":u>y?p=o.bottom+r:p=o.bottom-r-l-s,o.left>0?m=o.right-c:m=10;break;case"bottom-start":u>y?p=o.bottom+r:p=o.bottom-r-l-s,o.left>0?m=o.left:m=10;break}p+l>u?p=u-l-r:p<0&&(p=r),m+c>d?m=d-c-r:m<0&&(m=r),n instanceof HTMLElement&&(n.style.top=`${p}px`,n.style.left=`${m}px`,n.style.position="fixed")},xV=Object.freeze(Object.defineProperty({__proto__:null,FormConditionUtils:Eg,FormRules:sP,asyncTemplateSlot:uf,dynamicPosition:Lc},Symbol.toStringTag,{value:"Module"})),pue={class:"flex items-center"},m1=g.defineComponent({__name:"vs-checkbox",props:{value:{type:[String,Number],default:""},label:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},view:{type:String,default:()=>"default"},modelValue:{type:[Array,Boolean],default:!1},icon:{type:String},imgUrl:{type:String},slots:{type:Object,default:()=>null},option:{type:[Object,String]},style:{type:String,default:()=>null}},emits:["update:modelValue"],setup(t,{emit:e}){var a,l;const n=t,r=e,i=`radio-${Math.floor(Math.random()*1e4)}`;(a=n.slots)!=null&&a.label&&uf(i,(l=n.slots)==null?void 0:l.label,["label",...Object.keys((n==null?void 0:n.option)||{})]);const o=g.computed({get:()=>Array.isArray(n.modelValue)?Array.isArray(n.modelValue)&&n.modelValue.includes(n.value):n.modelValue,set:c=>{if(Array.isArray(n.modelValue)){let u=[...n.modelValue];c?u.includes(n.value)||u.push(n.value):u=u.filter(d=>d!==n.value),r("update:modelValue",u)}else r("update:modelValue",c)}}),s=g.ref("vs-checkbox-"+(n.view||"default"));return(c,u)=>{var d,p;return g.openBlock(),g.createElementBlock("div",pue,[(g.openBlock(),g.createBlock(g.resolveDynamicComponent((d=g.unref(fue))==null?void 0:d[s.value]),{value:t.value,label:t.label,info:(p=t.option)==null?void 0:p.info,disabled:t.disabled,modelValue:o.value,"onUpdate:modelValue":u[0]||(u[0]=m=>o.value=m),id:i,icon:t.icon,imgUrl:t.imgUrl,style:g.normalizeStyle(t.style)},{default:g.withCtx(()=>{var m;return[(m=t.slots)!=null&&m.label?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(i),g.mergeProps({key:0},t.option,{label:t.label}),null,16,["label"])):(g.openBlock(),g.createElementBlock(g.Fragment,{key:1},[g.createTextVNode(g.toDisplayString(t.label),1)],64))]}),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style"]))])}}});var EV={exports:{}};/** * MapLibre GL JS * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.6.0/LICENSE.txt */(function(t,e){(function(n,r){t.exports=r()})(pb,function(){var n={},r={};function i(s,a,l){if(r[s]=l,s==="index"){var c="var sharedModule = {}; ("+r.shared+")(sharedModule); ("+r.worker+")(sharedModule);",u={};return r.shared(u),r.index(n,u),typeof window<"u"&&n.setWorkerUrl(window.URL.createObjectURL(new Blob([c],{type:"text/javascript"}))),n}}i("shared",["exports"],function(s){function a(b,f,_,k){return new(_||(_=Promise))(function(N,B){function F(ee){try{X(k.next(ee))}catch(ne){B(ne)}}function H(ee){try{X(k.throw(ee))}catch(ne){B(ne)}}function X(ee){var ne;ee.done?N(ee.value):(ne=ee.value,ne instanceof _?ne:new _(function(se){se(ne)})).then(F,H)}X((k=k.apply(b,f||[])).next())})}function l(b){return b&&b.__esModule&&Object.prototype.hasOwnProperty.call(b,"default")?b.default:b}var c,u;function d(){if(u)return c;function b(f,_){this.x=f,this.y=_}return u=1,c=b,b.prototype={clone:function(){return new b(this.x,this.y)},add:function(f){return this.clone()._add(f)},sub:function(f){return this.clone()._sub(f)},multByPoint:function(f){return this.clone()._multByPoint(f)},divByPoint:function(f){return this.clone()._divByPoint(f)},mult:function(f){return this.clone()._mult(f)},div:function(f){return this.clone()._div(f)},rotate:function(f){return this.clone()._rotate(f)},rotateAround:function(f,_){return this.clone()._rotateAround(f,_)},matMult:function(f){return this.clone()._matMult(f)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(f){return this.x===f.x&&this.y===f.y},dist:function(f){return Math.sqrt(this.distSqr(f))},distSqr:function(f){var _=f.x-this.x,k=f.y-this.y;return _*_+k*k},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(f){return Math.atan2(this.y-f.y,this.x-f.x)},angleWith:function(f){return this.angleWithSep(f.x,f.y)},angleWithSep:function(f,_){return Math.atan2(this.x*_-this.y*f,this.x*f+this.y*_)},_matMult:function(f){var _=f[2]*this.x+f[3]*this.y;return this.x=f[0]*this.x+f[1]*this.y,this.y=_,this},_add:function(f){return this.x+=f.x,this.y+=f.y,this},_sub:function(f){return this.x-=f.x,this.y-=f.y,this},_mult:function(f){return this.x*=f,this.y*=f,this},_div:function(f){return this.x/=f,this.y/=f,this},_multByPoint:function(f){return this.x*=f.x,this.y*=f.y,this},_divByPoint:function(f){return this.x/=f.x,this.y/=f.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var f=this.y;return this.y=this.x,this.x=-f,this},_rotate:function(f){var _=Math.cos(f),k=Math.sin(f),N=k*this.x+_*this.y;return this.x=_*this.x-k*this.y,this.y=N,this},_rotateAround:function(f,_){var k=Math.cos(f),N=Math.sin(f),B=_.y+N*(this.x-_.x)+k*(this.y-_.y);return this.x=_.x+k*(this.x-_.x)-N*(this.y-_.y),this.y=B,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},b.convert=function(f){return f instanceof b?f:Array.isArray(f)?new b(f[0],f[1]):f},c}typeof SuppressedError=="function"&&SuppressedError;var p,m,y=l(d()),w=function(){if(m)return p;function b(f,_,k,N){this.cx=3*f,this.bx=3*(k-f)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*_,this.by=3*(N-_)-this.cy,this.ay=1-this.cy-this.by,this.p1x=f,this.p1y=_,this.p2x=k,this.p2y=N}return m=1,p=b,b.prototype={sampleCurveX:function(f){return((this.ax*f+this.bx)*f+this.cx)*f},sampleCurveY:function(f){return((this.ay*f+this.by)*f+this.cy)*f},sampleCurveDerivativeX:function(f){return(3*this.ax*f+2*this.bx)*f+this.cx},solveCurveX:function(f,_){if(_===void 0&&(_=1e-6),f<0)return 0;if(f>1)return 1;for(var k=f,N=0;N<8;N++){var B=this.sampleCurveX(k)-f;if(Math.abs(B)<_)return k;var F=this.sampleCurveDerivativeX(k);if(Math.abs(F)<1e-6)break;k-=B/F}var H=0,X=1;for(k=f,N=0;N<20&&(B=this.sampleCurveX(k),!(Math.abs(B-f)<_));N++)f>B?H=k:X=k,k=.5*(X-H)+H;return k},solve:function(f,_){return this.sampleCurveY(this.solveCurveX(f,_))}},p}(),x=l(w);let C,S;function M(){return C==null&&(C=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),C}function E(){if(S==null&&(S=!1,M())){const f=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(f){for(let k=0;k<5*5;k++){const N=4*k;f.fillStyle=`rgb(${N},${N+1},${N+2})`,f.fillRect(k%5,Math.floor(k/5),1,1)}const _=f.getImageData(0,0,5,5).data;for(let k=0;k<5*5*4;k++)if(k%4!=3&&_[k]!==k){S=!0;break}}}return S||!1}var A=1e-6,I=typeof Float32Array<"u"?Float32Array:Array;function O(){var b=new I(9);return I!=Float32Array&&(b[1]=0,b[2]=0,b[3]=0,b[5]=0,b[6]=0,b[7]=0),b[0]=1,b[4]=1,b[8]=1,b}function z(b){return b[0]=1,b[1]=0,b[2]=0,b[3]=0,b[4]=0,b[5]=1,b[6]=0,b[7]=0,b[8]=0,b[9]=0,b[10]=1,b[11]=0,b[12]=0,b[13]=0,b[14]=0,b[15]=1,b}function $(){var b=new I(3);return I!=Float32Array&&(b[0]=0,b[1]=0,b[2]=0),b}function W(b){return Math.hypot(b[0],b[1],b[2])}function J(b,f,_){var k=new I(3);return k[0]=b,k[1]=f,k[2]=_,k}function Z(b,f,_){return b[0]=f[0]+_[0],b[1]=f[1]+_[1],b[2]=f[2]+_[2],b}function q(b,f,_){return b[0]=f[0]*_,b[1]=f[1]*_,b[2]=f[2]*_,b}function j(b,f,_){var k=f[0],N=f[1],B=f[2],F=_[0],H=_[1],X=_[2];return b[0]=N*X-B*H,b[1]=B*F-k*X,b[2]=k*H-N*F,b}Math.hypot||(Math.hypot=function(){for(var b=0,f=arguments.length;f--;)b+=arguments[f]*arguments[f];return Math.sqrt(b)});var G,U=W;function Q(b,f,_){var k=f[0],N=f[1],B=f[2],F=f[3];return b[0]=_[0]*k+_[4]*N+_[8]*B+_[12]*F,b[1]=_[1]*k+_[5]*N+_[9]*B+_[13]*F,b[2]=_[2]*k+_[6]*N+_[10]*B+_[14]*F,b[3]=_[3]*k+_[7]*N+_[11]*B+_[15]*F,b}function re(){var b=new I(4);return I!=Float32Array&&(b[0]=0,b[1]=0,b[2]=0),b[3]=1,b}function le(b,f,_,k){var N=.5*Math.PI/180;f*=N,_*=N,k*=N;var B=Math.sin(f),F=Math.cos(f),H=Math.sin(_),X=Math.cos(_),ee=Math.sin(k),ne=Math.cos(k);return b[0]=B*X*ne-F*H*ee,b[1]=F*H*ne+B*X*ee,b[2]=F*X*ee-B*H*ne,b[3]=F*X*ne+B*H*ee,b}function oe(){var b=new I(2);return I!=Float32Array&&(b[0]=0,b[1]=0),b}function he(b,f){var _=new I(2);return _[0]=b,_[1]=f,_}$(),G=new I(4),I!=Float32Array&&(G[0]=0,G[1]=0,G[2]=0,G[3]=0),$(),J(1,0,0),J(0,1,0),re(),re(),O(),oe();const xe=8192;function Ee(b,f,_){return f*(xe/(b.tileSize*Math.pow(2,_-b.tileID.overscaledZ)))}function Ie(b,f){return(b%f+f)%f}function Oe(b,f,_){return b*(1-_)+f*_}function $e(b){if(b<=0)return 0;if(b>=1)return 1;const f=b*b,_=f*b;return 4*(b<.5?_:3*(b-f)+_-.75)}function Ze(b,f,_,k){const N=new x(b,f,_,k);return B=>N.solve(B)}const lt=Ze(.25,.1,.25,1);function pt(b,f,_){return Math.min(_,Math.max(f,b))}function yt(b,f,_){const k=_-f,N=((b-f)%k+k)%k+f;return N===f?_:N}function Lt(b,...f){for(const _ of f)for(const k in _)b[k]=_[k];return b}let hn=1;function Ht(b,f,_){const k={};for(const N in b)k[N]=f.call(this,b[N],N,b);return k}function wn(b,f,_){const k={};for(const N in b)f.call(this,b[N],N,b)&&(k[N]=b[N]);return k}function cn(b){return Array.isArray(b)?b.map(cn):typeof b=="object"&&b?Ht(b,cn):b}const Hn={};function Bn(b){Hn[b]||(typeof console<"u"&&console.warn(b),Hn[b]=!0)}function Ue(b,f,_){return(_.y-b.y)*(f.x-b.x)>(f.y-b.y)*(_.x-b.x)}function qe(b){return typeof WorkerGlobalScope<"u"&&b!==void 0&&b instanceof WorkerGlobalScope}let Et=null;function qt(b){return typeof ImageBitmap<"u"&&b instanceof ImageBitmap}const rn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function it(b,f,_,k,N){return a(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const B=new VideoFrame(b,{timestamp:0});try{const F=B==null?void 0:B.format;if(!F||!F.startsWith("BGR")&&!F.startsWith("RGB"))throw new Error(`Unrecognized format ${F}`);const H=F.startsWith("BGR"),X=new Uint8ClampedArray(k*N*4);if(yield B.copyTo(X,function(ee,ne,se,de,me){const ge=4*Math.max(1,0),be=(Math.max(0,se)-se)*de*4+ge,Ce=4*de,Le=Math.max(0,ne),Xe=Math.max(0,se);return{rect:{x:Le,y:Xe,width:Math.min(ee.width,ne+de)-Le,height:Math.min(ee.height,se+me)-Xe},layout:[{offset:be,stride:Ce}]}}(b,f,_,k,N)),H)for(let ee=0;ee{b.removeEventListener(f,_,k)}}}function nt(b){return b*Math.PI/180}function It(b){return b/Math.PI*180}const en={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Fn={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},lr="AbortError";function Ye(){return new Error(lr)}const ye={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function ue(b){return ye.REGISTERED_PROTOCOLS[b.substring(0,b.indexOf("://"))]}const ve="global-dispatcher";class ke extends Error{constructor(f,_,k,N){super(`AJAXError: ${_} (${f}): ${k}`),this.status=f,this.statusText=_,this.url=k,this.body=N}}const ze=()=>qe(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,He=function(b,f){if(/:\/\//.test(b.url)&&!/^https?:|^file:/.test(b.url)){const k=ue(b.url);if(k)return k(b,f);if(qe(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:b,targetMapId:ve},f)}if(!(/^file:/.test(_=b.url)||/^file:/.test(ze())&&!/^\w+:/.test(_))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(k,N){return a(this,void 0,void 0,function*(){const B=new Request(k.url,{method:k.method||"GET",body:k.body,credentials:k.credentials,headers:k.headers,cache:k.cache,referrer:ze(),signal:N.signal});let F,H;k.type!=="json"||B.headers.has("Accept")||B.headers.set("Accept","application/json");try{F=yield fetch(B)}catch(ee){throw new ke(0,ee.message,k.url,new Blob)}if(!F.ok){const ee=yield F.blob();throw new ke(F.status,F.statusText,k.url,ee)}H=k.type==="arrayBuffer"||k.type==="image"?F.arrayBuffer():k.type==="json"?F.json():F.text();const X=yield H;if(N.signal.aborted)throw Ye();return{data:X,cacheControl:F.headers.get("Cache-Control"),expires:F.headers.get("Expires")}})}(b,f);if(qe(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:b,mustQueue:!0,targetMapId:ve},f)}var _;return function(k,N){return new Promise((B,F)=>{var H;const X=new XMLHttpRequest;X.open(k.method||"GET",k.url,!0),k.type!=="arrayBuffer"&&k.type!=="image"||(X.responseType="arraybuffer");for(const ee in k.headers)X.setRequestHeader(ee,k.headers[ee]);k.type==="json"&&(X.responseType="text",!((H=k.headers)===null||H===void 0)&&H.Accept||X.setRequestHeader("Accept","application/json")),X.withCredentials=k.credentials==="include",X.onerror=()=>{F(new Error(X.statusText))},X.onload=()=>{if(!N.signal.aborted)if((X.status>=200&&X.status<300||X.status===0)&&X.response!==null){let ee=X.response;if(k.type==="json")try{ee=JSON.parse(X.response)}catch(ne){return void F(ne)}B({data:ee,cacheControl:X.getResponseHeader("Cache-Control"),expires:X.getResponseHeader("Expires")})}else{const ee=new Blob([X.response],{type:X.getResponseHeader("Content-Type")});F(new ke(X.status,X.statusText,k.url,ee))}},N.signal.addEventListener("abort",()=>{X.abort(),F(Ye())}),X.send(k.body)})}(b,f)};function tt(b){if(!b||b.indexOf("://")<=0||b.indexOf("data:image/")===0||b.indexOf("blob:")===0)return!0;const f=new URL(b),_=window.location;return f.protocol===_.protocol&&f.host===_.host}function Ke(b,f,_){_[b]&&_[b].indexOf(f)!==-1||(_[b]=_[b]||[],_[b].push(f))}function mt(b,f,_){if(_&&_[b]){const k=_[b].indexOf(f);k!==-1&&_[b].splice(k,1)}}class dt{constructor(f,_={}){Lt(this,_),this.type=f}}class Qe extends dt{constructor(f,_={}){super("error",Lt({error:f},_))}}class wt{on(f,_){return this._listeners=this._listeners||{},Ke(f,_,this._listeners),{unsubscribe:()=>{this.off(f,_)}}}off(f,_){return mt(f,_,this._listeners),mt(f,_,this._oneTimeListeners),this}once(f,_){return _?(this._oneTimeListeners=this._oneTimeListeners||{},Ke(f,_,this._oneTimeListeners),this):new Promise(k=>this.once(f,k))}fire(f,_){typeof f=="string"&&(f=new dt(f,_||{}));const k=f.type;if(this.listens(k)){f.target=this;const N=this._listeners&&this._listeners[k]?this._listeners[k].slice():[];for(const H of N)H.call(this,f);const B=this._oneTimeListeners&&this._oneTimeListeners[k]?this._oneTimeListeners[k].slice():[];for(const H of B)mt(k,H,this._oneTimeListeners),H.call(this,f);const F=this._eventedParent;F&&(Lt(f,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),F.fire(f))}else f instanceof Qe&&console.error(f.error);return this}listens(f){return this._listeners&&this._listeners[f]&&this._listeners[f].length>0||this._oneTimeListeners&&this._oneTimeListeners[f]&&this._oneTimeListeners[f].length>0||this._eventedParent&&this._eventedParent.listens(f)}setEventedParent(f,_){return this._eventedParent=f,this._eventedParentData=_,this}}var We={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const Vt=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function xn(b,f){const _={};for(const k in b)k!=="ref"&&(_[k]=b[k]);return Vt.forEach(k=>{k in f&&(_[k]=f[k])}),_}function jt(b,f){if(Array.isArray(b)){if(!Array.isArray(f)||b.length!==f.length)return!1;for(let _=0;_`:b.itemType.kind==="value"?"array":`array<${f}>`}return b.kind}const _M=[Hf,Bt,nr,rr,Ol,d_,Wf,zu,Dl(ir),Vo,wy,by,kh,xy];function Ey(b,f){if(f.kind==="error")return null;if(b.kind==="array"){if(f.kind==="array"&&(f.N===0&&f.itemType.kind==="value"||!Ey(b.itemType,f.itemType))&&(typeof b.N!="number"||b.N===f.N))return null}else{if(b.kind===f.kind)return null;if(b.kind==="value"){for(const _ of _M)if(!Ey(_,f))return null}}return`Expected ${so(b)} but found ${so(f)} instead.`}function f_(b,f){return f.some(_=>_.kind===b.kind)}function Gf(b,f){return f.some(_=>_==="null"?b===null:_==="array"?Array.isArray(b):_==="object"?b&&!Array.isArray(b)&&typeof b=="object":_===typeof b)}function Md(b,f){return b.kind==="array"&&f.kind==="array"?b.itemType.kind===f.itemType.kind&&typeof b.N=="number":b.kind===f.kind}const bM=.96422,wM=.82521,xM=4/29,pm=6/29,EM=3*pm*pm,SM=pm*pm*pm,Sy=Math.PI/180,LR=180/Math.PI;function CM(b){return(b%=360)<0&&(b+=360),b}function mm([b,f,_,k]){let N,B;const F=sx((.2225045*(b=ox(b))+.7168786*(f=ox(f))+.0606169*(_=ox(_)))/1);b===f&&f===_?N=B=F:(N=sx((.4360747*b+.3850649*f+.1430804*_)/bM),B=sx((.0139322*b+.0971045*f+.7141733*_)/wM));const H=116*F-16;return[H<0?0:H,500*(N-F),200*(F-B),k]}function ox(b){return b<=.04045?b/12.92:Math.pow((b+.055)/1.055,2.4)}function sx(b){return b>SM?Math.pow(b,1/3):b/EM+xM}function kM([b,f,_,k]){let N=(b+16)/116,B=isNaN(f)?N:N+f/500,F=isNaN(_)?N:N-_/200;return N=1*m_(N),B=bM*m_(B),F=wM*m_(F),[p_(3.1338561*B-1.6168667*N-.4906146*F),p_(-.9787684*B+1.9161415*N+.033454*F),p_(.0719453*B-.2289914*N+1.4052427*F),k]}function p_(b){return(b=b<=.00304?12.92*b:1.055*Math.pow(b,1/2.4)-.055)<0?0:b>1?1:b}function m_(b){return b>pm?b*b*b:EM*(b-xM)}const Vu=Object.hasOwn||function(b,f){return Object.prototype.hasOwnProperty.call(b,f)};function dr(b,f){return Vu(b,f)?b[f]:void 0}function Th(b){return parseInt(b.padEnd(2,b),16)/255}function Mh(b,f){return qf(f?b/100:b,0,1)}function qf(b,f,_){return Math.min(Math.max(f,b),_)}function ax(b){return!b.some(Number.isNaN)}const lx={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function pc(b,f,_){return b+_*(f-b)}function Ah(b,f,_){return b.map((k,N)=>pc(k,f[N],_))}class fr{constructor(f,_,k,N=1,B=!0){this.r=f,this.g=_,this.b=k,this.a=N,B||(this.r*=N,this.g*=N,this.b*=N,N||this.overwriteGetter("rgb",[f,_,k,N]))}static parse(f){if(f instanceof fr)return f;if(typeof f!="string")return;const _=function(k){if((k=k.toLowerCase().trim())==="transparent")return[0,0,0,0];const N=dr(lx,k);if(N){const[F,H,X]=N;return[F/255,H/255,X/255,1]}if(k.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(k)){const F=k.length<6?1:2;let H=1;return[Th(k.slice(H,H+=F)),Th(k.slice(H,H+=F)),Th(k.slice(H,H+=F)),Th(k.slice(H,H+F)||"ff")]}if(k.startsWith("rgb")){const F=k.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(F){const[H,X,ee,ne,se,de,me,ge,be,Ce,Le,Xe]=F,Be=[ne||" ",me||" ",Ce].join("");if(Be===" "||Be===" /"||Be===",,"||Be===",,,"){const pe=[ee,de,be].join(""),Se=pe==="%%%"?100:pe===""?255:0;if(Se){const Ve=[qf(+X/Se,0,1),qf(+se/Se,0,1),qf(+ge/Se,0,1),Le?Mh(+Le,Xe):1];if(ax(Ve))return Ve}}return}}const B=k.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(B){const[F,H,X,ee,ne,se,de,me,ge]=B,be=[X||" ",ne||" ",de].join("");if(be===" "||be===" /"||be===",,"||be===",,,"){const Ce=[+H,qf(+ee,0,100),qf(+se,0,100),me?Mh(+me,ge):1];if(ax(Ce))return function([Le,Xe,Be,pe]){function Se(Ve){const at=(Ve+Le/30)%12,Ct=Xe*Math.min(Be,1-Be);return Be-Ct*Math.max(-1,Math.min(at-3,9-at,1))}return Le=CM(Le),Xe/=100,Be/=100,[Se(0),Se(8),Se(4),pe]}(Ce)}}}(f);return _?new fr(..._,!1):void 0}get rgb(){const{r:f,g:_,b:k,a:N}=this,B=N||1/0;return this.overwriteGetter("rgb",[f/B,_/B,k/B,N])}get hcl(){return this.overwriteGetter("hcl",function(f){const[_,k,N,B]=mm(f),F=Math.sqrt(k*k+N*N);return[Math.round(1e4*F)?CM(Math.atan2(N,k)*LR):NaN,F,_,B]}(this.rgb))}get lab(){return this.overwriteGetter("lab",mm(this.rgb))}overwriteGetter(f,_){return Object.defineProperty(this,f,{value:_}),_}toString(){const[f,_,k,N]=this.rgb;return`rgba(${[f,_,k].map(B=>Math.round(255*B)).join(",")},${N})`}static interpolate(f,_,k,N="rgb"){switch(N){case"rgb":{const[B,F,H,X]=Ah(f.rgb,_.rgb,k);return new fr(B,F,H,X,!1)}case"hcl":{const[B,F,H,X]=f.hcl,[ee,ne,se,de]=_.hcl;let me,ge;if(isNaN(B)||isNaN(ee))isNaN(B)?isNaN(ee)?me=NaN:(me=ee,H!==1&&H!==0||(ge=ne)):(me=B,se!==1&&se!==0||(ge=F));else{let Be=ee-B;ee>B&&Be>180?Be-=360:ee180&&(Be+=360),me=B+k*Be}const[be,Ce,Le,Xe]=function([Be,pe,Se,Ve]){return Be=isNaN(Be)?0:Be*Sy,kM([Se,Math.cos(Be)*pe,Math.sin(Be)*pe,Ve])}([me,ge??pc(F,ne,k),pc(H,se,k),pc(X,de,k)]);return new fr(be,Ce,Le,Xe,!1)}case"lab":{const[B,F,H,X]=kM(Ah(f.lab,_.lab,k));return new fr(B,F,H,X,!1)}}}}fr.black=new fr(0,0,0,1),fr.white=new fr(1,1,1,1),fr.transparent=new fr(0,0,0,0),fr.red=new fr(1,0,0,1);class Cy{constructor(f,_,k){this.sensitivity=f?_?"variant":"case":_?"accent":"base",this.locale=k,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(f,_){return this.collator.compare(f,_)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const g_=["bottom","center","top"];class cx{constructor(f,_,k,N,B,F){this.text=f,this.image=_,this.scale=k,this.fontStack=N,this.textColor=B,this.verticalAlign=F}}class ya{constructor(f){this.sections=f}static fromString(f){return new ya([new cx(f,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(f=>f.text.length!==0||f.image&&f.image.name.length!==0)}static factory(f){return f instanceof ya?f:ya.fromString(f)}toString(){return this.sections.length===0?"":this.sections.map(f=>f.text).join("")}}class Yo{constructor(f){this.values=f.slice()}static parse(f){if(f instanceof Yo)return f;if(typeof f=="number")return new Yo([f,f,f,f]);if(Array.isArray(f)&&!(f.length<1||f.length>4)){for(const _ of f)if(typeof _!="number")return;switch(f.length){case 1:f=[f[0],f[0],f[0],f[0]];break;case 2:f=[f[0],f[1],f[0],f[1]];break;case 3:f=[f[0],f[1],f[2],f[1]]}return new Yo(f)}}toString(){return JSON.stringify(this.values)}static interpolate(f,_,k){return new Yo(Ah(f.values,_.values,k))}}class va{constructor(f){this.values=f.slice()}static parse(f){if(f instanceof va)return f;if(typeof f=="number")return new va([f]);if(Array.isArray(f)){for(const _ of f)if(typeof _!="number")return;return new va(f)}}toString(){return JSON.stringify(this.values)}static interpolate(f,_,k){return new va(Ah(f.values,_.values,k))}}class ks{constructor(f){this.values=f.slice()}static parse(f){if(f instanceof ks)return f;if(typeof f=="string"){const k=fr.parse(f);return k?new ks([k]):void 0}if(!Array.isArray(f))return;const _=[];for(const k of f){if(typeof k!="string")return;const N=fr.parse(k);if(!N)return;_.push(N)}return new ks(_)}toString(){return JSON.stringify(this.values)}static interpolate(f,_,k,N="rgb"){const B=[];if(f.values.length!=_.values.length)throw new Error(`colorArray: Arrays have mismatched length (${f.values.length} vs. ${_.values.length}), cannot interpolate.`);for(let F=0;F=0&&b<=255&&typeof f=="number"&&f>=0&&f<=255&&typeof _=="number"&&_>=0&&_<=255?k===void 0||typeof k=="number"&&k>=0&&k<=1?null:`Invalid rgba value [${[b,f,_,k].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof k=="number"?[b,f,_,k]:[b,f,_]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Yf(b){if(b===null||typeof b=="string"||typeof b=="boolean"||typeof b=="number"||b instanceof Zn||b instanceof fr||b instanceof Cy||b instanceof ya||b instanceof Yo||b instanceof va||b instanceof ks||b instanceof Sr||b instanceof cl)return!0;if(Array.isArray(b)){for(const f of b)if(!Yf(f))return!1;return!0}if(typeof b=="object"){for(const f in b)if(!Yf(b[f]))return!1;return!0}return!1}function Ln(b){if(b===null)return Hf;if(typeof b=="string")return nr;if(typeof b=="boolean")return rr;if(typeof b=="number")return Bt;if(b instanceof fr)return Ol;if(b instanceof Zn)return d_;if(b instanceof Cy)return Ch;if(b instanceof ya)return Wf;if(b instanceof Yo)return Vo;if(b instanceof va)return wy;if(b instanceof ks)return by;if(b instanceof Sr)return xy;if(b instanceof cl)return kh;if(Array.isArray(b)){const f=b.length;let _;for(const k of b){const N=Ln(k);if(_){if(_===N)continue;_=ir;break}_=N}return Dl(_||ir,f)}return zu}function Zf(b){const f=typeof b;return b===null?"":f==="string"||f==="number"||f==="boolean"?String(b):b instanceof fr||b instanceof Zn||b instanceof ya||b instanceof Yo||b instanceof va||b instanceof ks||b instanceof Sr||b instanceof cl?b.toString():JSON.stringify(b)}class La{constructor(f,_){this.type=f,this.value=_}static parse(f,_){if(f.length!==2)return _.error(`'literal' expression requires exactly one argument, but found ${f.length-1} instead.`);if(!Yf(f[1]))return _.error("invalid value");const k=f[1];let N=Ln(k);const B=_.expectedType;return N.kind!=="array"||N.N!==0||!B||B.kind!=="array"||typeof B.N=="number"&&B.N!==0||(N=B),new La(N,k)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const gm={string:nr,number:Bt,boolean:rr,object:zu};class mc{constructor(f,_){this.type=f,this.args=_}static parse(f,_){if(f.length<2)return _.error("Expected at least one argument.");let k,N=1;const B=f[0];if(B==="array"){let H,X;if(f.length>2){const ee=f[1];if(typeof ee!="string"||!(ee in gm)||ee==="object")return _.error('The item type argument of "array" must be one of string, number, boolean',1);H=gm[ee],N++}else H=ir;if(f.length>3){if(f[2]!==null&&(typeof f[2]!="number"||f[2]<0||f[2]!==Math.floor(f[2])))return _.error('The length argument to "array" must be a positive integer literal',2);X=f[2],N++}k=Dl(H,X)}else{if(!gm[B])throw new Error(`Types doesn't contain name = ${B}`);k=gm[B]}const F=[];for(;Nf.outputDefined())}}const ux={"to-boolean":rr,"to-color":Ol,"to-number":Bt,"to-string":nr};class ju{constructor(f,_){this.type=f,this.args=_}static parse(f,_){if(f.length<2)return _.error("Expected at least one argument.");const k=f[0];if(!ux[k])throw new Error(`Can't parse ${k} as it is not part of the known types`);if((k==="to-boolean"||k==="to-string")&&f.length!==2)return _.error("Expected one argument.");const N=ux[k],B=[];for(let F=1;F4?`Invalid rgba value ${JSON.stringify(_)}: expected an array containing either three or four numeric values.`:er(_[0],_[1],_[2],_[3]),!k))return new fr(_[0]/255,_[1]/255,_[2]/255,_[3])}throw new ao(k||`Could not parse color from value '${typeof _=="string"?_:JSON.stringify(_)}'`)}case"padding":{let _;for(const k of this.args){_=k.evaluate(f);const N=Yo.parse(_);if(N)return N}throw new ao(`Could not parse padding from value '${typeof _=="string"?_:JSON.stringify(_)}'`)}case"numberArray":{let _;for(const k of this.args){_=k.evaluate(f);const N=va.parse(_);if(N)return N}throw new ao(`Could not parse numberArray from value '${typeof _=="string"?_:JSON.stringify(_)}'`)}case"colorArray":{let _;for(const k of this.args){_=k.evaluate(f);const N=ks.parse(_);if(N)return N}throw new ao(`Could not parse colorArray from value '${typeof _=="string"?_:JSON.stringify(_)}'`)}case"variableAnchorOffsetCollection":{let _;for(const k of this.args){_=k.evaluate(f);const N=Sr.parse(_);if(N)return N}throw new ao(`Could not parse variableAnchorOffsetCollection from value '${typeof _=="string"?_:JSON.stringify(_)}'`)}case"number":{let _=null;for(const k of this.args){if(_=k.evaluate(f),_===null)return 0;const N=Number(_);if(!isNaN(N))return N}throw new ao(`Could not convert ${JSON.stringify(_)} to number.`)}case"formatted":return ya.fromString(Zf(this.args[0].evaluate(f)));case"resolvedImage":return cl.fromString(Zf(this.args[0].evaluate(f)));case"projectionDefinition":return this.args[0].evaluate(f);default:return Zf(this.args[0].evaluate(f))}}eachChild(f){this.args.forEach(f)}outputDefined(){return this.args.every(f=>f.outputDefined())}}const TM=["Unknown","Point","LineString","Polygon"];class MM{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?TM[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(f){let _=this._parseColorCache.get(f);return _||(_=fr.parse(f),this._parseColorCache.set(f,_)),_}}class ky{constructor(f,_,k=[],N,B=new Td,F=[]){this.registry=f,this.path=k,this.key=k.map(H=>`[${H}]`).join(""),this.scope=B,this.errors=F,this.expectedType=N,this._isConstant=_}parse(f,_,k,N,B={}){return _?this.concat(_,k,N)._parse(f,B):this._parse(f,B)}_parse(f,_){function k(N,B,F){return F==="assert"?new mc(B,[N]):F==="coerce"?new ju(B,[N]):N}if(f!==null&&typeof f!="string"&&typeof f!="boolean"&&typeof f!="number"||(f=["literal",f]),Array.isArray(f)){if(f.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const N=f[0];if(typeof N!="string")return this.error(`Expression name must be a string, but found ${typeof N} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const B=this.registry[N];if(B){let F=B.parse(f,this);if(!F)return null;if(this.expectedType){const H=this.expectedType,X=F.type;if(H.kind!=="string"&&H.kind!=="number"&&H.kind!=="boolean"&&H.kind!=="object"&&H.kind!=="array"||X.kind!=="value"){if(H.kind==="projectionDefinition"&&["string","array"].includes(X.kind)||["color","formatted","resolvedImage"].includes(H.kind)&&["value","string"].includes(X.kind)||["padding","numberArray"].includes(H.kind)&&["value","number","array"].includes(X.kind)||H.kind==="colorArray"&&["value","string","array"].includes(X.kind)||H.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(X.kind))F=k(F,H,_.typeAnnotation||"coerce");else if(this.checkSubtype(H,X))return null}else F=k(F,H,_.typeAnnotation||"assert")}if(!(F instanceof La)&&F.type.kind!=="resolvedImage"&&this._isConstant(F)){const H=new MM;try{F=new La(F.type,F.evaluate(H))}catch(X){return this.error(X.message),null}}return F}return this.error(`Unknown expression "${N}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(f===void 0?"'undefined' value invalid. Use null instead.":typeof f=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof f} instead.`)}concat(f,_,k){const N=typeof f=="number"?this.path.concat(f):this.path,B=k?this.scope.concat(k):this.scope;return new ky(this.registry,this._isConstant,N,_||null,B,this.errors)}error(f,..._){const k=`${this.key}${_.map(N=>`[${N}]`).join("")}`;this.errors.push(new oo(k,f))}checkSubtype(f,_){const k=Ey(f,_);return k&&this.error(k),k}}class Ty{constructor(f,_){this.type=_.type,this.bindings=[].concat(f),this.result=_}evaluate(f){return this.result.evaluate(f)}eachChild(f){for(const _ of this.bindings)f(_[1]);f(this.result)}static parse(f,_){if(f.length<4)return _.error(`Expected at least 3 arguments, but found ${f.length-1} instead.`);const k=[];for(let B=1;B=k.length)throw new ao(`Array index out of bounds: ${_} > ${k.length-1}.`);if(_!==Math.floor(_))throw new ao(`Array index must be an integer, but found ${_} instead.`);return k[_]}eachChild(f){f(this.index),f(this.input)}outputDefined(){return!1}}class ym{constructor(f,_){this.type=rr,this.needle=f,this.haystack=_}static parse(f,_){if(f.length!==3)return _.error(`Expected 2 arguments, but found ${f.length-1} instead.`);const k=_.parse(f[1],1,ir),N=_.parse(f[2],2,ir);return k&&N?f_(k.type,[rr,nr,Bt,Hf,ir])?new ym(k,N):_.error(`Expected first argument to be of type boolean, string, number or null, but found ${so(k.type)} instead`):null}evaluate(f){const _=this.needle.evaluate(f),k=this.haystack.evaluate(f);if(!k)return!1;if(!Gf(_,["boolean","string","number","null"]))throw new ao(`Expected first argument to be of type boolean, string, number or null, but found ${so(Ln(_))} instead.`);if(!Gf(k,["string","array"]))throw new ao(`Expected second argument to be of type array or string, but found ${so(Ln(k))} instead.`);return k.indexOf(_)>=0}eachChild(f){f(this.needle),f(this.haystack)}outputDefined(){return!0}}class My{constructor(f,_,k){this.type=Bt,this.needle=f,this.haystack=_,this.fromIndex=k}static parse(f,_){if(f.length<=2||f.length>=5)return _.error(`Expected 3 or 4 arguments, but found ${f.length-1} instead.`);const k=_.parse(f[1],1,ir),N=_.parse(f[2],2,ir);if(!k||!N)return null;if(!f_(k.type,[rr,nr,Bt,Hf,ir]))return _.error(`Expected first argument to be of type boolean, string, number or null, but found ${so(k.type)} instead`);if(f.length===4){const B=_.parse(f[3],3,Bt);return B?new My(k,N,B):null}return new My(k,N)}evaluate(f){const _=this.needle.evaluate(f),k=this.haystack.evaluate(f);if(!Gf(_,["boolean","string","number","null"]))throw new ao(`Expected first argument to be of type boolean, string, number or null, but found ${so(Ln(_))} instead.`);let N;if(this.fromIndex&&(N=this.fromIndex.evaluate(f)),Gf(k,["string"])){const B=k.indexOf(_,N);return B===-1?-1:[...k.slice(0,B)].length}if(Gf(k,["array"]))return k.indexOf(_,N);throw new ao(`Expected second argument to be of type array or string, but found ${so(Ln(k))} instead.`)}eachChild(f){f(this.needle),f(this.haystack),this.fromIndex&&f(this.fromIndex)}outputDefined(){return!1}}class vm{constructor(f,_,k,N,B,F){this.inputType=f,this.type=_,this.input=k,this.cases=N,this.outputs=B,this.otherwise=F}static parse(f,_){if(f.length<5)return _.error(`Expected at least 4 arguments, but found only ${f.length-1}.`);if(f.length%2!=1)return _.error("Expected an even number of arguments.");let k,N;_.expectedType&&_.expectedType.kind!=="value"&&(N=_.expectedType);const B={},F=[];for(let ee=2;eeNumber.MAX_SAFE_INTEGER)return de.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof ge=="number"&&Math.floor(ge)!==ge)return de.error("Numeric branch labels must be integer values.");if(k){if(de.checkSubtype(k,Ln(ge)))return null}else k=Ln(ge);if(B[String(ge)]!==void 0)return de.error("Branch labels must be unique.");B[String(ge)]=F.length}const me=_.parse(se,ee,N);if(!me)return null;N=N||me.type,F.push(me)}const H=_.parse(f[1],1,ir);if(!H)return null;const X=_.parse(f[f.length-1],f.length-1,N);return X?H.type.kind!=="value"&&_.concat(1).checkSubtype(k,H.type)?null:new vm(k,N,H,B,F,X):null}evaluate(f){const _=this.input.evaluate(f);return(Ln(_)===this.inputType&&this.outputs[this.cases[_]]||this.otherwise).evaluate(f)}eachChild(f){f(this.input),this.outputs.forEach(f),f(this.otherwise)}outputDefined(){return this.outputs.every(f=>f.outputDefined())&&this.otherwise.outputDefined()}}class Zo{constructor(f,_,k){this.type=f,this.branches=_,this.otherwise=k}static parse(f,_){if(f.length<4)return _.error(`Expected at least 3 arguments, but found only ${f.length-1}.`);if(f.length%2!=0)return _.error("Expected an odd number of arguments.");let k;_.expectedType&&_.expectedType.kind!=="value"&&(k=_.expectedType);const N=[];for(let F=1;F_.outputDefined())&&this.otherwise.outputDefined()}}class Ay{constructor(f,_,k,N){this.type=f,this.input=_,this.beginIndex=k,this.endIndex=N}static parse(f,_){if(f.length<=2||f.length>=5)return _.error(`Expected 3 or 4 arguments, but found ${f.length-1} instead.`);const k=_.parse(f[1],1,ir),N=_.parse(f[2],2,Bt);if(!k||!N)return null;if(!f_(k.type,[Dl(ir),nr,ir]))return _.error(`Expected first argument to be of type array or string, but found ${so(k.type)} instead`);if(f.length===4){const B=_.parse(f[3],3,Bt);return B?new Ay(k.type,k,N,B):null}return new Ay(k.type,k,N)}evaluate(f){const _=this.input.evaluate(f),k=this.beginIndex.evaluate(f);let N;if(this.endIndex&&(N=this.endIndex.evaluate(f)),Gf(_,["string"]))return[..._].slice(k,N).join("");if(Gf(_,["array"]))return _.slice(k,N);throw new ao(`Expected first argument to be of type array or string, but found ${so(Ln(_))} instead.`)}eachChild(f){f(this.input),f(this.beginIndex),this.endIndex&&f(this.endIndex)}outputDefined(){return!1}}function _m(b,f){const _=b.length-1;let k,N,B=0,F=_,H=0;for(;B<=F;)if(H=Math.floor((B+F)/2),k=b[H],N=b[H+1],k<=f){if(H===_||ff))throw new ao("Input is not a number.");F=H-1}return 0}class bm{constructor(f,_,k){this.type=f,this.input=_,this.labels=[],this.outputs=[];for(const[N,B]of k)this.labels.push(N),this.outputs.push(B)}static parse(f,_){if(f.length-1<4)return _.error(`Expected at least 4 arguments, but found only ${f.length-1}.`);if((f.length-1)%2!=0)return _.error("Expected an even number of arguments.");const k=_.parse(f[1],1,Bt);if(!k)return null;const N=[];let B=null;_.expectedType&&_.expectedType.kind!=="value"&&(B=_.expectedType);for(let F=1;F=H)return _.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',ee);const se=_.parse(X,ne,B);if(!se)return null;B=B||se.type,N.push([H,se])}return new bm(B,k,N)}evaluate(f){const _=this.labels,k=this.outputs;if(_.length===1)return k[0].evaluate(f);const N=this.input.evaluate(f);if(N<=_[0])return k[0].evaluate(f);const B=_.length;return N>=_[B-1]?k[B-1].evaluate(f):k[_m(_,N)].evaluate(f)}eachChild(f){f(this.input);for(const _ of this.outputs)f(_)}outputDefined(){return this.outputs.every(f=>f.outputDefined())}}function PR(b){return b&&b.__esModule&&Object.prototype.hasOwnProperty.call(b,"default")?b.default:b}var Ad,Iy,hx=function(){if(Iy)return Ad;function b(f,_,k,N){this.cx=3*f,this.bx=3*(k-f)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*_,this.by=3*(N-_)-this.cy,this.ay=1-this.cy-this.by,this.p1x=f,this.p1y=_,this.p2x=k,this.p2y=N}return Iy=1,Ad=b,b.prototype={sampleCurveX:function(f){return((this.ax*f+this.bx)*f+this.cx)*f},sampleCurveY:function(f){return((this.ay*f+this.by)*f+this.cy)*f},sampleCurveDerivativeX:function(f){return(3*this.ax*f+2*this.bx)*f+this.cx},solveCurveX:function(f,_){if(_===void 0&&(_=1e-6),f<0)return 0;if(f>1)return 1;for(var k=f,N=0;N<8;N++){var B=this.sampleCurveX(k)-f;if(Math.abs(B)<_)return k;var F=this.sampleCurveDerivativeX(k);if(Math.abs(F)<1e-6)break;k-=B/F}var H=0,X=1;for(k=f,N=0;N<20&&(B=this.sampleCurveX(k),!(Math.abs(B-f)<_));N++)f>B?H=k:X=k,k=.5*(X-H)+H;return k},solve:function(f,_){return this.sampleCurveY(this.solveCurveX(f,_))}},Ad}(),NR=PR(hx);class Pa{constructor(f,_,k,N,B){this.type=f,this.operator=_,this.interpolation=k,this.input=N,this.labels=[],this.outputs=[];for(const[F,H]of B)this.labels.push(F),this.outputs.push(H)}static interpolationFactor(f,_,k,N){let B=0;if(f.name==="exponential")B=wm(_,f.base,k,N);else if(f.name==="linear")B=wm(_,1,k,N);else if(f.name==="cubic-bezier"){const F=f.controlPoints;B=new NR(F[0],F[1],F[2],F[3]).solve(wm(_,1,k,N))}return B}static parse(f,_){let[k,N,B,...F]=f;if(!Array.isArray(N)||N.length===0)return _.error("Expected an interpolation type expression.",1);if(N[0]==="linear")N={name:"linear"};else if(N[0]==="exponential"){const ee=N[1];if(typeof ee!="number")return _.error("Exponential interpolation requires a numeric base.",1,1);N={name:"exponential",base:ee}}else{if(N[0]!=="cubic-bezier")return _.error(`Unknown interpolation type ${String(N[0])}`,1,0);{const ee=N.slice(1);if(ee.length!==4||ee.some(ne=>typeof ne!="number"||ne<0||ne>1))return _.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);N={name:"cubic-bezier",controlPoints:ee}}}if(f.length-1<4)return _.error(`Expected at least 4 arguments, but found only ${f.length-1}.`);if((f.length-1)%2!=0)return _.error("Expected an even number of arguments.");if(B=_.parse(B,2,Bt),!B)return null;const H=[];let X=null;k!=="interpolate-hcl"&&k!=="interpolate-lab"||_.expectedType==by?_.expectedType&&_.expectedType.kind!=="value"&&(X=_.expectedType):X=Ol;for(let ee=0;ee=ne)return _.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',de);const ge=_.parse(se,me,X);if(!ge)return null;X=X||ge.type,H.push([ne,ge])}return Md(X,Bt)||Md(X,d_)||Md(X,Ol)||Md(X,Vo)||Md(X,wy)||Md(X,by)||Md(X,xy)||Md(X,Dl(Bt))?new Pa(X,k,N,B,H):_.error(`Type ${so(X)} is not interpolatable.`)}evaluate(f){const _=this.labels,k=this.outputs;if(_.length===1)return k[0].evaluate(f);const N=this.input.evaluate(f);if(N<=_[0])return k[0].evaluate(f);const B=_.length;if(N>=_[B-1])return k[B-1].evaluate(f);const F=_m(_,N),H=Pa.interpolationFactor(this.interpolation,N,_[F],_[F+1]),X=k[F].evaluate(f),ee=k[F+1].evaluate(f);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return pc(X,ee,H);case"color":return fr.interpolate(X,ee,H);case"padding":return Yo.interpolate(X,ee,H);case"colorArray":return ks.interpolate(X,ee,H);case"numberArray":return va.interpolate(X,ee,H);case"variableAnchorOffsetCollection":return Sr.interpolate(X,ee,H);case"array":return Ah(X,ee,H);case"projectionDefinition":return Zn.interpolate(X,ee,H)}case"interpolate-hcl":switch(this.type.kind){case"color":return fr.interpolate(X,ee,H,"hcl");case"colorArray":return ks.interpolate(X,ee,H,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return fr.interpolate(X,ee,H,"lab");case"colorArray":return ks.interpolate(X,ee,H,"lab")}}}eachChild(f){f(this.input);for(const _ of this.outputs)f(_)}outputDefined(){return this.outputs.every(f=>f.outputDefined())}}function wm(b,f,_,k){const N=k-_,B=b-_;return N===0?0:f===1?B/N:(Math.pow(f,B)-1)/(Math.pow(f,N)-1)}const Rl={color:fr.interpolate,number:pc,padding:Yo.interpolate,numberArray:va.interpolate,colorArray:ks.interpolate,variableAnchorOffsetCollection:Sr.interpolate,array:Ah};class ul{constructor(f,_){this.type=f,this.args=_}static parse(f,_){if(f.length<2)return _.error("Expected at least one argument.");let k=null;const N=_.expectedType;N&&N.kind!=="value"&&(k=N);const B=[];for(const H of f.slice(1)){const X=_.parse(H,1+B.length,k,void 0,{typeAnnotation:"omit"});if(!X)return null;k=k||X.type,B.push(X)}if(!k)throw new Error("No output type");const F=N&&B.some(H=>Ey(N,H.type));return new ul(F?ir:k,B)}evaluate(f){let _,k=null,N=0;for(const B of this.args)if(N++,k=B.evaluate(f),k&&k instanceof cl&&!k.available&&(_||(_=k.name),k=null,N===this.args.length&&(k=_)),k!==null)break;return k}eachChild(f){this.args.forEach(f)}outputDefined(){return this.args.every(f=>f.outputDefined())}}function dx(b,f){return b==="=="||b==="!="?f.kind==="boolean"||f.kind==="string"||f.kind==="number"||f.kind==="null"||f.kind==="value":f.kind==="string"||f.kind==="number"||f.kind==="value"}function Ly(b,f,_,k){return k.compare(f,_)===0}function xm(b,f,_){const k=b!=="=="&&b!=="!=";return class RK{constructor(B,F,H){this.type=rr,this.lhs=B,this.rhs=F,this.collator=H,this.hasUntypedArgument=B.type.kind==="value"||F.type.kind==="value"}static parse(B,F){if(B.length!==3&&B.length!==4)return F.error("Expected two or three arguments.");const H=B[0];let X=F.parse(B[1],1,ir);if(!X)return null;if(!dx(H,X.type))return F.concat(1).error(`"${H}" comparisons are not supported for type '${so(X.type)}'.`);let ee=F.parse(B[2],2,ir);if(!ee)return null;if(!dx(H,ee.type))return F.concat(2).error(`"${H}" comparisons are not supported for type '${so(ee.type)}'.`);if(X.type.kind!==ee.type.kind&&X.type.kind!=="value"&&ee.type.kind!=="value")return F.error(`Cannot compare types '${so(X.type)}' and '${so(ee.type)}'.`);k&&(X.type.kind==="value"&&ee.type.kind!=="value"?X=new mc(ee.type,[X]):X.type.kind!=="value"&&ee.type.kind==="value"&&(ee=new mc(X.type,[ee])));let ne=null;if(B.length===4){if(X.type.kind!=="string"&&ee.type.kind!=="string"&&X.type.kind!=="value"&&ee.type.kind!=="value")return F.error("Cannot use collator to compare non-string types.");if(ne=F.parse(B[3],3,Ch),!ne)return null}return new RK(X,ee,ne)}evaluate(B){const F=this.lhs.evaluate(B),H=this.rhs.evaluate(B);if(k&&this.hasUntypedArgument){const X=Ln(F),ee=Ln(H);if(X.kind!==ee.kind||X.kind!=="string"&&X.kind!=="number")throw new ao(`Expected arguments for "${b}" to be (string, string) or (number, number), but found (${X.kind}, ${ee.kind}) instead.`)}if(this.collator&&!k&&this.hasUntypedArgument){const X=Ln(F),ee=Ln(H);if(X.kind!=="string"||ee.kind!=="string")return f(B,F,H)}return this.collator?_(B,F,H,this.collator.evaluate(B)):f(B,F,H)}eachChild(B){B(this.lhs),B(this.rhs),this.collator&&B(this.collator)}outputDefined(){return!0}}}const fx=xm("==",function(b,f,_){return f===_},Ly),OR=xm("!=",function(b,f,_){return f!==_},function(b,f,_,k){return!Ly(0,f,_,k)}),DR=xm("<",function(b,f,_){return f<_},function(b,f,_,k){return k.compare(f,_)<0}),RR=xm(">",function(b,f,_){return f>_},function(b,f,_,k){return k.compare(f,_)>0}),BR=xm("<=",function(b,f,_){return f<=_},function(b,f,_,k){return k.compare(f,_)<=0}),v_=xm(">=",function(b,f,_){return f>=_},function(b,f,_,k){return k.compare(f,_)>=0});class __{constructor(f,_,k){this.type=Ch,this.locale=k,this.caseSensitive=f,this.diacriticSensitive=_}static parse(f,_){if(f.length!==2)return _.error("Expected one argument.");const k=f[1];if(typeof k!="object"||Array.isArray(k))return _.error("Collator options argument must be an object.");const N=_.parse(k["case-sensitive"]!==void 0&&k["case-sensitive"],1,rr);if(!N)return null;const B=_.parse(k["diacritic-sensitive"]!==void 0&&k["diacritic-sensitive"],1,rr);if(!B)return null;let F=null;return k.locale&&(F=_.parse(k.locale,1,nr),!F)?null:new __(N,B,F)}evaluate(f){return new Cy(this.caseSensitive.evaluate(f),this.diacriticSensitive.evaluate(f),this.locale?this.locale.evaluate(f):null)}eachChild(f){f(this.caseSensitive),f(this.diacriticSensitive),this.locale&&f(this.locale)}outputDefined(){return!1}}class b_{constructor(f,_,k,N,B){this.type=nr,this.number=f,this.locale=_,this.currency=k,this.minFractionDigits=N,this.maxFractionDigits=B}static parse(f,_){if(f.length!==3)return _.error("Expected two arguments.");const k=_.parse(f[1],1,Bt);if(!k)return null;const N=f[2];if(typeof N!="object"||Array.isArray(N))return _.error("NumberFormat options argument must be an object.");let B=null;if(N.locale&&(B=_.parse(N.locale,1,nr),!B))return null;let F=null;if(N.currency&&(F=_.parse(N.currency,1,nr),!F))return null;let H=null;if(N["min-fraction-digits"]&&(H=_.parse(N["min-fraction-digits"],1,Bt),!H))return null;let X=null;return N["max-fraction-digits"]&&(X=_.parse(N["max-fraction-digits"],1,Bt),!X)?null:new b_(k,B,F,H,X)}evaluate(f){return new Intl.NumberFormat(this.locale?this.locale.evaluate(f):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(f):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(f):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(f):void 0}).format(this.number.evaluate(f))}eachChild(f){f(this.number),this.locale&&f(this.locale),this.currency&&f(this.currency),this.minFractionDigits&&f(this.minFractionDigits),this.maxFractionDigits&&f(this.maxFractionDigits)}outputDefined(){return!1}}class Py{constructor(f){this.type=Wf,this.sections=f}static parse(f,_){if(f.length<2)return _.error("Expected at least one argument.");const k=f[1];if(!Array.isArray(k)&&typeof k=="object")return _.error("First argument must be an image or text section.");const N=[];let B=!1;for(let F=1;F<=f.length-1;++F){const H=f[F];if(B&&typeof H=="object"&&!Array.isArray(H)){B=!1;let X=null;if(H["font-scale"]&&(X=_.parse(H["font-scale"],1,Bt),!X))return null;let ee=null;if(H["text-font"]&&(ee=_.parse(H["text-font"],1,Dl(nr)),!ee))return null;let ne=null;if(H["text-color"]&&(ne=_.parse(H["text-color"],1,Ol),!ne))return null;let se=null;if(H["vertical-align"]){if(typeof H["vertical-align"]=="string"&&!g_.includes(H["vertical-align"]))return _.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${H["vertical-align"]}' instead.`);if(se=_.parse(H["vertical-align"],1,nr),!se)return null}const de=N[N.length-1];de.scale=X,de.font=ee,de.textColor=ne,de.verticalAlign=se}else{const X=_.parse(f[F],1,ir);if(!X)return null;const ee=X.type.kind;if(ee!=="string"&&ee!=="value"&&ee!=="null"&&ee!=="resolvedImage")return _.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");B=!0,N.push({content:X,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Py(N)}evaluate(f){return new ya(this.sections.map(_=>{const k=_.content.evaluate(f);return Ln(k)===kh?new cx("",k,null,null,null,_.verticalAlign?_.verticalAlign.evaluate(f):null):new cx(Zf(k),null,_.scale?_.scale.evaluate(f):null,_.font?_.font.evaluate(f).join(","):null,_.textColor?_.textColor.evaluate(f):null,_.verticalAlign?_.verticalAlign.evaluate(f):null)}))}eachChild(f){for(const _ of this.sections)f(_.content),_.scale&&f(_.scale),_.font&&f(_.font),_.textColor&&f(_.textColor),_.verticalAlign&&f(_.verticalAlign)}outputDefined(){return!1}}class px{constructor(f){this.type=kh,this.input=f}static parse(f,_){if(f.length!==2)return _.error("Expected two arguments.");const k=_.parse(f[1],1,nr);return k?new px(k):_.error("No image name provided.")}evaluate(f){const _=this.input.evaluate(f),k=cl.fromString(_);return k&&f.availableImages&&(k.available=f.availableImages.indexOf(_)>-1),k}eachChild(f){f(this.input)}outputDefined(){return!1}}class w_{constructor(f){this.type=Bt,this.input=f}static parse(f,_){if(f.length!==2)return _.error(`Expected 1 argument, but found ${f.length-1} instead.`);const k=_.parse(f[1],1);return k?k.type.kind!=="array"&&k.type.kind!=="string"&&k.type.kind!=="value"?_.error(`Expected argument of type string or array, but found ${so(k.type)} instead.`):new w_(k):null}evaluate(f){const _=this.input.evaluate(f);if(typeof _=="string")return[..._].length;if(Array.isArray(_))return _.length;throw new ao(`Expected value to be of type string or array, but found ${so(Ln(_))} instead.`)}eachChild(f){f(this.input)}outputDefined(){return!1}}const Uu=8192;function FR(b,f){const _=(180+b[0])/360,k=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+b[1]*Math.PI/360)))/360,N=Math.pow(2,f.z);return[Math.round(_*N*Uu),Math.round(k*N*Uu)]}function mx(b,f){const _=Math.pow(2,f.z);return[(N=(b[0]/Uu+f.x)/_,360*N-180),(k=(b[1]/Uu+f.y)/_,360/Math.PI*Math.atan(Math.exp((180-360*k)*Math.PI/180))-90)];var k,N}function Ny(b,f){b[0]=Math.min(b[0],f[0]),b[1]=Math.min(b[1],f[1]),b[2]=Math.max(b[2],f[0]),b[3]=Math.max(b[3],f[1])}function Oy(b,f){return!(b[0]<=f[0]||b[2]>=f[2]||b[1]<=f[1]||b[3]>=f[3])}function AM(b,f,_){const k=b[0]-f[0],N=b[1]-f[1],B=b[0]-_[0],F=b[1]-_[1];return k*F-B*N==0&&k*B<=0&&N*F<=0}function Dy(b,f,_,k){return(N=[k[0]-_[0],k[1]-_[1]])[0]*(B=[f[0]-b[0],f[1]-b[1]])[1]-N[1]*B[0]!=0&&!(!x_(b,f,_,k)||!x_(_,k,b,f));var N,B}function IM(b,f,_){for(const k of _)for(let N=0;N(N=b)[1]!=(F=H[X+1])[1]>N[1]&&N[0]<(F[0]-B[0])*(N[1]-B[1])/(F[1]-B[1])+B[0]&&(k=!k)}var N,B,F;return k}function $R(b,f){for(const _ of f)if(Em(b,_))return!0;return!1}function LM(b,f){for(const _ of b)if(!Em(_,f))return!1;for(let _=0;_0&&H<0||F<0&&H>0}function gx(b,f,_){const k=[];for(let N=0;N_[2]){const N=.5*k;let B=b[0]-_[0]>N?-k:_[0]-b[0]>N?k:0;B===0&&(B=b[0]-_[2]>N?-k:_[2]-b[0]>N?k:0),b[0]+=B}Ny(f,b)}function yx(b,f,_,k){const N=Math.pow(2,k.z)*Uu,B=[k.x*Uu,k.y*Uu],F=[];for(const H of b)for(const X of H){const ee=[X.x+B[0],X.y+B[1]];NM(ee,f,_,N),F.push(ee)}return F}function vx(b,f,_,k){const N=Math.pow(2,k.z)*Uu,B=[k.x*Uu,k.y*Uu],F=[];for(const X of b){const ee=[];for(const ne of X){const se=[ne.x+B[0],ne.y+B[1]];Ny(f,se),ee.push(se)}F.push(ee)}if(f[2]-f[0]<=N/2){(H=f)[0]=H[1]=1/0,H[2]=H[3]=-1/0;for(const X of F)for(const ee of X)NM(ee,f,_,N)}var H;return F}class Xf{constructor(f,_){this.type=rr,this.geojson=f,this.geometries=_}static parse(f,_){if(f.length!==2)return _.error(`'within' expression requires exactly one argument, but found ${f.length-1} instead.`);if(Yf(f[1])){const k=f[1];if(k.type==="FeatureCollection"){const N=[];for(const B of k.features){const{type:F,coordinates:H}=B.geometry;F==="Polygon"&&N.push(H),F==="MultiPolygon"&&N.push(...H)}if(N.length)return new Xf(k,{type:"MultiPolygon",coordinates:N})}else if(k.type==="Feature"){const N=k.geometry.type;if(N==="Polygon"||N==="MultiPolygon")return new Xf(k,k.geometry)}else if(k.type==="Polygon"||k.type==="MultiPolygon")return new Xf(k,k)}return _.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(f){if(f.geometry()!=null&&f.canonicalID()!=null){if(f.geometryType()==="Point")return function(_,k){const N=[1/0,1/0,-1/0,-1/0],B=[1/0,1/0,-1/0,-1/0],F=_.canonicalID();if(k.type==="Polygon"){const H=gx(k.coordinates,B,F),X=yx(_.geometry(),N,B,F);if(!Oy(N,B))return!1;for(const ee of X)if(!Em(ee,H))return!1}if(k.type==="MultiPolygon"){const H=PM(k.coordinates,B,F),X=yx(_.geometry(),N,B,F);if(!Oy(N,B))return!1;for(const ee of X)if(!$R(ee,H))return!1}return!0}(f,this.geometries);if(f.geometryType()==="LineString")return function(_,k){const N=[1/0,1/0,-1/0,-1/0],B=[1/0,1/0,-1/0,-1/0],F=_.canonicalID();if(k.type==="Polygon"){const H=gx(k.coordinates,B,F),X=vx(_.geometry(),N,B,F);if(!Oy(N,B))return!1;for(const ee of X)if(!LM(ee,H))return!1}if(k.type==="MultiPolygon"){const H=PM(k.coordinates,B,F),X=vx(_.geometry(),N,B,F);if(!Oy(N,B))return!1;for(const ee of X)if(!zR(ee,H))return!1}return!0}(f,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let OM=class{constructor(b=[],f=(_,k)=>_k?1:0){if(this.data=b,this.length=this.data.length,this.compare=f,this.length>0)for(let _=(this.length>>1)-1;_>=0;_--)this._down(_)}push(b){this.data.push(b),this._up(this.length++)}pop(){if(this.length===0)return;const b=this.data[0],f=this.data.pop();return--this.length>0&&(this.data[0]=f,this._down(0)),b}peek(){return this.data[0]}_up(b){const{data:f,compare:_}=this,k=f[b];for(;b>0;){const N=b-1>>1,B=f[N];if(_(k,B)>=0)break;f[b]=B,b=N}f[b]=k}_down(b){const{data:f,compare:_}=this,k=this.length>>1,N=f[b];for(;b=0)break;f[b]=f[B],b=B}f[b]=N}};function _x(b,f,_=0,k=b.length-1,N=VR){for(;k>_;){if(k-_>600){const X=k-_+1,ee=f-_+1,ne=Math.log(X),se=.5*Math.exp(2*ne/3),de=.5*Math.sqrt(ne*se*(X-se)/X)*(ee-X/2<0?-1:1);_x(b,f,Math.max(_,Math.floor(f-ee*se/X+de)),Math.min(k,Math.floor(f+(X-ee)*se/X+de)),N)}const B=b[f];let F=_,H=k;for(Sm(b,_,f),N(b[k],B)>0&&Sm(b,_,k);F0;)H--}N(b[_],B)===0?Sm(b,_,H):(H++,Sm(b,H,k)),H<=f&&(_=H+1),f<=H&&(k=H-1)}}function Sm(b,f,_){const k=b[f];b[f]=b[_],b[_]=k}function VR(b,f){return bf?1:0}function E_(b,f){if(b.length<=1)return[b];const _=[];let k,N;for(const B of b){const F=DM(B);F!==0&&(B.area=Math.abs(F),N===void 0&&(N=F<0),N===F<0?(k&&_.push(k),k=[B]):k.push(B))}if(k&&_.push(k),f>1)for(let B=0;B<_.length;B++)_[B].length<=f||(_x(_[B],f,1,_[B].length-1,jR),_[B]=_[B].slice(0,f));return _}function jR(b,f){return f.area-b.area}function DM(b){let f=0;for(let _,k,N=0,B=b.length,F=B-1;N1?(ee=f[X+1][0],ne=f[X+1][1]):me>0&&(ee+=se/this.kx*me,ne+=de/this.ky*me)),se=this.wrap(_[0]-ee)*this.kx,de=(_[1]-ne)*this.ky;const ge=se*se+de*de;ge180;)f-=360;return f}}function hi(b,f){return f[0]-b[0]}function S_(b){return b[1]-b[0]+1}function Ih(b,f){return b[1]>=b[0]&&b[1]b[1])return[null,null];const _=S_(b);if(f){if(_===2)return[b,null];const N=Math.floor(_/2);return[[b[0],b[0]+N],[b[0]+N,b[1]]]}if(_===1)return[b,null];const k=Math.floor(_/2)-1;return[[b[0],b[0]+k],[b[0]+k+1,b[1]]]}function xx(b,f){if(!Ih(f,b.length))return[1/0,1/0,-1/0,-1/0];const _=[1/0,1/0,-1/0,-1/0];for(let k=f[0];k<=f[1];++k)Ny(_,b[k]);return _}function Ex(b){const f=[1/0,1/0,-1/0,-1/0];for(const _ of b)for(const k of _)Ny(f,k);return f}function $M(b){return b[0]!==-1/0&&b[1]!==-1/0&&b[2]!==1/0&&b[3]!==1/0}function Sx(b,f,_){if(!$M(b)||!$M(f))return NaN;let k=0,N=0;return b[2]f[2]&&(k=b[0]-f[2]),b[1]>f[3]&&(N=b[1]-f[3]),b[3]=k)return k;if(Oy(N,B)){if(zM(b,f))return 0}else if(zM(f,b))return 0;let F=1/0;for(const H of b)for(let X=0,ee=H.length,ne=ee-1;X0;){const X=F.pop();if(X[0]>=B)continue;const ee=X[1],ne=f?50:100;if(S_(ee)<=ne){if(!Ih(ee,b.length))return NaN;if(f){const se=GR(b,ee,_,k);if(isNaN(se)||se===0)return se;B=Math.min(B,se)}else for(let se=ee[0];se<=ee[1];++se){const de=WR(b[se],_,k);if(B=Math.min(B,de),B===0)return 0}}else{const se=wx(ee,f);VM(F,B,k,b,H,se[0]),VM(F,B,k,b,H,se[1])}}return B}function T_(b,f,_,k,N,B=1/0){let F=Math.min(B,N.distance(b[0],_[0]));if(F===0)return F;const H=new OM([[0,[0,b.length-1],[0,_.length-1]]],hi);for(;H.length>0;){const X=H.pop();if(X[0]>=F)continue;const ee=X[1],ne=X[2],se=f?50:100,de=k?50:100;if(S_(ee)<=se&&S_(ne)<=de){if(!Ih(ee,b.length)&&Ih(ne,_.length))return NaN;let me;if(f&&k)me=UR(b,ee,_,ne,N),F=Math.min(F,me);else if(f&&!k){const ge=b.slice(ee[0],ee[1]+1);for(let be=ne[0];be<=ne[1];++be)if(me=Kf(_[be],ge,N),F=Math.min(F,me),F===0)return F}else if(!f&&k){const ge=_.slice(ne[0],ne[1]+1);for(let be=ee[0];be<=ee[1];++be)if(me=Kf(b[be],ge,N),F=Math.min(F,me),F===0)return F}else me=HR(b,ee,_,ne,N),F=Math.min(F,me)}else{const me=wx(ee,f),ge=wx(ne,k);C_(H,F,N,b,_,me[0],ge[0]),C_(H,F,N,b,_,me[0],ge[1]),C_(H,F,N,b,_,me[1],ge[0]),C_(H,F,N,b,_,me[1],ge[1])}}return F}function kx(b){return b.type==="MultiPolygon"?b.coordinates.map(f=>({type:"Polygon",coordinates:f})):b.type==="MultiLineString"?b.coordinates.map(f=>({type:"LineString",coordinates:f})):b.type==="MultiPoint"?b.coordinates.map(f=>({type:"Point",coordinates:f})):[b]}class Jf{constructor(f,_){this.type=Bt,this.geojson=f,this.geometries=_}static parse(f,_){if(f.length!==2)return _.error(`'distance' expression requires exactly one argument, but found ${f.length-1} instead.`);if(Yf(f[1])){const k=f[1];if(k.type==="FeatureCollection")return new Jf(k,k.features.map(N=>kx(N.geometry)).flat());if(k.type==="Feature")return new Jf(k,kx(k.geometry));if("type"in k&&"coordinates"in k)return new Jf(k,kx(k))}return _.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(f){if(f.geometry()!=null&&f.canonicalID()!=null){if(f.geometryType()==="Point")return function(_,k){const N=_.geometry(),B=N.flat().map(X=>mx([X.x,X.y],_.canonical));if(N.length===0)return NaN;const F=new bx(B[0][1]);let H=1/0;for(const X of k){switch(X.type){case"Point":H=Math.min(H,T_(B,!1,[X.coordinates],!1,F,H));break;case"LineString":H=Math.min(H,T_(B,!1,X.coordinates,!0,F,H));break;case"Polygon":H=Math.min(H,k_(B,!1,X.coordinates,F,H))}if(H===0)return H}return H}(f,this.geometries);if(f.geometryType()==="LineString")return function(_,k){const N=_.geometry(),B=N.flat().map(X=>mx([X.x,X.y],_.canonical));if(N.length===0)return NaN;const F=new bx(B[0][1]);let H=1/0;for(const X of k){switch(X.type){case"Point":H=Math.min(H,T_(B,!0,[X.coordinates],!1,F,H));break;case"LineString":H=Math.min(H,T_(B,!0,X.coordinates,!0,F,H));break;case"Polygon":H=Math.min(H,k_(B,!0,X.coordinates,F,H))}if(H===0)return H}return H}(f,this.geometries);if(f.geometryType()==="Polygon")return function(_,k){const N=_.geometry();if(N.length===0||N[0].length===0)return NaN;const B=E_(N,0).map(X=>X.map(ee=>ee.map(ne=>mx([ne.x,ne.y],_.canonical)))),F=new bx(B[0][0][0][1]);let H=1/0;for(const X of k)for(const ee of B){switch(X.type){case"Point":H=Math.min(H,k_([X.coordinates],!1,ee,F,H));break;case"LineString":H=Math.min(H,k_(X.coordinates,!0,ee,F,H));break;case"Polygon":H=Math.min(H,qR(ee,X.coordinates,F,H))}if(H===0)return H}return H}(f,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Ry{constructor(f){this.type=ir,this.key=f}static parse(f,_){if(f.length!==2)return _.error(`Expected 1 argument, but found ${f.length-1} instead.`);const k=f[1];return k==null?_.error("Global state property must be defined."):typeof k!="string"?_.error(`Global state property must be string, but found ${typeof f[1]} instead.`):new Ry(k)}evaluate(f){var _;const k=(_=f.globals)===null||_===void 0?void 0:_.globalState;return k&&Object.keys(k).length!==0?dr(k,this.key):null}eachChild(){}outputDefined(){return!1}}const Cm={"==":fx,"!=":OR,">":RR,"<":DR,">=":v_,"<=":BR,array:mc,at:Ts,boolean:mc,case:Zo,coalesce:ul,collator:__,format:Py,image:px,in:ym,"index-of":My,interpolate:Pa,"interpolate-hcl":Pa,"interpolate-lab":Pa,length:w_,let:Ty,literal:La,match:vm,number:mc,"number-format":b_,object:mc,slice:Ay,step:bm,string:mc,"to-boolean":ju,"to-color":ju,"to-number":ju,"to-string":ju,var:Hc,within:Xf,distance:Jf,"global-state":Ry};class gc{constructor(f,_,k,N){this.name=f,this.type=_,this._evaluate=k,this.args=N}evaluate(f){return this._evaluate(f,this.args)}eachChild(f){this.args.forEach(f)}outputDefined(){return!1}static parse(f,_){const k=f[0],N=gc.definitions[k];if(!N)return _.error(`Unknown expression "${k}". If you wanted a literal array, use ["literal", [...]].`,0);const B=Array.isArray(N)?N[0]:N.type,F=Array.isArray(N)?[[N[1],N[2]]]:N.overloads,H=F.filter(([ee])=>!Array.isArray(ee)||ee.length===f.length-1);let X=null;for(const[ee,ne]of H){X=new ky(_.registry,M_,_.path,null,_.scope);const se=[];let de=!1;for(let me=1;me{return de=se,Array.isArray(de)?`(${de.map(so).join(", ")})`:`(${so(de.type)}...)`;var de}).join(" | "),ne=[];for(let se=1;se{_=f?_&&M_(k):_&&k instanceof La}),!!_&&A_(b)&&km(b,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function A_(b){if(b instanceof gc&&(b.name==="get"&&b.args.length===1||b.name==="feature-state"||b.name==="has"&&b.args.length===1||b.name==="properties"||b.name==="geometry-type"||b.name==="id"||/^filter-/.test(b.name))||b instanceof Xf||b instanceof Jf)return!1;let f=!0;return b.eachChild(_=>{f&&!A_(_)&&(f=!1)}),f}function By(b){if(b instanceof gc&&b.name==="feature-state")return!1;let f=!0;return b.eachChild(_=>{f&&!By(_)&&(f=!1)}),f}function km(b,f){if(b instanceof gc&&f.indexOf(b.name)>=0)return!1;let _=!0;return b.eachChild(k=>{_&&!km(k,f)&&(_=!1)}),_}function HM(b){return{result:"success",value:b}}function Tm(b){return{result:"error",value:b}}function Mm(b){return b["property-type"]==="data-driven"||b["property-type"]==="cross-faded-data-driven"}function Mx(b){return!!b.expression&&b.expression.parameters.indexOf("zoom")>-1}function Ax(b){return!!b.expression&&b.expression.interpolated}function pr(b){return b instanceof Number?"number":b instanceof String?"string":b instanceof Boolean?"boolean":Array.isArray(b)?"array":b===null?"null":typeof b}function ep(b){return typeof b=="object"&&b!==null&&!Array.isArray(b)&&Ln(b)===zu}function WM(b){return b}function GM(b,f){const _=b.stops&&typeof b.stops[0][0]=="object",k=_||!(_||b.property!==void 0),N=b.type||(Ax(f)?"exponential":"interval"),B=function(ne){switch(ne.type){case"color":return fr.parse;case"padding":return Yo.parse;case"numberArray":return va.parse;case"colorArray":return ks.parse;default:return null}}(f);if(B&&((b=Us({},b)).stops&&(b.stops=b.stops.map(ne=>[ne[0],B(ne[1])])),b.default=B(b.default?b.default:f.default)),b.colorSpace&&(F=b.colorSpace)!=="rgb"&&F!=="hcl"&&F!=="lab")throw new Error(`Unknown color space: "${b.colorSpace}"`);var F;const H=function(ne){switch(ne){case"exponential":return qM;case"interval":return ZR;case"categorical":return YR;case"identity":return YM;default:throw new Error(`Unknown function type "${ne}"`)}}(N);let X,ee;if(N==="categorical"){X=Object.create(null);for(const ne of b.stops)X[ne[0]]=ne[1];ee=typeof b.stops[0][0]}if(_){const ne={},se=[];for(let ge=0;gege[0]),evaluate:({zoom:ge},be)=>qM({stops:de,base:b.base},f,ge).evaluate(ge,be)}}if(k){const ne=N==="exponential"?{name:"exponential",base:b.base!==void 0?b.base:1}:null;return{kind:"camera",interpolationType:ne,interpolationFactor:Pa.interpolationFactor.bind(void 0,ne),zoomStops:b.stops.map(se=>se[0]),evaluate:({zoom:se})=>H(b,f,se,X,ee)}}return{kind:"source",evaluate(ne,se){const de=se&&se.properties?se.properties[b.property]:void 0;return de===void 0?Fy(b.default,f.default):H(b,f,de,X,ee)}}}function Fy(b,f,_){return b!==void 0?b:f!==void 0?f:_!==void 0?_:void 0}function YR(b,f,_,k,N){return Fy(typeof _===N?k[_]:void 0,b.default,f.default)}function ZR(b,f,_){if(pr(_)!=="number")return Fy(b.default,f.default);const k=b.stops.length;if(k===1||_<=b.stops[0][0])return b.stops[0][1];if(_>=b.stops[k-1][0])return b.stops[k-1][1];const N=_m(b.stops.map(B=>B[0]),_);return b.stops[N][1]}function qM(b,f,_){const k=b.base!==void 0?b.base:1;if(pr(_)!=="number")return Fy(b.default,f.default);const N=b.stops.length;if(N===1||_<=b.stops[0][0])return b.stops[0][1];if(_>=b.stops[N-1][0])return b.stops[N-1][1];const B=_m(b.stops.map(ne=>ne[0]),_),F=function(ne,se,de,me){const ge=me-de,be=ne-de;return ge===0?0:se===1?be/ge:(Math.pow(se,be)-1)/(Math.pow(se,ge)-1)}(_,k,b.stops[B][0],b.stops[B+1][0]),H=b.stops[B][1],X=b.stops[B+1][1],ee=Rl[f.type]||WM;return typeof H.evaluate=="function"?{evaluate(...ne){const se=H.evaluate.apply(void 0,ne),de=X.evaluate.apply(void 0,ne);if(se!==void 0&&de!==void 0)return ee(se,de,F,b.colorSpace)}}:ee(H,X,F,b.colorSpace)}function YM(b,f,_){switch(f.type){case"color":_=fr.parse(_);break;case"formatted":_=ya.fromString(_.toString());break;case"resolvedImage":_=cl.fromString(_.toString());break;case"padding":_=Yo.parse(_);break;case"colorArray":_=ks.parse(_);break;case"numberArray":_=va.parse(_);break;default:pr(_)===f.type||f.type==="enum"&&f.values[_]||(_=void 0)}return Fy(_,b.default,f.default)}gc.register(Cm,{error:[{kind:"error"},[nr],(b,[f])=>{throw new ao(f.evaluate(b))}],typeof:[nr,[ir],(b,[f])=>so(Ln(f.evaluate(b)))],"to-rgba":[Dl(Bt,4),[Ol],(b,[f])=>{const[_,k,N,B]=f.evaluate(b).rgb;return[255*_,255*k,255*N,B]}],rgb:[Ol,[Bt,Bt,Bt],jM],rgba:[Ol,[Bt,Bt,Bt,Bt],jM],has:{type:rr,overloads:[[[nr],(b,[f])=>UM(f.evaluate(b),b.properties())],[[nr,zu],(b,[f,_])=>UM(f.evaluate(b),_.evaluate(b))]]},get:{type:ir,overloads:[[[nr],(b,[f])=>Tx(f.evaluate(b),b.properties())],[[nr,zu],(b,[f,_])=>Tx(f.evaluate(b),_.evaluate(b))]]},"feature-state":[ir,[nr],(b,[f])=>Tx(f.evaluate(b),b.featureState||{})],properties:[zu,[],b=>b.properties()],"geometry-type":[nr,[],b=>b.geometryType()],id:[ir,[],b=>b.id()],zoom:[Bt,[],b=>b.globals.zoom],"heatmap-density":[Bt,[],b=>b.globals.heatmapDensity||0],elevation:[Bt,[],b=>b.globals.elevation||0],"line-progress":[Bt,[],b=>b.globals.lineProgress||0],accumulated:[ir,[],b=>b.globals.accumulated===void 0?null:b.globals.accumulated],"+":[Bt,Qf(Bt),(b,f)=>{let _=0;for(const k of f)_+=k.evaluate(b);return _}],"*":[Bt,Qf(Bt),(b,f)=>{let _=1;for(const k of f)_*=k.evaluate(b);return _}],"-":{type:Bt,overloads:[[[Bt,Bt],(b,[f,_])=>f.evaluate(b)-_.evaluate(b)],[[Bt],(b,[f])=>-f.evaluate(b)]]},"/":[Bt,[Bt,Bt],(b,[f,_])=>f.evaluate(b)/_.evaluate(b)],"%":[Bt,[Bt,Bt],(b,[f,_])=>f.evaluate(b)%_.evaluate(b)],ln2:[Bt,[],()=>Math.LN2],pi:[Bt,[],()=>Math.PI],e:[Bt,[],()=>Math.E],"^":[Bt,[Bt,Bt],(b,[f,_])=>Math.pow(f.evaluate(b),_.evaluate(b))],sqrt:[Bt,[Bt],(b,[f])=>Math.sqrt(f.evaluate(b))],log10:[Bt,[Bt],(b,[f])=>Math.log(f.evaluate(b))/Math.LN10],ln:[Bt,[Bt],(b,[f])=>Math.log(f.evaluate(b))],log2:[Bt,[Bt],(b,[f])=>Math.log(f.evaluate(b))/Math.LN2],sin:[Bt,[Bt],(b,[f])=>Math.sin(f.evaluate(b))],cos:[Bt,[Bt],(b,[f])=>Math.cos(f.evaluate(b))],tan:[Bt,[Bt],(b,[f])=>Math.tan(f.evaluate(b))],asin:[Bt,[Bt],(b,[f])=>Math.asin(f.evaluate(b))],acos:[Bt,[Bt],(b,[f])=>Math.acos(f.evaluate(b))],atan:[Bt,[Bt],(b,[f])=>Math.atan(f.evaluate(b))],min:[Bt,Qf(Bt),(b,f)=>Math.min(...f.map(_=>_.evaluate(b)))],max:[Bt,Qf(Bt),(b,f)=>Math.max(...f.map(_=>_.evaluate(b)))],abs:[Bt,[Bt],(b,[f])=>Math.abs(f.evaluate(b))],round:[Bt,[Bt],(b,[f])=>{const _=f.evaluate(b);return _<0?-Math.round(-_):Math.round(_)}],floor:[Bt,[Bt],(b,[f])=>Math.floor(f.evaluate(b))],ceil:[Bt,[Bt],(b,[f])=>Math.ceil(f.evaluate(b))],"filter-==":[rr,[nr,ir],(b,[f,_])=>b.properties()[f.value]===_.value],"filter-id-==":[rr,[ir],(b,[f])=>b.id()===f.value],"filter-type-==":[rr,[nr],(b,[f])=>b.geometryType()===f.value],"filter-<":[rr,[nr,ir],(b,[f,_])=>{const k=b.properties()[f.value],N=_.value;return typeof k==typeof N&&k{const _=b.id(),k=f.value;return typeof _==typeof k&&_":[rr,[nr,ir],(b,[f,_])=>{const k=b.properties()[f.value],N=_.value;return typeof k==typeof N&&k>N}],"filter-id->":[rr,[ir],(b,[f])=>{const _=b.id(),k=f.value;return typeof _==typeof k&&_>k}],"filter-<=":[rr,[nr,ir],(b,[f,_])=>{const k=b.properties()[f.value],N=_.value;return typeof k==typeof N&&k<=N}],"filter-id-<=":[rr,[ir],(b,[f])=>{const _=b.id(),k=f.value;return typeof _==typeof k&&_<=k}],"filter->=":[rr,[nr,ir],(b,[f,_])=>{const k=b.properties()[f.value],N=_.value;return typeof k==typeof N&&k>=N}],"filter-id->=":[rr,[ir],(b,[f])=>{const _=b.id(),k=f.value;return typeof _==typeof k&&_>=k}],"filter-has":[rr,[ir],(b,[f])=>f.value in b.properties()],"filter-has-id":[rr,[],b=>b.id()!==null&&b.id()!==void 0],"filter-type-in":[rr,[Dl(nr)],(b,[f])=>f.value.indexOf(b.geometryType())>=0],"filter-id-in":[rr,[Dl(ir)],(b,[f])=>f.value.indexOf(b.id())>=0],"filter-in-small":[rr,[nr,Dl(ir)],(b,[f,_])=>_.value.indexOf(b.properties()[f.value])>=0],"filter-in-large":[rr,[nr,Dl(ir)],(b,[f,_])=>function(k,N,B,F){for(;B<=F;){const H=B+F>>1;if(N[H]===k)return!0;N[H]>k?F=H-1:B=H+1}return!1}(b.properties()[f.value],_.value,0,_.value.length-1)],all:{type:rr,overloads:[[[rr,rr],(b,[f,_])=>f.evaluate(b)&&_.evaluate(b)],[Qf(rr),(b,f)=>{for(const _ of f)if(!_.evaluate(b))return!1;return!0}]]},any:{type:rr,overloads:[[[rr,rr],(b,[f,_])=>f.evaluate(b)||_.evaluate(b)],[Qf(rr),(b,f)=>{for(const _ of f)if(_.evaluate(b))return!0;return!1}]]},"!":[rr,[rr],(b,[f])=>!f.evaluate(b)],"is-supported-script":[rr,[nr],(b,[f])=>{const _=b.globals&&b.globals.isSupportedScript;return!_||_(f.evaluate(b))}],upcase:[nr,[nr],(b,[f])=>f.evaluate(b).toUpperCase()],downcase:[nr,[nr],(b,[f])=>f.evaluate(b).toLowerCase()],concat:[nr,Qf(ir),(b,f)=>f.map(_=>Zf(_.evaluate(b))).join("")],"resolved-locale":[nr,[Ch],(b,[f])=>f.evaluate(b).resolvedLocale()]});class I_{constructor(f,_){this.expression=f,this._warningHistory={},this._evaluator=new MM,this._defaultValue=_?function(k){if(k.type==="color"&&ep(k.default))return new fr(0,0,0,0);switch(k.type){case"color":return fr.parse(k.default)||null;case"padding":return Yo.parse(k.default)||null;case"numberArray":return va.parse(k.default)||null;case"colorArray":return ks.parse(k.default)||null;case"variableAnchorOffsetCollection":return Sr.parse(k.default)||null;case"projectionDefinition":return Zn.parse(k.default)||null;default:return k.default===void 0?null:k.default}}(_):null,this._enumValues=_&&_.type==="enum"?_.values:null}evaluateWithoutErrorHandling(f,_,k,N,B,F){return this._evaluator.globals=f,this._evaluator.feature=_,this._evaluator.featureState=k,this._evaluator.canonical=N,this._evaluator.availableImages=B||null,this._evaluator.formattedSection=F,this.expression.evaluate(this._evaluator)}evaluate(f,_,k,N,B,F){this._evaluator.globals=f,this._evaluator.feature=_||null,this._evaluator.featureState=k||null,this._evaluator.canonical=N,this._evaluator.availableImages=B||null,this._evaluator.formattedSection=F||null;try{const H=this.expression.evaluate(this._evaluator);if(H==null||typeof H=="number"&&H!=H)return this._defaultValue;if(this._enumValues&&!(H in this._enumValues))throw new ao(`Expected value to be one of ${Object.keys(this._enumValues).map(X=>JSON.stringify(X)).join(", ")}, but found ${JSON.stringify(H)} instead.`);return H}catch(H){return this._warningHistory[H.message]||(this._warningHistory[H.message]=!0,typeof console<"u"&&console.warn(H.message)),this._defaultValue}}}function L_(b){return Array.isArray(b)&&b.length>0&&typeof b[0]=="string"&&b[0]in Cm}function P_(b,f){const _=new ky(Cm,M_,[],f?function(N){const B={color:Ol,string:nr,number:Bt,enum:nr,boolean:rr,formatted:Wf,padding:Vo,numberArray:wy,colorArray:by,projectionDefinition:d_,resolvedImage:kh,variableAnchorOffsetCollection:xy};return N.type==="array"?Dl(B[N.value]||ir,N.length):B[N.type]}(f):void 0),k=_.parse(b,void 0,void 0,void 0,f&&f.type==="string"?{typeAnnotation:"coerce"}:void 0);return k?HM(new I_(k,f)):Tm(_.errors)}class $y{constructor(f,_){this.kind=f,this._styleExpression=_,this.isStateDependent=f!=="constant"&&!By(_.expression),this.globalStateRefs=Im(_.expression)}evaluateWithoutErrorHandling(f,_,k,N,B,F){return this._styleExpression.evaluateWithoutErrorHandling(f,_,k,N,B,F)}evaluate(f,_,k,N,B,F){return this._styleExpression.evaluate(f,_,k,N,B,F)}}class N_{constructor(f,_,k,N){this.kind=f,this.zoomStops=k,this._styleExpression=_,this.isStateDependent=f!=="camera"&&!By(_.expression),this.globalStateRefs=Im(_.expression),this.interpolationType=N}evaluateWithoutErrorHandling(f,_,k,N,B,F){return this._styleExpression.evaluateWithoutErrorHandling(f,_,k,N,B,F)}evaluate(f,_,k,N,B,F){return this._styleExpression.evaluate(f,_,k,N,B,F)}interpolationFactor(f,_,k){return this.interpolationType?Pa.interpolationFactor(this.interpolationType,f,_,k):0}}function Ix(b,f){const _=P_(b,f);if(_.result==="error")return _;const k=_.value.expression,N=A_(k);if(!N&&!Mm(f))return Tm([new oo("","data expressions not supported")]);const B=km(k,["zoom"]);if(!B&&!Mx(f))return Tm([new oo("","zoom expressions not supported")]);const F=Am(k);return F||B?F instanceof oo?Tm([F]):F instanceof Pa&&!Ax(f)?Tm([new oo("",'"interpolate" expressions cannot be used with this property')]):HM(F?new N_(N?"camera":"composite",_.value,F.labels,F instanceof Pa?F.interpolation:void 0):new $y(N?"constant":"source",_.value)):Tm([new oo("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class zy{constructor(f,_){this._parameters=f,this._specification=_,Us(this,GM(this._parameters,this._specification))}static deserialize(f){return new zy(f._parameters,f._specification)}static serialize(f){return{_parameters:f._parameters,_specification:f._specification}}}function Am(b){let f=null;if(b instanceof Ty)f=Am(b.result);else if(b instanceof ul){for(const _ of b.args)if(f=Am(_),f)break}else(b instanceof bm||b instanceof Pa)&&b.input instanceof gc&&b.input.name==="zoom"&&(f=b);return f instanceof oo||b.eachChild(_=>{const k=Am(_);k instanceof oo?f=k:!f&&k?f=new oo("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):f&&k&&f!==k&&(f=new oo("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),f}function Im(b,f=new Set){return b instanceof Ry&&f.add(b.key),b.eachChild(_=>{Im(_,f)}),f}function Vy(b){if(b===!0||b===!1)return!0;if(!Array.isArray(b)||b.length===0)return!1;switch(b[0]){case"has":return b.length>=2&&b[1]!=="$id"&&b[1]!=="$type";case"in":return b.length>=3&&(typeof b[1]!="string"||Array.isArray(b[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return b.length!==3||Array.isArray(b[1])||Array.isArray(b[2]);case"any":case"all":for(const f of b.slice(1))if(!Vy(f)&&typeof f!="boolean")return!1;return!0;default:return!0}}const Lx={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Id(b){if(b==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Vy(b)||(b=O_(b));const f=P_(b,Lx);if(f.result==="error")throw new Error(f.value.map(_=>`${_.key}: ${_.message}`).join(", "));return{filter:(_,k,N)=>f.value.evaluate(_,k,{},N),needGeometry:ZM(b),getGlobalStateRefs:()=>Im(f.value.expression)}}function XR(b,f){return bf?1:0}function ZM(b){if(!Array.isArray(b))return!1;if(b[0]==="within"||b[0]==="distance")return!0;for(let f=1;f"||f==="<="||f===">="?Px(b[1],b[2],f):f==="any"?(_=b.slice(1),["any"].concat(_.map(O_))):f==="all"?["all"].concat(b.slice(1).map(O_)):f==="none"?["all"].concat(b.slice(1).map(O_).map(jy)):f==="in"?XM(b[1],b.slice(2)):f==="!in"?jy(XM(b[1],b.slice(2))):f==="has"?KM(b[1]):f!=="!has"||jy(KM(b[1]));var _}function Px(b,f,_){switch(b){case"$type":return[`filter-type-${_}`,f];case"$id":return[`filter-id-${_}`,f];default:return[`filter-${_}`,b,f]}}function XM(b,f){if(f.length===0)return!1;switch(b){case"$type":return["filter-type-in",["literal",f]];case"$id":return["filter-id-in",["literal",f]];default:return f.length>200&&!f.some(_=>typeof _!=typeof f[0])?["filter-in-large",b,["literal",f.sort(XR)]]:["filter-in-small",b,["literal",f]]}}function KM(b){switch(b){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",b]}}function jy(b){return["!",b]}function D_(b){const f=typeof b;if(f==="number"||f==="boolean"||f==="string"||b==null)return JSON.stringify(b);if(Array.isArray(b)){let N="[";for(const B of b)N+=`${D_(B)},`;return`${N}]`}const _=Object.keys(b).sort();let k="{";for(let N=0;N<_.length;N++)k+=`${JSON.stringify(_[N])}:${D_(b[_[N]])},`;return`${k}}`}function R_(b){let f="";for(const _ of Vt)f+=`/${D_(b[_])}`;return f}function JM(b){const f=b.value;return f?[new Ot(b.key,f,"constants have been deprecated as of v8")]:[]}function bo(b){return b instanceof Number||b instanceof String||b instanceof Boolean?b.valueOf():b}function Ld(b){if(Array.isArray(b))return b.map(Ld);if(b instanceof Object&&!(b instanceof Number||b instanceof String||b instanceof Boolean)){const f={};for(const _ in b)f[_]=Ld(b[_]);return f}return bo(b)}function yc(b){const f=b.key,_=b.value,k=b.valueSpec||{},N=b.objectElementValidators||{},B=b.style,F=b.styleSpec,H=b.validateSpec;let X=[];const ee=pr(_);if(ee!=="object")return[new Ot(f,_,`object expected, ${ee} found`)];for(const ne in _){const se=ne.split(".")[0],de=dr(k,se)||k["*"];let me;if(dr(N,se))me=N[se];else if(dr(k,se))me=H;else if(N["*"])me=N["*"];else{if(!k["*"]){X.push(new Ot(f,_[ne],`unknown property "${ne}"`));continue}me=H}X=X.concat(me({key:(f&&`${f}.`)+ne,value:_[ne],valueSpec:de,style:B,styleSpec:F,object:_,objectKey:ne,validateSpec:H},_))}for(const ne in k)N[ne]||k[ne].required&&k[ne].default===void 0&&_[ne]===void 0&&X.push(new Ot(f,_,`missing required property "${ne}"`));return X}function B_(b){const f=b.value,_=b.valueSpec,k=b.style,N=b.styleSpec,B=b.key,F=b.arrayElementValidator||b.validateSpec;if(pr(f)!=="array")return[new Ot(B,f,`array expected, ${pr(f)} found`)];if(_.length&&f.length!==_.length)return[new Ot(B,f,`array length ${_.length} expected, length ${f.length} found`)];if(_["min-length"]&&f.length<_["min-length"])return[new Ot(B,f,`array length at least ${_["min-length"]} expected, length ${f.length} found`)];let H={type:_.value,values:_.values};N.$version<7&&(H.function=_.function),pr(_.value)==="object"&&(H=_.value);let X=[];for(let ee=0;eek.maximum?[new Ot(f,_,`${_} is greater than the maximum value ${k.maximum}`)]:[]}function Lm(b){const f=b.valueSpec,_=bo(b.value.type);let k,N,B,F={};const H=_!=="categorical"&&b.value.property===void 0,X=!H,ee=pr(b.value.stops)==="array"&&pr(b.value.stops[0])==="array"&&pr(b.value.stops[0][0])==="object",ne=yc({key:b.key,value:b.value,valueSpec:b.styleSpec.function,validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{stops:function(me){if(_==="identity")return[new Ot(me.key,me.value,'identity function may not have a "stops" property')];let ge=[];const be=me.value;return ge=ge.concat(B_({key:me.key,value:be,valueSpec:me.valueSpec,validateSpec:me.validateSpec,style:me.style,styleSpec:me.styleSpec,arrayElementValidator:se})),pr(be)==="array"&&be.length===0&&ge.push(new Ot(me.key,be,"array must have at least one stop")),ge},default:function(me){return me.validateSpec({key:me.key,value:me.value,valueSpec:f,validateSpec:me.validateSpec,style:me.style,styleSpec:me.styleSpec})}}});return _==="identity"&&H&&ne.push(new Ot(b.key,b.value,'missing required property "property"')),_==="identity"||b.value.stops||ne.push(new Ot(b.key,b.value,'missing required property "stops"')),_==="exponential"&&b.valueSpec.expression&&!Ax(b.valueSpec)&&ne.push(new Ot(b.key,b.value,"exponential functions not supported")),b.styleSpec.$version>=8&&(X&&!Mm(b.valueSpec)?ne.push(new Ot(b.key,b.value,"property functions not supported")):H&&!Mx(b.valueSpec)&&ne.push(new Ot(b.key,b.value,"zoom functions not supported"))),_!=="categorical"&&!ee||b.value.property!==void 0||ne.push(new Ot(b.key,b.value,'"property" property is required')),ne;function se(me){let ge=[];const be=me.value,Ce=me.key;if(pr(be)!=="array")return[new Ot(Ce,be,`array expected, ${pr(be)} found`)];if(be.length!==2)return[new Ot(Ce,be,`array length 2 expected, length ${be.length} found`)];if(ee){if(pr(be[0])!=="object")return[new Ot(Ce,be,`object expected, ${pr(be[0])} found`)];if(be[0].zoom===void 0)return[new Ot(Ce,be,"object stop key must have zoom")];if(be[0].value===void 0)return[new Ot(Ce,be,"object stop key must have value")];if(B&&B>bo(be[0].zoom))return[new Ot(Ce,be[0].zoom,"stop zoom values must appear in ascending order")];bo(be[0].zoom)!==B&&(B=bo(be[0].zoom),N=void 0,F={}),ge=ge.concat(yc({key:`${Ce}[0]`,value:be[0],valueSpec:{zoom:{}},validateSpec:me.validateSpec,style:me.style,styleSpec:me.styleSpec,objectElementValidators:{zoom:Uy,value:de}}))}else ge=ge.concat(de({key:`${Ce}[0]`,value:be[0],validateSpec:me.validateSpec,style:me.style,styleSpec:me.styleSpec},be));return L_(Ld(be[1]))?ge.concat([new Ot(`${Ce}[1]`,be[1],"expressions are not allowed in function stops.")]):ge.concat(me.validateSpec({key:`${Ce}[1]`,value:be[1],valueSpec:f,validateSpec:me.validateSpec,style:me.style,styleSpec:me.styleSpec}))}function de(me,ge){const be=pr(me.value),Ce=bo(me.value),Le=me.value!==null?me.value:ge;if(k){if(be!==k)return[new Ot(me.key,Le,`${be} stop domain type must match previous stop domain type ${k}`)]}else k=be;if(be!=="number"&&be!=="string"&&be!=="boolean")return[new Ot(me.key,Le,"stop domain value must be a number, string, or boolean")];if(be!=="number"&&_!=="categorical"){let Xe=`number expected, ${be} found`;return Mm(f)&&_===void 0&&(Xe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ot(me.key,Le,Xe)]}return _!=="categorical"||be!=="number"||isFinite(Ce)&&Math.floor(Ce)===Ce?_!=="categorical"&&be==="number"&&N!==void 0&&Cenew Ot(`${b.key}${k.key}`,b.value,k.message));const _=f.value.expression||f.value._styleExpression.expression;if(b.expressionContext==="property"&&b.propertyKey==="text-font"&&!_.outputDefined())return[new Ot(b.key,b.value,`Invalid data expression for "${b.propertyKey}". Output values must be contained as literals within the expression.`)];if(b.expressionContext==="property"&&b.propertyType==="layout"&&!By(_))return[new Ot(b.key,b.value,'"feature-state" data expressions are not supported with layout properties.')];if(b.expressionContext==="filter"&&!By(_))return[new Ot(b.key,b.value,'"feature-state" data expressions are not supported with filters.')];if(b.expressionContext&&b.expressionContext.indexOf("cluster")===0){if(!km(_,["zoom","feature-state"]))return[new Ot(b.key,b.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(b.expressionContext==="cluster-initial"&&!A_(_))return[new Ot(b.key,b.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Nx(b){const f=b.key,_=b.value,k=pr(_);return k!=="string"?[new Ot(f,_,`color expected, ${k} found`)]:fr.parse(String(_))?[]:[new Ot(f,_,`color expected, "${_}" found`)]}function Hy(b){const f=b.key,_=b.value,k=b.valueSpec,N=[];return Array.isArray(k.values)?k.values.indexOf(bo(_))===-1&&N.push(new Ot(f,_,`expected one of [${k.values.join(", ")}], ${JSON.stringify(_)} found`)):Object.keys(k.values).indexOf(bo(_))===-1&&N.push(new Ot(f,_,`expected one of [${Object.keys(k.values).join(", ")}], ${JSON.stringify(_)} found`)),N}function Ox(b){return Vy(Ld(b.value))?Pm(Us({},b,{expressionContext:"filter",valueSpec:{value:"boolean"}})):QM(b)}function QM(b){const f=b.value,_=b.key;if(pr(f)!=="array")return[new Ot(_,f,`array expected, ${pr(f)} found`)];const k=b.styleSpec;let N,B=[];if(f.length<1)return[new Ot(_,f,"filter array must have at least 1 element")];switch(B=B.concat(Hy({key:`${_}[0]`,value:f[0],valueSpec:k.filter_operator,style:b.style,styleSpec:b.styleSpec})),bo(f[0])){case"<":case"<=":case">":case">=":f.length>=2&&bo(f[1])==="$type"&&B.push(new Ot(_,f,`"$type" cannot be use with operator "${f[0]}"`));case"==":case"!=":f.length!==3&&B.push(new Ot(_,f,`filter array for operator "${f[0]}" must have 3 elements`));case"in":case"!in":f.length>=2&&(N=pr(f[1]),N!=="string"&&B.push(new Ot(`${_}[1]`,f[1],`string expected, ${N} found`)));for(let F=2;F{ee in _&&f.push(new Ot(k,_[ee],`"${ee}" is prohibited for ref layers`))}),N.layers.forEach(ee=>{bo(ee.id)===H&&(X=ee)}),X?X.ref?f.push(new Ot(k,_.ref,"ref cannot reference another ref layer")):F=bo(X.type):f.push(new Ot(k,_.ref,`ref layer "${H}" not found`))}else if(F!=="background")if(_.source){const X=N.sources&&N.sources[_.source],ee=X&&bo(X.type);X?ee==="vector"&&F==="raster"?f.push(new Ot(k,_.source,`layer "${_.id}" requires a raster source`)):ee!=="raster-dem"&&F==="hillshade"||ee!=="raster-dem"&&F==="color-relief"?f.push(new Ot(k,_.source,`layer "${_.id}" requires a raster-dem source`)):ee==="raster"&&F!=="raster"?f.push(new Ot(k,_.source,`layer "${_.id}" requires a vector source`)):ee!=="vector"||_["source-layer"]?ee==="raster-dem"&&F!=="hillshade"&&F!=="color-relief"?f.push(new Ot(k,_.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):F!=="line"||!_.paint||!_.paint["line-gradient"]||ee==="geojson"&&X.lineMetrics||f.push(new Ot(k,_,`layer "${_.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):f.push(new Ot(k,_,`layer "${_.id}" must specify a "source-layer"`)):f.push(new Ot(k,_.source,`source "${_.source}" not found`))}else f.push(new Ot(k,_,'missing required property "source"'));return f=f.concat(yc({key:k,value:_,valueSpec:B.layer,style:b.style,styleSpec:b.styleSpec,validateSpec:b.validateSpec,objectElementValidators:{"*":()=>[],type:()=>b.validateSpec({key:`${k}.type`,value:_.type,valueSpec:B.layer.type,style:b.style,styleSpec:b.styleSpec,validateSpec:b.validateSpec,object:_,objectKey:"type"}),filter:Ox,layout:X=>yc({layer:_,key:X.key,value:X.value,style:X.style,styleSpec:X.styleSpec,validateSpec:X.validateSpec,objectElementValidators:{"*":ee=>Om(Us({layerType:F},ee))}}),paint:X=>yc({layer:_,key:X.key,value:X.value,style:X.style,styleSpec:X.styleSpec,validateSpec:X.validateSpec,objectElementValidators:{"*":ee=>Nm(Us({layerType:F},ee))}})}})),f}function Wc(b){const f=b.value,_=b.key,k=pr(f);return k!=="string"?[new Ot(_,f,`string expected, ${k} found`)]:[]}const Dx={promoteId:function({key:b,value:f}){if(pr(f)==="string")return Wc({key:b,value:f});{const _=[];for(const k in f)_.push(...Wc({key:`${b}.${k}`,value:f[k]}));return _}}};function tA(b){const f=b.value,_=b.key,k=b.styleSpec,N=b.style,B=b.validateSpec;if(!f.type)return[new Ot(_,f,'"type" is required')];const F=bo(f.type);let H;switch(F){case"vector":case"raster":return H=yc({key:_,value:f,valueSpec:k[`source_${F.replace("-","_")}`],style:b.style,styleSpec:k,objectElementValidators:Dx,validateSpec:B}),H;case"raster-dem":return H=function(X){var ee;const ne=(ee=X.sourceName)!==null&&ee!==void 0?ee:"",se=X.value,de=X.styleSpec,me=de.source_raster_dem,ge=X.style;let be=[];const Ce=pr(se);if(se===void 0)return be;if(Ce!=="object")return be.push(new Ot("source_raster_dem",se,`object expected, ${Ce} found`)),be;const Le=bo(se.encoding)==="custom",Xe=["redFactor","greenFactor","blueFactor","baseShift"],Be=X.value.encoding?`"${X.value.encoding}"`:"Default";for(const pe in se)!Le&&Xe.includes(pe)?be.push(new Ot(pe,se[pe],`In "${ne}": "${pe}" is only valid when "encoding" is set to "custom". ${Be} encoding found`)):me[pe]?be=be.concat(X.validateSpec({key:pe,value:se[pe],valueSpec:me[pe],validateSpec:X.validateSpec,style:ge,styleSpec:de})):be.push(new Ot(pe,se[pe],`unknown property "${pe}"`));return be}({sourceName:_,value:f,style:b.style,styleSpec:k,validateSpec:B}),H;case"geojson":if(H=yc({key:_,value:f,valueSpec:k.source_geojson,style:N,styleSpec:k,validateSpec:B,objectElementValidators:Dx}),f.cluster)for(const X in f.clusterProperties){const[ee,ne]=f.clusterProperties[X],se=typeof ee=="string"?[ee,["accumulated"],["get",X]]:ee;H.push(...Pm({key:`${_}.${X}.map`,value:ne,expressionContext:"cluster-map"})),H.push(...Pm({key:`${_}.${X}.reduce`,value:se,expressionContext:"cluster-reduce"}))}return H;case"video":return yc({key:_,value:f,valueSpec:k.source_video,style:N,validateSpec:B,styleSpec:k});case"image":return yc({key:_,value:f,valueSpec:k.source_image,style:N,validateSpec:B,styleSpec:k});case"canvas":return[new Ot(_,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Hy({key:`${_}.type`,value:f.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function nA(b){const f=b.value,_=b.styleSpec,k=_.light,N=b.style;let B=[];const F=pr(f);if(f===void 0)return B;if(F!=="object")return B=B.concat([new Ot("light",f,`object expected, ${F} found`)]),B;for(const H in f){const X=H.match(/^(.*)-transition$/);B=B.concat(X&&k[X[1]]&&k[X[1]].transition?b.validateSpec({key:H,value:f[H],valueSpec:_.transition,validateSpec:b.validateSpec,style:N,styleSpec:_}):k[H]?b.validateSpec({key:H,value:f[H],valueSpec:k[H],validateSpec:b.validateSpec,style:N,styleSpec:_}):[new Ot(H,f[H],`unknown property "${H}"`)])}return B}function Dm(b){const f=b.value,_=b.styleSpec,k=_.sky,N=b.style,B=pr(f);if(f===void 0)return[];if(B!=="object")return[new Ot("sky",f,`object expected, ${B} found`)];let F=[];for(const H in f)F=F.concat(k[H]?b.validateSpec({key:H,value:f[H],valueSpec:k[H],style:N,styleSpec:_}):[new Ot(H,f[H],`unknown property "${H}"`)]);return F}function Rx(b){const f=b.value,_=b.styleSpec,k=_.terrain,N=b.style;let B=[];const F=pr(f);if(f===void 0)return B;if(F!=="object")return B=B.concat([new Ot("terrain",f,`object expected, ${F} found`)]),B;for(const H in f)B=B.concat(k[H]?b.validateSpec({key:H,value:f[H],valueSpec:k[H],validateSpec:b.validateSpec,style:N,styleSpec:_}):[new Ot(H,f[H],`unknown property "${H}"`)]);return B}function F_(b){let f=[];const _=b.value,k=b.key;if(Array.isArray(_)){const N=[],B=[];for(const F in _)_[F].id&&N.includes(_[F].id)&&f.push(new Ot(k,_,`all the sprites' ids must be unique, but ${_[F].id} is duplicated`)),N.push(_[F].id),_[F].url&&B.includes(_[F].url)&&f.push(new Ot(k,_,`all the sprites' URLs must be unique, but ${_[F].url} is duplicated`)),B.push(_[F].url),f=f.concat(yc({key:`${k}[${F}]`,value:_[F],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:b.validateSpec}));return f}return Wc({key:k,value:_})}function rA(b){return f=b.value,f&&f.constructor===Object?[]:[new Ot(b.key,b.value,`object expected, ${pr(b.value)} found`)];var f}const $_={"*":()=>[],array:B_,boolean:function(b){const f=b.value,_=b.key,k=pr(f);return k!=="boolean"?[new Ot(_,f,`boolean expected, ${k} found`)]:[]},number:Uy,color:Nx,constants:JM,enum:Hy,filter:Ox,function:Lm,layer:hl,object:yc,source:tA,light:nA,sky:Dm,terrain:Rx,projection:function(b){const f=b.value,_=b.styleSpec,k=_.projection,N=b.style,B=pr(f);if(f===void 0)return[];if(B!=="object")return[new Ot("projection",f,`object expected, ${B} found`)];let F=[];for(const H in f)F=F.concat(k[H]?b.validateSpec({key:H,value:f[H],valueSpec:k[H],style:N,styleSpec:_}):[new Ot(H,f[H],`unknown property "${H}"`)]);return F},projectionDefinition:function(b){const f=b.key;let _=b.value;_=_ instanceof String?_.valueOf():_;const k=pr(_);return k!=="array"||function(N){return Array.isArray(N)&&N.length===3&&typeof N[0]=="string"&&typeof N[1]=="string"&&typeof N[2]=="number"}(_)||function(N){return!!["interpolate","step","literal"].includes(N[0])}(_)?["array","string"].includes(k)?[]:[new Ot(f,_,`projection expected, invalid type "${k}" found`)]:[new Ot(f,_,`projection expected, invalid array ${JSON.stringify(_)} found`)]},string:Wc,formatted:function(b){return Wc(b).length===0?[]:Pm(b)},resolvedImage:function(b){return Wc(b).length===0?[]:Pm(b)},padding:function(b){const f=b.key,_=b.value;if(pr(_)==="array"){if(_.length<1||_.length>4)return[new Ot(f,_,`padding requires 1 to 4 values; ${_.length} values found`)];const k={type:"number"};let N=[];for(let B=0;B<_.length;B++)N=N.concat(b.validateSpec({key:`${f}[${B}]`,value:_[B],validateSpec:b.validateSpec,valueSpec:k}));return N}return Uy({key:f,value:_,valueSpec:{}})},numberArray:function(b){const f=b.key,_=b.value;if(pr(_)==="array"){const k={type:"number"};if(_.length<1)return[new Ot(f,_,"array length at least 1 expected, length 0 found")];let N=[];for(let B=0;B<_.length;B++)N=N.concat(b.validateSpec({key:`${f}[${B}]`,value:_[B],validateSpec:b.validateSpec,valueSpec:k}));return N}return Uy({key:f,value:_,valueSpec:{}})},colorArray:function(b){const f=b.key,_=b.value;if(pr(_)==="array"){if(_.length<1)return[new Ot(f,_,"array length at least 1 expected, length 0 found")];let k=[];for(let N=0;N<_.length;N++)k=k.concat(Nx({key:`${f}[${N}]`,value:_[N]}));return k}return Nx({key:f,value:_})},variableAnchorOffsetCollection:function(b){const f=b.key,_=b.value,k=pr(_),N=b.styleSpec;if(k!=="array"||_.length<1||_.length%2!=0)return[new Ot(f,_,"variableAnchorOffsetCollection requires a non-empty array of even length")];let B=[];for(let F=0;F<_.length;F+=2)B=B.concat(Hy({key:`${f}[${F}]`,value:_[F],valueSpec:N.layout_symbol["text-anchor"]})),B=B.concat(B_({key:`${f}[${F+1}]`,value:_[F+1],valueSpec:{length:2,value:"number"},validateSpec:b.validateSpec,style:b.style,styleSpec:N}));return B},sprite:F_,state:rA};function z_(b){const f=b.value,_=b.valueSpec,k=b.styleSpec;return b.validateSpec=z_,_.expression&&ep(bo(f))?Lm(b):_.expression&&L_(Ld(f))?Pm(b):_.type&&$_[_.type]?$_[_.type](b):yc(Us({},b,{valueSpec:_.type?k[_.type]:_}))}function Rm(b){const f=b.value,_=b.key,k=Wc(b);return k.length||(f.indexOf("{fontstack}")===-1&&k.push(new Ot(_,f,'"glyphs" url must include a "{fontstack}" token')),f.indexOf("{range}")===-1&&k.push(new Ot(_,f,'"glyphs" url must include a "{range}" token'))),k}function vc(b,f=We){let _=[];return _=_.concat(z_({key:"",value:b,valueSpec:f.$root,styleSpec:f,style:b,validateSpec:z_,objectElementValidators:{glyphs:Rm,"*":()=>[]}})),b.constants&&(_=_.concat(JM({key:"constants",value:b.constants}))),iA(_)}function Gc(b){return function(f){return b({...f,validateSpec:z_})}}function iA(b){return[].concat(b).sort((f,_)=>f.line-_.line)}function Na(b){return function(...f){return iA(b.apply(this,f))}}vc.source=Na(Gc(tA)),vc.sprite=Na(Gc(F_)),vc.glyphs=Na(Gc(Rm)),vc.light=Na(Gc(nA)),vc.sky=Na(Gc(Dm)),vc.terrain=Na(Gc(Rx)),vc.state=Na(Gc(rA)),vc.layer=Na(Gc(hl)),vc.filter=Na(Gc(Ox)),vc.paintProperty=Na(Gc(Nm)),vc.layoutProperty=Na(Gc(Om));const Bm=vc,KR=Bm.light,V_=Bm.sky,JR=Bm.paintProperty,Bx=Bm.layoutProperty;function Wy(b,f){let _=!1;if(f&&f.length)for(const k of f)b.fire(new Qe(new Error(k.message))),_=!0;return _}class Fm{constructor(f,_,k){const N=this.cells=[];if(f instanceof ArrayBuffer){this.arrayBuffer=f;const F=new Int32Array(this.arrayBuffer);f=F[0],this.d=(_=F[1])+2*(k=F[2]);for(let X=0;X=se[ge+0]&&N>=se[ge+1])?(H[me]=!0,F.push(ne[me])):H[me]=!1}}}}_forEachCell(f,_,k,N,B,F,H,X){const ee=this._convertToCellCoord(f),ne=this._convertToCellCoord(_),se=this._convertToCellCoord(k),de=this._convertToCellCoord(N);for(let me=ee;me<=se;me++)for(let ge=ne;ge<=de;ge++){const be=this.d*ge+me;if((!X||X(this._convertFromCellCoord(me),this._convertFromCellCoord(ge),this._convertFromCellCoord(me+1),this._convertFromCellCoord(ge+1)))&&B.call(this,f,_,k,N,be,F,H,X))return}}_convertFromCellCoord(f){return(f-this.padding)/this.scale}_convertToCellCoord(f){return Math.max(0,Math.min(this.d-1,Math.floor(f*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const f=this.cells,_=3+this.cells.length+1+1;let k=0;for(let F=0;F=0)continue;const F=b[B];N[B]=Hu[_].shallow.indexOf(B)>=0?F:qy(F,f)}b instanceof Error&&(N.message=b.message)}if(N.$name)throw new Error("$name property is reserved for worker serialization logic.");return _!=="Object"&&(N.$name=_),N}function $m(b){if($x(b))return b;if(Array.isArray(b))return b.map($m);if(typeof b!="object")throw new Error("can't deserialize object of type "+typeof b);const f=Gy(b)||"Object";if(!Hu[f])throw new Error(`can't deserialize unregistered class ${f}`);const{klass:_}=Hu[f];if(!_)throw new Error(`can't deserialize unregistered class ${f}`);if(_.deserialize)return _.deserialize(b);const k=Object.create(_.prototype);for(const N of Object.keys(b)){if(N==="$name")continue;const B=b[N];k[N]=Hu[f].shallow.indexOf(N)>=0?B:$m(B)}return k}class zx{constructor(){this.first=!0}update(f,_){const k=Math.floor(f);return this.first?(this.first=!1,this.lastIntegerZoom=k,this.lastIntegerZoomTime=0,this.lastZoom=f,this.lastFloorZoom=k,!0):(this.lastFloorZoom>k?(this.lastIntegerZoom=k+1,this.lastIntegerZoomTime=_):this.lastFloorZoomb>=128&&b<=255,"Hangul Jamo":b=>b>=4352&&b<=4607,Khmer:b=>b>=6016&&b<=6143,"General Punctuation":b=>b>=8192&&b<=8303,"Letterlike Symbols":b=>b>=8448&&b<=8527,"Number Forms":b=>b>=8528&&b<=8591,"Miscellaneous Technical":b=>b>=8960&&b<=9215,"Control Pictures":b=>b>=9216&&b<=9279,"Optical Character Recognition":b=>b>=9280&&b<=9311,"Enclosed Alphanumerics":b=>b>=9312&&b<=9471,"Geometric Shapes":b=>b>=9632&&b<=9727,"Miscellaneous Symbols":b=>b>=9728&&b<=9983,"Miscellaneous Symbols and Arrows":b=>b>=11008&&b<=11263,"Ideographic Description Characters":b=>b>=12272&&b<=12287,"CJK Symbols and Punctuation":b=>b>=12288&&b<=12351,Hiragana:b=>b>=12352&&b<=12447,Katakana:b=>b>=12448&&b<=12543,Kanbun:b=>b>=12688&&b<=12703,"CJK Strokes":b=>b>=12736&&b<=12783,"Enclosed CJK Letters and Months":b=>b>=12800&&b<=13055,"CJK Compatibility":b=>b>=13056&&b<=13311,"Yijing Hexagram Symbols":b=>b>=19904&&b<=19967,"CJK Unified Ideographs":b=>b>=19968&&b<=40959,"Hangul Syllables":b=>b>=44032&&b<=55215,"Private Use Area":b=>b>=57344&&b<=63743,"Vertical Forms":b=>b>=65040&&b<=65055,"CJK Compatibility Forms":b=>b>=65072&&b<=65103,"Small Form Variants":b=>b>=65104&&b<=65135,"Halfwidth and Fullwidth Forms":b=>b>=65280&&b<=65519};function Vx(b){for(const f of b)if(U_(f.charCodeAt(0)))return!0;return!1}function oA(b){for(const f of b)if(!e3(f.charCodeAt(0)))return!1;return!0}function j_(b){const f=b.map(_=>{try{return new RegExp(`\\p{sc=${_}}`,"u").source}catch{return null}}).filter(_=>_);return new RegExp(f.join("|"),"u")}const QR=j_(["Arab","Dupl","Mong","Ougr","Syrc"]);function e3(b){return!QR.test(String.fromCodePoint(b))}const jx=j_(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function U_(b){return!(b!==746&&b!==747&&(b<4352||!(mr["CJK Compatibility Forms"](b)&&!(b>=65097&&b<=65103)||mr["CJK Compatibility"](b)||mr["CJK Strokes"](b)||!(!mr["CJK Symbols and Punctuation"](b)||b>=12296&&b<=12305||b>=12308&&b<=12319||b===12336)||mr["Enclosed CJK Letters and Months"](b)||mr["Ideographic Description Characters"](b)||mr.Kanbun(b)||mr.Katakana(b)&&b!==12540||!(!mr["Halfwidth and Fullwidth Forms"](b)||b===65288||b===65289||b===65293||b>=65306&&b<=65310||b===65339||b===65341||b===65343||b>=65371&&b<=65503||b===65507||b>=65512&&b<=65519)||!(!mr["Small Form Variants"](b)||b>=65112&&b<=65118||b>=65123&&b<=65126)||mr["Vertical Forms"](b)||mr["Yijing Hexagram Symbols"](b)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(b))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(b))||jx.test(String.fromCodePoint(b)))))}function Ux(b){return!(U_(b)||function(f){return!!(mr["Latin-1 Supplement"](f)&&(f===167||f===169||f===174||f===177||f===188||f===189||f===190||f===215||f===247)||mr["General Punctuation"](f)&&(f===8214||f===8224||f===8225||f===8240||f===8241||f===8251||f===8252||f===8258||f===8263||f===8264||f===8265||f===8273)||mr["Letterlike Symbols"](f)||mr["Number Forms"](f)||mr["Miscellaneous Technical"](f)&&(f>=8960&&f<=8967||f>=8972&&f<=8991||f>=8996&&f<=9e3||f===9003||f>=9085&&f<=9114||f>=9150&&f<=9165||f===9167||f>=9169&&f<=9179||f>=9186&&f<=9215)||mr["Control Pictures"](f)&&f!==9251||mr["Optical Character Recognition"](f)||mr["Enclosed Alphanumerics"](f)||mr["Geometric Shapes"](f)||mr["Miscellaneous Symbols"](f)&&!(f>=9754&&f<=9759)||mr["Miscellaneous Symbols and Arrows"](f)&&(f>=11026&&f<=11055||f>=11088&&f<=11097||f>=11192&&f<=11243)||mr["CJK Symbols and Punctuation"](f)||mr.Katakana(f)||mr["Private Use Area"](f)||mr["CJK Compatibility Forms"](f)||mr["Small Form Variants"](f)||mr["Halfwidth and Fullwidth Forms"](f)||f===8734||f===8756||f===8757||f>=9984&&f<=10087||f>=10102&&f<=10131||f===65532||f===65533)}(b))}const sA=j_(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Yy(b){return sA.test(String.fromCodePoint(b))}function t3(b,f){return!(!f&&Yy(b)||b>=2304&&b<=3583||b>=3840&&b<=4255||mr.Khmer(b))}function Hx(b){for(const f of b)if(Yy(f.charCodeAt(0)))return!0;return!1}const Pd=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(b){this.pluginStatus=b.pluginStatus,this.pluginURL=b.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(b){if(Pd.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=b.applyArabicShaping,this.processBidirectionalText=b.processBidirectionalText,this.processStyledBidirectionalText=b.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(b,f){return a(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if(b.pluginStatus!=="loading")return this.setState(b),b;const _=b.pluginURL,k=new Promise(B=>{this.loadScriptResolve=B});f(_);const N=new Promise(B=>setTimeout(()=>B(),this.TIMEOUT));if(yield Promise.race([k,N]),this.isParsed()){const B={pluginStatus:"loaded",pluginURL:_};return this.setState(B),B}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${_}`)})}};class Qi{constructor(f,_){this.zoom=f,_?(this.now=_.now||0,this.fadeDuration=_.fadeDuration||0,this.zoomHistory=_.zoomHistory||new zx,this.transition=_.transition||{},this.globalState=_.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new zx,this.transition={},this.globalState={})}isSupportedScript(f){return function(_,k){for(const N of _)if(!t3(N.charCodeAt(0),k))return!1;return!0}(f,Pd.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const f=this.zoom,_=f-Math.floor(f),k=this.crossFadingFactor();return f>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:_+(1-_)*k}:{fromScale:.5,toScale:1,t:1-(1-k)*_}}}class Zy{constructor(f,_){this.property=f,this.value=_,this.expression=function(k,N){if(ep(k))return new zy(k,N);if(L_(k)){const B=Ix(k,N);if(B.result==="error")throw new Error(B.value.map(F=>`${F.key}: ${F.message}`).join(", "));return B.value}{let B=k;return N.type==="color"&&typeof k=="string"?B=fr.parse(k):N.type!=="padding"||typeof k!="number"&&!Array.isArray(k)?N.type!=="numberArray"||typeof k!="number"&&!Array.isArray(k)?N.type!=="colorArray"||typeof k!="string"&&!Array.isArray(k)?N.type==="variableAnchorOffsetCollection"&&Array.isArray(k)?B=Sr.parse(k):N.type==="projectionDefinition"&&typeof k=="string"&&(B=Zn.parse(k)):B=ks.parse(k):B=va.parse(k):B=Yo.parse(k),{globalStateRefs:new Set,kind:"constant",evaluate:()=>B}}}(_===void 0?f.specification.default:_,f.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(f,_,k){return this.property.possiblyEvaluate(this,f,_,k)}}class H_{constructor(f){this.property=f,this.value=new Zy(f,void 0)}transitioned(f,_){return new aA(this.property,this.value,_,Lt({},f.transition,this.transition),f.now)}untransitioned(){return new aA(this.property,this.value,null,{},0)}}class Wx{constructor(f){this._properties=f,this._values=Object.create(f.defaultTransitionablePropertyValues)}getValue(f){return cn(this._values[f].value.value)}setValue(f,_){Object.prototype.hasOwnProperty.call(this._values,f)||(this._values[f]=new H_(this._values[f].property)),this._values[f].value=new Zy(this._values[f].property,_===null?void 0:cn(_))}getTransition(f){return cn(this._values[f].transition)}setTransition(f,_){Object.prototype.hasOwnProperty.call(this._values,f)||(this._values[f]=new H_(this._values[f].property)),this._values[f].transition=cn(_)||void 0}serialize(){const f={};for(const _ of Object.keys(this._values)){const k=this.getValue(_);k!==void 0&&(f[_]=k);const N=this.getTransition(_);N!==void 0&&(f[`${_}-transition`]=N)}return f}transitioned(f,_){const k=new lA(this._properties);for(const N of Object.keys(this._values))k._values[N]=this._values[N].transitioned(f,_._values[N]);return k}untransitioned(){const f=new lA(this._properties);for(const _ of Object.keys(this._values))f._values[_]=this._values[_].untransitioned();return f}}class aA{constructor(f,_,k,N,B){this.property=f,this.value=_,this.begin=B+N.delay||0,this.end=this.begin+N.duration||0,f.specification.transition&&(N.delay||N.duration)&&(this.prior=k)}possiblyEvaluate(f,_,k){const N=f.now||0,B=this.value.possiblyEvaluate(f,_,k),F=this.prior;if(F){if(N>this.end)return this.prior=null,B;if(this.value.isDataDriven())return this.prior=null,B;if(NN.zoomHistory.lastIntegerZoom?{from:f,to:_}:{from:k,to:_}}interpolate(f){return f}}class Gx{constructor(f){this.specification=f}possiblyEvaluate(f,_,k,N){if(f.value!==void 0){if(f.expression.kind==="constant"){const B=f.expression.evaluate(_,null,{},k,N);return this._calculate(B,B,B,_)}return this._calculate(f.expression.evaluate(new Qi(Math.floor(_.zoom-1),_)),f.expression.evaluate(new Qi(Math.floor(_.zoom),_)),f.expression.evaluate(new Qi(Math.floor(_.zoom+1),_)),_)}}_calculate(f,_,k,N){return N.zoom>N.zoomHistory.lastIntegerZoom?{from:f,to:_}:{from:k,to:_}}interpolate(f){return f}}class Xy{constructor(f){this.specification=f}possiblyEvaluate(f,_,k,N){return!!f.expression.evaluate(_,null,{},k,N)}interpolate(){return!1}}class Oa{constructor(f){this.properties=f,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const _ in f){const k=f[_];k.specification.overridable&&this.overridableProperties.push(_);const N=this.defaultPropertyValues[_]=new Zy(k,void 0),B=this.defaultTransitionablePropertyValues[_]=new H_(k);this.defaultTransitioningPropertyValues[_]=B.untransitioned(),this.defaultPossiblyEvaluatedValues[_]=N.possiblyEvaluate({})}}}Yt("DataDrivenProperty",Cn),Yt("DataConstantProperty",tn),Yt("CrossFadedDataDrivenProperty",G_),Yt("CrossFadedProperty",Gx),Yt("ColorRampProperty",Xy);const cA="-transition";class Hs extends wt{constructor(f,_){if(super(),this.id=f.id,this.type=f.type,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},f.type!=="custom"&&(this.metadata=f.metadata,this.minzoom=f.minzoom,this.maxzoom=f.maxzoom,f.type!=="background"&&(this.source=f.source,this.sourceLayer=f["source-layer"],this.filter=f.filter,this._featureFilter=Id(f.filter)),_.layout&&(this._unevaluatedLayout=new n3(_.layout)),_.paint)){this._transitionablePaint=new Wx(_.paint);for(const k in f.paint)this.setPaintProperty(k,f.paint[k],{validate:!1});for(const k in f.layout)this.setLayoutProperty(k,f.layout[k],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new W_(_.paint)}}setFilter(f){this.filter=f,this._featureFilter=Id(f)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(f){return f==="visibility"?this.visibility:this._unevaluatedLayout.getValue(f)}getLayoutAffectingGlobalStateRefs(){const f=new Set;if(this._unevaluatedLayout)for(const _ in this._unevaluatedLayout._values){const k=this._unevaluatedLayout._values[_];for(const N of k.getGlobalStateRefs())f.add(N)}for(const _ of this._featureFilter.getGlobalStateRefs())f.add(_);return f}setLayoutProperty(f,_,k={}){_!=null&&this._validate(Bx,`layers.${this.id}.layout.${f}`,f,_,k)||(f!=="visibility"?this._unevaluatedLayout.setValue(f,_):this.visibility=_)}getPaintProperty(f){return f.endsWith(cA)?this._transitionablePaint.getTransition(f.slice(0,-11)):this._transitionablePaint.getValue(f)}setPaintProperty(f,_,k={}){if(_!=null&&this._validate(JR,`layers.${this.id}.paint.${f}`,f,_,k))return!1;if(f.endsWith(cA))return this._transitionablePaint.setTransition(f.slice(0,-11),_||void 0),!1;{const N=this._transitionablePaint._values[f],B=N.property.specification["property-type"]==="cross-faded-data-driven",F=N.value.isDataDriven(),H=N.value;this._transitionablePaint.setValue(f,_),this._handleSpecialPaintPropertyUpdate(f);const X=this._transitionablePaint._values[f].value;return X.isDataDriven()||F||B||this._handleOverridablePaintPropertyUpdate(f,H,X)}}_handleSpecialPaintPropertyUpdate(f){}_handleOverridablePaintPropertyUpdate(f,_,k){return!1}isHidden(f){return!!(this.minzoom&&f=this.maxzoom)||this.visibility==="none"}updateTransitions(f){this._transitioningPaint=this._transitionablePaint.transitioned(f,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(f,_){f.getCrossfadeParameters&&(this._crossfadeParameters=f.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(f,void 0,_)),this.paint=this._transitioningPaint.possiblyEvaluate(f,void 0,_)}serialize(){const f={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(f.layout=f.layout||{},f.layout.visibility=this.visibility),wn(f,(_,k)=>!(_===void 0||k==="layout"&&!Object.keys(_).length||k==="paint"&&!Object.keys(_).length))}_validate(f,_,k,N,B={}){return(!B||B.validate!==!1)&&Wy(this,f.call(Bm,{key:_,layerType:this.type,objectKey:k,value:N,styleSpec:We,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const f in this.paint._values){const _=this.paint.get(f);if(_ instanceof Wu&&Mm(_.property.specification)&&(_.value.kind==="source"||_.value.kind==="composite")&&_.value.isStateDependent)return!0}return!1}}const uA={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class tp{constructor(f,_){this._structArray=f,this._pos1=_*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class lo{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(f,_){return f._trim(),_&&(f.isTransferred=!0,_.push(f.arrayBuffer)),{length:f.length,arrayBuffer:f.arrayBuffer}}static deserialize(f){const _=Object.create(this.prototype);return _.arrayBuffer=f.arrayBuffer,_.length=f.length,_.capacity=f.arrayBuffer.byteLength/_.bytesPerElement,_._refreshViews(),_}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(f){this.reserve(f),this.length=f}reserve(f){if(f>this.capacity){this.capacity=Math.max(f,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const _=this.uint8;this._refreshViews(),_&&this.uint8.set(_)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function wo(b,f=1){let _=0,k=0;return{members:b.map(N=>{const B=uA[N.type].BYTES_PER_ELEMENT,F=_=hA(_,Math.max(f,B)),H=N.components||1;return k=Math.max(k,B),_+=B*H,{name:N.name,type:N.type,components:H,offset:F}}),size:hA(_,Math.max(k,f)),alignment:f}}function hA(b,f){return Math.ceil(b/f)*f}class Nd extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(f,_){const k=this.length;return this.resize(k+1),this.emplace(k,f,_)}emplace(f,_,k){const N=2*f;return this.int16[N+0]=_,this.int16[N+1]=k,f}}Nd.prototype.bytesPerElement=4,Yt("StructArrayLayout2i4",Nd);class Od extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(f,_,k){const N=this.length;return this.resize(N+1),this.emplace(N,f,_,k)}emplace(f,_,k,N){const B=3*f;return this.int16[B+0]=_,this.int16[B+1]=k,this.int16[B+2]=N,f}}Od.prototype.bytesPerElement=6,Yt("StructArrayLayout3i6",Od);class qx extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(f,_,k,N){const B=this.length;return this.resize(B+1),this.emplace(B,f,_,k,N)}emplace(f,_,k,N,B){const F=4*f;return this.int16[F+0]=_,this.int16[F+1]=k,this.int16[F+2]=N,this.int16[F+3]=B,f}}qx.prototype.bytesPerElement=8,Yt("StructArrayLayout4i8",qx);class q_ extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(f,_,k,N,B,F){const H=this.length;return this.resize(H+1),this.emplace(H,f,_,k,N,B,F)}emplace(f,_,k,N,B,F,H){const X=6*f;return this.int16[X+0]=_,this.int16[X+1]=k,this.int16[X+2]=N,this.int16[X+3]=B,this.int16[X+4]=F,this.int16[X+5]=H,f}}q_.prototype.bytesPerElement=12,Yt("StructArrayLayout2i4i12",q_);class np extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(f,_,k,N,B,F){const H=this.length;return this.resize(H+1),this.emplace(H,f,_,k,N,B,F)}emplace(f,_,k,N,B,F,H){const X=4*f,ee=8*f;return this.int16[X+0]=_,this.int16[X+1]=k,this.uint8[ee+4]=N,this.uint8[ee+5]=B,this.uint8[ee+6]=F,this.uint8[ee+7]=H,f}}np.prototype.bytesPerElement=8,Yt("StructArrayLayout2i4ub8",np);class Ky extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(f,_){const k=this.length;return this.resize(k+1),this.emplace(k,f,_)}emplace(f,_,k){const N=2*f;return this.float32[N+0]=_,this.float32[N+1]=k,f}}Ky.prototype.bytesPerElement=8,Yt("StructArrayLayout2f8",Ky);class Yx extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(f,_,k,N,B,F,H,X,ee,ne){const se=this.length;return this.resize(se+1),this.emplace(se,f,_,k,N,B,F,H,X,ee,ne)}emplace(f,_,k,N,B,F,H,X,ee,ne,se){const de=10*f;return this.uint16[de+0]=_,this.uint16[de+1]=k,this.uint16[de+2]=N,this.uint16[de+3]=B,this.uint16[de+4]=F,this.uint16[de+5]=H,this.uint16[de+6]=X,this.uint16[de+7]=ee,this.uint16[de+8]=ne,this.uint16[de+9]=se,f}}Yx.prototype.bytesPerElement=20,Yt("StructArrayLayout10ui20",Yx);class Y_ extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(f,_,k,N,B,F,H,X,ee,ne,se,de){const me=this.length;return this.resize(me+1),this.emplace(me,f,_,k,N,B,F,H,X,ee,ne,se,de)}emplace(f,_,k,N,B,F,H,X,ee,ne,se,de,me){const ge=12*f;return this.int16[ge+0]=_,this.int16[ge+1]=k,this.int16[ge+2]=N,this.int16[ge+3]=B,this.uint16[ge+4]=F,this.uint16[ge+5]=H,this.uint16[ge+6]=X,this.uint16[ge+7]=ee,this.int16[ge+8]=ne,this.int16[ge+9]=se,this.int16[ge+10]=de,this.int16[ge+11]=me,f}}Y_.prototype.bytesPerElement=24,Yt("StructArrayLayout4i4ui4i24",Y_);class Zx extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(f,_,k){const N=this.length;return this.resize(N+1),this.emplace(N,f,_,k)}emplace(f,_,k,N){const B=3*f;return this.float32[B+0]=_,this.float32[B+1]=k,this.float32[B+2]=N,f}}Zx.prototype.bytesPerElement=12,Yt("StructArrayLayout3f12",Zx);class D extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(f){const _=this.length;return this.resize(_+1),this.emplace(_,f)}emplace(f,_){return this.uint32[1*f+0]=_,f}}D.prototype.bytesPerElement=4,Yt("StructArrayLayout1ul4",D);class h extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(f,_,k,N,B,F,H,X,ee){const ne=this.length;return this.resize(ne+1),this.emplace(ne,f,_,k,N,B,F,H,X,ee)}emplace(f,_,k,N,B,F,H,X,ee,ne){const se=10*f,de=5*f;return this.int16[se+0]=_,this.int16[se+1]=k,this.int16[se+2]=N,this.int16[se+3]=B,this.int16[se+4]=F,this.int16[se+5]=H,this.uint32[de+3]=X,this.uint16[se+8]=ee,this.uint16[se+9]=ne,f}}h.prototype.bytesPerElement=20,Yt("StructArrayLayout6i1ul2ui20",h);class v extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(f,_,k,N,B,F){const H=this.length;return this.resize(H+1),this.emplace(H,f,_,k,N,B,F)}emplace(f,_,k,N,B,F,H){const X=6*f;return this.int16[X+0]=_,this.int16[X+1]=k,this.int16[X+2]=N,this.int16[X+3]=B,this.int16[X+4]=F,this.int16[X+5]=H,f}}v.prototype.bytesPerElement=12,Yt("StructArrayLayout2i2i2i12",v);class T extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(f,_,k,N,B){const F=this.length;return this.resize(F+1),this.emplace(F,f,_,k,N,B)}emplace(f,_,k,N,B,F){const H=4*f,X=8*f;return this.float32[H+0]=_,this.float32[H+1]=k,this.float32[H+2]=N,this.int16[X+6]=B,this.int16[X+7]=F,f}}T.prototype.bytesPerElement=16,Yt("StructArrayLayout2f1f2i16",T);class P extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(f,_,k,N,B,F){const H=this.length;return this.resize(H+1),this.emplace(H,f,_,k,N,B,F)}emplace(f,_,k,N,B,F,H){const X=16*f,ee=4*f,ne=8*f;return this.uint8[X+0]=_,this.uint8[X+1]=k,this.float32[ee+1]=N,this.float32[ee+2]=B,this.int16[ne+6]=F,this.int16[ne+7]=H,f}}P.prototype.bytesPerElement=16,Yt("StructArrayLayout2ub2f2i16",P);class R extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(f,_,k){const N=this.length;return this.resize(N+1),this.emplace(N,f,_,k)}emplace(f,_,k,N){const B=3*f;return this.uint16[B+0]=_,this.uint16[B+1]=k,this.uint16[B+2]=N,f}}R.prototype.bytesPerElement=6,Yt("StructArrayLayout3ui6",R);class V extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(f,_,k,N,B,F,H,X,ee,ne,se,de,me,ge,be,Ce,Le){const Xe=this.length;return this.resize(Xe+1),this.emplace(Xe,f,_,k,N,B,F,H,X,ee,ne,se,de,me,ge,be,Ce,Le)}emplace(f,_,k,N,B,F,H,X,ee,ne,se,de,me,ge,be,Ce,Le,Xe){const Be=24*f,pe=12*f,Se=48*f;return this.int16[Be+0]=_,this.int16[Be+1]=k,this.uint16[Be+2]=N,this.uint16[Be+3]=B,this.uint32[pe+2]=F,this.uint32[pe+3]=H,this.uint32[pe+4]=X,this.uint16[Be+10]=ee,this.uint16[Be+11]=ne,this.uint16[Be+12]=se,this.float32[pe+7]=de,this.float32[pe+8]=me,this.uint8[Se+36]=ge,this.uint8[Se+37]=be,this.uint8[Se+38]=Ce,this.uint32[pe+10]=Le,this.int16[Be+22]=Xe,f}}V.prototype.bytesPerElement=48,Yt("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",V);class Y extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(f,_,k,N,B,F,H,X,ee,ne,se,de,me,ge,be,Ce,Le,Xe,Be,pe,Se,Ve,at,Ct,ht,gt,At,Tt){const Pt=this.length;return this.resize(Pt+1),this.emplace(Pt,f,_,k,N,B,F,H,X,ee,ne,se,de,me,ge,be,Ce,Le,Xe,Be,pe,Se,Ve,at,Ct,ht,gt,At,Tt)}emplace(f,_,k,N,B,F,H,X,ee,ne,se,de,me,ge,be,Ce,Le,Xe,Be,pe,Se,Ve,at,Ct,ht,gt,At,Tt,Pt){const vt=32*f,Qt=16*f;return this.int16[vt+0]=_,this.int16[vt+1]=k,this.int16[vt+2]=N,this.int16[vt+3]=B,this.int16[vt+4]=F,this.int16[vt+5]=H,this.int16[vt+6]=X,this.int16[vt+7]=ee,this.uint16[vt+8]=ne,this.uint16[vt+9]=se,this.uint16[vt+10]=de,this.uint16[vt+11]=me,this.uint16[vt+12]=ge,this.uint16[vt+13]=be,this.uint16[vt+14]=Ce,this.uint16[vt+15]=Le,this.uint16[vt+16]=Xe,this.uint16[vt+17]=Be,this.uint16[vt+18]=pe,this.uint16[vt+19]=Se,this.uint16[vt+20]=Ve,this.uint16[vt+21]=at,this.uint16[vt+22]=Ct,this.uint32[Qt+12]=ht,this.float32[Qt+13]=gt,this.float32[Qt+14]=At,this.uint16[vt+30]=Tt,this.uint16[vt+31]=Pt,f}}Y.prototype.bytesPerElement=64,Yt("StructArrayLayout8i15ui1ul2f2ui64",Y);class K extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(f){const _=this.length;return this.resize(_+1),this.emplace(_,f)}emplace(f,_){return this.float32[1*f+0]=_,f}}K.prototype.bytesPerElement=4,Yt("StructArrayLayout1f4",K);class te extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(f,_,k){const N=this.length;return this.resize(N+1),this.emplace(N,f,_,k)}emplace(f,_,k,N){const B=3*f;return this.uint16[6*f+0]=_,this.float32[B+1]=k,this.float32[B+2]=N,f}}te.prototype.bytesPerElement=12,Yt("StructArrayLayout1ui2f12",te);class ie extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(f,_,k){const N=this.length;return this.resize(N+1),this.emplace(N,f,_,k)}emplace(f,_,k,N){const B=4*f;return this.uint32[2*f+0]=_,this.uint16[B+2]=k,this.uint16[B+3]=N,f}}ie.prototype.bytesPerElement=8,Yt("StructArrayLayout1ul2ui8",ie);class ce extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(f,_){const k=this.length;return this.resize(k+1),this.emplace(k,f,_)}emplace(f,_,k){const N=2*f;return this.uint16[N+0]=_,this.uint16[N+1]=k,f}}ce.prototype.bytesPerElement=4,Yt("StructArrayLayout2ui4",ce);class ae extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(f){const _=this.length;return this.resize(_+1),this.emplace(_,f)}emplace(f,_){return this.uint16[1*f+0]=_,f}}ae.prototype.bytesPerElement=2,Yt("StructArrayLayout1ui2",ae);class fe extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(f,_,k,N){const B=this.length;return this.resize(B+1),this.emplace(B,f,_,k,N)}emplace(f,_,k,N,B){const F=4*f;return this.float32[F+0]=_,this.float32[F+1]=k,this.float32[F+2]=N,this.float32[F+3]=B,f}}fe.prototype.bytesPerElement=16,Yt("StructArrayLayout4f16",fe);class _e extends tp{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new y(this.anchorPointX,this.anchorPointY)}}_e.prototype.size=20;class Me extends h{get(f){return new _e(this,f)}}Yt("CollisionBoxArray",Me);class Te extends tp{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(f){this._structArray.uint8[this._pos1+37]=f}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(f){this._structArray.uint8[this._pos1+38]=f}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(f){this._structArray.uint32[this._pos4+10]=f}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Te.prototype.size=48;class Ae extends V{get(f){return new Te(this,f)}}Yt("PlacedSymbolArray",Ae);class Pe extends tp{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(f){this._structArray.uint32[this._pos4+12]=f}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}Pe.prototype.size=64;class Fe extends Y{get(f){return new Pe(this,f)}}Yt("SymbolInstanceArray",Fe);class De extends K{getoffsetX(f){return this.float32[1*f+0]}}Yt("GlyphOffsetArray",De);class je extends Od{getx(f){return this.int16[3*f+0]}gety(f){return this.int16[3*f+1]}gettileUnitDistanceFromAnchor(f){return this.int16[3*f+2]}}Yt("SymbolLineVertexArray",je);class Ge extends tp{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}Ge.prototype.size=12;class Re extends te{get(f){return new Ge(this,f)}}Yt("TextAnchorOffsetArray",Re);class Je extends tp{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}Je.prototype.size=8;class ct extends ie{get(f){return new Je(this,f)}}Yt("FeatureIndexArray",ct);class rt extends Nd{}class ot extends Nd{}class ut extends Nd{}class Rt extends q_{}class Dt extends np{}class kt extends Ky{}class Jt extends Yx{}class tr extends Y_{}class di extends Zx{}class co extends D{}class Li extends v{}class uo extends P{}class Oi extends R{}class Pi extends ce{}const Di=wo([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ws}=Di;class Xr{constructor(f=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=f}prepareSegment(f,_,k,N){const B=this.segments[this.segments.length-1];return f>Xr.MAX_VERTEX_ARRAY_LENGTH&&Bn(`Max vertices per segment is ${Xr.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${f}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${Xr.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!B||B.vertexLength+f>Xr.MAX_VERTEX_ARRAY_LENGTH||B.sortKey!==N?this.createNewSegment(_,k,N):B}createNewSegment(f,_,k){const N={vertexOffset:f.length,primitiveOffset:_.length,vertexLength:0,primitiveLength:0,vaos:{}};return k!==void 0&&(N.sortKey=k),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(N),N}getOrCreateLatestSegment(f,_,k){return this.prepareSegment(0,f,_,k)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const f of this.segments)for(const _ in f.vaos)f.vaos[_].destroy()}static simpleSegment(f,_,k,N){return new Xr([{vertexOffset:f,primitiveOffset:_,vertexLength:k,primitiveLength:N,vaos:{},sortKey:0}])}}function Ms(b,f){return 256*(b=pt(Math.floor(b),0,255))+pt(Math.floor(f),0,255)}Xr.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Yt("SegmentVector",Xr);const Gs=wo([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Dd,Rd,Bd,Gu={exports:{}},Jy={exports:{}},Qy={exports:{}},zm=function(){if(Bd)return Gu.exports;Bd=1;var b=(Dd||(Dd=1,Jy.exports=function(_,k){var N,B,F,H,X,ee,ne,se;for(B=_.length-(N=3&_.length),F=k,X=3432918353,ee=461845907,se=0;se>>16)*X&65535)<<16)&4294967295)<<15|ne>>>17))*ee+(((ne>>>16)*ee&65535)<<16)&4294967295)<<13|F>>>19))+((5*(F>>>16)&65535)<<16)&4294967295))+((58964+(H>>>16)&65535)<<16);switch(ne=0,N){case 3:ne^=(255&_.charCodeAt(se+2))<<16;case 2:ne^=(255&_.charCodeAt(se+1))<<8;case 1:F^=ne=(65535&(ne=(ne=(65535&(ne^=255&_.charCodeAt(se)))*X+(((ne>>>16)*X&65535)<<16)&4294967295)<<15|ne>>>17))*ee+(((ne>>>16)*ee&65535)<<16)&4294967295}return F^=_.length,F=2246822507*(65535&(F^=F>>>16))+((2246822507*(F>>>16)&65535)<<16)&4294967295,F=3266489909*(65535&(F^=F>>>13))+((3266489909*(F>>>16)&65535)<<16)&4294967295,(F^=F>>>16)>>>0}),Jy.exports),f=(Rd||(Rd=1,Qy.exports=function(_,k){for(var N,B=_.length,F=k^B,H=0;B>=4;)N=1540483477*(65535&(N=255&_.charCodeAt(H)|(255&_.charCodeAt(++H))<<8|(255&_.charCodeAt(++H))<<16|(255&_.charCodeAt(++H))<<24))+((1540483477*(N>>>16)&65535)<<16),F=1540483477*(65535&F)+((1540483477*(F>>>16)&65535)<<16)^(N=1540483477*(65535&(N^=N>>>24))+((1540483477*(N>>>16)&65535)<<16)),B-=4,++H;switch(B){case 3:F^=(255&_.charCodeAt(H+2))<<16;case 2:F^=(255&_.charCodeAt(H+1))<<8;case 1:F=1540483477*(65535&(F^=255&_.charCodeAt(H)))+((1540483477*(F>>>16)&65535)<<16)}return F=1540483477*(65535&(F^=F>>>13))+((1540483477*(F>>>16)&65535)<<16),(F^=F>>>15)>>>0}),Qy.exports);return Gu.exports=b,Gu.exports.murmur3=b,Gu.exports.murmur2=f,Gu.exports}(),dl=l(zm);class qc{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(f,_,k,N){this.ids.push(Fd(f)),this.positions.push(_,k,N)}getPositions(f){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const _=Fd(f);let k=0,N=this.ids.length-1;for(;k>1;this.ids[F]>=_?N=F:k=F+1}const B=[];for(;this.ids[k]===_;)B.push({index:this.positions[3*k],start:this.positions[3*k+1],end:this.positions[3*k+2]}),k++;return B}static serialize(f,_){const k=new Float64Array(f.ids),N=new Uint32Array(f.positions);return rp(k,N,0,k.length-1),_&&_.push(k.buffer,N.buffer),{ids:k,positions:N}}static deserialize(f){const _=new qc;return _.ids=f.ids,_.positions=f.positions,_.indexed=!0,_}}function Fd(b){const f=+b;return!isNaN(f)&&f<=Number.MAX_SAFE_INTEGER?f:dl(String(b))}function rp(b,f,_,k){for(;_>1];let B=_-1,F=k+1;for(;;){do B++;while(b[B]N);if(B>=F)break;Io(b,B,F),Io(f,3*B,3*F),Io(f,3*B+1,3*F+1),Io(f,3*B+2,3*F+2)}F-_`u_${N}`),this.type=k}setUniform(f,_,k){f.set(k.constantOr(this.value))}getBinding(f,_,k){return this.type==="color"?new dA(f,_):new Da(f,_)}}class Vm{constructor(f,_){this.uniformNames=_.map(k=>`u_${k}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(f,_){this.pixelRatioFrom=_.pixelRatio,this.pixelRatioTo=f.pixelRatio,this.patternFrom=_.tlbr,this.patternTo=f.tlbr}setUniform(f,_,k,N){const B=N==="u_pattern_to"?this.patternTo:N==="u_pattern_from"?this.patternFrom:N==="u_pixel_ratio_to"?this.pixelRatioTo:N==="u_pixel_ratio_from"?this.pixelRatioFrom:null;B&&f.set(B)}getBinding(f,_,k){return k.substr(0,9)==="u_pattern"?new rs(f,_):new Da(f,_)}}class Lh{constructor(f,_,k,N){this.expression=f,this.type=k,this.maxValue=0,this.paintVertexAttributes=_.map(B=>({name:`a_${B}`,type:"Float32",components:k==="color"?2:1,offset:0})),this.paintVertexArray=new N}populatePaintArray(f,_,k,N,B){const F=this.paintVertexArray.length,H=this.expression.evaluate(new Qi(0),_,{},N,[],B);this.paintVertexArray.resize(f),this._setPaintValue(F,f,H)}updatePaintArray(f,_,k,N){const B=this.expression.evaluate({zoom:0},k,N);this._setPaintValue(f,_,B)}_setPaintValue(f,_,k){if(this.type==="color"){const N=Xx(k);for(let B=f;B<_;B++)this.paintVertexArray.emplace(B,N[0],N[1])}else{for(let N=f;N<_;N++)this.paintVertexArray.emplace(N,k);this.maxValue=Math.max(this.maxValue,Math.abs(k))}}upload(f){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=f.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class qs{constructor(f,_,k,N,B,F){this.expression=f,this.uniformNames=_.map(H=>`u_${H}_t`),this.type=k,this.useIntegerZoom=N,this.zoom=B,this.maxValue=0,this.paintVertexAttributes=_.map(H=>({name:`a_${H}`,type:"Float32",components:k==="color"?4:2,offset:0})),this.paintVertexArray=new F}populatePaintArray(f,_,k,N,B){const F=this.expression.evaluate(new Qi(this.zoom),_,{},N,[],B),H=this.expression.evaluate(new Qi(this.zoom+1),_,{},N,[],B),X=this.paintVertexArray.length;this.paintVertexArray.resize(f),this._setPaintValue(X,f,F,H)}updatePaintArray(f,_,k,N){const B=this.expression.evaluate({zoom:this.zoom},k,N),F=this.expression.evaluate({zoom:this.zoom+1},k,N);this._setPaintValue(f,_,B,F)}_setPaintValue(f,_,k,N){if(this.type==="color"){const B=Xx(k),F=Xx(N);for(let H=f;H<_;H++)this.paintVertexArray.emplace(H,B[0],B[1],F[0],F[1])}else{for(let B=f;B<_;B++)this.paintVertexArray.emplace(B,k,N);this.maxValue=Math.max(this.maxValue,Math.abs(k),Math.abs(N))}}upload(f){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=f.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(f,_){const k=this.useIntegerZoom?Math.floor(_.zoom):_.zoom,N=pt(this.expression.interpolationFactor(k,this.zoom,this.zoom+1),0,1);f.set(N)}getBinding(f,_,k){return new Da(f,_)}}class Ph{constructor(f,_,k,N,B,F){this.expression=f,this.type=_,this.useIntegerZoom=k,this.zoom=N,this.layerId=F,this.zoomInPaintVertexArray=new B,this.zoomOutPaintVertexArray=new B}populatePaintArray(f,_,k){const N=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(f),this.zoomOutPaintVertexArray.resize(f),this._setPaintValues(N,f,_.patterns&&_.patterns[this.layerId],k)}updatePaintArray(f,_,k,N,B){this._setPaintValues(f,_,k.patterns&&k.patterns[this.layerId],B)}_setPaintValues(f,_,k,N){if(!N||!k)return;const{min:B,mid:F,max:H}=k,X=N[B],ee=N[F],ne=N[H];if(X&&ee&&ne)for(let se=f;se<_;se++)this.zoomInPaintVertexArray.emplace(se,ee.tl[0],ee.tl[1],ee.br[0],ee.br[1],X.tl[0],X.tl[1],X.br[0],X.br[1],ee.pixelRatio,X.pixelRatio),this.zoomOutPaintVertexArray.emplace(se,ee.tl[0],ee.tl[1],ee.br[0],ee.br[1],ne.tl[0],ne.tl[1],ne.br[0],ne.br[1],ee.pixelRatio,ne.pixelRatio)}upload(f){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=f.createVertexBuffer(this.zoomInPaintVertexArray,Gs.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=f.createVertexBuffer(this.zoomOutPaintVertexArray,Gs.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Kx{constructor(f,_,k){this.binders={},this._buffers=[];const N=[];for(const B in f.paint._values){if(!k(B))continue;const F=f.paint.get(B);if(!(F instanceof Wu&&Mm(F.property.specification)))continue;const H=Jx(B,f.type),X=F.value,ee=F.property.specification.type,ne=F.property.useIntegerZoom,se=F.property.specification["property-type"],de=se==="cross-faded"||se==="cross-faded-data-driven";if(X.kind==="constant")this.binders[B]=de?new Vm(X.value,H):new ev(X.value,H,ee),N.push(`/u_${B}`);else if(X.kind==="source"||de){const me=Qx(B,ee,"source");this.binders[B]=de?new Ph(X,ee,ne,_,me,f.id):new Lh(X,H,ee,me),N.push(`/a_${B}`)}else{const me=Qx(B,ee,"composite");this.binders[B]=new qs(X,H,ee,ne,_,me),N.push(`/z_${B}`)}}this.cacheKey=N.sort().join("")}getMaxValue(f){const _=this.binders[f];return _ instanceof Lh||_ instanceof qs?_.maxValue:0}populatePaintArrays(f,_,k,N,B){for(const F in this.binders){const H=this.binders[F];(H instanceof Lh||H instanceof qs||H instanceof Ph)&&H.populatePaintArray(f,_,k,N,B)}}setConstantPatternPositions(f,_){for(const k in this.binders){const N=this.binders[k];N instanceof Vm&&N.setConstantPatternPositions(f,_)}}updatePaintArrays(f,_,k,N,B){let F=!1;for(const H in f){const X=_.getPositions(H);for(const ee of X){const ne=k.feature(ee.index);for(const se in this.binders){const de=this.binders[se];if((de instanceof Lh||de instanceof qs||de instanceof Ph)&&de.expression.isStateDependent===!0){const me=N.paint.get(se);de.expression=me.value,de.updatePaintArray(ee.start,ee.end,ne,f[H],B),F=!0}}}}return F}defines(){const f=[];for(const _ in this.binders){const k=this.binders[_];(k instanceof ev||k instanceof Vm)&&f.push(...k.uniformNames.map(N=>`#define HAS_UNIFORM_${N}`))}return f}getBinderAttributes(){const f=[];for(const _ in this.binders){const k=this.binders[_];if(k instanceof Lh||k instanceof qs)for(let N=0;N!0){this.programConfigurations={};for(const N of f)this.programConfigurations[N.id]=new Kx(N,_,k);this.needsUpload=!1,this._featureMap=new qc,this._bufferOffset=0}populatePaintArrays(f,_,k,N,B,F){for(const H in this.programConfigurations)this.programConfigurations[H].populatePaintArrays(f,_,N,B,F);_.id!==void 0&&this._featureMap.add(_.id,k,this._bufferOffset,f),this._bufferOffset=f,this.needsUpload=!0}updatePaintArrays(f,_,k,N){for(const B of k)this.needsUpload=this.programConfigurations[B.id].updatePaintArrays(f,this._featureMap,_,B,N)||this.needsUpload}get(f){return this.programConfigurations[f]}upload(f){if(this.needsUpload){for(const _ in this.programConfigurations)this.programConfigurations[_].upload(f);this.needsUpload=!1}}destroy(){for(const f in this.programConfigurations)this.programConfigurations[f].destroy()}}function Jx(b,f){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[b]||[b.replace(`${f}-`,"").replace(/-/g,"_")]}function Qx(b,f,_){const k={color:{source:Ky,composite:fe},number:{source:K,composite:Ky}},N=function(B){return{"line-pattern":{source:Jt,composite:Jt},"fill-pattern":{source:Jt,composite:Jt},"fill-extrusion-pattern":{source:Jt,composite:Jt}}[B]}(b);return N&&N[_]||k[f][_]}Yt("ConstantBinder",ev),Yt("CrossFadedConstantBinder",Vm),Yt("SourceExpressionBinder",Lh),Yt("CrossFadedCompositeBinder",Ph),Yt("CompositeExpressionBinder",qs),Yt("ProgramConfiguration",Kx,{omit:["_buffers"]}),Yt("ProgramConfigurationSet",$d);const tv=Math.pow(2,14)-1,ZZ=-tv-1;function nv(b){const f=xe/b.extent,_=b.loadGeometry();for(let k=0;k<_.length;k++){const N=_[k];for(let B=0;BF.x+1||XF.y+1)&&Bn("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return _}function rv(b,f){return{type:b.type,id:b.id,properties:b.properties,geometry:f?nv(b):[]}}const XZ=-32768;function Tje(b,f,_,k,N){b.emplaceBack(XZ+8*f+k,XZ+8*_+N)}class i3{constructor(f){this.zoom=f.zoom,this.globalState=f.globalState,this.overscaling=f.overscaling,this.layers=f.layers,this.layerIds=this.layers.map(_=>_.id),this.index=f.index,this.hasPattern=!1,this.layoutVertexArray=new ot,this.indexArray=new Oi,this.segments=new Xr,this.programConfigurations=new $d(f.layers,f.zoom),this.stateDependentLayerIds=this.layers.filter(_=>_.isStateDependent()).map(_=>_.id)}populate(f,_,k){const N=this.layers[0],B=[];let F=null,H=!1,X=N.type==="heatmap";if(N.type==="circle"){const ne=N;F=ne.layout.get("circle-sort-key"),H=!F.isConstant(),X=X||ne.paint.get("circle-pitch-alignment")==="map"}const ee=X?_.subdivisionGranularity.circle:1;for(const{feature:ne,id:se,index:de,sourceLayerIndex:me}of f){const ge=this.layers[0]._featureFilter.needGeometry,be=rv(ne,ge);if(!this.layers[0]._featureFilter.filter(new Qi(this.zoom,{globalState:this.globalState}),be,k))continue;const Ce=H?F.evaluate(be,{},k):void 0,Le={id:se,properties:ne.properties,type:ne.type,sourceLayerIndex:me,index:de,geometry:ge?be.geometry:nv(ne),patterns:{},sortKey:Ce};B.push(Le)}H&&B.sort((ne,se)=>ne.sortKey-se.sortKey);for(const ne of B){const{geometry:se,index:de,sourceLayerIndex:me}=ne,ge=f[de].feature;this.addFeature(ne,se,de,k,ee),_.featureIndex.insert(ge,se,de,me,this.index)}}update(f,_,k){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(f,_,this.stateDependentLayers,k)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(f){this.uploaded||(this.layoutVertexBuffer=f.createVertexBuffer(this.layoutVertexArray,Ws),this.indexBuffer=f.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(f),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(f,_,k,N,B=1){let F;switch(B){case 1:F=[0,7];break;case 3:F=[0,2,5,7];break;case 5:F=[0,1,3,4,6,7];break;case 7:F=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${B}; valid values are 1, 3, 5, 7.`)}const H=F.length;for(const X of _)for(const ee of X){const ne=ee.x,se=ee.y;if(ne<0||ne>=xe||se<0||se>=xe)continue;const de=this.segments.prepareSegment(H*H,this.layoutVertexArray,this.indexArray,f.sortKey),me=de.vertexLength;for(let ge=0;ge1){if(o3(b,f))return!0;for(let k=0;k1?_:_.sub(f)._mult(N)._add(f))}function eX(b,f){let _,k,N,B=!1;for(let F=0;Ff.y!=N.y>f.y&&f.x<(N.x-k.x)*(f.y-k.y)/(N.y-k.y)+k.x&&(B=!B)}return B}function Z_(b,f){let _=!1;for(let k=0,N=b.length-1;kf.y!=F.y>f.y&&f.x<(F.x-B.x)*(f.y-B.y)/(F.y-B.y)+B.x&&(_=!_)}return _}function Lje(b,f,_){const k=_[0],N=_[2];if(b.xN.x&&f.x>N.x||b.yN.y&&f.y>N.y)return!1;const B=Ue(b,f,_[0]);return B!==Ue(b,f,_[1])||B!==Ue(b,f,_[2])||B!==Ue(b,f,_[3])}function eE(b,f,_){const k=f.paint.get(b).value;return k.kind==="constant"?k.value:_.programConfigurations.get(f.id).getMaxValue(b)}function fA(b){return Math.sqrt(b[0]*b[0]+b[1]*b[1])}function pA(b,f,_,k,N){if(!f[0]&&!f[1])return b;const B=y.convert(f)._mult(N);_==="viewport"&&B._rotate(-k);const F=[];for(let H=0;HrX(Xe,be,Ce,Le))}(ee,B,H,X),me=se?ne*F:ne;for(const ge of N)for(const be of ge){const Ce=se?be:rX(be,B,H,X);let Le=me;const Xe=B.projectTileCoordinates(be.x,be.y,H,X).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?Le*=Xe/B.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(Le*=B.cameraToCenterDistance/Xe),Mje(de,Ce,Le))return!0}return!1}}function rX(b,f,_,k){const N=f.projectTileCoordinates(b.x,b.y,_,k).point;return new y((.5*N.x+.5)*f.width,(.5*-N.y+.5)*f.height)}class iX extends i3{}let oX;Yt("HeatmapBucket",iX,{omit:["layers"]});var Oje={get paint(){return oX=oX||new Oa({"heatmap-radius":new Cn(We.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Cn(We.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new tn(We.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Xy(We.paint_heatmap["heatmap-color"]),"heatmap-opacity":new tn(We.paint_heatmap["heatmap-opacity"])})}};function a3(b,{width:f,height:_},k,N){if(N){if(N instanceof Uint8ClampedArray)N=new Uint8Array(N.buffer);else if(N.length!==f*_*k)throw new RangeError(`mismatched image size. expected: ${N.length} but got: ${f*_*k}`)}else N=new Uint8Array(f*_*k);return b.width=f,b.height=_,b.data=N,b}function sX(b,{width:f,height:_},k){if(f===b.width&&_===b.height)return;const N=a3({},{width:f,height:_},k);l3(b,N,{x:0,y:0},{x:0,y:0},{width:Math.min(b.width,f),height:Math.min(b.height,_)},k),b.width=f,b.height=_,b.data=N.data}function l3(b,f,_,k,N,B){if(N.width===0||N.height===0)return f;if(N.width>b.width||N.height>b.height||_.x>b.width-N.width||_.y>b.height-N.height)throw new RangeError("out of range source coordinates for image copy");if(N.width>f.width||N.height>f.height||k.x>f.width-N.width||k.y>f.height-N.height)throw new RangeError("out of range destination coordinates for image copy");const F=b.data,H=f.data;if(F===H)throw new Error("srcData equals dstData, so image is already copied");for(let X=0;X{f[b.evaluationKey]=X;const ee=b.expression.evaluate(f);N.setPixel(F/4/_,H/4,ee)};if(b.clips)for(let F=0,H=0;Fthis.max&&(this.max=se),se=this.dim+1||_<-1||_>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(_+1)*this.stride+(f+1)}unpack(f,_,k){return f*this.redFactor+_*this.greenFactor+k*this.blueFactor-this.baseShift}pack(f){return hX(f,this.getUnpackVector())}getPixels(){return new Bl({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(f,_,k){if(this.dim!==f.dim)throw new Error("dem dimension mismatch");let N=_*this.dim,B=_*this.dim+this.dim,F=k*this.dim,H=k*this.dim+this.dim;switch(_){case-1:N=B-1;break;case 1:B=N+1}switch(k){case-1:F=H-1;break;case 1:H=F+1}const X=-_*this.dim,ee=-k*this.dim;for(let ne=F;ne0)for(let F=f;F<_;F+=k)B=gX(F/k|0,b[F],b[F+1],B);else for(let F=_-k;F>=f;F-=k)B=gX(F/k|0,b[F],b[F+1],B);return B&&X_(B,B.next)&&(oE(B),B=B.next),B}function iv(b,f){if(!b)return b;f||(f=b);let _,k=b;do if(_=!1,k.steiner||!X_(k,k.next)&&jo(k.prev,k,k.next)!==0)k=k.next;else{if(oE(k),k=f=k.prev,k===k.next)break;_=!0}while(_||k!==f);return f}function nE(b,f,_,k,N,B,F){if(!b)return;!F&&B&&function(X,ee,ne,se){let de=X;do de.z===0&&(de.z=f3(de.x,de.y,ee,ne,se)),de.prevZ=de.prev,de.nextZ=de.next,de=de.next;while(de!==X);de.prevZ.nextZ=null,de.prevZ=null,function(me){let ge,be=1;do{let Ce,Le=me;me=null;let Xe=null;for(ge=0;Le;){ge++;let Be=Le,pe=0;for(let Ve=0;Ve0||Se>0&&Be;)pe!==0&&(Se===0||!Be||Le.z<=Be.z)?(Ce=Le,Le=Le.nextZ,pe--):(Ce=Be,Be=Be.nextZ,Se--),Xe?Xe.nextZ=Ce:me=Ce,Ce.prevZ=Xe,Xe=Ce;Le=Be}Xe.nextZ=null,be*=2}while(ge>1)}(de)}(b,k,N,B);let H=b;for(;b.prev!==b.next;){const X=b.prev,ee=b.next;if(B?Uje(b,k,N,B):jje(b))f.push(X.i,b.i,ee.i),oE(b),b=ee.next,H=ee.next;else if((b=ee)===H){F?F===1?nE(b=Hje(iv(b),f),f,_,k,N,B,2):F===2&&Wje(b,f,_,k,N,B):nE(iv(b),f,_,k,N,B,1);break}}}function jje(b){const f=b.prev,_=b,k=b.next;if(jo(f,_,k)>=0)return!1;const N=f.x,B=_.x,F=k.x,H=f.y,X=_.y,ee=k.y,ne=Math.min(N,B,F),se=Math.min(H,X,ee),de=Math.max(N,B,F),me=Math.max(H,X,ee);let ge=k.next;for(;ge!==f;){if(ge.x>=ne&&ge.x<=de&&ge.y>=se&&ge.y<=me&&rE(N,H,B,X,F,ee,ge.x,ge.y)&&jo(ge.prev,ge,ge.next)>=0)return!1;ge=ge.next}return!0}function Uje(b,f,_,k){const N=b.prev,B=b,F=b.next;if(jo(N,B,F)>=0)return!1;const H=N.x,X=B.x,ee=F.x,ne=N.y,se=B.y,de=F.y,me=Math.min(H,X,ee),ge=Math.min(ne,se,de),be=Math.max(H,X,ee),Ce=Math.max(ne,se,de),Le=f3(me,ge,f,_,k),Xe=f3(be,Ce,f,_,k);let Be=b.prevZ,pe=b.nextZ;for(;Be&&Be.z>=Le&&pe&&pe.z<=Xe;){if(Be.x>=me&&Be.x<=be&&Be.y>=ge&&Be.y<=Ce&&Be!==N&&Be!==F&&rE(H,ne,X,se,ee,de,Be.x,Be.y)&&jo(Be.prev,Be,Be.next)>=0||(Be=Be.prevZ,pe.x>=me&&pe.x<=be&&pe.y>=ge&&pe.y<=Ce&&pe!==N&&pe!==F&&rE(H,ne,X,se,ee,de,pe.x,pe.y)&&jo(pe.prev,pe,pe.next)>=0))return!1;pe=pe.nextZ}for(;Be&&Be.z>=Le;){if(Be.x>=me&&Be.x<=be&&Be.y>=ge&&Be.y<=Ce&&Be!==N&&Be!==F&&rE(H,ne,X,se,ee,de,Be.x,Be.y)&&jo(Be.prev,Be,Be.next)>=0)return!1;Be=Be.prevZ}for(;pe&&pe.z<=Xe;){if(pe.x>=me&&pe.x<=be&&pe.y>=ge&&pe.y<=Ce&&pe!==N&&pe!==F&&rE(H,ne,X,se,ee,de,pe.x,pe.y)&&jo(pe.prev,pe,pe.next)>=0)return!1;pe=pe.nextZ}return!0}function Hje(b,f){let _=b;do{const k=_.prev,N=_.next.next;!X_(k,N)&&pX(k,_,_.next,N)&&iE(k,N)&&iE(N,k)&&(f.push(k.i,_.i,N.i),oE(_),oE(_.next),_=b=N),_=_.next}while(_!==b);return iv(_)}function Wje(b,f,_,k,N,B){let F=b;do{let H=F.next.next;for(;H!==F.prev;){if(F.i!==H.i&&Xje(F,H)){let X=mX(F,H);return F=iv(F,F.next),X=iv(X,X.next),nE(F,f,_,k,N,B,0),void nE(X,f,_,k,N,B,0)}H=H.next}F=F.next}while(F!==b)}function Gje(b,f){let _=b.x-f.x;return _===0&&(_=b.y-f.y,_===0)&&(_=(b.next.y-b.y)/(b.next.x-b.x)-(f.next.y-f.y)/(f.next.x-f.x)),_}function qje(b,f){const _=function(N,B){let F=B;const H=N.x,X=N.y;let ee,ne=-1/0;if(X_(N,F))return F;do{if(X_(N,F.next))return F.next;if(X<=F.y&&X>=F.next.y&&F.next.y!==F.y){const be=F.x+(X-F.y)*(F.next.x-F.x)/(F.next.y-F.y);if(be<=H&&be>ne&&(ne=be,ee=F.x=F.x&&F.x>=de&&H!==F.x&&fX(Xee.x||F.x===ee.x&&Yje(ee,F)))&&(ee=F,ge=be)}F=F.next}while(F!==se);return ee}(b,f);if(!_)return f;const k=mX(_,b);return iv(k,k.next),iv(_,_.next)}function Yje(b,f){return jo(b.prev,b,f.prev)<0&&jo(f.next,b,b.next)<0}function f3(b,f,_,k,N){return(b=1431655765&((b=858993459&((b=252645135&((b=16711935&((b=(b-_)*N|0)|b<<8))|b<<4))|b<<2))|b<<1))|(f=1431655765&((f=858993459&((f=252645135&((f=16711935&((f=(f-k)*N|0)|f<<8))|f<<4))|f<<2))|f<<1))<<1}function Zje(b){let f=b,_=b;do(f.x<_.x||f.x===_.x&&f.y<_.y)&&(_=f),f=f.next;while(f!==b);return _}function fX(b,f,_,k,N,B,F,H){return(N-F)*(f-H)>=(b-F)*(B-H)&&(b-F)*(k-H)>=(_-F)*(f-H)&&(_-F)*(B-H)>=(N-F)*(k-H)}function rE(b,f,_,k,N,B,F,H){return!(b===F&&f===H)&&fX(b,f,_,k,N,B,F,H)}function Xje(b,f){return b.next.i!==f.i&&b.prev.i!==f.i&&!function(_,k){let N=_;do{if(N.i!==_.i&&N.next.i!==_.i&&N.i!==k.i&&N.next.i!==k.i&&pX(N,N.next,_,k))return!0;N=N.next}while(N!==_);return!1}(b,f)&&(iE(b,f)&&iE(f,b)&&function(_,k){let N=_,B=!1;const F=(_.x+k.x)/2,H=(_.y+k.y)/2;do N.y>H!=N.next.y>H&&N.next.y!==N.y&&F<(N.next.x-N.x)*(H-N.y)/(N.next.y-N.y)+N.x&&(B=!B),N=N.next;while(N!==_);return B}(b,f)&&(jo(b.prev,b,f.prev)||jo(b,f.prev,f))||X_(b,f)&&jo(b.prev,b,b.next)>0&&jo(f.prev,f,f.next)>0)}function jo(b,f,_){return(f.y-b.y)*(_.x-f.x)-(f.x-b.x)*(_.y-f.y)}function X_(b,f){return b.x===f.x&&b.y===f.y}function pX(b,f,_,k){const N=gA(jo(b,f,_)),B=gA(jo(b,f,k)),F=gA(jo(_,k,b)),H=gA(jo(_,k,f));return N!==B&&F!==H||!(N!==0||!mA(b,_,f))||!(B!==0||!mA(b,k,f))||!(F!==0||!mA(_,b,k))||!(H!==0||!mA(_,f,k))}function mA(b,f,_){return f.x<=Math.max(b.x,_.x)&&f.x>=Math.min(b.x,_.x)&&f.y<=Math.max(b.y,_.y)&&f.y>=Math.min(b.y,_.y)}function gA(b){return b>0?1:b<0?-1:0}function iE(b,f){return jo(b.prev,b,b.next)<0?jo(b,f,b.next)>=0&&jo(b,b.prev,f)>=0:jo(b,f,b.prev)<0||jo(b,b.next,f)<0}function mX(b,f){const _=p3(b.i,b.x,b.y),k=p3(f.i,f.x,f.y),N=b.next,B=f.prev;return b.next=f,f.prev=b,_.next=N,N.prev=_,k.next=_,_.prev=k,B.next=k,k.prev=B,k}function gX(b,f,_,k){const N=p3(b,f,_);return k?(N.next=k.next,N.prev=k,k.next.prev=N,k.next=N):(N.prev=N,N.next=N),N}function oE(b){b.next.prev=b.prev,b.prev.next=b.next,b.prevZ&&(b.prevZ.nextZ=b.nextZ),b.nextZ&&(b.nextZ.prevZ=b.prevZ)}function p3(b,f,_){return{i:b,x:f,y:_,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class K_{constructor(f,_){if(_>f)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=f,this._minGranularity=_}getGranularityForZoomLevel(f){return Math.max(Math.floor(this._baseZoomGranularity/(1<32767||_>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const k=0|Math.round(f),N=0|Math.round(_),B=this._getKey(k,N);if(this._vertexDictionary.has(B))return this._vertexDictionary.get(B);const F=this._vertexBuffer.length/2;return this._vertexDictionary.set(B,F),this._vertexBuffer.push(k,N),F}_subdivideTrianglesScanline(f){if(this._granularity<2)return function(N,B){const F=[];for(let H=0;H0?(F.push(X),F.push(ne),F.push(ee)):(F.push(X),F.push(ee),F.push(ne))}return F}(this._vertexBuffer,f);const _=[],k=f.length;for(let N=0;N=1||Se<=0)||Le&&(eeB)){se>=N&&se<=B&&F.push(k[(H+1)%3]);continue}!Le&&pe>0&&F.push(this._vertexToIndex(X+ge*pe,ee+be*pe));const Ve=X+ge*Math.max(pe,0),at=X+ge*Math.min(Se,1);Ce||this._generateIntraEdgeVertices(F,X,ee,ne,se,Ve,at),!Le&&Se<1&&F.push(this._vertexToIndex(X+ge*Se,ee+be*Se)),(Le||se>=N&&se<=B)&&F.push(k[(H+1)%3]),!Le&&(se<=N||se>=B)&&this._generateInterEdgeVertices(F,X,ee,ne,se,de,me,at,N,B)}return F}_generateIntraEdgeVertices(f,_,k,N,B,F,H){const X=N-_,ee=B-k,ne=ee===0,se=ne?Math.min(_,N):Math.min(F,H),de=ne?Math.max(_,N):Math.max(F,H),me=Math.floor(se/this._granularityCellSize)+1,ge=Math.ceil(de/this._granularityCellSize)-1;if(ne?_=me;be--){const Ce=be*this._granularityCellSize;f.push(this._vertexToIndex(Ce,k+ee*(Ce-_)/X))}}_generateInterEdgeVertices(f,_,k,N,B,F,H,X,ee,ne){const se=B-k,de=F-N,me=H-B,ge=(ee-B)/me,be=(ne-B)/me,Ce=Math.min(ge,be),Le=Math.max(ge,be),Xe=N+de*Ce;let Be=Math.floor(Math.min(Xe,X)/this._granularityCellSize)+1,pe=Math.ceil(Math.max(Xe,X)/this._granularityCellSize)-1,Se=X=1||Le<=0){const Ct=k-H,ht=F+(_-F)*Math.min((ee-H)/Ct,(ne-H)/Ct);Be=Math.floor(Math.min(ht,X)/this._granularityCellSize)+1,pe=Math.ceil(Math.max(ht,X)/this._granularityCellSize)-1,Se=X0?ne:ee;if(Se)for(let Ct=Be;Ct<=pe;Ct++)f.push(this._vertexToIndex(Ct*this._granularityCellSize,at));else for(let Ct=pe;Ct>=Be;Ct--)f.push(this._vertexToIndex(Ct*this._granularityCellSize,at))}_generateOutline(f){const _=[];for(const k of f){const N=ov(k,this._granularity,!0),B=this._pointArrayToIndices(N),F=[];for(let H=1;HB!=(F===J_)?(f.push(_),f.push(k),f.push(this._vertexToIndex(N,F)),f.push(k),f.push(this._vertexToIndex(B,F)),f.push(this._vertexToIndex(N,F))):(f.push(k),f.push(_),f.push(this._vertexToIndex(N,F)),f.push(this._vertexToIndex(B,F)),f.push(k),f.push(this._vertexToIndex(N,F)))}_fillPoles(f,_,k){const N=this._vertexBuffer,B=xe,F=f.length;for(let H=2;H80*se){Ce=1/0,Le=1/0;let Be=-1/0,pe=-1/0;for(let Se=se;SeBe&&(Be=Ve),at>pe&&(pe=at)}Xe=Math.max(Be-Ce,pe-Le),Xe=Xe!==0?32767/Xe:0}return nE(ge,be,se,Ce,Le,Xe,0),be}(k,N),X=this._convertIndices(k,H);B=this._subdivideTrianglesScanline(X)}catch(H){console.error(H)}let F=[];return _&&(F=this._generateOutline(f)),this._ensureNoPoleVertices(),this._handlePoles(B),{verticesFlattened:this._vertexBuffer,indicesTriangles:B,indicesLineList:F}}_convertIndices(f,_){const k=[];for(let N=0;N<_.length;N++)k.push(this._vertexToIndex(f[2*_[N]],f[2*_[N]+1]));return k}_pointArrayToIndices(f){const _=[];for(let k=0;k0?(Math.floor(at/F)+1)*F:(Math.ceil(at/F)-1)*F,At=pe>0?(Math.floor(Ct/F)+1)*F:(Math.ceil(Ct/F)-1)*F,Tt=Math.abs(at-gt),Pt=Math.abs(Ct-At),vt=Math.abs(at-be),Qt=Math.abs(Ct-Ce),En=Le?Tt/Se:Number.POSITIVE_INFINITY,bn=Xe?Pt/Ve:Number.POSITIVE_INFINITY;if((vt<=Tt||!Le)&&(Qt<=Pt||!Xe))break;if(En=0?F-1:B-1,ee=(H+1)%B,ne=b[2*f[X]],se=b[2*f[ee]],de=b[2*f[F]],me=b[2*f[F]+1],ge=b[2*f[H]+1];let be=!1;if(nese)be=!1;else{const Ce=ge-me,Le=-(b[2*f[H]]-de),Xe=me((se-de)*Ce+(b[2*f[ee]+1]-me)*Le)*Xe&&(be=!0)}if(be){const Ce=f[X],Le=f[F],Xe=f[H];Ce!==Le&&Ce!==Xe&&Le!==Xe&&_.push(Xe,Le,Ce),F--,F<0&&(F=B-1)}else{const Ce=f[ee],Le=f[F],Xe=f[H];Ce!==Le&&Ce!==Xe&&Le!==Xe&&_.push(Xe,Le,Ce),H++,H>=B&&(H=0)}if(X===ee)break}}function vX(b,f,_,k,N,B,F,H,X){const ee=N.length/2,ne=F&&H&&X;if(eeXr.MAX_VERTEX_ARRAY_LENGTH&&(pe=se.createNewSegment(de,me),Be=Xe.count,gt=!0,At=!0,Tt=!0,Se=0);const Pt=aE(Le,ge,Ce,Xe,at,gt,pe),vt=aE(Le,ge,Ce,Xe,Ct,At,pe),Qt=aE(Le,ge,Ce,Xe,ht,Tt,pe);me.emplaceBack(Se+Pt-Be,Se+vt-Be,Se+Qt-Be),pe.primitiveLength++}})(f,_,k,N,B,b),ne&&function(se,de,me,ge,be,Ce){const Le=[];for(let Ve=0;VeXr.MAX_VERTEX_ARRAY_LENGTH&&(pe=se.createNewSegment(de,me),Be=Xe.count,At=!0,Tt=!0,Se=0);const Pt=aE(Le,ge,Ce,Xe,ht,At,pe),vt=aE(Le,ge,Ce,Xe,gt,Tt,pe);me.emplaceBack(Se+Pt-Be,Se+vt-Be),pe.primitiveLength++}}}(F,_,H,N,X,b),f.forceNewSegmentOnNextPrepare(),F==null||F.forceNewSegmentOnNextPrepare()}function aE(b,f,_,k,N,B,F){if(B){const H=k.count;return _(f[2*N],f[2*N+1]),b[N]=k.count,k.count++,F.vertexLength++,H}return b[N]}class m3{constructor(f){this.zoom=f.zoom,this.globalState=f.globalState,this.overscaling=f.overscaling,this.layers=f.layers,this.layerIds=this.layers.map(_=>_.id),this.index=f.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ut,this.indexArray=new Oi,this.indexArray2=new Pi,this.programConfigurations=new $d(f.layers,f.zoom),this.segments=new Xr,this.segments2=new Xr,this.stateDependentLayerIds=this.layers.filter(_=>_.isStateDependent()).map(_=>_.id)}populate(f,_,k){this.hasPattern=h3("fill",this.layers,_);const N=this.layers[0].layout.get("fill-sort-key"),B=!N.isConstant(),F=[];for(const{feature:H,id:X,index:ee,sourceLayerIndex:ne}of f){const se=this.layers[0]._featureFilter.needGeometry,de=rv(H,se);if(!this.layers[0]._featureFilter.filter(new Qi(this.zoom,{globalState:this.globalState}),de,k))continue;const me=B?N.evaluate(de,{},k,_.availableImages):void 0,ge={id:X,properties:H.properties,type:H.type,sourceLayerIndex:ne,index:ee,geometry:se?de.geometry:nv(H),patterns:{},sortKey:me};F.push(ge)}B&&F.sort((H,X)=>H.sortKey-X.sortKey);for(const H of F){const{geometry:X,index:ee,sourceLayerIndex:ne}=H;if(this.hasPattern){const se=d3("fill",this.layers,H,this.zoom,_);this.patternFeatures.push(se)}else this.addFeature(H,X,ee,k,{},_.subdivisionGranularity);_.featureIndex.insert(f[ee].feature,X,ee,ne,this.index)}}update(f,_,k){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(f,_,this.stateDependentLayers,k)}addFeatures(f,_,k){for(const N of this.patternFeatures)this.addFeature(N,N.geometry,N.index,_,k,f.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(f){this.uploaded||(this.layoutVertexBuffer=f.createVertexBuffer(this.layoutVertexArray,Vje),this.indexBuffer=f.createIndexBuffer(this.indexArray),this.indexBuffer2=f.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(f),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(f,_,k,N,B,F){for(const H of E_(_,500)){const X=yX(H,N,F.fill.getGranularityForZoomLevel(N.z)),ee=this.layoutVertexArray;vX((ne,se)=>{ee.emplaceBack(ne,se)},this.segments,this.layoutVertexArray,this.indexArray,X.verticesFlattened,X.indicesTriangles,this.segments2,this.indexArray2,X.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,f,k,B,N)}}let _X,bX;Yt("FillBucket",m3,{omit:["layers","patternFeatures"]});var Qje={get paint(){return bX=bX||new Oa({"fill-antialias":new tn(We.paint_fill["fill-antialias"]),"fill-opacity":new Cn(We.paint_fill["fill-opacity"]),"fill-color":new Cn(We.paint_fill["fill-color"]),"fill-outline-color":new Cn(We.paint_fill["fill-outline-color"]),"fill-translate":new tn(We.paint_fill["fill-translate"]),"fill-translate-anchor":new tn(We.paint_fill["fill-translate-anchor"]),"fill-pattern":new G_(We.paint_fill["fill-pattern"])})},get layout(){return _X=_X||new Oa({"fill-sort-key":new Cn(We.layout_fill["fill-sort-key"])})}};class e9e extends Hs{constructor(f){super(f,Qje)}recalculate(f,_){super.recalculate(f,_);const k=this.paint._values["fill-outline-color"];k.value.kind==="constant"&&k.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(f){return new m3(f)}queryRadius(){return fA(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:f,geometry:_,transform:k,pixelsToTileUnits:N}){return JZ(pA(f,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-k.bearingInRadians,N),_)}isTileClipped(){return!0}}const t9e=wo([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),n9e=wo([{name:"a_centroid",components:2,type:"Int16"}],4),{members:r9e}=t9e;var g3,wX,y3,xX,v3,EX,SX,vA={};function CX(){if(wX)return g3;wX=1;var b=d();function f(N,B,F,H,X){this.properties={},this.extent=F,this.type=0,this._pbf=N,this._geometry=-1,this._keys=H,this._values=X,N.readFields(_,this,B)}function _(N,B,F){N==1?B.id=F.readVarint():N==2?function(H,X){for(var ee=H.readVarint()+H.pos;H.pos>3}if(X--,H===1||H===2)ee+=N.readSVarint(),ne+=N.readSVarint(),H===1&&(B&&se.push(B),B=[]),B.push(new b(ee,ne));else{if(H!==7)throw new Error("unknown command "+H);B&&B.push(B[0].clone())}}return B&&se.push(B),se},f.prototype.bbox=function(){var N=this._pbf;N.pos=this._geometry;for(var B=N.readVarint()+N.pos,F=1,H=0,X=0,ee=0,ne=1/0,se=-1/0,de=1/0,me=-1/0;N.pos>3}if(H--,F===1||F===2)(X+=N.readSVarint())se&&(se=X),(ee+=N.readSVarint())me&&(me=ee);else if(F!==7)throw new Error("unknown command "+F)}return[ne,de,se,me]},f.prototype.toGeoJSON=function(N,B,F){var H,X,ee=this.extent*Math.pow(2,F),ne=this.extent*N,se=this.extent*B,de=this.loadGeometry(),me=f.types[this.type];function ge(Le){for(var Xe=0;Xe>3;H=ee===1?F.readString():ee===2?F.readFloat():ee===3?F.readDouble():ee===4?F.readVarint64():ee===5?F.readVarint():ee===6?F.readSVarint():ee===7?F.readBoolean():null}return H}(B))}return y3=f,f.prototype.feature=function(k){if(k<0||k>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[k];var N=this._pbf.readVarint()+this._pbf.pos;return new b(this._pbf,N,this.extent,this._keys,this._values)},y3}function TX(){return SX||(SX=1,vA.VectorTile=function(){if(EX)return v3;EX=1;var b=kX();function f(_,k,N){if(_===3){var B=new b(N,N.readVarint()+N.pos);B.length&&(k[B.name]=B)}}return v3=function(_,k){this.layers=_.readFields(f,{},k)},v3}(),vA.VectorTileFeature=CX(),vA.VectorTileLayer=kX()),vA}var lE=l(TX());const i9e=lE.VectorTileFeature.types,_3=Math.pow(2,13);function cE(b,f,_,k,N,B,F,H){b.emplaceBack(f,_,2*Math.floor(k*_3)+F,N*_3*2,B*_3*2,Math.round(H))}class b3{constructor(f){this.zoom=f.zoom,this.globalState=f.globalState,this.overscaling=f.overscaling,this.layers=f.layers,this.layerIds=this.layers.map(_=>_.id),this.index=f.index,this.hasPattern=!1,this.layoutVertexArray=new Rt,this.centroidVertexArray=new rt,this.indexArray=new Oi,this.programConfigurations=new $d(f.layers,f.zoom),this.segments=new Xr,this.stateDependentLayerIds=this.layers.filter(_=>_.isStateDependent()).map(_=>_.id)}populate(f,_,k){this.features=[],this.hasPattern=h3("fill-extrusion",this.layers,_);for(const{feature:N,id:B,index:F,sourceLayerIndex:H}of f){const X=this.layers[0]._featureFilter.needGeometry,ee=rv(N,X);if(!this.layers[0]._featureFilter.filter(new Qi(this.zoom,{globalState:this.globalState}),ee,k))continue;const ne={id:B,sourceLayerIndex:H,index:F,geometry:X?ee.geometry:nv(N),properties:N.properties,type:N.type,patterns:{}};this.hasPattern?this.features.push(d3("fill-extrusion",this.layers,ne,this.zoom,_)):this.addFeature(ne,ne.geometry,F,k,{},_.subdivisionGranularity),_.featureIndex.insert(N,ne.geometry,F,H,this.index,!0)}}addFeatures(f,_,k){for(const N of this.features){const{geometry:B}=N;this.addFeature(N,B,N.index,_,k,f.subdivisionGranularity)}}update(f,_,k){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(f,_,this.stateDependentLayers,k)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(f){this.uploaded||(this.layoutVertexBuffer=f.createVertexBuffer(this.layoutVertexArray,r9e),this.centroidVertexBuffer=f.createVertexBuffer(this.centroidVertexArray,n9e.members,!0),this.indexBuffer=f.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(f),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(f,_,k,N,B,F){for(const H of E_(_,500)){const X={x:0,y:0,sampleCount:0},ee=this.layoutVertexArray.length;this.processPolygon(X,N,f,H,F);const ne=this.layoutVertexArray.length-ee,se=Math.floor(X.x/X.sampleCount),de=Math.floor(X.y/X.sampleCount);for(let me=0;me{cE(ne,se,de,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,ee.verticesFlattened,ee.indicesTriangles)}_generateSideFaces(f,_){let k=0;for(let N=1;NXr.MAX_VERTEX_ARRAY_LENGTH&&(_.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const H=B.sub(F)._perp()._unit(),X=F.dist(B);k+X>32768&&(k=0),cE(this.layoutVertexArray,B.x,B.y,H.x,H.y,0,0,k),cE(this.layoutVertexArray,B.x,B.y,H.x,H.y,0,1,k),k+=X,cE(this.layoutVertexArray,F.x,F.y,H.x,H.y,0,0,k),cE(this.layoutVertexArray,F.x,F.y,H.x,H.y,0,1,k);const ee=_.segment.vertexLength;this.indexArray.emplaceBack(ee,ee+2,ee+1),this.indexArray.emplaceBack(ee+1,ee+2,ee+3),_.segment.vertexLength+=4,_.segment.primitiveLength+=2}}}function o9e(b,f){for(let _=0;_xe)||b.y===f.y&&(b.y<0||b.y>xe)}function MX(b){return b.every(f=>f.x<0)||b.every(f=>f.x>xe)||b.every(f=>f.y<0)||b.every(f=>f.y>xe)}let AX;Yt("FillExtrusionBucket",b3,{omit:["layers","features"]});var a9e={get paint(){return AX=AX||new Oa({"fill-extrusion-opacity":new tn(We["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Cn(We["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new tn(We["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new tn(We["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new G_(We["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Cn(We["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Cn(We["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new tn(We["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class l9e extends Hs{constructor(f){super(f,a9e)}createBucket(f){return new b3(f)}queryRadius(){return fA(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:f,feature:_,featureState:k,geometry:N,transform:B,pixelsToTileUnits:F,pixelPosMatrix:H}){const X=pA(f,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-B.bearingInRadians,F),ee=this.paint.get("fill-extrusion-height").evaluate(_,k),ne=this.paint.get("fill-extrusion-base").evaluate(_,k),se=function(me,ge){const be=[];for(const Ce of me){const Le=[Ce.x,Ce.y,0,1];Q(Le,Le,ge),be.push(new y(Le[0]/Le[3],Le[1]/Le[3]))}return be}(X,H),de=function(me,ge,be,Ce){const Le=[],Xe=[],Be=Ce[8]*ge,pe=Ce[9]*ge,Se=Ce[10]*ge,Ve=Ce[11]*ge,at=Ce[8]*be,Ct=Ce[9]*be,ht=Ce[10]*be,gt=Ce[11]*be;for(const At of me){const Tt=[],Pt=[];for(const vt of At){const Qt=vt.x,En=vt.y,bn=Ce[0]*Qt+Ce[4]*En+Ce[12],ln=Ce[1]*Qt+Ce[5]*En+Ce[13],vr=Ce[2]*Qt+Ce[6]*En+Ce[14],xo=Ce[3]*Qt+Ce[7]*En+Ce[15],is=vr+Se,ba=xo+Ve,Zc=bn+at,Fl=ln+Ct,Ys=vr+ht,ho=xo+gt,Is=new y((bn+Be)/ba,(ln+pe)/ba);Is.z=is/ba,Tt.push(Is);const Zs=new y(Zc/ho,Fl/ho);Zs.z=Ys/ho,Pt.push(Zs)}Le.push(Tt),Xe.push(Pt)}return[Le,Xe]}(N,ne,ee,H);return function(me,ge,be){let Ce=1/0;JZ(be,ge)&&(Ce=IX(be,ge[0]));for(let Le=0;Le_.id),this.index=f.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(_=>{this.gradients[_.id]={}}),this.layoutVertexArray=new Dt,this.layoutVertexArray2=new kt,this.indexArray=new Oi,this.programConfigurations=new $d(f.layers,f.zoom),this.segments=new Xr,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(_=>_.isStateDependent()).map(_=>_.id)}populate(f,_,k){this.hasPattern=h3("line",this.layers,_);const N=this.layers[0].layout.get("line-sort-key"),B=!N.isConstant(),F=[];for(const{feature:H,id:X,index:ee,sourceLayerIndex:ne}of f){const se=this.layers[0]._featureFilter.needGeometry,de=rv(H,se);if(!this.layers[0]._featureFilter.filter(new Qi(this.zoom,{globalState:this.globalState}),de,k))continue;const me=B?N.evaluate(de,{},k):void 0,ge={id:X,properties:H.properties,type:H.type,sourceLayerIndex:ne,index:ee,geometry:se?de.geometry:nv(H),patterns:{},sortKey:me};F.push(ge)}B&&F.sort((H,X)=>H.sortKey-X.sortKey);for(const H of F){const{geometry:X,index:ee,sourceLayerIndex:ne}=H;if(this.hasPattern){const se=d3("line",this.layers,H,this.zoom,_);this.patternFeatures.push(se)}else this.addFeature(H,X,ee,k,{},_.subdivisionGranularity);_.featureIndex.insert(f[ee].feature,X,ee,ne,this.index)}}update(f,_,k){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(f,_,this.stateDependentLayers,k)}addFeatures(f,_,k){for(const N of this.patternFeatures)this.addFeature(N,N.geometry,N.index,_,k,f.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(f){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=f.createVertexBuffer(this.layoutVertexArray2,d9e)),this.layoutVertexBuffer=f.createVertexBuffer(this.layoutVertexArray,u9e),this.indexBuffer=f.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(f),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(f){if(f.properties&&Object.prototype.hasOwnProperty.call(f.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(f.properties,"mapbox_clip_end"))return{start:+f.properties.mapbox_clip_start,end:+f.properties.mapbox_clip_end}}addFeature(f,_,k,N,B,F){const H=this.layers[0].layout,X=H.get("line-join").evaluate(f,{}),ee=H.get("line-cap"),ne=H.get("line-miter-limit"),se=H.get("line-round-limit");this.lineClips=this.lineFeatureClips(f);for(const de of _)this.addLine(de,f,X,ee,ne,se,N,F);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,f,k,B,N)}addLine(f,_,k,N,B,F,H,X){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,f=ov(f,H?X.line.getGranularityForZoomLevel(H.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let Be=0;Be=2&&f[ne-1].equals(f[ne-2]);)ne--;let se=0;for(;se0;if(ht&&Be>se){const Pt=ge.dist(be);if(Pt>2*de){const vt=ge.sub(ge.sub(be)._mult(de/Pt)._round());this.updateDistance(be,vt),this.addCurrentVertex(vt,Le,0,0,me),be=vt}}const At=be&&Ce;let Tt=At?k:ee?"butt":N;if(At&&Tt==="round"&&(atB&&(Tt="bevel"),Tt==="bevel"&&(at>2&&(Tt="flipbevel"),at100)pe=Xe.mult(-1);else{const Pt=at*Le.add(Xe).mag()/Le.sub(Xe).mag();pe._perp()._mult(Pt*(gt?-1:1))}this.addCurrentVertex(ge,pe,0,0,me),this.addCurrentVertex(ge,pe.mult(-1),0,0,me)}else if(Tt==="bevel"||Tt==="fakeround"){const Pt=-Math.sqrt(at*at-1),vt=gt?Pt:0,Qt=gt?0:Pt;if(be&&this.addCurrentVertex(ge,Le,vt,Qt,me),Tt==="fakeround"){const En=Math.round(180*Ct/Math.PI/20);for(let bn=1;bn2*de){const vt=ge.add(Ce.sub(ge)._mult(de/Pt)._round());this.updateDistance(ge,vt),this.addCurrentVertex(vt,Xe,0,0,me),ge=vt}}}}addCurrentVertex(f,_,k,N,B,F=!1){const H=_.y*N-_.x,X=-_.y-_.x*N;this.addHalfVertex(f,_.x+_.y*k,_.y-_.x*k,F,!1,k,B),this.addHalfVertex(f,H,X,F,!0,-N,B),this.distance>LX/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(f,_,k,N,B,F))}addHalfVertex({x:f,y:_},k,N,B,F,H,X){const ee=.5*(this.lineClips?this.scaledDistance*(LX-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((f<<1)+(B?1:0),(_<<1)+(F?1:0),Math.round(63*k)+128,Math.round(63*N)+128,1+(H===0?0:H<0?-1:1)|(63&ee)<<2,ee>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const ne=X.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,ne,this.e2),X.primitiveLength++),F?this.e2=ne:this.e1=ne}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(f,_){this.distance+=f.dist(_),this.updateScaledDistance()}}let PX,NX;Yt("LineBucket",w3,{omit:["layers","patternFeatures"]});var OX={get paint(){return NX=NX||new Oa({"line-opacity":new Cn(We.paint_line["line-opacity"]),"line-color":new Cn(We.paint_line["line-color"]),"line-translate":new tn(We.paint_line["line-translate"]),"line-translate-anchor":new tn(We.paint_line["line-translate-anchor"]),"line-width":new Cn(We.paint_line["line-width"]),"line-gap-width":new Cn(We.paint_line["line-gap-width"]),"line-offset":new Cn(We.paint_line["line-offset"]),"line-blur":new Cn(We.paint_line["line-blur"]),"line-dasharray":new Gx(We.paint_line["line-dasharray"]),"line-pattern":new G_(We.paint_line["line-pattern"]),"line-gradient":new Xy(We.paint_line["line-gradient"])})},get layout(){return PX=PX||new Oa({"line-cap":new tn(We.layout_line["line-cap"]),"line-join":new Cn(We.layout_line["line-join"]),"line-miter-limit":new tn(We.layout_line["line-miter-limit"]),"line-round-limit":new tn(We.layout_line["line-round-limit"]),"line-sort-key":new Cn(We.layout_line["line-sort-key"])})}};class m9e extends Cn{possiblyEvaluate(f,_){return _=new Qi(Math.floor(_.zoom),{now:_.now,fadeDuration:_.fadeDuration,zoomHistory:_.zoomHistory,transition:_.transition}),super.possiblyEvaluate(f,_)}evaluate(f,_,k,N){return _=Lt({},_,{zoom:Math.floor(_.zoom)}),super.evaluate(f,_,k,N)}}let _A;class g9e extends Hs{constructor(f){super(f,OX),this.gradientVersion=0,_A||(_A=new m9e(OX.paint.properties["line-width"].specification),_A.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(f){if(f==="line-gradient"){const _=this.gradientExpression();this.stepInterpolant=!!function(k){return k._styleExpression!==void 0}(_)&&_._styleExpression.expression instanceof bm,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(f,_){super.recalculate(f,_),this.paint._values["line-floorwidth"]=_A.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,f)}createBucket(f){return new w3(f)}queryRadius(f){const _=f,k=DX(eE("line-width",this,_),eE("line-gap-width",this,_)),N=eE("line-offset",this,_);return k/2+Math.abs(N)+fA(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:f,feature:_,featureState:k,geometry:N,transform:B,pixelsToTileUnits:F}){const H=pA(f,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-B.bearingInRadians,F),X=F/2*DX(this.paint.get("line-width").evaluate(_,k),this.paint.get("line-gap-width").evaluate(_,k)),ee=this.paint.get("line-offset").evaluate(_,k);return ee&&(N=function(ne,se){const de=[];for(let me=0;me=3){for(let be=0;be0?f+2*b:b}const y9e=wo([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),v9e=wo([{name:"a_projected_pos",components:3,type:"Float32"}],4);wo([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const _9e=wo([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);wo([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const RX=wo([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),b9e=wo([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function w9e(b,f,_){return b.sections.forEach(k=>{k.text=function(N,B,F){const H=B.layout.get("text-transform").evaluate(F,{});return H==="uppercase"?N=N.toLocaleUpperCase():H==="lowercase"&&(N=N.toLocaleLowerCase()),Pd.applyArabicShaping&&(N=Pd.applyArabicShaping(N)),N}(k.text,f,_)}),b}wo([{name:"triangle",components:3,type:"Uint16"}]),wo([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),wo([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),wo([{type:"Float32",name:"offsetX"}]),wo([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),wo([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const hE={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var BX,x3,FX,As=24,E3={};function x9e(){return BX||(BX=1,E3.read=function(b,f,_,k,N){var B,F,H=8*N-k-1,X=(1<>1,ne=-7,se=_?N-1:0,de=_?-1:1,me=b[f+se];for(se+=de,B=me&(1<<-ne)-1,me>>=-ne,ne+=H;ne>0;B=256*B+b[f+se],se+=de,ne-=8);for(F=B&(1<<-ne)-1,B>>=-ne,ne+=k;ne>0;F=256*F+b[f+se],se+=de,ne-=8);if(B===0)B=1-ee;else{if(B===X)return F?NaN:1/0*(me?-1:1);F+=Math.pow(2,k),B-=ee}return(me?-1:1)*F*Math.pow(2,B-k)},E3.write=function(b,f,_,k,N,B){var F,H,X,ee=8*B-N-1,ne=(1<>1,de=N===23?Math.pow(2,-24)-Math.pow(2,-77):0,me=k?0:B-1,ge=k?1:-1,be=f<0||f===0&&1/f<0?1:0;for(f=Math.abs(f),isNaN(f)||f===1/0?(H=isNaN(f)?1:0,F=ne):(F=Math.floor(Math.log(f)/Math.LN2),f*(X=Math.pow(2,-F))<1&&(F--,X*=2),(f+=F+se>=1?de/X:de*Math.pow(2,1-se))*X>=2&&(F++,X/=2),F+se>=ne?(H=0,F=ne):F+se>=1?(H=(f*X-1)*Math.pow(2,N),F+=se):(H=f*Math.pow(2,se-1)*Math.pow(2,N),F=0));N>=8;b[_+me]=255&H,me+=ge,H/=256,N-=8);for(F=F<0;b[_+me]=255&F,me+=ge,F/=256,ee-=8);b[_+me-ge]|=128*be}),E3}function $X(){if(FX)return x3;FX=1,x3=f;var b=x9e();function f(pe){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(pe)?pe:new Uint8Array(pe||0),this.pos=0,this.type=0,this.length=this.buf.length}f.Varint=0,f.Fixed64=1,f.Bytes=2,f.Fixed32=5;var _=4294967296,k=1/_,N=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function B(pe){return pe.type===f.Bytes?pe.readVarint()+pe.pos:pe.pos+1}function F(pe,Se,Ve){return Ve?4294967296*Se+(pe>>>0):4294967296*(Se>>>0)+(pe>>>0)}function H(pe,Se,Ve){var at=Se<=16383?1:Se<=2097151?2:Se<=268435455?3:Math.floor(Math.log(Se)/(7*Math.LN2));Ve.realloc(at);for(var Ct=Ve.pos-1;Ct>=pe;Ct--)Ve.buf[Ct+at]=Ve.buf[Ct]}function X(pe,Se){for(var Ve=0;Ve>>8,pe[Ve+2]=Se>>>16,pe[Ve+3]=Se>>>24}function Be(pe,Se){return(pe[Se]|pe[Se+1]<<8|pe[Se+2]<<16)+(pe[Se+3]<<24)}return f.prototype={destroy:function(){this.buf=null},readFields:function(pe,Se,Ve){for(Ve=Ve||this.length;this.pos>3,ht=this.pos;this.type=7&at,pe(Ct,Se,this),this.pos===ht&&this.skip(at)}return Se},readMessage:function(pe,Se){return this.readFields(pe,Se,this.readVarint()+this.pos)},readFixed32:function(){var pe=Le(this.buf,this.pos);return this.pos+=4,pe},readSFixed32:function(){var pe=Be(this.buf,this.pos);return this.pos+=4,pe},readFixed64:function(){var pe=Le(this.buf,this.pos)+Le(this.buf,this.pos+4)*_;return this.pos+=8,pe},readSFixed64:function(){var pe=Le(this.buf,this.pos)+Be(this.buf,this.pos+4)*_;return this.pos+=8,pe},readFloat:function(){var pe=b.read(this.buf,this.pos,!0,23,4);return this.pos+=4,pe},readDouble:function(){var pe=b.read(this.buf,this.pos,!0,52,8);return this.pos+=8,pe},readVarint:function(pe){var Se,Ve,at=this.buf;return Se=127&(Ve=at[this.pos++]),Ve<128?Se:(Se|=(127&(Ve=at[this.pos++]))<<7,Ve<128?Se:(Se|=(127&(Ve=at[this.pos++]))<<14,Ve<128?Se:(Se|=(127&(Ve=at[this.pos++]))<<21,Ve<128?Se:function(Ct,ht,gt){var At,Tt,Pt=gt.buf;if(At=(112&(Tt=Pt[gt.pos++]))>>4,Tt<128||(At|=(127&(Tt=Pt[gt.pos++]))<<3,Tt<128)||(At|=(127&(Tt=Pt[gt.pos++]))<<10,Tt<128)||(At|=(127&(Tt=Pt[gt.pos++]))<<17,Tt<128)||(At|=(127&(Tt=Pt[gt.pos++]))<<24,Tt<128)||(At|=(1&(Tt=Pt[gt.pos++]))<<31,Tt<128))return F(Ct,At,ht);throw new Error("Expected varint not more than 10 bytes")}(Se|=(15&(Ve=at[this.pos]))<<28,pe,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var pe=this.readVarint();return pe%2==1?(pe+1)/-2:pe/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var pe=this.readVarint()+this.pos,Se=this.pos;return this.pos=pe,pe-Se>=12&&N?function(Ve,at,Ct){return N.decode(Ve.subarray(at,Ct))}(this.buf,Se,pe):function(Ve,at,Ct){for(var ht="",gt=at;gt239?4:vt>223?3:vt>191?2:1;if(gt+En>Ct)break;En===1?vt<128&&(Qt=vt):En===2?(192&(At=Ve[gt+1]))==128&&(Qt=(31&vt)<<6|63&At)<=127&&(Qt=null):En===3?(Tt=Ve[gt+2],(192&(At=Ve[gt+1]))==128&&(192&Tt)==128&&((Qt=(15&vt)<<12|(63&At)<<6|63&Tt)<=2047||Qt>=55296&&Qt<=57343)&&(Qt=null)):En===4&&(Tt=Ve[gt+2],Pt=Ve[gt+3],(192&(At=Ve[gt+1]))==128&&(192&Tt)==128&&(192&Pt)==128&&((Qt=(15&vt)<<18|(63&At)<<12|(63&Tt)<<6|63&Pt)<=65535||Qt>=1114112)&&(Qt=null)),Qt===null?(Qt=65533,En=1):Qt>65535&&(Qt-=65536,ht+=String.fromCharCode(Qt>>>10&1023|55296),Qt=56320|1023&Qt),ht+=String.fromCharCode(Qt),gt+=En}return ht}(this.buf,Se,pe)},readBytes:function(){var pe=this.readVarint()+this.pos,Se=this.buf.subarray(this.pos,pe);return this.pos=pe,Se},readPackedVarint:function(pe,Se){if(this.type!==f.Bytes)return pe.push(this.readVarint(Se));var Ve=B(this);for(pe=pe||[];this.pos127;);else if(Se===f.Bytes)this.pos=this.readVarint()+this.pos;else if(Se===f.Fixed32)this.pos+=4;else{if(Se!==f.Fixed64)throw new Error("Unimplemented type: "+Se);this.pos+=8}},writeTag:function(pe,Se){this.writeVarint(pe<<3|Se)},realloc:function(pe){for(var Se=this.length||16;Se268435455||pe<0?function(Se,Ve){var at,Ct;if(Se>=0?(at=Se%4294967296|0,Ct=Se/4294967296|0):(Ct=~(-Se/4294967296),4294967295^(at=~(-Se%4294967296))?at=at+1|0:(at=0,Ct=Ct+1|0)),Se>=18446744073709552e3||Se<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");Ve.realloc(10),function(ht,gt,At){At.buf[At.pos++]=127&ht|128,ht>>>=7,At.buf[At.pos++]=127&ht|128,ht>>>=7,At.buf[At.pos++]=127&ht|128,ht>>>=7,At.buf[At.pos++]=127&ht|128,At.buf[At.pos]=127&(ht>>>=7)}(at,0,Ve),function(ht,gt){var At=(7&ht)<<4;gt.buf[gt.pos++]|=At|((ht>>>=3)?128:0),ht&&(gt.buf[gt.pos++]=127&ht|((ht>>>=7)?128:0),ht&&(gt.buf[gt.pos++]=127&ht|((ht>>>=7)?128:0),ht&&(gt.buf[gt.pos++]=127&ht|((ht>>>=7)?128:0),ht&&(gt.buf[gt.pos++]=127&ht|((ht>>>=7)?128:0),ht&&(gt.buf[gt.pos++]=127&ht)))))}(Ct,Ve)}(pe,this):(this.realloc(4),this.buf[this.pos++]=127&pe|(pe>127?128:0),pe<=127||(this.buf[this.pos++]=127&(pe>>>=7)|(pe>127?128:0),pe<=127||(this.buf[this.pos++]=127&(pe>>>=7)|(pe>127?128:0),pe<=127||(this.buf[this.pos++]=pe>>>7&127))))},writeSVarint:function(pe){this.writeVarint(pe<0?2*-pe-1:2*pe)},writeBoolean:function(pe){this.writeVarint(!!pe)},writeString:function(pe){pe=String(pe),this.realloc(4*pe.length),this.pos++;var Se=this.pos;this.pos=function(at,Ct,ht){for(var gt,At,Tt=0;Tt55295&><57344){if(!At){gt>56319||Tt+1===Ct.length?(at[ht++]=239,at[ht++]=191,at[ht++]=189):At=gt;continue}if(gt<56320){at[ht++]=239,at[ht++]=191,at[ht++]=189,At=gt;continue}gt=At-55296<<10|gt-56320|65536,At=null}else At&&(at[ht++]=239,at[ht++]=191,at[ht++]=189,At=null);gt<128?at[ht++]=gt:(gt<2048?at[ht++]=gt>>6|192:(gt<65536?at[ht++]=gt>>12|224:(at[ht++]=gt>>18|240,at[ht++]=gt>>12&63|128),at[ht++]=gt>>6&63|128),at[ht++]=63>|128)}return ht}(this.buf,pe,this.pos);var Ve=this.pos-Se;Ve>=128&&H(Se,Ve,this),this.pos=Se-1,this.writeVarint(Ve),this.pos+=Ve},writeFloat:function(pe){this.realloc(4),b.write(this.buf,pe,this.pos,!0,23,4),this.pos+=4},writeDouble:function(pe){this.realloc(8),b.write(this.buf,pe,this.pos,!0,52,8),this.pos+=8},writeBytes:function(pe){var Se=pe.length;this.writeVarint(Se),this.realloc(Se);for(var Ve=0;Ve=128&&H(Ve,at,this),this.pos=Ve-1,this.writeVarint(at),this.pos+=at},writeMessage:function(pe,Se,Ve){this.writeTag(pe,f.Bytes),this.writeRawMessage(Se,Ve)},writePackedVarint:function(pe,Se){Se.length&&this.writeMessage(pe,X,Se)},writePackedSVarint:function(pe,Se){Se.length&&this.writeMessage(pe,ee,Se)},writePackedBoolean:function(pe,Se){Se.length&&this.writeMessage(pe,de,Se)},writePackedFloat:function(pe,Se){Se.length&&this.writeMessage(pe,ne,Se)},writePackedDouble:function(pe,Se){Se.length&&this.writeMessage(pe,se,Se)},writePackedFixed32:function(pe,Se){Se.length&&this.writeMessage(pe,me,Se)},writePackedSFixed32:function(pe,Se){Se.length&&this.writeMessage(pe,ge,Se)},writePackedFixed64:function(pe,Se){Se.length&&this.writeMessage(pe,be,Se)},writePackedSFixed64:function(pe,Se){Se.length&&this.writeMessage(pe,Ce,Se)},writeBytesField:function(pe,Se){this.writeTag(pe,f.Bytes),this.writeBytes(Se)},writeFixed32Field:function(pe,Se){this.writeTag(pe,f.Fixed32),this.writeFixed32(Se)},writeSFixed32Field:function(pe,Se){this.writeTag(pe,f.Fixed32),this.writeSFixed32(Se)},writeFixed64Field:function(pe,Se){this.writeTag(pe,f.Fixed64),this.writeFixed64(Se)},writeSFixed64Field:function(pe,Se){this.writeTag(pe,f.Fixed64),this.writeSFixed64(Se)},writeVarintField:function(pe,Se){this.writeTag(pe,f.Varint),this.writeVarint(Se)},writeSVarintField:function(pe,Se){this.writeTag(pe,f.Varint),this.writeSVarint(Se)},writeStringField:function(pe,Se){this.writeTag(pe,f.Bytes),this.writeString(Se)},writeFloatField:function(pe,Se){this.writeTag(pe,f.Fixed32),this.writeFloat(Se)},writeDoubleField:function(pe,Se){this.writeTag(pe,f.Fixed64),this.writeDouble(Se)},writeBooleanField:function(pe,Se){this.writeVarintField(pe,!!Se)}},x3}var jm,S3=l($X());function E9e(b,f,_){b===1&&_.readMessage(S9e,f)}function S9e(b,f,_){if(b===3){const{id:k,bitmap:N,width:B,height:F,left:H,top:X,advance:ee}=_.readMessage(C9e,{});f.push({id:k,bitmap:new tE({width:B+6,height:F+6},N),metrics:{width:B,height:F,left:H,top:X,advance:ee}})}}function C9e(b,f,_){b===1?f.id=_.readVarint():b===2?f.bitmap=_.readBytes():b===3?f.width=_.readVarint():b===4?f.height=_.readVarint():b===5?f.left=_.readSVarint():b===6?f.top=_.readSVarint():b===7&&(f.advance=_.readVarint())}function zX(b){let f=0,_=0;for(const F of b)f+=F.w*F.h,_=Math.max(_,F.w);b.sort((F,H)=>H.h-F.h);const k=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(f/.95)),_),h:1/0}];let N=0,B=0;for(const F of b)for(let H=k.length-1;H>=0;H--){const X=k[H];if(!(F.w>X.w||F.h>X.h)){if(F.x=X.x,F.y=X.y,B=Math.max(B,F.y+F.h),N=Math.max(N,F.x+F.w),F.w===X.w&&F.h===X.h){const ee=k.pop();H=0&&k>=f&&wA[this.text.charCodeAt(k)];k--)_--;this.text=this.text.substring(f,_),this.sectionIndex=this.sectionIndex.slice(f,_)}substring(f,_){const k=new Q_;return k.text=this.text.substring(f,_),k.sectionIndex=this.sectionIndex.slice(f,_),k.sections=this.sections,k}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((f,_)=>Math.max(f,this.sections[_].scale),0)}getMaxImageSize(f){let _=0,k=0;for(let N=0;N=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function bA(b,f,_,k,N,B,F,H,X,ee,ne,se,de,me,ge){const be=Q_.fromFeature(b,N);let Ce;se===s.an.vertical&&be.verticalizePunctuation();const{processBidirectionalText:Le,processStyledBidirectionalText:Xe}=Pd;if(Le&&be.sections.length===1){Ce=[];const Se=Le(be.toString(),k3(be,ee,B,f,k,me));for(const Ve of Se){const at=new Q_;at.text=Ve,at.sections=be.sections;for(let Ct=0;Ct=0;let ee=0;for(let se=0;seee){const ne=Math.ceil(B/ee);N*=ne/F,F=ne}return{x1:k,y1:N,x2:k+B,y2:N+F}}function YX(b,f,_,k,N,B){const F=b.image;let H;if(F.content){const Ce=F.content,Le=F.pixelRatio||1;H=[Ce[0]/Le,Ce[1]/Le,F.displaySize[0]-Ce[2]/Le,F.displaySize[1]-Ce[3]/Le]}const X=f.left*B,ee=f.right*B;let ne,se,de,me;_==="width"||_==="both"?(me=N[0]+X-k[3],se=N[0]+ee+k[1]):(me=N[0]+(X+ee-F.displaySize[0])/2,se=me+F.displaySize[0]);const ge=f.top*B,be=f.bottom*B;return _==="height"||_==="both"?(ne=N[1]+ge-k[0],de=N[1]+be+k[2]):(ne=N[1]+(ge+be-F.displaySize[1])/2,de=ne+F.displaySize[1]),{image:F,top:ne,right:se,bottom:de,left:me,collisionPadding:H}}const ip=128,Um=32640;function ZX(b,f){const{expression:_}=f;if(_.kind==="constant")return{kind:"constant",layoutSize:_.evaluate(new Qi(b+1))};if(_.kind==="source")return{kind:"source"};{const{zoomStops:k,interpolationType:N}=_;let B=0;for(;BF.id),this.index=f.index,this.pixelRatio=f.pixelRatio,this.sourceLayerIndex=f.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const _=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ZX(this.zoom,_["text-size"]),this.iconSizeData=ZX(this.zoom,_["icon-size"]);const k=this.layers[0].layout,N=k.get("symbol-sort-key"),B=k.get("symbol-z-order");this.canOverlap=M3(k,"text-overlap","text-allow-overlap")!=="never"||M3(k,"icon-overlap","icon-allow-overlap")!=="never"||k.get("text-ignore-placement")||k.get("icon-ignore-placement"),this.sortFeaturesByKey=B!=="viewport-y"&&!N.isConstant(),this.sortFeaturesByY=(B==="viewport-y"||B==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,k.get("symbol-placement")==="point"&&(this.writingModes=k.get("text-writing-mode").map(F=>s.an[F])),this.stateDependentLayerIds=this.layers.filter(F=>F.isStateDependent()).map(F=>F.id),this.sourceID=f.sourceID}createArrays(){this.text=new I3(new $d(this.layers,this.zoom,f=>/^text/.test(f))),this.icon=new I3(new $d(this.layers,this.zoom,f=>/^icon/.test(f))),this.glyphOffsetArray=new De,this.lineVertexArray=new je,this.symbolInstances=new Fe,this.textAnchorOffsets=new Re}calculateGlyphDependencies(f,_,k,N,B){for(let F=0;F0)&&(F.value.kind!=="constant"||F.value.value.length>0),ne=X.value.kind!=="constant"||!!X.value.value||Object.keys(X.parameters).length>0,se=B.get("symbol-sort-key");if(this.features=[],!ee&&!ne)return;const de=_.iconDependencies,me=_.glyphDependencies,ge=_.availableImages,be=new Qi(this.zoom,{globalState:this.globalState});for(const{feature:Ce,id:Le,index:Xe,sourceLayerIndex:Be}of f){const pe=N._featureFilter.needGeometry,Se=rv(Ce,pe);if(!N._featureFilter.filter(be,Se,k))continue;let Ve,at;if(pe||(Se.geometry=nv(Ce)),ee){const ht=N.getValueAndResolveTokens("text-field",Se,k,ge),gt=ya.factory(ht),At=this.hasRTLText=this.hasRTLText||B9e(gt);(!At||Pd.getRTLTextPluginStatus()==="unavailable"||At&&Pd.isParsed())&&(Ve=w9e(gt,N,Se))}if(ne){const ht=N.getValueAndResolveTokens("icon-image",Se,k,ge);at=ht instanceof cl?ht:cl.fromString(ht)}if(!Ve&&!at)continue;const Ct=this.sortFeaturesByKey?se.evaluate(Se,{},k):void 0;if(this.features.push({id:Le,text:Ve,icon:at,index:Xe,sourceLayerIndex:Be,geometry:Se.geometry,properties:Ce.properties,type:D9e[Ce.type],sortKey:Ct}),at&&(de[at.name]=!0),Ve){const ht=F.evaluate(Se,{},k).join(","),gt=B.get("text-rotation-alignment")!=="viewport"&&B.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(s.an.vertical)>=0;for(const At of Ve.sections)if(At.image)de[At.image.name]=!0;else{const Tt=Vx(Ve.toString()),Pt=At.fontStack||ht,vt=me[Pt]=me[Pt]||{};this.calculateGlyphDependencies(At.text,vt,gt,this.allowVerticalPlacement,Tt)}}}B.get("symbol-placement")==="line"&&(this.features=function(Ce){const Le={},Xe={},Be=[];let pe=0;function Se(ht){Be.push(Ce[ht]),pe++}function Ve(ht,gt,At){const Tt=Xe[ht];return delete Xe[ht],Xe[gt]=Tt,Be[Tt].geometry[0].pop(),Be[Tt].geometry[0]=Be[Tt].geometry[0].concat(At[0]),Tt}function at(ht,gt,At){const Tt=Le[gt];return delete Le[gt],Le[ht]=Tt,Be[Tt].geometry[0].shift(),Be[Tt].geometry[0]=At[0].concat(Be[Tt].geometry[0]),Tt}function Ct(ht,gt,At){const Tt=At?gt[0][gt[0].length-1]:gt[0][0];return`${ht}:${Tt.x}:${Tt.y}`}for(let ht=0;htht.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((Ce,Le)=>Ce.sortKey-Le.sortKey)}update(f,_,k){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(f,_,this.layers,k),this.icon.programConfigurations.updatePaintArrays(f,_,this.layers,k))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(f){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(f),this.iconCollisionBox.upload(f)),this.text.upload(f,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(f,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(f,_){const k=this.lineVertexArray.length;if(f.segment!==void 0){let N=f.dist(_[f.segment+1]),B=f.dist(_[f.segment]);const F={};for(let H=f.segment+1;H<_.length;H++)F[H]={x:_[H].x,y:_[H].y,tileUnitDistanceFromAnchor:N},H<_.length-1&&(N+=_[H+1].dist(_[H]));for(let H=f.segment||0;H>=0;H--)F[H]={x:_[H].x,y:_[H].y,tileUnitDistanceFromAnchor:B},H>0&&(B+=_[H-1].dist(_[H]));for(let H=0;H<_.length;H++){const X=F[H];this.lineVertexArray.emplaceBack(X.x,X.y,X.tileUnitDistanceFromAnchor)}}return{lineStartIndex:k,lineLength:this.lineVertexArray.length-k}}addSymbols(f,_,k,N,B,F,H,X,ee,ne,se,de){const me=f.indexArray,ge=f.layoutVertexArray,be=f.segments.prepareSegment(4*_.length,ge,me,this.canOverlap?F.sortKey:void 0),Ce=this.glyphOffsetArray.length,Le=be.vertexLength,Xe=this.allowVerticalPlacement&&H===s.an.vertical?Math.PI/2:0,Be=F.text&&F.text.sections;for(let pe=0;pe<_.length;pe++){const{tl:Se,tr:Ve,bl:at,br:Ct,tex:ht,pixelOffsetTL:gt,pixelOffsetBR:At,minFontScaleX:Tt,minFontScaleY:Pt,glyphOffset:vt,isSDF:Qt,sectionIndex:En}=_[pe],bn=be.vertexLength,ln=vt[1];xA(ge,X.x,X.y,Se.x,ln+Se.y,ht.x,ht.y,k,Qt,gt.x,gt.y,Tt,Pt),xA(ge,X.x,X.y,Ve.x,ln+Ve.y,ht.x+ht.w,ht.y,k,Qt,At.x,gt.y,Tt,Pt),xA(ge,X.x,X.y,at.x,ln+at.y,ht.x,ht.y+ht.h,k,Qt,gt.x,At.y,Tt,Pt),xA(ge,X.x,X.y,Ct.x,ln+Ct.y,ht.x+ht.w,ht.y+ht.h,k,Qt,At.x,At.y,Tt,Pt),A3(f.dynamicLayoutVertexArray,X,Xe),me.emplaceBack(bn,bn+2,bn+1),me.emplaceBack(bn+1,bn+2,bn+3),be.vertexLength+=4,be.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(vt[0]),pe!==_.length-1&&En===_[pe+1].sectionIndex||f.programConfigurations.populatePaintArrays(ge.length,F,F.index,{},de,Be&&Be[En])}f.placedSymbolArray.emplaceBack(X.x,X.y,Ce,this.glyphOffsetArray.length-Ce,Le,ee,ne,X.segment,k?k[0]:0,k?k[1]:0,N[0],N[1],H,0,!1,0,se)}_addCollisionDebugVertex(f,_,k,N,B,F){return _.emplaceBack(0,0),f.emplaceBack(k.x,k.y,N,B,Math.round(F.x),Math.round(F.y))}addCollisionDebugVertices(f,_,k,N,B,F,H){const X=B.segments.prepareSegment(4,B.layoutVertexArray,B.indexArray),ee=X.vertexLength,ne=B.layoutVertexArray,se=B.collisionVertexArray,de=H.anchorX,me=H.anchorY;this._addCollisionDebugVertex(ne,se,F,de,me,new y(f,_)),this._addCollisionDebugVertex(ne,se,F,de,me,new y(k,_)),this._addCollisionDebugVertex(ne,se,F,de,me,new y(k,N)),this._addCollisionDebugVertex(ne,se,F,de,me,new y(f,N)),X.vertexLength+=4;const ge=B.indexArray;ge.emplaceBack(ee,ee+1),ge.emplaceBack(ee+1,ee+2),ge.emplaceBack(ee+2,ee+3),ge.emplaceBack(ee+3,ee),X.primitiveLength+=4}addDebugCollisionBoxes(f,_,k,N){for(let B=f;B<_;B++){const F=this.collisionBoxArray.get(B);this.addCollisionDebugVertices(F.x1,F.y1,F.x2,F.y2,N?this.textCollisionBox:this.iconCollisionBox,F.anchorPoint,k)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new L3(Li,RX.members,Pi),this.iconCollisionBox=new L3(Li,RX.members,Pi);for(let f=0;f0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(f,_){const k=f.placedSymbolArray.get(_),N=k.vertexStartIndex+4*k.numGlyphs;for(let B=k.vertexStartIndex;BN[H]-N[X]||B[X]-B[H]),F}addToSortKeyRanges(f,_){const k=this.sortKeyRanges[this.sortKeyRanges.length-1];k&&k.sortKey===_?k.symbolInstanceEnd=f+1:this.sortKeyRanges.push({sortKey:_,symbolInstanceStart:f,symbolInstanceEnd:f+1})}sortFeatures(f){if(this.sortFeaturesByY&&this.sortedAngle!==f&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(f),this.sortedAngle=f,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const _ of this.symbolInstanceIndexes){const k=this.symbolInstances.get(_);this.featureSortOrder.push(k.featureIndex),[k.rightJustifiedTextSymbolIndex,k.centerJustifiedTextSymbolIndex,k.leftJustifiedTextSymbolIndex].forEach((N,B,F)=>{N>=0&&F.indexOf(N)===B&&this.addIndicesForPlacedSymbol(this.text,N)}),k.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,k.verticalPlacedTextSymbolIndex),k.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,k.placedIconSymbolIndex),k.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,k.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let XX,KX;Yt("SymbolBucket",eb,{omit:["layers","collisionBoxArray","features","compareText"]}),eb.MAX_GLYPHS=65535,eb.addDynamicAttributes=A3;var P3={get paint(){return KX=KX||new Oa({"icon-opacity":new Cn(We.paint_symbol["icon-opacity"]),"icon-color":new Cn(We.paint_symbol["icon-color"]),"icon-halo-color":new Cn(We.paint_symbol["icon-halo-color"]),"icon-halo-width":new Cn(We.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Cn(We.paint_symbol["icon-halo-blur"]),"icon-translate":new tn(We.paint_symbol["icon-translate"]),"icon-translate-anchor":new tn(We.paint_symbol["icon-translate-anchor"]),"text-opacity":new Cn(We.paint_symbol["text-opacity"]),"text-color":new Cn(We.paint_symbol["text-color"],{runtimeType:Ol,getOverride:b=>b.textColor,hasOverride:b=>!!b.textColor}),"text-halo-color":new Cn(We.paint_symbol["text-halo-color"]),"text-halo-width":new Cn(We.paint_symbol["text-halo-width"]),"text-halo-blur":new Cn(We.paint_symbol["text-halo-blur"]),"text-translate":new tn(We.paint_symbol["text-translate"]),"text-translate-anchor":new tn(We.paint_symbol["text-translate-anchor"])})},get layout(){return XX=XX||new Oa({"symbol-placement":new tn(We.layout_symbol["symbol-placement"]),"symbol-spacing":new tn(We.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new tn(We.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Cn(We.layout_symbol["symbol-sort-key"]),"symbol-z-order":new tn(We.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new tn(We.layout_symbol["icon-allow-overlap"]),"icon-overlap":new tn(We.layout_symbol["icon-overlap"]),"icon-ignore-placement":new tn(We.layout_symbol["icon-ignore-placement"]),"icon-optional":new tn(We.layout_symbol["icon-optional"]),"icon-rotation-alignment":new tn(We.layout_symbol["icon-rotation-alignment"]),"icon-size":new Cn(We.layout_symbol["icon-size"]),"icon-text-fit":new tn(We.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new tn(We.layout_symbol["icon-text-fit-padding"]),"icon-image":new Cn(We.layout_symbol["icon-image"]),"icon-rotate":new Cn(We.layout_symbol["icon-rotate"]),"icon-padding":new Cn(We.layout_symbol["icon-padding"]),"icon-keep-upright":new tn(We.layout_symbol["icon-keep-upright"]),"icon-offset":new Cn(We.layout_symbol["icon-offset"]),"icon-anchor":new Cn(We.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new tn(We.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new tn(We.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new tn(We.layout_symbol["text-rotation-alignment"]),"text-field":new Cn(We.layout_symbol["text-field"]),"text-font":new Cn(We.layout_symbol["text-font"]),"text-size":new Cn(We.layout_symbol["text-size"]),"text-max-width":new Cn(We.layout_symbol["text-max-width"]),"text-line-height":new tn(We.layout_symbol["text-line-height"]),"text-letter-spacing":new Cn(We.layout_symbol["text-letter-spacing"]),"text-justify":new Cn(We.layout_symbol["text-justify"]),"text-radial-offset":new Cn(We.layout_symbol["text-radial-offset"]),"text-variable-anchor":new tn(We.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Cn(We.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Cn(We.layout_symbol["text-anchor"]),"text-max-angle":new tn(We.layout_symbol["text-max-angle"]),"text-writing-mode":new tn(We.layout_symbol["text-writing-mode"]),"text-rotate":new Cn(We.layout_symbol["text-rotate"]),"text-padding":new tn(We.layout_symbol["text-padding"]),"text-keep-upright":new tn(We.layout_symbol["text-keep-upright"]),"text-transform":new Cn(We.layout_symbol["text-transform"]),"text-offset":new Cn(We.layout_symbol["text-offset"]),"text-allow-overlap":new tn(We.layout_symbol["text-allow-overlap"]),"text-overlap":new tn(We.layout_symbol["text-overlap"]),"text-ignore-placement":new tn(We.layout_symbol["text-ignore-placement"]),"text-optional":new tn(We.layout_symbol["text-optional"])})}};class JX{constructor(f){if(f.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=f.property.overrides?f.property.overrides.runtimeType:Hf,this.defaultValue=f}evaluate(f){if(f.formattedSection){const _=this.defaultValue.property.overrides;if(_&&_.hasOverride(f.formattedSection))return _.getOverride(f.formattedSection)}return f.feature&&f.featureState?this.defaultValue.evaluate(f.feature,f.featureState):this.defaultValue.property.specification.default}eachChild(f){this.defaultValue.isConstant()||f(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Yt("FormatSectionOverride",JX,{omit:["defaultValue"]});class EA extends Hs{constructor(f){super(f,P3)}recalculate(f,_){if(super.recalculate(f,_),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const k=this.layout.get("text-writing-mode");if(k){const N=[];for(const B of k)N.indexOf(B)<0&&N.push(B);this.layout._values["text-writing-mode"]=N}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(f,_,k,N){const B=this.layout.get(f).evaluate(_,{},k,N),F=this._unevaluatedLayout._values[f];return F.isDataDriven()||L_(F.value)||!B?B:function(H,X){return X.replace(/{([^{}]+)}/g,(ee,ne)=>H&&ne in H?String(H[ne]):"")}(_.properties,B)}createBucket(f){return new eb(f)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const f of P3.paint.overridableProperties){if(!EA.hasPaintOverride(this.layout,f))continue;const _=this.paint.get(f),k=new JX(_),N=new I_(k,_.property.specification);let B=null;B=_.value.kind==="constant"||_.value.kind==="source"?new $y("source",N):new N_("composite",N,_.value.zoomStops),this.paint._values[f]=new Wu(_.property,B,_.parameters)}}_handleOverridablePaintPropertyUpdate(f,_,k){return!(!this.layout||_.isDataDriven()||k.isDataDriven())&&EA.hasPaintOverride(this.layout,f)}static hasPaintOverride(f,_){const k=f.get("text-field"),N=P3.paint.properties[_];let B=!1;const F=H=>{for(const X of H)if(N.overrides&&N.overrides.hasOverride(X))return void(B=!0)};if(k.value.kind==="constant"&&k.value.value instanceof ya)F(k.value.value.sections);else if(k.value.kind==="source"){const H=ee=>{B||(ee instanceof La&&Ln(ee.value)===Wf?F(ee.value.sections):ee instanceof Py?F(ee.sections):ee.eachChild(H))},X=k.value;X._styleExpression&&H(X._styleExpression.expression)}return B}}let QX;var F9e={get paint(){return QX=QX||new Oa({"background-color":new tn(We.paint_background["background-color"]),"background-pattern":new Gx(We.paint_background["background-pattern"]),"background-opacity":new tn(We.paint_background["background-opacity"])})}};class $9e extends Hs{constructor(f){super(f,F9e)}}let eK;var z9e={get paint(){return eK=eK||new Oa({"raster-opacity":new tn(We.paint_raster["raster-opacity"]),"raster-hue-rotate":new tn(We.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new tn(We.paint_raster["raster-brightness-min"]),"raster-brightness-max":new tn(We.paint_raster["raster-brightness-max"]),"raster-saturation":new tn(We.paint_raster["raster-saturation"]),"raster-contrast":new tn(We.paint_raster["raster-contrast"]),"raster-resampling":new tn(We.paint_raster["raster-resampling"]),"raster-fade-duration":new tn(We.paint_raster["raster-fade-duration"])})}};class V9e extends Hs{constructor(f){super(f,z9e)}}class j9e extends Hs{constructor(f){super(f,{}),this.onAdd=_=>{this.implementation.onAdd&&this.implementation.onAdd(_,_.painter.context.gl)},this.onRemove=_=>{this.implementation.onRemove&&this.implementation.onRemove(_,_.painter.context.gl)},this.implementation=f}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class U9e{constructor(f){this._methodToThrottle=f,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const H9e={once:!0},N3=63710088e-1;class Hm{constructor(f,_){if(isNaN(f)||isNaN(_))throw new Error(`Invalid LngLat object: (${f}, ${_})`);if(this.lng=+f,this.lat=+_,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Hm(yt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(f){const _=Math.PI/180,k=this.lat*_,N=f.lat*_,B=Math.sin(k)*Math.sin(N)+Math.cos(k)*Math.cos(N)*Math.cos((f.lng-this.lng)*_);return N3*Math.acos(Math.min(B,1))}static convert(f){if(f instanceof Hm)return f;if(Array.isArray(f)&&(f.length===2||f.length===3))return new Hm(Number(f[0]),Number(f[1]));if(!Array.isArray(f)&&typeof f=="object"&&f!==null)return new Hm(Number("lng"in f?f.lng:f.lon),Number(f.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const tK=2*Math.PI*N3;function nK(b){return tK*Math.cos(b*Math.PI/180)}function rK(b){return(180+b)/360}function iK(b){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+b*Math.PI/360)))/360}function oK(b,f){return b/nK(f)}function O3(b){return 360/Math.PI*Math.atan(Math.exp((180-360*b)*Math.PI/180))-90}function sK(b,f){return b*nK(O3(f))}class fE{constructor(f,_,k=0){this.x=+f,this.y=+_,this.z=+k}static fromLngLat(f,_=0){const k=Hm.convert(f);return new fE(rK(k.lng),iK(k.lat),oK(_,k.lat))}toLngLat(){return new Hm(360*this.x-180,O3(this.y))}toAltitude(){return sK(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/tK*(f=O3(this.y),1/Math.cos(f*Math.PI/180));var f}}function aK(b,f,_){var k=2*Math.PI*6378137/256/Math.pow(2,_);return[b*k-2*Math.PI*6378137/2,f*k-2*Math.PI*6378137/2]}class D3{constructor(f,_,k){if(!function(N,B,F){return!(N<0||N>25||F<0||F>=Math.pow(2,N)||B<0||B>=Math.pow(2,N))}(f,_,k))throw new Error(`x=${_}, y=${k}, z=${f} outside of bounds. 0<=x<${Math.pow(2,f)}, 0<=y<${Math.pow(2,f)} 0<=z<=25 `);this.z=f,this.x=_,this.y=k,this.key=tb(0,f,f,_,k)}equals(f){return this.z===f.z&&this.x===f.x&&this.y===f.y}url(f,_,k){const N=(F=this.y,H=this.z,X=aK(256*(B=this.x),256*(F=Math.pow(2,H)-F-1),H),ee=aK(256*(B+1),256*(F+1),H),X[0]+","+X[1]+","+ee[0]+","+ee[1]);var B,F,H,X,ee;const ne=function(se,de,me){let ge,be="";for(let Ce=se;Ce>0;Ce--)ge=1<1?"@2x":"").replace(/{quadkey}/g,ne).replace(/{bbox-epsg-3857}/g,N)}isChildOf(f){const _=this.z-f.z;return _>0&&f.x===this.x>>_&&f.y===this.y>>_}getTilePoint(f){const _=Math.pow(2,this.z);return new y((f.x*_-this.x)*xe,(f.y*_-this.y)*xe)}toString(){return`${this.z}/${this.x}/${this.y}`}}class lK{constructor(f,_){this.wrap=f,this.canonical=_,this.key=tb(f,_.z,_.z,_.x,_.y)}}class Yc{constructor(f,_,k,N,B){if(this.terrainRttPosMatrix32f=null,f= z; overscaledZ = ${f}; z = ${k}`);this.overscaledZ=f,this.wrap=_,this.canonical=new D3(k,+N,+B),this.key=tb(_,f,k,N,B)}clone(){return new Yc(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(f){return this.overscaledZ===f.overscaledZ&&this.wrap===f.wrap&&this.canonical.equals(f.canonical)}scaledTo(f){if(f>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${f}; overscaledZ = ${this.overscaledZ}`);const _=this.canonical.z-f;return f>this.canonical.z?new Yc(f,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Yc(f,this.wrap,f,this.canonical.x>>_,this.canonical.y>>_)}calculateScaledKey(f,_){if(f>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${f}; overscaledZ = ${this.overscaledZ}`);const k=this.canonical.z-f;return f>this.canonical.z?tb(this.wrap*+_,f,this.canonical.z,this.canonical.x,this.canonical.y):tb(this.wrap*+_,f,f,this.canonical.x>>k,this.canonical.y>>k)}isChildOf(f){if(f.wrap!==this.wrap)return!1;const _=this.canonical.z-f.canonical.z;return f.overscaledZ===0||f.overscaledZ>_&&f.canonical.y===this.canonical.y>>_}children(f){if(this.overscaledZ>=f)return[new Yc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const _=this.canonical.z+1,k=2*this.canonical.x,N=2*this.canonical.y;return[new Yc(_,this.wrap,_,k,N),new Yc(_,this.wrap,_,k+1,N),new Yc(_,this.wrap,_,k,N+1),new Yc(_,this.wrap,_,k+1,N+1)]}isLessThan(f){return this.wrapf.wrap)&&(this.overscaledZf.overscaledZ)&&(this.canonical.xf.canonical.x)&&this.canonical.ythis.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(f){return this.expandBy(-f)}map(f){const _=new sv;return _.extend(f(new y(this.minX,this.minY))),_.extend(f(new y(this.maxX,this.minY))),_.extend(f(new y(this.minX,this.maxY))),_.extend(f(new y(this.maxX,this.maxY))),_}static fromPoints(f){const _=new sv;for(const k of f)_.extend(k);return _}contains(f){return f.x>=this.minX&&f.x<=this.maxX&&f.y>=this.minY&&f.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(f){return!this.empty()&&!f.empty()&&f.minX>=this.minX&&f.maxX<=this.maxX&&f.minY>=this.minY&&f.maxY<=this.maxY}intersects(f){return!this.empty()&&!f.empty()&&f.minX<=this.maxX&&f.maxX>=this.minX&&f.minY<=this.maxY&&f.maxY>=this.minY}}class cK{constructor(f){this._stringToNumber={},this._numberToString=[];for(let _=0;_=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${f} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[f]}}class uK{constructor(f,_,k,N,B){this.type="Feature",this._vectorTileFeature=f,f._z=_,f._x=k,f._y=N,this.properties=f.properties,this.id=B}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(f){this._geometry=f}toJSON(){const f={geometry:this.geometry};for(const _ in this)_!=="_geometry"&&_!=="_vectorTileFeature"&&(f[_]=this[_]);return f}}class hK{constructor(f,_){this.tileID=f,this.x=f.canonical.x,this.y=f.canonical.y,this.z=f.canonical.z,this.grid=new Fm(xe,16,0),this.grid3D=new Fm(xe,16,0),this.featureIndexArray=new ct,this.promoteId=_}insert(f,_,k,N,B,F){const H=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(k,N,B);const X=F?this.grid3D:this.grid;for(let ee=0;ee<_.length;ee++){const ne=_[ee],se=[1/0,1/0,-1/0,-1/0];for(let de=0;de=0&&se[3]>=0&&X.insert(H,se[0],se[1],se[2],se[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new lE.VectorTile(new S3(this.rawTileData)).layers,this.sourceLayerCoder=new cK(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(f,_,k,N){this.loadVTLayers();const B=f.params,F=xe/f.tileSize/f.scale,H=Id(B.filter),X=f.queryGeometry,ee=f.queryPadding*F,ne=sv.fromPoints(X),se=this.grid.query(ne.minX-ee,ne.minY-ee,ne.maxX+ee,ne.maxY+ee),de=sv.fromPoints(f.cameraQueryGeometry).expandBy(ee),me=this.grid3D.query(de.minX,de.minY,de.maxX,de.maxY,(Ce,Le,Xe,Be)=>function(pe,Se,Ve,at,Ct){for(const gt of pe)if(Se<=gt.x&&Ve<=gt.y&&at>=gt.x&&Ct>=gt.y)return!0;const ht=[new y(Se,Ve),new y(Se,Ct),new y(at,Ct),new y(at,Ve)];if(pe.length>2){for(const gt of ht)if(Z_(pe,gt))return!0}for(let gt=0;gt(Be||(Be=nv(pe)),Se.queryIntersectsFeature({queryGeometry:X,feature:pe,featureState:Ve,geometry:Be,zoom:this.z,transform:f.transform,pixelsToTileUnits:F,pixelPosMatrix:f.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:f.getElevation})))}return ge}loadMatchingFeature(f,_,k,N,B,F,H,X,ee,ne,se){const de=this.bucketLayerIDs[_];if(F&&!de.some(Ce=>F.has(Ce)))return;const me=this.sourceLayerCoder.decode(k),ge=this.vtLayers[me].feature(N);if(B.needGeometry){const Ce=rv(ge,!0);if(!B.filter(new Qi(this.tileID.overscaledZ),Ce,this.tileID.canonical))return}else if(!B.filter(new Qi(this.tileID.overscaledZ),ge))return;const be=this.getId(ge,me);for(let Ce=0;Ce{const H=f instanceof W_?f.get(F):null;return H&&H.evaluate?H.evaluate(_,k,N):H})}function W9e(b,f){return f-b}function fK(b,f,_,k,N){const B=[];for(let F=0;F=k&&se.x>=k||(ne.x>=k?ne=new y(k,ne.y+(k-ne.x)/(se.x-ne.x)*(se.y-ne.y))._round():se.x>=k&&(se=new y(k,ne.y+(k-ne.x)/(se.x-ne.x)*(se.y-ne.y))._round()),ne.y>=N&&se.y>=N||(ne.y>=N?ne=new y(ne.x+(N-ne.y)/(se.y-ne.y)*(se.x-ne.x),N)._round():se.y>=N&&(se=new y(ne.x+(N-ne.y)/(se.y-ne.y)*(se.x-ne.x),N)._round()),X&&ne.equals(X[X.length-1])||(X=[ne],B.push(X)),X.push(se)))))}}return B}Yt("FeatureIndex",hK,{omit:["rawTileData","sourceLayerCoder"]});class Wm extends y{constructor(f,_,k,N){super(f,_),this.angle=k,N!==void 0&&(this.segment=N)}clone(){return new Wm(this.x,this.y,this.angle,this.segment)}}function pK(b,f,_,k,N){if(f.segment===void 0||_===0)return!0;let B=f,F=f.segment+1,H=0;for(;H>-_/2;){if(F--,F<0)return!1;H-=b[F].dist(B),B=b[F]}H+=b[F].dist(b[F+1]),F++;const X=[];let ee=0;for(;H<_/2;){const ne=b[F],se=b[F+1];if(!se)return!1;let de=b[F-1].angleTo(ne)-ne.angleTo(se);for(de=Math.abs((de+3*Math.PI)%(2*Math.PI)-Math.PI),X.push({distance:H,angleDelta:de}),ee+=de;H-X[0].distance>k;)ee-=X.shift().angleDelta;if(ee>N)return!1;F++,H+=ne.dist(se)}return!0}function mK(b){let f=0;for(let _=0;_ee){const ge=(ee-X)/me,be=Rl.number(se.x,de.x,ge),Ce=Rl.number(se.y,de.y,ge),Le=new Wm(be,Ce,de.angleTo(se),ne);return Le._round(),!F||pK(b,Le,H,F,f)?Le:void 0}X+=me}}function q9e(b,f,_,k,N,B,F,H,X){const ee=gK(k,B,F),ne=yK(k,N),se=ne*F,de=b[0].x===0||b[0].x===X||b[0].y===0||b[0].y===X;return f-se=0&&pe=0&&Se=0&&de+ee<=ne){const Ve=new Wm(pe,Se,Xe,ge);Ve._round(),k&&!pK(b,Ve,B,k,N)||me.push(Ve)}}se+=Le}return H||me.length||F||(me=vK(b,se/2,_,k,N,B,F,!0,X)),me}function _K(b,f,_,k){const N=[],B=b.image,F=B.pixelRatio,H=B.paddedRect.w-2,X=B.paddedRect.h-2;let ee={x1:b.left,y1:b.top,x2:b.right,y2:b.bottom};const ne=B.stretchX||[[0,H]],se=B.stretchY||[[0,X]],de=(vt,Qt)=>vt+Qt[1]-Qt[0],me=ne.reduce(de,0),ge=se.reduce(de,0),be=H-me,Ce=X-ge;let Le=0,Xe=me,Be=0,pe=ge,Se=0,Ve=be,at=0,Ct=Ce;if(B.content&&k){const vt=B.content,Qt=vt[2]-vt[0],En=vt[3]-vt[1];(B.textFitWidth||B.textFitHeight)&&(ee=qX(b)),Le=SA(ne,0,vt[0]),Be=SA(se,0,vt[1]),Xe=SA(ne,vt[0],vt[2]),pe=SA(se,vt[1],vt[3]),Se=vt[0]-Le,at=vt[1]-Be,Ve=Qt-Xe,Ct=En-pe}const ht=ee.x1,gt=ee.y1,At=ee.x2-ht,Tt=ee.y2-gt,Pt=(vt,Qt,En,bn)=>{const ln=CA(vt.stretch-Le,Xe,At,ht),vr=kA(vt.fixed-Se,Ve,vt.stretch,me),xo=CA(Qt.stretch-Be,pe,Tt,gt),is=kA(Qt.fixed-at,Ct,Qt.stretch,ge),ba=CA(En.stretch-Le,Xe,At,ht),Zc=kA(En.fixed-Se,Ve,En.stretch,me),Fl=CA(bn.stretch-Be,pe,Tt,gt),Ys=kA(bn.fixed-at,Ct,bn.stretch,ge),ho=new y(ln,xo),Is=new y(ba,xo),Zs=new y(ba,Fl),Xs=new y(ln,Fl),fl=new y(vr/F,is/F),Xc=new y(Zc/F,Ys/F),Ls=f*Math.PI/180;if(Ls){const Ps=Math.sin(Ls),Ns=Math.cos(Ls),Xo=[Ns,-Ps,Ps,Ns];ho._matMult(Xo),Is._matMult(Xo),Xs._matMult(Xo),Zs._matMult(Xo)}const $l=vt.stretch+vt.fixed,ss=Qt.stretch+Qt.fixed;return{tl:ho,tr:Is,bl:Xs,br:Zs,tex:{x:B.paddedRect.x+1+$l,y:B.paddedRect.y+1+ss,w:En.stretch+En.fixed-$l,h:bn.stretch+bn.fixed-ss},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:fl,pixelOffsetBR:Xc,minFontScaleX:Ve/F/At,minFontScaleY:Ct/F/Tt,isSDF:_}};if(k&&(B.stretchX||B.stretchY)){const vt=bK(ne,be,me),Qt=bK(se,Ce,ge);for(let En=0;En0&&(be=Math.max(10,be),this.circleDiameter=be)}else{const de=!((se=F.image)===null||se===void 0)&&se.content&&(F.image.textFitWidth||F.image.textFitHeight)?qX(F):{x1:F.left,y1:F.top,x2:F.right,y2:F.bottom};de.y1=de.y1*H-X[0],de.y2=de.y2*H+X[2],de.x1=de.x1*H-X[3],de.x2=de.x2*H+X[1];const me=F.collisionPadding;if(me&&(de.x1-=me[0]*H,de.y1-=me[1]*H,de.x2+=me[2]*H,de.y2+=me[3]*H),ne){const ge=new y(de.x1,de.y1),be=new y(de.x2,de.y1),Ce=new y(de.x1,de.y2),Le=new y(de.x2,de.y2),Xe=ne*Math.PI/180;ge._rotate(Xe),be._rotate(Xe),Ce._rotate(Xe),Le._rotate(Xe),de.x1=Math.min(ge.x,be.x,Ce.x,Le.x),de.x2=Math.max(ge.x,be.x,Ce.x,Le.x),de.y1=Math.min(ge.y,be.y,Ce.y,Le.y),de.y2=Math.max(ge.y,be.y,Ce.y,Le.y)}f.emplaceBack(_.x,_.y,de.x1,de.y1,de.x2,de.y2,k,N,B)}this.boxEndIndex=f.length}}class Y9e{constructor(f=[],_=(k,N)=>kN?1:0){if(this.data=f,this.length=this.data.length,this.compare=_,this.length>0)for(let k=(this.length>>1)-1;k>=0;k--)this._down(k)}push(f){this.data.push(f),this._up(this.length++)}pop(){if(this.length===0)return;const f=this.data[0],_=this.data.pop();return--this.length>0&&(this.data[0]=_,this._down(0)),f}peek(){return this.data[0]}_up(f){const{data:_,compare:k}=this,N=_[f];for(;f>0;){const B=f-1>>1,F=_[B];if(k(N,F)>=0)break;_[f]=F,f=B}_[f]=N}_down(f){const{data:_,compare:k}=this,N=this.length>>1,B=_[f];for(;f=0)break;_[f]=_[F],f=F}_[f]=B}}function Z9e(b,f=1,_=!1){const k=sv.fromPoints(b[0]),N=Math.min(k.width(),k.height());let B=N/2;const F=new Y9e([],X9e),{minX:H,minY:X,maxX:ee,maxY:ne}=k;if(N===0)return new y(H,X);for(let me=H;mese.d||!se.d)&&(se=me,_&&console.log("found best %d after %d probes",Math.round(1e4*me.d)/1e4,de)),me.max-se.d<=f||(B=me.h/2,F.push(new nb(me.p.x-B,me.p.y-B,B,b)),F.push(new nb(me.p.x+B,me.p.y-B,B,b)),F.push(new nb(me.p.x-B,me.p.y+B,B,b)),F.push(new nb(me.p.x+B,me.p.y+B,B,b)),de+=4)}return _&&(console.log(`num probes: ${de}`),console.log(`best distance: ${se.d}`)),se.p}function X9e(b,f){return f.max-b.max}function nb(b,f,_,k){this.p=new y(b,f),this.h=_,this.d=function(N,B){let F=!1,H=1/0;for(let X=0;XN.y!=ge.y>N.y&&N.x<(ge.x-me.x)*(N.y-me.y)/(ge.y-me.y)+me.x&&(F=!F),H=Math.min(H,QZ(N,me,ge))}}return(F?1:-1)*Math.sqrt(H)}(this.p,k),this.max=this.d+this.h*Math.SQRT2}var _a;s.aD=void 0,(_a=s.aD||(s.aD={}))[_a.center=1]="center",_a[_a.left=2]="left",_a[_a.right=3]="right",_a[_a.top=4]="top",_a[_a.bottom=5]="bottom",_a[_a["top-left"]=6]="top-left",_a[_a["top-right"]=7]="top-right",_a[_a["bottom-left"]=8]="bottom-left",_a[_a["bottom-right"]=9]="bottom-right";const R3=Number.POSITIVE_INFINITY;function wK(b,f){return f[1]!==R3?function(_,k,N){let B=0,F=0;switch(k=Math.abs(k),N=Math.abs(N),_){case"top-right":case"top-left":case"top":F=N-7;break;case"bottom-right":case"bottom-left":case"bottom":F=7-N}switch(_){case"top-right":case"bottom-right":case"right":B=-k;break;case"top-left":case"bottom-left":case"left":B=k}return[B,F]}(b,f[0],f[1]):function(_,k){let N=0,B=0;k<0&&(k=0);const F=k/Math.SQRT2;switch(_){case"top-right":case"top-left":B=F-7;break;case"bottom-right":case"bottom-left":B=7-F;break;case"bottom":B=7-k;break;case"top":B=k-7}switch(_){case"top-right":case"bottom-right":N=-F;break;case"top-left":case"bottom-left":N=F;break;case"left":N=k;break;case"right":N=-k}return[N,B]}(b,f[0])}function xK(b,f,_){var k;const N=b.layout,B=(k=N.get("text-variable-anchor-offset"))===null||k===void 0?void 0:k.evaluate(f,{},_);if(B){const H=B.values,X=[];for(let ee=0;eede*As);ne.startsWith("top")?se[1]-=7:ne.startsWith("bottom")&&(se[1]+=7),X[ee+1]=se}return new Sr(X)}const F=N.get("text-variable-anchor");if(F){let H;H=b._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[N.get("text-radial-offset").evaluate(f,{},_)*As,R3]:N.get("text-offset").evaluate(f,{},_).map(ee=>ee*As);const X=[];for(const ee of F)X.push(ee,wK(ee,H));return new Sr(X)}return null}function B3(b){switch(b){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function K9e(b,f,_,k,N,B,F,H,X,ee,ne,se){let de=B.textMaxSize.evaluate(f,{});de===void 0&&(de=F);const me=b.layers[0].layout,ge=me.get("icon-offset").evaluate(f,{},ne),be=SK(_.horizontal),Ce=F/24,Le=b.tilePixelRatio*Ce,Xe=b.tilePixelRatio*de/24,Be=b.tilePixelRatio*H,pe=b.tilePixelRatio*me.get("symbol-spacing"),Se=me.get("text-padding")*b.tilePixelRatio,Ve=function(En,bn,ln,vr=1){const xo=En.get("icon-padding").evaluate(bn,{},ln),is=xo&&xo.values;return[is[0]*vr,is[1]*vr,is[2]*vr,is[3]*vr]}(me,f,ne,b.tilePixelRatio),at=me.get("text-max-angle")/180*Math.PI,Ct=me.get("text-rotation-alignment")!=="viewport"&&me.get("symbol-placement")!=="point",ht=me.get("icon-rotation-alignment")==="map"&&me.get("symbol-placement")!=="point",gt=me.get("symbol-placement"),At=pe/2,Tt=me.get("icon-text-fit");let Pt;k&&Tt!=="none"&&(b.allowVerticalPlacement&&_.vertical&&(Pt=YX(k,_.vertical,Tt,me.get("icon-text-fit-padding"),ge,Ce)),be&&(k=YX(k,be,Tt,me.get("icon-text-fit-padding"),ge,Ce)));const vt=ne?se.line.getGranularityForZoomLevel(ne.z):1,Qt=(En,bn)=>{bn.x<0||bn.x>=xe||bn.y<0||bn.y>=xe||function(ln,vr,xo,is,ba,Zc,Fl,Ys,ho,Is,Zs,Xs,fl,Xc,Ls,$l,ss,Ps,Ns,Xo,qi,Nh,rb,Oh,e7e){const ib=ln.addToLineVertexArray(vr,xo);let av,ob,sb,ab,MK=0,AK=0,IK=0,LK=0,W3=-1,G3=-1;const op={};let PK=dl("");if(ln.allowVerticalPlacement&&is.vertical){const Ra=Ys.layout.get("text-rotate").evaluate(qi,{},Oh)+90;sb=new TA(ho,vr,Is,Zs,Xs,is.vertical,fl,Xc,Ls,Ra),Fl&&(ab=new TA(ho,vr,Is,Zs,Xs,Fl,ss,Ps,Ls,Ra))}if(ba){const Ra=Ys.layout.get("icon-rotate").evaluate(qi,{}),Kc=Ys.layout.get("icon-text-fit")!=="none",lv=_K(ba,Ra,rb,Kc),Rh=Fl?_K(Fl,Ra,rb,Kc):void 0;ob=new TA(ho,vr,Is,Zs,Xs,ba,ss,Ps,!1,Ra),MK=4*lv.length;const cv=ln.iconSizeData;let zd=null;cv.kind==="source"?(zd=[ip*Ys.layout.get("icon-size").evaluate(qi,{})],zd[0]>Um&&Bn(`${ln.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):cv.kind==="composite"&&(zd=[ip*Nh.compositeIconSizes[0].evaluate(qi,{},Oh),ip*Nh.compositeIconSizes[1].evaluate(qi,{},Oh)],(zd[0]>Um||zd[1]>Um)&&Bn(`${ln.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),ln.addSymbols(ln.icon,lv,zd,Xo,Ns,qi,s.an.none,vr,ib.lineStartIndex,ib.lineLength,-1,Oh),W3=ln.icon.placedSymbolArray.length-1,Rh&&(AK=4*Rh.length,ln.addSymbols(ln.icon,Rh,zd,Xo,Ns,qi,s.an.vertical,vr,ib.lineStartIndex,ib.lineLength,-1,Oh),G3=ln.icon.placedSymbolArray.length-1)}const NK=Object.keys(is.horizontal);for(const Ra of NK){const Kc=is.horizontal[Ra];if(!av){PK=dl(Kc.text);const Rh=Ys.layout.get("text-rotate").evaluate(qi,{},Oh);av=new TA(ho,vr,Is,Zs,Xs,Kc,fl,Xc,Ls,Rh)}const lv=Kc.positionedLines.length===1;if(IK+=EK(ln,vr,Kc,Zc,Ys,Ls,qi,$l,ib,is.vertical?s.an.horizontal:s.an.horizontalOnly,lv?NK:[Ra],op,W3,Nh,Oh),lv)break}is.vertical&&(LK+=EK(ln,vr,is.vertical,Zc,Ys,Ls,qi,$l,ib,s.an.vertical,["vertical"],op,G3,Nh,Oh));const t7e=av?av.boxStartIndex:ln.collisionBoxArray.length,n7e=av?av.boxEndIndex:ln.collisionBoxArray.length,r7e=sb?sb.boxStartIndex:ln.collisionBoxArray.length,i7e=sb?sb.boxEndIndex:ln.collisionBoxArray.length,o7e=ob?ob.boxStartIndex:ln.collisionBoxArray.length,s7e=ob?ob.boxEndIndex:ln.collisionBoxArray.length,a7e=ab?ab.boxStartIndex:ln.collisionBoxArray.length,l7e=ab?ab.boxEndIndex:ln.collisionBoxArray.length;let Dh=-1;const AA=(Ra,Kc)=>Ra&&Ra.circleDiameter?Math.max(Ra.circleDiameter,Kc):Kc;Dh=AA(av,Dh),Dh=AA(sb,Dh),Dh=AA(ob,Dh),Dh=AA(ab,Dh);const OK=Dh>-1?1:0;OK&&(Dh*=e7e/As),ln.glyphOffsetArray.length>=eb.MAX_GLYPHS&&Bn("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),qi.sortKey!==void 0&&ln.addToSortKeyRanges(ln.symbolInstances.length,qi.sortKey);const c7e=xK(Ys,qi,Oh),[u7e,h7e]=function(Ra,Kc){const lv=Ra.length,Rh=Kc==null?void 0:Kc.values;if((Rh==null?void 0:Rh.length)>0)for(let cv=0;cv=0?op.right:-1,op.center>=0?op.center:-1,op.left>=0?op.left:-1,op.vertical||-1,W3,G3,PK,t7e,n7e,r7e,i7e,o7e,s7e,a7e,l7e,Is,IK,LK,MK,AK,OK,0,fl,Dh,u7e,h7e)}(b,bn,En,_,k,N,Pt,b.layers[0],b.collisionBoxArray,f.index,f.sourceLayerIndex,b.index,Le,[Se,Se,Se,Se],Ct,X,Be,Ve,ht,ge,f,B,ee,ne,F)};if(gt==="line")for(const En of fK(f.geometry,0,0,xe,xe)){const bn=ov(En,vt),ln=q9e(bn,pe,at,_.vertical||be,k,24,Xe,b.overscaling,xe);for(const vr of ln)be&&J9e(b,be.text,At,vr)||Qt(bn,vr)}else if(gt==="line-center"){for(const En of f.geometry)if(En.length>1){const bn=ov(En,vt),ln=G9e(bn,at,_.vertical||be,k,24,Xe);ln&&Qt(bn,ln)}}else if(f.type==="Polygon")for(const En of E_(f.geometry,0)){const bn=Z9e(En,16);Qt(ov(En[0],vt,!0),new Wm(bn.x,bn.y,0))}else if(f.type==="LineString")for(const En of f.geometry){const bn=ov(En,vt);Qt(bn,new Wm(bn[0].x,bn[0].y,0))}else if(f.type==="Point")for(const En of f.geometry)for(const bn of En)Qt([bn],new Wm(bn.x,bn.y,0))}function EK(b,f,_,k,N,B,F,H,X,ee,ne,se,de,me,ge){const be=function(Xe,Be,pe,Se,Ve,at,Ct,ht){const gt=Se.layout.get("text-rotate").evaluate(at,{})*Math.PI/180,At=[];for(const Tt of Be.positionedLines)for(const Pt of Tt.positionedGlyphs){if(!Pt.rect)continue;const vt=Pt.rect||{};let Qt=4,En=!0,bn=1,ln=0;const vr=(Ve||ht)&&Pt.vertical,xo=Pt.metrics.advance*Pt.scale/2;if(ht&&Be.verticalizable&&(ln=Tt.lineOffset/2-(Pt.imageName?-(As-Pt.metrics.width*Pt.scale)/2:(Pt.scale-1)*As)),Pt.imageName){const Ps=Ct[Pt.imageName];En=Ps.sdf,bn=Ps.pixelRatio,Qt=1/bn}const is=Ve?[Pt.x+xo,Pt.y]:[0,0];let ba=Ve?[0,0]:[Pt.x+xo+pe[0],Pt.y+pe[1]-ln],Zc=[0,0];vr&&(Zc=ba,ba=[0,0]);const Fl=Pt.metrics.isDoubleResolution?2:1,Ys=(Pt.metrics.left-Qt)*Pt.scale-xo+ba[0],ho=(-Pt.metrics.top-Qt)*Pt.scale+ba[1],Is=Ys+vt.w/Fl*Pt.scale/bn,Zs=ho+vt.h/Fl*Pt.scale/bn,Xs=new y(Ys,ho),fl=new y(Is,ho),Xc=new y(Ys,Zs),Ls=new y(Is,Zs);if(vr){const Ps=new y(-xo,xo- -17),Ns=-Math.PI/2,Xo=12-xo,qi=new y(22-Xo,-(Pt.imageName?Xo:0)),Nh=new y(...Zc);Xs._rotateAround(Ns,Ps)._add(qi)._add(Nh),fl._rotateAround(Ns,Ps)._add(qi)._add(Nh),Xc._rotateAround(Ns,Ps)._add(qi)._add(Nh),Ls._rotateAround(Ns,Ps)._add(qi)._add(Nh)}if(gt){const Ps=Math.sin(gt),Ns=Math.cos(gt),Xo=[Ns,-Ps,Ps,Ns];Xs._matMult(Xo),fl._matMult(Xo),Xc._matMult(Xo),Ls._matMult(Xo)}const $l=new y(0,0),ss=new y(0,0);At.push({tl:Xs,tr:fl,bl:Xc,br:Ls,tex:vt,writingMode:Be.writingMode,glyphOffset:is,sectionIndex:Pt.sectionIndex,isSDF:En,pixelOffsetTL:$l,pixelOffsetBR:ss,minFontScaleX:0,minFontScaleY:0})}return At}(0,_,H,N,B,F,k,b.allowVerticalPlacement),Ce=b.textSizeData;let Le=null;Ce.kind==="source"?(Le=[ip*N.layout.get("text-size").evaluate(F,{})],Le[0]>Um&&Bn(`${b.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):Ce.kind==="composite"&&(Le=[ip*me.compositeTextSizes[0].evaluate(F,{},ge),ip*me.compositeTextSizes[1].evaluate(F,{},ge)],(Le[0]>Um||Le[1]>Um)&&Bn(`${b.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),b.addSymbols(b.text,be,Le,H,B,F,ee,f,X.lineStartIndex,X.lineLength,de,ge);for(const Xe of ne)se[Xe]=b.text.placedSymbolArray.length-1;return 4*be.length}function SK(b){for(const f in b)return b[f];return null}function J9e(b,f,_,k){const N=b.compareText;if(f in N){const B=N[f];for(let F=B.length-1;F>=0;F--)if(k.dist(B[F])<_)return!0}else N[f]=[];return N[f].push(k),!1}const CK=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class F3{static from(f){if(!(f instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[_,k]=new Uint8Array(f,0,2);if(_!==219)throw new Error("Data does not appear to be in a KDBush format.");const N=k>>4;if(N!==1)throw new Error(`Got v${N} data when expected v1.`);const B=CK[15&k];if(!B)throw new Error("Unrecognized array type.");const[F]=new Uint16Array(f,2,1),[H]=new Uint32Array(f,4,1);return new F3(H,F,B,f)}constructor(f,_=64,k=Float64Array,N){if(isNaN(f)||f<0)throw new Error(`Unpexpected numItems value: ${f}.`);this.numItems=+f,this.nodeSize=Math.min(Math.max(+_,2),65535),this.ArrayType=k,this.IndexArrayType=f<65536?Uint16Array:Uint32Array;const B=CK.indexOf(this.ArrayType),F=2*f*this.ArrayType.BYTES_PER_ELEMENT,H=f*this.IndexArrayType.BYTES_PER_ELEMENT,X=(8-H%8)%8;if(B<0)throw new Error(`Unexpected typed array class: ${k}.`);N&&N instanceof ArrayBuffer?(this.data=N,this.ids=new this.IndexArrayType(this.data,8,f),this.coords=new this.ArrayType(this.data,8+H+X,2*f),this._pos=2*f,this._finished=!0):(this.data=new ArrayBuffer(8+F+H+X),this.ids=new this.IndexArrayType(this.data,8,f),this.coords=new this.ArrayType(this.data,8+H+X,2*f),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+B]),new Uint16Array(this.data,2,1)[0]=_,new Uint32Array(this.data,4,1)[0]=f)}add(f,_){const k=this._pos>>1;return this.ids[k]=k,this.coords[this._pos++]=f,this.coords[this._pos++]=_,k}finish(){const f=this._pos>>1;if(f!==this.numItems)throw new Error(`Added ${f} items when expected ${this.numItems}.`);return $3(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(f,_,k,N){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:B,coords:F,nodeSize:H}=this,X=[0,B.length-1,0],ee=[];for(;X.length;){const ne=X.pop()||0,se=X.pop()||0,de=X.pop()||0;if(se-de<=H){for(let Ce=de;Ce<=se;Ce++){const Le=F[2*Ce],Xe=F[2*Ce+1];Le>=f&&Le<=k&&Xe>=_&&Xe<=N&&ee.push(B[Ce])}continue}const me=de+se>>1,ge=F[2*me],be=F[2*me+1];ge>=f&&ge<=k&&be>=_&&be<=N&&ee.push(B[me]),(ne===0?f<=ge:_<=be)&&(X.push(de),X.push(me-1),X.push(1-ne)),(ne===0?k>=ge:N>=be)&&(X.push(me+1),X.push(se),X.push(1-ne))}return ee}within(f,_,k){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:N,coords:B,nodeSize:F}=this,H=[0,N.length-1,0],X=[],ee=k*k;for(;H.length;){const ne=H.pop()||0,se=H.pop()||0,de=H.pop()||0;if(se-de<=F){for(let Ce=de;Ce<=se;Ce++)TK(B[2*Ce],B[2*Ce+1],f,_)<=ee&&X.push(N[Ce]);continue}const me=de+se>>1,ge=B[2*me],be=B[2*me+1];TK(ge,be,f,_)<=ee&&X.push(N[me]),(ne===0?f-k<=ge:_-k<=be)&&(H.push(de),H.push(me-1),H.push(1-ne)),(ne===0?f+k>=ge:_+k>=be)&&(H.push(me+1),H.push(se),H.push(1-ne))}return X}}function $3(b,f,_,k,N,B){if(N-k<=_)return;const F=k+N>>1;kK(b,f,F,k,N,B),$3(b,f,_,k,F-1,1-B),$3(b,f,_,F+1,N,1-B)}function kK(b,f,_,k,N,B){for(;N>k;){if(N-k>600){const ee=N-k+1,ne=_-k+1,se=Math.log(ee),de=.5*Math.exp(2*se/3),me=.5*Math.sqrt(se*de*(ee-de)/ee)*(ne-ee/2<0?-1:1);kK(b,f,_,Math.max(k,Math.floor(_-ne*de/ee+me)),Math.min(N,Math.floor(_+(ee-ne)*de/ee+me)),B)}const F=f[2*_+B];let H=k,X=N;for(pE(b,f,k,_),f[2*N+B]>F&&pE(b,f,k,N);HF;)X--}f[2*k+B]===F?pE(b,f,k,X):(X++,pE(b,f,X,N)),X<=_&&(k=X+1),_<=X&&(N=X-1)}}function pE(b,f,_,k){z3(b,_,k),z3(f,2*_,2*k),z3(f,2*_+1,2*k+1)}function z3(b,f,_){const k=b[f];b[f]=b[_],b[_]=k}function TK(b,f,_,k){const N=b-_,B=f-k;return N*N+B*B}var V3;s.cw=void 0,(V3=s.cw||(s.cw={})).create="create",V3.load="load",V3.fullLoad="fullLoad";let MA=null,mE=[];const j3=1e3/60,U3="loadTime",H3="fullLoadTime",Q9e={mark(b){performance.mark(b)},frame(b){const f=b;MA!=null&&mE.push(f-MA),MA=f},clearMetrics(){MA=null,mE=[],performance.clearMeasures(U3),performance.clearMeasures(H3);for(const b in s.cw)performance.clearMarks(s.cw[b])},getPerformanceMetrics(){performance.measure(U3,s.cw.create,s.cw.load),performance.measure(H3,s.cw.create,s.cw.fullLoad);const b=performance.getEntriesByName(U3)[0].duration,f=performance.getEntriesByName(H3)[0].duration,_=mE.length,k=1/(mE.reduce((B,F)=>B+F,0)/_/1e3),N=mE.filter(B=>B>j3).reduce((B,F)=>B+(F-j3)/j3,0);return{loadTime:b,fullLoadTime:f,fps:k,percentDroppedFrames:N/(_+N)*100,totalFrames:_}}};s.$=xe,s.A=I,s.B=function([b,f,_]){return f+=90,f*=Math.PI/180,_*=Math.PI/180,{x:b*Math.cos(f)*Math.sin(_),y:b*Math.sin(f)*Math.sin(_),z:b*Math.cos(_)}},s.C=Rl,s.D=tn,s.E=wt,s.F=Qi,s.G=V_,s.H=function(b){if(Et==null){const f=b.navigator?b.navigator.userAgent:null;Et=!!b.safari||!(!f||!(/\b(iPad|iPhone|iPod)\b/.test(f)||f.match("Safari")&&!f.match("Chrome")))}return Et},s.I=C3,s.J=class{constructor(b,f){this.target=b,this.mapId=f,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new U9e(()=>this.process()),this.subscription=Ne(this.target,"message",_=>this.receive(_),!1),this.globalScope=qe(self)?b:window}registerMessageHandler(b,f){this.messageHandlers[b]=f}sendAsync(b,f){return new Promise((_,k)=>{const N=Math.round(1e18*Math.random()).toString(36).substring(0,10),B=f?Ne(f.signal,"abort",()=>{B==null||B.unsubscribe(),delete this.resolveRejects[N];const X={id:N,type:"",origin:location.origin,targetMapId:b.targetMapId,sourceMapId:this.mapId};this.target.postMessage(X)},H9e):null;this.resolveRejects[N]={resolve:X=>{B==null||B.unsubscribe(),_(X)},reject:X=>{B==null||B.unsubscribe(),k(X)}};const F=[],H=Object.assign(Object.assign({},b),{id:N,sourceMapId:this.mapId,origin:location.origin,data:qy(b.data,F)});this.target.postMessage(H,{transfer:F})})}receive(b){const f=b.data,_=f.id;if(!(f.origin!=="file://"&&location.origin!=="file://"&&f.origin!=="resource://android"&&location.origin!=="resource://android"&&f.origin!==location.origin||f.targetMapId&&this.mapId!==f.targetMapId)){if(f.type===""){delete this.tasks[_];const k=this.abortControllers[_];return delete this.abortControllers[_],void(k&&k.abort())}if(qe(self)||f.mustQueue)return this.tasks[_]=f,this.taskQueue.push(_),void this.invoker.trigger();this.processTask(_,f)}}process(){if(this.taskQueue.length===0)return;const b=this.taskQueue.shift(),f=this.tasks[b];delete this.tasks[b],this.taskQueue.length>0&&this.invoker.trigger(),f&&this.processTask(b,f)}processTask(b,f){return a(this,void 0,void 0,function*(){if(f.type===""){const N=this.resolveRejects[b];return delete this.resolveRejects[b],N?void(f.error?N.reject($m(f.error)):N.resolve($m(f.data))):void 0}if(!this.messageHandlers[f.type])return void this.completeTask(b,new Error(`Could not find a registered handler for ${f.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const _=$m(f.data),k=new AbortController;this.abortControllers[b]=k;try{const N=yield this.messageHandlers[f.type](f.sourceMapId,_,k);this.completeTask(b,null,N)}catch(N){this.completeTask(b,N)}})}completeTask(b,f,_){const k=[];delete this.abortControllers[b];const N={id:b,type:"",sourceMapId:this.mapId,origin:location.origin,error:f?qy(f):null,data:qy(_,k)};this.target.postMessage(N,{transfer:k})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},s.K=ve,s.L=function(){var b=new I(16);return I!=Float32Array&&(b[1]=0,b[2]=0,b[3]=0,b[4]=0,b[6]=0,b[7]=0,b[8]=0,b[9]=0,b[11]=0,b[12]=0,b[13]=0,b[14]=0),b[0]=1,b[5]=1,b[10]=1,b[15]=1,b},s.M=function(b,f,_){var k,N,B,F,H,X,ee,ne,se,de,me,ge,be=_[0],Ce=_[1],Le=_[2];return f===b?(b[12]=f[0]*be+f[4]*Ce+f[8]*Le+f[12],b[13]=f[1]*be+f[5]*Ce+f[9]*Le+f[13],b[14]=f[2]*be+f[6]*Ce+f[10]*Le+f[14],b[15]=f[3]*be+f[7]*Ce+f[11]*Le+f[15]):(N=f[1],B=f[2],F=f[3],H=f[4],X=f[5],ee=f[6],ne=f[7],se=f[8],de=f[9],me=f[10],ge=f[11],b[0]=k=f[0],b[1]=N,b[2]=B,b[3]=F,b[4]=H,b[5]=X,b[6]=ee,b[7]=ne,b[8]=se,b[9]=de,b[10]=me,b[11]=ge,b[12]=k*be+H*Ce+se*Le+f[12],b[13]=N*be+X*Ce+de*Le+f[13],b[14]=B*be+ee*Ce+me*Le+f[14],b[15]=F*be+ne*Ce+ge*Le+f[15]),b},s.N=function(b,f,_){var k=_[0],N=_[1],B=_[2];return b[0]=f[0]*k,b[1]=f[1]*k,b[2]=f[2]*k,b[3]=f[3]*k,b[4]=f[4]*N,b[5]=f[5]*N,b[6]=f[6]*N,b[7]=f[7]*N,b[8]=f[8]*B,b[9]=f[9]*B,b[10]=f[10]*B,b[11]=f[11]*B,b[12]=f[12],b[13]=f[13],b[14]=f[14],b[15]=f[15],b},s.O=function(b,f,_){var k=f[0],N=f[1],B=f[2],F=f[3],H=f[4],X=f[5],ee=f[6],ne=f[7],se=f[8],de=f[9],me=f[10],ge=f[11],be=f[12],Ce=f[13],Le=f[14],Xe=f[15],Be=_[0],pe=_[1],Se=_[2],Ve=_[3];return b[0]=Be*k+pe*H+Se*se+Ve*be,b[1]=Be*N+pe*X+Se*de+Ve*Ce,b[2]=Be*B+pe*ee+Se*me+Ve*Le,b[3]=Be*F+pe*ne+Se*ge+Ve*Xe,b[4]=(Be=_[4])*k+(pe=_[5])*H+(Se=_[6])*se+(Ve=_[7])*be,b[5]=Be*N+pe*X+Se*de+Ve*Ce,b[6]=Be*B+pe*ee+Se*me+Ve*Le,b[7]=Be*F+pe*ne+Se*ge+Ve*Xe,b[8]=(Be=_[8])*k+(pe=_[9])*H+(Se=_[10])*se+(Ve=_[11])*be,b[9]=Be*N+pe*X+Se*de+Ve*Ce,b[10]=Be*B+pe*ee+Se*me+Ve*Le,b[11]=Be*F+pe*ne+Se*ge+Ve*Xe,b[12]=(Be=_[12])*k+(pe=_[13])*H+(Se=_[14])*se+(Ve=_[15])*be,b[13]=Be*N+pe*X+Se*de+Ve*Ce,b[14]=Be*B+pe*ee+Se*me+Ve*Le,b[15]=Be*F+pe*ne+Se*ge+Ve*Xe,b},s.P=y,s.Q=function(b,f){const _={};for(let k=0;k{const f=window.document.createElement("video");return f.muted=!0,new Promise(_=>{f.onloadstart=()=>{_(f)};for(const k of b){const N=window.document.createElement("source");tt(k)||(f.crossOrigin="Anonymous"),N.src=k,f.appendChild(N)}})},s.a5=Ot,s.a6=function(){return hn++},s.a7=Me,s.a8=eb,s.a9=Id,s.aA=As,s.aB=Ee,s.aC=function(b,f,_,k,N=!1){if(!_[0]&&!_[1])return[0,0];const B=N?k==="map"?-b.bearingInRadians:0:k==="viewport"?b.bearingInRadians:0;if(B){const F=Math.sin(B),H=Math.cos(B);_=[_[0]*H-_[1]*F,_[0]*F+_[1]*H]}return[N?_[0]:Ee(f,_[0],b.zoom),N?_[1]:Ee(f,_[1],b.zoom)]},s.aE=M3,s.aF=B3,s.aG=T3,s.aH=F3,s.aI=wo,s.aJ=yA,s.aK=rt,s.aL=Xr,s.aM=Oi,s.aN=yt,s.aO=It,s.aP=sK,s.aQ=q,s.aR=Z,s.aS=function(b){var f=new I(3);return f[0]=b[0],f[1]=b[1],f[2]=b[2],f},s.aT=function(b,f,_){return b[0]=f[0]-_[0],b[1]=f[1]-_[1],b[2]=f[2]-_[2],b},s.aU=function(b,f){var _=f[0],k=f[1],N=f[2],B=_*_+k*k+N*N;return B>0&&(B=1/Math.sqrt(B)),b[0]=f[0]*B,b[1]=f[1]*B,b[2]=f[2]*B,b},s.aV=j,s.aW=function(b,f){return b[0]*f[0]+b[1]*f[1]+b[2]*f[2]},s.aX=function(b,f,_){return b[0]=f[0]*_[0],b[1]=f[1]*_[1],b[2]=f[2]*_[2],b[3]=f[3]*_[3],b},s.aY=W,s.aZ=function(b,f,_){const k=f[0]*_[0]+f[1]*_[1]+f[2]*_[2];return k===0?null:(-(b[0]*_[0]+b[1]*_[1]+b[2]*_[2])-_[3])/k},s.a_=U,s.aa=rv,s.ab=uK,s.ac=function(b){const f={};if(b.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(_,k,N,B)=>{const F=N||B;return f[k]=!F||F.toLowerCase(),""}),f["max-age"]){const _=parseInt(f["max-age"],10);isNaN(_)?delete f["max-age"]:f["max-age"]=_}return f},s.ad=nt,s.ae=function(b){return Math.pow(2,b)},s.af=z,s.ag=pt,s.ah=85.051129,s.ai=oK,s.aj=function(b){return Math.log(b)/Math.LN2},s.ak=function(b){var f=b[0],_=b[1];return f*f+_*_},s.al=function(b,f){const _=[];for(const k in b)k in f||_.push(k);return _},s.am=function(b,f){let _=0,k=0;if(b.kind==="constant")k=b.layoutSize;else if(b.kind!=="source"){const{interpolationType:N,minZoom:B,maxZoom:F}=b,H=N?pt(Pa.interpolationFactor(N,f,B,F),0,1):0;b.kind==="camera"?k=Rl.number(b.minSize,b.maxSize,H):_=H}return{uSizeT:_,uSize:k}},s.ao=function(b,{uSize:f,uSizeT:_},{lowerSize:k,upperSize:N}){return b.kind==="source"?k/ip:b.kind==="composite"?Rl.number(k/ip,N/ip,_):f},s.ap=function(b,f){var _=f[0],k=f[1],N=f[2],B=f[3],F=f[4],H=f[5],X=f[6],ee=f[7],ne=f[8],se=f[9],de=f[10],me=f[11],ge=f[12],be=f[13],Ce=f[14],Le=f[15],Xe=_*H-k*F,Be=_*X-N*F,pe=_*ee-B*F,Se=k*X-N*H,Ve=k*ee-B*H,at=N*ee-B*X,Ct=ne*be-se*ge,ht=ne*Ce-de*ge,gt=ne*Le-me*ge,At=se*Ce-de*be,Tt=se*Le-me*be,Pt=de*Le-me*Ce,vt=Xe*Pt-Be*Tt+pe*At+Se*gt-Ve*ht+at*Ct;return vt?(b[0]=(H*Pt-X*Tt+ee*At)*(vt=1/vt),b[1]=(N*Tt-k*Pt-B*At)*vt,b[2]=(be*at-Ce*Ve+Le*Se)*vt,b[3]=(de*Ve-se*at-me*Se)*vt,b[4]=(X*gt-F*Pt-ee*ht)*vt,b[5]=(_*Pt-N*gt+B*ht)*vt,b[6]=(Ce*pe-ge*at-Le*Be)*vt,b[7]=(ne*at-de*pe+me*Be)*vt,b[8]=(F*Tt-H*gt+ee*Ct)*vt,b[9]=(k*gt-_*Tt-B*Ct)*vt,b[10]=(ge*Ve-be*pe+Le*Xe)*vt,b[11]=(se*pe-ne*Ve-me*Xe)*vt,b[12]=(H*ht-F*At-X*Ct)*vt,b[13]=(_*At-k*ht+N*Ct)*vt,b[14]=(be*Be-ge*Se-Ce*Xe)*vt,b[15]=(ne*Se-se*Be+de*Xe)*vt,b):null},s.aq=oe,s.ar=function(b){return Math.hypot(b[0],b[1])},s.as=function(b){return b[0]=0,b[1]=0,b},s.at=function(b,f,_){return b[0]=f[0]*_,b[1]=f[1]*_,b},s.au=A3,s.av=Q,s.aw=function(b,f,_,k){const N=f.y-b.y,B=f.x-b.x,F=k.y-_.y,H=k.x-_.x,X=F*B-H*N;if(X===0)return null;const ee=(H*(b.y-_.y)-F*(b.x-_.x))/X;return new y(b.x+ee*B,b.y+ee*N)},s.ax=fK,s.ay=KZ,s.az=function(b){let f=1/0,_=1/0,k=-1/0,N=-1/0;for(const B of b)f=Math.min(f,B.x),_=Math.min(_,B.y),k=Math.max(k,B.x),N=Math.max(N,B.y);return[f,_,k,N]},s.b=qt,s.b$=b9e,s.b0=function(b,f){return b[0]*f[0]+b[1]*f[1]+b[2]*f[2]+b[3]},s.b1=lK,s.b2=tb,s.b3=function(b,f,_,k,N){var B,F=1/Math.tan(f/2);return b[0]=F/_,b[1]=0,b[2]=0,b[3]=0,b[4]=0,b[5]=F,b[6]=0,b[7]=0,b[8]=0,b[9]=0,b[11]=-1,b[12]=0,b[13]=0,b[15]=0,N!=null&&N!==1/0?(b[10]=(N+k)*(B=1/(k-N)),b[14]=2*N*k*B):(b[10]=-1,b[14]=-2*k),b},s.b4=function(b){var f=new I(16);return f[0]=b[0],f[1]=b[1],f[2]=b[2],f[3]=b[3],f[4]=b[4],f[5]=b[5],f[6]=b[6],f[7]=b[7],f[8]=b[8],f[9]=b[9],f[10]=b[10],f[11]=b[11],f[12]=b[12],f[13]=b[13],f[14]=b[14],f[15]=b[15],f},s.b5=function(b,f,_){var k=Math.sin(_),N=Math.cos(_),B=f[0],F=f[1],H=f[2],X=f[3],ee=f[4],ne=f[5],se=f[6],de=f[7];return f!==b&&(b[8]=f[8],b[9]=f[9],b[10]=f[10],b[11]=f[11],b[12]=f[12],b[13]=f[13],b[14]=f[14],b[15]=f[15]),b[0]=B*N+ee*k,b[1]=F*N+ne*k,b[2]=H*N+se*k,b[3]=X*N+de*k,b[4]=ee*N-B*k,b[5]=ne*N-F*k,b[6]=se*N-H*k,b[7]=de*N-X*k,b},s.b6=function(b,f,_){var k=Math.sin(_),N=Math.cos(_),B=f[4],F=f[5],H=f[6],X=f[7],ee=f[8],ne=f[9],se=f[10],de=f[11];return f!==b&&(b[0]=f[0],b[1]=f[1],b[2]=f[2],b[3]=f[3],b[12]=f[12],b[13]=f[13],b[14]=f[14],b[15]=f[15]),b[4]=B*N+ee*k,b[5]=F*N+ne*k,b[6]=H*N+se*k,b[7]=X*N+de*k,b[8]=ee*N-B*k,b[9]=ne*N-F*k,b[10]=se*N-H*k,b[11]=de*N-X*k,b},s.b7=function(){const b=new Float32Array(16);return z(b),b},s.b8=function(){const b=new Float64Array(16);return z(b),b},s.b9=function(){return new Float64Array(16)},s.bA=function(b){return b[0]=0,b[1]=0,b[2]=0,b},s.bB=function(b,f,_,k){const N=Math.sqrt(b*b+f*f),B=Math.sqrt(_*_+k*k);b/=N,f/=N,_/=B,k/=B;const F=Math.acos(b*_+f*k);return-f*_+b*k>0?F:-F},s.bC=function(b,f){const _=Ie(b,2*Math.PI),k=Ie(f,2*Math.PI);return Math.min(Math.abs(_-k),Math.abs(_-k+2*Math.PI),Math.abs(_-k-2*Math.PI))},s.bD=function(){const b={},f=We.$version;for(const _ in We.$root){const k=We.$root[_];if(k.required){let N=null;N=_==="version"?f:k.type==="array"?[]:{},N!=null&&(b[_]=N)}}return b},s.bE=zx,s.bF=ze,s.bG=function b(f,_){if(Array.isArray(f)){if(!Array.isArray(_)||f.length!==_.length)return!1;for(let k=0;k{"source"in F&&k[F.source]?_.push({command:"removeLayer",args:[F.id]}):B.push(F)}),_=_.concat(N),function(F,H,X){H=H||[];const ee=(F=F||[]).map(Er),ne=H.map(Er),se=F.reduce(Cs,{}),de=H.reduce(Cs,{}),me=ee.slice(),ge=Object.create(null);let be,Ce,Le,Xe,Be;for(let pe=0,Se=0;peA?(N=Math.acos(B),F=Math.sin(N),H=Math.sin((1-k)*N)/F,X=Math.sin(k*N)/F):(H=1-k,X=k),b[0]=H*ee+X*me,b[1]=H*ne+X*ge,b[2]=H*se+X*be,b[3]=H*de+X*Ce,b},s.bc=function(b){const f=new Float64Array(9);var _,k,N,B,F,H,X,ee,ne,se,de,me,ge,be,Ce,Le,Xe,Be;se=(N=(k=b)[0])*(X=N+N),de=(B=k[1])*X,ge=(F=k[2])*X,be=F*(ee=B+B),Le=(H=k[3])*X,Xe=H*ee,Be=H*(ne=F+F),(_=f)[0]=1-(me=B*ee)-(Ce=F*ne),_[3]=de-Be,_[6]=ge+Xe,_[1]=de+Be,_[4]=1-se-Ce,_[7]=be-Le,_[2]=ge-Xe,_[5]=be+Le,_[8]=1-se-me;const pe=It(-Math.asin(pt(f[2],-1,1)));let Se,Ve;return Math.hypot(f[5],f[8])<.001?(Se=0,Ve=-It(Math.atan2(f[3],f[4]))):(Se=It(f[5]===0&&f[8]===0?0:Math.atan2(f[5],f[8])),Ve=It(f[1]===0&&f[0]===0?0:Math.atan2(f[1],f[0]))),{roll:Se,pitch:pe+90,bearing:Ve}},s.bd=function(b,f){return b.roll==f.roll&&b.pitch==f.pitch&&b.bearing==f.bearing},s.be=fr,s.bf=Da,s.bg=J_,s.bh=sE,s.bi=K_,s.bj=Oe,s.bk=$e,s.bl=Zn,s.bm=function(b,f,_,k,N){return Oe(k,N,pt((b-f)/(_-f),0,1))},s.bn=Ie,s.bo=function(){return new Float64Array(3)},s.bp=function(b,f,_,k){return b[0]=f[0]+_[0]*k,b[1]=f[1]+_[1]*k,b[2]=f[2]+_[2]*k,b},s.bq=le,s.br=function(b,f,_){var k=_[0],N=_[1],B=_[2],F=f[0],H=f[1],X=f[2],ee=N*X-B*H,ne=B*F-k*X,se=k*H-N*F,de=N*se-B*ne,me=B*ee-k*se,ge=k*ne-N*ee,be=2*_[3];return ne*=be,se*=be,me*=2,ge*=2,b[0]=F+(ee*=be)+(de*=2),b[1]=H+ne+me,b[2]=X+se+ge,b},s.bs=function(b,f,_){const k=(N=[b[0],b[1],b[2],f[0],f[1],f[2],_[0],_[1],_[2]])[0]*((ne=N[8])*(F=N[4])-(H=N[5])*(ee=N[7]))+N[1]*(-ne*(B=N[3])+H*(X=N[6]))+N[2]*(ee*B-F*X);var N,B,F,H,X,ee,ne;if(k===0)return null;const se=j([],[f[0],f[1],f[2]],[_[0],_[1],_[2]]),de=j([],[_[0],_[1],_[2]],[b[0],b[1],b[2]]),me=j([],[b[0],b[1],b[2]],[f[0],f[1],f[2]]),ge=q([],se,-b[3]);return Z(ge,ge,q([],de,-f[3])),Z(ge,ge,q([],me,-_[3])),q(ge,ge,1/k),ge},s.bt=N3,s.bu=function(){return new Float64Array(4)},s.bv=function(b,f,_,k){var N=[],B=[];return N[0]=f[0]-_[0],N[1]=f[1]-_[1],N[2]=f[2]-_[2],B[0]=N[0]*Math.cos(k)-N[1]*Math.sin(k),B[1]=N[0]*Math.sin(k)+N[1]*Math.cos(k),B[2]=N[2],b[0]=B[0]+_[0],b[1]=B[1]+_[1],b[2]=B[2]+_[2],b},s.bw=function(b,f,_,k){var N=[],B=[];return N[0]=f[0]-_[0],N[1]=f[1]-_[1],N[2]=f[2]-_[2],B[0]=N[0],B[1]=N[1]*Math.cos(k)-N[2]*Math.sin(k),B[2]=N[1]*Math.sin(k)+N[2]*Math.cos(k),b[0]=B[0]+_[0],b[1]=B[1]+_[1],b[2]=B[2]+_[2],b},s.bx=function(b,f,_,k){var N=[],B=[];return N[0]=f[0]-_[0],N[1]=f[1]-_[1],N[2]=f[2]-_[2],B[0]=N[2]*Math.sin(k)+N[0]*Math.cos(k),B[1]=N[1],B[2]=N[2]*Math.cos(k)-N[0]*Math.sin(k),b[0]=B[0]+_[0],b[1]=B[1]+_[1],b[2]=B[2]+_[2],b},s.by=function(b,f,_){var k=Math.sin(_),N=Math.cos(_),B=f[0],F=f[1],H=f[2],X=f[3],ee=f[8],ne=f[9],se=f[10],de=f[11];return f!==b&&(b[4]=f[4],b[5]=f[5],b[6]=f[6],b[7]=f[7],b[12]=f[12],b[13]=f[13],b[14]=f[14],b[15]=f[15]),b[0]=B*N-ee*k,b[1]=F*N-ne*k,b[2]=H*N-se*k,b[3]=X*N-de*k,b[8]=B*k+ee*N,b[9]=F*k+ne*N,b[10]=H*k+se*N,b[11]=X*k+de*N,b},s.bz=function(b,f){const _=Ie(b,360),k=Ie(f,360),N=k-_,B=k>_?N-360:N+360;return Math.abs(N)Pt*As)}let ht=F?"center":_.get("text-justify").evaluate(ee,{},b.canonical);const gt=_.get("symbol-placement")==="point"?_.get("text-max-width").evaluate(ee,{},b.canonical)*As:1/0,At=()=>{b.bucket.allowVerticalPlacement&&Vx(pe)&&(ge.vertical=bA(be,b.glyphMap,b.glyphPositions,b.imagePositions,ne,gt,B,at,"left",Ve,Le,s.an.vertical,!0,de,se))};if(!F&&Ct){const Tt=new Set;if(ht==="auto")for(let vt=0;vtb.type==="symbol",s.cb=b=>b.type==="circle",s.cc=b=>b.type==="heatmap",s.cd=b=>b.type==="line",s.ce=b=>b.type==="fill",s.cf=b=>b.type==="fill-extrusion",s.cg=b=>b.type==="hillshade",s.ch=b=>b.type==="color-relief",s.ci=b=>b.type==="raster",s.cj=b=>b.type==="background",s.ck=b=>b.type==="custom",s.cl=Ze,s.cm=function(b,f,_){const k=he(f.x-_.x,f.y-_.y),N=he(b.x-_.x,b.y-_.y);var B,F;return It(Math.atan2(k[0]*N[1]-k[1]*N[0],(B=k)[0]*(F=N)[0]+B[1]*F[1]))},s.cn=lt,s.co=function(b,f){return Fn[f]&&(b instanceof MouseEvent||b instanceof WheelEvent)},s.cp=function(b,f){return en[f]&&"touches"in b},s.cq=function(b){return en[b]||Fn[b]},s.cr=function(b,f,_){var k=f[0],N=f[1];return b[0]=_[0]*k+_[4]*N+_[12],b[1]=_[1]*k+_[5]*N+_[13],b},s.cs=function(b,f){const{x:_,y:k}=fE.fromLngLat(f);return!(b<0||b>25||k<0||k>=1||_<0||_>=1)},s.ct=function(b,f){return b[0]=f[0],b[1]=0,b[2]=0,b[3]=0,b[4]=0,b[5]=f[1],b[6]=0,b[7]=0,b[8]=0,b[9]=0,b[10]=f[2],b[11]=0,b[12]=0,b[13]=0,b[14]=0,b[15]=1,b},s.cu=class extends Od{},s.cv=Q9e,s.cx=function(b){return b.message===lr},s.cy=ke,s.cz=function(b,f){ye.REGISTERED_PROTOCOLS[b]=f},s.d=tt,s.e=Lt,s.f=b=>a(void 0,void 0,void 0,function*(){if(b.byteLength===0)return createImageBitmap(new ImageData(1,1));const f=new Blob([new Uint8Array(b)],{type:"image/png"});try{return createImageBitmap(f)}catch(_){throw new Error(`Could not load image because of ${_.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),s.g=ue,s.h=b=>new Promise((f,_)=>{const k=new Image;k.onload=()=>{f(k),URL.revokeObjectURL(k.src),k.onload=null,window.requestAnimationFrame(()=>{k.src=rn})},k.onerror=()=>_(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const N=new Blob([new Uint8Array(b)],{type:"image/png"});k.src=b.byteLength?URL.createObjectURL(N):rn}),s.i=qe,s.j=(b,f)=>He(Lt(b,{type:"json"}),f),s.k=Qe,s.l=dt,s.m=He,s.n=(b,f)=>He(Lt(b,{type:"arrayBuffer"}),f),s.o=function(b){return new S3(b).readFields(E9e,[])},s.p=zX,s.q=tE,s.r=Oa,s.s=Ne,s.t=Wx,s.u=mr,s.v=We,s.w=Bn,s.x=KR,s.y=Wy,s.z=Bm}),i("worker",["./shared"],function(s){class a{constructor(ye){this.keyCache={},ye&&this.replace(ye)}replace(ye){this._layerConfigs={},this._layers={},this.update(ye,[])}update(ye,ue){for(const ke of ye){this._layerConfigs[ke.id]=ke;const ze=this._layers[ke.id]=s.bI(ke);ze._featureFilter=s.a9(ze.filter),this.keyCache[ke.id]&&delete this.keyCache[ke.id]}for(const ke of ue)delete this.keyCache[ke],delete this._layerConfigs[ke],delete this._layers[ke];this.familiesBySource={};const ve=s.cB(Object.values(this._layerConfigs),this.keyCache);for(const ke of ve){const ze=ke.map(Qe=>this._layers[Qe.id]),He=ze[0];if(He.visibility==="none")continue;const tt=He.source||"";let Ke=this.familiesBySource[tt];Ke||(Ke=this.familiesBySource[tt]={});const mt=He.sourceLayer||"_geojsonTileLayer";let dt=Ke[mt];dt||(dt=Ke[mt]=[]),dt.push(ze)}}}class l{constructor(ye){const ue={},ve=[];for(const tt in ye){const Ke=ye[tt],mt=ue[tt]={};for(const dt in Ke){const Qe=Ke[+dt];if(!Qe||Qe.bitmap.width===0||Qe.bitmap.height===0)continue;const wt={x:0,y:0,w:Qe.bitmap.width+2,h:Qe.bitmap.height+2};ve.push(wt),mt[dt]={rect:wt,metrics:Qe.metrics}}}const{w:ke,h:ze}=s.p(ve),He=new s.q({width:ke||1,height:ze||1});for(const tt in ye){const Ke=ye[tt];for(const mt in Ke){const dt=Ke[+mt];if(!dt||dt.bitmap.width===0||dt.bitmap.height===0)continue;const Qe=ue[tt][mt].rect;s.q.copy(dt.bitmap,He,{x:0,y:0},{x:Qe.x+1,y:Qe.y+1},dt.bitmap)}}this.image=He,this.positions=ue}}s.cC("GlyphAtlas",l);class c{constructor(ye){this.tileID=new s.Z(ye.tileID.overscaledZ,ye.tileID.wrap,ye.tileID.canonical.z,ye.tileID.canonical.x,ye.tileID.canonical.y),this.uid=ye.uid,this.zoom=ye.zoom,this.pixelRatio=ye.pixelRatio,this.tileSize=ye.tileSize,this.source=ye.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=ye.showCollisionBoxes,this.collectResourceTiming=!!ye.collectResourceTiming,this.returnDependencies=!!ye.returnDependencies,this.promoteId=ye.promoteId,this.inFlightDependencies=[],this.globalState=ye.globalState}parse(ye,ue,ve,ke,ze){return s._(this,void 0,void 0,function*(){this.status="parsing",this.data=ye,this.collisionBoxArray=new s.a7;const He=new s.cD(Object.keys(ye.layers).sort()),tt=new s.cE(this.tileID,this.promoteId);tt.bucketLayerIDs=[];const Ke={},mt={featureIndex:tt,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:ve,subdivisionGranularity:ze},dt=ue.familiesBySource[this.source];for(const On in dt){const Er=ye.layers[On];if(!Er)continue;Er.version===1&&s.w(`Vector tile source "${this.source}" layer "${On}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Cs=He.encode(On),Ot=[];for(let Us=0;Us=oo.maxzoom||oo.visibility!=="none"&&(u(Us,this.zoom,ve),(Ke[oo.id]=oo.createBucket({index:tt.bucketLayerIDs.length,layers:Us,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Cs,sourceID:this.source,globalState:this.globalState})).populate(Ot,mt,this.tileID.canonical),tt.bucketLayerIDs.push(Us.map(Td=>Td.id)))}}const Qe=s.bM(mt.glyphDependencies,On=>Object.keys(On).map(Number));this.inFlightDependencies.forEach(On=>On==null?void 0:On.abort()),this.inFlightDependencies=[];let wt=Promise.resolve({});if(Object.keys(Qe).length){const On=new AbortController;this.inFlightDependencies.push(On),wt=ke.sendAsync({type:"GG",data:{stacks:Qe,source:this.source,tileID:this.tileID,type:"glyphs"}},On)}const We=Object.keys(mt.iconDependencies);let Vt=Promise.resolve({});if(We.length){const On=new AbortController;this.inFlightDependencies.push(On),Vt=ke.sendAsync({type:"GI",data:{icons:We,source:this.source,tileID:this.tileID,type:"icons"}},On)}const xn=Object.keys(mt.patternDependencies);let jt=Promise.resolve({});if(xn.length){const On=new AbortController;this.inFlightDependencies.push(On),jt=ke.sendAsync({type:"GI",data:{icons:xn,source:this.source,tileID:this.tileID,type:"patterns"}},On)}const[yn,jn,zi]=yield Promise.all([wt,Vt,jt]),xi=new l(yn),ai=new s.cF(jn,zi);for(const On in Ke){const Er=Ke[On];Er instanceof s.a8?(u(Er.layers,this.zoom,ve),s.cG({bucket:Er,glyphMap:yn,glyphPositions:xi.positions,imageMap:jn,imagePositions:ai.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:mt.subdivisionGranularity})):Er.hasPattern&&(Er instanceof s.cH||Er instanceof s.cI||Er instanceof s.cJ)&&(u(Er.layers,this.zoom,ve),Er.addFeatures(mt,this.tileID.canonical,ai.patternPositions))}return this.status="done",{buckets:Object.values(Ke).filter(On=>!On.isEmpty()),featureIndex:tt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:xi.image,imageAtlas:ai,glyphMap:this.returnDependencies?yn:null,iconMap:this.returnDependencies?jn:null,glyphPositions:this.returnDependencies?xi.positions:null}})}}function u(Ye,ye,ue){const ve=new s.F(ye);for(const ke of Ye)ke.recalculate(ve,ue)}class d{constructor(ye,ue,ve){this.actor=ye,this.layerIndex=ue,this.availableImages=ve,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(ye,ue){return s._(this,void 0,void 0,function*(){const ve=yield s.n(ye.request,ue);try{return{vectorTile:new s.cK.VectorTile(new s.cL(ve.data)),rawData:ve.data,cacheControl:ve.cacheControl,expires:ve.expires}}catch(ke){const ze=new Uint8Array(ve.data);let He=`Unable to parse the tile at ${ye.request.url}, `;throw He+=ze[0]===31&&ze[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ke.message}`,new Error(He)}})}loadTile(ye){return s._(this,void 0,void 0,function*(){const ue=ye.uid,ve=!!(ye&&ye.request&&ye.request.collectResourceTiming)&&new s.cM(ye.request),ke=new c(ye);this.loading[ue]=ke;const ze=new AbortController;ke.abort=ze;try{const He=yield this.loadVectorTile(ye,ze);if(delete this.loading[ue],!He)return null;const tt=He.rawData,Ke={};He.expires&&(Ke.expires=He.expires),He.cacheControl&&(Ke.cacheControl=He.cacheControl);const mt={};if(ve){const Qe=ve.finish();Qe&&(mt.resourceTiming=JSON.parse(JSON.stringify(Qe)))}ke.vectorTile=He.vectorTile;const dt=ke.parse(He.vectorTile,this.layerIndex,this.availableImages,this.actor,ye.subdivisionGranularity);this.loaded[ue]=ke,this.fetching[ue]={rawTileData:tt,cacheControl:Ke,resourceTiming:mt};try{const Qe=yield dt;return s.e({rawTileData:tt.slice(0)},Qe,Ke,mt)}finally{delete this.fetching[ue]}}catch(He){throw delete this.loading[ue],ke.status="done",this.loaded[ue]=ke,He}})}reloadTile(ye){return s._(this,void 0,void 0,function*(){const ue=ye.uid;if(!this.loaded||!this.loaded[ue])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const ve=this.loaded[ue];if(ve.showCollisionBoxes=ye.showCollisionBoxes,ve.globalState=ye.globalState,ve.status==="parsing"){const ke=yield ve.parse(ve.vectorTile,this.layerIndex,this.availableImages,this.actor,ye.subdivisionGranularity);let ze;if(this.fetching[ue]){const{rawTileData:He,cacheControl:tt,resourceTiming:Ke}=this.fetching[ue];delete this.fetching[ue],ze=s.e({rawTileData:He.slice(0)},ke,tt,Ke)}else ze=ke;return ze}if(ve.status==="done"&&ve.vectorTile)return ve.parse(ve.vectorTile,this.layerIndex,this.availableImages,this.actor,ye.subdivisionGranularity)})}abortTile(ye){return s._(this,void 0,void 0,function*(){const ue=this.loading,ve=ye.uid;ue&&ue[ve]&&ue[ve].abort&&(ue[ve].abort.abort(),delete ue[ve])})}removeTile(ye){return s._(this,void 0,void 0,function*(){this.loaded&&this.loaded[ye.uid]&&delete this.loaded[ye.uid]})}}class p{constructor(){this.loaded={}}loadTile(ye){return s._(this,void 0,void 0,function*(){const{uid:ue,encoding:ve,rawImageData:ke,redFactor:ze,greenFactor:He,blueFactor:tt,baseShift:Ke}=ye,mt=ke.width+2,dt=ke.height+2,Qe=s.b(ke)?new s.R({width:mt,height:dt},yield s.cN(ke,-1,-1,mt,dt)):ke,wt=new s.cO(ue,Qe,ve,ze,He,tt,Ke);return this.loaded=this.loaded||{},this.loaded[ue]=wt,wt})}removeTile(ye){const ue=this.loaded,ve=ye.uid;ue&&ue[ve]&&delete ue[ve]}}var m,y,w=function(){if(y)return m;function Ye(ue,ve){if(ue.length!==0){ye(ue[0],ve);for(var ke=1;ke=Math.abs(mt)?ke-dt+mt:mt-dt+ke,ke=dt}ke+ze>=0!=!!ve&&ue.reverse()}return y=1,m=function ue(ve,ke){var ze,He=ve&&ve.type;if(He==="FeatureCollection")for(ze=0;ze>31}function Ke(dt,Qe){for(var wt=dt.loadGeometry(),We=dt.type,Vt=0,xn=0,jt=wt.length,yn=0;ynYe},J=Math.fround||(Z=new Float32Array(1),Ye=>(Z[0]=+Ye,Z[0]));var Z;class q{constructor(ye){this.options=Object.assign(Object.create(W),ye),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(ye){const{log:ue,minZoom:ve,maxZoom:ke}=this.options;ue&&console.time("total time");const ze=`prepare ${ye.length} points`;ue&&console.time(ze),this.points=ye;const He=[];for(let Ke=0;Ke=ve;Ke--){const mt=+Date.now();tt=this.trees[Ke]=this._createTree(this._cluster(tt,Ke)),ue&&console.log("z%d: %d clusters in %dms",Ke,tt.numItems,+Date.now()-mt)}return ue&&console.timeEnd("total time"),this}getClusters(ye,ue){let ve=((ye[0]+180)%360+360)%360-180;const ke=Math.max(-90,Math.min(90,ye[1]));let ze=ye[2]===180?180:((ye[2]+180)%360+360)%360-180;const He=Math.max(-90,Math.min(90,ye[3]));if(ye[2]-ye[0]>=360)ve=-180,ze=180;else if(ve>ze){const Qe=this.getClusters([ve,ke,180,He],ue),wt=this.getClusters([-180,ke,ze,He],ue);return Qe.concat(wt)}const tt=this.trees[this._limitZoom(ue)],Ke=tt.range(U(ve),Q(He),U(ze),Q(ke)),mt=tt.data,dt=[];for(const Qe of Ke){const wt=this.stride*Qe;dt.push(mt[wt+5]>1?j(mt,wt,this.clusterProps):this.points[mt[wt+3]])}return dt}getChildren(ye){const ue=this._getOriginId(ye),ve=this._getOriginZoom(ye),ke="No cluster with the specified id.",ze=this.trees[ve];if(!ze)throw new Error(ke);const He=ze.data;if(ue*this.stride>=He.length)throw new Error(ke);const tt=this.options.radius/(this.options.extent*Math.pow(2,ve-1)),Ke=ze.within(He[ue*this.stride],He[ue*this.stride+1],tt),mt=[];for(const dt of Ke){const Qe=dt*this.stride;He[Qe+4]===ye&&mt.push(He[Qe+5]>1?j(He,Qe,this.clusterProps):this.points[He[Qe+3]])}if(mt.length===0)throw new Error(ke);return mt}getLeaves(ye,ue,ve){const ke=[];return this._appendLeaves(ke,ye,ue=ue||10,ve=ve||0,0),ke}getTile(ye,ue,ve){const ke=this.trees[this._limitZoom(ye)],ze=Math.pow(2,ye),{extent:He,radius:tt}=this.options,Ke=tt/He,mt=(ve-Ke)/ze,dt=(ve+1+Ke)/ze,Qe={features:[]};return this._addTileFeatures(ke.range((ue-Ke)/ze,mt,(ue+1+Ke)/ze,dt),ke.data,ue,ve,ze,Qe),ue===0&&this._addTileFeatures(ke.range(1-Ke/ze,mt,1,dt),ke.data,ze,ve,ze,Qe),ue===ze-1&&this._addTileFeatures(ke.range(0,mt,Ke/ze,dt),ke.data,-1,ve,ze,Qe),Qe.features.length?Qe:null}getClusterExpansionZoom(ye){let ue=this._getOriginZoom(ye)-1;for(;ue<=this.options.maxZoom;){const ve=this.getChildren(ye);if(ue++,ve.length!==1)break;ye=ve[0].properties.cluster_id}return ue}_appendLeaves(ye,ue,ve,ke,ze){const He=this.getChildren(ue);for(const tt of He){const Ke=tt.properties;if(Ke&&Ke.cluster?ze+Ke.point_count<=ke?ze+=Ke.point_count:ze=this._appendLeaves(ye,Ke.cluster_id,ve,ke,ze):ze1;let dt,Qe,wt;if(mt)dt=G(ue,Ke,this.clusterProps),Qe=ue[Ke],wt=ue[Ke+1];else{const xn=this.points[ue[Ke+3]];dt=xn.properties;const[jt,yn]=xn.geometry.coordinates;Qe=U(jt),wt=Q(yn)}const We={type:1,geometry:[[Math.round(this.options.extent*(Qe*ze-ve)),Math.round(this.options.extent*(wt*ze-ke))]],tags:dt};let Vt;Vt=mt||this.options.generateId?ue[Ke+3]:this.points[ue[Ke+3]].id,Vt!==void 0&&(We.id=Vt),He.features.push(We)}}_limitZoom(ye){return Math.max(this.options.minZoom,Math.min(Math.floor(+ye),this.options.maxZoom+1))}_cluster(ye,ue){const{radius:ve,extent:ke,reduce:ze,minPoints:He}=this.options,tt=ve/(ke*Math.pow(2,ue)),Ke=ye.data,mt=[],dt=this.stride;for(let Qe=0;Qeue&&(jt+=Ke[jn+5])}if(jt>xn&&jt>=He){let yn,jn=wt*xn,zi=We*xn,xi=-1;const ai=(Qe/dt<<5)+(ue+1)+this.points.length;for(const On of Vt){const Er=On*dt;if(Ke[Er+2]<=ue)continue;Ke[Er+2]=ue;const Cs=Ke[Er+5];jn+=Ke[Er]*Cs,zi+=Ke[Er+1]*Cs,Ke[Er+4]=ai,ze&&(yn||(yn=this._map(Ke,Qe,!0),xi=this.clusterProps.length,this.clusterProps.push(yn)),ze(yn,this._map(Ke,Er)))}Ke[Qe+4]=ai,mt.push(jn/jt,zi/jt,1/0,ai,-1,jt),ze&&mt.push(xi)}else{for(let yn=0;yn1)for(const yn of Vt){const jn=yn*dt;if(!(Ke[jn+2]<=ue)){Ke[jn+2]=ue;for(let zi=0;zi>5}_getOriginZoom(ye){return(ye-this.points.length)%32}_map(ye,ue,ve){if(ye[ue+5]>1){const He=this.clusterProps[ye[ue+6]];return ve?Object.assign({},He):He}const ke=this.points[ye[ue+3]].properties,ze=this.options.map(ke);return ve&&ze===ke?Object.assign({},ze):ze}}function j(Ye,ye,ue){return{type:"Feature",id:Ye[ye+3],properties:G(Ye,ye,ue),geometry:{type:"Point",coordinates:[(ve=Ye[ye],360*(ve-.5)),re(Ye[ye+1])]}};var ve}function G(Ye,ye,ue){const ve=Ye[ye+5],ke=ve>=1e4?`${Math.round(ve/1e3)}k`:ve>=1e3?Math.round(ve/100)/10+"k":ve,ze=Ye[ye+6],He=ze===-1?{}:Object.assign({},ue[ze]);return Object.assign(He,{cluster:!0,cluster_id:Ye[ye+3],point_count:ve,point_count_abbreviated:ke})}function U(Ye){return Ye/360+.5}function Q(Ye){const ye=Math.sin(Ye*Math.PI/180),ue=.5-.25*Math.log((1+ye)/(1-ye))/Math.PI;return ue<0?0:ue>1?1:ue}function re(Ye){const ye=(180-360*Ye)*Math.PI/180;return 360*Math.atan(Math.exp(ye))/Math.PI-90}function le(Ye,ye,ue,ve){let ke=ve;const ze=ye+(ue-ye>>1);let He,tt=ue-ye;const Ke=Ye[ye],mt=Ye[ye+1],dt=Ye[ue],Qe=Ye[ue+1];for(let wt=ye+3;wtke)He=wt,ke=We;else if(We===ke){const Vt=Math.abs(wt-ze);Vtve&&(He-ye>3&&le(Ye,ye,He,ve),Ye[He+2]=ke,ue-He>3&&le(Ye,He,ue,ve))}function oe(Ye,ye,ue,ve,ke,ze){let He=ke-ue,tt=ze-ve;if(He!==0||tt!==0){const Ke=((Ye-ue)*He+(ye-ve)*tt)/(He*He+tt*tt);Ke>1?(ue=ke,ve=ze):Ke>0&&(ue+=He*Ke,ve+=tt*Ke)}return He=Ye-ue,tt=ye-ve,He*He+tt*tt}function he(Ye,ye,ue,ve){const ke={id:Ye??null,type:ye,geometry:ue,tags:ve,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(ye==="Point"||ye==="MultiPoint"||ye==="LineString")xe(ke,ue);else if(ye==="Polygon")xe(ke,ue[0]);else if(ye==="MultiLineString")for(const ze of ue)xe(ke,ze);else if(ye==="MultiPolygon")for(const ze of ue)xe(ke,ze[0]);return ke}function xe(Ye,ye){for(let ue=0;ue0&&(He+=ve?(ke*dt-mt*ze)/2:Math.sqrt(Math.pow(mt-ke,2)+Math.pow(dt-ze,2))),ke=mt,ze=dt}const tt=ye.length-3;ye[2]=1,le(ye,0,tt,ue),ye[tt+2]=1,ye.size=Math.abs(He),ye.start=0,ye.end=ye.size}function $e(Ye,ye,ue,ve){for(let ke=0;ke1?1:ue}function pt(Ye,ye,ue,ve,ke,ze,He,tt){if(ve/=ye,ze>=(ue/=ye)&&He=ve)return null;const Ke=[];for(const mt of Ye){const dt=mt.geometry;let Qe=mt.type;const wt=ke===0?mt.minX:mt.minY,We=ke===0?mt.maxX:mt.maxY;if(wt>=ue&&We=ve)continue;let Vt=[];if(Qe==="Point"||Qe==="MultiPoint")yt(dt,Vt,ue,ve,ke);else if(Qe==="LineString")Lt(dt,Vt,ue,ve,ke,!1,tt.lineMetrics);else if(Qe==="MultiLineString")Ht(dt,Vt,ue,ve,ke,!1);else if(Qe==="Polygon")Ht(dt,Vt,ue,ve,ke,!0);else if(Qe==="MultiPolygon")for(const xn of dt){const jt=[];Ht(xn,jt,ue,ve,ke,!0),jt.length&&Vt.push(jt)}if(Vt.length){if(tt.lineMetrics&&Qe==="LineString"){for(const xn of Vt)Ke.push(he(mt.id,Qe,xn,mt.tags));continue}Qe!=="LineString"&&Qe!=="MultiLineString"||(Vt.length===1?(Qe="LineString",Vt=Vt[0]):Qe="MultiLineString"),Qe!=="Point"&&Qe!=="MultiPoint"||(Qe=Vt.length===3?"Point":"MultiPoint"),Ke.push(he(mt.id,Qe,Vt,mt.tags))}}return Ke.length?Ke:null}function yt(Ye,ye,ue,ve,ke){for(let ze=0;ze=ue&&He<=ve&&wn(ye,Ye[ze],Ye[ze+1],Ye[ze+2])}}function Lt(Ye,ye,ue,ve,ke,ze,He){let tt=hn(Ye);const Ke=ke===0?cn:Hn;let mt,dt,Qe=Ye.start;for(let jt=0;jtue&&(dt=Ke(tt,yn,jn,xi,ai,ue),He&&(tt.start=Qe+mt*dt)):On>ve?Er=ue&&(dt=Ke(tt,yn,jn,xi,ai,ue),Cs=!0),Er>ve&&On<=ve&&(dt=Ke(tt,yn,jn,xi,ai,ve),Cs=!0),!ze&&Cs&&(He&&(tt.end=Qe+mt*dt),ye.push(tt),tt=hn(Ye)),He&&(Qe+=mt)}let wt=Ye.length-3;const We=Ye[wt],Vt=Ye[wt+1],xn=ke===0?We:Vt;xn>=ue&&xn<=ve&&wn(tt,We,Vt,Ye[wt+2]),wt=tt.length-3,ze&&wt>=3&&(tt[wt]!==tt[0]||tt[wt+1]!==tt[1])&&wn(tt,tt[0],tt[1],tt[2]),tt.length&&ye.push(tt)}function hn(Ye){const ye=[];return ye.size=Ye.size,ye.start=Ye.start,ye.end=Ye.end,ye}function Ht(Ye,ye,ue,ve,ke,ze){for(const He of Ye)Lt(He,ye,ue,ve,ke,ze,!1)}function wn(Ye,ye,ue,ve){Ye.push(ye,ue,ve)}function cn(Ye,ye,ue,ve,ke,ze){const He=(ze-ye)/(ve-ye);return wn(Ye,ze,ue+(ke-ue)*He,1),He}function Hn(Ye,ye,ue,ve,ke,ze){const He=(ze-ue)/(ke-ue);return wn(Ye,ye+(ve-ye)*He,ze,1),He}function Bn(Ye,ye){const ue=[];for(let ve=0;ve0&&ye.size<(ke?He:ve))return void(ue.numPoints+=ye.length/3);const tt=[];for(let Ke=0;KeHe)&&(ue.numSimplified++,tt.push(ye[Ke],ye[Ke+1])),ue.numPoints++;ke&&function(Ke,mt){let dt=0;for(let Qe=0,wt=Ke.length,We=wt-2;Qe0===mt)for(let Qe=0,wt=Ke.length;Qe24)throw new Error("maxZoom should be in the 0-24 range");if(ue.promoteId&&ue.generateId)throw new Error("promoteId and generateId cannot be used together.");let ke=function(ze,He){const tt=[];if(ze.type==="FeatureCollection")for(let Ke=0;Ke1&&console.time("creation"),We=this.tiles[wt]=qt(ye,ue,ve,ke,mt),this.tileCoords.push({z:ue,x:ve,y:ke}),dt)){dt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",ue,ve,ke,We.numFeatures,We.numPoints,We.numSimplified),console.timeEnd("creation"));const Cs=`z${ue}`;this.stats[Cs]=(this.stats[Cs]||0)+1,this.total++}if(We.source=ye,ze==null){if(ue===mt.indexMaxZoom||We.numPoints<=mt.indexMaxPoints)continue}else{if(ue===mt.maxZoom||ue===ze)continue;if(ze!=null){const Cs=ze-ue;if(ve!==He>>Cs||ke!==tt>>Cs)continue}}if(We.source=null,ye.length===0)continue;dt>1&&console.time("clipping");const Vt=.5*mt.buffer/mt.extent,xn=.5-Vt,jt=.5+Vt,yn=1+Vt;let jn=null,zi=null,xi=null,ai=null,On=pt(ye,Qe,ve-Vt,ve+jt,0,We.minX,We.maxX,mt),Er=pt(ye,Qe,ve+xn,ve+yn,0,We.minX,We.maxX,mt);ye=null,On&&(jn=pt(On,Qe,ke-Vt,ke+jt,1,We.minY,We.maxY,mt),zi=pt(On,Qe,ke+xn,ke+yn,1,We.minY,We.maxY,mt),On=null),Er&&(xi=pt(Er,Qe,ke-Vt,ke+jt,1,We.minY,We.maxY,mt),ai=pt(Er,Qe,ke+xn,ke+yn,1,We.minY,We.maxY,mt),Er=null),dt>1&&console.timeEnd("clipping"),Ke.push(jn||[],ue+1,2*ve,2*ke),Ke.push(zi||[],ue+1,2*ve,2*ke+1),Ke.push(xi||[],ue+1,2*ve+1,2*ke),Ke.push(ai||[],ue+1,2*ve+1,2*ke+1)}}getTile(ye,ue,ve){ye=+ye,ue=+ue,ve=+ve;const ke=this.options,{extent:ze,debug:He}=ke;if(ye<0||ye>24)return null;const tt=1<1&&console.log("drilling down to z%d-%d-%d",ye,ue,ve);let mt,dt=ye,Qe=ue,wt=ve;for(;!mt&&dt>0;)dt--,Qe>>=1,wt>>=1,mt=this.tiles[Ne(dt,Qe,wt)];return mt&&mt.source?(He>1&&(console.log("found parent tile z%d-%d-%d",dt,Qe,wt),console.time("drilling down")),this.splitTile(mt.source,dt,Qe,wt,ye,ue,ve),He>1&&console.timeEnd("drilling down"),this.tiles[Ke]?qe(this.tiles[Ke],ze):null):null}}function Ne(Ye,ye,ue){return 32*((1<{Qe.properties=We;const Vt={};for(const xn of wt)Vt[xn]=Ke[xn].evaluate(dt,Qe);return Vt},He.reduce=(We,Vt)=>{Qe.properties=Vt;for(const xn of wt)dt.accumulated=We[xn],We[xn]=mt[xn].evaluate(dt,Qe)},He}(ye)).load((yield this._pendingData).features):(ke=yield this._pendingData,new an(ke,ye.geojsonVtOptions)),this.loaded={};const ze={};if(ve){const He=ve.finish();He&&(ze.resourceTiming={},ze.resourceTiming[ye.source]=JSON.parse(JSON.stringify(He)))}return ze}catch(ze){if(delete this._pendingRequest,s.cx(ze))return{abandoned:!0};throw ze}var ke})}getData(){return s._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(ye){const ue=this.loaded;return ue&&ue[ye.uid]?super.reloadTile(ye):this.loadTile(ye)}loadAndProcessGeoJSON(ye,ue){return s._(this,void 0,void 0,function*(){let ve=yield this.loadGeoJSON(ye,ue);if(delete this._pendingRequest,typeof ve!="object")throw new Error(`Input data given to '${ye.source}' is not a valid GeoJSON object.`);if(x(ve,!0),ye.filter){const ke=s.cT(ye.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ke.result==="error")throw new Error(ke.value.map(He=>`${He.key}: ${He.message}`).join(", "));ve={type:"FeatureCollection",features:ve.features.filter(He=>ke.value.evaluate({zoom:0},He))}}return ve})}loadGeoJSON(ye,ue){return s._(this,void 0,void 0,function*(){const{promoteId:ve}=ye;if(ye.request){const ke=yield s.j(ye.request,ue);return this._dataUpdateable=It(ke.data,ve)?en(ke.data,ve):void 0,ke.data}if(typeof ye.data=="string")try{const ke=JSON.parse(ye.data);return this._dataUpdateable=It(ke,ve)?en(ke,ve):void 0,ke}catch{throw new Error(`Input data given to '${ye.source}' is not a valid GeoJSON object.`)}if(!ye.dataDiff)throw new Error(`Input data given to '${ye.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${ye.source}`);return function(ke,ze,He){var tt,Ke,mt,dt;if(ze.removeAll&&ke.clear(),ze.remove)for(const Qe of ze.remove)ke.delete(Qe);if(ze.add)for(const Qe of ze.add){const wt=nt(Qe,He);wt!=null&&ke.set(wt,Qe)}if(ze.update)for(const Qe of ze.update){let wt=ke.get(Qe.id);if(wt==null)continue;const We=!Qe.removeAllProperties&&(((tt=Qe.removeProperties)===null||tt===void 0?void 0:tt.length)>0||((Ke=Qe.addOrUpdateProperties)===null||Ke===void 0?void 0:Ke.length)>0);if((Qe.newGeometry||Qe.removeAllProperties||We)&&(wt=Object.assign({},wt),ke.set(Qe.id,wt),We&&(wt.properties=Object.assign({},wt.properties))),Qe.newGeometry&&(wt.geometry=Qe.newGeometry),Qe.removeAllProperties)wt.properties={};else if(((mt=Qe.removeProperties)===null||mt===void 0?void 0:mt.length)>0)for(const Vt of Qe.removeProperties)Object.prototype.hasOwnProperty.call(wt.properties,Vt)&&delete wt.properties[Vt];if(((dt=Qe.addOrUpdateProperties)===null||dt===void 0?void 0:dt.length)>0)for(const{key:Vt,value:xn}of Qe.addOrUpdateProperties)wt.properties[Vt]=xn}}(this._dataUpdateable,ye.dataDiff,ve),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(ye){return s._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(ye){return this._geoJSONIndex.getClusterExpansionZoom(ye.clusterId)}getClusterChildren(ye){return this._geoJSONIndex.getChildren(ye.clusterId)}getClusterLeaves(ye){return this._geoJSONIndex.getLeaves(ye.clusterId,ye.limit,ye.offset)}}class lr{constructor(ye){this.self=ye,this.actor=new s.J(ye),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(ue,ve)=>{if(this.externalWorkerSourceTypes[ue])throw new Error(`Worker source with name "${ue}" already registered.`);this.externalWorkerSourceTypes[ue]=ve},this.self.addProtocol=s.cz,this.self.removeProtocol=s.cA,this.self.registerRTLTextPlugin=ue=>{s.cU.setMethods(ue)},this.actor.registerMessageHandler("LDT",(ue,ve)=>this._getDEMWorkerSource(ue,ve.source).loadTile(ve)),this.actor.registerMessageHandler("RDT",(ue,ve)=>s._(this,void 0,void 0,function*(){this._getDEMWorkerSource(ue,ve.source).removeTile(ve)})),this.actor.registerMessageHandler("GCEZ",(ue,ve)=>s._(this,void 0,void 0,function*(){return this._getWorkerSource(ue,ve.type,ve.source).getClusterExpansionZoom(ve)})),this.actor.registerMessageHandler("GCC",(ue,ve)=>s._(this,void 0,void 0,function*(){return this._getWorkerSource(ue,ve.type,ve.source).getClusterChildren(ve)})),this.actor.registerMessageHandler("GCL",(ue,ve)=>s._(this,void 0,void 0,function*(){return this._getWorkerSource(ue,ve.type,ve.source).getClusterLeaves(ve)})),this.actor.registerMessageHandler("LD",(ue,ve)=>this._getWorkerSource(ue,ve.type,ve.source).loadData(ve)),this.actor.registerMessageHandler("GD",(ue,ve)=>this._getWorkerSource(ue,ve.type,ve.source).getData()),this.actor.registerMessageHandler("LT",(ue,ve)=>this._getWorkerSource(ue,ve.type,ve.source).loadTile(ve)),this.actor.registerMessageHandler("RT",(ue,ve)=>this._getWorkerSource(ue,ve.type,ve.source).reloadTile(ve)),this.actor.registerMessageHandler("AT",(ue,ve)=>this._getWorkerSource(ue,ve.type,ve.source).abortTile(ve)),this.actor.registerMessageHandler("RMT",(ue,ve)=>this._getWorkerSource(ue,ve.type,ve.source).removeTile(ve)),this.actor.registerMessageHandler("RS",(ue,ve)=>s._(this,void 0,void 0,function*(){if(!this.workerSources[ue]||!this.workerSources[ue][ve.type]||!this.workerSources[ue][ve.type][ve.source])return;const ke=this.workerSources[ue][ve.type][ve.source];delete this.workerSources[ue][ve.type][ve.source],ke.removeSource!==void 0&&ke.removeSource(ve)})),this.actor.registerMessageHandler("RM",ue=>s._(this,void 0,void 0,function*(){delete this.layerIndexes[ue],delete this.availableImages[ue],delete this.workerSources[ue],delete this.demWorkerSources[ue]})),this.actor.registerMessageHandler("SR",(ue,ve)=>s._(this,void 0,void 0,function*(){this.referrer=ve})),this.actor.registerMessageHandler("SRPS",(ue,ve)=>this._syncRTLPluginState(ue,ve)),this.actor.registerMessageHandler("IS",(ue,ve)=>s._(this,void 0,void 0,function*(){this.self.importScripts(ve)})),this.actor.registerMessageHandler("SI",(ue,ve)=>this._setImages(ue,ve)),this.actor.registerMessageHandler("UL",(ue,ve)=>s._(this,void 0,void 0,function*(){this._getLayerIndex(ue).update(ve.layers,ve.removedIds)})),this.actor.registerMessageHandler("SL",(ue,ve)=>s._(this,void 0,void 0,function*(){this._getLayerIndex(ue).replace(ve)}))}_setImages(ye,ue){return s._(this,void 0,void 0,function*(){this.availableImages[ye]=ue;for(const ve in this.workerSources[ye]){const ke=this.workerSources[ye][ve];for(const ze in ke)ke[ze].availableImages=ue}})}_syncRTLPluginState(ye,ue){return s._(this,void 0,void 0,function*(){return yield s.cU.syncState(ue,this.self.importScripts)})}_getAvailableImages(ye){let ue=this.availableImages[ye];return ue||(ue=[]),ue}_getLayerIndex(ye){let ue=this.layerIndexes[ye];return ue||(ue=this.layerIndexes[ye]=new a),ue}_getWorkerSource(ye,ue,ve){if(this.workerSources[ye]||(this.workerSources[ye]={}),this.workerSources[ye][ue]||(this.workerSources[ye][ue]={}),!this.workerSources[ye][ue][ve]){const ke={sendAsync:(ze,He)=>(ze.targetMapId=ye,this.actor.sendAsync(ze,He))};switch(ue){case"vector":this.workerSources[ye][ue][ve]=new d(ke,this._getLayerIndex(ye),this._getAvailableImages(ye));break;case"geojson":this.workerSources[ye][ue][ve]=new Fn(ke,this._getLayerIndex(ye),this._getAvailableImages(ye));break;default:this.workerSources[ye][ue][ve]=new this.externalWorkerSourceTypes[ue](ke,this._getLayerIndex(ye),this._getAvailableImages(ye))}}return this.workerSources[ye][ue][ve]}_getDEMWorkerSource(ye,ue){return this.demWorkerSources[ye]||(this.demWorkerSources[ye]={}),this.demWorkerSources[ye][ue]||(this.demWorkerSources[ye][ue]=new p),this.demWorkerSources[ye][ue]}}return s.i(self)&&(self.worker=new lr(self)),lr}),i("index",["exports","./shared"],function(s,a){var l="5.6.0";function c(){var D=new a.A(4);return a.A!=Float32Array&&(D[1]=0,D[2]=0),D[0]=1,D[3]=1,D}let u,d;const p={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(D,h,v){const T=requestAnimationFrame(R=>{P(),h(R)}),{unsubscribe:P}=a.s(D.signal,"abort",()=>{P(),cancelAnimationFrame(T),v(a.c())},!1)},frameAsync(D){return new Promise((h,v)=>{this.frame(D,h,v)})},getImageData(D,h=0){return this.getImageCanvasContext(D).getImageData(-h,-h,D.width+2*h,D.height+2*h)},getImageCanvasContext(D){const h=window.document.createElement("canvas"),v=h.getContext("2d",{willReadFrequently:!0});if(!v)throw new Error("failed to create canvas 2d context");return h.width=D.width,h.height=D.height,v.drawImage(D,0,0,D.width,D.height),v},resolveURL:D=>(u||(u=document.createElement("a")),u.href=D,u.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(d==null&&(d=matchMedia("(prefers-reduced-motion: reduce)")),d.matches)}};class m{static testProp(h){if(!m.docStyle)return h[0];for(let v=0;v{window.removeEventListener("click",m.suppressClickInternal,!0)},0)}static getScale(h){const v=h.getBoundingClientRect();return{x:v.width/h.offsetWidth||1,y:v.height/h.offsetHeight||1,boundingClientRect:v}}static getPoint(h,v,T){const P=v.boundingClientRect;return new a.P((T.clientX-P.left)/v.x-h.clientLeft,(T.clientY-P.top)/v.y-h.clientTop)}static mousePos(h,v){const T=m.getScale(h);return m.getPoint(h,T,v)}static touchPos(h,v){const T=[],P=m.getScale(h);for(let R=0;R{w&&M(w),w=null,S=!0},x.onerror=()=>{C=!0,w=null},x.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(D){let h,v,T,P;D.resetRequestQueue=()=>{h=[],v=0,T=0,P={}},D.addThrottleControl=K=>{const te=T++;return P[te]=K,te},D.removeThrottleControl=K=>{delete P[K],V()},D.getImage=(K,te,ie=!0)=>new Promise((ce,ae)=>{y.supported&&(K.headers||(K.headers={}),K.headers.accept="image/webp,*/*"),a.e(K,{type:"image"}),h.push({abortController:te,requestParameters:K,supportImageRefresh:ie,state:"queued",onError:fe=>{ae(fe)},onSuccess:fe=>{ce(fe)}}),V()});const R=K=>a._(this,void 0,void 0,function*(){K.state="running";const{requestParameters:te,supportImageRefresh:ie,onError:ce,onSuccess:ae,abortController:fe}=K,_e=ie===!1&&!a.i(self)&&!a.g(te.url)&&(!te.headers||Object.keys(te.headers).reduce((Ae,Pe)=>Ae&&Pe==="accept",!0));v++;const Me=_e?Y(te,fe):a.m(te,fe);try{const Ae=yield Me;delete K.abortController,K.state="completed",Ae.data instanceof HTMLImageElement||a.b(Ae.data)?ae(Ae):Ae.data&&ae({data:yield(Te=Ae.data,typeof createImageBitmap=="function"?a.f(Te):a.h(Te)),cacheControl:Ae.cacheControl,expires:Ae.expires})}catch(Ae){delete K.abortController,ce(Ae)}finally{v--,V()}var Te}),V=()=>{const K=(()=>{for(const te of Object.keys(P))if(P[te]())return!0;return!1})()?a.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:a.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let te=v;te0;te++){const ie=h.shift();ie.abortController.signal.aborted?te--:R(ie)}},Y=(K,te)=>new Promise((ie,ce)=>{const ae=new Image,fe=K.url,_e=K.credentials;_e&&_e==="include"?ae.crossOrigin="use-credentials":(_e&&_e==="same-origin"||!a.d(fe))&&(ae.crossOrigin="anonymous"),te.signal.addEventListener("abort",()=>{ae.src="",ce(a.c())}),ae.fetchPriority="high",ae.onload=()=>{ae.onerror=ae.onload=null,ie({data:ae})},ae.onerror=()=>{ae.onerror=ae.onload=null,te.signal.aborted||ce(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},ae.src=fe})}(E||(E={})),E.resetRequestQueue();class A{constructor(h){this._transformRequestFn=h}transformRequest(h,v){return this._transformRequestFn&&this._transformRequestFn(h,v)||{url:h}}setTransformRequest(h){this._transformRequestFn=h}}function I(D){const h=[];if(typeof D=="string")h.push({id:"default",url:D});else if(D&&D.length>0){const v=[];for(const{id:T,url:P}of D){const R=`${T}${P}`;v.indexOf(R)===-1&&(v.push(R),h.push({id:T,url:P}))}}return h}function O(D,h,v){try{const T=new URL(D);return T.pathname+=`${h}${v}`,T.toString()}catch{throw new Error(`Invalid sprite URL "${D}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function z(D){const{userImage:h}=D;return!!(h&&h.render&&h.render())&&(D.data.replace(new Uint8Array(h.data.buffer)),!0)}class $ extends a.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(h){if(this.loaded!==h&&(this.loaded=h,h)){for(const{ids:v,promiseResolve:T}of this.requestors)T(this._getImagesForIds(v));this.requestors=[]}}getImage(h){const v=this.images[h];if(v&&!v.data&&v.spriteData){const T=v.spriteData;v.data=new a.R({width:T.width,height:T.height},T.context.getImageData(T.x,T.y,T.width,T.height).data),v.spriteData=null}return v}addImage(h,v){if(this.images[h])throw new Error(`Image id ${h} already exist, use updateImage instead`);this._validate(h,v)&&(this.images[h]=v)}_validate(h,v){let T=!0;const P=v.data||v.spriteData;return this._validateStretch(v.stretchX,P&&P.width)||(this.fire(new a.k(new Error(`Image "${h}" has invalid "stretchX" value`))),T=!1),this._validateStretch(v.stretchY,P&&P.height)||(this.fire(new a.k(new Error(`Image "${h}" has invalid "stretchY" value`))),T=!1),this._validateContent(v.content,v)||(this.fire(new a.k(new Error(`Image "${h}" has invalid "content" value`))),T=!1),T}_validateStretch(h,v){if(!h)return!0;let T=0;for(const P of h){if(P[0]{let P=!0;if(!this.isLoaded())for(const R of h)this.images[R]||(P=!1);this.isLoaded()||P?v(this._getImagesForIds(h)):this.requestors.push({ids:h,promiseResolve:v})})}_getImagesForIds(h){const v={};for(const T of h){let P=this.getImage(T);P||(this.fire(new a.l("styleimagemissing",{id:T})),P=this.getImage(T)),P?v[T]={data:P.data.clone(),pixelRatio:P.pixelRatio,sdf:P.sdf,version:P.version,stretchX:P.stretchX,stretchY:P.stretchY,content:P.content,textFitWidth:P.textFitWidth,textFitHeight:P.textFitHeight,hasRenderCallback:!!(P.userImage&&P.userImage.render)}:a.w(`Image "${T}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return v}getPixelSize(){const{width:h,height:v}=this.atlasImage;return{width:h,height:v}}getPattern(h){const v=this.patterns[h],T=this.getImage(h);if(!T)return null;if(v&&v.position.version===T.version)return v.position;if(v)v.position.version=T.version;else{const P={w:T.data.width+2,h:T.data.height+2,x:0,y:0},R=new a.I(P,T);this.patterns[h]={bin:P,position:R}}return this._updatePatternAtlas(),this.patterns[h].position}bind(h){const v=h.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new a.T(h,this.atlasImage,v.RGBA),this.atlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE)}_updatePatternAtlas(){const h=[];for(const R in this.patterns)h.push(this.patterns[R].bin);const{w:v,h:T}=a.p(h),P=this.atlasImage;P.resize({width:v||1,height:T||1});for(const R in this.patterns){const{bin:V}=this.patterns[R],Y=V.x+1,K=V.y+1,te=this.getImage(R).data,ie=te.width,ce=te.height;a.R.copy(te,P,{x:0,y:0},{x:Y,y:K},{width:ie,height:ce}),a.R.copy(te,P,{x:0,y:ce-1},{x:Y,y:K-1},{width:ie,height:1}),a.R.copy(te,P,{x:0,y:0},{x:Y,y:K+ce},{width:ie,height:1}),a.R.copy(te,P,{x:ie-1,y:0},{x:Y-1,y:K},{width:1,height:ce}),a.R.copy(te,P,{x:0,y:0},{x:Y+ie,y:K},{width:1,height:ce})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(h){for(const v of h){if(this.callbackDispatchedThisFrame[v])continue;this.callbackDispatchedThisFrame[v]=!0;const T=this.getImage(v);T||a.w(`Image with ID: "${v}" was not found`),z(T)&&this.updateImage(v,T)}}}const W=1e20;function J(D,h,v,T,P,R,V,Y,K){for(let te=h;te-1);K++,R[K]=Y,V[K]=te,V[K+1]=W}for(let Y=0,K=0;Y65535)throw new Error("glyphs > 65535 not supported");if(T.ranges[R])return{stack:h,id:v,glyph:P};if(!this.url)throw new Error("glyphsUrl is not set");if(!T.requests[R]){const Y=q.loadGlyphRange(h,R,this.url,this.requestManager);T.requests[R]=Y}const V=yield T.requests[R];for(const Y in V)this._doesCharSupportLocalGlyph(+Y)||(T.glyphs[+Y]=V[+Y]);return T.ranges[R]=!0,{stack:h,id:v,glyph:V[v]||null}})}_doesCharSupportLocalGlyph(h){return!!this.localIdeographFontFamily&&(new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(h))||a.u["CJK Unified Ideographs"](h)||a.u["Hangul Syllables"](h)||a.u.Hiragana(h)||a.u.Katakana(h)||a.u["CJK Symbols and Punctuation"](h)||a.u["Halfwidth and Fullwidth Forms"](h))}_tinySDF(h,v,T){const P=this.localIdeographFontFamily;if(!P||!this._doesCharSupportLocalGlyph(T))return;let R=h.tinySDF;if(!R){let Y="400";/bold/i.test(v)?Y="900":/medium/i.test(v)?Y="500":/light/i.test(v)&&(Y="200"),R=h.tinySDF=new q.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:P,fontWeight:Y})}const V=R.draw(String.fromCharCode(T));return{id:T,bitmap:new a.q({width:V.width||60,height:V.height||60},V.data),metrics:{width:V.glyphWidth/2||24,height:V.glyphHeight/2||24,left:V.glyphLeft/2+.5||0,top:V.glyphTop/2-27.5||-8,advance:V.glyphAdvance/2||24,isDoubleResolution:!0}}}}q.loadGlyphRange=function(D,h,v,T){return a._(this,void 0,void 0,function*(){const P=256*h,R=P+255,V=T.transformRequest(v.replace("{fontstack}",D).replace("{range}",`${P}-${R}`),"Glyphs"),Y=yield a.n(V,new AbortController);if(!Y||!Y.data)throw new Error(`Could not load glyph range. range: ${h}, ${P}-${R}`);const K={};for(const te of a.o(Y.data))K[te.id]=te;return K})},q.TinySDF=class{constructor({fontSize:D=24,buffer:h=3,radius:v=8,cutoff:T=.25,fontFamily:P="sans-serif",fontWeight:R="normal",fontStyle:V="normal"}={}){this.buffer=h,this.cutoff=T,this.radius=v;const Y=this.size=D+4*h,K=this._createCanvas(Y),te=this.ctx=K.getContext("2d",{willReadFrequently:!0});te.font=`${V} ${R} ${D}px ${P}`,te.textBaseline="alphabetic",te.textAlign="left",te.fillStyle="black",this.gridOuter=new Float64Array(Y*Y),this.gridInner=new Float64Array(Y*Y),this.f=new Float64Array(Y),this.z=new Float64Array(Y+1),this.v=new Uint16Array(Y)}_createCanvas(D){const h=document.createElement("canvas");return h.width=h.height=D,h}draw(D){const{width:h,actualBoundingBoxAscent:v,actualBoundingBoxDescent:T,actualBoundingBoxLeft:P,actualBoundingBoxRight:R}=this.ctx.measureText(D),V=Math.ceil(v),Y=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(R-P))),K=Math.min(this.size-this.buffer,V+Math.ceil(T)),te=Y+2*this.buffer,ie=K+2*this.buffer,ce=Math.max(te*ie,0),ae=new Uint8ClampedArray(ce),fe={data:ae,width:te,height:ie,glyphWidth:Y,glyphHeight:K,glyphTop:V,glyphLeft:0,glyphAdvance:h};if(Y===0||K===0)return fe;const{ctx:_e,buffer:Me,gridInner:Te,gridOuter:Ae}=this;_e.clearRect(Me,Me,Y,K),_e.fillText(D,Me,Me+V);const Pe=_e.getImageData(Me,Me,Y,K);Ae.fill(W,0,ce),Te.fill(0,0,ce);for(let Fe=0;Fe0?Re*Re:0,Te[Ge]=Re<0?Re*Re:0}}J(Ae,0,0,te,ie,te,this.f,this.v,this.z),J(Te,Me,Me,Y,K,te,this.f,this.v,this.z);for(let Fe=0;Fe1&&(K=h[++Y]);const ie=Math.abs(te-K.left),ce=Math.abs(te-K.right),ae=Math.min(ie,ce);let fe;const _e=R/T*(P+1);if(K.isDash){const Me=P-Math.abs(_e);fe=Math.sqrt(ae*ae+Me*Me)}else fe=P-Math.sqrt(ae*ae+_e*_e);this.data[V+te]=Math.max(0,Math.min(255,fe+128))}}}addRegularDash(h){for(let Y=h.length-1;Y>=0;--Y){const K=h[Y],te=h[Y+1];K.zeroLength?h.splice(Y,1):te&&te.isDash===K.isDash&&(te.left=K.left,h.splice(Y,1))}const v=h[0],T=h[h.length-1];v.isDash===T.isDash&&(v.left=T.left-this.width,T.right=v.right+this.width);const P=this.width*this.nextRow;let R=0,V=h[R];for(let Y=0;Y1&&(V=h[++R]);const K=Math.abs(Y-V.left),te=Math.abs(Y-V.right),ie=Math.min(K,te);this.data[P+Y]=Math.max(0,Math.min(255,(V.isDash?ie:-ie)+128))}}addDash(h,v){const T=v?7:0,P=2*T+1;if(this.nextRow+P>this.height)return a.w("LineAtlas out of space"),null;let R=0;for(let Y=0;Y{v.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[oe]}numActive(){return Object.keys(this.active).length}}const xe=Math.floor(p.hardwareConcurrency/2);let Ee,Ie;function Oe(){return Ee||(Ee=new he),Ee}he.workerCount=a.H(globalThis)?Math.max(Math.min(xe,3),1):1;class $e{constructor(h,v){this.workerPool=h,this.actors=[],this.currentActor=0,this.id=v;const T=this.workerPool.acquire(v);for(let P=0;P{v.remove()}),this.actors=[],h&&this.workerPool.release(this.id)}registerMessageHandler(h,v){for(const T of this.actors)T.registerMessageHandler(h,v)}}function Ze(){return Ie||(Ie=new $e(Oe(),a.K),Ie.registerMessageHandler("GR",(D,h,v)=>a.m(h,v))),Ie}function lt(D,h){const v=a.L();return a.M(v,v,[1,1,0]),a.N(v,v,[.5*D.width,.5*D.height,1]),D.calculatePosMatrix?a.O(v,v,D.calculatePosMatrix(h.toUnwrapped())):v}function pt(D,h,v,T,P,R,V){var Y;const K=function(ae,fe,_e){if(ae)for(const Me of ae){const Te=fe[Me];if(Te&&Te.source===_e&&Te.type==="fill-extrusion")return!0}else for(const Me in fe){const Te=fe[Me];if(Te.source===_e&&Te.type==="fill-extrusion")return!0}return!1}((Y=P==null?void 0:P.layers)!==null&&Y!==void 0?Y:null,h,D.id),te=R.maxPitchScaleFactor(),ie=D.tilesIn(T,te,K);ie.sort(yt);const ce=[];for(const ae of ie)ce.push({wrappedTileID:ae.tileID.wrapped().key,queryResults:ae.tile.queryRenderedFeatures(h,v,D._state,ae.queryGeometry,ae.cameraQueryGeometry,ae.scale,P,R,te,lt(D.transform,ae.tileID),V?(fe,_e)=>V(ae.tileID,fe,_e):void 0)});return function(ae,fe){for(const _e in ae)for(const Me of ae[_e])Lt(Me,fe);return ae}(function(ae){const fe={},_e={};for(const Me of ae){const Te=Me.queryResults,Ae=Me.wrappedTileID,Pe=_e[Ae]=_e[Ae]||{};for(const Fe in Te){const De=Te[Fe],je=Pe[Fe]=Pe[Fe]||{},Ge=fe[Fe]=fe[Fe]||[];for(const Re of De)je[Re.featureIndex]||(je[Re.featureIndex]=!0,Ge.push(Re))}}return fe}(ce),D)}function yt(D,h){const v=D.tileID,T=h.tileID;return v.overscaledZ-T.overscaledZ||v.canonical.y-T.canonical.y||v.wrap-T.wrap||v.canonical.x-T.canonical.x}function Lt(D,h){const v=D.feature,T=h.getFeatureState(v.layer["source-layer"],v.id);v.source=v.layer.source,v.layer["source-layer"]&&(v.sourceLayer=v.layer["source-layer"]),v.state=T}function hn(D,h,v){return a._(this,void 0,void 0,function*(){let T=D;if(D.url?T=(yield a.j(h.transformRequest(D.url,"Source"),v)).data:yield p.frameAsync(v),!T)return null;const P=a.Q(a.e(T,D),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in T&&T.vector_layers&&(P.vectorLayerIds=T.vector_layers.map(R=>R.id)),P})}class Ht{constructor(h,v){h&&(v?this.setSouthWest(h).setNorthEast(v):Array.isArray(h)&&(h.length===4?this.setSouthWest([h[0],h[1]]).setNorthEast([h[2],h[3]]):this.setSouthWest(h[0]).setNorthEast(h[1])))}setNorthEast(h){return this._ne=h instanceof a.S?new a.S(h.lng,h.lat):a.S.convert(h),this}setSouthWest(h){return this._sw=h instanceof a.S?new a.S(h.lng,h.lat):a.S.convert(h),this}extend(h){const v=this._sw,T=this._ne;let P,R;if(h instanceof a.S)P=h,R=h;else{if(!(h instanceof Ht))return Array.isArray(h)?h.length===4||h.every(Array.isArray)?this.extend(Ht.convert(h)):this.extend(a.S.convert(h)):h&&("lng"in h||"lon"in h)&&"lat"in h?this.extend(a.S.convert(h)):this;if(P=h._sw,R=h._ne,!P||!R)return this}return v||T?(v.lng=Math.min(P.lng,v.lng),v.lat=Math.min(P.lat,v.lat),T.lng=Math.max(R.lng,T.lng),T.lat=Math.max(R.lat,T.lat)):(this._sw=new a.S(P.lng,P.lat),this._ne=new a.S(R.lng,R.lat)),this}getCenter(){return new a.S((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new a.S(this.getWest(),this.getNorth())}getSouthEast(){return new a.S(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(h){const{lng:v,lat:T}=a.S.convert(h);let P=this._sw.lng<=v&&v<=this._ne.lng;return this._sw.lng>this._ne.lng&&(P=this._sw.lng>=v&&v>=this._ne.lng),this._sw.lat<=T&&T<=this._ne.lat&&P}static convert(h){return h instanceof Ht?h:h&&new Ht(h)}static fromLngLat(h,v=0){const T=360*v/40075017,P=T/Math.cos(Math.PI/180*h.lat);return new Ht(new a.S(h.lng-P,h.lat-T),new a.S(h.lng+P,h.lat+T))}adjustAntiMeridian(){const h=new a.S(this._sw.lng,this._sw.lat),v=new a.S(this._ne.lng,this._ne.lat);return new Ht(h,h.lng>v.lng?new a.S(v.lng+360,v.lat):v)}}class wn{constructor(h,v,T){this.bounds=Ht.convert(this.validateBounds(h)),this.minzoom=v||0,this.maxzoom=T||24}validateBounds(h){return Array.isArray(h)&&h.length===4?[Math.max(-180,h[0]),Math.max(-90,h[1]),Math.min(180,h[2]),Math.min(90,h[3])]:[-180,-90,180,90]}contains(h){const v=Math.pow(2,h.z),T=Math.floor(a.V(this.bounds.getWest())*v),P=Math.floor(a.U(this.bounds.getNorth())*v),R=Math.ceil(a.V(this.bounds.getEast())*v),V=Math.ceil(a.U(this.bounds.getSouth())*v);return h.x>=T&&h.x=P&&h.y{this._options.tiles=h}),this}setUrl(h){return this.setSourceProperty(()=>{this.url=h,this._options.url=h}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return a.e({},this._options)}loadTile(h){return a._(this,void 0,void 0,function*(){const v=h.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),T={request:this.map._requestManager.transformRequest(v,"Tile"),uid:h.uid,tileID:h.tileID,zoom:h.tileID.overscaledZ,tileSize:this.tileSize*h.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};T.request.collectResourceTiming=this._collectResourceTiming;let P="RT";if(h.actor&&h.state!=="expired"){if(h.state==="loading")return new Promise((R,V)=>{h.reloadPromise={resolve:R,reject:V}})}else h.actor=this.dispatcher.getActor(),P="LT";h.abortController=new AbortController;try{const R=yield h.actor.sendAsync({type:P,data:T},h.abortController);if(delete h.abortController,h.aborted)return;this._afterTileLoadWorkerResponse(h,R)}catch(R){if(delete h.abortController,h.aborted)return;if(R&&R.status!==404)throw R;this._afterTileLoadWorkerResponse(h,null)}})}_afterTileLoadWorkerResponse(h,v){if(v&&v.resourceTiming&&(h.resourceTiming=v.resourceTiming),v&&this.map._refreshExpiredTiles&&h.setExpiryData(v),h.loadVectorData(v,this.map.painter),h.reloadPromise){const T=h.reloadPromise;h.reloadPromise=null,this.loadTile(h).then(T.resolve).catch(T.reject)}}abortTile(h){return a._(this,void 0,void 0,function*(){h.abortController&&(h.abortController.abort(),delete h.abortController),h.actor&&(yield h.actor.sendAsync({type:"AT",data:{uid:h.uid,type:this.type,source:this.id}}))})}unloadTile(h){return a._(this,void 0,void 0,function*(){h.unloadVectorData(),h.actor&&(yield h.actor.sendAsync({type:"RMT",data:{uid:h.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Hn extends a.E{constructor(h,v,T,P){super(),this.id=h,this.dispatcher=T,this.setEventedParent(P),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=a.e({type:"raster"},v),a.e(this,a.Q(v,["url","scheme","tileSize"]))}load(){return a._(this,arguments,void 0,function*(h=!1){this._loaded=!1,this.fire(new a.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const v=yield hn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,v&&(a.e(this,v),v.bounds&&(this.tileBounds=new wn(v.bounds,this.minzoom,this.maxzoom)),this.fire(new a.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:h})))}catch(v){this._tileJSONRequest=null,this.fire(new a.k(v))}})}loaded(){return this._loaded}onAdd(h){this.map=h,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(h){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),h(),this.load(!0)}setTiles(h){return this.setSourceProperty(()=>{this._options.tiles=h}),this}setUrl(h){return this.setSourceProperty(()=>{this.url=h,this._options.url=h}),this}serialize(){return a.e({},this._options)}hasTile(h){return!this.tileBounds||this.tileBounds.contains(h.canonical)}loadTile(h){return a._(this,void 0,void 0,function*(){const v=h.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);h.abortController=new AbortController;try{const T=yield E.getImage(this.map._requestManager.transformRequest(v,"Tile"),h.abortController,this.map._refreshExpiredTiles);if(delete h.abortController,h.aborted)return void(h.state="unloaded");if(T&&T.data){this.map._refreshExpiredTiles&&(T.cacheControl||T.expires)&&h.setExpiryData({cacheControl:T.cacheControl,expires:T.expires});const P=this.map.painter.context,R=P.gl,V=T.data;h.texture=this.map.painter.getTileTexture(V.width),h.texture?h.texture.update(V,{useMipmap:!0}):(h.texture=new a.T(P,V,R.RGBA,{useMipmap:!0}),h.texture.bind(R.LINEAR,R.CLAMP_TO_EDGE,R.LINEAR_MIPMAP_NEAREST)),h.state="loaded"}}catch(T){if(delete h.abortController,h.aborted)h.state="unloaded";else if(T)throw h.state="errored",T}})}abortTile(h){return a._(this,void 0,void 0,function*(){h.abortController&&(h.abortController.abort(),delete h.abortController)})}unloadTile(h){return a._(this,void 0,void 0,function*(){h.texture&&this.map.painter.saveTileTexture(h.texture)})}hasTransition(){return!1}}class Bn extends Hn{constructor(h,v,T,P){super(h,v,T,P),this.type="raster-dem",this.maxzoom=22,this._options=a.e({type:"raster-dem"},v),this.encoding=v.encoding||"mapbox",this.redFactor=v.redFactor,this.greenFactor=v.greenFactor,this.blueFactor=v.blueFactor,this.baseShift=v.baseShift}loadTile(h){return a._(this,void 0,void 0,function*(){const v=h.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),T=this.map._requestManager.transformRequest(v,"Tile");h.neighboringTiles=this._getNeighboringTiles(h.tileID),h.abortController=new AbortController;try{const P=yield E.getImage(T,h.abortController,this.map._refreshExpiredTiles);if(delete h.abortController,h.aborted)return void(h.state="unloaded");if(P&&P.data){const R=P.data;this.map._refreshExpiredTiles&&(P.cacheControl||P.expires)&&h.setExpiryData({cacheControl:P.cacheControl,expires:P.expires});const V=a.b(R)&&a.W()?R:yield this.readImageNow(R),Y={type:this.type,uid:h.uid,source:this.id,rawImageData:V,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!h.actor||h.state==="expired"){h.actor=this.dispatcher.getActor();const K=yield h.actor.sendAsync({type:"LDT",data:Y});h.dem=K,h.needsHillshadePrepare=!0,h.needsTerrainPrepare=!0,h.state="loaded"}}}catch(P){if(delete h.abortController,h.aborted)h.state="unloaded";else if(P)throw h.state="errored",P}})}readImageNow(h){return a._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&a.X()){const v=h.width+2,T=h.height+2;try{return new a.R({width:v,height:T},yield a.Y(h,-1,-1,v,T))}catch{}}return p.getImageData(h,1)})}_getNeighboringTiles(h){const v=h.canonical,T=Math.pow(2,v.z),P=(v.x-1+T)%T,R=v.x===0?h.wrap-1:h.wrap,V=(v.x+1+T)%T,Y=v.x+1===T?h.wrap+1:h.wrap,K={};return K[new a.Z(h.overscaledZ,R,v.z,P,v.y).key]={backfilled:!1},K[new a.Z(h.overscaledZ,Y,v.z,V,v.y).key]={backfilled:!1},v.y>0&&(K[new a.Z(h.overscaledZ,R,v.z,P,v.y-1).key]={backfilled:!1},K[new a.Z(h.overscaledZ,h.wrap,v.z,v.x,v.y-1).key]={backfilled:!1},K[new a.Z(h.overscaledZ,Y,v.z,V,v.y-1).key]={backfilled:!1}),v.y+1v.coordinates).flat(1/0):h.coordinates.flat(1/0)}getBounds(){return a._(this,void 0,void 0,function*(){const h=new Ht,v=yield this.getData();let T;switch(v.type){case"FeatureCollection":T=v.features.map(P=>this.getCoordinatesFromGeometry(P.geometry)).flat(1/0);break;case"Feature":T=this.getCoordinatesFromGeometry(v.geometry);break;default:T=this.getCoordinatesFromGeometry(v)}if(T.length==0)return h;for(let P=0;P0&&a.e(R,{resourceTiming:P}),this.fire(new a.l("data",Object.assign(Object.assign({},R),{sourceDataType:"metadata"}))),this.fire(new a.l("data",Object.assign(Object.assign({},R),{sourceDataType:"content"})))}catch(T){if(this._pendingLoads--,this._removed)return void this.fire(new a.l("dataabort",{dataType:"source"}));this.fire(new a.k(T))}})}loaded(){return this._pendingLoads===0}loadTile(h){return a._(this,void 0,void 0,function*(){const v=h.actor?"RT":"LT";h.actor=this.actor;const T={type:this.type,uid:h.uid,tileID:h.tileID,zoom:h.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};h.abortController=new AbortController;const P=yield this.actor.sendAsync({type:v,data:T},h.abortController);delete h.abortController,h.unloadVectorData(),h.aborted||h.loadVectorData(P,this.map.painter,v==="RT")})}abortTile(h){return a._(this,void 0,void 0,function*(){h.abortController&&(h.abortController.abort(),delete h.abortController),h.aborted=!0})}unloadTile(h){return a._(this,void 0,void 0,function*(){h.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:h.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return a.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class qe extends a.E{constructor(h,v,T,P){super(),this.flippedWindingOrder=!1,this.id=h,this.dispatcher=T,this.coordinates=v.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(P),this.options=v}load(h){return a._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new a.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const v=yield E.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,v&&v.data&&(this.image=v.data,h&&(this.coordinates=h),this._finishLoading())}catch(v){this._request=null,this._loaded=!0,this.fire(new a.k(v))}})}loaded(){return this._loaded}updateImage(h){return h.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=h.url,this.load(h.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(h){this.map=h,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(h){this.coordinates=h;const v=h.map(a.a0.fromLngLat);var T;return this.tileID=function(P){const R=a.a1.fromPoints(P),V=R.width(),Y=R.height(),K=Math.max(V,Y),te=Math.max(0,Math.floor(-Math.log(K)/Math.LN2)),ie=Math.pow(2,te);return new a.a3(te,Math.floor((R.minX+R.maxX)/2*ie),Math.floor((R.minY+R.maxY)/2*ie))}(v),this.terrainTileRanges=this._getOverlappingTileRanges(v),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=v.map(P=>this.tileID.getTilePoint(P)._round()),this.flippedWindingOrder=((T=this.tileCoords)[1].x-T[0].x)*(T[2].y-T[0].y)-(T[1].y-T[0].y)*(T[2].x-T[0].x)<0,this.fire(new a.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const h=this.map.painter.context,v=h.gl;this.texture||(this.texture=new a.T(h,this.image,v.RGBA),this.texture.bind(v.LINEAR,v.CLAMP_TO_EDGE));let T=!1;for(const P in this.tiles){const R=this.tiles[P];R.state!=="loaded"&&(R.state="loaded",R.texture=this.texture,T=!0)}T&&this.fire(new a.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(h){return a._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(h.tileID.canonical)?(this.tiles[String(h.tileID.wrap)]=h,h.buckets={}):h.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(h){const{minX:v,minY:T,maxX:P,maxY:R}=a.a1.fromPoints(h),V={};for(let Y=0;Y<=a.a2;Y++){const K=Math.pow(2,Y),te=Math.floor(v*K),ie=Math.floor(T*K),ce=Math.floor(P*K),ae=Math.floor(R*K);V[Y]={minTileX:te,minTileY:ie,maxTileX:ce,maxTileY:ae}}return V}}class Et extends qe{constructor(h,v,T,P){super(h,v,T,P),this.roundZoom=!0,this.type="video",this.options=v}load(){return a._(this,void 0,void 0,function*(){this._loaded=!1;const h=this.options;this.urls=[];for(const v of h.urls)this.urls.push(this.map._requestManager.transformRequest(v,"Source").url);try{const v=yield a.a4(this.urls);if(this._loaded=!0,!v)return;this.video=v,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(v){this.fire(new a.k(v))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(h){if(this.video){const v=this.video.seekable;hv.end(0)?this.fire(new a.k(new a.a5(`sources.${this.id}`,null,`Playback for this video can be set only between the ${v.start(0)} and ${v.end(0)}-second mark.`))):this.video.currentTime=h}}getVideo(){return this.video}onAdd(h){this.map||(this.map=h,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const h=this.map.painter.context,v=h.gl;this.texture?this.video.paused||(this.texture.bind(v.LINEAR,v.CLAMP_TO_EDGE),v.texSubImage2D(v.TEXTURE_2D,0,0,0,v.RGBA,v.UNSIGNED_BYTE,this.video)):(this.texture=new a.T(h,this.video,v.RGBA),this.texture.bind(v.LINEAR,v.CLAMP_TO_EDGE));let T=!1;for(const P in this.tiles){const R=this.tiles[P];R.state!=="loaded"&&(R.state="loaded",R.texture=this.texture,T=!0)}T&&this.fire(new a.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class qt extends qe{constructor(h,v,T,P){super(h,v,T,P),v.coordinates?Array.isArray(v.coordinates)&&v.coordinates.length===4&&!v.coordinates.some(R=>!Array.isArray(R)||R.length!==2||R.some(V=>typeof V!="number"))||this.fire(new a.k(new a.a5(`sources.${h}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.k(new a.a5(`sources.${h}`,null,'missing required property "coordinates"'))),v.animate&&typeof v.animate!="boolean"&&this.fire(new a.k(new a.a5(`sources.${h}`,null,'optional "animate" property must be a boolean value'))),v.canvas?typeof v.canvas=="string"||v.canvas instanceof HTMLCanvasElement||this.fire(new a.k(new a.a5(`sources.${h}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new a.k(new a.a5(`sources.${h}`,null,'missing required property "canvas"'))),this.options=v,this.animate=v.animate===void 0||v.animate}load(){return a._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new a.k(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(h){this.map=h,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let h=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,h=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,h=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const v=this.map.painter.context,T=v.gl;this.texture?(h||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new a.T(v,this.canvas,T.RGBA,{premultiply:!0});let P=!1;for(const R in this.tiles){const V=this.tiles[R];V.state!=="loaded"&&(V.state="loaded",V.texture=this.texture,P=!0)}P&&this.fire(new a.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const h of[this.canvas.width,this.canvas.height])if(isNaN(h)||h<=0)return!0;return!1}}const rn={},it=D=>{switch(D){case"geojson":return Ue;case"image":return qe;case"raster":return Hn;case"raster-dem":return Bn;case"vector":return cn;case"video":return Et;case"canvas":return qt}return rn[D]},St="RTLPluginLoaded";class an extends a.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Ze()}_syncState(h){return this.status=h,this.dispatcher.broadcast("SRPS",{pluginStatus:h,pluginURL:this.url}).catch(v=>{throw this.status="error",v})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(h){return a._(this,arguments,void 0,function*(v,T=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=p.resolveURL(v),!this.url)throw new Error(`requested url ${v} is invalid`);if(this.status==="unavailable"){if(!T)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return a._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new a.l(St))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Ne=null;function nt(){return Ne||(Ne=new an),Ne}class It{constructor(h,v){this.timeAdded=0,this.fadeEndTime=0,this.tileID=h,this.uid=a.a6(),this.uses=0,this.tileSize=v,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(h){const v=h+this.timeAdded;vR.getLayer(te)).filter(Boolean);if(K.length!==0){Y.layers=K,Y.stateDependentLayerIds&&(Y.stateDependentLayers=Y.stateDependentLayerIds.map(te=>K.filter(ie=>ie.id===te)[0]));for(const te of K)V[te.id]=Y}}return V}(h.buckets,v==null?void 0:v.style),this.hasSymbolBuckets=!1;for(const P in this.buckets){const R=this.buckets[P];if(R instanceof a.a8){if(this.hasSymbolBuckets=!0,!T)break;R.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const P in this.buckets){const R=this.buckets[P];if(R instanceof a.a8&&R.hasRTLText){this.hasRTLText=!0,nt().lazyLoad();break}}this.queryPadding=0;for(const P in this.buckets){const R=this.buckets[P];this.queryPadding=Math.max(this.queryPadding,v.style.getLayer(P).queryRadius(R))}h.imageAtlas&&(this.imageAtlas=h.imageAtlas),h.glyphAtlasImage&&(this.glyphAtlasImage=h.glyphAtlasImage)}else this.collisionBoxArray=new a.a7}unloadVectorData(){for(const h in this.buckets)this.buckets[h].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(h){return this.buckets[h.id]}upload(h){for(const T in this.buckets){const P=this.buckets[T];P.uploadPending()&&P.upload(h)}const v=h.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new a.T(h,this.imageAtlas.image,v.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new a.T(h,this.glyphAtlasImage,v.ALPHA),this.glyphAtlasImage=null)}prepare(h){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(h,this.imageAtlasTexture)}queryRenderedFeatures(h,v,T,P,R,V,Y,K,te,ie,ce){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:P,cameraQueryGeometry:R,scale:V,tileSize:this.tileSize,pixelPosMatrix:ie,transform:K,params:Y,queryPadding:this.queryPadding*te,getElevation:ce},h,v,T):{}}querySourceFeatures(h,v){const T=this.latestFeatureIndex;if(!T||!T.rawTileData)return;const P=T.loadVTLayers(),R=v&&v.sourceLayer?v.sourceLayer:"",V=P._geojsonTileLayer||P[R];if(!V)return;const Y=a.a9(v&&v.filter),{z:K,x:te,y:ie}=this.tileID.canonical,ce={z:K,x:te,y:ie};for(let ae=0;aeT)P=!1;else if(v)if(this.expirationTime{this.remove(h,R)},T)),this.data[P].push(R),this.order.push(P),this.order.length>this.max){const V=this._getAndRemoveByKey(this.order[0]);V&&this.onRemove(V)}return this}has(h){return h.wrapped().key in this.data}getAndRemove(h){return this.has(h)?this._getAndRemoveByKey(h.wrapped().key):null}_getAndRemoveByKey(h){const v=this.data[h].shift();return v.timeout&&clearTimeout(v.timeout),this.data[h].length===0&&delete this.data[h],this.order.splice(this.order.indexOf(h),1),v.value}getByKey(h){const v=this.data[h];return v?v[0].value:null}get(h){return this.has(h)?this.data[h.wrapped().key][0].value:null}remove(h,v){if(!this.has(h))return this;const T=h.wrapped().key,P=v===void 0?0:this.data[T].indexOf(v),R=this.data[T][P];return this.data[T].splice(P,1),R.timeout&&clearTimeout(R.timeout),this.data[T].length===0&&delete this.data[T],this.onRemove(R.value),this.order.splice(this.order.indexOf(T),1),this}setMaxSize(h){for(this.max=h;this.order.length>this.max;){const v=this._getAndRemoveByKey(this.order[0]);v&&this.onRemove(v)}return this}filter(h){const v=[];for(const T in this.data)for(const P of this.data[T])h(P.value)||v.push(P);for(const T of v)this.remove(T.value.tileID,T)}}class Fn{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(h,v,T){const P=String(v);if(this.stateChanges[h]=this.stateChanges[h]||{},this.stateChanges[h][P]=this.stateChanges[h][P]||{},a.e(this.stateChanges[h][P],T),this.deletedStates[h]===null){this.deletedStates[h]={};for(const R in this.state[h])R!==P&&(this.deletedStates[h][R]=null)}else if(this.deletedStates[h]&&this.deletedStates[h][P]===null){this.deletedStates[h][P]={};for(const R in this.state[h][P])T[R]||(this.deletedStates[h][P][R]=null)}else for(const R in T)this.deletedStates[h]&&this.deletedStates[h][P]&&this.deletedStates[h][P][R]===null&&delete this.deletedStates[h][P][R]}removeFeatureState(h,v,T){if(this.deletedStates[h]===null)return;const P=String(v);if(this.deletedStates[h]=this.deletedStates[h]||{},T&&v!==void 0)this.deletedStates[h][P]!==null&&(this.deletedStates[h][P]=this.deletedStates[h][P]||{},this.deletedStates[h][P][T]=null);else if(v!==void 0)if(this.stateChanges[h]&&this.stateChanges[h][P])for(T in this.deletedStates[h][P]={},this.stateChanges[h][P])this.deletedStates[h][P][T]=null;else this.deletedStates[h][P]=null;else this.deletedStates[h]=null}getState(h,v){const T=String(v),P=a.e({},(this.state[h]||{})[T],(this.stateChanges[h]||{})[T]);if(this.deletedStates[h]===null)return{};if(this.deletedStates[h]){const R=this.deletedStates[h][v];if(R===null)return{};for(const V in R)delete P[V]}return P}initializeTileState(h,v){h.setFeatureState(this.state,v)}coalesceChanges(h,v){const T={};for(const P in this.stateChanges){this.state[P]=this.state[P]||{};const R={};for(const V in this.stateChanges[P])this.state[P][V]||(this.state[P][V]={}),a.e(this.state[P][V],this.stateChanges[P][V]),R[V]=this.state[P][V];T[P]=R}for(const P in this.deletedStates){this.state[P]=this.state[P]||{};const R={};if(this.deletedStates[P]===null)for(const V in this.state[P])R[V]={},this.state[P][V]={};else for(const V in this.deletedStates[P]){if(this.deletedStates[P][V]===null)this.state[P][V]={};else for(const Y of Object.keys(this.deletedStates[P][V]))delete this.state[P][V][Y];R[V]=this.state[P][V]}T[P]=T[P]||{},a.e(T[P],R)}if(this.stateChanges={},this.deletedStates={},Object.keys(T).length!==0)for(const P in h)h[P].setFeatureState(T,v)}}const lr=89.25;function Ye(D,h){const v=a.ag(h.lat,-85.051129,a.ah);return new a.P(a.V(h.lng)*D,a.U(v)*D)}function ye(D,h){return new a.a0(h.x/D,h.y/D).toLngLat()}function ue(D){return D.cameraToCenterDistance*Math.min(.85*Math.tan(a.ad(90-D.pitch)),Math.tan(a.ad(lr-D.pitch)))}function ve(D,h){const v=D.canonical,T=h/a.ae(v.z),P=v.x+Math.pow(2,v.z)*D.wrap,R=a.af(new Float64Array(16));return a.M(R,R,[P*T,v.y*T,0]),a.N(R,R,[T/a.$,T/a.$,1]),R}function ke(D,h,v,T,P){const R=a.a0.fromLngLat(D,h),V=P*a.ai(1,D.lat),Y=V*Math.cos(a.ad(v)),K=Math.sqrt(V*V-Y*Y),te=K*Math.sin(a.ad(-T)),ie=K*Math.cos(a.ad(-T));return new a.a0(R.x+te,R.y+ie,R.z+Y)}function ze(D,h,v){const T=h.intersectsFrustum(D);if(!v||T===0)return T;const P=h.intersectsPlane(v);return P===0?0:T===2&&P===2?2:1}function He(D,h,v){let T=0;const P=(v-h)/10;for(let R=0;R<10;R++)T+=P*Math.pow(Math.cos(h+(R+.5)/10*(v-h)),D);return T}function tt(D,h){return function(v,T,P,R,V){const Y=2*((D-1)/a.aj(Math.cos(a.ad(lr-V))/Math.cos(a.ad(lr)))-1),K=Math.acos(P/R),te=2*He(Y-1,0,a.ad(V/2)),ie=Math.min(a.ad(lr),K+a.ad(V/2)),ce=He(Y-1,Math.min(ie,K-a.ad(V/2)),ie),ae=Math.atan(T/P),fe=Math.hypot(T,P);let _e=v;return _e+=a.aj(R/fe/Math.max(.5,Math.cos(a.ad(V/2)))),_e+=Y*a.aj(Math.cos(ae))/2,_e-=a.aj(Math.max(1,ce/te/h))/2,_e}}const Ke=tt(9.314,3);function mt(D,h){const v=(h.roundZoom?Math.round:Math.floor)(D.zoom+a.aj(D.tileSize/h.tileSize));return Math.max(0,v)}function dt(D,h){const v=D.getCameraFrustum(),T=D.getClippingPlane(),P=D.screenPointToMercatorCoordinate(D.getCameraPoint()),R=a.a0.fromLngLat(D.center,D.elevation);P.z=R.z+Math.cos(D.pitchInRadians)*D.cameraToCenterDistance/D.worldSize;const V=D.getCoveringTilesDetailsProvider(),Y=V.allowVariableZoom(D,h),K=mt(D,h),te=h.minzoom||0,ie=h.maxzoom!==void 0?h.maxzoom:D.maxZoom,ce=Math.min(Math.max(0,K),ie),ae=Math.pow(2,ce),fe=[ae*P.x,ae*P.y,0],_e=[ae*R.x,ae*R.y,0],Me=Math.hypot(R.x-P.x,R.y-P.y),Te=Math.abs(R.z-P.z),Ae=Math.hypot(Me,Te),Pe=je=>({zoom:0,x:0,y:0,wrap:je,fullyVisible:!1}),Fe=[],De=[];if(D.renderWorldCopies&&V.allowWorldCopies())for(let je=1;je<=3;je++)Fe.push(Pe(-je)),Fe.push(Pe(je));for(Fe.push(Pe(0));Fe.length>0;){const je=Fe.pop(),Ge=je.x,Re=je.y;let Je=je.fullyVisible;const ct={x:Ge,y:Re,z:je.zoom},rt=V.getTileBoundingVolume(ct,je.wrap,D.elevation,h);if(!Je){const Dt=ze(v,rt,T);if(Dt===0)continue;Je=Dt===2}const ot=V.distanceToTile2d(P.x,P.y,ct,rt);let ut=K;Y&&(ut=(h.calculateTileZoom||Ke)(D.zoom+a.aj(D.tileSize/h.tileSize),ot,Te,Ae,D.fov)),ut=(h.roundZoom?Math.round:Math.floor)(ut),ut=Math.max(0,ut);const Rt=Math.min(ut,ie);if(je.wrap=V.getWrap(R,ct,je.wrap),je.zoom>=Rt){if(je.zoom>1),wrap:je.wrap,fullyVisible:Je})}return De.sort((je,Ge)=>je.distanceSq-Ge.distanceSq).map(je=>je.tileID)}const Qe=a.a1.fromPoints([new a.P(0,0),new a.P(a.$,a.$)]);class wt extends a.E{constructor(h,v,T){super(),this.id=h,this.dispatcher=T,this.on("data",P=>this._dataHandler(P)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((P,R,V,Y)=>{const K=new(it(R.type))(P,R,V,Y);if(K.id!==P)throw new Error(`Expected Source id to be ${P} instead of ${K.id}`);return K})(h,v,T,this),this._tiles={},this._cache=new en(0,P=>this._unloadTile(P)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Fn,this._didEmitContent=!1,this._updated=!1}onAdd(h){this.map=h,this._maxTileCacheSize=h?h._maxTileCacheSize:null,this._maxTileCacheZoomLevels=h?h._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(h)}onRemove(h){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(h)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const h in this._tiles){const v=this._tiles[h];if(v.state!=="loaded"&&v.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const h=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,h&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(h,v,T){return a._(this,void 0,void 0,function*(){try{yield this._source.loadTile(h),this._tileLoaded(h,v,T)}catch(P){h.state="errored",P.status!==404?this._source.fire(new a.k(P,{tile:h})):this.update(this.transform,this.terrain)}})}_unloadTile(h){this._source.unloadTile&&this._source.unloadTile(h)}_abortTile(h){this._source.abortTile&&this._source.abortTile(h),this._source.fire(new a.l("dataabort",{tile:h,coord:h.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(h){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const v in this._tiles){const T=this._tiles[v];T.upload(h),T.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(h=>h.tileID).sort(We).map(h=>h.key)}getRenderableIds(h){const v=[];for(const T in this._tiles)this._isIdRenderable(T,h)&&v.push(this._tiles[T]);return h?v.sort((T,P)=>{const R=T.tileID,V=P.tileID,Y=new a.P(R.canonical.x,R.canonical.y)._rotate(-this.transform.bearingInRadians),K=new a.P(V.canonical.x,V.canonical.y)._rotate(-this.transform.bearingInRadians);return R.overscaledZ-V.overscaledZ||K.y-Y.y||K.x-Y.x}).map(T=>T.tileID.key):v.map(T=>T.tileID).sort(We).map(T=>T.key)}hasRenderableParent(h){const v=this.findLoadedParent(h,0);return!!v&&this._isIdRenderable(v.tileID.key)}_isIdRenderable(h,v){return this._tiles[h]&&this._tiles[h].hasData()&&!this._coveredTiles[h]&&(v||!this._tiles[h].holdingForFade())}reload(h){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const v in this._tiles)h?this._reloadTile(v,"expired"):this._tiles[v].state!=="errored"&&this._reloadTile(v,"reloading")}}_reloadTile(h,v){return a._(this,void 0,void 0,function*(){const T=this._tiles[h];T&&(T.state!=="loading"&&(T.state=v),yield this._loadTile(T,h,v))})}_tileLoaded(h,v,T){h.timeAdded=p.now(),T==="expired"&&(h.refreshedUponExpiration=!0),this._setTileReloadTimer(v,h),this.getSource().type==="raster-dem"&&h.dem&&this._backfillDEM(h),this._state.initializeTileState(h,this.map?this.map.painter:null),h.aborted||this._source.fire(new a.l("data",{dataType:"source",tile:h,coord:h.tileID}))}_backfillDEM(h){const v=this.getRenderableIds();for(let P=0;P1||(Math.abs(V)>1&&(Math.abs(V+K)===1?V+=K:Math.abs(V-K)===1&&(V-=K)),R.dem&&P.dem&&(P.dem.backfillBorder(R.dem,V,Y),P.neighboringTiles&&P.neighboringTiles[te]&&(P.neighboringTiles[te].backfilled=!0)))}}getTile(h){return this.getTileByID(h.key)}getTileByID(h){return this._tiles[h]}_retainLoadedChildren(h,v,T,P){for(const R in this._tiles){let V=this._tiles[R];if(P[R]||!V.hasData()||V.tileID.overscaledZ<=v||V.tileID.overscaledZ>T)continue;let Y=V.tileID;for(;V&&V.tileID.overscaledZ>v+1;){const te=V.tileID.scaledTo(V.tileID.overscaledZ-1);V=this._tiles[te.key],V&&V.hasData()&&(Y=te)}let K=Y;for(;K.overscaledZ>v;)if(K=K.scaledTo(K.overscaledZ-1),h[K.key]||h[K.canonical.key]){P[Y.key]=Y;break}}}findLoadedParent(h,v){if(h.key in this._loadedParentTiles){const T=this._loadedParentTiles[h.key];return T&&T.tileID.overscaledZ>=v?T:null}for(let T=h.overscaledZ-1;T>=v;T--){const P=h.scaledTo(T),R=this._getLoadedTile(P);if(R)return R}}findLoadedSibling(h){return this._getLoadedTile(h)}_getLoadedTile(h){const v=this._tiles[h.key];return v&&v.hasData()?v:this._cache.getByKey(h.wrapped().key)}updateCacheSize(h){const v=Math.ceil(h.width/this._source.tileSize)+1,T=Math.ceil(h.height/this._source.tileSize)+1,P=Math.floor(v*T*(this._maxTileCacheZoomLevels===null?a.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),R=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,P):P;this._cache.setMaxSize(R)}handleWrapJump(h){const v=Math.round((h-(this._prevLng===void 0?h:this._prevLng))/360);if(this._prevLng=h,v){const T={};for(const P in this._tiles){const R=this._tiles[P];R.tileID=R.tileID.unwrapTo(R.tileID.wrap+v),T[R.tileID.key]=R}this._tiles=T;for(const P in this._timers)clearTimeout(this._timers[P]),delete this._timers[P];for(const P in this._tiles)this._setTileReloadTimer(P,this._tiles[P])}}_updateCoveredAndRetainedTiles(h,v,T,P,R,V){const Y={},K={},te=Object.keys(h),ie=p.now();for(const ce of te){const ae=h[ce],fe=this._tiles[ce];if(!fe||fe.fadeEndTime!==0&&fe.fadeEndTime<=ie)continue;const _e=this.findLoadedParent(ae,v),Me=this.findLoadedSibling(ae),Te=_e||Me||null;Te&&(this._addTile(Te.tileID),Y[Te.tileID.key]=Te.tileID),K[ce]=ae}this._retainLoadedChildren(K,P,T,h);for(const ce in Y)h[ce]||(this._coveredTiles[ce]=!0,h[ce]=Y[ce]);if(V){const ce={},ae={};for(const fe of R)this._tiles[fe.key].hasData()?ce[fe.key]=fe:ae[fe.key]=fe;for(const fe in ae){const _e=ae[fe].children(this._source.maxzoom);this._tiles[_e[0].key]&&this._tiles[_e[1].key]&&this._tiles[_e[2].key]&&this._tiles[_e[3].key]&&(ce[_e[0].key]=h[_e[0].key]=_e[0],ce[_e[1].key]=h[_e[1].key]=_e[1],ce[_e[2].key]=h[_e[2].key]=_e[2],ce[_e[3].key]=h[_e[3].key]=_e[3],delete ae[fe])}for(const fe in ae){const _e=ae[fe],Me=this.findLoadedParent(_e,this._source.minzoom),Te=this.findLoadedSibling(_e),Ae=Me||Te||null;if(Ae){ce[Ae.tileID.key]=h[Ae.tileID.key]=Ae.tileID;for(const Pe in ce)ce[Pe].isChildOf(Ae.tileID)&&delete ce[Pe]}}for(const fe in this._tiles)ce[fe]||(this._coveredTiles[fe]=!0)}}update(h,v){if(!this._sourceLoaded||this._paused)return;let T;this.transform=h,this.terrain=v,this.updateCacheSize(h),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?T=h.getVisibleUnwrappedCoordinates(this._source.tileID).map(ie=>new a.Z(ie.canonical.z,ie.wrap,ie.canonical.z,ie.canonical.x,ie.canonical.y)):(T=dt(h,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:v,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(T=T.filter(ie=>this._source.hasTile(ie)))):T=[];const P=mt(h,this._source),R=Math.max(P-wt.maxOverzooming,this._source.minzoom),V=Math.max(P+wt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const ie={};for(const ce of T)if(ce.canonical.z>this._source.minzoom){const ae=ce.scaledTo(ce.canonical.z-1);ie[ae.key]=ae;const fe=ce.scaledTo(Math.max(this._source.minzoom,Math.min(ce.canonical.z,5)));ie[fe.key]=fe}T=T.concat(Object.values(ie))}const Y=T.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,Y&&this.fire(new a.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const K=this._updateRetainedTiles(T,P);Vt(this._source.type)&&this._updateCoveredAndRetainedTiles(K,R,V,P,T,v);for(const ie in K)this._tiles[ie].clearFadeHold();const te=a.al(this._tiles,K);for(const ie of te){const ce=this._tiles[ie];ce.hasSymbolBuckets&&!ce.holdingForFade()?ce.setHoldDuration(this.map._fadeDuration):ce.hasSymbolBuckets&&!ce.symbolFadeFinished()||this._removeTile(ie)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const h in this._tiles)this._tiles[h].holdingForFade()&&this._removeTile(h)}_updateRetainedTiles(h,v){var T;const P={},R={},V=Math.max(v-wt.maxOverzooming,this._source.minzoom),Y=Math.max(v+wt.maxUnderzooming,this._source.minzoom),K={};for(const te of h){const ie=this._addTile(te);P[te.key]=te,ie.hasData()||vthis._source.maxzoom){const ae=te.children(this._source.maxzoom)[0],fe=this.getTile(ae);if(fe&&fe.hasData()){P[ae.key]=ae;continue}}else{const ae=te.children(this._source.maxzoom);if(P[ae[0].key]&&P[ae[1].key]&&P[ae[2].key]&&P[ae[3].key])continue}let ce=ie.wasRequested();for(let ae=te.overscaledZ-1;ae>=V;--ae){const fe=te.scaledTo(ae);if(R[fe.key])break;if(R[fe.key]=!0,ie=this.getTile(fe),!ie&&ce&&(ie=this._addTile(fe)),ie){const _e=ie.hasData();if((_e||!(!((T=this.map)===null||T===void 0)&&T.cancelPendingTileRequestsWhileZooming)||ce)&&(P[fe.key]=fe),ce=ie.wasRequested(),_e)break}}}return P}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const h in this._tiles){const v=[];let T,P=this._tiles[h].tileID;for(;P.overscaledZ>0;){if(P.key in this._loadedParentTiles){T=this._loadedParentTiles[P.key];break}v.push(P.key);const R=P.scaledTo(P.overscaledZ-1);if(T=this._getLoadedTile(R),T)break;P=R}for(const R of v)this._loadedParentTiles[R]=T}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const h in this._tiles){const v=this._tiles[h].tileID,T=this._getLoadedTile(v);this._loadedSiblingTiles[v.key]=T}}_addTile(h){let v=this._tiles[h.key];if(v)return v;v=this._cache.getAndRemove(h),v&&(this._setTileReloadTimer(h.key,v),v.tileID=h,this._state.initializeTileState(v,this.map?this.map.painter:null),this._cacheTimers[h.key]&&(clearTimeout(this._cacheTimers[h.key]),delete this._cacheTimers[h.key],this._setTileReloadTimer(h.key,v)));const T=v;return v||(v=new It(h,this._source.tileSize*h.overscaleFactor()),this._loadTile(v,h.key,v.state)),v.uses++,this._tiles[h.key]=v,T||this._source.fire(new a.l("dataloading",{tile:v,coord:v.tileID,dataType:"source"})),v}_setTileReloadTimer(h,v){h in this._timers&&(clearTimeout(this._timers[h]),delete this._timers[h]);const T=v.getExpiryTimeout();T&&(this._timers[h]=setTimeout(()=>{this._reloadTile(h,"expired"),delete this._timers[h]},T))}refreshTiles(h){for(const v in this._tiles)(this._isIdRenderable(v)||this._tiles[v].state=="errored")&&h.some(T=>T.equals(this._tiles[v].tileID.canonical))&&this._reloadTile(v,"expired")}_removeTile(h){const v=this._tiles[h];v&&(v.uses--,delete this._tiles[h],this._timers[h]&&(clearTimeout(this._timers[h]),delete this._timers[h]),v.uses>0||(v.hasData()&&v.state!=="reloading"?this._cache.add(v.tileID,v,v.getExpiryTimeout()):(v.aborted=!0,this._abortTile(v),this._unloadTile(v))))}_dataHandler(h){const v=h.sourceDataType;h.dataType==="source"&&v==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&h.dataType==="source"&&v==="content"&&(this.reload(h.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const h in this._tiles)this._removeTile(h);this._cache.reset()}tilesIn(h,v,T){const P=[],R=this.transform;if(!R)return P;const V=R.getCoveringTilesDetailsProvider().allowWorldCopies(),Y=T?R.getCameraQueryGeometry(h):h,K=fe=>R.screenPointToMercatorCoordinate(fe,this.terrain),te=this.transformBbox(h,K,!V),ie=this.transformBbox(Y,K,!V),ce=this.getIds(),ae=a.a1.fromPoints(ie);for(let fe=0;fePe.getTilePoint(new a.a0(De.x,De.y)));if(Fe.expandBy(Ae),Fe.intersects(Qe)){const De=te.map(Ge=>Pe.getTilePoint(Ge)),je=ie.map(Ge=>Pe.getTilePoint(Ge));P.push({tile:_e,tileID:V?Pe:Pe.unwrapTo(0),queryGeometry:De,cameraQueryGeometry:je,scale:Te})}}}return P}transformBbox(h,v,T){let P=h.map(v);if(T){const R=a.a1.fromPoints(h);R.shrinkBy(.001*Math.min(R.width(),R.height()));const V=R.map(v);a.a1.fromPoints(P).covers(V)||(P=P.map(Y=>Y.x>.5?new a.a0(Y.x-1,Y.y,Y.z):Y))}return P}getVisibleCoordinates(h){const v=this.getRenderableIds(h).map(T=>this._tiles[T].tileID);return this.transform&&this.transform.populateCache(v),v}hasTransition(){if(this._source.hasTransition())return!0;if(Vt(this._source.type)){const h=p.now();for(const v in this._tiles)if(this._tiles[v].fadeEndTime>=h)return!0}return!1}setFeatureState(h,v,T){this._state.updateState(h=h||"_geojsonTileLayer",v,T)}removeFeatureState(h,v,T){this._state.removeFeatureState(h=h||"_geojsonTileLayer",v,T)}getFeatureState(h,v){return this._state.getState(h=h||"_geojsonTileLayer",v)}setDependencies(h,v,T){const P=this._tiles[h];P&&P.setDependencies(v,T)}reloadTilesForDependencies(h,v){for(const T in this._tiles)this._tiles[T].hasDependency(h,v)&&this._reloadTile(T,"reloading");this._cache.filter(T=>!T.hasDependency(h,v))}}function We(D,h){const v=Math.abs(2*D.wrap)-+(D.wrap<0),T=Math.abs(2*h.wrap)-+(h.wrap<0);return D.overscaledZ-h.overscaledZ||T-v||h.canonical.y-D.canonical.y||h.canonical.x-D.canonical.x}function Vt(D){return D==="raster"||D==="image"||D==="video"}wt.maxOverzooming=10,wt.maxUnderzooming=3;class xn{constructor(h,v){this.reset(h,v)}reset(h,v){this.points=h||[],this._distances=[0];for(let T=1;T0?(P-V)/Y:0;return this.points[R].mult(1-K).add(this.points[v].mult(K))}}function jt(D,h){let v=!0;return D==="always"||D!=="never"&&h!=="never"||(v=!1),v}class yn{constructor(h,v,T){const P=this.boxCells=[],R=this.circleCells=[];this.xCellCount=Math.ceil(h/T),this.yCellCount=Math.ceil(v/T);for(let V=0;Vthis.width||P<0||v>this.height)return[];const K=[];if(h<=0&&v<=0&&this.width<=T&&this.height<=P){if(R)return[{key:null,x1:h,y1:v,x2:T,y2:P}];for(let te=0;te0}hitTestCircle(h,v,T,P,R){const V=h-T,Y=h+T,K=v-T,te=v+T;if(Y<0||V>this.width||te<0||K>this.height)return!1;const ie=[];return this._forEachCell(V,K,Y,te,this._queryCellCircle,ie,{hitTest:!0,overlapMode:P,circle:{x:h,y:v,radius:T},seenUids:{box:{},circle:{}}},R),ie.length>0}_queryCell(h,v,T,P,R,V,Y,K){const{seenUids:te,hitTest:ie,overlapMode:ce}=Y,ae=this.boxCells[R];if(ae!==null){const _e=this.bboxes;for(const Me of ae)if(!te.box[Me]){te.box[Me]=!0;const Te=4*Me,Ae=this.boxKeys[Me];if(h<=_e[Te+2]&&v<=_e[Te+3]&&T>=_e[Te+0]&&P>=_e[Te+1]&&(!K||K(Ae))&&(!ie||!jt(ce,Ae.overlapMode))&&(V.push({key:Ae,x1:_e[Te],y1:_e[Te+1],x2:_e[Te+2],y2:_e[Te+3]}),ie))return!0}}const fe=this.circleCells[R];if(fe!==null){const _e=this.circles;for(const Me of fe)if(!te.circle[Me]){te.circle[Me]=!0;const Te=3*Me,Ae=this.circleKeys[Me];if(this._circleAndRectCollide(_e[Te],_e[Te+1],_e[Te+2],h,v,T,P)&&(!K||K(Ae))&&(!ie||!jt(ce,Ae.overlapMode))){const Pe=_e[Te],Fe=_e[Te+1],De=_e[Te+2];if(V.push({key:Ae,x1:Pe-De,y1:Fe-De,x2:Pe+De,y2:Fe+De}),ie)return!0}}}return!1}_queryCellCircle(h,v,T,P,R,V,Y,K){const{circle:te,seenUids:ie,overlapMode:ce}=Y,ae=this.boxCells[R];if(ae!==null){const _e=this.bboxes;for(const Me of ae)if(!ie.box[Me]){ie.box[Me]=!0;const Te=4*Me,Ae=this.boxKeys[Me];if(this._circleAndRectCollide(te.x,te.y,te.radius,_e[Te+0],_e[Te+1],_e[Te+2],_e[Te+3])&&(!K||K(Ae))&&!jt(ce,Ae.overlapMode))return V.push(!0),!0}}const fe=this.circleCells[R];if(fe!==null){const _e=this.circles;for(const Me of fe)if(!ie.circle[Me]){ie.circle[Me]=!0;const Te=3*Me,Ae=this.circleKeys[Me];if(this._circlesCollide(_e[Te],_e[Te+1],_e[Te+2],te.x,te.y,te.radius)&&(!K||K(Ae))&&!jt(ce,Ae.overlapMode))return V.push(!0),!0}}}_forEachCell(h,v,T,P,R,V,Y,K){const te=this._convertToXCellCoord(h),ie=this._convertToYCellCoord(v),ce=this._convertToXCellCoord(T),ae=this._convertToYCellCoord(P);for(let fe=te;fe<=ce;fe++)for(let _e=ie;_e<=ae;_e++)if(R.call(this,h,v,T,P,this.xCellCount*_e+fe,V,Y,K))return}_convertToXCellCoord(h){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(h*this.xScale)))}_convertToYCellCoord(h){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(h*this.yScale)))}_circlesCollide(h,v,T,P,R,V){const Y=P-h,K=R-v,te=T+V;return te*te>Y*Y+K*K}_circleAndRectCollide(h,v,T,P,R,V,Y){const K=(V-P)/2,te=Math.abs(h-(P+K));if(te>K+T)return!1;const ie=(Y-R)/2,ce=Math.abs(v-(R+ie));if(ce>ie+T)return!1;if(te<=K||ce<=ie)return!0;const ae=te-K,fe=ce-ie;return ae*ae+fe*fe<=T*T}}function jn(D,h,v){const T=a.L();if(!D){const{vecSouth:ce,vecEast:ae}=xi(h),fe=c();fe[0]=ae[0],fe[1]=ae[1],fe[2]=ce[0],fe[3]=ce[1],P=fe,(ie=(V=(R=fe)[0])*(te=R[3])-(K=R[2])*(Y=R[1]))&&(P[0]=te*(ie=1/ie),P[1]=-Y*ie,P[2]=-K*ie,P[3]=V*ie),T[0]=fe[0],T[1]=fe[1],T[4]=fe[2],T[5]=fe[3]}var P,R,V,Y,K,te,ie;return a.N(T,T,[1/v,1/v,1]),T}function zi(D,h,v,T){if(D){const P=a.L();if(!h){const{vecSouth:R,vecEast:V}=xi(v);P[0]=V[0],P[1]=V[1],P[4]=R[0],P[5]=R[1]}return a.N(P,P,[T,T,1]),P}return v.pixelsToClipSpaceMatrix}function xi(D){const h=Math.cos(D.rollInRadians),v=Math.sin(D.rollInRadians),T=Math.cos(D.pitchInRadians),P=Math.cos(D.bearingInRadians),R=Math.sin(D.bearingInRadians),V=a.aq();V[0]=-P*T*v-R*h,V[1]=-R*T*v+P*h;const Y=a.ar(V);Y<1e-9?a.as(V):a.at(V,V,1/Y);const K=a.aq();K[0]=P*T*h-R*v,K[1]=R*T*h+P*v;const te=a.ar(K);return te<1e-9?a.as(K):a.at(K,K,1/te),{vecEast:K,vecSouth:V}}function ai(D,h,v,T){let P;T?(P=[D,h,T(D,h),1],a.av(P,P,v)):(P=[D,h,0,1],Wf(P,P,v));const R=P[3];return{point:new a.P(P[0]/R,P[1]/R),signedDistanceFromCamera:R,isOccluded:!1}}function On(D,h){return .5+D/h*.5}function Er(D,h){return D.x>=-h[0]&&D.x<=h[0]&&D.y>=-h[1]&&D.y<=h[1]}function Cs(D,h,v,T,P,R,V,Y,K,te,ie,ce,ae){const fe=v?D.textSizeData:D.iconSizeData,_e=a.am(fe,h.transform.zoom),Me=[256/h.width*2+1,256/h.height*2+1],Te=v?D.text.dynamicLayoutVertexArray:D.icon.dynamicLayoutVertexArray;Te.clear();const Ae=D.lineVertexArray,Pe=v?D.text.placedSymbolArray:D.icon.placedSymbolArray,Fe=h.transform.width/h.transform.height;let De=!1;for(let je=0;jeMath.abs(v.x-h.x)*T?{useVertical:!0}:(D===a.an.vertical?h.yv.x)?{needsFlipping:!0}:null}function oo(D){const{projectionContext:h,pitchedLabelPlaneMatrixInverse:v,symbol:T,fontSize:P,flip:R,keepUpright:V,glyphOffsetArray:Y,dynamicLayoutVertexArray:K,aspectRatio:te,rotateToLine:ie}=D,ce=P/24,ae=T.lineOffsetX*ce,fe=T.lineOffsetY*ce;let _e;if(T.numGlyphs>1){const Me=T.glyphStartIndex+T.numGlyphs,Te=T.lineStartIndex,Ae=T.lineStartIndex+T.lineLength,Pe=Ot(ce,Y,ae,fe,R,T,ie,h);if(!Pe)return{notEnoughRoom:!0};const Fe=nr(Pe.first.point.x,Pe.first.point.y,h,v),De=nr(Pe.last.point.x,Pe.last.point.y,h,v);if(V&&!R){const je=Us(T.writingMode,Fe,De,te);if(je)return je}_e=[Pe.first];for(let je=T.glyphStartIndex+1;je0?Fe.point:Td(h.tileAnchorPoint,Pe,Te,1,h),je=nr(Te.x,Te.y,h,v),Ge=nr(De.x,De.y,h,v),Re=Us(T.writingMode,je,Ge,te);if(Re)return Re}const Me=zu(ce*Y.getoffsetX(T.glyphStartIndex),ae,fe,R,T.segment,T.lineStartIndex,T.lineStartIndex+T.lineLength,h,ie);if(!Me||h.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};_e=[Me]}for(const Me of _e)a.au(K,Me.point,Me.angle);return{}}function Td(D,h,v,T,P){const R=D.add(D.sub(h)._unit()),V=Bt(R.x,R.y,P).point,Y=v.sub(V);return v.add(Y._mult(T/Y.mag()))}function Hf(D,h,v){const T=h.projectionCache;if(T.projections[D])return T.projections[D];const P=new a.P(h.lineVertexArray.getx(D),h.lineVertexArray.gety(D)),R=Bt(P.x,P.y,h);if(R.signedDistanceFromCamera>0)return T.projections[D]=R.point,T.anyProjectionOccluded=T.anyProjectionOccluded||R.isOccluded,R.point;const V=D-v.direction;return Td(v.distanceFromAnchor===0?h.tileAnchorPoint:new a.P(h.lineVertexArray.getx(V),h.lineVertexArray.gety(V)),P,v.previousVertex,v.absOffsetX-v.distanceFromAnchor+1,h)}function Bt(D,h,v){const T=D+v.translation[0],P=h+v.translation[1];let R;return v.pitchWithMap?(R=ai(T,P,v.pitchedLabelPlaneMatrix,v.getElevation),R.isOccluded=!1):(R=v.transform.projectTileCoordinates(T,P,v.unwrappedTileID,v.getElevation),R.point.x=(.5*R.point.x+.5)*v.width,R.point.y=(.5*-R.point.y+.5)*v.height),R}function nr(D,h,v,T){if(v.pitchWithMap){const P=[D,h,0,1];return a.av(P,P,T),v.transform.projectTileCoordinates(P[0]/P[3],P[1]/P[3],v.unwrappedTileID,v.getElevation).point}return{x:D/v.width*2-1,y:h/v.height*2-1}}function rr(D,h,v){return v.transform.projectTileCoordinates(D,h,v.unwrappedTileID,v.getElevation)}function Ol(D,h,v){return D._unit()._perp()._mult(h*v)}function d_(D,h,v,T,P,R,V,Y,K){if(Y.projectionCache.offsets[D])return Y.projectionCache.offsets[D];const te=v.add(h);if(D+K.direction=P)return Y.projectionCache.offsets[D]=te,te;const ie=Hf(D+K.direction,Y,K),ce=Ol(ie.sub(v),V,K.direction),ae=v.add(ce),fe=ie.add(ce);return Y.projectionCache.offsets[D]=a.aw(R,te,ae,fe)||te,Y.projectionCache.offsets[D]}function zu(D,h,v,T,P,R,V,Y,K){const te=T?D-h:D+h;let ie=te>0?1:-1,ce=0;T&&(ie*=-1,ce=Math.PI),ie<0&&(ce+=Math.PI);let ae,fe=ie>0?R+P:R+P+1;Y.projectionCache.cachedAnchorPoint?ae=Y.projectionCache.cachedAnchorPoint:(ae=Bt(Y.tileAnchorPoint.x,Y.tileAnchorPoint.y,Y).point,Y.projectionCache.cachedAnchorPoint=ae);let _e,Me,Te=ae,Ae=ae,Pe=0,Fe=0;const De=Math.abs(te),je=[];let Ge;for(;Pe+Fe<=De;){if(fe+=ie,fe=V)return null;Pe+=Fe,Ae=Te,Me=_e;const ct={absOffsetX:De,direction:ie,distanceFromAnchor:Pe,previousVertex:Ae};if(Te=Hf(fe,Y,ct),v===0)je.push(Ae),Ge=Te.sub(Ae);else{let rt;const ot=Te.sub(Ae);rt=ot.mag()===0?Ol(Hf(fe+ie,Y,ct).sub(Te),v,ie):Ol(ot,v,ie),Me||(Me=Ae.add(rt)),_e=d_(fe,rt,Te,R,V,Me,v,Y,ct),je.push(Me),Ge=_e.sub(Me)}Fe=Ge.mag()}const Re=Ge._mult((De-Pe)/Fe)._add(Me||Ae),Je=ce+Math.atan2(Te.y-Ae.y,Te.x-Ae.x);return je.push(Re),{point:Re,angle:K?Je:0,path:je}}const ir=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ch(D,h){for(let v=0;v=1;tr--)Dt.push(ut.path[tr]);for(let tr=1;trdi.signedDistanceFromCamera<=0)?[]:tr.map(di=>di.point)}let Jt=[];if(Dt.length>0){const tr=Dt[0].clone(),di=Dt[0].clone();for(let co=1;co=ct.x&&di.x<=rt.x&&tr.y>=ct.y&&di.y<=rt.y?[Dt]:di.xrt.x||di.yrt.y?[]:a.ax([Dt],ct.x,ct.y,rt.x,rt.y)}for(const tr of Jt){ot.reset(tr,.25*Je);let di=0;di=ot.length<=.5*Je?1:Math.ceil(ot.paddedLength/kt)+1;for(let co=0;co{const K=ai(Y.x,Y.y,V,R.getElevation),te=R.transform.projectTileCoordinates(K.point.x,K.point.y,R.unwrappedTileID,R.getElevation);return te.point.x=(.5*te.point.x+.5)*R.width,te.point.y=(.5*-te.point.y+.5)*R.height,te})}(h,v);return function(P){let R=0,V=0,Y=0,K=0;for(let te=0;teV&&(V=K,R=Y));return P.slice(R,R+V)}(T)}queryRenderedSymbols(h){if(h.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const v=[],T=new a.a1;for(const ce of h){const ae=new a.P(ce.x+Vo,ce.y+Vo);T.extend(ae),v.push(ae)}const{minX:P,minY:R,maxX:V,maxY:Y}=T,K=this.grid.query(P,R,V,Y).concat(this.ignoredGrid.query(P,R,V,Y)),te={},ie={};for(const ce of K){const ae=ce.key;if(te[ae.bucketInstanceId]===void 0&&(te[ae.bucketInstanceId]={}),te[ae.bucketInstanceId][ae.featureIndex])continue;const fe=[new a.P(ce.x1,ce.y1),new a.P(ce.x2,ce.y1),new a.P(ce.x2,ce.y2),new a.P(ce.x1,ce.y2)];a.ay(v,fe)&&(te[ae.bucketInstanceId][ae.featureIndex]=!0,ie[ae.bucketInstanceId]===void 0&&(ie[ae.bucketInstanceId]=[]),ie[ae.bucketInstanceId].push(ae.featureIndex))}return ie}insertCollisionBox(h,v,T,P,R,V){(T?this.ignoredGrid:this.grid).insert({bucketInstanceId:P,featureIndex:R,collisionGroupID:V,overlapMode:v},h[0],h[1],h[2],h[3])}insertCollisionCircles(h,v,T,P,R,V){const Y=T?this.ignoredGrid:this.grid,K={bucketInstanceId:P,featureIndex:R,collisionGroupID:V,overlapMode:v};for(let te=0;te=this.screenRightBoundary||Pthis.screenBottomBoundary}isInsideGrid(h,v,T,P){return T>=0&&h=0&&vthis.projectAndGetPerspectiveRatio(kt.x,kt.y,P,te,ce));Rt=Dt.some(kt=>!kt.isOccluded),ut=Dt.map(kt=>new a.P(kt.x,kt.y))}else Rt=!0;return{box:a.az(ut),allPointsOccluded:!Rt}}}class wy{constructor(h,v,T,P){this.opacity=h?Math.max(0,Math.min(1,h.opacity+(h.placed?v:-v))):P&&T?1:0,this.placed=T}isHidden(){return this.opacity===0&&!this.placed}}class kh{constructor(h,v,T,P,R){this.text=new wy(h?h.text:null,v,T,R),this.icon=new wy(h?h.icon:null,v,P,R)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class xy{constructor(h,v,T){this.text=h,this.icon=v,this.skipFade=T}}class Dl{constructor(h,v,T,P,R){this.bucketInstanceId=h,this.featureIndex=v,this.sourceLayerIndex=T,this.bucketIndex=P,this.tileID=R}}class so{constructor(h){this.crossSourceCollisions=h,this.maxGroupID=0,this.collisionGroups={}}get(h){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[h]){const v=++this.maxGroupID;this.collisionGroups[h]={ID:v,predicate:T=>T.collisionGroupID===v}}return this.collisionGroups[h]}}function _M(D,h,v,T,P){const{horizontalAlign:R,verticalAlign:V}=a.aG(D);return new a.P(-(R-.5)*h+T[0]*P,-(V-.5)*v+T[1]*P)}class Ey{constructor(h,v,T,P,R){this.transform=h.clone(),this.terrain=v,this.collisionIndex=new by(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=T,this.retainedQueryData={},this.collisionGroups=new so(P),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=R,R&&(R.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(h){const v=this.terrain;return v?(T,P)=>v.getElevation(h,T,P):null}getBucketParts(h,v,T,P){const R=T.getBucket(v),V=T.latestFeatureIndex;if(!R||!V||v.id!==R.layerIds[0])return;const Y=T.collisionBoxArray,K=R.layers[0].layout,te=R.layers[0].paint,ie=Math.pow(2,this.transform.zoom-T.tileID.overscaledZ),ce=T.tileSize/a.$,ae=T.tileID.toUnwrapped(),fe=K.get("text-rotation-alignment")==="map",_e=a.aB(T,1,this.transform.zoom),Me=a.aC(this.collisionIndex.transform,T,te.get("text-translate"),te.get("text-translate-anchor")),Te=a.aC(this.collisionIndex.transform,T,te.get("icon-translate"),te.get("icon-translate-anchor")),Ae=jn(fe,this.transform,_e);this.retainedQueryData[R.bucketInstanceId]=new Dl(R.bucketInstanceId,V,R.sourceLayerIndex,R.index,T.tileID);const Pe={bucket:R,layout:K,translationText:Me,translationIcon:Te,unwrappedTileID:ae,pitchedLabelPlaneMatrix:Ae,scale:ie,textPixelRatio:ce,holdingForFade:T.holdingForFade(),collisionBoxArray:Y,partiallyEvaluatedTextSize:a.am(R.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(R.sourceID)};if(P)for(const Fe of R.sortKeyRanges){const{sortKey:De,symbolInstanceStart:je,symbolInstanceEnd:Ge}=Fe;h.push({sortKey:De,symbolInstanceStart:je,symbolInstanceEnd:Ge,parameters:Pe})}else h.push({symbolInstanceStart:0,symbolInstanceEnd:R.symbolInstances.length,parameters:Pe})}attemptAnchorPlacement(h,v,T,P,R,V,Y,K,te,ie,ce,ae,fe,_e,Me,Te,Ae,Pe,Fe,De){const je=a.aD[h.textAnchor],Ge=[h.textOffset0,h.textOffset1],Re=_M(je,T,P,Ge,R),Je=this.collisionIndex.placeCollisionBox(v,ae,K,te,ie,Y,V,Te,ce.predicate,Fe,Re,De);if((!Pe||this.collisionIndex.placeCollisionBox(Pe,ae,K,te,ie,Y,V,Ae,ce.predicate,Fe,Re,De).placeable)&&Je.placeable){let ct;if(this.prevPlacement&&this.prevPlacement.variableOffsets[fe.crossTileID]&&this.prevPlacement.placements[fe.crossTileID]&&this.prevPlacement.placements[fe.crossTileID].text&&(ct=this.prevPlacement.variableOffsets[fe.crossTileID].anchor),fe.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[fe.crossTileID]={textOffset:Ge,width:T,height:P,anchor:je,textBoxScale:R,prevAnchor:ct},this.markUsedJustification(_e,je,fe,Me),_e.allowVerticalPlacement&&(this.markUsedOrientation(_e,Me,fe),this.placedOrientations[fe.crossTileID]=Me),{shift:Re,placedGlyphBoxes:Je}}}placeLayerBucketPart(h,v,T){const{bucket:P,layout:R,translationText:V,translationIcon:Y,unwrappedTileID:K,pitchedLabelPlaneMatrix:te,textPixelRatio:ie,holdingForFade:ce,collisionBoxArray:ae,partiallyEvaluatedTextSize:fe,collisionGroup:_e}=h.parameters,Me=R.get("text-optional"),Te=R.get("icon-optional"),Ae=a.aE(R,"text-overlap","text-allow-overlap"),Pe=Ae==="always",Fe=a.aE(R,"icon-overlap","icon-allow-overlap"),De=Fe==="always",je=R.get("text-rotation-alignment")==="map",Ge=R.get("text-pitch-alignment")==="map",Re=R.get("icon-text-fit")!=="none",Je=R.get("symbol-z-order")==="viewport-y",ct=Pe&&(De||!P.hasIconData()||Te),rt=De&&(Pe||!P.hasTextData()||Me);!P.collisionArrays&&ae&&P.deserializeCollisionBoxes(ae);const ot=this.retainedQueryData[P.bucketInstanceId].tileID,ut=this._getTerrainElevationFunc(ot),Rt=this.transform.getFastPathSimpleProjectionMatrix(ot),Dt=(kt,Jt,tr)=>{var di,co;if(v[kt.crossTileID])return;if(ce)return void(this.placements[kt.crossTileID]=new xy(!1,!1,!1));let Li=!1,uo=!1,Oi=!0,Pi=null,Di={box:null,placeable:!1,offscreen:null,occluded:!1},Ws={placeable:!1},Xr=null,Ms=null,Gs=null,Dd=0,Rd=0,Bd=0;Jt.textFeatureIndex?Dd=Jt.textFeatureIndex:kt.useRuntimeCollisionCircles&&(Dd=kt.featureIndex),Jt.verticalTextFeatureIndex&&(Rd=Jt.verticalTextFeatureIndex);const Gu=Jt.textBox;if(Gu){const dl=Io=>{let Gi=a.an.horizontal;if(P.allowVerticalPlacement&&!Io&&this.prevPlacement){const Da=this.prevPlacement.placedOrientations[kt.crossTileID];Da&&(this.placedOrientations[kt.crossTileID]=Da,Gi=Da,this.markUsedOrientation(P,Gi,kt))}return Gi},qc=(Io,Gi)=>{if(P.allowVerticalPlacement&&kt.numVerticalGlyphVertices>0&&Jt.verticalTextBox){for(const Da of P.writingModes)if(Da===a.an.vertical?(Di=Gi(),Ws=Di):Di=Io(),Di&&Di.placeable)break}else Di=Io()},Fd=kt.textAnchorOffsetStartIndex,rp=kt.textAnchorOffsetEndIndex;if(rp===Fd){const Io=(Gi,Da)=>{const rs=this.collisionIndex.placeCollisionBox(Gi,Ae,ie,ot,K,Ge,je,V,_e.predicate,ut,void 0,Rt);return rs&&rs.placeable&&(this.markUsedOrientation(P,Da,kt),this.placedOrientations[kt.crossTileID]=Da),rs};qc(()=>Io(Gu,a.an.horizontal),()=>{const Gi=Jt.verticalTextBox;return P.allowVerticalPlacement&&kt.numVerticalGlyphVertices>0&&Gi?Io(Gi,a.an.vertical):{box:null,offscreen:null}}),dl(Di&&Di.placeable)}else{let Io=a.aD[(co=(di=this.prevPlacement)===null||di===void 0?void 0:di.variableOffsets[kt.crossTileID])===null||co===void 0?void 0:co.anchor];const Gi=(rs,dA,r3)=>{const Xx=rs.x2-rs.x1,ev=rs.y2-rs.y1,Vm=kt.textBoxScale,Lh=Re&&Fe==="never"?dA:null;let qs=null,Ph=Ae==="never"?1:2,Kx="never";Io&&Ph++;for(let $d=0;$dGi(Gu,Jt.iconBox,a.an.horizontal),()=>{const rs=Jt.verticalTextBox;return P.allowVerticalPlacement&&(!Di||!Di.placeable)&&kt.numVerticalGlyphVertices>0&&rs?Gi(rs,Jt.verticalIconBox,a.an.vertical):{box:null,occluded:!0,offscreen:null}}),Di&&(Li=Di.placeable,Oi=Di.offscreen);const Da=dl(Di&&Di.placeable);if(!Li&&this.prevPlacement){const rs=this.prevPlacement.variableOffsets[kt.crossTileID];rs&&(this.variableOffsets[kt.crossTileID]=rs,this.markUsedJustification(P,rs.anchor,kt,Da))}}}if(Xr=Di,Li=Xr&&Xr.placeable,Oi=Xr&&Xr.offscreen,kt.useRuntimeCollisionCircles){const dl=P.text.placedSymbolArray.get(kt.centerJustifiedTextSymbolIndex),qc=a.ao(P.textSizeData,fe,dl),Fd=R.get("text-padding");Ms=this.collisionIndex.placeCollisionCircles(Ae,dl,P.lineVertexArray,P.glyphOffsetArray,qc,K,te,T,Ge,_e.predicate,kt.collisionCircleDiameter,Fd,V,ut),Ms.circles.length&&Ms.collisionDetected&&!T&&a.w("Collisions detected, but collision boxes are not shown"),Li=Pe||Ms.circles.length>0&&!Ms.collisionDetected,Oi=Oi&&Ms.offscreen}if(Jt.iconFeatureIndex&&(Bd=Jt.iconFeatureIndex),Jt.iconBox){const dl=qc=>this.collisionIndex.placeCollisionBox(qc,Fe,ie,ot,K,Ge,je,Y,_e.predicate,ut,Re&&Pi?Pi:void 0,Rt);Ws&&Ws.placeable&&Jt.verticalIconBox?(Gs=dl(Jt.verticalIconBox),uo=Gs.placeable):(Gs=dl(Jt.iconBox),uo=Gs.placeable),Oi=Oi&&Gs.offscreen}const Jy=Me||kt.numHorizontalGlyphVertices===0&&kt.numVerticalGlyphVertices===0,Qy=Te||kt.numIconVertices===0;Jy||Qy?Qy?Jy||(uo=uo&&Li):Li=uo&&Li:uo=Li=uo&&Li;const zm=uo&&Gs.placeable;if(Li&&Xr.placeable&&this.collisionIndex.insertCollisionBox(Xr.box,Ae,R.get("text-ignore-placement"),P.bucketInstanceId,Ws&&Ws.placeable&&Rd?Rd:Dd,_e.ID),zm&&this.collisionIndex.insertCollisionBox(Gs.box,Fe,R.get("icon-ignore-placement"),P.bucketInstanceId,Bd,_e.ID),Ms&&Li&&this.collisionIndex.insertCollisionCircles(Ms.circles,Ae,R.get("text-ignore-placement"),P.bucketInstanceId,Dd,_e.ID),T&&this.storeCollisionData(P.bucketInstanceId,tr,Jt,Xr,Gs,Ms),kt.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(P.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[kt.crossTileID]=new xy((Li||ct)&&!(Xr!=null&&Xr.occluded),(uo||rt)&&!(Gs!=null&&Gs.occluded),Oi||P.justReloaded),v[kt.crossTileID]=!0};if(Je){if(h.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const kt=P.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let Jt=kt.length-1;Jt>=0;--Jt){const tr=kt[Jt];Dt(P.symbolInstances.get(tr),P.collisionArrays[tr],tr)}}else for(let kt=h.symbolInstanceStart;kt=0&&(h.text.placedSymbolArray.get(Y).crossTileID=R>=0&&Y!==R?0:T.crossTileID)}markUsedOrientation(h,v,T){const P=v===a.an.horizontal||v===a.an.horizontalOnly?v:0,R=v===a.an.vertical?v:0,V=[T.leftJustifiedTextSymbolIndex,T.centerJustifiedTextSymbolIndex,T.rightJustifiedTextSymbolIndex];for(const Y of V)h.text.placedSymbolArray.get(Y).placedOrientation=P;T.verticalPlacedTextSymbolIndex&&(h.text.placedSymbolArray.get(T.verticalPlacedTextSymbolIndex).placedOrientation=R)}commit(h){this.commitTime=h,this.zoomAtLastRecencyCheck=this.transform.zoom;const v=this.prevPlacement;let T=!1;this.prevZoomAdjustment=v?v.zoomAdjustment(this.transform.zoom):0;const P=v?v.symbolFadeChange(h):1,R=v?v.opacities:{},V=v?v.variableOffsets:{},Y=v?v.placedOrientations:{};for(const K in this.placements){const te=this.placements[K],ie=R[K];ie?(this.opacities[K]=new kh(ie,P,te.text,te.icon),T=T||te.text!==ie.text.placed||te.icon!==ie.icon.placed):(this.opacities[K]=new kh(null,P,te.text,te.icon,te.skipFade),T=T||te.text||te.icon)}for(const K in R){const te=R[K];if(!this.opacities[K]){const ie=new kh(te,P,!1,!1);ie.isHidden()||(this.opacities[K]=ie,T=T||te.text.placed||te.icon.placed)}}for(const K in V)this.variableOffsets[K]||!this.opacities[K]||this.opacities[K].isHidden()||(this.variableOffsets[K]=V[K]);for(const K in Y)this.placedOrientations[K]||!this.opacities[K]||this.opacities[K].isHidden()||(this.placedOrientations[K]=Y[K]);if(v&&v.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");T?this.lastPlacementChangeTime=h:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=v?v.lastPlacementChangeTime:h)}updateLayerOpacities(h,v){const T={};for(const P of v){const R=P.getBucket(h);R&&P.latestFeatureIndex&&h.id===R.layerIds[0]&&this.updateBucketOpacities(R,P.tileID,T,P.collisionBoxArray)}}updateBucketOpacities(h,v,T,P){h.hasTextData()&&(h.text.opacityVertexArray.clear(),h.text.hasVisibleVertices=!1),h.hasIconData()&&(h.icon.opacityVertexArray.clear(),h.icon.hasVisibleVertices=!1),h.hasIconCollisionBoxData()&&h.iconCollisionBox.collisionVertexArray.clear(),h.hasTextCollisionBoxData()&&h.textCollisionBox.collisionVertexArray.clear();const R=h.layers[0],V=R.layout,Y=new kh(null,0,!1,!1,!0),K=V.get("text-allow-overlap"),te=V.get("icon-allow-overlap"),ie=R._unevaluatedLayout.hasValue("text-variable-anchor")||R._unevaluatedLayout.hasValue("text-variable-anchor-offset"),ce=V.get("text-rotation-alignment")==="map",ae=V.get("text-pitch-alignment")==="map",fe=V.get("icon-text-fit")!=="none",_e=new kh(null,0,K&&(te||!h.hasIconData()||V.get("icon-optional")),te&&(K||!h.hasTextData()||V.get("text-optional")),!0);!h.collisionArrays&&P&&(h.hasIconCollisionBoxData()||h.hasTextCollisionBoxData())&&h.deserializeCollisionBoxes(P);const Me=(Ae,Pe,Fe)=>{for(let De=0;De0,Je=this.placedOrientations[Pe.crossTileID],ct=Je===a.an.vertical,rt=Je===a.an.horizontal||Je===a.an.horizontalOnly;if(Fe>0||De>0){const ut=SM(Ge.text);Me(h.text,Fe,ct?Sy:ut),Me(h.text,De,rt?Sy:ut);const Rt=Ge.text.isHidden();[Pe.rightJustifiedTextSymbolIndex,Pe.centerJustifiedTextSymbolIndex,Pe.leftJustifiedTextSymbolIndex].forEach(Jt=>{Jt>=0&&(h.text.placedSymbolArray.get(Jt).hidden=Rt||ct?1:0)}),Pe.verticalPlacedTextSymbolIndex>=0&&(h.text.placedSymbolArray.get(Pe.verticalPlacedTextSymbolIndex).hidden=Rt||rt?1:0);const Dt=this.variableOffsets[Pe.crossTileID];Dt&&this.markUsedJustification(h,Dt.anchor,Pe,Je);const kt=this.placedOrientations[Pe.crossTileID];kt&&(this.markUsedJustification(h,"left",Pe,kt),this.markUsedOrientation(h,kt,Pe))}if(Re){const ut=SM(Ge.icon),Rt=!(fe&&Pe.verticalPlacedIconSymbolIndex&&ct);Pe.placedIconSymbolIndex>=0&&(Me(h.icon,Pe.numIconVertices,Rt?ut:Sy),h.icon.placedSymbolArray.get(Pe.placedIconSymbolIndex).hidden=Ge.icon.isHidden()),Pe.verticalPlacedIconSymbolIndex>=0&&(Me(h.icon,Pe.numVerticalIconVertices,Rt?Sy:ut),h.icon.placedSymbolArray.get(Pe.verticalPlacedIconSymbolIndex).hidden=Ge.icon.isHidden())}const ot=Te&&Te.has(Ae)?Te.get(Ae):{text:null,icon:null};if(h.hasIconCollisionBoxData()||h.hasTextCollisionBoxData()){const ut=h.collisionArrays[Ae];if(ut){let Rt=new a.P(0,0);if(ut.textBox||ut.verticalTextBox){let Dt=!0;if(ie){const kt=this.variableOffsets[je];kt?(Rt=_M(kt.anchor,kt.width,kt.height,kt.textOffset,kt.textBoxScale),ce&&Rt._rotate(ae?-this.transform.bearingInRadians:this.transform.bearingInRadians)):Dt=!1}if(ut.textBox||ut.verticalTextBox){let kt;ut.textBox&&(kt=ct),ut.verticalTextBox&&(kt=rt),f_(h.textCollisionBox.collisionVertexArray,Ge.text.placed,!Dt||kt,ot.text,Rt.x,Rt.y)}}if(ut.iconBox||ut.verticalIconBox){const Dt=!!(!rt&&ut.verticalIconBox);let kt;ut.iconBox&&(kt=Dt),ut.verticalIconBox&&(kt=!Dt),f_(h.iconCollisionBox.collisionVertexArray,Ge.icon.placed,kt,ot.icon,fe?Rt.x:0,fe?Rt.y:0)}}}}if(h.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[h.bucketInstanceId]&&(this.retainedQueryData[h.bucketInstanceId].featureSortOrder=h.featureSortOrder),h.hasTextData()&&h.text.opacityVertexBuffer&&h.text.opacityVertexBuffer.updateData(h.text.opacityVertexArray),h.hasIconData()&&h.icon.opacityVertexBuffer&&h.icon.opacityVertexBuffer.updateData(h.icon.opacityVertexArray),h.hasIconCollisionBoxData()&&h.iconCollisionBox.collisionVertexBuffer&&h.iconCollisionBox.collisionVertexBuffer.updateData(h.iconCollisionBox.collisionVertexArray),h.hasTextCollisionBoxData()&&h.textCollisionBox.collisionVertexBuffer&&h.textCollisionBox.collisionVertexBuffer.updateData(h.textCollisionBox.collisionVertexArray),h.text.opacityVertexArray.length!==h.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${h.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${h.text.layoutVertexArray.length}) / 4`);if(h.icon.opacityVertexArray.length!==h.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${h.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${h.icon.layoutVertexArray.length}) / 4`);h.bucketInstanceId in this.collisionCircleArrays&&(h.collisionCircleArray=this.collisionCircleArrays[h.bucketInstanceId],delete this.collisionCircleArrays[h.bucketInstanceId])}symbolFadeChange(h){return this.fadeDuration===0?1:(h-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(h){return Math.max(0,(this.transform.zoom-h)/1.5)}hasTransitions(h){return this.stale||h-this.lastPlacementChangeTimeh}setStale(){this.stale=!0}}function f_(D,h,v,T,P,R){T&&T.length!==0||(T=[0,0,0,0]);const V=T[0]-Vo,Y=T[1]-Vo,K=T[2]-Vo,te=T[3]-Vo;D.emplaceBack(h?1:0,v?1:0,P||0,R||0,V,Y),D.emplaceBack(h?1:0,v?1:0,P||0,R||0,K,Y),D.emplaceBack(h?1:0,v?1:0,P||0,R||0,K,te),D.emplaceBack(h?1:0,v?1:0,P||0,R||0,V,te)}const Gf=Math.pow(2,25),Md=Math.pow(2,24),bM=Math.pow(2,17),wM=Math.pow(2,16),xM=Math.pow(2,9),pm=Math.pow(2,8),EM=Math.pow(2,1);function SM(D){if(D.opacity===0&&!D.placed)return 0;if(D.opacity===1&&D.placed)return 4294967295;const h=D.placed?1:0,v=Math.floor(127*D.opacity);return v*Gf+h*Md+v*bM+h*wM+v*xM+h*pm+v*EM+h}const Sy=0;class LR{constructor(h){this._sortAcrossTiles=h.layout.get("symbol-z-order")!=="viewport-y"&&!h.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(h,v,T,P,R){const V=this._bucketParts;for(;this._currentTileIndexY.sortKey-K.sortKey));this._currentPartIndex!this._forceFullPlacement&&p.now()-P>2;for(;this._currentPlacementIndex>=0;){const V=v[h[this._currentPlacementIndex]],Y=this.placement.collisionIndex.transform.zoom;if(V.type==="symbol"&&(!V.minzoom||V.minzoom<=Y)&&(!V.maxzoom||V.maxzoom>Y)){if(this._inProgressLayer||(this._inProgressLayer=new LR(V)),this._inProgressLayer.continuePlacement(T[V.source],this.placement,this._showCollisionBoxes,V,R))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(h){return this.placement.commit(h),this.placement}}const mm=512/a.$/2;class ox{constructor(h,v,T){this.tileID=h,this.bucketInstanceId=T,this._symbolsByKey={};const P=new Map;for(let R=0;R({x:Math.floor(K.anchorX*mm),y:Math.floor(K.anchorY*mm)})),crossTileIDs:V.map(K=>K.crossTileID)};if(Y.positions.length>128){const K=new a.aH(Y.positions.length,16,Uint16Array);for(const{x:te,y:ie}of Y.positions)K.add(te,ie);K.finish(),delete Y.positions,Y.index=K}this._symbolsByKey[R]=Y}}getScaledCoordinates(h,v){const{x:T,y:P,z:R}=this.tileID.canonical,{x:V,y:Y,z:K}=v.canonical,te=mm/Math.pow(2,K-R),ie=(Y*a.$+h.anchorY)*te,ce=P*a.$*mm;return{x:Math.floor((V*a.$+h.anchorX)*te-T*a.$*mm),y:Math.floor(ie-ce)}}findMatches(h,v,T){const P=this.tileID.canonical.zh)}}class sx{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class kM{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(h){const v=Math.round((h-this.lng)/360);if(v!==0)for(const T in this.indexes){const P=this.indexes[T],R={};for(const V in P){const Y=P[V];Y.tileID=Y.tileID.unwrapTo(Y.tileID.wrap+v),R[Y.tileID.key]=Y}this.indexes[T]=R}this.lng=h}addBucket(h,v,T){if(this.indexes[h.overscaledZ]&&this.indexes[h.overscaledZ][h.key]){if(this.indexes[h.overscaledZ][h.key].bucketInstanceId===v.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(h.overscaledZ,this.indexes[h.overscaledZ][h.key])}for(let R=0;Rh.overscaledZ)for(const Y in V){const K=V[Y];K.tileID.isChildOf(h)&&K.findMatches(v.symbolInstances,h,P)}else{const Y=V[h.scaledTo(Number(R)).key];Y&&Y.findMatches(v.symbolInstances,h,P)}}for(let R=0;R{v[T]=!0});for(const T in this.layerIndexes)v[T]||delete this.layerIndexes[T]}}var m_="void main() {fragColor=vec4(1.0);}";const Vu={prelude:dr(`#ifdef GL_ES precision mediump float; #else #if !defined(lowp) #define lowp #endif #if !defined(mediump) #define mediump #endif #if !defined(highp) #define highp #endif #endif out highp vec4 fragColor;`,`#ifdef GL_ES precision highp float; #else #if !defined(lowp) #define lowp #endif #if !defined(mediump) #define mediump #endif #if !defined(highp) #define highp #endif #endif vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 );}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c );} #ifdef TERRAIN3D uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth; #endif const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) { #ifdef TERRAIN3D highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0)); #else return 1.0; #endif }float calculate_visibility(vec4 pos) { #ifdef TERRAIN3D vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0; #else return 1.0; #endif }float ele(vec2 pos) { #ifdef TERRAIN3D vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; #else return 0.0; #endif }float get_elevation(vec2 pos) { #ifdef TERRAIN3D #ifdef GLOBE if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;} #endif vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration; #else return 0.0; #endif }const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:dr("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:dr("",`#define GLOBE_RADIUS 6371008.8 uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos );}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len );if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:dr(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity; #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:dr(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity; #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,"uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:dr(`in vec3 v_data;in float v_visibility; #pragma mapbox: define highp vec4 color #pragma mapbox: define mediump float radius #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define highp vec4 stroke_color #pragma mapbox: define mediump float stroke_width #pragma mapbox: define lowp float stroke_opacity void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize mediump float radius #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize highp vec4 stroke_color #pragma mapbox: initialize mediump float stroke_width #pragma mapbox: initialize lowp float stroke_opacity vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;} #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility; #pragma mapbox: define highp vec4 color #pragma mapbox: define mediump float radius #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define highp vec4 stroke_color #pragma mapbox: define mediump float stroke_width #pragma mapbox: define lowp float stroke_opacity void main(void) { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize mediump float radius #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize highp vec4 stroke_color #pragma mapbox: initialize mediump float stroke_width #pragma mapbox: initialize lowp float stroke_opacity vec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) { #ifdef GLOBE vec3 center_vector=projectToSphere(circle_center); #endif float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else { #ifdef GLOBE vec4 projected_center=interpolateProjection(circle_center,center_vector,ele); #else vec4 projected_center=projectTileWithElevation(circle_center,ele); #endif corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);} #ifdef GLOBE vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele); #else gl_Position=projectTileWithElevation(corner_position,ele); #endif } else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:dr(m_,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:dr(`uniform highp float u_intensity;in vec2 v_extrude; #pragma mapbox: define highp float weight #define GAUSS_COEF 0.3989422804014327 void main() { #pragma mapbox: initialize highp float weight float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0); #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude; #pragma mapbox: define highp float weight #pragma mapbox: define mediump float radius const highp float ZERO=1.0/255.0/16.0; #define GAUSS_COEF 0.3989422804014327 void main(void) { #pragma mapbox: initialize highp float weight #pragma mapbox: initialize mediump float radius vec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0); #ifdef GLOBE vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0); #else gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center)); #endif }`),heatmapTexture:dr(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity; #ifdef OVERDRAW_INSPECTOR fragColor=vec4(0.0); #endif }`,"uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:dr("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:dr("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:dr(`#ifdef GL_ES precision highp float; #endif uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(textureSize(u_elevation_stops,0)[0]);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int num_elevation_stops=textureSize(u_elevation_stops,0)[0];int r=(num_elevation_stops-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else {l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(textureSize(u_color_stops,0)[0]);fragColor=u_opacity*texture(u_color_stops,vec2(x,0)); #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,"uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:dr("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:dr(m_,`in vec2 a_pos;void main() { #ifdef GLOBE gl_Position=projectTileFor3D(a_pos,0.0); #else gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0); #endif }`),fill:dr(`#pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float opacity fragColor=color*opacity; #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,`uniform vec2 u_fill_translate;in vec2 a_pos; #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float opacity gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:dr(`in vec2 v_pos; #ifdef GLOBE in float v_depth; #endif #pragma mapbox: define highp vec4 outline_color #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize highp vec4 outline_color #pragma mapbox: initialize lowp float opacity float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity); #ifdef GLOBE if (v_depth > 1.0) {discard;} #endif #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos; #ifdef GLOBE out float v_depth; #endif #pragma mapbox: define highp vec4 outline_color #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize highp vec4 outline_color #pragma mapbox: initialize lowp float opacity gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; #ifdef GLOBE v_depth=gl_Position.z/gl_Position.w; #endif }`),fillOutlinePattern:dr(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos; #ifdef GLOBE in float v_depth; #endif #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern_from #pragma mapbox: define lowp vec4 pattern_to void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern_from #pragma mapbox: initialize mediump vec4 pattern_to vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity; #ifdef GLOBE if (v_depth > 1.0) {discard;} #endif #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,`uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos; #ifdef GLOBE out float v_depth; #endif #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern_from #pragma mapbox: define lowp vec4 pattern_to #pragma mapbox: define lowp float pixel_ratio_from #pragma mapbox: define lowp float pixel_ratio_to void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern_from #pragma mapbox: initialize mediump vec4 pattern_to #pragma mapbox: initialize lowp float pixel_ratio_from #pragma mapbox: initialize lowp float pixel_ratio_to vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; #ifdef GLOBE v_depth=gl_Position.z/gl_Position.w; #endif }`),fillPattern:dr(`#ifdef GL_ES precision highp float; #endif uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b; #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern_from #pragma mapbox: define lowp vec4 pattern_to void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern_from #pragma mapbox: initialize mediump vec4 pattern_to vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity; #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b; #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern_from #pragma mapbox: define lowp vec4 pattern_to #pragma mapbox: define lowp float pixel_ratio_from #pragma mapbox: define lowp float pixel_ratio_to void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern_from #pragma mapbox: initialize mediump vec4 pattern_to #pragma mapbox: initialize lowp float pixel_ratio_from #pragma mapbox: initialize lowp float pixel_ratio_to vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:dr(`in vec4 v_color;void main() {fragColor=v_color; #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed; #ifdef TERRAIN3D in vec2 a_centroid; #endif out vec4 v_color; #pragma mapbox: define highp float base #pragma mapbox: define highp float height #pragma mapbox: define highp vec4 color void main() { #pragma mapbox: initialize highp float base #pragma mapbox: initialize highp float height #pragma mapbox: initialize highp vec4 color vec3 normal=a_normal_ed.xyz; #ifdef TERRAIN3D float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); #else float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; #endif base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate; #ifdef GLOBE vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation); #else gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0); #endif float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0); #ifdef GLOBE mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition); #endif directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:dr(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting; #pragma mapbox: define lowp float base #pragma mapbox: define lowp float height #pragma mapbox: define lowp vec4 pattern_from #pragma mapbox: define lowp vec4 pattern_to #pragma mapbox: define lowp float pixel_ratio_from #pragma mapbox: define lowp float pixel_ratio_to void main() { #pragma mapbox: initialize lowp float base #pragma mapbox: initialize lowp float height #pragma mapbox: initialize mediump vec4 pattern_from #pragma mapbox: initialize mediump vec4 pattern_to #pragma mapbox: initialize lowp float pixel_ratio_from #pragma mapbox: initialize lowp float pixel_ratio_to vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting; #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed; #ifdef TERRAIN3D in vec2 a_centroid; #endif #ifdef GLOBE out vec3 v_sphere_pos; #endif out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting; #pragma mapbox: define lowp float base #pragma mapbox: define lowp float height #pragma mapbox: define lowp vec4 pattern_from #pragma mapbox: define lowp vec4 pattern_to #pragma mapbox: define lowp float pixel_ratio_from #pragma mapbox: define lowp float pixel_ratio_to void main() { #pragma mapbox: initialize lowp float base #pragma mapbox: initialize lowp float height #pragma mapbox: initialize mediump vec4 pattern_from #pragma mapbox: initialize mediump vec4 pattern_to #pragma mapbox: initialize lowp float pixel_ratio_from #pragma mapbox: initialize lowp float pixel_ratio_to vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to; #ifdef TERRAIN3D float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); #else float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; #endif base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate; #ifdef GLOBE vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation); #else gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0); #endif vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 ? a_pos : vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:dr(`#ifdef GL_ES precision highp float; #endif uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0); #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:dr(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES]; #define PI 3.141592653589793 #define STANDARD 0 #define COMBINED 1 #define IGOR 2 #define MULTIDIRECTIONAL 3 #define BASIC 4 float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else {fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else {fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;switch(u_method){case BASIC: basic_hillshade(deriv);break;case COMBINED: combined_hillshade(deriv);break;case IGOR: igor_hillshade(deriv);break;case MULTIDIRECTIONAL: multidirectional_hillshade(deriv);break;case STANDARD: default: standard_hillshade(deriv);break;} #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,"uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:dr(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale; #ifdef GLOBE in float v_depth; #endif #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity); #ifdef GLOBE if (v_depth > 1.0) {discard;} #endif #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,` #define scale 0.015873016 in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar; #ifdef GLOBE out float v_depth; #endif #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define mediump float gapwidth #pragma mapbox: define lowp float offset #pragma mapbox: define mediump float width void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump float gapwidth #pragma mapbox: initialize lowp float offset #pragma mapbox: initialize mediump float width float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; #ifdef GLOBE v_depth=gl_Position.z/gl_Position.w; #endif #ifdef TERRAIN3D v_gamma_scale=1.0; #else float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; #endif v_width2=vec2(outset,inset);}`),lineGradient:dr(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv; #ifdef GLOBE in float v_depth; #endif #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity); #ifdef GLOBE if (v_depth > 1.0) {discard;} #endif #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,` #define scale 0.015873016 in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv; #ifdef GLOBE out float v_depth; #endif #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define mediump float gapwidth #pragma mapbox: define lowp float offset #pragma mapbox: define mediump float width void main() { #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump float gapwidth #pragma mapbox: initialize lowp float offset #pragma mapbox: initialize mediump float width float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; #ifdef GLOBE v_depth=gl_Position.z/gl_Position.w; #endif #ifdef TERRAIN3D v_gamma_scale=1.0; #else float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; #endif v_width2=vec2(outset,inset);}`),linePattern:dr(`#ifdef GL_ES precision highp float; #endif uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width; #ifdef GLOBE in float v_depth; #endif #pragma mapbox: define lowp vec4 pattern_from #pragma mapbox: define lowp vec4 pattern_to #pragma mapbox: define lowp float pixel_ratio_from #pragma mapbox: define lowp float pixel_ratio_to #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize mediump vec4 pattern_from #pragma mapbox: initialize mediump vec4 pattern_to #pragma mapbox: initialize lowp float pixel_ratio_from #pragma mapbox: initialize lowp float pixel_ratio_to #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity; #ifdef GLOBE if (v_depth > 1.0) {discard;} #endif #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,` #define scale 0.015873016 #define LINE_DISTANCE_SCALE 2.0 in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width; #ifdef GLOBE out float v_depth; #endif #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp float offset #pragma mapbox: define mediump float gapwidth #pragma mapbox: define mediump float width #pragma mapbox: define lowp float floorwidth #pragma mapbox: define lowp vec4 pattern_from #pragma mapbox: define lowp vec4 pattern_to #pragma mapbox: define lowp float pixel_ratio_from #pragma mapbox: define lowp float pixel_ratio_to void main() { #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize lowp float offset #pragma mapbox: initialize mediump float gapwidth #pragma mapbox: initialize mediump float width #pragma mapbox: initialize lowp float floorwidth #pragma mapbox: initialize mediump vec4 pattern_from #pragma mapbox: initialize mediump vec4 pattern_to #pragma mapbox: initialize lowp float pixel_ratio_from #pragma mapbox: initialize lowp float pixel_ratio_to float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; #ifdef GLOBE v_depth=gl_Position.z/gl_Position.w; #endif #ifdef TERRAIN3D v_gamma_scale=1.0; #else float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; #endif v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:dr(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale; #ifdef GLOBE in float v_depth; #endif #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define mediump float width #pragma mapbox: define lowp float floorwidth void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump float width #pragma mapbox: initialize lowp float floorwidth float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity); #ifdef GLOBE if (v_depth > 1.0) {discard;} #endif #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,` #define scale 0.015873016 #define LINE_DISTANCE_SCALE 2.0 in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale; #ifdef GLOBE out float v_depth; #endif #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define mediump float gapwidth #pragma mapbox: define lowp float offset #pragma mapbox: define mediump float width #pragma mapbox: define lowp float floorwidth void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump float gapwidth #pragma mapbox: initialize lowp float offset #pragma mapbox: initialize mediump float width #pragma mapbox: initialize lowp float floorwidth float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; #ifdef GLOBE v_depth=gl_Position.z/gl_Position.w; #endif #ifdef TERRAIN3D v_gamma_scale=1.0; #else float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; #endif v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:dr(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a); #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5; #ifdef GLOBE if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;} #endif v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:dr(`uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity; #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize lowp float opacity lowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha; #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_fade_opacity; #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize lowp float opacity vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? camera_to_anchor_distance/u_camera_to_center_distance : u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0; #ifdef GLOBE if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} #endif vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:dr(`#define SDF_PX 8.0 uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1; #pragma mapbox: define highp vec4 fill_color #pragma mapbox: define highp vec4 halo_color #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp float halo_width #pragma mapbox: define lowp float halo_blur void main() { #pragma mapbox: initialize highp vec4 fill_color #pragma mapbox: initialize highp vec4 halo_color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize lowp float halo_width #pragma mapbox: initialize lowp float halo_blur float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity); #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1; #pragma mapbox: define highp vec4 fill_color #pragma mapbox: define highp vec4 halo_color #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp float halo_width #pragma mapbox: define lowp float halo_blur void main() { #pragma mapbox: initialize highp vec4 fill_color #pragma mapbox: initialize highp vec4 halo_color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize lowp float halo_width #pragma mapbox: initialize lowp float halo_blur vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? camera_to_anchor_distance/u_camera_to_center_distance : u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0; #ifdef GLOBE if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} #endif vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:dr(`#define SDF_PX 8.0 #define SDF 1.0 #define ICON 0.0 uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1; #pragma mapbox: define highp vec4 fill_color #pragma mapbox: define highp vec4 halo_color #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp float halo_width #pragma mapbox: define lowp float halo_blur void main() { #pragma mapbox: initialize highp vec4 fill_color #pragma mapbox: initialize highp vec4 halo_color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize lowp float halo_width #pragma mapbox: initialize lowp float halo_blur float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha; #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity); #ifdef OVERDRAW_INSPECTOR fragColor=vec4(1.0); #endif }`,`in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1; #pragma mapbox: define highp vec4 fill_color #pragma mapbox: define highp vec4 halo_color #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp float halo_width #pragma mapbox: define lowp float halo_blur void main() { #pragma mapbox: initialize highp vec4 fill_color #pragma mapbox: initialize highp vec4 halo_color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize lowp float halo_width #pragma mapbox: initialize lowp float halo_blur vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? camera_to_anchor_distance/u_camera_to_center_distance : u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0; #ifdef GLOBE if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} #endif vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:dr("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:dr("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:dr("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:dr("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:dr(`in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758 );color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:dr("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function dr(D,h){const v=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,T=h.match(/in ([\w]+) ([\w]+)/g),P=D.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),R=h.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),V=R?R.concat(P):P,Y={};return{fragmentSource:D=D.replace(v,(K,te,ie,ce,ae)=>(Y[ae]=!0,te==="define"?` #ifndef HAS_UNIFORM_u_${ae} in ${ie} ${ce} ${ae}; #else uniform ${ie} ${ce} u_${ae}; #endif `:` #ifdef HAS_UNIFORM_u_${ae} ${ie} ${ce} ${ae} = u_${ae}; #endif `)),vertexSource:h=h.replace(v,(K,te,ie,ce,ae)=>{const fe=ce==="float"?"vec2":"vec4",_e=ae.match(/color/)?"color":fe;return Y[ae]?te==="define"?` #ifndef HAS_UNIFORM_u_${ae} uniform lowp float u_${ae}_t; in ${ie} ${fe} a_${ae}; out ${ie} ${ce} ${ae}; #else uniform ${ie} ${ce} u_${ae}; #endif `:_e==="vec4"?` #ifndef HAS_UNIFORM_u_${ae} ${ae} = a_${ae}; #else ${ie} ${ce} ${ae} = u_${ae}; #endif `:` #ifndef HAS_UNIFORM_u_${ae} ${ae} = unpack_mix_${_e}(a_${ae}, u_${ae}_t); #else ${ie} ${ce} ${ae} = u_${ae}; #endif `:te==="define"?` #ifndef HAS_UNIFORM_u_${ae} uniform lowp float u_${ae}_t; in ${ie} ${fe} a_${ae}; #else uniform ${ie} ${ce} u_${ae}; #endif `:_e==="vec4"?` #ifndef HAS_UNIFORM_u_${ae} ${ie} ${ce} ${ae} = a_${ae}; #else ${ie} ${ce} ${ae} = u_${ae}; #endif `:` #ifndef HAS_UNIFORM_u_${ae} ${ie} ${ce} ${ae} = unpack_mix_${_e}(a_${ae}, u_${ae}_t); #else ${ie} ${ce} ${ae} = u_${ae}; #endif `}),staticAttributes:T,staticUniforms:V}}class Th{constructor(h,v,T){this.vertexBuffer=h,this.indexBuffer=v,this.segments=T}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var Mh=a.aI([{name:"a_pos",type:"Int16",components:2}]);const qf="#define PROJECTION_MERCATOR",ax="mercator";class lx{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return ax}get shaderDefine(){return qf}get shaderPreludeCode(){return Vu.projectionMercator}get vertexShaderPreludeCode(){return Vu.projectionMercator.vertexSource}get subdivisionGranularity(){return a.aJ.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(h){}getMeshFromTileID(h,v,T,P,R){if(this._cachedMesh)return this._cachedMesh;const V=new a.aK;V.emplaceBack(0,0),V.emplaceBack(a.$,0),V.emplaceBack(0,a.$),V.emplaceBack(a.$,a.$);const Y=h.createVertexBuffer(V,Mh.members),K=a.aL.simpleSegment(0,0,4,2),te=new a.aM;te.emplaceBack(1,0,2),te.emplaceBack(1,2,3);const ie=h.createIndexBuffer(te);return this._cachedMesh=new Th(Y,ie,K),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(h){}}class pc{constructor(h=0,v=0,T=0,P=0){if(isNaN(h)||h<0||isNaN(v)||v<0||isNaN(T)||T<0||isNaN(P)||P<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=h,this.bottom=v,this.left=T,this.right=P}interpolate(h,v,T){return v.top!=null&&h.top!=null&&(this.top=a.C.number(h.top,v.top,T)),v.bottom!=null&&h.bottom!=null&&(this.bottom=a.C.number(h.bottom,v.bottom,T)),v.left!=null&&h.left!=null&&(this.left=a.C.number(h.left,v.left,T)),v.right!=null&&h.right!=null&&(this.right=a.C.number(h.right,v.right,T)),this}getCenter(h,v){const T=a.ag((this.left+h-this.right)/2,0,h),P=a.ag((this.top+v-this.bottom)/2,0,v);return new a.P(T,P)}equals(h){return this.top===h.top&&this.bottom===h.bottom&&this.left===h.left&&this.right===h.right}clone(){return new pc(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Ah(D,h){if(!D.renderWorldCopies||D.lngRange)return;const v=h.lng-D.center.lng;h.lng+=v>180?-360:v<-180?360:0}function fr(D){return Math.max(0,Math.floor(D))}class Cy{constructor(h,v,T,P,R,V){this._callbacks=h,this._tileSize=512,this._renderWorldCopies=V===void 0||!!V,this._minZoom=v||0,this._maxZoom=T||22,this._minPitch=P??0,this._maxPitch=R??60,this.setMaxBounds(),this._width=0,this._height=0,this._center=new a.S(0,0),this._elevation=0,this._zoom=0,this._tileZoom=fr(this._zoom),this._scale=a.ae(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new pc,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(h,v,T){this._latRange=h.latRange,this._lngRange=h.lngRange,this._width=h.width,this._height=h.height,this._center=h.center,this._elevation=h.elevation,this._minElevationForCurrentTile=h.minElevationForCurrentTile,this._zoom=h.zoom,this._tileZoom=fr(this._zoom),this._scale=a.ae(this._zoom),this._bearingInRadians=h.bearingInRadians,this._fovInRadians=h.fovInRadians,this._pitchInRadians=h.pitchInRadians,this._rollInRadians=h.rollInRadians,this._unmodified=h.unmodified,this._edgeInsets=new pc(h.padding.top,h.padding.bottom,h.padding.left,h.padding.right),this._minZoom=h.minZoom,this._maxZoom=h.maxZoom,this._minPitch=h.minPitch,this._maxPitch=h.maxPitch,this._renderWorldCopies=h.renderWorldCopies,this._cameraToCenterDistance=h.cameraToCenterDistance,this._nearZ=h.nearZ,this._farZ=h.farZ,this._autoCalculateNearFarZ=!T&&h.autoCalculateNearFarZ,v&&this._constrain(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(h){this._minElevationForCurrentTile=h}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(h){this._minZoom!==h&&(this._minZoom=h,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(h){this._maxZoom!==h&&(this._maxZoom=h,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(h){this._minPitch!==h&&(this._minPitch=h,this.setPitch(Math.max(this.pitch,h)))}get maxPitch(){return this._maxPitch}setMaxPitch(h){this._maxPitch!==h&&(this._maxPitch=h,this.setPitch(Math.min(this.pitch,h)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(h){h===void 0?h=!0:h===null&&(h=!1),this._renderWorldCopies=h}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(h){const v=a.aN(h,-180,180)*Math.PI/180;var T,P,R,V,Y,K,te,ie,ce;this._bearingInRadians!==v&&(this._unmodified=!1,this._bearingInRadians=v,this._calcMatrices(),this._rotationMatrix=c(),T=this._rotationMatrix,R=-this._bearingInRadians,V=(P=this._rotationMatrix)[0],Y=P[1],K=P[2],te=P[3],ie=Math.sin(R),ce=Math.cos(R),T[0]=V*ce+K*ie,T[1]=Y*ce+te*ie,T[2]=V*-ie+K*ce,T[3]=Y*-ie+te*ce)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(h){const v=a.ag(h,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==v&&(this._unmodified=!1,this._pitchInRadians=v,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(h){const v=h/180*Math.PI;this._rollInRadians!==v&&(this._unmodified=!1,this._rollInRadians=v,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return a.aO(this._fovInRadians)}setFov(h){h=a.ag(h,.1,150),this.fov!==h&&(this._unmodified=!1,this._fovInRadians=a.ad(h),this._calcMatrices())}get zoom(){return this._zoom}setZoom(h){const v=this.getConstrained(this._center,h).zoom;this._zoom!==v&&(this._unmodified=!1,this._zoom=v,this._tileZoom=Math.max(0,Math.floor(v)),this._scale=a.ae(v),this._constrain(),this._calcMatrices())}get center(){return this._center}setCenter(h){h.lat===this._center.lat&&h.lng===this._center.lng||(this._unmodified=!1,this._center=h,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(h){h!==this._elevation&&(this._elevation=h,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(h){this._edgeInsets.equals(h)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,h,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(h,v){this._autoCalculateNearFarZ=!1,this._nearZ=h,this._farZ=v,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(h){return this._edgeInsets.equals(h)}interpolatePadding(h,v,T){this._unmodified=!1,this._edgeInsets.interpolate(h,v,T),this._constrain(),this._calcMatrices()}resize(h,v,T=!0){this._width=h,this._height=v,T&&this._constrain(),this._calcMatrices()}getMaxBounds(){return this._latRange&&this._latRange.length===2&&this._lngRange&&this._lngRange.length===2?new Ht([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(h){h?(this._lngRange=[h.getWest(),h.getEast()],this._latRange=[h.getSouth(),h.getNorth()],this._constrain()):(this._lngRange=null,this._latRange=[-85.051129,a.ah])}getConstrained(h,v){return this._callbacks.getConstrained(h,v)}getCameraQueryGeometry(h,v){if(v.length===1)return[v[0],h];{const{minX:T,minY:P,maxX:R,maxY:V}=a.a1.fromPoints(v).extend(h);return[new a.P(T,P),new a.P(R,P),new a.P(R,V),new a.P(T,V),new a.P(T,P)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const h=this._unmodified,{center:v,zoom:T}=this.getConstrained(this.center,this.zoom);this.setCenter(v),this.setZoom(T),this._unmodified=h,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let h=a.af(new Float64Array(16));a.N(h,h,[this._width/2,-this._height/2,1]),a.M(h,h,[1,-1,0]),this._clipSpaceToPixelsMatrix=h,h=a.af(new Float64Array(16)),a.N(h,h,[1,-1,1]),a.M(h,h,[-1,-1,0]),a.N(h,h,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=h,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(h,v,T,P){const R=T!==void 0?T:this.bearing,V=P=P!==void 0?P:this.pitch,Y=a.a0.fromLngLat(h,v),K=-Math.cos(a.ad(V)),te=Math.sin(a.ad(V)),ie=te*Math.sin(a.ad(R)),ce=-te*Math.cos(a.ad(R));let ae=this.elevation;const fe=v-ae;let _e;K*fe>=0||Math.abs(K)<.1?(_e=1e4,ae=v+_e*K):_e=-fe/K;let Me,Te,Ae=a.aP(1,Y.y),Pe=0;do{if(Pe+=1,Pe>10)break;Te=_e/Ae,Me=new a.a0(Y.x+ie*Te,Y.y+ce*Te),Ae=1/Me.meterInMercatorCoordinateUnits()}while(Math.abs(_e-Te*Ae)>1e-12);return{center:Me.toLngLat(),elevation:ae,zoom:a.aj(this.height/2/Math.tan(this.fovInRadians/2)/Te/this.tileSize)}}recalculateZoomAndCenter(h){if(this.elevation-h==0)return;const v=a.ai(1,this.center.lat)*this.worldSize,T=this.cameraToCenterDistance/v,P=a.a0.fromLngLat(this.center,this.elevation),R=ke(this.center,this.elevation,this.pitch,this.bearing,T);this._elevation=h;const V=this.calculateCenterFromCameraLngLatAlt(R.toLngLat(),a.aP(R.z,P.y),this.bearing,this.pitch);this._elevation=V.elevation,this._center=V.center,this.setZoom(V.zoom)}getCameraPoint(){const h=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.P(h*Math.sin(this.rollInRadians),h*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const h=a.ai(1,this.center.lat)*this.worldSize;return ke(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/h).toLngLat()}getMercatorTileCoordinates(h){if(!h)return[0,0,1,1];const v=h.canonical.z>=0?1<this.max[0]||h.aabb.min[1]>this.max[1]||h.aabb.min[2]>this.max[2]||h.aabb.max[0]0?(v+=h[P]*this.min[P],T+=h[P]*this.max[P]):(T+=h[P]*this.min[P],v+=h[P]*this.max[P]);return v>=0?2:T<0?0:1}}class cx{distanceToTile2d(h,v,T,P){const R=P.distanceX([h,v]),V=P.distanceY([h,v]);return Math.hypot(R,V)}getWrap(h,v,T){return T}getTileBoundingVolume(h,v,T,P){var R,V;let Y=T,K=T;if(P!=null&&P.terrain){const ie=new a.Z(h.z,v,h.z,h.x,h.y),ce=P.terrain.getMinMaxElevation(ie);Y=(R=ce.minElevation)!==null&&R!==void 0?R:T,K=(V=ce.maxElevation)!==null&&V!==void 0?V:T}const te=1<P}allowWorldCopies(){return!0}prepareNextFrame(){}}class ya{constructor(h,v,T){this.points=h,this.planes=v,this.aabb=T}static fromInvProjectionMatrix(h,v=1,T=0,P,R){const V=R?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],Y=Math.pow(2,T),K=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(ae=>function(fe,_e,Me,Te){const Ae=a.av([],fe,_e),Pe=1/Ae[3]/Me*Te;return a.aX(Ae,Ae,[Pe,Pe,1/Ae[3],Pe])}(ae,h,v,Y));P&&function(ae,fe,_e,Me){const Te=Me?4:0,Ae=Me?0:4;let Pe=0;const Fe=[],De=[];for(let Re=0;Re<4;Re++){const Je=a.aT([],ae[Re+Ae],ae[Re+Te]),ct=a.aY(Je);a.aQ(Je,Je,1/ct),Fe.push(ct),De.push(Je)}for(let Re=0;Re<4;Re++){const Je=a.aZ(ae[Re+Te],De[Re],_e);Pe=Je!==null&&Je>=0?Math.max(Pe,Je):Math.max(Pe,Fe[Re])}const je=function(Re,Je){const ct=a.aT([],Re[Je[0]],Re[Je[1]]),rt=a.aT([],Re[Je[2]],Re[Je[1]]),ot=[0,0,0,0];return a.aU(ot,a.aV([],ct,rt)),ot[3]=-a.aW(ot,Re[Je[0]]),ot}(ae,fe),Ge=function(Re,Je){const ct=a.a_(Re),rt=a.a$([],Re,1/ct),ot=a.aT([],Je,a.aQ([],rt,a.aW(Je,rt))),ut=a.a_(ot);if(ut>0){const Rt=Math.sqrt(1-rt[3]*rt[3]),Dt=a.aQ([],rt,-rt[3]),kt=a.aR([],Dt,a.aQ([],ot,Rt/ut));return a.b0(Je,kt)}return null}(_e,je);if(Ge!==null){const Re=Ge/a.aW(De[0],je);Pe=Math.min(Pe,Re)}for(let Re=0;Re<4;Re++){const Je=Math.min(Pe,Fe[Re]);ae[Re+Ae]=[ae[Re+Te][0]+De[Re][0]*Je,ae[Re+Te][1]+De[Re][1]*Je,ae[Re+Te][2]+De[Re][2]*Je,1]}}(K,V[0],P,R);const te=V.map(ae=>{const fe=a.aT([],K[ae[0]],K[ae[1]]),_e=a.aT([],K[ae[2]],K[ae[1]]),Me=a.aU([],a.aV([],fe,_e)),Te=-a.aW(Me,K[ae[1]]);return Me.concat(Te)}),ie=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],ce=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const ae of K)for(let fe=0;fe<3;fe++)ie[fe]=Math.min(ie[fe],ae[fe]),ce[fe]=Math.max(ce[fe],ae[fe]);return new ya(K,te,new g_(ie,ce))}}class Yo{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(h){this._helper.setMinZoom(h)}setMaxZoom(h){this._helper.setMaxZoom(h)}setMinPitch(h){this._helper.setMinPitch(h)}setMaxPitch(h){this._helper.setMaxPitch(h)}setRenderWorldCopies(h){this._helper.setRenderWorldCopies(h)}setBearing(h){this._helper.setBearing(h)}setPitch(h){this._helper.setPitch(h)}setRoll(h){this._helper.setRoll(h)}setFov(h){this._helper.setFov(h)}setZoom(h){this._helper.setZoom(h)}setCenter(h){this._helper.setCenter(h)}setElevation(h){this._helper.setElevation(h)}setMinElevationForCurrentTile(h){this._helper.setMinElevationForCurrentTile(h)}setPadding(h){this._helper.setPadding(h)}interpolatePadding(h,v,T){return this._helper.interpolatePadding(h,v,T)}isPaddingEqual(h){return this._helper.isPaddingEqual(h)}resize(h,v,T=!0){this._helper.resize(h,v,T)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(h){this._helper.setMaxBounds(h)}overrideNearFarZ(h,v){this._helper.overrideNearFarZ(h,v)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(h){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),h)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(h,v){}constructor(h,v,T,P,R){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._helper=new Cy({calcMatrices:()=>{this._calcMatrices()},getConstrained:(V,Y)=>this.getConstrained(V,Y)},h,v,T,P,R),this._coveringTilesDetailsProvider=new cx}clone(){const h=new Yo;return h.apply(this),h}apply(h,v,T){this._helper.apply(h,v,T)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(h){const v=[new a.b1(0,h)];if(this._helper._renderWorldCopies){const T=this.screenPointToMercatorCoordinate(new a.P(0,0)),P=this.screenPointToMercatorCoordinate(new a.P(this._helper._width,0)),R=this.screenPointToMercatorCoordinate(new a.P(this._helper._width,this._helper._height)),V=this.screenPointToMercatorCoordinate(new a.P(0,this._helper._height)),Y=Math.floor(Math.min(T.x,P.x,R.x,V.x)),K=Math.floor(Math.max(T.x,P.x,R.x,V.x)),te=1;for(let ie=Y-te;ie<=K+te;ie++)ie!==0&&v.push(new a.b1(ie,h))}return v}getCameraFrustum(){return ya.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(h){const v=this.screenPointToLocation(this.centerPoint,h),T=h?h.getElevationForLngLatZoom(v,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(T)}setLocationAtPoint(h,v){const T=a.ai(this.elevation,this.center.lat),P=this.screenPointToMercatorCoordinateAtZ(v,T),R=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,T),V=a.a0.fromLngLat(h),Y=new a.a0(V.x-(P.x-R.x),V.y-(P.y-R.y));this.setCenter(Y==null?void 0:Y.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(h,v){return v?this.coordinatePoint(a.a0.fromLngLat(h),v.getElevationForLngLatZoom(h,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(a.a0.fromLngLat(h))}screenPointToLocation(h,v){var T;return(T=this.screenPointToMercatorCoordinate(h,v))===null||T===void 0?void 0:T.toLngLat()}screenPointToMercatorCoordinate(h,v){if(v){const T=v.pointCoordinate(h);if(T!=null)return T}return this.screenPointToMercatorCoordinateAtZ(h)}screenPointToMercatorCoordinateAtZ(h,v){const T=v||0,P=[h.x,h.y,0,1],R=[h.x,h.y,1,1];a.av(P,P,this._pixelMatrixInverse),a.av(R,R,this._pixelMatrixInverse);const V=P[3],Y=R[3],K=P[1]/V,te=R[1]/Y,ie=P[2]/V,ce=R[2]/Y,ae=ie===ce?0:(T-ie)/(ce-ie);return new a.a0(a.C.number(P[0]/V,R[0]/Y,ae)/this.worldSize,a.C.number(K,te,ae)/this.worldSize,T)}coordinatePoint(h,v=0,T=this._pixelMatrix){const P=[h.x*this.worldSize,h.y*this.worldSize,v,1];return a.av(P,P,T),new a.P(P[0]/P[3],P[1]/P[3])}getBounds(){const h=Math.max(0,this._helper._height/2-ue(this));return new Ht().extend(this.screenPointToLocation(new a.P(0,h))).extend(this.screenPointToLocation(new a.P(this._helper._width,h))).extend(this.screenPointToLocation(new a.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new a.P(0,this._helper._height)))}isPointOnMapSurface(h,v){return v?v.pointCoordinate(h)!=null:h.y>this.height/2-ue(this)}calculatePosMatrix(h,v=!1,T){var P;const R=(P=h.key)!==null&&P!==void 0?P:a.b2(h.wrap,h.canonical.z,h.canonical.z,h.canonical.x,h.canonical.y),V=v?this._alignedPosMatrixCache:this._posMatrixCache;if(V.has(R)){const te=V.get(R);return T?te.f32:te.f64}const Y=ve(h,this.worldSize);a.O(Y,v?this._alignedProjMatrix:this._viewProjMatrix,Y);const K={f64:Y,f32:new Float32Array(Y)};return V.set(R,K),T?K.f32:K.f64}calculateFogMatrix(h){const v=h.key,T=this._fogMatrixCacheF32;if(T.has(v))return T.get(v);const P=ve(h,this.worldSize);return a.O(P,this._fogMatrix,P),T.set(v,new Float32Array(P)),T.get(v)}getConstrained(h,v){v=a.ag(+v,this.minZoom,this.maxZoom);const T={center:new a.S(h.lng,h.lat),zoom:v};let P=this._helper._lngRange;this._helper._renderWorldCopies||P!==null||(P=[-179.9999999999,180-1e-10]);const R=this.tileSize*a.ae(T.zoom);let V=0,Y=R,K=0,te=R,ie=0,ce=0;const{x:ae,y:fe}=this.size;if(this._helper._latRange){const Fe=this._helper._latRange;V=a.U(Fe[1])*R,Y=a.U(Fe[0])*R,Y-VY&&(Ae=Y-Fe)}if(P){const Fe=(K+te)/2;let De=_e;this._helper._renderWorldCopies&&(De=a.aN(_e,Fe-R/2,Fe+R/2));const je=ae/2;De-jete&&(Te=te-je)}if(Te!==void 0||Ae!==void 0){const Fe=new a.P(Te??_e,Ae??Me);T.center=ye(R,Fe).wrap()}return T}calculateCenterFromCameraLngLatAlt(h,v,T,P){return this._helper.calculateCenterFromCameraLngLatAlt(h,v,T,P)}_calculateNearFarZIfNeeded(h,v,T){if(!this._helper.autoCalculateNearFarZ)return;const P=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),R=h-P*this._helper._pixelPerMeter/Math.cos(v),V=P<0?R:h,Y=Math.PI/2+this.pitchInRadians,K=a.ad(this.fov)*(Math.abs(Math.cos(a.ad(this.roll)))*this.height+Math.abs(Math.sin(a.ad(this.roll)))*this.width)/this.height*(.5+T.y/this.height),te=Math.sin(K)*V/Math.sin(a.ag(Math.PI-Y-K,.01,Math.PI-.01)),ie=ue(this),ce=Math.atan(ie/this._helper.cameraToCenterDistance),ae=a.ad(.75),fe=ce>ae?2*ce*(.5+T.y/(2*ie)):ae,_e=Math.sin(fe)*V/Math.sin(a.ag(Math.PI-Y-fe,.01,Math.PI-.01)),Me=Math.min(te,_e);this._helper._farZ=1.01*(Math.cos(Math.PI/2-v)*Me+V),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const h=this.centerOffset,v=Ye(this.worldSize,this.center),T=v.x,P=v.y;this._helper._pixelPerMeter=a.ai(1,this.center.lat)*this.worldSize;const R=a.ad(Math.min(this.pitch,lr)),V=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(R));let Y;this._calculateNearFarZIfNeeded(V,R,h),Y=new Float64Array(16),a.b3(Y,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),a.ap(this._invProjMatrix,Y),Y[8]=2*-h.x/this._helper._width,Y[9]=2*h.y/this._helper._height,this._projectionMatrix=a.b4(Y),a.N(Y,Y,[1,-1,1]),a.M(Y,Y,[0,0,-this._helper.cameraToCenterDistance]),a.b5(Y,Y,-this.rollInRadians),a.b6(Y,Y,this.pitchInRadians),a.b5(Y,Y,-this.bearingInRadians),a.M(Y,Y,[-T,-P,0]),this._mercatorMatrix=a.N([],Y,[this.worldSize,this.worldSize,this.worldSize]),a.N(Y,Y,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=a.O(new Float64Array(16),this.clipSpaceToPixelsMatrix,Y),a.M(Y,Y,[0,0,-this.elevation]),this._viewProjMatrix=Y,this._invViewProjMatrix=a.ap([],Y);const K=[0,0,-1,1];a.av(K,K,this._invViewProjMatrix),this._cameraPosition=[K[0]/K[3],K[1]/K[3],K[2]/K[3]],this._fogMatrix=new Float64Array(16),a.b3(this._fogMatrix,this.fovInRadians,this.width/this.height,V,this._helper._farZ),this._fogMatrix[8]=2*-h.x/this.width,this._fogMatrix[9]=2*h.y/this.height,a.N(this._fogMatrix,this._fogMatrix,[1,-1,1]),a.M(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),a.b5(this._fogMatrix,this._fogMatrix,-this.rollInRadians),a.b6(this._fogMatrix,this._fogMatrix,this.pitchInRadians),a.b5(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),a.M(this._fogMatrix,this._fogMatrix,[-T,-P,0]),a.N(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),a.M(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=a.O(new Float64Array(16),this.clipSpaceToPixelsMatrix,Y);const te=this._helper._width%2/2,ie=this._helper._height%2/2,ce=Math.cos(this.bearingInRadians),ae=Math.sin(-this.bearingInRadians),fe=T-Math.round(T)+ce*te+ae*ie,_e=P-Math.round(P)+ce*ie+ae*te,Me=new Float64Array(Y);if(a.M(Me,Me,[fe>.5?fe-1:fe,_e>.5?_e-1:_e,0]),this._alignedProjMatrix=Me,Y=a.ap(new Float64Array(16),this._pixelMatrix),!Y)throw new Error("failed to invert matrix");this._pixelMatrixInverse=Y,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const h=this.screenPointToMercatorCoordinate(new a.P(0,0)),v=[h.x*this.worldSize,h.y*this.worldSize,0,1];return a.av(v,v,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const h=a.ai(1,this.center.lat)*this.worldSize;return ke(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/h).toLngLat()}lngLatToCameraDepth(h,v){const T=a.a0.fromLngLat(h),P=[T.x*this.worldSize,T.y*this.worldSize,v,1];return a.av(P,P,this._viewProjMatrix),P[2]/P[3]}getProjectionData(h){const{overscaledTileID:v,aligned:T,applyTerrainMatrix:P}=h,R=this._helper.getMercatorTileCoordinates(v),V=v?this.calculatePosMatrix(v,T,!0):null;let Y;return Y=v&&v.terrainRttPosMatrix32f&&P?v.terrainRttPosMatrix32f:V||a.b7(),{mainMatrix:Y,tileMercatorCoords:R,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:Y}}isLocationOccluded(h){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(h,v,T){return 1}transformLightDirection(h){return a.aS(h)}getRayDirectionFromPixel(h){throw new Error("Not implemented.")}projectTileCoordinates(h,v,T,P){const R=this.calculatePosMatrix(T);let V;P?(V=[h,v,P(h,v),1],a.av(V,V,R)):(V=[h,v,0,1],Wf(V,V,R));const Y=V[3];return{point:new a.P(V[0]/Y,V[1]/Y),signedDistanceFromCamera:Y,isOccluded:!1}}populateCache(h){for(const v of h)this.calculatePosMatrix(v)}getMatrixForModel(h,v){const T=a.a0.fromLngLat(h,v),P=T.meterInMercatorCoordinateUnits(),R=a.b8();return a.M(R,R,[T.x,T.y,T.z]),a.b5(R,R,Math.PI),a.b6(R,R,Math.PI/2),a.N(R,R,[-P,P,P]),R}getProjectionDataForCustomLayer(h=!0){const v=new a.Z(0,0,0,0,0),T=this.getProjectionData({overscaledTileID:v,applyGlobeMatrix:h}),P=ve(v,this.worldSize);a.O(P,this._viewProjMatrix,P),T.tileMercatorCoords=[0,0,1,1];const R=[a.$,a.$,this.worldSize/this._helper.pixelsPerMeter],V=a.b9();return a.N(V,P,R),T.fallbackMatrix=V,T.mainMatrix=V,T}getFastPathSimpleProjectionMatrix(h){return this.calculatePosMatrix(h)}}function va(){a.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function ks(D){if(D.useSlerp)if(D.k<1){const h=a.ba(D.startEulerAngles.roll,D.startEulerAngles.pitch,D.startEulerAngles.bearing),v=a.ba(D.endEulerAngles.roll,D.endEulerAngles.pitch,D.endEulerAngles.bearing),T=new Float64Array(4);a.bb(T,h,v,D.k);const P=a.bc(T);D.tr.setRoll(P.roll),D.tr.setPitch(P.pitch),D.tr.setBearing(P.bearing)}else D.tr.setRoll(D.endEulerAngles.roll),D.tr.setPitch(D.endEulerAngles.pitch),D.tr.setBearing(D.endEulerAngles.bearing);else D.tr.setRoll(a.C.number(D.startEulerAngles.roll,D.endEulerAngles.roll,D.k)),D.tr.setPitch(a.C.number(D.startEulerAngles.pitch,D.endEulerAngles.pitch,D.k)),D.tr.setBearing(a.C.number(D.startEulerAngles.bearing,D.endEulerAngles.bearing,D.k))}function ao(D,h,v,T,P){const R=P.padding,V=Ye(P.worldSize,v.getNorthWest()),Y=Ye(P.worldSize,v.getNorthEast()),K=Ye(P.worldSize,v.getSouthEast()),te=Ye(P.worldSize,v.getSouthWest()),ie=a.ad(-T),ce=V.rotate(ie),ae=Y.rotate(ie),fe=K.rotate(ie),_e=te.rotate(ie),Me=new a.P(Math.max(ce.x,ae.x,_e.x,fe.x),Math.max(ce.y,ae.y,_e.y,fe.y)),Te=new a.P(Math.min(ce.x,ae.x,_e.x,fe.x),Math.min(ce.y,ae.y,_e.y,fe.y)),Ae=Me.sub(Te),Pe=(P.width-(R.left+R.right+h.left+h.right))/Ae.x,Fe=(P.height-(R.top+R.bottom+h.top+h.bottom))/Ae.y;if(Fe<0||Pe<0)return void va();const De=Math.min(a.aj(P.scale*Math.min(Pe,Fe)),D.maxZoom),je=a.P.convert(D.offset),Ge=new a.P((h.left-h.right)/2,(h.top-h.bottom)/2).rotate(a.ad(T)),Re=je.add(Ge).mult(P.scale/a.ae(De));return{center:ye(P.worldSize,V.add(K).div(2).sub(Re)),zoom:De,bearing:T}}class y_{get useGlobeControls(){return!1}handlePanInertia(h,v){return{easingOffset:h,easingCenter:v.center}}handleMapControlsRollPitchBearingZoom(h,v){h.bearingDelta&&v.setBearing(v.bearing+h.bearingDelta),h.pitchDelta&&v.setPitch(v.pitch+h.pitchDelta),h.rollDelta&&v.setRoll(v.roll+h.rollDelta),h.zoomDelta&&v.setZoom(v.zoom+h.zoomDelta)}handleMapControlsPan(h,v,T){h.around.distSqr(v.centerPoint)<.01||v.setLocationAtPoint(T,h.around)}cameraForBoxAndBearing(h,v,T,P,R){return ao(h,v,T,P,R)}handleJumpToCenterZoom(h,v){h.zoom!==(v.zoom!==void 0?+v.zoom:h.zoom)&&h.setZoom(+v.zoom),v.center!==void 0&&h.setCenter(a.S.convert(v.center))}handleEaseTo(h,v){const T=h.zoom,P=h.padding,R={roll:h.roll,pitch:h.pitch,bearing:h.bearing},V={roll:v.roll===void 0?h.roll:v.roll,pitch:v.pitch===void 0?h.pitch:v.pitch,bearing:v.bearing===void 0?h.bearing:v.bearing},Y=v.zoom!==void 0,K=!h.isPaddingEqual(v.padding);let te=!1;const ie=Y?+v.zoom:h.zoom;let ce=h.centerPoint.add(v.offsetAsPoint);const ae=h.screenPointToLocation(ce),{center:fe,zoom:_e}=h.getConstrained(a.S.convert(v.center||ae),ie??T);Ah(h,fe);const Me=Ye(h.worldSize,ae),Te=Ye(h.worldSize,fe).sub(Me),Ae=a.ae(_e-T);return te=_e!==T,{easeFunc:Pe=>{if(te&&h.setZoom(a.C.number(T,_e,Pe)),a.bd(R,V)||ks({startEulerAngles:R,endEulerAngles:V,tr:h,k:Pe,useSlerp:R.roll!=V.roll}),K&&(h.interpolatePadding(P,v.padding,Pe),ce=h.centerPoint.add(v.offsetAsPoint)),v.around)h.setLocationAtPoint(v.around,v.aroundPoint);else{const Fe=a.ae(h.zoom-T),De=_e>T?Math.min(2,Ae):Math.max(.5,Ae),je=Math.pow(De,1-Pe),Ge=ye(h.worldSize,Me.add(Te.mult(Pe*je)).mult(Fe));h.setLocationAtPoint(h.renderWorldCopies?Ge.wrap():Ge,ce)}},isZooming:te,elevationCenter:fe}}handleFlyTo(h,v){const T=v.zoom!==void 0,P=h.zoom,R=h.getConstrained(a.S.convert(v.center||v.locationAtOffset),T?+v.zoom:P),V=R.center,Y=R.zoom;Ah(h,V);const K=Ye(h.worldSize,v.locationAtOffset),te=Ye(h.worldSize,V).sub(K),ie=te.mag(),ce=a.ae(Y-P);let ae;if(v.minZoom!==void 0){const fe=Math.min(+v.minZoom,P,Y),_e=h.getConstrained(V,fe).zoom;ae=a.ae(_e-P)}return{easeFunc:(fe,_e,Me,Te)=>{h.setZoom(fe===1?Y:P+a.aj(_e));const Ae=fe===1?V:ye(h.worldSize,K.add(te.mult(Me)).mult(_e));h.setLocationAtPoint(h.renderWorldCopies?Ae.wrap():Ae,Te)},scaleOfZoom:ce,targetCenter:V,scaleOfMinZoom:ae,pixelPathLength:ie}}}class Sr{constructor(h,v,T){this.blendFunction=h,this.blendColor=v,this.mask=T}}Sr.Replace=[1,0],Sr.disabled=new Sr(Sr.Replace,a.be.transparent,[!1,!1,!1,!1]),Sr.unblended=new Sr(Sr.Replace,a.be.transparent,[!0,!0,!0,!0]),Sr.alphaBlended=new Sr([1,771],a.be.transparent,[!0,!0,!0,!0]);const cl=2305;class Zn{constructor(h,v,T){this.enable=h,this.mode=v,this.frontFace=T}}Zn.disabled=new Zn(!1,1029,cl),Zn.backCCW=new Zn(!0,1029,cl),Zn.frontCCW=new Zn(!0,1028,cl);class er{constructor(h,v,T){this.func=h,this.mask=v,this.range=T}}er.ReadOnly=!1,er.ReadWrite=!0,er.disabled=new er(519,er.ReadOnly,[0,1]);const Yf=7680;class Ln{constructor(h,v,T,P,R,V){this.test=h,this.ref=v,this.mask=T,this.fail=P,this.depthFail=R,this.pass=V}}Ln.disabled=new Ln({func:519,mask:0},0,0,Yf,Yf,Yf);const Zf=new WeakMap;function La(D){var h;if(Zf.has(D))return Zf.get(D);{const v=(h=D.getParameter(D.VERSION))===null||h===void 0?void 0:h.startsWith("WebGL 2.0");return Zf.set(D,v),v}}class gm{get awaitingQuery(){return!!this._readbackQueue}constructor(h){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=h;const v=h.context,T=v.gl;this._texFormat=T.RGBA,this._texType=T.UNSIGNED_BYTE;const P=new a.aK;P.emplaceBack(-1,-1),P.emplaceBack(2,-1),P.emplaceBack(-1,2);const R=new a.aM;R.emplaceBack(0,1,2),this._fullscreenTriangle=new Th(v.createVertexBuffer(P,Mh.members),v.createIndexBuffer(R),a.aL.simpleSegment(0,0,P.length,R.length)),this._resultBuffer=new Uint8Array(4),v.activeTexture.set(T.TEXTURE1);const V=T.createTexture();T.bindTexture(T.TEXTURE_2D,V),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_WRAP_S,T.CLAMP_TO_EDGE),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_WRAP_T,T.CLAMP_TO_EDGE),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_MIN_FILTER,T.NEAREST),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_MAG_FILTER,T.NEAREST),T.texImage2D(T.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=v.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(V),La(T)&&(this._pbo=T.createBuffer(),T.bindBuffer(T.PIXEL_PACK_BUFFER,this._pbo),T.bufferData(T.PIXEL_PACK_BUFFER,4,T.STREAM_READ),T.bindBuffer(T.PIXEL_PACK_BUFFER,null))}destroy(){const h=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),h.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(h,v){const T=this._updateCount;return this._readbackQueue?T>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():T>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(h,v),this._updateCount++,this._measuredError}_bindFramebuffer(){const h=this._cachedRenderContext.context,v=h.gl;h.activeTexture.set(v.TEXTURE1),v.bindTexture(v.TEXTURE_2D,this._fbo.colorAttachment.get()),h.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(h,v){const T=this._cachedRenderContext.context,P=T.gl;if(this._bindFramebuffer(),T.viewport.set([0,0,this._texWidth,this._texHeight]),T.clear({color:a.be.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(T,P.TRIANGLES,er.disabled,Ln.disabled,Sr.unblended,Zn.disabled,((R,V)=>({u_input:R,u_output_expected:V}))(h,v),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&La(P)){P.bindBuffer(P.PIXEL_PACK_BUFFER,this._pbo),P.readBuffer(P.COLOR_ATTACHMENT0),P.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),P.bindBuffer(P.PIXEL_PACK_BUFFER,null);const R=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);P.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:R}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const h=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&La(h)){const v=h.clientWaitSync(this._readbackQueue.sync,0,0);if(v===h.WAIT_FAILED)return a.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(v===h.TIMEOUT_EXPIRED)return;h.bindBuffer(h.PIXEL_PACK_BUFFER,this._pbo),h.getBufferSubData(h.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),h.bindBuffer(h.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),h.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=gm._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(h){let v=0;return v+=h[0]/256,v+=h[1]/65536,v+=h[2]/16777216,h[3]<127&&(v=-v),v/128}}const mc=a.$/128;function ux(D,h){const v=D.granularity!==void 0?Math.max(D.granularity,1):1,T=v+(D.generateBorders?2:0),P=v+(D.extendToNorthPole||D.generateBorders?1:0)+(D.extendToSouthPole||D.generateBorders?1:0),R=T+1,V=P+1,Y=D.generateBorders?-1:0,K=D.generateBorders||D.extendToNorthPole?-1:0,te=v+(D.generateBorders?1:0),ie=v+(D.generateBorders||D.extendToSouthPole?1:0),ce=R*V,ae=T*P*6,fe=R*V>65536;if(fe&&h==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const _e=fe||h==="32bit",Me=new Int16Array(2*ce);let Te=0;for(let Fe=K;Fe<=ie;Fe++)for(let De=Y;De<=te;De++){let je=De/v*a.$;De===-1&&(je=-64),De===v+1&&(je=a.$+mc);let Ge=Fe/v*a.$;Fe===-1&&(Ge=D.extendToNorthPole?a.bg:-64),Fe===v+1&&(Ge=D.extendToSouthPole?a.bh:a.$+mc),Me[Te++]=je,Me[Te++]=Ge}const Ae=_e?new Uint32Array(ae):new Uint16Array(ae);let Pe=0;for(let Fe=0;Fe0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(h){this._mercatorProjection.updateGPUdependent(h),this._verticalPerspectiveProjection.updateGPUdependent(h)}getMeshFromTileID(h,v,T,P,R){return this.currentProjection.getMeshFromTileID(h,v,T,P,R)}setProjection(h){this._transitionable.setValue("type",(h==null?void 0:h.type)||"mercator")}updateTransitions(h){this._transitioning=this._transitionable.transitioned(h,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(h){this.properties=this._transitioning.possiblyEvaluate(h)}setErrorQueryLatitudeDegrees(h){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(h),this._mercatorProjection.setErrorQueryLatitudeDegrees(h)}}function Ty(D){const h=ym(D.worldSize,D.center.lat);return 2*Math.PI*h}function Hc(D,h,v,T,P){const R=1/(1<1e-6){const T=D[0]/v,P=Math.acos(D[2]/v),R=(T>0?P:-P)/Math.PI*180;return new a.S(a.aN(R,-180,180),h)}return new a.S(0,h)}function vm(D){return Math.cos(D*Math.PI/180)}function Zo(D,h){const v=vm(D),T=vm(h);return a.aj(T/v)}function Ay(D,h){const v=D.rotate(h.bearingInRadians),T=h.zoom+Zo(h.center.lat,0),P=a.bj(1/vm(h.center.lat),1/vm(Math.min(Math.abs(h.center.lat),60)),a.bm(T,7,3,0,1)),R=360/Ty({worldSize:h.worldSize,center:{lat:h.center.lat}});return new a.S(h.center.lng-v.x*R*P,a.ag(h.center.lat+v.y*R,-85.051129,a.ah))}function _m(D){const h=.5*D,v=Math.sin(h),T=Math.cos(h);return Math.log(v+T)-Math.log(T-v)}function bm(D,h,v,T){const P=D.lat+v*T;if(Math.abs(v)>1){const R=(Math.sign(D.lat+v)!==Math.sign(D.lat)?-Math.abs(D.lat):Math.abs(D.lat))*Math.PI/180,V=Math.abs(D.lat+v)*Math.PI/180,Y=_m(R+T*(V-R)),K=_m(R),te=_m(V);return new a.S(D.lng+h*((Y-K)/(te-K)),P)}return new a.S(D.lng+h*T,P)}class PR{constructor(h){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=h}swapBuffers(){if(!this._hadAnyChanges)return;const h=this._cachePrevious;this._cachePrevious=this._cache,this._cache=h,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(h,v,T,P){const R=`${h.z}_${h.x}_${h.y}_${P!=null&&P.terrain?"t":""}`,V=this._cache.get(R);if(V)return V;const Y=this._cachePrevious.get(R);if(Y)return this._cache.set(R,Y),Y;const K=this._boundingVolumeFactory(h,v,T,P);return this._cache.set(R,K),this._hadAnyChanges=!0,K}}class Ad{constructor(h,v,T,P){this.min=T,this.max=P,this.points=h,this.planes=v}static fromAabb(h,v){const T=[];for(let P=0;P<8;P++)T.push([1&~P?h[0]:v[0],(P>>1&1)==1?v[1]:h[1],(P>>2&1)==1?v[2]:h[2]]);return new Ad(T,[[-1,0,0,v[0]],[1,0,0,-h[0]],[0,-1,0,v[1]],[0,1,0,-h[1]],[0,0,-1,v[2]],[0,0,1,-h[2]]],h,v)}static fromCenterSizeAngles(h,v,T){const P=a.bq([],T[0],T[1],T[2]),R=a.br([],[v[0],0,0],P),V=a.br([],[0,v[1],0],P),Y=a.br([],[0,0,v[2]],P),K=[...h],te=[...h];for(let ce=0;ce<8;ce++)for(let ae=0;ae<3;ae++){const fe=h[ae]+R[ae]*(1&~ce?-1:1)+V[ae]*((ce>>1&1)==1?1:-1)+Y[ae]*((ce>>2&1)==1?1:-1);K[ae]=Math.min(K[ae],fe),te[ae]=Math.max(te[ae],fe)}const ie=[];for(let ce=0;ce<8;ce++){const ae=[...h];a.aR(ae,ae,a.aQ([],R,1&~ce?-1:1)),a.aR(ae,ae,a.aQ([],V,(ce>>1&1)==1?1:-1)),a.aR(ae,ae,a.aQ([],Y,(ce>>2&1)==1?1:-1)),ie.push(ae)}return new Ad(ie,[[...R,-a.aW(R,ie[0])],[...V,-a.aW(V,ie[0])],[...Y,-a.aW(Y,ie[0])],[-R[0],-R[1],-R[2],-a.aW(R,ie[7])],[-V[0],-V[1],-V[2],-a.aW(V,ie[7])],[-Y[0],-Y[1],-Y[2],-a.aW(Y,ie[7])]],K,te)}intersectsFrustum(h){let v=!0;const T=this.points.length,P=this.planes.length,R=h.planes.length,V=h.points.length;for(let Y=0;Y=0&&te++}if(te===0)return 0;te=0&&te++}if(te===0)return 0}return 1}intersectsPlane(h){const v=this.points.length;let T=0;for(let P=0;P=0&&T++}return T===v?2:T===0?0:1}}function Iy(D,h,v){const T=D-h;return T<0?-T:Math.max(0,T-v)}function hx(D,h,v,T,P){const R=D-v;let V;return V=R<0?Math.min(-R,1+R-P):R>1?Math.min(Math.max(R-P,0),1-R):0,Math.max(V,Iy(h,T,P))}class NR{constructor(){this._boundingVolumeCache=new PR(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(h,v,T,P){const R=1<4}allowWorldCopies(){return!1}getTileBoundingVolume(h,v,T,P){return this._boundingVolumeCache.getTileBoundingVolume(h,v,T,P)}_computeTileBoundingVolume(h,v,T,P){var R,V;let Y=T,K=T;if(P!=null&&P.terrain){const te=new a.Z(h.z,v,h.z,h.x,h.y),ie=P.terrain.getMinMaxElevation(te);Y=(R=ie.minElevation)!==null&&R!==void 0?R:T,K=(V=ie.maxElevation)!==null&&V!==void 0?V:T}if(Y/=a.bt,K/=a.bt,Y+=1,K+=1,h.z<=0)return Ad.fromAabb([-K,-K,-K],[K,K,K]);if(h.z===1)return Ad.fromAabb([h.x===0?-K:0,h.y===0?0:-K,-K],[h.x===0?0:K,h.y===0?K:0,K]);{const te=[Hc(0,0,h.x,h.y,h.z),Hc(a.$,0,h.x,h.y,h.z),Hc(a.$,a.$,h.x,h.y,h.z),Hc(0,a.$,h.x,h.y,h.z)],ie=[];for(const ot of te)ie.push(a.aQ([],ot,K));if(K!==Y)for(const ot of te)ie.push(a.aQ([],ot,Y));h.y===0&&ie.push([0,1,0]),h.y===(1<=(1<{this._calcMatrices()},getConstrained:(h,v)=>this.getConstrained(h,v)}),this._coveringTilesDetailsProvider=new NR}clone(){const h=new wm;return h.apply(this),h}apply(h,v){this._globeLatitudeErrorCorrectionRadians=v||0,this._helper.apply(h)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const h=a.bo();return h[0]=this._cameraPosition[0],h[1]=this._cameraPosition[1],h[2]=this._cameraPosition[2],h}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(h){const{overscaledTileID:v,applyGlobeMatrix:T}=h,P=this._helper.getMercatorTileCoordinates(v);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:P,clippingPlane:this._cachedClippingPlane,projectionTransition:T?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(h){const v=this.pitchInRadians,T=this.cameraToCenterDistance/h,P=Math.sin(v)*T,R=Math.cos(v)*T+1,V=1/Math.sqrt(P*P+R*R)*1;let Y=-P,K=R;const te=Math.sqrt(Y*Y+K*K);Y/=te,K/=te;const ie=[0,Y,K];a.bv(ie,ie,[0,0,0],-this.bearingInRadians),a.bw(ie,ie,[0,0,0],-1*this.center.lat*Math.PI/180),a.bx(ie,ie,[0,0,0],this.center.lng*Math.PI/180);const ce=1/a.aY(ie);return a.aQ(ie,ie,ce),[...ie,-V*ce]}isLocationOccluded(h){return!this.isSurfacePointVisible(Ts(h))}transformLightDirection(h){const v=this._helper._center.lng*Math.PI/180,T=this._helper._center.lat*Math.PI/180,P=Math.cos(T),R=[Math.sin(v)*P,Math.sin(T),Math.cos(v)*P],V=[R[2],0,-R[0]],Y=[0,0,0];a.aV(Y,V,R),a.aU(V,V),a.aU(Y,Y);const K=[0,0,0];return a.aU(K,[V[0]*h[0]+Y[0]*h[1]+R[0]*h[2],V[1]*h[0]+Y[1]*h[1]+R[1]*h[2],V[2]*h[0]+Y[2]*h[1]+R[2]*h[2]]),K}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(h,v,T){const P=function(Y,K,te){const ie=1/(1<R&&(R=ae),feY&&(Y=fe)}const ie=[te.lng+V,te.lat+K,te.lng+R,te.lat+Y];return this.isSurfacePointOnScreen([0,1,0])&&(ie[3]=90,ie[0]=-180,ie[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(ie[1]=-90,ie[0]=-180,ie[2]=180),new Ht(ie)}getConstrained(h,v){const T=a.ag(h.lat,-85.051129,a.ah),P=a.ag(+v,this.minZoom+Zo(0,T),this.maxZoom);return{center:new a.S(h.lng,T),zoom:P}}calculateCenterFromCameraLngLatAlt(h,v,T,P){return this._helper.calculateCenterFromCameraLngLatAlt(h,v,T,P)}setLocationAtPoint(h,v){const T=Ts(this.unprojectScreenPoint(v)),P=Ts(h),R=a.bo();a.bA(R);const V=a.bo();a.bx(V,T,R,-this.center.lng*Math.PI/180),a.bw(V,V,R,this.center.lat*Math.PI/180);const Y=P[0]*P[0]+P[2]*P[2],K=V[0]*V[0];if(Y=-Ae&&_e<=Ae,Fe=Te>=-Ae&&Te<=Ae;let De,je;if(Pe&&Fe){const ct=this.center.lng*Math.PI/180,rt=this.center.lat*Math.PI/180;a.bC(ce,ct)+a.bC(_e,rt)=0}isSurfacePointOnScreen(h){if(!this.isSurfacePointVisible(h))return!1;const v=a.bu();return a.av(v,[...h,1],this._globeViewProjMatrixNoCorrection),v[0]/=v[3],v[1]/=v[3],v[2]/=v[3],v[0]>-1&&v[0]<1&&v[1]>-1&&v[1]<1&&v[2]>-1&&v[2]<1}rayPlanetIntersection(h,v){const T=a.aW(h,v),P=a.bo(),R=a.bo();a.aQ(R,v,T),a.aT(P,h,R);const V=1-a.aW(P,P);if(V<0)return null;const Y=a.aW(h,h)-1,K=-T+(T<0?1:-1)*Math.sqrt(V),te=Y/K,ie=K;return{tMin:Math.min(te,ie),tMax:Math.max(te,ie)}}unprojectScreenPoint(h){const v=this._cameraPosition,T=this.getRayDirectionFromPixel(h),P=this.rayPlanetIntersection(v,T);if(P){const ie=a.bo();a.aR(ie,v,[T[0]*P.tMin,T[1]*P.tMin,T[2]*P.tMin]);const ce=a.bo();return a.aU(ce,ie),My(ce)}const R=this._cachedClippingPlane,V=R[0]*T[0]+R[1]*T[1]+R[2]*T[2],Y=-a.b0(R,v)/V,K=a.bo();if(Y>0)a.aR(K,v,[T[0]*Y,T[1]*Y,T[2]*Y]);else{const ie=a.bo();a.aR(ie,v,[2*T[0],2*T[1],2*T[2]]);const ce=a.b0(this._cachedClippingPlane,ie);a.aT(K,ie,[this._cachedClippingPlane[0]*ce,this._cachedClippingPlane[1]*ce,this._cachedClippingPlane[2]*ce])}const te=function(ie){const ce=a.bo();return ce[0]=ie[0]*-ie[3],ce[1]=ie[1]*-ie[3],ce[2]=ie[2]*-ie[3],{center:ce,radius:Math.sqrt(1-ie[3]*ie[3])}}(R);return My(function(ie,ce,ae){const fe=a.bo();a.aT(fe,ae,ie);const _e=a.bo();return a.bp(_e,ie,fe,ce/a.a_(fe)),_e}(te.center,te.radius,K))}getMatrixForModel(h,v){const T=a.S.convert(h),P=1/a.bt,R=a.b8();return a.by(R,R,T.lng/180*Math.PI),a.b6(R,R,-T.lat/180*Math.PI),a.M(R,R,[0,0,1+v/a.bt]),a.b6(R,R,.5*Math.PI),a.N(R,R,[P,P,P]),R}getProjectionDataForCustomLayer(h=!0){const v=this.getProjectionData({overscaledTileID:new a.Z(0,0,0,0,0),applyGlobeMatrix:h});return v.tileMercatorCoords=[0,0,1,1],v}getFastPathSimpleProjectionMatrix(h){}}class Rl{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(h){this._helper.setMinZoom(h)}setMaxZoom(h){this._helper.setMaxZoom(h)}setMinPitch(h){this._helper.setMinPitch(h)}setMaxPitch(h){this._helper.setMaxPitch(h)}setRenderWorldCopies(h){this._helper.setRenderWorldCopies(h)}setBearing(h){this._helper.setBearing(h)}setPitch(h){this._helper.setPitch(h)}setRoll(h){this._helper.setRoll(h)}setFov(h){this._helper.setFov(h)}setZoom(h){this._helper.setZoom(h)}setCenter(h){this._helper.setCenter(h)}setElevation(h){this._helper.setElevation(h)}setMinElevationForCurrentTile(h){this._helper.setMinElevationForCurrentTile(h)}setPadding(h){this._helper.setPadding(h)}interpolatePadding(h,v,T){return this._helper.interpolatePadding(h,v,T)}isPaddingEqual(h){return this._helper.isPaddingEqual(h)}resize(h,v,T=!0){this._helper.resize(h,v,T)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(h){this._helper.setMaxBounds(h)}overrideNearFarZ(h,v){this._helper.overrideNearFarZ(h,v)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(h){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),h)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(h,v){this._globeness=h,this._globeLatitudeErrorCorrectionRadians=v,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new Cy({calcMatrices:()=>{this._calcMatrices()},getConstrained:(h,v)=>this.getConstrained(h,v)}),this._globeness=1,this._mercatorTransform=new Yo,this._verticalPerspectiveTransform=new wm}clone(){const h=new Rl;return h._globeness=this._globeness,h._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,h.apply(this),h}apply(h){this._helper.apply(h),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(h){const v=this._mercatorTransform.getProjectionData(h),T=this._verticalPerspectiveTransform.getProjectionData(h);return{mainMatrix:this.isGlobeRendering?T.mainMatrix:v.mainMatrix,clippingPlane:T.clippingPlane,tileMercatorCoords:T.tileMercatorCoords,projectionTransition:h.applyGlobeMatrix?this._globeness:0,fallbackMatrix:v.fallbackMatrix}}isLocationOccluded(h){return this.currentTransform.isLocationOccluded(h)}transformLightDirection(h){return this.currentTransform.transformLightDirection(h)}getPixelScale(){return a.bj(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return a.bj(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(h,v,T){const P=this._mercatorTransform.getPitchedTextCorrection(h,v,T),R=this._verticalPerspectiveTransform.getPitchedTextCorrection(h,v,T);return a.bj(P,R,this._globeness)}projectTileCoordinates(h,v,T,P){return this.currentTransform.projectTileCoordinates(h,v,T,P)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(h){return this.currentTransform.calculateFogMatrix(h)}getVisibleUnwrappedCoordinates(h){return this.currentTransform.getVisibleUnwrappedCoordinates(h)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(h){this._mercatorTransform.recalculateZoomAndCenter(h),this._verticalPerspectiveTransform.recalculateZoomAndCenter(h)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(h,v){return this.currentTransform.lngLatToCameraDepth(h,v)}populateCache(h){this._mercatorTransform.populateCache(h),this._verticalPerspectiveTransform.populateCache(h)}getBounds(){return this.currentTransform.getBounds()}getConstrained(h,v){return this.currentTransform.getConstrained(h,v)}calculateCenterFromCameraLngLatAlt(h,v,T,P){return this._helper.calculateCenterFromCameraLngLatAlt(h,v,T,P)}setLocationAtPoint(h,v){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(h,v),void this.apply(this._mercatorTransform);this._verticalPerspectiveTransform.setLocationAtPoint(h,v),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(h,v){return this.currentTransform.locationToScreenPoint(h,v)}screenPointToMercatorCoordinate(h,v){return this.currentTransform.screenPointToMercatorCoordinate(h,v)}screenPointToLocation(h,v){return this.currentTransform.screenPointToLocation(h,v)}isPointOnMapSurface(h,v){return this.currentTransform.isPointOnMapSurface(h,v)}getRayDirectionFromPixel(h){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(h)}getMatrixForModel(h,v){return this.currentTransform.getMatrixForModel(h,v)}getProjectionDataForCustomLayer(h=!0){const v=this._mercatorTransform.getProjectionDataForCustomLayer(h);if(!this.isGlobeRendering)return v;const T=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(h);return T.fallbackMatrix=v.mainMatrix,T}getFastPathSimpleProjectionMatrix(h){return this.currentTransform.getFastPathSimpleProjectionMatrix(h)}}class ul{get useGlobeControls(){return!0}handlePanInertia(h,v){const T=Ay(h,v);return Math.abs(T.lng-v.center.lng)>180&&(T.lng=v.center.lng+179.5*Math.sign(T.lng-v.center.lng)),{easingCenter:T,easingOffset:new a.P(0,0)}}handleMapControlsRollPitchBearingZoom(h,v){const T=h.around,P=v.screenPointToLocation(T);h.bearingDelta&&v.setBearing(v.bearing+h.bearingDelta),h.pitchDelta&&v.setPitch(v.pitch+h.pitchDelta),h.rollDelta&&v.setRoll(v.roll+h.rollDelta);const R=v.zoom;h.zoomDelta&&v.setZoom(v.zoom+h.zoomDelta);const V=v.zoom-R;if(V===0)return;const Y=a.bz(v.center.lng,P.lng),K=Y/(Math.abs(Y/180)+1),te=a.bz(v.center.lat,P.lat),ie=v.getRayDirectionFromPixel(T),ce=v.cameraPosition,ae=-1*a.aW(ce,ie),fe=a.bo();a.aR(fe,ce,[ie[0]*ae,ie[1]*ae,ie[2]*ae]);const _e=a.aY(fe)-1,Me=Math.exp(.5*-Math.max(_e-.3,0)),Te=ym(v.worldSize,v.center.lat)/Math.min(v.width,v.height),Ae=a.bm(Te,.9,.5,1,.25),Pe=(1-a.ae(-V))*Math.min(Me,Ae),Fe=v.center.lat,De=v.zoom,je=new a.S(v.center.lng+K*Pe,a.ag(v.center.lat+te*Pe,-85.051129,a.ah));v.setLocationAtPoint(P,T);const Ge=v.center,Re=a.bm(Math.abs(Y),45,85,0,1),Je=a.bm(Te,.75,.35,0,1),ct=Math.pow(Math.max(Re,Je),.25),rt=a.bz(Ge.lng,je.lng),ot=a.bz(Ge.lat,je.lat);v.setCenter(new a.S(Ge.lng+rt*ct,Ge.lat+ot*ct).wrap()),v.setZoom(De+Zo(Fe,v.center.lat))}handleMapControlsPan(h,v,T){if(!h.panDelta)return;const P=v.center.lat,R=v.zoom;v.setCenter(Ay(h.panDelta,v).wrap()),v.setZoom(R+Zo(P,v.center.lat))}cameraForBoxAndBearing(h,v,T,P,R){const V=ao(h,v,T,P,R),Y=v.left/R.width*2-1,K=(R.width-v.right)/R.width*2-1,te=v.top/R.height*-2+1,ie=(R.height-v.bottom)/R.height*-2+1,ce=a.bz(T.getWest(),T.getEast())<0,ae=ce?T.getEast():T.getWest(),fe=ce?T.getWest():T.getEast(),_e=Math.max(T.getNorth(),T.getSouth()),Me=Math.min(T.getNorth(),T.getSouth()),Te=ae+.5*a.bz(ae,fe),Ae=_e+.5*a.bz(_e,Me),Pe=R.clone();Pe.setCenter(V.center),Pe.setBearing(V.bearing),Pe.setPitch(0),Pe.setRoll(0),Pe.setZoom(V.zoom);const Fe=Pe.modelViewProjectionMatrix,De=[Ts(T.getNorthWest()),Ts(T.getNorthEast()),Ts(T.getSouthWest()),Ts(T.getSouthEast()),Ts(new a.S(fe,Ae)),Ts(new a.S(ae,Ae)),Ts(new a.S(Te,_e)),Ts(new a.S(Te,Me))],je=Ts(V.center);let Ge=Number.POSITIVE_INFINITY;for(const Re of De)Y<0&&(Ge=ul.getLesserNonNegativeNonNull(Ge,ul.solveVectorScale(Re,je,Fe,"x",Y))),K>0&&(Ge=ul.getLesserNonNegativeNonNull(Ge,ul.solveVectorScale(Re,je,Fe,"x",K))),te>0&&(Ge=ul.getLesserNonNegativeNonNull(Ge,ul.solveVectorScale(Re,je,Fe,"y",te))),ie<0&&(Ge=ul.getLesserNonNegativeNonNull(Ge,ul.solveVectorScale(Re,je,Fe,"y",ie)));if(Number.isFinite(Ge)&&Ge!==0)return V.zoom=Pe.zoom+a.aj(Ge),V;va()}handleJumpToCenterZoom(h,v){const T=h.center.lat,P=h.getConstrained(v.center?a.S.convert(v.center):h.center,h.zoom).center;h.setCenter(P.wrap());const R=v.zoom!==void 0?+v.zoom:h.zoom+Zo(T,P.lat);h.zoom!==R&&h.setZoom(R)}handleEaseTo(h,v){const T=h.zoom,P=h.center,R=h.padding,V={roll:h.roll,pitch:h.pitch,bearing:h.bearing},Y={roll:v.roll===void 0?h.roll:v.roll,pitch:v.pitch===void 0?h.pitch:v.pitch,bearing:v.bearing===void 0?h.bearing:v.bearing},K=v.zoom!==void 0,te=!h.isPaddingEqual(v.padding);let ie=!1;const ce=v.center?a.S.convert(v.center):P,ae=h.getConstrained(ce,T).center;Ah(h,ae);const fe=h.clone();fe.setCenter(ae),fe.setZoom(K?+v.zoom:T+Zo(P.lat,ce.lat)),fe.setBearing(v.bearing);const _e=new a.P(a.ag(h.centerPoint.x+v.offsetAsPoint.x,0,h.width),a.ag(h.centerPoint.y+v.offsetAsPoint.y,0,h.height));fe.setLocationAtPoint(ae,_e);const Me=(v.offset&&v.offsetAsPoint.mag())>0?fe.center:ae,Te=K?+v.zoom:T+Zo(P.lat,Me.lat),Ae=T+Zo(P.lat,0),Pe=Te+Zo(Me.lat,0),Fe=a.bz(P.lng,Me.lng),De=a.bz(P.lat,Me.lat),je=a.ae(Pe-Ae);return ie=Te!==T,{easeFunc:Ge=>{if(a.bd(V,Y)||ks({startEulerAngles:V,endEulerAngles:Y,tr:h,k:Ge,useSlerp:V.roll!=Y.roll}),te&&h.interpolatePadding(R,v.padding,Ge),v.around)a.w("Easing around a point is not supported under globe projection."),h.setLocationAtPoint(v.around,v.aroundPoint);else{const Re=Pe>Ae?Math.min(2,je):Math.max(.5,je),Je=Math.pow(Re,1-Ge),ct=bm(P,Fe,De,Ge*Je);h.setCenter(ct.wrap())}if(ie){const Re=a.C.number(Ae,Pe,Ge)+Zo(0,h.center.lat);h.setZoom(Re)}},isZooming:ie,elevationCenter:Me}}handleFlyTo(h,v){const T=v.zoom!==void 0,P=h.center,R=h.zoom,V=h.padding,Y=!h.isPaddingEqual(v.padding),K=h.getConstrained(a.S.convert(v.center||v.locationAtOffset),R).center,te=T?+v.zoom:h.zoom+Zo(h.center.lat,K.lat),ie=h.clone();ie.setCenter(K),ie.setZoom(te),ie.setBearing(v.bearing);const ce=new a.P(a.ag(h.centerPoint.x+v.offsetAsPoint.x,0,h.width),a.ag(h.centerPoint.y+v.offsetAsPoint.y,0,h.height));ie.setLocationAtPoint(K,ce);const ae=ie.center;Ah(h,ae);const fe=function(De,je,Ge){const Re=Ts(je),Je=Ts(Ge),ct=a.aW(Re,Je),rt=Math.acos(ct),ot=Ty(De);return rt/(2*Math.PI)*ot}(h,P,ae),_e=R+Zo(P.lat,0),Me=te+Zo(ae.lat,0),Te=a.ae(Me-_e);let Ae;if(typeof v.minZoom=="number"){const De=+v.minZoom+Zo(ae.lat,0),je=Math.min(De,_e,Me)+Zo(0,ae.lat),Ge=h.getConstrained(ae,je).zoom+Zo(ae.lat,0);Ae=a.ae(Ge-_e)}const Pe=a.bz(P.lng,ae.lng),Fe=a.bz(P.lat,ae.lat);return{easeFunc:(De,je,Ge,Re)=>{const Je=bm(P,Pe,Fe,Ge);Y&&h.interpolatePadding(V,v.padding,De);const ct=De===1?ae:Je;h.setCenter(ct.wrap());const rt=_e+a.aj(je);h.setZoom(De===1?te:rt+Zo(0,ct.lat))},scaleOfZoom:Te,targetCenter:ae,scaleOfMinZoom:Ae,pixelPathLength:fe}}static solveVectorScale(h,v,T,P,R){const V=P==="x"?[T[0],T[4],T[8],T[12]]:[T[1],T[5],T[9],T[13]],Y=[T[3],T[7],T[11],T[15]],K=h[0]*V[0]+h[1]*V[1]+h[2]*V[2],te=h[0]*Y[0]+h[1]*Y[1]+h[2]*Y[2],ie=v[0]*V[0]+v[1]*V[1]+v[2]*V[2],ce=v[0]*Y[0]+v[1]*Y[1]+v[2]*Y[2];return ie+R*te===K+R*ce||Y[3]*(K-ie)+V[3]*(ce-te)+K*ce==ie*te?null:(ie+V[3]-R*ce-R*Y[3])/(ie-K-R*ce+R*te)}static getLesserNonNegativeNonNull(h,v){return v!==null&&v>=0&&va.y(D,h&&h.filter(v=>v.identifier!=="source.canvas")),xm=a.bD();class fx extends a.E{constructor(h,v={}){super(),this._rtlPluginLoaded=()=>{for(const T in this.sourceCaches){const P=this.sourceCaches[T].getSource().type;P!=="vector"&&P!=="geojson"||this.sourceCaches[T].reload()}},this.map=h,this.dispatcher=new $e(Oe(),h._getMapId()),this.dispatcher.registerMessageHandler("GG",(T,P)=>this.getGlyphs(T,P)),this.dispatcher.registerMessageHandler("GI",(T,P)=>this.getImages(T,P)),this.imageManager=new $,this.imageManager.setEventedParent(this),this.glyphManager=new q(h._requestManager,v.localIdeographFontFamily),this.lineAtlas=new le(256,512),this.crossTileSymbolIndex=new p_,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new a.bE,this._loaded=!1,this._availableImages=[],this._globalState={},this._resetUpdates(),this.dispatcher.broadcast("SR",a.bF()),nt().on(St,this._rtlPluginLoaded),this.on("data",T=>{if(T.dataType!=="source"||T.sourceDataType!=="metadata")return;const P=this.sourceCaches[T.sourceId];if(!P)return;const R=P.getSource();if(R&&R.vectorLayerIds)for(const V in this._layers){const Y=this._layers[V];Y.source===R.id&&this._validateLayer(Y)}})}setGlobalStateProperty(h,v){var T,P,R;this._checkLoaded();const V=v===null?(R=(P=(T=this.stylesheet.state)===null||T===void 0?void 0:T[h])===null||P===void 0?void 0:P.default)!==null&&R!==void 0?R:null:v;if(a.bG(V,this._globalState[h]))return this;this._globalState[h]=V;const Y=this._findGlobalStateAffectedSources([h]);for(const K in this.sourceCaches)Y.has(K)&&(this._reloadSource(K),this._changed=!0)}getGlobalState(){return this._globalState}setGlobalState(h){this._checkLoaded();const v=[];for(const P in h)!a.bG(this._globalState[P],h[P].default)&&(v.push(P),this._globalState[P]=h[P].default);const T=this._findGlobalStateAffectedSources(v);for(const P in this.sourceCaches)T.has(P)&&(this._reloadSource(P),this._changed=!0)}_findGlobalStateAffectedSources(h){if(h.length===0)return new Set;const v=new Set;for(const T in this._layers){const P=this._layers[T],R=P.getLayoutAffectingGlobalStateRefs();for(const V of h)R.has(V)&&v.add(P.source)}return v}loadURL(h,v={},T){this.fire(new a.l("dataloading",{dataType:"style"})),v.validate=typeof v.validate!="boolean"||v.validate;const P=this.map._requestManager.transformRequest(h,"Style");this._loadStyleRequest=new AbortController;const R=this._loadStyleRequest;a.j(P,this._loadStyleRequest).then(V=>{this._loadStyleRequest=null,this._load(V.data,v,T)}).catch(V=>{this._loadStyleRequest=null,V&&!R.signal.aborted&&this.fire(new a.k(V))})}loadJSON(h,v={},T){this.fire(new a.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,p.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,v.validate=v.validate!==!1,this._load(h,v,T)}).catch(()=>{})}loadEmpty(){this.fire(new a.l("dataloading",{dataType:"style"})),this._load(xm,{validate:!1})}_load(h,v,T){var P,R,V;const Y=v.transformStyle?v.transformStyle(T,h):h;if(!v.validate||!Ly(this,a.z(Y))){this._loaded=!0,this.stylesheet=Y;for(const K in Y.sources)this.addSource(K,Y.sources[K],{validate:!1});Y.sprite?this._loadSprite(Y.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(Y.glyphs),this._createLayers(),this.light=new U(this.stylesheet.light),this._setProjectionInternal(((P=this.stylesheet.projection)===null||P===void 0?void 0:P.type)||"mercator"),this.sky=new re(this.stylesheet.sky),this.map.setTerrain((R=this.stylesheet.terrain)!==null&&R!==void 0?R:null),this.setGlobalState((V=this.stylesheet.state)!==null&&V!==void 0?V:null),this.fire(new a.l("data",{dataType:"style"})),this.fire(new a.l("style.load"))}}_createLayers(){const h=a.bH(this.stylesheet.layers);this.dispatcher.broadcast("SL",h),this._order=h.map(v=>v.id),this._layers={},this._serializedLayers=null;for(const v of h){const T=a.bI(v);T.setEventedParent(this,{layer:{id:v.id}}),this._layers[v.id]=T}}_loadSprite(h,v=!1,T=void 0){let P;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(R,V,Y,K){return a._(this,void 0,void 0,function*(){const te=I(R),ie=Y>1?"@2x":"",ce={},ae={};for(const{id:fe,url:_e}of te){const Me=V.transformRequest(O(_e,ie,".json"),"SpriteJSON");ce[fe]=a.j(Me,K);const Te=V.transformRequest(O(_e,ie,".png"),"SpriteImage");ae[fe]=E.getImage(Te,K)}return yield Promise.all([...Object.values(ce),...Object.values(ae)]),function(fe,_e){return a._(this,void 0,void 0,function*(){const Me={};for(const Te in fe){Me[Te]={};const Ae=p.getImageCanvasContext((yield _e[Te]).data),Pe=(yield fe[Te]).data;for(const Fe in Pe){const{width:De,height:je,x:Ge,y:Re,sdf:Je,pixelRatio:ct,stretchX:rt,stretchY:ot,content:ut,textFitWidth:Rt,textFitHeight:Dt}=Pe[Fe];Me[Te][Fe]={data:null,pixelRatio:ct,sdf:Je,stretchX:rt,stretchY:ot,content:ut,textFitWidth:Rt,textFitHeight:Dt,spriteData:{width:De,height:je,x:Ge,y:Re,context:Ae}}}}return Me})}(ce,ae)})}(h,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(R=>{if(this._spriteRequest=null,R)for(const V in R){this._spritesImagesIds[V]=[];const Y=this._spritesImagesIds[V]?this._spritesImagesIds[V].filter(K=>!(K in R)):[];for(const K of Y)this.imageManager.removeImage(K),this._changedImages[K]=!0;for(const K in R[V]){const te=V==="default"?K:`${V}:${K}`;this._spritesImagesIds[V].push(te),te in this.imageManager.images?this.imageManager.updateImage(te,R[V][K],!1):this.imageManager.addImage(te,R[V][K]),v&&(this._changedImages[te]=!0)}}}).catch(R=>{this._spriteRequest=null,P=R,this.fire(new a.k(P))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),v&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new a.l("data",{dataType:"style"})),T&&T(P)})}_unloadSprite(){for(const h of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(h),this._changedImages[h]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new a.l("data",{dataType:"style"}))}_validateLayer(h){const v=this.sourceCaches[h.source];if(!v)return;const T=h.sourceLayer;if(!T)return;const P=v.getSource();(P.type==="geojson"||P.vectorLayerIds&&P.vectorLayerIds.indexOf(T)===-1)&&this.fire(new a.k(new Error(`Source layer "${T}" does not exist on source "${P.id}" as specified by style layer "${h.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const h in this.sourceCaches)if(!this.sourceCaches[h].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(h,v=!1){const T=this._serializedAllLayers();if(!h||h.length===0)return Object.values(v?a.bJ(T):T);const P=[];for(const R of h)if(T[R]){const V=v?a.bJ(T[R]):T[R];P.push(V)}return P}_serializedAllLayers(){let h=this._serializedLayers;if(h)return h;h=this._serializedLayers={};const v=Object.keys(this._layers);for(const T of v){const P=this._layers[T];P.type!=="custom"&&(h[T]=P.serialize())}return h}hasTransitions(){var h,v,T;if(!((h=this.light)===null||h===void 0)&&h.hasTransition()||!((v=this.sky)===null||v===void 0)&&v.hasTransition()||!((T=this.projection)===null||T===void 0)&&T.hasTransition())return!0;for(const P in this.sourceCaches)if(this.sourceCaches[P].hasTransition())return!0;for(const P in this._layers)if(this._layers[P].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(h){if(!this._loaded)return;const v=this._changed;if(v){const P=Object.keys(this._updatedLayers),R=Object.keys(this._removedLayers);(P.length||R.length)&&this._updateWorkerLayers(P,R);for(const V in this._updatedSources){const Y=this._updatedSources[V];if(Y==="reload")this._reloadSource(V);else{if(Y!=="clear")throw new Error(`Invalid action ${Y}`);this._clearSource(V)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const V in this._updatedPaintProps)this._layers[V].updateTransitions(h);this.light.updateTransitions(h),this.sky.updateTransitions(h),this._resetUpdates()}const T={};for(const P in this.sourceCaches){const R=this.sourceCaches[P];T[P]=R.used,R.used=!1}for(const P of this._order){const R=this._layers[P];R.recalculate(h,this._availableImages),!R.isHidden(h.zoom)&&R.source&&(this.sourceCaches[R.source].used=!0)}for(const P in T){const R=this.sourceCaches[P];!!T[P]!=!!R.used&&R.fire(new a.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:P}))}this.light.recalculate(h),this.sky.recalculate(h),this.projection.recalculate(h),this.z=h.zoom,v&&this.fire(new a.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const h=Object.keys(this._changedImages);if(h.length){for(const v in this.sourceCaches)this.sourceCaches[v].reloadTilesForDependencies(["icons","patterns"],h);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const h in this.sourceCaches)this.sourceCaches[h].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(h,v){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(h,!1),removedIds:v})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(h,v={}){var T;this._checkLoaded();const P=this.serialize();if(h=v.transformStyle?v.transformStyle(P,h):h,((T=v.validate)===null||T===void 0||T)&&Ly(this,a.z(h)))return!1;(h=a.bJ(h)).layers=a.bH(h.layers);const R=a.bK(P,h),V=this._getOperationsToPerform(R);if(V.unimplemented.length>0)throw new Error(`Unimplemented: ${V.unimplemented.join(", ")}.`);if(V.operations.length===0)return!1;for(const Y of V.operations)Y();return this.stylesheet=h,this._serializedLayers=null,!0}_getOperationsToPerform(h){const v=[],T=[];for(const P of h)switch(P.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":v.push(()=>this.addLayer.apply(this,P.args));break;case"removeLayer":v.push(()=>this.removeLayer.apply(this,P.args));break;case"setPaintProperty":v.push(()=>this.setPaintProperty.apply(this,P.args));break;case"setLayoutProperty":v.push(()=>this.setLayoutProperty.apply(this,P.args));break;case"setFilter":v.push(()=>this.setFilter.apply(this,P.args));break;case"addSource":v.push(()=>this.addSource.apply(this,P.args));break;case"removeSource":v.push(()=>this.removeSource.apply(this,P.args));break;case"setLayerZoomRange":v.push(()=>this.setLayerZoomRange.apply(this,P.args));break;case"setLight":v.push(()=>this.setLight.apply(this,P.args));break;case"setGeoJSONSourceData":v.push(()=>this.setGeoJSONSourceData.apply(this,P.args));break;case"setGlyphs":v.push(()=>this.setGlyphs.apply(this,P.args));break;case"setSprite":v.push(()=>this.setSprite.apply(this,P.args));break;case"setTerrain":v.push(()=>this.map.setTerrain.apply(this,P.args));break;case"setSky":v.push(()=>this.setSky.apply(this,P.args));break;case"setProjection":this.setProjection.apply(this,P.args);break;case"setGlobalState":v.push(()=>this.setGlobalState.apply(this,P.args));break;case"setTransition":v.push(()=>{});break;default:T.push(P.command)}return{operations:v,unimplemented:T}}addImage(h,v){if(this.getImage(h))return this.fire(new a.k(new Error(`An image named "${h}" already exists.`)));this.imageManager.addImage(h,v),this._afterImageUpdated(h)}updateImage(h,v){this.imageManager.updateImage(h,v)}getImage(h){return this.imageManager.getImage(h)}removeImage(h){if(!this.getImage(h))return this.fire(new a.k(new Error(`An image named "${h}" does not exist.`)));this.imageManager.removeImage(h),this._afterImageUpdated(h)}_afterImageUpdated(h){this._availableImages=this.imageManager.listImages(),this._changedImages[h]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new a.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(h,v,T={}){if(this._checkLoaded(),this.sourceCaches[h]!==void 0)throw new Error(`Source "${h}" already exists.`);if(!v.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(v).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(v.type)>=0&&this._validate(a.z.source,`sources.${h}`,v,null,T))return;this.map&&this.map._collectResourceTiming&&(v.collectResourceTiming=!0);const P=this.sourceCaches[h]=new wt(h,v,this.dispatcher);P.style=this,P.setEventedParent(this,()=>({isSourceLoaded:P.loaded(),source:P.serialize(),sourceId:h})),P.onAdd(this.map),this._changed=!0}removeSource(h){if(this._checkLoaded(),this.sourceCaches[h]===void 0)throw new Error("There is no source with this ID");for(const T in this._layers)if(this._layers[T].source===h)return this.fire(new a.k(new Error(`Source "${h}" cannot be removed while layer "${T}" is using it.`)));const v=this.sourceCaches[h];delete this.sourceCaches[h],delete this._updatedSources[h],v.fire(new a.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:h})),v.setEventedParent(null),v.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(h,v){if(this._checkLoaded(),this.sourceCaches[h]===void 0)throw new Error(`There is no source with this ID=${h}`);const T=this.sourceCaches[h].getSource();if(T.type!=="geojson")throw new Error(`geojsonSource.type is ${T.type}, which is !== 'geojson`);T.setData(v),this._changed=!0}getSource(h){return this.sourceCaches[h]&&this.sourceCaches[h].getSource()}addLayer(h,v,T={}){this._checkLoaded();const P=h.id;if(this.getLayer(P))return void this.fire(new a.k(new Error(`Layer "${P}" already exists on this map.`)));let R;if(h.type==="custom"){if(Ly(this,a.bL(h)))return;R=a.bI(h)}else{if("source"in h&&typeof h.source=="object"&&(this.addSource(P,h.source),h=a.bJ(h),h=a.e(h,{source:P})),this._validate(a.z.layer,`layers.${P}`,h,{arrayIndex:-1},T))return;R=a.bI(h),this._validateLayer(R),R.setEventedParent(this,{layer:{id:P}})}const V=v?this._order.indexOf(v):this._order.length;if(v&&V===-1)this.fire(new a.k(new Error(`Cannot add layer "${P}" before non-existing layer "${v}".`)));else{if(this._order.splice(V,0,P),this._layerOrderChanged=!0,this._layers[P]=R,this._removedLayers[P]&&R.source&&R.type!=="custom"){const Y=this._removedLayers[P];delete this._removedLayers[P],Y.type!==R.type?this._updatedSources[R.source]="clear":(this._updatedSources[R.source]="reload",this.sourceCaches[R.source].pause())}this._updateLayer(R),R.onAdd&&R.onAdd(this.map)}}moveLayer(h,v){if(this._checkLoaded(),this._changed=!0,!this._layers[h])return void this.fire(new a.k(new Error(`The layer '${h}' does not exist in the map's style and cannot be moved.`)));if(h===v)return;const T=this._order.indexOf(h);this._order.splice(T,1);const P=v?this._order.indexOf(v):this._order.length;v&&P===-1?this.fire(new a.k(new Error(`Cannot move layer "${h}" before non-existing layer "${v}".`))):(this._order.splice(P,0,h),this._layerOrderChanged=!0)}removeLayer(h){this._checkLoaded();const v=this._layers[h];if(!v)return void this.fire(new a.k(new Error(`Cannot remove non-existing layer "${h}".`)));v.setEventedParent(null);const T=this._order.indexOf(h);this._order.splice(T,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[h]=v,delete this._layers[h],this._serializedLayers&&delete this._serializedLayers[h],delete this._updatedLayers[h],delete this._updatedPaintProps[h],v.onRemove&&v.onRemove(this.map)}getLayer(h){return this._layers[h]}getLayersOrder(){return[...this._order]}hasLayer(h){return h in this._layers}setLayerZoomRange(h,v,T){this._checkLoaded();const P=this.getLayer(h);P?P.minzoom===v&&P.maxzoom===T||(v!=null&&(P.minzoom=v),T!=null&&(P.maxzoom=T),this._updateLayer(P)):this.fire(new a.k(new Error(`Cannot set the zoom range of non-existing layer "${h}".`)))}setFilter(h,v,T={}){this._checkLoaded();const P=this.getLayer(h);if(P){if(!a.bG(P.filter,v))return v==null?(P.setFilter(void 0),void this._updateLayer(P)):void(this._validate(a.z.filter,`layers.${P.id}.filter`,v,null,T)||(P.setFilter(a.bJ(v)),this._updateLayer(P)))}else this.fire(new a.k(new Error(`Cannot filter non-existing layer "${h}".`)))}getFilter(h){return a.bJ(this.getLayer(h).filter)}setLayoutProperty(h,v,T,P={}){this._checkLoaded();const R=this.getLayer(h);R?a.bG(R.getLayoutProperty(v),T)||(R.setLayoutProperty(v,T,P),this._updateLayer(R)):this.fire(new a.k(new Error(`Cannot style non-existing layer "${h}".`)))}getLayoutProperty(h,v){const T=this.getLayer(h);if(T)return T.getLayoutProperty(v);this.fire(new a.k(new Error(`Cannot get style of non-existing layer "${h}".`)))}setPaintProperty(h,v,T,P={}){this._checkLoaded();const R=this.getLayer(h);R?a.bG(R.getPaintProperty(v),T)||(R.setPaintProperty(v,T,P)&&this._updateLayer(R),this._changed=!0,this._updatedPaintProps[h]=!0,this._serializedLayers=null):this.fire(new a.k(new Error(`Cannot style non-existing layer "${h}".`)))}getPaintProperty(h,v){return this.getLayer(h).getPaintProperty(v)}setFeatureState(h,v){this._checkLoaded();const T=h.source,P=h.sourceLayer,R=this.sourceCaches[T];if(R===void 0)return void this.fire(new a.k(new Error(`The source '${T}' does not exist in the map's style.`)));const V=R.getSource().type;V==="geojson"&&P?this.fire(new a.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):V!=="vector"||P?(h.id===void 0&&this.fire(new a.k(new Error("The feature id parameter must be provided."))),R.setFeatureState(P,h.id,v)):this.fire(new a.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(h,v){this._checkLoaded();const T=h.source,P=this.sourceCaches[T];if(P===void 0)return void this.fire(new a.k(new Error(`The source '${T}' does not exist in the map's style.`)));const R=P.getSource().type,V=R==="vector"?h.sourceLayer:void 0;R!=="vector"||V?v&&typeof h.id!="string"&&typeof h.id!="number"?this.fire(new a.k(new Error("A feature id is required to remove its specific state property."))):P.removeFeatureState(V,h.id,v):this.fire(new a.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(h){this._checkLoaded();const v=h.source,T=h.sourceLayer,P=this.sourceCaches[v];if(P!==void 0)return P.getSource().type!=="vector"||T?(h.id===void 0&&this.fire(new a.k(new Error("The feature id parameter must be provided."))),P.getFeatureState(T,h.id)):void this.fire(new a.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new a.k(new Error(`The source '${v}' does not exist in the map's style.`)))}getTransition(){return a.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const h=a.bM(this.sourceCaches,R=>R.serialize()),v=this._serializeByIds(this._order,!0),T=this.map.getTerrain()||void 0,P=this.stylesheet;return a.bN({version:P.version,name:P.name,metadata:P.metadata,light:P.light,sky:P.sky,center:P.center,zoom:P.zoom,bearing:P.bearing,pitch:P.pitch,sprite:P.sprite,glyphs:P.glyphs,transition:P.transition,projection:P.projection,sources:h,layers:v,terrain:T},R=>R!==void 0)}_updateLayer(h){this._updatedLayers[h.id]=!0,h.source&&!this._updatedSources[h.source]&&this.sourceCaches[h.source].getSource().type!=="raster"&&(this._updatedSources[h.source]="reload",this.sourceCaches[h.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(h){const v=V=>this._layers[V].type==="fill-extrusion",T={},P=[];for(let V=this._order.length-1;V>=0;V--){const Y=this._order[V];if(v(Y)){T[Y]=V;for(const K of h){const te=K[Y];if(te)for(const ie of te)P.push(ie)}}}P.sort((V,Y)=>Y.intersectionZ-V.intersectionZ);const R=[];for(let V=this._order.length-1;V>=0;V--){const Y=this._order[V];if(v(Y))for(let K=P.length-1;K>=0;K--){const te=P[K].feature;if(T[te.layer.id]this.map.terrain.getElevation(ie,ce,ae):void 0));return this.placement&&R.push(function(te,ie,ce,ae,fe,_e,Me){const Te={},Ae=_e.queryRenderedSymbols(ae),Pe=[];for(const Fe of Object.keys(Ae).map(Number))Pe.push(Me[Fe]);Pe.sort(yt);for(const Fe of Pe){const De=Fe.featureIndex.lookupSymbolFeatures(Ae[Fe.bucketInstanceId],ie,Fe.bucketIndex,Fe.sourceLayerIndex,fe.filter,fe.layers,fe.availableImages,te);for(const je in De){const Ge=Te[je]=Te[je]||[],Re=De[je];Re.sort((Je,ct)=>{const rt=Fe.featureSortOrder;if(rt){const ot=rt.indexOf(Je.featureIndex);return rt.indexOf(ct.featureIndex)-ot}return ct.featureIndex-Je.featureIndex});for(const Je of Re)Ge.push(Je)}}return function(Fe,De,je){for(const Ge in Fe)for(const Re of Fe[Ge])Lt(Re,je[De[Ge].source]);return Fe}(Te,te,ce)}(this._layers,V,this.sourceCaches,h,K,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(R)}querySourceFeatures(h,v){v&&v.filter&&this._validate(a.z.filter,"querySourceFeatures.filter",v.filter,null,v);const T=this.sourceCaches[h];return T?function(P,R){const V=P.getRenderableIds().map(te=>P.getTileByID(te)),Y=[],K={};for(let te=0;teae.getTileByID(fe)).sort((fe,_e)=>_e.tileID.overscaledZ-fe.tileID.overscaledZ||(fe.tileID.isLessThan(_e.tileID)?-1:1))}const ce=this.crossTileSymbolIndex.addLayer(ie,K[ie.source],h.center.lng);V=V||ce}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((R=R||this._layerOrderChanged||T===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(p.now(),h.zoom))&&(this.pauseablePlacement=new CM(h,this.map.terrain,this._order,R,v,T,P,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,K),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(p.now()),Y=!0),V&&this.pauseablePlacement.placement.setStale()),Y||V)for(const te of this._order){const ie=this._layers[te];ie.type==="symbol"&&this.placement.updateLayerOpacities(ie,K[ie.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(p.now())}_releaseSymbolFadeTiles(){for(const h in this.sourceCaches)this.sourceCaches[h].releaseSymbolFadeTiles()}getImages(h,v){return a._(this,void 0,void 0,function*(){const T=yield this.imageManager.getImages(v.icons);this._updateTilesForChangedImages();const P=this.sourceCaches[v.source];return P&&P.setDependencies(v.tileID.key,v.type,v.icons),T})}getGlyphs(h,v){return a._(this,void 0,void 0,function*(){const T=yield this.glyphManager.getGlyphs(v.stacks),P=this.sourceCaches[v.source];return P&&P.setDependencies(v.tileID.key,v.type,[""]),T})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(h,v={}){this._checkLoaded(),h&&this._validate(a.z.glyphs,"glyphs",h,null,v)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=h,this.glyphManager.entries={},this.glyphManager.setURL(h))}addSprite(h,v,T={},P){this._checkLoaded();const R=[{id:h,url:v}],V=[...I(this.stylesheet.sprite),...R];this._validate(a.z.sprite,"sprite",V,null,T)||(this.stylesheet.sprite=V,this._loadSprite(R,!0,P))}removeSprite(h){this._checkLoaded();const v=I(this.stylesheet.sprite);if(v.find(T=>T.id===h)){if(this._spritesImagesIds[h])for(const T of this._spritesImagesIds[h])this.imageManager.removeImage(T),this._changedImages[T]=!0;v.splice(v.findIndex(T=>T.id===h),1),this.stylesheet.sprite=v.length>0?v:void 0,delete this._spritesImagesIds[h],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new a.l("data",{dataType:"style"}))}else this.fire(new a.k(new Error(`Sprite "${h}" doesn't exists on this map.`)))}getSprite(){return I(this.stylesheet.sprite)}setSprite(h,v={},T){this._checkLoaded(),h&&this._validate(a.z.sprite,"sprite",h,null,v)||(this.stylesheet.sprite=h,h?this._loadSprite(h,!0,T):(this._unloadSprite(),T&&T(null)))}}var OR=a.aI([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class DR{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(h,v,T,P,R,V,Y,K,te){this.context=h;let ie=this.boundPaintVertexBuffers.length!==P.length;for(let ce=0;!ie&&ce({u_texture:0,u_ele_delta:D,u_fog_matrix:h,u_fog_color:v?v.properties.get("fog-color"):a.be.white,u_fog_ground_blend:v?v.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:P?0:v?v.calculateFogBlendOpacity(T):0,u_horizon_color:v?v.properties.get("horizon-color"):a.be.white,u_horizon_fog_blend:v?v.properties.get("horizon-fog-blend"):1,u_is_globe_mode:P?1:0}),BR={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function v_(D){const h=[];for(let v=0;v({u_depth:new a.bO(rt,ot.u_depth),u_terrain:new a.bO(rt,ot.u_terrain),u_terrain_dim:new a.bf(rt,ot.u_terrain_dim),u_terrain_matrix:new a.bQ(rt,ot.u_terrain_matrix),u_terrain_unpack:new a.bR(rt,ot.u_terrain_unpack),u_terrain_exaggeration:new a.bf(rt,ot.u_terrain_exaggeration)}))(h,ct),this.projectionUniforms=((rt,ot)=>({u_projection_matrix:new a.bQ(rt,ot.u_projection_matrix),u_projection_tile_mercator_coords:new a.bR(rt,ot.u_projection_tile_mercator_coords),u_projection_clipping_plane:new a.bR(rt,ot.u_projection_clipping_plane),u_projection_transition:new a.bf(rt,ot.u_projection_transition),u_projection_fallback_matrix:new a.bQ(rt,ot.u_projection_fallback_matrix)}))(h,ct),this.binderUniforms=T?T.getUniforms(h,ct):[]}draw(h,v,T,P,R,V,Y,K,te,ie,ce,ae,fe,_e,Me,Te,Ae,Pe,Fe){const De=h.gl;if(this.failedToCreate)return;if(h.program.set(this.program),h.setDepthMode(T),h.setStencilMode(P),h.setColorMode(R),h.setCullFace(V),K){h.activeTexture.set(De.TEXTURE2),De.bindTexture(De.TEXTURE_2D,K.depthTexture),h.activeTexture.set(De.TEXTURE3),De.bindTexture(De.TEXTURE_2D,K.texture);for(const Ge in this.terrainUniforms)this.terrainUniforms[Ge].set(K[Ge])}if(te)for(const Ge in te)this.projectionUniforms[BR[Ge]].set(te[Ge]);if(Y)for(const Ge in this.fixedUniforms)this.fixedUniforms[Ge].set(Y[Ge]);Te&&Te.setUniforms(h,this.binderUniforms,_e,{zoom:Me});let je=0;switch(v){case De.LINES:je=2;break;case De.TRIANGLES:je=3;break;case De.LINE_STRIP:je=1}for(const Ge of fe.get()){const Re=Ge.vaos||(Ge.vaos={});(Re[ie]||(Re[ie]=new DR)).bind(h,this,ce,Te?Te.getPaintVertexBuffers():[],ae,Ge.vertexOffset,Ae,Pe,Fe),De.drawElements(v,Ge.primitiveLength*je,De.UNSIGNED_SHORT,Ge.primitiveOffset*je*2)}}}function b_(D,h,v){const T=1/a.aB(v,1,h.transform.tileZoom),P=Math.pow(2,v.tileID.overscaledZ),R=v.tileSize*Math.pow(2,h.transform.tileZoom)/P,V=R*(v.tileID.canonical.x+v.tileID.wrap*P),Y=R*v.tileID.canonical.y;return{u_image:0,u_texsize:v.imageAtlasTexture.size,u_scale:[T,D.fromScale,D.toScale],u_fade:D.t,u_pixel_coord_upper:[V>>16,Y>>16],u_pixel_coord_lower:[65535&V,65535&Y]}}const Py=(D,h,v,T)=>{const P=D.style.light,R=P.properties.get("position"),V=[R.x,R.y,R.z],Y=a.bU();P.properties.get("anchor")==="viewport"&&a.bV(Y,D.transform.bearingInRadians),a.bW(V,V,Y);const K=D.transform.transformLightDirection(V),te=P.properties.get("color");return{u_lightpos:V,u_lightpos_globe:K,u_lightintensity:P.properties.get("intensity"),u_lightcolor:[te.r,te.g,te.b],u_vertical_gradient:+h,u_opacity:v,u_fill_translate:T}},px=(D,h,v,T,P,R,V)=>a.e(Py(D,h,v,T),b_(R,D,V),{u_height_factor:-Math.pow(2,P.overscaledZ)/V.tileSize/8}),w_=(D,h,v,T)=>a.e(b_(h,D,v),{u_fill_translate:T}),Uu=(D,h)=>({u_world:D,u_fill_translate:h}),FR=(D,h,v,T,P)=>a.e(w_(D,h,v,P),{u_world:T}),mx=(D,h,v,T,P)=>{const R=D.transform;let V,Y,K=0;if(v.paint.get("circle-pitch-alignment")==="map"){const te=a.aB(h,1,R.zoom);V=!0,Y=[te,te],K=te/(a.$*Math.pow(2,h.tileID.overscaledZ))*2*Math.PI*P}else V=!1,Y=R.pixelsToGLUnits;return{u_camera_to_center_distance:R.cameraToCenterDistance,u_scale_with_map:+(v.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+V,u_device_pixel_ratio:D.pixelRatio,u_extrude_scale:Y,u_globe_extrude_scale:K,u_translate:T}},Ny=D=>({u_pixel_extrude_scale:[1/D.width,1/D.height]}),Oy=D=>({u_viewport_size:[D.width,D.height]}),AM=(D,h=1)=>({u_color:D,u_overlay:0,u_overlay_scale:h}),Dy=(D,h,v,T)=>{const P=a.aB(D,1,h)/(a.$*Math.pow(2,D.tileID.overscaledZ))*2*Math.PI*T;return{u_extrude_scale:a.aB(D,1,h),u_intensity:v,u_globe_extrude_scale:P}},IM=(D,h,v,T)=>{const P=a.L();a.bX(P,0,D.width,D.height,0,0,1);const R=D.context.gl;return{u_matrix:P,u_world:[R.drawingBufferWidth,R.drawingBufferHeight],u_image:v,u_color_ramp:T,u_opacity:h.paint.get("heatmap-opacity")}},Em=(D,h,v)=>{const T=v.paint.get("hillshade-accent-color");let P;switch(v.paint.get("hillshade-method")){case"basic":P=4;break;case"combined":P=1;break;case"igor":P=2;break;case"multidirectional":P=3;break;default:P=0}const R=v.getIlluminationProperties();for(let V=0;V{const v=h.stride,T=a.L();return a.bX(T,0,a.$,-8192,0,0,1),a.M(T,T,[0,-8192,0]),{u_matrix:T,u_image:1,u_dimension:[v,v],u_zoom:D.overscaledZ,u_unpack:h.getUnpackVector()}};function LM(D,h){const v=Math.pow(2,h.canonical.z),T=h.canonical.y;return[new a.a0(0,T/v).toLngLat().lat,new a.a0(0,(T+1)/v).toLngLat().lat]}const zR=(D,h)=>({u_image:0,u_unpack:h.getUnpackVector(),u_dimension:[h.stride,h.stride],u_elevation_stops:1,u_color_stops:4,u_opacity:D.paint.get("color-relief-opacity")}),x_=(D,h,v,T)=>{const P=D.transform;return{u_translation:vx(D,h,v),u_ratio:T/a.aB(h,1,P.zoom),u_device_pixel_ratio:D.pixelRatio,u_units_to_pixels:[1/P.pixelsToGLUnits[0],1/P.pixelsToGLUnits[1]]}},gx=(D,h,v,T,P)=>a.e(x_(D,h,v,T),{u_image:0,u_image_height:P}),PM=(D,h,v,T,P)=>{const R=D.transform,V=yx(h,R);return{u_translation:vx(D,h,v),u_texsize:h.imageAtlasTexture.size,u_ratio:T/a.aB(h,1,R.zoom),u_device_pixel_ratio:D.pixelRatio,u_image:0,u_scale:[V,P.fromScale,P.toScale],u_fade:P.t,u_units_to_pixels:[1/R.pixelsToGLUnits[0],1/R.pixelsToGLUnits[1]]}},NM=(D,h,v,T,P,R)=>{const V=D.lineAtlas,Y=yx(h,D.transform),K=v.layout.get("line-cap")==="round",te=V.getDash(P.from,K),ie=V.getDash(P.to,K),ce=te.width*R.fromScale,ae=ie.width*R.toScale;return a.e(x_(D,h,v,T),{u_patternscale_a:[Y/ce,-te.height/2],u_patternscale_b:[Y/ae,-ie.height/2],u_sdfgamma:V.width/(256*Math.min(ce,ae)*D.pixelRatio)/2,u_image:0,u_tex_y_a:te.y,u_tex_y_b:ie.y,u_mix:R.t})};function yx(D,h){return 1/a.aB(D,1,h.tileZoom)}function vx(D,h,v){return a.aC(D.transform,h,v.paint.get("line-translate"),v.paint.get("line-translate-anchor"))}const Xf=(D,h,v,T,P)=>{return{u_tl_parent:D,u_scale_parent:h,u_buffer_scale:1,u_fade_t:v.mix,u_opacity:v.opacity*T.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:T.paint.get("raster-brightness-min"),u_brightness_high:T.paint.get("raster-brightness-max"),u_saturation_factor:(V=T.paint.get("raster-saturation"),V>0?1-1/(1.001-V):-V),u_contrast_factor:(R=T.paint.get("raster-contrast"),R>0?1/(1-R):1+R),u_spin_weights:OM(T.paint.get("raster-hue-rotate")),u_coords_top:[P[0].x,P[0].y,P[1].x,P[1].y],u_coords_bottom:[P[3].x,P[3].y,P[2].x,P[2].y]};var R,V};function OM(D){D*=Math.PI/180;const h=Math.sin(D),v=Math.cos(D);return[(2*v+1)/3,(-Math.sqrt(3)*h-v+1)/3,(Math.sqrt(3)*h-v+1)/3]}const _x=(D,h,v,T,P,R,V,Y,K,te,ie,ce,ae)=>{const fe=V.transform;return{u_is_size_zoom_constant:+(D==="constant"||D==="source"),u_is_size_feature_constant:+(D==="constant"||D==="camera"),u_size_t:h?h.uSizeT:0,u_size:h?h.uSize:0,u_camera_to_center_distance:fe.cameraToCenterDistance,u_pitch:fe.pitch/360*2*Math.PI,u_rotate_symbol:+v,u_aspect_ratio:fe.width/fe.height,u_fade_change:V.options.fadeDuration?V.symbolFadeChange:1,u_label_plane_matrix:Y,u_coord_matrix:K,u_is_text:+ie,u_pitch_with_map:+T,u_is_along_line:P,u_is_variable_anchor:R,u_texsize:ce,u_texture:0,u_translation:te,u_pitched_scale:ae}},Sm=(D,h,v,T,P,R,V,Y,K,te,ie,ce,ae,fe)=>{const _e=V.transform;return a.e(_x(D,h,v,T,P,R,V,Y,K,te,ie,ce,fe),{u_gamma_scale:T?Math.cos(_e.pitch*Math.PI/180)*_e.cameraToCenterDistance:1,u_device_pixel_ratio:V.pixelRatio,u_is_halo:1})},VR=(D,h,v,T,P,R,V,Y,K,te,ie,ce,ae)=>a.e(Sm(D,h,v,T,P,R,V,Y,K,te,!0,ie,0,ae),{u_texsize_icon:ce,u_texture_icon:1}),E_=(D,h)=>({u_opacity:D,u_color:h}),jR=(D,h,v,T,P)=>a.e(function(R,V,Y,K){const te=Y.imageManager.getPattern(R.from.toString()),ie=Y.imageManager.getPattern(R.to.toString()),{width:ce,height:ae}=Y.imageManager.getPixelSize(),fe=Math.pow(2,K.tileID.overscaledZ),_e=K.tileSize*Math.pow(2,Y.transform.tileZoom)/fe,Me=_e*(K.tileID.canonical.x+K.tileID.wrap*fe),Te=_e*K.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:te.tl,u_pattern_br_a:te.br,u_pattern_tl_b:ie.tl,u_pattern_br_b:ie.br,u_texsize:[ce,ae],u_mix:V.t,u_pattern_size_a:te.displaySize,u_pattern_size_b:ie.displaySize,u_scale_a:V.fromScale,u_scale_b:V.toScale,u_tile_units_to_pixels:1/a.aB(K,1,Y.transform.tileZoom),u_pixel_coord_upper:[Me>>16,Te>>16],u_pixel_coord_lower:[65535&Me,65535&Te]}}(v,P,h,T),{u_opacity:D}),DM=(D,h)=>{},RM={fillExtrusion:(D,h)=>({u_lightpos:new a.bS(D,h.u_lightpos),u_lightpos_globe:new a.bS(D,h.u_lightpos_globe),u_lightintensity:new a.bf(D,h.u_lightintensity),u_lightcolor:new a.bS(D,h.u_lightcolor),u_vertical_gradient:new a.bf(D,h.u_vertical_gradient),u_opacity:new a.bf(D,h.u_opacity),u_fill_translate:new a.bT(D,h.u_fill_translate)}),fillExtrusionPattern:(D,h)=>({u_lightpos:new a.bS(D,h.u_lightpos),u_lightpos_globe:new a.bS(D,h.u_lightpos_globe),u_lightintensity:new a.bf(D,h.u_lightintensity),u_lightcolor:new a.bS(D,h.u_lightcolor),u_vertical_gradient:new a.bf(D,h.u_vertical_gradient),u_height_factor:new a.bf(D,h.u_height_factor),u_opacity:new a.bf(D,h.u_opacity),u_fill_translate:new a.bT(D,h.u_fill_translate),u_image:new a.bO(D,h.u_image),u_texsize:new a.bT(D,h.u_texsize),u_pixel_coord_upper:new a.bT(D,h.u_pixel_coord_upper),u_pixel_coord_lower:new a.bT(D,h.u_pixel_coord_lower),u_scale:new a.bS(D,h.u_scale),u_fade:new a.bf(D,h.u_fade)}),fill:(D,h)=>({u_fill_translate:new a.bT(D,h.u_fill_translate)}),fillPattern:(D,h)=>({u_image:new a.bO(D,h.u_image),u_texsize:new a.bT(D,h.u_texsize),u_pixel_coord_upper:new a.bT(D,h.u_pixel_coord_upper),u_pixel_coord_lower:new a.bT(D,h.u_pixel_coord_lower),u_scale:new a.bS(D,h.u_scale),u_fade:new a.bf(D,h.u_fade),u_fill_translate:new a.bT(D,h.u_fill_translate)}),fillOutline:(D,h)=>({u_world:new a.bT(D,h.u_world),u_fill_translate:new a.bT(D,h.u_fill_translate)}),fillOutlinePattern:(D,h)=>({u_world:new a.bT(D,h.u_world),u_image:new a.bO(D,h.u_image),u_texsize:new a.bT(D,h.u_texsize),u_pixel_coord_upper:new a.bT(D,h.u_pixel_coord_upper),u_pixel_coord_lower:new a.bT(D,h.u_pixel_coord_lower),u_scale:new a.bS(D,h.u_scale),u_fade:new a.bf(D,h.u_fade),u_fill_translate:new a.bT(D,h.u_fill_translate)}),circle:(D,h)=>({u_camera_to_center_distance:new a.bf(D,h.u_camera_to_center_distance),u_scale_with_map:new a.bO(D,h.u_scale_with_map),u_pitch_with_map:new a.bO(D,h.u_pitch_with_map),u_extrude_scale:new a.bT(D,h.u_extrude_scale),u_device_pixel_ratio:new a.bf(D,h.u_device_pixel_ratio),u_globe_extrude_scale:new a.bf(D,h.u_globe_extrude_scale),u_translate:new a.bT(D,h.u_translate)}),collisionBox:(D,h)=>({u_pixel_extrude_scale:new a.bT(D,h.u_pixel_extrude_scale)}),collisionCircle:(D,h)=>({u_viewport_size:new a.bT(D,h.u_viewport_size)}),debug:(D,h)=>({u_color:new a.bP(D,h.u_color),u_overlay:new a.bO(D,h.u_overlay),u_overlay_scale:new a.bf(D,h.u_overlay_scale)}),depth:DM,clippingMask:DM,heatmap:(D,h)=>({u_extrude_scale:new a.bf(D,h.u_extrude_scale),u_intensity:new a.bf(D,h.u_intensity),u_globe_extrude_scale:new a.bf(D,h.u_globe_extrude_scale)}),heatmapTexture:(D,h)=>({u_matrix:new a.bQ(D,h.u_matrix),u_world:new a.bT(D,h.u_world),u_image:new a.bO(D,h.u_image),u_color_ramp:new a.bO(D,h.u_color_ramp),u_opacity:new a.bf(D,h.u_opacity)}),hillshade:(D,h)=>({u_image:new a.bO(D,h.u_image),u_latrange:new a.bT(D,h.u_latrange),u_exaggeration:new a.bf(D,h.u_exaggeration),u_altitudes:new a.bZ(D,h.u_altitudes),u_azimuths:new a.bZ(D,h.u_azimuths),u_accent:new a.bP(D,h.u_accent),u_method:new a.bO(D,h.u_method),u_shadows:new a.bY(D,h.u_shadows),u_highlights:new a.bY(D,h.u_highlights)}),hillshadePrepare:(D,h)=>({u_matrix:new a.bQ(D,h.u_matrix),u_image:new a.bO(D,h.u_image),u_dimension:new a.bT(D,h.u_dimension),u_zoom:new a.bf(D,h.u_zoom),u_unpack:new a.bR(D,h.u_unpack)}),colorRelief:(D,h)=>({u_image:new a.bO(D,h.u_image),u_unpack:new a.bR(D,h.u_unpack),u_dimension:new a.bT(D,h.u_dimension),u_elevation_stops:new a.bO(D,h.u_elevation_stops),u_color_stops:new a.bO(D,h.u_color_stops),u_opacity:new a.bf(D,h.u_opacity)}),line:(D,h)=>({u_translation:new a.bT(D,h.u_translation),u_ratio:new a.bf(D,h.u_ratio),u_device_pixel_ratio:new a.bf(D,h.u_device_pixel_ratio),u_units_to_pixels:new a.bT(D,h.u_units_to_pixels)}),lineGradient:(D,h)=>({u_translation:new a.bT(D,h.u_translation),u_ratio:new a.bf(D,h.u_ratio),u_device_pixel_ratio:new a.bf(D,h.u_device_pixel_ratio),u_units_to_pixels:new a.bT(D,h.u_units_to_pixels),u_image:new a.bO(D,h.u_image),u_image_height:new a.bf(D,h.u_image_height)}),linePattern:(D,h)=>({u_translation:new a.bT(D,h.u_translation),u_texsize:new a.bT(D,h.u_texsize),u_ratio:new a.bf(D,h.u_ratio),u_device_pixel_ratio:new a.bf(D,h.u_device_pixel_ratio),u_image:new a.bO(D,h.u_image),u_units_to_pixels:new a.bT(D,h.u_units_to_pixels),u_scale:new a.bS(D,h.u_scale),u_fade:new a.bf(D,h.u_fade)}),lineSDF:(D,h)=>({u_translation:new a.bT(D,h.u_translation),u_ratio:new a.bf(D,h.u_ratio),u_device_pixel_ratio:new a.bf(D,h.u_device_pixel_ratio),u_units_to_pixels:new a.bT(D,h.u_units_to_pixels),u_patternscale_a:new a.bT(D,h.u_patternscale_a),u_patternscale_b:new a.bT(D,h.u_patternscale_b),u_sdfgamma:new a.bf(D,h.u_sdfgamma),u_image:new a.bO(D,h.u_image),u_tex_y_a:new a.bf(D,h.u_tex_y_a),u_tex_y_b:new a.bf(D,h.u_tex_y_b),u_mix:new a.bf(D,h.u_mix)}),raster:(D,h)=>({u_tl_parent:new a.bT(D,h.u_tl_parent),u_scale_parent:new a.bf(D,h.u_scale_parent),u_buffer_scale:new a.bf(D,h.u_buffer_scale),u_fade_t:new a.bf(D,h.u_fade_t),u_opacity:new a.bf(D,h.u_opacity),u_image0:new a.bO(D,h.u_image0),u_image1:new a.bO(D,h.u_image1),u_brightness_low:new a.bf(D,h.u_brightness_low),u_brightness_high:new a.bf(D,h.u_brightness_high),u_saturation_factor:new a.bf(D,h.u_saturation_factor),u_contrast_factor:new a.bf(D,h.u_contrast_factor),u_spin_weights:new a.bS(D,h.u_spin_weights),u_coords_top:new a.bR(D,h.u_coords_top),u_coords_bottom:new a.bR(D,h.u_coords_bottom)}),symbolIcon:(D,h)=>({u_is_size_zoom_constant:new a.bO(D,h.u_is_size_zoom_constant),u_is_size_feature_constant:new a.bO(D,h.u_is_size_feature_constant),u_size_t:new a.bf(D,h.u_size_t),u_size:new a.bf(D,h.u_size),u_camera_to_center_distance:new a.bf(D,h.u_camera_to_center_distance),u_pitch:new a.bf(D,h.u_pitch),u_rotate_symbol:new a.bO(D,h.u_rotate_symbol),u_aspect_ratio:new a.bf(D,h.u_aspect_ratio),u_fade_change:new a.bf(D,h.u_fade_change),u_label_plane_matrix:new a.bQ(D,h.u_label_plane_matrix),u_coord_matrix:new a.bQ(D,h.u_coord_matrix),u_is_text:new a.bO(D,h.u_is_text),u_pitch_with_map:new a.bO(D,h.u_pitch_with_map),u_is_along_line:new a.bO(D,h.u_is_along_line),u_is_variable_anchor:new a.bO(D,h.u_is_variable_anchor),u_texsize:new a.bT(D,h.u_texsize),u_texture:new a.bO(D,h.u_texture),u_translation:new a.bT(D,h.u_translation),u_pitched_scale:new a.bf(D,h.u_pitched_scale)}),symbolSDF:(D,h)=>({u_is_size_zoom_constant:new a.bO(D,h.u_is_size_zoom_constant),u_is_size_feature_constant:new a.bO(D,h.u_is_size_feature_constant),u_size_t:new a.bf(D,h.u_size_t),u_size:new a.bf(D,h.u_size),u_camera_to_center_distance:new a.bf(D,h.u_camera_to_center_distance),u_pitch:new a.bf(D,h.u_pitch),u_rotate_symbol:new a.bO(D,h.u_rotate_symbol),u_aspect_ratio:new a.bf(D,h.u_aspect_ratio),u_fade_change:new a.bf(D,h.u_fade_change),u_label_plane_matrix:new a.bQ(D,h.u_label_plane_matrix),u_coord_matrix:new a.bQ(D,h.u_coord_matrix),u_is_text:new a.bO(D,h.u_is_text),u_pitch_with_map:new a.bO(D,h.u_pitch_with_map),u_is_along_line:new a.bO(D,h.u_is_along_line),u_is_variable_anchor:new a.bO(D,h.u_is_variable_anchor),u_texsize:new a.bT(D,h.u_texsize),u_texture:new a.bO(D,h.u_texture),u_gamma_scale:new a.bf(D,h.u_gamma_scale),u_device_pixel_ratio:new a.bf(D,h.u_device_pixel_ratio),u_is_halo:new a.bO(D,h.u_is_halo),u_translation:new a.bT(D,h.u_translation),u_pitched_scale:new a.bf(D,h.u_pitched_scale)}),symbolTextAndIcon:(D,h)=>({u_is_size_zoom_constant:new a.bO(D,h.u_is_size_zoom_constant),u_is_size_feature_constant:new a.bO(D,h.u_is_size_feature_constant),u_size_t:new a.bf(D,h.u_size_t),u_size:new a.bf(D,h.u_size),u_camera_to_center_distance:new a.bf(D,h.u_camera_to_center_distance),u_pitch:new a.bf(D,h.u_pitch),u_rotate_symbol:new a.bO(D,h.u_rotate_symbol),u_aspect_ratio:new a.bf(D,h.u_aspect_ratio),u_fade_change:new a.bf(D,h.u_fade_change),u_label_plane_matrix:new a.bQ(D,h.u_label_plane_matrix),u_coord_matrix:new a.bQ(D,h.u_coord_matrix),u_is_text:new a.bO(D,h.u_is_text),u_pitch_with_map:new a.bO(D,h.u_pitch_with_map),u_is_along_line:new a.bO(D,h.u_is_along_line),u_is_variable_anchor:new a.bO(D,h.u_is_variable_anchor),u_texsize:new a.bT(D,h.u_texsize),u_texsize_icon:new a.bT(D,h.u_texsize_icon),u_texture:new a.bO(D,h.u_texture),u_texture_icon:new a.bO(D,h.u_texture_icon),u_gamma_scale:new a.bf(D,h.u_gamma_scale),u_device_pixel_ratio:new a.bf(D,h.u_device_pixel_ratio),u_is_halo:new a.bO(D,h.u_is_halo),u_translation:new a.bT(D,h.u_translation),u_pitched_scale:new a.bf(D,h.u_pitched_scale)}),background:(D,h)=>({u_opacity:new a.bf(D,h.u_opacity),u_color:new a.bP(D,h.u_color)}),backgroundPattern:(D,h)=>({u_opacity:new a.bf(D,h.u_opacity),u_image:new a.bO(D,h.u_image),u_pattern_tl_a:new a.bT(D,h.u_pattern_tl_a),u_pattern_br_a:new a.bT(D,h.u_pattern_br_a),u_pattern_tl_b:new a.bT(D,h.u_pattern_tl_b),u_pattern_br_b:new a.bT(D,h.u_pattern_br_b),u_texsize:new a.bT(D,h.u_texsize),u_mix:new a.bf(D,h.u_mix),u_pattern_size_a:new a.bT(D,h.u_pattern_size_a),u_pattern_size_b:new a.bT(D,h.u_pattern_size_b),u_scale_a:new a.bf(D,h.u_scale_a),u_scale_b:new a.bf(D,h.u_scale_b),u_pixel_coord_upper:new a.bT(D,h.u_pixel_coord_upper),u_pixel_coord_lower:new a.bT(D,h.u_pixel_coord_lower),u_tile_units_to_pixels:new a.bf(D,h.u_tile_units_to_pixels)}),terrain:(D,h)=>({u_texture:new a.bO(D,h.u_texture),u_ele_delta:new a.bf(D,h.u_ele_delta),u_fog_matrix:new a.bQ(D,h.u_fog_matrix),u_fog_color:new a.bP(D,h.u_fog_color),u_fog_ground_blend:new a.bf(D,h.u_fog_ground_blend),u_fog_ground_blend_opacity:new a.bf(D,h.u_fog_ground_blend_opacity),u_horizon_color:new a.bP(D,h.u_horizon_color),u_horizon_fog_blend:new a.bf(D,h.u_horizon_fog_blend),u_is_globe_mode:new a.bf(D,h.u_is_globe_mode)}),terrainDepth:(D,h)=>({u_ele_delta:new a.bf(D,h.u_ele_delta)}),terrainCoords:(D,h)=>({u_texture:new a.bO(D,h.u_texture),u_terrain_coords_id:new a.bf(D,h.u_terrain_coords_id),u_ele_delta:new a.bf(D,h.u_ele_delta)}),projectionErrorMeasurement:(D,h)=>({u_input:new a.bf(D,h.u_input),u_output_expected:new a.bf(D,h.u_output_expected)}),atmosphere:(D,h)=>({u_sun_pos:new a.bS(D,h.u_sun_pos),u_atmosphere_blend:new a.bf(D,h.u_atmosphere_blend),u_globe_position:new a.bS(D,h.u_globe_position),u_globe_radius:new a.bf(D,h.u_globe_radius),u_inv_proj_matrix:new a.bQ(D,h.u_inv_proj_matrix)}),sky:(D,h)=>({u_sky_color:new a.bP(D,h.u_sky_color),u_horizon_color:new a.bP(D,h.u_horizon_color),u_horizon:new a.bT(D,h.u_horizon),u_horizon_normal:new a.bT(D,h.u_horizon_normal),u_sky_horizon_blend:new a.bf(D,h.u_sky_horizon_blend),u_sky_blend:new a.bf(D,h.u_sky_blend)})};class BM{constructor(h,v,T){this.context=h;const P=h.gl;this.buffer=P.createBuffer(),this.dynamicDraw=!!T,this.context.unbindVAO(),h.bindElementBuffer.set(this.buffer),P.bufferData(P.ELEMENT_ARRAY_BUFFER,v.arrayBuffer,this.dynamicDraw?P.DYNAMIC_DRAW:P.STATIC_DRAW),this.dynamicDraw||delete v.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(h){const v=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),v.bufferSubData(v.ELEMENT_ARRAY_BUFFER,0,h.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const FM={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class bx{constructor(h,v,T,P){this.length=v.length,this.attributes=T,this.itemSize=v.bytesPerElement,this.dynamicDraw=P,this.context=h;const R=h.gl;this.buffer=R.createBuffer(),h.bindVertexBuffer.set(this.buffer),R.bufferData(R.ARRAY_BUFFER,v.arrayBuffer,this.dynamicDraw?R.DYNAMIC_DRAW:R.STATIC_DRAW),this.dynamicDraw||delete v.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(h){if(h.length!==this.length)throw new Error(`Length of new data is ${h.length}, which doesn't match current length of ${this.length}`);const v=this.context.gl;this.bind(),v.bufferSubData(v.ARRAY_BUFFER,0,h.arrayBuffer)}enableAttributes(h,v){for(let T=0;T0&&(te.push({circleArray:je,circleOffset:ce,coord:Pe}),ie+=je.length/4,ce=ie),De&&K.draw(R,Y.LINES,er.disabled,Ln.disabled,D.colorModeForRenderPass(),Zn.disabled,Ny(D.transform),D.style.map.terrain&&D.style.map.terrain.getTerrainData(Pe),V.getProjectionData({overscaledTileID:Pe,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),v.id,De.layoutVertexBuffer,De.indexBuffer,De.segments,null,D.transform.zoom,null,null,De.collisionVertexBuffer)}if(!P||!te.length)return;const ae=D.useProgram("collisionCircle"),fe=new a.b_;fe.resize(4*ie),fe._trim();let _e=0;for(const Ae of te)for(let Pe=0;Pe=0&&(Me[Ae.associatedIconIndex]={shiftedAnchor:kt,angle:Jt})}else Ch(Ae.numGlyphs,fe)}if(K){_e.clear();const Te=D.icon.placedSymbolArray;for(let Ae=0;AeD.style.map.terrain.getElevation(rt,Da,rs):null,Gi=v.layout.get("text-rotation-alignment")==="map";Cs(ut,D,P,Gs,Dd,Ae,te,Gi,rt.toUnwrapped(),Me.width,Me.height,Bd,Io)}const zm=P&&Re||Qy,dl=Pe||zm?GM:Ae?Gs:D.transform.clipSpaceToPixelsMatrix,qc=kt&&v.paint.get(P?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Fd;Fd=kt?ut.iconsInText?VR(Jt.kind,co,Fe,Ae,Pe,zm,D,dl,Rd,Bd,uo,Ws,ct):Sm(Jt.kind,co,Fe,Ae,Pe,zm,D,dl,Rd,Bd,P,uo,0,ct):_x(Jt.kind,co,Fe,Ae,Pe,zm,D,dl,Rd,Bd,P,uo,ct);const rp={program:di,buffers:Rt,uniformValues:Fd,projectionData:Gu,atlasTexture:Oi,atlasTextureIcon:Xr,atlasInterpolation:Pi,atlasInterpolationIcon:Di,isSDF:kt,hasHalo:qc};if(De&&ut.canOverlap){je=!0;const Io=Rt.segments.get();for(const Gi of Io)Je.push({segments:new a.aL([Gi]),sortKey:Gi.sortKey,state:rp,terrainData:Li})}else Je.push({segments:Rt.segments,sortKey:0,state:rp,terrainData:Li})}je&&Je.sort((rt,ot)=>rt.sortKey-ot.sortKey);for(const rt of Je){const ot=rt.state;if(fe.activeTexture.set(_e.TEXTURE0),ot.atlasTexture.bind(ot.atlasInterpolation,_e.CLAMP_TO_EDGE),ot.atlasTextureIcon&&(fe.activeTexture.set(_e.TEXTURE1),ot.atlasTextureIcon&&ot.atlasTextureIcon.bind(ot.atlasInterpolationIcon,_e.CLAMP_TO_EDGE)),ot.isSDF){const ut=ot.uniformValues;ot.hasHalo&&(ut.u_is_halo=1,I_(ot.buffers,rt.segments,v,D,ot.program,Ge,ie,ce,ut,ot.projectionData,rt.terrainData)),ut.u_is_halo=0}I_(ot.buffers,rt.segments,v,D,ot.program,Ge,ie,ce,ot.uniformValues,ot.projectionData,rt.terrainData)}}function I_(D,h,v,T,P,R,V,Y,K,te,ie){const ce=T.context;P.draw(ce,ce.gl.TRIANGLES,R,V,Y,Zn.backCCW,K,ie,te,v.id,D.layoutVertexBuffer,D.indexBuffer,h,v.paint,T.transform.zoom,D.programConfigurations.get(v.id),D.dynamicLayoutVertexBuffer,D.opacityVertexBuffer)}function L_(D,h,v,T,P){const R=D.context,V=R.gl,Y=Ln.disabled,K=new Sr([V.ONE,V.ONE],a.be.transparent,[!0,!0,!0,!0]),te=h.getBucket(v);if(!te)return;const ie=T.key;let ce=v.heatmapFbos.get(ie);ce||(ce=$y(R,h.tileSize,h.tileSize),v.heatmapFbos.set(ie,ce)),R.bindFramebuffer.set(ce.framebuffer),R.viewport.set([0,0,h.tileSize,h.tileSize]),R.clear({color:a.be.transparent});const ae=te.programConfigurations.get(v.id),fe=D.useProgram("heatmap",ae,!P),_e=D.transform.getProjectionData({overscaledTileID:h.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),Me=D.style.map.terrain.getTerrainData(T);fe.draw(R,V.TRIANGLES,er.disabled,Y,K,Zn.disabled,Dy(h,D.transform.zoom,v.paint.get("heatmap-intensity"),1),Me,_e,v.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,v.paint,D.transform.zoom,ae)}function P_(D,h,v,T,P){const R=D.context,V=R.gl,Y=D.transform;R.setColorMode(D.colorModeForRenderPass());const K=N_(R,h),te=v.key,ie=h.heatmapFbos.get(te);if(!ie)return;R.activeTexture.set(V.TEXTURE0),V.bindTexture(V.TEXTURE_2D,ie.colorAttachment.get()),R.activeTexture.set(V.TEXTURE1),K.bind(V.LINEAR,V.CLAMP_TO_EDGE);const ce=Y.getProjectionData({overscaledTileID:v,applyTerrainMatrix:P,applyGlobeMatrix:!T});D.useProgram("heatmapTexture").draw(R,V.TRIANGLES,er.disabled,Ln.disabled,D.colorModeForRenderPass(),Zn.disabled,IM(D,h,0,1),null,ce,h.id,D.rasterBoundsBuffer,D.quadTriangleIndexBuffer,D.rasterBoundsSegments,h.paint,Y.zoom),ie.destroy(),h.heatmapFbos.delete(te)}function $y(D,h,v){var T,P;const R=D.gl,V=R.createTexture();R.bindTexture(R.TEXTURE_2D,V),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_WRAP_S,R.CLAMP_TO_EDGE),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_WRAP_T,R.CLAMP_TO_EDGE),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_MIN_FILTER,R.LINEAR),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_MAG_FILTER,R.LINEAR);const Y=(T=D.HALF_FLOAT)!==null&&T!==void 0?T:R.UNSIGNED_BYTE,K=(P=D.RGBA16F)!==null&&P!==void 0?P:R.RGBA;R.texImage2D(R.TEXTURE_2D,0,K,h,v,0,R.RGBA,Y,null);const te=D.createFramebuffer(h,v,!1,!1);return te.colorAttachment.set(V),te}function N_(D,h){return h.colorRampTexture||(h.colorRampTexture=new a.T(D,h.colorRamp,D.gl.RGBA)),h.colorRampTexture}function Ix(D,h,v,T,P){if(!v||!T||!T.imageAtlas)return;const R=T.imageAtlas.patternPositions;let V=R[v.to.toString()],Y=R[v.from.toString()];if(!V&&Y&&(V=Y),!Y&&V&&(Y=V),!V||!Y){const K=P.getPaintProperty(h);V=R[K],Y=R[K]}V&&Y&&D.setConstantPatternPositions(V,Y)}function zy(D,h,v,T,P,R,V,Y){const K=D.context.gl,te="fill-pattern",ie=v.paint.get(te),ce=ie&&ie.constantOr(1),ae=v.getCrossfadeParameters();let fe,_e,Me,Te,Ae;const Pe=D.transform,Fe=v.paint.get("fill-translate"),De=v.paint.get("fill-translate-anchor");V?(_e=ce&&!v.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",fe=K.LINES):(_e=ce?"fillPattern":"fill",fe=K.TRIANGLES);const je=ie.constantOr(null);for(const Ge of T){const Re=h.getTile(Ge);if(ce&&!Re.patternsLoaded())continue;const Je=Re.getBucket(v);if(!Je)continue;const ct=Je.programConfigurations.get(v.id),rt=D.useProgram(_e,ct),ot=D.style.map.terrain&&D.style.map.terrain.getTerrainData(Ge);ce&&(D.context.activeTexture.set(K.TEXTURE0),Re.imageAtlasTexture.bind(K.LINEAR,K.CLAMP_TO_EDGE),ct.updatePaintBuffers(ae)),Ix(ct,te,je,Re,v);const ut=Pe.getProjectionData({overscaledTileID:Ge,applyGlobeMatrix:!Y,applyTerrainMatrix:!0}),Rt=a.aC(Pe,Re,Fe,De);if(V){Te=Je.indexBuffer2,Ae=Je.segments2;const kt=[K.drawingBufferWidth,K.drawingBufferHeight];Me=_e==="fillOutlinePattern"&&ce?FR(D,ae,Re,kt,Rt):Uu(kt,Rt)}else Te=Je.indexBuffer,Ae=Je.segments,Me=ce?w_(D,ae,Re,Rt):{u_fill_translate:Rt};const Dt=D.stencilModeForClipping(Ge);rt.draw(D.context,fe,P,Dt,R,Zn.backCCW,Me,ot,ut,v.id,Je.layoutVertexBuffer,Te,Ae,v.paint,D.transform.zoom,ct)}}function Am(D,h,v,T,P,R,V,Y){const K=D.context,te=K.gl,ie="fill-extrusion-pattern",ce=v.paint.get(ie),ae=ce.constantOr(1),fe=v.getCrossfadeParameters(),_e=v.paint.get("fill-extrusion-opacity"),Me=ce.constantOr(null),Te=D.transform;for(const Ae of T){const Pe=h.getTile(Ae),Fe=Pe.getBucket(v);if(!Fe)continue;const De=D.style.map.terrain&&D.style.map.terrain.getTerrainData(Ae),je=Fe.programConfigurations.get(v.id),Ge=D.useProgram(ae?"fillExtrusionPattern":"fillExtrusion",je);ae&&(D.context.activeTexture.set(te.TEXTURE0),Pe.imageAtlasTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE),je.updatePaintBuffers(fe));const Re=Te.getProjectionData({overscaledTileID:Ae,applyGlobeMatrix:!Y,applyTerrainMatrix:!0});Ix(je,ie,Me,Pe,v);const Je=a.aC(Te,Pe,v.paint.get("fill-extrusion-translate"),v.paint.get("fill-extrusion-translate-anchor")),ct=v.paint.get("fill-extrusion-vertical-gradient"),rt=ae?px(D,ct,_e,Je,Ae,fe,Pe):Py(D,ct,_e,Je);Ge.draw(K,K.gl.TRIANGLES,P,R,V,Zn.backCCW,rt,De,Re,v.id,Fe.layoutVertexBuffer,Fe.indexBuffer,Fe.segments,v.paint,D.transform.zoom,je,D.style.map.terrain&&Fe.centroidVertexBuffer)}}function Im(D,h,v,T,P,R,V,Y,K){var te;const ie=D.style.projection,ce=D.context,ae=D.transform,fe=ce.gl,_e=[`#define NUM_ILLUMINATION_SOURCES ${v.paint.get("hillshade-highlight-color").values.length}`],Me=D.useProgram("hillshade",null,!1,_e),Te=!D.options.moving;for(const Ae of T){const Pe=h.getTile(Ae),Fe=Pe.fbo;if(!Fe)continue;const De=ie.getMeshFromTileID(ce,Ae.canonical,Y,!0,"raster"),je=(te=D.style.map.terrain)===null||te===void 0?void 0:te.getTerrainData(Ae);ce.activeTexture.set(fe.TEXTURE0),fe.bindTexture(fe.TEXTURE_2D,Fe.colorAttachment.get());const Ge=ae.getProjectionData({overscaledTileID:Ae,aligned:Te,applyGlobeMatrix:!K,applyTerrainMatrix:!0});Me.draw(ce,fe.TRIANGLES,R,P[Ae.overscaledZ],V,Zn.backCCW,Em(D,Pe,v),je,Ge,v.id,De.vertexBuffer,De.indexBuffer,De.segments)}}function Vy(D,h,v,T,P,R,V,Y,K){var te;const ie=D.style.projection,ce=D.context,ae=D.transform,fe=ce.gl,_e=D.useProgram("colorRelief"),Me=!D.options.moving;let Te=!0;for(const Ae of T){const Pe=h.getTile(Ae),Fe=Pe.dem;if(Te){const ct=fe.getParameter(fe.MAX_TEXTURE_SIZE),{elevationTexture:rt,colorTexture:ot}=v.getColorRampTextures(ce,ct,Fe.getUnpackVector());ce.activeTexture.set(fe.TEXTURE1),rt.bind(fe.NEAREST,fe.CLAMP_TO_EDGE),ce.activeTexture.set(fe.TEXTURE4),ot.bind(fe.LINEAR,fe.CLAMP_TO_EDGE),Te=!1}if(!Fe||!Fe.data)continue;const De=Fe.stride,je=Fe.getPixels();if(ce.activeTexture.set(fe.TEXTURE0),ce.pixelStoreUnpackPremultiplyAlpha.set(!1),Pe.demTexture=Pe.demTexture||D.getTileTexture(De),Pe.demTexture){const ct=Pe.demTexture;ct.update(je,{premultiply:!1}),ct.bind(fe.LINEAR,fe.CLAMP_TO_EDGE)}else Pe.demTexture=new a.T(ce,je,fe.RGBA,{premultiply:!1}),Pe.demTexture.bind(fe.LINEAR,fe.CLAMP_TO_EDGE);const Ge=ie.getMeshFromTileID(ce,Ae.canonical,Y,!0,"raster"),Re=(te=D.style.map.terrain)===null||te===void 0?void 0:te.getTerrainData(Ae),Je=ae.getProjectionData({overscaledTileID:Ae,aligned:Me,applyGlobeMatrix:!K,applyTerrainMatrix:!0});_e.draw(ce,fe.TRIANGLES,R,P[Ae.overscaledZ],V,Zn.backCCW,zR(v,Pe.dem),Re,Je,v.id,Ge.vertexBuffer,Ge.indexBuffer,Ge.segments)}}const Lx=[new a.P(0,0),new a.P(a.$,0),new a.P(a.$,a.$),new a.P(0,a.$)];function Id(D,h,v,T,P,R,V,Y,K=!1,te=!1){const ie=T[T.length-1].overscaledZ,ce=D.context,ae=ce.gl,fe=D.useProgram("raster"),_e=D.transform,Me=D.style.projection,Te=D.colorModeForRenderPass(),Ae=!D.options.moving;for(const Pe of T){const Fe=D.getDepthModeForSublayer(Pe.overscaledZ-ie,v.paint.get("raster-opacity")===1?er.ReadWrite:er.ReadOnly,ae.LESS),De=h.getTile(Pe);De.registerFadeDuration(v.paint.get("raster-fade-duration"));const je=h.findLoadedParent(Pe,0),Ge=h.findLoadedSibling(Pe),Re=XR(De,je||Ge||null,h,v,D.transform,D.style.map.terrain);let Je,ct;const rt=v.paint.get("raster-resampling")==="nearest"?ae.NEAREST:ae.LINEAR;ce.activeTexture.set(ae.TEXTURE0),De.texture.bind(rt,ae.CLAMP_TO_EDGE,ae.LINEAR_MIPMAP_NEAREST),ce.activeTexture.set(ae.TEXTURE1),je?(je.texture.bind(rt,ae.CLAMP_TO_EDGE,ae.LINEAR_MIPMAP_NEAREST),Je=Math.pow(2,je.tileID.overscaledZ-De.tileID.overscaledZ),ct=[De.tileID.canonical.x*Je%1,De.tileID.canonical.y*Je%1]):De.texture.bind(rt,ae.CLAMP_TO_EDGE,ae.LINEAR_MIPMAP_NEAREST),De.texture.useMipmap&&ce.extTextureFilterAnisotropic&&D.transform.pitch>20&&ae.texParameterf(ae.TEXTURE_2D,ce.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,ce.extTextureFilterAnisotropicMax);const ot=D.style.map.terrain&&D.style.map.terrain.getTerrainData(Pe),ut=_e.getProjectionData({overscaledTileID:Pe,aligned:Ae,applyGlobeMatrix:!te,applyTerrainMatrix:!0}),Rt=Xf(ct||[0,0],Je||1,Re,v,Y),Dt=Me.getMeshFromTileID(ce,Pe.canonical,R,V,"raster");fe.draw(ce,ae.TRIANGLES,Fe,P?P[Pe.overscaledZ]:Ln.disabled,Te,K?Zn.frontCCW:Zn.backCCW,Rt,ot,ut,v.id,Dt.vertexBuffer,Dt.indexBuffer,Dt.segments)}}function XR(D,h,v,T,P,R){const V=T.paint.get("raster-fade-duration");if(!R&&V>0){const Y=p.now(),K=(Y-D.timeAdded)/V,te=h?(Y-h.timeAdded)/V:-1,ie=v.getSource(),ce=mt(P,{tileSize:ie.tileSize,roundZoom:ie.roundZoom}),ae=!h||Math.abs(h.tileID.overscaledZ-ce)>Math.abs(D.tileID.overscaledZ-ce),fe=ae&&D.refreshedUponExpiration?1:a.ag(ae?K:1-te,0,1);return D.refreshedUponExpiration&&K>=1&&(D.refreshedUponExpiration=!1),h?{opacity:1,mix:1-fe}:{opacity:fe,mix:0}}return{opacity:1,mix:0}}const ZM=new a.be(1,0,0,1),O_=new a.be(0,1,0,1),Px=new a.be(0,0,1,1),XM=new a.be(1,0,1,1),KM=new a.be(0,1,1,1);function jy(D,h,v,T){R_(D,0,h+v/2,D.transform.width,v,T)}function D_(D,h,v,T){R_(D,h-v/2,0,v,D.transform.height,T)}function R_(D,h,v,T,P,R){const V=D.context,Y=V.gl;Y.enable(Y.SCISSOR_TEST),Y.scissor(h*D.pixelRatio,v*D.pixelRatio,T*D.pixelRatio,P*D.pixelRatio),V.clear({color:R}),Y.disable(Y.SCISSOR_TEST)}function JM(D,h,v){const T=D.context,P=T.gl,R=D.useProgram("debug"),V=er.disabled,Y=Ln.disabled,K=D.colorModeForRenderPass(),te="$debug",ie=D.style.map.terrain&&D.style.map.terrain.getTerrainData(v);T.activeTexture.set(P.TEXTURE0);const ce=h.getTileByID(v.key).latestRawTileData,ae=Math.floor((ce&&ce.byteLength||0)/1024),fe=h.getTile(v).tileSize,_e=512/Math.min(fe,512)*(v.overscaledZ/D.transform.zoom)*.5;let Me=v.canonical.toString();v.overscaledZ!==v.canonical.z&&(Me+=` => ${v.overscaledZ}`),function(Ae,Pe){Ae.initDebugOverlayCanvas();const Fe=Ae.debugOverlayCanvas,De=Ae.context.gl,je=Ae.debugOverlayCanvas.getContext("2d");je.clearRect(0,0,Fe.width,Fe.height),je.shadowColor="white",je.shadowBlur=2,je.lineWidth=1.5,je.strokeStyle="white",je.textBaseline="top",je.font="bold 36px Open Sans, sans-serif",je.fillText(Pe,5,5),je.strokeText(Pe,5,5),Ae.debugOverlayTexture.update(Fe),Ae.debugOverlayTexture.bind(De.LINEAR,De.CLAMP_TO_EDGE)}(D,`${Me} ${ae}kB`);const Te=D.transform.getProjectionData({overscaledTileID:v,applyGlobeMatrix:!0,applyTerrainMatrix:!0});R.draw(T,P.TRIANGLES,V,Y,Sr.alphaBlended,Zn.disabled,AM(a.be.transparent,_e),null,Te,te,D.debugBuffer,D.quadTriangleIndexBuffer,D.debugSegments),R.draw(T,P.LINE_STRIP,V,Y,K,Zn.disabled,AM(a.be.red),ie,Te,te,D.debugBuffer,D.tileBorderIndexBuffer,D.debugSegments)}function bo(D,h,v,T){const{isRenderingGlobe:P}=T,R=D.context,V=R.gl,Y=D.transform,K=D.colorModeForRenderPass(),te=D.getDepthModeFor3D(),ie=D.useProgram("terrain");R.bindFramebuffer.set(null),R.viewport.set([0,0,D.width,D.height]);for(const ce of v){const ae=h.getTerrainMesh(ce.tileID),fe=D.renderToTexture.getTexture(ce),_e=h.getTerrainData(ce.tileID);R.activeTexture.set(V.TEXTURE0),V.bindTexture(V.TEXTURE_2D,fe.texture);const Me=h.getMeshFrameDelta(Y.zoom),Te=Y.calculateFogMatrix(ce.tileID.toUnwrapped()),Ae=RR(Me,Te,D.style.sky,Y.pitch,P),Pe=Y.getProjectionData({overscaledTileID:ce.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});ie.draw(R,V.TRIANGLES,te,Ln.disabled,K,Zn.backCCW,Ae,_e,Pe,"terrain",ae.vertexBuffer,ae.indexBuffer,ae.segments)}}function Ld(D,h){if(!h.mesh){const v=new a.aK;v.emplaceBack(-1,-1),v.emplaceBack(1,-1),v.emplaceBack(1,1),v.emplaceBack(-1,1);const T=new a.aM;T.emplaceBack(0,1,2),T.emplaceBack(0,2,3),h.mesh=new Th(D.createVertexBuffer(v,Mh.members),D.createIndexBuffer(T),a.aL.simpleSegment(0,0,v.length,T.length))}return h.mesh}class yc{constructor(h,v){this.context=new pr(h),this.transform=v,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:a.af(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=wt.maxUnderzooming+wt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new p_}resize(h,v,T){if(this.width=Math.floor(h*T),this.height=Math.floor(v*T),this.pixelRatio=T,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const P of this.style._order)this.style._layers[P].resize()}setup(){const h=this.context,v=new a.aK;v.emplaceBack(0,0),v.emplaceBack(a.$,0),v.emplaceBack(0,a.$),v.emplaceBack(a.$,a.$),this.tileExtentBuffer=h.createVertexBuffer(v,Mh.members),this.tileExtentSegments=a.aL.simpleSegment(0,0,4,2);const T=new a.aK;T.emplaceBack(0,0),T.emplaceBack(a.$,0),T.emplaceBack(0,a.$),T.emplaceBack(a.$,a.$),this.debugBuffer=h.createVertexBuffer(T,Mh.members),this.debugSegments=a.aL.simpleSegment(0,0,4,5);const P=new a.c5;P.emplaceBack(0,0,0,0),P.emplaceBack(a.$,0,a.$,0),P.emplaceBack(0,a.$,0,a.$),P.emplaceBack(a.$,a.$,a.$,a.$),this.rasterBoundsBuffer=h.createVertexBuffer(P,OR.members),this.rasterBoundsSegments=a.aL.simpleSegment(0,0,4,2);const R=new a.aK;R.emplaceBack(0,0),R.emplaceBack(a.$,0),R.emplaceBack(0,a.$),R.emplaceBack(a.$,a.$),this.rasterBoundsBufferPosOnly=h.createVertexBuffer(R,Mh.members),this.rasterBoundsSegmentsPosOnly=a.aL.simpleSegment(0,0,4,5);const V=new a.aK;V.emplaceBack(0,0),V.emplaceBack(1,0),V.emplaceBack(0,1),V.emplaceBack(1,1),this.viewportBuffer=h.createVertexBuffer(V,Mh.members),this.viewportSegments=a.aL.simpleSegment(0,0,4,2);const Y=new a.c6;Y.emplaceBack(0),Y.emplaceBack(1),Y.emplaceBack(3),Y.emplaceBack(2),Y.emplaceBack(0),this.tileBorderIndexBuffer=h.createIndexBuffer(Y);const K=new a.aM;K.emplaceBack(1,0,2),K.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=h.createIndexBuffer(K);const te=this.context.gl;this.stencilClearMode=new Ln({func:te.ALWAYS,mask:0},0,255,te.ZERO,te.ZERO,te.ZERO),this.tileExtentMesh=new Th(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const h=this.context,v=h.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const T=a.L();a.bX(T,0,this.width,this.height,0,0,1),a.N(T,T,[v.drawingBufferWidth,v.drawingBufferHeight,0]);const P={mainMatrix:T,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:T};this.useProgram("clippingMask",null,!0).draw(h,v.TRIANGLES,er.disabled,this.stencilClearMode,Sr.disabled,Zn.disabled,null,null,P,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(h,v,T){if(this.currentStencilSource===h.source||!h.isTileClipped()||!v||!v.length)return;this.currentStencilSource=h.source,this.nextStencilID+v.length>256&&this.clearStencil();const P=this.context;P.setColorMode(Sr.disabled),P.setDepthMode(er.disabled);const R={};for(const V of v)R[V.key]=this.nextStencilID++;this._renderTileMasks(R,v,T,!0),this._renderTileMasks(R,v,T,!1),this._tileClippingMaskIDs=R}_renderTileMasks(h,v,T,P){const R=this.context,V=R.gl,Y=this.style.projection,K=this.transform,te=this.useProgram("clippingMask");for(const ie of v){const ce=h[ie.key],ae=this.style.map.terrain&&this.style.map.terrain.getTerrainData(ie),fe=Y.getMeshFromTileID(this.context,ie.canonical,P,!0,"stencil"),_e=K.getProjectionData({overscaledTileID:ie,applyGlobeMatrix:!T,applyTerrainMatrix:!0});te.draw(R,V.TRIANGLES,er.disabled,new Ln({func:V.ALWAYS,mask:0},ce,255,V.KEEP,V.KEEP,V.REPLACE),Sr.disabled,T?Zn.disabled:Zn.backCCW,null,ae,_e,"$clipping",fe.vertexBuffer,fe.indexBuffer,fe.segments)}}_renderTilesDepthBuffer(){const h=this.context,v=h.gl,T=this.style.projection,P=this.transform,R=this.useProgram("depth"),V=this.getDepthModeFor3D(),Y=dt(P,{tileSize:P.tileSize});for(const K of Y){const te=this.style.map.terrain&&this.style.map.terrain.getTerrainData(K),ie=T.getMeshFromTileID(this.context,K.canonical,!0,!0,"raster"),ce=P.getProjectionData({overscaledTileID:K,applyGlobeMatrix:!0,applyTerrainMatrix:!0});R.draw(h,v.TRIANGLES,V,Ln.disabled,Sr.disabled,Zn.backCCW,null,te,ce,"$clipping",ie.vertexBuffer,ie.indexBuffer,ie.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const h=this.nextStencilID++,v=this.context.gl;return new Ln({func:v.NOTEQUAL,mask:255},h,255,v.KEEP,v.KEEP,v.REPLACE)}stencilModeForClipping(h){const v=this.context.gl;return new Ln({func:v.EQUAL,mask:255},this._tileClippingMaskIDs[h.key],0,v.KEEP,v.KEEP,v.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(h){const v=this.context.gl,T=h.sort((V,Y)=>Y.overscaledZ-V.overscaledZ),P=T[T.length-1].overscaledZ,R=T[0].overscaledZ-P+1;if(R>1){this.currentStencilSource=void 0,this.nextStencilID+R>256&&this.clearStencil();const V={};for(let Y=0;YY.overscaledZ-V.overscaledZ),P=T[T.length-1].overscaledZ,R=T[0].overscaledZ-P+1;if(this.clearStencil(),R>1){const V={},Y={};for(let K=0;K0};for(const ae in V){const fe=V[ae];fe.used&&fe.prepare(this.context),Y[ae]=fe.getVisibleCoordinates(!1),K[ae]=Y[ae].slice().reverse(),te[ae]=fe.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let ae=0;aethis.useProgram(ae)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:v.showOverdrawInspector?a.be.black:a.be.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(ae,fe){const _e=ae.context,Me=_e.gl,Te=((Ge,Re,Je)=>{const ct=Math.cos(Re.rollInRadians),rt=Math.sin(Re.rollInRadians),ot=ue(Re),ut=Re.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:Ge.properties.get("sky-color"),u_horizon_color:Ge.properties.get("horizon-color"),u_horizon:[(Re.width/2-ot*rt)*Je,(Re.height/2+ot*ct)*Je],u_horizon_normal:[-rt,ct],u_sky_horizon_blend:Ge.properties.get("sky-horizon-blend")*Re.height/2*Je,u_sky_blend:ut}})(fe,ae.style.map.transform,ae.pixelRatio),Ae=new er(Me.LEQUAL,er.ReadWrite,[0,1]),Pe=Ln.disabled,Fe=ae.colorModeForRenderPass(),De=ae.useProgram("sky"),je=Ld(_e,fe);De.draw(_e,Me.TRIANGLES,Ae,Pe,Fe,Zn.disabled,Te,null,void 0,"sky",je.vertexBuffer,je.indexBuffer,je.segments)}(this,this.style.sky),this._showOverdrawInspector=v.showOverdrawInspector,this.depthRangeFor3D=[0,1-(h._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=R.length-1;this.currentLayer>=0;this.currentLayer--){const ae=this.style._layers[R[this.currentLayer]],fe=V[ae.source],_e=Y[ae.source];this._renderTileClippingMasks(ae,_e,!1),this.renderLayer(this,fe,ae,_e,ie)}this.renderPass="translucent";let ce=!1;for(this.currentLayer=0;this.currentLayer({u_sun_pos:ut,u_atmosphere_blend:Rt,u_globe_position:Dt,u_globe_radius:kt,u_inv_proj_matrix:Jt}))(De,Ge,[ct[0],ct[1],ct[2]],Re,Je),ot=Ld(Me,fe);Ae.draw(Me,Te.TRIANGLES,Pe,Ln.disabled,Sr.alphaBlended,Zn.disabled,rt,null,null,"atmosphere",ot.vertexBuffer,ot.indexBuffer,ot.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const ae=function(fe,_e){let Me=null;const Te=Object.values(fe._layers).flatMap(De=>De.source&&!De.isHidden(_e)?[fe.sourceCaches[De.source]]:[]),Ae=Te.filter(De=>De.getSource().type==="vector"),Pe=Te.filter(De=>De.getSource().type!=="vector"),Fe=De=>{(!Me||Me.getSource().maxzoomFe(De)),Me||Pe.forEach(De=>Fe(De)),Me}(this.style,this.transform.zoom);ae&&function(fe,_e,Me){for(let Te=0;Tect.getElevation(ut,uo,Oi):null;ZR(Dt,rt,ot,Re,Je,tr,co,kt,di,a.aC(Je,Rt,je,Ge),ut.toUnwrapped(),Li)}}}(te,V,K,Y,K.layout.get("text-rotation-alignment"),K.layout.get("text-pitch-alignment"),K.paint.get("text-translate"),K.paint.get("text-translate-anchor"),ie),K.paint.get("icon-opacity").constantOr(1)!==0&&YM(V,Y,K,te,!1,K.paint.get("icon-translate"),K.paint.get("icon-translate-anchor"),K.layout.get("icon-rotation-alignment"),K.layout.get("icon-pitch-alignment"),K.layout.get("icon-keep-upright"),fe,_e,ae),K.paint.get("text-opacity").constantOr(1)!==0&&YM(V,Y,K,te,!0,K.paint.get("text-translate"),K.paint.get("text-translate-anchor"),K.layout.get("text-rotation-alignment"),K.layout.get("text-pitch-alignment"),K.layout.get("text-keep-upright"),fe,_e,ae),Y.map.showCollisionBoxes&&(WM(V,Y,K,te,!0),WM(V,Y,K,te,!1))}(h,v,T,P,this.style.placement.variableOffsets,R):a.cb(T)?function(V,Y,K,te,ie){if(V.renderPass!=="translucent")return;const{isRenderingToTexture:ce}=ie,ae=K.paint.get("circle-opacity"),fe=K.paint.get("circle-stroke-width"),_e=K.paint.get("circle-stroke-opacity"),Me=!K.layout.get("circle-sort-key").isConstant();if(ae.constantOr(1)===0&&(fe.constantOr(1)===0||_e.constantOr(1)===0))return;const Te=V.context,Ae=Te.gl,Pe=V.transform,Fe=V.getDepthModeForSublayer(0,er.ReadOnly),De=Ln.disabled,je=V.colorModeForRenderPass(),Ge=[],Re=Pe.getCircleRadiusCorrection();for(let Je=0;JeJe.sortKey-ct.sortKey);for(const Je of Ge){const{programConfiguration:ct,program:rt,layoutVertexBuffer:ot,indexBuffer:ut,uniformValues:Rt,terrainData:Dt,projectionData:kt}=Je.state;rt.draw(Te,Ae.TRIANGLES,Fe,De,je,Zn.backCCW,Rt,Dt,kt,K.id,ot,ut,Je.segments,K.paint,V.transform.zoom,ct)}}(h,v,T,P,R):a.cc(T)?function(V,Y,K,te,ie){if(K.paint.get("heatmap-opacity")===0)return;const ce=V.context,{isRenderingToTexture:ae,isRenderingGlobe:fe}=ie;if(V.style.map.terrain){for(const _e of te){const Me=Y.getTile(_e);Y.hasRenderableParent(_e)||(V.renderPass==="offscreen"?L_(V,Me,K,_e,fe):V.renderPass==="translucent"&&P_(V,K,_e,ae,fe))}ce.viewport.set([0,0,V.width,V.height])}else V.renderPass==="offscreen"?function(_e,Me,Te,Ae){const Pe=_e.context,Fe=Pe.gl,De=_e.transform,je=Ln.disabled,Ge=new Sr([Fe.ONE,Fe.ONE],a.be.transparent,[!0,!0,!0,!0]);(function(Re,Je,ct){const rt=Re.gl;Re.activeTexture.set(rt.TEXTURE1),Re.viewport.set([0,0,Je.width/4,Je.height/4]);let ot=ct.heatmapFbos.get(a.c1);ot?(rt.bindTexture(rt.TEXTURE_2D,ot.colorAttachment.get()),Re.bindFramebuffer.set(ot.framebuffer)):(ot=$y(Re,Je.width/4,Je.height/4),ct.heatmapFbos.set(a.c1,ot))})(Pe,_e,Te),Pe.clear({color:a.be.transparent});for(let Re=0;Re0?v.pop():null}isPatternMissing(h){if(!h)return!1;if(!h.from||!h.to)return!0;const v=this.imageManager.getPattern(h.from.toString()),T=this.imageManager.getPattern(h.to.toString());return!v||!T}useProgram(h,v,T=!1,P=[]){this.cache=this.cache||{};const R=!!this.style.map.terrain,V=this.style.projection,Y=T?Vu.projectionMercator:V.shaderPreludeCode,K=T?qf:V.shaderDefine,te=h+(v?v.cacheKey:"")+`/${T?ax:V.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(R?"/terrain":"")+(P?`/${P.join("/")}`:"");return this.cache[te]||(this.cache[te]=new __(this.context,Vu[h],v,RM[h],this._showOverdrawInspector,R,Y,K,P)),this.cache[te]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const h=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(h.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new a.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:h,drawingBufferHeight:v}=this.context.gl;return this.width!==h||this.height!==v}}function B_(D,h){let v,T=!1,P=null,R=null;const V=()=>{P=null,T&&(D.apply(R,v),P=setTimeout(V,h),T=!1)};return(...Y)=>(T=!0,R=this,v=Y,P||V(),P)}class Uy{constructor(h){this._getCurrentHash=()=>{const v=window.location.hash.replace("#","");if(this._hashName){let T;return v.split("&").map(P=>P.split("=")).forEach(P=>{P[0]===this._hashName&&(T=P)}),(T&&T[1]||"").split("/")}return v.split("/")},this._onHashChange=()=>{const v=this._getCurrentHash();if(!this._isValidHash(v))return!1;const T=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(v[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+v[2],+v[1]],zoom:+v[0],bearing:T,pitch:+(v[4]||0)}),!0},this._updateHashUnthrottled=()=>{const v=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,v)},this._removeHash=()=>{const v=this._getCurrentHash();if(v.length===0)return;const T=v.join("/");let P=T;P.split("&").length>0&&(P=P.split("&")[0]),this._hashName&&(P=`${this._hashName}=${T}`);let R=window.location.hash.replace(P,"");R.startsWith("#&")?R=R.slice(0,1)+R.slice(2):R==="#"&&(R="");let V=window.location.href.replace(/(#.+)?$/,R);V=V.replace("&&","&"),window.history.replaceState(window.history.state,null,V)},this._updateHash=B_(this._updateHashUnthrottled,300),this._hashName=h&&encodeURIComponent(h)}addTo(h){return this._map=h,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(h){const v=this._map.getCenter(),T=Math.round(100*this._map.getZoom())/100,P=Math.ceil((T*Math.LN2+Math.log(512/360/.5))/Math.LN10),R=Math.pow(10,P),V=Math.round(v.lng*R)/R,Y=Math.round(v.lat*R)/R,K=this._map.getBearing(),te=this._map.getPitch();let ie="";if(ie+=h?`/${V}/${Y}/${T}`:`${T}/${Y}/${V}`,(K||te)&&(ie+="/"+Math.round(10*K)/10),te&&(ie+=`/${Math.round(te)}`),this._hashName){const ce=this._hashName;let ae=!1;const fe=window.location.hash.slice(1).split("&").map(_e=>{const Me=_e.split("=")[0];return Me===ce?(ae=!0,`${Me}=${ie}`):_e}).filter(_e=>_e);return ae||fe.push(`${ce}=${ie}`),`#${fe.join("&")}`}return`#${ie}`}_isValidHash(h){if(h.length<3||h.some(isNaN))return!1;try{new a.S(+h[2],+h[1])}catch{return!1}const v=+h[0],T=+(h[3]||0),P=+(h[4]||0);return v>=this._map.getMinZoom()&&v<=this._map.getMaxZoom()&&T>=-180&&T<=180&&P>=this._map.getMinPitch()&&P<=this._map.getMaxPitch()}}const Lm={linearity:.3,easing:a.cl(0,0,.3,1)},Pm=a.e({deceleration:2500,maxSpeed:1400},Lm),Nx=a.e({deceleration:20,maxSpeed:1400},Lm),Hy=a.e({deceleration:1e3,maxSpeed:360},Lm),Ox=a.e({deceleration:1e3,maxSpeed:90},Lm),QM=a.e({deceleration:1e3,maxSpeed:360},Lm);class eA{constructor(h){this._map=h,this.clear()}clear(){this._inertiaBuffer=[]}record(h){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:p.now(),settings:h})}_drainInertiaBuffer(){const h=this._inertiaBuffer,v=p.now();for(;h.length>0&&v-h[0].time>160;)h.shift()}_onMoveEnd(h){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const v={zoom:0,bearing:0,pitch:0,roll:0,pan:new a.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:R}of this._inertiaBuffer)v.zoom+=R.zoomDelta||0,v.bearing+=R.bearingDelta||0,v.pitch+=R.pitchDelta||0,v.roll+=R.rollDelta||0,R.panDelta&&v.pan._add(R.panDelta),R.around&&(v.around=R.around),R.pinchAround&&(v.pinchAround=R.pinchAround);const T=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,P={};if(v.pan.mag()){const R=Om(v.pan.mag(),T,a.e({},Pm,h||{})),V=v.pan.mult(R.amount/v.pan.mag()),Y=this._map.cameraHelper.handlePanInertia(V,this._map.transform);P.center=Y.easingCenter,P.offset=Y.easingOffset,Nm(P,R)}if(v.zoom){const R=Om(v.zoom,T,Nx);P.zoom=this._map.transform.zoom+R.amount,Nm(P,R)}if(v.bearing){const R=Om(v.bearing,T,Hy);P.bearing=this._map.transform.bearing+a.ag(R.amount,-179,179),Nm(P,R)}if(v.pitch){const R=Om(v.pitch,T,Ox);P.pitch=this._map.transform.pitch+R.amount,Nm(P,R)}if(v.roll){const R=Om(v.roll,T,QM);P.roll=this._map.transform.roll+a.ag(R.amount,-179,179),Nm(P,R)}if(P.zoom||P.bearing){const R=v.pinchAround===void 0?v.around:v.pinchAround;P.around=R?this._map.unproject(R):this._map.getCenter()}return this.clear(),a.e(P,{noMoveStart:!0})}}function Nm(D,h){(!D.duration||D.durationv.unproject(K)),Y=R.reduce((K,te,ie,ce)=>K.add(te.div(ce.length)),new a.P(0,0));super(h,{points:R,point:Y,lngLats:V,lngLat:v.unproject(Y),originalEvent:T}),this._defaultPrevented=!1}}class Dx extends a.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(h,v,T){super(h,{originalEvent:T}),this._defaultPrevented=!1}}class tA{constructor(h,v){this._map=h,this._clickTolerance=v.clickTolerance}reset(){delete this._mousedownPos}wheel(h){return this._firePreventable(new Dx(h.type,this._map,h))}mousedown(h,v){return this._mousedownPos=v,this._firePreventable(new hl(h.type,this._map,h))}mouseup(h){this._map.fire(new hl(h.type,this._map,h))}click(h,v){this._mousedownPos&&this._mousedownPos.dist(v)>=this._clickTolerance||this._map.fire(new hl(h.type,this._map,h))}dblclick(h){return this._firePreventable(new hl(h.type,this._map,h))}mouseover(h){this._map.fire(new hl(h.type,this._map,h))}mouseout(h){this._map.fire(new hl(h.type,this._map,h))}touchstart(h){return this._firePreventable(new Wc(h.type,this._map,h))}touchmove(h){this._map.fire(new Wc(h.type,this._map,h))}touchend(h){this._map.fire(new Wc(h.type,this._map,h))}touchcancel(h){this._map.fire(new Wc(h.type,this._map,h))}_firePreventable(h){if(this._map.fire(h),h.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class nA{constructor(h){this._map=h}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(h){this._map.fire(new hl(h.type,this._map,h))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new hl("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(h){this._delayContextMenu?this._contextMenuEvent=h:this._ignoreContextMenu||this._map.fire(new hl(h.type,this._map,h)),this._map.listens("contextmenu")&&h.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Dm{constructor(h){this._map=h}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(h){return this.transform.screenPointToLocation(a.P.convert(h),this._map.terrain)}}class Rx{constructor(h,v){this._map=h,this._tr=new Dm(h),this._el=h.getCanvasContainer(),this._container=h.getContainer(),this._clickTolerance=v.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(h,v){this.isEnabled()&&h.shiftKey&&h.button===0&&(m.disableDrag(),this._startPos=this._lastPos=v,this._active=!0)}mousemoveWindow(h,v){if(!this._active)return;const T=v;if(this._lastPos.equals(T)||!this._box&&T.dist(this._startPos)R.fitScreenCoordinates(T,P,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",h)}keydown(h){this._active&&h.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",h))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(m.remove(this._box),this._box=null),m.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(h,v){return this._map.fire(new a.l(h,{originalEvent:v}))}}function F_(D,h){if(D.length!==h.length)throw new Error(`The number of touches and points are not equal - touches ${D.length}, points ${h.length}`);const v={};for(let T=0;Tthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=h.timeStamp),T.length===this.numTouches&&(this.centroid=function(P){const R=new a.P(0,0);for(const V of P)R._add(V);return R.div(P.length)}(v),this.touches=F_(T,v)))}touchmove(h,v,T){if(this.aborted||!this.centroid)return;const P=F_(T,v);for(const R in this.touches){const V=P[R];(!V||V.dist(this.touches[R])>30)&&(this.aborted=!0)}}touchend(h,v,T){if((!this.centroid||h.timeStamp-this.startTime>500)&&(this.aborted=!0),T.length===0){const P=!this.aborted&&this.centroid;if(this.reset(),P)return P}}}class $_{constructor(h){this.singleTap=new rA(h),this.numTaps=h.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(h,v,T){this.singleTap.touchstart(h,v,T)}touchmove(h,v,T){this.singleTap.touchmove(h,v,T)}touchend(h,v,T){const P=this.singleTap.touchend(h,v,T);if(P){const R=h.timeStamp-this.lastTime<500,V=!this.lastTap||this.lastTap.dist(P)<30;if(R&&V||this.reset(),this.count++,this.lastTime=h.timeStamp,this.lastTap=P,this.count===this.numTaps)return this.reset(),P}}}class z_{constructor(h){this._tr=new Dm(h),this._zoomIn=new $_({numTouches:1,numTaps:2}),this._zoomOut=new $_({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(h,v,T){this._zoomIn.touchstart(h,v,T),this._zoomOut.touchstart(h,v,T)}touchmove(h,v,T){this._zoomIn.touchmove(h,v,T),this._zoomOut.touchmove(h,v,T)}touchend(h,v,T){const P=this._zoomIn.touchend(h,v,T),R=this._zoomOut.touchend(h,v,T),V=this._tr;return P?(this._active=!0,h.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:Y=>Y.easeTo({duration:300,zoom:V.zoom+1,around:V.unproject(P)},{originalEvent:h})}):R?(this._active=!0,h.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:Y=>Y.easeTo({duration:300,zoom:V.zoom-1,around:V.unproject(R)},{originalEvent:h})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Rm{constructor(h){this._enabled=!!h.enable,this._moveStateManager=h.moveStateManager,this._clickTolerance=h.clickTolerance||1,this._moveFunction=h.move,this._activateOnStart=!!h.activateOnStart,h.assignEvents(this),this.reset()}reset(h){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(h)}_move(...h){const v=this._moveFunction(...h);if(v.bearingDelta||v.pitchDelta||v.rollDelta||v.around||v.panDelta)return this._active=!0,v}dragStart(h,v){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(h)&&(this._moveStateManager.startMove(h),this._lastPoint=Array.isArray(v)?v[0]:v,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(h,v){if(!this.isEnabled())return;const T=this._lastPoint;if(!T)return;if(h.preventDefault(),!this._moveStateManager.isValidMoveEvent(h))return void this.reset(h);const P=Array.isArray(v)?v[0]:v;return!this._moved&&P.dist(T)!0}),v=new Bm){this.mouseMoveStateManager=h,this.oneFingerTouchMoveStateManager=v}_executeRelevantHandler(h,v,T){return h instanceof MouseEvent?v(h):typeof TouchEvent<"u"&&h instanceof TouchEvent?T(h):void 0}startMove(h){this._executeRelevantHandler(h,v=>this.mouseMoveStateManager.startMove(v),v=>this.oneFingerTouchMoveStateManager.startMove(v))}endMove(h){this._executeRelevantHandler(h,v=>this.mouseMoveStateManager.endMove(v),v=>this.oneFingerTouchMoveStateManager.endMove(v))}isValidStartEvent(h){return this._executeRelevantHandler(h,v=>this.mouseMoveStateManager.isValidStartEvent(v),v=>this.oneFingerTouchMoveStateManager.isValidStartEvent(v))}isValidMoveEvent(h){return this._executeRelevantHandler(h,v=>this.mouseMoveStateManager.isValidMoveEvent(v),v=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(v))}isValidEndEvent(h){return this._executeRelevantHandler(h,v=>this.mouseMoveStateManager.isValidEndEvent(v),v=>this.oneFingerTouchMoveStateManager.isValidEndEvent(v))}}const V_=D=>{D.mousedown=D.dragStart,D.mousemoveWindow=D.dragMove,D.mouseup=D.dragEnd,D.contextmenu=h=>{h.preventDefault()}};class JR{constructor(h,v){this._clickTolerance=h.clickTolerance||1,this._map=v,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new a.P(0,0)}_shouldBePrevented(h){return h<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(h,v,T){return this._calculateTransform(h,v,T)}touchmove(h,v,T){if(this._active){if(!this._shouldBePrevented(T.length))return h.preventDefault(),this._calculateTransform(h,v,T);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",h)}}touchend(h,v,T){this._calculateTransform(h,v,T),this._active&&this._shouldBePrevented(T.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(h,v,T){T.length>0&&(this._active=!0);const P=F_(T,v),R=new a.P(0,0),V=new a.P(0,0);let Y=0;for(const te in P){const ie=P[te],ce=this._touches[te];ce&&(R._add(ie),V._add(ie.sub(ce)),Y++,P[te]=ie)}if(this._touches=P,this._shouldBePrevented(Y)||!V.mag())return;const K=V.div(Y);return this._sum._add(K),this._sum.mag()Math.abs(D.x)}class $x extends Bx{constructor(h){super(),this._currentTouchCount=0,this._map=h}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(h,v,T){super.touchstart(h,v,T),this._currentTouchCount=T.length}_start(h){this._lastPoints=h,Gy(h[0].sub(h[1]))&&(this._valid=!1)}_move(h,v,T){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const P=h[0].sub(this._lastPoints[0]),R=h[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(P,R,T.timeStamp),this._valid?(this._lastPoints=h,this._active=!0,{pitchDelta:(P.y+R.y)/2*-.5}):void 0}gestureBeginsVertically(h,v,T){if(this._valid!==void 0)return this._valid;const P=h.mag()>=2,R=v.mag()>=2;if(!P&&!R)return;if(!P||!R)return this._firstMove===void 0&&(this._firstMove=T),T-this._firstMove<100&&void 0;const V=h.y>0==v.y>0;return Gy(h)&&Gy(v)&&V}}const qy={panStep:100,bearingStep:15,pitchStep:10};class $m{constructor(h){this._tr=new Dm(h);const v=qy;this._panStep=v.panStep,this._bearingStep=v.bearingStep,this._pitchStep=v.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(h){if(h.altKey||h.ctrlKey||h.metaKey)return;let v=0,T=0,P=0,R=0,V=0;switch(h.keyCode){case 61:case 107:case 171:case 187:v=1;break;case 189:case 109:case 173:v=-1;break;case 37:h.shiftKey?T=-1:(h.preventDefault(),R=-1);break;case 39:h.shiftKey?T=1:(h.preventDefault(),R=1);break;case 38:h.shiftKey?P=1:(h.preventDefault(),V=-1);break;case 40:h.shiftKey?P=-1:(h.preventDefault(),V=1);break;default:return}return this._rotationDisabled&&(T=0,P=0),{cameraAnimation:Y=>{const K=this._tr;Y.easeTo({duration:300,easeId:"keyboardHandler",easing:zx,zoom:v?Math.round(K.zoom)+v*(h.shiftKey?2:1):K.zoom,bearing:K.bearing+T*this._bearingStep,pitch:K.pitch+P*this._pitchStep,offset:[-R*this._panStep,-V*this._panStep],center:K.center},{originalEvent:h})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function zx(D){return D*(2-D)}const mr=4.000244140625,Vx=1/450;class oA{constructor(h,v){this._onTimeout=T=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(T)},this._map=h,this._tr=new Dm(h),this._triggerRenderFrame=v,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Vx}setZoomRate(h){this._defaultZoomRate=h}setWheelZoomRate(h){this._wheelZoomRate=h}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(h){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!h&&h.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(h){return!!this._map.cooperativeGestures.isEnabled()&&!(h.ctrlKey||this._map.cooperativeGestures.isBypassed(h))}wheel(h){if(!this.isEnabled())return;if(this._shouldBePrevented(h))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",h);let v=h.deltaMode===WheelEvent.DOM_DELTA_LINE?40*h.deltaY:h.deltaY;const T=p.now(),P=T-(this._lastWheelEventTime||0);this._lastWheelEventTime=T,v!==0&&v%mr==0?this._type="wheel":v!==0&&Math.abs(v)<4?this._type="trackpad":P>400?(this._type=null,this._lastValue=v,this._timeout=setTimeout(this._onTimeout,40,h)):this._type||(this._type=Math.abs(P*v)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,v+=this._lastValue)),h.shiftKey&&v&&(v/=4),this._type&&(this._lastWheelEvent=h,this._delta-=v,this._active||this._start(h)),h.preventDefault()}_start(h){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const v=m.mousePos(this._map.getCanvas(),h),T=this._tr;this._aroundPoint=this._aroundCenter?T.transform.locationToScreenPoint(a.S.convert(T.center)):v,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const h=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const Y=h.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=Y),typeof this._targetZoom=="number"&&(this._targetZoom+=Y)}if(this._delta!==0){const Y=this._type==="wheel"&&Math.abs(this._delta)>mr?this._wheelZoomRate:this._defaultZoomRate;let K=2/(1+Math.exp(-Math.abs(this._delta*Y)));this._delta<0&&K!==0&&(K=1/K);const te=typeof this._targetZoom!="number"?h.scale:a.ae(this._targetZoom);this._targetZoom=h.getConstrained(h.getCameraLngLat(),a.aj(te*K)).zoom,this._type==="wheel"&&(this._startZoom=h.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const v=typeof this._targetZoom!="number"?h.zoom:this._targetZoom,T=this._startZoom,P=this._easing;let R,V=!1;if(this._type==="wheel"&&T&&P){const Y=p.now()-this._lastWheelEventTime,K=Math.min((Y+5)/200,1),te=P(K);R=a.C.number(T,v,te),K<1?this._frameId||(this._frameId=!0):V=!0}else R=v,V=!0;return this._active=!0,V&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=R,{noInertia:!0,needsRenderFrame:!V,zoomDelta:R-h.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(h){let v=a.cn;if(this._prevEase){const T=this._prevEase,P=(p.now()-T.start)/T.duration,R=T.easing(P+.01)-T.easing(P),V=.27/Math.sqrt(R*R+1e-4)*.01,Y=Math.sqrt(.0729-V*V);v=a.cl(V,Y,.25,1)}return this._prevEase={start:p.now(),duration:h,easing:v},v}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class j_{constructor(h,v){this._clickZoom=h,this._tapZoom=v}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class QR{constructor(h){this._tr=new Dm(h),this.reset()}reset(){this._active=!1}dblclick(h,v){return h.preventDefault(),{cameraAnimation:T=>{T.easeTo({duration:300,zoom:this._tr.zoom+(h.shiftKey?-1:1),around:this._tr.unproject(v)},{originalEvent:h})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class e3{constructor(){this._tap=new $_({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(h,v,T){if(!this._swipePoint)if(this._tapTime){const P=v[0],R=h.timeStamp-this._tapTime<500,V=this._tapPoint.dist(P)<30;R&&V?T.length>0&&(this._swipePoint=P,this._swipeTouch=T[0].identifier):this.reset()}else this._tap.touchstart(h,v,T)}touchmove(h,v,T){if(this._tapTime){if(this._swipePoint){if(T[0].identifier!==this._swipeTouch)return;const P=v[0],R=P.y-this._swipePoint.y;return this._swipePoint=P,h.preventDefault(),this._active=!0,{zoomDelta:R/128}}}else this._tap.touchmove(h,v,T)}touchend(h,v,T){if(this._tapTime)this._swipePoint&&T.length===0&&this.reset();else{const P=this._tap.touchend(h,v,T);P&&(this._tapTime=h.timeStamp,this._tapPoint=P)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class jx{constructor(h,v,T){this._el=h,this._mousePan=v,this._touchPan=T}enable(h){this._inertiaOptions=h||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class U_{constructor(h,v,T,P){this._pitchWithRotate=h.pitchWithRotate,this._rollEnabled=h.rollEnabled,this._mouseRotate=v,this._mousePitch=T,this._mouseRoll=P}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Ux{constructor(h,v,T,P){this._el=h,this._touchZoom=v,this._touchRotate=T,this._tapDragZoom=P,this._rotationDisabled=!1,this._enabled=!0}enable(h){this._touchZoom.enable(h),this._rotationDisabled||this._touchRotate.enable(h),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class sA{constructor(h,v){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=h,this._options=v,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const h=this._map.getCanvasContainer();h.classList.add("maplibregl-cooperative-gestures"),this._container=m.create("div","maplibregl-cooperative-gesture-screen",h);let v=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(v=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const T=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),P=document.createElement("div");P.className="maplibregl-desktop-message",P.textContent=v,this._container.appendChild(P);const R=document.createElement("div");R.className="maplibregl-mobile-message",R.textContent=T,this._container.appendChild(R),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(m.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(h){return h[this._bypassKey]}notifyGestureBlocked(h,v){this._enabled&&(this._map.fire(new a.l("cooperativegestureprevented",{gestureType:h,originalEvent:v})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Yy=D=>D.zoom||D.drag||D.roll||D.pitch||D.rotate;class t3 extends a.l{}function Hx(D){return D.panDelta&&D.panDelta.mag()||D.zoomDelta||D.bearingDelta||D.pitchDelta||D.rollDelta}class Pd{constructor(h,v){this.handleWindowEvent=P=>{this.handleEvent(P,`${P.type}Window`)},this.handleEvent=(P,R)=>{if(P.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const V=P.type==="renderFrame"?void 0:P,Y={needsRenderFrame:!1},K={},te={};for(const{handlerName:ae,handler:fe,allowed:_e}of this._handlers){if(!fe.isEnabled())continue;let Me;if(this._blockedByActive(te,_e,ae))fe.reset();else if(fe[R||P.type]){if(a.co(P,R||P.type)){const Te=m.mousePos(this._map.getCanvas(),P);Me=fe[R||P.type](P,Te)}else if(a.cp(P,R||P.type)){const Te=this._getMapTouches(P.touches),Ae=m.touchPos(this._map.getCanvas(),Te);Me=fe[R||P.type](P,Ae,Te)}else a.cq(R||P.type)||(Me=fe[R||P.type](P));this.mergeHandlerResult(Y,K,Me,ae,V),Me&&Me.needsRenderFrame&&this._triggerRenderFrame()}(Me||fe.isActive())&&(te[ae]=fe)}const ie={};for(const ae in this._previousActiveHandlers)te[ae]||(ie[ae]=V);this._previousActiveHandlers=te,(Object.keys(ie).length||Hx(Y))&&(this._changes.push([Y,K,ie]),this._triggerRenderFrame()),(Object.keys(te).length||Hx(Y))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ce}=Y;ce&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ce(this._map))},this._map=h,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new eA(h),this._bearingSnap=v.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(v);const T=this._el;this._listeners=[[T,"touchstart",{passive:!0}],[T,"touchmove",{passive:!1}],[T,"touchend",void 0],[T,"touchcancel",void 0],[T,"mousedown",void 0],[T,"mousemove",void 0],[T,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[T,"mouseover",void 0],[T,"mouseout",void 0],[T,"dblclick",void 0],[T,"click",void 0],[T,"keydown",{capture:!1}],[T,"keyup",void 0],[T,"wheel",{passive:!1}],[T,"contextmenu",void 0],[window,"blur",void 0]];for(const[P,R,V]of this._listeners)m.addEventListener(P,R,P===document?this.handleWindowEvent:this.handleEvent,V)}destroy(){for(const[h,v,T]of this._listeners)m.removeEventListener(h,v,h===document?this.handleWindowEvent:this.handleEvent,T)}_addDefaultHandlers(h){const v=this._map,T=v.getCanvasContainer();this._add("mapEvent",new tA(v,h));const P=v.boxZoom=new Rx(v,h);this._add("boxZoom",P),h.interactive&&h.boxZoom&&P.enable();const R=v.cooperativeGestures=new sA(v,h.cooperativeGestures);this._add("cooperativeGestures",R),h.cooperativeGestures&&R.enable();const V=new z_(v),Y=new QR(v);v.doubleClickZoom=new j_(Y,V),this._add("tapZoom",V),this._add("clickZoom",Y),h.interactive&&h.doubleClickZoom&&v.doubleClickZoom.enable();const K=new e3;this._add("tapDragZoom",K);const te=v.touchPitch=new $x(v);this._add("touchPitch",te),h.interactive&&h.touchPitch&&v.touchPitch.enable(h.touchPitch);const ie=()=>v.project(v.getCenter()),ce=function({enable:De,clickTolerance:je,aroundCenter:Ge=!0,minPixelCenterThreshold:Re=100,rotateDegreesPerPixelMoved:Je=.8},ct){const rt=new Na({checkCorrectEvent:ot=>m.mouseButton(ot)===0&&ot.ctrlKey||m.mouseButton(ot)===2&&!ot.ctrlKey});return new Rm({clickTolerance:je,move:(ot,ut)=>{const Rt=ct();if(Ge&&Math.abs(Rt.y-ot.y)>Re)return{bearingDelta:a.cm(new a.P(ot.x,ut.y),ut,Rt)};let Dt=(ut.x-ot.x)*Je;return Ge&&ut.ym.mouseButton(Je)===0&&Je.ctrlKey||m.mouseButton(Je)===2});return new Rm({clickTolerance:je,move:(Je,ct)=>({pitchDelta:(ct.y-Je.y)*Ge}),moveStateManager:Re,enable:De,assignEvents:V_})}(h),fe=function({enable:De,clickTolerance:je,rollDegreesPerPixelMoved:Ge=.3},Re){const Je=new Na({checkCorrectEvent:ct=>m.mouseButton(ct)===2&&ct.ctrlKey});return new Rm({clickTolerance:je,move:(ct,rt)=>{const ot=Re();let ut=(rt.x-ct.x)*Ge;return rt.ym.mouseButton(Re)===0&&!Re.ctrlKey});return new Rm({clickTolerance:je,move:(Re,Je)=>({around:Je,panDelta:Je.sub(Re)}),activateOnStart:!0,moveStateManager:Ge,enable:De,assignEvents:V_})}(h),Me=new JR(h,v);v.dragPan=new jx(T,_e,Me),this._add("mousePan",_e),this._add("touchPan",Me,["touchZoom","touchRotate"]),h.interactive&&h.dragPan&&v.dragPan.enable(h.dragPan);const Te=new Fx,Ae=new Hu;v.touchZoomRotate=new Ux(T,Ae,Te,K),this._add("touchRotate",Te,["touchPan","touchZoom"]),this._add("touchZoom",Ae,["touchPan","touchRotate"]),h.interactive&&h.touchZoomRotate&&v.touchZoomRotate.enable(h.touchZoomRotate);const Pe=v.scrollZoom=new oA(v,()=>this._triggerRenderFrame());this._add("scrollZoom",Pe,["mousePan"]),h.interactive&&h.scrollZoom&&v.scrollZoom.enable(h.scrollZoom);const Fe=v.keyboard=new $m(v);this._add("keyboard",Fe),h.interactive&&h.keyboard&&v.keyboard.enable(),this._add("blockableMapEvent",new nA(v))}_add(h,v,T){this._handlers.push({handlerName:h,handler:v,allowed:T}),this._handlersById[h]=v}stop(h){if(!this._updatingCamera){for(const{handler:v}of this._handlers)v.reset();this._inertia.clear(),this._fireEvents({},{},h),this._changes=[]}}isActive(){for(const{handler:h}of this._handlers)if(h.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Yy(this._eventsInProgress)||this.isZooming()}_blockedByActive(h,v,T){for(const P in h)if(P!==T&&(!v||v.indexOf(P)<0))return!0;return!1}_getMapTouches(h){const v=[];for(const T of h)this._el.contains(T.target)&&v.push(T);return v}mergeHandlerResult(h,v,T,P,R){if(!T)return;a.e(h,T);const V={handlerName:P,originalEvent:T.originalEvent||R};T.zoomDelta!==void 0&&(v.zoom=V),T.panDelta!==void 0&&(v.drag=V),T.rollDelta!==void 0&&(v.roll=V),T.pitchDelta!==void 0&&(v.pitch=V),T.bearingDelta!==void 0&&(v.rotate=V)}_applyChanges(){const h={},v={},T={};for(const[P,R,V]of this._changes)P.panDelta&&(h.panDelta=(h.panDelta||new a.P(0,0))._add(P.panDelta)),P.zoomDelta&&(h.zoomDelta=(h.zoomDelta||0)+P.zoomDelta),P.bearingDelta&&(h.bearingDelta=(h.bearingDelta||0)+P.bearingDelta),P.pitchDelta&&(h.pitchDelta=(h.pitchDelta||0)+P.pitchDelta),P.rollDelta&&(h.rollDelta=(h.rollDelta||0)+P.rollDelta),P.around!==void 0&&(h.around=P.around),P.pinchAround!==void 0&&(h.pinchAround=P.pinchAround),P.noInertia&&(h.noInertia=P.noInertia),a.e(v,R),a.e(T,V);this._updateMapTransform(h,v,T),this._changes=[]}_updateMapTransform(h,v,T){const P=this._map,R=P._getTransformForUpdate(),V=P.terrain;if(!(Hx(h)||V&&this._terrainMovement))return this._fireEvents(v,T,!0);P._stop(!0);let{panDelta:Y,zoomDelta:K,bearingDelta:te,pitchDelta:ie,rollDelta:ce,around:ae,pinchAround:fe}=h;fe!==void 0&&(ae=fe),ae=ae||P.transform.centerPoint,V&&!R.isPointOnMapSurface(ae)&&(ae=R.centerPoint);const _e={panDelta:Y,zoomDelta:K,rollDelta:ce,pitchDelta:ie,bearingDelta:te,around:ae};this._map.cameraHelper.useGlobeControls&&!R.isPointOnMapSurface(ae)&&(ae=R.centerPoint);const Me=ae.distSqr(R.centerPoint)<.01?R.center:R.screenPointToLocation(Y?ae.sub(Y):ae);V?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(_e,R),this._terrainMovement||!v.drag&&!v.zoom?v.drag&&this._terrainMovement?R.setCenter(R.screenPointToLocation(R.centerPoint.sub(Y))):this._map.cameraHelper.handleMapControlsPan(_e,R,Me):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(_e,R,Me))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(_e,R),this._map.cameraHelper.handleMapControlsPan(_e,R,Me)),P._applyUpdatedTransform(R),this._map._update(),h.noInertia||this._inertia.record(h),this._fireEvents(v,T,!0)}_fireEvents(h,v,T){const P=Yy(this._eventsInProgress),R=Yy(h),V={};for(const ce in h){const{originalEvent:ae}=h[ce];this._eventsInProgress[ce]||(V[`${ce}start`]=ae),this._eventsInProgress[ce]=h[ce]}!P&&R&&this._fireEvent("movestart",R.originalEvent);for(const ce in V)this._fireEvent(ce,V[ce]);R&&this._fireEvent("move",R.originalEvent);for(const ce in h){const{originalEvent:ae}=h[ce];this._fireEvent(ce,ae)}const Y={};let K;for(const ce in this._eventsInProgress){const{handlerName:ae,originalEvent:fe}=this._eventsInProgress[ce];this._handlersById[ae].isActive()||(delete this._eventsInProgress[ce],K=v[ae]||fe,Y[`${ce}end`]=K)}for(const ce in Y)this._fireEvent(ce,Y[ce]);const te=Yy(this._eventsInProgress),ie=(P||R)&&!te;if(ie&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const ce=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&ce.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(ce)}if(T&&ie){this._updatingCamera=!0;const ce=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),ae=fe=>fe!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new t3("renderFrame",{timeStamp:h})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Qi extends a.E{constructor(h,v,T){super(),this._renderFrameCallback=()=>{const P=Math.min((p.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(P)),P<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=h,this._bearingSnap=T.bearingSnap,this.cameraHelper=v,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(h,v){h.apply(this.transform),this.transform=h,this.cameraHelper=v}getCenter(){return new a.S(this.transform.center.lng,this.transform.center.lat)}setCenter(h,v){return this.jumpTo({center:h},v)}getCenterElevation(){return this.transform.elevation}setCenterElevation(h,v){return this.jumpTo({elevation:h},v),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(h){this._centerClampedToGround=h}panBy(h,v,T){return h=a.P.convert(h).mult(-1),this.panTo(this.transform.center,a.e({offset:h},v),T)}panTo(h,v,T){return this.easeTo(a.e({center:h},v),T)}getZoom(){return this.transform.zoom}setZoom(h,v){return this.jumpTo({zoom:h},v),this}zoomTo(h,v,T){return this.easeTo(a.e({zoom:h},v),T)}zoomIn(h,v){return this.zoomTo(this.getZoom()+1,h,v),this}zoomOut(h,v){return this.zoomTo(this.getZoom()-1,h,v),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(h,v){return h!=this.transform.fov&&(this.transform.setFov(h),this.fire(new a.l("movestart",v)).fire(new a.l("move",v)).fire(new a.l("moveend",v))),this}getBearing(){return this.transform.bearing}setBearing(h,v){return this.jumpTo({bearing:h},v),this}getPadding(){return this.transform.padding}setPadding(h,v){return this.jumpTo({padding:h},v),this}rotateTo(h,v,T){return this.easeTo(a.e({bearing:h},v),T)}resetNorth(h,v){return this.rotateTo(0,a.e({duration:1e3},h),v),this}resetNorthPitch(h,v){return this.easeTo(a.e({bearing:0,pitch:0,roll:0,duration:1e3},h),v),this}snapToNorth(h,v){return Math.abs(this.getBearing()){Me.easeFunc(Te),this.terrain&&!h.freezeElevation&&this._updateElevation(Te),this._applyUpdatedTransform(T),this._fireMoveEvents(v)},Te=>{this.terrain&&h.freezeElevation&&this._finalizeElevation(),this._afterEase(v,Te)},h),this}_prepareEase(h,v,T={}){this._moving=!0,v||T.moving||this.fire(new a.l("movestart",h)),this._zooming&&!T.zooming&&this.fire(new a.l("zoomstart",h)),this._rotating&&!T.rotating&&this.fire(new a.l("rotatestart",h)),this._pitching&&!T.pitching&&this.fire(new a.l("pitchstart",h)),this._rolling&&!T.rolling&&this.fire(new a.l("rollstart",h))}_prepareElevation(h){this._elevationCenter=h,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(h,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(h){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const v=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(h<1&&v!==this._elevationTarget){const T=this._elevationTarget-this._elevationStart;this._elevationStart+=h*(T-(v-(T*h+this._elevationStart))/(1-h)),this._elevationTarget=v}this.transform.setElevation(a.C.number(this._elevationStart,this._elevationTarget,h))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(h){if(!this.terrain&&h.elevation>=0&&h.pitch<=90)return{};const v=h.getCameraLngLat(),T=h.getCameraAltitude(),P=this.terrain?this.terrain.getElevationForLngLatZoom(v,h.zoom):0;if(Tthis._elevateCameraIfInsideTerrain(P)),this.transformCameraUpdate&&v.push(P=>this.transformCameraUpdate(P)),!v.length)return;const T=h.clone();for(const P of v){const R=T.clone(),{center:V,zoom:Y,roll:K,pitch:te,bearing:ie,elevation:ce}=P(R);V&&R.setCenter(V),ce!==void 0&&R.setElevation(ce),Y!==void 0&&R.setZoom(Y),K!==void 0&&R.setRoll(K),te!==void 0&&R.setPitch(te),ie!==void 0&&R.setBearing(ie),T.apply(R)}this.transform.apply(T)}_fireMoveEvents(h){this.fire(new a.l("move",h)),this._zooming&&this.fire(new a.l("zoom",h)),this._rotating&&this.fire(new a.l("rotate",h)),this._pitching&&this.fire(new a.l("pitch",h)),this._rolling&&this.fire(new a.l("roll",h))}_afterEase(h,v){if(this._easeId&&v&&this._easeId===v)return;delete this._easeId;const T=this._zooming,P=this._rotating,R=this._pitching,V=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,T&&this.fire(new a.l("zoomend",h)),P&&this.fire(new a.l("rotateend",h)),R&&this.fire(new a.l("pitchend",h)),V&&this.fire(new a.l("rollend",h)),this.fire(new a.l("moveend",h))}flyTo(h,v){if(!h.essential&&p.prefersReducedMotion){const ut=a.Q(h,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(ut,v)}this.stop(),h=a.e({offset:[0,0],speed:1.2,curve:1.42,easing:a.cn},h);const T=this._getTransformForUpdate(),P=T.bearing,R=T.pitch,V=T.roll,Y=T.padding,K="bearing"in h?this._normalizeBearing(h.bearing,P):P,te="pitch"in h?+h.pitch:R,ie="roll"in h?this._normalizeBearing(h.roll,V):V,ce="padding"in h?h.padding:T.padding,ae=a.P.convert(h.offset);let fe=T.centerPoint.add(ae);const _e=T.screenPointToLocation(fe),Me=this.cameraHelper.handleFlyTo(T,{bearing:K,pitch:te,roll:ie,padding:ce,locationAtOffset:_e,offsetAsPoint:ae,center:h.center,minZoom:h.minZoom,zoom:h.zoom});let Te=h.curve;const Ae=Math.max(T.width,T.height),Pe=Ae/Me.scaleOfZoom,Fe=Me.pixelPathLength;typeof Me.scaleOfMinZoom=="number"&&(Te=Math.sqrt(Ae/Me.scaleOfMinZoom/Fe*2));const De=Te*Te;function je(ut){const Rt=(Pe*Pe-Ae*Ae+(ut?-1:1)*De*De*Fe*Fe)/(2*(ut?Pe:Ae)*De*Fe);return Math.log(Math.sqrt(Rt*Rt+1)-Rt)}function Ge(ut){return(Math.exp(ut)-Math.exp(-ut))/2}function Re(ut){return(Math.exp(ut)+Math.exp(-ut))/2}const Je=je(!1);let ct=function(ut){return Re(Je)/Re(Je+Te*ut)},rt=function(ut){return Ae*((Re(Je)*(Ge(Rt=Je+Te*ut)/Re(Rt))-Ge(Je))/De)/Fe;var Rt},ot=(je(!0)-Je)/Te;if(Math.abs(Fe)<2e-6||!isFinite(ot)){if(Math.abs(Ae-Pe)<1e-6)return this.easeTo(h,v);const ut=Pe0,ct=Rt=>Math.exp(ut*Te*Rt)}return h.duration="duration"in h?+h.duration:1e3*ot/("screenSpeed"in h?+h.screenSpeed/Te:+h.speed),h.maxDuration&&h.duration>h.maxDuration&&(h.duration=0),this._zooming=!0,this._rotating=P!==K,this._pitching=te!==R,this._rolling=ie!==V,this._padding=!T.isPaddingEqual(ce),this._prepareEase(v,!1),this.terrain&&this._prepareElevation(Me.targetCenter),this._ease(ut=>{const Rt=ut*ot,Dt=1/ct(Rt),kt=rt(Rt);this._rotating&&T.setBearing(a.C.number(P,K,ut)),this._pitching&&T.setPitch(a.C.number(R,te,ut)),this._rolling&&T.setRoll(a.C.number(V,ie,ut)),this._padding&&(T.interpolatePadding(Y,ce,ut),fe=T.centerPoint.add(ae)),Me.easeFunc(ut,Dt,kt,fe),this.terrain&&!h.freezeElevation&&this._updateElevation(ut),this._applyUpdatedTransform(T),this._fireMoveEvents(v)},()=>{this.terrain&&h.freezeElevation&&this._finalizeElevation(),this._afterEase(v)},h),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(h,v){var T;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const P=this._onEaseEnd;delete this._onEaseEnd,P.call(this,v)}return h||(T=this.handlers)===null||T===void 0||T.stop(!1),this}_ease(h,v,T){T.animate===!1||T.duration===0?(h(1),v()):(this._easeStart=p.now(),this._easeOptions=T,this._onEaseFrame=h,this._onEaseEnd=v,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(h,v){h=a.aN(h,-180,180);const T=Math.abs(h-v);return Math.abs(h-360-v)MapLibre'};class H_{constructor(h=Zy){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=v=>{!v||v.sourceDataType!=="metadata"&&v.sourceDataType!=="visibility"&&v.dataType!=="style"&&v.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=h}getDefaultPosition(){return"bottom-right"}onAdd(h){return this._map=h,this._compact=this.options.compact,this._container=m.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=m.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=m.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){m.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(h,v){const T=this._map._getUIString(`AttributionControl.${v}`);h.title=T,h.setAttribute("aria-label",T)}_updateAttributions(){if(!this._map.style)return;let h=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?h=h.concat(this.options.customAttribution.map(P=>typeof P!="string"?"":P)):typeof this.options.customAttribution=="string"&&h.push(this.options.customAttribution)),this._map.style.stylesheet){const P=this._map.style.stylesheet;this.styleOwner=P.owner,this.styleId=P.id}const v=this._map.style.sourceCaches;for(const P in v){const R=v[P];if(R.used||R.usedForTerrain){const V=R.getSource();V.attribution&&h.indexOf(V.attribution)<0&&h.push(V.attribution)}}h=h.filter(P=>String(P).trim()),h.sort((P,R)=>P.length-R.length),h=h.filter((P,R)=>{for(let V=R+1;V=0)return!1;return!0});const T=h.join(" | ");T!==this._attribHTML&&(this._attribHTML=T,h.length?(this._innerContainer.innerHTML=m.sanitize(T),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Wx{constructor(h={}){this._updateCompact=()=>{const v=this._container.children;if(v.length){const T=v[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&T.classList.add("maplibregl-compact"):T.classList.remove("maplibregl-compact")}},this.options=h}getDefaultPosition(){return"bottom-left"}onAdd(h){this._map=h,this._compact=this.options&&this.options.compact,this._container=m.create("div","maplibregl-ctrl");const v=m.create("a","maplibregl-ctrl-logo");return v.target="_blank",v.rel="noopener nofollow",v.href="https://maplibre.org/",v.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),v.setAttribute("rel","noopener nofollow"),this._container.appendChild(v),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){m.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class aA{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(h){const v=++this._id;return this._queue.push({callback:h,id:v,cancelled:!1}),v}remove(h){const v=this._currentlyRunning,T=v?this._queue.concat(v):this._queue;for(const P of T)if(P.id===h)return void(P.cancelled=!0)}run(h=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const v=this._currentlyRunning=this._queue;this._queue=[];for(const T of v)if(!T.cancelled&&(T.callback(h),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var lA=a.aI([{name:"a_pos3d",type:"Int16",components:3}]);class n3 extends a.E{constructor(h){super(),this._lastTilesetChange=p.now(),this.sourceCache=h,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=h._source.tileSize*2**this.deltaZoom,h.usedForTerrain=!0,h.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(h,v){this.sourceCache.update(h,v),this._renderableTilesKeys=[];const T={};for(const P of dt(h,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:v,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))T[P.key]=!0,this._renderableTilesKeys.push(P.key),this._tiles[P.key]||(P.terrainRttPosMatrix32f=new Float64Array(16),a.bX(P.terrainRttPosMatrix32f,0,a.$,a.$,0,0,1),this._tiles[P.key]=new It(P,this.tileSize),this._lastTilesetChange=p.now());for(const P in this._tiles)T[P]||delete this._tiles[P]}freeRtt(h){for(const v in this._tiles){const T=this._tiles[v];(!h||T.tileID.equals(h)||T.tileID.isChildOf(h)||h.isChildOf(T.tileID))&&(T.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(h=>this.getTileByID(h))}getTileByID(h){return this._tiles[h]}getTerrainCoords(h,v){return v?this._getTerrainCoordsForTileRanges(h,v):this._getTerrainCoordsForRegularTile(h)}_getTerrainCoordsForRegularTile(h){const v={};for(const T of this._renderableTilesKeys){const P=this._tiles[T].tileID,R=h.clone(),V=a.b9();if(P.canonical.equals(h.canonical))a.bX(V,0,a.$,a.$,0,0,1);else if(P.canonical.isChildOf(h.canonical)){const Y=P.canonical.z-h.canonical.z,K=P.canonical.x-(P.canonical.x>>Y<>Y<>Y;a.bX(V,0,ie,ie,0,0,1),a.M(V,V,[-K*ie,-te*ie,0])}else{if(!h.canonical.isChildOf(P.canonical))continue;{const Y=h.canonical.z-P.canonical.z,K=h.canonical.x-(h.canonical.x>>Y<>Y<>Y;a.bX(V,0,a.$,a.$,0,0,1),a.M(V,V,[K*ie,te*ie,0]),a.N(V,V,[1/2**Y,1/2**Y,0])}}R.terrainRttPosMatrix32f=new Float32Array(V),v[T]=R}return v}_getTerrainCoordsForTileRanges(h,v){const T={};for(const P of this._renderableTilesKeys){const R=this._tiles[P].tileID;if(!this._isWithinTileRanges(R,v))continue;const V=h.clone(),Y=a.b9();if(R.canonical.z===h.canonical.z){const K=h.canonical.x-R.canonical.x,te=h.canonical.y-R.canonical.y;a.bX(Y,0,a.$,a.$,0,0,1),a.M(Y,Y,[K*a.$,te*a.$,0])}else if(R.canonical.z>h.canonical.z){const K=R.canonical.z-h.canonical.z,te=R.canonical.x-(R.canonical.x>>K<>K<>K),ae=h.canonical.y-(R.canonical.y>>K),fe=a.$>>K;a.bX(Y,0,fe,fe,0,0,1),a.M(Y,Y,[-te*fe+ce*a.$,-ie*fe+ae*a.$,0])}else{const K=h.canonical.z-R.canonical.z,te=h.canonical.x-(h.canonical.x>>K<>K<>K)-R.canonical.x,ae=(h.canonical.y>>K)-R.canonical.y,fe=a.$<T.maxzoom&&(P=T.maxzoom),P=T.minzoom&&(!R||!R.dem);)R=this.sourceCache.getTileByID(h.scaledTo(P--).key);return R}anyTilesAfterTime(h=Date.now()){return this._lastTilesetChange>=h}_isWithinTileRanges(h,v){return v[h.canonical.z]&&h.canonical.x>=v[h.canonical.z].minTileX&&h.canonical.x<=v[h.canonical.z].maxTileX&&h.canonical.y>=v[h.canonical.z].minTileY&&h.canonical.y<=v[h.canonical.z].maxTileY}}class Wu{constructor(h,v,T){this._meshCache={},this.painter=h,this.sourceCache=new n3(v),this.options=T,this.exaggeration=typeof T.exaggeration=="number"?T.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(h,v,T,P=a.$){var R;if(!(v>=0&&v=0&&Th.canonical.z&&(h.canonical.z>=P?R=h.canonical.z-P:a.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const V=h.canonical.x-(h.canonical.x>>R<>R<>8<<4|R>>8,v[V+3]=0;const T=new a.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(v.buffer)),P=new a.T(h,T,h.gl.RGBA,{premultiply:!1});return P.bind(h.gl.NEAREST,h.gl.CLAMP_TO_EDGE),this._coordsTexture=P,P}pointCoordinate(h){this.painter.maybeDrawDepthAndCoords(!0);const v=new Uint8Array(4),T=this.painter.context,P=T.gl,R=Math.round(h.x*this.painter.pixelRatio/devicePixelRatio),V=Math.round(h.y*this.painter.pixelRatio/devicePixelRatio),Y=Math.round(this.painter.height/devicePixelRatio);T.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),P.readPixels(R,Y-V-1,1,1,P.RGBA,P.UNSIGNED_BYTE,v),T.bindFramebuffer.set(null);const K=v[0]+(v[2]>>4<<8),te=v[1]+((15&v[2])<<8),ie=this.coordsIndex[255-v[3]],ce=ie&&this.sourceCache.getTileByID(ie);if(!ce)return null;const ae=this._coordsTextureSize,fe=(1<0,P=T&&h.canonical.y===0,R=T&&h.canonical.y===(1<h.id!==v),this._recentlyUsed.push(h.id)}stampObject(h){h.stamp=++this._stamp}getOrCreateFreeObject(){for(const v of this._recentlyUsed)if(!this._objects[v].inUse)return this._objects[v];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const h=this._createObject(this._objects.length);return this._objects.push(h),h}freeObject(h){h.inUse=!1}freeAllObjects(){for(const h of this._objects)this.freeObject(h)}isFull(){return!(this._objects.length!h.inUse)===!1}}const tn={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class Cn{constructor(h,v){this.painter=h,this.terrain=v,this.pool=new W_(h.context,30,v.sourceCache.tileSize*v.qualityFactor)}destruct(){this.pool.destruct()}getTexture(h){return this.pool.getObjectForId(h.rtt[this._stacks.length-1].id).texture}prepareForRender(h,v){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=h._order.filter(T=>!h._layers[T].isHidden(v)),this._coordsAscending={};for(const T in h.sourceCaches){this._coordsAscending[T]={};const P=h.sourceCaches[T].getVisibleCoordinates(),R=h.sourceCaches[T].getSource(),V=R instanceof qe?R.terrainTileRanges:null;for(const Y of P){const K=this.terrain.sourceCache.getTerrainCoords(Y,V);for(const te in K)this._coordsAscending[T][te]||(this._coordsAscending[T][te]=[]),this._coordsAscending[T][te].push(K[te])}}this._coordsAscendingStr={};for(const T of h._order){const P=h._layers[T],R=P.source;if(tn[P.type]&&!this._coordsAscendingStr[R]){this._coordsAscendingStr[R]={};for(const V in this._coordsAscending[R])this._coordsAscendingStr[R][V]=this._coordsAscending[R][V].map(Y=>Y.key).sort().join()}}for(const T of this._renderableTiles)for(const P in this._coordsAscendingStr){const R=this._coordsAscendingStr[P][T.tileID.key];R&&R!==T.rttCoords[P]&&(T.rtt=[])}}renderLayer(h,v){if(h.isHidden(this.painter.transform.zoom))return!1;const T=Object.assign(Object.assign({},v),{isRenderingToTexture:!0}),P=h.type,R=this.painter,V=this._renderableLayerIds[this._renderableLayerIds.length-1]===h.id;if(tn[P]&&(this._prevType&&tn[this._prevType]||this._stacks.push([]),this._prevType=P,this._stacks[this._stacks.length-1].push(h.id),!V))return!0;if(tn[this._prevType]||tn[P]&&V){this._prevType=P;const Y=this._stacks.length-1,K=this._stacks[Y]||[];for(const te of this._renderableTiles){if(this.pool.isFull()&&(bo(this.painter,this.terrain,this._rttTiles,T),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(te),te.rtt[Y]){const ce=this.pool.getObjectForId(te.rtt[Y].id);if(ce.stamp===te.rtt[Y].stamp){this.pool.useObject(ce);continue}}const ie=this.pool.getOrCreateFreeObject();this.pool.useObject(ie),this.pool.stampObject(ie),te.rtt[Y]={id:ie.id,stamp:ie.stamp},R.context.bindFramebuffer.set(ie.fbo.framebuffer),R.context.clear({color:a.be.transparent,stencil:0}),R.currentStencilSource=void 0;for(let ce=0;ce{this.startMove(R,m.mousePos(this.element,R)),m.addEventListener(window,"mousemove",this.mousemove),m.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=R=>{this.move(R,m.mousePos(this.element,R))},this.mouseup=R=>{this._rotatePitchHanlder.dragEnd(R),this.offTemp()},this.touchstart=R=>{R.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=m.touchPos(this.element,R.targetTouches)[0],this.startMove(R,this._startPos),m.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),m.addEventListener(window,"touchend",this.touchend))},this.touchmove=R=>{R.targetTouches.length!==1?this.reset():(this._lastPos=m.touchPos(this.element,R.targetTouches)[0],this.move(R,this._lastPos))},this.touchend=R=>{R.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=v;const P=new KR;this._rotatePitchHanlder=new Rm({clickTolerance:3,move:(R,V)=>{const Y=v.getBoundingClientRect(),K=new a.P((Y.bottom-Y.top)/2,(Y.right-Y.left)/2);return{bearingDelta:a.cm(new a.P(R.x,V.y),V,K),pitchDelta:T?-.5*(V.y-R.y):void 0}},moveStateManager:P,enable:!0,assignEvents:()=>{}}),this.map=h,m.addEventListener(v,"mousedown",this.mousedown),m.addEventListener(v,"touchstart",this.touchstart,{passive:!1}),m.addEventListener(v,"touchcancel",this.reset)}startMove(h,v){this._rotatePitchHanlder.dragStart(h,v),m.disableDrag()}move(h,v){const T=this.map,{bearingDelta:P,pitchDelta:R}=this._rotatePitchHanlder.dragMove(h,v)||{};P&&T.setBearing(T.getBearing()+P),R&&T.setPitch(T.getPitch()+R)}off(){const h=this.element;m.removeEventListener(h,"mousedown",this.mousedown),m.removeEventListener(h,"touchstart",this.touchstart,{passive:!1}),m.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),m.removeEventListener(window,"touchend",this.touchend),m.removeEventListener(h,"touchcancel",this.reset),this.offTemp()}offTemp(){m.enableDrag(),m.removeEventListener(window,"mousemove",this.mousemove),m.removeEventListener(window,"mouseup",this.mouseup),m.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),m.removeEventListener(window,"touchend",this.touchend)}}let Hs;function uA(D,h,v,T=!1){if(T||!v.getCoveringTilesDetailsProvider().allowWorldCopies())return D==null?void 0:D.wrap();const P=new a.S(D.lng,D.lat);if(D=new a.S(D.lng,D.lat),h){const R=new a.S(D.lng-360,D.lat),V=new a.S(D.lng+360,D.lat),Y=v.locationToScreenPoint(D).distSqr(h);v.locationToScreenPoint(R).distSqr(h)180;){const R=v.locationToScreenPoint(D);if(R.x>=0&&R.y>=0&&R.x<=v.width&&R.y<=v.height)break;D.lng>v.center.lng?D.lng-=360:D.lng+=360}return D.lng!==P.lng&&v.isPointOnMapSurface(v.locationToScreenPoint(D))?D:P}const tp={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function lo(D,h,v){const T=D.classList;for(const P in tp)T.remove(`maplibregl-${v}-anchor-${P}`);T.add(`maplibregl-${v}-anchor-${h}`)}class wo extends a.E{constructor(h){if(super(),this._onKeyPress=v=>{const T=v.code,P=v.charCode||v.keyCode;T!=="Space"&&T!=="Enter"&&P!==32&&P!==13||this.togglePopup()},this._onMapClick=v=>{const T=v.originalEvent.target,P=this._element;this._popup&&(T===P||P.contains(T))&&this.togglePopup()},this._update=v=>{if(!this._map)return;const T=this._map.loaded()&&!this._map.isMoving();((v==null?void 0:v.type)==="terrain"||(v==null?void 0:v.type)==="render"&&!T)&&this._map.once("render",this._update),this._lngLat=uA(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let P="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?P=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(P=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let R="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?R="rotateX(0deg)":this._pitchAlignment==="map"&&(R=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||v&&v.type!=="moveend"||(this._pos=this._pos.round()),m.setTransform(this._element,`${tp[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${R} ${P}`),p.frameAsync(new AbortController).then(()=>{this._updateOpacity(v&&v.type==="moveend")}).catch(()=>{})},this._onMove=v=>{if(!this._isDragging){const T=this._clickTolerance||this._map._clickTolerance;this._isDragging=v.point.dist(this._pointerdownPos)>=T}this._isDragging&&(this._pos=v.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new a.l("dragstart"))),this.fire(new a.l("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new a.l("dragend")),this._state="inactive"},this._addDragHandler=v=>{this._element.contains(v.originalEvent.target)&&(v.preventDefault(),this._positionDelta=v.point.sub(this._pos).add(this._offset),this._pointerdownPos=v.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=h&&h.anchor||"center",this._color=h&&h.color||"#3FB1CE",this._scale=h&&h.scale||1,this._draggable=h&&h.draggable||!1,this._clickTolerance=h&&h.clickTolerance||0,this._subpixelPositioning=h&&h.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=h&&h.rotation||0,this._rotationAlignment=h&&h.rotationAlignment||"auto",this._pitchAlignment=h&&h.pitchAlignment&&h.pitchAlignment!=="auto"?h.pitchAlignment:this._rotationAlignment,this.setOpacity(h==null?void 0:h.opacity,h==null?void 0:h.opacityWhenCovered),h&&h.element)this._element=h.element,this._offset=a.P.convert(h&&h.offset||[0,0]);else{this._defaultMarker=!0,this._element=m.create("div");const v=m.createNS("http://www.w3.org/2000/svg","svg"),T=41,P=27;v.setAttributeNS(null,"display","block"),v.setAttributeNS(null,"height",`${T}px`),v.setAttributeNS(null,"width",`${P}px`),v.setAttributeNS(null,"viewBox",`0 0 ${P} ${T}`);const R=m.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"stroke","none"),R.setAttributeNS(null,"stroke-width","1"),R.setAttributeNS(null,"fill","none"),R.setAttributeNS(null,"fill-rule","evenodd");const V=m.createNS("http://www.w3.org/2000/svg","g");V.setAttributeNS(null,"fill-rule","nonzero");const Y=m.createNS("http://www.w3.org/2000/svg","g");Y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),Y.setAttributeNS(null,"fill","#000000");const K=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const Ae of K){const Pe=m.createNS("http://www.w3.org/2000/svg","ellipse");Pe.setAttributeNS(null,"opacity","0.04"),Pe.setAttributeNS(null,"cx","10.5"),Pe.setAttributeNS(null,"cy","5.80029008"),Pe.setAttributeNS(null,"rx",Ae.rx),Pe.setAttributeNS(null,"ry",Ae.ry),Y.appendChild(Pe)}const te=m.createNS("http://www.w3.org/2000/svg","g");te.setAttributeNS(null,"fill",this._color);const ie=m.createNS("http://www.w3.org/2000/svg","path");ie.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),te.appendChild(ie);const ce=m.createNS("http://www.w3.org/2000/svg","g");ce.setAttributeNS(null,"opacity","0.25"),ce.setAttributeNS(null,"fill","#000000");const ae=m.createNS("http://www.w3.org/2000/svg","path");ae.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),ce.appendChild(ae);const fe=m.createNS("http://www.w3.org/2000/svg","g");fe.setAttributeNS(null,"transform","translate(6.0, 7.0)"),fe.setAttributeNS(null,"fill","#FFFFFF");const _e=m.createNS("http://www.w3.org/2000/svg","g");_e.setAttributeNS(null,"transform","translate(8.0, 8.0)");const Me=m.createNS("http://www.w3.org/2000/svg","circle");Me.setAttributeNS(null,"fill","#000000"),Me.setAttributeNS(null,"opacity","0.25"),Me.setAttributeNS(null,"cx","5.5"),Me.setAttributeNS(null,"cy","5.5"),Me.setAttributeNS(null,"r","5.4999962");const Te=m.createNS("http://www.w3.org/2000/svg","circle");Te.setAttributeNS(null,"fill","#FFFFFF"),Te.setAttributeNS(null,"cx","5.5"),Te.setAttributeNS(null,"cy","5.5"),Te.setAttributeNS(null,"r","5.4999962"),_e.appendChild(Me),_e.appendChild(Te),V.appendChild(Y),V.appendChild(te),V.appendChild(ce),V.appendChild(fe),V.appendChild(_e),v.appendChild(V),v.setAttributeNS(null,"height",T*this._scale+"px"),v.setAttributeNS(null,"width",P*this._scale+"px"),this._element.appendChild(v),this._offset=a.P.convert(h&&h.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",v=>{v.preventDefault()}),this._element.addEventListener("mousedown",v=>{v.preventDefault()}),lo(this._element,this._anchor,"marker"),h&&h.className)for(const v of h.className.split(" "))this._element.classList.add(v);this._popup=null}addTo(h){return this.remove(),this._map=h,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",h._getUIString("Marker.Title")),h.getCanvasContainer().appendChild(this._element),h.on("move",this._update),h.on("moveend",this._update),h.on("terrain",this._update),h.on("projectiontransition",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),m.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(h){return this._lngLat=a.S.convert(h),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(h){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),h){if(!("offset"in h.options)){const P=Math.abs(13.5)/Math.SQRT2;h.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[P,-1*(38.1-13.5+P)],"bottom-right":[-P,-1*(38.1-13.5+P)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=h,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(h){return this._subpixelPositioning=h,this}getPopup(){return this._popup}togglePopup(){const h=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:h?(h.isOpen()?h.remove():(h.setLngLat(this._lngLat),h.addTo(this._map)),this):this}_updateOpacity(h=!1){var v,T;const P=(v=this._map)===null||v===void 0?void 0:v.terrain,R=this._map.transform.isLocationOccluded(this._lngLat);if(!P||R){const fe=R?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==fe&&(this._element.style.opacity=fe))}if(h)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const V=this._map,Y=V.terrain.depthAtPoint(this._pos),K=V.terrain.getElevationForLngLatZoom(this._lngLat,V.transform.tileZoom);if(V.transform.lngLatToCameraDepth(this._lngLat,K)-Y<.006)return void(this._element.style.opacity=this._opacity);const te=-this._offset.y/V.transform.pixelsPerMeter,ie=Math.sin(V.getPitch()*Math.PI/180)*te,ce=V.terrain.depthAtPoint(new a.P(this._pos.x,this._pos.y-this._offset.y)),ae=V.transform.lngLatToCameraDepth(this._lngLat,K+ie)-ce>.006;!((T=this._popup)===null||T===void 0)&&T.isOpen()&&ae&&this._popup.remove(),this._element.style.opacity=ae?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(h){return this._offset=a.P.convert(h),this._update(),this}addClassName(h){this._element.classList.add(h)}removeClassName(h){this._element.classList.remove(h)}toggleClassName(h){return this._element.classList.toggle(h)}setDraggable(h){return this._draggable=!!h,this._map&&(h?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(h){return this._rotation=h||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(h){return this._rotationAlignment=h||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(h){return this._pitchAlignment=h&&h!=="auto"?h:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(h,v){return(this._opacity===void 0||h===void 0&&v===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),h!==void 0&&(this._opacity=h),v!==void 0&&(this._opacityWhenCovered=v),this._map&&this._updateOpacity(!0),this}}const hA={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Nd=0,Od=!1;const qx={maxWidth:100,unit:"metric"};function q_(D,h,v){const T=v&&v.maxWidth||100,P=D._container.clientHeight/2,R=D._container.clientWidth/2,V=D.unproject([R-T/2,P]),Y=D.unproject([R+T/2,P]),K=Math.round(D.project(Y).x-D.project(V).x),te=Math.min(T,K,D._container.clientWidth),ie=V.distanceTo(Y);if(v&&v.unit==="imperial"){const ce=3.2808*ie;ce>5280?np(h,te,ce/5280,D._getUIString("ScaleControl.Miles")):np(h,te,ce,D._getUIString("ScaleControl.Feet"))}else v&&v.unit==="nautical"?np(h,te,ie/1852,D._getUIString("ScaleControl.NauticalMiles")):ie>=1e3?np(h,te,ie/1e3,D._getUIString("ScaleControl.Kilometers")):np(h,te,ie,D._getUIString("ScaleControl.Meters"))}function np(D,h,v,T){const P=function(R){const V=Math.pow(10,`${Math.floor(R)}`.length-1);let Y=R/V;return Y=Y>=10?10:Y>=5?5:Y>=3?3:Y>=2?2:Y>=1?1:function(K){const te=Math.pow(10,Math.ceil(-Math.log(K)/Math.LN10));return Math.round(K*te)/te}(Y),V*Y}(v);D.style.width=h*(P/v)+"px",D.innerHTML=`${P} ${T}`}const Ky={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Yx=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Y_(D){if(D){if(typeof D=="number"){const h=Math.round(Math.abs(D)/Math.SQRT2);return{center:new a.P(0,0),top:new a.P(0,D),"top-left":new a.P(h,h),"top-right":new a.P(-h,h),bottom:new a.P(0,-D),"bottom-left":new a.P(h,-h),"bottom-right":new a.P(-h,-h),left:new a.P(D,0),right:new a.P(-D,0)}}if(D instanceof a.P||Array.isArray(D)){const h=a.P.convert(D);return{center:h,top:h,"top-left":h,"top-right":h,bottom:h,"bottom-left":h,"bottom-right":h,left:h,right:h}}return{center:a.P.convert(D.center||[0,0]),top:a.P.convert(D.top||[0,0]),"top-left":a.P.convert(D["top-left"]||[0,0]),"top-right":a.P.convert(D["top-right"]||[0,0]),bottom:a.P.convert(D.bottom||[0,0]),"bottom-left":a.P.convert(D["bottom-left"]||[0,0]),"bottom-right":a.P.convert(D["bottom-right"]||[0,0]),left:a.P.convert(D.left||[0,0]),right:a.P.convert(D.right||[0,0])}}return Y_(new a.P(0,0))}const Zx=l;s.AJAXError=a.cy,s.Event=a.l,s.Evented=a.E,s.LngLat=a.S,s.MercatorCoordinate=a.a0,s.Point=a.P,s.addProtocol=a.cz,s.config=a.a,s.removeProtocol=a.cA,s.AttributionControl=H_,s.BoxZoomHandler=Rx,s.CanvasSource=qt,s.CooperativeGesturesHandler=sA,s.DoubleClickZoomHandler=j_,s.DragPanHandler=jx,s.DragRotateHandler=U_,s.EdgeInsets=pc,s.FullscreenControl=class extends a.E{constructor(D={}){super(),this._onFullscreenChange=()=>{var h;let v=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((h=v==null?void 0:v.shadowRoot)===null||h===void 0)&&h.fullscreenElement;)v=v.shadowRoot.fullscreenElement;v===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,D&&D.container&&(D.container instanceof HTMLElement?this._container=D.container:a.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(D){return this._map=D,this._container||(this._container=this._map.getContainer()),this._controlContainer=m.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){m.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const D=this._fullscreenButton=m.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);m.create("span","maplibregl-ctrl-icon",D).setAttribute("aria-hidden","true"),D.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const D=this._getTitle();this._fullscreenButton.setAttribute("aria-label",D),this._fullscreenButton.title=D}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new a.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new a.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},s.GeoJSONSource=Ue,s.GeolocateControl=class extends a.E{constructor(D){super(),this._onSuccess=h=>{if(this._map){if(this._isOutOfMapMaxBounds(h))return this._setErrorState(),this.fire(new a.l("outofmaxbounds",h)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=h,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(h),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(h),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new a.l("geolocate",h)),this._finish()}},this._updateCamera=h=>{const v=new a.S(h.coords.longitude,h.coords.latitude),T=h.coords.accuracy,P=this._map.getBearing(),R=a.e({bearing:P},this.options.fitBoundsOptions),V=Ht.fromLngLat(v,T);this._map.fitBounds(V,R,{geolocateSource:!0})},this._updateMarker=h=>{if(h){const v=new a.S(h.coords.longitude,h.coords.latitude);this._accuracyCircleMarker.setLngLat(v).addTo(this._map),this._userLocationDotMarker.setLngLat(v).addTo(this._map),this._accuracy=h.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=h=>{if(this._map){if(h.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const v=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=v,this._geolocateButton.setAttribute("aria-label",v),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(h.code===3&&Od)return;this.options.trackUserLocation&&this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new a.l("error",h)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",h=>h.preventDefault()),this._geolocateButton=m.create("button","maplibregl-ctrl-geolocate",this._container),m.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=h=>{if(this._map){if(h===!1){a.w("Geolocation support is not available so the GeolocateControl will be disabled.");const v=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=v,this._geolocateButton.setAttribute("aria-label",v)}else{const v=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=v,this._geolocateButton.setAttribute("aria-label",v)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=m.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new wo({element:this._dotElement}),this._circleElement=m.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new wo({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",v=>{v.geolocateSource||this._watchState!=="ACTIVE_LOCK"||v.originalEvent&&v.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new a.l("trackuserlocationend")),this.fire(new a.l("userlocationlostfocus")))})}},this.options=a.e({},hA,D)}onAdd(D){return this._map=D,this._container=m.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return a._(this,arguments,void 0,function*(h=!1){if(Hs!==void 0&&!h)return Hs;if(window.navigator.permissions===void 0)return Hs=!!window.navigator.geolocation,Hs;try{Hs=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Hs=!!window.navigator.geolocation}return Hs})}().then(h=>this._finishSetupUI(h)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),m.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Nd=0,Od=!1}_isOutOfMapMaxBounds(D){const h=this._map.getMaxBounds(),v=D.coords;return h&&(v.longitudeh.getEast()||v.latitudeh.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const D=this._map.getBounds(),h=D.getSouthEast(),v=D.getNorthEast(),T=h.distanceTo(v),P=Math.ceil(this._accuracy/(T/this._map._container.clientHeight)*2);this._circleElement.style.width=`${P}px`,this._circleElement.style.height=`${P}px`}trigger(){if(!this._setup)return a.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new a.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Nd--,Od=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new a.l("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.l("trackuserlocationstart")),this.fire(new a.l("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let D;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Nd++,Nd>1?(D={maximumAge:6e5,timeout:0},Od=!0):(D=this.options.positionOptions,Od=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,D)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},s.GlobeControl=class{constructor(){this._toggleProjection=()=>{var D;const h=(D=this._map.getProjection())===null||D===void 0?void 0:D.type;this._map.setProjection(h!=="mercator"&&h?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var D;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((D=this._map.getProjection())===null||D===void 0?void 0:D.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(D){return this._map=D,this._container=m.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=m.create("button","maplibregl-ctrl-globe",this._container),m.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){m.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},s.Hash=Uy,s.ImageSource=qe,s.KeyboardHandler=$m,s.LngLatBounds=Ht,s.LogoControl=Wx,s.Map=class extends Qi{constructor(D){var h,v;a.cv.mark(a.cw.create);const T=Object.assign(Object.assign(Object.assign({},Xy),D),{canvasContextAttributes:Object.assign(Object.assign({},Xy.canvasContextAttributes),D.canvasContextAttributes)});if(T.minZoom!=null&&T.maxZoom!=null&&T.minZoom>T.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(T.minPitch!=null&&T.maxPitch!=null&&T.minPitch>T.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(T.minPitch!=null&&T.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(T.maxPitch!=null&&T.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const P=new Yo,R=new y_;if(T.minZoom!==void 0&&P.setMinZoom(T.minZoom),T.maxZoom!==void 0&&P.setMaxZoom(T.maxZoom),T.minPitch!==void 0&&P.setMinPitch(T.minPitch),T.maxPitch!==void 0&&P.setMaxPitch(T.maxPitch),T.renderWorldCopies!==void 0&&P.setRenderWorldCopies(T.renderWorldCopies),super(P,R,{bearingSnap:T.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new aA,this._controls=[],this._mapId=a.a6(),this._contextLost=Y=>{Y.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new a.l("webglcontextlost",{originalEvent:Y}))},this._contextRestored=Y=>{this._setupPainter(),this.resize(),this._update(),this.fire(new a.l("webglcontextrestored",{originalEvent:Y}))},this._onMapScroll=Y=>{if(Y.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=T.interactive,this._maxTileCacheSize=T.maxTileCacheSize,this._maxTileCacheZoomLevels=T.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},T.canvasContextAttributes),this._trackResize=T.trackResize===!0,this._bearingSnap=T.bearingSnap,this._centerClampedToGround=T.centerClampedToGround,this._refreshExpiredTiles=T.refreshExpiredTiles===!0,this._fadeDuration=T.fadeDuration,this._crossSourceCollisions=T.crossSourceCollisions===!0,this._collectResourceTiming=T.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},G_),T.locale),this._clickTolerance=T.clickTolerance,this._overridePixelRatio=T.pixelRatio,this._maxCanvasSize=T.maxCanvasSize,this.transformCameraUpdate=T.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=T.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=E.addThrottleControl(()=>this.isMoving()),this._requestManager=new A(T.transformRequest),typeof T.container=="string"){if(this._container=document.getElementById(T.container),!this._container)throw new Error(`Container '${T.container}' not found.`)}else{if(!(T.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=T.container}if(T.maxBounds&&this.setMaxBounds(T.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let Y=!1;const K=B_(te=>{this._trackResize&&!this._removed&&(this.resize(te),this.redraw())},50);this._resizeObserver=new ResizeObserver(te=>{Y?K(te):Y=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Pd(this,T),this._hash=T.hash&&new Uy(typeof T.hash=="string"&&T.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:T.center,elevation:T.elevation,zoom:T.zoom,bearing:T.bearing,pitch:T.pitch,roll:T.roll}),T.bounds&&(this.resize(),this.fitBounds(T.bounds,a.e({},T.fitBoundsOptions,{duration:0}))));const V=typeof T.style=="string"||((v=(h=T.style)===null||h===void 0?void 0:h.projection)===null||v===void 0?void 0:v.type)!=="globe";this.resize(null,V),this._localIdeographFontFamily=T.localIdeographFontFamily,this._validateStyle=T.validateStyle,T.style&&this.setStyle(T.style,{localIdeographFontFamily:T.localIdeographFontFamily}),T.attributionControl&&this.addControl(new H_(typeof T.attributionControl=="boolean"?void 0:T.attributionControl)),T.maplibreLogo&&this.addControl(new Wx,T.logoPosition),this.on("style.load",()=>{if(V||this._resizeTransform(),this.transform.unmodified){const Y=a.Q(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(Y)}}),this.on("data",Y=>{this._update(Y.dataType==="style"),this.fire(new a.l(`${Y.dataType}data`,Y))}),this.on("dataloading",Y=>{this.fire(new a.l(`${Y.dataType}dataloading`,Y))}),this.on("dataabort",Y=>{this.fire(new a.l("sourcedataabort",Y))})}_getMapId(){return this._mapId}setGlobalStateProperty(D,h){return this.style.setGlobalStateProperty(D,h),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(D,h){if(h===void 0&&(h=D.getDefaultPosition?D.getDefaultPosition():"top-right"),!D||!D.onAdd)return this.fire(new a.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const v=D.onAdd(this);this._controls.push(D);const T=this._controlPositions[h];return h.indexOf("bottom")!==-1?T.insertBefore(v,T.firstChild):T.appendChild(v),this}removeControl(D){if(!D||!D.onRemove)return this.fire(new a.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const h=this._controls.indexOf(D);return h>-1&&this._controls.splice(h,1),D.onRemove(this),this}hasControl(D){return this._controls.indexOf(D)>-1}calculateCameraOptionsFromTo(D,h,v,T){return T==null&&this.terrain&&(T=this.terrain.getElevationForLngLatZoom(v,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(D,h,v,T)}resize(D,h=!0){const[v,T]=this._containerDimensions(),P=this._getClampedPixelRatio(v,T);if(this._resizeCanvas(v,T,P),this.painter.resize(v,T,P),this.painter.overLimit()){const V=this.painter.context.gl;this._maxCanvasSize=[V.drawingBufferWidth,V.drawingBufferHeight];const Y=this._getClampedPixelRatio(v,T);this._resizeCanvas(v,T,Y),this.painter.resize(v,T,Y)}this._resizeTransform(h);const R=!this._moving;return R&&(this.stop(),this.fire(new a.l("movestart",D)).fire(new a.l("move",D))),this.fire(new a.l("resize",D)),R&&this.fire(new a.l("moveend",D)),this}_resizeTransform(D=!0){var h;const[v,T]=this._containerDimensions();this.transform.resize(v,T,D),(h=this._requestedCameraState)===null||h===void 0||h.resize(v,T,D)}_getClampedPixelRatio(D,h){const{0:v,1:T}=this._maxCanvasSize,P=this.getPixelRatio(),R=D*P,V=h*P;return Math.min(R>v?v/R:1,V>T?T/V:1)*P}getPixelRatio(){var D;return(D=this._overridePixelRatio)!==null&&D!==void 0?D:devicePixelRatio}setPixelRatio(D){this._overridePixelRatio=D,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(D){return this.transform.setMaxBounds(Ht.convert(D)),this._update()}setMinZoom(D){if((D=D??-2)>=-2&&D<=this.transform.maxZoom)return this.transform.setMinZoom(D),this._update(),this.getZoom()=this.transform.minZoom)return this.transform.setMaxZoom(D),this._update(),this.getZoom()>D&&this.setZoom(D),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(D){if((D=D??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(D>=0&&D<=this.transform.maxPitch)return this.transform.setMinPitch(D),this._update(),this.getPitch()180)throw new Error("maxPitch must be less than or equal to 180");if(D>=this.transform.minPitch)return this.transform.setMaxPitch(D),this._update(),this.getPitch()>D&&this.setPitch(D),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(D){return this.transform.setRenderWorldCopies(D),this._update()}project(D){return this.transform.locationToScreenPoint(a.S.convert(D),this.style&&this.terrain)}unproject(D){return this.transform.screenPointToLocation(a.P.convert(D),this.terrain)}isMoving(){var D;return this._moving||((D=this.handlers)===null||D===void 0?void 0:D.isMoving())}isZooming(){var D;return this._zooming||((D=this.handlers)===null||D===void 0?void 0:D.isZooming())}isRotating(){var D;return this._rotating||((D=this.handlers)===null||D===void 0?void 0:D.isRotating())}_createDelegatedListener(D,h,v){if(D==="mouseenter"||D==="mouseover"){let T=!1;return{layers:h,listener:v,delegates:{mousemove:R=>{const V=h.filter(K=>this.getLayer(K)),Y=V.length!==0?this.queryRenderedFeatures(R.point,{layers:V}):[];Y.length?T||(T=!0,v.call(this,new hl(D,this,R.originalEvent,{features:Y}))):T=!1},mouseout:()=>{T=!1}}}}if(D==="mouseleave"||D==="mouseout"){let T=!1;return{layers:h,listener:v,delegates:{mousemove:V=>{const Y=h.filter(K=>this.getLayer(K));(Y.length!==0?this.queryRenderedFeatures(V.point,{layers:Y}):[]).length?T=!0:T&&(T=!1,v.call(this,new hl(D,this,V.originalEvent)))},mouseout:V=>{T&&(T=!1,v.call(this,new hl(D,this,V.originalEvent)))}}}}{const T=P=>{const R=h.filter(Y=>this.getLayer(Y)),V=R.length!==0?this.queryRenderedFeatures(P.point,{layers:R}):[];V.length&&(P.features=V,v.call(this,P),delete P.features)};return{layers:h,listener:v,delegates:{[D]:T}}}}_saveDelegatedListener(D,h){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[D]=this._delegatedListeners[D]||[],this._delegatedListeners[D].push(h)}_removeDelegatedListener(D,h,v){if(!this._delegatedListeners||!this._delegatedListeners[D])return;const T=this._delegatedListeners[D];for(let P=0;Ph.includes(V))){for(const V in R.delegates)this.off(V,R.delegates[V]);return void T.splice(P,1)}}}on(D,h,v){if(v===void 0)return super.on(D,h);const T=typeof h=="string"?[h]:h,P=this._createDelegatedListener(D,T,v);this._saveDelegatedListener(D,P);for(const R in P.delegates)this.on(R,P.delegates[R]);return{unsubscribe:()=>{this._removeDelegatedListener(D,T,v)}}}once(D,h,v){if(v===void 0)return super.once(D,h);const T=typeof h=="string"?[h]:h,P=this._createDelegatedListener(D,T,v);for(const R in P.delegates){const V=P.delegates[R];P.delegates[R]=(...Y)=>{this._removeDelegatedListener(D,T,v),V(...Y)}}this._saveDelegatedListener(D,P);for(const R in P.delegates)this.once(R,P.delegates[R]);return this}off(D,h,v){return v===void 0?super.off(D,h):(this._removeDelegatedListener(D,typeof h=="string"?[h]:h,v),this)}queryRenderedFeatures(D,h){if(!this.style)return[];let v;const T=D instanceof a.P||Array.isArray(D),P=T?D:[[0,0],[this.transform.width,this.transform.height]];if(h=h||(T?{}:D)||{},P instanceof a.P||typeof P[0]=="number")v=[a.P.convert(P)];else{const R=a.P.convert(P[0]),V=a.P.convert(P[1]);v=[R,new a.P(V.x,R.y),V,new a.P(R.x,V.y),R]}return this.style.queryRenderedFeatures(v,h,this.transform)}querySourceFeatures(D,h){return this.style.querySourceFeatures(D,h)}setStyle(D,h){return(h=a.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},h)).diff!==!1&&h.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&D?(this._diffStyle(D,h),this):(this._localIdeographFontFamily=h.localIdeographFontFamily,this._updateStyle(D,h))}setTransformRequest(D){return this._requestManager.setTransformRequest(D),this}_getUIString(D){const h=this._locale[D];if(h==null)throw new Error(`Missing UI string '${D}'`);return h}_updateStyle(D,h){var v,T;if(h.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(D,h));const P=this.style&&h.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!D)),D?(this.style=new fx(this,h||{}),this.style.setEventedParent(this,{style:this.style}),typeof D=="string"?this.style.loadURL(D,h,P):this.style.loadJSON(D,h,P),this):((T=(v=this.style)===null||v===void 0?void 0:v.projection)===null||T===void 0||T.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new fx(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(D,h){if(typeof D=="string"){const v=this._requestManager.transformRequest(D,"Style");a.j(v,new AbortController).then(T=>{this._updateDiff(T.data,h)}).catch(T=>{T&&this.fire(new a.k(T))})}else typeof D=="object"&&this._updateDiff(D,h)}_updateDiff(D,h){try{this.style.setState(D,h)&&this._update(!0)}catch(v){a.w(`Unable to perform style diff: ${v.message||v.error||v}. Rebuilding the style from scratch.`),this._updateStyle(D,h)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():a.w("There is no style added to the map.")}addSource(D,h){return this._lazyInitEmptyStyle(),this.style.addSource(D,h),this._update(!0)}isSourceLoaded(D){const h=this.style&&this.style.sourceCaches[D];if(h!==void 0)return h.loaded();this.fire(new a.k(new Error(`There is no source with ID '${D}'`)))}setTerrain(D){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),D){const h=this.style.sourceCaches[D.source];if(!h)throw new Error(`cannot load terrain, because there exists no source with ID: ${D.source}`);this.terrain===null&&h.reload();for(const v in this.style._layers){const T=this.style._layers[v];T.type==="hillshade"&&T.source===D.source&&a.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),T.type==="color-relief"&&T.source===D.source&&a.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Wu(this.painter,h,D),this.painter.renderToTexture=new Cn(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=v=>{var T;v.dataType==="style"?this.terrain.sourceCache.freeRtt():v.dataType==="source"&&v.tile&&(v.sourceId!==D.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((T=v.source)===null||T===void 0?void 0:T.type)==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(v.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new a.l("terrain",{terrain:D})),this}getTerrain(){var D,h;return(h=(D=this.terrain)===null||D===void 0?void 0:D.options)!==null&&h!==void 0?h:null}areTilesLoaded(){const D=this.style&&this.style.sourceCaches;for(const h in D){const v=D[h]._tiles;for(const T in v){const P=v[T];if(P.state!=="loaded"&&P.state!=="errored")return!1}}return!0}removeSource(D){return this.style.removeSource(D),this._update(!0)}getSource(D){return this.style.getSource(D)}setSourceTileLodParams(D,h,v){if(v){const T=this.getSource(v);if(!T)throw new Error(`There is no source with ID "${v}", cannot set LOD parameters`);T.calculateTileZoom=tt(Math.max(1,D),Math.max(1,h))}else for(const T in this.style.sourceCaches)this.style.sourceCaches[T].getSource().calculateTileZoom=tt(Math.max(1,D),Math.max(1,h));return this._update(!0),this}refreshTiles(D,h){const v=this.style.sourceCaches[D];if(!v)throw new Error(`There is no source cache with ID "${D}", cannot refresh tile`);h===void 0?v.reload(!0):v.refreshTiles(h.map(T=>new a.a3(T.z,T.x,T.y)))}addImage(D,h,v={}){const{pixelRatio:T=1,sdf:P=!1,stretchX:R,stretchY:V,content:Y,textFitWidth:K,textFitHeight:te}=v;if(this._lazyInitEmptyStyle(),!(h instanceof HTMLImageElement||a.b(h))){if(h.width===void 0||h.height===void 0)return this.fire(new a.k(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:ie,height:ce,data:ae}=h,fe=h;return this.style.addImage(D,{data:new a.R({width:ie,height:ce},new Uint8Array(ae)),pixelRatio:T,stretchX:R,stretchY:V,content:Y,textFitWidth:K,textFitHeight:te,sdf:P,version:0,userImage:fe}),fe.onAdd&&fe.onAdd(this,D),this}}{const{width:ie,height:ce,data:ae}=p.getImageData(h);this.style.addImage(D,{data:new a.R({width:ie,height:ce},ae),pixelRatio:T,stretchX:R,stretchY:V,content:Y,textFitWidth:K,textFitHeight:te,sdf:P,version:0})}}updateImage(D,h){const v=this.style.getImage(D);if(!v)return this.fire(new a.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const T=h instanceof HTMLImageElement||a.b(h)?p.getImageData(h):h,{width:P,height:R,data:V}=T;if(P===void 0||R===void 0)return this.fire(new a.k(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(P!==v.data.width||R!==v.data.height)return this.fire(new a.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const Y=!(h instanceof HTMLImageElement||a.b(h));return v.data.replace(V,Y),this.style.updateImage(D,v),this}getImage(D){return this.style.getImage(D)}hasImage(D){return D?!!this.style.getImage(D):(this.fire(new a.k(new Error("Missing required image id"))),!1)}removeImage(D){this.style.removeImage(D)}loadImage(D){return E.getImage(this._requestManager.transformRequest(D,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(D,h){return this._lazyInitEmptyStyle(),this.style.addLayer(D,h),this._update(!0)}moveLayer(D,h){return this.style.moveLayer(D,h),this._update(!0)}removeLayer(D){return this.style.removeLayer(D),this._update(!0)}getLayer(D){return this.style.getLayer(D)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(D,h,v){return this.style.setLayerZoomRange(D,h,v),this._update(!0)}setFilter(D,h,v={}){return this.style.setFilter(D,h,v),this._update(!0)}getFilter(D){return this.style.getFilter(D)}setPaintProperty(D,h,v,T={}){return this.style.setPaintProperty(D,h,v,T),this._update(!0)}getPaintProperty(D,h){return this.style.getPaintProperty(D,h)}setLayoutProperty(D,h,v,T={}){return this.style.setLayoutProperty(D,h,v,T),this._update(!0)}getLayoutProperty(D,h){return this.style.getLayoutProperty(D,h)}setGlyphs(D,h={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(D,h),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(D,h,v={}){return this._lazyInitEmptyStyle(),this.style.addSprite(D,h,v,T=>{T||this._update(!0)}),this}removeSprite(D){return this._lazyInitEmptyStyle(),this.style.removeSprite(D),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(D,h={}){return this._lazyInitEmptyStyle(),this.style.setSprite(D,h,v=>{v||this._update(!0)}),this}setLight(D,h={}){return this._lazyInitEmptyStyle(),this.style.setLight(D,h),this._update(!0)}getLight(){return this.style.getLight()}setSky(D,h={}){return this._lazyInitEmptyStyle(),this.style.setSky(D,h),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(D,h){return this.style.setFeatureState(D,h),this._update()}removeFeatureState(D,h){return this.style.removeFeatureState(D,h),this._update()}getFeatureState(D){return this.style.getFeatureState(D)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let D=0,h=0;return this._container&&(D=this._container.clientWidth||400,h=this._container.clientHeight||300),[D,h]}_setupContainer(){const D=this._container;D.classList.add("maplibregl-map");const h=this._canvasContainer=m.create("div","maplibregl-canvas-container",D);this._interactive&&h.classList.add("maplibregl-interactive"),this._canvas=m.create("canvas","maplibregl-canvas",h),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const v=this._containerDimensions(),T=this._getClampedPixelRatio(v[0],v[1]);this._resizeCanvas(v[0],v[1],T);const P=this._controlContainer=m.create("div","maplibregl-control-container",D),R=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(V=>{R[V]=m.create("div",`maplibregl-ctrl-${V} `,P)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(D,h,v){this._canvas.width=Math.floor(v*D),this._canvas.height=Math.floor(v*h),this._canvas.style.width=`${D}px`,this._canvas.style.height=`${h}px`}_setupPainter(){const D=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let h=null;this._canvas.addEventListener("webglcontextcreationerror",T=>{h={requestedAttributes:D},T&&(h.statusMessage=T.statusMessage,h.type=T.type)},{once:!0});let v=null;if(v=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,D):this._canvas.getContext("webgl2",D)||this._canvas.getContext("webgl",D),!v){const T="Failed to initialize WebGL";throw h?(h.message=T,new Error(JSON.stringify(h))):new Error(T)}this.painter=new yc(v,this.transform),y.testSupport(v)}migrateProjection(D,h){super.migrateProjection(D,h),this.painter.transform=D,this.fire(new a.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(D){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||D,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(D){return this._update(),this._renderTaskQueue.add(D)}_cancelRenderFrame(D){this._renderTaskQueue.remove(D)}_render(D){var h,v,T,P,R;const V=this._idleTriggered?this._fadeDuration:0,Y=((h=this.style.projection)===null||h===void 0?void 0:h.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(D),this._removed)return;let K=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const ce=this.transform.zoom,ae=p.now();this.style.zoomHistory.update(ce,ae);const fe=new a.F(ce,{now:ae,fadeDuration:V,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition(),globalState:this.style.getGlobalState()}),_e=fe.crossFadingFactor();_e===1&&_e===this._crossFadingFactor||(K=!0,this._crossFadingFactor=_e),this.style.update(fe)}const te=((v=this.style.projection)===null||v===void 0?void 0:v.transitionState)>0!==Y;(T=this.style.projection)===null||T===void 0||T.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((P=this.style.projection)===null||P===void 0?void 0:P.transitionState,(R=this.style.projection)===null||R===void 0?void 0:R.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||te)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,V,this._crossSourceCollisions,te),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:V,showPadding:this.showPadding}),this.fire(new a.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,a.cv.mark(a.cw.load),this.fire(new a.l("load"))),this.style&&(this.style.hasTransitions()||K)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const ie=this._sourcesDirty||this._styleDirty||this._placementDirty;return ie||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new a.l("idle")),!this._loaded||this._fullyLoaded||ie||(this._fullyLoaded=!0,a.cv.mark(a.cw.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var D;this._hash&&this._hash.remove();for(const v of this._controls)v.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),E.removeThrottleControl(this._imageQueueHandle),(D=this._resizeObserver)===null||D===void 0||D.disconnect();const h=this.painter.context.gl.getExtension("WEBGL_lose_context");h!=null&&h.loseContext&&h.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),m.remove(this._canvasContainer),m.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),a.cv.clearMetrics(),this._removed=!0,this.fire(new a.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,p.frame(this._frameRequest,D=>{a.cv.frame(D),this._frameRequest=null;try{this._render(D)}catch(h){if(!a.cx(h)&&!function(v){return v.message===Mx}(h))throw h}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(D){this._showTileBoundaries!==D&&(this._showTileBoundaries=D,this._update())}get showPadding(){return!!this._showPadding}set showPadding(D){this._showPadding!==D&&(this._showPadding=D,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(D){this._showCollisionBoxes!==D&&(this._showCollisionBoxes=D,D?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(D){this._showOverdrawInspector!==D&&(this._showOverdrawInspector=D,this._update())}get repaint(){return!!this._repaint}set repaint(D){this._repaint!==D&&(this._repaint=D,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(D){this._vertices=D,this._update()}get version(){return Gx}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(D){return this._lazyInitEmptyStyle(),this.style.setProjection(D),this._update(!0)}},s.MapMouseEvent=hl,s.MapTouchEvent=Wc,s.MapWheelEvent=Dx,s.Marker=wo,s.NavigationControl=class{constructor(D){this._updateZoomButtons=()=>{const h=this._map.getZoom(),v=h===this._map.getMaxZoom(),T=h===this._map.getMinZoom();this._zoomInButton.disabled=v,this._zoomOutButton.disabled=T,this._zoomInButton.setAttribute("aria-disabled",v.toString()),this._zoomOutButton.setAttribute("aria-disabled",T.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(h,v)=>{const T=this._map._getUIString(`NavigationControl.${v}`);h.title=T,h.setAttribute("aria-label",T)},this.options=a.e({},Oa,D),this._container=m.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",h=>h.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",h=>this._map.zoomIn({},{originalEvent:h})),m.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",h=>this._map.zoomOut({},{originalEvent:h})),m.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",h=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:h}):this._map.resetNorth({},{originalEvent:h})}),this._compassIcon=m.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(D){return this._map=D,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new cA(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){m.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(D,h){const v=m.create("button",D,this._container);return v.type="button",v.addEventListener("click",h),v}},s.Popup=class extends a.E{constructor(D){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:void 0)},this.remove=()=>(this._content&&m.remove(this._content),this._container&&(m.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new a.l("close"))),this),this._onMouseUp=h=>{this._update(h.point)},this._onMouseMove=h=>{this._update(h.point)},this._onDrag=h=>{this._update(h.point)},this._update=h=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=m.create("div","maplibregl-popup",this._map.getContainer()),this._tip=m.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const V of this.options.className.split(" "))this._container.classList.add(V);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=uA(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!h)return;const v=this._flatPos=this._pos=this._trackPointer&&h?h:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&h?h:this._map.transform.locationToScreenPoint(this._lngLat));let T=this.options.anchor;const P=Y_(this.options.offset);if(!T){const V=this._container.offsetWidth,Y=this._container.offsetHeight;let K;K=v.y+P.bottom.ythis._map.transform.height-Y?["bottom"]:[],v.xthis._map.transform.width-V/2&&K.push("right"),T=K.length===0?"bottom":K.join("-")}let R=v.add(P[T]);this.options.subpixelPositioning||(R=R.round()),m.setTransform(this._container,`${tp[T]} translate(${R.x}px,${R.y}px)`),lo(this._container,T,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=a.e(Object.create(Ky),D)}addTo(D){return this._map&&this.remove(),this._map=D,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new a.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(D){return this._lngLat=a.S.convert(D),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(D){return this.setDOMContent(document.createTextNode(D))}setHTML(D){const h=document.createDocumentFragment(),v=document.createElement("body");let T;for(v.innerHTML=D;T=v.firstChild,T;)h.appendChild(T);return this.setDOMContent(h)}getMaxWidth(){var D;return(D=this._container)===null||D===void 0?void 0:D.style.maxWidth}setMaxWidth(D){return this.options.maxWidth=D,this._update(),this}setDOMContent(D){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=m.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(D),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(D){return this._container&&this._container.classList.add(D),this}removeClassName(D){return this._container&&this._container.classList.remove(D),this}setOffset(D){return this.options.offset=D,this._update(),this}toggleClassName(D){if(this._container)return this._container.classList.toggle(D)}setSubpixelPositioning(D){this.options.subpixelPositioning=D}_createCloseButton(){this.options.closeButton&&(this._closeButton=m.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const D=this._container.querySelector(Yx);D&&D.focus()}},s.RasterDEMTileSource=Bn,s.RasterTileSource=Hn,s.ScaleControl=class{constructor(D){this._onMove=()=>{q_(this._map,this._container,this.options)},this.setUnit=h=>{this.options.unit=h,q_(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},qx),D)}getDefaultPosition(){return"bottom-left"}onAdd(D){return this._map=D,this._container=m.create("div","maplibregl-ctrl maplibregl-ctrl-scale",D.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){m.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},s.ScrollZoomHandler=oA,s.Style=fx,s.TerrainControl=class{constructor(D){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=D}onAdd(D){return this._map=D,this._container=m.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=m.create("button","maplibregl-ctrl-terrain",this._container),m.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){m.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},s.TwoFingersTouchPitchHandler=$x,s.TwoFingersTouchRotateHandler=Fx,s.TwoFingersTouchZoomHandler=Hu,s.TwoFingersTouchZoomRotateHandler=Ux,s.VectorTileSource=cn,s.VideoSource=Et,s.addSourceType=(D,h)=>a._(void 0,void 0,void 0,function*(){if(it(D))throw new Error(`A source type called "${D}" already exists.`);((v,T)=>{rn[v]=T})(D,h)}),s.clearPrewarmedResources=function(){const D=Ee;D&&(D.isPreloaded()&&D.numActive()===1?(D.release(oe),Ee=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},s.createTileMesh=ux,s.getMaxParallelImageRequests=function(){return a.a.MAX_PARALLEL_IMAGE_REQUESTS},s.getRTLTextPluginStatus=function(){return nt().getRTLTextPluginStatus()},s.getVersion=function(){return Zx},s.getWorkerCount=function(){return he.workerCount},s.getWorkerUrl=function(){return a.a.WORKER_URL},s.importScriptInWorkers=function(D){return Ze().broadcast("IS",D)},s.prewarm=function(){Oe().acquire(oe)},s.setMaxParallelImageRequests=function(D){a.a.MAX_PARALLEL_IMAGE_REQUESTS=D},s.setRTLTextPlugin=function(D,h){return nt().setRTLTextPlugin(D,h)},s.setWorkerCount=function(D){he.workerCount=D},s.setWorkerUrl=function(D){a.a.WORKER_URL=D}});var o=n;return o})})(EV);var mue=EV.exports;const SV=gl(mue),gue={key:0},yue={__name:"vs-form-geom-dataset",props:{dataset:{type:Array,default:()=>[],require:!0},map:{type:Object,default:()=>{},require:!0},activeLayers:{type:Array}},emits:["update:activeLayers"],setup(t,{emit:e}){const n=t,r=e,{addLayer:i,setVisible:o}=Zce({value:n.map}),s=g.ref(null),a=g.ref(null),l=g.ref(null),c=g.ref(null),u=g.ref(["area-measure","area-measure-lines","area-measure-points","area-measure-labels","area-linear-area-fill","mapbox-gl-draw-cold","mapbox-gl-draw-hot"]),d=({target:w})=>{var x,C,S,M;w.checked?(o((x=n.dataset[0])==null?void 0:x.table,!0),r("update:activeLayers",[...n.activeLayers,(C=n.dataset[0])==null?void 0:C.table])):(o((S=n.dataset[0])==null?void 0:S.table,!1),r("update:activeLayers",(M=n.activeLayers)==null?void 0:M.filter(E=>{var A;return E!==((A=n.dataset[0])==null?void 0:A.table)})))},p=w=>{var C;w=w||[];const x=w.reduce((S,M)=>M!=null&&M.id&&(M!=null&&M.color)?[...S,M.id,M.color]:S,["match",["get",(C=n.dataset[0])==null?void 0:C.colorAttr]]);return x.push("gray"),x},m=async()=>{var w,x,C,S,M,E,A,I,O,z,$;if(await i({id:(w=n.dataset[0])==null?void 0:w.table,service:"vector",url:`${(x=n.dataset[0])==null?void 0:x.url}?pointZoom=12`,layers:[{type:"fill","source-layer":(C=n.dataset[0])==null?void 0:C.table,paint:{"fill-color":p((M=(S=n.dataset[0])==null?void 0:S.data)==null?void 0:M.rows),"fill-opacity":["case",["==",["feature-state","selected"],!0],.6,.3],"fill-outline-color":["case",["==",["feature-state","hover"],!0],"red","#000000"]},filter:["all",["==",["geometry-type"],"Polygon"]]},{type:"circle","source-layer":(E=n.dataset[0])==null?void 0:E.table,filter:["all",["==",["geometry-type"],"Point"]],paint:{"circle-radius":{base:1.75,stops:[[10,5],[12,6],[18,12]]},"circle-stroke-color":["case",["==",["feature-state","hover"],!0],"red","#ccc"],"circle-stroke-width":["case",["==",["feature-state","hover"],!0],2,1],"circle-color":p((I=(A=n.dataset[0])==null?void 0:A.data)==null?void 0:I.rows)}}]}),(O=n.dataset[0])!=null&&O.visible){r("update:activeLayers",[...n.activeLayers,(z=n.dataset[0])==null?void 0:z.table]);return}else o(($=n.dataset[0])==null?void 0:$.table,!1)},y=async w=>{var S;(S=a.value)!=null&&S.id&&n.map.setFeatureState(a.value,{hover:!1}),a.value=null,c.value||(c.value=new SV.Popup({closeButton:!1,closeOnClick:!1}));const x=n.map.queryRenderedFeatures(w.point);if(n.map.getCanvas().style.cursor=x.length?"pointer":"",!x.length){c.value.isOpen()&&c.value.remove();return}const C={source:x[0].source,sourceLayer:x[0].sourceLayer,id:x[0].id};if(u.value.includes(C.source)){c.value.isOpen()&&c.value.remove();return}C.id&&n.map.setFeatureState(C,{hover:!0}),a.value=C,l.value=x[0].properties,c.value.setLngLat([w.lngLat.lng,w.lngLat.lat]).setDOMContent(s.value).addTo(n.map)};return g.onMounted(()=>{var w,x;m(),n.map.on("mousemove",y),uf("map-popup",(x=(w=n.dataset[0])==null?void 0:w.slots)==null?void 0:x.popup,["hoverData"])}),(w,x)=>{const C=g.resolveComponent("map-popup");return g.openBlock(),g.createElementBlock("div",null,[x[0]||(x[0]=g.createElementVNode("div",{class:"block font-[500] text-sm text-start text-gray-500"},"Набори",-1)),(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(t.dataset,S=>(g.openBlock(),g.createBlock(m1,{key:S==null?void 0:S.id,label:S==null?void 0:S.name,modelValue:S.visible,"onUpdate:modelValue":M=>S.visible=M,onChange:d},null,8,["label","modelValue","onUpdate:modelValue"]))),128)),g.createElementVNode("div",{ref_key:"popupEl",ref:s,class:"relative"},[l.value?(g.openBlock(),g.createElementBlock("div",gue,[g.createVNode(C,{hoverData:l.value},null,8,["hoverData"])])):g.createCommentVNode("",!0)],512)])}}},vue=["name","value","disabled"],_ue={class:"flex items-center gap-[6px] text-[14px] w-full"},bue={key:0,class:"text-[16px]"},wue=["src"],xue=g.defineComponent({__name:"vs-radio-buttons",props:{value:{type:[String,Number],default:""},label:{type:String,default:""},modelValue:{type:[Array,String],default:""},disabled:{type:Boolean,default:!1},id:{type:[String,Number]},icon:{type:String},size:{type:String},img:{type:String},style:{type:Object,default:()=>null}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=g.computed({get:()=>n.modelValue,set:s=>{r("update:modelValue",s)}}),o=g.computed(()=>{var a;const s=n.size||((a=n.style)==null?void 0:a.size);return s==="xs"?"p-1.5 text-xs":s==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs"});return(s,a)=>{var l,c;return g.openBlock(),g.createElementBlock("label",{class:g.normalizeClass(["group customButton relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 cursor-pointer rounded-lg w-full",[o.value,t.value===t.modelValue||((l=t.value)==null?void 0:l.value)===t.modelValue||((c=t.value)==null?void 0:c.id)===t.modelValue?"ring ring-2 ring-blue-600":"border border-gray-200"]])},[g.withDirectives(g.createElementVNode("input",{type:"radio",class:"hidden",name:t.id,value:t.value,"onUpdate:modelValue":a[0]||(a[0]=u=>i.value=u),disabled:t.disabled},null,8,vue),[[g.vModelRadio,i.value]]),g.createElementVNode("span",_ue,[t.icon||t.img?(g.openBlock(),g.createElementBlock("span",bue,[t.icon?(g.openBlock(),g.createElementBlock("i",{key:0,class:g.normalizeClass(t.icon)},null,2)):g.createCommentVNode("",!0),t.img?(g.openBlock(),g.createElementBlock("img",{key:1,src:t.img,width:"16",height:"16",alt:"icon"},null,8,wue)):g.createCommentVNode("",!0)])):g.createCommentVNode("",!0),g.renderSlot(s.$slots,"default",{},()=>[g.createTextVNode(g.toDisplayString(t.label),1)])])],2)}}}),Eue={class:"flex items-center cursor-pointer"},Sue=["for"],Cue={key:0,class:"w-[10px] h-[10px] rounded-full bg-white"},kue=["value","name","id","disabled"],Tue=g.defineComponent({__name:"vs-radio-default",props:{value:{type:[String,Number],default:""},label:{type:[String,Number],default:""},modelValue:{type:[Array,String],default:""},color:{type:String,default:""},disabled:{type:Boolean,default:!1},id:{type:[String,Number]},style:{type:Object,default:()=>null}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=g.ref("#2563eb"),o=g.ref("#ffffff"),s=g.ref("#d9d9d9"),a=g.computed({get:()=>n.modelValue,set:c=>{r("update:modelValue",c)}}),l=g.computed(()=>{var c,u;return((c=n.style)==null?void 0:c.size)==="xs"?"text-[12px]":((u=n.style)==null?void 0:u.size)==="lg"?"text-[20px]":"text-sm"});return(c,u)=>(g.openBlock(),g.createElementBlock("div",Eue,[g.createElementVNode("label",{for:t.id,class:g.normalizeClass(["text-sm text-gray-500 px-2 w-full py-2 cursor-pointer flex flex-row items-center",[t.disabled?"!cursor-not-allowed":"",l.value]])},[g.createElementVNode("div",{class:g.normalizeClass(["w-[18px] min-w-[18px] h-[18px] border rounded-full flex items-center justify-center mr-[10px]",a.value===t.value?`bg-[${t.color||i.value}] border-[${t.color||o.value}]`:`bg-[${t.color||o.value}] border-[${t.color||s.value}]`])},[a.value===t.value?(g.openBlock(),g.createElementBlock("div",Cue)):g.createCommentVNode("",!0)],2),g.withDirectives(g.createElementVNode("input",{value:t.value,"onUpdate:modelValue":u[0]||(u[0]=d=>a.value=d),type:"radio",name:t.id,class:g.normalizeClass(["hidden",{"!cursor-not-allowed":t.disabled}]),id:t.id,disabled:t.disabled},null,10,kue),[[g.vModelRadio,a.value]]),g.renderSlot(c.$slots,"default",{},()=>[g.createTextVNode(g.toDisplayString(t.value),1)])],10,Sue)]))}}),Mue=["name","value","disabled"],Aue={class:"block"},Iue={"vs-radio-default":Tue,"vs-radio-tabs":g.defineComponent({__name:"vs-radio-tabs",props:{value:{type:[String,Number],default:""},label:{type:[String,Number],default:""},modelValue:{type:[Array,String],default:""},disabled:{type:Boolean,default:!1},id:{type:[String,Number]}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=g.computed({get:()=>n.modelValue,set:o=>{r("update:modelValue",o)}});return(o,s)=>{var a,l;return g.openBlock(),g.createElementBlock("label",{class:g.normalizeClass(["relative dark:hs-tab-active:border-b-blue-600 min-w-0 flex-1 bg-white first:border-s-0 border-s border-b-2 py-3 px-4 hover:text-gray-700 text-sm font-medium text-center overflow-hidden hover:bg-gray-50 focus:z-10 focus:outline-none focus:text-blue-600 disabled:opacity-50 disabled:pointer-events-none",[t.value===t.modelValue||((a=t.value)==null?void 0:a.value)===t.modelValue||((l=t.value)==null?void 0:l.id)===t.modelValue?"text-black border-b-2 border-b-blue-600":"text-gray-500"]])},[g.withDirectives(g.createElementVNode("input",{type:"radio",class:"hidden",name:t.id,value:t.value,"onUpdate:modelValue":s[0]||(s[0]=c=>i.value=c),disabled:t.disabled},null,8,Mue),[[g.vModelRadio,i.value]]),g.createElementVNode("span",Aue,[g.renderSlot(o.$slots,"default",{},()=>[g.createTextVNode(g.toDisplayString(t.label),1)])])],2)}}}),"vs-radio-buttons":xue},aP=g.defineComponent({__name:"vs-radio",props:{value:{type:[String,Number],default:""},label:{type:[String,Number],default:""},info:{type:String,default:""},modelValue:{type:[Array,String],default:""},disabled:{type:Boolean,default:!1},view:{type:String,default:()=>"default"},icon:{type:String},size:{type:String},img:{type:String},length:{type:Number},slots:{type:Object,default:()=>null},option:{type:[Object,String]},style:{type:Object,default:()=>null}},emits:["update:modelValue"],setup(t,{emit:e}){var a,l;const n=t,r=e,i=`radio-${Math.floor(Math.random()*1e4)}`;(a=n.slots)!=null&&a.label&&uf(i,(l=n.slots)==null?void 0:l.label,[...Object.keys(n.option)]);const o=g.computed({get:()=>n.modelValue,set:c=>{r("update:modelValue",c)}}),s=g.ref("vs-radio-"+n.view);return(c,u)=>{const d=g.resolveComponent("VsTooltip");return g.openBlock(),g.createElementBlock("div",{class:"flex items-center gap-x-3",style:g.normalizeStyle({width:t.view==="tabs"?`calc(100% / ${t.length})`:"auto"})},[(g.openBlock(),g.createBlock(g.resolveDynamicComponent(g.unref(Iue)[s.value]||"div"),{id:i,modelValue:o.value,"onUpdate:modelValue":u[0]||(u[0]=p=>o.value=p),value:t.value,icon:t.icon,disabled:t.disabled,img:t.img,label:t.label,size:t.size,style:g.normalizeStyle(t.style)},{default:g.withCtx(()=>{var p;return[(p=t.slots)!=null&&p.label?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(i),g.normalizeProps(g.mergeProps({key:0},t.option)),null,16)):(g.openBlock(),g.createElementBlock(g.Fragment,{key:1},[g.createTextVNode(g.toDisplayString(t.label)+" ",1),t.info?(g.openBlock(),g.createBlock(d,{key:0,content:t.info,position:"right"},{reference:g.withCtx(()=>[g.createVNode(wV,{class:"ml-1",height:"14",width:"14"})]),_:1},8,["content"])):g.createCommentVNode("",!0)],64))]}),_:1},8,["modelValue","value","icon","disabled","img","label","size","style"]))],4)}}}),Lue={components:{VsFormRadio:aP,VsFormGeomDataset:yue,VsFormCheckbox:m1},emits:["update:activeLayers"],props:{map:{type:Object,default:()=>{}},dataset:{type:Array,default:()=>[]},apiLayer:{type:String,default:()=>""},activeLayers:Array,layers:{type:Array,default:()=>[]}},data(){return{radioLayers:{base:[{id:"voyager",name:"Базова карта (voyager)",url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",service:"TMS"}],all:[]},baseLayer:"",activeLayers:[]}},watch:{baseLayer:{immediate:!0,handler(t){this.changeLayer(t),this.map.once("idle",()=>{["mapbox-gl-draw-cold","mapbox-gl-draw-hot"].forEach(e=>{this.map.getSource(e)&&(this.map.getStyle().layers||[]).forEach(r=>{r.source===e&&this.map.moveLayer(r.id)})})})}}},async mounted(){var n,r,i;this.radioLayers=await this.getLayers();const t=this.radioLayers.base.filter(o=>o==null?void 0:o.visible),e=((n=t==null?void 0:t[0])==null?void 0:n.id)||((i=(r=this.radioLayers.base)==null?void 0:r[0])==null?void 0:i.id);this.baseLayer!==e&&(this.baseLayer=e)},methods:{async getLayers(){if(!this.apiLayer)return this.createLayersObject(this.layers);try{const t=await fetch(this.apiLayer);if(t.ok){const e=await t.json(),n=(e==null?void 0:e.layers)||e||[];return this.createLayersObject(n.concat(this.layers))}return null}catch(t){return console.error(t),this.createLayersObject(this.layers)}},changeLayer(t){const e=this.radioLayers.base.find(n=>n.id===t);e&&this.map.changeBaseLayer(e,!0)},toggleLayer(t,e){this.map.setVisible(t,e.target.checked)},createLayersObject(t){return t.reduce((e,n)=>{const r=n.overlay?"all":"base";return e[r].find(o=>o.id===n.id)?e:(r==="all"&&n.visible&&(this.activeLayers=this.activeLayers.concat(n.id),this.map.setVisible(n,!0)),{...e,[r]:e[r].concat(n)})},{all:[],base:this.radioLayers.base})}}},Pue={class:"layers"},Nue={key:1,class:"mb-3"};function Oue(t,e,n,r,i,o){var c,u,d,p,m;const s=g.resolveComponent("VsFormGeomDataset"),a=g.resolveComponent("VsCheckbox"),l=g.resolveComponent("VsFormRadio");return g.openBlock(),g.createElementBlock("div",Pue,[(c=n.dataset)!=null&&c.length&&((d=(u=n.dataset)==null?void 0:u[0])==null?void 0:d.data)!=="template not found"?(g.openBlock(),g.createBlock(s,{key:0,"onUpdate:activeLayers":[e[0]||(e[0]=y=>t.$emit("update:activeLayers",y)),e[1]||(e[1]=y=>i.activeLayers=y)],class:"mb-3",dataset:n.dataset,activeLayers:i.activeLayers,map:n.map},null,8,["dataset","activeLayers","map"])):g.createCommentVNode("",!0),(m=(p=i.radioLayers)==null?void 0:p.all)!=null&&m.length?(g.openBlock(),g.createElementBlock("div",Nue,[e[4]||(e[4]=g.createElementVNode("div",{class:"layers__title block text-sm text-gray-500"},"Усі шари",-1)),(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(i.radioLayers.all,y=>(g.openBlock(),g.createBlock(a,{value:y.id,key:y.id,modelValue:i.activeLayers,"onUpdate:modelValue":e[2]||(e[2]=w=>i.activeLayers=w),class:"layers__item",label:(y==null?void 0:y.name)||(y==null?void 0:y.title)||(y==null?void 0:y.id)||"Назва відсутня",onChange:w=>o.toggleLayer(y,w)},{default:g.withCtx(()=>[g.createTextVNode(g.toDisplayString((y==null?void 0:y.name)||(y==null?void 0:y.title)||(y==null?void 0:y.id)||"Назва відсутня"),1)]),_:2},1032,["value","modelValue","label","onChange"]))),128))])):g.createCommentVNode("",!0),g.createElementVNode("div",null,[e[5]||(e[5]=g.createElementVNode("div",{class:"layers__title block text-sm text-start text-gray-500"}," Базові шари ",-1)),(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(i.radioLayers.base,y=>(g.openBlock(),g.createBlock(l,{modelValue:i.baseLayer,"onUpdate:modelValue":e[3]||(e[3]=w=>i.baseLayer=w),key:y.id,class:"layers__item mb-2",value:y.id,label:y.title||y.name},null,8,["modelValue","value","label"]))),128))])])}const CV=xt(Lue,[["render",Oue],["__scopeId","data-v-161613ac"]]),GS={load(){try{const t=Array.from(arguments);window.headLoadedFiles||(window.headLoadedFiles=[]);const e=typeof arguments[arguments.length-1]=="function"?arguments[arguments.length-1]:null,n=t.filter(r=>typeof r!="function").reduce((r,i)=>r.concat(i),[]).filter(r=>r&&!window.headLoadedFiles[r.url||r.split("?")[0]]);Promise.all(n.map(r=>this.loadFile1(r))).then(()=>{e&&e()})}catch(t){console.log(t)}},promise(t){return new Promise((e,n)=>{GS.load(t,()=>{e()})})},loadFile1(t){let e=!1;typeof t=="object"&&(e=t.type,t=t.url);const n=t.split("?")[0];return new Promise((r,i)=>{function o(a){delete window.headLoadedFiles[`_${n}`],window.headLoadedFiles[n]=a.type,r(a.type)}let s;window.headLoadedFiles[`_${n}`]?s=window.headLoadedFiles[`_${n}`]:(n.includes(".css")?(s=document.createElement("link"),s.href=t,s.type="text/css",s.rel="stylesheet"):(s=document.createElement("script"),s.type="text/javascript",s.src=t,e&&(s.type=e)),window.headLoadedFiles[`_${n}`]=s,document.head.appendChild(s)),s.addEventListener("load",o),s.addEventListener("error",o)})}},Due={},Rue={class:"absolute bottom-2.5 left-2.5 bg-white border rounded-md max-w-[220px] max-h-[250px] overflow-y-auto scrollbar-thin scrollbar-thumb-gray-400 scrollbar-track-gray-100 legend"};function Bue(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",Rue,[g.renderSlot(t.$slots,"default")])}const Fue={components:{VsMapSearch:gV,VsLayers:CV,VsLegend:xt(Due,[["render",Bue]])},mixins:[oP],props:{height:{type:String,default:()=>"400px"},apiLayer:{type:String,default:()=>""},dataset:{type:Array,default:()=>[]},zoom:{type:Number,default:()=>10},center:{type:Array,default:()=>[30.5,50.45]},maxZoom:{type:Number,default:()=>21},minZoom:{type:Number,default:()=>0}},inject:["meta"],data(){return{map:null,showLayers:!1,layers:[],mapLoaded:!1,mapParams:{bearing:0},windowSettingLayers:""}},async mounted(){await GS.promise(["https://cdn.softpro.ua/vendor/maplibre/maplibre.js","https://cdn.softpro.ua/vendor/maplibre/maplibre.css"]),setTimeout(()=>{this.initMap()},1)},computed:{compasRotate(){return this.mapParams.bearing-45}},methods:{async initMap(){var n,r;const t=((r=(n=window==null?void 0:window.setting)==null?void 0:n.map)==null?void 0:r.basemap)||"2997428371643697116,orto10,graymap";this.windowSettingLayers=t,new maplibregl.Map({container:"vs-simple-map",style:{version:8,sources:{},layers:[]},center:this.center,zoom:this.zoom,maxZoom:this.maxZoom,minZoom:this.minZoom}).on("load",this.onMapLoad)},async getLayerList(){try{const{data:t}=await un.get("/api-user/gis-layer-list"),e=(this.windowSettingLayers||"").split(",");this.layers=t.filter(n=>e.includes(n.id)),this.mapLoaded=!0}catch(t){this.mapLoaded=!0,console.error(t)}},async onMapLoad(t){this.map=await t.target,this.map.setVisible=this.setVisible,this.map.changeBaseLayer=this.changeBaseLayer,this.windowSettingLayers?this.getLayerList():this.mapLoaded=!0,this.map.on("click",this.handleMapClick),this.map.on("mousemove",this.handleMapMousemove)},handleMapClick(t){this.$emit("click",t)},handleMapMousemove(t){this.$emit("mousemove",t)},mapLevelOut(){const{map:t}=this;t.flyTo({pitch:0,bearing:0})}}},$ue={class:"relative"},zue={class:"absolute top-[150px] sm:top-2.5 right-2.5 flex flex-col"},Vue={class:"relative"};function jue(t,e,n,r,i,o){const s=g.resolveComponent("VsLegend"),a=g.resolveComponent("VsMapSearch"),l=g.resolveComponent("VsLayers");return g.openBlock(),g.createElementBlock("div",null,[g.createElementVNode("div",$ue,[g.createElementVNode("div",{id:"vs-simple-map",style:g.normalizeStyle({height:n.height}),class:"w-full"},null,4),g.createVNode(s,null,{default:g.withCtx(()=>[g.renderSlot(t.$slots,"default")]),_:3}),g.createVNode(a,{map:i.map,"onUpdate:map":e[0]||(e[0]=c=>i.map=c),height:n.height,class:"absolute top-2.5 left-2.5"},null,8,["map","height"]),g.createElementVNode("div",zue,[g.createElementVNode("div",{title:"Вирівняти карту",class:"w-[36px] h-[36px] flex items-center justify-center mb-1 py-0.5 px-2 cursor-pointer transition-all border rounded-md text-sm bg-white hover:bg-blue-500",onClick:e[1]||(e[1]=(...c)=>o.mapLevelOut&&o.mapLevelOut(...c))},[g.createElementVNode("i",{class:g.normalizeClass(["ti ti-compass text-base",{"transform rotate-45":o.compasRotate}])},null,2)]),g.createElementVNode("div",Vue,[g.createElementVNode("div",{title:"Шари",class:g.normalizeClass(["w-[36px] h-[36px] flex items-center justify-center py-0.5 px-2 cursor-pointer transition-all border rounded-md text-sm bg-white hover:bg-blue-500",{"bg-blue-500":i.showLayers}]),onClick:e[2]||(e[2]=c=>i.showLayers=!i.showLayers)},[g.createElementVNode("i",{class:g.normalizeClass(["ti ti-stack-2 text-base",{"text-white":i.showLayers}])},null,2)],2),i.map&&i.mapLoaded?g.withDirectives((g.openBlock(),g.createBlock(l,{key:0,"api-layer":n.apiLayer,layers:i.layers,dataset:n.dataset,map:i.map},null,8,["api-layer","layers","dataset","map"])),[[g.vShow,i.showLayers]]):g.createCommentVNode("",!0)])])])])}const Uue=xt(Fue,[["render",jue]]);function Lp(t){return typeof t=="string"||t instanceof String}function kV(t){var e;return typeof t=="object"&&t!=null&&(t==null||(e=t.constructor)==null?void 0:e.name)==="Object"}function TV(t,e){return Array.isArray(e)?TV(t,(n,r)=>e.includes(r)):Object.entries(t).reduce((n,r)=>{let[i,o]=r;return e(o,i)&&(n[i]=o),n},{})}const In={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function Hue(t){switch(t){case In.LEFT:return In.FORCE_LEFT;case In.RIGHT:return In.FORCE_RIGHT;default:return t}}function lP(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function qS(t,e){if(e===t)return!0;const n=Array.isArray(e),r=Array.isArray(t);let i;if(n&&r){if(e.length!=t.length)return!1;for(i=0;i!o.startsWith("_")),mask:e.constructor,_mask:r,...n}}}return kV(t)?{...t}:{mask:t}}function hf(t){if(Rn.Masked&&t instanceof Rn.Masked)return t;const e=g1(t),n=MV(e.mask);if(!n)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===n&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new n(e)}Rn.createMask=hf;class cP{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return e??this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return e??this.value.length}select(e,n){if(!(e==null||n==null||e===this.selectionStart&&n===this.selectionEnd))try{this._unsafeSelect(e,n)}catch{}}get isActive(){return!1}}Rn.MaskElement=cP;const AV=90,Gue=89;class YS extends cP{constructor(e){super(),this.input=e,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var e,n,r;return(e=(n=(r=this.input).getRootNode)==null?void 0:n.call(r))!=null?e:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){if(this._handlers.redo&&(e.keyCode===AV&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===Gue&&e.ctrlKey))return e.preventDefault(),this._handlers.redo(e);if(this._handlers.undo&&e.keyCode===AV&&(e.metaKey||e.ctrlKey))return e.preventDefault(),this._handlers.undo(e);e.isComposing||this._handlers.selectionChange(e)}_onBeforeinput(e){if(e.inputType==="historyUndo"&&this._handlers.undo)return e.preventDefault(),this._handlers.undo(e);if(e.inputType==="historyRedo"&&this._handlers.redo)return e.preventDefault(),this._handlers.redo(e)}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}Rn.HTMLMaskElement=YS;class que extends YS{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,n){this.input.setSelectionRange(e,n)}get value(){return this.input.value}set value(e){this.input.value=e}}Rn.HTMLMaskElement=YS;class IV extends YS{get _unsafeSelectionStart(){const e=this.rootElement,n=e.getSelection&&e.getSelection(),r=n&&n.anchorOffset,i=n&&n.focusOffset;return i==null||r==null||ri?r:i}_unsafeSelect(e,n){if(!this.rootElement.createRange)return;const r=this.rootElement.createRange();r.setStart(this.input.firstChild||this.input,e),r.setEnd(this.input.lastChild||this.input,n);const i=this.rootElement,o=i.getSelection&&i.getSelection();o&&(o.removeAllRanges(),o.addRange(r))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}Rn.HTMLContenteditableMaskElement=IV;class ZS{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(e){this.currentIndexZS.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}ZS.MAX_LENGTH=100;class Yue{constructor(e,n){this.el=e instanceof cP?e:e.isContentEditable&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"?new IV(e):new que(e),this.masked=hf(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new ZS,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(e){var n;return e==null||((n=this.masked)==null?void 0:n.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof Rn.Masked)&&this.masked.constructor===MV(e)){this.masked.updateOptions({mask:e});return}const n=e instanceof Rn.Masked?e:hf({mask:e});n.unmaskedValue=this.masked.unmaskedValue,this.masked=n}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(e,n){const r=this._listeners[e];r&&r.forEach(i=>i(n))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){!this.el||!this.el.isActive||(this.el.select(e,e),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(e){const n=this.masked.unmaskedValue,r=this.masked.value,i=this.masked.rawInputValue,o=this.displayValue,s=this.unmaskedValue!==n||this.value!==r||this._rawInputValue!==i;this._unmaskedValue=n,this._value=r,this._rawInputValue=i,this.el.value!==o&&(this.el.value=o),e==="auto"?this.alignCursor():e!=null&&(this.cursorPos=e),s&&this._fireChangeEvents(),!this._historyChanging&&(s||this.history.isEmpty)&&this.history.push({unmaskedValue:n,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:n,...r}=e,i=!this.maskEquals(n),o=this.masked.optionsIsChanged(r);i&&(this.mask=n),o&&this.masked.updateOptions(r),(i||o)&&this.updateControl()}updateCursor(e){e!=null&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,In.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,n){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(n),this}off(e,n){if(!this._listeners[e])return this;if(!n)return delete this._listeners[e],this;const r=this._listeners[e].indexOf(n);return r>=0&&this._listeners[e].splice(r,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const n=new Wue({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),r=this.masked.rawInputValue,i=this.masked.splice(n.startChangePos,n.removed.length,n.inserted,n.removeDirection,{input:!0,raw:!0}).offset,o=r===this.masked.rawInputValue?n.removeDirection:In.NONE;let s=this.masked.nearestInputPos(n.startChangePos+i,o);o!==In.NONE&&(s=this.masked.nearestInputPos(s,In.NONE)),this.updateControl(s),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}Rn.InputMask=Yue;class br{static normalize(e){return Array.isArray(e)?e:[e,new br]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},e)}aggregate(e){return this.inserted+=e.inserted,this.rawInserted+=e.rawInserted,this.tailShift+=e.tailShift,this.skip=this.skip||e.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(e){return this.inserted===e.inserted&&this.tailShift===e.tailShift&&this.rawInserted===e.rawInserted&&this.skip===e.skip}}Rn.ChangeDetails=br;class nd{constructor(e,n,r){e===void 0&&(e=""),n===void 0&&(n=0),this.value=e,this.from=n,this.stop=r}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||e!=null&&this.from>=e)return"";const n=this.value[0];return this.value=this.value.slice(1),n}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class Ga{constructor(e){this._value="",this._update({...Ga.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,n){n===void 0&&(n={input:!0}),this.reset(),this.append(e,n,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,n){return e}totalInputPositions(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),Math.min(this.displayValue.length,n-e)}extractInput(e,n,r){return e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),this.displayValue.slice(e,n)}extractTail(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),new nd(this.extractInput(e,n),e)}appendTail(e){return Lp(e)&&(e=new nd(String(e))),e.appendTo(this)}_appendCharRaw(e,n){return e?(this._value+=e,new br({inserted:e,rawInserted:e})):new br}_appendChar(e,n,r){n===void 0&&(n={});const i=this.state;let o;if([e,o]=this.doPrepareChar(e,n),e&&(o=o.aggregate(this._appendCharRaw(e,n)),!o.rawInserted&&this.autofix==="pad")){const s=this.state;this.state=i;let a=this.pad(n);const l=this._appendCharRaw(e,n);a=a.aggregate(l),l.rawInserted||a.equals(o)?o=a:this.state=s}if(o.inserted){let s,a=this.doValidate(n)!==!1;if(a&&r!=null){const l=this.state;if(this.overwrite===!0){s=r.state;for(let u=0;u1&&e!==0&&!l?In.NONE:i),d.tailShift=u-e),d.aggregate(this.remove(u)),l&&i!==In.NONE&&c===this.rawInputValue)if(i===In.FORCE_LEFT){let p;for(;c===this.rawInputValue&&(p=this.displayValue.length);)d.aggregate(new br({tailShift:-1})).aggregate(this.remove(p-1))}else i===In.FORCE_RIGHT&&a.unshift();return d.aggregate(this.append(r,o,a))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!qS(this,e)}typedValueEquals(e){const n=this.typedValue;return e===n||Ga.EMPTY_VALUES.includes(e)&&Ga.EMPTY_VALUES.includes(n)||(this.format?this.format(e,this)===this.format(this.typedValue,this):!1)}pad(e){return new br}}Ga.DEFAULTS={skipInvalid:!0},Ga.EMPTY_VALUES=[void 0,null,""],Rn.Masked=Ga;class Sg{constructor(e,n){e===void 0&&(e=[]),n===void 0&&(n=0),this.chunks=e,this.from=n}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=Lp(e)?new nd(String(e)):e;const n=this.chunks[this.chunks.length-1],r=n&&(n.stop===e.stop||e.stop==null)&&e.from===n.from+n.toString().length;if(e instanceof nd)r?n.extend(e.toString()):this.chunks.push(e);else if(e instanceof Sg){if(e.stop==null){let i;for(;e.chunks.length&&e.chunks[0].stop==null;)i=e.chunks.shift(),i.from+=e.from,this.extend(i)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof Rn.MaskedPattern))return new nd(this.toString()).appendTo(e);const n=new br;for(let r=0;r=0)&&n.aggregate(e._appendPlaceholder(s)),a=i instanceof Sg&&e._blocks[s]),a){const l=a.appendTail(i);n.aggregate(l);const c=i.toString().slice(l.rawInserted.length);c&&n.aggregate(e.append(c,{tail:!0}))}else n.aggregate(e.append(i.toString(),{tail:!0}))}return n}get state(){return{chunks:this.chunks.map(e=>e.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:n,...r}=e;Object.assign(this,r),this.chunks=n.map(i=>{const o="chunks"in i?new Sg:new nd;return o.state=i,o})}unshift(e){if(!this.chunks.length||e!=null&&this.from>=e)return"";const n=e!=null?e-this.from:e;let r=0;for(;r=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(e){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((n=this.block)==null?void 0:n.displayValue.length)||0){var n;if(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,In.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,In.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,In.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,In.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,In.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,In.NONE),!0})}}class LV{constructor(e){Object.assign(this,e),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(e,n){return e===void 0&&(e=0),n===void 0&&(n=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(n),this._value||(this._isRawInput=!1),new br}nearestInputPos(e,n){n===void 0&&(n=In.NONE);const r=0,i=this._value.length;switch(n){case In.LEFT:case In.FORCE_LEFT:return r;case In.NONE:case In.RIGHT:case In.FORCE_RIGHT:default:return i}}totalInputPositions(e,n){return e===void 0&&(e=0),n===void 0&&(n=this._value.length),this._isRawInput?n-e:0}extractInput(e,n,r){return e===void 0&&(e=0),n===void 0&&(n=this._value.length),r===void 0&&(r={}),r.raw&&this._isRawInput&&this._value.slice(e,n)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(e,n){if(n===void 0&&(n={}),this.isFilled)return new br;const r=this.eager===!0||this.eager==="append",o=this.char===e&&(this.isUnmasking||n.input||n.raw)&&(!n.raw||!r)&&!n.tail,s=new br({inserted:this.char,rawInserted:o?this.char:""});return this._value=this.char,this._isRawInput=o&&(n.raw||n.input),s}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new br;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new nd("")}appendTail(e){return Lp(e)&&(e=new nd(String(e))),e.appendTo(this)}append(e,n,r){const i=this._appendChar(e[0],n);return r!=null&&(i.tailShift+=this.appendTail(r).tailShift),i}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=!!e._rawInputValue}pad(e){return this._appendPlaceholder()}}class XS{constructor(e){const{parent:n,isOptional:r,placeholderChar:i,displayChar:o,lazy:s,eager:a,...l}=e;this.masked=hf(l),Object.assign(this,{parent:n,isOptional:r,placeholderChar:i,displayChar:o,lazy:s,eager:a})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.value.length),e===0&&n>=1?(this.isFilled=!1,this.masked.remove(e,n)):new br}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(e,n){if(n===void 0&&(n={}),this.isFilled)return new br;const r=this.masked.state;let i=this.masked._appendChar(e,this.currentMaskFlags(n));return i.inserted&&this.doValidate(n)===!1&&(i=new br,this.masked.state=r),!i.inserted&&!this.isOptional&&!this.lazy&&!n.input&&(i.inserted=this.placeholderChar),i.skip=!i.inserted&&!this.isOptional,this.isFilled=!!i.inserted,i}append(e,n,r){return this.masked.append(e,this.currentMaskFlags(n),r)}_appendPlaceholder(){return this.isFilled||this.isOptional?new br:(this.isFilled=!0,new br({inserted:this.placeholderChar}))}_appendEager(){return new br}extractTail(e,n){return this.masked.extractTail(e,n)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,n,r){return e===void 0&&(e=0),n===void 0&&(n=this.value.length),this.masked.extractInput(e,n,r)}nearestInputPos(e,n){n===void 0&&(n=In.NONE);const r=0,i=this.value.length,o=Math.min(Math.max(e,r),i);switch(n){case In.LEFT:case In.FORCE_LEFT:return this.isComplete?o:r;case In.RIGHT:case In.FORCE_RIGHT:return this.isComplete?o:i;case In.NONE:default:return o}}totalInputPositions(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.value.length),this.value.slice(e,n).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var n;return{...e,_beforeTailState:(e==null||(n=e._beforeTailState)==null?void 0:n.masked)||(e==null?void 0:e._beforeTailState)}}pad(e){return new br}}XS.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class Xue extends Ga{updateOptions(e){super.updateOptions(e)}_update(e){const n=e.mask;n&&(e.validate=r=>r.search(n)>=0),super._update(e)}}Rn.MaskedRegExp=Xue;class qa extends Ga{constructor(e){super({...qa.DEFAULTS,...e,definitions:Object.assign({},XS.DEFAULT_DEFINITIONS,e==null?void 0:e.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const n=this.mask;if(!n||!e)return;let r=!1,i=!1;for(let o=0;oc.indexOf(p)===0);u.sort((p,m)=>m.length-p.length);const d=u[0];if(d){const{expose:p,repeat:m,...y}=g1(this.blocks[d]),w={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...y,repeat:m,parent:this},x=m!=null?new Rn.RepeatBlock(w):hf(w);x&&(this._blocks.push(x),p&&(this.exposeBlock=x),this._maskedBlocks[d]||(this._maskedBlocks[d]=[]),this._maskedBlocks[d].push(this._blocks.length-1)),o+=d.length-1;continue}}let s=n[o],a=s in e;if(s===qa.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(s==="{"||s==="}"){r=!r;continue}if(s==="["||s==="]"){i=!i;continue}if(s===qa.ESCAPE_CHAR){if(++o,s=n[o],!s)break;a=!1}const l=a?new XS({isOptional:i,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...g1(e[s]),parent:this}):new LV({char:s,eager:this.eager,isUnmasking:r});this._blocks.push(l)}}get state(){return{...super.state,_blocks:this._blocks.map(e=>e.state)}}set state(e){if(!e){this.reset();return}const{_blocks:n,...r}=e;this._blocks.forEach((i,o)=>i.state=n[o]),super.state=r}reset(){super.reset(),this._blocks.forEach(e=>e.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(e=>e.isComplete)}get isFilled(){return this._blocks.every(e=>e.isFilled)}get isFixed(){return this._blocks.every(e=>e.isFixed)}get isOptional(){return this._blocks.every(e=>e.isOptional)}doCommit(){this._blocks.forEach(e=>e.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((e,n)=>e+=n.unmaskedValue,"")}set unmaskedValue(e){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(n),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((e,n)=>e+=n.value,"")}set value(e){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(n),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(n),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce((e,n)=>e+=n.displayValue,"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const n=new br;let r=(e=this._mapPosToBlock(this.displayValue.length))==null?void 0:e.index;if(r==null)return n;this._blocks[r].isFilled&&++r;for(let i=r;i{const l=i.extractTail(s,a);l.stop=this._findStopBefore(o),l.from=this._blockStartPos(o),l instanceof Sg&&(l.blockIndex=o),r.extend(l)}),r}extractInput(e,n,r){if(e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),r===void 0&&(r={}),e===n)return"";let i="";return this._forEachBlocksInRange(e,n,(o,s,a,l)=>{i+=o.extractInput(a,l,r)}),i}_findStopBefore(e){let n;for(let r=0;r{if(!s.lazy||e!=null){var a;n.aggregate(s._appendPlaceholder((a=s._blocks)==null?void 0:a.length))}}),n}_mapPosToBlock(e){let n="";for(let r=0;rn+=r.displayValue.length,0)}_forEachBlocksInRange(e,n,r){n===void 0&&(n=this.displayValue.length);const i=this._mapPosToBlock(e);if(i){const o=this._mapPosToBlock(n),s=o&&i.index===o.index,a=i.offset,l=o&&s?o.offset:this._blocks[i.index].displayValue.length;if(r(this._blocks[i.index],i.index,a,l),o&&!s){for(let c=i.index+1;c{r.aggregate(i.remove(s,a))}),r}nearestInputPos(e,n){if(n===void 0&&(n=In.NONE),!this._blocks.length)return 0;const r=new Zue(this,e);if(n===In.NONE)return r.pushRightBeforeInput()||(r.popState(),r.pushLeftBeforeInput())?r.pos:this.displayValue.length;if(n===In.LEFT||n===In.FORCE_LEFT){if(n===In.LEFT){if(r.pushRightBeforeFilled(),r.ok&&r.pos===e)return e;r.popState()}if(r.pushLeftBeforeInput(),r.pushLeftBeforeRequired(),r.pushLeftBeforeFilled(),n===In.LEFT){if(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.ok&&r.pos<=e||(r.popState(),r.ok&&r.pos<=e))return r.pos;r.popState()}return r.ok?r.pos:n===In.FORCE_LEFT?0:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:0)}return n===In.RIGHT||n===In.FORCE_RIGHT?(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.pushRightBeforeFilled()?r.pos:n===In.FORCE_RIGHT?this.displayValue.length:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:this.nearestInputPos(e,In.LEFT))):e}totalInputPositions(e,n){e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length);let r=0;return this._forEachBlocksInRange(e,n,(i,o,s,a)=>{r+=i.totalInputPositions(s,a)}),r}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const n=this._maskedBlocks[e];return n?n.map(r=>this._blocks[r]):[]}pad(e){const n=new br;return this._forEachBlocksInRange(0,this.displayValue.length,r=>n.aggregate(r.pad(e))),n}}qa.DEFAULTS={...Ga.DEFAULTS,lazy:!0,placeholderChar:"_"},qa.STOP_CHAR="`",qa.ESCAPE_CHAR="\\",qa.InputDefinition=XS,qa.FixedDefinition=LV,Rn.MaskedPattern=qa;class KS extends qa{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:n=this.to||0,from:r=this.from||0,maxLength:i=this.maxLength||0,autofix:o=this.autofix,...s}=e;this.to=n,this.from=r,this.maxLength=Math.max(String(n).length,i),this.autofix=o;const a=String(this.from).padStart(this.maxLength,"0"),l=String(this.to).padStart(this.maxLength,"0");let c=0;for(;cthis.maxLength)return super._appendCharRaw(e,n);const r=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0"),[o,s]=this.boundaries(this.value+e);return Number(s)this.to?!n.tail&&this.autofix==="pad"&&this.value.length+1this._appendCharRaw(o))}return n}}Rn.MaskedRange=KS;const Kue="d{.}`m{.}`Y";class df extends qa{static extractPatternOptions(e){const{mask:n,pattern:r,...i}=e;return{...i,mask:Lp(n)?n:r}}constructor(e){super(df.extractPatternOptions({...df.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:n,pattern:r,blocks:i,...o}={...df.DEFAULTS,...e},s=Object.assign({},df.GET_DEFAULT_BLOCKS());e.min&&(s.Y.from=e.min.getFullYear()),e.max&&(s.Y.to=e.max.getFullYear()),e.min&&e.max&&s.Y.from===s.Y.to&&(s.m.from=e.min.getMonth()+1,s.m.to=e.max.getMonth()+1,s.m.from===s.m.to&&(s.d.from=e.min.getDate(),s.d.to=e.max.getDate())),Object.assign(s,this.blocks,i),super._update({...o,mask:Lp(n)?n:r,blocks:s})}doValidate(e){const n=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&n!=null&&(this.min==null||this.min<=n)&&(this.max==null||n<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged(df.extractPatternOptions(e))}}df.GET_DEFAULT_BLOCKS=()=>({d:{mask:KS,from:1,to:31,maxLength:2},m:{mask:KS,from:1,to:12,maxLength:2},Y:{mask:KS,from:1900,to:9999}}),df.DEFAULTS={...qa.DEFAULTS,mask:Date,pattern:Kue,format:(t,e)=>{if(!t)return"";const n=String(t.getDate()).padStart(2,"0"),r=String(t.getMonth()+1).padStart(2,"0"),i=t.getFullYear();return[n,r,i].join(".")},parse:(t,e)=>{const[n,r,i]=t.split(".").map(Number);return new Date(i,r-1,n)}},Rn.MaskedDate=df;class JS extends Ga{constructor(e){super({...JS.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map(n=>{const{expose:r,...i}=g1(n),o=hf({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...i});return r&&(this.exposeMask=o),o}):[])}_appendCharRaw(e,n){n===void 0&&(n={});const r=this._applyDispatch(e,n);return this.currentMask&&r.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(n))),r}_applyDispatch(e,n,r){e===void 0&&(e=""),n===void 0&&(n={}),r===void 0&&(r="");const i=n.tail&&n._beforeTailState!=null?n._beforeTailState._value:this.value,o=this.rawInputValue,s=n.tail&&n._beforeTailState!=null?n._beforeTailState._rawInputValue:o,a=o.slice(s.length),l=this.currentMask,c=new br,u=l==null?void 0:l.state;return this.currentMask=this.doDispatch(e,{...n},r),this.currentMask&&(this.currentMask!==l?(this.currentMask.reset(),s&&(this.currentMask.append(s,{raw:!0}),c.tailShift=this.currentMask.value.length-i.length),a&&(c.tailShift+=this.currentMask.append(a,{raw:!0,tail:!0}).tailShift)):u&&(this.currentMask.state=u)),c}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const n=new br;return e&&n.aggregate(this._applyDispatch("",{},e)),n.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var n,r;return{...e,_beforeTailState:((n=e._beforeTailState)==null?void 0:n.currentMaskRef)===this.currentMask&&((r=e._beforeTailState)==null?void 0:r.currentMask)||e._beforeTailState}}doDispatch(e,n,r){return n===void 0&&(n={}),r===void 0&&(r=""),this.dispatch(e,this,n,r)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,n){n===void 0&&(n={});let[r,i]=super.doPrepare(e,n);if(this.currentMask){let o;[r,o]=super.doPrepare(r,this.currentMaskFlags(n)),i=i.aggregate(o)}return[r,i]}doPrepareChar(e,n){n===void 0&&(n={});let[r,i]=super.doPrepareChar(e,n);if(this.currentMask){let o;[r,o]=super.doPrepareChar(r,this.currentMaskFlags(n)),i=i.aggregate(o)}return[r,i]}reset(){var e;(e=this.currentMask)==null||e.reset(),this.compiledMasks.forEach(n=>n.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask){this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,this._applyDispatch();return}let n=String(e);this.currentMask&&(this.currentMask.typedValue=e,n=this.currentMask.unmaskedValue),this.unmaskedValue=n}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return!!((e=this.currentMask)!=null&&e.isComplete)}get isFilled(){var e;return!!((e=this.currentMask)!=null&&e.isFilled)}remove(e,n){const r=new br;return this.currentMask&&r.aggregate(this.currentMask.remove(e,n)).aggregate(this._applyDispatch()),r}get state(){var e;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(n=>n.state),currentMaskRef:this.currentMask,currentMask:(e=this.currentMask)==null?void 0:e.state}}set state(e){const{compiledMasks:n,currentMaskRef:r,currentMask:i,...o}=e;n&&this.compiledMasks.forEach((s,a)=>s.state=n[a]),r!=null&&(this.currentMask=r,this.currentMask.state=i),super.state=o}extractInput(e,n,r){return this.currentMask?this.currentMask.extractInput(e,n,r):""}extractTail(e,n){return this.currentMask?this.currentMask.extractTail(e,n):super.extractTail(e,n)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(e,n){return this.currentMask?this.currentMask.nearestInputPos(e,n):super.nearestInputPos(e,n)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(e){this._overwrite=e}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(e){this._eager=e}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(e){this._skipInvalid=e}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(e){this._autofix=e}maskEquals(e){return Array.isArray(e)?this.compiledMasks.every((n,r)=>{if(!e[r])return;const{mask:i,...o}=e[r];return qS(n,o)&&n.maskEquals(i)}):super.maskEquals(e)}typedValueEquals(e){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(e))}}JS.DEFAULTS={...Ga.DEFAULTS,dispatch:(t,e,n,r)=>{if(!e.compiledMasks.length)return;const i=e.rawInputValue,o=e.compiledMasks.map((s,a)=>{const l=e.currentMask===s,c=l?s.displayValue.length:s.nearestInputPos(s.displayValue.length,In.FORCE_LEFT);return s.rawInputValue!==i?(s.reset(),s.append(i,{raw:!0})):l||s.remove(c),s.append(t,e.currentMaskFlags(n)),s.appendTail(r),{index:a,weight:s.rawInputValue.length,totalInputPositions:s.totalInputPositions(0,Math.max(c,s.nearestInputPos(s.displayValue.length,In.FORCE_LEFT)))}});return o.sort((s,a)=>a.weight-s.weight||a.totalInputPositions-s.totalInputPositions),e.compiledMasks[o[0].index]}},Rn.MaskedDynamic=JS;class QS extends qa{constructor(e){super({...QS.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:n,...r}=e;if(n){const i=n.map(a=>a.length),o=Math.min(...i),s=Math.max(...i)-o;r.mask="*".repeat(o),s&&(r.mask+="["+"*".repeat(s)+"]"),this.enum=n}super._update(r)}_appendCharRaw(e,n){n===void 0&&(n={});const r=Math.min(this.nearestInputPos(0,In.FORCE_RIGHT),this.value.length),i=this.enum.filter(o=>this.matchValue(o,this.unmaskedValue+e,r));if(i.length){i.length===1&&this._forEachBlocksInRange(0,this.value.length,(s,a)=>{const l=i[0][a];a>=this.value.length||l===s.value||(s.reset(),s._appendChar(l,n))});const o=super._appendCharRaw(i[0][this.value.length],n);return i.length===1&&i[0].slice(this.unmaskedValue.length).split("").forEach(s=>o.aggregate(super._appendCharRaw(s))),o}return new br({skip:!this.isComplete})}extractTail(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),new nd("",e)}remove(e,n){if(e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),e===n)return new br;const r=Math.min(super.nearestInputPos(0,In.FORCE_RIGHT),this.value.length);let i;for(i=e;i>=0&&!(this.enum.filter(a=>this.matchValue(a,this.value.slice(r,i),r)).length>1);--i);const o=super.remove(i,n);return o.tailShift+=i-e,o}get isComplete(){return this.enum.indexOf(this.value)>=0}}QS.DEFAULTS={...qa.DEFAULTS,matchValue:(t,e,n)=>t.indexOf(e,n)===n},Rn.MaskedEnum=QS;class Jue extends Ga{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}Rn.MaskedFunction=Jue;var PV;class Pc extends Ga{constructor(e){super({...Pc.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),n="\\d*",r=(this.scale?"("+lP(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+n+r),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(lP).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(lP(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const n=e.split(this.radix);return n[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),n.join(this.radix)}doPrepareChar(e,n){n===void 0&&(n={});const[r,i]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(n.input&&n.raw||!n.input&&!n.raw)?e.replace(this._mapToRadixRegExp,this.radix):e),n);return e&&!r&&(i.skip=!0),r&&!this.allowPositive&&!this.value&&r!=="-"&&i.aggregate(this._appendChar("-")),[r,i]}_separatorsCount(e,n){n===void 0&&(n=!1);let r=0;for(let i=0;i0&&this.number>this.max&&(p=this.max),p!=null&&(this.autofix?(this._value=this.format(p,this).replace(Pc.UNMASKED_RADIX,this.radix),l||(l=o===this._value&&!n.tail)):a=!1),a&&(a=!!this._value.match(this._numberRegExp))}let c;a?c=new br({inserted:this._value.slice(o.length),rawInserted:l?"":e,skip:l}):(this._value=o,c=new br),this._value=this._insertThousandsSeparators(this._value);const u=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,d=this._separatorsCountFromSlice(u);return c.tailShift+=(d-i)*this.thousandsSeparator.length,c}_findSeparatorAround(e){if(this.thousandsSeparator){const n=e-this.thousandsSeparator.length+1,r=this.value.indexOf(this.thousandsSeparator,n);if(r<=e)return r}return-1}_adjustRangeWithSeparators(e,n){const r=this._findSeparatorAround(e);r>=0&&(e=r);const i=this._findSeparatorAround(n);return i>=0&&(n=i+this.thousandsSeparator.length),[e,n]}remove(e,n){e===void 0&&(e=0),n===void 0&&(n=this.displayValue.length),[e,n]=this._adjustRangeWithSeparators(e,n);const r=this.value.slice(0,e),i=this.value.slice(n),o=this._separatorsCount(r.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(r+i));const s=this._separatorsCountFromSlice(r);return new br({tailShift:(s-o)*this.thousandsSeparator.length})}nearestInputPos(e,n){if(!this.thousandsSeparator)return e;switch(n){case In.NONE:case In.LEFT:case In.FORCE_LEFT:{const r=this._findSeparatorAround(e-1);if(r>=0){const i=r+this.thousandsSeparator.length;if(e=0)return r+this.thousandsSeparator.length}}return e}doCommit(){if(this.value){const e=this.number;let n=e;this.min!=null&&(n=Math.max(n,this.min)),this.max!=null&&(n=Math.min(n,this.max)),n!==e&&(this.unmaskedValue=this.format(n,this));let r=this.value;this.normalizeZeros&&(r=this._normalizeZeros(r)),this.padFractionalZeros&&this.scale>0&&(r=this._padFractionalZeros(r)),this._value=r}super.doCommit()}_normalizeZeros(e){const n=this._removeThousandsSeparators(e).split(this.radix);return n[0]=n[0].replace(/^(\D*)(0*)(\d*)/,(r,i,o,s)=>i+s),e.length&&!/\d$/.test(n[0])&&(n[0]=n[0]+"0"),n.length>1&&(n[1]=n[1].replace(/0*$/,""),n[1].length||(n.length=1)),this._insertThousandsSeparators(n.join(this.radix))}_padFractionalZeros(e){if(!e)return e;const n=e.split(this.radix);return n.length<2&&n.push(""),n[1]=n[1].padEnd(this.scale,"0"),n.join(this.radix)}doSkipInvalid(e,n,r){n===void 0&&(n={});const i=this.scale===0&&e!==this.thousandsSeparator&&(e===this.radix||e===Pc.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,n,r)&&!i}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,Pc.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(e){this.rawInputValue=this.format(e,this).replace(Pc.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(e){return(super.typedValueEquals(e)||Pc.EMPTY_VALUES.includes(e)&&Pc.EMPTY_VALUES.includes(this.typedValue))&&!(e===0&&this.value==="")}}PV=Pc,Pc.UNMASKED_RADIX=".",Pc.EMPTY_VALUES=[...Ga.EMPTY_VALUES,0],Pc.DEFAULTS={...Ga.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[PV.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:t=>t.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},Rn.MaskedNumber=Pc;const uP={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function NV(t,e,n){e===void 0&&(e=uP.MASKED),n===void 0&&(n=uP.MASKED);const r=hf(t);return i=>r.runIsolated(o=>(o[e]=i,o[n]))}function Que(t,e,n,r){return NV(e,n,r)(t)}Rn.PIPE_TYPE=uP,Rn.createPipe=NV,Rn.pipe=Que;class ehe extends qa{get repeatFrom(){var e;return(e=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?e:0}get repeatTo(){var e;return(e=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?e:1/0}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){var n,r,i;const{repeat:o,...s}=g1(e);this._blockOpts=Object.assign({},this._blockOpts,s);const a=hf(this._blockOpts);this.repeat=(n=(r=o??a.repeat)!=null?r:this.repeat)!=null?n:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((i=this._blocks)==null?void 0:i.length)||0,this.repeatFrom)),blocks:{m:a},eager:a.eager,overwrite:a.overwrite,skipInvalid:a.skipInvalid,lazy:a.lazy,placeholderChar:a.placeholderChar,displayChar:a.displayChar})}_allocateBlock(e){if(e""},icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},modelValue:{type:String,default:()=>""},placeholder:{type:String,default:()=>""},iconPosition:{type:String,default:()=>"right"}},computed:{modelState:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}}},mounted(){this.initMask()},methods:{initMask(){const e=this.$refs.formText.$el.querySelector("input"),n=Rn(e,{mask:this.mask.replace(/9/g,"0")});n.on("accept",()=>{this.$emit("update:modelValue",n.value)})}}});function nhe(t,e,n,r,i,o){const s=g.resolveComponent("VsFormText");return g.openBlock(),g.createElementBlock("div",null,[g.createVNode(s,{ref:"formText",icon:t.icon,iconPosition:t.iconPosition,disabled:t.disabled,clearable:t.clearable,modelValue:t.modelState,"onUpdate:modelValue":e[0]||(e[0]=a=>t.modelState=a),placeholder:t.placeholder},null,8,["icon","iconPosition","disabled","clearable","modelValue","placeholder"])])}const rhe=xt(the,[["render",nhe]]),ihe={props:{confirm:{type:Boolean,default:()=>!0},modelValue:{type:String,default:()=>""}},data(){return{isVisible:!1,passwordValue:this.modelValue,confirmValue:this.modelValue,error:!1}},watch:{modelValue(t){this.passwordValue=t,this.confirmValue=t}},methods:{checkConfirm(t){this.confirm?t!==this.passwordValue&&this.passwordValue!==""?this.error=!0:(this.error=!1,this.$emit("update:modelValue",this.passwordValue)):this.$emit("update:modelValue",this.passwordValue)}}},ohe=["type"],she={key:0,class:"flex flex-col gap-[8px] text-sm font-medium text-gray-500 relative"},ahe=["type"],lhe={key:0,class:"text-red-600 text-xs"};function che(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",null,[g.createElementVNode("label",{class:g.normalizeClass(["flex flex-col gap-[8px] text-sm font-medium text-gray-500 relative",[n.confirm?"mb-[10px]":""]])},[g.withDirectives(g.createElementVNode("input",{onBlur:e[0]||(e[0]=s=>o.checkConfirm(i.confirmValue)),onInput:e[1]||(e[1]=s=>o.checkConfirm(i.confirmValue)),"onUpdate:modelValue":e[2]||(e[2]=s=>i.passwordValue=s),placeholder:"Пароль",type:i.isVisible?"text":"password",class:"h-[40px] w-full rounded-lg outline-none border focus:border-blue-600 focus:border-[2px] outline-none pl-[15px] pr-[40px] border-gray-200 [&::placeholder]:opacity-[0.5] [&::placeholder]:font-normal"},null,40,ohe),[[g.vModelDynamic,i.passwordValue]]),g.createElementVNode("button",{onClick:e[3]||(e[3]=s=>i.isVisible=!i.isVisible),class:"absolute top-[10px] right-[10px]"},[g.createElementVNode("i",{class:g.normalizeClass([i.isVisible?"ti ti-eye text-[20px]":"ti ti-eye-off text-[20px]"])},null,2)])],2),n.confirm?(g.openBlock(),g.createElementBlock("label",she,[e[8]||(e[8]=g.createTextVNode(g.toDisplayString("Повторіть пароль"))),g.withDirectives(g.createElementVNode("input",{"onUpdate:modelValue":e[4]||(e[4]=s=>i.confirmValue=s),type:i.isVisible?"text":"password",placeholder:"Повторіть пароль",class:"h-[40px] w-full rounded-lg outline-none border pl-[15px] focus:border-blue-600 focus:border-[2px] outline-none pr-[40px] border-gray-200 [&::placeholder]:opacity-[0.5] [&::placeholder]:font-normal",onInput:e[5]||(e[5]=s=>o.checkConfirm(i.confirmValue)),onBlur:e[6]||(e[6]=s=>o.checkConfirm(i.confirmValue))},null,40,ahe),[[g.vModelDynamic,i.confirmValue]]),g.createElementVNode("button",{onClick:e[7]||(e[7]=s=>i.isVisible=!i.isVisible),class:"absolute top-[37px] right-[10px]"},[g.createElementVNode("i",{class:g.normalizeClass([i.isVisible?"ti ti-eye text-[20px]":"ti ti-eye-off text-[20px]"])},null,2)]),i.error?(g.openBlock(),g.createElementBlock("div",lhe,"Паролі не співпадають")):g.createCommentVNode("",!0)])):g.createCommentVNode("",!0)])}const uhe=xt(ihe,[["render",che]]),hhe=g.defineComponent({props:{modelValue:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1}},data(){return{}},mounted(){this.modelValue||this.$emit("update:modelValue",!1)},computed:{modelState:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}},labelCursorClasses(){return[{"cursor-not-allowed":this.disabled},{"cursor-pointer":!this.disabled}]}},methods:{handleEnterDown(t){const{keyCode:e}=t;e===13&&(this.modelState=!this.modelState)},addKeyHandler(){window.addEventListener("keydown",this.handleEnterDown)},removeKeyHandler(){window.removeEventListener("keydown",this.handleEnterDown)}}}),dhe=["disabled"],fhe={class:"ml-2 text-sm"};function phe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("label",{class:g.normalizeClass(["relative inline-flex items-center cursor-pointer min-h-[40px] relative",t.labelCursorClasses])},[g.withDirectives(g.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=s=>t.modelState=s),type:"checkbox",value:"",class:"sr-only peer",disabled:t.disabled,tabindex:"-1"},null,8,dhe),[[g.vModelCheckbox,t.modelState]]),g.createElementVNode("div",{class:"w-11 h-6 t-[12px] bg-gray-200 transition-all rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[10px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600 outline-none focus:border dark:bg-transparent dark:border-gray-600 focus:border-blue-500",tabindex:"0",onFocus:e[1]||(e[1]=(...s)=>t.addKeyHandler&&t.addKeyHandler(...s)),onBlur:e[2]||(e[2]=(...s)=>t.removeKeyHandler&&t.removeKeyHandler(...s))},null,32),g.createElementVNode("span",fhe,[g.renderSlot(t.$slots,"default",{},()=>[g.createTextVNode(g.toDisplayString(t.title),1)])])],2)}const OV=xt(hhe,[["render",phe]]),mhe=g.defineComponent({emits:["command"],props:{value:{type:String,default:()=>""},label:{type:String,default:"Обрати..."},icon:{type:String,default:()=>""},iconPosition:{type:String,default:()=>"left"},chevronIcon:{type:Boolean,default:()=>!0},width:{type:String,default:()=>""},positionHorizontal:{type:String,default:()=>"top-0"},positionVertical:{type:String,default:()=>"left-[95px]"}},data(){return{list:{visible:!1,canClose:!1},currentOption:""}},mounted(){window.addEventListener("click",this.closeDropdownOnClickOutside,!1),window.addEventListener("resize",this.boundList),window.addEventListener("scroll",this.boundList)},beforeUnmount(){window.removeEventListener("click",this.closeDropdownOnClickOutside),window.removeEventListener("resize",this.boundList),window.removeEventListener("scroll",this.boundList)},computed:{listWidth(){return this.width?`min-w-[${this.width}]`:"min-w-max"},listPositionClasses(){return{[this.positionHorizontal]:!0,[this.positionVertical]:!0}}},methods:{handleClick(){this.list.visible=!this.list.visible,this.list.visible&&this.boundList()},closeDropdownOnClickOutside(){this.list.canClose&&(this.list.visible=!1)},disallowBodyClick(t){const{type:e}=t;switch(e){case"mouseenter":this.list.canClose=!1;break;default:this.list.canClose=!0;break}},boundList(){var n;const t=(n=this.$refs)==null?void 0:n.button,e=t==null?void 0:t.getBoundingClientRect();this.list.visible&&this.$nextTick(()=>{var i;const r=(i=this.$refs)==null?void 0:i.list;r.style.top=`${e.bottom}px`,r.style.left=`${e.left}px`,r.style.width=`${t.clientWidth}px`})},handleChange(t){this.currentOption=t,this.$emit("command",t),this.list.visible=!1}}}),ghe={type:"button",class:"hs-select-disabled:pointer-events-none hs-select-disabled:opacity-50 relative py-2 px-3 flex justify-between text-nowrap w-full cursor-pointer bg-white border border-solid border-stone-200 rounded-lg text-start text-sm text-stone-800 focus:outline-none focus:ring-2 focus:ring-blue-600"},yhe={key:1},vhe={class:"form-dropdown__list"};function _he(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",{class:"flex flex-col gap-1",onMouseenter:e[3]||(e[3]=(...s)=>t.disallowBodyClick&&t.disallowBodyClick(...s)),onMouseleave:e[4]||(e[4]=(...s)=>t.disallowBodyClick&&t.disallowBodyClick(...s))},[g.createElementVNode("div",{onClick:e[0]||(e[0]=(...s)=>t.handleClick&&t.handleClick(...s)),ref:"button"},[g.renderSlot(t.$slots,"button",{},()=>[g.createElementVNode("button",ghe,[t.icon&&t.iconPosition==="left"?(g.openBlock(),g.createElementBlock("i",{key:0,class:g.normalizeClass(t.icon)},null,2)):g.createCommentVNode("",!0),t.label?(g.openBlock(),g.createElementBlock("span",yhe,g.toDisplayString(t.label),1)):g.createCommentVNode("",!0),t.chevronIcon?(g.openBlock(),g.createElementBlock("svg",{key:2,class:g.normalizeClass(["w-4 h-4 ml-auto transition-transform",{"rotate-180":t.list.visible}]),xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},e[5]||(e[5]=[g.createElementVNode("path",{d:"m6 9 6 6 6-6"},null,-1)]),2)):g.createCommentVNode("",!0),t.icon&&t.iconPosition==="right"?(g.openBlock(),g.createElementBlock("i",{key:3,class:g.normalizeClass(t.icon)},null,2)):g.createCommentVNode("",!0)])])],512),(g.openBlock(),g.createBlock(g.Teleport,{to:"#modal"},[g.createVNode(g.Transition,{name:"fade"},{default:g.withCtx(()=>[g.withDirectives(g.createElementVNode("div",{class:"vsTailwind fixed",ref:"list",onMouseenter:e[1]||(e[1]=(...s)=>t.disallowBodyClick&&t.disallowBodyClick(...s)),onMouseleave:e[2]||(e[2]=(...s)=>t.disallowBodyClick&&t.disallowBodyClick(...s))},[g.createElementVNode("div",{class:g.normalizeClass(["bg-white shadow-md rounded-lg mt-4 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] focus:outline-none focus:bg-stone-100 absolute",(t.listWidth,t.listPositionClasses)])},[g.createElementVNode("div",vhe,[g.renderSlot(t.$slots,"default")])],2)],544),[[g.vShow,t.list.visible]])]),_:3})]))],32)}const bhe=xt(mhe,[["render",_he]]);//! moment.js //! version : 2.30.1 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT //! momentjs.com var DV;function Xt(){return DV.apply(null,arguments)}function whe(t){DV=t}function ch(t){return t instanceof Array||Object.prototype.toString.call(t)==="[object Array]"}function Cg(t){return t!=null&&Object.prototype.toString.call(t)==="[object Object]"}function Ci(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function hP(t){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(t).length===0;var e;for(e in t)if(Ci(t,e))return!1;return!0}function Ql(t){return t===void 0}function ff(t){return typeof t=="number"||Object.prototype.toString.call(t)==="[object Number]"}function y1(t){return t instanceof Date||Object.prototype.toString.call(t)==="[object Date]"}function RV(t,e){var n=[],r,i=t.length;for(r=0;r>>0,r;for(r=0;r0)for(n=0;n=0;return(o?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}var _P=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,tC=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,bP={},l0={};function Nn(t,e,n,r){var i=r;typeof r=="string"&&(i=function(){return this[r]()}),t&&(l0[t]=i),e&&(l0[e[0]]=function(){return od(i.apply(this,arguments),e[1],e[2])}),n&&(l0[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),t)})}function khe(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function The(t){var e=t.match(_P),n,r;for(n=0,r=e.length;n=0&&tC.test(t);)t=t.replace(tC,r),tC.lastIndex=0,n-=1;return t}var Mhe={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function Ahe(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.match(_P).map(function(r){return r==="MMMM"||r==="MM"||r==="DD"||r==="dddd"?r.slice(1):r}).join(""),this._longDateFormat[t])}var Ihe="Invalid date";function Lhe(){return this._invalidDate}var Phe="%d",Nhe=/\d{1,2}/;function Ohe(t){return this._ordinal.replace("%d",t)}var Dhe={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Rhe(t,e,n,r){var i=this._relativeTime[n];return id(i)?i(t,e,n,r):i.replace(/%d/i,t)}function Bhe(t,e){var n=this._relativeTime[t>0?"future":"past"];return id(n)?n(e):n.replace(/%s/i,e)}var jV={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function bu(t){return typeof t=="string"?jV[t]||jV[t.toLowerCase()]:void 0}function wP(t){var e={},n,r;for(r in t)Ci(t,r)&&(n=bu(r),n&&(e[n]=t[r]));return e}var Fhe={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function $he(t){var e=[],n;for(n in t)Ci(t,n)&&e.push({unit:n,priority:Fhe[n]});return e.sort(function(r,i){return r.priority-i.priority}),e}var UV=/\d/,Nc=/\d\d/,HV=/\d{3}/,xP=/\d{4}/,rC=/[+-]?\d{6}/,yo=/\d\d?/,WV=/\d\d\d\d?/,GV=/\d\d\d\d\d\d?/,iC=/\d{1,3}/,EP=/\d{1,4}/,oC=/[+-]?\d{1,6}/,c0=/\d+/,sC=/[+-]?\d+/,zhe=/Z|[+-]\d\d:?\d\d/gi,aC=/Z|[+-]\d\d(?::?\d\d)?/gi,Vhe=/[+-]?\d+(\.\d{1,3})?/,_1=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,u0=/^[1-9]\d?/,SP=/^([1-9]\d|\d)/,lC;lC={};function dn(t,e,n){lC[t]=id(e)?e:function(r,i){return r&&n?n:e}}function jhe(t,e){return Ci(lC,t)?lC[t](e._strict,e._locale):new RegExp(Uhe(t))}function Uhe(t){return pf(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,n,r,i,o){return n||r||i||o}))}function pf(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function wu(t){return t<0?Math.ceil(t)||0:Math.floor(t)}function oi(t){var e=+t,n=0;return e!==0&&isFinite(e)&&(n=wu(e)),n}var CP={};function Ui(t,e){var n,r=e,i;for(typeof t=="string"&&(t=[t]),ff(e)&&(r=function(o,s){s[e]=oi(o)}),i=t.length,n=0;n68?1900:2e3)};var qV=h0("FullYear",!0);function qhe(){return cC(this.year())}function h0(t,e){return function(n){return n!=null?(YV(this,t,n),Xt.updateOffset(this,e),this):x1(this,t)}}function x1(t,e){if(!t.isValid())return NaN;var n=t._d,r=t._isUTC;switch(e){case"Milliseconds":return r?n.getUTCMilliseconds():n.getMilliseconds();case"Seconds":return r?n.getUTCSeconds():n.getSeconds();case"Minutes":return r?n.getUTCMinutes():n.getMinutes();case"Hours":return r?n.getUTCHours():n.getHours();case"Date":return r?n.getUTCDate():n.getDate();case"Day":return r?n.getUTCDay():n.getDay();case"Month":return r?n.getUTCMonth():n.getMonth();case"FullYear":return r?n.getUTCFullYear():n.getFullYear();default:return NaN}}function YV(t,e,n){var r,i,o,s,a;if(!(!t.isValid()||isNaN(n))){switch(r=t._d,i=t._isUTC,e){case"Milliseconds":return void(i?r.setUTCMilliseconds(n):r.setMilliseconds(n));case"Seconds":return void(i?r.setUTCSeconds(n):r.setSeconds(n));case"Minutes":return void(i?r.setUTCMinutes(n):r.setMinutes(n));case"Hours":return void(i?r.setUTCHours(n):r.setHours(n));case"Date":return void(i?r.setUTCDate(n):r.setDate(n));case"FullYear":break;default:return}o=n,s=t.month(),a=t.date(),a=a===29&&s===1&&!cC(o)?28:a,i?r.setUTCFullYear(o,s,a):r.setFullYear(o,s,a)}}function Yhe(t){return t=bu(t),id(this[t])?this[t]():this}function Zhe(t,e){if(typeof t=="object"){t=wP(t);var n=$he(t),r,i=n.length;for(r=0;r=0?(a=new Date(t+400,e,n,r,i,o,s),isFinite(a.getFullYear())&&a.setFullYear(t)):a=new Date(t,e,n,r,i,o,s),a}function E1(t){var e,n;return t<100&&t>=0?(n=Array.prototype.slice.call(arguments),n[0]=t+400,e=new Date(Date.UTC.apply(null,n)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t)):e=new Date(Date.UTC.apply(null,arguments)),e}function uC(t,e,n){var r=7+e-n,i=(7+E1(t,0,r).getUTCDay()-e)%7;return-i+r-1}function e6(t,e,n,r,i){var o=(7+n-r)%7,s=uC(t,r,i),a=1+7*(e-1)+o+s,l,c;return a<=0?(l=t-1,c=w1(l)+a):a>w1(t)?(l=t+1,c=a-w1(t)):(l=t,c=a),{year:l,dayOfYear:c}}function S1(t,e,n){var r=uC(t.year(),e,n),i=Math.floor((t.dayOfYear()-r-1)/7)+1,o,s;return i<1?(s=t.year()-1,o=i+yf(s,e,n)):i>yf(t.year(),e,n)?(o=i-yf(t.year(),e,n),s=t.year()+1):(s=t.year(),o=i),{week:o,year:s}}function yf(t,e,n){var r=uC(t,e,n),i=uC(t+1,e,n);return(w1(t)-r+i)/7}Nn("w",["ww",2],"wo","week"),Nn("W",["WW",2],"Wo","isoWeek"),dn("w",yo,u0),dn("ww",yo,Nc),dn("W",yo,u0),dn("WW",yo,Nc),b1(["w","ww","W","WW"],function(t,e,n,r){e[r.substr(0,1)]=oi(t)});function lde(t){return S1(t,this._week.dow,this._week.doy).week}var cde={dow:0,doy:6};function ude(){return this._week.dow}function hde(){return this._week.doy}function dde(t){var e=this.localeData().week(this);return t==null?e:this.add((t-e)*7,"d")}function fde(t){var e=S1(this,1,4).week;return t==null?e:this.add((t-e)*7,"d")}Nn("d",0,"do","day"),Nn("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),Nn("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),Nn("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),Nn("e",0,0,"weekday"),Nn("E",0,0,"isoWeekday"),dn("d",yo),dn("e",yo),dn("E",yo),dn("dd",function(t,e){return e.weekdaysMinRegex(t)}),dn("ddd",function(t,e){return e.weekdaysShortRegex(t)}),dn("dddd",function(t,e){return e.weekdaysRegex(t)}),b1(["dd","ddd","dddd"],function(t,e,n,r){var i=n._locale.weekdaysParse(t,r,n._strict);i!=null?e.d=i:yr(n).invalidWeekday=t}),b1(["d","e","E"],function(t,e,n,r){e[r]=oi(t)});function pde(t,e){return typeof t!="string"?t:isNaN(t)?(t=e.weekdaysParse(t),typeof t=="number"?t:null):parseInt(t,10)}function mde(t,e){return typeof t=="string"?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function TP(t,e){return t.slice(e,7).concat(t.slice(0,e))}var gde="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),t6="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),yde="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),vde=_1,_de=_1,bde=_1;function wde(t,e){var n=ch(this._weekdays)?this._weekdays:this._weekdays[t&&t!==!0&&this._weekdays.isFormat.test(e)?"format":"standalone"];return t===!0?TP(n,this._week.dow):t?n[t.day()]:n}function xde(t){return t===!0?TP(this._weekdaysShort,this._week.dow):t?this._weekdaysShort[t.day()]:this._weekdaysShort}function Ede(t){return t===!0?TP(this._weekdaysMin,this._week.dow):t?this._weekdaysMin[t.day()]:this._weekdaysMin}function Sde(t,e,n){var r,i,o,s=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)o=rd([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(o,"").toLocaleLowerCase();return n?e==="dddd"?(i=ts.call(this._weekdaysParse,s),i!==-1?i:null):e==="ddd"?(i=ts.call(this._shortWeekdaysParse,s),i!==-1?i:null):(i=ts.call(this._minWeekdaysParse,s),i!==-1?i:null):e==="dddd"?(i=ts.call(this._weekdaysParse,s),i!==-1||(i=ts.call(this._shortWeekdaysParse,s),i!==-1)?i:(i=ts.call(this._minWeekdaysParse,s),i!==-1?i:null)):e==="ddd"?(i=ts.call(this._shortWeekdaysParse,s),i!==-1||(i=ts.call(this._weekdaysParse,s),i!==-1)?i:(i=ts.call(this._minWeekdaysParse,s),i!==-1?i:null)):(i=ts.call(this._minWeekdaysParse,s),i!==-1||(i=ts.call(this._weekdaysParse,s),i!==-1)?i:(i=ts.call(this._shortWeekdaysParse,s),i!==-1?i:null))}function Cde(t,e,n){var r,i,o;if(this._weekdaysParseExact)return Sde.call(this,t,e,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++){if(i=rd([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[r]||(o="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(o.replace(".",""),"i")),n&&e==="dddd"&&this._fullWeekdaysParse[r].test(t))return r;if(n&&e==="ddd"&&this._shortWeekdaysParse[r].test(t))return r;if(n&&e==="dd"&&this._minWeekdaysParse[r].test(t))return r;if(!n&&this._weekdaysParse[r].test(t))return r}}function kde(t){if(!this.isValid())return t!=null?this:NaN;var e=x1(this,"Day");return t!=null?(t=pde(t,this.localeData()),this.add(t-e,"d")):e}function Tde(t){if(!this.isValid())return t!=null?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return t==null?e:this.add(t-e,"d")}function Mde(t){if(!this.isValid())return t!=null?this:NaN;if(t!=null){var e=mde(t,this.localeData());return this.day(this.day()%7?e:e-7)}else return this.day()||7}function Ade(t){return this._weekdaysParseExact?(Ci(this,"_weekdaysRegex")||MP.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(Ci(this,"_weekdaysRegex")||(this._weekdaysRegex=vde),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}function Ide(t){return this._weekdaysParseExact?(Ci(this,"_weekdaysRegex")||MP.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(Ci(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=_de),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Lde(t){return this._weekdaysParseExact?(Ci(this,"_weekdaysRegex")||MP.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(Ci(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=bde),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function MP(){function t(u,d){return d.length-u.length}var e=[],n=[],r=[],i=[],o,s,a,l,c;for(o=0;o<7;o++)s=rd([2e3,1]).day(o),a=pf(this.weekdaysMin(s,"")),l=pf(this.weekdaysShort(s,"")),c=pf(this.weekdays(s,"")),e.push(a),n.push(l),r.push(c),i.push(a),i.push(l),i.push(c);e.sort(t),n.sort(t),r.sort(t),i.sort(t),this._weekdaysRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+e.join("|")+")","i")}function AP(){return this.hours()%12||12}function Pde(){return this.hours()||24}Nn("H",["HH",2],0,"hour"),Nn("h",["hh",2],0,AP),Nn("k",["kk",2],0,Pde),Nn("hmm",0,0,function(){return""+AP.apply(this)+od(this.minutes(),2)}),Nn("hmmss",0,0,function(){return""+AP.apply(this)+od(this.minutes(),2)+od(this.seconds(),2)}),Nn("Hmm",0,0,function(){return""+this.hours()+od(this.minutes(),2)}),Nn("Hmmss",0,0,function(){return""+this.hours()+od(this.minutes(),2)+od(this.seconds(),2)});function n6(t,e){Nn(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}n6("a",!0),n6("A",!1);function r6(t,e){return e._meridiemParse}dn("a",r6),dn("A",r6),dn("H",yo,SP),dn("h",yo,u0),dn("k",yo,u0),dn("HH",yo,Nc),dn("hh",yo,Nc),dn("kk",yo,Nc),dn("hmm",WV),dn("hmmss",GV),dn("Hmm",WV),dn("Hmmss",GV),Ui(["H","HH"],zs),Ui(["k","kk"],function(t,e,n){var r=oi(t);e[zs]=r===24?0:r}),Ui(["a","A"],function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t}),Ui(["h","hh"],function(t,e,n){e[zs]=oi(t),yr(n).bigHour=!0}),Ui("hmm",function(t,e,n){var r=t.length-2;e[zs]=oi(t.substr(0,r)),e[hh]=oi(t.substr(r)),yr(n).bigHour=!0}),Ui("hmmss",function(t,e,n){var r=t.length-4,i=t.length-2;e[zs]=oi(t.substr(0,r)),e[hh]=oi(t.substr(r,2)),e[gf]=oi(t.substr(i)),yr(n).bigHour=!0}),Ui("Hmm",function(t,e,n){var r=t.length-2;e[zs]=oi(t.substr(0,r)),e[hh]=oi(t.substr(r))}),Ui("Hmmss",function(t,e,n){var r=t.length-4,i=t.length-2;e[zs]=oi(t.substr(0,r)),e[hh]=oi(t.substr(r,2)),e[gf]=oi(t.substr(i))});function Nde(t){return(t+"").toLowerCase().charAt(0)==="p"}var Ode=/[ap]\.?m?\.?/i,Dde=h0("Hours",!0);function Rde(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"}var i6={calendar:She,longDateFormat:Mhe,invalidDate:Ihe,ordinal:Phe,dayOfMonthOrdinalParse:Nhe,relativeTime:Dhe,months:Khe,monthsShort:ZV,week:cde,weekdays:gde,weekdaysMin:yde,weekdaysShort:t6,meridiemParse:Ode},To={},C1={},k1;function Bde(t,e){var n,r=Math.min(t.length,e.length);for(n=0;n0;){if(i=hC(o.slice(0,n).join("-")),i)return i;if(r&&r.length>=n&&Bde(o,r)>=n-1)break;n--}e++}return k1}function $de(t){return!!(t&&t.match("^[^/\\\\]*$"))}function hC(t){var e=null,n;if(To[t]===void 0&&typeof module<"u"&&module&&module.exports&&$de(t))try{e=k1._abbr,n=require,n("./locale/"+t),Np(e)}catch{To[t]=null}return To[t]}function Np(t,e){var n;return t&&(Ql(e)?n=vf(t):n=IP(t,e),n?k1=n:typeof console<"u"&&console.warn&&console.warn("Locale "+t+" not found. Did you forget to load it?")),k1._abbr}function IP(t,e){if(e!==null){var n,r=i6;if(e.abbr=t,To[t]!=null)zV("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),r=To[t]._config;else if(e.parentLocale!=null)if(To[e.parentLocale]!=null)r=To[e.parentLocale]._config;else if(n=hC(e.parentLocale),n!=null)r=n._config;else return C1[e.parentLocale]||(C1[e.parentLocale]=[]),C1[e.parentLocale].push({name:t,config:e}),null;return To[t]=new yP(gP(r,e)),C1[t]&&C1[t].forEach(function(i){IP(i.name,i.config)}),Np(t),To[t]}else return delete To[t],null}function zde(t,e){if(e!=null){var n,r,i=i6;To[t]!=null&&To[t].parentLocale!=null?To[t].set(gP(To[t]._config,e)):(r=hC(t),r!=null&&(i=r._config),e=gP(i,e),r==null&&(e.abbr=t),n=new yP(e),n.parentLocale=To[t],To[t]=n),Np(t)}else To[t]!=null&&(To[t].parentLocale!=null?(To[t]=To[t].parentLocale,t===Np()&&Np(t)):To[t]!=null&&delete To[t]);return To[t]}function vf(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return k1;if(!ch(t)){if(e=hC(t),e)return e;t=[t]}return Fde(t)}function Vde(){return vP(To)}function LP(t){var e,n=t._a;return n&&yr(t).overflow===-2&&(e=n[mf]<0||n[mf]>11?mf:n[sd]<1||n[sd]>kP(n[Ya],n[mf])?sd:n[zs]<0||n[zs]>24||n[zs]===24&&(n[hh]!==0||n[gf]!==0||n[kg]!==0)?zs:n[hh]<0||n[hh]>59?hh:n[gf]<0||n[gf]>59?gf:n[kg]<0||n[kg]>999?kg:-1,yr(t)._overflowDayOfYear&&(esd)&&(e=sd),yr(t)._overflowWeeks&&e===-1&&(e=Whe),yr(t)._overflowWeekday&&e===-1&&(e=Ghe),yr(t).overflow=e),t}var jde=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ude=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Hde=/Z|[+-]\d\d(?::?\d\d)?/,dC=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],PP=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Wde=/^\/?Date\((-?\d+)/i,Gde=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,qde={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function s6(t){var e,n,r=t._i,i=jde.exec(r)||Ude.exec(r),o,s,a,l,c=dC.length,u=PP.length;if(i){for(yr(t).iso=!0,e=0,n=c;ew1(s)||t._dayOfYear===0)&&(yr(t)._overflowDayOfYear=!0),n=E1(s,0,t._dayOfYear),t._a[mf]=n.getUTCMonth(),t._a[sd]=n.getUTCDate()),e=0;e<3&&t._a[e]==null;++e)t._a[e]=r[e]=i[e];for(;e<7;e++)t._a[e]=r[e]=t._a[e]==null?e===2?1:0:t._a[e];t._a[zs]===24&&t._a[hh]===0&&t._a[gf]===0&&t._a[kg]===0&&(t._nextDay=!0,t._a[zs]=0),t._d=(t._useUTC?E1:ade).apply(null,r),o=t._useUTC?t._d.getUTCDay():t._d.getDay(),t._tzm!=null&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[zs]=24),t._w&&typeof t._w.d<"u"&&t._w.d!==o&&(yr(t).weekdayMismatch=!0)}}function tfe(t){var e,n,r,i,o,s,a,l,c;e=t._w,e.GG!=null||e.W!=null||e.E!=null?(o=1,s=4,n=d0(e.GG,t._a[Ya],S1(vo(),1,4).year),r=d0(e.W,1),i=d0(e.E,1),(i<1||i>7)&&(l=!0)):(o=t._locale._week.dow,s=t._locale._week.doy,c=S1(vo(),o,s),n=d0(e.gg,t._a[Ya],c.year),r=d0(e.w,c.week),e.d!=null?(i=e.d,(i<0||i>6)&&(l=!0)):e.e!=null?(i=e.e+o,(e.e<0||e.e>6)&&(l=!0)):i=o),r<1||r>yf(n,o,s)?yr(t)._overflowWeeks=!0:l!=null?yr(t)._overflowWeekday=!0:(a=e6(n,r,i,o,s),t._a[Ya]=a.year,t._dayOfYear=a.dayOfYear)}Xt.ISO_8601=function(){},Xt.RFC_2822=function(){};function OP(t){if(t._f===Xt.ISO_8601){s6(t);return}if(t._f===Xt.RFC_2822){a6(t);return}t._a=[],yr(t).empty=!0;var e=""+t._i,n,r,i,o,s,a=e.length,l=0,c,u;for(i=VV(t._f,t._locale).match(_P)||[],u=i.length,n=0;n0&&yr(t).unusedInput.push(s),e=e.slice(e.indexOf(r)+r.length),l+=r.length),l0[o]?(r?yr(t).empty=!1:yr(t).unusedTokens.push(o),Hhe(o,r,t)):t._strict&&!r&&yr(t).unusedTokens.push(o);yr(t).charsLeftOver=a-l,e.length>0&&yr(t).unusedInput.push(e),t._a[zs]<=12&&yr(t).bigHour===!0&&t._a[zs]>0&&(yr(t).bigHour=void 0),yr(t).parsedDateParts=t._a.slice(0),yr(t).meridiem=t._meridiem,t._a[zs]=nfe(t._locale,t._a[zs],t._meridiem),c=yr(t).era,c!==null&&(t._a[Ya]=t._locale.erasConvertYear(c,t._a[Ya])),NP(t),LP(t)}function nfe(t,e,n){var r;return n==null?e:t.meridiemHour!=null?t.meridiemHour(e,n):(t.isPM!=null&&(r=t.isPM(n),r&&e<12&&(e+=12),!r&&e===12&&(e=0)),e)}function rfe(t){var e,n,r,i,o,s,a=!1,l=t._f.length;if(l===0){yr(t).invalidFormat=!0,t._d=new Date(NaN);return}for(i=0;ithis?this:t:eC()});function u6(t,e){var n,r;if(e.length===1&&ch(e[0])&&(e=e[0]),!e.length)return vo();for(n=e[0],r=1;rthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Sfe(){if(!Ql(this._isDSTShifted))return this._isDSTShifted;var t={},e;return mP(t,this),t=l6(t),t._a?(e=t._isUTC?rd(t._a):vo(t._a),this._isDSTShifted=this.isValid()&&mfe(t._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Cfe(){return this.isValid()?!this._isUTC:!1}function kfe(){return this.isValid()?this._isUTC:!1}function d6(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Tfe=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Mfe=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function dh(t,e){var n=t,r=null,i,o,s;return pC(t)?n={ms:t._milliseconds,d:t._days,M:t._months}:ff(t)||!isNaN(+t)?(n={},e?n[e]=+t:n.milliseconds=+t):(r=Tfe.exec(t))?(i=r[1]==="-"?-1:1,n={y:0,d:oi(r[sd])*i,h:oi(r[zs])*i,m:oi(r[hh])*i,s:oi(r[gf])*i,ms:oi(DP(r[kg]*1e3))*i}):(r=Mfe.exec(t))?(i=r[1]==="-"?-1:1,n={y:Tg(r[2],i),M:Tg(r[3],i),w:Tg(r[4],i),d:Tg(r[5],i),h:Tg(r[6],i),m:Tg(r[7],i),s:Tg(r[8],i)}):n==null?n={}:typeof n=="object"&&("from"in n||"to"in n)&&(s=Afe(vo(n.from),vo(n.to)),n={},n.ms=s.milliseconds,n.M=s.months),o=new fC(n),pC(t)&&Ci(t,"_locale")&&(o._locale=t._locale),pC(t)&&Ci(t,"_isValid")&&(o._isValid=t._isValid),o}dh.fn=fC.prototype,dh.invalid=pfe;function Tg(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function f6(t,e){var n={};return n.months=e.month()-t.month()+(e.year()-t.year())*12,t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function Afe(t,e){var n;return t.isValid()&&e.isValid()?(e=BP(e,t),t.isBefore(e)?n=f6(t,e):(n=f6(e,t),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function p6(t,e){return function(n,r){var i,o;return r!==null&&!isNaN(+r)&&(zV(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),o=n,n=r,r=o),i=dh(n,r),m6(this,i,t),this}}function m6(t,e,n,r){var i=e._milliseconds,o=DP(e._days),s=DP(e._months);t.isValid()&&(r=r??!0,s&&KV(t,x1(t,"Month")+s*n),o&&YV(t,"Date",x1(t,"Date")+o*n),i&&t._d.setTime(t._d.valueOf()+i*n),r&&Xt.updateOffset(t,o||s))}var Ife=p6(1,"add"),Lfe=p6(-1,"subtract");function g6(t){return typeof t=="string"||t instanceof String}function Pfe(t){return uh(t)||y1(t)||g6(t)||ff(t)||Ofe(t)||Nfe(t)||t===null||t===void 0}function Nfe(t){var e=Cg(t)&&!hP(t),n=!1,r=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],i,o,s=r.length;for(i=0;in.valueOf():n.valueOf()9999?nC(n,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):id(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",nC(n,"Z")):nC(n,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Yfe(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t="moment",e="",n,r,i,o;return this.isLocal()||(t=this.utcOffset()===0?"moment.utc":"moment.parseZone",e="Z"),n="["+t+'("]',r=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i="-MM-DD[T]HH:mm:ss.SSS",o=e+'[")]',this.format(n+r+i+o)}function Zfe(t){t||(t=this.isUtc()?Xt.defaultFormatUtc:Xt.defaultFormat);var e=nC(this,t);return this.localeData().postformat(e)}function Xfe(t,e){return this.isValid()&&(uh(t)&&t.isValid()||vo(t).isValid())?dh({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function Kfe(t){return this.from(vo(),t)}function Jfe(t,e){return this.isValid()&&(uh(t)&&t.isValid()||vo(t).isValid())?dh({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function Qfe(t){return this.to(vo(),t)}function y6(t){var e;return t===void 0?this._locale._abbr:(e=vf(t),e!=null&&(this._locale=e),this)}var v6=_u("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return t===void 0?this.localeData():this.locale(t)});function _6(){return this._locale}var gC=1e3,f0=60*gC,yC=60*f0,b6=(365*400+97)*24*yC;function p0(t,e){return(t%e+e)%e}function w6(t,e,n){return t<100&&t>=0?new Date(t+400,e,n)-b6:new Date(t,e,n).valueOf()}function x6(t,e,n){return t<100&&t>=0?Date.UTC(t+400,e,n)-b6:Date.UTC(t,e,n)}function epe(t){var e,n;if(t=bu(t),t===void 0||t==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?x6:w6,t){case"year":e=n(this.year(),0,1);break;case"quarter":e=n(this.year(),this.month()-this.month()%3,1);break;case"month":e=n(this.year(),this.month(),1);break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":e=n(this.year(),this.month(),this.date());break;case"hour":e=this._d.valueOf(),e-=p0(e+(this._isUTC?0:this.utcOffset()*f0),yC);break;case"minute":e=this._d.valueOf(),e-=p0(e,f0);break;case"second":e=this._d.valueOf(),e-=p0(e,gC);break}return this._d.setTime(e),Xt.updateOffset(this,!0),this}function tpe(t){var e,n;if(t=bu(t),t===void 0||t==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?x6:w6,t){case"year":e=n(this.year()+1,0,1)-1;break;case"quarter":e=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":e=n(this.year(),this.month()+1,1)-1;break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":e=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":e=this._d.valueOf(),e+=yC-p0(e+(this._isUTC?0:this.utcOffset()*f0),yC)-1;break;case"minute":e=this._d.valueOf(),e+=f0-p0(e,f0)-1;break;case"second":e=this._d.valueOf(),e+=gC-p0(e,gC)-1;break}return this._d.setTime(e),Xt.updateOffset(this,!0),this}function npe(){return this._d.valueOf()-(this._offset||0)*6e4}function rpe(){return Math.floor(this.valueOf()/1e3)}function ipe(){return new Date(this.valueOf())}function ope(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]}function spe(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}}function ape(){return this.isValid()?this.toISOString():null}function lpe(){return fP(this)}function cpe(){return Pp({},yr(this))}function upe(){return yr(this).overflow}function hpe(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}Nn("N",0,0,"eraAbbr"),Nn("NN",0,0,"eraAbbr"),Nn("NNN",0,0,"eraAbbr"),Nn("NNNN",0,0,"eraName"),Nn("NNNNN",0,0,"eraNarrow"),Nn("y",["y",1],"yo","eraYear"),Nn("y",["yy",2],0,"eraYear"),Nn("y",["yyy",3],0,"eraYear"),Nn("y",["yyyy",4],0,"eraYear"),dn("N",$P),dn("NN",$P),dn("NNN",$P),dn("NNNN",xpe),dn("NNNNN",Epe),Ui(["N","NN","NNN","NNNN","NNNNN"],function(t,e,n,r){var i=n._locale.erasParse(t,r,n._strict);i?yr(n).era=i:yr(n).invalidEra=t}),dn("y",c0),dn("yy",c0),dn("yyy",c0),dn("yyyy",c0),dn("yo",Spe),Ui(["y","yy","yyy","yyyy"],Ya),Ui(["yo"],function(t,e,n,r){var i;n._locale._eraYearOrdinalRegex&&(i=t.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?e[Ya]=n._locale.eraYearOrdinalParse(t,i):e[Ya]=parseInt(t,10)});function dpe(t,e){var n,r,i,o=this._eras||vf("en")._eras;for(n=0,r=o.length;n=0)return o[r]}function ppe(t,e){var n=t.since<=t.until?1:-1;return e===void 0?Xt(t.since).year():Xt(t.since).year()+(e-t.offset)*n}function mpe(){var t,e,n,r=this.localeData().eras();for(t=0,e=r.length;to&&(e=o),Lpe.call(this,t,e,n,r,i))}function Lpe(t,e,n,r,i){var o=e6(t,e,n,r,i),s=E1(o.year,0,o.dayOfYear);return this.year(s.getUTCFullYear()),this.month(s.getUTCMonth()),this.date(s.getUTCDate()),this}Nn("Q",0,"Qo","quarter"),dn("Q",UV),Ui("Q",function(t,e){e[mf]=(oi(t)-1)*3});function Ppe(t){return t==null?Math.ceil((this.month()+1)/3):this.month((t-1)*3+this.month()%3)}Nn("D",["DD",2],"Do","date"),dn("D",yo,u0),dn("DD",yo,Nc),dn("Do",function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient}),Ui(["D","DD"],sd),Ui("Do",function(t,e){e[sd]=oi(t.match(yo)[0])});var S6=h0("Date",!0);Nn("DDD",["DDDD",3],"DDDo","dayOfYear"),dn("DDD",iC),dn("DDDD",HV),Ui(["DDD","DDDD"],function(t,e,n){n._dayOfYear=oi(t)});function Npe(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return t==null?e:this.add(t-e,"d")}Nn("m",["mm",2],0,"minute"),dn("m",yo,SP),dn("mm",yo,Nc),Ui(["m","mm"],hh);var Ope=h0("Minutes",!1);Nn("s",["ss",2],0,"second"),dn("s",yo,SP),dn("ss",yo,Nc),Ui(["s","ss"],gf);var Dpe=h0("Seconds",!1);Nn("S",0,0,function(){return~~(this.millisecond()/100)}),Nn(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),Nn(0,["SSS",3],0,"millisecond"),Nn(0,["SSSS",4],0,function(){return this.millisecond()*10}),Nn(0,["SSSSS",5],0,function(){return this.millisecond()*100}),Nn(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),Nn(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),Nn(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),Nn(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),dn("S",iC,UV),dn("SS",iC,Nc),dn("SSS",iC,HV);var Op,C6;for(Op="SSSS";Op.length<=9;Op+="S")dn(Op,c0);function Rpe(t,e){e[kg]=oi(("0."+t)*1e3)}for(Op="S";Op.length<=9;Op+="S")Ui(Op,Rpe);C6=h0("Milliseconds",!1),Nn("z",0,0,"zoneAbbr"),Nn("zz",0,0,"zoneName");function Bpe(){return this._isUTC?"UTC":""}function Fpe(){return this._isUTC?"Coordinated Universal Time":""}var zt=v1.prototype;zt.add=Ife,zt.calendar=Bfe,zt.clone=Ffe,zt.diff=Wfe,zt.endOf=tpe,zt.format=Zfe,zt.from=Xfe,zt.fromNow=Kfe,zt.to=Jfe,zt.toNow=Qfe,zt.get=Yhe,zt.invalidAt=upe,zt.isAfter=$fe,zt.isBefore=zfe,zt.isBetween=Vfe,zt.isSame=jfe,zt.isSameOrAfter=Ufe,zt.isSameOrBefore=Hfe,zt.isValid=lpe,zt.lang=v6,zt.locale=y6,zt.localeData=_6,zt.max=lfe,zt.min=afe,zt.parsingFlags=cpe,zt.set=Zhe,zt.startOf=epe,zt.subtract=Lfe,zt.toArray=ope,zt.toObject=spe,zt.toDate=ipe,zt.toISOString=qfe,zt.inspect=Yfe,typeof Symbol<"u"&&Symbol.for!=null&&(zt[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),zt.toJSON=ape,zt.toString=Gfe,zt.unix=rpe,zt.valueOf=npe,zt.creationData=hpe,zt.eraName=mpe,zt.eraNarrow=gpe,zt.eraAbbr=ype,zt.eraYear=vpe,zt.year=qV,zt.isLeapYear=qhe,zt.weekYear=Cpe,zt.isoWeekYear=kpe,zt.quarter=zt.quarters=Ppe,zt.month=JV,zt.daysInMonth=ide,zt.week=zt.weeks=dde,zt.isoWeek=zt.isoWeeks=fde,zt.weeksInYear=Ape,zt.weeksInWeekYear=Ipe,zt.isoWeeksInYear=Tpe,zt.isoWeeksInISOWeekYear=Mpe,zt.date=S6,zt.day=zt.days=kde,zt.weekday=Tde,zt.isoWeekday=Mde,zt.dayOfYear=Npe,zt.hour=zt.hours=Dde,zt.minute=zt.minutes=Ope,zt.second=zt.seconds=Dpe,zt.millisecond=zt.milliseconds=C6,zt.utcOffset=yfe,zt.utc=_fe,zt.local=bfe,zt.parseZone=wfe,zt.hasAlignedHourOffset=xfe,zt.isDST=Efe,zt.isLocal=Cfe,zt.isUtcOffset=kfe,zt.isUtc=d6,zt.isUTC=d6,zt.zoneAbbr=Bpe,zt.zoneName=Fpe,zt.dates=_u("dates accessor is deprecated. Use date instead.",S6),zt.months=_u("months accessor is deprecated. Use month instead",JV),zt.years=_u("years accessor is deprecated. Use year instead",qV),zt.zone=_u("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",vfe),zt.isDSTShifted=_u("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Sfe);function $pe(t){return vo(t*1e3)}function zpe(){return vo.apply(null,arguments).parseZone()}function k6(t){return t}var ki=yP.prototype;ki.calendar=Che,ki.longDateFormat=Ahe,ki.invalidDate=Lhe,ki.ordinal=Ohe,ki.preparse=k6,ki.postformat=k6,ki.relativeTime=Rhe,ki.pastFuture=Bhe,ki.set=Ehe,ki.eras=dpe,ki.erasParse=fpe,ki.erasConvertYear=ppe,ki.erasAbbrRegex=bpe,ki.erasNameRegex=_pe,ki.erasNarrowRegex=wpe,ki.months=ede,ki.monthsShort=tde,ki.monthsParse=rde,ki.monthsRegex=sde,ki.monthsShortRegex=ode,ki.week=lde,ki.firstDayOfYear=hde,ki.firstDayOfWeek=ude,ki.weekdays=wde,ki.weekdaysMin=Ede,ki.weekdaysShort=xde,ki.weekdaysParse=Cde,ki.weekdaysRegex=Ade,ki.weekdaysShortRegex=Ide,ki.weekdaysMinRegex=Lde,ki.isPM=Nde,ki.meridiem=Rde;function _C(t,e,n,r){var i=vf(),o=rd().set(r,e);return i[n](o,t)}function T6(t,e,n){if(ff(t)&&(e=t,t=void 0),t=t||"",e!=null)return _C(t,e,n,"month");var r,i=[];for(r=0;r<12;r++)i[r]=_C(t,r,n,"month");return i}function VP(t,e,n,r){typeof t=="boolean"?(ff(e)&&(n=e,e=void 0),e=e||""):(e=t,n=e,t=!1,ff(e)&&(n=e,e=void 0),e=e||"");var i=vf(),o=t?i._week.dow:0,s,a=[];if(n!=null)return _C(e,(n+o)%7,r,"day");for(s=0;s<7;s++)a[s]=_C(e,(s+o)%7,r,"day");return a}function Vpe(t,e){return T6(t,e,"months")}function jpe(t,e){return T6(t,e,"monthsShort")}function Upe(t,e,n){return VP(t,e,n,"weekdays")}function Hpe(t,e,n){return VP(t,e,n,"weekdaysShort")}function Wpe(t,e,n){return VP(t,e,n,"weekdaysMin")}Np("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10,n=oi(t%100/10)===1?"th":e===1?"st":e===2?"nd":e===3?"rd":"th";return t+n}}),Xt.lang=_u("moment.lang is deprecated. Use moment.locale instead.",Np),Xt.langData=_u("moment.langData is deprecated. Use moment.localeData instead.",vf);var _f=Math.abs;function Gpe(){var t=this._data;return this._milliseconds=_f(this._milliseconds),this._days=_f(this._days),this._months=_f(this._months),t.milliseconds=_f(t.milliseconds),t.seconds=_f(t.seconds),t.minutes=_f(t.minutes),t.hours=_f(t.hours),t.months=_f(t.months),t.years=_f(t.years),this}function M6(t,e,n,r){var i=dh(e,n);return t._milliseconds+=r*i._milliseconds,t._days+=r*i._days,t._months+=r*i._months,t._bubble()}function qpe(t,e){return M6(this,t,e,1)}function Ype(t,e){return M6(this,t,e,-1)}function A6(t){return t<0?Math.floor(t):Math.ceil(t)}function Zpe(){var t=this._milliseconds,e=this._days,n=this._months,r=this._data,i,o,s,a,l;return t>=0&&e>=0&&n>=0||t<=0&&e<=0&&n<=0||(t+=A6(jP(n)+e)*864e5,e=0,n=0),r.milliseconds=t%1e3,i=wu(t/1e3),r.seconds=i%60,o=wu(i/60),r.minutes=o%60,s=wu(o/60),r.hours=s%24,e+=wu(s/24),l=wu(I6(e)),n+=l,e-=A6(jP(l)),a=wu(n/12),n%=12,r.days=e,r.months=n,r.years=a,this}function I6(t){return t*4800/146097}function jP(t){return t*146097/4800}function Xpe(t){if(!this.isValid())return NaN;var e,n,r=this._milliseconds;if(t=bu(t),t==="month"||t==="quarter"||t==="year")switch(e=this._days+r/864e5,n=this._months+I6(e),t){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(e=this._days+Math.round(jP(this._months)),t){case"week":return e/7+r/6048e5;case"day":return e+r/864e5;case"hour":return e*24+r/36e5;case"minute":return e*1440+r/6e4;case"second":return e*86400+r/1e3;case"millisecond":return Math.floor(e*864e5)+r;default:throw new Error("Unknown unit "+t)}}function bf(t){return function(){return this.as(t)}}var L6=bf("ms"),Kpe=bf("s"),Jpe=bf("m"),Qpe=bf("h"),eme=bf("d"),tme=bf("w"),nme=bf("M"),rme=bf("Q"),ime=bf("y"),ome=L6;function sme(){return dh(this)}function ame(t){return t=bu(t),this.isValid()?this[t+"s"]():NaN}function Mg(t){return function(){return this.isValid()?this._data[t]:NaN}}var lme=Mg("milliseconds"),cme=Mg("seconds"),ume=Mg("minutes"),hme=Mg("hours"),dme=Mg("days"),fme=Mg("months"),pme=Mg("years");function mme(){return wu(this.days()/7)}var wf=Math.round,m0={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function gme(t,e,n,r,i){return i.relativeTime(e||1,!!n,t,r)}function yme(t,e,n,r){var i=dh(t).abs(),o=wf(i.as("s")),s=wf(i.as("m")),a=wf(i.as("h")),l=wf(i.as("d")),c=wf(i.as("M")),u=wf(i.as("w")),d=wf(i.as("y")),p=o<=n.ss&&["s",o]||o0,p[4]=r,gme.apply(null,p)}function vme(t){return t===void 0?wf:typeof t=="function"?(wf=t,!0):!1}function _me(t,e){return m0[t]===void 0?!1:e===void 0?m0[t]:(m0[t]=e,t==="s"&&(m0.ss=e-1),!0)}function bme(t,e){if(!this.isValid())return this.localeData().invalidDate();var n=!1,r=m0,i,o;return typeof t=="object"&&(e=t,t=!1),typeof t=="boolean"&&(n=t),typeof e=="object"&&(r=Object.assign({},m0,e),e.s!=null&&e.ss==null&&(r.ss=e.s-1)),i=this.localeData(),o=yme(this,!n,r,i),n&&(o=i.pastFuture(+this,o)),i.postformat(o)}var UP=Math.abs;function g0(t){return(t>0)-(t<0)||+t}function bC(){if(!this.isValid())return this.localeData().invalidDate();var t=UP(this._milliseconds)/1e3,e=UP(this._days),n=UP(this._months),r,i,o,s,a=this.asSeconds(),l,c,u,d;return a?(r=wu(t/60),i=wu(r/60),t%=60,r%=60,o=wu(n/12),n%=12,s=t?t.toFixed(3).replace(/\.?0+$/,""):"",l=a<0?"-":"",c=g0(this._months)!==g0(a)?"-":"",u=g0(this._days)!==g0(a)?"-":"",d=g0(this._milliseconds)!==g0(a)?"-":"",l+"P"+(o?c+o+"Y":"")+(n?c+n+"M":"")+(e?u+e+"D":"")+(i||r||t?"T":"")+(i?d+i+"H":"")+(r?d+r+"M":"")+(t?d+s+"S":"")):"P0D"}var fi=fC.prototype;fi.isValid=ffe,fi.abs=Gpe,fi.add=qpe,fi.subtract=Ype,fi.as=Xpe,fi.asMilliseconds=L6,fi.asSeconds=Kpe,fi.asMinutes=Jpe,fi.asHours=Qpe,fi.asDays=eme,fi.asWeeks=tme,fi.asMonths=nme,fi.asQuarters=rme,fi.asYears=ime,fi.valueOf=ome,fi._bubble=Zpe,fi.clone=sme,fi.get=ame,fi.milliseconds=lme,fi.seconds=cme,fi.minutes=ume,fi.hours=hme,fi.days=dme,fi.weeks=mme,fi.months=fme,fi.years=pme,fi.humanize=bme,fi.toISOString=bC,fi.toString=bC,fi.toJSON=bC,fi.locale=y6,fi.localeData=_6,fi.toIsoString=_u("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",bC),fi.lang=v6,Nn("X",0,0,"unix"),Nn("x",0,0,"valueOf"),dn("x",sC),dn("X",Vhe),Ui("X",function(t,e,n){n._d=new Date(parseFloat(t)*1e3)}),Ui("x",function(t,e,n){n._d=new Date(oi(t))});//! moment.js Xt.version="2.30.1",whe(vo),Xt.fn=zt,Xt.min=cfe,Xt.max=ufe,Xt.now=hfe,Xt.utc=rd,Xt.unix=$pe,Xt.months=Vpe,Xt.isDate=y1,Xt.locale=Np,Xt.invalid=eC,Xt.duration=dh,Xt.isMoment=uh,Xt.weekdays=Upe,Xt.parseZone=zpe,Xt.localeData=vf,Xt.isDuration=pC,Xt.monthsShort=jpe,Xt.weekdaysMin=Wpe,Xt.defineLocale=IP,Xt.updateLocale=zde,Xt.locales=Vde,Xt.weekdaysShort=Hpe,Xt.normalizeUnits=bu,Xt.relativeTimeRounding=vme,Xt.relativeTimeThreshold=_me,Xt.calendarFormat=Rfe,Xt.prototype=zt,Xt.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const wme={props:{modelValue:{type:String,default:()=>""}},data(){return{date:{day:new Date().getDate(),month:new Date().getMonth(),year:new Date().getFullYear()},selectedDate:null}},computed:{daysInMonth(){return this.getDaysMonth(this.date)},monthName(){const{day:t,month:e,year:n}=this.date;return new Date(n,e,t).toLocaleDateString("uk-UA",{month:"long"})}},created(){if(this.modelValue){const t=Xt(this.modelValue,"YYYY-MM-DD").toDate();this.setDate(t),this.selectedDate=this.date}},methods:{selectDay(t){this.selectedDate={...this.date,day:t};const e=Xt(this.createTemporaryDate(this.selectedDate)).format("YYYY-MM-DD");this.$emit("update:modelValue",e),this.$emit("selectDateInCalendar")},getDaysMonth({year:t,month:e}={}){return 32-new Date(t,e,32).getDate()},changeMonth(t){const e=t==="next"?1:-1,n=this.createTemporaryDate(this.date);n.setMonth(n.getMonth()+e),this.setDate(new Date(n))},changeYear(t){const e=this.createTemporaryDate(this.date),n=t==="next"?1:-1;e.setFullYear(e.getFullYear()+n),this.setDate(new Date(e))},createTemporaryDate({day:t,month:e,year:n}={}){return new Date(n,e,t)},setDate(t){this.date={day:t.getDate(),month:t.getMonth(),year:t.getFullYear()}},isDateEqualCurrent(t){var i,o,s;const e=this.date.month===((i=this.selectedDate)==null?void 0:i.month),n=this.date.year===((o=this.selectedDate)==null?void 0:o.year);return((s=this.selectedDate)==null?void 0:s.day)===t&&e&&n},isDateEqualToday(t){const e=new Date,n=this.date.year===e.getFullYear(),r=this.date.month===e.getMonth(),i=t===e.getDate();return n&&r&&i},daysToFirst(t){const e=["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"],n=t==="last"?1:this.daysInMonth,r=this.createTemporaryDate({...this.date,day:n}),i=e.indexOf(e[r.getDay()]);return t==="next"?[...e].slice(i,e.length).length:[...e].slice(0,i-1).length}},watch:{modelValue(t){if(!t)this.selectedDate=null;else{const e=Xt(this.modelValue,"YYYY-MM-DD").toDate();this.setDate(e),this.selectedDate=this.date}}}},xme={class:"w-fit",style:{"max-width":"300px"}},Eme={class:"grid grid-cols-5 items-center gap-x-3 mx-1.5 pb-3"},Sme={class:"col-span-1 flex justify-start"},Cme={class:"col-span-3 flex justify-center items-center gap-x-1 text-gray-600"},kme={class:"col-span-1 flex justify-end"},Tme={class:"flex pb-1.5 border-b"},Mme={class:"flex flex-wrap"},Ame=["onClick","data-testid"];function Ime(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",xme,[g.createElementVNode("div",Eme,[g.createElementVNode("div",Sme,[g.createElementVNode("button",{type:"button",class:"w-8 h-8 flex justify-center items-center text-gray-600 hover:bg-gray-100 rounded-full disabled:opacity-50 disabled:pointer-events-none",onClick:e[0]||(e[0]=s=>o.changeYear("prev"))},e[4]||(e[4]=[g.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[g.createElementVNode("path",{d:"m15 18-6-6 6-6"}),g.createElementVNode("path",{d:"m9 18-6-6 6-6"})],-1)])),g.createElementVNode("button",{type:"button",class:"w-8 h-8 flex justify-center items-center text-gray-600 hover:bg-gray-100 rounded-full disabled:opacity-50 disabled:pointer-events-none",onClick:e[1]||(e[1]=s=>o.changeMonth("prev"))},e[5]||(e[5]=[g.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[g.createElementVNode("path",{d:"m15 18-6-6 6-6"})],-1)]))]),g.createElementVNode("div",Cme,[g.createElementVNode("div",null,g.toDisplayString(t.date.year),1),e[6]||(e[6]=g.createElementVNode("span",null,"/",-1)),g.createElementVNode("div",null,g.toDisplayString(o.monthName),1)]),g.createElementVNode("div",kme,[g.createElementVNode("button",{type:"button",class:"w-8 h-8 flex justify-center items-center text-gray-600 hover:bg-gray-100 rounded-full disabled:opacity-50 disabled:pointer-events-none",onClick:e[2]||(e[2]=s=>o.changeMonth("next"))},e[7]||(e[7]=[g.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[g.createElementVNode("path",{d:"m9 18 6-6-6-6"})],-1)])),g.createElementVNode("button",{type:"button",class:"w-8 h-8 flex justify-center items-center text-gray-600 hover:bg-gray-100 rounded-full disabled:opacity-50 disabled:pointer-events-none",onClick:e[3]||(e[3]=s=>o.changeYear("next"))},e[8]||(e[8]=[g.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[g.createElementVNode("path",{d:"m9 18 6-6-6-6"}),g.createElementVNode("path",{d:"m15 18 6-6-6-6"})],-1)]))])]),g.createElementVNode("div",Tme,[(g.openBlock(),g.createElementBlock(g.Fragment,null,g.renderList(["Пн","Вт","Ср","Чт","Пт","Сб","Нд"],s=>g.createElementVNode("span",{class:"m-px w-10 block text-center text-xs text-gray-600",key:s},g.toDisplayString(s),1)),64))]),g.createElementVNode("div",Mme,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(o.daysToFirst("last"),(s,a)=>(g.openBlock(),g.createElementBlock("button",{type:"button",key:a,class:"m-px w-10 h-10 flex justify-center items-center border border-transparent text-sm text-gray-600 hover:border-blue-600 hover:text-blue-600 rounded-full disabled:text-gray-300 disabled:pointer-events-none",disabled:""},g.toDisplayString(o.getDaysMonth({...t.date,month:t.date.month-1})-o.daysToFirst("last")+(a+1)),1))),128)),(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(o.daysInMonth,s=>(g.openBlock(),g.createElementBlock("button",{key:s,onClick:a=>o.selectDay(s),type:"button","data-testid":o.isDateEqualCurrent(s)?"active-day":"",class:g.normalizeClass(["m-px w-10 h-10 transition-all flex justify-center items-center border border-transparent text-sm hover:border-blue-600 hover:text-blue-600 rounded-full disabled:text-gray-300 disabled:pointer-events-none",[o.isDateEqualCurrent(s)?"bg-blue-500 !text-white hover:text-white":"",o.isDateEqualToday(s)?"text-blue-600":"text-gray-600"]])},g.toDisplayString(s),11,Ame))),128)),(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(o.daysToFirst("next"),(s,a)=>(g.openBlock(),g.createElementBlock("button",{type:"button",key:a,class:"m-px w-10 h-10 flex justify-center items-center border border-transparent text-sm text-gray-600 hover:border-blue-600 hover:text-blue-600 rounded-full disabled:text-gray-300 disabled:pointer-events-none",disabled:""},g.toDisplayString(s),1))),128))]),e[9]||(e[9]=g.createElementVNode("div",{class:"flex"},null,-1))])}const HP=xt(wme,[["render",Ime]]),Lme={class:"text-center"},Pme={class:"py-2 px-4 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},Dp={__name:"vs-popover",props:{isOpen:{type:Boolean,default:()=>!1},placement:{type:String,default:"top"},gap:{type:Number,default:8},width:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},trigger:{type:String,default:"click"},teleport:{type:String,default:"#modal"}},emits:["isvisible"],setup(t,{expose:e,emit:n}){const r=t,i=n,o=g.ref(!1),s=g.ref([]),a=g.ref(null),l=g.ref(null),c=g.ref(null);g.watch(o,M=>{M?(u(),window.addEventListener("resize",()=>Lc(r.placement,l.value,c.value)),Lc(r.placement,l.value,c.value)):window.removeEventListener("resize",()=>Lc(r.placement,l.value,c.value)),i("isvisible",M)}),g.onMounted(()=>{window.addEventListener("click",x),window.addEventListener("popstate",C),window.addEventListener("scroll",S,!0),u()}),g.onBeforeUnmount(()=>{window.removeEventListener("click",x),window.removeEventListener("popstate",C),d()});const u=()=>{let M=a.value;for(;M&&M!==document.body;)(M.scrollHeight>M.clientHeight||M.scrollWidth>M.clientWidth)&&(M.addEventListener("scroll",w),s.value.push(M)),M=M.parentElement;document.body&&(document.body.addEventListener("scroll",w),s.value.push(document.body))},d=()=>{s.value.forEach(M=>{M.removeEventListener("scroll",w)}),s.value=[]},p=()=>{o.value=!0,Lc(r.placement,l.value,c.value)},m=()=>{o.value=!1},y=async()=>{await Lc(r.placement,l.value,c.value),o.value=!o.value},w=()=>{o.value=!1},x=M=>{var E,A;if(!M){o.value=!1;return}(E=l.value)!=null&&E.contains(M.target)||(A=c.value)!=null&&A.contains(M.target)||(o.value=!1)},C=()=>{o.value&&(o.value=!1)},S=M=>{o.value&&c.value&&!c.value.contains(M.target)&&(o.value=!1)};return e({togglePopover:y}),(M,E)=>(g.openBlock(),g.createElementBlock("div",{ref_key:"popover",ref:a,class:"vs-popover inline-block"},[g.createElementVNode("div",Lme,[t.trigger==="click"?(g.openBlock(),g.createElementBlock("div",{key:0,ref_key:"popoverRef",ref:l,onClick:y,class:g.normalizeClass({"pointer-events-none":t.disabled})},[g.renderSlot(M.$slots,"reference",{},()=>[E[0]||(E[0]=g.createElementVNode("button",null,"Click me!",-1))])],2)):g.createCommentVNode("",!0),t.trigger==="hover"?(g.openBlock(),g.createElementBlock("div",{key:1,ref_key:"popoverRef",ref:l,onMouseover:p,onMouseleave:m,class:g.normalizeClass({"pointer-events-none":t.disabled})},[g.renderSlot(M.$slots,"reference",{},()=>[E[1]||(E[1]=g.createElementVNode("button",null,"Click me!",-1))])],34)):g.createCommentVNode("",!0),(g.openBlock(),g.createBlock(g.Teleport,{to:t.teleport},[g.createVNode(g.Transition,{name:"fade"},{default:g.withCtx(()=>[g.withDirectives(g.createElementVNode("div",{class:g.normalizeClass(["vsTailwind vs-popover__content",t.placement]),ref_key:"contentPop",ref:c,style:g.normalizeStyle({width:t.width?t.width+"px":"fit-content",zIndex:10002})},[g.createElementVNode("div",Pme,[g.renderSlot(M.$slots,"default",{},()=>[E[2]||(E[2]=g.createElementVNode("span",null,"Popover content",-1))])])],6),[[g.vShow,o.value]])]),_:3})],8,["to"]))])],512))}},y0=(t="")=>`${t}${Math.floor(Math.random()*1e4)}`,Nme=["id"],Ome={__name:"vs-date-text",props:g.mergeModels({time:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const e=t,n=g.useModel(t,"modelValue"),r=y0("input-date-");return g.onMounted(()=>{const i=document.getElementById(r),o=e.time?{mask:Date,pattern:"d-`m-`Y H:MM",blocks:{d:{mask:Rn.MaskedRange,from:1,to:31,maxLength:2},m:{mask:Rn.MaskedRange,from:1,to:12,maxLength:2},Y:{mask:Rn.MaskedRange,from:1,to:3e3},H:{mask:Rn.MaskedRange,from:0,to:23,maxLength:2},MM:{mask:Rn.MaskedRange,from:0,to:59,maxLength:2}},format(s){const a=s.getDate().toString().padStart(2,"0"),l=(s.getMonth()+1).toString().padStart(2,"0"),c=s.getFullYear(),u=s.getHours().toString().padStart(2,"0"),d=s.getMinutes().toString().padStart(2,"0");return`${a}-${l}-${c} ${u}:${d}`},parse(s){const[a,l="00:00"]=s.split(" "),[c,u,d]=a.split("-"),[p,m]=l.split(":");return new Date(d,u-1,c,p,m)}}:{mask:Date,pattern:"d-`m-`Y",blocks:{d:{mask:Rn.MaskedRange,from:1,to:31,maxLength:2},m:{mask:Rn.MaskedRange,from:1,to:12,maxLength:2},Y:{mask:Rn.MaskedRange,from:1,to:3e3}},format(s){const a=s.getDate().toString().padStart(2,"0"),l=(s.getMonth()+1).toString().padStart(2,"0"),c=s.getFullYear();return`${a}-${l}-${c}`},parse(s){const[a,l,c]=s.split("-");return new Date(c,l-1,a)}};Rn(i,o)}),(i,o)=>g.withDirectives((g.openBlock(),g.createElementBlock("input",{id:g.unref(r),"onUpdate:modelValue":o[0]||(o[0]=s=>n.value=s),class:"py-2 px-3 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg text-sm text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,Nme)),[[g.vModelText,n.value]])}},An=g.ref({geom:{}}),Dme={class:"flex item-center gap-2"},Rme={class:"relative"},Bme=["disabled"],Fme={key:0,class:"gap-1 text-nowrap items-center flex text-sm font-medium text-gray-700 justify-start text-start"},P6=g.defineComponent({__name:"vs-datepicker",props:{modelValue:{type:String,default:null},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},now:{type:Boolean,default:!1},placeholder:{type:String,default:t=>t!=null&&t.time?"__-__-_____ __:__":"__-__-_____"},editable:{type:Boolean,default:()=>{var t,e;return((e=(t=An.value)==null?void 0:t.datepicker)==null?void 0:e.editable)||!0}},time:{type:Boolean,default:!1},isInfinity:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=g.ref(!1),i=e,o=g.ref(),s=g.ref(n.modelValue?new Date(n.modelValue):n.now?new Date:null),a=g.ref(""),l=g.computed(()=>{if(!s.value)return"";const x=String(s.value.getDate()).padStart(2,"0"),C=String(s.value.getMonth()+1).padStart(2,"0"),S=s.value.getFullYear();if(n.time){const M=String(s.value.getHours()).padStart(2,"0"),E=String(s.value.getMinutes()).padStart(2,"0");return`${x}-${C}-${S} ${M}:${E}`}return`${x}-${C}-${S}`}),c=g.computed({get(){return s.value?`${s.value.getFullYear()}-${String(s.value.getMonth()+1).padStart(2,"0")}-${String(s.value.getDate()).padStart(2,"0")}`:""},set(x){var S,M;const C=new Date(x);if(n.time){const E=((S=s.value)==null?void 0:S.getHours())||0,A=((M=s.value)==null?void 0:M.getMinutes())||0;C.setHours(E,A)}else C.setHours(0,0,0,0);s.value=C}});function u(){s.value=null}function d(){var x;n.time||(x=o.value)==null||x.togglePopover()}function p(){var z,$;let x=($=(z=a.value)==null?void 0:z.trim())==null?void 0:$.replaceAll("_","");const C=n.time?/^(\d{2})-(\d{2})-(\d{4})(?:\s+(\d{2}):(\d{2}))?$/:/^(\d{2})-(\d{2})-(\d{4})$/,S=x.match(C);if(!S){a.value=l.value;return}let[,M,E,A,I,O]=S;n.time?(I=I||"00",O=O||"00",s.value=new Date(Number(A),Number(E)-1,Number(M),Number(I),Number(O))):s.value=new Date(Number(A),Number(E)-1,Number(M)),a.value=l.value}const m=g.computed(()=>s.value?s.value.toLocaleString("uk-UA",{dateStyle:"long",timeStyle:n.time?"short":void 0}):n.placeholder);function y(x){const C=x.getFullYear(),S=String(x.getMonth()+1).padStart(2,"0"),M=String(x.getDate()).padStart(2,"0"),E=String(x.getHours()).padStart(2,"0"),A=String(x.getMinutes()).padStart(2,"0");return`${C}-${S}-${M}T${E}:${A}`}const w=({key:x})=>x==="Escape"&&document.body.click();return g.watch(()=>n.modelValue,x=>{s.value=x?new Date(x):null,a.value=l.value},{immediate:!0}),g.watch(s,x=>{i("update:modelValue",x?y(x):null)}),g.watch(()=>n.now,x=>{x&&!s.value&&(s.value=new Date)},{immediate:!0}),g.watch(r,x=>{i("update:modelValue",null)}),g.onMounted(()=>{addEventListener("keydown",w)}),g.onUnmounted(()=>{removeEventListener("keydown",w)}),(x,C)=>(g.openBlock(),g.createElementBlock("div",Dme,[g.createVNode(Dp,{placement:"bottom-start",ref_key:"popover",ref:o,class:g.normalizeClass(["w-full",{"cursor-not-allowed":t.disabled||r.value}]),disabled:t.disabled||r.value},{reference:g.withCtx(()=>[g.createElementVNode("div",Rme,[t.editable?(g.openBlock(),g.createElementBlock(g.Fragment,{key:0},[g.createVNode(Ome,{modelValue:a.value,"onUpdate:modelValue":C[2]||(C[2]=S=>a.value=S),time:t.time,onBlur:p,onKeydown:g.withKeys(p,["enter"]),placeholder:t.placeholder},null,8,["modelValue","time","placeholder"]),t.clearable&&s.value?(g.openBlock(),g.createBlock(Fa,{key:0,class:"absolute bottom-2/4 text-gray-500 translate-y-2/4 right-4 w-[15px] hover:text-red-500",onClick:g.withModifiers(u,["stop"])})):g.createCommentVNode("",!0)],64)):(g.openBlock(),g.createElementBlock("button",{key:1,type:"button",disabled:t.disabled||r.value,class:"vs-datepicker__button disabled:opacity-50 disabled:pointer-events-none relative py-2 px-4 pe-9 flex text-nowrap w-full cursor-pointer bg-white border border-stone-200 rounded-lg text-start text-sm text-stone-800 focus:outline-none focus:ring-2 focus:ring-blue-600 dark:bg-neutral-800 dark:border-blue-700 dark:text-neutral-200 dark:focus:outline-none dark:focus:ring-1 dark:focus:ring-blue-600"},[g.createElementVNode("div",{class:g.normalizeClass({"text-gray-400":!s.value})},g.toDisplayString(s.value?m.value:t.placeholder),3),t.clearable&&s.value?(g.openBlock(),g.createBlock(Fa,{key:0,class:"absolute bottom-2/4 text-gray-500 translate-y-2/4 right-8 w-[15px] hover:text-red-500",onClick:g.withModifiers(u,["stop"])})):g.createCommentVNode("",!0),C[4]||(C[4]=g.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-chevron-down stroke-gray-500 absolute right-3 translate-y-2/4 bottom-1/2",width:"15px",height:"15px",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g.createElementVNode("path",{d:"M6 9l6 6l6 -6"})],-1))],8,Bme))])]),default:g.withCtx(()=>[g.createElementVNode("div",{class:"px-2",onClick:C[1]||(C[1]=g.withModifiers(()=>{},["stop"]))},[g.createVNode(HP,{onSelectDateInCalendar:d,modelValue:c.value,"onUpdate:modelValue":C[0]||(C[0]=S=>c.value=S),class:"vs-datepicker__calendar"},null,8,["modelValue"])])]),_:1},8,["disabled","class"]),t.isInfinity?(g.openBlock(),g.createElementBlock("label",Fme,[g.withDirectives(g.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":C[3]||(C[3]=S=>r.value=S),class:"hidden"},null,512),[[g.vModelCheckbox,r.value]]),g.createElementVNode("div",{class:g.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[r.value?"bg-blue-600":"bg-white"]])},[g.createVNode(cf,{height:"12",width:"12"})],2),C[5]||(C[5]=g.createTextVNode(" Безстроково"))])):g.createCommentVNode("",!0)]))}}),$me=g.defineComponent({emits:["command"],props:{value:{type:String,default:()=>""},label:{type:String,default:()=>""},icon:{type:String,default:()=>""},selected:{type:Boolean,default:!1}},computed:{parentInstance(){var e;return(e=this.$parent)==null?void 0:e.$parent},parentValue(){return this.parentInstance.currentOption},isValueEqaulParentValue(){const t=this.value||this.label;return this.parentValue===t},activeClass(){return"bg-gray-100 cursor-default"}},methods:{handleClick(){const t=(this==null?void 0:this.value)||this.label;t&&(this.parentInstance.$emit("command",t),this.parentInstance.list.visible=!1)}}});function zme(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",{onClick:e[0]||(e[0]=g.withModifiers((...s)=>t.handleClick&&t.handleClick(...s),["stop","self"])),class:g.normalizeClass([{"outline-none bg-gray-100 ":t.selected},"flex items-center gap-x-3.5 py-2 px-3 rounded-lg text-sm text-gray-800 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 cursor-pointer text-sm text-stone-800"])},[t.icon?(g.openBlock(),g.createElementBlock("i",{key:0,class:g.normalizeClass(t.icon)},null,2)):g.createCommentVNode("",!0),g.renderSlot(t.$slots,"default",{},()=>[g.createTextVNode(g.toDisplayString(t.label),1)])],2)}const Vme=xt($me,[["render",zme]]),jme={props:{visible:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},size:{type:String,default:()=>""},closeClickBack:{type:Boolean,default:()=>!1}},emits:["update:visible","onClose"],name:"vs-dialog",mounted(){window.addEventListener("keydown",this.checkKey)},unmounted(){window.removeEventListener("keydown",this.checkKey)},computed:{hasSlot(){var t;return!!((t=this.$slots)!=null&&t.footer)},checkSize(){return this.size==="small"?"md:w-5/12 w-9/12":this.size==="medium"?"md:w-6/12 w-9/12":"lg:w-7/12 w-11/12"}},methods:{checkKey({key:t}){t==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("onClose")},closeByClickBack(t,e){e&&t.target.classList.contains("vs-dialog-overlay")&&this.handleClose()}}},Ume={key:0,class:"vsTailwind ui-dialog__wrapper"},Hme={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},Wme={class:"font-medium text-gray-800 dark:text-[#ffffff]"},Gme={class:"ui-dialog__content p-4"},qme={key:0,class:"flex justify-end gap-x-2"};function Yme(t,e,n,r,i,o){return g.openBlock(),g.createBlock(g.Teleport,{to:"#modal"},[n.visible?(g.openBlock(),g.createElementBlock("div",Ume,[g.createElementVNode("div",{onMousedown:e[1]||(e[1]=s=>o.closeByClickBack(s,n.closeClickBack)),class:"vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},[g.createVNode(g.Transition,{name:"content",appear:""},{default:g.withCtx(()=>[g.createElementVNode("div",{class:g.normalizeClass(["ui-dialog__modal opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",[o.checkSize]])},[g.createElementVNode("div",Hme,[g.createElementVNode("h3",Wme,g.toDisplayString(n.title),1),g.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:e[0]||(e[0]=(...s)=>o.handleClose&&o.handleClose(...s))},e[2]||(e[2]=[g.createElementVNode("span",{class:"sr-only"},"Close",-1),g.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[g.createElementVNode("path",{d:"M18 6 6 18"}),g.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),g.createElementVNode("div",Gme,[g.renderSlot(t.$slots,"default",{},void 0,!0)]),o.hasSlot?(g.openBlock(),g.createElementBlock("div",qme,[g.renderSlot(t.$slots,"footer",{handleClose:o.handleClose},void 0,!0)])):g.createCommentVNode("",!0)],2)]),_:3})],32)])):g.createCommentVNode("",!0)])}const Ag=xt(jme,[["render",Yme],["__scopeId","data-v-3e0d345a"]]),Zme={key:0,class:"vsTailwind ui-dialog__wrapper"},Xme={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},Kme={class:"font-medium text-gray-800 dark:text-[#ffffff]"},Jme={class:"ui-dialog__content p-4"},Qme={key:0,class:"flex justify-end gap-x-2"},ege=xt({__name:"vs-drower",props:{visible:{type:Boolean,default:!1},title:{type:String,default:""},closeClickBack:{type:Boolean,default:!1},position:{type:String,default:"right"}},emits:["update:visible","onClose"],setup(t,{emit:e}){const n=t,r=e,i=g.useSlots(),o=g.computed(()=>!!i.footer),s=g.computed(()=>{if(n.position==="right")return"top-0 right-0 w-[400px] h-full ";if(n.position==="left")return"top-0 left-0 w-[400px] h-full ";if(n.position==="top")return"top-0 left-0 right-0 h-auto max-h-[500px] overflow-auto";if(n.position==="bottom")return"bottom-0 left-0 right-0 h-auto max-h-[500px] overflow-auto"}),a=()=>{r("update:visible",!1),r("onClose")},l=u=>{n.closeClickBack&&u.target.classList.contains("vs-dialog-overlay")&&a()},c=u=>{u.key==="Escape"&&a()};return g.onMounted(()=>{window.addEventListener("keydown",c)}),g.onUnmounted(()=>{window.removeEventListener("keydown",c)}),(u,d)=>(g.openBlock(),g.createBlock(g.Teleport,{to:"#modal"},[t.visible?(g.openBlock(),g.createElementBlock("div",Zme,[g.createElementVNode("div",{onMousedown:l,class:"vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},[g.createVNode(g.Transition,{name:"fade"},{default:g.withCtx(()=>[g.createElementVNode("div",{class:g.normalizeClass(["ui-dialog__modal fixed [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500 opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)]",s.value])},[g.createElementVNode("div",Xme,[g.createElementVNode("h3",Kme,g.toDisplayString(t.title),1),g.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:a},d[0]||(d[0]=[g.createElementVNode("span",{class:"sr-only"},"Close",-1),g.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[g.createElementVNode("path",{d:"M18 6 6 18"}),g.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),g.createElementVNode("div",Jme,[g.renderSlot(u.$slots,"default",{},void 0,!0)]),o.value?(g.openBlock(),g.createElementBlock("div",Qme,[g.renderSlot(u.$slots,"footer",{handleClose:a},void 0,!0)])):g.createCommentVNode("",!0)],2)]),_:3})],32)])):g.createCommentVNode("",!0)]))}},[["__scopeId","data-v-08c103de"]]),tge=g.defineComponent({emits:["update:modelValue"],props:{modelValue:{type:String,default:()=>""},position:{type:String,default:()=>"horizontal"}},data(){return{tabId:`nav-${Math.floor(Math.random()*1e4)}`,bodyLoaded:!1}},mounted(){this.bodyLoaded=!0},computed:{tabPositionClasses(){return[{"font-semibold border-blue-600 text-blue-600 space-x-2 border-b ":this.position==="horizontal"},{"flex-col border-e space-y-2":this.position==="vertical"}]},wrapperPositionClasses(){return[{"flex flex-wrap":this.position==="vertical"}]}},methods:{handleTabSelection(t){this.$emit("update:modelValue",t)}}}),nge=["id"],rge={key:0,ref:"parentBody"};function ige(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",{class:g.normalizeClass(t.wrapperPositionClasses)},[g.createElementVNode("nav",{ref:"nav",class:g.normalizeClass(["flex",t.tabPositionClasses]),"aria-label":"Tabs",role:"tablist",id:t.tabId},null,10,nge),t.bodyLoaded?(g.openBlock(),g.createElementBlock("div",rge,[g.renderSlot(t.$slots,"default")],512)):g.createCommentVNode("",!0)],2)}const N6=xt(tge,[["render",ige]]),oge=g.defineComponent({components:{VsTabs:N6},props:{value:{type:String,default:()=>""},label:{type:String,default:()=>""},icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1}},computed:{tabClasses(){var t,e,n,r;return[{"font-semibold border-solid border-blue-600 text-blue-600":((t=this.parentInstance)==null?void 0:t.modelValue)===this.value},{"text-gray-500 border-transparent":((e=this.parentInstance)==null?void 0:e.modelValue)!==this.value},{"py-4 px-1 border-b-2 justify-center":((n=this.parentInstance)==null?void 0:n.position)==="horizontal"},{"border-e-2 py-1 pe-4 justify-start":((r=this.parentInstance)==null?void 0:r.position)==="vertical"},{"opacity-40 pointer-events-none":this.disabled}]},bodyClasses(){var t;return[{"ms-3":((t=this.parentInstance)==null?void 0:t.position)==="vertical"}]},parentInstance(){return this.$parent},parentId(){var t;return(t=this.parentInstance)==null?void 0:t.tabId},isValueEqualParentValue(){var e;const t=this.value||this.label;return((e=this.parentInstance)==null?void 0:e.modelValue)===t}},methods:{handleClick(){var t,e;this.disabled||this.value!==((t=this.parentInstance)==null?void 0:t.modelValue)&&((e=this.parentInstance)==null||e.handleTabSelection(this.value))}}}),sge={ref:"wrapper"};function age(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",sge,[(g.openBlock(),g.createBlock(g.Teleport,{to:`#${t.parentId}`},[g.createElementVNode("button",{ref:"button",type:"button",class:g.normalizeClass(["inline-flex w-full items-center gap-x-2 text-sm whitespace-nowrap hover:text-blue-600 !outline-none focus:!outline-none active:outline-none focus:text-blue-600 disabled:opacity-50 disabled:pointer-events-none",t.tabClasses]),onClick:e[0]||(e[0]=(...s)=>t.handleClick&&t.handleClick(...s))},[t.icon?(g.openBlock(),g.createElementBlock("i",{key:0,class:g.normalizeClass(t.icon)},null,2)):g.createCommentVNode("",!0),g.createTextVNode(" "+g.toDisplayString(t.label),1)],2)],8,["to"])),g.withDirectives(g.createElementVNode("div",{ref:"body",class:g.normalizeClass(["h-full",t.bodyClasses])},[g.renderSlot(t.$slots,"default")],2),[[g.vShow,t.isValueEqualParentValue]])],512)}const lge=xt(oge,[["render",age]]),O6={props:{data:{type:Object,default:()=>null},formErrors:{type:Object,default:()=>{}},modelValue:{type:[Object,Array,String,Number],default:()=>""}},computed:{values:{get(){let t={};return this.data.type==="datatable"?(this.data.colModel.forEach(e=>{t[e.name]=""}),t):this.modelValue},set(t){this.$emit("update:modelValue",{...this.modelValue,[this.data.key]:t})}}}},cge={name:"formWrapper",components:{VsButton:Fh,VsForm:g.defineAsyncComponent(()=>Promise.resolve().then(()=>Cj))},props:{parentValues:{type:Object,default:()=>{}},obj:{type:String,default:()=>""},mode:{type:String,default:()=>""},table:{type:String,default:()=>""},id:{type:String,default:()=>""},token:{type:String,default:()=>""},model:{type:String,default:()=>""},legacyDeps:{type:Boolean,default:()=>!1},scheme:{type:Object,default:()=>{}},url:{type:String,default:()=>""}},data(){return{formState:{error:"",loading:!0},formLayout:{head:!0},formId:"",formData:{},formMeta:{api:""},formScheme:null,refreshFormEvent:new CustomEvent("form-refresh")}},provide(){return{meta:g.computed(()=>({token:this.token,table:this.table,nextId:this.formId}))}},computed:{isAdd(){return window.location.pathname.match("/add")||this.mode==="add"},isEditing(){return(window.location.pathname.match("/edit")||this.mode==="edit")&&!this.isAdd},formatedScheme(){var t;return(t=this.formScheme)==null?void 0:t.components},formIsReady(){return!this.formState.loading},windowToken(){var t;return((t=window==null?void 0:window.v3cdep)==null?void 0:t.token)||""}},watch:{model(){this.initForm()}},beforeUnmount(){this.legacyDeps&&window.removeEventListener("form-data-change",this.handleFormDataChange)},async mounted(){if(this.legacyDeps&&window.addEventListener("form-data-change",this.handleFormDataChange),this.obj){let t;typeof this.obj=="object"?t=this.obj:t=this.obj.split("#").reduce((e,n)=>{let[r,i]=n.split("=");return i.includes("{{")&&this.parentValues?e[r.trim()]=this.parentValues[i.replace(/{{|}}/g,"")]:e[r.trim()]=i.trim(),e},{}),this.formData={...this.formData,...t}}await this.initForm()},methods:{async getFormId(){const t=async()=>{const{data:e}=await un.get("/api/next-id");return e.id};return this.isAdd?t():this.id},async getFormScheme(){var t;try{if(this.scheme&&!this.table)return this.scheme;if(!this.table)return null;this.formState.loading=!0;const{data:e}=await un.get(`/api/template/form/${this.table}`);return this.createFormMeta(e),this.token&&this.isEditing&&await this.getFormData(),this.formState.loading=!1,((t=e==null?void 0:e.form)==null?void 0:t.schema)||(e==null?void 0:e.schema)||(e==null?void 0:e.form)||e}catch(e){return this.$notify({title:"Помилка!",message:"Помилка при завантаженні форми!",type:"error"}),this.formState.loading=!1,this.formState.error="Помилка під час завантаження форми!",console.error(e),null}},async getFormData(){try{const{data:t}=await un.get(`/api/${this.token}/${this.token}`);this.formData=t}catch(t){this.$notify({title:"Помилка!",message:"Помилка при отриманні данних!",type:"error"}),console.error(t)}},async editForm(){var t;try{const e=((t=this.formMeta)==null?void 0:t.api)||this.url||`/api/${this.token}/${this.token}`;await un.put(e,this.formData),this.$notify({title:"Успіх!",message:"Форму успішно редаговано!",type:"success"})}catch(e){throw this.$notify({title:"Помилка!",message:"Помилка при редагуванні форми!",type:"error"}),console.error(e),new Error("EditForm error")}},async createForm(){var t;try{const e=((t=this.formMeta)==null?void 0:t.api)||this.url||`/api/${this.token||this.formId}`,n=await un.post(e,this.formData);this.$notify({title:"Успіх!",message:"Форма успішно відправлена!",type:"success"}),this.$emit("addedValue",n),this.resetFormData()}catch(e){throw this.$notify({title:"Помилка!",message:"Помилка при створенні форми!",type:"error"}),console.error(e),new Error("CreateForm error")}},async initForm(){this.formId=await this.getFormId(),this.formScheme=await this.getFormScheme()},handleFormDataChange(t){const e=t.detail||null;if(!(e!=null&&e.token)&&!(e!=null&&e.table))throw new Error("Table and Token aren't exist!");this.formState.loading=!1,this.formData={},this.formScheme=null,e!=null&&e.table&&this.$emit("update:table",e.table),e!=null&&e.token&&this.$emit("update:token",e.token),this.initForm()},applyFormChanges(t){t().then(this.editForm)},createFormMeta({api:t=""}){this.formMeta={api:t}},createBackUrl(){var n;const t=/back=([^&]+)/;if(window.location.href.match(t)){const i=((n=window.location.href.match(t))==null?void 0:n[0]).slice(5);return window.decodeURIComponent(i)}return null},goBack(){const t=this.createBackUrl();t?window!=null&&window.Backbone?window.Backbone.history.navigate(t,!0):window.history.pushState(null,"",t):window.history.go(-1),this.legacyDeps&&this.legacyWidgetRefresh()},handleCancel(){var e,n,r;this.$emit("cancel"),((r=(n=(e=this.$root)==null?void 0:e.$options)==null?void 0:n.name)==null?void 0:r.match("dialog"))?this.$root.modalClose():this.resetFormData()},legacyWidgetRefresh(){window.widgetRefresh&&window.sid==="35"&&setTimeout(()=>{var n;const t=window.location.pathname.split("/")[1],e=(n=document.querySelector(`section[path="${t}"] [widget]`))==null?void 0:n.getAttribute("widget");window.widgetRefresh(e)},100)},handleSubmit(t){t().then(()=>{this.isAdd?this.createForm().then(this.handleCancel):this.isEditing&&this.editForm().then(this.handleCancel)})},handleValdidationError(){this.$notify({title:"Помилка!",message:"Перевірте правильність введених даних!",type:"error"})},resetFormData(){this.formData={},this.$nextTick(()=>{this.$refs.vsForm.setFromData(),window.dispatchEvent(this.refreshFormEvent)})}}},uge={class:"bg-white p-3"},hge={key:0,class:"animate-spin block m-auto w-8 h-8 border-[3px] border-current border-t-transparent text-blue-600 rounded-full",role:"status","aria-label":"loading"},dge={key:1,class:"flex flex-col items-center"};function fge(t,e,n,r,i,o){const s=g.resolveComponent("VsButton"),a=g.resolveComponent("VsForm");return g.openBlock(),g.createElementBlock("div",uge,[t.formState.loading&&!t.formScheme?(g.openBlock(),g.createElementBlock("div",hge,e[1]||(e[1]=[g.createElementVNode("span",{class:"sr-only"},"Loading...",-1)]))):g.createCommentVNode("",!0),t.formState.error?(g.openBlock(),g.createElementBlock("div",dge,[e[2]||(e[2]=g.createElementVNode("i",{class:"ti ti-xbox-x text-4xl mb-1"},null,-1)),g.createTextVNode(" "+g.toDisplayString(t.formState.error),1)])):g.createCommentVNode("",!0),o.formIsReady&&t.formScheme?(g.openBlock(),g.createBlock(a,{key:2,ref:"vsForm",scheme:o.formatedScheme?o.formatedScheme:t.formScheme,onOnValidationError:o.handleValdidationError,table:n.table,token:n.token,id:t.formId,layout:t.formLayout,modelValue:t.formData,"onUpdate:modelValue":e[0]||(e[0]=l=>t.formData=l)},{header:g.withCtx(l=>[g.createVNode(s,{class:"mr-2",title:"Скасувати",color:"red",onClick:o.handleCancel},null,8,["onClick"]),o.isEditing?(g.openBlock(),g.createBlock(s,{key:0,class:"mr-2",title:"Застосувати",onClick:c=>o.applyFormChanges(l)},null,8,["onClick"])):g.createCommentVNode("",!0),g.createVNode(s,{title:"Зберегти",type:"primary",onClick:c=>o.handleSubmit(l)},null,8,["onClick"])]),_:1},8,["scheme","onOnValidationError","table","token","id","layout","modelValue"])):g.createCommentVNode("",!0)])}const WP=xt(cge,[["render",fge]]),pge=g.defineComponent({name:"form-autocomplete",props:{defaultValue:{type:[String,Array,Number],default:()=>""},data:{type:String,default:()=>""},original:{type:Object,default:()=>null},options:{type:Array,default:()=>null},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!0},modelValue:{type:[String,Array,Number],default:()=>""},multiple:{type:Boolean,default:()=>!1},searchPlaceholder:{type:String,default:()=>"Пошук.."},searchIcon:{type:String,default:()=>"ti-search"},host:{type:String,default:()=>""},prefix:{type:String,default:()=>{var t;return((t=An.value)==null?void 0:t.prefix)||"api"}},parent:{type:String,default:()=>""},mode:{type:String,default:()=>""},searchHighlight:{type:Boolean,default:()=>!0},placeholder:{type:String,default:()=>"Обрати"}},components:{VsAutocomplete:nP,VsAutocompleteOption:rP,VsFormWrapper:WP,VsButton:Fh,VsDialog:Ag},inject:["formValues","behaviorValueSetter"],data(){return{firstInstance:null,optionsList:null,searchList:[],search:"",dialogVisible:!1,optionsLoading:!1,highlightedIndex:-1,isArray:!1,handleSearchDebounced:WS(t=>{this.handleSearch(t)},500)}},watch:{async parentValue(t,e){t!==e&&(this.firstInstance=null,this.search="",t&&(this.optionsList=await this.getOptions()))},value(t,e){var n,r;t&&t!==e&&!((n=this.optionsList)!=null&&n.length)&&this.loadData(),t||(this.optionsList=(r=this.requestData({val:"",search:""}))==null?void 0:r.data)}},computed:{value:{get(){return this.isMultiple&&typeof this.modelValue=="string"?[]:this.modelValue},set(t){this.$emit("update:modelValue",t)}},addData(){var t;return((t=this.original)==null?void 0:t.add)||null},addFormTable(){var t;return((t=this.addData)==null?void 0:t.token)||this.addData.form},isMultiple(){return this.multiple},addFormToken(){var t;return(t=this.addData)==null?void 0:t.token},countEqualTotal(){var t,e;return((t=this.firstInstance)==null?void 0:t.count)===((e=this.firstInstance)==null?void 0:e.limit)},totalBiggerThanLimit(){var t,e,n;return((t=this.firstInstance)==null?void 0:t.mode)==="sql"?!0:(e=this.firstInstance)!=null&&e.total?((n=this.firstInstance)==null?void 0:n.total)>50:!1},parentValue(){var t;return this.formValues&&this.parent?(t=this.formValues)==null?void 0:t[this.parent]:""},searchedDataList(){var e,n;const t=(e=this.search)==null?void 0:e.toLowerCase();return t?this.totalBiggerThanLimit?this.searchList:(n=this.optionsList)==null?void 0:n.filter(r=>r.text.toLowerCase().match(t)):this.optionsList},sortedDataList(){return this.searchedDataList?[...this.searchedDataList].sort(e=>Array.isArray(this.modelValue)?this.modelValue.includes(String(e.id))?-1:1:this.modelValue===String(e.id)?-1:1):[]},isSearchable(){var t;return this.optionsList?((t=this.optionsList)==null?void 0:t.length)>=10||!this.isArray:!1}},async created(){var t;if(this.defaultValue&&!this.modelValue&&this.$emit("update:modelValue",this.isMultiple?[this.defaultValue]:this.defaultValue),(t=this.parent)!=null&&t.includes("{{")){window!=null&&window.Handlebars||await GS.promise(["https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.7.7/handlebars.min.js"]);const e=await window.Handlebars.compile(this.parent)({setting:window.setting});this.$emit("update:parent",e)}},methods:{async setNewValue(t){var n,r;const e=await this.requestData({val:`${Array.isArray(t)?"&val="+t[(n=this.addData)==null?void 0:n.pk]:"&val="+t}`,search:""});this.optionsList=e==null?void 0:e.data,this.$emit("update:modelValue",Array.isArray(t)?t[(r=this.addData)==null?void 0:r.pk]:e==null?void 0:e.data[0].id)},async loadData(){this.modelValue&&await this.handleFocus()},handleOptionClick(t){var n,r;const e=this.formatedOptionValue(t);if(this.isMultiple){const i=Array.isArray(this.modelValue)?this.modelValue:[],o=i.includes(e)?i.filter(s=>s!==e):i.concat(e);this.$emit("update:modelValue",o)}else{const i=(r=(n=this.original)==null?void 0:n.behavior)==null?void 0:r.set;i&&Object.keys(i).forEach(o=>{var c;const s=i[o].split(".").at(-1),a=(c=this.searchedDataList)==null?void 0:c.find(u=>u.id===e),l=a?a[s]:s;this.behaviorValueSetter(o,l)}),this.$emit("update:modelValue",e)}},formatedOptionValue(t){return(t==null?void 0:t.id)!==void 0?t.id:t},handleKeyNavigation(t="next"){var i;const e=(((i=this.searchedDataList)==null?void 0:i.length)||0)-1,n=this.$refs.autocomplete.$refs.listWrapper;switch(t){case"next":this.highlightedIndex{const s=o;s.innerText===r&&(t==="next"?s.scrollIntoView({block:"end",inline:"nearest",behavior:"auto"}):s.scrollIntoView({block:"start",inline:"nearest",behavior:"auto"}))})},menuEnterSelect(){const t=this.getOptionValue(),e=this.getFirstMatchingOption(t);e&&this.$emit("update:modelValue",e)},getOptionValue(){var e,n;const t="id";return this.searchedDataList&&this.searchedDataList.length>0&&t in this.searchedDataList[0]?((e=this.searchedDataList[0][t])==null||e.toString(),((n=this.searchedDataList[0][t])==null?void 0:n.toString())??null):null},getFirstMatchingOption(t){const e=this.getHighlightedValue()||t;if(e){if(this.isMultiple){const n=Array.isArray(this.modelValue)?this.modelValue:[];return this.modelValue.includes(e)?n.filter(i=>i!==e):n.concat(e)}return e}return null},getHighlightedValue(t){var n;const e=(n=this.searchedDataList)==null?void 0:n[this.highlightedIndex];return e?t?e==null?void 0:e[t]:(e.id||e.text).toString():""},openDialog(){this.dialogVisible=!this.dialogVisible},async handleFocus(){this.optionsList||(this.optionsList=await this.getOptions())},async getOptions(){try{if(this.options)return this.options;const t=await this.requestData();this.firstInstance={count:t==null?void 0:t.count,total:t==null?void 0:t.total,limit:t==null?void 0:t.limit,mode:t==null?void 0:t.mode};let e=(t==null?void 0:t.data)||[];if(this.isArray=(t==null?void 0:t.mode)==="array",this.modelValue&&e.findIndex(r=>{var i;return Array.isArray(this.modelValue)?(i=this.modelValue)==null?void 0:i.includes(r.id):r.id==this.modelValue})===-1){const r=await this.requestData({val:`${this.modelValue.length?"&val="+this.modelValue:""}`,search:""});e=(r==null?void 0:r.data)||[]}return e}catch(t){return console.error(t),null}},async requestData({val:t,search:e}={val:"",search:""}){var i;const n=setTimeout(()=>{this.optionsLoading=!0},600),r=()=>{clearTimeout(n),this.optionsLoading=!1};try{const o=this.parent&&this.parentValue?`&parent=${this.parentValue}`:"";console.log(o);const s=this.host||((i=this.original)==null?void 0:i.host)||"",{data:a}=await un.get(`${s}/${this.prefix}/suggest/${this.data}?json=1${o}${e}${t}`);return r(),a}catch(o){return r(),console.error(o),null}},async handleSearch(t){var e;this.search=t,this.highlightedIndex=-1,this.totalBiggerThanLimit&&t&&this.mode!=="array"&&(this.searchList=(e=await this.requestData({search:`&key=${t.toLowerCase()}`,val:""}))==null?void 0:e.data)}}}),mge={class:"relative flex items-center w-full"},gge={key:0,class:"animate-spin absolute z-10 top-2.5 right-9 inline-block w-4 h-4 border-[3px] border-current border-t-transparent text-blue-600 rounded-full",role:"status","aria-label":"loading"},yge={class:"flex items-center"},vge={key:1,class:"text-center"},_ge={class:"vs-form__autocomplete-dialog"};function bge(t,e,n,r,i,o){const s=g.resolveComponent("VsAutocompleteOption"),a=g.resolveComponent("VsAutocomplete"),l=g.resolveComponent("VsFormWrapper"),c=g.resolveComponent("VsDialog");return g.openBlock(),g.createElementBlock("div",mge,[t.optionsLoading?(g.openBlock(),g.createElementBlock("div",gge,e[6]||(e[6]=[g.createElementVNode("span",{class:"sr-only"},"Loading...",-1)]))):g.createCommentVNode("",!0),g.createVNode(a,{modelValue:t.value,"onUpdate:modelValue":e[0]||(e[0]=u=>t.value=u),class:"w-full",ref:"autocomplete",optionsList:t.searchedDataList,lazyLoad:t.loadData,disabled:t.disabled,clearable:t.clearable,multiple:t.isMultiple,searchable:t.isSearchable,searchHighlight:t.searchHighlight,searchPlaceholder:t.searchPlaceholder,searchIcon:t.searchIcon,onClick:t.handleFocus,onOnSearch:t.handleSearchDebounced,placeholder:t.placeholder,onMenuKeyDown:e[1]||(e[1]=u=>t.handleKeyNavigation("next")),onMenuKeyUp:e[2]||(e[2]=u=>t.handleKeyNavigation("prev")),onMenuEnterSelect:t.menuEnterSelect},{default:g.withCtx(()=>{var u;return[(u=t.sortedDataList)!=null&&u.length?(g.openBlock(!0),g.createElementBlock(g.Fragment,{key:0},g.renderList(t.sortedDataList,(d,p)=>(g.openBlock(),g.createBlock(s,{"is-highlighted":p===t.highlightedIndex,label:d.text||d.id||d,value:t.formatedOptionValue(d).toString(),color:d.color,key:d.id,onClick:m=>t.handleOptionClick(d)},{default:g.withCtx(()=>[g.createElementVNode("div",yge,[d.color?(g.openBlock(),g.createElementBlock("div",{key:0,class:"w-4 h-4 rounded-md mr-2",style:g.normalizeStyle({"background-color":d.color})},null,4)):g.createCommentVNode("",!0),g.createTextVNode(" "+g.toDisplayString((d==null?void 0:d.text)||(d==null?void 0:d.label)||d),1)])]),_:2},1032,["is-highlighted","label","value","color","onClick"]))),128)):(g.openBlock(),g.createElementBlock("div",vge,"Дані не знайдено"))]}),_:1},8,["modelValue","optionsList","lazyLoad","disabled","clearable","multiple","searchable","searchHighlight","searchPlaceholder","searchIcon","onClick","onOnSearch","placeholder","onMenuEnterSelect"]),t.addData?(g.openBlock(),g.createElementBlock("button",{key:1,onClick:e[3]||(e[3]=(...u)=>t.openDialog&&t.openDialog(...u)),class:"ml-[10px] bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[40px] max-h-[40px] gap-[8px] flex items-center"},e[7]||(e[7]=[g.createElementVNode("svg",{class:"vpbnr cp61q",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},[g.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 1C8.55228 1 9 1.44772 9 2V7L14 7C14.5523 7 15 7.44771 15 8C15 8.55228 14.5523 9 14 9L9 9V14C9 14.5523 8.55228 15 8 15C7.44772 15 7 14.5523 7 14V9.00001L2 9.00001C1.44772 9.00001 1 8.5523 1 8.00001C0.999999 7.44773 1.44771 7.00001 2 7.00001L7 7.00001V2C7 1.44772 7.44772 1 8 1Z"})],-1),g.createElementVNode("span",null,"Додати",-1)]))):g.createCommentVNode("",!0),t.addData?(g.openBlock(),g.createBlock(c,{key:2,visible:t.dialogVisible,"onUpdate:visible":e[5]||(e[5]=u=>t.dialogVisible=u),title:"Додати"},{default:g.withCtx(()=>{var u,d;return[g.createElementVNode("div",_ge,[g.createVNode(l,{class:"add-form",parentValues:t.formValues,obj:(u=t.addData)==null?void 0:u.obj,table:t.addFormTable,token:t.addFormToken,url:(d=t.addData)==null?void 0:d.api,mode:"add",onAddedValue:e[4]||(e[4]=p=>{var m,y,w,x;return t.setNewValue(((m=p==null?void 0:p.data)==null?void 0:m.id)||((x=(w=(y=p==null?void 0:p.data)==null?void 0:y.rows)==null?void 0:w[0])==null?void 0:x.id))}),onCancel:t.openDialog},null,8,["parentValues","obj","table","token","url","onCancel"])])]}),_:1},8,["visible"])):g.createCommentVNode("",!0)])}const GP=xt(pge,[["render",bge]]),wge=["innerHTML"],qP={__name:"vs-high-light",props:{searchValue:{type:String,default:""},value:{type:String,default:""}},setup(t){const e=t,n=r=>{if(!e.searchValue)return r;const i=e.searchValue.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${i})(\\s*)`,"gi");return r.replace(o,(s,a,l)=>`${a}${l}`)};return(r,i)=>(g.openBlock(),g.createElementBlock("span",{innerHTML:n(t.value)},null,8,wge))}},xge={class:"text-[13px] text-gray-500 dark:text-neutral-500"},Ege={class:"text-[14px] text-gray-800 dark:text-neutral-200"},D6=xt({__name:"vs-combobox-popover",props:{option:{type:Object,required:!0},popup:{type:Array,default:()=>null},visible:{type:Boolean,default:!1}},setup(t){const e=t,n=g.ref(!1),r=g.ref(null),i=g.ref(null);return g.watch(n,o=>{o&&Lc("right",r.value,i.value,12)}),g.watch(()=>e.visible,o=>{o||(n.value=!1)}),g.watch(()=>e.option,o=>{o||(n.value=!1)}),(o,s)=>(g.openBlock(),g.createElementBlock("div",{ref_key:"popover",ref:r,onMouseenter:s[0]||(s[0]=()=>{t.popup&&(n.value=!0)}),onMouseleave:s[1]||(s[1]=a=>n.value=!1)},[g.renderSlot(o.$slots,"default",{},void 0,!0),(g.openBlock(),g.createBlock(g.Teleport,{to:"#modal"},[g.createVNode(g.Transition,{name:"fade"},{default:g.withCtx(()=>[g.withDirectives(g.createElementVNode("div",{class:"fixed bg-white max-w-[300px] border popover-container p-2 px-4 rounded-lg combobox-popover",ref_key:"contentPop",ref:i},[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(t.popup,a=>{var l;return g.openBlock(),g.createElementBlock("div",{key:a.name},[g.createElementVNode("h3",xge,g.toDisplayString(a.title),1),g.createElementVNode("p",Ege,g.toDisplayString(((l=t.option)==null?void 0:l[a==null?void 0:a.name])||"-"),1)])}),128))],512),[[g.vShow,n.value]])]),_:1})]))],544))}},[["__scopeId","data-v-a316124b"]]),Sge=["disabled","placeholder","value"],Cge={key:1,class:"absolute top-[50%] text-gray-700 translate-y-[-50%] left-[16px] pointer-events-none"},kge=["onClick"],Tge={key:1},Mge={key:1},Age={key:1},wC={__name:"vs-combobox",props:g.mergeModels({placeholder:{type:String,default:"Пошук"},prefix:{type:String,default:"api"},host:{type:String,default:""},data:{type:String,default:null},options:{type:Array,default:[]},maxHeight:{type:Number,default:400},slots:{type:Object,default:null},parent:{type:String,default:""},popup:{type:Array,default:()=>null},disabled:{type:Boolean,default:!1},mode:{type:String,default:()=>{var t,e;return((e=(t=An.value)==null?void 0:t.combobox)==null?void 0:e.mode)||"search"}},appendNewOption:{type:Boolean,default:!1}},{modelValue:{type:[Number,String],default:null},modelModifiers:{}}),emits:g.mergeModels(["append-new-option"],["update:modelValue"]),setup(t,{emit:e}){const n=t,r=g.inject("formValues"),i=e,o=g.useModel(t,"modelValue"),s=g.ref({}),a=g.ref(),l=g.ref(),c=g.ref(!1),u=g.ref(""),d=g.ref(""),p=g.ref(null),m=g.ref([]),y=g.ref(-1),w=g.ref([]),x=g.computed(()=>{var U,Q,re,le;if(Lc("bottom-start",a.value,l.value),!((U=n.options)!=null&&U.length)&&n.data)return[p.value,...((Q=m.value)==null?void 0:Q.filter(oe=>{var he;return(oe==null?void 0:oe.id)!==((he=p.value)==null?void 0:he.id)}))||[]].filter(oe=>{var he,xe,Ee;return(Ee=(he=oe==null?void 0:oe.text)==null?void 0:he.toLowerCase())==null?void 0:Ee.includes((xe=d.value)==null?void 0:xe.toLowerCase())});if((re=n.options)!=null&&re.length)return[p.value,...((le=m.value)==null?void 0:le.filter(oe=>{var he;return(oe==null?void 0:oe.id)!==((he=p.value)==null?void 0:he.id)}))||[]].filter(oe=>{var he,xe,Ee;return(Ee=(he=oe==null?void 0:oe.text)==null?void 0:he.toLowerCase())==null?void 0:Ee.includes((xe=d.value)==null?void 0:xe.toLowerCase())})}),C=g.computed(()=>{var U;return((U=r==null?void 0:r.value)==null?void 0:U[n==null?void 0:n.parent])||(r==null?void 0:r[n==null?void 0:n.parent])}),S=async(U="",Q="")=>{try{const{data:re}=await un.get(`${n.host}/${n.prefix}/suggest/${n.data}?json=1${U?"&key="+U:""}${Q?"&val="+Q:""}${C.value?"&parent="+C.value:""}`);return re.data}catch(re){console.log(re)}},M=async(U=void 0)=>{var Q,re,le,oe;document.body.click(),c.value=U!==void 0?U:!c.value,c.value&&!((Q=m.value)!=null&&Q.length)&&(!((re=n.options)!=null&&re.length)&&n.data?m.value=await S(""):(le=n.options)!=null&&le.length&&(m.value=[...n.options||[]])),c.value?(s.value.width=((oe=a.value.getBoundingClientRect())==null?void 0:oe.width)+"px",Lc("bottom-start",a.value,l.value)):(p.value&&(u.value=await p.value.text),y.value=-1,d.value="")},E=WS(async U=>{m.value=await S(U)},300),A=()=>c.value?M(!1):null,I=U=>{p.value=U,u.value=U.text,o.value=U.id,M(!1)},O=async U=>{var Q;c.value||M(!0),u.value=U.target.value||"",d.value=u.value,!((Q=n.options)!=null&&Q.length)&&n.data&&E(u.value)},z=()=>{i("append-new-option",u.value),u.value="",o.value=null,p.value=null,M(!1)},$=(U,Q)=>{var re;return uf(U,(re=n.slots)==null?void 0:re.option,Object.keys(Q||{}))},W=U=>{var Q;return uf(U,(Q=n.slots)==null?void 0:Q.appendNewOption,["searchValue"])},J=(U,Q)=>{if(!U||!Q)return;const re=U.offsetTop,le=re+U.offsetHeight,oe=Q.scrollTop,he=oe+Q.clientHeight;rehe&&(Q.scrollTop=le-Q.clientHeight+4)},Z=U=>{var re;if(!c.value)return;const{keyCode:Q}=U;if([38,40,13].includes(Q)&&U.preventDefault(),Q==38){if(y.value==0)return;y.value=y.value-1,J(w.value[y.value],l.value)}else if(Q==40){if(y.value+1>=((re=x.value)==null?void 0:re.length))return;y.value=y.value+1,J(w.value[y.value],l.value)}else if(Q==13){const le=x.value[y.value];le&&I(le)}},q=async U=>{if(c.value)return;const{keyCode:Q}=U;[38,40].includes(Q)&&(await U.preventDefault(),y.value=0,setTimeout(()=>M()))},j=U=>{c.value&&a.value&&!l.value.contains(U.target)&&(c.value=!1)},G=U=>{(U==null?void 0:U.key)==="Escape"&&c.value&&M(!1)};return g.watch(o,async U=>{var Q,re;if(U&&!((Q=n.options)!=null&&Q.length)&&n.data){let le=[...m.value||{}];m.value=await S(),p.value=await[...le,...(m==null?void 0:m.value)||[]].find(oe=>(oe==null?void 0:oe.id)==o.value),u.value=await((re=p.value)==null?void 0:re.text)||o.value}U||(u.value="")}),g.onMounted(async()=>{var U,Q,re,le;if(addEventListener("click",A),addEventListener("keydown",Z),addEventListener("scroll",j,!0),addEventListener("keydown",G),o.value&&!((U=n.options)!=null&&U.length)&&n.data){if(m.value=await S(""),p.value=await((Q=m==null?void 0:m.value)==null?void 0:Q.find(oe=>(oe==null?void 0:oe.id)===o.value)),!p.value&&o.value){const oe=await S("",o.value);p.value=oe[0]}}else o.value&&((re=n.options)!=null&&re.length)&&(p.value=n.options.find(oe=>(oe==null?void 0:oe.id)===o.value));u.value=await((le=p.value)==null?void 0:le.text)||o.value}),g.onUnmounted(()=>{removeEventListener("click",A),removeEventListener("keydown",Z),removeEventListener("scroll",j,!0),removeEventListener("keydown",G)}),(U,Q)=>{var re,le,oe;return g.openBlock(),g.createElementBlock("div",{class:"relative h-[38px] w-full",ref_key:"combobox",ref:a,onClick:Q[3]||(Q[3]=g.withModifiers(()=>{},["stop"]))},[g.createVNode(D6,{popup:p.value?t.popup:null,option:p.value,class:"w-full h-full",visible:c.value},{default:g.withCtx(()=>[g.createElementVNode("input",{type:"text",disabled:t.disabled,class:g.normalizeClass(["block w-full flex h-full text-[13px] rounded-lg outline-blue-600 placeholder:text-[14px] w-[calc(100%)] overflow-ellipsis disabled:cursor-not-allowed disabled:opacity-50",[t.mode==="combo"?"pl-[16px] pr-[60px] bg-white":"pr-[40px] pl-[40px] bg-gray-100 placeholder:text-gray-700"]]),placeholder:t.placeholder,value:u.value,style:g.normalizeStyle({border:t.mode==="combo"?"1px solid #e5e7eb":"1px solid transparent"}),onInput:O,onKeydown:q,onClick:Q[0]||(Q[0]=he=>M(!c.value))},null,46,Sge),t.mode==="combo"?(g.openBlock(),g.createElementBlock("button",{key:0,class:g.normalizeClass(["absolute top-[50%] text-gray-500 translate-y-[-50%] right-[16px] duration-300 pointer-events-none",[c.value?"rotate-180":""]])},[g.createVNode(Ip,{height:"14",width:"14"})],2)):g.createCommentVNode("",!0),t.mode==="search"?(g.openBlock(),g.createElementBlock("span",Cge,[g.createVNode(UA,{height:"14",width:"14"})])):g.createCommentVNode("",!0),u.value?(g.openBlock(),g.createElementBlock("button",{key:2,onClick:Q[1]||(Q[1]=he=>{u.value="",o.value=null,p.value=null}),class:g.normalizeClass(["absolute top-[50%] text-gray-500 translate-y-[-50%] hover:text-red-600",[t.mode=="combo"?"right-[40px] ":"right-[16px]"]])},[g.createVNode(Fa,{height:"14",width:"14"})],2)):g.createCommentVNode("",!0)]),_:1},8,["popup","option","visible"]),(g.openBlock(),g.createBlock(g.Teleport,{to:"#modal"},[g.withDirectives(g.createElementVNode("ul",{class:"border z-[90] rounded-lg fixed flex flex-col gap-[2px] p-1 bg-white overflow-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-[6px] [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500",ref_key:"list",ref:l,style:g.normalizeStyle({width:s.value.width,maxHeight:t.maxHeight+"px",backgroundColor:"white"}),onClick:Q[2]||(Q[2]=g.withModifiers(()=>{},["stop"]))},[(re=x.value)!=null&&re.length?(g.openBlock(),g.createElementBlock(g.Fragment,{key:0},[Q[4]||(Q[4]=g.createElementVNode("li",{class:"sticky top-[-4px] text-[12px] bg-white p-1 z-[2] px-4 text-gray-400"}," Натисніть Enter для вибору, ↑↓ для навігації, Esc для закриття ",-1)),(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(x.value,(he,xe)=>{var Ee;return g.openBlock(),g.createElementBlock("li",{onClick:Ie=>I(he),key:he==null?void 0:he.id,ref_for:!0,ref:Ie=>w.value[xe]=Ie},[(Ee=t.slots)!=null&&Ee.option?(g.openBlock(),g.createBlock(g.resolveDynamicComponent($(`ComboboxOption${xe}`,{...he,ind:xe,selectedNavIndex:y.value,modelValue:o.value,searchValue:u.value})),g.mergeProps({key:0,ref_for:!0},he,{selectedNavIndex:y.value,ind:xe,modelValue:o.value,searchValue:u.value}),null,16,["selectedNavIndex","ind","modelValue","searchValue"])):(g.openBlock(),g.createBlock(D6,{key:1,popup:t.popup,option:he,visible:c.value,class:g.normalizeClass(["cursor-pointer relative py-2 px-4 w-full text-[14px] [&>div]:text-start text-gray-800 hover:bg-gray-100 rounded-lg",[y.value==xe?"bg-gray-100":""]])},{default:g.withCtx(()=>[g.createVNode(qP,{value:he==null?void 0:he.text,"search-value":u.value},null,8,["value","search-value"]),o.value==(he==null?void 0:he.id)?(g.openBlock(),g.createBlock(cf,{key:0,height:"14",width:"14","stroke-width":"2",class:"absolute right-[16px] top-[50%] translate-y-[-50%] text-blue-600"})):g.createCommentVNode("",!0)]),_:2},1032,["popup","option","visible","class"]))],8,kge)}),128))],64)):(g.openBlock(),g.createElementBlock("li",Tge,[t.appendNewOption&&((le=u.value)!=null&&le.trim())?(g.openBlock(),g.createElementBlock("p",{key:0,class:"cursor-pointer",onClick:z},[(oe=t.slots)!=null&&oe.appendNewOption?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(W("ComboboxAppendNewOption")),{key:0,searchValue:u.value},null,8,["searchValue"])):(g.openBlock(),g.createElementBlock("span",Mge,[Q[5]||(Q[5]=g.createTextVNode(" Створити на основі: ")),g.createVNode(qP,{value:u.value,"search-value":u.value},null,8,["value","search-value"])]))])):(g.openBlock(),g.createElementBlock("p",Age,"Дані відсутні"))]))],4),[[g.vShow,c.value]])]))],512)}}},Ige={},Lge={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Pge(t,e){return g.openBlock(),g.createElementBlock("svg",Lge,e[0]||(e[0]=[g.createElementVNode("path",{d:"M5 12h14"},null,-1),g.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const R6=xt(Ige,[["render",Pge]]),Nge={},Oge={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Dge(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",Oge,e[0]||(e[0]=[g.createElementVNode("path",{d:"m7 15 5 5 5-5"},null,-1),g.createElementVNode("path",{d:"m7 9 5-5 5 5"},null,-1)]))}const Rge=xt(Nge,[["render",Dge]]),Bge=["disabled"],Fge={key:1},$ge={key:2,class:"text-gray-400"},zge={class:"absolute top-[50%] text-gray-500 translate-y-[-50%] right-[16px]"},Vge=["onClick"],jge={key:1,class:"flex items-center gap-[8px] w-full"},Uge={key:1},B6={__name:"vs-select",props:g.mergeModels({placeholder:{type:String,default:"Оберіть значення"},prefix:{type:String,default:"api"},host:{type:String,default:""},data:{type:String,default:null},options:{type:Array,default:[]},maxHeight:{type:Number,default:400},slots:{type:Object,default:null},disabled:{type:Boolean,default:!1}},{modelValue:{type:[Number,String,Array],default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const e=t,n=g.useModel(t,"modelValue"),r=g.ref({}),i=g.ref(),o=g.ref(),s=g.ref(!1),a=g.ref(null),l=g.ref([]),c=g.ref(-1),u=g.ref([]),d=g.computed(()=>{var I,O;return(I=l.value)!=null&&I.length?[a.value,...(O=l.value)==null?void 0:O.filter(z=>{var $;return(z==null?void 0:z.id)!==(($=a.value)==null?void 0:$.id)})].filter(z=>z):[]}),p=async()=>{try{const{data:I}=await un.get(`${e.host}/${e.prefix}/suggest/${e.data}?json=1`);return I.data}catch{}},m=async(I=void 0)=>{var O,z,$,W;document.body.click(),s.value=I!==void 0?I:!s.value,s.value&&!((O=l.value)!=null&&O.length)&&(!((z=e.options)!=null&&z.length)&&e.data?l.value=await p():($=e.options)!=null&&$.length&&(l.value=[...e.options])),s.value?(r.value.width=((W=i.value.getBoundingClientRect())==null?void 0:W.width)+"px",Lc("bottom-start",i.value,o.value)):c.value=-1},y=()=>s.value?m(!1):null,w=I=>{a.value=I,n.value=I.id,m(!1)},x=(I,O)=>{var z;return uf(I,(z=e.slots)==null?void 0:z.option,Object.keys(O||{}))},C=(I,O)=>{if(!I||!O)return;const z=I.offsetTop,$=z+I.offsetHeight,W=O.scrollTop,J=W+O.clientHeight;zJ&&(O.scrollTop=$-O.clientHeight+4)},S=I=>{var z;if(!s.value)return;const{keyCode:O}=I;if([38,40,13].includes(O)&&I.preventDefault(),O==38){if(c.value==0)return;c.value=c.value-1,C(u.value[c.value],o.value)}else if(O==40){if(c.value+1>=((z=d.value)==null?void 0:z.length))return;c.value=c.value+1,C(u.value[c.value],o.value)}else if(O==13){const $=d.value[c.value];$&&w($)}},M=async I=>{if(s.value)return;const{keyCode:O}=I;[38,40].includes(O)&&(await I.preventDefault(),c.value=0,setTimeout(()=>m()))},E=I=>{s.value&&i.value&&!o.value.contains(I.target)&&(s.value=!1)},A=I=>{(I==null?void 0:I.key)==="Escape"&&s.value&&m(!1)};return g.onMounted(async()=>{var I,O;addEventListener("click",y),addEventListener("keydown",S),addEventListener("scroll",E,!0),addEventListener("keydown",A),n.value&&!((I=e.options)!=null&&I.length)&&e.data&&(l.value=await p(),a.value=await((O=l==null?void 0:l.value)==null?void 0:O.find(z=>(z==null?void 0:z.id)===n.value)))}),g.onUnmounted(()=>{removeEventListener("click",y),removeEventListener("keydown",S),removeEventListener("scroll",E,!0),removeEventListener("keydown",A)}),(I,O)=>{var z,$,W,J,Z,q;return g.openBlock(),g.createElementBlock("div",{class:"relative h-[38px] w-full",ref_key:"combobox",ref:i,onClick:O[3]||(O[3]=g.withModifiers(()=>{},["stop"]))},[g.createElementVNode("button",{class:g.normalizeClass(["block w-full border flex items-center gap-[8px] h-full text-[13px] rounded-lg pl-[16px] pr-[60px] bg-white placeholder:text-[14px] w-[calc(100%)] overflow-ellipsis disabled:cursor-not-allowed disabled:opacity-50",[s.value?"ring-2 ring-blue-500":""]]),onKeydown:M,disabled:t.disabled,onClick:O[0]||(O[0]=j=>m(!s.value))},[(z=a.value)!=null&&z.color?(g.openBlock(),g.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block",style:g.normalizeStyle({backgroundColor:($=a.value)==null?void 0:$.color})},null,4)):g.createCommentVNode("",!0),(W=a.value)!=null&&W.text?(g.openBlock(),g.createElementBlock("span",Fge,g.toDisplayString((J=a.value)==null?void 0:J.text),1)):(g.openBlock(),g.createElementBlock("span",$ge,g.toDisplayString(t.placeholder),1))],42,Bge),g.createElementVNode("span",zge,[g.createVNode(Rge,{height:"14",width:"14"})]),(Z=a.value)!=null&&Z.text?(g.openBlock(),g.createElementBlock("button",{key:0,onClick:O[1]||(O[1]=j=>{n.value=null,a.value=null}),class:"absolute top-[50%] text-gray-500 translate-y-[-50%] hover:text-red-600 right-[40px]"},[g.createVNode(Fa,{height:"14",width:"14"})])):g.createCommentVNode("",!0),(g.openBlock(),g.createBlock(g.Teleport,{to:"#modal"},[g.withDirectives(g.createElementVNode("ul",{class:"z-[90] border rounded-lg fixed flex flex-col gap-[2px] p-1 bg-white overflow-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-[6px] [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500",ref_key:"list",ref:o,style:g.normalizeStyle({width:r.value.width,maxHeight:t.maxHeight+"px",backgroundColor:"white"}),onClick:O[2]||(O[2]=g.withModifiers(()=>{},["stop"]))},[(q=d.value)!=null&&q.length?(g.openBlock(),g.createElementBlock(g.Fragment,{key:0},[O[4]||(O[4]=g.createElementVNode("li",{class:"sticky top-[-4px] text-[12px] bg-white p-1 z-[2] px-4 text-gray-400"}," Натисніть Enter для вибору, ↑↓ для навігації, Esc для закриття ",-1)),(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(d.value,(j,G)=>{var U;return g.openBlock(),g.createElementBlock("li",{onClick:Q=>w(j),key:j==null?void 0:j.id,ref_for:!0,ref:Q=>u.value[G]=Q,class:g.normalizeClass(["cursor-pointer relative py-2 px-4 w-full text-[14px] text-gray-800 hover:bg-gray-100 rounded-lg",[c.value==G?"bg-gray-100":""]])},[(U=t.slots)!=null&&U.option?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(x(`ComboboxOption${G}`,j)),g.mergeProps({key:0,ref_for:!0},j),null,16)):(g.openBlock(),g.createElementBlock("span",jge,[j!=null&&j.color?(g.openBlock(),g.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block",style:g.normalizeStyle({backgroundColor:j==null?void 0:j.color})},null,4)):g.createCommentVNode("",!0),g.createTextVNode(" "+g.toDisplayString(j==null?void 0:j.text),1)])),n.value==(j==null?void 0:j.id)?(g.openBlock(),g.createBlock(cf,{key:2,height:"14",width:"14","stroke-width":"2",class:"absolute right-[16px] top-[50%] translate-y-[-50%] text-blue-600"})):g.createCommentVNode("",!0)],10,Vge)}),128))],64)):(g.openBlock(),g.createElementBlock("li",Uge,"Дані відсутні"))],4),[[g.vShow,s.value]])]))],512)}}};/**! * Sortable 1.15.6 * @author RubaXa * @author owenm * @license MIT */function F6(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ad(t){for(var e=1;e=0)&&(n[i]=t[i]);return n}function Gge(t,e){if(t==null)return{};var n=Wge(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}var qge="1.15.6";function Ef(t){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(t)}var Sf=Ef(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),M1=Ef(/Edge/i),$6=Ef(/firefox/i),A1=Ef(/safari/i)&&!Ef(/chrome/i)&&!Ef(/android/i),YP=Ef(/iP(ad|od|hone)/i),z6=Ef(/chrome/i)&&Ef(/android/i),V6={capture:!1,passive:!1};function ui(t,e,n){t.addEventListener(e,n,!Sf&&V6)}function si(t,e,n){t.removeEventListener(e,n,!Sf&&V6)}function EC(t,e){if(e){if(e[0]===">"&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch{return!1}return!1}}function j6(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function fh(t,e,n,r){if(t){n=n||document;do{if(e!=null&&(e[0]===">"?t.parentNode===n&&EC(t,e):EC(t,e))||r&&t===n)return t;if(t===n)break}while(t=j6(t))}return null}var U6=/\s+/g;function Oc(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var r=(" "+t.className+" ").replace(U6," ").replace(" "+e+" "," ");t.className=(r+(n?" "+e:"")).replace(U6," ")}}function Xn(t,e,n){var r=t&&t.style;if(r){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),e===void 0?n:n[e];!(e in r)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),r[e]=n+(typeof n=="string"?"":"px")}}function v0(t,e){var n="";if(typeof t=="string")n=t;else do{var r=Xn(t,"transform");r&&r!=="none"&&(n=r+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function H6(t,e,n){if(t){var r=t.getElementsByTagName(e),i=0,o=r.length;if(n)for(;i=o,!s)return r;if(r===ld())break;r=Rp(r,!1)}return!1}function _0(t,e,n,r){for(var i=0,o=0,s=t.children;o2&&arguments[2]!==void 0?arguments[2]:{},i=r.evt,o=Gge(r,tye);L1.pluginEvent.bind(Kn)(e,n,ad({dragEl:Wt,parentEl:Uo,ghostEl:ar,rootEl:Mo,nextEl:Ig,lastDownEl:SC,cloneEl:Bo,cloneHidden:Bp,dragStarted:N1,putSortable:Ta,activeSortable:Kn.active,originalEvent:i,oldIndex:w0,oldDraggableIndex:P1,newIndex:Dc,newDraggableIndex:Fp,hideGhostForTarget:r8,unhideGhostForTarget:i8,cloneNowHidden:function(){Bp=!0},cloneNowShown:function(){Bp=!1},dispatchSortableEvent:function(a){Cl({sortable:n,name:a,originalEvent:i})}},o))};function Cl(t){eye(ad({putSortable:Ta,cloneEl:Bo,targetEl:Wt,rootEl:Mo,oldIndex:w0,oldDraggableIndex:P1,newIndex:Dc,newDraggableIndex:Fp},t))}var Wt,Uo,ar,Mo,Ig,SC,Bo,Bp,w0,Dc,P1,Fp,CC,Ta,x0=!1,kC=!1,TC=[],Lg,ph,JP,QP,K6,J6,N1,E0,O1,D1=!1,MC=!1,AC,Za,e2=[],t2=!1,IC=[],LC=typeof document<"u",PC=YP,Q6=M1||Sf?"cssFloat":"float",nye=LC&&!z6&&!YP&&"draggable"in document.createElement("div"),e8=function(){if(LC){if(Sf)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),t8=function(e,n){var r=Xn(e),i=parseInt(r.width)-parseInt(r.paddingLeft)-parseInt(r.paddingRight)-parseInt(r.borderLeftWidth)-parseInt(r.borderRightWidth),o=_0(e,0,n),s=_0(e,1,n),a=o&&Xn(o),l=s&&Xn(s),c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+ys(o).width,u=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+ys(s).width;if(r.display==="flex")return r.flexDirection==="column"||r.flexDirection==="column-reverse"?"vertical":"horizontal";if(r.display==="grid")return r.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&a.float&&a.float!=="none"){var d=a.float==="left"?"left":"right";return s&&(l.clear==="both"||l.clear===d)?"vertical":"horizontal"}return o&&(a.display==="block"||a.display==="flex"||a.display==="table"||a.display==="grid"||c>=i&&r[Q6]==="none"||s&&r[Q6]==="none"&&c+u>i)?"vertical":"horizontal"},rye=function(e,n,r){var i=r?e.left:e.top,o=r?e.right:e.bottom,s=r?e.width:e.height,a=r?n.left:n.top,l=r?n.right:n.bottom,c=r?n.width:n.height;return i===a||o===l||i+s/2===a+c/2},iye=function(e,n){var r;return TC.some(function(i){var o=i[ec].options.emptyInsertThreshold;if(!(!o||ZP(i))){var s=ys(i),a=e>=s.left-o&&e<=s.right+o,l=n>=s.top-o&&n<=s.bottom+o;if(a&&l)return r=i}}),r},n8=function(e){function n(o,s){return function(a,l,c,u){var d=a.options.group.name&&l.options.group.name&&a.options.group.name===l.options.group.name;if(o==null&&(s||d))return!0;if(o==null||o===!1)return!1;if(s&&o==="clone")return o;if(typeof o=="function")return n(o(a,l,c,u),s)(a,l,c,u);var p=(s?a:l).options.group.name;return o===!0||typeof o=="string"&&o===p||o.join&&o.indexOf(p)>-1}}var r={},i=e.group;(!i||xC(i)!="object")&&(i={name:i}),r.name=i.name,r.checkPull=n(i.pull,!0),r.checkPut=n(i.put),r.revertClone=i.revertClone,e.group=r},r8=function(){!e8&&ar&&Xn(ar,"display","none")},i8=function(){!e8&&ar&&Xn(ar,"display","")};LC&&!z6&&document.addEventListener("click",function(t){if(kC)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),kC=!1,!1},!0);var Pg=function(e){if(Wt){e=e.touches?e.touches[0]:e;var n=iye(e.clientX,e.clientY);if(n){var r={};for(var i in e)e.hasOwnProperty(i)&&(r[i]=e[i]);r.target=r.rootEl=n,r.preventDefault=void 0,r.stopPropagation=void 0,n[ec]._onDragOver(r)}}},oye=function(e){Wt&&Wt.parentNode[ec]._isOutsideThisEl(e.target)};function Kn(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=xf({},e),t[ec]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return t8(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(s,a){s.setData("Text",a.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:Kn.supportPointer!==!1&&"PointerEvent"in window&&(!A1||YP),emptyInsertThreshold:5};L1.initializePlugins(this,t,n);for(var r in n)!(r in e)&&(e[r]=n[r]);n8(e);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=e.forceFallback?!1:nye,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?ui(t,"pointerdown",this._onTapStart):(ui(t,"mousedown",this._onTapStart),ui(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(ui(t,"dragover",this),ui(t,"dragenter",this)),TC.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),xf(this,Kge())}Kn.prototype={constructor:Kn,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(E0=null)},_getDirection:function(e,n){return typeof this.options.direction=="function"?this.options.direction.call(this,e,n,Wt):this.options.direction},_onTapStart:function(e){if(e.cancelable){var n=this,r=this.el,i=this.options,o=i.preventOnFilter,s=e.type,a=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,l=(a||e).target,c=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||l,u=i.filter;if(fye(r),!Wt&&!(/mousedown|pointerdown/.test(s)&&e.button!==0||i.disabled)&&!c.isContentEditable&&!(!this.nativeDraggable&&A1&&l&&l.tagName.toUpperCase()==="SELECT")&&(l=fh(l,i.draggable,r,!1),!(l&&l.animated)&&SC!==l)){if(w0=xu(l),P1=xu(l,i.draggable),typeof u=="function"){if(u.call(this,e,l,this)){Cl({sortable:n,rootEl:c,name:"filter",targetEl:l,toEl:r,fromEl:r}),tc("filter",n,{evt:e}),o&&e.preventDefault();return}}else if(u&&(u=u.split(",").some(function(d){if(d=fh(c,d.trim(),r,!1),d)return Cl({sortable:n,rootEl:d,name:"filter",targetEl:l,fromEl:r,toEl:r}),tc("filter",n,{evt:e}),!0}),u)){o&&e.preventDefault();return}i.handle&&!fh(c,i.handle,r,!1)||this._prepareDragStart(e,a,l)}}},_prepareDragStart:function(e,n,r){var i=this,o=i.el,s=i.options,a=o.ownerDocument,l;if(r&&!Wt&&r.parentNode===o){var c=ys(r);if(Mo=o,Wt=r,Uo=Wt.parentNode,Ig=Wt.nextSibling,SC=r,CC=s.group,Kn.dragged=Wt,Lg={target:Wt,clientX:(n||e).clientX,clientY:(n||e).clientY},K6=Lg.clientX-c.left,J6=Lg.clientY-c.top,this._lastX=(n||e).clientX,this._lastY=(n||e).clientY,Wt.style["will-change"]="all",l=function(){if(tc("delayEnded",i,{evt:e}),Kn.eventCanceled){i._onDrop();return}i._disableDelayedDragEvents(),!$6&&i.nativeDraggable&&(Wt.draggable=!0),i._triggerDragStart(e,n),Cl({sortable:i,name:"choose",originalEvent:e}),Oc(Wt,s.chosenClass,!0)},s.ignore.split(",").forEach(function(u){H6(Wt,u.trim(),n2)}),ui(a,"dragover",Pg),ui(a,"mousemove",Pg),ui(a,"touchmove",Pg),s.supportPointer?(ui(a,"pointerup",i._onDrop),!this.nativeDraggable&&ui(a,"pointercancel",i._onDrop)):(ui(a,"mouseup",i._onDrop),ui(a,"touchend",i._onDrop),ui(a,"touchcancel",i._onDrop)),$6&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Wt.draggable=!0),tc("delayStart",this,{evt:e}),s.delay&&(!s.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(M1||Sf))){if(Kn.eventCanceled){this._onDrop();return}s.supportPointer?(ui(a,"pointerup",i._disableDelayedDrag),ui(a,"pointercancel",i._disableDelayedDrag)):(ui(a,"mouseup",i._disableDelayedDrag),ui(a,"touchend",i._disableDelayedDrag),ui(a,"touchcancel",i._disableDelayedDrag)),ui(a,"mousemove",i._delayedDragTouchMoveHandler),ui(a,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&ui(a,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(l,s.delay)}else l()}},_delayedDragTouchMoveHandler:function(e){var n=e.touches?e.touches[0]:e;Math.max(Math.abs(n.clientX-this._lastX),Math.abs(n.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Wt&&n2(Wt),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;si(e,"mouseup",this._disableDelayedDrag),si(e,"touchend",this._disableDelayedDrag),si(e,"touchcancel",this._disableDelayedDrag),si(e,"pointerup",this._disableDelayedDrag),si(e,"pointercancel",this._disableDelayedDrag),si(e,"mousemove",this._delayedDragTouchMoveHandler),si(e,"touchmove",this._delayedDragTouchMoveHandler),si(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,n){n=n||e.pointerType=="touch"&&e,!this.nativeDraggable||n?this.options.supportPointer?ui(document,"pointermove",this._onTouchMove):n?ui(document,"touchmove",this._onTouchMove):ui(document,"mousemove",this._onTouchMove):(ui(Wt,"dragend",this),ui(Mo,"dragstart",this._onDragStart));try{document.selection?OC(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,n){if(x0=!1,Mo&&Wt){tc("dragStarted",this,{evt:n}),this.nativeDraggable&&ui(document,"dragover",oye);var r=this.options;!e&&Oc(Wt,r.dragClass,!1),Oc(Wt,r.ghostClass,!0),Kn.active=this,e&&this._appendGhost(),Cl({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(ph){this._lastX=ph.clientX,this._lastY=ph.clientY,r8();for(var e=document.elementFromPoint(ph.clientX,ph.clientY),n=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(ph.clientX,ph.clientY),e!==n);)n=e;if(Wt.parentNode[ec]._isOutsideThisEl(e),n)do{if(n[ec]){var r=void 0;if(r=n[ec]._onDragOver({clientX:ph.clientX,clientY:ph.clientY,target:e,rootEl:n}),r&&!this.options.dragoverBubble)break}e=n}while(n=j6(n));i8()}},_onTouchMove:function(e){if(Lg){var n=this.options,r=n.fallbackTolerance,i=n.fallbackOffset,o=e.touches?e.touches[0]:e,s=ar&&v0(ar,!0),a=ar&&s&&s.a,l=ar&&s&&s.d,c=PC&&Za&&G6(Za),u=(o.clientX-Lg.clientX+i.x)/(a||1)+(c?c[0]-e2[0]:0)/(a||1),d=(o.clientY-Lg.clientY+i.y)/(l||1)+(c?c[1]-e2[1]:0)/(l||1);if(!Kn.active&&!x0){if(r&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))=0&&(Cl({rootEl:Uo,name:"add",toEl:Uo,fromEl:Mo,originalEvent:e}),Cl({sortable:this,name:"remove",toEl:Uo,originalEvent:e}),Cl({rootEl:Uo,name:"sort",toEl:Uo,fromEl:Mo,originalEvent:e}),Cl({sortable:this,name:"sort",toEl:Uo,originalEvent:e})),Ta&&Ta.save()):Dc!==w0&&Dc>=0&&(Cl({sortable:this,name:"update",toEl:Uo,originalEvent:e}),Cl({sortable:this,name:"sort",toEl:Uo,originalEvent:e})),Kn.active&&((Dc==null||Dc===-1)&&(Dc=w0,Fp=P1),Cl({sortable:this,name:"end",toEl:Uo,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){tc("nulling",this),Mo=Wt=Uo=ar=Ig=Bo=SC=Bp=Lg=ph=N1=Dc=Fp=w0=P1=E0=O1=Ta=CC=Kn.dragged=Kn.ghost=Kn.clone=Kn.active=null,IC.forEach(function(e){e.checked=!0}),IC.length=JP=QP=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":Wt&&(this._onDragOver(e),sye(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],n,r=this.el.children,i=0,o=r.length,s=this.options;ii.right+o||t.clientY>r.bottom&&t.clientX>r.left:t.clientY>i.bottom+o||t.clientX>r.right&&t.clientY>r.top}function uye(t,e,n,r,i,o,s,a){var l=r?t.clientY:t.clientX,c=r?n.height:n.width,u=r?n.top:n.left,d=r?n.bottom:n.right,p=!1;if(!s){if(a&&ACu+c*o/2:ld-AC)return-O1}else if(l>u+c*(1-i)/2&&ld-c*o/2)?l>u+c/2?1:-1:0}function hye(t){return xu(Wt)({type:"Text"})},modelValue:{type:Array,default:()=>null},addButtonText:{type:String,default:()=>"Додати"}},emits:["update:modelValue"],setup(t,{emit:e}){var d;const n={"vs-text":Yu,"vs-select":B6,"vs-combobox":wC},r=t,i=e,o=g.ref((d=Array.isArray(r.modelValue)?r.modelValue:[r.modelValue||null])==null?void 0:d.map(p=>({id:y0("multi-text-"),value:p}))),s=g.ref(null);g.onMounted(()=>{s.value&&new Kn(s.value,{handle:".drag-handle",animation:150,ghostClass:"sortable-ghost",onEnd:({oldIndex:p,newIndex:m})=>{if(p!==m){const y=o.value.splice(p,1)[0];o.value.splice(m,0,y)}}})});const a=g.computed(()=>{var p;return(p=o.value)==null?void 0:p.some(m=>!(m!=null&&m.value))}),l=p=>(n==null?void 0:n[`vs-${p==null?void 0:p.toLowerCase()}`])||"div",c=()=>{o.value=[...o.value||[],{id:y0("multi-text-"),value:""}]},u=p=>{var m;o.value=(m=o.value)==null?void 0:m.filter(y=>(y==null?void 0:y.id)!==p)};return g.watch(o,p=>{i("update:modelValue",p.length?p.map(m=>m.value):[])},{deep:!0}),(p,m)=>(g.openBlock(),g.createElementBlock("div",mye,[g.createElementVNode("div",{ref_key:"sortableContainer",ref:s,class:"flex flex-col gap-1"},[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(o.value,y=>{var w;return g.openBlock(),g.createElementBlock("div",{key:y==null?void 0:y.id,class:"flex items-center gap-2 w-full"},[m[0]||(m[0]=g.createStaticVNode('',1)),(g.openBlock(),g.createBlock(g.resolveDynamicComponent(l((w=t.colModel)==null?void 0:w.type)),g.mergeProps({class:"w-full"},{ref_for:!0},t.colModel||{},{modelValue:y.value,"onUpdate:modelValue":x=>y.value=x}),null,16,["modelValue","onUpdate:modelValue"])),g.createElementVNode("button",{onClick:x=>u(y==null?void 0:y.id),class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 duration-300 hover:bg-gray-200"},[g.createVNode(Fa,{height:"16",width:"16"})],8,gye)])}),128))],512),o.value.length?g.createCommentVNode("",!0):(g.openBlock(),g.createElementBlock("span",yye,"Дані для відображення відсутні")),g.createElementVNode("div",vye,[g.createElementVNode("button",{type:"button",onClick:c,disabled:a.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed focus:outline-hidden focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[g.createVNode(R6,{height:"14",width:"14"}),g.createTextVNode(" "+g.toDisplayString(t.addButtonText),1)],8,_ye)])]))}},[["__scopeId","data-v-ef06cd56"]]),bye=Object.assign({inheritAttrs:!1},{__name:"vs-form-autocomplete-wrapper",props:{modelValue:{},modelModifiers:{}},emits:["update:modelValue"],setup(t){const e=g.useModel(t,"modelValue"),n={type:"Combobox"},r=g.ref(1);return g.watch(e,(i,o)=>{(i==null?void 0:i.length)!==(o==null?void 0:o.length)&&(r.value=r.value+1)}),(i,o)=>{var s,a,l;return(a=(s=g.unref(An))==null?void 0:s.autocomplete)!=null&&a.disableAutocomplete?(g.openBlock(),g.createElementBlock(g.Fragment,{key:0},[(l=i.$attrs)!=null&&l.multiple?(g.openBlock(),g.createBlock(h2,g.mergeProps({key:r.value,colModel:{...i.$attrs,...n}},i.$attrs,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c)}),null,16,["colModel","modelValue"])):(g.openBlock(),g.createBlock(wC,g.mergeProps({key:1},i.$attrs,{modelValue:e.value,"onUpdate:modelValue":o[1]||(o[1]=c=>e.value=c)}),null,16,["modelValue"]))],64)):(g.openBlock(),g.createBlock(GP,g.mergeProps({key:1},i.$attrs,{modelValue:e.value,"onUpdate:modelValue":o[2]||(o[2]=c=>e.value=c)}),null,16,["modelValue"]))}}}),wye={class:"flex items-center text-[12px] shrink-0 gap-1 px-[4px] py-[2px] bg-gray-200 rounded max-w-[120px]"},xye={class:"max-w-[120px] text-nowrap overflow-hidden overflow-ellipsis"},Eye={key:1,class:"flex items-center text-[12px] shrink-0 gap-1 px-[4px] py-[2px] bg-gray-200 rounded max-w-[120px]"},Sye={class:"max-w-[120px] text-nowrap overflow-hidden overflow-ellipsis"},Cye={__name:"vs-select-badge",props:{option:{type:Object,required:!0},handleRemove:{type:Function,required:!0}},setup(t){return(e,n)=>{var r,i,o,s,a;return((i=(r=t.option)==null?void 0:r.text)==null?void 0:i.length)>15?(g.openBlock(),g.createBlock(Dp,{key:0,trigger:"hover"},{reference:g.withCtx(()=>{var l,c,u;return[g.createElementVNode("div",wye,[(l=t.option)!=null&&l.color?(g.openBlock(),g.createElementBlock("span",{key:0,class:"rounded-full w-[10px] h-[10px] block",style:g.normalizeStyle({backgroundColor:(c=t.option)==null?void 0:c.color})},null,4)):g.createCommentVNode("",!0),g.createElementVNode("span",xye,g.toDisplayString((u=t.option)==null?void 0:u.text),1),g.createVNode(Fa,{height:"14",width:"14",class:"text-gray-500 duration-100 shrink-0 cursor-pointer hover:text-red-700",onClick:n[0]||(n[0]=g.withModifiers(d=>t.handleRemove(t.option),["stop"]))})])]}),default:g.withCtx(()=>{var l;return[g.createElementVNode("div",null,[g.createElementVNode("p",null,g.toDisplayString((l=t.option)==null?void 0:l.text),1)])]}),_:1})):(g.openBlock(),g.createElementBlock("div",Eye,[(o=t.option)!=null&&o.color?(g.openBlock(),g.createElementBlock("span",{key:0,class:"rounded-full w-[10px] h-[10px] block",style:g.normalizeStyle({backgroundColor:(s=t.option)==null?void 0:s.color})},null,4)):g.createCommentVNode("",!0),g.createElementVNode("span",Sye,g.toDisplayString((a=t.option)==null?void 0:a.text),1),g.createVNode(Fa,{height:"14",width:"14",class:"text-gray-500 duration-100 shrink-0 cursor-pointer hover:text-red-700",onClick:n[1]||(n[1]=g.withModifiers(l=>t.handleRemove(t.option),["stop"]))})]))}}},kye={class:"w-fill bg-white"},Tye={key:0,class:"text-gray-400 absolute top-[50%] translate-y-[-50%] left-[10px]"},Mye={key:1,class:"h-full flex items-center gap-2"},Aye={key:2,class:"flex flex-wrap gap-[5px] items-center w-fit max-w-[calc(100%)]"},Iye=["disabled"],Lye=["disabled"],Pye={key:4,class:"dots-loading absolute top-[50%] translate-y-[-50%] right-[32px]"},Nye=["onClick"],Oye={key:1,class:"p-[10px] text-gray-400 text-center"},Dye={class:"text-blue-500"},Rye=xt(g.defineComponent({__name:"vs-select",props:g.mergeModels({options:{},multiple:{type:Boolean},searchable:{type:[String,Boolean],default:"auto"},clearable:{type:Boolean},prefix:{default:"api"},host:{default:""},data:{default:""},maxHeight:{default:400},parent:{default:""},disabled:{type:Boolean,default:!1},placeholder:{default:"Пошук"},creatable:{type:Boolean,default:!1},hideSelected:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{},loading:{type:Boolean,default:!1},loadingModifiers:{}}),emits:g.mergeModels(["create"],["update:modelValue","update:loading"]),setup(t,{emit:e}){const n=t,r=e,i=g.inject("formValues"),o=g.useModel(t,"modelValue"),s=g.useModel(t,"loading"),a=g.ref(!1),l=g.ref(""),c=g.ref(),u=g.ref([]),d=g.ref(),p=g.ref({}),m=g.ref(-1),y=g.ref([]),w=g.ref(),x=g.ref(null),C=g.ref(!1),S=g.computed(()=>{var oe;return((oe=i==null?void 0:i.value)==null?void 0:oe[n==null?void 0:n.parent])||(i==null?void 0:i[n==null?void 0:n.parent])}),M=g.computed(()=>{var oe;return Lc("bottom-left",c.value,d.value),n.data?n.hideSelected?u.value.filter(he=>{var xe;return!((xe=o.value)!=null&&xe.includes(he==null?void 0:he.id))}):u.value:(oe=n.options)!=null&&oe.length?n.hideSelected?n.options.filter(he=>{var xe;return!((xe=o.value)!=null&&xe.includes(he==null?void 0:he.id))}):n.options.filter(he=>{var xe;return(xe=he==null?void 0:he.text)==null?void 0:xe.toLowerCase().includes(l.value.toLowerCase())}):[]}),E=g.computed(()=>{var oe;return n.searchable=="auto"||n.searchable==null?u.value.length>6||((oe=n.options)==null?void 0:oe.length)>6:n.searchable}),A=async(oe="",he="")=>{s.value=!0;try{const{data:xe}=await un.get(`${n.host}/${n.prefix}/suggest/${n.data}?json=1${oe?"&key="+oe:""}${he?"&val="+he:""}${S.value?"&parent="+S.value:""}`);return xe.data}catch(xe){console.log(xe)}finally{s.value=!1}},I=WS(async oe=>{u.value=await A(oe)},300),O=async()=>{var oe;try{if(n.multiple)(oe=o.value)==null||oe.forEach(async he=>{let xe=[...u.value||[],...n.options||[]].find(Ee=>(Ee==null?void 0:Ee.id)==he);xe?x.value=[...x.value||[],xe]:n.data&&(xe=await A("",he),x.value=[...x.value||[],xe==null?void 0:xe[0]])});else{let he=[...u.value||[],...n.options||[]].find(xe=>(xe==null?void 0:xe.id)==o.value);he?x.value=he:n.data&&(he=await A("",o.value),x.value=he==null?void 0:he[0])}}catch{}},z=oe=>{var he,xe,Ee;n.disabled||(document.body.click(),a.value=oe??!a.value,a.value?(p.value.width=((xe=(he=c.value)==null?void 0:he.getBoundingClientRect())==null?void 0:xe.width)+"px",Lc("bottom-left",c.value,d.value)):m.value=-1,(Ee=w.value)==null||Ee.focus(),C.value=!0)},$=oe=>{var he,xe,Ee;n.multiple?(o.value=(he=o.value)!=null&&he.includes(oe==null?void 0:oe.id)?(xe=o.value)==null?void 0:xe.filter(Ie=>Ie!==(oe==null?void 0:oe.id)):[...o.value||[],oe==null?void 0:oe.id],x.value=(Ee=x.value)!=null&&Ee.find(({id:Ie})=>Ie===(oe==null?void 0:oe.id))?(x.value||[]).filter(({id:Ie})=>Ie!==(oe==null?void 0:oe.id)):[...x.value||[],oe]):(o.value=o.value==(oe==null?void 0:oe.id)?null:oe==null?void 0:oe.id,x.value=o.value==(oe==null?void 0:oe.id)?null:oe),n.multiple||(a.value=!1),l.value=""},W=async()=>{var oe;z(!0),!((oe=n.options)!=null&&oe.length)&&n.data&&I(l.value)},J=()=>{n.disabled||(o.value=null,x.value=null,l.value="",a.value=!1,W())},Z=oe=>{var he,xe;n.disabled||(o.value=(he=o.value)==null?void 0:he.filter(Ee=>Ee!==(oe==null?void 0:oe.id)),x.value=(xe=x.value)==null?void 0:xe.filter(({id:Ee})=>Ee!==(oe==null?void 0:oe.id)))},q=()=>{a.value&&z(!1),C.value=!1},j=(oe,he)=>{if(!oe||!he)return;const xe=oe.offsetTop,Ee=xe+oe.offsetHeight,Ie=he.scrollTop,Oe=Ie+he.clientHeight;xeOe&&(he.scrollTop=Ee-he.clientHeight+4)},G=oe=>{var xe;if(!a.value)return;const{keyCode:he}=oe;if([38,40,13].includes(he)&&oe.preventDefault(),he==38){if(m.value==0)return;m.value=m.value-1,j(y.value[m.value],d.value)}else if(he==40){if(m.value+1>=((xe=M.value)==null?void 0:xe.length))return;m.value=m.value+1,j(y.value[m.value],d.value)}else if(he==13){const Ee=M.value[m.value];Ee&&$(Ee)}},U=async oe=>{if(a.value||!C.value)return;const{keyCode:he}=oe;[38,40].includes(he)&&(await oe.preventDefault(),m.value=0,setTimeout(()=>z()))},Q=oe=>{(oe==null?void 0:oe.key)==="Escape"&&a.value&&z()},re=oe=>{a.value&&d.value&&!d.value.contains(oe.target)&&Lc("bottom-left",c.value,d.value)},le=async()=>{r("create",l.value),l.value="",W()};return g.watch(o,async oe=>{oe&&(x.value=null,O())}),g.onMounted(async()=>{window.addEventListener("click",q),window.addEventListener("keydown",G),window.addEventListener("keydown",U),window.addEventListener("keydown",Q),window.addEventListener("scroll",re,!0),n.data&&(u.value=await A()),o.value&&await O()}),g.onUnmounted(()=>{window.removeEventListener("click",q),window.removeEventListener("keydown",G),window.removeEventListener("keydown",U),window.removeEventListener("keydown",Q),window.removeEventListener("scroll",re,!0)}),(oe,he)=>{var xe,Ee,Ie,Oe,$e;return g.openBlock(),g.createElementBlock("div",kye,[g.createElementVNode("div",{onClick:he[2]||(he[2]=g.withModifiers(Ze=>z(!a.value),["stop"])),class:g.normalizeClass(["min-h-[38px] border ring-ring ring-blue-500 flex flex-wrap duration-100 relative rounded-lg py-[5px] px-[10px] pr-[44px]",[C.value?"ring-2":"ring-0",oe.disabled?"opacity-50 cursor-not-allowed ":"cursor-pointer"]]),ref_key:"selectRef",ref:c},[!l.value&&!x.value?(g.openBlock(),g.createElementBlock("span",Tye,g.toDisplayString(oe.placeholder),1)):g.createCommentVNode("",!0),x.value&&!oe.multiple?(g.openBlock(),g.createElementBlock("div",Mye,[(xe=x.value)!=null&&xe.color?(g.openBlock(),g.createElementBlock("span",{key:0,class:"rounded-full w-[10px] h-[10px] block",style:g.normalizeStyle({backgroundColor:(Ee=x.value)==null?void 0:Ee.color})},null,4)):g.createCommentVNode("",!0),g.createTextVNode(" "+g.toDisplayString((Ie=x.value)==null?void 0:Ie.text),1)])):oe.multiple?(g.openBlock(),g.createElementBlock("div",Aye,[(Oe=x.value)!=null&&Oe.length?(g.openBlock(!0),g.createElementBlock(g.Fragment,{key:0},g.renderList(x.value,Ze=>(g.openBlock(),g.createBlock(Cye,{key:Ze==null?void 0:Ze.id,option:Ze,handleRemove:Z},null,8,["option"]))),128)):g.createCommentVNode("",!0),g.withDirectives(g.createElementVNode("input",{type:"text",onInput:W,onkeydown:"this.style.width = ((this.value.length + 2) * 8) + 'px';",disabled:oe.disabled,"onUpdate:modelValue":he[0]||(he[0]=Ze=>l.value=Ze),ref_key:"inputRef",ref:w,class:"focus:outline-none focus:ring-0 min-w-[10px] w-[10px] max-w-[calc(100%-10px)] overflow-auto focus:border-0 h-auto rounded-lg disabled:opacity-50 disabled:cursor-not-allowed"},null,40,Iye),[[g.vShow,E.value],[g.vModelText,l.value]])])):g.createCommentVNode("",!0),oe.multiple?g.createCommentVNode("",!0):g.withDirectives((g.openBlock(),g.createElementBlock("input",{key:3,type:"text","onUpdate:modelValue":he[1]||(he[1]=Ze=>l.value=Ze),disabled:oe.disabled,onInput:W,ref_key:"inputRef",ref:w,class:g.normalizeClass(["focus:outline-none focus:ring-0 focus:border-0 block h-auto rounded-lg absolute top-0 h-full left-[10px] disabled:opacity-50 disabled:cursor-not-allowed",[l.value?"bg-white":"bg-transparent"]])},null,42,Lye)),[[g.vShow,E.value],[g.vModelText,l.value]]),g.createVNode(Ip,{height:"16",width:"16",class:g.normalizeClass(["absolute top-[50%] translate-y-[-50%] right-[12px] text-gray-500 duration-100",[a.value?"rotate-180":""]])},null,8,["class"]),s.value?(g.openBlock(),g.createElementBlock("div",Pye,he[4]||(he[4]=[g.createElementVNode("span",null,null,-1),g.createElementVNode("span",null,null,-1),g.createElementVNode("span",null,null,-1)]))):oe.clearable&&!oe.disabled&&(l.value||o.value)?(g.openBlock(),g.createBlock(Fa,{key:5,height:"14",width:"14",class:"absolute top-[50%] translate-y-[-50%] right-[32px] text-gray-500 duration-100 cursor-pointer hover:text-red-700",onClick:g.withModifiers(J,["stop"])})):g.createCommentVNode("",!0)],2),(g.openBlock(),g.createBlock(g.Teleport,{to:"#modal"},[g.withDirectives(g.createElementVNode("ul",{onClick:he[3]||(he[3]=g.withModifiers(()=>{},["stop"])),ref_key:"listRef",ref:d,style:g.normalizeStyle(p.value),class:g.normalizeClass(["fixed bg-white rounded-lg border overflow-y-auto z-[10]",[`max-h-[${oe.maxHeight}px]`]])},[($e=M.value)!=null&&$e.length?(g.openBlock(!0),g.createElementBlock(g.Fragment,{key:0},g.renderList(M.value,(Ze,lt)=>{var pt,yt;return g.openBlock(),g.createElementBlock("li",{key:Ze==null?void 0:Ze.id,ref_for:!0,ref:Lt=>y.value[lt]=Lt,class:g.normalizeClass(["p-[10px] hover:bg-gray-100 relative flex items-center gap-2",[oe.multiple?(pt=o.value||[])!=null&&pt.includes(Ze==null?void 0:Ze.id)?"bg-gray-100":"":o.value==(Ze==null?void 0:Ze.id)?"bg-gray-100":"",m.value==lt?"!bg-gray-200":""]]),onClick:Lt=>$(Ze)},[Ze!=null&&Ze.color?(g.openBlock(),g.createElementBlock("span",{key:0,class:"rounded-full w-[10px] h-[10px] block",style:g.normalizeStyle({backgroundColor:Ze==null?void 0:Ze.color})},null,4)):g.createCommentVNode("",!0),g.createTextVNode(" "+g.toDisplayString(Ze==null?void 0:Ze.text)+" ",1),(oe.multiple?(yt=o.value||[])!=null&&yt.includes(Ze==null?void 0:Ze.id):o.value==(Ze==null?void 0:Ze.id))?(g.openBlock(),g.createBlock(cf,{key:1,height:"14",width:"14",class:"absolute top-[50%] translate-y-[-50%] right-[12px] text-blue-500 duration-100"})):g.createCommentVNode("",!0)],10,Nye)}),128)):oe.creatable?g.createCommentVNode("",!0):(g.openBlock(),g.createElementBlock("li",Oye," Нічого не знайдено ")),oe.creatable&&l.value?(g.openBlock(),g.createElementBlock("li",{key:2,onClick:le,class:"p-[10px] text-gray-400 cursor-pointer"},[he[5]||(he[5]=g.createTextVNode(" Створити: ")),g.createElementVNode("span",Dye,g.toDisplayString(l.value),1)])):g.createCommentVNode("",!0)],6),[[g.vShow,a.value]])]))])}}}),[["__scopeId","data-v-772953f6"]]),Bye={},Fye={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-loader-2"};function $ye(t,e){return g.openBlock(),g.createElementBlock("svg",Fye,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M12 3a9 9 0 1 0 9 9"},null,-1)]))}const zye=xt(Bye,[["render",$ye]]),Vye=(t,e)=>e.split(".").reduce((n,r)=>n&&n[r]!==void 0?n[r]:void 0,t),jye=g.defineComponent({components:{VsFormText:Yu,IconLoading:zye},props:{original:{type:Object,default:()=>null},mask:{type:[Object,String],default:()=>""},icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},modelValue:{type:String,default:()=>""},placeholder:{type:String,default:()=>""},iconPosition:{type:String,default:()=>"right"}},computed:{modelState:{get(){return this.modelValue},set(t){(!this.mask.length||!t.length)&&this.$emit("update:modelValue",t)}},placeholderValue(){return this.mask?this.mask.replace(/9/g,"_"):""}},inject:["behaviorValueSetter"],data(){return{loading:!1}},mounted(){this.initMask()},methods:{initMask(){const e=this.$refs.formText.$el.querySelector("input"),n=Rn(e,{mask:this.mask.replace(/9/g,"0"),placeholderChar:"_",lazy:!1});n.on("accept",()=>{const r=n.value.replace(/\_/g,"");this.$emit("update:modelValue",r)})},async onBehaviorButtonClick(){this.loading=!0;const t=this.original.behavior.api.replace("{{value}}",this.modelValue);try{const{data:e}=await un.get(t),n=(e==null?void 0:e.result)||e;if(n){const r=this.original.behavior.set;Object.keys(r).forEach(i=>{let o=r[i];o.startsWith("api.")&&(o=o.slice(4));const s=Vye(n,o);this.behaviorValueSetter(i,s)})}else throw new Error(`The "result" wasn't sent!`);this.$notify({type:"success",title:"Успішно!",message:"Дані завантажено успішно!"})}catch(e){console.error(e),this.$notify({type:"error",title:"Помилка!",message:"При спробі завантажити дані виникла помилка"});const n=this.original.behavior.set;Object.keys(n).forEach(r=>{let i=n[r];i.startsWith("api.")&&(i=i.slice(4)),this.behaviorValueSetter(r,null)})}finally{this.loading=!1}}}}),Uye={class:"flex items-center w-full vs-form-mask flex-wrap md:flex-nowrap"},Hye=["disabled"],Wye={key:0,class:"absolute top-0 bottom-0 left-0 right-0 bg-[rgba(0,0,0,0.3)] flex items-center justify-center rounded-md"};function Gye(t,e,n,r,i,o){var l,c;const s=g.resolveComponent("VsFormText"),a=g.resolveComponent("IconLoading");return g.openBlock(),g.createElementBlock("div",Uye,[g.createVNode(s,{ref:"formText",class:"w-full",icon:t.icon,iconPosition:t.iconPosition,disabled:t.disabled,modelValue:t.modelState,"onUpdate:modelValue":e[0]||(e[0]=u=>t.modelState=u),placeholder:t.placeholderValue,clearable:t.clearable},null,8,["icon","iconPosition","disabled","modelValue","placeholder","clearable"]),(c=(l=t.original)==null?void 0:l.behavior)!=null&&c.button?(g.openBlock(),g.createElementBlock("button",{key:0,class:"vs-button relative inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-blue-500 hover:border-blue-500 hover:bg-blue-500 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 ml-0 md:ml-2 mt-2 md:mt-0 py-[8px] md:w-2/4 whitespace-nowrap w-full",onClick:e[1]||(e[1]=(...u)=>t.onBehaviorButtonClick&&t.onBehaviorButtonClick(...u)),disabled:t.loading},[g.createTextVNode(g.toDisplayString(t.original.behavior.button)+" ",1),t.loading?(g.openBlock(),g.createElementBlock("span",Wye,[g.createVNode(a,{class:"text-blue-500 animate-spin"})])):g.createCommentVNode("",!0)],8,Hye)):g.createCommentVNode("",!0)])}const a8=xt(jye,[["render",Gye]]),l8=xt(g.defineComponent({__name:"vs-form-checkbox",props:{options:{type:Array,default:()=>[]},modelValue:{type:[Boolean,Array],default:!1},position:{default:()=>"vertical"},slots:{type:Object,default:()=>null},view:{type:String,default:()=>null},colSpan:{type:Number,default:()=>0},data:{type:String,default:()=>null}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=g.ref([]),o=g.reactive({}),s=u=>(u==null?void 0:u.value)||(u==null?void 0:u.id)||(u==null?void 0:u.text)||u,a=u=>u.text||String(u),l=u=>`lg:col-span-${u||12}`,c=async()=>{try{const{data:u}=await un.get(`/api/suggest/${n.data}`);i.value=(u==null?void 0:u.data)||u}catch(u){console.error(u)}};return g.watch(()=>n.modelValue,u=>{if(typeof u=="boolean"&&i.value.length===1){const d=s(i.value[0]);o[d]=u}else if(Array.isArray(u)){const d=new Set(u);i.value.forEach(p=>{if(!p.disabled){const m=s(p);o[m]=d.has(m)}})}},{immediate:!0}),g.watch(o,()=>{if(!i.value.length){r("update:modelValue",null);return}const u=Object.entries(o).filter(([,d])=>d).map(([d])=>d);r("update:modelValue",u.length===0?null:u)},{deep:!0}),g.onMounted(()=>{if(n.data)c().then(()=>{if(typeof n.modelValue=="boolean"&&i.value.length===1){const u=s(i.value[0]);o[u]=n.modelValue}else if(Array.isArray(n.modelValue)){const u=new Set(n.modelValue);i.value.forEach(d=>{if(!d.disabled){const p=s(d);o[p]=u.has(p)}})}});else if(i.value=n.options,typeof n.modelValue=="boolean"&&i.value.length===1){const u=s(i.value[0]);o[u]=n.modelValue}else if(Array.isArray(n.modelValue)){const u=new Set(n.modelValue);i.value.forEach(d=>{if(!d.disabled){const p=s(d);o[p]=u.has(p)}})}}),(u,d)=>(g.openBlock(),g.createElementBlock("div",{class:g.normalizeClass(["p-0 w-full gap-[6px]",[t.position==="vertical"?"flex-col":"",t.colSpan?"grid":"flex justify-start"]])},[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(i.value,p=>(g.openBlock(),g.createBlock(m1,{modelValue:o[s(p)],"onUpdate:modelValue":m=>o[s(p)]=m,value:s(p),class:g.normalizeClass(l(t.colSpan)),disabled:p.disabled,label:a(p),key:s(p),icon:p==null?void 0:p.icon,imgUrl:p==null?void 0:p.imgUrl,option:p,slots:t.slots,view:t.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","slots","view"]))),128))],2))}}),[["__scopeId","data-v-57effeeb"]]),c8=g.defineComponent({inheritAttrs:!1,__name:"vs-form-radio",props:{options:{type:Array,default:()=>[]},modelValue:null,size:{type:String},position:{default:()=>"horizontal"},view:{type:String},data:{type:String},slots:{type:Object,default:()=>null},style:{type:Object,default:()=>null},componentKey:{type:String}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=g.inject("formValuesOption"),i=e,o=g.computed({get:()=>n.modelValue,set:u=>i("update:modelValue",u)}),s=g.ref([]);if(!n.modelValue){const u=n.options[0];i("update:modelValue",a(u))}function a(u){return(u==null?void 0:u.id)||(u==null?void 0:u.value)||u}function l(u){return(u==null?void 0:u.text)||(u==null?void 0:u.label)||typeof u=="string"&&u||""}const c=async()=>{try{const{data:u}=await un.get(`/api/suggest/${n.data}`);s.value=(u==null?void 0:u.data)||u}catch{}};return g.watch(()=>n.modelValue,u=>{var d;r&&(r[n.componentKey]=((d=n.options)==null?void 0:d.find(p=>(p==null?void 0:p.id)===u||(p==null?void 0:p.value)===u))||u)}),g.onMounted(()=>{var u;n!=null&&n.data?c():s.value=n.options,r&&(r[n.componentKey]=((u=n.options)==null?void 0:u.find(d=>(d==null?void 0:d.id)===n.modelValue||(d==null?void 0:d.value)===n.modelValue))||n.modelValue)}),(u,d)=>{var p;return(p=s.value)!=null&&p.length?(g.openBlock(),g.createElementBlock("div",{key:0,class:g.normalizeClass(["flex flex-wrap w-full",[t.position==="horizontal"?"flex-row":"flex-col",t.view==="tabs"?" transition rounded-sm border py-0":t.size==="xs"?"gap-[5px]":"gap-[10px]"]])},[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(s.value,(m,y)=>{var w,x;return g.openBlock(),g.createBlock(aP,{modelValue:o.value,"onUpdate:modelValue":d[0]||(d[0]=C=>o.value=C),label:l(m),value:a(m),key:(m==null?void 0:m.id)||y,disabled:m==null?void 0:m.disabled,info:m==null?void 0:m.info,view:t.view,icon:m==null?void 0:m.icon,img:m==null?void 0:m.img,length:(w=s.value)==null?void 0:w.length,slots:t.slots,option:m,style:g.normalizeStyle(t.style),size:t.size,class:g.normalizeClass([((x=t.style)==null?void 0:x.class)||""])},null,8,["modelValue","label","value","disabled","info","view","icon","img","length","slots","option","style","size","class"])}),128))],2)):g.createCommentVNode("",!0)}}}),qye={components:{VsText:Yu},props:{defaultValue:{type:String,default:()=>""},modelValue:{type:String,default:t=>t.defaultValue},icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},placeholder:{type:[String,Object],default:()=>""},iconPosition:{type:String,default:()=>"right"},style:{type:Object,default:()=>null}},computed:{value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}},placeholderValue(){var t;return((t=this.placeholder)==null?void 0:t.ua)||this.placeholder}},mounted(){this.modelValue&&this.$emit("update:modelValue",this.modelValue)}};function Yye(t,e,n,r,i,o){const s=g.resolveComponent("VsText");return g.openBlock(),g.createBlock(s,{modelValue:o.value,"onUpdate:modelValue":e[0]||(e[0]=a=>o.value=a),icon:n.icon,iconPosition:n.iconPosition,disabled:n.disabled,placeholder:o.placeholderValue,style:g.normalizeStyle(n.style)},null,8,["modelValue","icon","iconPosition","disabled","placeholder","style"])}const Zye=xt(qye,[["render",Yye]]),Xye=["onClick"],Kye={class:"mt-3 text-end"},u8=xt(g.defineComponent({__name:"vs-form-list",props:g.mergeModels({schema:{type:Object},addText:{type:String,default:()=>""}},{modelValue:{default:[]},modelModifiers:{}}),emits:g.mergeModels(["change"],["update:modelValue"]),setup(t,{emit:e}){const n=e,r=g.defineAsyncComponent(()=>Promise.resolve().then(()=>Sj)),i=t,o=g.useModel(t,"modelValue"),s=()=>{var c;const l=(c=Object.keys(i.schema))==null?void 0:c.reduce((u,d)=>({...u,[d]:""}),{});o.value=[...o.value,l]},a=l=>{var c;(c=o.value)==null||c.splice(l,1),n("change",o)};return(l,c)=>(g.openBlock(),g.createElementBlock("div",null,[g.createVNode(g.TransitionGroup,{name:"list",tag:"div",class:"flex flex-col"},{default:g.withCtx(()=>[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(Object.keys(o.value),(u,d)=>(g.openBlock(),g.createElementBlock("div",{key:d,class:"text-xs flex items-center relative mb-2 last:mb-0"},[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(Object.keys(o.value[d]),p=>(g.openBlock(),g.createBlock(g.unref(r),{class:"w-full last:mr-0 mr-2",modelValue:o.value[d],"onUpdate:modelValue":m=>o.value[d]=m,modelModifiers:{lazy:!0},key:p,data:t.schema[p]},null,8,["modelValue","onUpdate:modelValue","data"]))),128)),g.createElementVNode("button",{class:"h-[30px] w-[30px] rounded-full border flex items-center shrink-0 justify-center hover:bg-gray-100",onClick:p=>a(d)},[g.createVNode(Fa,{height:"16",width:"16"})],8,Xye)]))),128))]),_:1}),g.createElementVNode("p",Kye,[g.createElementVNode("button",{type:"button",onClick:s,class:"py-1.5 px-5 inline-flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 focus:outline-none focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},g.toDisplayString(t.addText||"Add"),1)])]))}}),[["__scopeId","data-v-2db0c512"]]),Jye={props:{modelValue:{type:String,default:()=>""},clearable:{type:Boolean,default:()=>!1},disabled:{type:Boolean,default:()=>!1},placeholder:{type:String,default:()=>"Введіть текст..."},minHeight:{type:String,default:()=>"38px"},maxHeight:{type:String,default:()=>"150px"}},data(){return{}},computed:{value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t||null)}}},methods:{clearInput(){this.$emit("update:modelValue","")}}},Qye={class:"vs-form-textarea relative"},eve=["placeholder","disabled"];function tve(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",Qye,[n.clearable&&o.value?(g.openBlock(),g.createElementBlock("i",{key:0,class:g.normalizeClass(["absolute top-1/8 translate-y-2/4 ti ti-x right-4",{"pointer-events-none":n.disabled}]),onClick:e[0]||(e[0]=(...s)=>o.clearInput&&o.clearInput(...s))},null,2)):g.createCommentVNode("",!0),g.withDirectives(g.createElementVNode("textarea",{"onUpdate:modelValue":e[1]||(e[1]=s=>o.value=s),class:"py-2 px-3 block border border-solid text-stone-800 w-full border-stone-200 rounded-lg text-sm focus:outline-0 placeholder:text-stone-500 focus:border-blue-600 dark:bg-neutral-800 focus:border-blue-600 dark:text-neutral-200 dark:placeholder:text-neutral-500 dark:focus:outline-none dark:focus:ring-1 dark:focus:ring-neutral-600",rows:"3",placeholder:n.placeholder,disabled:n.disabled,style:g.normalizeStyle({"min-height":n.minHeight,"max-height":n.maxHeight})},null,12,eve),[[g.vModelText,o.value]])])}const nve=xt(Jye,[["render",tve]]),rve={props:{min:{type:Number},step:{type:Number,default:()=>1},max:{type:Number,default:()=>1/0},modelValue:{type:Number,default:()=>null},label:{type:String,default:()=>""},placeholder:{type:String,default:()=>"0"},disabled:{type:Boolean,default:()=>!1}},data(){return{id:`input-number-${Math.floor(Math.random()*1e3)}`,inputValue:this.modelValue}},watch:{modelValue(t){this.inputValue=t},inputValue(t){this.$emit("update:modelValue",t)}},methods:{validateInput(t){(t.key==="+"||t.key===","||t.key==="-"&&this.inputValue&&this.inputValue.toString().length>0)&&t.preventDefault()},handleBlur(){let t=parseFloat(this.inputValue);this.$emit("blur"),isNaN(t)?t=this.min:t>this.max?t=this.max:ti.inputValue=s),type:"number",onKeydown:e[1]||(e[1]=(...s)=>o.validateInput&&o.validateInput(...s)),onBlur:e[2]||(e[2]=(...s)=>o.handleBlur&&o.handleBlur(...s)),step:n.step,min:n.min,max:n.max,id:i.id,"aria-describedby":"helper-text-explanation",class:g.normalizeClass(["vs-number__input py-2 px-3 block w-full h-[38px] border border-solid border-stone-200 rounded-lg text-sm text-stone-800 placeholder:text-stone-500 focus:z-10 focus:border-1 focus:outline-none focus:border-blue-600 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-200 dark:placeholder:text-neutral-500 dark:focus:outline-none dark:focus:ring-1 dark:focus:ring-neutral-600",{"cursor-not-allowed":n.disabled}]),placeholder:n.placeholder,disabled:n.disabled},null,42,ove),[[g.vModelText,i.inputValue]])])}const h8=xt(rve,[["render",sve]]),Kt=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),d2=function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,n=window.getComputedStyle(t).overflowY,r=n.indexOf("hidden")!==-1,i=n.indexOf("visible")!==-1;return e&&!r&&!i},BC=function(t,e=void 0){return!(!t||t===document.body||e&&t===e)&&(d2(t)?t:BC(t.parentElement,e))},cd=function(t){var e=new DOMParser().parseFromString(t,"text/html").body;if(e.childElementCount>1){for(var n=document.createElement("div");e.firstChild;)n.appendChild(e.firstChild);return n}return e.firstChild},f2=t=>`${t||""}`.split(" ").filter(e=>!!e),ud=(t,e,n)=>{t&&f2(e).forEach(r=>{t.classList.toggle(r,n||!1)})};class S0{constructor(e){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=e,this.pageX=e.pageX,this.pageY=e.pageY,this.clientX=e.clientX,this.clientY=e.clientY,this.id=self.Touch&&e instanceof Touch?e.identifier:-1,this.time=Date.now()}}const C0={passive:!1};class ave{constructor(e,{start:n=()=>!0,move:r=()=>{},end:i=()=>{}}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=e,this.startCallback=n,this.moveCallback=r,this.endCallback=i;for(const o of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[o]=this[o].bind(this);this.element.addEventListener("mousedown",this.onPointerStart,C0),this.element.addEventListener("touchstart",this.onTouchStart,C0),this.element.addEventListener("touchmove",this.onMove,C0),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd)}onPointerStart(e){if(!e.buttons||e.button!==0)return;const n=new S0(e);this.currentPointers.some(r=>r.id===n.id)||this.triggerPointerStart(n,e)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(e){for(const n of Array.from(e.changedTouches||[]))this.triggerPointerStart(new S0(n),e);window.addEventListener("blur",this.onWindowBlur)}onMove(e){const n=this.currentPointers.slice(),r="changedTouches"in e?Array.from(e.changedTouches||[]).map(o=>new S0(o)):[new S0(e)],i=[];for(const o of r){const s=this.currentPointers.findIndex(a=>a.id===o.id);s<0||(i.push(o),this.currentPointers[s]=o)}i.length&&this.moveCallback(e,this.currentPointers.slice(),n)}onPointerEnd(e){e.buttons>0&&e.button!==0||(this.triggerPointerEnd(e,new S0(e)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(e){for(const n of Array.from(e.changedTouches||[]))this.triggerPointerEnd(e,new S0(n))}triggerPointerStart(e,n){return!!this.startCallback(n,e,this.currentPointers.slice())&&(this.currentPointers.push(e),this.startPointers.push(e),!0)}triggerPointerEnd(e,n){const r=this.currentPointers.findIndex(i=>i.id===n.id);r<0||(this.currentPointers.splice(r,1),this.startPointers.splice(r,1),this.endCallback(e,n,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const e=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:e.clientX,clientY:e.clientY}),e,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,C0),this.element.removeEventListener("touchstart",this.onTouchStart,C0),this.element.removeEventListener("touchmove",this.onMove,C0),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function d8(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function f8(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const p2=t=>typeof t=="object"&&t!==null&&t.constructor===Object&&Object.prototype.toString.call(t)==="[object Object]",nc=(t,...e)=>{const n=e.length;for(let r=0;r{const a=Array.isArray(s)?[]:{};t[o]||Object.assign(t,{[o]:a}),p2(s)?Object.assign(t[o],nc(a,s)):Array.isArray(s)?Object.assign(t,{[o]:[...s]}):Object.assign(t,{[o]:s})})}return t},m2=function(t,e){return t.split(".").reduce((n,r)=>typeof n=="object"?n[r]:void 0,e)};class FC{constructor(e={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(e);for(const n of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))n.startsWith("on")&&typeof this[n]=="function"&&(this[n]=this[n].bind(this))}setOptions(e){this.options=e?nc({},this.constructor.defaults,e):{};for(const[n,r]of Object.entries(this.option("on")||{}))this.on(n,r)}option(e,...n){let r=m2(e,this.options);return r&&typeof r=="function"&&(r=r.call(this,this,...n)),r}optionFor(e,n,r,...i){let o=m2(n,e);var s;typeof(s=o)!="string"||isNaN(s)||isNaN(parseFloat(s))||(o=parseFloat(o)),o==="true"&&(o=!0),o==="false"&&(o=!1),o&&typeof o=="function"&&(o=o.call(this,this,e,...i));let a=m2(n,this.options);return a&&typeof a=="function"?o=a.call(this,this,e,...i,o):o===void 0&&(o=a),o===void 0?r:o}cn(e){const n=this.options.classes;return n&&n[e]||""}localize(e,n=[]){e=String(e).replace(/\{\{(\w+).?(\w+)?\}\}/g,(r,i,o)=>{let s="";return o?s=this.option(`${i[0]+i.toLowerCase().substring(1)}.l10n.${o}`):i&&(s=this.option(`l10n.${i}`)),s||(s=r),s});for(let r=0;ri)}on(e,n){let r=[];typeof e=="string"?r=e.split(" "):Array.isArray(e)&&(r=e),this.events||(this.events=new Map),r.forEach(i=>{let o=this.events.get(i);o||(this.events.set(i,[]),o=[]),o.includes(n)||o.push(n),this.events.set(i,o)})}off(e,n){let r=[];typeof e=="string"?r=e.split(" "):Array.isArray(e)&&(r=e),r.forEach(i=>{const o=this.events.get(i);if(Array.isArray(o)){const s=o.indexOf(n);s>-1&&o.splice(s,1)}})}emit(e,...n){[...this.events.get(e)||[]].forEach(r=>r(this,...n)),e!=="*"&&this.emit("*",e,...n)}}Object.defineProperty(FC,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.36"}),Object.defineProperty(FC,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class g2 extends FC{constructor(e={}){super(e),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(e={}){const n=new Map;for(const[r,i]of Object.entries(e)){const o=this.option(r),s=this.plugins[r];s||o===!1?s&&o===!1&&(s.detach(),delete this.plugins[r]):n.set(r,new i(this,o||{}))}for(const[r,i]of n)this.plugins[r]=i,i.attach()}detachPlugins(e){e=e||Object.keys(this.plugins);for(const n of e){const r=this.plugins[n];r&&r.detach(),delete this.plugins[n]}return this.emit("detachPlugins"),this}}var Ni;(function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"})(Ni||(Ni={}));const Cf=["a","b","c","d","e","f"],p8={PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"},lve={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:p8},m8='',y2='
'+m8+m8+"
",rc=t=>t&&t!==null&&t instanceof Element&&"nodeType"in t,Ii=(t,e)=>{t&&f2(e).forEach(n=>{t.classList.remove(n)})},Tn=(t,e)=>{t&&f2(e).forEach(n=>{t.classList.add(n)})},$C={a:1,b:0,c:0,d:1,e:0,f:0},cve=1e5,zC=1e4,Eu="mousemove",g8="drag",y8="content",Su="auto";let v2=null,_2=null;class $p extends g2{get fits(){return this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1}get isTouchDevice(){return _2===null&&(_2=window.matchMedia("(hover: none)").matches),_2}get isMobile(){return v2===null&&(v2=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),v2}get panMode(){return this.options.panMode!==Eu||this.isTouchDevice?g8:Eu}get panOnlyZoomed(){const e=this.options.panOnlyZoomed;return e===Su?this.isTouchDevice:e}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:e,b:n}=this.current;return Math.sqrt(e*e+n*n)||1}get targetScale(){const{a:e,b:n}=this.target;return Math.sqrt(e*e+n*n)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:e}=this;return e.fullWidth/e.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:e,contentRect:n}=this,r=Math.max(e.height/n.fitHeight,e.width/n.fitWidth)||1;return Math.min(this.fullScale,r)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){const e=this.content;return!!(e&&e instanceof HTMLImageElement)&&!e.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const e of Cf){const n=e=="e"||e==="f"?1e-4:1e-5;if(Math.abs(this.target[e]-this.current[e])>n)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(e,n={},r={}){var i;if(super(n),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pwt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"cwd",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"pmme",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Ni.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},$C)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},$C)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!e)throw new Error("Container Element Not Found");this.container=e,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},$p.Plugins),r)),this.emit("attachPlugins"),this.emit("init");const o=this.content;if(o.addEventListener("load",this.onLoad),o.addEventListener("error",this.onError),this.isContentLoading){if(this.option("spinner")){e.classList.add(this.cn("isLoading"));const s=cd(y2);!e.contains(o)||o.parentElement instanceof HTMLPictureElement?this.spinner=e.appendChild(s):this.spinner=((i=o.parentElement)===null||i===void 0?void 0:i.insertBefore(s,o))||null}this.emit("beforeLoad")}else queueMicrotask(()=>{this.enable()})}initContent(){const{container:e}=this,n=this.cn(y8);let r=this.option(y8)||e.querySelector(`.${n}`);if(r||(r=e.querySelector("img,picture")||e.firstElementChild,r&&Tn(r,n)),r instanceof HTMLPictureElement&&(r=r.querySelector("img")),!r)throw new Error("No content found");this.content=r}onLoad(){const{spinner:e,container:n,state:r}=this;e&&(e.remove(),this.spinner=null),this.option("spinner")&&n.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),r===Ni.Init?this.enable():this.updateMetrics()}onError(){this.state!==Ni.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=Ni.Error,this.emit("error"))}getNextScale(e){const{fullScale:n,targetScale:r,coverScale:i,maxScale:o,minScale:s}=this;let a=s;switch(e){case"toggleMax":a=r-s<.5*(o-s)?o:s;break;case"toggleCover":a=r-s<.5*(i-s)?i:s;break;case"toggleZoom":a=r-s<.5*(n-s)?n:s;break;case"iterateZoom":let l=[1,n,o].sort((u,d)=>u-d),c=l.findIndex(u=>u>r+1e-5);a=l[c]||1}return a}attachObserver(){var e;const n=()=>{const{container:r,containerRect:i}=this;return Math.abs(i.width-r.getBoundingClientRect().width)>.1||Math.abs(i.height-r.getBoundingClientRect().height)>.1};this.resizeObserver||window.ResizeObserver===void 0||(this.resizeObserver=new ResizeObserver(()=>{this.updateTimer||(n()?(this.onResize(),this.isMobile&&(this.updateTimer=setTimeout(()=>{n()&&this.onResize(),this.updateTimer=null},500))):this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null))})),(e=this.resizeObserver)===null||e===void 0||e.observe(this.container)}detachObserver(){var e;(e=this.resizeObserver)===null||e===void 0||e.disconnect()}attachEvents(){const{container:e}=this;e.addEventListener("click",this.onClick,{passive:!1,capture:!1}),e.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new ave(e,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener(Eu,this.onMouseMove)}detachEvents(){var e;const{container:n}=this;n.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),n.removeEventListener("wheel",this.onWheel,{passive:!1}),(e=this.pointerTracker)===null||e===void 0||e.stop(),this.pointerTracker=null,document.removeEventListener(Eu,this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const e=this.friction,n=this.option("maxVelocity");for(const r of Cf)e?(this.velocity[r]*=1-e,n&&!this.isScaling&&(this.velocity[r]=Math.max(Math.min(this.velocity[r],n),-1*n)),this.current[r]+=this.velocity[r]):this.current[r]=this.target[r];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame(()=>this.animate()):this.stop("current")}setTargetForce(){for(const e of Cf)e==="e"&&this.isBouncingX||e==="f"&&this.isBouncingY||(this.velocity[e]=(1/(1-this.friction)-1)*(this.target[e]-this.current[e]))}checkBounds(e=0,n=0){const{current:r}=this,i=r.e+e,o=r.f+n,s=this.getBounds(),{x:a,y:l}=s,c=a.min,u=a.max,d=l.min,p=l.max;let m=0,y=0;return c!==1/0&&iu&&(m=u-i),d!==1/0&&op&&(y=p-o),Math.abs(m)<1e-4&&(m=0),Math.abs(y)<1e-4&&(y=0),Object.assign(Object.assign({},s),{xDiff:m,yDiff:y,inBounds:!m&&!y})}clampTargetBounds(){const{target:e}=this,{x:n,y:r}=this.getBounds();n.min!==1/0&&(e.e=Math.max(e.e,n.min)),n.max!==1/0&&(e.e=Math.min(e.e,n.max)),r.min!==1/0&&(e.f=Math.max(e.f,r.min)),r.max!==1/0&&(e.f=Math.min(e.f,r.max))}calculateContentDim(e=this.current){const{content:n,contentRect:r}=this,{fitWidth:i,fitHeight:o,fullWidth:s,fullHeight:a}=r;let l=s,c=a;if(this.option("zoom")||this.angle!==0){const u=!(n instanceof HTMLImageElement)&&(window.getComputedStyle(n).maxWidth==="none"||window.getComputedStyle(n).maxHeight==="none"),d=u?s:i,p=u?a:o,m=this.getMatrix(e),y=new DOMPoint(0,0).matrixTransform(m),w=new DOMPoint(0+d,0).matrixTransform(m),x=new DOMPoint(0+d,0+p).matrixTransform(m),C=new DOMPoint(0,0+p).matrixTransform(m),S=Math.abs(x.x-y.x),M=Math.abs(x.y-y.y),E=Math.abs(C.x-w.x),A=Math.abs(C.y-w.y);l=Math.max(S,E),c=Math.max(M,A)}return{contentWidth:l,contentHeight:c}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||this.panMode===Eu||this.targetScale{const m=window.getSelection();return m&&m.type==="Range"})()&&!r.closest("button"))return;const i=r.closest("[data-panzoom-action]"),o=r.closest("[data-panzoom-change]"),s=i||o,a=s&&rc(s)?s.dataset:null;if(a){const m=a.panzoomChange,y=a.panzoomAction;if((m||y)&&e.preventDefault(),m){let w={};try{w=JSON.parse(m)}catch{console&&console.warn("The given data was not valid JSON")}return void this.applyChange(w)}if(y)return void(this[y]&&this[y]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return e.preventDefault(),void e.stopPropagation();if(r.closest("[data-fancybox]"))return;const l=this.content.getBoundingClientRect(),c=this.dragStart;if(c.time&&!this.canZoomOut()&&(Math.abs(l.x-c.x)>2||Math.abs(l.y-c.y)>2))return;this.dragStart.time=0;const u=m=>{this.option("zoom",e)&&m&&typeof m=="string"&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(m)&&typeof this[m]=="function"&&(e.preventDefault(),this[m]({event:e}))},d=this.option("click",e),p=this.option("dblClick",e);p?(this.clicks++,this.clicks==1&&(this.clickTimer=setTimeout(()=>{this.clicks===1?(this.emit("click",e),!e.defaultPrevented&&d&&u(d)):(this.emit("dblClick",e),e.defaultPrevented||u(p)),this.clicks=0,this.clickTimer=null},350))):(this.emit("click",e),!e.defaultPrevented&&d&&u(d))}addTrackingPoint(e){const n=this.trackingPoints.filter(r=>r.time>Date.now()-100);n.push(e),this.trackingPoints=n}onPointerDown(e,n,r){var i;if(this.option("touch",e)===!1)return!1;this.pwt=0,this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const o=this.content.getBoundingClientRect();if(this.dragStart={x:o.x,y:o.y,top:o.top,left:o.left,time:Date.now()},this.clickTimer)return!1;if(this.panMode===Eu&&this.targetScale>1)return e.preventDefault(),e.stopPropagation(),!1;const s=e.composedPath()[0];if(!r.length){if(["TEXTAREA","OPTION","INPUT","SELECT","VIDEO","IFRAME"].includes(s.nodeName)||s.closest("[contenteditable],[data-selectable],[data-draggable],[data-clickable],[data-panzoom-change],[data-panzoom-action]"))return!1;(i=window.getSelection())===null||i===void 0||i.removeAllRanges()}if(e.type==="mousedown")["A","BUTTON"].includes(s.nodeName)||e.preventDefault();else if(Math.abs(this.velocity.a)>.3)return!1;return this.target.e=this.current.e,this.target.f=this.current.f,this.stop(),this.isDragging||(this.isDragging=!0,this.addTrackingPoint(n),this.emit("touchStart",e)),!0}onPointerMove(e,n,r){if(this.option("touch",e)===!1||!this.isDragging||n.length<2&&this.panOnlyZoomed&&Kt(this.targetScale)<=Kt(this.minScale)||(this.emit("touchMove",e),e.defaultPrevented))return;this.addTrackingPoint(n[0]);const{content:i}=this,o=f8(r[0],r[1]),s=f8(n[0],n[1]);let a=0,l=0;if(n.length>1){const M=i.getBoundingClientRect();a=o.clientX-M.left-.5*M.width,l=o.clientY-M.top-.5*M.height}const c=d8(r[0],r[1]),u=d8(n[0],n[1]);let d=c?u/c:1,p=s.clientX-o.clientX,m=s.clientY-o.clientY;this.dragOffset.x+=p,this.dragOffset.y+=m,this.dragOffset.time=Date.now()-this.dragStart.time;let y=Kt(this.targetScale)===Kt(this.minScale)&&this.option("lockAxis");if(y&&!this.lockedAxis)if(y==="xy"||y==="y"||e.type==="touchmove"){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void e.preventDefault();const M=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=M>45&&M<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,p=0,m=0}else this.lockedAxis=y;if(BC(e.target,this.content)&&(y="x",this.dragOffset.y=0),y&&y!=="xy"&&this.lockedAxis!==y&&Kt(this.targetScale)===Kt(this.minScale))return;e.cancelable&&e.preventDefault(),this.container.classList.add(this.cn("isDragging"));const w=this.checkBounds(p,m);this.option("rubberband")?(this.isInfinite!=="x"&&(w.xDiff>0&&p<0||w.xDiff<0&&p>0)&&(p*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*w.xDiff))),this.isInfinite!=="y"&&(w.yDiff>0&&m<0||w.yDiff<0&&m>0)&&(m*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*w.yDiff)))):(w.xDiff&&(p=0),w.yDiff&&(m=0));const x=this.targetScale,C=this.minScale,S=this.maxScale;x<.5*C&&(d=Math.max(d,C)),x>1.5*S&&(d=Math.min(d,S)),this.lockedAxis==="y"&&Kt(x)===Kt(C)&&(p=0),this.lockedAxis==="x"&&Kt(x)===Kt(C)&&(m=0),this.applyChange({originX:a,originY:l,panX:p,panY:m,scale:d,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(e,n,r){if(r.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.addTrackingPoint(n),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),BC(e.target,this.content)&&this.lockedAxis==="y"&&(this.trackingPoints=[]),this.emit("touchEnd",e),this.isDragging=!1,this.lockedAxis=!1,this.state!==Ni.Destroy&&(e.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){var e;const n=this.isScaling;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const M of Cf)this.velocity[M]=0;this.target.e=this.current.e,this.target.f=this.current.f,Ii(this.container,"is-scaling"),Ii(this.container,"is-animating"),this.isTicking=!1;const{trackingPoints:r}=this,i=r[0],o=r[r.length-1];let s=0,a=0,l=0;o&&i&&(s=o.clientX-i.clientX,a=o.clientY-i.clientY,l=o.time-i.time);const c=((e=window.visualViewport)===null||e===void 0?void 0:e.scale)||1;c!==1&&(s*=c,a*=c);let u=0,d=0,p=0,m=0,y=this.option("decelFriction");const w=this.targetScale;if(l>0){p=Math.abs(s)>3?s/(l/30):0,m=Math.abs(a)>3?a/(l/30):0;const M=this.option("maxVelocity");M&&(p=Math.max(Math.min(p,M),-1*M),m=Math.max(Math.min(m,M),-1*M))}p&&(u=p/(1/(1-y)-1)),m&&(d=m/(1/(1-y)-1)),(this.option("lockAxis")==="y"||this.option("lockAxis")==="xy"&&this.lockedAxis==="y"&&Kt(w)===this.minScale)&&(u=p=0),(this.option("lockAxis")==="x"||this.option("lockAxis")==="xy"&&this.lockedAxis==="x"&&Kt(w)===this.minScale)&&(d=m=0);const x=this.dragOffset.x,C=this.dragOffset.y,S=this.option("dragMinThreshold")||0;Math.abs(x)this.maxScale+1e-5)||n&&!u&&!d)&&(y=.35),this.applyChange({panX:u,panY:d,friction:y}),this.emit("decel",p,m,x,C)}onWheel(e){var n=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(o,s){return Math.abs(s)>Math.abs(o)?s:o});const r=Math.max(-1,Math.min(1,n));if(this.emit("wheel",e,r),this.panMode===Eu||e.defaultPrevented)return;const i=this.option("wheel");i==="pan"?(e.preventDefault(),this.panOnlyZoomed&&!this.canZoomOut()||this.applyChange({panX:2*-e.deltaX,panY:2*-e.deltaY,bounce:!1})):i==="zoom"&&this.option("zoom")!==!1&&this.zoomWithWheel(e)}onMouseMove(e){this.panWithMouse(e)}onKeydown(e){e.key==="Escape"&&this.toggleFS()}onResize(){this.updateMetrics(),this.checkBounds().inBounds||this.requestTick()}setTransform(){this.emit("beforeTransform");const{current:e,target:n,content:r,contentRect:i}=this,o=Object.assign({},$C);for(const x of Cf){const C=x=="e"||x==="f"?zC:cve;o[x]=Kt(e[x],C),Math.abs(n[x]-e[x])<(x=="e"||x==="f"?.51:.001)&&(e[x]=n[x])}let{a:s,b:a,c:l,d:c,e:u,f:d}=o,p=`matrix(${s}, ${a}, ${l}, ${c}, ${u}, ${d})`,m=r.parentElement instanceof HTMLPictureElement?r.parentElement:r;if(this.option("transformParent")&&(m=m.parentElement||m),m.style.transform===p)return;m.style.transform=p;const{contentWidth:y,contentHeight:w}=this.calculateContentDim();i.width=y,i.height=w,this.emit("afterTransform")}updateMetrics(e=!1){var n;if(!this||this.state===Ni.Destroy||this.isContentLoading)return;const r=Math.max(1,((n=window.visualViewport)===null||n===void 0?void 0:n.scale)||1),{container:i,content:o}=this,s=o instanceof HTMLImageElement,a=i.getBoundingClientRect(),l=getComputedStyle(this.container);let c=a.width*r,u=a.height*r;const d=parseFloat(l.paddingTop)+parseFloat(l.paddingBottom),p=c-(parseFloat(l.paddingLeft)+parseFloat(l.paddingRight)),m=u-d;this.containerRect={width:c,height:u,innerWidth:p,innerHeight:m};const y=parseFloat(o.dataset.width||"")||(q=>{let j=0;return j=q instanceof HTMLImageElement?q.naturalWidth:q instanceof SVGElement?q.width.baseVal.value:Math.max(q.offsetWidth,q.scrollWidth),j||0})(o),w=parseFloat(o.dataset.height||"")||(q=>{let j=0;return j=q instanceof HTMLImageElement?q.naturalHeight:q instanceof SVGElement?q.height.baseVal.value:Math.max(q.offsetHeight,q.scrollHeight),j||0})(o);let x=this.option("width",y)||Su,C=this.option("height",w)||Su;const S=x===Su,M=C===Su;typeof x!="number"&&(x=y),typeof C!="number"&&(C=w),S&&(x=y*(C/w)),M&&(C=w/(y/x));let E=o.parentElement instanceof HTMLPictureElement?o.parentElement:o;this.option("transformParent")&&(E=E.parentElement||E);const A=E.getAttribute("style")||"";E.style.setProperty("transform","none","important"),s&&(E.style.width="",E.style.height=""),E.offsetHeight;const I=o.getBoundingClientRect();let O=I.width*r,z=I.height*r,$=O,W=z;O=Math.min(O,x),z=Math.min(z,C),s?{width:O,height:z}=((q,j,G,U)=>{const Q=G/q,re=U/j,le=Math.min(Q,re);return{width:q*=le,height:j*=le}})(x,C,O,z):(O=Math.min(O,x),z=Math.min(z,C));let J=.5*(W-z),Z=.5*($-O);this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:I.top-a.top+J,bottom:a.bottom-I.bottom+J,left:I.left-a.left+Z,right:a.right-I.right+Z,fitWidth:O,fitHeight:z,width:O,height:z,fullWidth:x,fullHeight:C}),E.style.cssText=A,s&&(E.style.width=`${O}px`,E.style.height=`${z}px`),this.setTransform(),e!==!0&&this.emit("refresh"),this.ignoreBounds||(Kt(this.targetScale)this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===Ni.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}calculateBounds(){const{contentWidth:e,contentHeight:n}=this.calculateContentDim(this.target),{targetScale:r,lockedAxis:i}=this,{fitWidth:o,fitHeight:s}=this.contentRect;let a=0,l=0,c=0,u=0;const d=this.option("infinite");if(d===!0||i&&d===i)a=-1/0,c=1/0,l=-1/0,u=1/0;else{let{containerRect:p,contentRect:m}=this,y=Kt(o*r,zC),w=Kt(s*r,zC),{innerWidth:x,innerHeight:C}=p;if(p.width===y&&(x=p.width),p.width===w&&(C=p.height),e>x){c=.5*(e-x),a=-1*c;let S=.5*(m.right-m.left);a+=S,c+=S}if(o>x&&eC){u=.5*(n-C),l=-1*u;let S=.5*(m.bottom-m.top);l+=S,u+=S}s>C&&nKt(i.fitWidth,1)||Kt(i.height,1)>Kt(i.fitHeight,1))&&(p=!0)),Kt(i.width*o,1)Kt(o),y=!m&&!p&&u&&Kt(a)E&&(r=E/S)}C=C.scale(r)}C=C.translate(-o,-s).translate(-y,-w).multiply(x),i&&(C=C.rotate(i)),l&&(C=C.scale(-1,1)),c&&(C=C.scale(1,-1));for(const S of Cf)S!=="e"&&S!=="f"&&(C[S]>this.minScale+1e-5||C[S].1||this.panMode===Eu||d===!1)&&!u&&this.clampTargetBounds(),p===Ni.Init?this.animate():this.isResting||(this.state=Ni.Panning,this.requestTick())}stop(e=!1){if(this.state===Ni.Init||this.state===Ni.Destroy)return;const n=this.isTicking;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const r of Cf)this.velocity[r]=0,e==="current"?this.current[r]=this.target[r]:e==="target"&&(this.target[r]=this.current[r]);this.setTransform(),Ii(this.container,"is-scaling"),Ii(this.container,"is-animating"),this.isTicking=!1,this.state=Ni.Ready,n&&(this.emit("endAnimation"),this.updateControls())}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),Tn(this.container,"is-animating"),this.isScaling&&Tn(this.container,"is-scaling")),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame(()=>this.animate()))}panWithMouse(e,n=this.option("mouseMoveFriction")){if(this.pmme=e,this.panMode!==Eu||!e||Kt(this.targetScale)<=Kt(this.minScale))return;this.emit("mouseMove",e);const{container:r,containerRect:i,contentRect:o}=this,s=i.width,a=i.height,l=r.getBoundingClientRect(),c=(e.clientX||0)-l.left,u=(e.clientY||0)-l.top;let{contentWidth:d,contentHeight:p}=this.calculateContentDim(this.target);const m=this.option("mouseMoveFactor");m>1&&(d!==s&&(d*=m),p!==a&&(p*=m));let y=.5*(d-s)-c/s*100/100*(d-s);y+=.5*(o.right-o.left);let w=.5*(p-a)-u/a*100/100*(p-a);w+=.5*(o.bottom-o.top),this.applyChange({panX:y-this.target.e,panY:w-this.target.f,friction:n})}zoomWithWheel(e){if(this.state===Ni.Destroy||this.state===Ni.Init)return;const n=Date.now();if(n-this.pwt<45)return void e.preventDefault();this.pwt=n;var r=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(c,u){return Math.abs(u)>Math.abs(c)?u:c});const i=Math.max(-1,Math.min(1,r)),{targetScale:o,maxScale:s,minScale:a}=this;let l=o*(100+45*i)/100;Kt(l)Kt(s)&&Kt(o)>=Kt(s)?(this.cwd+=Math.abs(i),l=s):(this.cwd=0,l=Math.max(Math.min(l,s),a)),this.cwd>this.option("wheelLimit")||(e.preventDefault(),Kt(l)!==Kt(o)&&this.zoomTo(l,{event:e}))}canZoomIn(){return this.option("zoom")&&(Kt(this.contentRect.width,1)Kt(this.minScale)}zoomIn(e=1.25,n){this.zoomTo(this.targetScale*e,n)}zoomOut(e=.8,n){this.zoomTo(this.targetScale*e,n)}zoomToFit(e){this.zoomTo("fit",e)}zoomToCover(e){this.zoomTo("cover",e)}zoomToFull(e){this.zoomTo("full",e)}zoomToMax(e){this.zoomTo("max",e)}toggleZoom(e){this.zoomTo(this.getNextScale("toggleZoom"),e)}toggleMax(e){this.zoomTo(this.getNextScale("toggleMax"),e)}toggleCover(e){this.zoomTo(this.getNextScale("toggleCover"),e)}iterateZoom(e){this.zoomTo("next",e)}zoomTo(e=1,{friction:n=Su,originX:r=Su,originY:i=Su,event:o}={}){if(this.isContentLoading||this.state===Ni.Destroy)return;const{targetScale:s,fullScale:a,maxScale:l,coverScale:c}=this;if(this.stop(),this.panMode===Eu&&(o=this.pmme||o),o||r===Su||i===Su){const d=this.content.getBoundingClientRect(),p=this.container.getBoundingClientRect(),m=o?o.clientX:p.left+.5*p.width,y=o?o.clientY:p.top+.5*p.height;r=m-d.left-.5*d.width,i=y-d.top-.5*d.height}let u=1;typeof e=="number"?u=e:e==="full"?u=a:e==="cover"?u=c:e==="max"?u=l:e==="fit"?u=1:e==="next"&&(u=this.getNextScale("iterateZoom")),u=u/s||1,n=n===Su?u>1?.15:.25:n,this.applyChange({scale:u,originX:r,originY:i,friction:n}),o&&this.panMode===Eu&&this.panWithMouse(o,n)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:e,contentRect:n,target:r}=this;this.applyChange({panX:.5*e.width-(n.left+.5*n.fitWidth)-r.e,panY:.5*e.height-(n.top+.5*n.fitHeight)-r.f,scale:e.width/n.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:e,contentRect:n,target:r}=this;this.applyChange({panX:.5*e.width-(n.left+.5*n.fitWidth)-r.e,panY:.5*e.innerHeight-(n.top+.5*n.fitHeight)-r.f,scale:e.height/n.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:e}=this,n=this.cn("inFullscreen"),r=this.cn("htmlHasFullscreen");e.classList.toggle(n);const i=e.classList.contains(n);i?(document.documentElement.classList.add(r),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(r),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(i?"enterFS":"exitFS")}getMatrix(e=this.current){const{a:n,b:r,c:i,d:o,e:s,f:a}=e;return new DOMMatrix([n,r,i,o,s,a])}reset(e){if(this.state!==Ni.Init&&this.state!==Ni.Destroy){this.stop("current");for(const n of Cf)this.target[n]=$C[n];this.target.a=this.minScale,this.target.d=this.minScale,this.clampTargetBounds(),this.isResting||(this.friction=e===void 0?this.option("friction"):e,this.state=Ni.Panning,this.requestTick())}}destroy(){this.stop(),this.state=Ni.Destroy,this.detachEvents(),this.detachObserver();const{container:e,content:n}=this,r=this.option("classes")||{};for(const i of Object.values(r))e.classList.remove(i+"");n&&(n.removeEventListener("load",this.onLoad),n.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty($p,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:lve}),Object.defineProperty($p,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const v8=function(t,e){let n=!0;return(...r)=>{n&&(n=!1,t(...r),setTimeout(()=>{n=!0},e))}},_8=(t,e)=>{let n=[];return t.childNodes.forEach(r=>{r.nodeType!==Node.ELEMENT_NODE||e&&!r.matches(e)||n.push(r)}),n},uve={viewport:null,track:null,enabled:!0,slides:[],axis:"x",transition:"fade",preload:1,slidesPerPage:"auto",initialPage:0,friction:.12,Panzoom:{decelFriction:.12},center:!0,infinite:!0,fill:!0,dragFree:!1,adaptiveHeight:!1,direction:"ltr",classes:{container:"f-carousel",viewport:"f-carousel__viewport",track:"f-carousel__track",slide:"f-carousel__slide",isLTR:"is-ltr",isRTL:"is-rtl",isHorizontal:"is-horizontal",isVertical:"is-vertical",inTransition:"in-transition",isSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}};var _s;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"})(_s||(_s={}));const b2=t=>{if(typeof t=="string"||t instanceof HTMLElement)t={html:t};else{const e=t.thumb;e!==void 0&&(typeof e=="string"&&(t.thumbSrc=e),e instanceof HTMLImageElement&&(t.thumbEl=e,t.thumbElSrc=e.src,t.thumbSrc=e.src),delete t.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",customClass:"",index:-1,dim:0,gap:0,pos:0,transition:!1},t)},hve=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);class mh extends FC{constructor(e,n){super(n),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:e})}attach(){}detach(){}}const dve={classes:{list:"f-carousel__dots",isDynamic:"is-dynamic",hasDots:"has-dots",dot:"f-carousel__dot",isBeforePrev:"is-before-prev",isPrev:"is-prev",isCurrent:"is-current",isNext:"is-next",isAfterNext:"is-after-next"},dotTpl:'',dynamicFrom:11,maxCount:1/0,minCount:2};let b8=class extends mh{constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let e=this.list;if(!e){e=document.createElement("ul"),Tn(e,this.cn("list")),e.setAttribute("role","tablist");const n=this.instance.container;n.appendChild(e),Tn(n,this.cn("hasDots")),this.list=e}return e}refresh(){var e;const n=this.instance.pages.length,r=Math.min(2,this.option("minCount")),i=Math.max(2e3,this.option("maxCount")),o=this.option("dynamicFrom");if(ni)return void this.cleanup();const s=typeof o=="number"&&n>5&&n>=o,a=!this.list||this.isDynamic!==s||this.list.children.length!==n;a&&this.cleanup();const l=this.build();if(ud(l,this.cn("isDynamic"),!!s),a)for(let d=0;d=n-1&&o.setAttribute(VC,"")))}addBtn(e){var n;const r=this.instance,i=document.createElement("button");i.setAttribute("tabindex","0"),i.setAttribute("title",r.localize(`{{${e.toUpperCase()}}}`)),Tn(i,this.cn("button")+" "+this.cn(e===jC?"isNext":"isPrev"));const o=r.isRTL?e===jC?w8:jC:e;var s;return i.innerHTML=r.localize(this.option(`${o}Tpl`)),i.dataset[`carousel${s=e,s?s.match("^[a-z]")?s.charAt(0).toUpperCase()+s.substring(1):s:""}`]="true",(n=this.container)===null||n===void 0||n.appendChild(i),i}build(){const e=this.instance.container,n=this.cn("container");let{container:r,prev:i,next:o}=this;r||(r=e.querySelector("."+n),this.isDom=!!r),r||(r=document.createElement("div"),Tn(r,n),e.appendChild(r)),this.container=r,o||(o=r.querySelector("[data-carousel-next]")),o||(o=this.addBtn(jC)),this.next=o,i||(i=r.querySelector("[data-carousel-prev]")),i||(i=this.addBtn(w8)),this.prev=i}cleanup(){this.isDom||(this.prev&&this.prev.remove(),this.next&&this.next.remove(),this.container&&this.container.remove()),this.prev=null,this.next=null,this.container=null,this.isDom=!1}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(x8,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'',prevTpl:''}});let E8=class extends mh{constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(e){this.target=this.instance,this.nav=e,this.attachEvents()}addAsNavFor(e){this.nav=this.instance,this.target=e,this.attachEvents()}attachEvents(){const{nav:e,target:n}=this;e&&n&&(e.options.initialSlide=n.options.initialPage,e.state===_s.Ready?this.onNavReady(e):e.on("ready",this.onNavReady),n.state===_s.Ready?this.onTargetReady(n):n.on("ready",this.onTargetReady))}onNavReady(e){e.on("createSlide",this.onNavCreateSlide),e.on("Panzoom.click",this.onNavClick),e.on("Panzoom.touchEnd",this.onNavTouch),this.onTargetChange()}onTargetReady(e){e.on("change",this.onTargetChange),e.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(e,n,r){this.onNavTouch(e,e.panzoom,r)}onNavTouch(e,n,r){var i,o;if(Math.abs(n.dragOffset.x)>3||Math.abs(n.dragOffset.y)>3)return;const s=r.target,{nav:a,target:l}=this;if(!a||!l||!s)return;const c=s.closest("[data-index]");if(r.stopPropagation(),r.preventDefault(),!c)return;const u=parseInt(c.dataset.index||"",10)||0,d=l.getPageForSlide(u),p=a.getPageForSlide(u);a.slideTo(p),l.slideTo(d,{friction:((o=(i=this.nav)===null||i===void 0?void 0:i.plugins)===null||o===void 0?void 0:o.Sync.option("friction"))||0}),this.markSelectedSlide(u)}onNavCreateSlide(e,n){n.index===this.selectedIndex&&this.markSelectedSlide(n.index)}onTargetChange(){var e,n;const{target:r,nav:i}=this;if(!r||!i||i.state!==_s.Ready||r.state!==_s.Ready)return;const o=(n=(e=r.pages[r.page])===null||e===void 0?void 0:e.slides[0])===null||n===void 0?void 0:n.index,s=i.getPageForSlide(o);this.markSelectedSlide(o),i.slideTo(s,i.prevPage===null&&r.prevPage===null?{friction:0}:void 0)}markSelectedSlide(e){const n=this.nav;n&&n.state===_s.Ready&&(this.selectedIndex=e,[...n.slides].map(r=>{r.el&&r.el.classList[r.index===e?"add":"remove"]("is-nav-selected")}))}attach(){const e=this;let n=e.options.target,r=e.options.nav;n?e.addAsNavFor(n):r&&e.addAsTargetFor(r)}detach(){const e=this,n=e.nav,r=e.target;n&&(n.off("ready",e.onNavReady),n.off("createSlide",e.onNavCreateSlide),n.off("Panzoom.click",e.onNavClick),n.off("Panzoom.touchEnd",e.onNavTouch)),e.nav=null,r&&(r.off("ready",e.onTargetReady),r.off("refresh",e.onTargetChange),r.off("change",e.onTargetChange)),e.target=null}};Object.defineProperty(E8,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const fve={Navigation:x8,Dots:b8,Sync:E8},UC="animationend",S8="isSelected",HC="slide";class zp extends g2{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===_s.Ready}get isInfinite(){let e=!1;const{contentDim:n,viewportDim:r,pages:i,slides:o}=this,s=o[0];return i.length>=2&&s&&n+s.dim>=r&&(e=this.option("infinite")),e}get isRTL(){return this.option("direction")==="rtl"}get isHorizontal(){return this.option("axis")==="x"}constructor(e,n={},r={}){if(super(),Object.defineProperty(this,"bp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"lp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"userOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:_s.Init}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevPage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"inTransition",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"contentDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"viewportDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),typeof e=="string"&&(e=document.querySelector(e)),!e||!rc(e))throw new Error("No Element found");this.container=e,this.slideNext=v8(this.slideNext.bind(this),150),this.slidePrev=v8(this.slidePrev.bind(this),150),this.userOptions=n,this.userPlugins=r,queueMicrotask(()=>{this.processOptions()})}processOptions(){var e,n;const r=nc({},zp.defaults,this.userOptions);let i="";const o=r.breakpoints;if(o&&p2(o))for(const[s,a]of Object.entries(o))window.matchMedia(s).matches&&p2(a)&&(i+=s,nc(r,a));i===this.bp&&this.state!==_s.Init||(this.bp=i,this.state===_s.Ready&&(r.initialSlide=((n=(e=this.pages[this.page])===null||e===void 0?void 0:e.slides[0])===null||n===void 0?void 0:n.index)||0),this.state!==_s.Init&&this.destroy(),super.setOptions(r),this.option("enabled")===!1?this.attachEvents():setTimeout(()=>{this.init()},0))}init(){this.state=_s.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},zp.Plugins),this.userPlugins)),this.emit("attachPlugins"),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=_s.Ready,this.emit("ready")}initLayout(){const{container:e}=this,n=this.option("classes");Tn(e,this.cn("container")),ud(e,n.isLTR,!this.isRTL),ud(e,n.isRTL,this.isRTL),ud(e,n.isVertical,!this.isHorizontal),ud(e,n.isHorizontal,this.isHorizontal);let r=this.option("viewport")||e.querySelector(`.${n.viewport}`);r||(r=document.createElement("div"),Tn(r,n.viewport),r.append(..._8(e,`.${n.slide}`)),e.prepend(r)),r.addEventListener("scroll",this.onScroll);let i=this.option("track")||e.querySelector(`.${n.track}`);i||(i=document.createElement("div"),Tn(i,n.track),i.append(...Array.from(r.childNodes))),i.setAttribute("aria-live","polite"),r.contains(i)||r.prepend(i),this.viewport=r,this.track=i,this.emit("initLayout")}initSlides(){const{track:e}=this;if(!e)return;const n=[...this.slides],r=[];[..._8(e,`.${this.cn(HC)}`)].forEach(i=>{if(rc(i)){const o=b2({el:i,isDom:!0,index:this.slides.length});r.push(o)}});for(let i of[...this.option("slides",[])||[],...n])r.push(b2(i));this.slides=r;for(let i=0;i!(this.pages.length<2&&!n.options.infinite),bounds:()=>this.getBounds(),maxVelocity:n=>Math.abs(n.target[this.axis]-n.current[this.axis])<2*this.viewportDim?100:0},e)),this.panzoom.on("*",(n,r,...i)=>{this.emit(`Panzoom.${r}`,n,...i)}),this.panzoom.on("decel",this.onDecel),this.panzoom.on("refresh",this.onRefresh),this.panzoom.on("beforeTransform",this.onBeforeTransform),this.panzoom.on("endAnimation",this.onEndAnimation)}attachEvents(){const e=this.container;e&&(e.addEventListener("click",this.onClick,{passive:!1,capture:!1}),e.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let e=[];const{contentDim:n,viewportDim:r}=this;let i=this.option("slidesPerPage");i=(i==="auto"||n<=r)&&this.option("fill")!==!1?1/0:parseFloat(i+"");let o=0,s=0,a=0;for(const l of this.slides)(!e.length||s+l.dim-r>.05||a>=i)&&(e.push(hve()),o=e.length-1,s=0,a=0),e[o].slides.push(l),s+=l.dim+l.gap,a++;return e}processPages(){const e=this.pages,{contentDim:n,viewportDim:r,isInfinite:i}=this,o=this.option("center"),s=this.option("fill"),a=s&&o&&n>r&&!i;if(e.forEach((u,d)=>{var p;u.index=d,u.pos=((p=u.slides[0])===null||p===void 0?void 0:p.pos)||0,u.dim=0;for(const[m,y]of u.slides.entries())u.dim+=y.dim,m=n-.5*r?u.pos=n-r:o&&(u.pos+=-.5*(r-u.dim))}),e.forEach(u=>{s&&!i&&n>r&&(u.pos=Math.max(u.pos,0),u.pos=Math.min(u.pos,n-r)),u.pos=Kt(u.pos,1e3),u.dim=Kt(u.dim,1e3),Math.abs(u.pos)<=.1&&(u.pos=0)}),i)return e;const l=[];let c;return e.forEach(u=>{const d=Object.assign({},u);c&&d.pos===c.pos?(c.dim+=d.dim,c.slides=[...c.slides,...d.slides]):(d.index=l.length,c=d,l.push(d))}),l}getPageFromIndex(e=0){const n=this.pages.length;let r;return e=parseInt((e||0).toString())||0,r=this.isInfinite?(e%n+n)%n:Math.max(Math.min(e,n-1),0),r}getSlideMetrics(e){var n,r;const i=this.isHorizontal?"width":"height";let o=0,s=0,a=e.el;const l=!(!a||a.parentNode);if(a?o=parseFloat(a.dataset[i]||"")||0:(a=document.createElement("div"),a.style.visibility="hidden",(this.track||document.body).prepend(a)),Tn(a,this.cn(HC)+" "+e.class+" "+e.customClass),o)a.style[i]=`${o}px`,a.style[i==="width"?"height":"width"]="";else{l&&(this.track||document.body).prepend(a),o=a.getBoundingClientRect()[i]*Math.max(1,((n=window.visualViewport)===null||n===void 0?void 0:n.scale)||1);let u=a[this.isHorizontal?"offsetWidth":"offsetHeight"];u-1>o&&(o=u)}const c=getComputedStyle(a);return c.boxSizing==="content-box"&&(this.isHorizontal?(o+=parseFloat(c.paddingLeft)||0,o+=parseFloat(c.paddingRight)||0):(o+=parseFloat(c.paddingTop)||0,o+=parseFloat(c.paddingBottom)||0)),s=parseFloat(c[this.isHorizontal?"marginRight":"marginBottom"])||0,l?(r=a.parentElement)===null||r===void 0||r.removeChild(a):e.el||a.remove(),{dim:Kt(o,1e3),gap:Kt(s,1e3)}}getBounds(){const{isInfinite:e,isRTL:n,isHorizontal:r,pages:i}=this;let o={min:0,max:0};if(e)o={min:-1/0,max:1/0};else if(i.length){const s=i[0].pos,a=i[i.length-1].pos;o=n&&r?{min:s,max:a}:{min:-1*a,max:-1*s}}return{x:r?o:{min:0,max:0},y:r?{min:0,max:0}:o}}repositionSlides(){let e,{isHorizontal:n,isRTL:r,isInfinite:i,viewport:o,viewportDim:s,contentDim:a,page:l,pages:c,slides:u,panzoom:d}=this,p=0,m=0,y=0,w=0;d?w=-1*d.current[this.axis]:c[l]&&(w=c[l].pos||0),e=n?r?"right":"left":"top",r&&n&&(w*=-1);for(const M of u){const E=M.el;E?(e==="top"?(E.style.right="",E.style.left=""):E.style.top="",M.index!==p?E.style[e]=m===0?"":`${Kt(m,1e3)}px`:E.style[e]="",y+=M.dim+M.gap,p++):m+=M.dim+M.gap}if(i&&y&&o){let M=getComputedStyle(o),E="padding",A=n?"Right":"Bottom",I=parseFloat(M[E+(n?"Left":"Top")]);w-=I,s+=I,s+=parseFloat(M[E+A]);for(const O of u)O.el&&(Kt(O.pos)Kt(a-s)&&(O.el.style[e]=`${Kt(m+y,1e3)}px`),Kt(O.pos+O.gap)>=Kt(a-s)&&Kt(O.pos)>Kt(w+s)&&Kt(w)1&&(x=c[S[0]],C=c[S[1]]),x&&C){let M=0;for(const E of u)E.el?this.inTransition.has(E.index)&&x.slides.indexOf(E)<0&&(E.el.style[e]=`${Kt(M+(x.pos-C.pos),1e3)}px`):M+=E.dim+E.gap}}createSlideEl(e){const{track:n,slides:r}=this;if(!n||!e||e.el&&e.el.parentNode)return;const i=e.el||document.createElement("div");Tn(i,this.cn(HC)),Tn(i,e.class),Tn(i,e.customClass);const o=e.html;o&&(o instanceof HTMLElement?i.appendChild(o):i.innerHTML=e.html+"");const s=[];r.forEach((u,d)=>{u.el&&s.push(d)});const a=e.index;let l=null;s.length&&(l=r[s.reduce((u,d)=>Math.abs(d-a)1)return!1;let d=e>a?1:-1;this.isInfinite&&(a===0&&e===l.length-1&&(d=-1),a===l.length-1&&e===0&&(d=1));const p=l[u].pos*(this.isRTL?1:-1);if(a===u&&Math.abs(p-c.target[this.axis])<1)return!1;this.clearTransitions();const m=c.isResting;Tn(this.container,this.cn("inTransition"));const y=((o=l[a])===null||o===void 0?void 0:o.slides[0])||null,w=((s=l[u])===null||s===void 0?void 0:s.slides[0])||null;this.inTransition.add(w.index),this.createSlideEl(w);let x=y.el,C=w.el;m||n===HC||(n="fadeFast",x=null);const S=this.isRTL?"next":"prev",M=this.isRTL?"prev":"next";return x&&(this.inTransition.add(y.index),y.transition=n,x.addEventListener(UC,this.onAnimationEnd),x.classList.add(`f-${n}Out`,`to-${d>0?M:S}`)),C&&(w.transition=n,C.addEventListener(UC,this.onAnimationEnd),C.classList.add(`f-${n}In`,`from-${d>0?S:M}`)),c.current[this.axis]=p,c.target[this.axis]=p,c.requestTick(),this.onChange(u),!0}manageSlideVisiblity(){const e=new Set,n=new Set,r=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const i of this.slides)r.has(i)?e.add(i):n.add(i);for(const i of this.inTransition)e.add(this.slides[i]);for(const i of e)this.createSlideEl(i),this.lazyLoadSlide(i);for(const i of n)e.has(i)||this.removeSlideEl(i);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const e="aria-hidden";let n=this.cn(S8);if(n)for(const r of this.slides){const i=r.el;i&&(i.dataset.index=`${r.index}`,i.classList.contains("f-thumbs__slide")?this.getVisibleSlides(0).has(r)?i.removeAttribute(e):i.setAttribute(e,"true"):this.pages[this.page].slides.includes(r)?(i.classList.contains(n)||(Tn(i,n),this.emit("selectSlide",r)),i.removeAttribute(e)):(i.classList.contains(n)&&(Ii(i,n),this.emit("unselectSlide",r)),i.setAttribute(e,"true")))}}flipInfiniteTrack(){const{axis:e,isHorizontal:n,isInfinite:r,isRTL:i,viewportDim:o,contentDim:s}=this,a=this.panzoom;if(!a||!r)return;let l=a.current[e],c=a.target[e]-l,u=0,d=.5*o;i&&n?(l<-d&&(u=-1,l+=s),l>s-d&&(u=1,l-=s)):(l>d&&(u=1,l-=s),l<-s+d&&(u=-1,l+=s)),u&&(a.current[e]=l,a.target[e]=l+c)}lazyLoadImg(e,n){const r=this,i="f-fadeIn",o="is-preloading";let s=!1,a=null;const l=()=>{s||(s=!0,a&&(a.remove(),a=null),Ii(n,o),n.complete&&(Tn(n,i),setTimeout(()=>{Ii(n,i)},350)),this.option("adaptiveHeight")&&e.el&&this.pages[this.page].slides.indexOf(e)>-1&&(r.updateMetrics(),r.setViewportHeight()),this.emit("load",e))};Tn(n,o),n.src=n.dataset.lazySrcset||n.dataset.lazySrc||"",delete n.dataset.lazySrc,delete n.dataset.lazySrcset,n.addEventListener("error",()=>{l()}),n.addEventListener("load",()=>{l()}),setTimeout(()=>{const c=n.parentNode;c&&e.el&&(n.complete?l():s||(a=cd(y2),c.insertBefore(a,n)))},300)}lazyLoadSlide(e){const n=e&&e.el;if(!n)return;const r=new Set;let i=Array.from(n.querySelectorAll("[data-lazy-src],[data-lazy-srcset]"));n.dataset.lazySrc&&i.push(n),i.map(o=>{o instanceof HTMLImageElement?r.add(o):o instanceof HTMLElement&&o.dataset.lazySrc&&(o.style.backgroundImage=`url('${o.dataset.lazySrc}')`,delete o.dataset.lazySrc)});for(const o of r)this.lazyLoadImg(e,o)}onAnimationEnd(e){var n;const r=e.target,i=r?parseInt(r.dataset.index||"",10)||0:-1,o=this.slides[i],s=e.animationName;if(!r||!o||!s)return;const a=!!this.inTransition.has(i)&&o.transition;a&&s.substring(0,a.length+2)===`f-${a}`&&this.inTransition.delete(i),this.inTransition.size||this.clearTransitions(),i===this.page&&(!((n=this.panzoom)===null||n===void 0)&&n.isResting)&&this.emit("settle")}onDecel(e,n=0,r=0,i=0,o=0){if(this.option("dragFree"))return void this.setPageFromPosition();const{isRTL:s,isHorizontal:a,axis:l,pages:c}=this,u=c.length,d=Math.abs(Math.atan2(r,n)/(Math.PI/180));let p=0;if(p=d>45&&d<135?a?0:r:a?n:0,!u)return;let m=this.page,y=s&&a?1:-1;const w=e.current[l]*y;let{pageIndex:x}=this.getPageFromPosition(w);Math.abs(p)>5?(c[m].dim=e&&(this.page+=p.length),this.updateMetrics(),a){const m=((o=this.pages[this.page])===null||o===void 0?void 0:o.pos)||0,y=((s=this.pages[this.page])===null||s===void 0?void 0:s.dim)||0,w=this.pages.length||1,x=this.isRTL?c-y:y-c,C=this.isRTL?l-m:m-l;u&&w===1?(e<=this.page&&(a.current[this.axis]-=x,a.target[this.axis]-=x),a.panTo({[this.isHorizontal?"x":"y"]:-1*m})):C&&e<=this.page&&(a.target[this.axis]-=C,a.current[this.axis]-=C,a.requestTick())}for(const m of p)this.emit("initSlide",m,m.index)}prependSlide(e){this.addSlide(0,e)}appendSlide(e){this.addSlide(this.slides.length,e)}removeSlide(e){const n=this.slides.length;e=(e%n+n)%n;const r=this.slides[e];if(r){this.removeSlideEl(r,!0),this.slides.splice(e,1);for(let i=0;ithis.page?-1:1;let l=-1*o.current.e,c=Kt((l-a.pos)/(1*a.dim),1e3),u=c,d=c;this.isInfinite&&r!==!0&&(u=Kt((l-a.pos+s)/(1*a.dim),1e3),d=Kt((l-a.pos-s)/(1*a.dim),1e3));let p=[c,u,d].reduce(function(m,y){return Math.abs(y)1?1:p<-1?-1:p}setViewportHeight(){const{page:e,pages:n,viewport:r,isHorizontal:i}=this;if(!r||!n[e])return;let o=0;i&&this.track&&(this.track.style.height="auto",n[e].slides.forEach(s=>{s.el&&(o=Math.max(o,s.el.offsetHeight))})),r.style.height=o?`${o}px`:""}getPageForSlide(e){for(const n of this.pages)for(const r of n.slides)if(r.index===e)return n.index;return-1}getVisibleSlides(e=0){var n;const r=new Set;let{panzoom:i,contentDim:o,viewportDim:s,pages:a,page:l}=this;if(s){o=o+((n=this.slides[this.slides.length-1])===null||n===void 0?void 0:n.gap)||0;let c=0;c=i&&i.state!==Ni.Init&&i.state!==Ni.Destroy?-1*i.current[this.axis]:a[l]&&a[l].pos||0,this.isInfinite&&(c-=Math.floor(c/o)*o),this.isRTL&&this.isHorizontal&&(c*=-1);const u=c-s*e,d=c+s*(e+1),p=this.isInfinite?[-1,0,1]:[0];for(const m of this.slides)for(const y of p){const w=m.pos+y*o,x=w+m.dim+m.gap;wu&&r.add(m)}}return r}getPageFromPosition(e){const{viewportDim:n,contentDim:r,slides:i,pages:o,panzoom:s}=this,a=o.length,l=i.length,c=i[0],u=i[l-1],d=this.option("center");let p=0,m=0,y=0,w=e===void 0?-1*((s==null?void 0:s.target[this.axis])||0):e;d&&(w+=.5*n),this.isInfinite?(wu.pos+u.dim+.5*u.gap&&(w-=r,y=1)):w=Math.max(c.pos||0,Math.min(w,u.pos));let x=u,C=i.find(S=>{const M=S.pos-.5*x.gap,E=S.pos+S.dim+.5*S.gap;return x=S,w>=M&&w{this.removeSlideEl(l)}),this.detachPlugins(),n&&(n.removeEventListener("scroll",this.onScroll),n.offsetParent&&r&&r.offsetParent&&n.replaceWith(...r.childNodes));for(const[l,c]of Object.entries(s))l!=="container"&&c&&e.classList.remove(c);this.track=null,this.viewport=null,this.page=0,this.slides=[];const a=this.events.get("ready");this.events=new Map,a&&this.events.set("ready",a)}}Object.defineProperty(zp,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:$p}),Object.defineProperty(zp,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:uve}),Object.defineProperty(zp,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:fve});const C8=function(t){if(!rc(t))return 0;const e=window.scrollY,n=window.innerHeight,r=e+n,i=t.getBoundingClientRect(),o=i.y+e,s=i.height,a=o+s;if(e>a||ra||or)return 100;let l=s;or&&(l-=a-r);const c=l/n*100;return Math.round(c)},F1=!(typeof window>"u"||!window.document||!window.document.createElement);let w2;const x2=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden]):not(.fancybox-focus-guard)","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not([tabindex^="-"]):not([disabled]):not([aria-hidden])'].join(","),k8=t=>{if(t&&F1){w2===void 0&&document.createElement("div").focus({get preventScroll(){return w2=!0,!1}});try{if(w2)t.focus({preventScroll:!0});else{const e=window.scrollY||document.body.scrollTop,n=window.scrollX||document.body.scrollLeft;t.focus(),document.body.scrollTo({top:e,left:n,behavior:"auto"})}}catch{}}},T8=()=>{const t=document;let e,n="",r="",i="";return t.fullscreenEnabled?(n="requestFullscreen",r="exitFullscreen",i="fullscreenElement"):t.webkitFullscreenEnabled&&(n="webkitRequestFullscreen",r="webkitExitFullscreen",i="webkitFullscreenElement"),n&&(e={request:function(o=t.documentElement){return n==="webkitRequestFullscreen"?o[n](Element.ALLOW_KEYBOARD_INPUT):o[n]()},exit:function(){return t[i]&&t[r]()},isFullscreen:function(){return t[i]}}),e},E2={animated:!0,autoFocus:!0,backdropClick:"close",Carousel:{classes:{container:"fancybox__carousel",viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"}},closeButton:"auto",closeExisting:!1,commonCaption:!1,compact:()=>window.matchMedia("(max-width: 578px), (max-height: 578px)").matches,contentClick:"toggleZoom",contentDblClick:!1,defaultType:"image",defaultDisplay:"flex",dragToClose:!0,Fullscreen:{autoStart:!1},groupAll:!1,groupAttr:"data-fancybox",hideClass:"f-fadeOut",hideScrollbar:!0,idle:3500,keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"prev",ArrowDown:"next",ArrowRight:"next",ArrowLeft:"prev"},l10n:Object.assign(Object.assign({},p8),{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}),parentEl:null,placeFocusBack:!0,showClass:"f-zoomInUp",startIndex:0,tpl:{closeButton:'',main:``},trapFocus:!0,wheel:"zoom"};var ca,Xa;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Closing=2]="Closing",t[t.CustomClosing=3]="CustomClosing",t[t.Destroy=4]="Destroy"})(ca||(ca={})),function(t){t[t.Loading=0]="Loading",t[t.Opening=1]="Opening",t[t.Ready=2]="Ready",t[t.Closing=3]="Closing"}(Xa||(Xa={}));let M8="",$1=!1,WC=!1,Ng=null;const A8=()=>{let t="",e="";const n=pi.getInstance();if(n){const r=n.carousel,i=n.getSlide();if(r&&i){let o=i.slug||void 0,s=i.triggerEl||void 0;e=o||n.option("slug")||"",!e&&s&&s.dataset&&(e=s.dataset.fancybox||""),e&&e!=="true"&&(t="#"+e+(!o&&r.slides.length>1?"-"+(i.index+1):""))}}return{hash:t,slug:e,index:1}},GC=()=>{const t=new URL(document.URL).hash,e=t.slice(1).split("-"),n=e[e.length-1],r=n&&/^\+?\d+$/.test(n)&&parseInt(e.pop()||"1",10)||1;return{hash:t,slug:e.join("-"),index:r}},I8=()=>{const{slug:t,index:e}=GC();if(!t)return;let n=document.querySelector(`[data-slug="${t}"]`);if(n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})),pi.getInstance())return;const r=document.querySelectorAll(`[data-fancybox="${t}"]`);r.length&&(n=r[e-1],n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})))},L8=()=>{if(pi.defaults.Hash===!1)return;const t=pi.getInstance();if((t==null?void 0:t.options.Hash)===!1)return;const{slug:e,index:n}=GC(),{slug:r}=A8();t&&(e===r?t.jumpTo(n-1):($1=!0,t.close())),I8()},P8=()=>{Ng&&clearTimeout(Ng),queueMicrotask(()=>{L8()})},N8=()=>{window.addEventListener("hashchange",P8,!1),setTimeout(()=>{L8()},500)};F1&&(/complete|interactive|loaded/.test(document.readyState)?N8():document.addEventListener("DOMContentLoaded",N8));const qC="is-zooming-in";class O8 extends mh{onCreateSlide(e,n,r){const i=this.instance.optionFor(r,"src")||"";r.el&&r.type==="image"&&typeof i=="string"&&this.setImage(r,i)}onRemoveSlide(e,n,r){r.panzoom&&r.panzoom.destroy(),r.panzoom=void 0,r.imageEl=void 0}onChange(e,n,r,i){Ii(this.instance.container,qC);for(const o of n.slides){const s=o.panzoom;s&&o.index!==r&&s.reset(.35)}}onClose(){var e;const n=this.instance,r=n.container,i=n.getSlide();if(!r||!r.parentElement||!i)return;const{el:o,contentEl:s,panzoom:a,thumbElSrc:l}=i;if(!o||!l||!s||!a||a.isContentLoading||a.state===Ni.Init||a.state===Ni.Destroy)return;a.updateMetrics();let c=this.getZoomInfo(i);if(!c)return;this.instance.state=ca.CustomClosing,r.classList.remove(qC),r.classList.add("is-zooming-out"),s.style.backgroundImage=`url('${l}')`;const u=r.getBoundingClientRect();(((e=window.visualViewport)===null||e===void 0?void 0:e.scale)||1)===1&&Object.assign(r.style,{position:"absolute",top:`${r.offsetTop+window.scrollY}px`,left:`${r.offsetLeft+window.scrollX}px`,bottom:"auto",right:"auto",width:`${u.width}px`,height:`${u.height}px`,overflow:"hidden"});const{x:d,y:p,scale:m,opacity:y}=c;if(y){const w=((x,C,S,M)=>{const E=C-x,A=M-S;return I=>S+((I-x)/E*A||0)})(a.scale,m,1,0);a.on("afterTransform",()=>{s.style.opacity=w(a.scale)+""})}a.on("endAnimation",()=>{n.destroy()}),a.target.a=m,a.target.b=0,a.target.c=0,a.target.d=m,a.panTo({x:d,y:p,scale:m,friction:y?.2:.33,ignoreBounds:!0}),a.isResting&&n.destroy()}setImage(e,n){const r=this.instance;e.src=n,this.process(e,n).then(i=>{const{contentEl:o,imageEl:s,thumbElSrc:a,el:l}=e;if(r.isClosing()||!o||!s)return;o.offsetHeight;const c=!!r.isOpeningSlide(e)&&this.getZoomInfo(e);if(this.option("protected")&&l){l.addEventListener("contextmenu",p=>{p.preventDefault()});const d=document.createElement("div");Tn(d,"fancybox-protected"),o.appendChild(d)}if(a&&c){const d=i.contentRect,p=Math.max(d.fullWidth,d.fullHeight);let m=null;!c.opacity&&p>1200&&(m=document.createElement("img"),Tn(m,"fancybox-ghost"),m.src=a,o.appendChild(m));const y=()=>{m&&(Tn(m,"f-fadeFastOut"),setTimeout(()=>{m&&(m.remove(),m=null)},200))};(u=a,new Promise((w,x)=>{const C=new Image;C.onload=w,C.onerror=x,C.src=u})).then(()=>{r.hideLoading(e),e.state=Xa.Opening,this.instance.emit("reveal",e),this.zoomIn(e).then(()=>{y(),this.instance.done(e)},()=>{}),m&&setTimeout(()=>{y()},p>2500?800:200)},()=>{r.hideLoading(e),r.revealContent(e)})}else{const d=this.optionFor(e,"initialSize"),p=this.optionFor(e,"zoom"),m={event:r.prevMouseMoveEvent||r.options.event,friction:p?.12:0};let y=r.optionFor(e,"showClass")||void 0,w=!0;r.isOpeningSlide(e)&&(d==="full"?i.zoomToFull(m):d==="cover"?i.zoomToCover(m):d==="max"?i.zoomToMax(m):w=!1,i.stop("current")),w&&y&&(y=i.isDragging?"f-fadeIn":""),r.hideLoading(e),r.revealContent(e,y)}var u},()=>{r.setError(e,"{{IMAGE_ERROR}}")})}process(e,n){return new Promise((r,i)=>{var o;const s=this.instance,a=e.el;s.clearContent(e),s.showLoading(e);let l=this.optionFor(e,"content");if(typeof l=="string"&&(l=cd(l)),!l||!rc(l)){if(l=document.createElement("img"),l instanceof HTMLImageElement){let c="",u=e.caption;c=typeof u=="string"&&u?u.replace(/<[^>]+>/gi,"").substring(0,1e3):`Image ${e.index+1} of ${((o=s.carousel)===null||o===void 0?void 0:o.pages.length)||1}`,l.src=n||"",l.alt=c,l.draggable=!1,e.srcset&&l.setAttribute("srcset",e.srcset),this.instance.isOpeningSlide(e)&&(l.fetchPriority="high")}e.sizes&&l.setAttribute("sizes",e.sizes)}Tn(l,"fancybox-image"),e.imageEl=l,s.setContent(e,l,!1),e.panzoom=new $p(a,nc({transformParent:!0},this.option("Panzoom")||{},{content:l,width:(c,u)=>s.optionFor(e,"width","auto",u)||"auto",height:(c,u)=>s.optionFor(e,"height","auto",u)||"auto",wheel:()=>{const c=s.option("wheel");return(c==="zoom"||c=="pan")&&c},click:(c,u)=>{var d,p;if(s.isCompact||s.isClosing()||e.index!==((d=s.getSlide())===null||d===void 0?void 0:d.index))return!1;if(u){const y=u.composedPath()[0];if(["A","BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(y.nodeName))return!1}let m=!u||u.target&&((p=e.contentEl)===null||p===void 0?void 0:p.contains(u.target));return s.option(m?"contentClick":"backdropClick")||!1},dblClick:()=>s.isCompact?"toggleZoom":s.option("contentDblClick")||!1,spinner:!1,panOnlyZoomed:!0,wheelLimit:1/0,on:{ready:c=>{r(c)},error:()=>{i()},destroy:()=>{i()}}}))})}zoomIn(e){return new Promise((n,r)=>{const i=this.instance,o=i.container,{panzoom:s,contentEl:a,el:l}=e;s&&s.updateMetrics();const c=this.getZoomInfo(e);if(!(c&&l&&a&&s&&o))return void r();const{x:u,y:d,scale:p,opacity:m}=c,y=()=>{e.state!==Xa.Closing&&(m&&(a.style.opacity=Math.max(Math.min(1,1-(1-s.scale)/(1-p)),0)+""),s.scale>=1&&s.scale>s.targetScale-.1&&n(s))},w=S=>{(S.scale<.99||S.scale>1.01)&&!S.isDragging||(Ii(o,qC),a.style.opacity="",S.off("endAnimation",w),S.off("touchStart",w),S.off("afterTransform",y),n(S))};s.on("endAnimation",w),s.on("touchStart",w),s.on("afterTransform",y),s.on(["error","destroy"],()=>{r()}),s.panTo({x:u,y:d,scale:p,friction:0,ignoreBounds:!0}),s.stop("current");const x={event:s.panMode==="mousemove"?i.prevMouseMoveEvent||i.options.event:void 0},C=this.optionFor(e,"initialSize");Tn(o,qC),i.hideLoading(e),C==="full"?s.zoomToFull(x):C==="cover"?s.zoomToCover(x):C==="max"?s.zoomToMax(x):s.reset(.172)})}getZoomInfo(e){const{el:n,imageEl:r,thumbEl:i,panzoom:o}=e,s=this.instance,a=s.container;if(!n||!r||!i||!o||C8(i)<3||!this.optionFor(e,"zoom")||!a||s.state===ca.Destroy||getComputedStyle(a).getPropertyValue("--f-images-zoom")==="0")return!1;const l=window.visualViewport||null;if((l?l.scale:1)!==1)return!1;let{top:c,left:u,width:d,height:p}=i.getBoundingClientRect(),{top:m,left:y,fitWidth:w,fitHeight:x}=o.contentRect;if(!(d&&p&&w&&x))return!1;const C=o.container.getBoundingClientRect();y+=C.left,m+=C.top;const S=-1*(y+.5*w-(u+.5*d)),M=-1*(m+.5*x-(c+.5*p)),E=d/w;let A=this.option("zoomOpacity")||!1;return A==="auto"&&(A=Math.abs(d/p-w/x)>.1),{x:S,y:M,scale:E,opacity:A}}attach(){const e=this,n=e.instance;n.on("Carousel.change",e.onChange),n.on("Carousel.createSlide",e.onCreateSlide),n.on("Carousel.removeSlide",e.onRemoveSlide),n.on("close",e.onClose)}detach(){const e=this,n=e.instance;n.off("Carousel.change",e.onChange),n.off("Carousel.createSlide",e.onCreateSlide),n.off("Carousel.removeSlide",e.onRemoveSlide),n.off("close",e.onClose)}}Object.defineProperty(O8,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{initialSize:"fit",Panzoom:{maxScale:1},protected:!1,zoom:!0,zoomOpacity:"auto"}}),typeof SuppressedError=="function"&&SuppressedError;const S2="html",D8="image",C2="map",kf="youtube",Og="vimeo",z1="html5video",R8=(t,e={})=>{const n=new URL(t),r=new URLSearchParams(n.search),i=new URLSearchParams;for(const[a,l]of[...r,...Object.entries(e)]){let c=l+"";if(a==="t"){let u=c.match(/((\d*)m)?(\d*)s?/);u&&i.set("start",60*parseInt(u[2]||"0")+parseInt(u[3]||"0")+"")}else i.set(a,c)}let o=i+"",s=t.match(/#t=((.*)?\d+s)/);return s&&(o+=`#t=${s[1]}`),o},pve={ajax:null,autoSize:!0,iframeAttr:{allow:"autoplay; fullscreen",scrolling:"auto"},preload:!0,videoAutoplay:!0,videoRatio:16/9,videoTpl:``,videoFormat:"",vimeo:{byline:1,color:"00adef",controls:1,dnt:1,muted:0},youtube:{controls:1,enablejsapi:1,nocookie:1,rel:0,fs:1}},mve=["image","html","ajax","inline","clone","iframe","map","pdf","html5video","youtube","vimeo"];let B8=class extends mh{onBeforeInitSlide(e,n,r){this.processType(r)}onCreateSlide(e,n,r){this.setContent(r)}onClearContent(e,n){n.xhr&&(n.xhr.abort(),n.xhr=null);const r=n.iframeEl;r&&(r.onload=r.onerror=null,r.src="//about:blank",n.iframeEl=null);const i=n.contentEl,o=n.placeholderEl;if(n.type==="inline"&&i&&o)i.classList.remove("fancybox__content"),getComputedStyle(i).getPropertyValue("display")!=="none"&&(i.style.display="none"),setTimeout(()=>{o&&(i&&o.parentNode&&o.parentNode.insertBefore(i,o),o.remove())},0),n.contentEl=void 0,n.placeholderEl=void 0;else for(;n.el&&n.el.firstChild;)n.el.removeChild(n.el.firstChild)}onSelectSlide(e,n,r){r.state===Xa.Ready&&this.playVideo()}onUnselectSlide(e,n,r){var i,o;if(r.type===z1){try{(o=(i=r.el)===null||i===void 0?void 0:i.querySelector("video"))===null||o===void 0||o.pause()}catch{}return}let s;r.type===Og?s={method:"pause",value:"true"}:r.type===kf&&(s={event:"command",func:"pauseVideo"}),s&&r.iframeEl&&r.iframeEl.contentWindow&&r.iframeEl.contentWindow.postMessage(JSON.stringify(s),"*"),r.poller&&clearTimeout(r.poller)}onDone(e,n){e.isCurrentSlide(n)&&!e.isClosing()&&this.playVideo()}onRefresh(e,n){n.slides.forEach(r=>{r.el&&(this.resizeIframe(r),this.setAspectRatio(r))})}onMessage(e){try{let n=JSON.parse(e.data);if(e.origin==="https://player.vimeo.com"){if(n.event==="ready")for(let r of Array.from(document.getElementsByClassName("fancybox__iframe")))r instanceof HTMLIFrameElement&&r.contentWindow===e.source&&(r.dataset.ready="true")}else if(e.origin.match(/^https:\/\/(www.)?youtube(-nocookie)?.com$/)&&n.event==="onReady"){const r=document.getElementById(n.id);r&&(r.dataset.ready="true")}}catch{}}loadAjaxContent(e){const n=this.instance.optionFor(e,"src")||"";this.instance.showLoading(e);const r=this.instance,i=new XMLHttpRequest;r.showLoading(e),i.onreadystatechange=function(){i.readyState===XMLHttpRequest.DONE&&r.state===ca.Ready&&(r.hideLoading(e),i.status===200?r.setContent(e,i.responseText):r.setError(e,i.status===404?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};const o=e.ajax||null;i.open(o?"POST":"GET",n+""),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.send(o),e.xhr=i}setInlineContent(e){let n=null;if(rc(e.src))n=e.src;else if(typeof e.src=="string"){const r=e.src.split("#",2).pop();n=r?document.getElementById(r):null}if(n){if(e.type==="clone"||n.closest(".fancybox__slide")){n=n.cloneNode(!0);const r=n.dataset.animationName;r&&(n.classList.remove(r),delete n.dataset.animationName);let i=n.getAttribute("id");i=i?`${i}--clone`:`clone-${this.instance.id}-${e.index}`,n.setAttribute("id",i)}else if(n.parentNode){const r=document.createElement("div");r.classList.add("fancybox-placeholder"),n.parentNode.insertBefore(r,n),e.placeholderEl=r}this.instance.setContent(e,n)}else this.instance.setError(e,"{{ELEMENT_NOT_FOUND}}")}setIframeContent(e){const{src:n,el:r}=e;if(!n||typeof n!="string"||!r)return;r.classList.add("is-loading");const i=this.instance,o=document.createElement("iframe");o.className="fancybox__iframe",o.setAttribute("id",`fancybox__iframe_${i.id}_${e.index}`);for(const[a,l]of Object.entries(this.optionFor(e,"iframeAttr")||{}))o.setAttribute(a,l);o.onerror=()=>{i.setError(e,"{{IFRAME_ERROR}}")},e.iframeEl=o;const s=this.optionFor(e,"preload");if(e.type!=="iframe"||s===!1)return o.setAttribute("src",e.src+""),i.setContent(e,o,!1),this.resizeIframe(e),void i.revealContent(e);i.showLoading(e),o.onload=()=>{if(!o.src.length)return;const a=o.dataset.ready!=="true";o.dataset.ready="true",this.resizeIframe(e),a?i.revealContent(e):i.hideLoading(e)},o.setAttribute("src",n),i.setContent(e,o,!1)}resizeIframe(e){const{type:n,iframeEl:r}=e;if(n===kf||n===Og)return;const i=r==null?void 0:r.parentElement;if(!r||!i)return;let o=e.autoSize;o===void 0&&(o=this.optionFor(e,"autoSize"));let s=e.width||0,a=e.height||0;s&&a&&(o=!1);const l=i&&i.style;if(e.preload!==!1&&o!==!1&&l)try{const c=window.getComputedStyle(i),u=parseFloat(c.paddingLeft)+parseFloat(c.paddingRight),d=parseFloat(c.paddingTop)+parseFloat(c.paddingBottom),p=r.contentWindow;if(p){const m=p.document,y=m.getElementsByTagName(S2)[0],w=m.body;l.width="",w.style.overflow="hidden",s=s||y.scrollWidth+u,l.width=`${s}px`,w.style.overflow="",l.flex="0 0 auto",l.height=`${w.scrollHeight}px`,a=y.scrollHeight+d}}catch{}if(s||a){const c={flex:"0 1 auto",width:"",height:""};s&&s!=="auto"&&(c.width=`${s}px`),a&&a!=="auto"&&(c.height=`${a}px`),Object.assign(l,c)}}playVideo(){const e=this.instance.getSlide();if(!e)return;const{el:n}=e;if(!n||!n.offsetParent||!this.optionFor(e,"videoAutoplay"))return;if(e.type===z1)try{const i=n.querySelector("video");if(i){const o=i.play();o!==void 0&&o.then(()=>{}).catch(s=>{i.muted=!0,i.play()})}}catch{}if(e.type!==kf&&e.type!==Og)return;const r=()=>{if(e.iframeEl&&e.iframeEl.contentWindow){let i;if(e.iframeEl.dataset.ready==="true")return i=e.type===kf?{event:"command",func:"playVideo"}:{method:"play",value:"true"},i&&e.iframeEl.contentWindow.postMessage(JSON.stringify(i),"*"),void(e.poller=void 0);e.type===kf&&(i={event:"listening",id:e.iframeEl.getAttribute("id")},e.iframeEl.contentWindow.postMessage(JSON.stringify(i),"*"))}e.poller=setTimeout(r,250)};r()}processType(e){if(e.html)return e.type=S2,e.src=e.html,void(e.html="");const n=this.instance.optionFor(e,"src","");if(!n||typeof n!="string")return;let r=e.type,i=null;if(i=n.match(/(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|shorts\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){const o=this.optionFor(e,kf),{nocookie:s}=o,a=function(d,p){var m={};for(var y in d)Object.prototype.hasOwnProperty.call(d,y)&&p.indexOf(y)<0&&(m[y]=d[y]);if(d!=null&&typeof Object.getOwnPropertySymbols=="function"){var w=0;for(y=Object.getOwnPropertySymbols(d);w0?"svembed":"embed"}`,r=C2):(i=n.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(e.src=`https://maps.google.${i[1]}/maps?q=${i[2].replace("query=","q=").replace("api=1","")}&output=embed`,r=C2),r=r||this.instance.option("defaultType"),e.type=r,r===D8&&(e.thumbSrc=e.thumbSrc||e.src)}setContent(e){const n=this.instance.optionFor(e,"src")||"";if(e&&e.type&&n){switch(e.type){case S2:this.instance.setContent(e,n);break;case z1:const r=this.option("videoTpl");r&&this.instance.setContent(e,r.replace(/\{\{src\}\}/gi,n+"").replace(/\{\{format\}\}/gi,this.optionFor(e,"videoFormat")||"").replace(/\{\{poster\}\}/gi,e.poster||e.thumbSrc||""));break;case"inline":case"clone":this.setInlineContent(e);break;case"ajax":this.loadAjaxContent(e);break;case"pdf":case C2:case kf:case Og:e.preload=!1;case"iframe":this.setIframeContent(e)}this.setAspectRatio(e)}}setAspectRatio(e){const n=e.contentEl;if(!(e.el&&n&&e.type&&[kf,Og,z1].includes(e.type)))return;let r,i=e.width||"auto",o=e.height||"auto";if(i==="auto"||o==="auto"){r=this.optionFor(e,"videoRatio");const c=(r+"").match(/(\d+)\s*\/\s?(\d+)/);r=c&&c.length>2?parseFloat(c[1])/parseFloat(c[2]):parseFloat(r+"")}else i&&o&&(r=i/o);if(!r)return;n.style.aspectRatio="",n.style.width="",n.style.height="",n.offsetHeight;const s=n.getBoundingClientRect(),a=s.width||1,l=s.height||1;n.style.aspectRatio=r+"",r{e.timer=null,e.inHover||e.onTimerEnd()},r),e.emit("set")}clear(){const e=this;e.timer&&(clearTimeout(e.timer),e.timer=null),e.removeProgressBar()}start(){const e=this;if(e.set(),e.state!==V1){if(e.option("pauseOnHover")){const n=e.instance.container;n.addEventListener("mouseenter",e.onMouseEnter,!1),n.addEventListener("mouseleave",e.onMouseLeave,!1)}document.addEventListener("visibilitychange",e.onVisibilityChange,!1),e.emit("start")}}stop(){const e=this,n=e.state,r=e.instance.container;e.clear(),e.state=V1,r.removeEventListener("mouseenter",e.onMouseEnter,!1),r.removeEventListener("mouseleave",e.onMouseLeave,!1),document.removeEventListener("visibilitychange",e.onVisibilityChange,!1),Ii(r,"has-autoplay"),n!==V1&&e.emit("stop")}pause(){const e=this;e.state===YC&&(e.state=ZC,e.clear(),e.emit(ZC))}resume(){const e=this,n=e.instance;if(n.isInfinite||n.page!==n.pages.length-1)if(e.state!==YC){if(e.state===ZC&&!e.inHover){const r=new Event("resume",{bubbles:!0,cancelable:!0});e.emit("resume",r),r.defaultPrevented||e.set()}}else e.set();else e.stop()}toggle(){this.state===YC||this.state===ZC?this.stop():this.start()}attach(){const e=this,n=e.instance;n.on("ready",e.onReady),n.on("Panzoom.startAnimation",e.onChange),n.on("Panzoom.endAnimation",e.onSettle),n.on("Panzoom.touchMove",e.onChange)}detach(){const e=this,n=e.instance;n.off("ready",e.onReady),n.off("Panzoom.startAnimation",e.onChange),n.off("Panzoom.endAnimation",e.onSettle),n.off("Panzoom.touchMove",e.onChange),e.stop()}}Object.defineProperty(F8,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});let $8=class extends mh{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null})}onPrepare(e){const n=e.carousel;if(!n)return;const r=e.container;r&&(n.options.Autoplay=nc({autoStart:!1},this.option("Autoplay")||{},{pauseOnHover:!1,timeout:this.option("timeout"),progressParentEl:()=>this.option("progressParentEl")||null,on:{start:()=>{e.emit("startSlideshow")},set:i=>{var o;r.classList.add("has-slideshow"),((o=e.getSlide())===null||o===void 0?void 0:o.state)!==Xa.Ready&&i.pause()},stop:()=>{r.classList.remove("has-slideshow"),e.isCompact||e.endIdle(),e.emit("endSlideshow")},resume:(i,o)=>{var s,a,l;!o||!o.cancelable||((s=e.getSlide())===null||s===void 0?void 0:s.state)===Xa.Ready&&(!((l=(a=e.carousel)===null||a===void 0?void 0:a.panzoom)===null||l===void 0)&&l.isResting)||o.preventDefault()}}}),n.attachPlugins({Autoplay:F8}),this.ref=n.plugins.Autoplay)}onReady(e){const n=e.carousel,r=this.ref;r&&n&&this.option("playOnStart")&&(n.isInfinite||n.page{e.isCurrentSlide(n)&&r.stop()}),e.isCurrentSlide(n)&&r.resume()}onKeydown(e,n){var r;const i=this.ref;i&&n===this.option("key")&&((r=document.activeElement)===null||r===void 0?void 0:r.nodeName)!=="BUTTON"&&i.toggle()}attach(){const e=this,n=e.instance;n.on("Carousel.init",e.onPrepare),n.on("Carousel.ready",e.onReady),n.on("done",e.onDone),n.on("keydown",e.onKeydown)}detach(){const e=this,n=e.instance;n.off("Carousel.init",e.onPrepare),n.off("Carousel.ready",e.onReady),n.off("done",e.onDone),n.off("keydown",e.onKeydown)}};Object.defineProperty($8,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{key:" ",playOnStart:!1,progressParentEl:t=>{var e;return((e=t.instance.container)===null||e===void 0?void 0:e.querySelector(".fancybox__toolbar [data-fancybox-toggle-slideshow]"))||t.instance.container},timeout:3e3}});const z8={classes:{container:"f-thumbs f-carousel__thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide",isResting:"is-resting",isSelected:"is-selected",isLoading:"is-loading",hasThumbs:"has-thumbs"},minCount:2,parentEl:null,thumbTpl:'',type:"modern"};var Tf;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Hidden=2]="Hidden"})(Tf||(Tf={}));const V8="isResting",XC="thumbWidth",k0="thumbHeight",hd="thumbClipWidth";let j8=class extends mh{constructor(){super(...arguments),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"modern"}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"thumbWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbClipWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbExtraGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Tf.Init})}get isModern(){return this.type==="modern"}onInitSlide(e,n){const r=n.el?n.el.dataset:void 0;r&&(n.thumbSrc=r.thumbSrc||n.thumbSrc||"",n[hd]=parseFloat(r[hd]||"")||n[hd]||0,n[k0]=parseFloat(r.thumbHeight||"")||n[k0]||0),this.addSlide(n)}onInitSlides(){this.build()}onChange(){var e;if(!this.isModern)return;const n=this.container,r=this.instance,i=r.panzoom,o=this.carousel,s=o?o.panzoom:null,a=r.page;if(i&&o&&s){if(i.isDragging){Ii(n,this.cn(V8));let l=((e=o.pages[a])===null||e===void 0?void 0:e.pos)||0;l+=r.getProgress(a)*(this[hd]+this.thumbGap);let c=s.getBounds();-1*l>c.x.min&&-1*lparseFloat(getComputedStyle(e).getPropertyValue("--f-thumb-"+r))||0;this.thumbGap=n("gap"),this.thumbExtraGap=n("extra-gap"),this[XC]=n("width")||40,this[hd]=n("clip-width")||40,this[k0]=n("height")||40}build(){const e=this;if(e.state!==Tf.Init)return;if(e.isDisabled())return void e.emit("disabled");const n=e.instance,r=n.container,i=e.getSlides(),o=e.option("type");e.type=o;const s=e.option("parentEl"),a=e.cn("container"),l=e.cn("track");let c=s==null?void 0:s.querySelector("."+a);c||(c=document.createElement("div"),Tn(c,a),s?s.appendChild(c):r.after(c)),Tn(c,`is-${o}`),Tn(r,e.cn("hasThumbs")),e.container=c,e.updateProps();let u=c.querySelector("."+l);u||(u=document.createElement("div"),Tn(u,e.cn("track")),c.appendChild(u)),e.track=u;const d=nc({},{track:u,infinite:!1,center:!0,fill:o==="classic",dragFree:!0,slidesPerPage:1,transition:!1,preload:.25,friction:.12,Panzoom:{maxVelocity:0},Dots:!1,Navigation:!1,classes:{container:"f-thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide"}},e.option("Carousel")||{},{Sync:{target:n},slides:i}),p=new n.constructor(c,d);p.on("createSlide",(m,y)=>{e.setProps(y.index),e.emit("createSlide",y,y.el)}),p.on("ready",()=>{e.shiftModern(),e.emit("ready")}),p.on("refresh",()=>{e.shiftModern()}),p.on("Panzoom.click",(m,y,w)=>{e.onClick(w)}),e.carousel=p,e.state=Tf.Ready}onClick(e){e.preventDefault(),e.stopPropagation();const n=this.instance,{pages:r,page:i}=n,o=x=>{if(x){const C=x.closest("[data-carousel-index]");if(C)return[parseInt(C.dataset.carouselIndex||"",10)||0,C]}return[-1,void 0]},s=(x,C)=>{const S=document.elementFromPoint(x,C);return S?o(S):[-1,void 0]};let[a,l]=o(e.target);if(a>-1)return;const c=this[hd],u=e.clientX,d=e.clientY;let[p,m]=s(u-c,d),[y,w]=s(u+c,d);m&&w?(a=Math.abs(u-m.getBoundingClientRect().right)-1&&r[a]&&n.slideTo(a)}getShift(e){var n;const r=this,{instance:i}=r,o=r.carousel;if(!i||!o)return 0;const s=r[XC],a=r[hd],l=r.thumbGap,c=r.thumbExtraGap;if(!(!((n=o.slides[e])===null||n===void 0)&&n.el))return 0;const u=.5*(s-a),d=i.pages.length-1;let p=i.getProgress(0),m=i.getProgress(d),y=i.getProgress(e,!1,!0),w=0,x=u+c+l;const C=p<0&&p>-1,S=m>0&&m<1;return e===0?(w=x*Math.abs(p),S&&p===1&&(w-=x*Math.abs(m))):e===d?(w=x*Math.abs(m)*-1,C&&m===-1&&(w+=x*Math.abs(p))):C||S?(w=-1*x,w+=x*Math.abs(p),w+=x*(1-Math.abs(m))):w=x*y,w}setProps(e){var n;const r=this;if(!r.isModern)return;const{instance:i}=r,o=r.carousel;if(i&&o){const s=(n=o.slides[e])===null||n===void 0?void 0:n.el;if(s&&s.childNodes.length){let a=Kt(1-Math.abs(i.getProgress(e))),l=Kt(r.getShift(e));s.style.setProperty("--progress",a?a+"":""),s.style.setProperty("--shift",l+"")}}}shiftModern(){const e=this;if(!e.isModern)return;const{instance:n,track:r}=e,i=n.panzoom,o=e.carousel;if(!(n&&r&&i&&o)||i.state===Ni.Init||i.state===Ni.Destroy)return;for(const a of n.slides)e.setProps(a.index);let s=(e[hd]+e.thumbGap)*(o.slides.length||0);r.style.setProperty("--width",s+"")}cleanup(){const e=this;e.carousel&&e.carousel.destroy(),e.carousel=null,e.container&&e.container.remove(),e.container=null,e.track&&e.track.remove(),e.track=null,e.state=Tf.Init,Ii(e.instance.container,e.cn("hasThumbs"))}attach(){const e=this,n=e.instance;n.on("initSlide",e.onInitSlide),n.state===_s.Init?n.on("initSlides",e.onInitSlides):e.onInitSlides(),n.on(["change","Panzoom.afterTransform"],e.onChange),n.on("Panzoom.refresh",e.onRefresh)}detach(){const e=this,n=e.instance;n.off("initSlide",e.onInitSlide),n.off("initSlides",e.onInitSlides),n.off(["change","Panzoom.afterTransform"],e.onChange),n.off("Panzoom.refresh",e.onRefresh),e.cleanup()}};Object.defineProperty(j8,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:z8});const gve=Object.assign(Object.assign({},z8),{key:"t",showOnStart:!0,parentEl:null}),U8="is-masked",H8="aria-hidden";let W8=class extends mh{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hidden",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get isEnabled(){const e=this.ref;return e&&!e.isDisabled()}get isHidden(){return this.hidden}onClick(e,n){n.stopPropagation()}onCreateSlide(e,n){var r,i,o;const s=((o=(i=(r=this.instance)===null||r===void 0?void 0:r.carousel)===null||i===void 0?void 0:i.slides[n.index])===null||o===void 0?void 0:o.type)||"",a=n.el;if(a&&s){let l=`for-${s}`;["video","youtube","vimeo","html5video"].includes(s)&&(l+=" for-video"),Tn(a,l)}}onInit(){var e;const n=this,r=n.instance,i=r.carousel;if(n.ref||!i)return;const o=n.option("parentEl")||r.footer||r.container;if(!o)return;const s=nc({},n.options,{parentEl:o,classes:{container:"f-thumbs fancybox__thumbs"},Carousel:{Sync:{friction:r.option("Carousel.friction")||0}},on:{ready:a=>{const l=a.container;l&&this.hidden&&(n.refresh(),l.style.transition="none",n.hide(),l.offsetHeight,queueMicrotask(()=>{l.style.transition="",n.show()}))}}});s.Carousel=s.Carousel||{},s.Carousel.on=nc(((e=n.options.Carousel)===null||e===void 0?void 0:e.on)||{},{click:this.onClick,createSlide:this.onCreateSlide}),i.options.Thumbs=s,i.attachPlugins({Thumbs:j8}),n.ref=i.plugins.Thumbs,n.option("showOnStart")||(n.ref.state=Tf.Hidden,n.hidden=!0)}onResize(){var e;const n=(e=this.ref)===null||e===void 0?void 0:e.container;n&&(n.style.maxHeight="")}onKeydown(e,n){const r=this.option("key");r&&r===n&&this.toggle()}toggle(){const e=this.ref;if(e&&!e.isDisabled())return e.state===Tf.Hidden?(e.state=Tf.Init,void e.build()):void(this.hidden?this.show():this.hide())}show(){const e=this.ref;if(!e||e.isDisabled())return;const n=e.container;n&&(this.refresh(),n.offsetHeight,n.removeAttribute(H8),n.classList.remove(U8),this.hidden=!1)}hide(){const e=this.ref,n=e&&e.container;n&&(this.refresh(),n.offsetHeight,n.classList.add(U8),n.setAttribute(H8,"true")),this.hidden=!0}refresh(){const e=this.ref;if(!e||!e.state)return;const n=e.container,r=(n==null?void 0:n.firstChild)||null;n&&r&&r.childNodes.length&&(n.style.maxHeight=`${r.getBoundingClientRect().height}px`)}attach(){const e=this,n=e.instance;n.state===ca.Init?n.on("Carousel.init",e.onInit):e.onInit(),n.on("resize",e.onResize),n.on("keydown",e.onKeydown)}detach(){var e;const n=this,r=n.instance;r.off("Carousel.init",n.onInit),r.off("resize",n.onResize),r.off("keydown",n.onKeydown),(e=r.carousel)===null||e===void 0||e.detachPlugins(["Thumbs"]),n.ref=null}};Object.defineProperty(W8,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:gve});const k2={panLeft:{icon:'',change:{panX:-100}},panRight:{icon:'',change:{panX:100}},panUp:{icon:'',change:{panY:-100}},panDown:{icon:'',change:{panY:100}},zoomIn:{icon:'',action:"zoomIn"},zoomOut:{icon:'',action:"zoomOut"},toggle1to1:{icon:'',action:"toggleZoom"},toggleZoom:{icon:'',action:"toggleZoom"},iterateZoom:{icon:'',action:"iterateZoom"},rotateCCW:{icon:'',action:"rotateCCW"},rotateCW:{icon:'',action:"rotateCW"},flipX:{icon:'',action:"flipX"},flipY:{icon:'',action:"flipY"},fitX:{icon:'',action:"fitX"},fitY:{icon:'',action:"fitY"},reset:{icon:'',action:"reset"},toggleFS:{icon:'',action:"toggleFS"}};var Dg;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Disabled=2]="Disabled"})(Dg||(Dg={}));const yve={absolute:"auto",display:{left:["infobar"],middle:[],right:["iterateZoom","slideshow","fullscreen","thumbs","close"]},enabled:"auto",items:{infobar:{tpl:'
/
'},download:{tpl:'
'},prev:{tpl:''},next:{tpl:''},slideshow:{tpl:''},fullscreen:{tpl:''},thumbs:{tpl:''},close:{tpl:''}},parentEl:null},vve={tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},G8="has-toolbar",T2="fancybox__toolbar";let q8=class extends mh{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Dg.Init}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null})}onReady(e){var n;if(!e.carousel)return;let r=this.option("display"),i=this.option("absolute"),o=this.option("enabled");if(o==="auto"){const c=this.instance.carousel;let u=0;if(c)for(const d of c.slides)(d.panzoom||d.type==="image")&&u++;u||(o=!1)}o||(r=void 0);let s=0;const a={left:[],middle:[],right:[]};if(r)for(const c of["left","middle","right"])for(const u of r[c]){const d=this.createEl(u);d&&((n=a[c])===null||n===void 0||n.push(d),s++)}let l=null;if(s&&(l=this.createContainer()),l){for(const[c,u]of Object.entries(a)){const d=document.createElement("div");Tn(d,T2+"__column is-"+c);for(const p of u)d.appendChild(p);i!=="auto"||c!=="middle"||u.length||(i=!0),l.appendChild(d)}i===!0&&Tn(l,"is-absolute"),this.state=Dg.Ready,this.onRefresh()}else this.state=Dg.Disabled}onClick(e){var n,r;const i=this.instance,o=i.getSlide(),s=o==null?void 0:o.panzoom,a=e.target,l=a&&rc(a)?a.dataset:null;if(!l)return;if(l.fancyboxToggleThumbs!==void 0)return e.preventDefault(),e.stopPropagation(),void((n=i.plugins.Thumbs)===null||n===void 0||n.toggle());if(l.fancyboxToggleFullscreen!==void 0)return e.preventDefault(),e.stopPropagation(),void this.instance.toggleFullscreen();if(l.fancyboxToggleSlideshow!==void 0){e.preventDefault(),e.stopPropagation();const d=(r=i.carousel)===null||r===void 0?void 0:r.plugins.Autoplay;let p=d.isActive;return s&&s.panMode==="mousemove"&&!p&&s.reset(),void(p?d.stop():d.start())}const c=l.panzoomAction,u=l.panzoomChange;if((u||c)&&(e.preventDefault(),e.stopPropagation()),u){let d={};try{d=JSON.parse(u)}catch{}s&&s.applyChange(d)}else c&&s&&s[c]&&s[c]()}onChange(){this.onRefresh()}onRefresh(){if(this.instance.isClosing())return;const e=this.container;if(!e)return;const n=this.instance.getSlide();if(!n||n.state!==Xa.Ready)return;const r=n&&!n.error&&n.panzoom;for(const s of e.querySelectorAll("[data-panzoom-action]"))r?(s.removeAttribute("disabled"),s.removeAttribute("tabindex")):(s.setAttribute("disabled",""),s.setAttribute("tabindex","-1"));let i=r&&r.canZoomIn(),o=r&&r.canZoomOut();for(const s of e.querySelectorAll('[data-panzoom-action="zoomIn"]'))i?(s.removeAttribute("disabled"),s.removeAttribute("tabindex")):(s.setAttribute("disabled",""),s.setAttribute("tabindex","-1"));for(const s of e.querySelectorAll('[data-panzoom-action="zoomOut"]'))o?(s.removeAttribute("disabled"),s.removeAttribute("tabindex")):(s.setAttribute("disabled",""),s.setAttribute("tabindex","-1"));for(const s of e.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){o||i?(s.removeAttribute("disabled"),s.removeAttribute("tabindex")):(s.setAttribute("disabled",""),s.setAttribute("tabindex","-1"));const a=s.querySelector("g");a&&(a.style.display=i?"":"none")}}onDone(e,n){var r;(r=n.panzoom)===null||r===void 0||r.on("afterTransform",()=>{this.instance.isCurrentSlide(n)&&this.onRefresh()}),this.instance.isCurrentSlide(n)&&this.onRefresh()}createContainer(){const e=this.instance.container;if(!e)return null;const n=this.option("parentEl")||e;let r=n.querySelector("."+T2);return r||(r=document.createElement("div"),Tn(r,T2),n.prepend(r)),r.addEventListener("click",this.onClick,{passive:!1,capture:!0}),e&&Tn(e,G8),this.container=r,r}createEl(e){const n=this.instance,r=n.carousel;if(!r||e==="toggleFS"||e==="fullscreen"&&!T8())return null;let i=null;const o=r.slides.length||0;let s=0,a=0;for(const c of r.slides)(c.panzoom||c.type==="image")&&s++,(c.type==="image"||c.downloadSrc)&&a++;if(o<2&&["infobar","prev","next"].includes(e))return i;if(k2[e]!==void 0&&!s||e==="download"&&!a)return null;if(e==="thumbs"){const c=n.plugins.Thumbs;if(!c||!c.isEnabled)return null}if(e==="slideshow"&&(!r.plugins.Autoplay||o<2))return null;if(k2[e]!==void 0){const c=k2[e];i=document.createElement("button"),i.setAttribute("title",this.instance.localize(`{{${e.toUpperCase()}}}`)),Tn(i,"f-button"),c.action&&(i.dataset.panzoomAction=c.action),c.change&&(i.dataset.panzoomChange=JSON.stringify(c.change)),i.appendChild(cd(this.instance.localize(c.icon)))}else{const c=(this.option("items")||[])[e];c&&(i=cd(this.instance.localize(c.tpl)),typeof c.click=="function"&&i.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),typeof c.click=="function"&&c.click.call(this,this,u)}))}const l=i==null?void 0:i.querySelector("svg");if(l)for(const[c,u]of Object.entries(vve))l.getAttribute(c)||l.setAttribute(c,String(u));return i}removeContainer(){const e=this.container;e&&e.remove(),this.container=null,this.state=Dg.Disabled;const n=this.instance.container;n&&Ii(n,G8)}attach(){const e=this,n=e.instance;n.on("Carousel.initSlides",e.onReady),n.on("done",e.onDone),n.on(["reveal","Carousel.change"],e.onChange),e.onReady(e.instance)}detach(){const e=this,n=e.instance;n.off("Carousel.initSlides",e.onReady),n.off("done",e.onDone),n.off(["reveal","Carousel.change"],e.onChange),e.removeContainer()}};Object.defineProperty(q8,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:yve});const _ve={Hash:class extends mh{onReady(){$1=!1}onChange(t){Ng&&clearTimeout(Ng);const{hash:e}=A8(),{hash:n}=GC(),r=t.isOpeningSlide(t.getSlide());r&&(M8=n===e?"":n),e&&e!==n&&(Ng=setTimeout(()=>{try{if(t.state===ca.Ready){let i="replaceState";r&&!WC&&(i="pushState",WC=!0),window.history[i]({},document.title,window.location.pathname+window.location.search+e)}}catch{}},300))}onClose(t){if(Ng&&clearTimeout(Ng),!$1&&WC)return WC=!1,$1=!1,void window.history.back();if(!$1)try{window.history.replaceState({},document.title,window.location.pathname+window.location.search+(M8||""))}catch{}}attach(){const t=this.instance;t.on("ready",this.onReady),t.on(["Carousel.ready","Carousel.change"],this.onChange),t.on("close",this.onClose)}detach(){const t=this.instance;t.off("ready",this.onReady),t.off(["Carousel.ready","Carousel.change"],this.onChange),t.off("close",this.onClose)}static parseURL(){return GC()}static startFromUrl(){I8()}static destroy(){window.removeEventListener("hashchange",P8,!1)}},Html:B8,Images:O8,Slideshow:$8,Thumbs:W8,Toolbar:q8},Y8="with-fancybox",M2="hide-scrollbar",Z8="--fancybox-scrollbar-compensate",X8="--fancybox-body-margin",A2="aria-hidden",I2="is-using-tab",L2="is-animated",K8="is-compact",J8="is-loading",P2="is-opening",KC="has-caption",T0="disabled",Rg="tabindex",Q8="download",N2="href",M0="src",Vp=t=>typeof t=="string",ej=function(){var t=window.getSelection();return!!t&&t.type==="Range"};let Cu,ku=null,Bg=null,tj=0,nj=0,rj=0,ij=0;const A0=new Map;let bve=0;class pi extends g2{get isIdle(){return this.idle}get isCompact(){return this.option("compact")}constructor(e=[],n={},r={}){super(n),Object.defineProperty(this,"userSlides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"idle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"idleTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pwt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreFocusChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"startedFs",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:ca.Init}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"lastFocus",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Cu||(Cu=T8()),this.id=n.id||++bve,A0.set(this.id,this),this.userSlides=e,this.userPlugins=r,queueMicrotask(()=>{this.init()})}init(){if(this.state===ca.Destroy)return;this.state=ca.Init,this.attachPlugins(Object.assign(Object.assign({},pi.Plugins),this.userPlugins)),this.emit("init"),this.emit("attachPlugins"),this.option("hideScrollbar")===!0&&(()=>{if(!F1)return;const n=document,r=n.body,i=n.documentElement;if(r.classList.contains(M2))return;let o=window.innerWidth-i.getBoundingClientRect().width;const s=parseFloat(window.getComputedStyle(r).marginRight);o<0&&(o=0),i.style.setProperty(Z8,`${o}px`),s&&r.style.setProperty(X8,`${s}px`),r.classList.add(M2)})(),this.initLayout(),this.scale();const e=()=>{this.initCarousel(this.userSlides),this.state=ca.Ready,this.attachEvents(),this.emit("ready"),setTimeout(()=>{this.container&&this.container.setAttribute(A2,"false")},16)};this.option("Fullscreen.autoStart")&&Cu&&!Cu.isFullscreen()?Cu.request().then(()=>{this.startedFs=!0,e()}).catch(()=>e()):e()}initLayout(){var e,n;const r=this.option("parentEl")||document.body,i=cd(this.localize(this.option("tpl.main")||""));if(i){if(i.setAttribute("id",`fancybox-${this.id}`),i.setAttribute("aria-label",this.localize("{{MODAL}}")),i.classList.toggle(K8,this.isCompact),Tn(i,this.option("mainClass")||""),Tn(i,P2),this.container=i,this.footer=i.querySelector(".fancybox__footer"),r.appendChild(i),Tn(document.documentElement,Y8),ku&&Bg||(ku=document.createElement("span"),Tn(ku,"fancybox-focus-guard"),ku.setAttribute(Rg,"0"),ku.setAttribute(A2,"true"),ku.setAttribute("aria-label","Focus guard"),Bg=ku.cloneNode(),(e=i.parentElement)===null||e===void 0||e.insertBefore(ku,i),(n=i.parentElement)===null||n===void 0||n.append(Bg)),i.addEventListener("mousedown",o=>{tj=o.pageX,nj=o.pageY,Ii(i,I2)}),this.option("closeExisting"))for(const o of A0.values())o.id!==this.id&&o.close();else this.option("animated")&&(Tn(i,L2),setTimeout(()=>{this.isClosing()||Ii(i,L2)},350));this.emit("initLayout")}}initCarousel(e){const n=this.container;if(!n)return;const r=n.querySelector(".fancybox__carousel");if(!r)return;const i=this.carousel=new zp(r,nc({},{slides:e,transition:"fade",Panzoom:{lockAxis:this.option("dragToClose")?"xy":"x",infinite:!!this.option("dragToClose")&&"y"},Dots:!1,Navigation:{classes:{container:"fancybox__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"}},initialPage:this.option("startIndex"),l10n:this.option("l10n")},this.option("Carousel")||{}));i.on("*",(o,s,...a)=>{this.emit(`Carousel.${s}`,o,...a)}),i.on(["ready","change"],()=>{this.manageCaption()}),this.on("Carousel.removeSlide",(o,s,a)=>{this.clearContent(a),a.state=void 0}),i.on("Panzoom.touchStart",()=>{var o,s;this.isCompact||this.endIdle(),!((o=document.activeElement)===null||o===void 0)&&o.closest(".f-thumbs")&&((s=this.container)===null||s===void 0||s.focus())}),i.on("settle",()=>{this.idleTimer||this.isCompact||!this.option("idle")||this.setIdle(),this.option("autoFocus")&&!this.isClosing&&this.checkFocus()}),this.option("dragToClose")&&(i.on("Panzoom.afterTransform",(o,s)=>{const a=this.getSlide();if(a&&d2(a.el))return;const l=this.container;if(l){const c=Math.abs(s.current.f),u=c<1?"":Math.max(.5,Math.min(1,1-c/s.contentRect.fitHeight*1.5));l.style.setProperty("--fancybox-ts",u?"0s":""),l.style.setProperty("--fancybox-opacity",u+"")}}),i.on("Panzoom.touchEnd",(o,s,a)=>{var l;const c=this.getSlide();if(c&&d2(c.el)||s.isMobile&&document.activeElement&&["TEXTAREA","INPUT"].indexOf((l=document.activeElement)===null||l===void 0?void 0:l.nodeName)!==-1)return;const u=Math.abs(s.dragOffset.y);s.lockedAxis==="y"&&(u>=200||u>=50&&s.dragOffset.time<300)&&(a&&a.cancelable&&a.preventDefault(),this.close(a,"f-throwOut"+(s.current.f<0?"Up":"Down")))})),i.on("change",o=>{var s;let a=(s=this.getSlide())===null||s===void 0?void 0:s.triggerEl;if(a){const l=new CustomEvent("slideTo",{bubbles:!0,cancelable:!0,detail:o.page});a.dispatchEvent(l)}}),i.on(["refresh","change"],o=>{const s=this.container;if(!s)return;for(const c of s.querySelectorAll("[data-fancybox-current-index]"))c.innerHTML=o.page+1;for(const c of s.querySelectorAll("[data-fancybox-count]"))c.innerHTML=o.pages.length;if(!o.isInfinite){for(const c of s.querySelectorAll("[data-fancybox-next]"))o.page0?(c.removeAttribute(T0),c.removeAttribute(Rg)):(c.setAttribute(T0,""),c.setAttribute(Rg,"-1"))}const a=this.getSlide();if(!a)return;let l=a.downloadSrc||"";l||a.type!=="image"||a.error||!Vp(a[M0])||(l=a[M0]);for(const c of s.querySelectorAll("[data-fancybox-download]")){const u=a.downloadFilename;l?(c.removeAttribute(T0),c.removeAttribute(Rg),c.setAttribute(N2,l),c.setAttribute(Q8,u||l),c.setAttribute("target","_blank")):(c.setAttribute(T0,""),c.setAttribute(Rg,"-1"),c.removeAttribute(N2),c.removeAttribute(Q8))}}),this.emit("initCarousel")}attachEvents(){const e=this,n=e.container;if(!n)return;n.addEventListener("click",e.onClick,{passive:!1,capture:!1}),n.addEventListener("wheel",e.onWheel,{passive:!1,capture:!1}),document.addEventListener("keydown",e.onKeydown,{passive:!1,capture:!0}),document.addEventListener("visibilitychange",e.onVisibilityChange,!1),document.addEventListener("mousemove",e.onMousemove),e.option("trapFocus")&&document.addEventListener("focus",e.onFocus,!0),window.addEventListener("resize",e.onResize);const r=window.visualViewport;r&&(r.addEventListener("scroll",e.onResize),r.addEventListener("resize",e.onResize))}detachEvents(){const e=this,n=e.container;if(!n)return;document.removeEventListener("keydown",e.onKeydown,{passive:!1,capture:!0}),n.removeEventListener("wheel",e.onWheel,{passive:!1,capture:!1}),n.removeEventListener("click",e.onClick,{passive:!1,capture:!1}),document.removeEventListener("mousemove",e.onMousemove),window.removeEventListener("resize",e.onResize);const r=window.visualViewport;r&&(r.removeEventListener("resize",e.onResize),r.removeEventListener("scroll",e.onResize)),document.removeEventListener("visibilitychange",e.onVisibilityChange,!1),document.removeEventListener("focus",e.onFocus,!0)}scale(){const e=this.container;if(!e)return;const n=window.visualViewport,r=Math.max(1,(n==null?void 0:n.scale)||1);let i="",o="",s="";if(n&&r>1){let a=`${n.offsetLeft}px`,l=`${n.offsetTop}px`;i=n.width*r+"px",o=n.height*r+"px",s=`translate3d(${a}, ${l}, 0) scale(${1/r})`}e.style.transform=s,e.style.width=i,e.style.height=o}onClick(e){var n;const{container:r,isCompact:i}=this;if(!r||this.isClosing())return;!i&&this.option("idle")&&this.resetIdle();const o=e.composedPath()[0];if(o.closest(".fancybox-spinner")||o.closest("[data-fancybox-close]"))return e.preventDefault(),void this.close(e);if(o.closest("[data-fancybox-prev]"))return e.preventDefault(),void this.prev();if(o.closest("[data-fancybox-next]"))return e.preventDefault(),void this.next();if(e.type==="click"&&e.detail===0||Math.abs(e.pageX-tj)>30||Math.abs(e.pageY-nj)>30)return;const s=document.activeElement;if(ej()&&s&&r.contains(s))return;if(i&&((n=this.getSlide())===null||n===void 0?void 0:n.type)==="image")return void(this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null):this.clickTimer=setTimeout(()=>{this.toggleIdle(),this.clickTimer=null},350));if(this.emit("click",e),e.defaultPrevented)return;let a=!1;if(o.closest(".fancybox__content")){if(s){if(s.closest("[contenteditable]"))return;o.matches(x2)||s.blur()}if(ej())return;a=this.option("contentClick")}else o.closest(".fancybox__carousel")&&!o.matches(x2)&&(a=this.option("backdropClick"));a==="close"?(e.preventDefault(),this.close(e)):a==="next"?(e.preventDefault(),this.next()):a==="prev"&&(e.preventDefault(),this.prev())}onWheel(e){const n=e.target;let r=this.option("wheel",e);n.closest(".fancybox__thumbs")&&(r="slide");const i=r==="slide",o=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(l,c){return Math.abs(c)>Math.abs(l)?c:l}),s=Math.max(-1,Math.min(1,o)),a=Date.now();this.pwt&&a-this.pwt<300?i&&e.preventDefault():(this.pwt=a,this.emit("wheel",e,s),e.defaultPrevented||(r==="close"?(e.preventDefault(),this.close(e)):r==="slide"&&(BC(n)||(e.preventDefault(),this[s>0?"prev":"next"]()))))}onScroll(){window.scrollTo(rj,ij)}onKeydown(e){if(!this.isTopmost())return;this.isCompact||!this.option("idle")||this.isClosing()||this.resetIdle();const n=e.key,r=this.option("keyboard");if(!r)return;const i=e.composedPath()[0],o=document.activeElement&&document.activeElement.classList,s=o&&o.contains("f-button")||i.dataset.carouselPage||i.dataset.carouselIndex;if(n!=="Escape"&&!s&&rc(i)&&(i.isContentEditable||["TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(i.nodeName)!==-1)||(e.key==="Tab"?Tn(this.container,I2):Ii(this.container,I2),e.ctrlKey||e.altKey||e.shiftKey))return;this.emit("keydown",n,e);const a=r[n];a&&typeof this[a]=="function"&&(e.preventDefault(),this[a]())}onResize(){const e=this.container;if(!e)return;const n=this.isCompact;e.classList.toggle(K8,n),this.manageCaption(this.getSlide()),this.isCompact?this.clearIdle():this.endIdle(),this.scale(),this.emit("resize")}onFocus(e){this.isTopmost()&&this.checkFocus(e)}onMousemove(e){this.prevMouseMoveEvent=e,!this.isCompact&&this.option("idle")&&this.resetIdle()}onVisibilityChange(){document.visibilityState==="visible"?this.checkFocus():this.endIdle()}manageCloseBtn(e){const n=this.optionFor(e,"closeButton")||!1;if(n==="auto"){const i=this.plugins.Toolbar;if(i&&i.state===Dg.Ready)return}if(!n||!e.contentEl||e.closeBtnEl)return;const r=this.option("tpl.closeButton");if(r){const i=cd(this.localize(r));e.closeBtnEl=e.contentEl.appendChild(i),e.el&&Tn(e.el,"has-close-btn")}}manageCaption(e=void 0){var n,r;const i="fancybox__caption",o=this.container;if(!o)return;Ii(o,KC);const s=this.isCompact||this.option("commonCaption"),a=!s;if(this.caption&&this.stop(this.caption),a&&this.caption&&(this.caption.remove(),this.caption=null),s&&!this.caption)for(const d of((n=this.carousel)===null||n===void 0?void 0:n.slides)||[])d.captionEl&&(d.captionEl.remove(),d.captionEl=void 0,Ii(d.el,KC),(r=d.el)===null||r===void 0||r.removeAttribute("aria-labelledby"));if(e||(e=this.getSlide()),!e||s&&!this.isCurrentSlide(e))return;const l=e.el;let c=this.optionFor(e,"caption","");if(!c)return void(s&&this.caption&&this.animate(this.caption,"f-fadeOut",()=>{this.caption&&(this.caption.innerHTML="")}));let u=null;if(a){if(u=e.captionEl||null,l&&!u){const d=i+`_${this.id}_${e.index}`;u=document.createElement("div"),Tn(u,i),u.setAttribute("id",d),e.captionEl=l.appendChild(u),Tn(l,KC),l.setAttribute("aria-labelledby",d)}}else u=this.caption,u||(u=o.querySelector("."+i)),!u&&(u=document.createElement("div"),u.dataset.fancyboxCaption="",Tn(u,i),(this.footer||o).prepend(u)),Tn(o,KC),this.caption=u;u&&(u.innerHTML="",Vp(c)||typeof c=="number"?u.innerHTML=c+"":c instanceof HTMLElement&&u.appendChild(c))}checkFocus(e){this.focus(e)}focus(e){var n;if(this.ignoreFocusChange)return;const r=document.activeElement||null,i=(e==null?void 0:e.target)||null,o=this.container,s=(n=this.carousel)===null||n===void 0?void 0:n.viewport;if(!o||!s||!e&&r&&o.contains(r))return;const a=this.getSlide(),l=a&&a.state===Xa.Ready?a.el:null;if(!l||l.contains(r)||o===r)return;e&&e.cancelable&&e.preventDefault(),this.ignoreFocusChange=!0;const c=Array.from(o.querySelectorAll(x2));let u=[],d=null;for(let m of c){const y=!m.offsetParent||!!m.closest('[aria-hidden="true"]'),w=l&&l.contains(m),x=!s.contains(m);if(m===o||(w||x)&&!y){u.push(m);const C=m.dataset.origTabindex;C!==void 0&&C&&(m.tabIndex=parseFloat(C)),m.removeAttribute("data-orig-tabindex"),!m.hasAttribute("autoFocus")&&d||(d=m)}else{const C=m.dataset.origTabindex===void 0?m.getAttribute("tabindex")||"":m.dataset.origTabindex;C&&(m.dataset.origTabindex=C),m.tabIndex=-1}}let p=null;e?(!i||u.indexOf(i)<0)&&(p=d||o,u.length&&(r===Bg?p=u[0]:this.lastFocus!==o&&r!==ku||(p=u[u.length-1]))):p=a&&a.type==="image"?o:d||o,p&&k8(p),this.lastFocus=document.activeElement,this.ignoreFocusChange=!1}next(){const e=this.carousel;e&&e.pages.length>1&&e.slideNext()}prev(){const e=this.carousel;e&&e.pages.length>1&&e.slidePrev()}jumpTo(...e){this.carousel&&this.carousel.slideTo(...e)}isTopmost(){var e;return((e=pi.getInstance())===null||e===void 0?void 0:e.id)==this.id}animate(e=null,n="",r){if(!e||!n)return void(r&&r());this.stop(e);const i=o=>{o.target===e&&e.dataset.animationName&&(e.removeEventListener("animationend",i),delete e.dataset.animationName,r&&r(),Ii(e,n))};e.dataset.animationName=n,e.addEventListener("animationend",i),Tn(e,n)}stop(e){e&&e.dispatchEvent(new CustomEvent("animationend",{bubbles:!1,cancelable:!0,currentTarget:e}))}setContent(e,n="",r=!0){if(this.isClosing())return;const i=e.el;if(!i)return;let o=null;if(rc(n)?o=n:(o=cd(n+""),rc(o)||(o=document.createElement("div"),o.innerHTML=n+"")),["img","picture","iframe","video","audio"].includes(o.nodeName.toLowerCase())){const s=document.createElement("div");s.appendChild(o),o=s}rc(o)&&e.filter&&!e.error&&(o=o.querySelector(e.filter)),o&&rc(o)?(Tn(o,"fancybox__content"),e.id&&o.setAttribute("id",e.id),i.classList.add(`has-${e.error?"error":e.type||"unknown"}`),i.prepend(o),o.style.display==="none"&&(o.style.display=""),getComputedStyle(o).getPropertyValue("display")==="none"&&(o.style.display=e.display||this.option("defaultDisplay")||"flex"),e.contentEl=o,r&&this.revealContent(e),this.manageCloseBtn(e),this.manageCaption(e)):this.setError(e,"{{ELEMENT_NOT_FOUND}}")}revealContent(e,n){const r=e.el,i=e.contentEl;r&&i&&(this.emit("reveal",e),this.hideLoading(e),e.state=Xa.Opening,(n=this.isOpeningSlide(e)?n===void 0?this.optionFor(e,"showClass"):n:"f-fadeIn")?this.animate(i,n,()=>{this.done(e)}):this.done(e))}done(e){this.isClosing()||(e.state=Xa.Ready,this.emit("done",e),Tn(e.el,"is-done"),this.isCurrentSlide(e)&&this.option("autoFocus")&&queueMicrotask(()=>{var n;(n=e.panzoom)===null||n===void 0||n.updateControls(),this.option("autoFocus")&&this.focus()}),this.isOpeningSlide(e)&&(Ii(this.container,P2),!this.isCompact&&this.option("idle")&&this.setIdle()))}isCurrentSlide(e){const n=this.getSlide();return!(!e||!n)&&n.index===e.index}isOpeningSlide(e){var n,r;return((n=this.carousel)===null||n===void 0?void 0:n.prevPage)===null&&e&&e.index===((r=this.getSlide())===null||r===void 0?void 0:r.index)}showLoading(e){e.state=Xa.Loading;const n=e.el;n&&(Tn(n,J8),this.emit("loading",e),e.spinnerEl||setTimeout(()=>{if(!this.isClosing()&&!e.spinnerEl&&e.state===Xa.Loading){let r=cd(y2);Tn(r,"fancybox-spinner"),e.spinnerEl=r,n.prepend(r),this.animate(r,"f-fadeIn")}},250))}hideLoading(e){const n=e.el;if(!n)return;const r=e.spinnerEl;this.isClosing()?r==null||r.remove():(Ii(n,J8),r&&this.animate(r,"f-fadeOut",()=>{r.remove()}),e.state===Xa.Loading&&(this.emit("loaded",e),e.state=Xa.Ready))}setError(e,n){if(this.isClosing())return;const r=new Event("error",{bubbles:!0,cancelable:!0});if(this.emit("error",r,e),r.defaultPrevented)return;e.error=n,this.hideLoading(e),this.clearContent(e);const i=document.createElement("div");i.classList.add("fancybox-error"),i.innerHTML=this.localize(n||"

{{ERROR}}

"),this.setContent(e,i)}clearContent(e){if(e.state===void 0)return;this.emit("clearContent",e),e.contentEl&&(e.contentEl.remove(),e.contentEl=void 0);const n=e.el;n&&(Ii(n,"has-error"),Ii(n,"has-unknown"),Ii(n,`has-${e.type||"unknown"}`)),e.closeBtnEl&&e.closeBtnEl.remove(),e.closeBtnEl=void 0,e.captionEl&&e.captionEl.remove(),e.captionEl=void 0,e.spinnerEl&&e.spinnerEl.remove(),e.spinnerEl=void 0}getSlide(){var e;const n=this.carousel;return((e=n==null?void 0:n.pages[n==null?void 0:n.page])===null||e===void 0?void 0:e.slides[0])||void 0}close(e,n){if(this.isClosing())return;const r=new Event("shouldClose",{bubbles:!0,cancelable:!0});if(this.emit("shouldClose",r,e),r.defaultPrevented)return;e&&e.cancelable&&(e.preventDefault(),e.stopPropagation());const i=()=>{this.proceedClose(e,n)};this.startedFs&&Cu&&Cu.isFullscreen()?Promise.resolve(Cu.exit()).then(()=>i()):i()}clearIdle(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=null}setIdle(e=!1){const n=()=>{this.clearIdle(),this.idle=!0,Tn(this.container,"is-idle"),this.emit("setIdle")};if(this.clearIdle(),!this.isClosing())if(e)n();else{const r=this.option("idle");r&&(this.idleTimer=setTimeout(n,r))}}endIdle(){this.clearIdle(),this.idle&&!this.isClosing()&&(this.idle=!1,Ii(this.container,"is-idle"),this.emit("endIdle"))}resetIdle(){this.endIdle(),this.setIdle()}toggleIdle(){this.idle?this.endIdle():this.setIdle(!0)}toggleFullscreen(){Cu&&(Cu.isFullscreen()?Cu.exit():Cu.request().then(()=>{this.startedFs=!0}))}isClosing(){return[ca.Closing,ca.CustomClosing,ca.Destroy].includes(this.state)}proceedClose(e,n){var r,i;this.state=ca.Closing,this.clearIdle(),this.detachEvents();const o=this.container,s=this.carousel,a=this.getSlide(),l=a&&this.option("placeFocusBack")?a.triggerEl||this.option("triggerEl"):null;if(l&&(C8(l)?k8(l):l.focus()),o&&(Ii(o,P2),Tn(o,"is-closing"),o.setAttribute(A2,"true"),this.option("animated")&&Tn(o,L2),o.style.pointerEvents="none"),s){s.clearTransitions(),(r=s.panzoom)===null||r===void 0||r.destroy(),(i=s.plugins.Navigation)===null||i===void 0||i.detach();for(const c of s.slides){c.state=Xa.Closing,this.hideLoading(c);const u=c.contentEl;u&&this.stop(u);const d=c==null?void 0:c.panzoom;d&&(d.stop(),d.detachEvents(),d.detachObserver()),this.isCurrentSlide(c)||s.emit("removeSlide",c)}}rj=window.scrollX,ij=window.scrollY,window.addEventListener("scroll",this.onScroll),this.emit("close",e),this.state!==ca.CustomClosing?(n===void 0&&a&&(n=this.optionFor(a,"hideClass")),n&&a?(this.animate(a.contentEl,n,()=>{s&&s.emit("removeSlide",a)}),setTimeout(()=>{this.destroy()},500)):this.destroy()):setTimeout(()=>{this.destroy()},500)}destroy(){var e;if(this.state===ca.Destroy)return;window.removeEventListener("scroll",this.onScroll),this.state=ca.Destroy,(e=this.carousel)===null||e===void 0||e.destroy();const n=this.container;n&&n.remove(),A0.delete(this.id);const r=pi.getInstance();r?r.focus():(ku&&(ku.remove(),ku=null),Bg&&(Bg.remove(),Bg=null),Ii(document.documentElement,Y8),(()=>{if(!F1)return;const i=document,o=i.body;o.classList.remove(M2),o.style.setProperty(X8,""),i.documentElement.style.setProperty(Z8,"")})(),this.emit("destroy"))}static bind(e,n,r){if(!F1)return;let i,o="",s={};if(e===void 0?i=document.body:Vp(e)?(i=document.body,o=e,typeof n=="object"&&(s=n||{})):(i=e,Vp(n)&&(o=n),typeof r=="object"&&(s=r||{})),!i||!rc(i))return;o=o||"[data-fancybox]";const a=pi.openers.get(i)||new Map;a.set(o,s),pi.openers.set(i,a),a.size===1&&i.addEventListener("click",pi.fromEvent)}static unbind(e,n){let r,i="";if(Vp(e)?(r=document.body,i=e):(r=e,Vp(n)&&(i=n)),!r)return;const o=pi.openers.get(r);o&&i&&o.delete(i),i&&o||(pi.openers.delete(r),r.removeEventListener("click",pi.fromEvent))}static destroy(){let e;for(;e=pi.getInstance();)e.destroy();for(const n of pi.openers.keys())n.removeEventListener("click",pi.fromEvent);pi.openers=new Map}static fromEvent(e){if(e.defaultPrevented||e.button&&e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey)return;let n=e.composedPath()[0];const r=n.closest("[data-fancybox-trigger]");if(r){const y=r.dataset.fancyboxTrigger||"",w=document.querySelectorAll(`[data-fancybox="${y}"]`),x=parseInt(r.dataset.fancyboxIndex||"",10)||0;n=w[x]||n}if(!(n&&n instanceof Element))return;let i,o,s,a;if([...pi.openers].reverse().find(([y,w])=>!(!y.contains(n)||![...w].reverse().find(([x,C])=>{let S=n.closest(x);return!!S&&(i=y,o=x,s=S,a=C,!0)}))),!i||!o||!s)return;a=a||{},e.preventDefault(),n=s;let l=[],c=nc({},E2,a);c.event=e,c.triggerEl=n,c.delegate=r;const u=c.groupAll,d=c.groupAttr,p=d&&n?n.getAttribute(`${d}`):"";if((!n||p||u)&&(l=[].slice.call(i.querySelectorAll(o))),n&&!u&&(l=p?l.filter(y=>y.getAttribute(`${d}`)===p):[n]),!l.length)return;const m=pi.getInstance();return m&&m.options.triggerEl&&l.indexOf(m.options.triggerEl)>-1?void 0:(n&&(c.startIndex=l.indexOf(n)),pi.fromNodes(l,c))}static fromSelector(e,n,r){let i=null,o="",s={};if(Vp(e)?(i=document.body,o=e,typeof n=="object"&&(s=n||{})):e instanceof HTMLElement&&Vp(n)&&(i=e,o=n,typeof r=="object"&&(s=r||{})),!i||!o)return!1;const a=pi.openers.get(i);return!!a&&(s=nc({},a.get(o)||{},s),!!s&&pi.fromNodes(Array.from(i.querySelectorAll(o)),s))}static fromNodes(e,n){n=nc({},E2,n||{});const r=[];for(const i of e){const o=i.dataset||{},s=o[M0]||i.getAttribute(N2)||i.getAttribute("currentSrc")||i.getAttribute(M0)||void 0;let a;const l=n.delegate;let c;l&&r.length===n.startIndex&&(a=l instanceof HTMLImageElement?l:l.querySelector("img:not([aria-hidden])")),a||(a=i instanceof HTMLImageElement?i:i.querySelector("img:not([aria-hidden])")),a&&(c=a.currentSrc||a[M0]||void 0,!c&&a.dataset&&(c=a.dataset.lazySrc||a.dataset[M0]||void 0));const u={src:s,triggerEl:i,thumbEl:a,thumbElSrc:c,thumbSrc:c};for(const d in o){let p=o[d]+"";p=p!=="false"&&(p==="true"||p),u[d]=p}r.push(u)}return new pi(r,n)}static getInstance(e){return e?A0.get(e):Array.from(A0.values()).reverse().find(n=>!n.isClosing()&&n)||null}static getSlide(){var e;return((e=pi.getInstance())===null||e===void 0?void 0:e.getSlide())||null}static show(e=[],n={}){return new pi(e,n)}static next(){const e=pi.getInstance();e&&e.next()}static prev(){const e=pi.getInstance();e&&e.prev()}static close(e=!0,...n){if(e)for(const r of A0.values())r.close(...n);else{const r=pi.getInstance();r&&r.close(...n)}}}Object.defineProperty(pi,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.36"}),Object.defineProperty(pi,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:E2}),Object.defineProperty(pi,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:_ve}),Object.defineProperty(pi,"openers",{enumerable:!0,configurable:!0,writable:!0,value:new Map});const j1=Object.freeze(Object.defineProperty({__proto__:null,Carousel:zp,Fancybox:pi,Panzoom:$p},Symbol.toStringTag,{value:"Module"})),{Fancybox:JC}=j1,wve={props:{options:Object},mounted(){JC.defaults={...this.options||{}}},updated(){JC.close(),JC.defaults={...this.options||{}}},unmounted(){JC.close()}},xve={ref:"container"};function Eve(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",xve,[g.renderSlot(t.$slots,"default")],512)}const Sve=xt(wve,[["render",Eve]]),Cve={},kve={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-file-unknown"};function Tve(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",kve,e[0]||(e[0]=[g.createStaticVNode('',5)]))}const O2=xt(Cve,[["render",Tve]]),Mve={componens:{IconFile:O2},props:{item:null},computed:{createDate(){try{const t=Xt(this.item.cdate,"YYYY-MM-DD");return new Date(t).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}},methods:{formatBytes(t){if(t<1024)return`${t} B`;const e=t/1024;return e<1024?`${e.toFixed(2)} KB`:`${(e/1024).toFixed(2)} MB`}}},Ave={class:"max-w-[55vw]"},Ive={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},Lve={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},Pve={class:"px-[5px]"},Nve={class:""};function Ove(t,e,n,r,i,o){var s,a;return g.openBlock(),g.createElementBlock(g.Fragment,null,[e[1]||(e[1]=g.createStaticVNode('
',1)),g.createElementVNode("div",Ave,[g.createElementVNode("p",Ive,g.toDisplayString(n.item.uploaded_name),1),g.createElementVNode("p",Lve,[g.createElementVNode("span",null,g.toDisplayString(n.item.username),1),g.withDirectives(g.createElementVNode("span",Pve,"|",512),[[g.vShow,(s=n.item)==null?void 0:s.username]]),g.createElementVNode("span",null,g.toDisplayString(o.createDate),1),e[0]||(e[0]=g.createElementVNode("span",{class:"px-[5px]"},"|",-1)),g.createElementVNode("span",Nve,g.toDisplayString(o.formatBytes((a=n.item)==null?void 0:a.size)),1)])])],64)}const Dve=xt(Mve,[["render",Ove]]),Rve={},Bve={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function Fve(t,e){return g.openBlock(),g.createElementBlock("svg",Bve,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),g.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),g.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const QC=xt(Rve,[["render",Fve]]),$ve={},zve={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function Vve(t,e){return g.openBlock(),g.createElementBlock("svg",zve,e[0]||(e[0]=[g.createStaticVNode('',6)]))}const D2=xt($ve,[["render",Vve]]),jve={components:{Fancybox:Sve,VsWidgetFileInfo:Dve,IconDownload:QC,IconTrash:D2},props:{item:null,prefix:{type:String,default:"/api"}},data(){return{optionsFile:{defaultType:"iframe"}}},computed:{createDate(){try{const t=Xt(this.item.cdate,"YYYY-MM-DD");return new Date(t).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}},methods:{isSupportedFile(t){return["pdf","json"].includes(t.ext)},isSupportedAllFile(t){return["ppt","pptx","doc","docx","xls","xlsx"].includes(t.ext)},async downloadFile(t){const e=document.createElement("a");e.setAttribute("download",t.uploaded_name),e.href=t.file_path,e.click()},confirnDeleteFile(){this.$emit("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:this.deleteFile,updateListOnConfirm:!0})},async deleteFile(){try{await un.delete(`${this.prefix}/widget/file/${this.item.entity_id}/${this.item.file_id}`),this.$emit("update")}catch(t){console.error(t)}}}},Uve={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},Hve={key:0,class:"flex w-full gap-x-3 items-center"},Wve=["href"],Gve={key:1,class:"flex gap-x-3 w-full items-center"},qve=["href"],Yve={key:2,class:"flex gap-x-3 w-full items-center"},Zve=["href"],Xve={key:3,class:"flex gap-x-3 w-full items-center"},Kve={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},Jve={class:"p-0.5 sm:p-1 inline-flex items-center gap-0.5 bg-white rounded-lg dark:bg-neutral-800 dark:border-neutral-700"},Qve={class:"inline-block"},e0e={class:"inline-block"};function t0e(t,e,n,r,i,o){const s=g.resolveComponent("VsWidgetFileInfo"),a=g.resolveComponent("Fancybox"),l=g.resolveComponent("IconDownload"),c=g.resolveComponent("IconTrash");return g.openBlock(),g.createElementBlock("div",Uve,[n.item.ext==="jpg"||n.item.ext==="png"?(g.openBlock(),g.createElementBlock("div",Hve,[g.createVNode(a,null,{default:g.withCtx(()=>[g.createElementVNode("a",{"data-fancybox":"gallery",href:n.item.file_path,target:"_blank",class:"flex gap-x-3 w-full items-center"},[g.createVNode(s,{item:n.item},null,8,["item"])],8,Wve)]),_:1})])):o.isSupportedFile(n.item)?(g.openBlock(),g.createElementBlock("div",Gve,[g.createVNode(a,{options:i.optionsFile},{default:g.withCtx(()=>[g.createElementVNode("a",{"data-fancybox":"gallery",href:n.item.file_path,target:"_blank",class:"flex gap-x-3 w-full items-center"},[g.createVNode(s,{item:n.item},null,8,["item"])],8,qve)]),_:1},8,["options"])])):o.isSupportedAllFile(n.item)?(g.openBlock(),g.createElementBlock("div",Yve,[g.createElementVNode("a",{href:`/api/file-preview?id=${n.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[g.createVNode(s,{item:n.item},null,8,["item"])],8,Zve)])):(g.openBlock(),g.createElementBlock("div",Xve,[g.createVNode(s,{item:n.item},null,8,["item"])])),g.createElementVNode("div",Kve,[g.createElementVNode("div",Jve,[g.createElementVNode("div",Qve,[g.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[0]||(e[0]=u=>o.downloadFile(n.item))},[g.createVNode(l,{height:"14",width:"14"})])]),e[2]||(e[2]=g.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),g.createElementVNode("div",e0e,[g.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:e[1]||(e[1]=u=>o.confirnDeleteFile())},[g.createVNode(c,{height:"14",width:"14"})])])])])])}const n0e=xt(jve,[["render",t0e]]),r0e={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700"},i0e={class:"flex w-full mb-[12px] items-center gap-x-2"},o0e={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},s0e={class1:"ml-auto"},a0e={class:"py-1.5 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg bg-gray-100 cursor-pointer hover:bg-gray-200 text-gray-800 shadow-2xs hover:bg-gray-50 focus:outline-hidden focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},l0e={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},c0e={class:"relative"},u0e={key:1,class:"space-y-3 max-h-[300px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},h0e={key:0},d0e={class:"p-4"},f0e={class:"mt-1 text-gray-500 dark:text-neutral-500"},p0e={class:"flex justify-end mt-4 gap-x-3"},m0e={__name:"vs-form-file-list-new",props:{id:{type:String,default:""},prefix:{type:String,default:"/api"}},emits:["update"],setup(t,{emit:e}){const{Fancybox:n}=j1,r=t,i=g.inject("formId"),o=e,s=g.computed(()=>i.value||r.id),a=g.ref(!1),l=g.ref({}),c=g.ref(""),u=g.ref(""),d=g.computed(()=>u.value===""?c.value:c.value.filter(x=>x.uploaded_name.includes(u.value))),p=async()=>{try{const{data:x}=await un.get(`${r.prefix}/widget/file/${s.value}`);n.bind("[data-fancybox='gallery']"),c.value=x==null?void 0:x.rows}catch(x){console.error(x)}},m=async x=>{await Promise.all(Array.from(x.target.files).map(async C=>{const S=new FormData;S.append("file",C);try{const M=`${r.prefix}/widget/file/${s.value}`;return await un.post(M,S),o("update","file-list"),C}catch(M){return console.error(M),null}})),await p()},y=x=>{const C={...x};return x.cancel||(C.cancel=()=>{a.value=!1}),x.updateListOnConfirm&&(C.confirm=async()=>{await x.confirm(),a.value=!1,p()}),C},w=x=>{l.value=y(x),a.value=!0};return g.watch(s,x=>{x&&p()}),g.onMounted(()=>{s.value&&p()}),(x,C)=>{var M,E,A;const S=g.resolveComponent("VsDialog");return g.openBlock(),g.createElementBlock("div",r0e,[g.createElementVNode("div",i0e,[g.createElementVNode("h2",o0e," Файлів: "+g.toDisplayString((M=c.value)==null?void 0:M.length),1),g.createElementVNode("div",s0e,[g.createElementVNode("label",null,[g.createElementVNode("input",{type:"file",class:"hidden",onChange:C[0]||(C[0]=I=>m(I))},null,32),g.createElementVNode("div",a0e,[g.createVNode(QC,{height:"16",width:"16"})])])])]),((E=c.value)==null?void 0:E.length)>4?(g.openBlock(),g.createElementBlock("div",l0e,[g.createElementVNode("div",null,[g.createElementVNode("div",c0e,[C[7]||(C[7]=g.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[g.createElementVNode("svg",{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[g.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),g.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),g.withDirectives(g.createElementVNode("input",{type:"text","onUpdate:modelValue":C[1]||(C[1]=I=>u.value=I),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[g.vModelText,u.value,void 0,{trim:!0}]])])])])):g.createCommentVNode("",!0),(A=c.value)!=null&&A.length?(g.openBlock(),g.createElementBlock("div",u0e,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(d.value,(I,O)=>(g.openBlock(),g.createBlock(n0e,{key:O,id:t.id,prefix:t.prefix,item:I,onUpdate:C[2]||(C[2]=z=>x.$emit("update","file-list")),onOpenModal:C[3]||(C[3]=z=>w(z))},null,8,["id","prefix","item"]))),128)),d.value.length?g.createCommentVNode("",!0):(g.openBlock(),g.createElementBlock("div",h0e,C[8]||(C[8]=[g.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):g.createCommentVNode("",!0),g.createVNode(S,{title:l.value.title,size:"small",visible:a.value,"onUpdate:visible":C[6]||(C[6]=I=>a.value=I)},{default:g.withCtx(()=>[g.createElementVNode("div",d0e,[g.createElementVNode("p",f0e,g.toDisplayString(l.value.message),1),g.createElementVNode("div",p0e,[g.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:C[4]||(C[4]=(...I)=>l.value.cancel&&l.value.cancel(...I))},g.toDisplayString(l.value.cancelButtonText),1),g.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:C[5]||(C[5]=(...I)=>l.value.confirm&&l.value.confirm(...I))},g.toDisplayString(l.value.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}}},g0e={},y0e={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-text",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function v0e(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",y0e,e[0]||(e[0]=[g.createStaticVNode('',6)]))}const oj=xt(g0e,[["render",v0e]]),_0e={},b0e={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-table",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function w0e(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",b0e,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),g.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),g.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const sj=xt(_0e,[["render",w0e]]),x0e={},E0e={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-zip",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function S0e(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",E0e,e[0]||(e[0]=[g.createStaticVNode('',9)]))}const aj=xt(x0e,[["render",S0e]]),C0e={},k0e={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-code",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function T0e(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",k0e,e[0]||(e[0]=[g.createStaticVNode('',5)]))}const lj=xt(C0e,[["render",T0e]]),M0e={},A0e={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg"};function I0e(t,e){return g.openBlock(),g.createElementBlock("svg",A0e,e[0]||(e[0]=[g.createElementVNode("path",{d:"M12.25 8.75V11.0833C12.25 11.3928 12.1271 11.6895 11.9083 11.9083C11.6895 12.1271 11.3928 12.25 11.0833 12.25H2.91667C2.60725 12.25 2.3105 12.1271 2.09171 11.9083C1.87292 11.6895 1.75 11.3928 1.75 11.0833V8.75","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),g.createElementVNode("path",{d:"M4.08325 5.83333L6.99992 8.74999L9.91659 5.83333","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),g.createElementVNode("path",{d:"M7 8.75V1.75","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const cj=xt(M0e,[["render",I0e]]),L0e={},P0e={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function N0e(t,e){return g.openBlock(),g.createElementBlock("svg",P0e,e[0]||(e[0]=[g.createElementVNode("path",{d:"M6.41667 11.0833C8.994 11.0833 11.0833 8.994 11.0833 6.41667C11.0833 3.83934 8.994 1.75 6.41667 1.75C3.83934 1.75 1.75 3.83934 1.75 6.41667C1.75 8.994 3.83934 11.0833 6.41667 11.0833Z",stroke:"#6B7280","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),g.createElementVNode("path",{d:"M12.25 12.25L9.7417 9.74167",stroke:"#6B7280","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const O0e=xt(L0e,[["render",N0e]]),D0e={},R0e={width:"38",height:"38",viewBox:"0 0 38 38",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function B0e(t,e){return g.openBlock(),g.createElementBlock("svg",R0e,e[0]||(e[0]=[g.createElementVNode("path",{d:"M18.9999 19.6667C19.3681 19.6667 19.6666 19.3682 19.6666 19C19.6666 18.6318 19.3681 18.3333 18.9999 18.3333C18.6317 18.3333 18.3333 18.6318 18.3333 19C18.3333 19.3682 18.6317 19.6667 18.9999 19.6667Z",stroke:"#1F2937","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),g.createElementVNode("path",{d:"M18.9999 15C19.3681 15 19.6666 14.7015 19.6666 14.3333C19.6666 13.9651 19.3681 13.6667 18.9999 13.6667C18.6317 13.6667 18.3333 13.9651 18.3333 14.3333C18.3333 14.7015 18.6317 15 18.9999 15Z",stroke:"#1F2937","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),g.createElementVNode("path",{d:"M18.9999 24.3333C19.3681 24.3333 19.6666 24.0349 19.6666 23.6667C19.6666 23.2985 19.3681 23 18.9999 23C18.6317 23 18.3333 23.2985 18.3333 23.6667C18.3333 24.0349 18.6317 24.3333 18.9999 24.3333Z",stroke:"#1F2937","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const F0e=xt(D0e,[["render",B0e]]),$0e={},z0e={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function V0e(t,e){return g.openBlock(),g.createElementBlock("svg",z0e,e[0]||(e[0]=[g.createElementVNode("path",{d:"M2.66675 9V2.66667C2.66675 2.31304 2.80722 1.9739 3.05727 1.72386C3.30732 1.47381 3.64646 1.33333 4.00008 1.33333H9.66675L13.3334 5V13.3333C13.3334 13.687 13.1929 14.0261 12.9429 14.2761C12.6928 14.5262 12.3537 14.6667 12.0001 14.6667H8.33341",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),g.createElementVNode("path",{d:"M9.33325 1.33333V5.33333H13.3333",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),g.createElementVNode("path",{d:"M6.94675 8.40667C7.07676 8.27666 7.2311 8.17353 7.40096 8.10317C7.57083 8.03281 7.75289 7.9966 7.93675 7.9966C8.12061 7.9966 8.30267 8.03281 8.47253 8.10317C8.6424 8.17353 8.79674 8.27666 8.92675 8.40667C9.05676 8.53668 9.15989 8.69102 9.23025 8.86088C9.30061 9.03075 9.33682 9.21281 9.33682 9.39667C9.33682 9.58053 9.30061 9.76259 9.23025 9.93245C9.15989 10.1023 9.05676 10.2567 8.92675 10.3867L5.30008 14L2.66675 14.6667L3.32675 12.0333L6.94675 8.40667Z",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const j0e=xt($0e,[["render",V0e]]),U0e={},H0e={width:"12",height:"14",viewBox:"0 0 12 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function W0e(t,e){return g.openBlock(),g.createElementBlock("svg",H0e,e[0]||(e[0]=[g.createStaticVNode('',5)]))}const R2=xt(U0e,[["render",W0e]]),G0e={},q0e={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Y0e(t,e){return g.openBlock(),g.createElementBlock("svg",q0e,e[0]||(e[0]=[g.createElementVNode("path",{d:"M2.91675 7H11.0834",stroke:"#1F2937","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),g.createElementVNode("path",{d:"M7 2.91667V11.0833",stroke:"#1F2937","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const Z0e=xt(G0e,[["render",Y0e]]),X0e={},K0e={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function J0e(t,e){return g.openBlock(),g.createElementBlock("svg",K0e,e[0]||(e[0]=[g.createElementVNode("path",{d:"M6.99992 0.333344C10.6819 0.333344 13.6666 3.31801 13.6666 7.00001C13.668 8.75033 12.9809 10.431 11.7539 11.6791C10.5268 12.9272 8.85802 13.6427 7.10793 13.6711C5.35785 13.6994 3.66681 13.0384 2.39992 11.8307C1.13302 10.623 0.391911 8.96545 0.336585 7.21601L0.333252 7.00001L0.335919 6.81334C0.434585 3.21801 3.37992 0.333344 6.99992 0.333344ZM6.99992 6.33334H6.33325L6.25525 6.33801C6.09322 6.35728 5.94388 6.43531 5.83553 6.55732C5.72717 6.67933 5.66733 6.83684 5.66733 7.00001C5.66733 7.16319 5.72717 7.32069 5.83553 7.4427C5.94388 7.56471 6.09322 7.64274 6.25525 7.66201L6.33325 7.66668V9.66668L6.33792 9.74468C6.35547 9.89349 6.42264 10.032 6.52859 10.138C6.63455 10.244 6.77311 10.3111 6.92192 10.3287L6.99992 10.3333H7.66659L7.74459 10.3287C7.8934 10.3111 8.03196 10.244 8.13791 10.138C8.24387 10.032 8.31104 9.89349 8.32859 9.74468L8.33325 9.66668L8.32859 9.58868C8.31265 9.45266 8.25521 9.32486 8.16408 9.22263C8.07295 9.12041 7.95255 9.04873 7.81925 9.01734L7.74459 9.00401L7.66659 9.00001V7.00001L7.66192 6.92201C7.64437 6.7732 7.5772 6.63464 7.47124 6.52868C7.36529 6.42273 7.22673 6.35556 7.07792 6.33801L6.99992 6.33334ZM7.00659 4.33334L6.92192 4.33801C6.75989 4.35728 6.61055 4.43531 6.50219 4.55732C6.39384 4.67933 6.33399 4.83684 6.33399 5.00001C6.33399 5.16319 6.39384 5.32069 6.50219 5.4427C6.61055 5.56471 6.75989 5.64274 6.92192 5.66201L6.99992 5.66668L7.08459 5.66201C7.24662 5.64274 7.39596 5.56471 7.50431 5.4427C7.61266 5.32069 7.67251 5.16319 7.67251 5.00001C7.67251 4.83684 7.61266 4.67933 7.50431 4.55732C7.39596 4.43531 7.24662 4.35728 7.08459 4.33801L7.00659 4.33334Z",fill:"#0068A8"},null,-1)]))}const Q0e=xt(X0e,[["render",J0e]]),e_e=R2,t_e=cj,{Fancybox:n_e}=j1,r_e={components:{IconPdf:oj,IconCsv:sj,IconFile:O2,IconZip:aj,IconGeojson:lj,trash:e_e,download:t_e},props:{table:{type:String,default:()=>""},token:{type:String,default:()=>""},dir:{type:String,default:()=>null},maxSize:{type:String,default:()=>"10"},multi:{type:Boolean,default:()=>!1},useId:{type:Boolean,default:()=>!1},useForm:{type:Array,default:()=>[]},customParams:{type:Array,default:()=>[]},format:{type:String,default:()=>""},modelValue:{type:[String,Array],default:()=>null},api:{type:String,default:()=>"/file/upload"}},inject:{id:{type:String,default:()=>""},formValues:{type:Object,default:()=>null},formId:{type:String,default:()=>""}},data(){return{fileData:this.multi?[]:null,tempFiles:[],hoveredFileIndex:null,hoveredAddFile:!1,fileActionIcons:["download","trash"]}},computed:{inputInnerLabel(){return this.tempFiles.length?this.multi?`Файлів обрано: ${this.tempFiles.length}`:this.tempFiles[0].name:"Файл не вибрано"}},mounted(){this.assignFileData(),n_e.bind('[data-fancybox="gallery"]'),window.addEventListener("form-refresh",this.clearData)},beforeUnmount(){window.removeEventListener("form-refresh",this.clearData)},methods:{clearData(){this.fileData=this.multi?[]:null},getAction(t,e){switch(t){case"download":this.downloadFile(e);break;case"trash":this.removeFile(e);break}},openFilePicker(){this.$refs.filePicker.click()},assignFileData(){this.multi?Array.isArray(this.modelValue)?this.fileData=this.modelValue.map(t=>({url:t,isLocal:!1})):this.fileData=[]:typeof this.modelValue=="string"&&this.modelValue?this.fileData={url:this.modelValue,isLocal:!1}:this.fileData=null},getFileType(t){const e=(t==null?void 0:t.url)||t;if(!e)return"";const n=e.split(".");return n[n.length-1]},getFileName(t){const e=(t==null?void 0:t.url)||t;if(!e)return"";const n=e.split("/");return n[n.length-1]},isFileImg(t){const e=this.getFileType(t);return["png","jpg","jpeg","tiff","svg","ico","webp"].includes(e)},fileFormatPreview(t){const e=(t==null?void 0:t.url)||t,n=this.getFileType(t),r={imageFormat:["tiff","jpg","jpeg","png","svg","ico","webp"],sheetsFormat:["xls","csv","xlsx"],archivesFormat:["zip","rar"],textsFormat:["json","geojson","txt","yml","yaml","shp"],documentsFormat:["pdf"]};return r.imageFormat.includes(n)?e:r.sheetsFormat.includes(n)?"icon-csv":r.textsFormat.includes(n)?"icon-geojson":r.documentsFormat.includes(n)?"icon-pdf":r.archivesFormat.includes(n)?"icon-zip":"icon-file"},getFileIcon(t){const e=this.getFileType(t);return{xls:"ti-file-type-xls",xlsx:"ti-file-spreadsheet",csv:"ti-file-type-csv",json:"ti-file-code",geojson:"ti-file-code",pdf:"ti-file-type-pdf"}[e]||"ti-file"},async removeFile(t){var n;const e=t.url||t;try{await un.get(`/file/delete${e}`),this.multi?this.fileData=this.fileData.filter(r=>r.url!==e):this.fileData=null,this.$emit("update:modelValue",this.multi?this.fileData.filter(r=>!r.isLocal).map(r=>r.url):((n=this.fileData)==null?void 0:n.url)||null)}catch(r){console.error(r)}},async downloadFile(t){const e=t.url||t;try{const n=await un.get(e,{responseType:"arraybuffer",headers:{"Content-Type":"application/json"}}),r=n.headers["content-type"],i=r.split("/")[1]||"txt",o=`file_${Date.now()}_${Math.floor(Math.random()*1e4)}.${i}`,s=new Blob([n.data],{type:r}),a=document.createElement("a");a.setAttribute("download",o),a.href=window.URL.createObjectURL(s),a.click()}catch(n){console.error(n.message)}},async handleChange(t){var o;const{files:e}=t.target;if(!e||!e.length)return;const n=Number(this.maxSize)*1024*1024;for(let s=0;sn){this.$notify({title:"Помилка!",message:`Файл ${e[s].name} перевищує максимальний розмір у ${this.maxSize} МБ`,type:"error"});return}this.tempFiles=Array.from(e).map(s=>({name:s==null?void 0:s.name,loading:0}));const r=Array.from(e).map(s=>({url:URL.createObjectURL(s),isLocal:!0,_file:s}));this.multi?(Array.isArray(this.fileData)||(this.fileData=[]),this.fileData=[...this.fileData,...r]):this.fileData=r[0];const i=await Array.from(e).reduce(async(s,a)=>{const l=await this.uploadFile(a);if(!l)return s;const c=l.result.file_path;return(await s).concat(c)},Promise.resolve([]));if(this.multi){const s=this.fileData.filter(l=>!l.isLocal),a=i.map(l=>({url:l,isLocal:!1}));this.fileData=[...s,...a]}else this.fileData=i[0]?{url:i[0],isLocal:!1}:null;this.$emit("update:modelValue",this.multi?this.fileData.map(s=>s.url):((o=this.fileData)==null?void 0:o.url)||null),this.$refs.filePicker.value=""},async uploadFile(t){var i;const{table:e,token:n}=this,r={id:this.id||this.formId||null,form:e||null,table:n||null};(i=this.customParams)!=null&&i.length&&this.customParams.forEach(o=>{var l;const[s,a]=(o==null?void 0:o.split("="))||[];r[s]=((l=this.formValues)==null?void 0:l[a])||null});try{const o=new FormData;o.append("unique","true"),o.append("file",t);const{data:s}=await un.post(`${this.api}${this.dir!==""?"/":""}${typeof this.dir=="string"?this==null?void 0:this.dir:"uploads"}`,o,{params:r,onUploadProgress:a=>{this.tempFiles=this.tempFiles.map(l=>(l.name===t.name&&(l.loading=a.loaded*100/(a.total===void 0?0:a.total)),l))}});return s}catch(o){return this.$notify({title:"Помилка!",message:"Помилка при завантаженні!",type:"error"}),console.error(o),null}}}},i_e={class:"vs-form-file flex gap-4"},o_e=["onMouseenter"],s_e={class:"absolute inset-0 flex items-center justify-center"},a_e=["src"],l_e={key:1},c_e={class:"action-list absolute bg-[rgba(0,0,0,0.4)] top-0 right-0 left-0 bottom-0 rounded-lg flex items-center justify-center"},u_e=["href"],h_e={key:0,class:"ti ti-zoom-in z-10 text-gray-600 hover:cursor-pointer"},d_e={key:0,class:"vs-form-file__item border border-dotted border-gray-300 rounded-lg hover:border-blue-500 transition-all relative hover:text-blue-500"},f_e={class:"absolute inset-0 flex items-center justify-center"},p_e=["src"],m_e={key:1},g_e={class:"action-list absolute bg-[rgba(0,0,0,0.4)] top-0 right-0 left-0 bottom-0 rounded-lg flex items-center justify-center"},y_e=["href"],v_e={key:0,class:"ti ti-zoom-in z-10 text-gray-600 hover:cursor-pointer"},__e=["multiple","accept"];function b_e(t,e,n,r,i,o){var s;return g.openBlock(),g.createElementBlock("div",i_e,[n.multi?(g.openBlock(!0),g.createElementBlock(g.Fragment,{key:0},g.renderList(t.fileData,(a,l)=>{var c;return g.openBlock(),g.createElementBlock("div",{key:a.url,class:"vs-form-file__item border-2 border-dotted border-gray-300 rounded-lg hover:border-blue-500 transition-all relative hover:text-blue-500",onMouseenter:u=>t.hoveredFileIndex=l,onMouseleave:e[0]||(e[0]=u=>t.hoveredFileIndex=null)},[g.createElementVNode("div",s_e,[(c=o.fileFormatPreview(a))!=null&&c.includes("icon")?(g.openBlock(),g.createElementBlock("span",l_e,[(g.openBlock(),g.createBlock(g.resolveDynamicComponent(o.fileFormatPreview(a)),{height:"70",width:"70",class:"text-gray-500"}))])):(g.openBlock(),g.createElementBlock("img",{key:0,src:a.url,class:"vs-form-file__img"},null,8,a_e)),g.createElementVNode("div",c_e,[a.url?(g.openBlock(),g.createElementBlock("a",{key:0,"data-fancybox":"gallery",href:a.url},[a.url?(g.openBlock(),g.createElementBlock("i",h_e)):g.createCommentVNode("",!0)],8,u_e)):g.createCommentVNode("",!0),(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(t.fileActionIcons,u=>(g.openBlock(),g.createElementBlock("button",{key:u,class:"p-[4px] text-white rounded hover:bg-white hover:text-gray-600 duration-300"},[(g.openBlock(),g.createBlock(g.resolveDynamicComponent(u),{height:"20",width:"20",class:"z-10",onClick:d=>o.getAction(u,a)},null,8,["onClick"]))]))),128))])])],40,o_e)}),128)):(g.openBlock(),g.createElementBlock(g.Fragment,{key:1},[t.fileData&&typeof t.fileData=="object"&&t.fileData.url?(g.openBlock(),g.createElementBlock("div",d_e,[g.createElementVNode("div",f_e,[(s=o.fileFormatPreview(t.fileData))!=null&&s.includes("icon")?(g.openBlock(),g.createElementBlock("span",m_e,[(g.openBlock(),g.createBlock(g.resolveDynamicComponent(o.fileFormatPreview(t.fileData)),{height:"70",width:"70",class:"text-gray-500"}))])):(g.openBlock(),g.createElementBlock("img",{key:0,src:t.fileData.url,class:"vs-form-file__img"},null,8,p_e)),g.createElementVNode("div",g_e,[t.fileData.url?(g.openBlock(),g.createElementBlock("a",{key:0,"data-fancybox":"gallery",href:t.fileData.url},[t.fileData.url?(g.openBlock(),g.createElementBlock("i",v_e)):g.createCommentVNode("",!0)],8,y_e)):g.createCommentVNode("",!0),(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(t.fileActionIcons,a=>(g.openBlock(),g.createElementBlock("button",{key:a,class:"p-[4px] text-white rounded hover:bg-white hover:text-gray-600 duration-300"},[(g.openBlock(),g.createBlock(g.resolveDynamicComponent(a),{height:"20",width:"20",class:"z-10",onClick:l=>o.getAction(a,t.fileData)},null,8,["onClick"]))]))),128))])])])):g.createCommentVNode("",!0)],64)),g.createElementVNode("div",{class:"border border-dotted border-gray-300 rounded-lg hover:border-blue-500 hover:cursor-pointer transition-all relative",style:{width:"120px",height:"120px"},onMouseenter:e[3]||(e[3]=a=>t.hoveredAddFile=!0),onMouseleave:e[4]||(e[4]=a=>t.hoveredAddFile=!1)},[g.createElementVNode("form",null,[g.withDirectives(g.createElementVNode("input",{type:"file",multiple:n.multi,placeholder:"...",ref:"filePicker",name:"file-input",onChange:e[1]||(e[1]=(...a)=>o.handleChange&&o.handleChange(...a)),id:"file-input",class:"hidden",accept:n.format},null,40,__e),[[g.vShow,!1]]),g.createElementVNode("div",{class:"absolute inset-0 flex items-center justify-center",onClick:e[2]||(e[2]=(...a)=>o.openFilePicker&&o.openFilePicker(...a))},e[5]||(e[5]=[g.createStaticVNode('',1)]))])],32)])}const w_e=xt(r_e,[["render",b_e],["__scopeId","data-v-dc4a9a61"]]),x_e=t=>{if(!t)return"";const e=t==null?void 0:t.split(".");return e[e.length-1]},B2=t=>{const e=x_e(t),n={imageFormat:["tiff","jpg","jpeg","png","svg","ico","webp"],sheetsFormat:["xls","csv","xlsx"],archivesFormat:["zip","rar"],textsFormat:["json","geojson","txt","yml","yaml","shp"],documentsFormat:["pdf"]};return n.imageFormat.includes(e)?t:n.sheetsFormat.includes(e)?sj:n.textsFormat.includes(e)?lj:n.documentsFormat.includes(e)?oj:n.archivesFormat.includes(e)?aj:O2},E_e=async(t,e,n,r)=>{try{const i=new FormData;i.append("unique","true"),i.append("file",t);const{data:o}=await un.post(`/file/upload/uploads?id=${e||""}&form=${n||""}&table=${r||""}`,i);return o}catch(i){console.error(i)}},S_e=async t=>{try{return await un.get(`file/delete${t}`),!0}catch(e){return console.error(e),!1}},uj=async t=>{try{const e=await un.get(`file/download/files/uploads${t}`,{responseType:"arraybuffer",headers:{"Content-Type":"application/json"}}),n=e.headers["content-type"],r=new TextDecoder("utf-8").decode(e.data),i=new Blob([r],{type:n}),o=document.createElement("a");o.setAttribute("download",t),o.href=window.URL.createObjectURL(i),o.click()}catch(e){console.error(e.message)}},C_e={},k_e={class:"w-16 text-gray-400 mx-auto dark:text-neutral-400",width:"70",height:"46",viewBox:"0 0 70 46",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function T_e(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",k_e,e[0]||(e[0]=[g.createStaticVNode('',5)]))}const hj=xt(C_e,[["render",T_e]]),M_e={key:0,class:"flex flex-col gap-0"},A_e={class:"!mt-[4px] text-xs text-center text-stone-400 dark:text-neutral-400"},I_e=["src"],L_e={class:"action-list absolute bg-[rgba(0,0,0,0.4)] top-0 right-0 left-0 bottom-0 opacity-0 duration-300 rounded-lg flex flex-col items-start justify-between p-[10px]"},P_e={class:"text-white text-[10px] text-nowrap overflow-hidden overflow-ellipsis w-[calc(100%)]"},N_e={class:"mx-auto"},O_e=["accept"],dj=xt({__name:"vs-form-dropzone",props:{modelValue:{type:String,default:()=>""},accept:{type:Array,default:()=>null},table:{type:String,default:()=>""},token:{type:String,default:()=>""}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=g.inject("id"),{$notify:i}=g.getCurrentInstance().proxy,o=g.ref(null),s=g.ref(!1),a=g.ref(n.modelValue),l=g.ref(""),c=g.computed(()=>{var S,M,E;return(S=n.accept)!=null&&S.length?(E=(M=n.accept)==null?void 0:M.map(A=>{var I;return(I=A==null?void 0:A.replace(".",""))==null?void 0:I.toUpperCase()}))==null?void 0:E.join(", "):"Приймаються всі типи файлів"}),u=e,d=()=>{o.value.click()},p=async S=>{var E,A,I;const M=await E_e(S,r);a.value=(E=M==null?void 0:M.result)==null?void 0:E.file_path,l.value=(A=M==null?void 0:M.result)==null?void 0:A.file_name,await u("update:modelValue",(I=M==null?void 0:M.result)==null?void 0:I.file_path)},m=S=>{const M=S.target.files[0];M&&p(M)},y=S=>{var A,I,O;const M=S.dataTransfer.files[0],E=M.name.split(".").pop();s.value=!1,!((A=n.accept)!=null&&A.length)||(I=n.accept)!=null&&I.includes("."+E)?M&&p(M):i({type:"error",title:"Помилка!",message:"Доступні формати: "+((O=n.accept)==null?void 0:O.join(", "))})},w=async()=>{await S_e(a.value)&&(a.value=null,u("update:modelValue",null))},x=()=>{s.value=!0},C=()=>{s.value=!1};return(S,M)=>{var E;return g.openBlock(),g.createElementBlock("div",null,[g.createElementVNode("div",{class:g.normalizeClass(["vs-form-dropzone border border-dashed rounded-xl p-[48px] flex items-center justify-center duration-300 hover:border-blue-600 hover:bg-blue-50",s.value?"border-blue-600 bg-blue-50":"border-gray-200"]),onDragover:g.withModifiers(x,["prevent"]),onDragleave:C,onDrop:g.withModifiers(y,["prevent"]),onClick:d},[a.value?(g.openBlock(),g.createElementBlock("div",{key:1,onClick:M[1]||(M[1]=g.withModifiers(()=>{},["stop"])),class:"vs-form-dropzone-preview h-[106px] w-[106px] bg-white border border-dashed duration-300 rounded-xl overflow-hidden flex justify-center items-center relative"},[typeof g.unref(B2)(a.value)=="object"?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(g.unref(B2)(a.value)),{key:0,height:"60",width:"60",class:"text-gray-600"})):(g.openBlock(),g.createElementBlock("img",{key:1,src:g.unref(B2)(a.value),alt:"",class:"h-[106px] w-[106px] object-cover"},null,8,I_e)),g.createElementVNode("div",L_e,[g.createElementVNode("p",P_e,g.toDisplayString(l.value),1),g.createElementVNode("div",N_e,[g.createElementVNode("button",{onClick:M[0]||(M[0]=(...A)=>g.unref(uj)&&g.unref(uj)(...A)),class:"p-[4px] text-white rounded hover:bg-white hover:text-gray-600 duration-300"},[g.createVNode(g.unref(cj),{height:"20",width:"20"})]),g.createElementVNode("button",{onClick:w,class:"p-[4px] text-white rounded hover:bg-white hover:text-gray-600 duration-300"},[g.createVNode(g.unref(R2),{height:"20",width:"20"})])])])])):(g.openBlock(),g.createElementBlock("div",M_e,[g.createVNode(hj),M[2]||(M[2]=g.createElementVNode("p",{class:"font-medium text-gray-800 mt-[16px] !mb-0"},[g.createTextVNode(" Перетягніть файл сюди або "),g.createElementVNode("span",{class:"text-[#2563EB]"},"завантажте з комп'ютера")],-1)),g.createElementVNode("p",A_e,g.toDisplayString(c.value),1)]))],34),g.createElementVNode("input",{ref_key:"fileInput",ref:o,type:"file",class:"hidden",accept:(E=t.accept)==null?void 0:E.join(","),onChange:m},null,40,O_e)])}}},[["__scopeId","data-v-54ed2c45"]]);var fj={};Object.defineProperty(fj,"__esModule",{value:!0});var pj={enable:function(e){setTimeout(function(){!e.map||!e.map.doubleClickZoom||!e._ctx||!e._ctx.store||!e._ctx.store.getInitialConfigValue||e._ctx.store.getInitialConfigValue("doubleClickZoom")&&e.map.doubleClickZoom.enable()},0)},disable:function(e){setTimeout(function(){!e.map||!e.map.doubleClickZoom||e.map.doubleClickZoom.disable()},0)}},D_e={onSetup:function(e){var n=this.newFeature({type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[]]}});return this.addFeature(n),this.clearSelectedFeatures(),pj.disable(this),this.updateUIClasses({mouse:"add"}),this.setActionableState({trash:!0}),{rectangle:n}},onTap:function(e,n){e.startPoint&&this.onMouseMove(e,n),this.onClick(e,n)},onClick:function(e,n){e.startPoint&&e.startPoint[0]!==n.lngLat.lng&&e.startPoint[1]!==n.lngLat.lat&&(this.updateUIClasses({mouse:"pointer"}),e.endPoint=[n.lngLat.lng,n.lngLat.lat],this.changeMode("simple_select",{featuresId:e.rectangle.id}));var r=[n.lngLat.lng,n.lngLat.lat];e.startPoint=r},onMouseMove:function(e,n){e.startPoint&&(e.rectangle.updateCoordinate("0.0",e.startPoint[0],e.startPoint[1]),e.rectangle.updateCoordinate("0.1",n.lngLat.lng,e.startPoint[1]),e.rectangle.updateCoordinate("0.2",n.lngLat.lng,n.lngLat.lat),e.rectangle.updateCoordinate("0.3",e.startPoint[0],n.lngLat.lat),e.rectangle.updateCoordinate("0.4",e.startPoint[0],e.startPoint[1]))},onKeyUp:function(e,n){if(n.keyCode===27)return this.changeMode("simple_select")},onStop:function(e){pj.enable(this),this.updateUIClasses({mouse:"none"}),this.activateUIButton(),this.getFeature(e.rectangle.id)!==void 0&&(e.rectangle.removeCoordinate("0.4"),e.rectangle.isValid()?this.map.fire("draw.create",{features:[e.rectangle.toGeoJSON()]}):(this.deleteFeature([e.rectangle.id],{silent:!0}),this.changeMode("simple_select",{},{silent:!0})))},toDisplayFeatures:function(e,n,r){var i=n.properties.id===e.rectangle.id;if(n.properties.active=i?"true":"false",!i)return r(n);if(e.startPoint)return r(n)},onTrash:function(e){this.deleteFeature([e.rectangle.id],{silent:!0}),this.changeMode("simple_select")}},R_e=fj.default=D_e;const B_e={methods:{fileDownload(t,e,n="json"){const r=document.createElement("a");document.body.appendChild(r);const i=new File([t],`${e}.${n}`,{type:"text/plain"}),o=window.URL.createObjectURL(i);r.href=o,r.download=`${e}.${n}`,r.click(),window.URL.revokeObjectURL(o),r.remove()},readFile(t,e){const n=t,r=new FileReader;r.readAsText(n),r.onload=()=>e(r.result),r.onerror=()=>{console.log(r.error)}}}},F_e={props:{maxFileSizeMB:{type:Number,default:20},label:{type:String,default:""},size:{type:String,default:()=>"default"},accept:{type:String,default:()=>""},disabled:{type:Boolean,default:!1}},methods:{handleFileChange(t){var r;const e=t.target;if(!((r=e==null?void 0:e.files)!=null&&r.length))return;const n=e==null?void 0:e.files[0];this.validateFileSize(n)?this.$emit("fileChange",e.files):alert(`Недопустимий розмір файлу. Макс. розмір - ${this.maxFileSizeMB}MB`)},validateFileSize(t){const e=this.maxFileSizeMB*1024*1024;return t.size<=e}}},$_e={key:0,for:"file-input",class:"mb-2 text-gray-500 cursor-pointer"},z_e=["accept"];function V_e(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",null,[g.createElementVNode("form",null,[n.label?(g.openBlock(),g.createElementBlock("label",$_e,g.toDisplayString(n.label),1)):g.createCommentVNode("",!0),g.createElementVNode("input",{id:"file-input",type:"file",name:"file-input",class:g.normalizeClass(["block w-full transition-all file:transition-all cursor-pointer hover:border-blue-500 file:cursor-pointer border border-gray-200 shadow-sm rounded-md focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-0 py-3 px-3 file:mr-4 file:py-3 file:px-6 file:rounded-md file:border-0 file:font-semibold file:bg-blue-500 file:text-white hover:file:bg-blue-700",{"text-xs file:text-xs":n.size==="mini","text-sm file:text-sm":n.size==="default","text-lg file:text-lg":n.size==="large"}]),accept:n.accept,onChange:e[0]||(e[0]=(...s)=>o.handleFileChange&&o.handleFileChange(...s))},null,42,z_e)])])}const j_e={components:{VsButton:Fh,VsDialog:Ag,VsFormFile:xt(F_e,[["render",V_e],["__scopeId","data-v-17e77adb"]]),VsFormAutocomplete:GP,IconInfo:Q0e},mixins:[B_e],props:{draw:{type:Object,default:()=>{}},map:{type:Object,default:()=>{}},table:{type:String,default:()=>""},form:{type:String,default:()=>""},field:{type:String,default:()=>""},id:{type:String,default:()=>""},prefix:{type:String,default:"api"},featuresList:{type:Array,default:()=>[]}},data(){var t,e;return{formData:{srid:"",encoding:"",file:"",limit:!0},dialogVisible:!1,sridOptions:((e=(t=An==null?void 0:An.value)==null?void 0:t.geom)==null?void 0:e.sridOptions)||[]}},watch:{dialogVisible(t){t&&!this.sridOptions.length&&this.getSridOptions()}},methods:{async exportFile(){var t;if((t=this.featuresList)!=null&&t.length)try{const e=this.draw.getAll(),n=JSON.stringify(e),r=new Blob([n],{type:"application/geo+json"}),i=URL.createObjectURL(r),o=document.createElement("a");o.href=i,o.download="data.geojson",o.click(),URL.revokeObjectURL(i)}catch(e){console.error(e)}},async getSridOptions(){try{const{data:t}=await un.get("/api/suggest/gis.srid_from_setting?limit=50&json=1");this.sridOptions=t.data}catch(t){console.error(t),this.sridOptions=[{initial:!0,id:4326,text:"4326 - WGS 84"}]}},async uploadFile(t){var e;try{const n=new FormData;n.append("file",t[0]),n.append("unique",!0);const r=await un("/file/upload/temp",{method:"post",params:{id:this.id,form:this.form,table:this.table,field:this.field},data:n}),i=(e=r==null?void 0:r.data)==null?void 0:e.result.file_path;this.formData.file=i}catch(n){console.error(n),this.$vsNotify({type:"error",title:"Помилка",message:"Помилка при завантаженні файла геометрії"})}},async submitImport(){if(this.formData.file)try{const t=await fetch("/api/file2geojson",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(this.formData)});if(t.ok){const e=await t.json(),{features:n}=e[0];this.draw.deleteAll(),n.forEach(i=>{this.draw.add(i[0]||i)});const r=Ri(Pn((n==null?void 0:n[0])||e[0]||n));this.map.fitBounds(r,{padding:30,maxZoom:17,duration:0}),this.$emit("upload"),this.dialogVisible=!1}}catch(t){console.error(t),this.$vsNotify({type:"error",title:"Помилка",message:"Помилка імпорту файла геометрії"})}}}},U_e={class:"flex items-center"},H_e={class:"mr-1"},W_e={class:"p-2"},G_e={class:"mb-4"},q_e={class:"mb-3"},Y_e={class:"mb-1 flex"},Z_e={class:"mb-3"},X_e={class:"mb-1 flex"},K_e={class:"mb-1 flex"},J_e={class:"flex justify-end"};function Q_e(t,e,n,r,i,o){var p;const s=g.resolveComponent("VsButton"),a=g.resolveComponent("IconInfo"),l=g.resolveComponent("vs-tooltip"),c=g.resolveComponent("VsFormAutocomplete"),u=g.resolveComponent("VsFormFile"),d=g.resolveComponent("VsDialog");return g.openBlock(),g.createElementBlock("div",U_e,[g.createElementVNode("div",H_e,[g.createVNode(s,{title:"Імпорт ",square:"",onClick:e[0]||(e[0]=m=>i.dialogVisible=!0)})]),g.createElementVNode("div",null,[g.createVNode(s,{title:"Експорт",square:"",disabled:!((p=n.featuresList)!=null&&p.length),onClick:o.exportFile},null,8,["disabled","onClick"])]),g.createVNode(d,{visible:i.dialogVisible,"onUpdate:visible":e[4]||(e[4]=m=>i.dialogVisible=m),title:"Імпорт геометрії"},{default:g.withCtx(()=>{var m;return[g.createElementVNode("div",W_e,[g.createElementVNode("div",G_e,[g.createElementVNode("div",q_e,[g.createElementVNode("div",Y_e,[e[5]||(e[5]=g.createTextVNode(" Система координат ")),g.createVNode(l,{content:"Оберіть одну із систем координат в якій знаходяться ваші геодані",class:"ml-1"},{reference:g.withCtx(()=>[g.createVNode(a)]),_:1})]),(m=i.sridOptions)!=null&&m.length?(g.openBlock(),g.createBlock(c,{key:0,modelValue:i.formData.srid,"onUpdate:modelValue":e[1]||(e[1]=y=>i.formData.srid=y),"append-to-body":!0,options:i.sridOptions},null,8,["modelValue","options"])):g.createCommentVNode("",!0)]),g.createElementVNode("div",Z_e,[g.createElementVNode("div",X_e,[e[6]||(e[6]=g.createTextVNode(" Кодування файлу ")),g.createVNode(l,{content:"Вкажіть кодування в якому зберігається інформація в ваших файлах. Зазвичай це UTF-8",class:"ml-1"},{reference:g.withCtx(()=>[g.createVNode(a)]),_:1})]),g.createVNode(c,{modelValue:i.formData.encoding,"onUpdate:modelValue":e[2]||(e[2]=y=>i.formData.encoding=y),"append-to-body":!0,options:[{id:"UTF-8",label:"UTF-8"},{id:"CP1251",label:"CP1251"},{id:"LATIN-1",label:"LATIN-1"}]},null,8,["modelValue"])]),g.createElementVNode("div",null,[g.createElementVNode("div",K_e,[e[7]||(e[7]=g.createTextVNode(" Файл ")),g.createVNode(l,{content:"Завантажте файл із геоданими у форматі GeoJson або Zip (Shapefiles) ",class:"ml-1"},{reference:g.withCtx(()=>[g.createVNode(a)]),_:1})]),g.createVNode(u,{accept:".geojson,.zip",onFileChange:o.uploadFile},null,8,["onFileChange"])])]),g.createElementVNode("div",J_e,[g.createVNode(s,{class:"mr-2",onClick:e[3]||(e[3]=y=>i.dialogVisible=!1),color:"red"},{default:g.withCtx(()=>e[8]||(e[8]=[g.createTextVNode("Скасувати")])),_:1,__:[8]}),g.createVNode(s,{type:"primary",disabled:!i.formData.file,onClick:o.submitImport},{default:g.withCtx(()=>e[9]||(e[9]=[g.createTextVNode("Додати")])),_:1,__:[9]},8,["disabled","onClick"])])])]}),_:1},8,["visible"])])}const ebe=xt(j_e,[["render",Q_e]]),tbe={},nbe={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-zoom-in"};function rbe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",nbe,e[0]||(e[0]=[g.createStaticVNode('',5)]))}const ibe={components:{IconClose:Fa,IconZoom:xt(tbe,[["render",rbe]])},props:{data:{type:Object,default:()=>{}},map:{type:Object,default:()=>{}},draw:{type:Object,default:()=>{}},selectedFeatures:{type:Array,default:()=>[]}},data(){return{}},computed:{featureActiveState(){return this.selectedFeatures.includes(this.data.id)?"bg-gray-50":""}},mounted(){window.addEventListener("form-refresh",this.deleteFeature)},beforeUnmount(){window.removeEventListener("form-refresh",this.deleteFeature)},methods:{deleteFeature(){this.$emit("delete")},zoomTo(){const t=Ri(this.data.geometry);this.map.fitBounds(t,{duration:1,maxZoom:17,padding:30}),this.highlightFeature()},highlightFeature(){const{id:t}=this.data;this.draw.changeMode("direct_select",{featureId:t})},additionalInfo(){var e,n;const{type:t}=this.data.geometry;if(t==="Point")return`
Центр: ${this.data.geometry.coordinates.map(i=>i.toFixed(5)).join(",")}
`;if(t==="Polygon"){const r=YE(this.data),i=(((n=(e=Wd(this.data))==null?void 0:e.geometry)==null?void 0:n.coordinates)||[0,0]).reverse().map(s=>s.toFixed(5)).join(","),o=Math.floor(r)<1e5?`${r.toFixed(1)}м²`:`${WA(r,"meters","kilometers").toFixed(1)}км²`;return`
Центр: ${i}
Площа: ${o}
`}return`
Відстань: ${ZE(this.data).toFixed(1)}км
`}}},obe={class:"form-geom__feature flex items-center text-xs transition-all"},sbe={class:"mr-auto"},abe={class:"font-bold"},lbe=["innerHTML"];function cbe(t,e,n,r,i,o){const s=g.resolveComponent("IconZoom"),a=g.resolveComponent("IconClose");return g.openBlock(),g.createElementBlock("div",obe,[g.createElementVNode("div",sbe,[e[2]||(e[2]=g.createTextVNode(" Тип: ")),g.createElementVNode("span",abe,g.toDisplayString(n.data.geometry.type),1)]),g.createElementVNode("div",{class:"mr-3 flex items-center",innerHTML:o.additionalInfo()},null,8,lbe),g.createElementVNode("div",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Наблизити",onClick:e[0]||(e[0]=(...l)=>o.zoomTo&&o.zoomTo(...l))},[g.createVNode(s,{height:"12",width:"12",stroke:"#3C3C43"})]),g.createElementVNode("div",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Видалити",onClick:e[1]||(e[1]=l=>t.$emit("delete"))},[g.createVNode(a,{height:"12",width:"12",stroke:"#3C3C43"})])])}const ube=xt(ibe,[["render",cbe],["__scopeId","data-v-46dc3de3"]]),hbe={components:{VsPopover:Dp},props:{fullScreen:Boolean,mapId:String,initialHeight:String,isFullscreen:Boolean,map:Object},data(){return{fullscreenShow:!1}},watch:{async fullscreenShow(t){const e=await document.querySelector(`#${this.mapId}`),n=document.querySelector(".form-geom"),r=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||!1,i=n.requestFullscreen||n.webkitRequestFullscreen||n.mozRequestFullScreen||n.msRequestFullscreen,o=document.exitFullscreen||document.webkitExitFullscreen||document.mozCancelFullScreen||document.msExitFullscreen;t?(!r&&i&&i.call(n),e.style.height="100vh"):(r&&o&&o.call(document),e.style.height=this.initialHeight),await this.$emit("update:isFullscreen",t),await this.map.resize()}},mounted(){document.addEventListener("fullscreenchange",this.handleFullscreenChange)},beforeDestroy(){document.removeEventListener("fullscreenchange",this.handleFullscreenChange)},methods:{togglePrint(){this.fullscreenShow=!this.fullscreenShow},async handleFullscreenChange(){const t=await document.querySelector(`#${this.mapId}`);this.fullscreenShow?t.style.height=await"100vh":(t.style.height=await this.initialHeight,this.fullscreenShow=!1),this.map.resize()}}};function dbe(t,e,n,r,i,o){const s=g.resolveComponent("VsPopover");return g.openBlock(),g.createBlock(s,{trigger:"hover",placement:"left"},{reference:g.withCtx(()=>[g.createElementVNode("div",{onClick:e[0]||(e[0]=(...a)=>o.togglePrint&&o.togglePrint(...a)),class:"form-geom__tool py-0.5 px-2 cursor-pointer transition-all border rounded-md text-sm bg-white hover:bg-blue-500 hover:text-white vs-form-geom-fullscreen__icon-container"},e[1]||(e[1]=[g.createElementVNode("svg",{height:"12px",width:"12px",version:"1.1",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg","xmlns:sketch":"http://www.bohemiancoding.com/sketch/ns","xmlns:xlink":"http://www.w3.org/1999/xlink",class:"fullscreen-icon"},[g.createElementVNode("title"),g.createElementVNode("desc"),g.createElementVNode("defs"),g.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[g.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[g.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[g.createElementVNode("path",{d:"M2,9 L0,9 L0,14 L5,14 L5,12 L2,12 L2,9 L2,9 Z M0,5 L2,5 L2,2 L5,2 L5,0 L0,0 L0,5 L0,5 Z M12,12 L9,12 L9,14 L14,14 L14,9 L12,9 L12,12 L12,12 Z M9,0 L9,2 L12,2 L12,5 L14,5 L14,0 L9,0 L9,0 Z",id:"Shape"})])])])],-1)]))]),default:g.withCtx(()=>[e[2]||(e[2]=g.createElementVNode("div",null,"Розтягнути на екран",-1))]),_:1,__:[2]})}const fbe=xt(hbe,[["render",dbe]]),pbe={},mbe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function gbe(t,e){return g.openBlock(),g.createElementBlock("svg",mbe,e[0]||(e[0]=[g.createStaticVNode('',6)]))}const ybe=xt(pbe,[["render",gbe]]),vbe={mixins:[oP],props:{layer:{type:Object,required:!0},map:{type:Object,default:()=>null},prefix:{type:String,default:""}},methods:{formatNumber(t){return Intl.NumberFormat("uk",{notation:"compact"}).format(t)},async handleChange(t){this.layer.visible=t,await this.setVisible(this.layer,t,this.map,this.prefix),this.map.once("idle",()=>{const e=["area-measure","area-measure-lines","area-measure-points","area-measure-labels","area-linear-area-fill","mapbox-gl-draw-cold","mapbox-gl-draw-hot"],n=this.map.getStyle().layers;e.forEach(r=>{n.forEach(i=>{if(i.source===r)try{this.map.moveLayer(i.id)}catch(o){console.warn(`Could not move layer ${i.id}:`,o)}})})})}}},_be={class:"hover:bg-gray-100 rounded-lg flex items-center ml-[20px] py-[8px] px-[8px]"},bbe=["for"],wbe={class:"custom-checkbox-wrapper"},xbe=["id","checked"],Ebe={class:"custom-checkbox"},Sbe={key:0,xmlns:"http://www.w3.org/2000/svg",width:"12",height:"8",viewBox:"0 0 12 8",fill:"none"},Cbe={class:"flex items-center justify-between ml-2 w-full"},kbe=["title"],Tbe={key:0,class:"text-xs opacity-60 text-[#4b5563]"};function Mbe(t,e,n,r,i,o){var s,a,l,c,u,d,p;return g.openBlock(),g.createElementBlock("div",_be,[g.createElementVNode("label",{class:"flex items-center w-full cursor-pointer",for:n.layer.id},[g.createElementVNode("div",wbe,[g.createElementVNode("input",{id:n.layer.id,type:"checkbox",checked:n.layer.visible,onChange:e[0]||(e[0]=m=>o.handleChange(m.target.checked)),class:"custom-checkbox-input"},null,40,xbe),g.createElementVNode("div",Ebe,[n.layer.visible?(g.openBlock(),g.createElementBlock("svg",Sbe,e[1]||(e[1]=[g.createElementVNode("path",{d:"M10.6663 1L4.24967 7.41667L1.33301 4.5",stroke:"#fff","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))):g.createCommentVNode("",!0)])]),g.createElementVNode("div",Cbe,[g.createElementVNode("div",{class:g.normalizeClass(["whitespace-nowrap text text-ellipsis overflow-hidden text-[13px] text-[#4b5563]",isNaN(o.formatNumber((s=n.layer)==null?void 0:s.count))?"max-w-[260px]":"max-w-[200px]"]),title:((a=n.layer)==null?void 0:a.name)||((l=n.layer)==null?void 0:l.title)},g.toDisplayString(((c=n.layer)==null?void 0:c.name)||((u=n.layer)==null?void 0:u.title)),11,kbe),isNaN(o.formatNumber((d=n.layer)==null?void 0:d.count))?g.createCommentVNode("",!0):(g.openBlock(),g.createElementBlock("div",Tbe,g.toDisplayString(o.formatNumber((p=n.layer)==null?void 0:p.count)),1))])],8,bbe)])}const Abe={components:{IconCatalog:ybe,IconClose:Fa,IconSearch:UA,VsFormGeomCatalogItem:xt(vbe,[["render",Mbe],["__scopeId","data-v-d0604647"]])},props:{height:{type:String,default:"400px"},map:{type:Object,default:()=>null},prefix:{type:String,default:""}},data(){return{layers:[],isOpen:!1,selectedCategory:"",search:"",sortBy:"category"}},async mounted(){try{const{data:t}=await un.get(`/${this.prefix}/gis-layer-list`);if(typeof t=="string")return;this.layers=t==null?void 0:t.map(e=>({...e,visible:!1}))}catch(t){console.error(t)}},computed:{searchedLayers(){return this.layers.filter(t=>(t.name||t.title||"").toLowerCase().includes(this.search.toLowerCase()))},categories(){return this.layers.reduce((t,e)=>{const n=this.sortBy==="category"?(e==null?void 0:e.category)||"Без категорії":(e==null?void 0:e.owner)||"Без утримувача";return t!=null&&t[n]?{...t,[n]:t==null?void 0:t[n].concat(e)}:{...t,[n]:[e]}},{})}},methods:{formatNumber(t){return Intl.NumberFormat("uk",{notation:"compact"}).format(t)},selectCategory(t){this.selectedCategory=this.selectedCategory===t?"":t},onEnter(){this.layers.filter(({name:e})=>e==null?void 0:e.toLowerCase().match(this.search.toLowerCase())).length===0&&this.$notify({type:"warn",title:"Нічого не знайдено!",message:"За вашим запитом нічого не знайдено"})},clearSearch(){this.search=""},addPxIfNeeded(t){return typeof t=="string"&&!t.endsWith("px")?`${t}px`:t}}},Ibe={class:"flex items-center justify-between pb-[8px] border-b"},Lbe={class:"flex items-baseline"},Pbe={class:"text-[13px] ml-[10px] opacity-60"},Nbe={class:"flex gap-4 mt-[10px]"},Obe={class:"flex items-center text-[14px] text-[#4b5563]"},Dbe={class:"flex items-center text-[14px] text-[#4b5563]"},Rbe={class:"relative mt-[10px]"},Bbe={class:"h-full overflow-y-auto mt-[10px] overflow-x-hidden [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent"},Fbe=["onClick"],$be={class:"flex items-center gap-x-3"},zbe=["title"],Vbe={class:"text-xs opacity-60 text-[#4b5563]"};function jbe(t,e,n,r,i,o){var m;const s=g.resolveComponent("IconCatalog"),a=g.resolveComponent("VsButton"),l=g.resolveComponent("IconClose"),c=g.resolveComponent("VsPopover"),u=g.resolveComponent("IconSearch"),d=g.resolveComponent("VsFormGeomCatalogItem"),p=g.resolveComponent("chevronRightIcon");return g.openBlock(),g.createElementBlock("div",null,[g.createVNode(a,{square:"",onClick:e[0]||(e[0]=y=>i.isOpen=!i.isOpen),class:"h-[38px] form-geom-catalog"},{default:g.withCtx(()=>[g.createVNode(s,{class:"icon-catalog",stroke:"#1e40af"})]),_:1}),(g.openBlock(),g.createBlock(g.Teleport,{to:"#formGeom"},[g.withDirectives(g.createElementVNode("div",{class:g.normalizeClass(["flex flex-col vs-layers-catalog absolute max-w-[360px] w-full top-[105px] left-[10px] bg-white border rounded-[15px] p-4 z-10",`!max-h-[calc(${o.addPxIfNeeded(n.height)}-115px)]`])},[g.createElementVNode("div",Ibe,[g.createElementVNode("div",Lbe,[e[6]||(e[6]=g.createElementVNode("span",{class:"text-[16px]"},"Каталог шарів",-1)),g.createElementVNode("span",Pbe,g.toDisplayString((m=i.layers)==null?void 0:m.length),1)]),g.createVNode(c,{trigger:"hover",teleport:"body"},{reference:g.withCtx(()=>[g.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:e[1]||(e[1]=y=>i.isOpen=!1)},[g.createVNode(l,{class:"cursor-pointer flex-shrink-0 w-4 h-4"})])]),default:g.withCtx(()=>[e[7]||(e[7]=g.createTextVNode(" Приховати панель "))]),_:1,__:[7]})]),g.createElementVNode("div",Nbe,[g.createElementVNode("label",Obe,[g.withDirectives(g.createElementVNode("input",{type:"radio",value:"category","onUpdate:modelValue":e[2]||(e[2]=y=>i.sortBy=y),class:"mr-1"},null,512),[[g.vModelRadio,i.sortBy]]),e[8]||(e[8]=g.createTextVNode(" Категорія "))]),g.createElementVNode("label",Dbe,[g.withDirectives(g.createElementVNode("input",{type:"radio",value:"owner","onUpdate:modelValue":e[3]||(e[3]=y=>i.sortBy=y),class:"mr-1"},null,512),[[g.vModelRadio,i.sortBy]]),e[9]||(e[9]=g.createTextVNode(" Утримувач "))])]),g.createElementVNode("div",Rbe,[g.withDirectives(g.createElementVNode("input",{title:"value",placeholder:"Введіть назву шару...","onUpdate:modelValue":e[4]||(e[4]=y=>i.search=y),type:"text",class:"py-[7px] ps-8 pe-8 block w-full bg-gray-100 border-transparent rounded-lg text-sm focus:bg-white focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600",onKeyup:e[5]||(e[5]=g.withKeys((...y)=>o.onEnter&&o.onEnter(...y),["enter"]))},null,544),[[g.vModelText,i.search]]),g.createVNode(u,{class:"absolute top-1/2 left-[8px] w-[16px] h-[16px]",style:{transform:"translate(0, -50%)"}}),i.search?(g.openBlock(),g.createBlock(l,{key:0,class:"absolute top-1/2 right-[10px] w-[16px] h-[16px] cursor-pointer",style:{transform:"translate(0, -50%)"},onClick:o.clearSearch},null,8,["onClick"])):g.createCommentVNode("",!0)]),g.createElementVNode("div",Bbe,[i.search?(g.openBlock(!0),g.createElementBlock(g.Fragment,{key:0},g.renderList(o.searchedLayers,(y,w)=>(g.openBlock(),g.createBlock(d,{prefix:n.prefix,key:w,layer:y,map:n.map},null,8,["prefix","layer","map"]))),128)):(g.openBlock(!0),g.createElementBlock(g.Fragment,{key:1},g.renderList(Object.keys(o.categories),y=>(g.openBlock(),g.createElementBlock("div",{key:y},[g.createElementVNode("div",{class:"hover:bg-gray-100 focus:bg-gray-100 px-2.5 cursor-pointer p-[8px] rounded-lg flex justify-between items-center",onClick:w=>o.selectCategory(y)},[g.createElementVNode("div",$be,[g.createVNode(p,{class:g.normalizeClass({"rotate-up":y===i.selectedCategory,"rotate-down":y!==i.selectedCategory})},null,8,["class"]),g.createElementVNode("div",{class:"max-w-[260px] text-[14px] text-[#4b5563]",title:y},g.toDisplayString(y),9,zbe)]),g.createElementVNode("div",Vbe,g.toDisplayString(o.formatNumber(o.categories[y].length)),1)],8,Fbe),g.withDirectives(g.createElementVNode("div",null,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(o.categories[y],(w,x)=>(g.openBlock(),g.createBlock(d,{prefix:n.prefix,key:x,layer:w,map:n.map},null,8,["prefix","layer","map"]))),128))],512),[[g.vShow,y===i.selectedCategory]])]))),128))])],2),[[g.vShow,i.isOpen]])]))])}const Ube=xt(Abe,[["render",jbe],["__scopeId","data-v-96b2b6ed"]]),Hbe={key:0,class:"absolute bottom-[10px] left-[10px] bg-white w-[240px] rounded-xl p-[10px]"},Wbe={key:0},Gbe={__name:"vs-form-geom-legend",props:{dataset:{type:Object,default:()=>{}}},setup(t){const e=g.ref(!1);return(n,r)=>{var i,o,s,a,l;return e.value?(g.openBlock(),g.createElementBlock("div",Hbe,[g.createElementVNode("h2",{onClick:r[0]||(r[0]=c=>e.value=!1),class:"mb-[3px] flex items-center justify-between cursor-pointer"},[g.createTextVNode(g.toDisplayString((i=t.dataset)==null?void 0:i.name)+" ",1),g.createVNode(Ip,{height:"20",width:"20",class:"text-gray-500"})]),(o=t.dataset)!=null&&o.data?(g.openBlock(),g.createElementBlock("ul",Wbe,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList((a=(s=t.dataset)==null?void 0:s.data)==null?void 0:a.rows,c=>(g.openBlock(),g.createElementBlock("li",{key:c==null?void 0:c.id,class:"flex items-center gap-[10px]"},[g.createElementVNode("span",{class:"h-3 w-3 rounded block",style:g.normalizeStyle({backgroundColor:c==null?void 0:c.color})},null,4),g.createElementVNode("span",null,g.toDisplayString(c==null?void 0:c.text),1)]))),128))])):g.createCommentVNode("",!0)])):(g.openBlock(),g.createElementBlock("button",{key:1,onClick:r[1]||(r[1]=c=>e.value=!0),class:"absolute bottom-[10px] left-[10px] py-2 px-2.5 max-h-[38px] text-sm font-medium border rounded-lg bg-white text-gray-800 hover:bg-gray-50"},g.toDisplayString((l=t.dataset)==null?void 0:l.name),1))}}},qbe={},Ybe={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-polygon"};function Zbe(t,e){return g.openBlock(),g.createElementBlock("svg",Ybe,e[0]||(e[0]=[g.createStaticVNode('',9)]))}const Xbe=xt(qbe,[["render",Zbe]]),Kbe={},Jbe={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",stroke:"currentColor",fill:"none","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-map-pin"};function Qbe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",Jbe,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),g.createElementVNode("path",{d:"M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0z"},null,-1)]))}const e1e=xt(Kbe,[["render",Qbe]]),t1e={},n1e={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","stroke-width":"2",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-line"};function r1e(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",n1e,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),g.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),g.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const i1e=xt(t1e,[["render",r1e]]),o1e={},s1e={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-topology-ring-3"};function a1e(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",s1e,e[0]||(e[0]=[g.createStaticVNode('',9)]))}const l1e=xt(o1e,[["render",a1e]]),c1e={},u1e={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-stack-2"};function h1e(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",u1e,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M12 4l-8 4l8 4l8 -4l-8 -4"},null,-1),g.createElementVNode("path",{d:"M4 12l8 4l8 -4"},null,-1),g.createElementVNode("path",{d:"M4 16l8 4l8 -4"},null,-1)]))}const d1e=xt(c1e,[["render",h1e]]);let f1e=0;const p1e={inheritAttrs:!1,components:{VsMapSearch:gV,VsFormGeomLayers:CV,VsFormGeomFeature:ube,VsFormGeomFilesTransfer:ebe,VsFormGeomLegend:Gbe,VsFormGeomCatalog:Ube,IconPolygon:Xbe,IconPoint:e1e,IconLine:i1e,IconTopology:l1e,IconStack:d1e,VsFormGeomFullscreen:fbe,VsPopover:Dp},mixins:[oP],props:{height:{type:String,default:()=>{var t,e;return((e=(t=An==null?void 0:An.value)==null?void 0:t.geom)==null?void 0:e.height)||"400px"}},atuSearchApi:{type:String,default:()=>{var t,e;return((e=(t=An==null?void 0:An.value)==null?void 0:t.geom)==null?void 0:e.atuSearchApi)||"https://data.softpro.ua"}},hideAddressSearch:{type:Boolean,default:()=>{var t,e;return((e=(t=An==null?void 0:An.value)==null?void 0:t.geom)==null?void 0:e.hideAddressSearch)||!1}},disabled:{type:Boolean,default:()=>!1},catalog:{type:Boolean,default:()=>{var t,e,n,r;return((e=(t=An==null?void 0:An.value)==null?void 0:t.geom)==null?void 0:e.catalog)!==void 0?(r=(n=An==null?void 0:An.value)==null?void 0:n.geom)==null?void 0:r.catalog:!1}},modelValue:{type:[Object,Array],default:()=>null},multiple:{type:Boolean,default:()=>!1},multipleAll:{type:Boolean,default:()=>!1},componentKey:{type:String,default:()=>""},apiLayer:{type:String,default:()=>""},searchable:{type:Boolean,default:()=>!0},isExportImport:{type:Boolean,default:()=>!0},customSearch:{type:[Object,String],default:()=>""},customTools:{type:Array,default:()=>[]},tools:{type:[Array],default:()=>{var t,e;return((e=(t=An==null?void 0:An.value)==null?void 0:t.geom)==null?void 0:e.tools)||["polygon","point","line","rectangle"]}},zoom:{type:Number,default:()=>{var t,e;return((e=(t=An==null?void 0:An.value)==null?void 0:t.geom)==null?void 0:e.zoom)||10}},center:{type:Array,default:()=>{var t,e;return((e=(t=An==null?void 0:An.value)==null?void 0:t.geom)==null?void 0:e.center)||[30.5,50.45]}},maxZoom:{type:Number,default:()=>21},minZoom:{type:Number,default:()=>0},layers:{type:Array,default:()=>{var t,e;return((e=(t=An==null?void 0:An.value)==null?void 0:t.geom)==null?void 0:e.layers)||[]}},parent:{type:String,default:""},prefix:{type:String,default:()=>{var t,e;return((e=(t=An==null?void 0:An.value)==null?void 0:t.geom)==null?void 0:e.prefix)||"api"}}},inject:["meta","formValues","scheme"],data(){return{mapId:`vsFormGeom-${f1e++}`,map:null,draw:null,parentData:null,activeTool:"",showLayers:!1,isFullscreen:!1,dataset:[],drawTools:[{title:"Полігон",mode:"draw_polygon",icon:"icon-polygon"},{title:"Точка",mode:"draw_point",icon:"icon-point"},{title:"Лінія",mode:"draw_line_string",icon:"icon-line"},{title:"Полігон (квадрат)",mode:"draw_rectangle",icon:"icon-topology"}],mapLoaded:!1,selectedFeatures:[],featuresList:[],mapParams:{bearing:0},activeLayers:[],windowSettingLayers:""}},watch:{modelValue(t,e){t!==e&&this.handleModelValueChange(t)},activeTool(t){const e=this.map.getCanvas();e.classList.remove("cursor-crosshair"),e.classList.remove("cursor-grab"),e.classList.add(t?"cursor-crosshair":"cursor-grab")},async parentValue(t,e){var n,r;if(t!==e){await this.getParentData();const i=(r=(n=this.parentData)==null?void 0:n.data.find(o=>o.id===this.parentValue))==null?void 0:r.geom;this.$emit("update:modelValue",i||null)}}},async mounted(){var t;await GS.promise(["https://www.unpkg.com/@mapbox/mapbox-gl-draw@1.4.3/dist/mapbox-gl-draw.js"]),((t=this.layers)==null?void 0:t.length)>=1&&this.findDatasetLayers(),this.$nextTick(async()=>{await this.initMap()}),this.drawTools=this.drawTools.filter(e=>this.tools.find(n=>e.mode.match(n)))},beforeUnmount(){this.map.off("draw:create",this.drawCreateEvent),this.map.off("draw:update",this.drawEvent),this.map.off("draw:delete",this.drawEvent),window.removeEventListener("keydown",this.keyboardEvents)},computed:{compasRotate(){return`${this.mapParams.bearing-45}deg`},metaToken(){var t;return((t=this==null?void 0:this.meta)==null?void 0:t.token)||""},metaTable(){var t;return((t=this==null?void 0:this.meta)==null?void 0:t.table)||""},nextId(){var t;return((t=this==null?void 0:this.meta)==null?void 0:t.nextId)||""},parentValue(){var t;return this.formValues&&this.parent?(t=this.formValues)==null?void 0:t[this.parent]:""}},methods:{handleModelValueChange(t){if(t){this.draw.deleteAll(),this.featuresByValue(t);const e=Ri(t);this.map.fitBounds(e,{maxZoom:17,padding:30,duration:0}),this.drawEvent(!1)}else this.draw.deleteAll()},async findDatasetLayers(){var e;const t=(e=this.layers)==null?void 0:e.find(n=>n==null?void 0:n.colorAttr);if(t)try{const{data:n}=await un.get(`/api/data/${t==null?void 0:t.table}/${t==null?void 0:t.colorAttr}`);this.dataset[0]={...t,data:n}}catch(n){console.log(n)}},async initMap(){var n,r;const t=(r=(n=window==null?void 0:window.setting)==null?void 0:n.map)==null?void 0:r.basemap;t&&(this.windowSettingLayers=t);const e=new SV.Map({container:this.mapId,style:{version:8,sources:{},layers:[]},center:this.center,zoom:this.zoom,maxZoom:this.maxZoom,minZoom:this.minZoom});e.on("load",this.onMapLoad),e.on("rotate",this.rotateEvent)},async getLayerList(){try{const{data:t}=await un.get("/api-user/gis-layer-list"),e=(this.windowSettingLayers||"").split(",");this.mapLoaded=!0}catch(t){this.mapLoaded=!0,console.error(t)}},async getParentData(){try{const{data:t}=await un.get(`/api/suggest/${this.scheme[this.parent].data}?val=${this.parentValue}`);this.parentData=t}catch(t){console.error(t)}},initDrawTool(){const{modes:t}=MapboxDraw;t.draw_rectangle=R_e;const e=MapboxDraw.lib.theme||MapboxDraw.lib.styles;console.log(e);const n=e.map(i=>i.id==="gl-draw-point-inactive"||i.id==="gl-draw-point-active"||i.id==="gl-draw-point-static"?{...i,paint:{...i.paint,"circle-radius":6}}:i),r={displayControlsDefault:!1,controls:{polygon:!this.disabled,trash:!this.disabled},modes:t,userProperties:!0,boxSelect:!this.disabled,touchEnabled:!this.disabled,keybindings:!this.disabled,clickBuffer:this.disabled?0:2,touchBuffer:this.disabled?0:2,styles:n};this.draw=new MapboxDraw(r),this.disabled||(this.map.on("click",this.handleMapClick),this.map.on("moveend",this.handleMapClick)),this.map.addControl(this.draw),this.drawCreateEvent=async()=>{this.activeTool="",await this.drawEvent(),await this.getAllSelectedFeatures()},this.disabled||(this.map.on("draw.create",this.drawCreateEvent),this.map.on("draw.update",this.drawEvent),this.map.on("draw.delete",this.drawEvent)),this.disabled&&(this.map.on("draw.selectionchange",()=>{this.draw.changeMode("simple_select",{featureIds:[]})}),this.map.on("draw.modechange",i=>{i.mode==="direct_select"&&this.draw.changeMode("simple_select",{featureIds:[]})}))},async onMapLoad(t){var e,n,r,i,o,s,a,l,c,u,d,p,m;if(this.map=await t.target,this.disabled&&this.map&&((e=this.map.dragPan)==null||e.disable(),(n=this.map.doubleClickZoom)==null||n.disable(),(r=this.map.touchPitch)==null||r.disable(),(i=this.map.dragRotate)==null||i.disable(),(o=this.map.keyboard)==null||o.disable()),(a=(s=An==null?void 0:An.value)==null?void 0:s.geom)!=null&&a.bounds&&this.map.fitBounds(An.value.geom.bounds,{padding:20,duration:0}),(c=(l=An==null?void 0:An.value)==null?void 0:l.geom)!=null&&c.zoom&&this.map.setZoom(An.value.geom.zoom),this.map.setVisible=this.setVisible,this.map.changeBaseLayer=this.changeBaseLayer,await this.initDrawTool(),this.windowSettingLayers?this.getLayerList():this.mapLoaded=!0,this.modelValue){this.featuresByValue(),this.drawEvent(!1);const y=Ri(this.modelValue);this.map.fitBounds(y,{maxZoom:17,padding:30,duration:0})}window.addEventListener("keydown",this.keyboardEvents),await this.$emit("load",this.map),(d=(u=An==null?void 0:An.value)==null?void 0:u.geom)!=null&&d.katottg&&await this.createAtuLayer((m=(p=An==null?void 0:An.value)==null?void 0:p.geom)==null?void 0:m.katottg),setTimeout(()=>{this.map.moveLayer("atu")},500)},async createAtuLayer(t){try{const{map:e}=this;if(!e)return;const{data:n}=await un.get(`https://data.gki.com.ua/api-user/atu/${t}`);e.addSource("atu",{type:"geojson",data:n}),e.addLayer({id:"atu",type:"line",source:"atu",paint:{"line-color":"#3b82f6","line-width":2}})}catch(e){console.error(e)}},async drawEvent(t=!0){this.featuresList=await this.formatFeatures(this.draw.getAll().features),t&&await this.$emit("update:modelValue",this.emitDataByType(this.featuresList)),document.querySelector(`#${this.mapId}`).style.height=await this.isFullscreen?"100vh":this.height,await this.map.resize()},rotateEvent(){this.mapParams.bearing=this.map.getBearing()},featuresByValue(){var r;if(this.multipleAll){const i=((r=this.modelValue)==null?void 0:r.features)||this.modelValue;i!=null&&i.length?i==null||i.forEach(o=>this.draw.add(o)):this.draw.add(i);return}const e=this.modelValue.type.replace("Multi",""),n=e.replace(e[0],e[0].toLowerCase());if(this.modelValue.type.match("Multi")){const i=this.modelValue.coordinates;i==null||i.forEach(o=>{this.draw.add(mV[n](o))});return}this.draw.add(this.modelValue)},emitDataByType(t){var n,r;if(!t.length)return null;const e=this.multipleAll;if(e)return t;if(!e&&this.multiple&&t.length>=1){const o=`multi${((r=(n=t[0])==null?void 0:n.geometry)==null?void 0:r.type)||""}`,s=t.map(l=>l.geometry.coordinates),{geometry:a}=mV[o](s);return a}return t[0].geometry},formatFeatures(t){return this.multiple?t.reduce((n,r)=>r.geometry.type!==t[0].geometry.type&&!this.multipleAll?(this.$vsNotify({type:"error",title:"Помилка!",message:"У режимі мульти-геометрії можливо додавати лише декілька геометрій одного типу!"}),this.draw.delete(r.id),n):n.concat(r),[]):t},toolClick({mode:t}){this.disabled||(this.multiple||this.draw.deleteAll(),this.activeTool=this.activeTool===t?"":t,this.draw.changeMode(t))},handleMapClick(){this.getAllSelectedFeatures()},getAllSelectedFeatures(){const{features:t}=this.draw.getSelected();this.selectedFeatures=t.map(e=>e.id)},deleteFeature({id:t}){this.draw.delete(t),this.drawEvent()},keyboardEvents(t){switch(t.keyCode){case 27:this.activeTool="";break}},mapLevelOut(){if(this.disabled)return;const{map:t}=this;t.flyTo({pitch:0,bearing:0})}}},m1e={class:"w-full relative",id:`formGeom `},g1e={class:"form-geom w-full"},y1e=["id"],v1e={key:3,class:"form-geom__panel flex gap-1 items-start"},_1e={class:"form-geom__tools flex flex-col gap-[2px]"},b1e=["onClick"],w1e={class:"relative"};function x1e(t,e,n,r,i,o){var w,x,C,S;const s=g.resolveComponent("VsFormGeomLegend"),a=g.resolveComponent("VsMapSearch"),l=g.resolveComponent("VsFormGeomFilesTransfer"),c=g.resolveComponent("VsFormGeomCatalog"),u=g.resolveComponent("VsPopover"),d=g.resolveComponent("IconStack"),p=g.resolveComponent("VsFormGeomLayers"),m=g.resolveComponent("VsFormGeomFullscreen"),y=g.resolveComponent("VsFormGeomFeature");return g.openBlock(),g.createElementBlock("div",m1e,[g.createElementVNode("div",g1e,[g.createElementVNode("div",{class:"outline-none",id:i.mapId,style:g.normalizeStyle({height:(w=n.height)!=null&&w.includes("px")||(x=n.height)!=null&&x.includes("%")?n.height:n.height+"px"})},null,12,y1e),(C=i.activeLayers)!=null&&C.length?(g.openBlock(),g.createBlock(s,{key:0,dataset:i.dataset[0]},null,8,["dataset"])):g.createCommentVNode("",!0),n.searchable&&!n.disabled?(g.openBlock(),g.createBlock(a,{key:1,atuSearchApi:n.atuSearchApi,prefix:n.prefix,map:i.map,"onUpdate:map":e[0]||(e[0]=M=>i.map=M),hideAddressSearch:n.hideAddressSearch,class:"form-geom__search"},null,8,["atuSearchApi","prefix","map","hideAddressSearch"])):g.createCommentVNode("",!0),n.customSearch?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.customSearch),{key:2,map:i.map,"onUpdate:map":e[1]||(e[1]=M=>i.map=M)},null,40,["map"])):g.createCommentVNode("",!0),n.isExportImport?(g.openBlock(),g.createElementBlock("div",v1e,[n.disabled?g.createCommentVNode("",!0):(g.openBlock(),g.createBlock(l,{key:0,field:"file",id:o.nextId,table:o.metaToken,form:o.metaTable,draw:i.draw,prefix:n.prefix,map:i.map,"features-list":i.featuresList,onUpload:o.drawEvent},null,8,["id","table","form","draw","prefix","map","features-list","onUpload"])),i.map&&n.catalog?(g.openBlock(),g.createBlock(c,{key:1,map:i.map,height:n.height,prefix:n.prefix},null,8,["map","height","prefix"])):g.createCommentVNode("",!0)])):g.createCommentVNode("",!0),g.createElementVNode("div",_1e,[g.createVNode(u,{placement:"left",trigger:"hover"},{reference:g.withCtx(()=>[g.createElementVNode("div",{class:"form-geom__tool py-0.5 px-2 cursor-pointer transition-all border rounded-md text-sm bg-white hover:bg-blue-500",onClick:e[2]||(e[2]=(...M)=>o.mapLevelOut&&o.mapLevelOut(...M))},[(g.openBlock(),g.createElementBlock("svg",{style:g.normalizeStyle({rotate:o.compasRotate}),xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",stroke:"#3C3C43",fill:"transparent",viewBox:"0 0 24 24","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-compass"},e[7]||(e[7]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M8 16l2 -6l6 -2l-2 6l-6 2"},null,-1),g.createElementVNode("path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"},null,-1),g.createElementVNode("path",{d:"M12 3l0 2"},null,-1),g.createElementVNode("path",{d:"M12 19l0 2"},null,-1),g.createElementVNode("path",{d:"M3 12l2 0"},null,-1),g.createElementVNode("path",{d:"M19 12l2 0"},null,-1)]),4))])]),default:g.withCtx(()=>[e[8]||(e[8]=g.createTextVNode(" Вирівняти карту "))]),_:1,__:[8]}),n.disabled?g.createCommentVNode("",!0):(g.openBlock(!0),g.createElementBlock(g.Fragment,{key:0},g.renderList(i.drawTools,M=>(g.openBlock(),g.createBlock(u,{placement:"left",key:M==null?void 0:M.mode,trigger:"hover"},{reference:g.withCtx(()=>[g.createElementVNode("div",{class:g.normalizeClass(["form-geom__tool py-0.5 px-2 cursor-pointer transition-all border text-black rounded-md text-sm bg-white hover:bg-blue-500 hover:text-white",{"!bg-blue-500 !text-white":M.mode===i.activeTool}]),onClick:E=>o.toolClick(M)},[(g.openBlock(),g.createBlock(g.resolveDynamicComponent(M.icon)))],10,b1e)]),default:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(M==null?void 0:M.title)+" ",1)]),_:2},1024))),128)),g.withDirectives(g.createVNode(u,{placement:"left",trigger:"hover"},{reference:g.withCtx(()=>{var M;return[g.createElementVNode("div",w1e,[g.createElementVNode("div",{class:g.normalizeClass(["form-geom__tool py-0.5 px-2 cursor-pointer transition-all border rounded-md text-sm bg-white hover:bg-blue-500",{"!bg-blue-500 text-white":i.showLayers}]),onClick:e[3]||(e[3]=E=>i.showLayers=!i.showLayers)},[g.createVNode(d)],2),i.map&&i.mapLoaded?g.withDirectives((g.openBlock(),g.createBlock(p,{key:0,"api-layer":n.apiLayer,activeLayers:i.activeLayers,"onUpdate:activeLayers":e[4]||(e[4]=E=>i.activeLayers=E),layers:(M=n.layers)==null?void 0:M.filter(E=>!(E!=null&&E.colorAttr)),dataset:i.dataset,map:i.map},null,8,["api-layer","activeLayers","layers","dataset","map"])),[[g.vShow,i.showLayers]]):g.createCommentVNode("",!0)])]}),default:g.withCtx(()=>[e[9]||(e[9]=g.createTextVNode(" Шари "))]),_:1,__:[9]},512),[[g.vShow,(S=n.layers)==null?void 0:S.length]]),(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(n.customTools,M=>(g.openBlock(),g.createBlock(u,{placement:"left",key:M.name,trigger:"hover"},{reference:g.withCtx(()=>[(g.openBlock(),g.createBlock(g.resolveDynamicComponent(M.component),{map:i.map,activeTool:i.activeTool,"onUpdate:activeTool":e[5]||(e[5]=E=>i.activeTool=E)},null,40,["map","activeTool"]))]),default:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(M==null?void 0:M.title)+" ",1)]),_:2},1024))),128)),g.createVNode(m,{mapId:i.mapId,isFullscreen:i.isFullscreen,"onUpdate:isFullscreen":e[6]||(e[6]=M=>i.isFullscreen=M),initialHeight:n.height,map:i.map},null,8,["mapId","isFullscreen","initialHeight","map"])])]),n.disabled?g.createCommentVNode("",!0):(g.openBlock(),g.createBlock(g.TransitionGroup,{key:0,name:"list",duration:300,tag:"div",class:"form-geom__features"},{default:g.withCtx(()=>[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(i.featuresList,M=>(g.openBlock(),g.createBlock(y,{key:M.id,class:"form-geom__feature flex items-center",draw:i.draw,data:M,"selected-features":i.selectedFeatures,map:i.map,onDelete:E=>o.deleteFeature(M)},null,8,["draw","data","selected-features","map","onDelete"]))),128))]),_:1}))])}const mj=xt(p1e,[["render",x1e]]),E1e={},S1e={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",height:"16",width:"16"};function C1e(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",S1e,e[0]||(e[0]=[g.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),g.createElementVNode("path",{d:"M7 20V4"},null,-1),g.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),g.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const k1e=xt(E1e,[["render",C1e]]),T1e={},M1e={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-upload"};function A1e(t,e){return g.openBlock(),g.createElementBlock("svg",M1e,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),g.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),g.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const I1e=xt(T1e,[["render",A1e]]),L1e={class:"table-wrapper flex gap-2"},P1e={class:"bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},N1e={class:"flex flex-col p-[2px] gap-[2px] w-[140px]"},O1e={class:"text-sm items-center text-gray-800 flex gap-1"},D1e={__name:"vs-datatable-input",props:{data:{},dataModifiers:{}},emits:["update:data"],setup(t){var s,a;const e=(a=(s=g.getCurrentInstance())==null?void 0:s.proxy)==null?void 0:a.$notify,n=g.useModel(t,"data"),r=async l=>{const c=new FileReader;c.readAsText(l.target.files[0]),c.onload=()=>{const u=JSON.parse(c.result);n.value=[...n.value||[],...u||[]]},c.onerror=()=>{e({type:"error",title:"Помилка!",message:"Невалідний файл!"})},l.target.value=""},i=(l,c)=>{const u=document.createElement("a");document.body.appendChild(u);const d=new File([l],c),p=window.URL.createObjectURL(d);u.href=p,u.download=c,u.click(),window.URL.revokeObjectURL(p),u.remove()},o=async(l="fileData",c=n.value)=>{if(c.length){const u=`${l}-${Date.now()}.geojson`;i(JSON.stringify(c),u)}else e({type:"error",title:"Помилка!",message:"Таблиця пуста!"})};return(l,c)=>(g.openBlock(),g.createElementBlock("div",L1e,[g.createElementVNode("input",{ref:"filePicker",class:"hidden",accept:".geojson",type:"file",onChange:r},null,544),g.createVNode(Dp,{placement:"bottom"},{reference:g.withCtx(()=>[g.createElementVNode("button",P1e,[g.createVNode(k1e)])]),default:g.withCtx(()=>[g.createElementVNode("div",N1e,[g.createElementVNode("button",{onClick:c[0]||(c[0]=u=>l.$refs.filePicker.click()),class:"flex items-center gap-1 px-3 py-1 rounded-md cursor-pointer group hover:bg-gray-100"},[g.createVNode(I1e,{height:"14",width:"14",class:"text-black"}),c[1]||(c[1]=g.createTextVNode(" Імпортувати "))]),g.createElementVNode("button",{onClick:o,class:"flex items-center px-3 py-1 rounded-md cursor-pointer group hover:bg-gray-100"},[g.createElementVNode("span",O1e,[g.createVNode(QC,{height:"14",width:"14",class:"text-black"}),c[2]||(c[2]=g.createTextVNode("Експортувати"))])])])]),_:1})]))}},R1e={props:{title:{type:String,default:()=>"Дані для відображення відсутні"},text:{type:String,default:()=>"Змініть параметри пошуку або спробуйте пізніше"}}},B1e={class:"w-full"},F1e={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},$1e={class:"max-w-sm mx-auto mt-6"},z1e={class:"font-medium text-gray-800 dark:text-neutral-200"},V1e={class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"};function j1e(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",B1e,[g.createElementVNode("div",F1e,[e[0]||(e[0]=g.createStaticVNode('',1)),g.createElementVNode("div",$1e,[g.createElementVNode("p",z1e,g.toDisplayString(n.title),1),g.createElementVNode("p",V1e,g.toDisplayString(n.text),1)])])])}const U1e=xt(R1e,[["render",j1e]]),H1e=g.defineComponent({components:{VsButton:Fh,VsDialog:Ag,VsText:Yu,TableFormInput:D1e,VsCheckbox:m1,IconSearch:O0e,IconMenu:F0e,IconEdit:j0e,IconDelete:R2,IconPlus:Z0e,VsNotData:U1e,VsForm:g.defineAsyncComponent(()=>Promise.resolve().then(()=>Cj))},props:{colModel:{type:Array,default:()=>[]},modelValue:{default:()=>[]},searchable:{type:Boolean,default:()=>!0},import:{type:Boolean,default:()=>!0},editable:{type:Boolean,default:()=>!0},addition:{type:Boolean,default:()=>!0},addTitle:{type:String,default:"Додати елемент"},editTitle:{type:String,default:"Редагувати елемент"},additionBottom:{type:Boolean,default:()=>!1},prefix:{type:Boolean,default:()=>{var t;return((t=An.value)==null?void 0:t.prefix)||"api"}}},data(){return{userSearch:"",dialogType:"",newElement:{},currentlyEditing:null,keysMeta:[],selectKeys:[],isDialogVisible:!1,draggingIndex:null}},computed:{dataset:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}},dialogTitle(){return this.dialogType==="add"?this.addTitle:this.editTitle},filteredDataset(){return(Array.isArray(this.dataset)&&this.dataset.length?this.dataset:[]).filter(e=>!e.hide)},filterDatasetsExist(){return this.filteredDataset.length>0},showTableBody(){return this.filteredDataset.length>0&&this.filterDatasetsExist}},watch:{dataset:{handler(t){Array.isArray(t)||(this.dataset=[]),this.$emit("update:modelValue",t)},deep:!0},userSearch:{handler(){this.filterDataset()},immediate:!0},isDialogVisible(t){t||(this.newElement={})},"$parent.values":{handler(t,e){t&&this.setParentData(t)},deep:!0,immediate:!0}},async mounted(){await this.initData()},methods:{registerComponent(t,e,n){return uf(t,e,n)},setParentData(t){var e;(e=this.colModel)==null||e.forEach(n=>{n!=null&&n.parent&&t[n==null?void 0:n.parent]&&(n.parentValue=t[n.parent])})},dragStart(t){this.draggingIndex=t},drop(t){this.draggingIndex!==null&&this.draggingIndex!==t&&this.moveRow(this.draggingIndex,t),this.draggingIndex=null},moveRow(t,e){const n=this.dataset.splice(t,1)[0];this.dataset.splice(e,0,n)},async initData(){var t;await this.initKeysMeta(),this.dataset=this.modelValue||[],(t=this.modelValue)!=null&&t.length&&await Promise.all(this.modelValue.map(async e=>{await this.initRowSuggestText(e)}))},async initKeysMeta(){this.keysMeta=this.colModel.filter(t=>t.type).map(t=>({...t,key:(t==null?void 0:t.name)||t.key,label:t.ua})),this.selectKeys=this.keysMeta.filter(t=>["Select2","Select","Autocomplete"].includes(t.type)).map(t=>({key:t.key,data:t.data,multi:t.multi}))},async initRowSuggestText(t){const e=Object.keys(t);await Promise.all(e.map(async n=>{await this.processRowSuggestText(n,t)}))},openAddForm(){this.dialogType="add",this.isDialogVisible=!0},async handleConfirm(){try{await this.$refs.form.doValidation(),this.dialogType==="add"?await this.addNewRow():this.dialogType==="edit"&&await this.editRow(),this.dialogType="",this.isDialogVisible=!1}catch{}},async processRowSuggestText(t,e){var r;const n=this.selectKeys.find(i=>i.key===t);if(n){let i="";if(n.multi){const o=[];await Promise.all((r=e[t])==null?void 0:r.map(async s=>{const a=await this.getSuggestText(s,n.data);o.push(a)})),i=o.join(",")}else i=await this.getSuggestText(e[t],n.data);e[`${n.key}_suggest`]=i}},async addNewRow(){var n;const t={},e=Object.keys(this.newElement);await Promise.all(e.map(async r=>{t[r]=this.newElement[r],await this.processRowSuggestText(r,t)})),(n=this.dataset)==null||n.push(t)},async editRow(){this.dataset=await Promise.all(this.dataset.map(async t=>t===this.currentlyEditing?await this.updateRowProperties(this.newElement):t)),this.currentlyEditing=null},async deleteRow(t){var e,n;document.body.click(),this.dataset=(e=this.dataset)!=null&&e.length?(n=this.dataset)==null?void 0:n.filter(r=>r!==t):this.dataset},async updateRowProperties(t){const e={},n=Object.keys(t),r=[];return await Promise.all(n.map(async i=>{if(i.includes("_suggest"))return;if(e[i]=t[i],this.selectKeys.find(s=>s.key===i)){const s=this.processRowSuggestText(i,e);r.push(s)}})),await Promise.all(r),e},startEditRow(t){document.body.click(),this.newElement=JSON.parse(JSON.stringify(t)),this.currentlyEditing=t,this.dialogType="edit",this.isDialogVisible=!0},async getSuggestText(t,e){var n,r,i,o,s,a,l,c;try{const{data:u}=await un.get(`/${this.prefix}/suggest/${e}`,{params:{val:t,parent:((n=this.colModel.find(d=>d.data==e))==null?void 0:n.parentValue)||null}});return((r=u[0])==null?void 0:r.text)||((i=u[0])==null?void 0:i.id)||((s=(o=u==null?void 0:u.data)==null?void 0:o[0])==null?void 0:s.text)||((c=(l=(a=u==null?void 0:u.data)==null?void 0:a.data)==null?void 0:l[0])==null?void 0:c.text)}catch(u){return console.error(u),t}},filterDataset(){var t;(t=this.dataset)==null||t.forEach(e=>{var n,r,i;e.hide=!((i=(r=(n=Object.values(e))==null?void 0:n.join(""))==null?void 0:r.toLowerCase())!=null&&i.includes(this.userSearch.toLowerCase()))})},rowTitle(t){return t||"-"}}}),W1e={class:"vs-datatable border rounded-xl"},G1e={class:"flex items-center gap-[16px] justify-between p-[20px] pb-[16px]"},q1e={key:0,class:"relative w-full"},Y1e={class:"table-responsive p-[20px] py-0 vs-datatable__table-wrapper"},Z1e={class:"border-[#E5E7EB] w-full border-separate border-t"},X1e={class:"z-999 top-0 h-[50px]"},K1e={class:"border-b border-[#E5E7EB]"},J1e={key:0,class:"py-[12px] px-[20px] font-[500] text-[12px] font-normal text-gray-500 text-start border-b border-[#E5E7EB]"},Q1e={key:0,class:"w-[78px] sticky right-0 top-0 bg-white py-[12px] px-[20px] text-sm font-normal text-gray-500 text-center border-b border-[#E5E7EB]"},ewe=["onDragstart","onDrop"],twe={key:0,class:"p-3 text-[12px] text-gray-800 leading-[20px] relative"},nwe=["onUpdate:modelValue"],rwe={key:0},iwe={key:1},owe={key:0,class:"w-[78px] sticky right-0 h-[40px] max-h-[40px] px-[20px]"},swe={class:"flex items-center justify-center items-center text-start"},awe=["onClick"],lwe=["onClick"],cwe={key:1,colspan:"100%",class:"text-center"},uwe={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function hwe(t,e,n,r,i,o){const s=g.resolveComponent("IconSearch"),a=g.resolveComponent("TableFormInput"),l=g.resolveComponent("IconPlus"),c=g.resolveComponent("VsCheckbox"),u=g.resolveComponent("IconEdit"),d=g.resolveComponent("IconDelete"),p=g.resolveComponent("VsNotData"),m=g.resolveComponent("VsForm"),y=g.resolveComponent("VsDialog");return g.openBlock(),g.createElementBlock("div",W1e,[g.createElementVNode("div",G1e,[t.searchable?(g.openBlock(),g.createElementBlock("div",q1e,[g.createVNode(s,{class:"absolute left-3 top-1/2 transform -translate-y-1/2 text-stone-500"}),g.withDirectives(g.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=w=>t.userSearch=w),type:"text",placeholder:"Пошук",class:"py-2 px-3 pl-10 w-full bg-gray-100 h-[36px] rounded-[8px] text-[15px] leading-[18px] focus:border-1 text-stone-800 placeholder:text-[#6B7280] focus:outline-blue-500 focus:outline-2"},null,512),[[g.vModelText,t.userSearch]])])):g.createCommentVNode("",!0),t.import?(g.openBlock(),g.createBlock(a,{key:1,data:t.dataset,"onUpdate:data":e[1]||(e[1]=w=>t.dataset=w),input:t.keysMeta,"onUpdate:input":e[2]||(e[2]=w=>t.keysMeta=w)},null,8,["data","input"])):g.createCommentVNode("",!0),t.addition?(g.openBlock(),g.createElementBlock("button",{key:2,onClick:e[3]||(e[3]=(...w)=>t.openAddForm&&t.openAddForm(...w)),class:"bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[g.createVNode(l),e[10]||(e[10]=g.createTextVNode(" Додати "))])):g.createCommentVNode("",!0)]),g.createElementVNode("div",Y1e,[g.createElementVNode("table",Z1e,[g.createElementVNode("thead",X1e,[g.createElementVNode("tr",K1e,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(t.keysMeta,w=>(g.openBlock(),g.createElementBlock(g.Fragment,{key:w.name},[w!=null&&w.hiddenCol?g.createCommentVNode("",!0):(g.openBlock(),g.createElementBlock("th",J1e,g.toDisplayString(w==null?void 0:w.ua),1))],64))),128)),t.editable?(g.openBlock(),g.createElementBlock("th",Q1e," Дії ")):g.createCommentVNode("",!0)])]),g.createElementVNode("tbody",null,[t.showTableBody?(g.openBlock(!0),g.createElementBlock(g.Fragment,{key:0},g.renderList(t.filteredDataset,(w,x)=>g.withDirectives((g.openBlock(),g.createElementBlock("tr",{key:x,draggable:"true",onDragstart:C=>t.dragStart(x),onDragover:e[4]||(e[4]=g.withModifiers(()=>{},["prevent"])),onDrop:C=>t.drop(x),class:"border border-[#E5E7EB] h-[40px] max-h-[40px]"},[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(t.keysMeta,C=>{var S,M,E;return g.openBlock(),g.createElementBlock(g.Fragment,{key:C.name},[C!=null&&C.hiddenCol?g.createCommentVNode("",!0):(g.openBlock(),g.createElementBlock("td",twe,[C.type==="Switcher"?(g.openBlock(),g.createBlock(c,{key:0,modelValue:w[C.key],"onUpdate:modelValue":A=>w[C.key]=A},null,8,["modelValue","onUpdate:modelValue"])):(S=C==null?void 0:C.slots)!=null&&S.row?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(t.registerComponent(C==null?void 0:C.key,(M=C==null?void 0:C.slots)==null?void 0:M.row,[...Object.keys(C),"data","row","columns"])),g.mergeProps({key:1,ref_for:!0},C||{},{columns:t.keysMeta,row:w,data:t.dataset}),null,16,["columns","row","data"])):((E=C.type)==null?void 0:E.toLowerCase())==="text"&&!(C!=null&&C.disabled)?g.withDirectives((g.openBlock(),g.createElementBlock("input",{key:2,type:"text","onUpdate:modelValue":A=>w[C.key]=A,class:"block w-full border-transparent focus:border-blue-600 bg-transparent focus:border-1 absolute top-0 left-0 h-full w-full px-[16px]"},null,8,nwe)),[[g.vModelText,w[C.key]]]):(g.openBlock(),g.createElementBlock(g.Fragment,{key:3},[["Select2","Select","Autocomplete"].includes(C.type)?(g.openBlock(),g.createElementBlock("span",rwe,g.toDisplayString(w[`${C.key}_suggest`]||w[C.key]||"-"),1)):C.hiddenCol?g.createCommentVNode("",!0):(g.openBlock(),g.createElementBlock("span",iwe,g.toDisplayString(t.rowTitle(w[C.key])),1))],64))]))],64)}),128)),t.editable?(g.openBlock(),g.createElementBlock("td",owe,[g.createElementVNode("div",swe,[g.createElementVNode("button",{onClick:C=>t.startEditRow(w),class:"flex gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-gray-100 float-left"},[g.createVNode(u)],8,awe),g.createElementVNode("button",{onClick:C=>t.deleteRow(w),class:"flex gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-gray-100 float-left"},[g.createVNode(d)],8,lwe)])])):g.createCommentVNode("",!0)],40,ewe)),[[g.vShow,!w.hide]])),128)):(g.openBlock(),g.createElementBlock("td",cwe,[g.createVNode(p,{title:"Нічого не знайдено",text:""})]))])])]),t.additionBottom?(g.openBlock(),g.createElementBlock("div",{key:0,class:"border-t p-[20px] cursor-pointer px-[30px] text-[14px] flex items-center gap-3 hover:bg-gray-100 duration-300",onClick:e[5]||(e[5]=(...w)=>t.openAddForm&&t.openAddForm(...w))},[g.createVNode(l,{height:"16",width:"16"}),e[11]||(e[11]=g.createTextVNode(" Додати ще один рядок "))])):g.createCommentVNode("",!0),g.createVNode(y,{visible:t.isDialogVisible,"onUpdate:visible":e[9]||(e[9]=w=>t.isDialogVisible=w),title:t.dialogTitle,closeClickBack:!0},{footer:g.withCtx(()=>[g.createElementVNode("div",uwe,[g.createElementVNode("button",{class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border rounded-lg border-gray-200 hover:bg-gray-100 duration-300",onClick:e[7]||(e[7]=w=>t.isDialogVisible=!1)}," Скасувати "),g.createElementVNode("button",{class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300",onClick:e[8]||(e[8]=(...w)=>t.handleConfirm&&t.handleConfirm(...w))}," Зберегти ")])]),default:g.withCtx(()=>[t.isDialogVisible?(g.openBlock(),g.createBlock(m,{key:0,ref:"form",modelValue:t.newElement,"onUpdate:modelValue":e[6]||(e[6]=w=>t.newElement=w),class:"p-4",scheme:t.colModel},null,8,["modelValue","scheme"])):g.createCommentVNode("",!0)]),_:1},8,["visible","title"])])}const gj=xt(H1e,[["render",hwe],["__scopeId","data-v-40a97287"]]),dwe={class:"flex items-center gap-2 mb-3"},fwe={class:"flex items-center gap-2"},pwe=["onClick"],mwe={key:1,class:"text-[14px] text-gray-500 font-medium"},gwe=["onClick"],ywe={class:"mt-3"},yj=xt(g.defineComponent({__name:"vs-datalist",props:g.mergeModels({colModel:{type:Object,required:!0},addText:{type:String,default:()=>""},useSpoiler:{type:Boolean,default:!1}},{modelValue:{default:[]},modelModifiers:{}}),emits:g.mergeModels(["change"],["update:modelValue"]),setup(t,{emit:e}){const n=e,r=g.defineAsyncComponent(()=>Promise.resolve().then(()=>Sj)),i=t,o=g.useModel(t,"modelValue"),s=g.ref([]),a=d=>i.useSpoiler?s.value[d]??!0:!0,l=d=>{i.useSpoiler&&(s.value[d]=!a(d))},c=()=>{const d=Object.keys(i.colModel).reduce((p,m)=>({...p,[m]:""}),{});o.value=[...o.value,d],i.useSpoiler&&s.value.push(!0)},u=d=>{var p;(p=o.value)==null||p.splice(d,1),i.useSpoiler&&s.value.splice(d,1),n("change",o)};return g.onMounted(()=>{o.value.length===0&&c()}),(d,p)=>(g.openBlock(),g.createElementBlock("div",null,[g.createVNode(g.TransitionGroup,{name:"list",tag:"div",class:"flex flex-col"},{default:g.withCtx(()=>[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(o.value,(m,y)=>(g.openBlock(),g.createElementBlock("div",{key:y,class:"text-xs flex flex-col relative mb-2 last:mb-0"},[g.createElementVNode("div",dwe,[g.createElementVNode("div",fwe,[t.useSpoiler?(g.openBlock(),g.createElementBlock("button",{key:0,class:"inline-flex items-center gap-x-1 text-sm font-semibold rounded-lg border border-transparent text-blue-600 decoration-2 hover:text-blue-700 hover:underline focus:outline-hidden focus:underline focus:text-blue-700",onClick:w=>l(y)},[g.createTextVNode(" Об'єкт номер: "+g.toDisplayString(y+1)+" ",1),g.createVNode(Ip,{height:"16",width:"16",class:g.normalizeClass(["duration-300",{"rotate-180":a(y)}])},null,8,["class"])],8,pwe)):(g.openBlock(),g.createElementBlock("h3",mwe," Об'єкт номер: "+g.toDisplayString(y+1),1))]),g.createElementVNode("button",{class:"inline-flex items-center gap-x-1 text-sm font-semibold rounded-lg border border-transparent text-red-600 decoration-2 hover:text-red-700 hover:underline focus:outline-hidden focus:underline focus:text-red-700",onClick:w=>u(y)},[g.createVNode(D2,{width:"16",height:"16"})],8,gwe)]),g.createVNode(g.Transition,{name:"list"},{default:g.withCtx(()=>[g.withDirectives(g.createElementVNode("div",null,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(Object.keys(t.colModel),w=>(g.openBlock(),g.createBlock(g.unref(r),{class:"w-full mb-2",modelValue:o.value[y],"onUpdate:modelValue":x=>o.value[y]=x,key:w,data:{columns:{container:12,label:2},...t.colModel[w]||{}}},null,8,["modelValue","onUpdate:modelValue","data"]))),128))],512),[[g.vShow,a(y)]])]),_:2},1024)]))),128))]),_:1}),g.createElementVNode("p",ywe,[g.createElementVNode("button",{type:"button",onClick:c,class:"inline-flex items-center gap-x-1 text-sm font-semibold rounded-lg border border-transparent text-blue-600 decoration-2 hover:text-blue-700 hover:underline focus:outline-hidden focus:underline focus:text-blue-700"},g.toDisplayString(t.addText||"Add"),1)])]))}}),[["__scopeId","data-v-00049567"]]),vwe=g.defineComponent({props:{text:{type:String,default:""},navId:{type:String,default:""}}}),_we=["innerHTML","id"];function bwe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",{innerHTML:t.text,class:"html-code",id:t.navId},null,8,_we)}const wwe=xt(vwe,[["render",bwe]]),xwe={components:{VsText:Yu},props:{defaultValue:{type:String,default:()=>""},modelValue:{type:String,default:t=>t.defaultValue},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},placeholder:{type:[String,Object],default:()=>"E-mail"},error:{type:String,default:()=>"Помилка при вводі емейла"}},emits:["update:modelValue","validate"],data:()=>({isValid:!0}),computed:{value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}},placeholderValue(){var t;return((t=this.placeholder)==null?void 0:t.ua)||this.placeholder}},methods:{validateEmail(t){if(!t)return null;const e=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;this.isValid=e.test(String(t).toLowerCase())}}};function Ewe(t,e,n,r,i,o){const s=g.resolveComponent("vs-text");return g.openBlock(),g.createElementBlock("div",null,[g.createVNode(s,{modelValue:o.value,"onUpdate:modelValue":e[0]||(e[0]=a=>o.value=a),type:"email",icon:"email",iconPosition:"left",disabled:n.disabled,clearable:n.clearable,placeholder:o.placeholderValue},null,8,["modelValue","disabled","clearable","placeholder"])])}const Swe=xt(xwe,[["render",Ewe]]),Cwe={components:{VsFormMarkedtext:a8},props:{mask:{type:[Object,String],default:()=>"+389999999999"},modelValue:{type:String,default:()=>"+38"},placeholder:{type:String,default:()=>"Введіть телефон.."},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1}},emits:["update:modelValue"],computed:{value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}}}};function kwe(t,e,n,r,i,o){const s=g.resolveComponent("VsFormMarkedtext");return g.openBlock(),g.createElementBlock("div",{class:g.normalizeClass(["w-full 211",{"vs-phone-text":!n.modelValue}])},[g.createVNode(s,{modelValue:o.value,"onUpdate:modelValue":e[0]||(e[0]=a=>o.value=a),iconPosition:"left",disabled:n.disabled,placeholder:n.placeholder,clearable:n.clearable,mask:n.mask},null,8,["modelValue","disabled","placeholder","clearable","mask"])],2)}const Twe=xt(Cwe,[["render",kwe]]),Mwe={components:{VsText:Yu},events:["update:modelValue"],props:{modelValue:{type:String,default:()=>"#000000"},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},isTextInputShown:{type:Boolean,default:()=>!0}},computed:{value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}}}},Awe={class:"flex items-center w-full"},Iwe=["disabled"];function Lwe(t,e,n,r,i,o){const s=g.resolveComponent("vs-text");return g.openBlock(),g.createElementBlock("div",Awe,[g.withDirectives(g.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=a=>o.value=a),type:"color",class:g.normalizeClass(["w-10 h-10 py-[2px] px-[3px] dark:bg-neutral-800 border dark:border-neutral-700 border-stone-200 rounded-lg",n.disabled?"cursor-not-allowed":"cursor-pointer"]),disabled:n.disabled},null,10,Iwe),[[g.vModelText,o.value]]),n.isTextInputShown?(g.openBlock(),g.createBlock(s,{key:0,modelValue:o.value,"onUpdate:modelValue":e[1]||(e[1]=a=>o.value=a),class:"ml-2 w-full",disabled:n.disabled,clearable:n.clearable},null,8,["modelValue","disabled","clearable"])):g.createCommentVNode("",!0)])}const vj=xt(Mwe,[["render",Lwe]]),Pwe={};function Nwe(t,e){const n=g.resolveComponent("vs-richtext");return g.openBlock(),g.createBlock(n,g.normalizeProps(g.guardReactiveProps(t.$attrs)),null,16)}const F2=xt(Pwe,[["render",Nwe]]),Owe=g.defineComponent({props:{modelValue:{type:Array,default:()=>[]},disabled:{type:Boolean,default:()=>!1},placeholder:{type:String,default:()=>"Введіть теги.."}},emits:["update:modelValue"],data(){return{tagInput:"",isFocused:!1}},mounted(){this.modelValue||this.$emit("update:modelValue",[])},computed:{tags:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}}},methods:{addTag(){this.tagInput.trim()!==""&&(this.tags=[...this.tags,this.tagInput.trim()],this.tagInput="")},removeTag(t){const e=[...this.tags];e.splice(t,1),this.tags=e},handleBackspace(t){t.key==="Backspace"&&this.tagInput===""&&this.tags.length>0&&this.removeTag(this.tags.length-1)}}}),Dwe=["onClick"],Rwe=["disabled","placeholder"],Bwe={key:0};function Fwe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("span",{class:g.normalizeClass(["vs-form-tags relative min-h-[40px] !flex flex-wrap gap-1 items-center py-[8px] px-[12px] block w-full border border-solid border-stone-200 rounded-lg !pr-8 focus:z-10 focus:border-blue-600 focus:ring-blue-600 dark:bg-neutral-800 dark:border-neutral-700 dark:focus:outline-none dark:focus:ring-1 dark:focus:ring-neutral-600",{" border-blue-600 border-1 py-[7px] px-[11px]":t.isFocused}])},[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(t.tags,(s,a)=>(g.openBlock(),g.createElementBlock("span",{key:a,class:"bg-gray-200 px-1 [&:last-of-type]:mr-2 rounded text-gray-500 text-xs flex items-center no-wrap w-fit"},[g.createTextVNode(g.toDisplayString(s)+" ",1),g.createElementVNode("i",{class:"ti ti-x cursor-pointer hover:text-blue-500 transition-all",onClick:l=>t.removeTag(a)},null,8,Dwe)]))),128)),g.withDirectives(g.createElementVNode("input",{disabled:t.disabled,placeholder:t.placeholder,"onUpdate:modelValue":e[0]||(e[0]=s=>t.tagInput=s),onFocus:e[1]||(e[1]=s=>t.isFocused=!0),onBlur:e[2]||(e[2]=s=>{t.isFocused=!1,t.addTag()}),onKeydown:e[3]||(e[3]=(...s)=>t.handleBackspace&&t.handleBackspace(...s)),onKeyup:e[4]||(e[4]=g.withKeys((...s)=>t.addTag&&t.addTag(...s),["enter"])),class:"vs-form-tags__input p-0 grow bg-transparent text-sm text-stone-800 focus:outline-none placeholder:text-stone-500 dark:text-neutral-200 dark:placeholder:text-neutral-500"},null,40,Rwe),[[g.vModelText,t.tagInput]]),t.tagInput.length?(g.openBlock(),g.createElementBlock("button",Bwe,[g.createElementVNode("i",{class:"absolute right-3 translate-y-2/4 bottom-1/2 ti ti-check cursor-pointer hover:text-blue-500 transition-all",onClick:e[5]||(e[5]=(...s)=>t.addTag&&t.addTag(...s))})])):g.createCommentVNode("",!0)],2)}const $we=xt(Owe,[["render",Fwe]]),zwe={},Vwe={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-eye"};function jwe(t,e){return g.openBlock(),g.createElementBlock("svg",Vwe,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"},null,-1),g.createElementVNode("path",{d:"M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6"},null,-1)]))}const Uwe=xt(zwe,[["render",jwe]]),Hwe={},Wwe={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-eye-off"};function Gwe(t,e){return g.openBlock(),g.createElementBlock("svg",Wwe,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828"},null,-1),g.createElementVNode("path",{d:"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87"},null,-1),g.createElementVNode("path",{d:"M3 3l18 18"},null,-1)]))}const qwe={props:{confirm:{type:Boolean,default:()=>!0},modelValue:{type:String,defaulst:()=>""},placeholder:{type:String,default:()=>"Пароль"},placeholderConfirm:{type:String,default:()=>"Повторіть пароль"},disabled:{type:Boolean,default:()=>!1},availableViewPassword:{type:Boolean,default:()=>!0},errorMessage:{type:Boolean,default:()=>"Паролі не співпадають"},labelConfirm:{type:String,default:()=>"Повторіть пароль"},scale:{type:Boolean,default:()=>!1}},components:{IconEye:Uwe,IconEyeOff:xt(Hwe,[["render",Gwe]])},data(){return{isVisible:!1,passwordValue:this.modelValue,confirmValue:this.modelValue,errorMessageConfirm:"Повторіть пароль",error:!1,isVisibleConfirm:!1}},methods:{checkConfirm(t){this.confirm?this.passwordValue&&(t===void 0||!t)?(this.error=!0,this.errorMessageConfirm="Повторіть пароль",this.$emit("validate","Повторіть пароль")):this.passwordValue&&t&&t!==this.passwordValue?(this.error=!0,this.errorMessageConfirm="Паролі не співпадають",this.$emit("validate","Паролі не співпадають")):(this.error=!1,this.$emit("update:modelValue",this.passwordValue),this.$emit("validate",null)):this.$emit("update:modelValue",this.passwordValue)}},computed:{passwordStrength(){var p;const t=this.passwordValue||"";let e=0,n=0;if(!t.trim())return{percent:0,color:"#ef4444",label:"Слабкий пароль",result:0,score:0};const r=t.trim().length;r>=18?e+=4:r>=16?e+=3:r>=12?e+=2:r>=8&&(e+=1),/[A-Z]/.test(t)&&(e+=1),/[a-z]/.test(t)&&(e+=1),/[0-9]/.test(t)&&(e+=1),/[^A-Za-z0-9]/.test(t)&&(e+=1);const i={};for(const m of t)i[m]=(i[m]||0)+1;const o=Math.max(...Object.values(i)),s=t.length*.5;if(o>s&&(e-=1),/(.)\1{3,}/.test(t)&&(e-=1),/(.{2,})\1{1,}/.test(t)){const m=t.match(/(.{2,})\1{1,}/)[1];t.split(m).length-1,e-=1}const c=["abc","abcd","123","1234","12345","123456","1234567","12345678","123456789","1234567890","qwerty","password","2024","2023","asdf","zxcv","qaz","wsx","edc","rfv","tgb"];for(const m of c)if(t.toLowerCase().includes(m)){e-=1;break}let u="#ef4444",d="Слабкий пароль";return e>=9?(u="#10b981",d="Дуже сильний пароль",n=4):e>=6?(u="#facc15",d="Сильний пароль",n=3):e>=3?(u="#f97316",d="Середній пароль",n=2):((p=this.passwordValue)==null?void 0:p.length)>0&&(u="#ef4444",d="Слабкий пароль",n=1),{percent:n/4*100,color:u,label:d,result:n,score:e}}}},Ywe={class:"border-transparent p-0"},Zwe=["disabled","placeholder","type"],Xwe={key:0,class:"relative pb-[24px] password-indicator-wrapper"},Kwe={class:"flex gap-1 password-indicator"},Jwe={key:1,class:"flex flex-col gap-[8px] text-sm font-medium text-gray-500 relative"},Qwe=["type","placeholder","disabled"],exe={key:0,class:"text-red-600 text-xs"};function txe(t,e,n,r,i,o){const s=g.resolveComponent("IconEye"),a=g.resolveComponent("IconEyeOff");return g.openBlock(),g.createElementBlock("div",Ywe,[g.createElementVNode("label",{class:g.normalizeClass(["flex gap-[8px] text-sm font-medium text-gray-500 relative",[n.confirm?"mb-[10px]":""]])},[g.withDirectives(g.createElementVNode("input",{onBlur:e[0]||(e[0]=l=>o.checkConfirm(i.confirmValue)),disabled:n.disabled,onInput:e[1]||(e[1]=l=>o.checkConfirm(i.confirmValue)),"onUpdate:modelValue":e[2]||(e[2]=l=>i.passwordValue=l),placeholder:n.placeholder,type:i.isVisible?"text":"password",class:"h-[40px] w-full rounded-lg outline-none border pl-[15px] focus:border-blue-600 focus:border-[2px] outline-none pr-[40px] border-gray-200 [&::placeholder]:opacity-[0.5] [&::placeholder]:font-normal"},null,40,Zwe),[[g.vModelDynamic,i.passwordValue]]),g.createElementVNode("button",{onClick:e[3]||(e[3]=l=>i.isVisible=!i.isVisible),class:"absolute top-[10px] right-[10px]"},[n.availableViewPassword&&i.isVisible?(g.openBlock(),g.createBlock(s,{key:0,class:"w-[20px] h-[20px]"})):n.availableViewPassword&&!i.isVisible?(g.openBlock(),g.createBlock(a,{key:1,class:"w-[20px] h-[20px]"})):g.createCommentVNode("",!0)])],2),n.confirm&&n.scale?(g.openBlock(),g.createElementBlock("div",Xwe,[g.createElementVNode("div",Kwe,[(g.openBlock(),g.createElementBlock(g.Fragment,null,g.renderList(4,l=>g.createElementVNode("div",{key:l,style:g.normalizeStyle({background:l<=o.passwordStrength.result?o.passwordStrength.color:"#E5E7EB",transition:"background 0.3s"}),class:"h-2 flex-1 rounded indicator-item"},null,4)),64))]),i.passwordValue?(g.openBlock(),g.createElementBlock("div",{key:0,class:"text-xs indicator-label absolute bottom-[8px]",style:g.normalizeStyle({color:o.passwordStrength.color})},g.toDisplayString(o.passwordStrength.label),5)):g.createCommentVNode("",!0)])):g.createCommentVNode("",!0),n.confirm?(g.openBlock(),g.createElementBlock("label",Jwe,[g.createTextVNode(g.toDisplayString(n.labelConfirm)+" ",1),g.withDirectives(g.createElementVNode("input",{"onUpdate:modelValue":e[4]||(e[4]=l=>i.confirmValue=l),type:i.isVisibleConfirm?"text":"password",placeholder:n.placeholderConfirm,disabled:n.disabled,class:"h-[40px] w-full rounded-lg border focus:border-blue-600 focus:border-[2px] outline-none pl-[15px] pr-[40px] border-gray-200 [&::placeholder]:opacity-[0.5] [&::placeholder]:font-normal",onInput:e[5]||(e[5]=l=>o.checkConfirm(i.confirmValue)),onBlur:e[6]||(e[6]=l=>o.checkConfirm(i.confirmValue))},null,40,Qwe),[[g.vModelDynamic,i.confirmValue]]),g.createElementVNode("button",{onClick:e[7]||(e[7]=l=>i.isVisibleConfirm=!i.isVisibleConfirm),class:"absolute top-[10px] right-[10px]"},[n.availableViewPassword&&i.isVisibleConfirm?(g.openBlock(),g.createBlock(s,{key:0,class:"w-[20px] h-[20px]"})):n.availableViewPassword&&!i.isVisibleConfirm?(g.openBlock(),g.createBlock(a,{key:1,class:"w-[20px] h-[20px]"})):g.createCommentVNode("",!0)]),i.error?(g.openBlock(),g.createElementBlock("div",exe,g.toDisplayString(i.errorMessageConfirm),1)):g.createCommentVNode("",!0)])):g.createCommentVNode("",!0)])}const nxe=xt(qwe,[["render",txe]]),rxe=["innerHTML"],ixe=g.defineComponent({__name:"vs-form-static",props:{tag:{},content:{}},setup(t){const e=t,n=g.computed(()=>{var r;return(r=e.content)!=null&&r.length?`<${e.tag} > ${e.content} `:`<${e.tag}/>`});return(r,i)=>(g.openBlock(),g.createElementBlock("div",{innerHTML:n.value,class:"htmlText"},null,8,rxe))}}),oxe={components:{VAceEditor:null},props:{modelValue:{type:String,default:""},readonly:{type:Boolean,default:!1},syntax:{type:String,default:"css"},height:{type:String,default:"250px"},width:{type:String,default:"100%"},fontSize:{type:String,default:"16px"}},data(){return{content:this.modelValue,isClient:!1}},async mounted(){this.isClient=!0;const{VAceEditor:t}=await Promise.resolve().then(()=>w8e);this.$options.components.VAceEditor=t,await Promise.all([Promise.resolve().then(()=>x8e),Promise.resolve().then(()=>E8e),Promise.resolve().then(()=>S8e),Promise.resolve().then(()=>C8e),Promise.resolve().then(()=>t8e)]),this.$forceUpdate()},watch:{content(t){this.$emit("update:modelValue",t)}}},sxe={key:0};function axe(t,e,n,r,i,o){const s=g.resolveComponent("VAceEditor");return i.isClient?(g.openBlock(),g.createElementBlock("div",sxe,[g.createVNode(s,{value:i.content,"onUpdate:value":e[0]||(e[0]=a=>i.content=a),lang:n.syntax,readonly:n.readonly,style:g.normalizeStyle({height:n.height,width:n.width,fontSize:n.fontSize})},null,8,["value","lang","readonly","style"])])):g.createCommentVNode("",!0)}const _j=xt(oxe,[["render",axe]]),lxe={},cxe={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"};function uxe(t,e){return g.openBlock(),g.createElementBlock("svg",cxe,e[0]||(e[0]=[g.createElementVNode("path",{"fill-rule":"evenodd",d:`M10 3a.75.75 0 01.55.24l3.25 3.5a.75.75 0 11-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 01-1.1-1.02l3.25-3.5A.75.75 0 0110 3zm-3.76 9.2a.75.75 0 011.06.04l2.7 2.908 2.7-2.908a.75.75 0 111.1 1.02l-3.25 3.5a.75.75 0 01-1.1 0l-3.25-3.5a.75.75 0 01.04-1.06z`,"clip-rule":"evenodd"},null,-1)]))}const hxe=xt(lxe,[["render",uxe]]),dxe={components:{iconCheck:cf},props:{index:{type:Number},label:{type:String},value:{type:String,default:""},modelValue:{type:String||Array},selectedId:{type:Number}},data(){return{isSelected:!1}},watch:{modelValue:{handler(){this.isSelected=this.isValueSelected()},deep:!0}},computed:{selectionOptionMeta(){return{isHighlighted:this.index===this.selectedId,isSelected:this.isValueSelected()}}},methods:{selectHandler(){this.$emit("update:modelValue",this.value)},isValueSelected(){var e;let t=null;return Array.isArray(this.modelValue)&&(t=this.modelValue.find(n=>n.value===this.value)),!!(this.value===this.modelValue||((e=this.modelValue)==null?void 0:e.value)==this.value||Array.isArray(this.modelValue)&&this.modelValue.includes(this.value)||t)}}},fxe={class:"flex justify-between items-center w-full"},pxe={class:"font-medium block truncate"},mxe={key:0};function gxe(t,e,n,r,i,o){const s=g.resolveComponent("iconCheck");return g.openBlock(),g.createElementBlock("div",{class:g.normalizeClass(["cursor-pointer py-2 px-4 min-w-[180px] text-sm text-gray-800 hover:bg-gray-100 rounded-lg focus:outline-none focus:bg-gray-100 flex justify-between items-center w-full",{"bg-gray-100":o.selectionOptionMeta.isHighlighted}]),onClick:e[0]||(e[0]=(...a)=>o.selectHandler&&o.selectHandler(...a))},[g.createElementVNode("div",fxe,[g.createElementVNode("span",pxe,g.toDisplayString(n.label||n.value),1),o.selectionOptionMeta.isSelected?(g.openBlock(),g.createElementBlock("span",mxe,[g.createVNode(s,{class:"w-3.5 h-[3.5] text-blue-600"})])):g.createCommentVNode("",!0)])],2)}const yxe={components:{iconArrows:hxe,VsSelectOption:xt(dxe,[["render",gxe]]),iconClose:Fa},props:{modelValue:{type:[Object,Array]},options:{type:Array,default:[]},multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},size:{type:String,default:"s"},clearable:{type:Boolean,default:!0},placeholder:{type:String,default:"Оберіть значення"},appendToBody:{type:Boolean,default:!1}},data(){var t;return{isOpen:!1,selectedId:0,selectedValue:(t=this.options)!=null&&t[0]||this.multiple?[]:{},selectedIdArray:[],list:this.options,slotOptions:[],optionsAmount:this.options.length}},watch:{modelValue(){this.selectedValue=Array.isArray(this.modelValue)?[...this.modelValue]:this.modelValue}},computed:{listboxMeta(){return{sizeClass:{"py-2 px-3":this.size==="s","py-3 px-4":this.size==="m","p-4 pe-9 sm:p-5":this.size==="l"}}}},methods:{initializeSlotOptions(){var t;this.$slots.default&&(this.slotOptions=this.$slots.default(),this.optionsAmount=(t=this.slotOptions)==null?void 0:t.length,this.list=this.slotOptions.map(e=>{var n,r;return{value:(n=e==null?void 0:e.props)==null?void 0:n.value,label:(r=e==null?void 0:e.props)==null?void 0:r.label}}))},clickHandler(){this.disabled||(this.isOpen=!this.isOpen,this.boundList())},selectHandler(t){var e;this.selectedId=((e=this.list)==null?void 0:e.findIndex(n=>n===t||(n==null?void 0:n.value)===t))||0,this.multiple&&(this.isOpen=!1),this.setValueByIndex()},setValueByIndex(){let t=this.list[this.selectedId];this.multiple?Array.isArray(this.selectedValue)&&this.selectedValue.includes(t)&&t?this.selectedValue=this.selectedValue.filter(e=>e!=t):Array.isArray(this.selectedValue)&&this.selectedValue.push(t):(t===void 0&&(t=""),this.selectedValue=t),this.$emit("on:selected",this.selectedValue),this.$emit("update:modelValue",this.selectedValue)},keyUpHandler(){this.selectedId!==0&&(this.selectedId--,this.$emit("menuKeyUp"))},keyDownHandler(){this.selectedId>=this.optionsAmount-1||(this.selectedId++,this.$emit("menuKeyDown"))},keyEnterHandler(){this.setValueByIndex(),this.multiple||(this.isOpen=!1),this.$emit("menuEnterSelect")},handleKeyDown(t){const{keyCode:e}=t;switch([38,40].includes(e)&&t.preventDefault(),e){case 38:this.keyUpHandler();break;case 40:this.keyDownHandler();break;case 13:this.keyEnterHandler();break;case 27:this.isOpen=!1;break}},clear(){this.isOpen=!1,this.selectedId=-1,this.setValueByIndex()},handleClickOutside(t){const e=this.$refs.listbox;e&&!e.contains(t.target)&&(this.isOpen=!1)},boundList(){var o,s;const t=(o=this.$refs)==null?void 0:o.listbox,e=t==null?void 0:t.getBoundingClientRect(),n=window.innerHeight,r=288,i=(s=this.$refs)==null?void 0:s.list;if(i){const a=e.top,l=i.clientHeight,c=e.bottom;let u=a+t.clientHeight+5;no.clickHandler&&o.clickHandler(...C))},g.toDisplayString(Array.isArray(i.selectedValue)?i.selectedValue.length?i.selectedValue.map(C=>C.label||(C==null?void 0:C.value)||C).join(", "):n.placeholder:(c=i.selectedValue)!=null&&c.label?(u=i.selectedValue)==null?void 0:u.label:(d=i.selectedValue)!=null&&d.value?(p=i.selectedValue)==null?void 0:p.value:(m=i.selectedValue)!=null&&m.length?i.selectedValue:n.placeholder),1),g.createElementVNode("div",bxe,[g.withDirectives(g.createElementVNode("button",{onClick:e[1]||(e[1]=(...C)=>o.clear&&o.clear(...C)),class:"cursor-pointer px-2 ml-2"},[g.createVNode(s,{class:"h-3.5 w-3.5 text-gray-400"})],512),[[g.vShow,n.clearable&&(((w=(y=i.selectedValue)==null?void 0:y.value)==null?void 0:w.length)||((x=i.selectedValue)==null?void 0:x.length))]]),g.createVNode(a,{class:"h-3.5 w-3.5 text-gray-400"})])],10,_xe),n.appendToBody?(g.openBlock(),g.createBlock(g.Teleport,{key:0,to:"#modal"},[g.createElementVNode("div",wxe,[i.isOpen?(g.openBlock(),g.createElementBlock("div",xxe,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(n.options,(C,S)=>(g.openBlock(),g.createBlock(l,{key:S,index:S,label:(C==null?void 0:C.label)||(C==null?void 0:C.value)||C,value:(C==null?void 0:C.value)||C,modelValue:i.selectedValue,selectedId:i.selectedId,"onUpdate:modelValue":o.selectHandler},null,8,["index","label","value","modelValue","selectedId","onUpdate:modelValue"]))),128))])):g.createCommentVNode("",!0)],512)])):(g.openBlock(),g.createElementBlock(g.Fragment,{key:1},[i.isOpen?(g.openBlock(),g.createElementBlock("div",Exe,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(n.options,(C,S)=>(g.openBlock(),g.createBlock(l,{key:S,index:S,label:(C==null?void 0:C.label)||(C==null?void 0:C.value)||C,value:(C==null?void 0:C.value)||C,modelValue:i.selectedValue,selectedId:i.selectedId,"onUpdate:modelValue":o.selectHandler},null,8,["index","label","value","modelValue","selectedId","onUpdate:modelValue"]))),128))])):g.createCommentVNode("",!0)],64))])}const bj=xt(yxe,[["render",Sxe]]),Cxe={components:{VsCalendar:HP,VsPopover:Dp,IconClose:Fa},props:{modelValue:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!0},now:{type:Boolean,default:()=>!1},placeholder:{type:String,default:()=>"Оберіть дату..."},time:{type:Boolean,default:()=>!1}},data(){return{calendarValue:null,hours:new Date().getHours(),minutes:new Date().getMinutes()}},computed:{value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t||null)}}},mounted(){var t,e;if(this.now&&this.applyTime(),this.modelValue){this.calendarValue=this.now?(t=new Date().toISOString())==null?void 0:t.split("T")[0]:(e=this.modelValue)==null?void 0:e.split(" ")[0];const n=new Date(this.modelValue);this.hours=n.getUTCHours(),this.minutes=n.getUTCMinutes()}},watch:{calendarValue(t){this.time||this.applyTime()},modelValue(){var t,e;if(this.modelValue){this.calendarValue=this.now?(t=new Date().toISOString())==null?void 0:t.split("T")[0]:(e=this.modelValue)==null?void 0:e.split(" ")[0];const n=new Date(this.modelValue);this.hours=n.getUTCHours(),this.minutes=n.getUTCMinutes()}}},methods:{clearInput(){this.calendarValue="",this.hours=new Date().getHours(),this.minutes=new Date().getMinutes(),this.$emit("update:modelValue",null)},applyTime(){if(this.calendarValue){const t=new Date(this.calendarValue);t.setHours(this.hours,this.minutes,0,0);const e=new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString();this.value=e;const n=new Date(e);this.hours=n.getUTCHours(),this.minutes=n.getUTCMinutes()}else this.value=""},formatDate(t){var a,l;const e=this.now?(a=new Date().toISOString())==null?void 0:a.split("T")[0]:(l=this.modelValue)==null?void 0:l.split(" ")[0];if(!t)return this.placeholder;const n=new Date(e);n.setHours(this.hours,this.minutes,0,0);const r=new Date(n.getTime()-n.getTimezoneOffset()*6e4).toISOString(),i=new Date(r),o=new Date(n).toLocaleDateString("uk-UA",{year:"numeric",month:"long",day:"numeric"});this.hours=i.getUTCHours(),this.minutes=i.getUTCMinutes();const s=`${String(this.hours).padStart(2,"0")}:${String(this.minutes).padStart(2,"0")}`;return this.time?`${o}, ${s||"00:00"}`:o},preventTyping(t){["ArrowUp","ArrowDown","Tab","Shift","Backspace"].includes(t.key)||t.preventDefault()}}},kxe={key:0,class:"flex items-center justify-between px-4 mt-2"},Txe={class:"flex items-center space-x-2"},Mxe=["disabled"];function Axe(t,e,n,r,i,o){const s=g.resolveComponent("VsCalendar");return g.openBlock(),g.createElementBlock("div",null,[g.createVNode(s,{modelValue:i.calendarValue,"onUpdate:modelValue":e[0]||(e[0]=a=>i.calendarValue=a),class:"vs-datepicker__calendar"},null,8,["modelValue"]),n.time?(g.openBlock(),g.createElementBlock("div",kxe,[g.createElementVNode("div",Txe,[g.withDirectives(g.createElementVNode("input",{type:"number","onUpdate:modelValue":e[1]||(e[1]=a=>i.hours=a),class:"w-12 p-1 border focus:outline-none focus:border-blue-600 focus:ring-blue-600 rounded text-center",min:"0",max:"23",maxlength:"2",onKeydown:e[2]||(e[2]=(...a)=>o.preventTyping&&o.preventTyping(...a))},null,544),[[g.vModelText,i.hours,void 0,{number:!0}]]),e[6]||(e[6]=g.createElementVNode("span",null,":",-1)),g.withDirectives(g.createElementVNode("input",{type:"number","onUpdate:modelValue":e[3]||(e[3]=a=>i.minutes=a),class:"w-12 p-1 border focus:outline-none focus:border-blue-600 focus:ring-blue-600 rounded text-center",min:"0",max:"59",maxlength:"2",onKeydown:e[4]||(e[4]=(...a)=>o.preventTyping&&o.preventTyping(...a))},null,544),[[g.vModelText,i.minutes,void 0,{number:!0}]])]),g.createElementVNode("button",{class:g.normalizeClass(["px-3 py-1 text-sm text-white bg-blue-500 rounded hover:bg-blue-600",i.calendarValue?"opacity-100":"opacity-70"]),disabled:!i.calendarValue,onClick:e[5]||(e[5]=(...a)=>o.applyTime&&o.applyTime(...a))}," Застосувати ",10,Mxe)])):g.createCommentVNode("",!0)])}const wj=xt(Cxe,[["render",Axe]]),Ixe={class:"hidden"},Lxe=xt({__name:"vs-form-key",props:g.mergeModels({componentKey:{type:String,default:""},token:{type:String,default:""},prefix:{type:String,default:()=>{var t;return((t=An.value)==null?void 0:t.prefix)||"api"}}},{modelValue:{},modelModifiers:{}}),emits:g.mergeModels(["onInput","blur","focus"],["update:modelValue"]),setup(t,{emit:e}){const n=t,r=g.useModel(t,"modelValue"),i=g.inject("formValues"),o=async()=>{var s;try{const{data:a}=await un.get(`/${n.prefix}/code-gen/${((s=i.value)==null?void 0:s.token)||n.token}/${n.componentKey}`);r.value=a||""}catch{}};return g.onMounted(()=>{o()}),(s,a)=>(g.openBlock(),g.createElementBlock("div",Ixe))}},[["__scopeId","data-v-4252bc45"]]),Pxe={class:"h-[66px] flex items-start"},Nxe={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},Oxe=["onClick"],xj={__name:"vs-form-button-add",props:{add:{type:Object,default:null},multiple:{type:Boolean,default:!1},modelValue:null},emits:"update:modelValue",setup(t,{emit:e}){var d;const n=(d=g.getCurrentInstance().proxy)==null?void 0:d.$notify,r=t,i=e,o=g.ref(!1),s=g.ref({}),a=g.ref(null),l=g.ref(),c=async()=>{try{await a.value.doValidation();const{data:p}=await un.post(r.add.api,s.value);await i("update:modelValue",r.multiple?[...r.modelValue||[],p==null?void 0:p.id]:p==null?void 0:p.id),s.value={},o.value=!1,n({title:"Успішно!",type:"success",message:"Об'єкт було успішно створено"})}catch{n({title:"Помилка!",type:"error",message:"При спробі створення виникла помилка"})}},u=async()=>{var p;try{const{data:m}=await un.get(`/api/template/form/${(p=r==null?void 0:r.add)==null?void 0:p.token}`);l.value=await(m==null?void 0:m.schema)||m,o.value=await!0}catch{}};return(p,m)=>(g.openBlock(),g.createElementBlock(g.Fragment,null,[g.createElementVNode("div",Pxe,[g.createVNode(Fh,{class:"h-[38px]",onClick:u},{default:g.withCtx(()=>{var y;return[g.createTextVNode(g.toDisplayString(((y=t.add)==null?void 0:y.text)||"Створити"),1)]}),_:1})]),g.createVNode(Ag,{visible:o.value,"onUpdate:visible":m[1]||(m[1]=y=>o.value=y),title:p.text},{footer:g.withCtx(({handleClose:y})=>[g.createElementVNode("div",Nxe,[g.createElementVNode("button",{style:{border:"1px solid #000"},onClick:w=>y(),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати ",8,Oxe),g.createElementVNode("button",{onClick:c,class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700"}," Зберегти ")])]),default:g.withCtx(()=>[g.createVNode(U1,{ref_key:"form",ref:a,scheme:l.value,modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=y=>s.value=y)},null,8,["scheme","modelValue"])]),_:1},8,["visible","title"])],64))}},Dxe={class:"cursor-pointer"},Rxe={class:"flex flex-col gap-0"},Bxe={class:"!mt-[4px] text-xs text-center text-stone-400 dark:text-neutral-400"},Fxe=["accept"],$xe=xt({__name:"vs-widget-gallery-dropzone",props:{accept:{type:Array,default:()=>[".tiff",".jpg",".jpeg",".png",".svg",".ico",".webp"]}},emits:["file:upload"],setup(t,{emit:e}){const n=t,{$notify:r}=g.getCurrentInstance().proxy,i=g.ref(null),o=g.ref(!1),s=g.computed(()=>{var y,w,x;return(y=n.accept)!=null&&y.length?(x=(w=n.accept)==null?void 0:w.map(C=>{var S;return(S=C==null?void 0:C.replace(".",""))==null?void 0:S.toUpperCase()}))==null?void 0:x.join(", "):"Приймаються всі типи файлів"}),a=e,l=()=>{i.value.click()},c=async y=>{y?a("file:upload",y):r({type:"error",title:"Помилка!",message:"При спробі завантаження файлу виникла помилка"})},u=y=>{const w=y.target.files;w&&c(w)},d=y=>{const w=y.dataTransfer.files;o.value=!1,w&&c(w)},p=()=>{o.value=!0},m=()=>{o.value=!1};return(y,w)=>{var x;return g.openBlock(),g.createElementBlock("div",Dxe,[g.createElementVNode("div",{class:g.normalizeClass(["vs-form-dropzone border border-dashed rounded-xl p-[48px] flex items-center justify-center duration-300 hover:border-blue-600 hover:bg-blue-50",o.value?"border-blue-600 bg-blue-50":"border-gray-200"]),onDragover:g.withModifiers(p,["prevent"]),onDragleave:m,onDrop:g.withModifiers(d,["prevent"]),onClick:l},[g.createElementVNode("div",Rxe,[g.createVNode(hj),w[0]||(w[0]=g.createElementVNode("p",{class:"font-medium text-gray-800 text-center mt-[16px] !mb-0"}," Додати фото ",-1)),g.createElementVNode("p",Bxe,g.toDisplayString(s.value),1)])],34),g.createElementVNode("input",{ref_key:"fileInput",ref:i,type:"file",class:"hidden",accept:(x=t.accept)==null?void 0:x.join(","),onChange:u,multiple:""},null,40,Fxe)])}}},[["__scopeId","data-v-21741725"]]),zxe={class:"flex items-center gap-x-2 mb-[16px]"},Vxe={class:"inline-block shrink-0 font-semibold text-gray-800 dark:text-neutral-200"},jxe=["onDragstart","onDrop"],Uxe={key:0,class:"absolute right-[5px] top-[5px] bg-blue-100 text-blue-800 text-xs font-medium px-2.5 py-0.5 rounded-sm dark:bg-blue-900 dark:text-blue-300"},Hxe=["href","data-caption"],Wxe=["src","alt"],Gxe={class:"item__text-content bg-white opacity-0 rounded-b-lg absolute w-full bottom-0 p-3 flex gap-2.5 items-center justify-between"},qxe={class:"text-xs w-[180px] block overflow-hidden text-nowrap overflow-ellipsis"},Yxe={class:"flex flex-wrap items-center text-xs text-gray-600 widget-images__item-desc"},Zxe={class:"flex items-center"},Xxe={class:"text-xs"},Kxe=["onClick"],Jxe=["onClick"],Qxe=["onClick"],eEe={class:"p-4"},tEe={class:"mt-1 text-gray-500 dark:text-neutral-500"},nEe={class:"flex justify-end mt-4 gap-x-3"},Ej={VsFormAutocomplete:bye,VsFormSelect:Rye,VsFormSelect2:GP,VsFormFilelist:m0e,VsFormFile:w_e,VsFormSwitcher:OV,VsFormMarkedtext:a8,VsFormText:Zye,VsFormCheckbox:l8,VsFormRadio:c8,VsFormDropzone:dj,VsFormDatepicker:P6,VsFormTextarea:nve,VsFormGeom:mj,VsFormNumber:h8,VsFormDatatable:gj,VsFormDatalist:yj,VsFormHtml:wwe,VsFormEmail:Swe,VsFormPassword:nxe,VsFormPhone:Twe,VsFormColorpicker:vj,VsFormTexteditor:F2,VsFormTags:$we,VsFormStatic:ixe,VsFormAce:_j,VsListbox:bj,VsFormList:u8,VsFormTiptapEditor:F2,VsFormCalendar:wj,VsFormMultiText:h2,VsFormKey:Lxe,VsFormCombobox:wC,VsFormButtonAdd:xj,VsFormGallery:{__name:"vs-form-gallery",props:{id:{type:String,default:""},readonly:{type:Boolean,default:!1},prefilledData:{type:Array,default:()=>[]},limit:{type:Number,default:10},prefix:{type:String,default:"/api"}},setup(t){const{Fancybox:e}=j1,{$notify:n}=g.getCurrentInstance().proxy,r=t,i=g.inject("formId"),o=g.ref([]),s=g.ref(!1),a=g.ref(null),l=g.ref({}),c=[".tiff",".jpg",".jpeg",".png",".svg",".ico",".webp"],u=g.computed(()=>r.id||i.value),d=async()=>{var J,Z,q;if((J=r==null?void 0:r.prefilledData)!=null&&J.length){o.value=r.prefilledData,e.bind("[data-fancybox='gallery']");return}try{const{data:j}=await un.get(`${r.prefix}/widget/gallery/${u.value}`);o.value=[(Z=j==null?void 0:j.rows)==null?void 0:Z.find(G=>G==null?void 0:G.ismain),...((q=j==null?void 0:j.rows)==null?void 0:q.filter(G=>!(G!=null&&G.ismain)))||[]].filter(G=>G),e.bind("[data-fancybox='gallery']")}catch(j){console.error(j)}},p=async J=>{var j,G,U,Q;if(((j=o.value)==null?void 0:j.length)+((U=Array.from((G=J.target)==null?void 0:G.files))==null?void 0:U.length)>r.limit){n({type:"error",title:"Помилка!",message:"Встановлено ліміт на кількість, - "+r.limit});return}const Z=Array.from((Q=J.target)==null?void 0:Q.files);if(!Z.every(re=>{var le,oe;return c==null?void 0:c.includes("."+((oe=(le=re.name.split("."))==null?void 0:le.pop())==null?void 0:oe.toLowerCase()))})){n({type:"error",title:"Помилка!",message:"Доступні формати: "+c.join(", ")});return}await Promise.all(Z.map(async re=>{const le=new FormData;le.append("file",re);try{await un.post(`${r.prefix}/widget/gallery/${u.value}`,le)}catch(oe){console.error(oe)}})),await d()},m=J=>{const Z=document.createElement("a");Z.setAttribute("download",J==null?void 0:J.uploaded_name),Z.href=J==null?void 0:J.file_path,Z.click()},y=async(J,Z)=>{try{await un.post(`${r.prefix}/widget/gallery/${J}/${Z}`,{ismain:!0}),await d()}catch(q){console.error(q)}},w=J=>{a.value=J,l.value={title:"Ви впевнені?",message:"Ви впевнені що хочете видалити зображення?",confirmButtonText:"Так, видалити ",cancelButtonText:"Відмінити",confirm:async()=>{var Z,q,j;await x(),s.value=!1,await d(),(Z=o.value)!=null&&Z[0]&&!((j=(q=o.value)==null?void 0:q[0])!=null&&j.ismain)&&setTimeout(()=>{var G,U,Q,re;return y((U=(G=o.value)==null?void 0:G[0])==null?void 0:U.entity_id,(re=(Q=o.value)==null?void 0:Q[0])==null?void 0:re.file_id)})},cancel:()=>{s.value=!1}},s.value=!0},x=async()=>{var J,Z;try{await un.delete(`${r.prefix}/widget/gallery/${(J=a.value)==null?void 0:J.entity_id}/${(Z=a.value)==null?void 0:Z.file_id}`)}catch(q){console.error(q)}},C=(J,Z=2)=>{if(J===0)return"0 Bytes";const q=1024,j=Z<0?0:Z,G=["Bytes","KB","MB","GB","TB"],U=Math.floor(Math.log(J)/Math.log(q));return`${parseFloat((J/q**U).toFixed(j))} ${G[U]}`},S=J=>{const Z={day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric"};return new Date(J).toLocaleDateString("uk-UA",Z)},M=g.ref(null),E=g.ref(0),A=()=>{var J;E.value=((J=M.value)==null?void 0:J.offsetWidth)||0},I=g.computed(()=>{const J=[...o.value],Z={isDropzone:!0},q=Math.floor(E.value/316)||1,j=Math.min(q-1,J.length);return J.splice(j,0,Z),J}),O=g.ref(null),z=J=>{O.value=J},$=J=>o.value.findIndex(Z=>Z.file_path===J.file_path),W=J=>{if(J===0){const Z=O.value;if(Z===null||Z===J)return;const j=I.value.filter(G=>!G.isDropzone)[Z];if(!j)return;o.value.splice(Z,1),o.value.splice(J,0,j),O.value=null,setTimeout(()=>{var G,U,Q,re;return y((U=(G=o.value)==null?void 0:G[0])==null?void 0:U.entity_id,(re=(Q=o.value)==null?void 0:Q[0])==null?void 0:re.file_id)})}};return g.onMounted(()=>{u.value&&d(),A(),window.addEventListener("resize",A)}),g.watch(u,d),g.watch(o,A),(J,Z)=>{const q=g.resolveComponent("VsConfirm");return g.openBlock(),g.createElementBlock("div",{ref_key:"galleryContainer",ref:M,class:"flex flex-col vs-widget-images xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700"},[g.createElementVNode("div",zxe,[g.createElementVNode("h2",Vxe," Світлин: "+g.toDisplayString(o.value.length)+" (ліміт - "+g.toDisplayString(t.limit)+") ",1)]),g.createVNode(g.TransitionGroup,{name:"gallery",tag:"div",class:"flex flex-wrap gap-[16px]"},{default:g.withCtx(()=>[g.createVNode($xe,{"onFile:upload":Z[0]||(Z[0]=j=>p({target:{files:j}})),class:"h-[200px] w-[300px]"}),(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(o.value,(j,G)=>(g.openBlock(),g.createElementBlock("div",{key:j.file_path||"dz-"+G,draggable:"true",onDragstart:U=>z($(j)),onDragover:Z[1]||(Z[1]=g.withModifiers(()=>{},["prevent"])),onDrop:U=>W($(j)),class:"relative cursor-pointer rounded-b-lg item hover:shadow-lg shrink-0 h-[200px] w-[300px]"},[j!=null&&j.ismain?(g.openBlock(),g.createElementBlock("span",Uxe,"Головне")):g.createCommentVNode("",!0),g.createElementVNode("a",{href:j.file_path,"data-fancybox":"gallery","data-caption":j.uploaded_name,target:"_blank"},[g.createElementVNode("img",{class:"object-cover w-full h-full rounded-lg",src:j.file_path||"/icons/no-image.jpg",alt:j.uploaded_name},null,8,Wxe),g.createElementVNode("div",Gxe,[g.createElementVNode("div",null,[g.createElementVNode("span",qxe,g.toDisplayString(j.uploaded_name),1),g.createElementVNode("div",Yxe,[g.createElementVNode("span",Zxe,g.toDisplayString(C(j.size)),1),g.createElementVNode("span",null,g.toDisplayString(S(j.cdate)),1)]),g.createElementVNode("span",Xxe,g.toDisplayString(j.username),1),j!=null&&j.ismain?g.createCommentVNode("",!0):(g.openBlock(),g.createElementBlock("div",{key:0,class:"text-xs underline",onClick:g.withModifiers(U=>y(j==null?void 0:j.entity_id,j==null?void 0:j.file_id),["prevent"])}," Зробити головним ",8,Kxe))]),g.createElementVNode("div",null,[g.createElementVNode("div",{class:"flex items-center justify-center gap-2 hover:bg-gray-200 p-[6px] rounded",onClick:g.withModifiers(U=>m(j),["prevent"])},[g.createVNode(QC,{height:"14",width:"14"})],8,Jxe),g.createElementVNode("div",{class:"flex items-center gap-2 hover:bg-gray-200 p-[6px] rounded hover:cursor-pointer",onClick:g.withModifiers(U=>w(j),["prevent"])},[g.createVNode(D2,{height:"14",width:"14"})],8,Qxe)])])],8,Hxe)],40,jxe))),128))]),_:1}),g.createVNode(q,{title:l.value.title,size:"small",visible:s.value,"onUpdate:visible":Z[4]||(Z[4]=j=>s.value=j)},{default:g.withCtx(()=>[g.createElementVNode("div",eEe,[g.createElementVNode("p",tEe,g.toDisplayString(l.value.message),1),g.createElementVNode("div",nEe,[g.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 hover:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700",onClick:Z[2]||(Z[2]=(...j)=>l.value.cancel&&l.value.cancel(...j))},g.toDisplayString(l.value.cancelButtonText),1),g.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600",onClick:Z[3]||(Z[3]=(...j)=>l.value.confirm&&l.value.confirm(...j))},g.toDisplayString(l.value.confirmButtonText),1)])])]),_:1},8,["title","visible"])],512)}}}},rEe={mixins:[O6],data(){return{currentTab:this.data.components[0].key}}};function iEe(t,e,n,r,i,o){const s=g.resolveComponent("VsLayout"),a=g.resolveComponent("VsTabsPanel"),l=g.resolveComponent("VsTabs");return g.openBlock(),g.createElementBlock("div",null,[g.createVNode(l,{modelValue:i.currentTab,"onUpdate:modelValue":e[1]||(e[1]=c=>i.currentTab=c)},{default:g.withCtx(()=>[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(t.data.components,c=>(g.openBlock(),g.createBlock(a,{class:"mt-3 vs-form-tab-container",value:c.key,label:c.label},{default:g.withCtx(()=>[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(c.components,u=>(g.openBlock(),g.createBlock(s,{data:u,"form-errors":t.formErrors,modelValue:t.values,"onUpdate:modelValue":e[0]||(e[0]=d=>t.values=d)},null,8,["data","form-errors","modelValue"]))),256))]),_:2},1032,["value","label"]))),256))]),_:1},8,["modelValue"])])}const oEe={components:{...Ej,VsLayoutTabs:xt(rEe,[["render",iEe]]),VsTooltip:p1,VsFormButtonAdd:xj},mixins:[O6],props:{errors:{type:Object,default:()=>new Map},id:{type:String,default:()=>""},style:{type:Object,default:()=>null}},inject:{table:{type:String,default:()=>""},token:{type:String,default:()=>""}},data(){return{componentId:""}},computed:{formatOriginalData(){const t=Object.entries(this.data),e=["component"];return t.reduce((n,r)=>{const[i,o]=r;return e.includes(i)?n:{...n,[i]:o}},{})},componentInstance(){const{type:t,component:e=null}=this.data;return e||`vs-form-${t==null?void 0:t.toLowerCase()}`},layoutType(){return`vs-layout-${this.data.type}`},fieldsIsRequired(){const{validators:t}=this.data;return t?(t==null?void 0:t.findIndex(e=>e==="required"))!==-1:!1},getStyle(){var t;return((t=this.data)==null?void 0:t.style)||this.style||null},getColumns(){var t,e,n,r;return((t=this.data)==null?void 0:t.columns)||((n=(e=this.data)==null?void 0:e.style)==null?void 0:n.columns)||((r=this.style)==null?void 0:r.columns)||this.columns||null},settings(){return An.value}},methods:{handleValidate(t,e){this.$emit("update:formErrors",{...this.formErrors,[e]:t})}},mounted(){var t,e,n,r;(e=(t=this.data)==null?void 0:t.slots)!=null&&e.help&&(this.componentId=`radio-${Math.floor(Math.random()*1e4)}`,uf(this.componentId,(r=(n=this.data)==null?void 0:n.slots)==null?void 0:r.help,["help",...Object.keys(this.data)]))}},sEe=["id"],aEe={key:0,class:"ml-1 !text-red-600"},lEe={class:"flex w-full items-start gap-1"},cEe=["innerHTML"],uEe={key:2,class:"text-red-500"},hEe={key:3,class:"errors"};function dEe(t,e,n,r,i,o){var l,c,u,d,p,m,y,w,x,C,S,M,E,A,I,O,z,$,W,J,Z,q,j,G,U,Q,re,le,oe,he,xe,Ee,Ie,Oe,$e,Ze,lt,pt,yt,Lt,hn,Ht,wn,cn,Hn,Bn,Ue,qe,Et,qt;const s=g.resolveComponent("vs-tooltip"),a=g.resolveComponent("VsFormButtonAdd");return g.openBlock(),g.createElementBlock("div",{class:g.normalizeClass(["relative",[o.getColumns?`grid w-full gap-1 grid-cols-${((l=o.getColumns)==null?void 0:l.container)||12}`:""]]),id:((p=(d=(u=t.formErrors)==null?void 0:u[(c=t.data)==null?void 0:c.key])==null?void 0:d[0])==null?void 0:p.navId)||t.data.key},[(m=t.data)!=null&&m.ua||(y=t.data)!=null&&y.label?(g.openBlock(),g.createElementBlock("label",{key:0,class:g.normalizeClass(["flex text-sm font-medium text-gray-700",{[`col-span-${(w=o.getColumns)==null?void 0:w.label}`]:(x=o.getColumns)==null?void 0:x.label,"w-full":!0,[`justify-${((S=(C=o.getStyle)==null?void 0:C.columns)==null?void 0:S.labelPosition)||"start"} text-${((E=(M=o.getStyle)==null?void 0:M.columns)==null?void 0:E.labelPosition)||"start"}`]:!0,"pr-[10px]":!0,"items-center":(A=o.getColumns)==null?void 0:A.label,"mb-2":!((I=o.getColumns)!=null&&I.label)}])},[g.createTextVNode(g.toDisplayString(((O=t.data)==null?void 0:O.ua)||((z=t.data)==null?void 0:z.label))+" ",1),o.fieldsIsRequired?(g.openBlock(),g.createElementBlock("span",aEe,"*")):g.createCommentVNode("",!0),($=t.data)!=null&&$.info||(J=(W=t.data)==null?void 0:W.original)!=null&&J.info||(Z=t.data)!=null&&Z.i||(j=(q=t.data)==null?void 0:q.original)!=null&&j.i?(g.openBlock(),g.createBlock(s,{key:1,content:((G=t.data)==null?void 0:G.info)||((Q=(U=t.data)==null?void 0:U.original)==null?void 0:Q.info)||((re=t.data)==null?void 0:re.i)||((oe=(le=t.data)==null?void 0:le.original)==null?void 0:oe.i),class:"ml-1"},{reference:g.withCtx(()=>e[4]||(e[4]=[g.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[g.createElementVNode("path",{d:"M6.99992 0.333344C10.6819 0.333344 13.6666 3.31801 13.6666 7.00001C13.668 8.75033 12.9809 10.431 11.7539 11.6791C10.5268 12.9272 8.85802 13.6427 7.10793 13.6711C5.35785 13.6994 3.66681 13.0384 2.39992 11.8307C1.13302 10.623 0.391911 8.96545 0.336585 7.21601L0.333252 7.00001L0.335919 6.81334C0.434585 3.21801 3.37992 0.333344 6.99992 0.333344ZM6.99992 6.33334H6.33325L6.25525 6.33801C6.09322 6.35728 5.94388 6.43531 5.83553 6.55732C5.72717 6.67933 5.66733 6.83684 5.66733 7.00001C5.66733 7.16319 5.72717 7.32069 5.83553 7.4427C5.94388 7.56471 6.09322 7.64274 6.25525 7.66201L6.33325 7.66668V9.66668L6.33792 9.74468C6.35547 9.89349 6.42264 10.032 6.52859 10.138C6.63455 10.244 6.77311 10.3111 6.92192 10.3287L6.99992 10.3333H7.66659L7.74459 10.3287C7.8934 10.3111 8.03196 10.244 8.13791 10.138C8.24387 10.032 8.31104 9.89349 8.32859 9.74468L8.33325 9.66668L8.32859 9.58868C8.31265 9.45266 8.25521 9.32486 8.16408 9.22263C8.07295 9.12041 7.95255 9.04873 7.81925 9.01734L7.74459 9.00401L7.66659 9.00001V7.00001L7.66192 6.92201C7.64437 6.7732 7.5772 6.63464 7.47124 6.52868C7.36529 6.42273 7.22673 6.35556 7.07792 6.33801L6.99992 6.33334ZM7.00659 4.33334L6.92192 4.33801C6.75989 4.35728 6.61055 4.43531 6.50219 4.55732C6.39384 4.67933 6.33399 4.83684 6.33399 5.00001C6.33399 5.16319 6.39384 5.32069 6.50219 5.4427C6.61055 5.56471 6.75989 5.64274 6.92192 5.66201L6.99992 5.66668L7.08459 5.66201C7.24662 5.64274 7.39596 5.56471 7.50431 5.4427C7.61266 5.32069 7.67251 5.16319 7.67251 5.00001C7.67251 4.83684 7.61266 4.67933 7.50431 4.55732C7.39596 4.43531 7.24662 4.35728 7.08459 4.33801L7.00659 4.33334Z",fill:"#0068A8"})],-1)])),_:1},8,["content"])):g.createCommentVNode("",!0)],2)):g.createCommentVNode("",!0),g.createElementVNode("div",{class:g.normalizeClass([(he=o.getColumns)!=null&&he.label&&((Ee=(xe=t.data)==null?void 0:xe.type)==null?void 0:Ee.toLowerCase())!=="html"?`col-span-${((Ie=o.getColumns)==null?void 0:Ie.container)-((Oe=o.getColumns)==null?void 0:Oe.label)}`:"col-span-12"])},[g.createElementVNode("div",lEe,[(($e=t.data)==null?void 0:$e.view)==="layout"?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(o.layoutType),{key:0,data:t.data,modelValue:t.values,"onUpdate:modelValue":e[0]||(e[0]=rn=>t.values=rn)},null,8,["data","modelValue"])):(g.openBlock(),g.createBlock(g.resolveDynamicComponent(o.componentInstance),g.mergeProps({key:1,class:"flex-grow",modelValue:t.values[t.data.key],"onUpdate:modelValue":e[1]||(e[1]=rn=>t.values[t.data.key]=rn),componentKey:t.data.key,token:o.token,table:o.table,defaultValue:t.data.default,original:((Ze=t.data)==null?void 0:Ze.original)||o.formatOriginalData,"append-to-body":!0,style:o.getStyle},((lt=t.data)==null?void 0:lt.original)||t.data||null,{onValidate:e[2]||(e[2]=rn=>o.handleValidate(rn,t.data.key))}),null,16,["modelValue","componentKey","token","table","defaultValue","original","style"])),(pt=t.data)!=null&&pt.add&&o.componentInstance!=="vs-form-autocomplete"||(yt=t.data)!=null&&yt.add&&((hn=(Lt=o.settings)==null?void 0:Lt.autocomplete)!=null&&hn.disableAutocomplete)?(g.openBlock(),g.createBlock(a,g.mergeProps({key:2},((Ht=t.data)==null?void 0:Ht.original)||t.data||null,{modelValue:t.values[t.data.key],"onUpdate:modelValue":e[3]||(e[3]=rn=>t.values[t.data.key]=rn)}),null,16,["modelValue"])):g.createCommentVNode("",!0)]),(cn=(wn=t.data)==null?void 0:wn.slots)!=null&&cn.help&&i.componentId?(g.openBlock(),g.createElementBlock("p",{key:0,class:g.normalizeClass(["text-xs layout-help font-normal !mt-0",{"absolute left-0":(Hn=o.getColumns)==null?void 0:Hn.label}])},[(g.openBlock(),g.createBlock(g.resolveDynamicComponent(i.componentId),g.normalizeProps(g.guardReactiveProps(t.data)),null,16))],2)):(g.openBlock(),g.createElementBlock(g.Fragment,{key:1},[(Bn=t.data)!=null&&Bn.help?(g.openBlock(),g.createElementBlock("p",{key:0,class:g.normalizeClass(["text-xs layout-help font-normal !mt-0",{"absolute left-0":(Ue=o.getColumns)==null?void 0:Ue.label}]),innerHTML:(qe=t.data)==null?void 0:qe.help},null,10,cEe)):g.createCommentVNode("",!0)],64)),n.errors.has(t.data.key)?(g.openBlock(),g.createElementBlock("div",uEe,g.toDisplayString(n.errors.get(t.data.key)),1)):g.createCommentVNode("",!0),(Et=t.formErrors)!=null&&Et[t.data.key]?(g.openBlock(),g.createElementBlock("div",hEe,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList((qt=t.formErrors)==null?void 0:qt[t.data.key],(rn,it)=>(g.openBlock(),g.createElementBlock("div",{key:it,class:"text-red-600 text-xs"},[g.createElementVNode("i",{class:g.normalizeClass("ti "+((rn==null?void 0:rn.icon)||"ti-alert-circle"))},null,2),g.createTextVNode(" "+g.toDisplayString(rn.message),1)]))),128))])):g.createCommentVNode("",!0)],2)],10,sEe)}const ek=xt(oEe,[["render",dEe]]),Sj=Object.freeze(Object.defineProperty({__proto__:null,default:ek},Symbol.toStringTag,{value:"Module"})),fEe={name:"VsForm",components:{VsLayout:ek},computed:{pinComponents(){return this.formScheme.filter(t=>{var e;return(t==null?void 0:t.pin)||((e=t==null?void 0:t.original)==null?void 0:e.pin)})},nonPinComponents(){return this.formScheme.filter(t=>{var e;return!(t!=null&&t.pin)&&!((e=t==null?void 0:t.original)!=null&&e.pin)})},pinGroups(){return[this.nonPinComponents,this.pinComponents]},hasPinComponents(){var t;return(t=this.pinComponents)==null?void 0:t.length}},props:{id:{type:String,default:()=>""},scheme:{type:[Array,Object],default:()=>null},modelValue:{type:[Object,Array],default:()=>{}},style:{type:Object,default:()=>null},columns:{type:Object,default:()=>null},api:{type:String,default:()=>""},table:{type:String,default:()=>""},token:{type:String,default:()=>""},layout:{type:Object,default:()=>({head:!1})}},inject:["parentFormValues"],provide(){return{scheme:this.scheme,formValues:g.computed(()=>({...this.parentFormValues||{},...this.formValues})),parentFormValues:g.computed(()=>this.formValues),table:this.table,token:this.token,id:this.id,formId:g.computed(()=>this.formId||""),formValuesOption:this.formValuesOption,behaviorValueSetter:this.behaviorValueSetter}},data(){return{formId:"",formValues:{},formErrors:{},formScheme:[],formValuesOption:{},behavior:{data:{},exist:!1},conditions:{},tempErrors:{},errors:new Map,preventErrors:!0,hiddenComponents:new Map}},watch:{formValues:{deep:!0,handler(t,e){this.formValueWatch(t,e)}},formValuesOption:{deep:!0,handler(t,e){this.formValueWatch(t,e)}}},async mounted(){const t=await this.getFormScheme();this.formScheme=Array.isArray(t)?t:this.formatSchemeFromObject(t),this.setFromData(),this.behavior.data=this.createBehavior(),this.invokeConditionChecking(),await this.checkFilelistElements()},methods:{async checkFilelistElements(){var e,n;if(this.formScheme.some(r=>{var i,o,s;return((i=r==null?void 0:r.type)==null?void 0:i.toLowerCase())==="filelist"||((o=r==null?void 0:r.type)==null?void 0:o.toLowerCase())==="gallery"||((s=r==null?void 0:r.type)==null?void 0:s.toLowerCase())==="file"&&(r==null?void 0:r.useId)})&&!((e=this.formValues)!=null&&e.id)){const{data:r}=await un.get("/api/next-id");this.formValues={...this.formValues,id:r.id},this.formId=r.id}else this.formId=(n=this.formValues)==null?void 0:n.id},formValueWatch(t,e){if(!Object.values(e||{}).length)return;this.behavior.exist&&(this.behavior.data=this.createBehavior());const n=this.createdNestedObject();this.invokeConditionChecking(),this.preventErrors||(this.errors=this.checkRules());const r=Object.keys(n).reduce((i,o)=>{const s=this.formScheme.find(l=>l.key===o);return(s?this.checkHiddenField(s)||this.checkHiddenComponents(s):!0)?i[o]=n[o]:delete this.formValues[o],i},{});this.$emit("update:modelValue",r),this.$emit("form-change",r)},async getFormScheme(){if(this.api)try{const{data:t}=await un.get(this.api);return t.components}catch(t){return console.error(t),[]}return this.scheme},updError(t){const e=Object.keys(t)[0],n=t[e];n!==null?this.tempErrors[e]=n:delete this.tempErrors[e]},checkHiddenField({conditions:t,key:e}){const n=this.behavior.data[e];return t?this.conditionalCheck({conditions:t,key:e}):n===void 0?!0:n},checkHiddenComponents({conditions:t,key:e}){return this.hiddenComponents.get(e)||!t},conditionalCheck({conditions:t,key:e}){if(!t||!t.length)return!0;const n=i=>{const o=this.formValues[i[0]]||"";return i[1]==="*"?o===i[2]:!1},r=t.every(i=>Array.isArray(i[0])?i.some(o=>n(o)):n(i));return this.behavior.data[e]=r,r},behaviorValueSetter(t,e){this.formValues={...this.formValues,[t]:e}},checkRules(){return sP.check({components:this.formScheme.filter(this.checkHiddenField),data:this.formValues,disabledFields:this.hiddenComponents})},formatSchemeFromObject(t){return Object.entries(t).reduce((e,[n,r])=>r!=null&&r.components?e.concat({...r,key:n,components:this.formatSchemeFromObject(r.components)}):e.concat({...r,key:n}),[])},resetForm(){this.formValues={}},checkConditions({conditions:t,key:e}){if(!t)return;let n=!1;Array.isArray(t[0][0])?n=t.flat(1).some(r=>Eg.checkConditions(this.formValues,r,this.formValuesOption)):Array.isArray(t[0])?n=t.every(r=>Eg.checkConditions(this.formValues,r,this.formValuesOption)):n=Eg.checkConditions(this.formValues,t,this.formValuesOption),this.hiddenComponents.set(e,n)},invokeConditionChecking(){this.formScheme.forEach(t=>this.checkConditions(t))},columnClass(t){switch((t==null?void 0:t.col)||12){case 1:return"md:w-1/12 w-full";case 2:return"md:w-1/6 w-full";case 3:return"md:w-1/4 w-full";case 4:return"md:w-1/3 w-full";case 5:return"md:w-5/12 w-full";case 6:return"md:w-1/2 w-full";case 7:return"md:w-7/12 w-full";case 8:return"md:w-2/3 w-full";case 9:return"md:w-3/4 w-full";case 10:return"md:w-5/6 w-full";case 11:return"md:w-11/12 w-full";case 12:return"md:w-full w-full";default:return"w-full"}},doValidation(){return new Promise((t,e)=>{this.preventErrors=!1,this.errors=this.checkRules(),this.formErrors=this.validation();const n=Object.keys(this.tempErrors),r=Object.keys(this.formErrors).concat(n);(r.length||this.errors.size)&&(this.$emit("onValidationError",r),e(new Error("validation error"))),t("submit"),this.$emit("update:errors",this.formErrors)})},setFromData(){const t=this.formScheme.reduce((e,{key:n,defaultValue:r})=>{var s;const i=(s=this.modelValue)==null?void 0:s[n],o=i===void 0?r:i;return{...e,[n]:o}},this.modelValue);this.formValues=t},validation(){var n;const t={icon:"ti-alert-circle",message:"Це поле обов'язкове"},e={icon:"ti-alert-circle",message:"Невірний email"};return(n=this.formScheme)==null?void 0:n.reduce((r,i)=>{const o=i.key,s=(i==null?void 0:i.label)||(i==null?void 0:i.ua)||"";if(!this.checkHiddenComponents(i))return r;let a=this.formValues[o];const l=Array.isArray(a)?a==null?void 0:a.some(d=>!d):!1,c=i==null?void 0:i.validators;if(!l&&(!c||c.length===0))return r;let u=c==null?void 0:c.reduce((d,p)=>{var y;return p==="required"&&(w=>Array.isArray(w)?w.length===0:typeof w=="boolean"||typeof w=="number"?!1:!w)(a)?d.push({...t,label:s,navId:y0("error-")}):p==="email"&&typeof a=="string"&&(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(a)||d.push(e)),typeof p=="object"&&p.regexp&&(a!=null&&a.length)&&(((y=i==null?void 0:i.type)==null?void 0:y.toLowerCase())==="markedtext"&&(a=a==null?void 0:a.replaceAll("_","")),new RegExp(p.regexp).test(a)||d.push({icon:"ti-alert-circle",message:p.message||"Невірний формат"})),d},[]);return l&&(u!=null&&u.length?u.push({message:"Всі поля мають бути заповненими"}):u=[{message:"Всі поля мають бути заповненими"}]),u.length>0&&(r[o]=u),r},{})},behaviorState({key:t}={}){var r;const e=this.behavior.data!==null,n=((r=this.behavior.data)==null?void 0:r[t])||!1;return e&&n},createBehavior(){const t=({show:n,hide:r}={})=>{const i=(o,s)=>(o==null?void 0:o.split(",").reduce((a,l)=>({...a,[l]:s}),{}))||{};return{...i(r,!1),...i(n,!0)}};return this.formScheme.reduce((n,r)=>{var c;const{key:i,behavior:o,original:s}=r,a=o||(s==null?void 0:s.behavior),l=(n==null?void 0:n[i])===void 0?!0:n==null?void 0:n[i];if(a){this.behavior.exist=!0;const u=`${((c=this.formValues)==null?void 0:c[i])||""}`,d=Object.keys(a).includes(u)?u:"*",p={...d==="*"?{}:t(a["*"]),...t(a[d])};return{...n,[i]:l,...p}}return{...n,[i]:l}},{})},createdNestedObject(){const t=(r,i)=>{for(const o of Object.keys(i))i[o]instanceof Object&&Object.assign(i[o],t(r==null?void 0:r[o],i[o]));return Object.assign(r||{},i),r},e=(r,i)=>r.split(".").reduceRight((o,s)=>({[s]:o}),i);return Object.keys(this.formValues).reduce((r,i)=>{if(!i.includes("."))return{...r,[i]:this.formValues[i]};const o=e(i,this.formValues[i]);return t(o,r)},{})}}},pEe={class:"vs-form",ref:"form"},mEe={key:0,class:"vs-form__head mb-5 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},gEe={class:"vs-form__body auto-rows-max container"},yEe={class:"flex flex-wrap"};function vEe(t,e,n,r,i,o){const s=g.resolveComponent("VsLayout");return g.openBlock(),g.createElementBlock("div",pEe,[n.layout.head?(g.openBlock(),g.createElementBlock("div",mEe,[g.renderSlot(t.$slots,"header",g.normalizeProps(g.guardReactiveProps(o.doValidation)))])):g.createCommentVNode("",!0),g.createElementVNode("div",gEe,[g.createElementVNode("div",yEe,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(o.pinGroups,(a,l)=>(g.openBlock(),g.createElementBlock("div",{key:l,class:g.normalizeClass(["h-fit",[o.hasPinComponents?"md:w-1/2 sm:w-full flex flex-wrap":"w-full flex flex-wrap"]])},[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(a,c=>(g.openBlock(),g.createElementBlock(g.Fragment,{key:c.key},[o.checkHiddenField(c)||o.checkHiddenComponents(c)?g.withDirectives((g.openBlock(),g.createElementBlock("div",{key:0,class:g.normalizeClass(["mb-6 px-2",[o.columnClass(c)]])},[g.createVNode(s,{data:c,errors:t.errors,"form-errors":t.formErrors,modelValue:t.formValues,"onUpdate:modelValue":e[0]||(e[0]=u=>t.formValues=u),"onUpdate:formErrors":o.updError,style:g.normalizeStyle(n.style),columns:n.columns},null,8,["data","errors","form-errors","modelValue","onUpdate:formErrors","style","columns"])],2)),[[g.vShow,!(c!=null&&c.hidden)]]):g.createCommentVNode("",!0)],64))),128))],2))),128))])])],512)}const U1=xt(fEe,[["render",vEe]]),Cj=Object.freeze(Object.defineProperty({__proto__:null,default:U1},Symbol.toStringTag,{value:"Module"})),_Ee={props:{visible:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},size:{type:String,default:()=>""},closeClickBack:{type:Boolean,default:()=>!1},scheme:{type:Object,required:!0},apiUrl:{type:String,default:()=>""},axiosMethod:{type:String,default:()=>"post"},buttonCancelText:{type:String,default:()=>"Скасувати"},buttonSaveText:{type:String,default:()=>"Зберегти"},initState:{type:Object,default:{}}},components:{VsForm:U1},emits:["update:visible","close","success","error"],name:"vs-dialog",data(){return{dialogModel:{}}},mounted(){window.addEventListener("keydown",this.checkKey),this.initState&&(this.dialogModel=this.initState)},unmounted(){window.removeEventListener("keydown",this.checkKey)},computed:{checkSize(){return this.size==="small"?"w-5/12":this.size==="medium"?"w-6/12":"lg:w-7/12 w-11/12"},getScheme(){return this.scheme}},methods:{checkKey({key:t}){t==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("close"),this.dialogModel={}},closeByClickBack(t){this.closeClickBack&&t.target.classList.contains("vs-dialog-overlay")&&this.handleClose()},async fetchData(){try{const t=this.$refs.form;await(t==null?void 0:t.doValidation());let e;this.apiUrl&&(this.axiosMethod==="post"&&(e=await un.post(this.apiUrl,this.dialogModel)),this.axiosMethod==="put"&&(e=await un.put(this.apiUrl,this.dialogModel))),await this.$emit("success",e),await this.handleClose()}catch{this.$emit("error")}}}},bEe={key:0},wEe={class:"vsTailwind ui-dialog__wrapper"},xEe={class:"py-2.5 px-4 flex justify-between items-center border-b"},EEe={class:"font-medium text-gray-800"},SEe={class:"ui-dialog__content p-4"},CEe={class:"flex justify-end gap-x-2"},kEe={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function TEe(t,e,n,r,i,o){const s=g.resolveComponent("VsForm");return n.visible?(g.openBlock(),g.createElementBlock("div",bEe,[(g.openBlock(),g.createBlock(g.Teleport,{to:"#modal"},[g.createVNode(g.Transition,{name:"fade"},{default:g.withCtx(()=>[g.createElementVNode("div",wEe,[g.createElementVNode("div",{onClick:e[4]||(e[4]=(...a)=>o.closeByClickBack&&o.closeByClickBack(...a)),class:"vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},[g.createVNode(g.Transition,{name:"content",appear:""},{default:g.withCtx(()=>[g.createElementVNode("div",{class:g.normalizeClass(["ui-dialog__modal opacity-1 transition-all flex flex-col bg-white border pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",[o.checkSize]])},[g.createElementVNode("div",xEe,[g.createElementVNode("h3",EEe,g.toDisplayString(n.title),1),g.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:e[0]||(e[0]=(...a)=>o.handleClose&&o.handleClose(...a))},e[5]||(e[5]=[g.createElementVNode("span",{class:"sr-only"},"Close",-1),g.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[g.createElementVNode("path",{d:"M18 6 6 18"}),g.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),g.createElementVNode("div",SEe,[g.createVNode(s,{scheme:n.scheme,modelValue:i.dialogModel,"onUpdate:modelValue":e[1]||(e[1]=a=>i.dialogModel=a),ref:"form",class:"p-0"},null,8,["scheme","modelValue"])]),g.createElementVNode("div",CEe,[g.createElementVNode("div",kEe,[g.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[2]||(e[2]=(...a)=>o.handleClose&&o.handleClose(...a)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"},g.toDisplayString(n.buttonCancelText),1),g.createElementVNode("button",{onClick:e[3]||(e[3]=(...a)=>o.fetchData&&o.fetchData(...a)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"},g.toDisplayString(n.buttonSaveText),1)])])],2)]),_:1})])])]),_:1})]))])):g.createCommentVNode("",!0)}const kj=xt(_Ee,[["render",TEe],["__scopeId","data-v-436f22a9"]]),MEe=g.defineComponent({name:"VsNumberValue",props:{value:{type:Number,required:!0},style:{type:String,default:"decimal"},currency:{type:String,default:"EUR"},unit:{type:String,default:"liter"},unitDisplay:{type:String,validator(t){return["short","narrow","long"].includes(t)}},locale:{type:String,default:"ua"}},computed:{formattedValue(){try{const t={style:this.style};return this.style==="currency"&&(t.currency=this.currency),this.style==="unit"&&(t.unit=this.unit,t.unitDisplay=this.unitDisplay),new Intl.NumberFormat(this.locale,t).format(this.value)}catch(t){return console.error("Formatting error:",t.message),this.value}}}});function AEe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("span",null,g.toDisplayString(t.formattedValue),1)}const IEe=xt(MEe,[["render",AEe]]),Tj=({message:t,title:e,type:n}={})=>{const r=document.querySelector(".p-toast__list");let i=r;const o=d=>{d.classList.remove("p-toast--visible"),d.classList.add("p-toast--hidden"),setTimeout(()=>{d.remove()},350)};r||(i=document.createElement("div"),i.className="p-toast__list vsTailwind",document.body.after(i));const s=document.createElement("div");s.addEventListener("click",()=>o(s)),s.className="p-toast vsTailwind p-toast--hidden";const a={error:'',success:''},l={success:"text-green-500 bg-green-100 dark:bg-green-800 dark:text-green-200",error:"text-red-500 bg-red-100 dark:bg-red-800 dark:text-red-200"},c=a[n],u=l[n];s.innerHTML=` `,i.after(s),setTimeout(()=>{i.classList.add("p-toast__list--move"),s.classList.remove("p-toast--hidden"),s.classList.add("p-toast--visible")},50),setTimeout(()=>{i.append(s),i.classList.remove("p-toast__list--move")},350),setTimeout(()=>{o(s)},3500)},Mj=t=>({template:n="",title:r="",components:i={}})=>{const{body:o}=document,s=document.createElement("div"),a=Math.floor(Math.random()*1e3).toString();s.setAttribute("id",`app-${a}`),o==null||o.prepend(s);const l=t({components:{...i,VsDialog:Ag,VsFormWrapper:WP},data(){return{title:r,visible:!0}},name:"vs-dialog",methods:{modalClose(){this.visible=!1,setTimeout(()=>{l.unmount(),s.remove()},300)}},template:`
${n}
`});mM.install(l),l.mount(`#app-${a}`)},Aj=t=>({template:n="",components:r={},methods:i={}})=>{const{body:o}=document,s=document.createElement("div"),a=Math.floor(Math.random()*1e3).toString();s.setAttribute("id",`app-${a}`),o==null||o.prepend(s);const l=t({components:r,name:"vs-dialog",methods:i,template:n});mM.install(l),l.mount(`#app-${a}`)},LEe={props:{title:{type:String,default:"Ви впевнені?"},message:{type:String,default:"Ви дійсно хочете?"},confirmButtonText:{type:String,default:"Так"},cancelButtonText:{type:String,default:"НІ"},confirmButtonStyle:{type:String,default:()=>" bg-red-500 hover:bg-red-700"},cancelButtonStyle:{type:String,default:()=>" border border-gray-200 bg-white hover:bg-gray-100"},cascade:{type:Boolean,default:()=>!1}},emits:["confirm","cancel"]},PEe={class:"vsTailwind ui-dialog__wrapper"},NEe={class:"vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},OEe={class:"ui-dialog__modal opacity-1 w-[448px] transition-all flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl"},DEe={class:"py-2.5 px-4 flex justify-between items-center border-gray-200 dark:border-b-[#454545]"},REe={class:"text-lg font-medium text-gray-800 dark:text-neutral-200"},BEe={class:"ui-dialog__content p-4 py-0"},FEe={class:"mt-1 text-sm text-gray-600 dark:text-neutral-400"},$Ee={key:0,class:"p-[16px] flex justify-end gap-x-3"},zEe={key:1,class:"flex p-[16px] justify-end gap-x-3"};function VEe(t,e,n,r,i,o){return g.openBlock(),g.createBlock(g.Teleport,{to:"#modal"},[g.createVNode(g.Transition,{name:"fade"},{default:g.withCtx(()=>[g.createElementVNode("div",PEe,[g.createElementVNode("div",NEe,[g.createVNode(g.Transition,{name:"content",appear:""},{default:g.withCtx(()=>[g.createElementVNode("div",OEe,[g.createElementVNode("div",DEe,[g.createElementVNode("h3",REe,g.toDisplayString(n.title),1),g.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:e[0]||(e[0]=s=>t.$emit("cancel"))},e[5]||(e[5]=[g.createElementVNode("span",{class:"sr-only"},"Close",-1),g.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[g.createElementVNode("path",{d:"M18 6 6 18"}),g.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),g.createElementVNode("div",BEe,[g.createElementVNode("p",FEe,g.toDisplayString(n.message),1)]),n.cascade?(g.openBlock(),g.createElementBlock("div",$Ee,[g.createElementVNode("button",{type:"button",class:g.normalizeClass([[n.cancelButtonStyle],"py-2 px-3 inline-flex items-center gap-x-2 text-xs font-medium rounded-lg duration-300 disabled:opacity-50 disabled:pointer-events-none"]),onClick:e[1]||(e[1]=s=>t.$emit("cancel"))},g.toDisplayString(n.cancelButtonText),3),g.createElementVNode("button",{type:"button",onClick:e[2]||(e[2]=s=>t.$emit("confirm")),class:g.normalizeClass([[n.confirmButtonStyle],"py-2 px-3 inline-flex items-center gap-x-2 text-xs font-medium rounded-lg duration-300 text-white shadow-sm disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50"])},g.toDisplayString(n.confirmButtonText),3)])):(g.openBlock(),g.createElementBlock("div",zEe,[g.createElementVNode("button",{type:"button",onClick:e[3]||(e[3]=s=>t.$emit("confirm")),class:g.normalizeClass([[n.confirmButtonStyle],"py-2 px-3 inline-flex items-center gap-x-2 text-xs font-medium rounded-lg duration-300 text-white shadow-sm disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50"])},g.toDisplayString(n.confirmButtonText),3),g.createElementVNode("button",{type:"button",class:g.normalizeClass([[n.cancelButtonStyle],"py-2 px-3 inline-flex items-center gap-x-2 text-xs font-medium rounded-lg duration-300 disabled:opacity-50 disabled:pointer-events-none"]),onClick:e[4]||(e[4]=s=>t.$emit("cancel"))},g.toDisplayString(n.cancelButtonText),3)]))])]),_:1})])])]),_:1})])}const jEe=xt(LEe,[["render",VEe],["__scopeId","data-v-af428910"]]),Ij=({message:t,title:e,confirmButtonText:n,cancelButtonText:r,onConfirm:i,onCancel:o,cascade:s,confirmButtonStyle:a,cancelButtonStyle:l}={})=>{const c=document.querySelector("#modal");if(!c){console.error('Modal root element with id "#modal" not found!');return}const u=document.createElement("div");c.appendChild(u);const d=()=>{p.unmount(),u.remove()},p=g.createApp({render(){return g.h(jEe,{title:e,message:t,cascade:s,confirmButtonText:n,cancelButtonText:r,cancelButtonStyle:l,confirmButtonStyle:a,onConfirm:()=>{i&&i(),d()},onCancel:()=>{o&&o(),d()}})}});p.mount(u)},UEe={};function HEe(t,e){return g.openBlock(),g.createBlock(g.Teleport,{to:"#modal"},[g.createVNode(g.Transition,{name:"fade"},{default:g.withCtx(()=>e[0]||(e[0]=[g.createElementVNode("div",{class:"loading-overlay"},[g.createElementVNode("div",{class:"loading-spinner"})],-1)])),_:1,__:[0]})])}const WEe=xt(UEe,[["render",HEe],["__scopeId","data-v-45dae12a"]]),Lj={show(){if(this.app)return;const t=document.querySelector("#modal");if(!t){console.error('Modal root element with id "#modal" not found!');return}const e=document.createElement("div");t.appendChild(e),g.createApp({render(){return g.h(WEe)}}).mount(e)},hide(){var e;(e=this.app)==null||e.unmount();const t=document.querySelector("#modal");t&&(t.innerHTML=""),this.app=null},app:null},Pj=({scheme:t,initState:e,axiosMethod:n,apiUrl:r,buttonCancelText:i,buttonSaveText:o,title:s,onError:a,onSuccess:l}={})=>{const c=document.querySelector("#modal");if(!c){console.error('Modal root element with id "#modal" not found!');return}const u=document.createElement("div");c.appendChild(u);const d=()=>{p.unmount(),u.remove()},p=g.createApp({render(){return g.h(kj,{visible:!0,scheme:t,initState:e,apiUrl:r,buttonCancelText:i,buttonSaveText:o,title:s,axiosMethod:n,onClose:()=>{d()},onError:()=>{a&&a()},onSuccess:m=>{l&&l(m),d()}})}});p.mount(u)},GEe=g.defineComponent({props:{text:{type:String,default:()=>""},size:{type:String,default:()=>"default"},color:{type:String,default:()=>"blue"}},data(){return{loaderClass:[""]}},created(){this.handleLoaderSize(),this.handleLoaderColor()},methods:{handleLoaderSize(){switch(this.size){case"small":this.loaderClass.push("w-6 h-6 border-[2px]");break;case"large":this.loaderClass.push("w-10 h-10 border-[4px]");break;default:this.loaderClass.push("w-8 h-8 border-[3px]");break}},handleLoaderColor(){this.loaderClass.push(`text-${this.color}-600`)}}}),qEe={class:"flex items-center"},YEe={key:0,class:"ml-2"};function ZEe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",qEe,[g.createElementVNode("div",{class:g.normalizeClass(["animate-spin inline-block border-current border-t-transparent rounded-full",t.loaderClass]),role:"status","aria-label":"loading"},e[0]||(e[0]=[g.createElementVNode("span",{class:"sr-only"},"Loading...",-1)]),2),t.text?(g.openBlock(),g.createElementBlock("p",YEe,g.toDisplayString(t.text),1)):g.createCommentVNode("",!0)])}const tk=xt(GEe,[["render",ZEe]]),XEe={},KEe={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-rosette-discount-check"};function JEe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",KEe,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M5 7.2a2.2 2.2 0 0 1 2.2 -2.2h1a2.2 2.2 0 0 0 1.55 -.64l.7 -.7a2.2 2.2 0 0 1 3.12 0l.7 .7c.412 .41 .97 .64 1.55 .64h1a2.2 2.2 0 0 1 2.2 2.2v1c0 .58 .23 1.138 .64 1.55l.7 .7a2.2 2.2 0 0 1 0 3.12l-.7 .7a2.2 2.2 0 0 0 -.64 1.55v1a2.2 2.2 0 0 1 -2.2 2.2h-1a2.2 2.2 0 0 0 -1.55 .64l-.7 .7a2.2 2.2 0 0 1 -3.12 0l-.7 -.7a2.2 2.2 0 0 0 -1.55 -.64h-1a2.2 2.2 0 0 1 -2.2 -2.2v-1a2.2 2.2 0 0 0 -.64 -1.55l-.7 -.7a2.2 2.2 0 0 1 0 -3.12l.7 -.7a2.2 2.2 0 0 0 .64 -1.55v-1"},null,-1),g.createElementVNode("path",{d:"M9 12l2 2l4 -4"},null,-1)]))}const Nj=xt(XEe,[["render",JEe]]),QEe={},eSe={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-exclamation-circle"};function tSe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",eSe,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"},null,-1),g.createElementVNode("path",{d:"M12 9v4"},null,-1),g.createElementVNode("path",{d:"M12 16v.01"},null,-1)]))}const Oj=xt(QEe,[["render",tSe]]),nSe=g.defineComponent({components:{vsLoader:tk,VsButton:Fh,IconCheckSuccess:Nj,IconError:Oj},props:{title:{type:String,default:()=>"Загрузка"},size:{type:String,default:()=>"30px"},pending_message:{type:String,default:()=>"Зачекайте, будь ласка! "},error_message:{type:String,default:()=>"Сталася помилка."},success_message:{type:String,default:()=>"Операція завершена успішно!"},button_text:{type:String,default:()=>"Ok"},button_color:{type:String,default:()=>"#643B9F"},button_text_color:{type:String,default:()=>"white"},button_height:{type:String,default:()=>"30px"},button_width:{type:String,default:()=>"35px"},apiURL:{type:String,default:""},apiMethod:{type:String,default:"GET"},data:{type:Object,default:{}},sse:{type:Boolean,default:!1}},data(){return{status:"pending",sseData:[]}},emits:["getData","close"],computed:{description(){switch(this.status){case"pending":return this.pending_message;case"error":return this.error_message;case"success":return this.success_message;default:return""}}},mounted(){this.getData()},methods:{handleClose(){this.$emit("close")},async getData(){if(this.sse){const t=new EventSource(this.apiURL,{withCredentials:!0});this.status="success",t.onmessage=e=>{this.sseData.push(e==null?void 0:e.data)},t.onerror=e=>{console.error("EventSource failed:",e)}}else await fetch(this.apiURL,{method:this.apiMethod,body:this.apiMethod!=="GET"?JSON.stringify(this.data):void 0,headers:{"Content-Type":"application/json"}}),this.status="success"}}}),rSe={class:"vsTailwind ui-dialog__wrapper"},iSe={class:"ui-dialog w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},oSe={class:"flex justify-between items-center py-3 px-4 border-b"},sSe={class:"font-bold text-gray-800 text-xl"},aSe={key:0,class:"ui-dialog__content p-4"},lSe={key:1,class:"justify-center grid"},cSe={key:2,class:"justify-center grid"},uSe={class:"grid justify-center p-4"},hSe={key:1,class:"box-border max-h-[700px] p-[20px]"},dSe={class:"bg-gray-200 p-[20px] max-h-[500px] overflow-y-scroll"},fSe={class:"ui-dialog-button grid justify-center p-4"},pSe=["disabled"];function mSe(t,e,n,r,i,o){const s=g.resolveComponent("vsLoader"),a=g.resolveComponent("IconCheckSuccess"),l=g.resolveComponent("IconError");return g.openBlock(),g.createBlock(g.Teleport,{to:"#modal"},[g.createVNode(g.Transition,{name:"fade"},{default:g.withCtx(()=>[g.createElementVNode("div",rSe,[g.createElementVNode("div",iSe,[g.createVNode(g.Transition,{name:"content",appear:""},{default:g.withCtx(()=>[g.createElementVNode("div",{class:"ui-dialog__modal opacity-1 transition-all flex flex-col bg-white border shadow-sm rounded-xl",style:g.normalizeStyle({fontSize:t.size})},[g.createElementVNode("div",oSe,[g.createElementVNode("h3",sSe,g.toDisplayString(t.title),1)]),t.sse?(g.openBlock(),g.createElementBlock("div",hSe,[g.createElementVNode("ul",dSe,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(t.sseData,(c,u)=>(g.openBlock(),g.createElementBlock("li",{key:u,class:"text-sm"},g.toDisplayString(c),1))),128))])])):(g.openBlock(),g.createElementBlock("div",aSe,[t.status==="pending"?(g.openBlock(),g.createBlock(s,{key:0,class:"justify-center grid"})):t.status==="success"?(g.openBlock(),g.createElementBlock("div",lSe,[g.createVNode(a,{width:"100",height:"100",fill:"green",stroke:"white"})])):t.status==="error"?(g.openBlock(),g.createElementBlock("div",cSe,[g.createVNode(l,{width:"100",height:"100",fill:"red",stroke:"white"})])):g.createCommentVNode("",!0),g.createElementVNode("div",uSe,g.toDisplayString(t.description),1)])),g.createElementVNode("div",fSe,[g.createElementVNode("button",{disabled:t.status=="pending",class:"h-[38px] px-[10px] rounded-lg bg-blue-500 text-[14px] text-white hover:bg-blue-700 duration-300",onClick:e[0]||(e[0]=(...c)=>t.handleClose&&t.handleClose(...c))},g.toDisplayString(t.button_text),9,pSe)])],4)]),_:1})])])]),_:1})])}const gSe=xt(nSe,[["render",mSe],["__scopeId","data-v-191d58cf"]]),Dj=({title:t,success_message:e,error_message:n,pending_message:r,apiURL:i,apiMethod:o,data:s,sse:a}={})=>{const l=document.querySelector("#modal");if(!l){console.error('Modal root element with id "#modal" not found!');return}const c=document.createElement("div");l.appendChild(c);const u=()=>{m.unmount(),c.remove()},d=g.ref(""),p=g.ref(""),m=g.createApp({render(){return g.h(gSe,{title:t,success_message:e,error_message:n,pending_message:r,apiURL:i,apiMethod:o,data:s,sse:a,onClose:()=>{u()},onGetData:y=>{p.value=y,d.value="success"}})}});return m.mount(c),new Promise((y,w)=>{const x=setInterval(()=>{d.value==="success"&&p.value!==null?(clearInterval(x),u(),y(p.value)):d.value==="error"&&(clearInterval(x),u(),w("An error occurred while fetching data"))},100)})},ySe={install:(t,e)=>{const n=Mj(e.createApp),r=Aj(e.createApp);t.config.globalProperties.$notify=Tj,t.config.globalProperties.$modal=n,t.config.globalProperties.$vueQuery=r,t.config.globalProperties.$confirm=Ij,t.config.globalProperties.$loading=Lj,t.config.globalProperties.$api=Dj,t.config.globalProperties.$form=Pj,t.config.globalProperties.$setV3CoreSettings=i=>({...An.value,...i})}},{Fancybox:vSe}=j1,_Se={data(){return{}},created(){vSe.bind('[data-fancybox="gallery"]')},methods:{}},bSe={class:"rounded-md vs-file-list"},wSe={class:"w-full"},xSe={class:"bg-gray-100"};function ESe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",bSe,[g.createElementVNode("table",wSe,[g.createElementVNode("thead",null,[g.createElementVNode("tr",xSe,[(g.openBlock(),g.createElementBlock(g.Fragment,null,g.renderList(["Назва","Тип","Користувач","Розмір","Дата","Дії"],s=>g.createElementVNode("th",{key:s,scope:"col",class:g.normalizeClass(["px-6 py-2 text-xs font-medium text-gray-500 uppercase text-start",[{"!text-center vs-file-list__actions":s==="Дії"},{"!pl-10":s==="Назва"}]])},g.toDisplayString(s),3)),64))])]),g.createElementVNode("tbody",null,[g.renderSlot(t.$slots,"default")])])])}const SSe=xt(_Se,[["render",ESe]]),CSe={props:{type:{type:String,default:"file"}}},kSe={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",width:"18px",height:"18px",viewBox:"0 0 256 256",version:"1.1"},TSe={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",width:"18px",height:"18px",viewBox:"0 0 256 256",version:"1.1"},MSe={key:2,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",width:"18px",height:"18px",viewBox:"0 0 18 18",version:"1.1"},ASe={key:3,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",width:"18px",height:"18px",viewBox:"0 0 256 256",version:"1.1"};function ISe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock(g.Fragment,null,[n.type==="document"?(g.openBlock(),g.createElementBlock("svg",kSe,e[0]||(e[0]=[g.createStaticVNode('',2)]))):g.createCommentVNode("",!0),n.type==="image"?(g.openBlock(),g.createElementBlock("svg",TSe,e[1]||(e[1]=[g.createStaticVNode('',1)]))):g.createCommentVNode("",!0),n.type==="video"?(g.openBlock(),g.createElementBlock("svg",MSe,e[2]||(e[2]=[g.createStaticVNode('',2)]))):g.createCommentVNode("",!0),n.type==="file"?(g.openBlock(),g.createElementBlock("svg",ASe,e[3]||(e[3]=[g.createStaticVNode('',2)]))):g.createCommentVNode("",!0)],64)}const LSe={components:{VsFileIcon:xt(CSe,[["render",ISe]]),VsButton:Fh,VsTooltip:p1},props:{data:{type:Object,default:()=>{}},appearance:{type:String,default:()=>"table"},isFileData:{type:[Boolean,Number],default:()=>!1}},data(){var t,e;return{showTileImageActions:null,fileTitle:((t=this.data)==null?void 0:t.uploaded_name)||((e=this.data)==null?void 0:e.file_name)}},computed:{isPreviewable(){return this.fileIcon==="image"||this.fileExtension==="pdf"},fileExtension(){var t;return this.data.ext||((t=this.fileTitle)==null?void 0:t.split(".").at(-1))},fileIcon(){const t=["jpg","jpeg","bmp","gif","png","svg"],e=["mp4","avi","mkv","mov"],n=["pdf","doc","docx","xls","xlsx","ppt","pptx"];return t.includes(this.fileExtension)?"image":e.includes(this.fileExtension)?"video":n.includes(this.fileExtension)?"document":"file"},fileDate(){if(!this.data.cdate)return null;const t={day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric"};return new Date(this.data.cdate).toLocaleDateString("uk-UK",t)},fileSrc(){const t=this.data.file_path;return t!=null&&t.includes("files/")?t:`files/${t}`}},methods:{getFileSize(t,e=2){if(t===0)return"0 Bytes";const n=1024,r=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],i=Math.floor(Math.log(t)/Math.log(n));return`${parseFloat((t/n**i).toFixed(e))} ${r[i]}`},getFileAction(t,e){switch(t){case"trash":this.$emit("openModal",{title:"Видалення",message:"Чи підтверджуєте Ви видалення?",confirmButtonText:"Так",cancelButtonText:"Ні",confirm:this.deleteFile,updateListOnConfirm:!0});break;case"download":this.downloadFile(e);break}},async deleteFile(){var t;try{await un.get(`/file/delete${(t=this.data)==null?void 0:t.file_path}`)}catch(e){console.error(e)}},async downloadFile(t){function e(){return un.get(`/file/download${t.file_path}`,{responseType:"arraybuffer",headers:{"Content-Type":"application/json"}})}e().then(n=>{const r=n.headers["content-type"],i=new Blob([n.data],{type:r,encoding:"UTF-8"}),o=document.createElement("a");o.setAttribute("download",t.uploaded_name||t.file_name),o.href=window.URL.createObjectURL(i),o.click()})}}},PSe={class:"px-2 py-1 whitespace-nowrap text-sm font-medium dark:text-white"},NSe={class:"flex align-items-center dark:text-white"},OSe=["data-src"],DSe=["data-caption","href"],RSe={class:"text-xs"},BSe={key:1,class:"flex items-center gap-2"},FSe={class:"text-xs"},$Se={class:"px-6 py-1 whitespace-nowrap text-sm dark:text-white"},zSe={class:"px-6 py-1 whitespace-nowrap text-sm dark:text-white"},VSe={class:"px-6 py-1 whitespace-nowrap text-sm dark:text-white"},jSe={class:"px-6 py-1 whitespace-nowrap text-sm dark:text-white"},USe={class:"px-6 py-1 whitespace-nowrap text-end text-sm font-medium flex gap-2 justify-end pr-0 dark:text-white"};function HSe(t,e,n,r,i,o){var l;const s=g.resolveComponent("VsFileIcon"),a=g.resolveComponent("VsTooltip");return g.openBlock(),g.createElementBlock("tr",null,[g.createElementVNode("td",PSe,[g.createElementVNode("span",NSe,[g.createElementVNode("div",{"data-src":o.fileSrc},[o.isPreviewable?(g.openBlock(),g.createElementBlock("a",{key:0,class:"flex items-center gap-2","data-fancybox":"gallery","data-caption":n.data.uploaded_name,href:n.data.file_path},[g.createVNode(s,{type:o.fileIcon},null,8,["type"]),g.createElementVNode("span",RSe,g.toDisplayString(i.fileTitle),1)],8,DSe)):(g.openBlock(),g.createElementBlock("div",BSe,[g.createVNode(s,{type:o.fileIcon},null,8,["type"]),g.createElementVNode("span",FSe,g.toDisplayString(i.fileTitle),1)]))],8,OSe)])]),g.createElementVNode("td",$Se,g.toDisplayString(n.data.ext||"-"),1),g.createElementVNode("td",zSe,g.toDisplayString(((l=n.data)==null?void 0:l.username)||"-"),1),g.createElementVNode("td",VSe,g.toDisplayString(o.getFileSize(n.data.size)),1),g.createElementVNode("td",jSe,g.toDisplayString(o.fileDate||"-"),1),g.createElementVNode("td",USe,[g.createVNode(a,{content:"Завантажити",position:"bottom"},{reference:g.withCtx(()=>[g.createElementVNode("button",{class:"border h-[20px] w-[20px] rounded",onClick:e[0]||(e[0]=c=>o.getFileAction("download",n.data))},e[2]||(e[2]=[g.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[g.createElementVNode("g",{"clip-path":"url(#clip0_197_103)"},[g.createElementVNode("path",{d:"M2.6665 11.3333V12.6666C2.6665 13.0202 2.80698 13.3593 3.05703 13.6094C3.30708 13.8594 3.64622 13.9999 3.99984 13.9999H11.9998C12.3535 13.9999 12.6926 13.8594 12.9426 13.6094C13.1927 13.3593 13.3332 13.0202 13.3332 12.6666V11.3333",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round"}),g.createElementVNode("path",{d:"M4.6665 7.33325L7.99984 10.6666L11.3332 7.33325",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round"}),g.createElementVNode("path",{d:"M8 2.66675V10.6667",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round"})]),g.createElementVNode("defs",null,[g.createElementVNode("clipPath",{id:"clip0_197_103"},[g.createElementVNode("rect",{width:"16",height:"16",fill:"white"})])])],-1)]))]),_:1}),g.createVNode(a,{content:"Видалити",position:"bottom"},{reference:g.withCtx(()=>[g.createElementVNode("button",{class:"border h-[20px] w-[20px] rounded",onClick:e[1]||(e[1]=c=>o.getFileAction("trash",n.data))},e[3]||(e[3]=[g.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[g.createElementVNode("path",{d:"M2.66699 4.66675H13.3337",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round"}),g.createElementVNode("path",{d:"M6.6665 7.33325V11.3333",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round"}),g.createElementVNode("path",{d:"M9.3335 7.33325V11.3333",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round"}),g.createElementVNode("path",{d:"M3.3335 4.66675L4.00016 12.6667C4.00016 13.0204 4.14064 13.3595 4.39069 13.6096C4.64074 13.8596 4.97987 14.0001 5.3335 14.0001H10.6668C11.0205 14.0001 11.3596 13.8596 11.6096 13.6096C11.8597 13.3595 12.0002 13.0204 12.0002 12.6667L12.6668 4.66675",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round"}),g.createElementVNode("path",{d:"M6 4.66667V2.66667C6 2.48986 6.07024 2.32029 6.19526 2.19526C6.32029 2.07024 6.48986 2 6.66667 2H9.33333C9.51014 2 9.67971 2.07024 9.80474 2.19526C9.92976 2.32029 10 2.48986 10 2.66667V4.66667",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]))]),_:1})])])}const WSe={components:{VsWidgetFileList:SSe,VsWidgetFileItem:xt(LSe,[["render",HSe]]),VsDialog:Ag,VsTooltip:p1,VsButton:Fh},props:{id:{type:String,default:""},apiFiles:{type:String,default:()=>""},apiAddFiles:{type:String,default:()=>""},fileData:{type:Array,default:()=>[]},staticData:{type:Object,default:()=>null}},data(){return{files:[],user:null,galleryId:Math.floor(Math.random()*1e3)+1,isModalVisible:!1,modal:{}}},computed:{renderFiles(){var t;return this.isFileDataAviable?this.fileData:(t=this.files)==null?void 0:t.map(e=>({...e,id:Math.floor(Math.random()*1e3)}))},filesCount(){var t;return(t=this.renderFiles)==null?void 0:t.length},isFileDataAviable(){var t;return(t=this.fileData)==null?void 0:t.length}},mounted(){if(this.staticData){this.user=this.staticData.user,this.files=this.staticData.rows;return}!this.isFileDataAviable&&this.apiFiles&&this.getFileList()},methods:{async getFileList(){if(this.apiFiles){this.files=[],this.$emit("update-formdata",[]);try{const e=await(await fetch(this.apiFiles)).json();this.user=e==null?void 0:e.user,this.files=(e==null?void 0:e.rows)||[]}catch(t){console.error("Error fetching files:",t),this.files=[]}}},async addFile(t){(await Promise.all(Array.from(t.target.files).map(async r=>{const i=new FormData;i.append("file",r);try{const o=this.apiAddFiles,s=await fetch(o,{body:i,method:"post"});if(!s.ok){const l=await s.json();console.error(l.message),this.$notify({type:"error",title:"Server Error",message:l.message});return}const a=await s.json();return this.$emit("update-formdata",[...this.fileData,{...r,...a==null?void 0:a.result}]),r}catch(o){return console.error(o),null}}))).every(r=>r)&&await this.getFileList()},prepareModal(t){const e={...t};return t.cancel||(e.cancel=()=>{this.isModalVisible=!1}),t.updateListOnConfirm&&(e.confirm=async()=>{await t.confirm(),this.isModalVisible=!1,this.getFileList()}),e},handleOpenModal(t){this.modal=this.prepareModal(t),this.isModalVisible=!0}}},GSe={class:"widget-file flex flex-col mb-2"},qSe={class:"flex items-center justify-between"},YSe={class:"text-sm font-medium !m-0"},ZSe={key:1,class:"bg-gray-100 rounded dark:text-white px-4 py-1.5",role:"alert"},XSe={class:"py-3 px-4"},KSe={class:"mt-3 flex items-center gap-4 justify-center"};function JSe(t,e,n,r,i,o){const s=g.resolveComponent("VsButton"),a=g.resolveComponent("VsTooltip"),l=g.resolveComponent("VsWidgetFileItem"),c=g.resolveComponent("VsWidgetFileList"),u=g.resolveComponent("VsDialog");return g.openBlock(),g.createElementBlock("div",null,[g.createElementVNode("div",GSe,[g.createElementVNode("div",qSe,[g.createElementVNode("h3",YSe,"Кількість: "+g.toDisplayString(o.filesCount),1),g.createVNode(a,{content:"Додати файл",position:"bottom"},{reference:g.withCtx(()=>[g.createVNode(s,{square:"",type:"primary"},{default:g.withCtx(()=>[e[3]||(e[3]=g.createElementVNode("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[g.createElementVNode("g",{"clip-path":"url(#clip0_481_2)"},[g.createElementVNode("path",{d:"M7.5 3.125V11.875",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round"}),g.createElementVNode("path",{d:"M3.125 7.5H11.875",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round"})]),g.createElementVNode("defs",null,[g.createElementVNode("clipPath",{id:"clip0_481_2"},[g.createElementVNode("rect",{width:"15",height:"15",fill:"white"})])])],-1)),g.createElementVNode("input",{multiple:"",class:"form-control form-control-sm input-hidden",type:"file",name:"file",title:" ",style:{opacity:"0",position:"absolute",top:"0",bottom:"0",left:"0",right:"0"},onChange:e[0]||(e[0]=d=>o.addFile(d))},null,32)]),_:1,__:[3]})]),_:1})])]),o.filesCount?(g.openBlock(),g.createBlock(c,{key:0},{default:g.withCtx(()=>[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(o.renderFiles,(d,p)=>(g.openBlock(),g.createBlock(l,{key:(d==null?void 0:d.id)||p,"is-file-data":o.isFileDataAviable,data:d,onUpdateList:o.getFileList,onOpenModal:e[1]||(e[1]=m=>o.handleOpenModal(m))},null,8,["is-file-data","data","onUpdateList"]))),128))]),_:1})):(g.openBlock(),g.createElementBlock("div",ZSe,e[4]||(e[4]=[g.createStaticVNode('

Файли відсутні

Додайте файли, щоб побачити список.

',1)]))),g.createVNode(u,{title:i.modal.title,size:"small",visible:i.isModalVisible,"onUpdate:visible":e[2]||(e[2]=d=>i.isModalVisible=d)},{default:g.withCtx(()=>[g.createElementVNode("div",XSe,[g.createElementVNode("p",null,g.toDisplayString(i.modal.message),1),g.createElementVNode("div",KSe,[g.createVNode(s,{class:"w-8 h-[38px]",type:"primary",onClick:i.modal.confirm},{default:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(i.modal.confirmButtonText),1)]),_:1},8,["onClick"]),g.createVNode(s,{class:"w-8 h-[38px]",color:"red",type:"plain",onClick:i.modal.cancel},{default:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(i.modal.cancelButtonText),1)]),_:1},8,["onClick"])])])]),_:1},8,["title","visible"])])}const QSe=xt(WSe,[["render",JSe]]),eCe=g.defineComponent({components:{IconChevronDown:Ip,IconCheck:cf},props:{total:{type:Number,default:()=>0},pageSize:{type:Number,default:()=>10},maxPages:{type:Number,default:()=>10},defaultPage:{type:Number,default:()=>1},backgroundColorSelected:{type:Boolean,default:!0},borderedCellSelected:{type:Boolean,default:!1},buttonGroup:{type:Boolean,default:!1},rounded:{type:Boolean,default:!1},size:{type:String,default:"small"},backgroundColor:{type:String,default:"#f9fafb"},backgroundColorDark:{type:String,default:"#242424"},pageSizes:{type:Array,default:[]},goTo:{type:Boolean,default:!0},goToString:{type:String,default:"Перейти до"}},data(){return{page:1,pages:[],isDropdownOpen:!1,pageSizeLocal:10,goToPageValue:null}},mounted(){this.pageSizeLocal=this.pageSize},watch:{total:{immediate:!0,handler(){this.initPages()}},defaultPage:{immediate:!0,handler(t){this.page=t,this.updatePages(t)}},pageSize(){this.page=1,this.updatePages(1)}},computed:{pagesCount(){return Math.ceil(this.total/this.pageSize)},disableNextClick(){return this.page>=this.pagesCount},disablePrevClick(){return this.page<=1},firstPageVisible(){return this.pages.includes(1)},sizeStyle(){return{"text-sm h-[32px] min-w-8":this.size==="small","text-base h-[38px] min-w-[38px]":this.size==="medium","text-lg h-[38px] min-w-[38px]":this.size==="large"}}},methods:{initPages(){if(this.total<=0){this.pages=[1];return}this.updatePages(this.page)},updatePages(t){const e=Math.floor(this.maxPages/2);let n=Math.max(t-e,1),r=n+this.maxPages-1;r>this.pagesCount&&(r=this.pagesCount,n=Math.max(r-this.maxPages+1,1)),this.pages=Array.from({length:r-n+1},(i,o)=>n+o)},handleClickPrev(){this.disablePrevClick||(this.setCurrentPage(this.page-1),this.updatePages(this.page),this.$emit("prevClick"))},handleClickNext(){this.disableNextClick||(this.setCurrentPage(parseInt(this.page)+1),this.updatePages(this.page),this.$emit("nextClick"))},setCurrentPage(t){t<1||t>this.pagesCount||this.page===t||(this.page=t,this.$emit("pageChange",this.page),this.updatePages(t))},selectPageSize(t){this.pageSizeLocal=t,this.isDropdownOpen=!1,this.$emit("pageSizeChange",this.pageSizeLocal)},goToPage(t){const e=t.target,n=parseInt(e.value,10),r=Math.ceil(this.total/this.pageSize);if(n<1){this.goToPageValue=1,this.page=1,this.$emit("pageChange",1);return}if(n>r){this.goToPageValue=r,this.page=r,this.$emit("pageChange",r);return}isNaN(n)||(this.page=n,this.$emit("pageChange",this.page))}}}),tCe={class:"flex items-center"},nCe=["onClick"],rCe={key:0,class:"flex justify-center items-center gap-x-5 ml-3"},iCe={class:"relative"},oCe={class:"hs-dropdown-menu z-50 bg-white shadow-md rounded-lg p-1 space-y-0.5 dark:bg-neutral-800 dark:border dark:border-neutral-700 right-0 dark:divide-neutral-700 absolute bottom-[100%]",role:"menu","aria-orientation":"vertical","aria-labelledby":"dropdown-button"},sCe=["onClick"],aCe={class:"text-gray-800 whitespace-nowrap dark:text-white"};function lCe(t,e,n,r,i,o){const s=g.resolveComponent("IconChevronDown"),a=g.resolveComponent("IconCheck");return g.openBlock(),g.createElementBlock("nav",{class:g.normalizeClass(["flex items-center justify-between w-full",{"gap-x-1":!t.buttonGroup}])},[g.createElementVNode("div",tCe,[g.createElementVNode("button",{type:"button",onClick:e[0]||(e[0]=(...l)=>t.handleClickPrev&&t.handleClickPrev(...l)),"aria-label":"Previous",class:g.normalizeClass(["py-2 px-2.5 inline-flex justify-center items-center gap-x-2 border text-sm rounded-lg bg-white text-gray-800 hover:shadow-sm hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-50 dark:bg-neutral-700 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-800 py-2",{"opacity-50 pointer-events-none":t.disablePrevClick,"border border-gray-200":t.buttonGroup,"border-white first:rounded-s-lg":!t.buttonGroup,...t.sizeStyle}])},[g.createVNode(s,{height:"16",width:"16",class:"rotate-90"}),e[5]||(e[5]=g.createElementVNode("span",{"aria-hidden":"true",class:"sr-only"},"Previous",-1))],2),g.createElementVNode("div",{class:g.normalizeClass(["flex items-center",{"gap-x-1":!t.buttonGroup}])},[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(t.pages,l=>(g.openBlock(),g.createElementBlock("button",{key:l,type:"button",onClick:c=>t.setCurrentPage(l),class:g.normalizeClass({" flex justify-center items-center rounded-lg text-sm dark:text-neutral-300 py-2 px-3 focus:outline-none disabled:opacity-50 disabled:pointer-events-none":l==t.page," flex justify-center items-center rounded-lg text-sm dark:text-neutral-400 hover:bg-gray-100 py-2 px-3 focus:outline-none focus:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:hover:bg-neutral-800 dark:focus:bg-neutral-800":l!=t.page,[`bg-[${t.backgroundColor}] dark:bg-[${t.backgroundColorDark}]`]:l==t.page&&t.backgroundColorSelected,"border border-gray-200":l==t.page&&t.borderedCellSelected||t.buttonGroup,"border-l-0":t.buttonGroup,"rounded-lg":t.rounded,...t.sizeStyle})},g.toDisplayString(l),11,nCe))),128))],2),g.createElementVNode("button",{type:"button",onClick:e[1]||(e[1]=(...l)=>t.handleClickNext&&t.handleClickNext(...l)),"aria-label":"Next",class:g.normalizeClass([{"opacity-50 pointer-events-none":t.disableNextClick,"border border-gray-200 border-l-0 last:rounded-e-lg":t.buttonGroup," border-white last:rounded-e-lg":!t.buttonGroup,...t.sizeStyle},"py-2 px-2.5 inline-flex justify-center items-center gap-x-2 border text-sm rounded-lg bg-white text-gray-800 hover:shadow-sm hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-50 dark:bg-neutral-700 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-800 py-2"])},[e[6]||(e[6]=g.createElementVNode("span",{"aria-hidden":"true",class:"sr-only"},"Next",-1)),g.createVNode(s,{height:"16",width:"16",class:"-rotate-90"})],2)]),t.pageSizes.length?(g.openBlock(),g.createElementBlock("div",rCe,[g.createElementVNode("div",iCe,[g.withDirectives(g.createElementVNode("div",oCe,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(t.pageSizes,l=>(g.openBlock(),g.createElementBlock("button",{type:"button",class:g.normalizeClass(["w-full flex items-center gap-x-3.5 py-2 px-3 rounded-lg text-sm",{"text-gray-800 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:hover:text-neutral-300 dark:focus:bg-neutral-700":l!=t.page,"bg-[#f9fafb]":l==t.pageSizeLocal}]),onClick:c=>t.selectPageSize(l)},[g.createTextVNode(g.toDisplayString(l)+" ",1),l===t.pageSizeLocal?(g.openBlock(),g.createBlock(a,{key:0,width:"14",height:"14",class:"text-blue-600"})):g.createCommentVNode("",!0)],10,sCe))),256))],512),[[g.vShow,t.isDropdownOpen]]),t.pageSizes.length?(g.openBlock(),g.createElementBlock("button",{key:0,type:"button",class:g.normalizeClass(["py-3 px-3.5 inline-flex items-center gap-x-1 text-sm rounded-lg border border-gray-200 text-gray-800 shadow-sm hover:bg-gray-50 focus:outline-none focus:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",{...t.sizeStyle}]),"aria-haspopup":"menu","aria-expanded":"false","aria-label":"Dropdown",onClick:e[2]||(e[2]=l=>t.isDropdownOpen=!t.isDropdownOpen)},[g.createTextVNode(g.toDisplayString(t.pageSizeLocal)+" ",1),g.createVNode(s,{height:"16",width:"16"})],2)):g.createCommentVNode("",!0)])])):g.createCommentVNode("",!0),t.goTo?(g.openBlock(),g.createElementBlock("div",{key:1,class:g.normalizeClass(["flex items-center gap-x-2 ml-3",{...t.sizeStyle}])},[g.createElementVNode("span",aCe,g.toDisplayString(t.goToString),1),g.withDirectives(g.createElementVNode("input",{type:"number","onUpdate:modelValue":e[3]||(e[3]=l=>t.goToPageValue=l),onChange:e[4]||(e[4]=(...l)=>t.goToPage&&t.goToPage(...l)),class:g.normalizeClass(["p-3 block w-12 border border-gray-200 rounded-lg text-sm text-center focus:border-blue-500 focus:ring-blue-500 [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-900 dark:border-neutral-700 dark:text-neutral-400 dark:placeholder-neutral-500 dark:focus:ring-neutral-600",{...t.sizeStyle}])},null,34),[[g.vModelText,t.goToPageValue]])],2)):g.createCommentVNode("",!0)],2)}const Rj=xt(eCe,[["render",lCe]]);function Bj(t){return t!==null&&typeof t=="object"&&"constructor"in t&&t.constructor===Object}function $2(t,e){t===void 0&&(t={}),e===void 0&&(e={});const n=["__proto__","constructor","prototype"];Object.keys(e).filter(r=>n.indexOf(r)<0).forEach(r=>{typeof t[r]>"u"?t[r]=e[r]:Bj(e[r])&&Bj(t[r])&&Object.keys(e[r]).length>0&&$2(t[r],e[r])})}const Fj={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector(){return null},querySelectorAll(){return[]},getElementById(){return null},createEvent(){return{initEvent(){}}},createElement(){return{children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName(){return[]}}},createElementNS(){return{}},importNode(){return null},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function gh(){const t=typeof document<"u"?document:{};return $2(t,Fj),t}const cCe={document:Fj,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle(){return{getPropertyValue(){return""}}},Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia(){return{}},requestAnimationFrame(t){return typeof setTimeout>"u"?(t(),null):setTimeout(t,0)},cancelAnimationFrame(t){typeof setTimeout>"u"||clearTimeout(t)}};function kl(){const t=typeof window<"u"?window:{};return $2(t,cCe),t}function uCe(t){return t===void 0&&(t=""),t.trim().split(" ").filter(e=>!!e.trim())}function hCe(t){const e=t;Object.keys(e).forEach(n=>{try{e[n]=null}catch{}try{delete e[n]}catch{}})}function z2(t,e){return e===void 0&&(e=0),setTimeout(t,e)}function Fg(){return Date.now()}function dCe(t){const e=kl();let n;return e.getComputedStyle&&(n=e.getComputedStyle(t,null)),!n&&t.currentStyle&&(n=t.currentStyle),n||(n=t.style),n}function fCe(t,e){e===void 0&&(e="x");const n=kl();let r,i,o;const s=dCe(t);return n.WebKitCSSMatrix?(i=s.transform||s.webkitTransform,i.split(",").length>6&&(i=i.split(", ").map(a=>a.replace(",",".")).join(", ")),o=new n.WebKitCSSMatrix(i==="none"?"":i)):(o=s.MozTransform||s.OTransform||s.MsTransform||s.msTransform||s.transform||s.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),r=o.toString().split(",")),e==="x"&&(n.WebKitCSSMatrix?i=o.m41:r.length===16?i=parseFloat(r[12]):i=parseFloat(r[4])),e==="y"&&(n.WebKitCSSMatrix?i=o.m42:r.length===16?i=parseFloat(r[13]):i=parseFloat(r[5])),i||0}function H1(t){return typeof t=="object"&&t!==null&&t.constructor&&Object.prototype.toString.call(t).slice(8,-1)==="Object"}function pCe(t){return typeof window<"u"&&typeof window.HTMLElement<"u"?t instanceof HTMLElement:t&&(t.nodeType===1||t.nodeType===11)}function Rc(){const t=Object(arguments.length<=0?void 0:arguments[0]),e=["__proto__","constructor","prototype"];for(let n=1;ne.indexOf(o)<0);for(let o=0,s=i.length;oo?"next":"prev",u=(p,m)=>c==="next"&&p>=m||c==="prev"&&p<=m,d=()=>{a=new Date().getTime(),s===null&&(s=a);const p=Math.max(Math.min((a-s)/l,1),0),m=.5-Math.cos(p*Math.PI)/2;let y=o+m*(n-o);if(u(y,n)&&(y=n),e.wrapperEl.scrollTo({[r]:y}),u(y,n)){e.wrapperEl.style.overflow="hidden",e.wrapperEl.style.scrollSnapType="",setTimeout(()=>{e.wrapperEl.style.overflow="",e.wrapperEl.scrollTo({[r]:y})}),i.cancelAnimationFrame(e.cssModeFrameID);return}e.cssModeFrameID=i.requestAnimationFrame(d)};d()}function yh(t,e){e===void 0&&(e="");const n=kl(),r=[...t.children];return n.HTMLSlotElement&&t instanceof HTMLSlotElement&&r.push(...t.assignedElements()),e?r.filter(i=>i.matches(e)):r}function mCe(t,e){const n=[e];for(;n.length>0;){const r=n.shift();if(t===r)return!0;n.push(...r.children,...r.shadowRoot?r.shadowRoot.children:[],...r.assignedElements?r.assignedElements():[])}}function gCe(t,e){const n=kl();let r=e.contains(t);return!r&&n.HTMLSlotElement&&e instanceof HTMLSlotElement&&(r=[...e.assignedElements()].includes(t),r||(r=mCe(t,e))),r}function rk(t){try{console.warn(t);return}catch{}}function ik(t,e){e===void 0&&(e=[]);const n=document.createElement(t);return n.classList.add(...Array.isArray(e)?e:uCe(e)),n}function yCe(t,e){const n=[];for(;t.previousElementSibling;){const r=t.previousElementSibling;e?r.matches(e)&&n.push(r):n.push(r),t=r}return n}function vCe(t,e){const n=[];for(;t.nextElementSibling;){const r=t.nextElementSibling;e?r.matches(e)&&n.push(r):n.push(r),t=r}return n}function jp(t,e){return kl().getComputedStyle(t,null).getPropertyValue(e)}function ok(t){let e=t,n;if(e){for(n=0;(e=e.previousSibling)!==null;)e.nodeType===1&&(n+=1);return n}}function zj(t,e){const n=[];let r=t.parentElement;for(;r;)e?r.matches(e)&&n.push(r):n.push(r),r=r.parentElement;return n}function V2(t,e){function n(r){r.target===t&&(e.call(t,r),t.removeEventListener("transitionend",n))}e&&t.addEventListener("transitionend",n)}function j2(t,e,n){const r=kl();return t[e==="width"?"offsetWidth":"offsetHeight"]+parseFloat(r.getComputedStyle(t,null).getPropertyValue(e==="width"?"margin-right":"margin-top"))+parseFloat(r.getComputedStyle(t,null).getPropertyValue(e==="width"?"margin-left":"margin-bottom"))}function ua(t){return(Array.isArray(t)?t:[t]).filter(e=>!!e)}function sk(t,e){e===void 0&&(e=""),typeof trustedTypes<"u"?t.innerHTML=trustedTypes.createPolicy("html",{createHTML:n=>n}).createHTML(e):t.innerHTML=e}let U2;function _Ce(){const t=kl(),e=gh();return{smoothScroll:e.documentElement&&e.documentElement.style&&"scrollBehavior"in e.documentElement.style,touch:!!("ontouchstart"in t||t.DocumentTouch&&e instanceof t.DocumentTouch)}}function Vj(){return U2||(U2=_Ce()),U2}let H2;function bCe(t){let{userAgent:e}=t===void 0?{}:t;const n=Vj(),r=kl(),i=r.navigator.platform,o=e||r.navigator.userAgent,s={ios:!1,android:!1},a=r.screen.width,l=r.screen.height,c=o.match(/(Android);?[\s\/]+([\d.]+)?/);let u=o.match(/(iPad).*OS\s([\d_]+)/);const d=o.match(/(iPod)(.*OS\s([\d_]+))?/),p=!u&&o.match(/(iPhone\sOS|iOS)\s([\d_]+)/),m=i==="Win32";let y=i==="MacIntel";const w=["1024x1366","1366x1024","834x1194","1194x834","834x1112","1112x834","768x1024","1024x768","820x1180","1180x820","810x1080","1080x810"];return!u&&y&&n.touch&&w.indexOf(`${a}x${l}`)>=0&&(u=o.match(/(Version)\/([\d.]+)/),u||(u=[0,1,"13_0_0"]),y=!1),c&&!m&&(s.os="android",s.android=!0),(u||p||d)&&(s.os="ios",s.ios=!0),s}function jj(t){return t===void 0&&(t={}),H2||(H2=bCe(t)),H2}let W2;function wCe(){const t=kl(),e=jj();let n=!1;function r(){const a=t.navigator.userAgent.toLowerCase();return a.indexOf("safari")>=0&&a.indexOf("chrome")<0&&a.indexOf("android")<0}if(r()){const a=String(t.navigator.userAgent);if(a.includes("Version/")){const[l,c]=a.split("Version/")[1].split(" ")[0].split(".").map(u=>Number(u));n=l<16||l===16&&c<2}}const i=/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(t.navigator.userAgent),o=r(),s=o||i&&e.ios;return{isSafari:n||o,needPerspectiveFix:n,need3dFix:s,isWebView:i}}function Uj(){return W2||(W2=wCe()),W2}function xCe(t){let{swiper:e,on:n,emit:r}=t;const i=kl();let o=null,s=null;const a=()=>{!e||e.destroyed||!e.initialized||(r("beforeResize"),r("resize"))},l=()=>{!e||e.destroyed||!e.initialized||(o=new ResizeObserver(d=>{s=i.requestAnimationFrame(()=>{const{width:p,height:m}=e;let y=p,w=m;d.forEach(x=>{let{contentBoxSize:C,contentRect:S,target:M}=x;M&&M!==e.el||(y=S?S.width:(C[0]||C).inlineSize,w=S?S.height:(C[0]||C).blockSize)}),(y!==p||w!==m)&&a()})}),o.observe(e.el))},c=()=>{s&&i.cancelAnimationFrame(s),o&&o.unobserve&&e.el&&(o.unobserve(e.el),o=null)},u=()=>{!e||e.destroyed||!e.initialized||r("orientationchange")};n("init",()=>{if(e.params.resizeObserver&&typeof i.ResizeObserver<"u"){l();return}i.addEventListener("resize",a),i.addEventListener("orientationchange",u)}),n("destroy",()=>{c(),i.removeEventListener("resize",a),i.removeEventListener("orientationchange",u)})}function ECe(t){let{swiper:e,extendParams:n,on:r,emit:i}=t;const o=[],s=kl(),a=function(u,d){d===void 0&&(d={});const p=s.MutationObserver||s.WebkitMutationObserver,m=new p(y=>{if(e.__preventObserver__)return;if(y.length===1){i("observerUpdate",y[0]);return}const w=function(){i("observerUpdate",y[0])};s.requestAnimationFrame?s.requestAnimationFrame(w):s.setTimeout(w,0)});m.observe(u,{attributes:typeof d.attributes>"u"?!0:d.attributes,childList:e.isElement||(typeof d.childList>"u"?!0:d).childList,characterData:typeof d.characterData>"u"?!0:d.characterData}),o.push(m)},l=()=>{if(e.params.observer){if(e.params.observeParents){const u=zj(e.hostEl);for(let d=0;d{o.forEach(u=>{u.disconnect()}),o.splice(0,o.length)};n({observer:!1,observeParents:!1,observeSlideChildren:!1}),r("init",l),r("destroy",c)}var SCe={on(t,e,n){const r=this;if(!r.eventsListeners||r.destroyed||typeof e!="function")return r;const i=n?"unshift":"push";return t.split(" ").forEach(o=>{r.eventsListeners[o]||(r.eventsListeners[o]=[]),r.eventsListeners[o][i](e)}),r},once(t,e,n){const r=this;if(!r.eventsListeners||r.destroyed||typeof e!="function")return r;function i(){r.off(t,i),i.__emitterProxy&&delete i.__emitterProxy;for(var o=arguments.length,s=new Array(o),a=0;a=0&&e.eventsAnyListeners.splice(n,1),e},off(t,e){const n=this;return!n.eventsListeners||n.destroyed||!n.eventsListeners||t.split(" ").forEach(r=>{typeof e>"u"?n.eventsListeners[r]=[]:n.eventsListeners[r]&&n.eventsListeners[r].forEach((i,o)=>{(i===e||i.__emitterProxy&&i.__emitterProxy===e)&&n.eventsListeners[r].splice(o,1)})}),n},emit(){const t=this;if(!t.eventsListeners||t.destroyed||!t.eventsListeners)return t;let e,n,r;for(var i=arguments.length,o=new Array(i),s=0;s{t.eventsAnyListeners&&t.eventsAnyListeners.length&&t.eventsAnyListeners.forEach(c=>{c.apply(r,[l,...n])}),t.eventsListeners&&t.eventsListeners[l]&&t.eventsListeners[l].forEach(c=>{c.apply(r,n)})}),t}};function CCe(){const t=this;let e,n;const r=t.el;typeof t.params.width<"u"&&t.params.width!==null?e=t.params.width:e=r.clientWidth,typeof t.params.height<"u"&&t.params.height!==null?n=t.params.height:n=r.clientHeight,!(e===0&&t.isHorizontal()||n===0&&t.isVertical())&&(e=e-parseInt(jp(r,"padding-left")||0,10)-parseInt(jp(r,"padding-right")||0,10),n=n-parseInt(jp(r,"padding-top")||0,10)-parseInt(jp(r,"padding-bottom")||0,10),Number.isNaN(e)&&(e=0),Number.isNaN(n)&&(n=0),Object.assign(t,{width:e,height:n,size:t.isHorizontal()?e:n}))}function kCe(){const t=this;function e(W,J){return parseFloat(W.getPropertyValue(t.getDirectionLabel(J))||0)}const n=t.params,{wrapperEl:r,slidesEl:i,size:o,rtlTranslate:s,wrongRTL:a}=t,l=t.virtual&&n.virtual.enabled,c=l?t.virtual.slides.length:t.slides.length,u=yh(i,`.${t.params.slideClass}, swiper-slide`),d=l?t.virtual.slides.length:u.length;let p=[];const m=[],y=[];let w=n.slidesOffsetBefore;typeof w=="function"&&(w=n.slidesOffsetBefore.call(t));let x=n.slidesOffsetAfter;typeof x=="function"&&(x=n.slidesOffsetAfter.call(t));const C=t.snapGrid.length,S=t.slidesGrid.length;let M=n.spaceBetween,E=-w,A=0,I=0;if(typeof o>"u")return;typeof M=="string"&&M.indexOf("%")>=0?M=parseFloat(M.replace("%",""))/100*o:typeof M=="string"&&(M=parseFloat(M)),t.virtualSize=-M,u.forEach(W=>{s?W.style.marginLeft="":W.style.marginRight="",W.style.marginBottom="",W.style.marginTop=""}),n.centeredSlides&&n.cssMode&&(nk(r,"--swiper-centered-offset-before",""),nk(r,"--swiper-centered-offset-after",""));const O=n.grid&&n.grid.rows>1&&t.grid;O?t.grid.initSlides(u):t.grid&&t.grid.unsetSlides();let z;const $=n.slidesPerView==="auto"&&n.breakpoints&&Object.keys(n.breakpoints).filter(W=>typeof n.breakpoints[W].slidesPerView<"u").length>0;for(let W=0;W1&&p.push(t.virtualSize-o)}if(l&&n.loop){const W=y[0]+M;if(n.slidesPerGroup>1){const J=Math.ceil((t.virtual.slidesBefore+t.virtual.slidesAfter)/n.slidesPerGroup),Z=W*n.slidesPerGroup;for(let q=0;q!n.cssMode||n.loop?!0:Z!==u.length-1).forEach(J=>{J.style[W]=`${M}px`})}if(n.centeredSlides&&n.centeredSlidesBounds){let W=0;y.forEach(Z=>{W+=Z+(M||0)}),W-=M;const J=W>o?W-o:0;p=p.map(Z=>Z<=0?-w:Z>J?J+x:Z)}if(n.centerInsufficientSlides){let W=0;y.forEach(Z=>{W+=Z+(M||0)}),W-=M;const J=(n.slidesOffsetBefore||0)+(n.slidesOffsetAfter||0);if(W+J{p[j]=q-Z}),m.forEach((q,j)=>{m[j]=q+Z})}}if(Object.assign(t,{slides:u,snapGrid:p,slidesGrid:m,slidesSizesGrid:y}),n.centeredSlides&&n.cssMode&&!n.centeredSlidesBounds){nk(r,"--swiper-centered-offset-before",`${-p[0]}px`),nk(r,"--swiper-centered-offset-after",`${t.size/2-y[y.length-1]/2}px`);const W=-t.snapGrid[0],J=-t.slidesGrid[0];t.snapGrid=t.snapGrid.map(Z=>Z+W),t.slidesGrid=t.slidesGrid.map(Z=>Z+J)}if(d!==c&&t.emit("slidesLengthChange"),p.length!==C&&(t.params.watchOverflow&&t.checkOverflow(),t.emit("snapGridLengthChange")),m.length!==S&&t.emit("slidesGridLengthChange"),n.watchSlidesProgress&&t.updateSlidesOffset(),t.emit("slidesUpdated"),!l&&!n.cssMode&&(n.effect==="slide"||n.effect==="fade")){const W=`${n.containerModifierClass}backface-hidden`,J=t.el.classList.contains(W);d<=n.maxBackfaceHiddenSlides?J||t.el.classList.add(W):J&&t.el.classList.remove(W)}}function TCe(t){const e=this,n=[],r=e.virtual&&e.params.virtual.enabled;let i=0,o;typeof t=="number"?e.setTransition(t):t===!0&&e.setTransition(e.params.speed);const s=a=>r?e.slides[e.getSlideIndexByData(a)]:e.slides[a];if(e.params.slidesPerView!=="auto"&&e.params.slidesPerView>1)if(e.params.centeredSlides)(e.visibleSlides||[]).forEach(a=>{n.push(a)});else for(o=0;oe.slides.length&&!r)break;n.push(s(a))}else n.push(s(e.activeIndex));for(o=0;oi?a:i}(i||i===0)&&(e.wrapperEl.style.height=`${i}px`)}function MCe(){const t=this,e=t.slides,n=t.isElement?t.isHorizontal()?t.wrapperEl.offsetLeft:t.wrapperEl.offsetTop:0;for(let r=0;r{e&&!t.classList.contains(n)?t.classList.add(n):!e&&t.classList.contains(n)&&t.classList.remove(n)};function ACe(t){t===void 0&&(t=this&&this.translate||0);const e=this,n=e.params,{slides:r,rtlTranslate:i,snapGrid:o}=e;if(r.length===0)return;typeof r[0].swiperSlideOffset>"u"&&e.updateSlidesOffset();let s=-t;i&&(s=t),e.visibleSlidesIndexes=[],e.visibleSlides=[];let a=n.spaceBetween;typeof a=="string"&&a.indexOf("%")>=0?a=parseFloat(a.replace("%",""))/100*e.size:typeof a=="string"&&(a=parseFloat(a));for(let l=0;l=0&&m<=e.size-e.slidesSizesGrid[l],x=m>=0&&m1&&y<=e.size||m<=0&&y>=e.size;x&&(e.visibleSlides.push(c),e.visibleSlidesIndexes.push(l)),Hj(c,x,n.slideVisibleClass),Hj(c,w,n.slideFullyVisibleClass),c.progress=i?-d:d,c.originalProgress=i?-p:p}}function ICe(t){const e=this;if(typeof t>"u"){const u=e.rtlTranslate?-1:1;t=e&&e.translate&&e.translate*u||0}const n=e.params,r=e.maxTranslate()-e.minTranslate();let{progress:i,isBeginning:o,isEnd:s,progressLoop:a}=e;const l=o,c=s;if(r===0)i=0,o=!0,s=!0;else{i=(t-e.minTranslate())/r;const u=Math.abs(t-e.minTranslate())<1,d=Math.abs(t-e.maxTranslate())<1;o=u||i<=0,s=d||i>=1,u&&(i=0),d&&(i=1)}if(n.loop){const u=e.getSlideIndexByData(0),d=e.getSlideIndexByData(e.slides.length-1),p=e.slidesGrid[u],m=e.slidesGrid[d],y=e.slidesGrid[e.slidesGrid.length-1],w=Math.abs(t);w>=p?a=(w-p)/y:a=(w+y-m)/y,a>1&&(a-=1)}Object.assign(e,{progress:i,progressLoop:a,isBeginning:o,isEnd:s}),(n.watchSlidesProgress||n.centeredSlides&&n.autoHeight)&&e.updateSlidesProgress(t),o&&!l&&e.emit("reachBeginning toEdge"),s&&!c&&e.emit("reachEnd toEdge"),(l&&!o||c&&!s)&&e.emit("fromEdge"),e.emit("progress",i)}const G2=(t,e,n)=>{e&&!t.classList.contains(n)?t.classList.add(n):!e&&t.classList.contains(n)&&t.classList.remove(n)};function LCe(){const t=this,{slides:e,params:n,slidesEl:r,activeIndex:i}=t,o=t.virtual&&n.virtual.enabled,s=t.grid&&n.grid&&n.grid.rows>1,a=d=>yh(r,`.${n.slideClass}${d}, swiper-slide${d}`)[0];let l,c,u;if(o)if(n.loop){let d=i-t.virtual.slidesBefore;d<0&&(d=t.virtual.slides.length+d),d>=t.virtual.slides.length&&(d-=t.virtual.slides.length),l=a(`[data-swiper-slide-index="${d}"]`)}else l=a(`[data-swiper-slide-index="${i}"]`);else s?(l=e.find(d=>d.column===i),u=e.find(d=>d.column===i+1),c=e.find(d=>d.column===i-1)):l=e[i];l&&(s||(u=vCe(l,`.${n.slideClass}, swiper-slide`)[0],n.loop&&!u&&(u=e[0]),c=yCe(l,`.${n.slideClass}, swiper-slide`)[0],n.loop&&!c===0&&(c=e[e.length-1]))),e.forEach(d=>{G2(d,d===l,n.slideActiveClass),G2(d,d===u,n.slideNextClass),G2(d,d===c,n.slidePrevClass)}),t.emitSlidesClasses()}const ak=(t,e)=>{if(!t||t.destroyed||!t.params)return;const n=()=>t.isElement?"swiper-slide":`.${t.params.slideClass}`,r=e.closest(n());if(r){let i=r.querySelector(`.${t.params.lazyPreloaderClass}`);!i&&t.isElement&&(r.shadowRoot?i=r.shadowRoot.querySelector(`.${t.params.lazyPreloaderClass}`):requestAnimationFrame(()=>{r.shadowRoot&&(i=r.shadowRoot.querySelector(`.${t.params.lazyPreloaderClass}`),i&&i.remove())})),i&&i.remove()}},q2=(t,e)=>{if(!t.slides[e])return;const n=t.slides[e].querySelector('[loading="lazy"]');n&&n.removeAttribute("loading")},Y2=t=>{if(!t||t.destroyed||!t.params)return;let e=t.params.lazyPreloadPrevNext;const n=t.slides.length;if(!n||!e||e<0)return;e=Math.min(e,n);const r=t.params.slidesPerView==="auto"?t.slidesPerViewDynamic():Math.ceil(t.params.slidesPerView),i=t.activeIndex;if(t.params.grid&&t.params.grid.rows>1){const s=i,a=[s-e];a.push(...Array.from({length:e}).map((l,c)=>s+r+c)),t.slides.forEach((l,c)=>{a.includes(l.column)&&q2(t,c)});return}const o=i+r-1;if(t.params.rewind||t.params.loop)for(let s=i-e;s<=o+e;s+=1){const a=(s%n+n)%n;(ao)&&q2(t,a)}else for(let s=Math.max(i-e,0);s<=Math.min(o+e,n-1);s+=1)s!==i&&(s>o||s=e[o]&&r=e[o]&&r=e[o]&&(i=o);return n.normalizeSlideIndex&&(i<0||typeof i>"u")&&(i=0),i}function NCe(t){const e=this,n=e.rtlTranslate?e.translate:-e.translate,{snapGrid:r,params:i,activeIndex:o,realIndex:s,snapIndex:a}=e;let l=t,c;const u=m=>{let y=m-e.virtual.slidesBefore;return y<0&&(y=e.virtual.slides.length+y),y>=e.virtual.slides.length&&(y-=e.virtual.slides.length),y};if(typeof l>"u"&&(l=PCe(e)),r.indexOf(n)>=0)c=r.indexOf(n);else{const m=Math.min(i.slidesPerGroupSkip,l);c=m+Math.floor((l-m)/i.slidesPerGroup)}if(c>=r.length&&(c=r.length-1),l===o&&!e.params.loop){c!==a&&(e.snapIndex=c,e.emit("snapIndexChange"));return}if(l===o&&e.params.loop&&e.virtual&&e.params.virtual.enabled){e.realIndex=u(l);return}const d=e.grid&&i.grid&&i.grid.rows>1;let p;if(e.virtual&&i.virtual.enabled&&i.loop)p=u(l);else if(d){const m=e.slides.find(w=>w.column===l);let y=parseInt(m.getAttribute("data-swiper-slide-index"),10);Number.isNaN(y)&&(y=Math.max(e.slides.indexOf(m),0)),p=Math.floor(y/i.grid.rows)}else if(e.slides[l]){const m=e.slides[l].getAttribute("data-swiper-slide-index");m?p=parseInt(m,10):p=l}else p=l;Object.assign(e,{previousSnapIndex:a,snapIndex:c,previousRealIndex:s,realIndex:p,previousIndex:o,activeIndex:l}),e.initialized&&Y2(e),e.emit("activeIndexChange"),e.emit("snapIndexChange"),(e.initialized||e.params.runCallbacksOnInit)&&(s!==p&&e.emit("realIndexChange"),e.emit("slideChange"))}function OCe(t,e){const n=this,r=n.params;let i=t.closest(`.${r.slideClass}, swiper-slide`);!i&&n.isElement&&e&&e.length>1&&e.includes(t)&&[...e.slice(e.indexOf(t)+1,e.length)].forEach(a=>{!i&&a.matches&&a.matches(`.${r.slideClass}, swiper-slide`)&&(i=a)});let o=!1,s;if(i){for(let a=0;al?u=l:r&&ts?a="next":o"u"&&(e=o.params.speed);const w=Math.min(o.params.slidesPerGroupSkip,s);let x=w+Math.floor((s-w)/o.params.slidesPerGroup);x>=l.length&&(x=l.length-1);const C=-l[x];if(a.normalizeSlideIndex)for(let O=0;O=$&&z=$&&z=$&&(s=O)}if(o.initialized&&s!==d&&(!o.allowSlideNext&&(p?C>o.translate&&C>o.minTranslate():Co.translate&&C>o.maxTranslate()&&(d||0)!==s))return!1;s!==(u||0)&&n&&o.emit("beforeSlideChangeStart"),o.updateProgress(C);let S;s>d?S="next":s0?(o._cssModeVirtualInitialSet=!0,requestAnimationFrame(()=>{m[O?"scrollLeft":"scrollTop"]=z})):m[O?"scrollLeft":"scrollTop"]=z,M&&requestAnimationFrame(()=>{o.wrapperEl.style.scrollSnapType="",o._immediateVirtual=!1});else{if(!o.support.smoothScroll)return $j({swiper:o,targetPosition:z,side:O?"left":"top"}),!0;m.scrollTo({[O?"left":"top"]:z,behavior:"smooth"})}return!0}const I=Uj().isSafari;return M&&!i&&I&&o.isElement&&o.virtual.update(!1,!1,s),o.setTransition(e),o.setTranslate(C),o.updateActiveIndex(s),o.updateSlidesClasses(),o.emit("beforeTransitionStart",e,r),o.transitionStart(n,S),e===0?o.transitionEnd(n,S):o.animating||(o.animating=!0,o.onSlideToWrapperTransitionEnd||(o.onSlideToWrapperTransitionEnd=function(z){!o||o.destroyed||z.target===this&&(o.wrapperEl.removeEventListener("transitionend",o.onSlideToWrapperTransitionEnd),o.onSlideToWrapperTransitionEnd=null,delete o.onSlideToWrapperTransitionEnd,o.transitionEnd(n,S))}),o.wrapperEl.addEventListener("transitionend",o.onSlideToWrapperTransitionEnd)),!0}function qCe(t,e,n,r){t===void 0&&(t=0),n===void 0&&(n=!0),typeof t=="string"&&(t=parseInt(t,10));const i=this;if(i.destroyed)return;typeof e>"u"&&(e=i.params.speed);const o=i.grid&&i.params.grid&&i.params.grid.rows>1;let s=t;if(i.params.loop)if(i.virtual&&i.params.virtual.enabled)s=s+i.virtual.slidesBefore;else{let a;if(o){const p=s*i.params.grid.rows;a=i.slides.find(m=>m.getAttribute("data-swiper-slide-index")*1===p).column}else a=i.getSlideIndexByData(s);const l=o?Math.ceil(i.slides.length/i.params.grid.rows):i.slides.length,{centeredSlides:c}=i.params;let u=i.params.slidesPerView;u==="auto"?u=i.slidesPerViewDynamic():(u=Math.ceil(parseFloat(i.params.slidesPerView,10)),c&&u%2===0&&(u=u+1));let d=l-am.getAttribute("data-swiper-slide-index")*1===p).column}else s=i.getSlideIndexByData(s)}return requestAnimationFrame(()=>{i.slideTo(s,e,n,r)}),i}function YCe(t,e,n){e===void 0&&(e=!0);const r=this,{enabled:i,params:o,animating:s}=r;if(!i||r.destroyed)return r;typeof t>"u"&&(t=r.params.speed);let a=o.slidesPerGroup;o.slidesPerView==="auto"&&o.slidesPerGroup===1&&o.slidesPerGroupAuto&&(a=Math.max(r.slidesPerViewDynamic("current",!0),1));const l=r.activeIndex{r.slideTo(r.activeIndex+l,t,e,n)}),!0}return o.rewind&&r.isEnd?r.slideTo(0,t,e,n):r.slideTo(r.activeIndex+l,t,e,n)}function ZCe(t,e,n){e===void 0&&(e=!0);const r=this,{params:i,snapGrid:o,slidesGrid:s,rtlTranslate:a,enabled:l,animating:c}=r;if(!l||r.destroyed)return r;typeof t>"u"&&(t=r.params.speed);const u=r.virtual&&i.virtual.enabled;if(i.loop){if(c&&!u&&i.loopPreventsSliding)return!1;r.loopFix({direction:"prev"}),r._clientLeft=r.wrapperEl.clientLeft}const d=a?r.translate:-r.translate;function p(S){return S<0?-Math.floor(Math.abs(S)):Math.floor(S)}const m=p(d),y=o.map(S=>p(S)),w=i.freeMode&&i.freeMode.enabled;let x=o[y.indexOf(m)-1];if(typeof x>"u"&&(i.cssMode||w)){let S;o.forEach((M,E)=>{m>=M&&(S=E)}),typeof S<"u"&&(x=w?o[S]:o[S>0?S-1:S])}let C=0;if(typeof x<"u"&&(C=s.indexOf(x),C<0&&(C=r.activeIndex-1),i.slidesPerView==="auto"&&i.slidesPerGroup===1&&i.slidesPerGroupAuto&&(C=C-r.slidesPerViewDynamic("previous",!0)+1,C=Math.max(C,0))),i.rewind&&r.isBeginning){const S=r.params.virtual&&r.params.virtual.enabled&&r.virtual?r.virtual.slides.length-1:r.slides.length-1;return r.slideTo(S,t,e,n)}else if(i.loop&&r.activeIndex===0&&i.cssMode)return requestAnimationFrame(()=>{r.slideTo(C,t,e,n)}),!0;return r.slideTo(C,t,e,n)}function XCe(t,e,n){e===void 0&&(e=!0);const r=this;if(!r.destroyed)return typeof t>"u"&&(t=r.params.speed),r.slideTo(r.activeIndex,t,e,n)}function KCe(t,e,n,r){e===void 0&&(e=!0),r===void 0&&(r=.5);const i=this;if(i.destroyed)return;typeof t>"u"&&(t=i.params.speed);let o=i.activeIndex;const s=Math.min(i.params.slidesPerGroupSkip,o),a=s+Math.floor((o-s)/i.params.slidesPerGroup),l=i.rtlTranslate?i.translate:-i.translate;if(l>=i.snapGrid[a]){const c=i.snapGrid[a],u=i.snapGrid[a+1];l-c>(u-c)*r&&(o+=i.params.slidesPerGroup)}else{const c=i.snapGrid[a-1],u=i.snapGrid[a];l-c<=(u-c)*r&&(o-=i.params.slidesPerGroup)}return o=Math.max(o,0),o=Math.min(o,i.slidesGrid.length-1),i.slideTo(o,t,e,n)}function JCe(){const t=this;if(t.destroyed)return;const{params:e,slidesEl:n}=t,r=e.slidesPerView==="auto"?t.slidesPerViewDynamic():e.slidesPerView;let i=t.clickedIndex,o;const s=t.isElement?"swiper-slide":`.${e.slideClass}`;if(e.loop){if(t.animating)return;o=parseInt(t.clickedSlide.getAttribute("data-swiper-slide-index"),10),e.centeredSlides?it.slides.length-t.loopedSlides+r/2?(t.loopFix(),i=t.getSlideIndex(yh(n,`${s}[data-swiper-slide-index="${o}"]`)[0]),z2(()=>{t.slideTo(i)})):t.slideTo(i):i>t.slides.length-r?(t.loopFix(),i=t.getSlideIndex(yh(n,`${s}[data-swiper-slide-index="${o}"]`)[0]),z2(()=>{t.slideTo(i)})):t.slideTo(i)}else t.slideTo(i)}var QCe={slideTo:GCe,slideToLoop:qCe,slideNext:YCe,slidePrev:ZCe,slideReset:XCe,slideToClosest:KCe,slideToClickedSlide:JCe};function eke(t,e){const n=this,{params:r,slidesEl:i}=n;if(!r.loop||n.virtual&&n.params.virtual.enabled)return;const o=()=>{yh(i,`.${r.slideClass}, swiper-slide`).forEach((p,m)=>{p.setAttribute("data-swiper-slide-index",m)})},s=n.grid&&r.grid&&r.grid.rows>1,a=r.slidesPerGroup*(s?r.grid.rows:1),l=n.slides.length%a!==0,c=s&&n.slides.length%r.grid.rows!==0,u=d=>{for(let p=0;p1;u.length"u"?o=c.getSlideIndex(u.find(U=>U.classList.contains(y.slideActiveClass))):$=o;const W=r==="next"||!r,J=r==="prev"||!r;let Z=0,q=0;const G=(E?u[o].column:o)+(w&&typeof i>"u"?-C/2+.5:0);if(G=0;le-=1)u[le].column===re&&A.push(le)}else A.push(O-Q-1)}}else if(G+C>O-M){q=Math.max(G-(O-M*2),S),z&&(q=Math.max(q,C-O+x+1));for(let U=0;U{re.column===Q&&I.push(le)}):I.push(Q)}}if(c.__preventObserver__=!0,requestAnimationFrame(()=>{c.__preventObserver__=!1}),c.params.effect==="cards"&&u.length{u[U].swiperLoopMoveDOM=!0,m.prepend(u[U]),u[U].swiperLoopMoveDOM=!1}),W&&I.forEach(U=>{u[U].swiperLoopMoveDOM=!0,m.append(u[U]),u[U].swiperLoopMoveDOM=!1}),c.recalcSlides(),y.slidesPerView==="auto"?c.updateSlides():E&&(A.length>0&&J||I.length>0&&W)&&c.slides.forEach((U,Q)=>{c.grid.updateSlide(Q,U,c.slides)}),y.watchSlidesProgress&&c.updateSlidesOffset(),n){if(A.length>0&&J){if(typeof e>"u"){const U=c.slidesGrid[$],re=c.slidesGrid[$+Z]-U;l?c.setTranslate(c.translate-re):(c.slideTo($+Math.ceil(Z),0,!1,!0),i&&(c.touchEventsData.startTranslate=c.touchEventsData.startTranslate-re,c.touchEventsData.currentTranslate=c.touchEventsData.currentTranslate-re))}else if(i){const U=E?A.length/y.grid.rows:A.length;c.slideTo(c.activeIndex+U,0,!1,!0),c.touchEventsData.currentTranslate=c.translate}}else if(I.length>0&&W)if(typeof e>"u"){const U=c.slidesGrid[$],re=c.slidesGrid[$-q]-U;l?c.setTranslate(c.translate-re):(c.slideTo($-q,0,!1,!0),i&&(c.touchEventsData.startTranslate=c.touchEventsData.startTranslate-re,c.touchEventsData.currentTranslate=c.touchEventsData.currentTranslate-re))}else{const U=E?I.length/y.grid.rows:I.length;c.slideTo(c.activeIndex-U,0,!1,!0)}}if(c.allowSlidePrev=d,c.allowSlideNext=p,c.controller&&c.controller.control&&!a){const U={slideRealIndex:e,direction:r,setTranslate:i,activeSlideIndex:o,byController:!0};Array.isArray(c.controller.control)?c.controller.control.forEach(Q=>{!Q.destroyed&&Q.params.loop&&Q.loopFix({...U,slideTo:Q.params.slidesPerView===y.slidesPerView?n:!1})}):c.controller.control instanceof c.constructor&&c.controller.control.params.loop&&c.controller.control.loopFix({...U,slideTo:c.controller.control.params.slidesPerView===y.slidesPerView?n:!1})}c.emit("loopFix")}function nke(){const t=this,{params:e,slidesEl:n}=t;if(!e.loop||!n||t.virtual&&t.params.virtual.enabled)return;t.recalcSlides();const r=[];t.slides.forEach(i=>{const o=typeof i.swiperSlideIndex>"u"?i.getAttribute("data-swiper-slide-index")*1:i.swiperSlideIndex;r[o]=i}),t.slides.forEach(i=>{i.removeAttribute("data-swiper-slide-index")}),r.forEach(i=>{n.append(i)}),t.recalcSlides(),t.slideTo(t.realIndex,0)}var rke={loopCreate:eke,loopFix:tke,loopDestroy:nke};function ike(t){const e=this;if(!e.params.simulateTouch||e.params.watchOverflow&&e.isLocked||e.params.cssMode)return;const n=e.params.touchEventsTarget==="container"?e.el:e.wrapperEl;e.isElement&&(e.__preventObserver__=!0),n.style.cursor="move",n.style.cursor=t?"grabbing":"grab",e.isElement&&requestAnimationFrame(()=>{e.__preventObserver__=!1})}function oke(){const t=this;t.params.watchOverflow&&t.isLocked||t.params.cssMode||(t.isElement&&(t.__preventObserver__=!0),t[t.params.touchEventsTarget==="container"?"el":"wrapperEl"].style.cursor="",t.isElement&&requestAnimationFrame(()=>{t.__preventObserver__=!1}))}var ske={setGrabCursor:ike,unsetGrabCursor:oke};function ake(t,e){e===void 0&&(e=this);function n(r){if(!r||r===gh()||r===kl())return null;r.assignedSlot&&(r=r.assignedSlot);const i=r.closest(t);return!i&&!r.getRootNode?null:i||n(r.getRootNode().host)}return n(e)}function Gj(t,e,n){const r=kl(),{params:i}=t,o=i.edgeSwipeDetection,s=i.edgeSwipeThreshold;return o&&(n<=s||n>=r.innerWidth-s)?o==="prevent"?(e.preventDefault(),!0):!1:!0}function lke(t){const e=this,n=gh();let r=t;r.originalEvent&&(r=r.originalEvent);const i=e.touchEventsData;if(r.type==="pointerdown"){if(i.pointerId!==null&&i.pointerId!==r.pointerId)return;i.pointerId=r.pointerId}else r.type==="touchstart"&&r.targetTouches.length===1&&(i.touchId=r.targetTouches[0].identifier);if(r.type==="touchstart"){Gj(e,r,r.targetTouches[0].pageX);return}const{params:o,touches:s,enabled:a}=e;if(!a||!o.simulateTouch&&r.pointerType==="mouse"||e.animating&&o.preventInteractionOnTransition)return;!e.animating&&o.cssMode&&o.loop&&e.loopFix();let l=r.target;if(o.touchEventsTarget==="wrapper"&&!gCe(l,e.wrapperEl)||"which"in r&&r.which===3||"button"in r&&r.button>0||i.isTouched&&i.isMoved)return;const c=!!o.noSwipingClass&&o.noSwipingClass!=="",u=r.composedPath?r.composedPath():r.path;c&&r.target&&r.target.shadowRoot&&u&&(l=u[0]);const d=o.noSwipingSelector?o.noSwipingSelector:`.${o.noSwipingClass}`,p=!!(r.target&&r.target.shadowRoot);if(o.noSwiping&&(p?ake(d,l):l.closest(d))){e.allowClick=!0;return}if(o.swipeHandler&&!l.closest(o.swipeHandler))return;s.currentX=r.pageX,s.currentY=r.pageY;const m=s.currentX,y=s.currentY;if(!Gj(e,r,m))return;Object.assign(i,{isTouched:!0,isMoved:!1,allowTouchCallbacks:!0,isScrolling:void 0,startMoving:void 0}),s.startX=m,s.startY=y,i.touchStartTime=Fg(),e.allowClick=!0,e.updateSize(),e.swipeDirection=void 0,o.threshold>0&&(i.allowThresholdMove=!1);let w=!0;l.matches(i.focusableElements)&&(w=!1,l.nodeName==="SELECT"&&(i.isTouched=!1)),n.activeElement&&n.activeElement.matches(i.focusableElements)&&n.activeElement!==l&&(r.pointerType==="mouse"||r.pointerType!=="mouse"&&!l.matches(i.focusableElements))&&n.activeElement.blur();const x=w&&e.allowTouchMove&&o.touchStartPreventDefault;(o.touchStartForcePreventDefault||x)&&!l.isContentEditable&&r.preventDefault(),o.freeMode&&o.freeMode.enabled&&e.freeMode&&e.animating&&!o.cssMode&&e.freeMode.onTouchStart(),e.emit("touchStart",r)}function cke(t){const e=gh(),n=this,r=n.touchEventsData,{params:i,touches:o,rtlTranslate:s,enabled:a}=n;if(!a||!i.simulateTouch&&t.pointerType==="mouse")return;let l=t;if(l.originalEvent&&(l=l.originalEvent),l.type==="pointermove"&&(r.touchId!==null||l.pointerId!==r.pointerId))return;let c;if(l.type==="touchmove"){if(c=[...l.changedTouches].find(A=>A.identifier===r.touchId),!c||c.identifier!==r.touchId)return}else c=l;if(!r.isTouched){r.startMoving&&r.isScrolling&&n.emit("touchMoveOpposite",l);return}const u=c.pageX,d=c.pageY;if(l.preventedByNestedSwiper){o.startX=u,o.startY=d;return}if(!n.allowTouchMove){l.target.matches(r.focusableElements)||(n.allowClick=!1),r.isTouched&&(Object.assign(o,{startX:u,startY:d,currentX:u,currentY:d}),r.touchStartTime=Fg());return}if(i.touchReleaseOnEdges&&!i.loop)if(n.isVertical()){if(do.startY&&n.translate>=n.minTranslate()){r.isTouched=!1,r.isMoved=!1;return}}else{if(s&&(u>o.startX&&-n.translate<=n.maxTranslate()||u=n.minTranslate()))return;if(!s&&(uo.startX&&n.translate>=n.minTranslate()))return}if(e.activeElement&&e.activeElement.matches(r.focusableElements)&&e.activeElement!==l.target&&l.pointerType!=="mouse"&&e.activeElement.blur(),e.activeElement&&l.target===e.activeElement&&l.target.matches(r.focusableElements)){r.isMoved=!0,n.allowClick=!1;return}r.allowTouchCallbacks&&n.emit("touchMove",l),o.previousX=o.currentX,o.previousY=o.currentY,o.currentX=u,o.currentY=d;const p=o.currentX-o.startX,m=o.currentY-o.startY;if(n.params.threshold&&Math.sqrt(p**2+m**2)"u"){let A;n.isHorizontal()&&o.currentY===o.startY||n.isVertical()&&o.currentX===o.startX?r.isScrolling=!1:p*p+m*m>=25&&(A=Math.atan2(Math.abs(m),Math.abs(p))*180/Math.PI,r.isScrolling=n.isHorizontal()?A>i.touchAngle:90-A>i.touchAngle)}if(r.isScrolling&&n.emit("touchMoveOpposite",l),typeof r.startMoving>"u"&&(o.currentX!==o.startX||o.currentY!==o.startY)&&(r.startMoving=!0),r.isScrolling||l.type==="touchmove"&&r.preventTouchMoveFromPointerMove){r.isTouched=!1;return}if(!r.startMoving)return;n.allowClick=!1,!i.cssMode&&l.cancelable&&l.preventDefault(),i.touchMoveStopPropagation&&!i.nested&&l.stopPropagation();let y=n.isHorizontal()?p:m,w=n.isHorizontal()?o.currentX-o.previousX:o.currentY-o.previousY;i.oneWayMovement&&(y=Math.abs(y)*(s?1:-1),w=Math.abs(w)*(s?1:-1)),o.diff=y,y*=i.touchRatio,s&&(y=-y,w=-w);const x=n.touchesDirection;n.swipeDirection=y>0?"prev":"next",n.touchesDirection=w>0?"prev":"next";const C=n.params.loop&&!i.cssMode,S=n.touchesDirection==="next"&&n.allowSlideNext||n.touchesDirection==="prev"&&n.allowSlidePrev;if(!r.isMoved){if(C&&S&&n.loopFix({direction:n.swipeDirection}),r.startTranslate=n.getTranslate(),n.setTransition(0),n.animating){const A=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0,detail:{bySwiperTouchMove:!0}});n.wrapperEl.dispatchEvent(A)}r.allowMomentumBounce=!1,i.grabCursor&&(n.allowSlideNext===!0||n.allowSlidePrev===!0)&&n.setGrabCursor(!0),n.emit("sliderFirstMove",l)}if(new Date().getTime(),i._loopSwapReset!==!1&&r.isMoved&&r.allowThresholdMove&&x!==n.touchesDirection&&C&&S&&Math.abs(y)>=1){Object.assign(o,{startX:u,startY:d,currentX:u,currentY:d,startTranslate:r.currentTranslate}),r.loopSwapReset=!0,r.startTranslate=r.currentTranslate;return}n.emit("sliderMove",l),r.isMoved=!0,r.currentTranslate=y+r.startTranslate;let M=!0,E=i.resistanceRatio;if(i.touchReleaseOnEdges&&(E=0),y>0?(C&&S&&r.allowThresholdMove&&r.currentTranslate>(i.centeredSlides?n.minTranslate()-n.slidesSizesGrid[n.activeIndex+1]-(i.slidesPerView!=="auto"&&n.slides.length-i.slidesPerView>=2?n.slidesSizesGrid[n.activeIndex+1]+n.params.spaceBetween:0)-n.params.spaceBetween:n.minTranslate())&&n.loopFix({direction:"prev",setTranslate:!0,activeSlideIndex:0}),r.currentTranslate>n.minTranslate()&&(M=!1,i.resistance&&(r.currentTranslate=n.minTranslate()-1+(-n.minTranslate()+r.startTranslate+y)**E))):y<0&&(C&&S&&r.allowThresholdMove&&r.currentTranslate<(i.centeredSlides?n.maxTranslate()+n.slidesSizesGrid[n.slidesSizesGrid.length-1]+n.params.spaceBetween+(i.slidesPerView!=="auto"&&n.slides.length-i.slidesPerView>=2?n.slidesSizesGrid[n.slidesSizesGrid.length-1]+n.params.spaceBetween:0):n.maxTranslate())&&n.loopFix({direction:"next",setTranslate:!0,activeSlideIndex:n.slides.length-(i.slidesPerView==="auto"?n.slidesPerViewDynamic():Math.ceil(parseFloat(i.slidesPerView,10)))}),r.currentTranslater.startTranslate&&(r.currentTranslate=r.startTranslate),!n.allowSlidePrev&&!n.allowSlideNext&&(r.currentTranslate=r.startTranslate),i.threshold>0)if(Math.abs(y)>i.threshold||r.allowThresholdMove){if(!r.allowThresholdMove){r.allowThresholdMove=!0,o.startX=o.currentX,o.startY=o.currentY,r.currentTranslate=r.startTranslate,o.diff=n.isHorizontal()?o.currentX-o.startX:o.currentY-o.startY;return}}else{r.currentTranslate=r.startTranslate;return}!i.followFinger||i.cssMode||((i.freeMode&&i.freeMode.enabled&&n.freeMode||i.watchSlidesProgress)&&(n.updateActiveIndex(),n.updateSlidesClasses()),i.freeMode&&i.freeMode.enabled&&n.freeMode&&n.freeMode.onTouchMove(),n.updateProgress(r.currentTranslate),n.setTranslate(r.currentTranslate))}function uke(t){const e=this,n=e.touchEventsData;let r=t;r.originalEvent&&(r=r.originalEvent);let i;if(r.type==="touchend"||r.type==="touchcancel"){if(i=[...r.changedTouches].find(A=>A.identifier===n.touchId),!i||i.identifier!==n.touchId)return}else{if(n.touchId!==null||r.pointerId!==n.pointerId)return;i=r}if(["pointercancel","pointerout","pointerleave","contextmenu"].includes(r.type)&&!(["pointercancel","contextmenu"].includes(r.type)&&(e.browser.isSafari||e.browser.isWebView)))return;n.pointerId=null,n.touchId=null;const{params:s,touches:a,rtlTranslate:l,slidesGrid:c,enabled:u}=e;if(!u||!s.simulateTouch&&r.pointerType==="mouse")return;if(n.allowTouchCallbacks&&e.emit("touchEnd",r),n.allowTouchCallbacks=!1,!n.isTouched){n.isMoved&&s.grabCursor&&e.setGrabCursor(!1),n.isMoved=!1,n.startMoving=!1;return}s.grabCursor&&n.isMoved&&n.isTouched&&(e.allowSlideNext===!0||e.allowSlidePrev===!0)&&e.setGrabCursor(!1);const d=Fg(),p=d-n.touchStartTime;if(e.allowClick){const A=r.path||r.composedPath&&r.composedPath();e.updateClickedSlide(A&&A[0]||r.target,A),e.emit("tap click",r),p<300&&d-n.lastClickTime<300&&e.emit("doubleTap doubleClick",r)}if(n.lastClickTime=Fg(),z2(()=>{e.destroyed||(e.allowClick=!0)}),!n.isTouched||!n.isMoved||!e.swipeDirection||a.diff===0&&!n.loopSwapReset||n.currentTranslate===n.startTranslate&&!n.loopSwapReset){n.isTouched=!1,n.isMoved=!1,n.startMoving=!1;return}n.isTouched=!1,n.isMoved=!1,n.startMoving=!1;let m;if(s.followFinger?m=l?e.translate:-e.translate:m=-n.currentTranslate,s.cssMode)return;if(s.freeMode&&s.freeMode.enabled){e.freeMode.onTouchEnd({currentPos:m});return}const y=m>=-e.maxTranslate()&&!e.params.loop;let w=0,x=e.slidesSizesGrid[0];for(let A=0;A=c[A]&&m=c[A])&&(w=A,x=c[c.length-1]-c[c.length-2])}let C=null,S=null;s.rewind&&(e.isBeginning?S=s.virtual&&s.virtual.enabled&&e.virtual?e.virtual.slides.length-1:e.slides.length-1:e.isEnd&&(C=0));const M=(m-c[w])/x,E=ws.longSwipesMs){if(!s.longSwipes){e.slideTo(e.activeIndex);return}e.swipeDirection==="next"&&(M>=s.longSwipesRatio?e.slideTo(s.rewind&&e.isEnd?C:w+E):e.slideTo(w)),e.swipeDirection==="prev"&&(M>1-s.longSwipesRatio?e.slideTo(w+E):S!==null&&M<0&&Math.abs(M)>s.longSwipesRatio?e.slideTo(S):e.slideTo(w))}else{if(!s.shortSwipes){e.slideTo(e.activeIndex);return}e.navigation&&(r.target===e.navigation.nextEl||r.target===e.navigation.prevEl)?r.target===e.navigation.nextEl?e.slideTo(w+E):e.slideTo(w):(e.swipeDirection==="next"&&e.slideTo(C!==null?C:w+E),e.swipeDirection==="prev"&&e.slideTo(S!==null?S:w))}}function qj(){const t=this,{params:e,el:n}=t;if(n&&n.offsetWidth===0)return;e.breakpoints&&t.setBreakpoint();const{allowSlideNext:r,allowSlidePrev:i,snapGrid:o}=t,s=t.virtual&&t.params.virtual.enabled;t.allowSlideNext=!0,t.allowSlidePrev=!0,t.updateSize(),t.updateSlides(),t.updateSlidesClasses();const a=s&&e.loop;(e.slidesPerView==="auto"||e.slidesPerView>1)&&t.isEnd&&!t.isBeginning&&!t.params.centeredSlides&&!a?t.slideTo(t.slides.length-1,0,!1,!0):t.params.loop&&!s?t.slideToLoop(t.realIndex,0,!1,!0):t.slideTo(t.activeIndex,0,!1,!0),t.autoplay&&t.autoplay.running&&t.autoplay.paused&&(clearTimeout(t.autoplay.resizeTimeout),t.autoplay.resizeTimeout=setTimeout(()=>{t.autoplay&&t.autoplay.running&&t.autoplay.paused&&t.autoplay.resume()},500)),t.allowSlidePrev=i,t.allowSlideNext=r,t.params.watchOverflow&&o!==t.snapGrid&&t.checkOverflow()}function hke(t){const e=this;e.enabled&&(e.allowClick||(e.params.preventClicks&&t.preventDefault(),e.params.preventClicksPropagation&&e.animating&&(t.stopPropagation(),t.stopImmediatePropagation())))}function dke(){const t=this,{wrapperEl:e,rtlTranslate:n,enabled:r}=t;if(!r)return;t.previousTranslate=t.translate,t.isHorizontal()?t.translate=-e.scrollLeft:t.translate=-e.scrollTop,t.translate===0&&(t.translate=0),t.updateActiveIndex(),t.updateSlidesClasses();let i;const o=t.maxTranslate()-t.minTranslate();o===0?i=0:i=(t.translate-t.minTranslate())/o,i!==t.progress&&t.updateProgress(n?-t.translate:t.translate),t.emit("setTranslate",t.translate,!1)}function fke(t){const e=this;ak(e,t.target),!(e.params.cssMode||e.params.slidesPerView!=="auto"&&!e.params.autoHeight)&&e.update()}function pke(){const t=this;t.documentTouchHandlerProceeded||(t.documentTouchHandlerProceeded=!0,t.params.touchReleaseOnEdges&&(t.el.style.touchAction="auto"))}const Yj=(t,e)=>{const n=gh(),{params:r,el:i,wrapperEl:o,device:s}=t,a=!!r.nested,l=e==="on"?"addEventListener":"removeEventListener",c=e;!i||typeof i=="string"||(n[l]("touchstart",t.onDocumentTouchStart,{passive:!1,capture:a}),i[l]("touchstart",t.onTouchStart,{passive:!1}),i[l]("pointerdown",t.onTouchStart,{passive:!1}),n[l]("touchmove",t.onTouchMove,{passive:!1,capture:a}),n[l]("pointermove",t.onTouchMove,{passive:!1,capture:a}),n[l]("touchend",t.onTouchEnd,{passive:!0}),n[l]("pointerup",t.onTouchEnd,{passive:!0}),n[l]("pointercancel",t.onTouchEnd,{passive:!0}),n[l]("touchcancel",t.onTouchEnd,{passive:!0}),n[l]("pointerout",t.onTouchEnd,{passive:!0}),n[l]("pointerleave",t.onTouchEnd,{passive:!0}),n[l]("contextmenu",t.onTouchEnd,{passive:!0}),(r.preventClicks||r.preventClicksPropagation)&&i[l]("click",t.onClick,!0),r.cssMode&&o[l]("scroll",t.onScroll),r.updateOnWindowResize?t[c](s.ios||s.android?"resize orientationchange observerUpdate":"resize observerUpdate",qj,!0):t[c]("observerUpdate",qj,!0),i[l]("load",t.onLoad,{capture:!0}))};function mke(){const t=this,{params:e}=t;t.onTouchStart=lke.bind(t),t.onTouchMove=cke.bind(t),t.onTouchEnd=uke.bind(t),t.onDocumentTouchStart=pke.bind(t),e.cssMode&&(t.onScroll=dke.bind(t)),t.onClick=hke.bind(t),t.onLoad=fke.bind(t),Yj(t,"on")}function gke(){Yj(this,"off")}var yke={attachEvents:mke,detachEvents:gke};const Zj=(t,e)=>t.grid&&e.grid&&e.grid.rows>1;function vke(){const t=this,{realIndex:e,initialized:n,params:r,el:i}=t,o=r.breakpoints;if(!o||o&&Object.keys(o).length===0)return;const s=gh(),a=r.breakpointsBase==="window"||!r.breakpointsBase?r.breakpointsBase:"container",l=["window","container"].includes(r.breakpointsBase)||!r.breakpointsBase?t.el:s.querySelector(r.breakpointsBase),c=t.getBreakpoint(o,a,l);if(!c||t.currentBreakpoint===c)return;const d=(c in o?o[c]:void 0)||t.originalParams,p=Zj(t,r),m=Zj(t,d),y=t.params.grabCursor,w=d.grabCursor,x=r.enabled;p&&!m?(i.classList.remove(`${r.containerModifierClass}grid`,`${r.containerModifierClass}grid-column`),t.emitContainerClasses()):!p&&m&&(i.classList.add(`${r.containerModifierClass}grid`),(d.grid.fill&&d.grid.fill==="column"||!d.grid.fill&&r.grid.fill==="column")&&i.classList.add(`${r.containerModifierClass}grid-column`),t.emitContainerClasses()),y&&!w?t.unsetGrabCursor():!y&&w&&t.setGrabCursor(),["navigation","pagination","scrollbar"].forEach(I=>{if(typeof d[I]>"u")return;const O=r[I]&&r[I].enabled,z=d[I]&&d[I].enabled;O&&!z&&t[I].disable(),!O&&z&&t[I].enable()});const C=d.direction&&d.direction!==r.direction,S=r.loop&&(d.slidesPerView!==r.slidesPerView||C),M=r.loop;C&&n&&t.changeDirection(),Rc(t.params,d);const E=t.params.enabled,A=t.params.loop;Object.assign(t,{allowTouchMove:t.params.allowTouchMove,allowSlideNext:t.params.allowSlideNext,allowSlidePrev:t.params.allowSlidePrev}),x&&!E?t.disable():!x&&E&&t.enable(),t.currentBreakpoint=c,t.emit("_beforeBreakpoint",d),n&&(S?(t.loopDestroy(),t.loopCreate(e),t.updateSlides()):!M&&A?(t.loopCreate(e),t.updateSlides()):M&&!A&&t.loopDestroy()),t.emit("breakpoint",d)}function _ke(t,e,n){if(e===void 0&&(e="window"),!t||e==="container"&&!n)return;let r=!1;const i=kl(),o=e==="window"?i.innerHeight:n.clientHeight,s=Object.keys(t).map(a=>{if(typeof a=="string"&&a.indexOf("@")===0){const l=parseFloat(a.substr(1));return{value:o*l,point:a}}return{value:a,point:a}});s.sort((a,l)=>parseInt(a.value,10)-parseInt(l.value,10));for(let a=0;a{typeof r=="object"?Object.keys(r).forEach(i=>{r[i]&&n.push(e+i)}):typeof r=="string"&&n.push(e+r)}),n}function xke(){const t=this,{classNames:e,params:n,rtl:r,el:i,device:o}=t,s=wke(["initialized",n.direction,{"free-mode":t.params.freeMode&&n.freeMode.enabled},{autoheight:n.autoHeight},{rtl:r},{grid:n.grid&&n.grid.rows>1},{"grid-column":n.grid&&n.grid.rows>1&&n.grid.fill==="column"},{android:o.android},{ios:o.ios},{"css-mode":n.cssMode},{centered:n.cssMode&&n.centeredSlides},{"watch-progress":n.watchSlidesProgress}],n.containerModifierClass);e.push(...s),i.classList.add(...e),t.emitContainerClasses()}function Eke(){const t=this,{el:e,classNames:n}=t;!e||typeof e=="string"||(e.classList.remove(...n),t.emitContainerClasses())}var Ske={addClasses:xke,removeClasses:Eke};function Cke(){const t=this,{isLocked:e,params:n}=t,{slidesOffsetBefore:r}=n;if(r){const i=t.slides.length-1,o=t.slidesGrid[i]+t.slidesSizesGrid[i]+r*2;t.isLocked=t.size>o}else t.isLocked=t.snapGrid.length===1;n.allowSlideNext===!0&&(t.allowSlideNext=!t.isLocked),n.allowSlidePrev===!0&&(t.allowSlidePrev=!t.isLocked),e&&e!==t.isLocked&&(t.isEnd=!1),e!==t.isLocked&&t.emit(t.isLocked?"lock":"unlock")}var kke={checkOverflow:Cke},Z2={init:!0,direction:"horizontal",oneWayMovement:!1,swiperElementNodeName:"SWIPER-CONTAINER",touchEventsTarget:"wrapper",initialSlide:0,speed:300,cssMode:!1,updateOnWindowResize:!0,resizeObserver:!0,nested:!1,createElements:!1,eventsPrefix:"swiper",enabled:!0,focusableElements:"input, select, option, textarea, button, video, label",width:null,height:null,preventInteractionOnTransition:!1,userAgent:null,url:null,edgeSwipeDetection:!1,edgeSwipeThreshold:20,autoHeight:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",breakpoints:void 0,breakpointsBase:"window",spaceBetween:0,slidesPerView:1,slidesPerGroup:1,slidesPerGroupSkip:0,slidesPerGroupAuto:!1,centeredSlides:!1,centeredSlidesBounds:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,normalizeSlideIndex:!0,centerInsufficientSlides:!1,watchOverflow:!0,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,allowTouchMove:!0,threshold:5,touchMoveStopPropagation:!1,touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchReleaseOnEdges:!1,uniqueNavElements:!0,resistance:!0,resistanceRatio:.85,watchSlidesProgress:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,loop:!1,loopAddBlankSlides:!0,loopAdditionalSlides:0,loopPreventsSliding:!0,rewind:!1,allowSlidePrev:!0,allowSlideNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:null,passiveListeners:!0,maxBackfaceHiddenSlides:10,containerModifierClass:"swiper-",slideClass:"swiper-slide",slideBlankClass:"swiper-slide-blank",slideActiveClass:"swiper-slide-active",slideVisibleClass:"swiper-slide-visible",slideFullyVisibleClass:"swiper-slide-fully-visible",slideNextClass:"swiper-slide-next",slidePrevClass:"swiper-slide-prev",wrapperClass:"swiper-wrapper",lazyPreloaderClass:"swiper-lazy-preloader",lazyPreloadPrevNext:0,runCallbacksOnInit:!0,_emitClasses:!1};function Tke(t,e){return function(r){r===void 0&&(r={});const i=Object.keys(r)[0],o=r[i];if(typeof o!="object"||o===null){Rc(e,r);return}if(t[i]===!0&&(t[i]={enabled:!0}),i==="navigation"&&t[i]&&t[i].enabled&&!t[i].prevEl&&!t[i].nextEl&&(t[i].auto=!0),["pagination","scrollbar"].indexOf(i)>=0&&t[i]&&t[i].enabled&&!t[i].el&&(t[i].auto=!0),!(i in t&&"enabled"in o)){Rc(e,r);return}typeof t[i]=="object"&&!("enabled"in t[i])&&(t[i].enabled=!0),t[i]||(t[i]={enabled:!1}),Rc(e,r)}}const X2={eventsEmitter:SCe,update:DCe,translate:VCe,transition:WCe,slide:QCe,loop:rke,grabCursor:ske,events:yke,breakpoints:bke,checkOverflow:kke,classes:Ske},K2={};let J2=class sp{constructor(){let e,n;for(var r=arguments.length,i=new Array(r),o=0;o1){const u=[];return s.querySelectorAll(n.el).forEach(d=>{const p=Rc({},n,{el:d});u.push(new sp(p))}),u}const a=this;a.__swiper__=!0,a.support=Vj(),a.device=jj({userAgent:n.userAgent}),a.browser=Uj(),a.eventsListeners={},a.eventsAnyListeners=[],a.modules=[...a.__modules__],n.modules&&Array.isArray(n.modules)&&a.modules.push(...n.modules);const l={};a.modules.forEach(u=>{u({params:n,swiper:a,extendParams:Tke(n,l),on:a.on.bind(a),once:a.once.bind(a),off:a.off.bind(a),emit:a.emit.bind(a)})});const c=Rc({},Z2,l);return a.params=Rc({},c,K2,n),a.originalParams=Rc({},a.params),a.passedParams=Rc({},n),a.params&&a.params.on&&Object.keys(a.params.on).forEach(u=>{a.on(u,a.params.on[u])}),a.params&&a.params.onAny&&a.onAny(a.params.onAny),Object.assign(a,{enabled:a.params.enabled,el:e,classNames:[],slides:[],slidesGrid:[],snapGrid:[],slidesSizesGrid:[],isHorizontal(){return a.params.direction==="horizontal"},isVertical(){return a.params.direction==="vertical"},activeIndex:0,realIndex:0,isBeginning:!0,isEnd:!1,translate:0,previousTranslate:0,progress:0,velocity:0,animating:!1,cssOverflowAdjustment(){return Math.trunc(this.translate/2**23)*2**23},allowSlideNext:a.params.allowSlideNext,allowSlidePrev:a.params.allowSlidePrev,touchEventsData:{isTouched:void 0,isMoved:void 0,allowTouchCallbacks:void 0,touchStartTime:void 0,isScrolling:void 0,currentTranslate:void 0,startTranslate:void 0,allowThresholdMove:void 0,focusableElements:a.params.focusableElements,lastClickTime:0,clickTimeout:void 0,velocities:[],allowMomentumBounce:void 0,startMoving:void 0,pointerId:null,touchId:null},allowClick:!0,allowTouchMove:a.params.allowTouchMove,touches:{startX:0,startY:0,currentX:0,currentY:0,diff:0},imagesToLoad:[],imagesLoaded:0}),a.emit("_swiper"),a.params.init&&a.init(),a}getDirectionLabel(e){return this.isHorizontal()?e:{width:"height","margin-top":"margin-left","margin-bottom ":"margin-right","margin-left":"margin-top","margin-right":"margin-bottom","padding-left":"padding-top","padding-right":"padding-bottom",marginRight:"marginBottom"}[e]}getSlideIndex(e){const{slidesEl:n,params:r}=this,i=yh(n,`.${r.slideClass}, swiper-slide`),o=ok(i[0]);return ok(e)-o}getSlideIndexByData(e){return this.getSlideIndex(this.slides.find(n=>n.getAttribute("data-swiper-slide-index")*1===e))}recalcSlides(){const e=this,{slidesEl:n,params:r}=e;e.slides=yh(n,`.${r.slideClass}, swiper-slide`)}enable(){const e=this;e.enabled||(e.enabled=!0,e.params.grabCursor&&e.setGrabCursor(),e.emit("enable"))}disable(){const e=this;e.enabled&&(e.enabled=!1,e.params.grabCursor&&e.unsetGrabCursor(),e.emit("disable"))}setProgress(e,n){const r=this;e=Math.min(Math.max(e,0),1);const i=r.minTranslate(),s=(r.maxTranslate()-i)*e+i;r.translateTo(s,typeof n>"u"?0:n),r.updateActiveIndex(),r.updateSlidesClasses()}emitContainerClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const n=e.el.className.split(" ").filter(r=>r.indexOf("swiper")===0||r.indexOf(e.params.containerModifierClass)===0);e.emit("_containerClasses",n.join(" "))}getSlideClasses(e){const n=this;return n.destroyed?"":e.className.split(" ").filter(r=>r.indexOf("swiper-slide")===0||r.indexOf(n.params.slideClass)===0).join(" ")}emitSlidesClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const n=[];e.slides.forEach(r=>{const i=e.getSlideClasses(r);n.push({slideEl:r,classNames:i}),e.emit("_slideClass",r,i)}),e.emit("_slideClasses",n)}slidesPerViewDynamic(e,n){e===void 0&&(e="current"),n===void 0&&(n=!1);const r=this,{params:i,slides:o,slidesGrid:s,slidesSizesGrid:a,size:l,activeIndex:c}=r;let u=1;if(typeof i.slidesPerView=="number")return i.slidesPerView;if(i.centeredSlides){let d=o[c]?Math.ceil(o[c].swiperSlideSize):0,p;for(let m=c+1;ml&&(p=!0));for(let m=c-1;m>=0;m-=1)o[m]&&!p&&(d+=o[m].swiperSlideSize,u+=1,d>l&&(p=!0))}else if(e==="current")for(let d=c+1;d=0;d-=1)s[c]-s[d]{s.complete&&ak(e,s)}),e.updateSize(),e.updateSlides(),e.updateProgress(),e.updateSlidesClasses();function i(){const s=e.rtlTranslate?e.translate*-1:e.translate,a=Math.min(Math.max(s,e.maxTranslate()),e.minTranslate());e.setTranslate(a),e.updateActiveIndex(),e.updateSlidesClasses()}let o;if(r.freeMode&&r.freeMode.enabled&&!r.cssMode)i(),r.autoHeight&&e.updateAutoHeight();else{if((r.slidesPerView==="auto"||r.slidesPerView>1)&&e.isEnd&&!r.centeredSlides){const s=e.virtual&&r.virtual.enabled?e.virtual.slides:e.slides;o=e.slideTo(s.length-1,0,!1,!0)}else o=e.slideTo(e.activeIndex,0,!1,!0);o||i()}r.watchOverflow&&n!==e.snapGrid&&e.checkOverflow(),e.emit("update")}changeDirection(e,n){n===void 0&&(n=!0);const r=this,i=r.params.direction;return e||(e=i==="horizontal"?"vertical":"horizontal"),e===i||e!=="horizontal"&&e!=="vertical"||(r.el.classList.remove(`${r.params.containerModifierClass}${i}`),r.el.classList.add(`${r.params.containerModifierClass}${e}`),r.emitContainerClasses(),r.params.direction=e,r.slides.forEach(o=>{e==="vertical"?o.style.width="":o.style.height=""}),r.emit("changeDirection"),n&&r.update()),r}changeLanguageDirection(e){const n=this;n.rtl&&e==="rtl"||!n.rtl&&e==="ltr"||(n.rtl=e==="rtl",n.rtlTranslate=n.params.direction==="horizontal"&&n.rtl,n.rtl?(n.el.classList.add(`${n.params.containerModifierClass}rtl`),n.el.dir="rtl"):(n.el.classList.remove(`${n.params.containerModifierClass}rtl`),n.el.dir="ltr"),n.update())}mount(e){const n=this;if(n.mounted)return!0;let r=e||n.params.el;if(typeof r=="string"&&(r=document.querySelector(r)),!r)return!1;r.swiper=n,r.parentNode&&r.parentNode.host&&r.parentNode.host.nodeName===n.params.swiperElementNodeName.toUpperCase()&&(n.isElement=!0);const i=()=>`.${(n.params.wrapperClass||"").trim().split(" ").join(".")}`;let s=r&&r.shadowRoot&&r.shadowRoot.querySelector?r.shadowRoot.querySelector(i()):yh(r,i())[0];return!s&&n.params.createElements&&(s=ik("div",n.params.wrapperClass),r.append(s),yh(r,`.${n.params.slideClass}`).forEach(a=>{s.append(a)})),Object.assign(n,{el:r,wrapperEl:s,slidesEl:n.isElement&&!r.parentNode.host.slideSlots?r.parentNode.host:s,hostEl:n.isElement?r.parentNode.host:r,mounted:!0,rtl:r.dir.toLowerCase()==="rtl"||jp(r,"direction")==="rtl",rtlTranslate:n.params.direction==="horizontal"&&(r.dir.toLowerCase()==="rtl"||jp(r,"direction")==="rtl"),wrongRTL:jp(s,"display")==="-webkit-box"}),!0}init(e){const n=this;if(n.initialized||n.mount(e)===!1)return n;n.emit("beforeInit"),n.params.breakpoints&&n.setBreakpoint(),n.addClasses(),n.updateSize(),n.updateSlides(),n.params.watchOverflow&&n.checkOverflow(),n.params.grabCursor&&n.enabled&&n.setGrabCursor(),n.params.loop&&n.virtual&&n.params.virtual.enabled?n.slideTo(n.params.initialSlide+n.virtual.slidesBefore,0,n.params.runCallbacksOnInit,!1,!0):n.slideTo(n.params.initialSlide,0,n.params.runCallbacksOnInit,!1,!0),n.params.loop&&n.loopCreate(void 0,!0),n.attachEvents();const i=[...n.el.querySelectorAll('[loading="lazy"]')];return n.isElement&&i.push(...n.hostEl.querySelectorAll('[loading="lazy"]')),i.forEach(o=>{o.complete?ak(n,o):o.addEventListener("load",s=>{ak(n,s.target)})}),Y2(n),n.initialized=!0,Y2(n),n.emit("init"),n.emit("afterInit"),n}destroy(e,n){e===void 0&&(e=!0),n===void 0&&(n=!0);const r=this,{params:i,el:o,wrapperEl:s,slides:a}=r;return typeof r.params>"u"||r.destroyed||(r.emit("beforeDestroy"),r.initialized=!1,r.detachEvents(),i.loop&&r.loopDestroy(),n&&(r.removeClasses(),o&&typeof o!="string"&&o.removeAttribute("style"),s&&s.removeAttribute("style"),a&&a.length&&a.forEach(l=>{l.classList.remove(i.slideVisibleClass,i.slideFullyVisibleClass,i.slideActiveClass,i.slideNextClass,i.slidePrevClass),l.removeAttribute("style"),l.removeAttribute("data-swiper-slide-index")})),r.emit("destroy"),Object.keys(r.eventsListeners).forEach(l=>{r.off(l)}),e!==!1&&(r.el&&typeof r.el!="string"&&(r.el.swiper=null),hCe(r)),r.destroyed=!0),null}static extendDefaults(e){Rc(K2,e)}static get extendedDefaults(){return K2}static get defaults(){return Z2}static installModule(e){sp.prototype.__modules__||(sp.prototype.__modules__=[]);const n=sp.prototype.__modules__;typeof e=="function"&&n.indexOf(e)<0&&n.push(e)}static use(e){return Array.isArray(e)?(e.forEach(n=>sp.installModule(n)),sp):(sp.installModule(e),sp)}};Object.keys(X2).forEach(t=>{Object.keys(X2[t]).forEach(e=>{J2.prototype[e]=X2[t][e]})}),J2.use([xCe,ECe]);const Xj=["eventsPrefix","injectStyles","injectStylesUrls","modules","init","_direction","oneWayMovement","swiperElementNodeName","touchEventsTarget","initialSlide","_speed","cssMode","updateOnWindowResize","resizeObserver","nested","focusableElements","_enabled","_width","_height","preventInteractionOnTransition","userAgent","url","_edgeSwipeDetection","_edgeSwipeThreshold","_freeMode","_autoHeight","setWrapperSize","virtualTranslate","_effect","breakpoints","breakpointsBase","_spaceBetween","_slidesPerView","maxBackfaceHiddenSlides","_grid","_slidesPerGroup","_slidesPerGroupSkip","_slidesPerGroupAuto","_centeredSlides","_centeredSlidesBounds","_slidesOffsetBefore","_slidesOffsetAfter","normalizeSlideIndex","_centerInsufficientSlides","_watchOverflow","roundLengths","touchRatio","touchAngle","simulateTouch","_shortSwipes","_longSwipes","longSwipesRatio","longSwipesMs","_followFinger","allowTouchMove","_threshold","touchMoveStopPropagation","touchStartPreventDefault","touchStartForcePreventDefault","touchReleaseOnEdges","uniqueNavElements","_resistance","_resistanceRatio","_watchSlidesProgress","_grabCursor","preventClicks","preventClicksPropagation","_slideToClickedSlide","_loop","loopAdditionalSlides","loopAddBlankSlides","loopPreventsSliding","_rewind","_allowSlidePrev","_allowSlideNext","_swipeHandler","_noSwiping","noSwipingClass","noSwipingSelector","passiveListeners","containerModifierClass","slideClass","slideActiveClass","slideVisibleClass","slideFullyVisibleClass","slideNextClass","slidePrevClass","slideBlankClass","wrapperClass","lazyPreloaderClass","lazyPreloadPrevNext","runCallbacksOnInit","observer","observeParents","observeSlideChildren","a11y","_autoplay","_controller","coverflowEffect","cubeEffect","fadeEffect","flipEffect","creativeEffect","cardsEffect","hashNavigation","history","keyboard","mousewheel","_navigation","_pagination","parallax","_scrollbar","_thumbs","virtual","zoom","control"];function $g(t){return typeof t=="object"&&t!==null&&t.constructor&&Object.prototype.toString.call(t).slice(8,-1)==="Object"&&!t.__swiper__}function I0(t,e){const n=["__proto__","constructor","prototype"];Object.keys(e).filter(r=>n.indexOf(r)<0).forEach(r=>{typeof t[r]>"u"?t[r]=e[r]:$g(e[r])&&$g(t[r])&&Object.keys(e[r]).length>0?e[r].__swiper__?t[r]=e[r]:I0(t[r],e[r]):t[r]=e[r]})}function Kj(t){return t===void 0&&(t={}),t.navigation&&typeof t.navigation.nextEl>"u"&&typeof t.navigation.prevEl>"u"}function Jj(t){return t===void 0&&(t={}),t.pagination&&typeof t.pagination.el>"u"}function Qj(t){return t===void 0&&(t={}),t.scrollbar&&typeof t.scrollbar.el>"u"}function e9(t){t===void 0&&(t="");const e=t.split(" ").map(r=>r.trim()).filter(r=>!!r),n=[];return e.forEach(r=>{n.indexOf(r)<0&&n.push(r)}),n.join(" ")}function Mke(t){return t===void 0&&(t=""),t?t.includes("swiper-wrapper")?t:`swiper-wrapper ${t}`:"swiper-wrapper"}function Ake(t){let{swiper:e,slides:n,passedParams:r,changedParams:i,nextEl:o,prevEl:s,scrollbarEl:a,paginationEl:l}=t;const c=i.filter($=>$!=="children"&&$!=="direction"&&$!=="wrapperClass"),{params:u,pagination:d,navigation:p,scrollbar:m,virtual:y,thumbs:w}=e;let x,C,S,M,E,A,I,O;i.includes("thumbs")&&r.thumbs&&r.thumbs.swiper&&!r.thumbs.swiper.destroyed&&u.thumbs&&(!u.thumbs.swiper||u.thumbs.swiper.destroyed)&&(x=!0),i.includes("controller")&&r.controller&&r.controller.control&&u.controller&&!u.controller.control&&(C=!0),i.includes("pagination")&&r.pagination&&(r.pagination.el||l)&&(u.pagination||u.pagination===!1)&&d&&!d.el&&(S=!0),i.includes("scrollbar")&&r.scrollbar&&(r.scrollbar.el||a)&&(u.scrollbar||u.scrollbar===!1)&&m&&!m.el&&(M=!0),i.includes("navigation")&&r.navigation&&(r.navigation.prevEl||s)&&(r.navigation.nextEl||o)&&(u.navigation||u.navigation===!1)&&p&&!p.prevEl&&!p.nextEl&&(E=!0);const z=$=>{e[$]&&(e[$].destroy(),$==="navigation"?(e.isElement&&(e[$].prevEl.remove(),e[$].nextEl.remove()),u[$].prevEl=void 0,u[$].nextEl=void 0,e[$].prevEl=void 0,e[$].nextEl=void 0):(e.isElement&&e[$].el.remove(),u[$].el=void 0,e[$].el=void 0))};i.includes("loop")&&e.isElement&&(u.loop&&!r.loop?A=!0:!u.loop&&r.loop?I=!0:O=!0),c.forEach($=>{if($g(u[$])&&$g(r[$]))Object.assign(u[$],r[$]),($==="navigation"||$==="pagination"||$==="scrollbar")&&"enabled"in r[$]&&!r[$].enabled&&z($);else{const W=r[$];(W===!0||W===!1)&&($==="navigation"||$==="pagination"||$==="scrollbar")?W===!1&&z($):u[$]=r[$]}}),c.includes("controller")&&!C&&e.controller&&e.controller.control&&u.controller&&u.controller.control&&(e.controller.control=u.controller.control),i.includes("children")&&n&&y&&u.virtual.enabled?(y.slides=n,y.update(!0)):i.includes("virtual")&&y&&u.virtual.enabled&&(n&&(y.slides=n),y.update(!0)),i.includes("children")&&n&&u.loop&&(O=!0),x&&w.init()&&w.update(!0),C&&(e.controller.control=u.controller.control),S&&(e.isElement&&(!l||typeof l=="string")&&(l=document.createElement("div"),l.classList.add("swiper-pagination"),l.part.add("pagination"),e.el.appendChild(l)),l&&(u.pagination.el=l),d.init(),d.render(),d.update()),M&&(e.isElement&&(!a||typeof a=="string")&&(a=document.createElement("div"),a.classList.add("swiper-scrollbar"),a.part.add("scrollbar"),e.el.appendChild(a)),a&&(u.scrollbar.el=a),m.init(),m.updateSize(),m.setTranslate()),E&&(e.isElement&&((!o||typeof o=="string")&&(o=document.createElement("div"),o.classList.add("swiper-button-next"),sk(o,e.hostEl.constructor.nextButtonSvg),o.part.add("button-next"),e.el.appendChild(o)),(!s||typeof s=="string")&&(s=document.createElement("div"),s.classList.add("swiper-button-prev"),sk(s,e.hostEl.constructor.prevButtonSvg),s.part.add("button-prev"),e.el.appendChild(s))),o&&(u.navigation.nextEl=o),s&&(u.navigation.prevEl=s),p.init(),p.update()),i.includes("allowSlideNext")&&(e.allowSlideNext=r.allowSlideNext),i.includes("allowSlidePrev")&&(e.allowSlidePrev=r.allowSlidePrev),i.includes("direction")&&e.changeDirection(r.direction,!1),(A||O)&&e.loopDestroy(),(I||O)&&e.loopCreate(),e.update()}function t9(t,e){t===void 0&&(t={});const n={on:{}},r={},i={};I0(n,Z2),n._emitClasses=!0,n.init=!1;const o={},s=Xj.map(l=>l.replace(/_/,"")),a=Object.assign({},t);return Object.keys(a).forEach(l=>{typeof t[l]>"u"||(s.indexOf(l)>=0?$g(t[l])?(n[l]={},i[l]={},I0(n[l],t[l]),I0(i[l],t[l])):(n[l]=t[l],i[l]=t[l]):l.search(/on[A-Z]/)===0&&typeof t[l]=="function"?n.on[`${l[2].toLowerCase()}${l.substr(3)}`]=t[l]:o[l]=t[l])}),["navigation","pagination","scrollbar"].forEach(l=>{n[l]===!0&&(n[l]={}),n[l]===!1&&delete n[l]}),{params:n,passedParams:i,rest:o,events:r}}function Ike(t,e){let{el:n,nextEl:r,prevEl:i,paginationEl:o,scrollbarEl:s,swiper:a}=t;Kj(e)&&r&&i&&(a.params.navigation.nextEl=r,a.originalParams.navigation.nextEl=r,a.params.navigation.prevEl=i,a.originalParams.navigation.prevEl=i),Jj(e)&&o&&(a.params.pagination.el=o,a.originalParams.pagination.el=o),Qj(e)&&s&&(a.params.scrollbar.el=s,a.originalParams.scrollbar.el=s),a.init(n)}function Lke(t,e,n,r,i){const o=[];if(!e)return o;const s=l=>{o.indexOf(l)<0&&o.push(l)};if(n&&r){const l=r.map(i),c=n.map(i);l.join("")!==c.join("")&&s("children"),r.length!==n.length&&s("children")}return Xj.filter(l=>l[0]==="_").map(l=>l.replace(/_/,"")).forEach(l=>{if(l in t&&l in e)if($g(t[l])&&$g(e[l])){const c=Object.keys(t[l]),u=Object.keys(e[l]);c.length!==u.length?s(l):(c.forEach(d=>{t[l][d]!==e[l][d]&&s(l)}),u.forEach(d=>{t[l][d]!==e[l][d]&&s(l)}))}else t[l]!==e[l]&&s(l)}),o}const Pke=t=>{!t||t.destroyed||!t.params.virtual||t.params.virtual&&!t.params.virtual.enabled||(t.updateSlides(),t.updateProgress(),t.updateSlidesClasses(),t.emit("_virtualUpdated"),t.parallax&&t.params.parallax&&t.params.parallax.enabled&&t.parallax.setTranslate())};function Q2(t,e,n){t===void 0&&(t={});const r=[],i={"container-start":[],"container-end":[],"wrapper-start":[],"wrapper-end":[]},o=(s,a)=>{Array.isArray(s)&&s.forEach(l=>{const c=typeof l.type=="symbol";a==="default"&&(a="container-end"),c&&l.children?o(l.children,a):l.type&&(l.type.name==="SwiperSlide"||l.type.name==="AsyncComponentWrapper")||l.componentOptions&&l.componentOptions.tag==="SwiperSlide"?r.push(l):i[a]&&i[a].push(l)})};return Object.keys(t).forEach(s=>{if(typeof t[s]!="function")return;const a=t[s]();o(a,s)}),n.value=e.value,e.value=r,{slides:r,slots:i}}function Nke(t,e,n){if(!n)return null;const r=u=>{let d=u;return u<0?d=e.length+u:d>=e.length&&(d=d-e.length),d},i=t.value.isHorizontal()?{[t.value.rtlTranslate?"right":"left"]:`${n.offset}px`}:{top:`${n.offset}px`},{from:o,to:s}=n,a=t.value.params.loop?-e.length:0,l=t.value.params.loop?e.length*2:e.length,c=[];for(let u=a;u=o&&u<=s&&c.length{if(u.props||(u.props={}),u.props.style||(u.props.style={}),u.props.swiperRef=t,u.props.style=i,u.type)return g.h(u.type,{...u.props},u.children);if(u.componentOptions)return g.h(u.componentOptions.Ctor,{...u.props},u.componentOptions.children)})}const n9={name:"Swiper",props:{tag:{type:String,default:"div"},wrapperTag:{type:String,default:"div"},modules:{type:Array,default:void 0},init:{type:Boolean,default:void 0},direction:{type:String,default:void 0},oneWayMovement:{type:Boolean,default:void 0},swiperElementNodeName:{type:String,default:"SWIPER-CONTAINER"},touchEventsTarget:{type:String,default:void 0},initialSlide:{type:Number,default:void 0},speed:{type:Number,default:void 0},cssMode:{type:Boolean,default:void 0},updateOnWindowResize:{type:Boolean,default:void 0},resizeObserver:{type:Boolean,default:void 0},nested:{type:Boolean,default:void 0},focusableElements:{type:String,default:void 0},width:{type:Number,default:void 0},height:{type:Number,default:void 0},preventInteractionOnTransition:{type:Boolean,default:void 0},userAgent:{type:String,default:void 0},url:{type:String,default:void 0},edgeSwipeDetection:{type:[Boolean,String],default:void 0},edgeSwipeThreshold:{type:Number,default:void 0},autoHeight:{type:Boolean,default:void 0},setWrapperSize:{type:Boolean,default:void 0},virtualTranslate:{type:Boolean,default:void 0},effect:{type:String,default:void 0},breakpoints:{type:Object,default:void 0},breakpointsBase:{type:String,default:void 0},spaceBetween:{type:[Number,String],default:void 0},slidesPerView:{type:[Number,String],default:void 0},maxBackfaceHiddenSlides:{type:Number,default:void 0},slidesPerGroup:{type:Number,default:void 0},slidesPerGroupSkip:{type:Number,default:void 0},slidesPerGroupAuto:{type:Boolean,default:void 0},centeredSlides:{type:Boolean,default:void 0},centeredSlidesBounds:{type:Boolean,default:void 0},slidesOffsetBefore:{type:Number,default:void 0},slidesOffsetAfter:{type:Number,default:void 0},normalizeSlideIndex:{type:Boolean,default:void 0},centerInsufficientSlides:{type:Boolean,default:void 0},watchOverflow:{type:Boolean,default:void 0},roundLengths:{type:Boolean,default:void 0},touchRatio:{type:Number,default:void 0},touchAngle:{type:Number,default:void 0},simulateTouch:{type:Boolean,default:void 0},shortSwipes:{type:Boolean,default:void 0},longSwipes:{type:Boolean,default:void 0},longSwipesRatio:{type:Number,default:void 0},longSwipesMs:{type:Number,default:void 0},followFinger:{type:Boolean,default:void 0},allowTouchMove:{type:Boolean,default:void 0},threshold:{type:Number,default:void 0},touchMoveStopPropagation:{type:Boolean,default:void 0},touchStartPreventDefault:{type:Boolean,default:void 0},touchStartForcePreventDefault:{type:Boolean,default:void 0},touchReleaseOnEdges:{type:Boolean,default:void 0},uniqueNavElements:{type:Boolean,default:void 0},resistance:{type:Boolean,default:void 0},resistanceRatio:{type:Number,default:void 0},watchSlidesProgress:{type:Boolean,default:void 0},grabCursor:{type:Boolean,default:void 0},preventClicks:{type:Boolean,default:void 0},preventClicksPropagation:{type:Boolean,default:void 0},slideToClickedSlide:{type:Boolean,default:void 0},loop:{type:Boolean,default:void 0},loopedSlides:{type:Number,default:void 0},loopPreventsSliding:{type:Boolean,default:void 0},loopAdditionalSlides:{type:Number,default:void 0},loopAddBlankSlides:{type:Boolean,default:void 0},rewind:{type:Boolean,default:void 0},allowSlidePrev:{type:Boolean,default:void 0},allowSlideNext:{type:Boolean,default:void 0},swipeHandler:{type:Boolean,default:void 0},noSwiping:{type:Boolean,default:void 0},noSwipingClass:{type:String,default:void 0},noSwipingSelector:{type:String,default:void 0},passiveListeners:{type:Boolean,default:void 0},containerModifierClass:{type:String,default:void 0},slideClass:{type:String,default:void 0},slideActiveClass:{type:String,default:void 0},slideVisibleClass:{type:String,default:void 0},slideFullyVisibleClass:{type:String,default:void 0},slideBlankClass:{type:String,default:void 0},slideNextClass:{type:String,default:void 0},slidePrevClass:{type:String,default:void 0},wrapperClass:{type:String,default:void 0},lazyPreloaderClass:{type:String,default:void 0},lazyPreloadPrevNext:{type:Number,default:void 0},runCallbacksOnInit:{type:Boolean,default:void 0},observer:{type:Boolean,default:void 0},observeParents:{type:Boolean,default:void 0},observeSlideChildren:{type:Boolean,default:void 0},a11y:{type:[Boolean,Object],default:void 0},autoplay:{type:[Boolean,Object],default:void 0},controller:{type:Object,default:void 0},coverflowEffect:{type:Object,default:void 0},cubeEffect:{type:Object,default:void 0},fadeEffect:{type:Object,default:void 0},flipEffect:{type:Object,default:void 0},creativeEffect:{type:Object,default:void 0},cardsEffect:{type:Object,default:void 0},hashNavigation:{type:[Boolean,Object],default:void 0},history:{type:[Boolean,Object],default:void 0},keyboard:{type:[Boolean,Object],default:void 0},mousewheel:{type:[Boolean,Object],default:void 0},navigation:{type:[Boolean,Object],default:void 0},pagination:{type:[Boolean,Object],default:void 0},parallax:{type:[Boolean,Object],default:void 0},scrollbar:{type:[Boolean,Object],default:void 0},thumbs:{type:Object,default:void 0},virtual:{type:[Boolean,Object],default:void 0},zoom:{type:[Boolean,Object],default:void 0},grid:{type:[Object],default:void 0},freeMode:{type:[Boolean,Object],default:void 0},enabled:{type:Boolean,default:void 0}},emits:["_beforeBreakpoint","_containerClasses","_slideClass","_slideClasses","_swiper","_freeModeNoMomentumRelease","activeIndexChange","afterInit","autoplay","autoplayStart","autoplayStop","autoplayPause","autoplayResume","autoplayTimeLeft","beforeDestroy","beforeInit","beforeLoopFix","beforeResize","beforeSlideChangeStart","beforeTransitionStart","breakpoint","changeDirection","click","disable","doubleTap","doubleClick","destroy","enable","fromEdge","hashChange","hashSet","init","keyPress","lock","loopFix","momentumBounce","navigationHide","navigationShow","navigationPrev","navigationNext","observerUpdate","orientationchange","paginationHide","paginationRender","paginationShow","paginationUpdate","progress","reachBeginning","reachEnd","realIndexChange","resize","scroll","scrollbarDragEnd","scrollbarDragMove","scrollbarDragStart","setTransition","setTranslate","slidesUpdated","slideChange","slideChangeTransitionEnd","slideChangeTransitionStart","slideNextTransitionEnd","slideNextTransitionStart","slidePrevTransitionEnd","slidePrevTransitionStart","slideResetTransitionStart","slideResetTransitionEnd","sliderMove","sliderFirstMove","slidesLengthChange","slidesGridLengthChange","snapGridLengthChange","snapIndexChange","swiper","tap","toEdge","touchEnd","touchMove","touchMoveOpposite","touchStart","transitionEnd","transitionStart","unlock","update","virtualUpdate","zoomChange"],setup(t,e){let{slots:n,emit:r}=e;const{tag:i,wrapperTag:o}=t,s=g.ref("swiper"),a=g.ref(null),l=g.ref(!1),c=g.ref(!1),u=g.ref(null),d=g.ref(null),p=g.ref(null),m={value:[]},y={value:[]},w=g.ref(null),x=g.ref(null),C=g.ref(null),S=g.ref(null),{params:M,passedParams:E}=t9(t);Q2(n,m,y),p.value=E,y.value=m.value;const A=()=>{Q2(n,m,y),l.value=!0};M.onAny=function(z){for(var $=arguments.length,W=new Array($>1?$-1:0),J=1;J<$;J++)W[J-1]=arguments[J];r(z,...W)},Object.assign(M.on,{_beforeBreakpoint:A,_containerClasses(z,$){s.value=$}});const I={...M};if(delete I.wrapperClass,d.value=new J2(I),d.value.virtual&&d.value.params.virtual.enabled){d.value.virtual.slides=m.value;const z={cache:!1,slides:m.value,renderExternal:$=>{a.value=$},renderExternalUpdate:!1};I0(d.value.params.virtual,z),I0(d.value.originalParams.virtual,z)}g.onUpdated(()=>{!c.value&&d.value&&(d.value.emitSlidesClasses(),c.value=!0);const{passedParams:z}=t9(t),$=Lke(z,p.value,m.value,y.value,W=>W.props&&W.props.key);p.value=z,($.length||l.value)&&d.value&&!d.value.destroyed&&Ake({swiper:d.value,slides:m.value,passedParams:z,changedParams:$,nextEl:w.value,prevEl:x.value,scrollbarEl:S.value,paginationEl:C.value}),l.value=!1}),g.provide("swiper",d),g.watch(a,()=>{g.nextTick(()=>{Pke(d.value)})}),g.onMounted(()=>{u.value&&(Ike({el:u.value,nextEl:w.value,prevEl:x.value,paginationEl:C.value,scrollbarEl:S.value,swiper:d.value},M),r("swiper",d.value))}),g.onBeforeUnmount(()=>{d.value&&!d.value.destroyed&&d.value.destroy(!0,!1)});function O(z){return M.virtual?Nke(d,z,a.value):(z.forEach(($,W)=>{$.props||($.props={}),$.props.swiperRef=d,$.props.swiperSlideIndex=W}),z)}return()=>{const{slides:z,slots:$}=Q2(n,m,y);return g.h(i,{ref:u,class:e9(s.value)},[$["container-start"],g.h(o,{class:Mke(M.wrapperClass)},[$["wrapper-start"],O(z),$["wrapper-end"]]),Kj(t)&&[g.h("div",{ref:x,class:"swiper-button-prev"}),g.h("div",{ref:w,class:"swiper-button-next"})],Qj(t)&&g.h("div",{ref:S,class:"swiper-scrollbar"}),Jj(t)&&g.h("div",{ref:C,class:"swiper-pagination"}),$["container-end"]])}}},r9={name:"SwiperSlide",props:{tag:{type:String,default:"div"},swiperRef:{type:Object,required:!1},swiperSlideIndex:{type:Number,default:void 0,required:!1},zoom:{type:Boolean,default:void 0,required:!1},lazy:{type:Boolean,default:!1,required:!1},virtualIndex:{type:[String,Number],default:void 0}},setup(t,e){let{slots:n}=e,r=!1;const{swiperRef:i}=t,o=g.ref(null),s=g.ref("swiper-slide"),a=g.ref(!1);function l(d,p,m){p===o.value&&(s.value=m)}g.onMounted(()=>{!i||!i.value||(i.value.on("_slideClass",l),r=!0)}),g.onBeforeUpdate(()=>{r||!i||!i.value||(i.value.on("_slideClass",l),r=!0)}),g.onUpdated(()=>{!o.value||!i||!i.value||(typeof t.swiperSlideIndex<"u"&&(o.value.swiperSlideIndex=t.swiperSlideIndex),i.value.destroyed&&s.value!=="swiper-slide"&&(s.value="swiper-slide"))}),g.onBeforeUnmount(()=>{!i||!i.value||i.value.off("_slideClass",l)});const c=g.computed(()=>({isActive:s.value.indexOf("swiper-slide-active")>=0,isVisible:s.value.indexOf("swiper-slide-visible")>=0,isPrev:s.value.indexOf("swiper-slide-prev")>=0,isNext:s.value.indexOf("swiper-slide-next")>=0}));g.provide("swiperSlide",c);const u=()=>{a.value=!0};return()=>g.h(t.tag,{class:e9(`${s.value}`),ref:o,"data-swiper-slide-index":typeof t.virtualIndex>"u"&&i&&i.value&&i.value.params.loop?t.swiperSlideIndex:t.virtualIndex,onLoadCapture:u},t.zoom?g.h("div",{class:"swiper-zoom-container","data-swiper-zoom":typeof t.zoom=="number"?t.zoom:void 0},[n.default&&n.default(c.value),t.lazy&&!a.value&&g.h("div",{class:"swiper-lazy-preloader"})]):[n.default&&n.default(c.value),t.lazy&&!a.value&&g.h("div",{class:"swiper-lazy-preloader"})])}};function i9(t,e,n,r){return t.params.createElements&&Object.keys(r).forEach(i=>{if(!n[i]&&n.auto===!0){let o=yh(t.el,`.${r[i]}`)[0];o||(o=ik("div",r[i]),o.className=r[i],t.el.append(o)),n[i]=o,e[i]=o}}),n}function eN(t){let{swiper:e,extendParams:n,on:r,emit:i}=t;n({navigation:{nextEl:null,prevEl:null,hideOnClick:!1,disabledClass:"swiper-button-disabled",hiddenClass:"swiper-button-hidden",lockClass:"swiper-button-lock",navigationDisabledClass:"swiper-navigation-disabled"}}),e.navigation={nextEl:null,prevEl:null};function o(y){let w;return y&&typeof y=="string"&&e.isElement&&(w=e.el.querySelector(y)||e.hostEl.querySelector(y),w)?w:(y&&(typeof y=="string"&&(w=[...document.querySelectorAll(y)]),e.params.uniqueNavElements&&typeof y=="string"&&w&&w.length>1&&e.el.querySelectorAll(y).length===1?w=e.el.querySelector(y):w&&w.length===1&&(w=w[0])),y&&!w?y:w)}function s(y,w){const x=e.params.navigation;y=ua(y),y.forEach(C=>{C&&(C.classList[w?"add":"remove"](...x.disabledClass.split(" ")),C.tagName==="BUTTON"&&(C.disabled=w),e.params.watchOverflow&&e.enabled&&C.classList[e.isLocked?"add":"remove"](x.lockClass))})}function a(){const{nextEl:y,prevEl:w}=e.navigation;if(e.params.loop){s(w,!1),s(y,!1);return}s(w,e.isBeginning&&!e.params.rewind),s(y,e.isEnd&&!e.params.rewind)}function l(y){y.preventDefault(),!(e.isBeginning&&!e.params.loop&&!e.params.rewind)&&(e.slidePrev(),i("navigationPrev"))}function c(y){y.preventDefault(),!(e.isEnd&&!e.params.loop&&!e.params.rewind)&&(e.slideNext(),i("navigationNext"))}function u(){const y=e.params.navigation;if(e.params.navigation=i9(e,e.originalParams.navigation,e.params.navigation,{nextEl:"swiper-button-next",prevEl:"swiper-button-prev"}),!(y.nextEl||y.prevEl))return;let w=o(y.nextEl),x=o(y.prevEl);Object.assign(e.navigation,{nextEl:w,prevEl:x}),w=ua(w),x=ua(x);const C=(S,M)=>{S&&S.addEventListener("click",M==="next"?c:l),!e.enabled&&S&&S.classList.add(...y.lockClass.split(" "))};w.forEach(S=>C(S,"next")),x.forEach(S=>C(S,"prev"))}function d(){let{nextEl:y,prevEl:w}=e.navigation;y=ua(y),w=ua(w);const x=(C,S)=>{C.removeEventListener("click",S==="next"?c:l),C.classList.remove(...e.params.navigation.disabledClass.split(" "))};y.forEach(C=>x(C,"next")),w.forEach(C=>x(C,"prev"))}r("init",()=>{e.params.navigation.enabled===!1?m():(u(),a())}),r("toEdge fromEdge lock unlock",()=>{a()}),r("destroy",()=>{d()}),r("enable disable",()=>{let{nextEl:y,prevEl:w}=e.navigation;if(y=ua(y),w=ua(w),e.enabled){a();return}[...y,...w].filter(x=>!!x).forEach(x=>x.classList.add(e.params.navigation.lockClass))}),r("click",(y,w)=>{let{nextEl:x,prevEl:C}=e.navigation;x=ua(x),C=ua(C);const S=w.target;let M=C.includes(S)||x.includes(S);if(e.isElement&&!M){const E=w.path||w.composedPath&&w.composedPath();E&&(M=E.find(A=>x.includes(A)||C.includes(A)))}if(e.params.navigation.hideOnClick&&!M){if(e.pagination&&e.params.pagination&&e.params.pagination.clickable&&(e.pagination.el===S||e.pagination.el.contains(S)))return;let E;x.length?E=x[0].classList.contains(e.params.navigation.hiddenClass):C.length&&(E=C[0].classList.contains(e.params.navigation.hiddenClass)),i(E===!0?"navigationShow":"navigationHide"),[...x,...C].filter(A=>!!A).forEach(A=>A.classList.toggle(e.params.navigation.hiddenClass))}});const p=()=>{e.el.classList.remove(...e.params.navigation.navigationDisabledClass.split(" ")),u(),a()},m=()=>{e.el.classList.add(...e.params.navigation.navigationDisabledClass.split(" ")),d()};Object.assign(e.navigation,{enable:p,disable:m,update:a,init:u,destroy:d})}function W1(t){return t===void 0&&(t=""),`.${t.trim().replace(/([\.:!+\/])/g,"\\$1").replace(/ /g,".")}`}function Oke(t){let{swiper:e,extendParams:n,on:r,emit:i}=t;const o="swiper-pagination";n({pagination:{el:null,bulletElement:"span",clickable:!1,hideOnClick:!1,renderBullet:null,renderProgressbar:null,renderFraction:null,renderCustom:null,progressbarOpposite:!1,type:"bullets",dynamicBullets:!1,dynamicMainBullets:1,formatFractionCurrent:S=>S,formatFractionTotal:S=>S,bulletClass:`${o}-bullet`,bulletActiveClass:`${o}-bullet-active`,modifierClass:`${o}-`,currentClass:`${o}-current`,totalClass:`${o}-total`,hiddenClass:`${o}-hidden`,progressbarFillClass:`${o}-progressbar-fill`,progressbarOppositeClass:`${o}-progressbar-opposite`,clickableClass:`${o}-clickable`,lockClass:`${o}-lock`,horizontalClass:`${o}-horizontal`,verticalClass:`${o}-vertical`,paginationDisabledClass:`${o}-disabled`}}),e.pagination={el:null,bullets:[]};let s,a=0;function l(){return!e.params.pagination.el||!e.pagination.el||Array.isArray(e.pagination.el)&&e.pagination.el.length===0}function c(S,M){const{bulletActiveClass:E}=e.params.pagination;S&&(S=S[`${M==="prev"?"previous":"next"}ElementSibling`],S&&(S.classList.add(`${E}-${M}`),S=S[`${M==="prev"?"previous":"next"}ElementSibling`],S&&S.classList.add(`${E}-${M}-${M}`)))}function u(S,M,E){if(S=S%E,M=M%E,M===S+1)return"next";if(M===S-1)return"previous"}function d(S){const M=S.target.closest(W1(e.params.pagination.bulletClass));if(!M)return;S.preventDefault();const E=ok(M)*e.params.slidesPerGroup;if(e.params.loop){if(e.realIndex===E)return;const A=u(e.realIndex,E,e.slides.length);A==="next"?e.slideNext():A==="previous"?e.slidePrev():e.slideToLoop(E)}else e.slideTo(E)}function p(){const S=e.rtl,M=e.params.pagination;if(l())return;let E=e.pagination.el;E=ua(E);let A,I;const O=e.virtual&&e.params.virtual.enabled?e.virtual.slides.length:e.slides.length,z=e.params.loop?Math.ceil(O/e.params.slidesPerGroup):e.snapGrid.length;if(e.params.loop?(I=e.previousRealIndex||0,A=e.params.slidesPerGroup>1?Math.floor(e.realIndex/e.params.slidesPerGroup):e.realIndex):typeof e.snapIndex<"u"?(A=e.snapIndex,I=e.previousSnapIndex):(I=e.previousIndex||0,A=e.activeIndex||0),M.type==="bullets"&&e.pagination.bullets&&e.pagination.bullets.length>0){const $=e.pagination.bullets;let W,J,Z;if(M.dynamicBullets&&(s=j2($[0],e.isHorizontal()?"width":"height"),E.forEach(q=>{q.style[e.isHorizontal()?"width":"height"]=`${s*(M.dynamicMainBullets+4)}px`}),M.dynamicMainBullets>1&&I!==void 0&&(a+=A-(I||0),a>M.dynamicMainBullets-1?a=M.dynamicMainBullets-1:a<0&&(a=0)),W=Math.max(A-a,0),J=W+(Math.min($.length,M.dynamicMainBullets)-1),Z=(J+W)/2),$.forEach(q=>{const j=[...["","-next","-next-next","-prev","-prev-prev","-main"].map(G=>`${M.bulletActiveClass}${G}`)].map(G=>typeof G=="string"&&G.includes(" ")?G.split(" "):G).flat();q.classList.remove(...j)}),E.length>1)$.forEach(q=>{const j=ok(q);j===A?q.classList.add(...M.bulletActiveClass.split(" ")):e.isElement&&q.setAttribute("part","bullet"),M.dynamicBullets&&(j>=W&&j<=J&&q.classList.add(...`${M.bulletActiveClass}-main`.split(" ")),j===W&&c(q,"prev"),j===J&&c(q,"next"))});else{const q=$[A];if(q&&q.classList.add(...M.bulletActiveClass.split(" ")),e.isElement&&$.forEach((j,G)=>{j.setAttribute("part",G===A?"bullet-active":"bullet")}),M.dynamicBullets){const j=$[W],G=$[J];for(let U=W;U<=J;U+=1)$[U]&&$[U].classList.add(...`${M.bulletActiveClass}-main`.split(" "));c(j,"prev"),c(G,"next")}}if(M.dynamicBullets){const q=Math.min($.length,M.dynamicMainBullets+4),j=(s*q-s)/2-Z*s,G=S?"right":"left";$.forEach(U=>{U.style[e.isHorizontal()?G:"top"]=`${j}px`})}}E.forEach(($,W)=>{if(M.type==="fraction"&&($.querySelectorAll(W1(M.currentClass)).forEach(J=>{J.textContent=M.formatFractionCurrent(A+1)}),$.querySelectorAll(W1(M.totalClass)).forEach(J=>{J.textContent=M.formatFractionTotal(z)})),M.type==="progressbar"){let J;M.progressbarOpposite?J=e.isHorizontal()?"vertical":"horizontal":J=e.isHorizontal()?"horizontal":"vertical";const Z=(A+1)/z;let q=1,j=1;J==="horizontal"?q=Z:j=Z,$.querySelectorAll(W1(M.progressbarFillClass)).forEach(G=>{G.style.transform=`translate3d(0,0,0) scaleX(${q}) scaleY(${j})`,G.style.transitionDuration=`${e.params.speed}ms`})}M.type==="custom"&&M.renderCustom?(sk($,M.renderCustom(e,A+1,z)),W===0&&i("paginationRender",$)):(W===0&&i("paginationRender",$),i("paginationUpdate",$)),e.params.watchOverflow&&e.enabled&&$.classList[e.isLocked?"add":"remove"](M.lockClass)})}function m(){const S=e.params.pagination;if(l())return;const M=e.virtual&&e.params.virtual.enabled?e.virtual.slides.length:e.grid&&e.params.grid.rows>1?e.slides.length/Math.ceil(e.params.grid.rows):e.slides.length;let E=e.pagination.el;E=ua(E);let A="";if(S.type==="bullets"){let I=e.params.loop?Math.ceil(M/e.params.slidesPerGroup):e.snapGrid.length;e.params.freeMode&&e.params.freeMode.enabled&&I>M&&(I=M);for(let O=0;O`}S.type==="fraction"&&(S.renderFraction?A=S.renderFraction.call(e,S.currentClass,S.totalClass):A=` / `),S.type==="progressbar"&&(S.renderProgressbar?A=S.renderProgressbar.call(e,S.progressbarFillClass):A=``),e.pagination.bullets=[],E.forEach(I=>{S.type!=="custom"&&sk(I,A||""),S.type==="bullets"&&e.pagination.bullets.push(...I.querySelectorAll(W1(S.bulletClass)))}),S.type!=="custom"&&i("paginationRender",E[0])}function y(){e.params.pagination=i9(e,e.originalParams.pagination,e.params.pagination,{el:"swiper-pagination"});const S=e.params.pagination;if(!S.el)return;let M;typeof S.el=="string"&&e.isElement&&(M=e.el.querySelector(S.el)),!M&&typeof S.el=="string"&&(M=[...document.querySelectorAll(S.el)]),M||(M=S.el),!(!M||M.length===0)&&(e.params.uniqueNavElements&&typeof S.el=="string"&&Array.isArray(M)&&M.length>1&&(M=[...e.el.querySelectorAll(S.el)],M.length>1&&(M=M.find(E=>zj(E,".swiper")[0]===e.el))),Array.isArray(M)&&M.length===1&&(M=M[0]),Object.assign(e.pagination,{el:M}),M=ua(M),M.forEach(E=>{S.type==="bullets"&&S.clickable&&E.classList.add(...(S.clickableClass||"").split(" ")),E.classList.add(S.modifierClass+S.type),E.classList.add(e.isHorizontal()?S.horizontalClass:S.verticalClass),S.type==="bullets"&&S.dynamicBullets&&(E.classList.add(`${S.modifierClass}${S.type}-dynamic`),a=0,S.dynamicMainBullets<1&&(S.dynamicMainBullets=1)),S.type==="progressbar"&&S.progressbarOpposite&&E.classList.add(S.progressbarOppositeClass),S.clickable&&E.addEventListener("click",d),e.enabled||E.classList.add(S.lockClass)}))}function w(){const S=e.params.pagination;if(l())return;let M=e.pagination.el;M&&(M=ua(M),M.forEach(E=>{E.classList.remove(S.hiddenClass),E.classList.remove(S.modifierClass+S.type),E.classList.remove(e.isHorizontal()?S.horizontalClass:S.verticalClass),S.clickable&&(E.classList.remove(...(S.clickableClass||"").split(" ")),E.removeEventListener("click",d))})),e.pagination.bullets&&e.pagination.bullets.forEach(E=>E.classList.remove(...S.bulletActiveClass.split(" ")))}r("changeDirection",()=>{if(!e.pagination||!e.pagination.el)return;const S=e.params.pagination;let{el:M}=e.pagination;M=ua(M),M.forEach(E=>{E.classList.remove(S.horizontalClass,S.verticalClass),E.classList.add(e.isHorizontal()?S.horizontalClass:S.verticalClass)})}),r("init",()=>{e.params.pagination.enabled===!1?C():(y(),m(),p())}),r("activeIndexChange",()=>{typeof e.snapIndex>"u"&&p()}),r("snapIndexChange",()=>{p()}),r("snapGridLengthChange",()=>{m(),p()}),r("destroy",()=>{w()}),r("enable disable",()=>{let{el:S}=e.pagination;S&&(S=ua(S),S.forEach(M=>M.classList[e.enabled?"remove":"add"](e.params.pagination.lockClass)))}),r("lock unlock",()=>{p()}),r("click",(S,M)=>{const E=M.target,A=ua(e.pagination.el);if(e.params.pagination.el&&e.params.pagination.hideOnClick&&A&&A.length>0&&!E.classList.contains(e.params.pagination.bulletClass)){if(e.navigation&&(e.navigation.nextEl&&E===e.navigation.nextEl||e.navigation.prevEl&&E===e.navigation.prevEl))return;const I=A[0].classList.contains(e.params.pagination.hiddenClass);i(I===!0?"paginationShow":"paginationHide"),A.forEach(O=>O.classList.toggle(e.params.pagination.hiddenClass))}});const x=()=>{e.el.classList.remove(e.params.pagination.paginationDisabledClass);let{el:S}=e.pagination;S&&(S=ua(S),S.forEach(M=>M.classList.remove(e.params.pagination.paginationDisabledClass))),y(),m(),p()},C=()=>{e.el.classList.add(e.params.pagination.paginationDisabledClass);let{el:S}=e.pagination;S&&(S=ua(S),S.forEach(M=>M.classList.add(e.params.pagination.paginationDisabledClass))),w()};Object.assign(e.pagination,{enable:x,disable:C,render:m,update:p,init:y,destroy:w})}function Dke(t){let{swiper:e,extendParams:n,on:r,emit:i,params:o}=t;e.autoplay={running:!1,paused:!1,timeLeft:0},n({autoplay:{enabled:!1,delay:3e3,waitForTransition:!0,disableOnInteraction:!1,stopOnLastSlide:!1,reverseDirection:!1,pauseOnMouseEnter:!1}});let s,a,l=o&&o.autoplay?o.autoplay.delay:3e3,c=o&&o.autoplay?o.autoplay.delay:3e3,u,d=new Date().getTime(),p,m,y,w,x,C,S;function M(re){!e||e.destroyed||!e.wrapperEl||re.target===e.wrapperEl&&(e.wrapperEl.removeEventListener("transitionend",M),!(S||re.detail&&re.detail.bySwiperTouchMove)&&W())}const E=()=>{if(e.destroyed||!e.autoplay.running)return;e.autoplay.paused?p=!0:p&&(c=u,p=!1);const re=e.autoplay.paused?u:d+c-new Date().getTime();e.autoplay.timeLeft=re,i("autoplayTimeLeft",re,re/l),a=requestAnimationFrame(()=>{E()})},A=()=>{let re;return e.virtual&&e.params.virtual.enabled?re=e.slides.find(oe=>oe.classList.contains("swiper-slide-active")):re=e.slides[e.activeIndex],re?parseInt(re.getAttribute("data-swiper-autoplay"),10):void 0},I=re=>{if(e.destroyed||!e.autoplay.running)return;cancelAnimationFrame(a),E();let le=typeof re>"u"?e.params.autoplay.delay:re;l=e.params.autoplay.delay,c=e.params.autoplay.delay;const oe=A();!Number.isNaN(oe)&&oe>0&&typeof re>"u"&&(le=oe,l=oe,c=oe),u=le;const he=e.params.speed,xe=()=>{!e||e.destroyed||(e.params.autoplay.reverseDirection?!e.isBeginning||e.params.loop||e.params.rewind?(e.slidePrev(he,!0,!0),i("autoplay")):e.params.autoplay.stopOnLastSlide||(e.slideTo(e.slides.length-1,he,!0,!0),i("autoplay")):!e.isEnd||e.params.loop||e.params.rewind?(e.slideNext(he,!0,!0),i("autoplay")):e.params.autoplay.stopOnLastSlide||(e.slideTo(0,he,!0,!0),i("autoplay")),e.params.cssMode&&(d=new Date().getTime(),requestAnimationFrame(()=>{I()})))};return le>0?(clearTimeout(s),s=setTimeout(()=>{xe()},le)):requestAnimationFrame(()=>{xe()}),le},O=()=>{d=new Date().getTime(),e.autoplay.running=!0,I(),i("autoplayStart")},z=()=>{e.autoplay.running=!1,clearTimeout(s),cancelAnimationFrame(a),i("autoplayStop")},$=(re,le)=>{if(e.destroyed||!e.autoplay.running)return;clearTimeout(s),re||(C=!0);const oe=()=>{i("autoplayPause"),e.params.autoplay.waitForTransition?e.wrapperEl.addEventListener("transitionend",M):W()};if(e.autoplay.paused=!0,le){x&&(u=e.params.autoplay.delay),x=!1,oe();return}u=(u||e.params.autoplay.delay)-(new Date().getTime()-d),!(e.isEnd&&u<0&&!e.params.loop)&&(u<0&&(u=0),oe())},W=()=>{e.isEnd&&u<0&&!e.params.loop||e.destroyed||!e.autoplay.running||(d=new Date().getTime(),C?(C=!1,I(u)):I(),e.autoplay.paused=!1,i("autoplayResume"))},J=()=>{if(e.destroyed||!e.autoplay.running)return;const re=gh();re.visibilityState==="hidden"&&(C=!0,$(!0)),re.visibilityState==="visible"&&W()},Z=re=>{re.pointerType==="mouse"&&(C=!0,S=!0,!(e.animating||e.autoplay.paused)&&$(!0))},q=re=>{re.pointerType==="mouse"&&(S=!1,e.autoplay.paused&&W())},j=()=>{e.params.autoplay.pauseOnMouseEnter&&(e.el.addEventListener("pointerenter",Z),e.el.addEventListener("pointerleave",q))},G=()=>{e.el&&typeof e.el!="string"&&(e.el.removeEventListener("pointerenter",Z),e.el.removeEventListener("pointerleave",q))},U=()=>{gh().addEventListener("visibilitychange",J)},Q=()=>{gh().removeEventListener("visibilitychange",J)};r("init",()=>{e.params.autoplay.enabled&&(j(),U(),O())}),r("destroy",()=>{G(),Q(),e.autoplay.running&&z()}),r("_freeModeStaticRelease",()=>{(y||C)&&W()}),r("_freeModeNoMomentumRelease",()=>{e.params.autoplay.disableOnInteraction?z():$(!0,!0)}),r("beforeTransitionStart",(re,le,oe)=>{e.destroyed||!e.autoplay.running||(oe||!e.params.autoplay.disableOnInteraction?$(!0,!0):z())}),r("sliderFirstMove",()=>{if(!(e.destroyed||!e.autoplay.running)){if(e.params.autoplay.disableOnInteraction){z();return}m=!0,y=!1,C=!1,w=setTimeout(()=>{C=!0,y=!0,$(!0)},200)}}),r("touchEnd",()=>{if(!(e.destroyed||!e.autoplay.running||!m)){if(clearTimeout(w),clearTimeout(s),e.params.autoplay.disableOnInteraction){y=!1,m=!1;return}y&&e.params.cssMode&&W(),y=!1,m=!1}}),r("slideChange",()=>{e.destroyed||!e.autoplay.running||(x=!0)}),Object.assign(e.autoplay,{start:O,stop:z,pause:$,resume:W})}function o9(t){let{swiper:e,extendParams:n,on:r}=t;n({thumbs:{swiper:null,multipleActiveThumbs:!0,autoScrollOffset:0,slideThumbActiveClass:"swiper-slide-thumb-active",thumbsContainerClass:"swiper-thumbs"}});let i=!1,o=!1;e.thumbs={swiper:null};function s(){const c=e.thumbs.swiper;if(!c||c.destroyed)return;const u=c.clickedIndex,d=c.clickedSlide;if(d&&d.classList.contains(e.params.thumbs.slideThumbActiveClass)||typeof u>"u"||u===null)return;let p;c.params.loop?p=parseInt(c.clickedSlide.getAttribute("data-swiper-slide-index"),10):p=u,e.params.loop?e.slideToLoop(p):e.slideTo(p)}function a(){const{thumbs:c}=e.params;if(i)return!1;i=!0;const u=e.constructor;if(c.swiper instanceof u){if(c.swiper.destroyed)return i=!1,!1;e.thumbs.swiper=c.swiper,Object.assign(e.thumbs.swiper.originalParams,{watchSlidesProgress:!0,slideToClickedSlide:!1}),Object.assign(e.thumbs.swiper.params,{watchSlidesProgress:!0,slideToClickedSlide:!1}),e.thumbs.swiper.update()}else if(H1(c.swiper)){const d=Object.assign({},c.swiper);Object.assign(d,{watchSlidesProgress:!0,slideToClickedSlide:!1}),e.thumbs.swiper=new u(d),o=!0}return e.thumbs.swiper.el.classList.add(e.params.thumbs.thumbsContainerClass),e.thumbs.swiper.on("tap",s),!0}function l(c){const u=e.thumbs.swiper;if(!u||u.destroyed)return;const d=u.params.slidesPerView==="auto"?u.slidesPerViewDynamic():u.params.slidesPerView;let p=1;const m=e.params.thumbs.slideThumbActiveClass;if(e.params.slidesPerView>1&&!e.params.centeredSlides&&(p=e.params.slidesPerView),e.params.thumbs.multipleActiveThumbs||(p=1),p=Math.floor(p),u.slides.forEach(x=>x.classList.remove(m)),u.params.loop||u.params.virtual&&u.params.virtual.enabled)for(let x=0;x{C.classList.add(m)});else for(let x=0;xE.getAttribute("data-swiper-slide-index")===`${e.realIndex}`);C=u.slides.indexOf(M),S=e.activeIndex>e.previousIndex?"next":"prev"}else C=e.realIndex,S=C>e.previousIndex?"next":"prev";w&&(C+=S==="next"?y:-1*y),u.visibleSlidesIndexes&&u.visibleSlidesIndexes.indexOf(C)<0&&(u.params.centeredSlides?C>x?C=C-Math.floor(d/2)+1:C=C+Math.floor(d/2)-1:C>x&&u.params.slidesPerGroup,u.slideTo(C,c?0:void 0))}}r("beforeInit",()=>{const{thumbs:c}=e.params;if(!(!c||!c.swiper))if(typeof c.swiper=="string"||c.swiper instanceof HTMLElement){const u=gh(),d=()=>{const m=typeof c.swiper=="string"?u.querySelector(c.swiper):c.swiper;if(m&&m.swiper)c.swiper=m.swiper,a(),l(!0);else if(m){const y=`${e.params.eventsPrefix}init`,w=x=>{c.swiper=x.detail[0],m.removeEventListener(y,w),a(),l(!0),c.swiper.update(),e.update()};m.addEventListener(y,w)}return m},p=()=>{if(e.destroyed)return;d()||requestAnimationFrame(p)};requestAnimationFrame(p)}else a(),l(!0)}),r("slideChange update resize observerUpdate",()=>{l()}),r("setTransition",(c,u)=>{const d=e.thumbs.swiper;!d||d.destroyed||d.setTransition(u)}),r("beforeDestroy",()=>{const c=e.thumbs.swiper;!c||c.destroyed||o&&c.destroy()}),Object.assign(e.thumbs,{init:a,update:l})}function s9(t){let{swiper:e,extendParams:n,emit:r,once:i}=t;n({freeMode:{enabled:!1,momentum:!0,momentumRatio:1,momentumBounce:!0,momentumBounceRatio:1,momentumVelocityRatio:1,sticky:!1,minimumVelocity:.02}});function o(){if(e.params.cssMode)return;const l=e.getTranslate();e.setTranslate(l),e.setTransition(0),e.touchEventsData.velocities.length=0,e.freeMode.onTouchEnd({currentPos:e.rtl?e.translate:-e.translate})}function s(){if(e.params.cssMode)return;const{touchEventsData:l,touches:c}=e;l.velocities.length===0&&l.velocities.push({position:c[e.isHorizontal()?"startX":"startY"],time:l.touchStartTime}),l.velocities.push({position:c[e.isHorizontal()?"currentX":"currentY"],time:Fg()})}function a(l){let{currentPos:c}=l;if(e.params.cssMode)return;const{params:u,wrapperEl:d,rtlTranslate:p,snapGrid:m,touchEventsData:y}=e,x=Fg()-y.touchStartTime;if(c<-e.minTranslate()){e.slideTo(e.activeIndex);return}if(c>-e.maxTranslate()){e.slides.length1){const z=y.velocities.pop(),$=y.velocities.pop(),W=z.position-$.position,J=z.time-$.time;e.velocity=W/J,e.velocity/=2,Math.abs(e.velocity)150||Fg()-z.time>300)&&(e.velocity=0)}else e.velocity=0;e.velocity*=u.freeMode.momentumVelocityRatio,y.velocities.length=0;let C=1e3*u.freeMode.momentumRatio;const S=e.velocity*C;let M=e.translate+S;p&&(M=-M);let E=!1,A;const I=Math.abs(e.velocity)*20*u.freeMode.momentumBounceRatio;let O;if(Me.minTranslate())u.freeMode.momentumBounce?(M-e.minTranslate()>I&&(M=e.minTranslate()+I),A=e.minTranslate(),E=!0,y.allowMomentumBounce=!0):M=e.minTranslate(),u.loop&&u.centeredSlides&&(O=!0);else if(u.freeMode.sticky){let z;for(let $=0;$-M){z=$;break}Math.abs(m[z]-M){e.loopFix()}),e.velocity!==0){if(p?C=Math.abs((-M-e.translate)/e.velocity):C=Math.abs((M-e.translate)/e.velocity),u.freeMode.sticky){const z=Math.abs((p?-M:M)-e.translate),$=e.slidesSizesGrid[e.activeIndex];z<$?C=u.speed:z<2*$?C=u.speed*1.5:C=u.speed*2.5}}else if(u.freeMode.sticky){e.slideToClosest();return}u.freeMode.momentumBounce&&E?(e.updateProgress(A),e.setTransition(C),e.setTranslate(M),e.transitionStart(!0,e.swipeDirection),e.animating=!0,V2(d,()=>{!e||e.destroyed||!y.allowMomentumBounce||(r("momentumBounce"),e.setTransition(u.speed),setTimeout(()=>{e.setTranslate(A),V2(d,()=>{!e||e.destroyed||e.transitionEnd()})},0))})):e.velocity?(r("_freeModeNoMomentumRelease"),e.updateProgress(M),e.setTransition(C),e.setTranslate(M),e.transitionStart(!0,e.swipeDirection),e.animating||(e.animating=!0,V2(d,()=>{!e||e.destroyed||e.transitionEnd()}))):e.updateProgress(M),e.updateActiveIndex(),e.updateSlidesClasses()}else if(u.freeMode.sticky){e.slideToClosest();return}else u.freeMode&&r("_freeModeNoMomentumRelease");(!u.freeMode.momentum||x>=u.longSwipesMs)&&(r("_freeModeStaticRelease"),e.updateProgress(),e.updateActiveIndex(),e.updateSlidesClasses())}Object.assign(e,{freeMode:{onTouchStart:o,onTouchMove:s,onTouchEnd:a}})}const Rke={components:{Swiper:n9,SwiperSlide:r9},props:["images","width","height"],computed:{blockWidth(){return this.width?this.width:"100%"},blockHeight(){return this.height?this.height:"auto"}},setup(){return{modules:[Dke,Oke,eN]}}},Bke=["src","alt"];function Fke(t,e,n,r,i,o){const s=g.resolveComponent("swiper-slide"),a=g.resolveComponent("swiper");return g.openBlock(),g.createBlock(a,{slidesPerView:1,spaceBetween:30,loop:!0,pagination:{clickable:!0},autoplay:{delay:2500,disableOnInteraction:!1},navigation:!0,modules:r.modules,class:"mySwiper",style:g.normalizeStyle({width:o.blockWidth,maxHeight:o.blockHeight})},{default:g.withCtx(()=>[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(n.images,(l,c)=>(g.openBlock(),g.createBlock(s,{key:c,class:""},{default:g.withCtx(()=>[g.createElementVNode("img",{src:(l==null?void 0:l.path)||l,alt:l.name||"alt",class:"object-cover"},null,8,Bke)]),_:2},1024))),128))]),_:1},8,["modules","style"])}const $ke=xt(Rke,[["render",Fke]]),zke={name:"VsForm",components:{VsLayout:ek},computed:{processedScheme(){return Array.isArray(this.schema)?this.schema.map(t=>({col:t.col||12,schema:t.schema||[]})):[]},pinComponents(){return this.formScheme.filter(t=>{var e;return(t==null?void 0:t.pin)||((e=t==null?void 0:t.original)==null?void 0:e.pin)})},nonPinComponents(){return this.formScheme.filter(t=>{var e;return!(t!=null&&t.pin)&&!((e=t==null?void 0:t.original)!=null&&e.pin)})},pinGroups(){return[this.nonPinComponents,this.pinComponents]},hasPinComponents(){var t;return(t=this.pinComponents)==null?void 0:t.length}},props:{id:{type:String,default:()=>""},schema:{type:[Array,Object],default:()=>null},modelValue:{type:[Object,Array],default:()=>{}},style:{type:Object,default:()=>null},columns:{type:Object,default:()=>null},api:{type:String,default:()=>""},table:{type:String,default:()=>""},token:{type:String,default:()=>""},layout:{type:Object,default:()=>({head:!1})}},inject:["parentFormValues"],provide(){return{scheme:this.schema,formValues:g.computed(()=>({...this.parentFormValues||{},...this.formValues})),parentFormValues:g.computed(()=>this.formValues),table:this.table,token:this.token,id:this.id,formValuesOption:this.formValuesOption,behaviorValueSetter:this.behaviorValueSetter}},data(){return{formId:"",formValues:{},formErrors:{},formScheme:[],formValuesOption:{},behavior:{data:{},exist:!1},conditions:{},tempErrors:{},errors:new Map,preventErrors:!0,hiddenComponents:new Map}},watch:{formValues:{deep:!0,handler(t,e){this.formValueWatch(t,e)}},formValuesOption:{deep:!0,handler(t,e){this.formValueWatch(t,e)}}},async mounted(){var e;const t=await this.getFormScheme();this.formScheme=Array.isArray(t==null?void 0:t[0])?t==null?void 0:t.reduce((n,r)=>[...n,...(r==null?void 0:r.schema)||[]],[]):(e=this.formatSchemeFromObject(t))==null?void 0:e.reduce((n,r)=>[...n,...(r==null?void 0:r.schema)||[]],[]),this.setFromData(),this.behavior.data=this.createBehavior(),this.invokeConditionChecking()},methods:{formValueWatch(t,e){if(!Object.values(e||{}).length)return;this.behavior.exist&&(this.behavior.data=this.createBehavior());const n=this.createdNestedObject();this.invokeConditionChecking(),this.preventErrors||(this.errors=this.checkRules());const r=Object.keys(n).reduce((i,o)=>{const s=this.formScheme.find(l=>l.key===o);return(s?this.checkHiddenField(s)||this.checkHiddenComponents(s):!0)?i[o]=n[o]:delete this.formValues[o],i},{});this.$emit("update:modelValue",r),this.$emit("form-change",r)},async getFormScheme(){if(this.api)try{const{data:t}=await un.get(this.api);return t.components}catch(t){return console.error(t),[]}return this.schema},updError(t){const e=Object.keys(t)[0],n=t[e];n!==null?this.tempErrors[e]=n:delete this.tempErrors[e]},checkHiddenField({conditions:t,key:e}){const n=this.behavior.data[e];return t?this.conditionalCheck({conditions:t,key:e}):n===void 0?!0:n},checkHiddenComponents({conditions:t,key:e}){return this.hiddenComponents.get(e)||!t},conditionalCheck({conditions:t,key:e}){if(!t||!t.length)return!0;const n=i=>{const o=this.formValues[i[0]]||"";return i[1]==="*"?o===i[2]:!1},r=t.every(i=>Array.isArray(i[0])?i.some(o=>n(o)):n(i));return this.behavior.data[e]=r,r},behaviorValueSetter(t,e){this.formValues={...this.formValues,[t]:e}},checkRules(){return sP.check({components:this.formScheme.filter(this.checkHiddenField),data:this.formValues,disabledFields:this.hiddenComponents})},formatSchemeFromObject(t){return Object.entries(t).reduce((e,[n,r])=>r!=null&&r.components?e.concat({...r,key:n,components:this.formatSchemeFromObject(r.components)}):e.concat({...r,key:n}),[])},checkConditions({conditions:t,key:e}){if(!t)return;let n=!1;Array.isArray(t[0][0])?n=t.flat(1).some(r=>Eg.checkConditions(this.formValues,r,this.formValuesOption)):Array.isArray(t[0])?n=t.every(r=>Eg.checkConditions(this.formValues,r,this.formValuesOption)):n=Eg.checkConditions(this.formValues,t,this.formValuesOption),this.hiddenComponents.set(e,n)},invokeConditionChecking(){this.formScheme.forEach(t=>this.checkConditions(t))},columnClass(t){return{1:"md:w-1/12 w-full",2:"md:w-1/6 w-full",3:"md:w-1/4 w-full",4:"md:w-1/3 w-full",5:"md:w-5/12 w-full",6:"md:w-1/2 w-full",7:"md:w-7/12 w-full",8:"md:w-2/3 w-full",9:"md:w-3/4 w-full",10:"md:w-5/6 w-full",11:"md:w-11/12 w-full",12:"md:w-full w-full"}[t]||"w-full"},mapValidationToScheme(t,e){return t.map(n=>({...n,schema:n.schema.map(r=>r.schema?{...r,schema:this.mapValidationToScheme(r.schema,e)}:{...r,errors:e[r.key]||[]})}))},doValidation(){return new Promise((t,e)=>{this.preventErrors=!1,this.errors=this.checkRules(),this.formErrors=this.validation(),this.processedScheme=this.mapValidationToScheme(this.schema,this.formErrors),Object.keys(this.formErrors).length>0||this.errors.size>0?(this.$emit("onValidationError",Object.keys(this.formErrors)),e(new Error("validation error"))):t("submit")})},setFromData(){const t=this.formScheme.reduce((e,{key:n,defaultValue:r})=>{const i=this.modelValue[n],o=i===void 0?r:i;return{...e,[n]:o}},this.modelValue);this.formValues=t},validation(){var n;const t={icon:"ti-alert-circle",message:"Це поле обов'язкове"},e={icon:"ti-alert-circle",message:"Невірний email"};return(n=this.formScheme)==null?void 0:n.reduce((r,i)=>{const o=i.key;if(!this.checkHiddenComponents(i))return r;const s=i==null?void 0:i.validators;if(!s||s.length===0)return r;const a=this.formValues[o],l=s==null?void 0:s.reduce((c,u)=>(u==="required"&&(p=>Array.isArray(p)?p.length===0:!p)(a)?c.push(t):u==="email"&&typeof a=="string"&&(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(a)||c.push(e)),typeof u=="object"&&u.regexp&&(a!=null&&a.length)&&(new RegExp(u.regexp).test(a)||c.push({icon:"ti-alert-circle",message:u.message||"Невірний формат"})),c),[]);return l.length>0&&(r[o]=l),r},{})},behaviorState({key:t}={}){var r;const e=this.behavior.data!==null,n=((r=this.behavior.data)==null?void 0:r[t])||!1;return e&&n},createBehavior(){const t=({show:n,hide:r}={})=>{const i=(o,s)=>(o==null?void 0:o.split(",").reduce((a,l)=>({...a,[l]:s}),{}))||{};return{...i(r,!1),...i(n,!0)}};return this.formScheme.reduce((n,r)=>{var c;const{key:i,behavior:o,original:s}=r,a=o||(s==null?void 0:s.behavior),l=(n==null?void 0:n[i])===void 0?!0:n==null?void 0:n[i];if(a){this.behavior.exist=!0;const u=`${((c=this.formValues)==null?void 0:c[i])||""}`,d=Object.keys(a).includes(u)?u:"*",p={...d==="*"?{}:t(a["*"]),...t(a[d])};return{...n,[i]:l,...p}}return{...n,[i]:l}},{})},createdNestedObject(){const t=(r,i)=>{for(const o of Object.keys(i))i[o]instanceof Object&&Object.assign(i[o],t(r==null?void 0:r[o],i[o]));return Object.assign(r||{},i),r},e=(r,i)=>r.split(".").reduceRight((o,s)=>({[s]:o}),i);return Object.keys(this.formValues).reduce((r,i)=>{if(!i.includes("."))return{...r,[i]:this.formValues[i]};const o=e(i,this.formValues[i]);return t(o,r)},{})}}},Vke={class:"vs-form",ref:"form"},jke={key:0,class:"vs-form__head mb-5 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},Uke={class:"vs-form__body auto-rows-max container"},Hke={class:"flex flex-wrap"},Wke={key:1,class:"flex flex-wrap"};function Gke(t,e,n,r,i,o){const s=g.resolveComponent("VsLayout");return g.openBlock(),g.createElementBlock("div",Vke,[n.layout.head?(g.openBlock(),g.createElementBlock("div",jke,[g.renderSlot(t.$slots,"header",g.normalizeProps(g.guardReactiveProps(o.doValidation)))])):g.createCommentVNode("",!0),g.createElementVNode("div",Uke,[g.createElementVNode("div",Hke,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(o.processedScheme,(a,l)=>(g.openBlock(),g.createElementBlock("div",{key:l,class:g.normalizeClass([o.columnClass(a.col),"h-fit flex flex-wrap"])},[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(a.schema,c=>(g.openBlock(),g.createElementBlock(g.Fragment,{key:c.key},[o.checkHiddenField(c)||o.checkHiddenComponents(c)?g.withDirectives((g.openBlock(),g.createElementBlock("div",{key:0,class:g.normalizeClass(["mb-6 px-2",o.columnClass(c.col)])},[c.schema?(g.openBlock(),g.createElementBlock("div",Wke,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(c.schema,(u,d)=>(g.openBlock(),g.createElementBlock(g.Fragment,{key:d},[o.checkHiddenField(u)||o.checkHiddenComponents(u)?g.withDirectives((g.openBlock(),g.createElementBlock("div",{key:0,class:g.normalizeClass(["mb-6 px-2",o.columnClass(u.col)])},[g.createVNode(s,{data:u,errors:t.errors,"form-errors":t.formErrors,modelValue:t.formValues,"onUpdate:modelValue":e[1]||(e[1]=p=>t.formValues=p),"onUpdate:formErrors":o.updError,style:g.normalizeStyle(n.style),columns:n.columns},null,8,["data","errors","form-errors","modelValue","onUpdate:formErrors","style","columns"])],2)),[[g.vShow,!(u!=null&&u.hidden)]]):g.createCommentVNode("",!0)],64))),128))])):(g.openBlock(),g.createBlock(s,{key:0,data:c,errors:t.errors,"form-errors":t.formErrors,modelValue:t.formValues,"onUpdate:modelValue":e[0]||(e[0]=u=>t.formValues=u),"onUpdate:formErrors":o.updError,style:g.normalizeStyle(n.style),columns:n.columns},null,8,["data","errors","form-errors","modelValue","onUpdate:formErrors","style","columns"]))],2)),[[g.vShow,!(c!=null&&c.hidden)]]):g.createCommentVNode("",!0)],64))),128))],2))),128))])])],512)}const qke=xt(zke,[["render",Gke]]),Yke=(t,e=.1)=>{function n(o){return{black:"0, 0, 0",white:"255, 255, 255",red:"255, 0, 0",green:"0, 128, 0",blue:"0, 0, 255",gray:"128, 128, 128",yellow:"255, 255, 0",cyan:"0, 255, 255",magenta:"255, 0, 255",orange:"255, 165, 0",purple:"128, 0, 128",brown:"165, 42, 42",pink:"255, 192, 203",lime:"0, 255, 0",navy:"0, 0, 128",teal:"0, 128, 128",olive:"128, 128, 0",maroon:"128, 0, 0",silver:"192, 192, 192",gold:"255, 215, 0"}[o]||null}function r(o){o=o.replace(/^#/,""),o.length===3&&(o=o.split("").map(u=>u+u).join(""));const s=parseInt(o,16),a=s>>16&255,l=s>>8&255,c=s&255;return`${a}, ${l}, ${c}`}let i;if(typeof t=="string"&&t.startsWith("#"))i=r(t);else if(typeof t=="string")i=n(t);else throw new Error("Invalid color format");if(i)return`rgba(${i}, ${e})`;throw new Error("Color not found")},Zke={props:{text:{type:String,default:()=>"",required:!0},color:{type:String,default:()=>"",required:!1}},computed:{createStyle(){return this.color?{backgroundColor:Yke(this.color,.2)}:{backgroundColor:"rgb(245 245 244)"}}}};function Xke(t,e,n,r,i,o){return n.text?(g.openBlock(),g.createElementBlock("div",{key:0,class:g.normalizeClass(["py-1.5 px-2 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-full",n.color?`text-[${n.color}]`:"text-gray-700"]),style:g.normalizeStyle(o.createStyle)},g.toDisplayString(n.text),7)):g.createCommentVNode("",!0)}const Kke=xt(Zke,[["render",Xke]]),Jke={props:{value:{type:String,default:()=>""}},computed:{dateValue(){try{const t=Xt(this.value,["DD-MM-YYYY","YYYY-MM-DD"]);return new Date(t).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return this.value}}}},Qke={class:"whitespace-nowrap"};function eTe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",Qke,g.toDisplayString(o.dateValue),1)}const tTe=xt(Jke,[["render",eTe]]),nTe={props:{value:{type:[String,Array],default:()=>"",required:!0},position:{type:String,default:()=>"horizontal",required:!1},gap:{type:String,Array,default:()=>"6px",required:!1}},data(){return{componentType:"string"}},mounted(){Array.isArray(this.value)&&(this.componentType="array")}},rTe={key:0};function iTe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock(g.Fragment,null,[i.componentType==="string"?(g.openBlock(),g.createElementBlock("div",rTe,g.toDisplayString(n.value),1)):g.createCommentVNode("",!0),i.componentType==="array"?(g.openBlock(),g.createElementBlock("div",{key:1,class:g.normalizeClass(n.position==="vertical"?` grid gap-[${n.gap}] `:`flex flex-wrap gap-[${n.gap}] `)},[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(n.value,(s,a)=>(g.openBlock(),g.createElementBlock("div",{key:a},g.toDisplayString(s),1))),128)),g.createTextVNode(" "+g.toDisplayString(n.position),1)],2)):g.createCommentVNode("",!0)],64)}const oTe=xt(nTe,[["render",iTe]]),sTe=g.defineComponent({components:{vsLoader:tk,VsButton:Fh,IconCheckSuccess:Nj,IconError:Oj},props:{title:{type:String,default:()=>"Загрузка"},size:{type:String,default:()=>"30px"},statusAPI:{type:String,default:()=>"pending"},pending_message:{type:String,default:()=>"Зачекайте, будь ласка! "},error_message:{type:String,default:()=>"Сталася помилка."},success_message:{type:String,default:()=>"Операція завершена успішно!"},button_text:{type:String,default:()=>"Ok"},button_color:{type:String,default:()=>"#643B9F"},button_text_color:{type:String,default:()=>"white"},button_height:{type:String,default:()=>"30px"},button_width:{type:String,default:()=>"35px"}},emits:["update:visible","close"],computed:{description(){switch(this.statusAPI){case"pending":return this.pending_message;case"error":return this.error_message;case"success":return this.success_message;default:return""}}},methods:{handleClose(){this.$emit("close")}}}),aTe={class:"vsTailwind ui-dialog__wrapper"},lTe={class:"ui-dialog w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},cTe={class:"flex justify-between items-center py-3 px-4 border-b"},uTe={class:"font-bold text-gray-800 text-xl"},hTe={class:"ui-dialog__content p-4"},dTe={key:1,class:"justify-center grid"},fTe={key:2,class:"justify-center grid"},pTe={class:"grid justify-center p-4"},mTe={class:"ui-dialog-button grid justify-center p-4"};function gTe(t,e,n,r,i,o){const s=g.resolveComponent("vsLoader"),a=g.resolveComponent("IconCheckSuccess"),l=g.resolveComponent("IconError");return g.openBlock(),g.createBlock(g.Teleport,{to:"#modal"},[g.createVNode(g.Transition,{name:"fade"},{default:g.withCtx(()=>[g.createElementVNode("div",aTe,[g.createElementVNode("div",lTe,[g.createVNode(g.Transition,{name:"content",appear:""},{default:g.withCtx(()=>[g.createElementVNode("div",{class:"ui-dialog__modal opacity-1 transition-all flex flex-col bg-white border shadow-sm rounded-xl",style:g.normalizeStyle({fontSize:t.size})},[g.createElementVNode("div",cTe,[g.createElementVNode("h3",uTe,g.toDisplayString(t.title),1)]),g.createElementVNode("div",hTe,[t.statusAPI==="pending"?(g.openBlock(),g.createBlock(s,{key:0})):t.statusAPI==="success"?(g.openBlock(),g.createElementBlock("div",dTe,[g.createVNode(a,{width:"100",height:"100",fill:"green",stroke:"white"})])):t.statusAPI==="error"?(g.openBlock(),g.createElementBlock("div",fTe,[g.createVNode(l,{width:"100",height:"100",fill:"red",stroke:"white"})])):g.createCommentVNode("",!0),g.createElementVNode("div",pTe,g.toDisplayString(t.description),1)]),g.createElementVNode("div",mTe,[g.createElementVNode("button",{class:"h-[38px] px-[10px] rounded-lg bg-blue-500 text-[14px] text-white hover:bg-blue-700 duration-300",onClick:e[0]||(e[0]=(...c)=>t.handleClose&&t.handleClose(...c))},g.toDisplayString(t.button_text),1)])],4)]),_:1})])])]),_:1})])}const yTe=xt(sTe,[["render",gTe],["__scopeId","data-v-d973eee5"]]),vTe=g.defineComponent({props:{icon:{type:String,default:()=>"alert-circle"},message:{type:String,default:()=>"Сталася помилка під час завантаження даних"}}}),_Te={class:"flex flex-col items-center"};function bTe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",_Te,[g.createElementVNode("i",{class:g.normalizeClass(["text-red-500 text-6xl",[`ti ti-${t.icon}`]])},null,2),g.createElementVNode("p",null,g.toDisplayString(t.message),1)])}const wTe=xt(vTe,[["render",bTe]]),xTe={props:{columns:{type:Array,required:!0},rows:{type:Array,required:!1,default:""},pageSize:{type:Number,required:!1,default:10},searchPlaceholderText:{type:String,required:!1,default:"Пошук.."},loaded:{type:Boolean,required:!1,default:!1},placeholderWidth:{type:String,required:!1,default:"25%"},placeholderPosition:{type:String,required:!1,default:"left"},bordered:{type:Boolean,default:!0},isTableView:{type:Boolean,required:!1,default:!0}},components:{VsPagination:Rj,VsLoader:tk,VsText:Yu},computed:{placeholderClass(){return{"!justify-start":this.placeholderPosition==="left","!justify-right":this.placeholderPosition==="right","!justify-center":this.placeholderPosition==="center",[`!w-[${this.placeholderWidth}]`]:!0}},tableClass(){return{border:this.bordered}},rowClass(){return{border:this.bordered}},cellClass(){return{border:this.bordered}}},data(){return{page:1,currentRows:[],sortedRows:[],filteredRows:[],searchQuery:"",isPending:!1,sortColumn:null,sortKey:null,sortDirection:"asc"}},watch:{searchQuery(){this.filteredRows=this.filter(),this.handlePageChange(1)},sortedRows(){this.filteredRows=this.filter(),this.handlePageChange(1)}},beforeMount(){this.isPending=!0},mounted(){this.filteredRows=this.rows,this.sortedRows=this.rows,this.currentRows=this.filteredRows.slice(0,this.pageSize),this.isPending=!1},methods:{sortBy(t){this.sortKey=t,this.sortDirection=this.sortDirection==="asc"?"desc":"asc",this.sortedRows=[...this.rows].sort((e,n)=>{let r=0;return e[t]>n[t]?r=1:e[t]Object.values(t).some(e=>e.toString().toLowerCase().includes(this.searchQuery.toLowerCase()))):this.sortedRows},selectRow(t){const e=window.getSelection();let n="";e!=null&&e.toString().trim()&&(n=e.toString()),this.$emit("selected:id",t),this.$emit("selected:value",n)}}},ETe={key:0},STe={key:1,class:"overflow-x-auto grid"},CTe=["onClick"],kTe={class:"divide-y divide-gray-200"},TTe=["onMouseup"],MTe={class:"py-2 justify-center w-fit mx-auto"},ATe={key:2},ITe={class:"grid"},LTe=["onMouseup"];function PTe(t,e,n,r,i,o){const s=g.resolveComponent("VsLoader"),a=g.resolveComponent("VsText"),l=g.resolveComponent("VsPagination");return g.openBlock(),g.createElementBlock(g.Fragment,null,[n.loaded&&i.isPending?(g.openBlock(),g.createElementBlock("div",ETe,[g.createVNode(s,{class:"flex justify-center"})])):g.createCommentVNode("",!0),(!i.isPending||!n.loaded)&&n.isTableView?(g.openBlock(),g.createElementBlock("div",STe,[g.createVNode(a,{type:"text",modelValue:i.searchQuery,"onUpdate:modelValue":e[0]||(e[0]=c=>i.searchQuery=c),placeholder:n.searchPlaceholderText,class:g.normalizeClass(["mb-4 p-2 rounded flex",o.placeholderClass]),onKeydown:g.withKeys(o.removeFocus,["enter"])},null,8,["modelValue","placeholder","class","onKeydown"]),g.createElementVNode("table",{class:g.normalizeClass(["min-w-full divide-y-2 divide-gray-200 bg-white text-sm !table",o.tableClass])},[g.createElementVNode("thead",null,[g.createElementVNode("tr",null,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(n.columns,(c,u)=>(g.openBlock(),g.createElementBlock("th",{class:g.normalizeClass([o.tableClass,"whitespace-nowrap px-4 py-2 font-medium text-gray-900"]),onClick:d=>o.sortBy(u)},[g.createTextVNode(g.toDisplayString(c)+" ",1),g.createElementVNode("span",null,g.toDisplayString(i.sortDirection==="asc"?"▲":"▼"),1)],10,CTe))),256))])]),g.createElementVNode("tbody",kTe,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(i.currentRows,(c,u)=>(g.openBlock(),g.createElementBlock("tr",{class:g.normalizeClass([o.rowClass,"odd:bg-gray-50"]),onMouseup:d=>o.selectRow(u)},[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(c,(d,p)=>(g.openBlock(),g.createElementBlock("td",{class:g.normalizeClass([o.rowClass,"whitespace-nowrap px-4 py-2 font-medium text-gray-900"]),key:p},g.toDisplayString(d),3))),128))],42,TTe))),256))])],2),g.createElementVNode("div",MTe,[i.filteredRows.length>10?(g.openBlock(),g.createBlock(l,{key:0,total:i.filteredRows.length,onPageChange:o.handlePageChange,pageSize:n.pageSize},null,8,["total","onPageChange","pageSize"])):g.createCommentVNode("",!0)])])):(g.openBlock(),g.createElementBlock("div",ATe,[g.createElementVNode("div",ITe,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(n.rows,(c,u)=>(g.openBlock(),g.createElementBlock("div",{key:u,class:"q-ma-md",onMouseup:d=>o.selectRow(u)},[g.createElementVNode("div",null,[g.createElementVNode("div",{class:g.normalizeClass(o.rowClass)},g.toDisplayString(c),3)])],40,LTe))),128))])]))],64)}const NTe=xt(xTe,[["render",PTe],["__scopeId","data-v-ac1b7f95"]]),OTe={},DTe={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function RTe(t,e){return g.openBlock(),g.createElementBlock("svg",DTe,e[0]||(e[0]=[g.createElementVNode("path",{d:"M5 12h14"},null,-1)]))}const BTe=xt(OTe,[["render",RTe]]),FTe=g.defineComponent({components:{IconChevronDown:Ip,iconPlus:R6,iconMinus:BTe},data(){return{activeNames:[]}},methods:{getSlotItems(){return this.$slots.default?this.$slots.default():[]},toggle(t){this.activeNames.includes(t)?this.activeNames=this.activeNames.filter(e=>e!==t):this.activeNames.push(t)},isActive(t){return this.activeNames.includes(t)}}}),$Te={class:"collapse-item"},zTe=["onClick"],VTe={key:0,class:"collapse-content"};function jTe(t,e,n,r,i,o){const s=g.resolveComponent("iconMinus"),a=g.resolveComponent("iconPlus");return g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(t.getSlotItems(),l=>{var c,u,d,p,m;return g.openBlock(),g.createElementBlock("div",$Te,[g.createElementVNode("div",{onClick:y=>{var w;return t.toggle((w=l==null?void 0:l.props)==null?void 0:w.title)},class:g.normalizeClass(["py-3 inline-flex gap-x-3 w-full font-semibold focus:outline-none focus:text-gray-500 rounded-lg cursor-pointer",{"text-blue-600":t.isActive((c=l==null?void 0:l.props)==null?void 0:c.title),"items-center text-gray-800 hover:text-gray-500":!t.isActive((u=l==null?void 0:l.props)==null?void 0:u.title)}])},[t.isActive((d=l==null?void 0:l.props)==null?void 0:d.title)?(g.openBlock(),g.createBlock(s,{key:0,class:"text-blue-600 max-h-[14px] max-w-[14px]"})):(g.openBlock(),g.createBlock(a,{key:1,class:"text-gray-800 max-h-[14px] max-w-[14px]"})),g.createElementVNode("span",null,g.toDisplayString((p=l==null?void 0:l.props)==null?void 0:p.title),1)],10,zTe),t.isActive((m=l==null?void 0:l.props)==null?void 0:m.title)?(g.openBlock(),g.createElementBlock("div",VTe,[(g.openBlock(),g.createBlock(g.resolveDynamicComponent(l)))])):g.createCommentVNode("",!0)])}),256)}const UTe=xt(FTe,[["render",jTe],["__scopeId","data-v-f9c5c837"]]),HTe=g.defineComponent({props:{title:{type:String}}}),WTe={class:"collapse-item"};function GTe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",WTe,[g.renderSlot(t.$slots,"default")])}const qTe=xt(HTe,[["render",GTe]]),YTe={props:{title:String},data(){return{expanded:!1}}},ZTe={class:"hs-accordion"},XTe={class:"py-0.5 flex items-center gap-x-0.5 w-full"},KTe={class:"size-4 text-gray-800",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},JTe={key:0,d:"M12 5v14"},QTe={class:"duration-150 ml-[32px] before:block before:absolute relative inline-block before:w-[2px] before:h-[100%] before:bg-gray-100 before:left-[-22px] cursor-pointer"};function eMe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",null,[g.createElementVNode("div",null,[g.createElementVNode("div",ZTe,[g.createElementVNode("div",XTe,[g.createElementVNode("button",{class:"size-6 flex justify-center items-center hover:bg-gray-100 rounded-md",onClick:e[0]||(e[0]=s=>i.expanded=!i.expanded)},[(g.openBlock(),g.createElementBlock("svg",KTe,[e[2]||(e[2]=g.createElementVNode("path",{d:"M5 12h14"},null,-1)),i.expanded?g.createCommentVNode("",!0):(g.openBlock(),g.createElementBlock("path",JTe))]))]),g.createElementVNode("div",{class:"grow px-1.5 rounded-md cursor-pointer",onClick:e[1]||(e[1]=s=>i.expanded=!i.expanded)},[e[3]||(e[3]=g.createElementVNode("span",{class:"text-sm text-gray-800"},null,-1)),g.renderSlot(t.$slots,"title",{},()=>[g.createElementVNode("span",null,g.toDisplayString(n.title),1)],!0)])]),g.createVNode(g.Transition,{name:"fade"},{default:g.withCtx(()=>[g.withDirectives(g.createElementVNode("div",QTe,[g.renderSlot(t.$slots,"default",{},void 0,!0)],512),[[g.vShow,i.expanded]])]),_:3})])])])}const tMe=xt(YTe,[["render",eMe],["__scopeId","data-v-1e39b64d"]]);/*! * PhotoSwipe Lightbox 5.4.4 - https://photoswipe.com * (c) 2024 Dmytro Semenov */function G1(t,e,n){const r=document.createElement(e);return t&&(r.className=t),n&&n.appendChild(r),r}function nMe(t,e,n){let r=`translate3d(${t}px,0px,0)`;return n!==void 0&&(r+=` scale3d(${n},${n},1)`),r}function tN(t,e,n){t.style.width=typeof e=="number"?`${e}px`:e,t.style.height=typeof n=="number"?`${n}px`:n}const Tu={IDLE:"idle",LOADING:"loading",LOADED:"loaded",ERROR:"error"};function rMe(t){return"button"in t&&t.button===1||t.ctrlKey||t.metaKey||t.altKey||t.shiftKey}function q1(t,e,n=document){let r=[];if(t instanceof Element)r=[t];else if(t instanceof NodeList||Array.isArray(t))r=Array.from(t);else{const i=typeof t=="string"?t:e;i&&(r=Array.from(n.querySelectorAll(i)))}return r}function iMe(t){return typeof t=="function"&&t.prototype&&t.prototype.goTo}function a9(){return!!(navigator.vendor&&navigator.vendor.match(/apple/i))}let oMe=class{constructor(e,n){this.type=e,this.defaultPrevented=!1,n&&Object.assign(this,n)}preventDefault(){this.defaultPrevented=!0}},sMe=class{constructor(){this._listeners={},this._filters={},this.pswp=void 0,this.options=void 0}addFilter(e,n,r=100){var i,o,s;this._filters[e]||(this._filters[e]=[]),(i=this._filters[e])===null||i===void 0||i.push({fn:n,priority:r}),(o=this._filters[e])===null||o===void 0||o.sort((a,l)=>a.priority-l.priority),(s=this.pswp)===null||s===void 0||s.addFilter(e,n,r)}removeFilter(e,n){this._filters[e]&&(this._filters[e]=this._filters[e].filter(r=>r.fn!==n)),this.pswp&&this.pswp.removeFilter(e,n)}applyFilters(e,...n){var r;return(r=this._filters[e])===null||r===void 0||r.forEach(i=>{n[0]=i.fn.apply(this,n)}),n[0]}on(e,n){var r,i;this._listeners[e]||(this._listeners[e]=[]),(r=this._listeners[e])===null||r===void 0||r.push(n),(i=this.pswp)===null||i===void 0||i.on(e,n)}off(e,n){var r;this._listeners[e]&&(this._listeners[e]=this._listeners[e].filter(i=>n!==i)),(r=this.pswp)===null||r===void 0||r.off(e,n)}dispatch(e,n){var r;if(this.pswp)return this.pswp.dispatch(e,n);const i=new oMe(e,n);return(r=this._listeners[e])===null||r===void 0||r.forEach(o=>{o.call(this,i)}),i}},aMe=class{constructor(e,n){if(this.element=G1("pswp__img pswp__img--placeholder",e?"img":"div",n),e){const r=this.element;r.decoding="async",r.alt="",r.src=e,r.setAttribute("role","presentation")}this.element.setAttribute("aria-hidden","true")}setDisplayedSize(e,n){this.element&&(this.element.tagName==="IMG"?(tN(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=nMe(0,0,e/250)):tN(this.element,e,n))}destroy(){var e;(e=this.element)!==null&&e!==void 0&&e.parentNode&&this.element.remove(),this.element=null}},lMe=class{constructor(e,n,r){this.instance=n,this.data=e,this.index=r,this.element=void 0,this.placeholder=void 0,this.slide=void 0,this.displayedImageWidth=0,this.displayedImageHeight=0,this.width=Number(this.data.w)||Number(this.data.width)||0,this.height=Number(this.data.h)||Number(this.data.height)||0,this.isAttached=!1,this.hasSlide=!1,this.isDecoding=!1,this.state=Tu.IDLE,this.data.type?this.type=this.data.type:this.data.src?this.type="image":this.type="html",this.instance.dispatch("contentInit",{content:this})}removePlaceholder(){this.placeholder&&!this.keepPlaceholder()&&setTimeout(()=>{this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0)},1e3)}load(e,n){if(this.slide&&this.usePlaceholder())if(this.placeholder){const r=this.placeholder.element;r&&!r.parentElement&&this.slide.container.prepend(r)}else{const r=this.instance.applyFilters("placeholderSrc",this.data.msrc&&this.slide.isFirstSlide?this.data.msrc:!1,this);this.placeholder=new aMe(r,this.slide.container)}this.element&&!n||this.instance.dispatch("contentLoad",{content:this,isLazy:e}).defaultPrevented||(this.isImageContent()?(this.element=G1("pswp__img","img"),this.displayedImageWidth&&this.loadImage(e)):(this.element=G1("pswp__content","div"),this.element.innerHTML=this.data.html||""),n&&this.slide&&this.slide.updateContentSize(!0))}loadImage(e){var n,r;if(!this.isImageContent()||!this.element||this.instance.dispatch("contentLoadImage",{content:this,isLazy:e}).defaultPrevented)return;const i=this.element;this.updateSrcsetSizes(),this.data.srcset&&(i.srcset=this.data.srcset),i.src=(n=this.data.src)!==null&&n!==void 0?n:"",i.alt=(r=this.data.alt)!==null&&r!==void 0?r:"",this.state=Tu.LOADING,i.complete?this.onLoaded():(i.onload=()=>{this.onLoaded()},i.onerror=()=>{this.onError()})}setSlide(e){this.slide=e,this.hasSlide=!0,this.instance=e.pswp}onLoaded(){this.state=Tu.LOADED,this.slide&&this.element&&(this.instance.dispatch("loadComplete",{slide:this.slide,content:this}),this.slide.isActive&&this.slide.heavyAppended&&!this.element.parentNode&&(this.append(),this.slide.updateContentSize(!0)),(this.state===Tu.LOADED||this.state===Tu.ERROR)&&this.removePlaceholder())}onError(){this.state=Tu.ERROR,this.slide&&(this.displayError(),this.instance.dispatch("loadComplete",{slide:this.slide,isError:!0,content:this}),this.instance.dispatch("loadError",{slide:this.slide,content:this}))}isLoading(){return this.instance.applyFilters("isContentLoading",this.state===Tu.LOADING,this)}isError(){return this.state===Tu.ERROR}isImageContent(){return this.type==="image"}setDisplayedSize(e,n){if(this.element&&(this.placeholder&&this.placeholder.setDisplayedSize(e,n),!this.instance.dispatch("contentResize",{content:this,width:e,height:n}).defaultPrevented&&(tN(this.element,e,n),this.isImageContent()&&!this.isError()))){const r=!this.displayedImageWidth&&e;this.displayedImageWidth=e,this.displayedImageHeight=n,r?this.loadImage(!1):this.updateSrcsetSizes(),this.slide&&this.instance.dispatch("imageSizeChange",{slide:this.slide,width:e,height:n,content:this})}}isZoomable(){return this.instance.applyFilters("isContentZoomable",this.isImageContent()&&this.state!==Tu.ERROR,this)}updateSrcsetSizes(){if(!this.isImageContent()||!this.element||!this.data.srcset)return;const e=this.element,n=this.instance.applyFilters("srcsetSizesWidth",this.displayedImageWidth,this);(!e.dataset.largestUsedSize||n>parseInt(e.dataset.largestUsedSize,10))&&(e.sizes=n+"px",e.dataset.largestUsedSize=String(n))}usePlaceholder(){return this.instance.applyFilters("useContentPlaceholder",this.isImageContent(),this)}lazyLoad(){this.instance.dispatch("contentLazyLoad",{content:this}).defaultPrevented||this.load(!0)}keepPlaceholder(){return this.instance.applyFilters("isKeepingPlaceholder",this.isLoading(),this)}destroy(){this.hasSlide=!1,this.slide=void 0,!this.instance.dispatch("contentDestroy",{content:this}).defaultPrevented&&(this.remove(),this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0),this.isImageContent()&&this.element&&(this.element.onload=null,this.element.onerror=null,this.element=void 0))}displayError(){if(this.slide){var e,n;let r=G1("pswp__error-msg","div");r.innerText=(e=(n=this.instance.options)===null||n===void 0?void 0:n.errorMsg)!==null&&e!==void 0?e:"",r=this.instance.applyFilters("contentErrorElement",r,this),this.element=G1("pswp__content pswp__error-msg-container","div"),this.element.appendChild(r),this.slide.container.innerText="",this.slide.container.appendChild(this.element),this.slide.updateContentSize(!0),this.removePlaceholder()}}append(){if(this.isAttached||!this.element)return;if(this.isAttached=!0,this.state===Tu.ERROR){this.displayError();return}if(this.instance.dispatch("contentAppend",{content:this}).defaultPrevented)return;const e="decode"in this.element;this.isImageContent()?e&&this.slide&&(!this.slide.isActive||a9())?(this.isDecoding=!0,this.element.decode().catch(()=>{}).finally(()=>{this.isDecoding=!1,this.appendImage()})):this.appendImage():this.slide&&!this.element.parentNode&&this.slide.container.appendChild(this.element)}activate(){this.instance.dispatch("contentActivate",{content:this}).defaultPrevented||!this.slide||(this.isImageContent()&&this.isDecoding&&!a9()?this.appendImage():this.isError()&&this.load(!1,!0),this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","false"))}deactivate(){this.instance.dispatch("contentDeactivate",{content:this}),this.slide&&this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","true")}remove(){this.isAttached=!1,!this.instance.dispatch("contentRemove",{content:this}).defaultPrevented&&(this.element&&this.element.parentNode&&this.element.remove(),this.placeholder&&this.placeholder.element&&this.placeholder.element.remove())}appendImage(){this.isAttached&&(this.instance.dispatch("contentAppendImage",{content:this}).defaultPrevented||(this.slide&&this.element&&!this.element.parentNode&&this.slide.container.appendChild(this.element),(this.state===Tu.LOADED||this.state===Tu.ERROR)&&this.removePlaceholder()))}};function cMe(t,e){if(t.getViewportSizeFn){const n=t.getViewportSizeFn(t,e);if(n)return n}return{x:document.documentElement.clientWidth,y:window.innerHeight}}function lk(t,e,n,r,i){let o=0;if(e.paddingFn)o=e.paddingFn(n,r,i)[t];else if(e.padding)o=e.padding[t];else{const s="padding"+t[0].toUpperCase()+t.slice(1);e[s]&&(o=e[s])}return Number(o)||0}function uMe(t,e,n,r){return{x:e.x-lk("left",t,e,n,r)-lk("right",t,e,n,r),y:e.y-lk("top",t,e,n,r)-lk("bottom",t,e,n,r)}}const l9=4e3;let hMe=class{constructor(e,n,r,i){this.pswp=i,this.options=e,this.itemData=n,this.index=r,this.panAreaSize=null,this.elementSize=null,this.fit=1,this.fill=1,this.vFill=1,this.initial=1,this.secondary=1,this.max=1,this.min=1}update(e,n,r){const i={x:e,y:n};this.elementSize=i,this.panAreaSize=r;const o=r.x/i.x,s=r.y/i.y;this.fit=Math.min(1,os?o:s),this.vFill=Math.min(1,s),this.initial=this._getInitial(),this.secondary=this._getSecondary(),this.max=Math.max(this.initial,this.secondary,this._getMax()),this.min=Math.min(this.fit,this.initial,this.secondary),this.pswp&&this.pswp.dispatch("zoomLevelsUpdate",{zoomLevels:this,slideData:this.itemData})}_parseZoomLevelOption(e){const n=e+"ZoomLevel",r=this.options[n];if(r)return typeof r=="function"?r(this):r==="fill"?this.fill:r==="fit"?this.fit:Number(r)}_getSecondary(){let e=this._parseZoomLevelOption("secondary");return e||(e=Math.min(1,this.fit*3),this.elementSize&&e*this.elementSize.x>l9&&(e=l9/this.elementSize.x),e)}_getInitial(){return this._parseZoomLevelOption("initial")||this.fit}_getMax(){return this._parseZoomLevelOption("max")||Math.max(1,this.fit*4)}};function c9(t,e,n){const r=e.createContentFromData(t,n);let i;const{options:o}=e;if(o){i=new hMe(o,t,-1);let s;e.pswp?s=e.pswp.viewportSize:s=cMe(o,e);const a=uMe(o,s,t,n);i.update(r.width,r.height,a)}return r.lazyLoad(),i&&r.setDisplayedSize(Math.ceil(r.width*i.initial),Math.ceil(r.height*i.initial)),r}function dMe(t,e){const n=e.getItemData(t);if(!e.dispatch("lazyLoadSlide",{index:t,itemData:n}).defaultPrevented)return c9(n,e,t)}let fMe=class extends sMe{getNumItems(){var e;let n=0;const r=(e=this.options)===null||e===void 0?void 0:e.dataSource;r&&"length"in r?n=r.length:r&&"gallery"in r&&(r.items||(r.items=this._getGalleryDOMElements(r.gallery)),r.items&&(n=r.items.length));const i=this.dispatch("numItems",{dataSource:r,numItems:n});return this.applyFilters("numItems",i.numItems,r)}createContentFromData(e,n){return new lMe(e,this,n)}getItemData(e){var n;const r=(n=this.options)===null||n===void 0?void 0:n.dataSource;let i={};Array.isArray(r)?i=r[e]:r&&"gallery"in r&&(r.items||(r.items=this._getGalleryDOMElements(r.gallery)),i=r.items[e]);let o=i;o instanceof Element&&(o=this._domElementToItemData(o));const s=this.dispatch("itemData",{itemData:o||{},index:e});return this.applyFilters("itemData",s.itemData,e)}_getGalleryDOMElements(e){var n,r;return(n=this.options)!==null&&n!==void 0&&n.children||(r=this.options)!==null&&r!==void 0&&r.childSelector?q1(this.options.children,this.options.childSelector,e)||[]:[e]}_domElementToItemData(e){const n={element:e},r=e.tagName==="A"?e:e.querySelector("a");if(r){n.src=r.dataset.pswpSrc||r.href,r.dataset.pswpSrcset&&(n.srcset=r.dataset.pswpSrcset),n.width=r.dataset.pswpWidth?parseInt(r.dataset.pswpWidth,10):0,n.height=r.dataset.pswpHeight?parseInt(r.dataset.pswpHeight,10):0,n.w=n.width,n.h=n.height,r.dataset.pswpType&&(n.type=r.dataset.pswpType);const o=e.querySelector("img");if(o){var i;n.msrc=o.currentSrc||o.src,n.alt=(i=o.getAttribute("alt"))!==null&&i!==void 0?i:""}(r.dataset.pswpCropped||r.dataset.cropped)&&(n.thumbCropped=!0)}return this.applyFilters("domItemData",n,e,r)}lazyLoadData(e,n){return c9(e,this,n)}};class u9 extends fMe{constructor(e){super(),this.options=e||{},this._uid=0,this.shouldOpen=!1,this._preloadedContent=void 0,this.onThumbnailsClick=this.onThumbnailsClick.bind(this)}init(){q1(this.options.gallery,this.options.gallerySelector).forEach(e=>{e.addEventListener("click",this.onThumbnailsClick,!1)})}onThumbnailsClick(e){if(rMe(e)||window.pswp)return;let n={x:e.clientX,y:e.clientY};!n.x&&!n.y&&(n=null);let r=this.getClickedIndex(e);r=this.applyFilters("clickedIndex",r,e,this);const i={gallery:e.currentTarget};r>=0&&(e.preventDefault(),this.loadAndOpen(r,i,n))}getClickedIndex(e){if(this.options.getClickedIndexFn)return this.options.getClickedIndexFn.call(this,e);const n=e.target,i=q1(this.options.children,this.options.childSelector,e.currentTarget).findIndex(o=>o===n||o.contains(n));return i!==-1?i:this.options.children||this.options.childSelector?-1:0}loadAndOpen(e,n,r){if(window.pswp||!this.options)return!1;if(!n&&this.options.gallery&&this.options.children){const i=q1(this.options.gallery);i[0]&&(n={gallery:i[0]})}return this.options.index=e,this.options.initialPointerPos=r,this.shouldOpen=!0,this.preload(e,n),!0}preload(e,n){const{options:r}=this;n&&(r.dataSource=n);const i=[],o=typeof r.pswpModule;if(iMe(r.pswpModule))i.push(Promise.resolve(r.pswpModule));else{if(o==="string")throw new Error("pswpModule as string is no longer supported");if(o==="function")i.push(r.pswpModule());else throw new Error("pswpModule is not valid")}typeof r.openPromise=="function"&&i.push(r.openPromise()),r.preloadFirstSlide!==!1&&e>=0&&(this._preloadedContent=dMe(e,this));const s=++this._uid;Promise.all(i).then(a=>{if(this.shouldOpen){const l=a[0];this._openPhotoswipe(l,s)}})}_openPhotoswipe(e,n){if(n!==this._uid&&this.shouldOpen||(this.shouldOpen=!1,window.pswp))return;const r=typeof e=="object"?new e.default(this.options):new e(this.options);this.pswp=r,window.pswp=r,Object.keys(this._listeners).forEach(i=>{var o;(o=this._listeners[i])===null||o===void 0||o.forEach(s=>{r.on(i,s)})}),Object.keys(this._filters).forEach(i=>{var o;(o=this._filters[i])===null||o===void 0||o.forEach(s=>{r.addFilter(i,s.fn,s.priority)})}),this._preloadedContent&&(r.contentLoader.addToCache(this._preloadedContent),this._preloadedContent=void 0),r.on("destroy",()=>{this.pswp=void 0,delete window.pswp}),r.init()}destroy(){var e;(e=this.pswp)===null||e===void 0||e.destroy(),this.shouldOpen=!1,this._listeners={},q1(this.options.gallery,this.options.gallerySelector).forEach(n=>{n.removeEventListener("click",this.onThumbnailsClick,!1)})}}const pMe={components:{Swiper:n9,SwiperSlide:r9},props:["images","width","height"],data(){return{lightbox:null,formatedImages:[]}},async mounted(){this.formatedImages=await this.transformImageUrls(this.images),this.lightbox||(this.lightbox=new u9({gallery:"#lightbox-gallery",children:"a",pswpModule:()=>Promise.resolve().then(()=>YZ)}),this.lightbox.init())},unmounted(){this.lightbox&&(this.lightbox.destroy(),this.lightbox=null)},methods:{async transformImageUrls(t){return await Promise.all(t.map(async n=>{const r=new Image;return r.src=n,new Promise(i=>{r.onload=()=>{const o=r.naturalWidth,s=r.naturalHeight;i({file_path:n,width:o.toString(),height:s.toString()})},r.onerror=()=>{console.error(`Не вдалося завантажити зображення за URL: ${n}`),i({path:n,width:"1440",height:"1200"})}})}))}},setup(){const t=g.ref(null);return{thumbsSwiper:t,setThumbsSwiper:n=>{t.value=n},modules:[s9,eN,o9]}}},mMe={key:0},gMe={key:0},yMe=["href","data-pswp-width","data-pswp-height"],vMe=["src"],_Me={class:"max-w-full"},bMe=["src"],wMe={key:1},xMe={key:1,id:"lightbox-gallery"},EMe=["href","data-pswp-width","data-pswp-height"],SMe=["src"];function CMe(t,e,n,r,i,o){var l,c,u,d,p,m,y,w,x;const s=g.resolveComponent("swiper-slide"),a=g.resolveComponent("swiper");return n.images.length>1?(g.openBlock(),g.createElementBlock("div",mMe,[g.createElementVNode("div",{class:"widget-images flex flex-col xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800",style:g.normalizeStyle({width:n.width+"px"}),id:"lightbox-gallery"},[(l=i.formatedImages)!=null&&l.length?(g.openBlock(),g.createElementBlock("div",gMe,[g.createElementVNode("div",null,[g.createVNode(a,{loop:!0,spaceBetween:10,modules:r.modules,thumbs:{swiper:r.thumbsSwiper},class:"mySwiper2 w-full max-h-[300px] min-h-[300px] object-cover rounded-lg mb-3",ref:"box"},{default:g.withCtx(()=>[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(i.formatedImages,(C,S)=>(g.openBlock(),g.createBlock(s,{key:S,class:"max-w-full rounded-lg mb-3"},{default:g.withCtx(()=>[g.createElementVNode("a",{href:C.file_path,"data-pswp-width":C.width,"data-pswp-height":C.height,target:"_blank",rel:"noreferrer"},[g.createElementVNode("img",{src:C.file_path||"/src/assets/images/no-image.jpg",alt:"alt",class:"object-cover mx-auto rounded-lg min-h-[300px]"},null,8,vMe)],8,yMe)]),_:2},1024))),128))]),_:1},8,["modules","thumbs"])]),g.createElementVNode("div",_Me,[g.createVNode(a,{onSwiper:r.setThumbsSwiper,spaceBetween:10,slidesPerView:4,freeMode:!0,watchSlidesProgress:!0,loop:!0,modules:r.modules,class:"mySwiper1 h-[110px]"},{default:g.withCtx(()=>[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(i.formatedImages,C=>(g.openBlock(),g.createBlock(s,{key:C.file_path},{default:g.withCtx(()=>[g.createElementVNode("img",{class:"object-cover mx-auto rounded-lg min-h-[110px]",src:C.file_path||"/src/assets/images/no-image.jpg",alt:"alt"},null,8,bMe)]),_:2},1024))),128))]),_:1},8,["onSwiper","modules"])])])):(g.openBlock(),g.createElementBlock("div",wMe,e[0]||(e[0]=[g.createElementVNode("p",{class:"pl-3 text-sm font-medium text-gray-600"}," Зображення відсутні ",-1)])))],4)])):(g.openBlock(),g.createElementBlock("div",xMe,[g.createElementVNode("a",{href:(u=(c=i.formatedImages)==null?void 0:c[0])==null?void 0:u.file_path,"data-pswp-width":(p=(d=i.formatedImages)==null?void 0:d[0])==null?void 0:p.width,"data-pswp-height":(y=(m=i.formatedImages)==null?void 0:m[0])==null?void 0:y.height,target:"_blank",rel:"noreferrer"},[g.createElementVNode("img",{src:((x=(w=i.formatedImages)==null?void 0:w[0])==null?void 0:x.file_path)||"/src/assets/images/no-image.jpg",alt:"alt",class:"object-cover mx-auto rounded-lg",style:g.normalizeStyle({width:n.width+"px",height:n.height+"px"})},null,12,SMe)],8,EMe)]))}const kMe=xt(pMe,[["render",CMe]]),TMe={props:["images","width","height"],data(){return{lightbox:null,formatedImages:[]}},watch:{images:{deep:!0,async handler(t){console.log(this.images),this.formatedImages=this.images?await this.transformImageUrls(this.images):[]}}},async mounted(){this.formatedImages=this.images?await this.transformImageUrls(this.images):[],this.lightbox||(this.lightbox=new u9({gallery:"#lightbox-gallery",children:"a",pswpModule:()=>Promise.resolve().then(()=>YZ)}),this.lightbox.init())},unmounted(){this.lightbox&&(this.lightbox.destroy(),this.lightbox=null)},methods:{async transformImageUrls(t=[]){return await Promise.all(t.map(async n=>{const r=new Image;return r.src=n,new Promise(i=>{r.onload=()=>{const o=r.naturalWidth,s=r.naturalHeight;i({file_path_resize:`/file/resize?filepath=${n}`,file_path:n,width:o.toString(),height:s.toString()})},r.onerror=()=>{console.error(`Не вдалося завантажити зображення за URL: ${n}`),i({path:n,width:"1440",height:"1200"})}})}))}},setup(){const t=g.ref(null);return{thumbsSwiper:t,setThumbsSwiper:n=>{t.value=n},modules:[s9,eN,o9]}}},MMe={key:0,class:"image-wrapper h-full max-h-[400px]",id:"lightbox-gallery"},AMe=["modules","thumbs"],IMe=["href","data-pswp-width","data-pswp-height"],LMe=["src"],PMe={key:0,class:"thumb-cover"},NMe=["href","data-pswp-width","data-pswp-height"],OMe=["src"],DMe={key:1,id:"lightbox-gallery"},RMe=["href","data-pswp-width","data-pswp-height"],BMe=["src"];function FMe(t,e,n,r,i,o){var s,a,l,c,u,d,p,m,y;return((s=n.images)==null?void 0:s.length)>1?(g.openBlock(),g.createElementBlock("div",MMe,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(i.formatedImages,(w,x)=>{var C,S;return g.openBlock(),g.createElementBlock("div",{class:g.normalizeClass("h-full w-full image"+x),key:x,modules:r.modules,thumbs:{swiper:r.thumbsSwiper}},[x<5?(g.openBlock(),g.createElementBlock("a",{key:0,href:w.file_path,"data-pswp-width":w.width,"data-pswp-height":w.height,target:"_blank",rel:"noreferrer",class:"relative block h-full w-full"},[g.createElementVNode("img",{src:w.file_path_resize||w,alt:"alt",height:"auto",width:"100%",class:g.normalizeClass(["object-cover h-full w-full",x===0?"max-h-[411px]":"max-h-[calc((411px-3px)/2)]"])},null,10,LMe),x===4&&((C=i.formatedImages)==null?void 0:C.length)>5?(g.openBlock(),g.createElementBlock("div",PMe," +"+g.toDisplayString(((S=i.formatedImages)==null?void 0:S.length)-5),1)):g.createCommentVNode("",!0)],8,IMe)):(g.openBlock(),g.createElementBlock("a",{key:1,href:w.file_path,"data-pswp-width":w.width,"data-pswp-height":w.height,target:"_blank",rel:"noreferrer",class:"hidden"},[g.createElementVNode("img",{src:w.file_path_resize||"/src/assets/images/no-image.jpg",alt:"alt",height:"auto",width:"100%",class:"object-fill"},null,8,OMe)],8,NMe))],10,AMe)}),128))])):(g.openBlock(),g.createElementBlock("div",DMe,[g.createElementVNode("a",{href:(l=(a=i.formatedImages)==null?void 0:a[0])==null?void 0:l.file_path,"data-pswp-width":(u=(c=i.formatedImages)==null?void 0:c[0])==null?void 0:u.width,"data-pswp-height":(p=(d=i.formatedImages)==null?void 0:d[0])==null?void 0:p.height,target:"_blank",rel:"noreferrer",style:g.normalizeStyle({width:n.width+"px",height:n.height+"px"})},[g.createElementVNode("img",{src:((y=(m=i.formatedImages)==null?void 0:m[0])==null?void 0:y.file_path_resize)||"/src/assets/images/no-image.jpg",alt:"alt",class:"object-cover mx-auto",style:g.normalizeStyle({width:n.width+"px",height:n.height+"px"})},null,12,BMe)],12,RMe)]))}const $Me=xt(TMe,[["render",FMe]]),zMe={props:{width:{type:String,default:"80%"},stepString:{type:String,default:"Крок"}},data(){return{currentStep:0}},components:{IconChevronDown:Ip,IconCheck:cf},computed:{steps(){return this.$slots.default?this.$slots.default():[]},stepperClass(){return{[`!w-[${this.width}]`]:!0}}},methods:{nextStep(){this.currentStep0&&this.currentStep--},goToStep(t){this.currentStep=t}}},VMe={class:"flex w-full mb-[30px]"},jMe=["onClick"],UMe={key:0},HMe={class:""},WMe={class:"p-4 h-48 flex justify-center items-center border border-dashed border-gray-200 rounded-xl"},GMe={class:"flex justify-between mt-[20px]"},qMe=["disabled"],YMe=["disabled"];function ZMe(t,e,n,r,i,o){const s=g.resolveComponent("IconCheck"),a=g.resolveComponent("IconChevronDown");return g.openBlock(),g.createElementBlock("div",{class:g.normalizeClass(["p-6 border rounded-xl shadow-sm",o.stepperClass])},[g.createElementVNode("div",VMe,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(o.steps,(l,c)=>(g.openBlock(),g.createElementBlock("div",{key:c,class:"flex items-center gap-[4px]"},[g.createElementVNode("div",{class:g.normalizeClass(["h-[30px] w-[30px] flex justify-center items-center shrink-0 text-[12px] font-medium rounded-full",{"bg-blue-600 text-white":c<=i.currentStep,"bg-gray-100 text-gray-800":c>i.currentStep}]),onClick:u=>o.goToStep(c)},[c>=i.currentStep?(g.openBlock(),g.createElementBlock("span",UMe,g.toDisplayString(c+1),1)):(g.openBlock(),g.createBlock(s,{key:1,height:"14",width:"14"}))],10,jMe),g.createElementVNode("div",HMe,g.toDisplayString(n.stepString),1),c(g.openBlock(),g.createElementBlock("div",{key:c},[c===i.currentStep?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(l),{key:0})):g.createCommentVNode("",!0)]))),128))]),g.createElementVNode("div",GMe,[g.createElementVNode("button",{onClick:e[0]||(e[0]=(...l)=>o.prevStep&&o.prevStep(...l)),disabled:i.currentStep===0,class:"py-2 px-3 inline-flex items-center gap-x-1 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 focus:outline-none focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none disabled"},[g.createVNode(a,{height:"16",width:"16",class:"rotate-90"}),e[2]||(e[2]=g.createTextVNode(" Назад "))],8,qMe),g.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>o.nextStep&&o.nextStep(...l)),disabled:i.currentStep===o.steps.length-1,class:"py-2 px-3 inline-flex items-center gap-x-1 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 focus:outline-none focus:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none"},[e[3]||(e[3]=g.createTextVNode(" Наступний крок ")),g.createVNode(a,{height:"16",width:"16",class:"-rotate-90"})],8,YMe)])],2)}const XMe=xt(zMe,[["render",ZMe]]),KMe={components:{IconCheck:cf,IconClose:Fa,VsPopover:Dp},props:{modelValue:null,component:{type:String,default:()=>"vs-text"},placeholder:{type:String},title:{type:String,default:()=>"Редагувати"}},data(){return{value:null}},mounted(){this.value=this.modelValue},watch:{modelValue(t){this.value=t}},methods:{toggleVisible(){this.isVisible=!this.isVisible,setTimeout(()=>this.value=this.modelValue)},closePopover(){this.$refs.popover.togglePopover(),this.value=this.modelValue},updateValue(){this.$emit("update-value",this.value),this.closePopover()},autofocusInput(t){var e;t?window.addEventListener("keydown",this.enterInPopover):window.removeEventListener("keydown",this.enterInPopover),!(!t||this.component!=="vs-text")&&((e=this.$refs.vsText)==null||e.inputFocus())},enterInPopover({code:t}){t==="Enter"&&this.updateValue(),t==="Escape"&&this.$refs.popover.togglePopover()}}},JMe={class:"opacity-1 transition-all flex flex-col dark:bg-[#1A1A1A] pointer-events-auto"},QMe={class:"py-2.5 px-3 flex justify-between items-center"},eAe={class:"text-lg font-medium text-black dark:text-neutral-200"},tAe={class:"flex gap-2 p-[10px] pt-0"},nAe={class:"flex gap-[4px] p-[10px] pt-0 justify-end"};function rAe(t,e,n,r,i,o){const s=g.resolveComponent("VsPopover");return g.openBlock(),g.createBlock(s,{ref:"popover",onIsvisible:o.autofocusInput,placement:"top"},{reference:g.withCtx(()=>[g.renderSlot(t.$slots,"default")]),default:g.withCtx(()=>[g.createElementVNode("div",JMe,[g.createElementVNode("div",QMe,[g.createElementVNode("h3",eAe,g.toDisplayString(n.title),1)]),g.createElementVNode("div",tAe,[(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.component),{ref:"vsText",modelValue:i.value,"onUpdate:modelValue":e[0]||(e[0]=a=>i.value=a),placeholder:n.placeholder,class:"w-full min-w-[300px]"},null,8,["modelValue","placeholder"]))]),g.createElementVNode("div",nAe,[g.createElementVNode("button",{onClick:e[1]||(e[1]=(...a)=>o.closePopover&&o.closePopover(...a)),type:"button",class:"inline-flex items-center px-3 py-2 text-xs font-medium duration-300 border rounded-lg shadow-sm gap-x-2 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50"}," Скасувати "),g.createElementVNode("button",{onClick:e[2]||(e[2]=(...a)=>o.updateValue&&o.updateValue(...a)),type:"button",class:"inline-flex items-center px-3 py-2 text-xs font-medium text-white duration-300 bg-blue-500 rounded-lg gap-x-2 disabled:opacity-50 disabled:pointer-events-none"}," Зберегти ")])])]),_:3},8,["onIsvisible"])}const iAe=xt(KMe,[["render",rAe]]),oAe={props:["geom"],data(){return{map:null,mapid:"",coordinates:null,center:[50.4501,30.5234],baseLayer:{id:"topo100",name:"Topomap Ukraine",url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",service:"TMS",scale:1e5,category:"Національна інфраструктура геопросторових даних",bounds:"ua",owner:"НДІГК (Інститут геодезії та картографії)",image:"https://data.softpro.ua/api-user/rtile/voyager/ua/8/149/86.png",basemap:!1}}},async mounted(){try{this.mapid=`map-${Math.random().toString(36)}`,await this.$nextTick(),this.changeGeom(),await this.loadStylesheet("https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"),await this.loadStylesheet("https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.css"),await this.loadScript("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"),this.loadScript("https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.js").then(()=>{this.initMap()})}catch(t){console.error(t)}},methods:{loadScript(t,e="script"){return new Promise((n,r)=>{let i;e==="script"?(i=document.createElement("script"),i.src=t):e==="link"&&(i=document.createElement("link"),i.rel="stylesheet",i.href=t),i.onload=n,i.onerror=r,document.head.appendChild(i)})},loadStylesheet(t){return new Promise((e,n)=>{const r=document.createElement("link");r.rel="stylesheet",r.href=t,r.onload=()=>e(),r.onerror=()=>n(new Error(`Failed to load stylesheet: ${t}`)),document.head.appendChild(r)})},async initMap(){var t;try{this.map=L.map(this.mapid).setView(this.center,9);const e=L.tileLayer(this.baseLayer.url,{maxZoom:this.baseLayer.maxzoom||16,attribution:this.baseLayer.attribution||'© '}).addTo(this.map),n={};if(!this.coordinates)return;((t=this.geom)==null?void 0:t.type)==="Point"&&L.circle(this.coordinates,{radius:200}).addTo(this.map),L.polygon(this.coordinates,{color:"#da1d9f",fillColor:"#da1d9f",fillOpacity:.2,opacity:.5}).addTo(this.map)}catch(e){console.error(e)}},changeGeom(){var t,e,n;try{if(!this.geom)return;let r;const{type:i,coordinates:o}=this.geom;switch(i){case"Polygon":r=ur(o),this.coordinates=r==null?void 0:r.geometry.coordinates[0].map(s=>[...s].reverse()),this.center=(t=Wd(r).geometry.coordinates)==null?void 0:t.reverse();break;case"MultiPolygon":r=pl(o),this.coordinates=r==null?void 0:r.geometry.coordinates[0].map(s=>s.map(a=>[...a].reverse())),this.center=(e=Wd(r).geometry.coordinates)==null?void 0:e.reverse();break;case"LineString":r=li(o),this.coordinates=o.map(s=>[...s].reverse()),this.center=(n=Wd(r).geometry.coordinates[0])==null?void 0:n.reverse();break;case"Point":this.coordinates=o.reverse(),this.center=o;break;default:return}}catch(r){console.error(r)}}}},sAe=["id"];function aAe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("div",{id:i.mapid,class:"w-full h-full rounded-[30px]"},null,8,sAe)}const lAe=xt(oAe,[["render",aAe],["__scopeId","data-v-529a65c9"]]),cAe={key:0,class:"vsTailwind ui-dialog__wrapper"},uAe={class:"ui-dialog__modal opacity-1 w-[448px] transition-all flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl"},hAe={class:"py-2.5 px-4 flex justify-between items-center border-gray-200 dark:border-b-[#454545]"},dAe={class:"text-lg font-medium text-gray-800 dark:text-neutral-200"},fAe={class:"ui-dialog__content p-4 py-0"},pAe={key:0,class:"flex justify-end gap-x-2"},mAe=xt({__name:"vs-confirm",props:{visible:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""}},emits:["update:visible"],setup(t,{emit:e}){const n=g.useSlots(),r=(s="default")=>!!n[s],i=e,o=()=>{i("update:visible",!1)};return(s,a)=>(g.openBlock(),g.createBlock(g.Teleport,{to:"#modal"},[t.visible?(g.openBlock(),g.createElementBlock("div",cAe,[g.createElementVNode("div",{onClick:a[0]||(a[0]=(...l)=>s.closeByClickBack&&s.closeByClickBack(...l)),class:"vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},[g.createVNode(g.Transition,{name:"content",appear:""},{default:g.withCtx(()=>[g.createElementVNode("div",uAe,[g.createElementVNode("div",hAe,[g.createElementVNode("h3",dAe,g.toDisplayString(t.title),1),g.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:o},a[1]||(a[1]=[g.createElementVNode("span",{class:"sr-only"},"Close",-1),g.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[g.createElementVNode("path",{d:"M18 6 6 18"}),g.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),g.createElementVNode("div",fAe,[g.renderSlot(s.$slots,"default",{},void 0,!0)]),r("footer")?(g.openBlock(),g.createElementBlock("div",pAe,[g.renderSlot(s.$slots,"footer",{},void 0,!0)])):g.createCommentVNode("",!0)])]),_:3})])])):g.createCommentVNode("",!0)]))}},[["__scopeId","data-v-0656bd87"]]),gAe={class:"absolute top-0 left-0 bottom-0 h-full overflow-hidden w-full select-none"},yAe={class:"h-[400px] w-[400px]"},vAe={__name:"vs-diff",setup(t){const e=g.ref({width:50}),n=g.ref({width:50}),r=g.ref(),i=g.ref({width:"100%",height:"100%"}),o=g.ref(!1),s=c=>{o.value=!0,document.addEventListener("mousemove",a),document.addEventListener("mouseup",l)},a=c=>{if(!o.value)return;const u=r.value.getBoundingClientRect();let d=(c.clientX-u.left)/u.width*100;d=Math.max(0,Math.min(100,d)),e.value.width=d,n.value.width=100-d},l=()=>{o.value=!1,document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",l)};return g.onMounted(()=>{setTimeout(()=>{var c,u,d,p;i.value.width=((u=(c=r.value)==null?void 0:c.getBoundingClientRect())==null?void 0:u.width)+"px",i.value.height=((p=(d=r.value)==null?void 0:d.getBoundingClientRect())==null?void 0:p.height)+"px"})}),(c,u)=>(g.openBlock(),g.createElementBlock("div",{class:"relative",ref_key:"diff",ref:r},[g.createElementVNode("div",gAe,[g.createElementVNode("div",yAe,[g.renderSlot(c.$slots,"panel1")])]),g.createElementVNode("div",{class:"absolute top-0 right-0 bottom-0 overflow-hidden",style:g.normalizeStyle({width:`${n.value.width}%`})},[g.createElementVNode("div",{class:"absolute top-0 bottom-0 right-0 select-none",style:g.normalizeStyle({width:i.value.width,height:i.value.height})},[g.renderSlot(c.$slots,"panel2")],4)],4),g.createElementVNode("div",{class:"absolute flex items-center justify-center top-0 translate-x-[-50%] h-full bg-white z-[1] w-[2px] cursor-ew-resize",style:g.normalizeStyle({left:`${e.value.width}%`}),onMousedown:s},u[0]||(u[0]=[g.createElementVNode("div",{class:"h-[30px] w-[20px] rounded-xl shrink-0 border border-white bg-gray-100"},null,-1)]),36)],512))}},_Ae={key:0,class:"sticky top-0 right-0 w-[400px] h-fit shrink-0 pt-[8px]"},bAe={class:"flex flex-col pl-[6px] border-l"},wAe=["onClick"],xAe=["innerHTML"],EAe={key:1},SAe={key:0,class:"flex flex-col pl-[6px] mt-[20px] border-l"},CAe=["onClick"],kAe={__name:"vs-form-with-navigation",props:{scheme:{type:[Object,Array],required:!0},style:{type:Object,default:null}},setup(t){const e=t,n=g.ref(null),r=g.ref({}),i=g.ref(null);let o=0;const s=g.computed(()=>{const d=[];return Array.isArray(e.scheme)?e.scheme.forEach(p=>{var m;if(((m=p==null?void 0:p.type)==null?void 0:m.toLowerCase())==="html"){const y=y0("html-");d.push({id:y,label:p==null?void 0:p.title})}}):Object.values(e.scheme).forEach(p=>{var m;if(((m=p==null?void 0:p.type)==null?void 0:m.toLowerCase())==="html"){const y=y0("html-");d.push({id:y,label:p==null?void 0:p.title})}}),d}),a=g.computed(()=>{var d;if(Array.isArray(e.scheme))return(d=e.scheme)==null?void 0:d.map(p=>{var m,y;if(((m=p==null?void 0:p.type)==null?void 0:m.toLowerCase())==="html"&&(p!=null&&p.title)){const w=(y=s.value.find(x=>x.label===((p==null?void 0:p.title)||(p==null?void 0:p.text))))==null?void 0:y.id;return{...p,navId:w}}else return p});{const p={};return Object.entries(e.scheme).forEach(([m,y])=>{var w,x;if(((w=y==null?void 0:y.type)==null?void 0:w.toLowerCase())==="html"){const C=(x=s.value.find(S=>S.label===(y==null?void 0:y.title)))==null?void 0:x.id;p[m]={...y,navId:C}}else p[m]=y}),p}}),l=d=>{const p=document.getElementById(d);p&&(p.scrollIntoView({behavior:"smooth",block:"start"}),i.value=d)},c=d=>document.getElementById(d),u=()=>{var S;const d=Date.now();if(d-o<100)return;const p=(S=n==null?void 0:n.value)==null?void 0:S.getBoundingClientRect(),m=p.top,y=p.height,w=m+y/2;let x=null,C=1/0;s.value.forEach(M=>{const E=document.getElementById(M.id);if(E){const A=E.getBoundingClientRect(),I=A.top+A.height/2,O=Math.abs(I-w);O{n.value&&n.value.addEventListener("scroll",u)}),g.onUnmounted(()=>{n.value&&n.value.removeEventListener("scroll",u)}),(d,p)=>{var m;return g.openBlock(),g.createElementBlock("div",{class:"w-full relative flex w-full overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500",ref_key:"container",ref:n},[g.createVNode(U1,g.mergeProps({ref:"form"},d.$attrs,{scheme:a.value,style:t.style,"onUpdate:errors":p[0]||(p[0]=y=>r.value=y)}),null,16,["scheme","style"]),(m=t.style)!=null&&m.navigation?(g.openBlock(),g.createElementBlock("div",_Ae,[g.createElementVNode("div",bAe,[p[1]||(p[1]=g.createElementVNode("h2",{class:"text-sm text-gray-800 ml-[10px] mb-[4px] font-medium dark:text-neutral-300"}," Навігація по формі ",-1)),(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(s.value,y=>{var w;return g.openBlock(),g.createElementBlock("button",{key:y.id,class:g.normalizeClass(["flex gap-x-3 py-[6px] px-3 text-sm relative duration-200 hover:text-gray-800",{"after:content-[''] after:absolute after:left-[-7px] after:w-[2px] after:h-[20px] after:bg-blue-600 text-gray-800":i.value===y.id,"text-gray-500":i.value!==y.id}]),onClick:x=>l(y.id)},[c(y.id)?(g.openBlock(),g.createElementBlock(g.Fragment,{key:0},[(w=y==null?void 0:y.label)!=null&&w.includes("<")?(g.openBlock(),g.createElementBlock("span",{key:0,innerHTML:y==null?void 0:y.label},null,8,xAe)):(g.openBlock(),g.createElementBlock("span",EAe,g.toDisplayString(y==null?void 0:y.label),1))],64)):g.createCommentVNode("",!0)],10,wAe)}),128))]),Object.values(r.value).length?(g.openBlock(),g.createElementBlock("div",SAe,[p[2]||(p[2]=g.createElementVNode("h2",{class:"text-sm text-gray-800 font-medium ml-[10px] mb-[4px] dark:text-neutral-300"}," Навігація по помилкам форми ",-1)),(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(Object.values(r.value),y=>{var w,x;return g.openBlock(),g.createElementBlock("button",{key:(w=y[0])==null?void 0:w.navId,class:"flex gap-x-3 py-[6px] px-3 text-sm relative duration-200 hover:text-gray-800 text-gray-500",onClick:C=>{var S;return l((S=y[0])==null?void 0:S.navId)}},[g.createElementVNode("span",null,g.toDisplayString((x=y[0])==null?void 0:x.label),1)],8,CAe)}),128))])):g.createCommentVNode("",!0)])):g.createCommentVNode("",!0)],512)}}};var TAe={};/*! * shared v12.0.0-alpha.2 * (c) 2016-present kazuya kawaguchi and contributors * Released under the MIT License. */const Mf=typeof window<"u";let Bc,zg;if(TAe.NODE_ENV!=="production"){const t=Mf&&window.performance;t&&t.mark&&t.measure&&t.clearMarks&&t.clearMeasures&&(Bc=e=>{t.mark(e)},zg=(e,n,r)=>{t.measure(e,n,r),t.clearMarks(n),t.clearMarks(r)})}const MAe=/\{([0-9a-zA-Z]+)\}/g;function nN(t,...e){return e.length===1&&bi(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),t.replace(MAe,(n,r)=>e.hasOwnProperty(r)?e[r]:"")}const dd=(t,e=!1)=>e?Symbol.for(t):Symbol(t),AAe=(t,e,n)=>IAe({l:t,k:e,s:n}),IAe=t=>JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),Ka=t=>typeof t=="number"&&isFinite(t),LAe=t=>rN(t)==="[object Date]",ck=t=>rN(t)==="[object RegExp]",uk=t=>mi(t)&&Object.keys(t).length===0,Ja=Object.assign,PAe=Object.create,Xi=(t=null)=>PAe(t);let h9;const L0=()=>h9||(h9=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:Xi());function d9(t){return t.replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}const NAe=Object.prototype.hasOwnProperty;function Vg(t,e){return NAe.call(t,e)}const bs=Array.isArray,Ao=t=>typeof t=="function",mn=t=>typeof t=="string",Fo=t=>typeof t=="boolean",bi=t=>t!==null&&typeof t=="object",OAe=t=>bi(t)&&Ao(t.then)&&Ao(t.catch),f9=Object.prototype.toString,rN=t=>f9.call(t),mi=t=>rN(t)==="[object Object]",DAe=t=>t==null?"":bs(t)||mi(t)&&t.toString===f9?JSON.stringify(t,null,2):String(t);function RAe(t,e=""){return t.reduce((n,r,i)=>i===0?n+r:n+e+r,"")}const p9=2;function BAe(t,e=0,n=t.length){const r=t.split(/\r?\n/);let i=0;const o=[];for(let s=0;s=e){for(let a=s-p9;a<=s+p9||n>i;a++){if(a<0||a>=r.length)continue;const l=a+1;o.push(`${l}${" ".repeat(3-String(l).length)}| ${r[a]}`);const c=r[a].length;if(a===s){const u=e-(i-c)+1,d=Math.max(1,n>i?c-u:n-e);o.push(" | "+" ".repeat(u)+"^".repeat(d))}else if(a>s){if(n>i){const u=Math.max(Math.min(n-i,c),1);o.push(" | "+"^".repeat(u))}i+=c+1}}break}return o.join(` `)}function P0(t,e){typeof console<"u"&&(console.warn("[intlify] "+t),e&&console.warn(e.stack))}const m9={};function FAe(t){m9[t]||(m9[t]=!0,P0(t))}function g9(){const t=new Map;return{events:t,on(n,r){const i=t.get(n);i&&i.push(r)||t.set(n,[r])},off(n,r){const i=t.get(n);i&&i.splice(i.indexOf(r)>>>0,1)},emit(n,r){(t.get(n)||[]).slice().map(i=>i(r)),(t.get("*")||[]).slice().map(i=>i(n,r))}}}const hk=t=>!bi(t)||bs(t);function dk(t,e){if(hk(t)||hk(e))throw new Error("Invalid value");const n=[{src:t,des:e}];for(;n.length;){const{src:r,des:i}=n.pop();Object.keys(r).forEach(o=>{o!=="__proto__"&&(bi(r[o])&&!bi(i[o])&&(i[o]=Array.isArray(r[o])?[]:Xi()),hk(i[o])||hk(r[o])?i[o]=r[o]:n.push({src:r[o],des:i[o]}))})}}var $Ae={};const Qa={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16},zAe=17,VAe={[Qa.EXPECTED_TOKEN]:"Expected token: '{0}'",[Qa.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[Qa.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[Qa.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[Qa.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[Qa.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[Qa.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[Qa.EMPTY_PLACEHOLDER]:"Empty placeholder",[Qa.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[Qa.INVALID_LINKED_FORMAT]:"Invalid linked format",[Qa.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[Qa.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[Qa.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[Qa.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[Qa.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[Qa.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function y9(t,e,n={}){const{domain:r,messages:i,args:o}=n,s=$Ae.NODE_ENV!=="production"?nN((i||VAe)[t]||"",...o||[]):t,a=new SyntaxError(String(s));return a.code=t,a.domain=r,a}var $o={};function jAe(){typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(L0().__INTLIFY_PROD_DEVTOOLS__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(L0().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}const UAe=["t","type"];function HAe(t){return WAe(t,UAe)}function WAe(t,e,n){for(let r=0;rY1&&Y1.emit(t,e)}const el={INVALID_ARGUMENT:zAe,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_NON_STRING_MESSAGE:20,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23},XAe=24;function Af(t){return y9(t,null,$o.NODE_ENV!=="production"?{messages:KAe}:void 0)}const KAe={[el.INVALID_ARGUMENT]:"Invalid arguments",[el.INVALID_DATE_ARGUMENT]:"The date provided is an invalid Date object.Make sure your Date represents a valid date.",[el.INVALID_ISO_DATE_ARGUMENT]:"The argument provided is not a valid ISO date string",[el.NOT_SUPPORT_NON_STRING_MESSAGE]:"Not support non-string message",[el.NOT_SUPPORT_LOCALE_PROMISE_VALUE]:"cannot support promise value",[el.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION]:"cannot support async function",[el.NOT_SUPPORT_LOCALE_TYPE]:"cannot support locale type"};function iN(t,e){return e.locale!=null?v9(e.locale):v9(t.locale)}let oN;function v9(t){if(mn(t))return t;if(Ao(t)){if(t.resolvedOnce&&oN!=null)return oN;if(t.constructor.name==="Function"){const e=t();if(OAe(e))throw Af(el.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return oN=e}else throw Af(el.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw Af(el.NOT_SUPPORT_LOCALE_TYPE)}function JAe(t,e,n){return[...new Set([n,...bs(e)?e:bi(e)?Object.keys(e):mn(e)?[e]:[n]])]}function QAe(t,e,n){const r=mn(n)?n:pk,i=t;i.__localeChainCache||(i.__localeChainCache=new Map);let o=i.__localeChainCache.get(r);if(!o){o=[];let s=[n];for(;bs(s);)s=_9(o,s,e);const a=bs(e)||!mi(e)?e:e.default?e.default:null;s=mn(a)?[a]:a,bs(s)&&_9(o,s,!1),i.__localeChainCache.set(r,o)}return o}function _9(t,e,n){let r=!0;for(let i=0;i`${t.charAt(0).toLocaleUpperCase()}${t.substr(1)}`;function sIe(){return{upper:(t,e)=>e==="text"&&mn(t)?t.toUpperCase():e==="vnode"&&bi(t)&&"__v_isVNode"in t?t.children.toUpperCase():t,lower:(t,e)=>e==="text"&&mn(t)?t.toLowerCase():e==="vnode"&&bi(t)&&"__v_isVNode"in t?t.children.toLowerCase():t,capitalize:(t,e)=>e==="text"&&mn(t)?b9(t):e==="vnode"&&bi(t)&&"__v_isVNode"in t?b9(t.children):t}}let aIe,w9=null;const lIe=t=>{w9=t},cIe=()=>w9;let x9=null;const E9=t=>{x9=t},uIe=()=>x9;let S9=0;function hIe(t={}){const e=Ao(t.onWarn)?t.onWarn:P0,n=mn(t.version)?t.version:oIe,r=mn(t.locale)||Ao(t.locale)?t.locale:pk,i=Ao(r)?pk:r,o=bs(t.fallbackLocale)||mi(t.fallbackLocale)||mn(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:i,s=mi(t.messages)?t.messages:sN(i),a=mi(t.datetimeFormats)?t.datetimeFormats:sN(i),l=mi(t.numberFormats)?t.numberFormats:sN(i),c=Ja(Xi(),t.modifiers,sIe()),u=t.pluralRules||Xi(),d=Ao(t.missing)?t.missing:null,p=Fo(t.missingWarn)||ck(t.missingWarn)?t.missingWarn:!0,m=Fo(t.fallbackWarn)||ck(t.fallbackWarn)?t.fallbackWarn:!0,y=!!t.fallbackFormat,w=!!t.unresolving,x=Ao(t.postTranslation)?t.postTranslation:null,C=mi(t.processor)?t.processor:null,S=Fo(t.warnHtmlMessage)?t.warnHtmlMessage:!0,M=!!t.escapeParameter,E=Ao(t.messageCompiler)?t.messageCompiler:aIe;$o.NODE_ENV!=="production"&&Ao(t.messageCompiler)&&FAe(Ug(ic.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER));const A=Ao(t.messageResolver)?t.messageResolver:nIe,I=Ao(t.localeFallbacker)?t.localeFallbacker:JAe,O=bi(t.fallbackContext)?t.fallbackContext:void 0,z=t,$=bi(z.__datetimeFormatters)?z.__datetimeFormatters:new Map,W=bi(z.__numberFormatters)?z.__numberFormatters:new Map,J=bi(z.__meta)?z.__meta:{};S9++;const Z={version:n,cid:S9,locale:r,fallbackLocale:o,messages:s,modifiers:c,pluralRules:u,missing:d,missingWarn:p,fallbackWarn:m,fallbackFormat:y,unresolving:w,postTranslation:x,processor:C,warnHtmlMessage:S,escapeParameter:M,messageCompiler:E,messageResolver:A,localeFallbacker:I,fallbackContext:O,onWarn:e,__meta:J};return Z.datetimeFormats=a,Z.numberFormats=l,Z.__datetimeFormatters=$,Z.__numberFormatters=W,$o.NODE_ENV!=="production"&&(Z.__v_emitter=z.__v_emitter!=null?z.__v_emitter:void 0),($o.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__)&&qAe(Z,n,J),Z}const sN=t=>({[t]:Xi()});function gk(t,e){return t instanceof RegExp?t.test(e):t}function C9(t,e){return t instanceof RegExp?t.test(e):t}function aN(t,e,n,r,i){const{missing:o,onWarn:s}=t;if($o.NODE_ENV!=="production"){const a=t.__v_emitter;a&&a.emit("missing",{locale:n,key:e,type:i,groupId:`${i}:${e}`})}if(o!==null){const a=o(t,n,e,i);return mn(a)?a:e}else return $o.NODE_ENV!=="production"&&C9(r,e)&&s(Ug(ic.NOT_FOUND_KEY,{key:e,locale:n})),e}function Z1(t,e,n){const r=t;r.__localeChainCache=new Map,t.localeFallbacker(t,n,e)}function k9(t,e){return t===e?!1:t.split("-")[0]===e.split("-")[0]}function dIe(t,e){const n=e.indexOf(t);if(n===-1)return!1;for(let r=n+1;r{I9.includes(l)?s[l]=n[l]:o[l]=n[l]}),mn(r)?o.locale=r:mi(r)&&(s=r),mi(i)&&(s=i),[o.key||"",a,o,s]}function L9(t,e,n){const r=t;for(const i in n){const o=`${e}__${i}`;r.__datetimeFormatters.has(o)&&r.__datetimeFormatters.delete(o)}}function P9(t,...e){const{numberFormats:n,unresolving:r,fallbackLocale:i,onWarn:o,localeFallbacker:s}=t,{__numberFormatters:a}=t;if($o.NODE_ENV!=="production"&&!M9.numberFormat)return o(Ug(ic.CANNOT_FORMAT_NUMBER)),mk;const[l,c,u,d]=cN(...e),p=Fo(u.missingWarn)?u.missingWarn:t.missingWarn,m=Fo(u.fallbackWarn)?u.fallbackWarn:t.fallbackWarn,y=!!u.part,w=iN(t,u),x=s(t,i,w);if(!mn(l)||l==="")return new Intl.NumberFormat(w,d).format(c);let C={},S,M=null,E=w,A=null;const I="number format";for(let $=0;${N9.includes(l)?s[l]=n[l]:o[l]=n[l]}),mn(r)?o.locale=r:mi(r)&&(s=r),mi(i)&&(s=i),[o.key||"",a,o,s]}function O9(t,e,n){const r=t;for(const i in n){const o=`${e}__${i}`;r.__numberFormatters.has(o)&&r.__numberFormatters.delete(o)}}const fIe=t=>t,pIe=t=>"",mIe="text",gIe=t=>t.length===0?"":RAe(t),yIe=DAe;function D9(t,e){return t=Math.abs(t),e===2?t?t>1?1:0:1:t?Math.min(t,2):0}function vIe(t){const e=Ka(t.pluralIndex)?t.pluralIndex:-1;return t.named&&(Ka(t.named.count)||Ka(t.named.n))?Ka(t.named.count)?t.named.count:Ka(t.named.n)?t.named.n:e:e}function _Ie(t,e){e.count||(e.count=t),e.n||(e.n=t)}function bIe(t={}){const e=t.locale,n=vIe(t),r=bi(t.pluralRules)&&mn(e)&&Ao(t.pluralRules[e])?t.pluralRules[e]:D9,i=bi(t.pluralRules)&&mn(e)&&Ao(t.pluralRules[e])?D9:void 0,o=C=>C[r(n,C.length,i)],s=t.list||[],a=C=>s[C],l=t.named||Xi();Ka(t.pluralIndex)&&_Ie(n,l);const c=C=>l[C];function u(C,S){const M=Ao(t.messages)?t.messages(C,!!S):bi(t.messages)?t.messages[C]:!1;return M||(t.parent?t.parent.message(C):pIe)}const d=C=>t.modifiers?t.modifiers[C]:fIe,p=mi(t.processor)&&Ao(t.processor.normalize)?t.processor.normalize:gIe,m=mi(t.processor)&&Ao(t.processor.interpolate)?t.processor.interpolate:yIe,y=mi(t.processor)&&mn(t.processor.type)?t.processor.type:mIe,x={list:a,named:c,plural:o,linked:(C,...S)=>{const[M,E]=S;let A="text",I="";S.length===1?bi(M)?(I=M.modifier||I,A=M.type||A):mn(M)&&(I=M||I):S.length===2&&(mn(M)&&(I=M||I),mn(E)&&(A=E||A));const O=u(C,!0)(x),z=A==="vnode"&&bs(O)&&I?O[0]:O;return I?d(I)(z,A):z},message:u,type:y,interpolate:m,normalize:p,values:Ja(Xi(),s,l)};return x}const R9=()=>"",Mu=t=>Ao(t);function B9(t,...e){const{fallbackFormat:n,postTranslation:r,unresolving:i,messageCompiler:o,fallbackLocale:s,messages:a}=t,[l,c]=uN(...e),u=Fo(c.missingWarn)?c.missingWarn:t.missingWarn,d=Fo(c.fallbackWarn)?c.fallbackWarn:t.fallbackWarn,p=Fo(c.escapeParameter)?c.escapeParameter:t.escapeParameter,m=!!c.resolvedMessage,y=mn(c.default)||Fo(c.default)?Fo(c.default)?o?l:()=>l:c.default:n?o?l:()=>l:null,w=n||y!=null&&(mn(y)||Ao(y)),x=iN(t,c);p&&wIe(c);let[C,S,M]=m?[l,x,a[x]||Xi()]:F9(t,l,x,s,d,u),E=C,A=l;if(!m&&!(mn(E)||jg(E)||Mu(E))&&w&&(E=y,A=E),!m&&(!(mn(E)||jg(E)||Mu(E))||!mn(S)))return i?fk:l;if($o.NODE_ENV!=="production"&&mn(E)&&t.messageCompiler==null)return P0(`The message format compilation is not supported in this build. Because message compiler isn't included. You need to pre-compilation all message format. So translate function return '${l}'.`),l;let I=!1;const O=()=>{I=!0},z=Mu(E)?E:$9(t,l,S,E,A,O);if(I)return E;const $=CIe(t,S,M,c),W=bIe($),J=xIe(t,z,W),Z=r?r(J,l):J;if($o.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const q={timestamp:Date.now(),key:mn(l)?l:Mu(E)?E.key:"",locale:S||(Mu(E)?E.locale:""),format:mn(E)?E:Mu(E)?E.source:"",message:Z};q.meta=Ja({},t.__meta,cIe()||{}),YAe(q)}return Z}function wIe(t){bs(t.list)?t.list=t.list.map(e=>mn(e)?d9(e):e):bi(t.named)&&Object.keys(t.named).forEach(e=>{mn(t.named[e])&&(t.named[e]=d9(t.named[e]))})}function F9(t,e,n,r,i,o){const{messages:s,onWarn:a,messageResolver:l,localeFallbacker:c}=t,u=c(t,r,n);let d=Xi(),p,m=null,y=n,w=null;const x="translate";for(let C=0;Cr;return p.locale=n,p.key=e,p}let l=null,c,u;$o.NODE_ENV!=="production"&&Mf&&(l=window.performance.now(),c="intlify-message-compilation-start",u="intlify-message-compilation-end",Bc&&Bc(c));const d=s(r,EIe(t,n,i,r,a,o));if($o.NODE_ENV!=="production"&&Mf){const p=window.performance.now(),m=t.__v_emitter;m&&l&&m.emit("message-compilation",{type:"message-compilation",message:r,time:p-l,groupId:`translate:${e}`}),c&&u&&Bc&&zg&&(Bc(u),zg("intlify message compilation",c,u))}return d.locale=n,d.key=e,d.source=r,d}function xIe(t,e,n){let r=null,i,o;$o.NODE_ENV!=="production"&&Mf&&(r=window.performance.now(),i="intlify-message-evaluation-start",o="intlify-message-evaluation-end",Bc&&Bc(i));const s=e(n);if($o.NODE_ENV!=="production"&&Mf){const a=window.performance.now(),l=t.__v_emitter;l&&r&&l.emit("message-evaluation",{type:"message-evaluation",value:s,time:a-r,groupId:`translate:${e.key}`}),i&&o&&Bc&&zg&&(Bc(o),zg("intlify message evaluation",i,o))}return s}function uN(...t){const[e,n,r]=t,i=Xi();if(!mn(e)&&!Ka(e)&&!Mu(e)&&!jg(e))throw Af(el.INVALID_ARGUMENT);const o=Ka(e)?String(e):(Mu(e),e);return Ka(n)?i.plural=n:mn(n)?i.default=n:mi(n)&&!uk(n)?i.named=n:bs(n)&&(i.list=n),Ka(r)?i.plural=r:mn(r)?i.default=r:mi(r)&&Ja(i,r),[o,i]}function EIe(t,e,n,r,i,o){return{locale:e,key:n,warnHtmlMessage:i,onError:s=>{if(o&&o(s),$o.NODE_ENV!=="production"){const a=SIe(r),l=`Message compilation error: ${s.message}`,c=s.location&&a&&BAe(a,s.location.start.offset,s.location.end.offset),u=t.__v_emitter;u&&a&&u.emit("compile-error",{message:a,error:s.message,start:s.location&&s.location.start.offset,end:s.location&&s.location.end.offset,groupId:`translate:${n}`}),console.error(c?`${l} ${c}`:l)}else throw s},onCacheKey:s=>AAe(e,n,s)}}function SIe(t){if(mn(t))return t;if(t.loc&&t.loc.source)return t.loc.source}function CIe(t,e,n,r){const{modifiers:i,pluralRules:o,messageResolver:s,fallbackLocale:a,fallbackWarn:l,missingWarn:c,fallbackContext:u}=t,p={locale:e,modifiers:i,pluralRules:o,messages:(m,y)=>{let w=s(n,m);if(w==null&&(u||y)){const[,,x]=F9(u||t,m,e,a,l,c);w=s(x,m)}if(mn(w)||jg(w)){let x=!1;const S=$9(t,m,e,w,m,()=>{x=!0});return x?R9:S}else return Mu(w)?w:R9}};return t.processor&&(p.processor=t.processor),r.list&&(p.list=r.list),r.named&&(p.named=r.named),Ka(r.plural)&&(p.pluralIndex=r.plural),p}jAe();function kIe(){return z9().__VUE_DEVTOOLS_GLOBAL_HOOK__}function z9(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const TIe=typeof Proxy=="function",MIe="devtools-plugin:setup",AIe="plugin:settings:set";let N0,hN;function IIe(){var t;return N0!==void 0||(typeof window<"u"&&window.performance?(N0=!0,hN=window.performance):typeof globalThis<"u"&&(!((t=globalThis.perf_hooks)===null||t===void 0)&&t.performance)?(N0=!0,hN=globalThis.perf_hooks.performance):N0=!1),N0}function LIe(){return IIe()?hN.now():Date.now()}class PIe{constructor(e,n){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=n;const r={};if(e.settings)for(const s in e.settings){const a=e.settings[s];r[s]=a.defaultValue}const i=`__vue-devtools-plugin-settings__${e.id}`;let o=Object.assign({},r);try{const s=localStorage.getItem(i),a=JSON.parse(s);Object.assign(o,a)}catch{}this.fallbacks={getSettings(){return o},setSettings(s){try{localStorage.setItem(i,JSON.stringify(s))}catch{}o=s},now(){return LIe()}},n&&n.on(AIe,(s,a)=>{s===this.plugin.id&&this.fallbacks.setSettings(a)}),this.proxiedOn=new Proxy({},{get:(s,a)=>this.target?this.target.on[a]:(...l)=>{this.onQueue.push({method:a,args:l})}}),this.proxiedTarget=new Proxy({},{get:(s,a)=>this.target?this.target[a]:a==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(a)?(...l)=>(this.targetQueue.push({method:a,args:l,resolve:()=>{}}),this.fallbacks[a](...l)):(...l)=>new Promise(c=>{this.targetQueue.push({method:a,args:l,resolve:c})})})}async setRealTarget(e){this.target=e;for(const n of this.onQueue)this.target.on[n.method](...n.args);for(const n of this.targetQueue)n.resolve(await this.target[n.method](...n.args))}}function NIe(t,e){const n=t,r=z9(),i=kIe(),o=TIe&&n.enableEarlyProxy;if(i&&(r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!o))i.emit(MIe,t,e);else{const s=o?new PIe(n,i):null;(r.__VUE_DEVTOOLS_PLUGINS__=r.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:n,setupFn:e,proxy:s}),s&&e(s.proxiedTarget)}}var Tl={};const OIe="12.0.0-alpha.2";function DIe(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(L0().__VUE_I18N_FULL_INSTALL__=!0),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(L0().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(L0().__INTLIFY_PROD_DEVTOOLS__=!1)}const Vs={UNEXPECTED_RETURN_TYPE:XAe,INVALID_ARGUMENT:25,MUST_BE_CALL_SETUP_TOP:26,NOT_INSTALLED:27,REQUIRED_VALUE:28,INVALID_VALUE:29,CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:30,NOT_INSTALLED_WITH_PROVIDE:31,UNEXPECTED_ERROR:32};function If(t,...e){return y9(t,null,Tl.NODE_ENV!=="production"?{messages:RIe,args:e}:void 0)}const RIe={[Vs.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[Vs.INVALID_ARGUMENT]:"Invalid argument",[Vs.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[Vs.NOT_INSTALLED]:"Need to install with `app.use` function",[Vs.UNEXPECTED_ERROR]:"Unexpected error",[Vs.REQUIRED_VALUE]:"Required in value: {0}",[Vs.INVALID_VALUE]:"Invalid value",[Vs.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[Vs.NOT_INSTALLED_WITH_PROVIDE]:"Need to install with `provide` function"},dN=dd("__translateVNode"),fN=dd("__datetimeParts"),pN=dd("__numberParts"),X1=dd("__enableEmitter"),mN=dd("__disableEmitter"),BIe=dd("__setPluralRules"),FIe=dd("__injectWithOption"),gN=dd("__dispose"),O0={FALLBACK_TO_ROOT:rIe,NOT_FOUND_PARENT_SCOPE:9,IGNORE_OBJ_FLATTEN:10},$Ie={[O0.FALLBACK_TO_ROOT]:"Fall back to {type} '{key}' with root locale.",[O0.NOT_FOUND_PARENT_SCOPE]:"Not found parent scope. use the global scope.",[O0.IGNORE_OBJ_FLATTEN]:"Ignore object flatten: '{key}' key has an string value"};function yN(t,...e){return nN($Ie[t],...e)}function K1(t){if(!bi(t))return t;for(const e in t)if(Vg(t,e))if(!e.includes("."))bi(t[e])&&K1(t[e]);else{const n=e.split("."),r=n.length-1;let i=t,o=!1;for(let s=0;s{if("locale"in a&&"resource"in a){const{locale:l,resource:c}=a;l?(s[l]=s[l]||Xi(),dk(c,s[l])):dk(c,s)}else mn(a)&&dk(JSON.parse(a),s)}),i==null&&o)for(const a in s)Vg(s,a)&&K1(s[a]);return s}function j9(t){return t.type}function zIe(t,e,n){let r=bi(e.messages)?e.messages:Xi();"__i18nGlobal"in n&&(r=V9(t.locale.value,{messages:r,__i18n:n.__i18nGlobal}));const i=Object.keys(r);i.length&&i.forEach(o=>{t.mergeLocaleMessage(o,r[o])});{if(bi(e.datetimeFormats)){const o=Object.keys(e.datetimeFormats);o.length&&o.forEach(s=>{t.mergeDateTimeFormat(s,e.datetimeFormats[s])})}if(bi(e.numberFormats)){const o=Object.keys(e.numberFormats);o.length&&o.forEach(s=>{t.mergeNumberFormat(s,e.numberFormats[s])})}}}function U9(t){return g.createVNode(g.Text,null,t,0)}const H9="__INTLIFY_META__",W9=()=>[],VIe=()=>!1;let G9=0;function q9(t){return(e,n,r,i)=>t(n,r,g.getCurrentInstance()||void 0,i)}const jIe=()=>{const t=g.getCurrentInstance();let e=null;return t&&(e=j9(t)[H9])?{[H9]:e}:null};function Y9(t={}){const{__root:e,__injectWithOption:n}=t,r=e===void 0,i=t.flatJson,o=Mf?g.ref:g.shallowRef;let s=Fo(t.inheritLocale)?t.inheritLocale:!0;const a=o(e&&s?e.locale.value:mn(t.locale)?t.locale:pk),l=o(e&&s?e.fallbackLocale.value:mn(t.fallbackLocale)||bs(t.fallbackLocale)||mi(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:a.value),c=o(V9(a.value,t)),u=o(mi(t.datetimeFormats)?t.datetimeFormats:{[a.value]:{}}),d=o(mi(t.numberFormats)?t.numberFormats:{[a.value]:{}});let p=e?e.missingWarn:Fo(t.missingWarn)||ck(t.missingWarn)?t.missingWarn:!0,m=e?e.fallbackWarn:Fo(t.fallbackWarn)||ck(t.fallbackWarn)?t.fallbackWarn:!0,y=e?e.fallbackRoot:Fo(t.fallbackRoot)?t.fallbackRoot:!0,w=!!t.fallbackFormat,x=Ao(t.missing)?t.missing:null,C=Ao(t.missing)?q9(t.missing):null,S=Ao(t.postTranslation)?t.postTranslation:null,M=e?e.warnHtmlMessage:Fo(t.warnHtmlMessage)?t.warnHtmlMessage:!0,E=!!t.escapeParameter;const A=e?e.modifiers:mi(t.modifiers)?t.modifiers:{};let I=t.pluralRules||e&&e.pluralRules,O;O=(()=>{r&&E9(null);const Ne={version:OIe,locale:a.value,fallbackLocale:l.value,messages:c.value,modifiers:A,pluralRules:I,missing:C===null?void 0:C,missingWarn:p,fallbackWarn:m,fallbackFormat:w,unresolving:!0,postTranslation:S===null?void 0:S,warnHtmlMessage:M,escapeParameter:E,messageResolver:t.messageResolver,messageCompiler:t.messageCompiler,__meta:{framework:"vue"}};Ne.datetimeFormats=u.value,Ne.numberFormats=d.value,Ne.__datetimeFormatters=mi(O)?O.__datetimeFormatters:void 0,Ne.__numberFormatters=mi(O)?O.__numberFormatters:void 0,Tl.NODE_ENV!=="production"&&(Ne.__v_emitter=mi(O)?O.__v_emitter:void 0);const nt=hIe(Ne);return r&&E9(nt),nt})(),Z1(O,a.value,l.value);function $(){return[a.value,l.value,c.value,u.value,d.value]}const W=g.computed({get:()=>a.value,set:Ne=>{O.locale=Ne,a.value=Ne}}),J=g.computed({get:()=>l.value,set:Ne=>{O.fallbackLocale=Ne,l.value=Ne,Z1(O,a.value,Ne)}}),Z=g.computed(()=>c.value),q=g.computed(()=>Object.keys(c.value).sort()),j=g.computed(()=>u.value),G=g.computed(()=>d.value);function U(){return Ao(S)?S:null}function Q(Ne){S=Ne,O.postTranslation=Ne}function re(){return x}function le(Ne){Ne!==null&&(C=q9(Ne)),x=Ne,O.missing=C}function oe(Ne,nt){return Ne!=="translate"||!nt.resolvedMessage}const he=(Ne,nt,It,en,Fn,lr)=>{$();let Ye;try{Tl.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(O.fallbackContext=e?uIe():void 0),Ye=Ne(O)}finally{Tl.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(O.fallbackContext=void 0)}if(It!=="translate exists"&&Ka(Ye)&&Ye===fk||It==="translate exists"&&!Ye){const[ye,ue]=nt();if(Tl.NODE_ENV!=="production"&&e&&mn(ye)&&oe(It,ue)&&(y&&(gk(m,ye)||C9(p,ye))&&P0(yN(O0.FALLBACK_TO_ROOT,{key:ye,type:It})),Tl.NODE_ENV!=="production")){const{__v_emitter:ve}=O;ve&&y&&ve.emit("fallback",{type:It,key:ye,to:"global",groupId:`${It}:${ye}`})}return e&&y?en(e):Fn(ye)}else{if(lr(Ye))return Ye;throw If(Vs.UNEXPECTED_RETURN_TYPE)}};function xe(...Ne){return he(nt=>Reflect.apply(B9,null,[nt,...Ne]),()=>uN(...Ne),"translate",nt=>Reflect.apply(nt.t,nt,[...Ne]),nt=>nt,nt=>mn(nt))}function Ee(...Ne){const[nt,It,en]=Ne;if(en&&!bi(en))throw If(Vs.INVALID_ARGUMENT);return xe(nt,It,Ja({resolvedMessage:!0},en||{}))}function Ie(...Ne){return he(nt=>Reflect.apply(A9,null,[nt,...Ne]),()=>lN(...Ne),"datetime format",nt=>Reflect.apply(nt.d,nt,[...Ne]),()=>mk,nt=>mn(nt))}function Oe(...Ne){return he(nt=>Reflect.apply(P9,null,[nt,...Ne]),()=>cN(...Ne),"number format",nt=>Reflect.apply(nt.n,nt,[...Ne]),()=>mk,nt=>mn(nt))}function $e(Ne){return Ne.map(nt=>mn(nt)||Ka(nt)||Fo(nt)?U9(String(nt)):nt)}const lt={normalize:$e,interpolate:Ne=>Ne,type:"vnode"};function pt(...Ne){return he(nt=>{let It;const en=nt;try{en.processor=lt,It=Reflect.apply(B9,null,[en,...Ne])}finally{en.processor=null}return It},()=>uN(...Ne),"translate",nt=>nt[dN](...Ne),nt=>[U9(nt)],nt=>bs(nt))}function yt(...Ne){return he(nt=>Reflect.apply(P9,null,[nt,...Ne]),()=>cN(...Ne),"number format",nt=>nt[pN](...Ne),W9,nt=>mn(nt)||bs(nt))}function Lt(...Ne){return he(nt=>Reflect.apply(A9,null,[nt,...Ne]),()=>lN(...Ne),"datetime format",nt=>nt[fN](...Ne),W9,nt=>mn(nt)||bs(nt))}function hn(Ne){I=Ne,O.pluralRules=I}function Ht(Ne,nt){return he(()=>{if(!Ne)return!1;const It=mn(nt)?nt:a.value,en=Hn(It),Fn=O.messageResolver(en,Ne);return jg(Fn)||Mu(Fn)||mn(Fn)},()=>[Ne],"translate exists",It=>Reflect.apply(It.te,It,[Ne,nt]),VIe,It=>Fo(It))}function wn(Ne){let nt=null;const It=QAe(O,l.value,a.value);for(let en=0;en{s&&(a.value=Ne,O.locale=Ne,Z1(O,a.value,l.value))}),g.watch(e.fallbackLocale,Ne=>{s&&(l.value=Ne,O.fallbackLocale=Ne,Z1(O,a.value,l.value))}));const an={id:G9,locale:W,fallbackLocale:J,get inheritLocale(){return s},set inheritLocale(Ne){s=Ne,Ne&&e&&(a.value=e.locale.value,l.value=e.fallbackLocale.value,Z1(O,a.value,l.value))},availableLocales:q,messages:Z,get modifiers(){return A},get pluralRules(){return I||{}},get isGlobal(){return r},get missingWarn(){return p},set missingWarn(Ne){p=Ne,O.missingWarn=p},get fallbackWarn(){return m},set fallbackWarn(Ne){m=Ne,O.fallbackWarn=m},get fallbackRoot(){return y},set fallbackRoot(Ne){y=Ne},get fallbackFormat(){return w},set fallbackFormat(Ne){w=Ne,O.fallbackFormat=w},get warnHtmlMessage(){return M},set warnHtmlMessage(Ne){M=Ne,O.warnHtmlMessage=Ne},get escapeParameter(){return E},set escapeParameter(Ne){E=Ne,O.escapeParameter=Ne},t:xe,getLocaleMessage:Hn,setLocaleMessage:Bn,mergeLocaleMessage:Ue,getPostTranslationHandler:U,setPostTranslationHandler:Q,getMissingHandler:re,setMissingHandler:le,[BIe]:hn};return an.datetimeFormats=j,an.numberFormats=G,an.rt=Ee,an.te=Ht,an.tm=cn,an.d=Ie,an.n=Oe,an.getDateTimeFormat=qe,an.setDateTimeFormat=Et,an.mergeDateTimeFormat=qt,an.getNumberFormat=rn,an.setNumberFormat=it,an.mergeNumberFormat=St,an[FIe]=n,an[dN]=pt,an[fN]=Lt,an[pN]=yt,Tl.NODE_ENV!=="production"&&(an[X1]=Ne=>{O.__v_emitter=Ne},an[mN]=()=>{O.__v_emitter=void 0}),an}const Z9="vue-i18n: composer properties",vN={"vue-devtools-plugin-vue-i18n":"Vue I18n DevTools","vue-i18n-resource-inspector":"Vue I18n DevTools","vue-i18n-timeline":"Vue I18n"},UIe={"vue-i18n-resource-inspector":"Search for scopes ..."},HIe={"vue-i18n-timeline":16764185};let _N;async function WIe(t,e){return new Promise((n,r)=>{try{NIe({id:"vue-devtools-plugin-vue-i18n",label:vN["vue-devtools-plugin-vue-i18n"],packageName:"vue-i18n",homepage:"https://vue-i18n.intlify.dev",logo:"https://vue-i18n.intlify.dev/vue-i18n-devtools-logo.png",componentStateTypes:[Z9],app:t},i=>{_N=i,i.on.visitComponentTree(({componentInstance:s,treeNode:a})=>{GIe(s,a,e)}),i.on.inspectComponent(({componentInstance:s,instanceData:a})=>{s.vnode.el&&s.vnode.el.__VUE_I18N__&&a&&qIe(a,s.vnode.el.__VUE_I18N__)}),i.addInspector({id:"vue-i18n-resource-inspector",label:vN["vue-i18n-resource-inspector"],icon:"language",treeFilterPlaceholder:UIe["vue-i18n-resource-inspector"]}),i.on.getInspectorTree(s=>{s.app===t&&s.inspectorId==="vue-i18n-resource-inspector"&&JIe(s,e)});const o=new Map;i.on.getInspectorState(async s=>{if(s.app===t&&s.inspectorId==="vue-i18n-resource-inspector")if(i.unhighlightElement(),eLe(s,e),s.nodeId==="global"){if(!o.has(s.app)){const[a]=await i.getComponentInstances(s.app);o.set(s.app,a)}i.highlightElement(o.get(s.app))}else{const a=QIe(s.nodeId,e);a&&i.highlightElement(a)}}),i.on.editInspectorState(s=>{s.app===t&&s.inspectorId==="vue-i18n-resource-inspector"&&nLe(s,e)}),i.addTimelineLayer({id:"vue-i18n-timeline",label:vN["vue-i18n-timeline"],color:HIe["vue-i18n-timeline"]}),n(!0)})}catch(i){console.error(i),r(!1)}})}function X9(t){return t.type.name||t.type.displayName||t.type.__file||"Anonymous"}function GIe(t,e,n){const r=n.global;if(t&&t.vnode.el&&t.vnode.el.__VUE_I18N__&&t.vnode.el.__VUE_I18N__!==r){const i={label:`i18n (${X9(t)} Scope)`,textColor:0,backgroundColor:16764185};e.tags.push(i)}}function qIe(t,e){const n=Z9;t.state.push({type:n,key:"locale",editable:!0,value:e.locale.value}),t.state.push({type:n,key:"availableLocales",editable:!1,value:e.availableLocales}),t.state.push({type:n,key:"fallbackLocale",editable:!0,value:e.fallbackLocale.value}),t.state.push({type:n,key:"inheritLocale",editable:!0,value:e.inheritLocale}),t.state.push({type:n,key:"messages",editable:!1,value:bN(e.messages.value)}),t.state.push({type:n,key:"datetimeFormats",editable:!1,value:e.datetimeFormats.value}),t.state.push({type:n,key:"numberFormats",editable:!1,value:e.numberFormats.value})}function bN(t){const e={};return Object.keys(t).forEach(n=>{const r=t[n];Ao(r)&&"source"in r?e[n]=KIe(r):jg(r)&&r.loc&&r.loc.source?e[n]=r.loc.source:bi(r)?e[n]=bN(r):e[n]=r}),e}const YIe={"<":"<",">":">",'"':""","&":"&"};function ZIe(t){return t.replace(/[<>"&]/g,XIe)}function XIe(t){return YIe[t]||t}function KIe(t){return{_custom:{type:"function",display:`ƒ ${t.source?`("${ZIe(t.source)}")`:"(?)"}`}}}function JIe(t,e){t.rootNodes.push({id:"global",label:"Global Scope"});const n=e.global;for(const[r,i]of e.__instances){const o=i;n!==o&&t.rootNodes.push({id:o.id.toString(),label:`${X9(r)} Scope`})}}function QIe(t,e){let n=null;if(t!=="global"){for(const[r,i]of e.__instances.entries())if(i.id.toString()===t){n=r;break}}return n}function K9(t,e){if(t==="global")return e.global;{const n=Array.from(e.__instances.values()).find(r=>r.id.toString()===t);return n||null}}function eLe(t,e){const n=K9(t.nodeId,e);return n&&(t.state=tLe(n)),null}function tLe(t){const e={},n="Locale related info",r=[{type:n,key:"locale",editable:!0,value:t.locale.value},{type:n,key:"fallbackLocale",editable:!0,value:t.fallbackLocale.value},{type:n,key:"availableLocales",editable:!1,value:t.availableLocales},{type:n,key:"inheritLocale",editable:!0,value:t.inheritLocale}];e[n]=r;const i="Locale messages info",o=[{type:i,key:"messages",editable:!1,value:bN(t.messages.value)}];e[i]=o;{const s="Datetime formats info",a=[{type:s,key:"datetimeFormats",editable:!1,value:t.datetimeFormats.value}];e[s]=a;const l="Datetime formats info",c=[{type:l,key:"numberFormats",editable:!1,value:t.numberFormats.value}];e[l]=c}return e}function wN(t,e){if(_N){let n;e&&"groupId"in e&&(n=e.groupId,delete e.groupId),_N.addTimelineEvent({layerId:"vue-i18n-timeline",event:{title:t,groupId:n,time:Date.now(),meta:{},data:e||{},logType:t==="compile-error"?"error":t==="fallback"||t==="missing"?"warning":"default"}})}}function nLe(t,e){const n=K9(t.nodeId,e);if(n){const[r]=t.path;r==="locale"&&mn(t.state.value)?n.locale.value=t.state.value:r==="fallbackLocale"&&(mn(t.state.value)||bs(t.state.value)||bi(t.state.value))?n.fallbackLocale.value=t.state.value:r==="inheritLocale"&&Fo(t.state.value)&&(n.inheritLocale=t.state.value)}}const xN={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:t=>t==="parent"||t==="global",default:"parent"},i18n:{type:Object}};function rLe({slots:t},e){return e.length===1&&e[0]==="default"?(t.default?t.default():[]).reduce((r,i)=>[...r,...i.type===g.Fragment?i.children:[i]],[]):e.reduce((n,r)=>{const i=t[r];return i&&(n[r]=i()),n},Xi())}function J9(){return g.Fragment}function iLe(t){return bs(t)&&!mn(t[0])}function Q9(t,e,n,r){const{slots:i,attrs:o}=e;return()=>{const s={part:!0};let a=Xi();t.locale&&(s.locale=t.locale),mn(t.format)?s.key=t.format:bi(t.format)&&(mn(t.format.key)&&(s.key=t.format.key),a=Object.keys(t.format).reduce((p,m)=>n.includes(m)?Ja(Xi(),p,{[m]:t.format[m]}):p,Xi()));const l=r(t.value,s,a);let c=[s.key];bs(l)?c=l.map((p,m)=>{const y=i[p.type],w=y?y({[p.type]:p.value,index:m,parts:l}):[p.value];return iLe(w)&&(w[0].key=`${p.type}-${m}`),w}):mn(l)&&(c=[l]);const u=Ja(Xi(),o),d=mn(t.tag)||bi(t.tag)?t.tag:J9();return g.h(d,u,c)}}const e7=g.defineComponent({name:"i18n-d",props:Ja({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},xN),setup(t,e){const n=t.i18n||EN({useScope:t.scope,__useComponent:!0});return Q9(t,e,I9,(...r)=>n[fN](...r))}}),t7=g.defineComponent({name:"i18n-n",props:Ja({value:{type:Number,required:!0},format:{type:[String,Object]}},xN),setup(t,e){const n=t.i18n||EN({useScope:t.scope,__useComponent:!0});return Q9(t,e,N9,(...r)=>n[pN](...r))}}),n7=g.defineComponent({name:"i18n-t",props:Ja({},{keypath:{type:String,required:!0},plural:{type:[Number,String],validator:t=>Ka(t)||!isNaN(t)}},xN),setup(t,e){const{slots:n,attrs:r}=e,i=t.i18n||EN({useScope:t.scope,__useComponent:!0});return()=>{const o=Object.keys(n).filter(d=>d!=="_"),s=Xi();t.locale&&(s.locale=t.locale),t.plural!==void 0&&(s.plural=mn(t.plural)?+t.plural:t.plural);const a=rLe(e,o),l=i[dN](t.keypath,a,s),c=Ja(Xi(),r),u=mn(t.tag)||bi(t.tag)?t.tag:J9();return g.h(u,c,l)}}});function oLe(t,...e){const n=mi(e[0])?e[0]:{};(Fo(n.globalInstall)?n.globalInstall:!0)&&([n7.name,"I18nT"].forEach(i=>t.component(i,n7)),[t7.name,"I18nN"].forEach(i=>t.component(i,t7)),[e7.name,"I18nD"].forEach(i=>t.component(i,e7)))}const sLe=dd("global-vue-i18n");function aLe(t={}){const e=Fo(t.globalInjection)?t.globalInjection:!0,n=new Map,[r,i]=lLe(t),o=dd(Tl.NODE_ENV!=="production"?"vue-i18n":"");function s(u){return n.get(u)||null}function a(u,d){n.set(u,d)}function l(u){n.delete(u)}const c={async install(u,...d){if(Tl.NODE_ENV!=="production"&&(u.__VUE_I18N__=c),u.__VUE_I18N_SYMBOL__=o,u.provide(u.__VUE_I18N_SYMBOL__,c),mi(d[0])){const y=d[0];c.__composerExtend=y.__composerExtend}let p=null;e&&(p=gLe(u,c.global)),__VUE_I18N_FULL_INSTALL__&&oLe(u,...d);const m=u.unmount;if(u.unmount=()=>{p&&p(),c.dispose(),m()},Tl.NODE_ENV!=="production"){if(!await WIe(u,c))throw If(Vs.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);const w=g9(),x=i;x[X1]&&x[X1](w),w.on("*",wN)}},get global(){return i},dispose(){r.stop()},__instances:n,__getInstance:s,__setInstance:a,__deleteInstance:l};return c}function EN(t={}){const e=g.getCurrentInstance();if(e==null)throw If(Vs.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw If(Vs.NOT_INSTALLED);const n=cLe(e),r=hLe(n),i=j9(e),o=uLe(t,i);if(o==="global")return zIe(r,t,i),r;if(o==="parent"){let l=dLe(n,e,t.__useComponent);return l==null&&(Tl.NODE_ENV!=="production"&&P0(yN(O0.NOT_FOUND_PARENT_SCOPE)),l=r),l}const s=n;let a=s.__getInstance(e);if(a==null){const l=Ja({},t);"__i18n"in i&&(l.__i18n=i.__i18n),r&&(l.__root=r),a=Y9(l),s.__composerExtend&&(a[gN]=s.__composerExtend(a)),pLe(s,e,a),s.__setInstance(e,a)}return a}function lLe(t){const e=g.effectScope(),n=e.run(()=>Y9(t));if(n==null)throw If(Vs.UNEXPECTED_ERROR);return[e,n]}function cLe(t){const e=g.inject(t.isCE?sLe:t.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw If(t.isCE?Vs.NOT_INSTALLED_WITH_PROVIDE:Vs.UNEXPECTED_ERROR);return e}function uLe(t,e){return uk(t)?"__i18n"in e?"local":"global":t.useScope?t.useScope:"local"}function hLe(t){return t.global}function dLe(t,e,n=!1){let r=null;const i=e.root;let o=fLe(e,n);for(;o!=null&&(r=t.__getInstance(o),!(r!=null||i===o));)o=o.parent;return r}function fLe(t,e=!1){return t==null?null:e&&t.vnode.ctx||t.parent}function pLe(t,e,n){let r=null;g.onMounted(()=>{if(Tl.NODE_ENV!=="production"&&e.vnode.el){e.vnode.el.__VUE_I18N__=n,r=g9();const i=n;i[X1]&&i[X1](r),r.on("*",wN)}},e),g.onUnmounted(()=>{const i=n;Tl.NODE_ENV!=="production"&&e.vnode.el&&e.vnode.el.__VUE_I18N__&&(r&&r.off("*",wN),i[mN]&&i[mN](),delete e.vnode.el.__VUE_I18N__),t.__deleteInstance(e);const o=i[gN];o&&(o(),delete i[gN])},e)}const mLe=["locale","fallbackLocale","availableLocales"],r7=["t","rt","d","n","tm","te"];function gLe(t,e){const n=Object.create(null);return mLe.forEach(i=>{const o=Object.getOwnPropertyDescriptor(e,i);if(!o)throw If(Vs.UNEXPECTED_ERROR);const s=g.isRef(o.value)?{get(){return o.value.value},set(a){o.value.value=a}}:{get(){return o.get&&o.get()}};Object.defineProperty(n,i,s)}),t.config.globalProperties.$i18n=n,r7.forEach(i=>{const o=Object.getOwnPropertyDescriptor(e,i);if(!o||!o.value)throw If(Vs.UNEXPECTED_ERROR);Object.defineProperty(t.config.globalProperties,`$${i}`,o)}),()=>{delete t.config.globalProperties.$i18n,r7.forEach(i=>{delete t.config.globalProperties[`$${i}`]})}}if(DIe(),Tl.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const t=L0();t.__INTLIFY__=!0,GAe(t.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}const yLe={},vLe={},SN=aLe({locale:"uk",fallbackLocale:"en",messages:{en:{...yLe},uk:{...vLe}}});var _n={};function Ma(t){this.content=t}Ma.prototype={constructor:Ma,find:function(t){for(var e=0;e>1}},Ma.from=function(t){if(t instanceof Ma)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ma(e)};function i7(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)n++;return n}if(i.content.size||o.content.size){let s=i7(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function o7(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),a=e.child(--o),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let c=0,u=Math.min(s.text.length,a.text.length);for(;ce&&r(l,i+a,o||null,s)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);oe)for(let o=0,s=0;se&&((sn)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),i+=a.nodeSize),s=l}return new Mt(r,i)}cutByIndex(e,n){return e==n?Mt.empty:e==0&&n==this.content.length?this:new Mt(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new Mt(i,o)}addToStart(e){return new Mt([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Mt(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),s=i+o.nodeSize;if(s>=e)return s==e||n>0?yk(r+1,s):yk(r,i);i=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return Mt.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Mt(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Mt.empty;let n,r=0;for(let i=0;ithis.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-i.type.rank),n}};Ki.none=[];class _k extends Error{}class Zt{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=a7(this.content,e+this.openStart,n);return r&&new Zt(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Zt(s7(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Zt.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Zt(Mt.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new Zt(e,r,i)}}Zt.empty=new Zt(Mt.empty,0,0);function s7(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(i==e||o.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(s7(o.content,e-i-1,n-i-1)))}function a7(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),s=t.maybeChild(i);if(o==e||s.isText)return t.cut(0,e).append(n).append(t.cut(e));let a=a7(s.content,e-o-1,n);return a&&t.replaceChild(i,s.copy(a))}function _Le(t,e,n){if(n.openStart>t.depth)throw new _k("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new _k("Inconsistent open depths");return l7(t,e,n,0)}function l7(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function J1(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Hg(t.nodeAfter,r),o++));for(let a=o;ai&&kN(t,e,i+1),s=r.depth>i&&kN(n,r,i+1),a=[];return J1(null,t,i,a),o&&s&&e.index(i)==n.index(i)?(c7(o,s),Hg(Wg(o,u7(t,e,n,r,i+1)),a)):(o&&Hg(Wg(o,bk(t,e,i+1)),a),J1(e,n,i,a),s&&Hg(Wg(s,bk(n,r,i+1)),a)),J1(r,null,i,a),new Mt(a)}function bk(t,e,n){let r=[];if(J1(null,t,n,r),t.depth>n){let i=kN(t,e,n+1);Hg(Wg(i,bk(t,e,n+1)),r)}return J1(e,null,n,r),new Mt(r)}function bLe(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)r=e.node(i).copy(Mt.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class Q1{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new wk(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(o),c=o-l;if(r.push(s,a,i+l),!c||(s=s.child(a),s.isText))break;o=c-1,i+=l+1}return new Q1(n,r,o)}static resolveCached(e,n){let r=h7.get(e);if(r)for(let o=0;oe&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),d7(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=Mt.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;ln.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=Mt.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};Up.prototype.text=void 0;class xk extends Up{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):d7(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new xk(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new xk(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function d7(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Gg{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new SLe(e,n);if(r.next==null)return Gg.empty;let i=f7(r);r.next&&r.err("Unexpected trailing text");let o=LLe(ILe(i));return PLe(o,r),o}matchType(e){for(let n=0;nc.createAndFill()));for(let c=0;c=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s"+e.indexOf(r.next[s].next);return o}).join(` `)}}Gg.empty=new Gg(!0);class SLe{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function f7(t){let e=[];do e.push(CLe(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function CLe(t){let e=[];do e.push(kLe(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function kLe(t){let e=ALe(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=TLe(t,e);else break;return e}function p7(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function TLe(t,e){let n=p7(t),r=n;return t.eat(",")&&(t.next!="}"?r=p7(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function MLe(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let s=n[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function ALe(t){if(t.eat("(")){let e=f7(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=MLe(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function ILe(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,l){let c={term:l,to:a};return e[s].push(c),c}function i(s,a){s.forEach(l=>l.to=a)}function o(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(o(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=o(s.exprs[l],a);if(l==s.exprs.length-1)return c;i(c,a=n())}else if(s.type=="star"){let l=n();return r(a,l),i(o(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return i(o(s.expr,a),l),i(o(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(o(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c{t[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new Gg(r.indexOf(t.length-1)>-1);for(let s=0;s-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:v7(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Up(this,this.computeAttrs(e),Mt.from(n),Ki.setFrom(r))}createChecked(e=null,n,r){return n=Mt.from(n),this.checkContent(n),new Up(this,this.computeAttrs(e),n,Ki.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=Mt.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(Mt.empty,!0);return o?new Up(this,e,n.append(o),Ki.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[o]=new BK(o,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function NLe(t,e,n){let r=n.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${o}`)}}class OLe{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?NLe(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ek{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=b7(e,i.attrs),this.excluded=null;let o=y7(this.attrs);this.instance=o?new Ki(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Ki(this,v7(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new Ek(o,i++,n,s)),r}removeFromSet(e){for(var n=0;n-1}}class x7{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Ma.from(e.nodes),n.marks=Ma.from(e.marks||{}),this.nodes=w7.compile(this.spec.nodes,this),this.marks=Ek.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=Gg.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=a=="_"?null:a?E7(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:E7(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof w7){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new xk(r,r.defaultAttrs,e,Ki.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return Up.fromJSON(this,e)}markFromJSON(e){return Ki.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function E7(t,e){let n=[];for(let r=0;r-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function DLe(t){return t.tag!=null}function RLe(t){return t.style!=null}let D0=class Z3{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(DLe(i))this.tags.push(i);else if(RLe(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let r=new T7(this,n,!1);return r.addAll(e,Ki.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new T7(this,n,!0);return r.addAll(e,Ki.none,n.from,n.to),Zt.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s{r(s=M7(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=M7(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Z3(e,Z3.schemaRules(e)))}};const S7={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},BLe={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},C7={ol:!0,ul:!0},ew=1,TN=2,tw=4;function k7(t,e,n){return e!=null?(e?ew:0)|(e==="full"?TN:0):t&&t.whitespace=="pre"?ew|TN:n&~tw}class Sk{constructor(e,n,r,i,o,s){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=Ki.none,this.match=o||(s&tw?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Mt.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ew)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=Mt.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Mt.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!S7.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class T7{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,o,s=k7(null,n.preserveWhitespace,0)|(r?tw:0);i?o=new Sk(i.type,i.attrs,Ki.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new Sk(null,null,Ki.none,!0,null,s):o=new Sk(e.schema.topNodeType,null,Ki.none,!0,null,s),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,o=i.options&TN?"full":this.localPreserveWS||(i.options&ew)>0;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)o!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,` `);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let s=i.content[i.content.length-1],a=e.previousSibling;(!s||a&&a.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;C7.hasOwnProperty(s)&&this.parser.normalizeLists&&FLe(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:BLe.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(S7.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),c=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(o),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(` `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,i){let o,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(o=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}o&&this.sync(a)&&this.open--}addAll(e,n,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];s!=a;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,n);this.findAtPoint(e,o)}findPlace(e,n,r){let i,o;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,o=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(o);for(let s=0;s(s.type?s.type.allowsMarkType(c.type):A7(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Sk(e,n,l,i,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=ew)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=o;l--)if(s(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:r&&l>=o?r.node(l-o).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function FLe(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&C7.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function $Le(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function M7(t){let e={};for(let n in t)e[n]=t[n];return e}function A7(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=a=>{o.push(a);for(let l=0;l{if(o.length||s.marks.length){let a=0,l=0;for(;a=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Ck(MN(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Ck(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new qg(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=I7(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return I7(e.marks)}}function I7(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function MN(t){return t.document||window.document}const L7=new WeakMap;function zLe(t){let e=L7.get(t);return e===void 0&&L7.set(t,e=VLe(t)),e}function VLe(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let p=d.indexOf(" ");p>0?l.setAttributeNS(d.slice(0,p),d.slice(p+1),c[d]):l.setAttribute(d,c[d])}}for(let d=u;du)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:m,contentDOM:y}=Ck(t,p,n,r);if(l.appendChild(m),y){if(a)throw new RangeError("Multiple content holes");a=y}}}return{dom:l,contentDOM:a}}const P7=65535,N7=Math.pow(2,16);function jLe(t,e){return t+e*N7}function O7(t){return t&P7}function ULe(t){return(t-(t&P7))/N7}const D7=1,R7=2,kk=4,B7=8;class AN{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&B7)>0}get deletedBefore(){return(this.delInfo&(D7|kk))>0}get deletedAfter(){return(this.delInfo&(R7|kk))>0}get deletedAcross(){return(this.delInfo&kk)>0}}class Fc{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Fc.empty)return Fc.empty}recover(e){let n=0,r=O7(e);if(!this.inverted)for(let i=0;ie)break;let c=this.ranges[a+o],u=this.ranges[a+s],d=l+c;if(e<=d){let p=c?e==l?-1:e==d?1:n:n,m=l+i+(p<0?0:u);if(r)return m;let y=e==(n<0?l:d)?null:jLe(a/3,e-l),w=e==l?R7:e==d?D7:kk;return(n<0?e!=l:e!=d)&&(w|=B7),new AN(m,w,y)}i+=u-c}return r?e+i:new AN(e+i,0,null)}touches(e,n){let r=0,i=O7(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;ae)break;let c=this.ranges[a+o],u=l+c;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new nw;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ro&&l!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return ws.fromReplace(e,this.from,this.to,o)}invert(){return new fd(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Hp(n.pos,r.pos,this.mark)}merge(e){return e instanceof Hp&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Hp(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Hp(n.from,n.to,e.markFromJSON(n.mark))}}tl.jsonID("addMark",Hp);class fd extends tl{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Zt(LN(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return ws.fromReplace(e,this.from,this.to,r)}invert(){return new Hp(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new fd(n.pos,r.pos,this.mark)}merge(e){return e instanceof fd&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new fd(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new fd(n.from,n.to,e.markFromJSON(n.mark))}}tl.jsonID("removeMark",fd);class Wp extends tl{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ws.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return ws.fromReplace(e,this.pos,this.pos+1,new Zt(Mt.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;ir.pos?null:new da(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new da(n.from,n.to,n.gapFrom,n.gapTo,Zt.fromJSON(e,n.slice),n.insert,!!n.structure)}}tl.jsonID("replaceAround",da);function PN(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function HLe(t,e,n,r){let i=[],o=[],s,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let p=Math.max(c,e),m=Math.min(c+l.nodeSize,n),y=r.addToSet(d);for(let w=0;wt.step(l)),o.forEach(l=>t.step(l))}function WLe(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;o++;let l=null;if(r instanceof Ek){let c=s.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,n);for(let u=0;ut.step(new fd(s.from,s.to,s.style)))}function NN(t,e,n,r=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l=0;l--)t.step(s[l])}function GLe(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function R0(t){let e=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth;;--n){let r=t.$from.node(n),i=t.$from.index(n),o=t.$to.indexAfter(n);if(nn;y--)w||r.index(y)>0?(w=!0,u=Mt.from(r.node(y).copy(u)),d++):l--;let p=Mt.empty,m=0;for(let y=o,w=!1;y>n;y--)w||i.after(y+1)=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Mt.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new da(i,o,i,o,new Zt(r,0,0),n.length,!0))}function KLe(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,l)&&JLe(t.doc,t.mapping.slice(o).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let m=r.whitespace=="pre",y=!!r.contentMatch.matchType(r.schema.linebreakReplacement);m&&!y?c=!1:!m&&y&&(c=!0)}c===!1&&z7(t,s,a,o),NN(t,t.mapping.slice(o).map(a,1),r,void 0,c===null);let u=t.mapping.slice(o),d=u.map(a,1),p=u.map(a+s.nodeSize,1);return t.step(new da(d,p,d+1,p-1,new Zt(Mt.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&$7(t,s,a,o),!1}})}function $7(t,e,n,r){e.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+o+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function z7(t,e,n,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+o);t.replaceWith(s,s+1,e.type.schema.text(` `))}})}function JLe(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function QLe(t,e,n,r,i){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,s);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new da(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new Zt(Mt.from(s),0,0),1,!0))}function Lf(t,e,n=1,r){let i=t.resolve(e),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=n-2;c>o;c--,u--){let d=i.node(c),p=i.index(c);if(d.type.spec.isolating)return!1;let m=d.content.cutByIndex(p,d.childCount),y=r&&r[u+1];y&&(m=m.replaceChild(0,y.type.create(y.attrs)));let w=r&&r[u]||d;if(!d.canReplace(p+1,d.childCount)||!w.type.validContent(m))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function ePe(t,e,n=1,r){let i=t.doc.resolve(e),o=Mt.empty,s=Mt.empty;for(let a=i.depth,l=i.depth-n,c=n-1;a>l;a--,c--){o=Mt.from(i.node(a).copy(o));let u=r&&r[c];s=Mt.from(u?u.type.create(u.attrs,s):i.node(a).copy(s))}t.step(new ha(e,e,new Zt(o.append(s),n,n),!0))}function Gp(t,e){let n=t.resolve(e),r=n.index();return V7(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function tPe(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i0?(o=r.node(i+1),a++,s=r.node(i).maybeChild(a)):(o=r.node(i).maybeChild(a-1),s=r.node(i+1)),o&&!o.isTextblock&&V7(o,s)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function nPe(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,o=t.doc.resolve(e-n),s=o.node().type;if(i&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(i);u&&!d?r=!1:!u&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);z7(t,u.node(),u.before(),a)}s.inlineContent&&NN(t,e+n-1,s,o.node().contentMatchAt(o.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new ha(c,l.map(e+n,-1),Zt.empty,!0)),r===!0){let u=t.doc.resolve(c);$7(t,u.node(),u.before(),t.steps.length)}return t}function rPe(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,n))return r.after(i+1);if(o=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),u=!1;if(o==1)u=c.canReplace(l,l,i);else{let d=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function Mk(t,e,n=e,r=Zt.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return j7(i,o,r)?new ha(e,n,r):new oPe(i,o,r).fit()}function j7(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class oPe{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Mt.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=Mt.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let l=new Zt(o,s,a);return e>-1?new da(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new ha(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=DN(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(Mt.from(s),!1)):o&&l.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:a,parent:o,inject:d};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:o,wrap:u};if(o&&c.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=DN(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new Zt(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=DN(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new Zt(rw(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new Zt(rw(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let w=0;w1||l==0||w.content.size)&&(d=x,u.push(U7(w.mark(p.allowedMarks(w.marks)),c==1?l:0,c==a.childCount?m:-1)))}let y=c==a.childCount;y||(m=-1),this.placed=iw(this.placed,n,Mt.from(u)),this.frontier[n].match=d,y&&m<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let w=0,x=a;w1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n=0;a--){let{match:l,type:c}=this.frontier[a],u=RN(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:o?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=iw(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=iw(this.placed,this.depth,Mt.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Mt.empty,!0);e.childCount&&(this.placed=iw(this.placed,this.frontier.length,e))}}function rw(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(rw(t.firstChild.content,e-1,n)))}function iw(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(iw(t.lastChild.content,e-1,n)))}function DN(t,e){for(let n=0;n1&&(r=r.replaceChild(0,U7(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(Mt.empty,!0)))),t.copy(r)}function RN(t,e,n,r,i){let o=t.node(e),s=i?t.indexAfter(e):t.index(e);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!sPe(n,o.content,s)?a:null}function sPe(t,e,n){for(let r=n;r0;p--,m--){let y=i.node(p).type.spec;if(y.defining||y.definingAsContext||y.isolating)break;s.indexOf(p)>-1?a=p:i.before(p)==m&&s.splice(1,0,-p)}let l=s.indexOf(a),c=[],u=r.openStart;for(let p=r.content,m=0;;m++){let y=p.firstChild;if(c.push(y),m==r.openStart)break;p=y.content}for(let p=u-1;p>=0;p--){let m=c[p],y=aPe(m.type);if(y&&!m.sameMarkup(i.node(Math.abs(a)-1)))u=p;else if(y||!m.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let m=(p+u+1)%(r.openStart+1),y=c[m];if(y)for(let w=0;w=0&&(t.replace(e,n,r),!(t.steps.length>d));p--){let m=s[p];m<0||(e=i.before(m),n=o.after(m))}}function H7(t,e,n,r,i){if(er){let o=i.contentMatchAt(0),s=o.fillBefore(t).append(t);t=s.append(o.matchFragment(s).fillBefore(Mt.empty,!0))}return t}function cPe(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=rPe(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new Zt(Mt.from(r),0,0))}function uPe(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=W7(r,i);for(let s=0;s0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function W7(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let o=t.start(i);if(oe.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&n.push(i)}return n}class B0 extends tl{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return ws.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return ws.fromReplace(e,this.pos,this.pos+1,new Zt(Mt.from(i),0,n.isLeaf?0:1))}getMap(){return Fc.empty}invert(e){return new B0(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new B0(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new B0(n.pos,n.attr,n.value)}}tl.jsonID("attr",B0);class ow extends tl{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return ws.ok(r)}getMap(){return Fc.empty}invert(e){return new ow(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new ow(n.attr,n.value)}}tl.jsonID("docAttr",ow);let F0=class extends Error{};F0=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},F0.prototype=Object.create(Error.prototype),F0.prototype.constructor=F0,F0.prototype.name="TransformError";class BN{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new nw}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new F0(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=Zt.empty){let i=Mk(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new Zt(Mt.from(r),0,0))}delete(e,n){return this.replace(e,n,Zt.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return lPe(this,e,n,r),this}replaceRangeWith(e,n,r){return cPe(this,e,n,r),this}deleteRange(e,n){return uPe(this,e,n),this}lift(e,n){return qLe(this,e,n),this}join(e,n=1){return nPe(this,e,n),this}wrap(e,n){return XLe(this,e,n),this}setBlockType(e,n=e,r,i=null){return KLe(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return QLe(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new B0(e,n,r)),this}setDocAttribute(e,n){return this.step(new ow(e,n)),this}addNodeMark(e,n){return this.step(new Wp(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Ki)n.isInSet(r.marks)&&this.step(new Yg(e,n));else{let i=r.marks,o,s=[];for(;o=n.isInSet(i);)s.push(new Yg(e,o)),i=o.removeFromSet(i);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return this}split(e,n=1,r){return ePe(this,e,n,r),this}addMark(e,n,r){return HLe(this,e,n,r),this}removeMark(e,n,r){return WLe(this,e,n,r),this}clearIncompatible(e,n,r){return NN(this,e,n,r),this}}const FN=Object.create(null);class Gn{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new G7(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n=0;o--){let s=n<0?$0(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):$0(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Au(e.node(0))}static atStart(e){return $0(e,e,0,0,1)||new Au(e)}static atEnd(e){return $0(e,e,e.content.size,e.childCount,-1)||new Au(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=FN[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in FN)throw new RangeError("Duplicate use of selection JSON ID "+e);return FN[e]=n,n.prototype.jsonID=e,n}getBookmark(){return qn.between(this.$anchor,this.$head).getBookmark()}}Gn.prototype.visible=!0;class G7{constructor(e,n){this.$from=e,this.$to=n}}let q7=!1;function Y7(t){!q7&&!t.parent.inlineContent&&(q7=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class qn extends Gn{constructor(e,n=e){Y7(e),Y7(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Gn.near(r);let i=e.resolve(n.map(this.anchor));return new qn(i.parent.inlineContent?i:r,r)}replace(e,n=Zt.empty){if(super.replace(e,n),n==Zt.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof qn&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ak(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new qn(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=Gn.findFrom(n,r,!0)||Gn.findFrom(n,-r,!0);if(o)n=o.$head;else return Gn.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Gn.findFrom(e,-r,!0)||Gn.findFrom(e,r,!0)).$anchor,e.pos0?0:1);i>0?s=0;s+=i){let a=e.child(s);if(a.isAtom){if(!o&&Vn.isSelectable(a))return Vn.create(t,n-(i<0?a.nodeSize:0))}else{let l=$0(t,a,n+i,i<0?a.childCount:0,i,o);if(l)return l}n+=a.nodeSize*i}return null}function Z7(t,e,n){let r=t.steps.length-1;if(r{s==null&&(s=u)}),t.setSelection(Gn.near(t.doc.resolve(s),n))}const X7=1,Ik=2,K7=4;class dPe extends BN{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ik,this}ensureMarks(e){return Ki.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Ik)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Ik,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Ki.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(n);o=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,o)),this.selection.empty||this.setSelection(Gn.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=K7,this}get scrolledIntoView(){return(this.updated&K7)>0}}function J7(t,e){return!e||!t?t:t.bind(e)}class sw{constructor(e,n,r){this.name=e,this.init=J7(n.init,r),this.apply=J7(n.apply,r)}}const fPe=[new sw("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new sw("selection",{init(t,e){return t.selection||Gn.atStart(e.doc)},apply(t){return t.selection}}),new sw("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new sw("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class zN{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=fPe.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new sw(r.key,r.spec.state,r))})}}class z0{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new zN(e.schema,e.plugins),o=new z0(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=Up.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=Gn.fromJSON(o.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){o[s.name]=c.fromJSON.call(l,e,n[a],o);return}}o[s.name]=s.init(e,o)}}),o}}function Q7(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Q7(i,e,{})),n[r]=i}return n}class xs{constructor(e){this.spec=e,this.props={},e.props&&Q7(e.props,this,this.props),this.key=e.key?e.key.key:eU("plugin")}getState(e){return e[this.key]}}const VN=Object.create(null);function eU(t){return t in VN?t+"$"+ ++VN[t]:(VN[t]=0,t+"$")}class fa{constructor(e="key"){this.key=eU(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Aa=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},V0=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let jN=null;const Pf=function(t,e,n){let r=jN||(jN=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},pPe=function(){jN=null},Zg=function(t,e,n,r){return n&&(tU(t,e,n,r,-1)||tU(t,e,n,r,1))},mPe=/^(img|br|input|textarea|hr)$/i;function tU(t,e,n,r,i){for(var o;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Iu(t))){let s=t.parentNode;if(!s||s.nodeType!=1||aw(t)||mPe.test(t.nodeName)||t.contentEditable=="false")return!1;e=Aa(t)+(i<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(i<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((o=s.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=i;else return!1;else t=s,e=i<0?Iu(t):0}else return!1}}function Iu(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function gPe(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Iu(t)}else if(t.parentNode&&!aw(t))e=Aa(t),t=t.parentNode;else return null}}function yPe(t,e){for(;;){if(t.nodeType==3&&e2),Lu=j0||(pd?/Mac/.test(pd.platform):!1),wPe=pd?/Win/.test(pd.platform):!1,Nf=/Android \d/.test(qp),lw=!!nU&&"webkitFontSmoothing"in nU.documentElement.style,xPe=lw?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function EPe(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Of(t,e){return typeof t=="number"?t:t[e]}function SPe(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function oU(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=V0(s);continue}let a=s,l=a==o.body,c=l?EPe(o):SPe(a),u=0,d=0;if(e.topc.bottom-Of(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Of(i,"top")-c.top:e.bottom-c.bottom+Of(i,"bottom")),e.leftc.right-Of(r,"right")&&(u=e.right-c.right+Of(i,"right")),u||d)if(l)o.defaultView.scrollBy(u,d);else{let m=a.scrollLeft,y=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let w=a.scrollLeft-m,x=a.scrollTop-y;e={left:e.left-w,top:e.top-x,right:e.right-w,bottom:e.bottom-x}}let p=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:V0(s)}}function CPe(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=n+1;s=n-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:sU(t.dom)}}function sU(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=V0(r));return e}function kPe({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;aU(n,r==0?0:r-e)}function aU(t,e){for(let n=0;n=a){s=Math.max(y.bottom,s),a=Math.min(y.top,a);let w=y.left>e.left?y.left-e.left:y.right=(y.left+y.right)/2?1:0));continue}}else y.top>e.top&&!l&&y.left<=e.left&&y.right>=e.left&&(l=u,c={left:Math.max(y.left,Math.min(y.right,e.left)),top:y.top});!n&&(e.left>=y.right&&e.top>=y.top||e.left>=y.left&&e.top>=y.bottom)&&(o=d+1)}}return!n&&l&&(n=l,i=c,r=0),n&&n.nodeType==3?MPe(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:lU(n,i)}function MPe(t,e){let n=t.nodeValue.length,r=document.createRange();for(let i=0;i=(o.left+o.right)/2?1:0)}}return{node:t,offset:0}}function GN(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function APe(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,i,o)}function LPe(t,e,n,r){let i=-1;for(let o=e,s=!1;o!=t.dom;){let a=t.docView.nearestDesc(o,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&(!s&&l.left>r.left||l.top>r.top?i=a.posBefore:(!s&&l.right-1?i:t.docView.posFromDOM(e,n,-1)}function cU(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&i++}let c;lw&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=LPe(t,r,i,e))}a==null&&(a=IPe(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function uU(t){return t.top=0&&i==r.nodeValue.length?(a--,c=1):n<0?a--:l++,cw(Zp(Pf(r,a,l),c),c<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==Iu(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return qN(a.getBoundingClientRect(),!1)}if(o==null&&i=0)}if(o==null&&i&&(n<0||i==Iu(r))){let a=r.childNodes[i-1],l=a.nodeType==3?Pf(a,Iu(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(l)return cw(Zp(l,1),!1)}if(o==null&&i=0)}function cw(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function qN(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function dU(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function OPe(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return dU(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let s=hU(t,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Pf(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;cu.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const DPe=/[\u0590-\u08ac]/;function RPe(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,a=t.domSelection();return a?!DPe.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?o:s:dU(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),p=a.caretBidiLevel;a.modify("move",n,"character");let m=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:y,focusOffset:w}=t.domSelectionRange(),x=y&&!m.contains(y.nodeType==1?y:y.parentNode)||l==y&&c==w;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return p!=null&&(a.caretBidiLevel=p),x}):r.pos==r.start()||r.pos==r.end()}let fU=null,pU=null,mU=!1;function BPe(t,e,n){return fU==e&&pU==n?mU:(fU=e,pU=n,mU=n=="up"||n=="down"?OPe(t,e,n):RPe(t,e,n))}const Pu=0,gU=1,Kg=2,md=3;class uw{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Pu,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nAa(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!n||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||s instanceof _U){i=e-o;break}o=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof yU&&o.side>=0;r--);if(n<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&n&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?Aa(o.dom)+1:0}}else{let o,s=!0;for(;o=r=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=s;for(let d=a;d>0;d--){let p=this.children[d-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){i=Aa(p.dom)+1;break}e-=p.size}i==-1&&(i=0)}if(i>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;uy&&sn){let y=a;a=l,l=y}let m=document.createRange();m.setEnd(l.node,l.offset),m.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(m)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i=r:er){let a=r+o.border,l=s-o.border;if(e>=a&&n<=l){this.dirty=e==r||n==s?Kg:gU,e==a&&n==l&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=md:o.markDirty(e-a,n-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Kg:md}r=s}this.dirty=Kg}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Kg:gU;n.dirty{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==Pu&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class FPe extends uw{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Jg extends uw{constructor(e,n,r,i,o){super(e,[],r,i),this.mark=n,this.spec=o}static create(e,n,r,i){let o=i.nodeViews[n.type.name],s=o&&o(n,i,r);return(!s||!s.dom)&&(s=qg.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Jg(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&md||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=md&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Pu){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(o=ZN(o,0,e,r));for(let a=0;a{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,i),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=qg.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let p=u;return u=xU(u,r,n),c?l=new $Pe(e,n,r,i,u,d||null,p,c,o,s+1):n.isText?new Pk(e,n,r,i,u,p,o):new Xp(e,n,r,i,u,d||null,p,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Mt.empty)}return e}matchesNode(e,n,r){return this.dirty==Pu&&e.eq(this.node)&&Nk(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,o=e.composing?this.localCompositionInfo(e,n):null,s=o&&o.pos>-1?o:null,a=o&&o.pos<0,l=new VPe(this,s&&s.node,e);HPe(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?Ki.none:this.node.child(u).marks,r,e),l.placeWidget(c,e,i)},(c,u,d,p)=>{l.syncToMarks(c.marks,r,e);let m;l.findNodeMatch(c,u,d,p)||a&&e.state.selection.from>i&&e.state.selection.to-1&&l.updateNodeAt(c,u,d,m,e)||l.updateNextNode(c,u,d,e,p,i)||l.addNode(c,u,d,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Kg)&&(s&&this.protectLocalComposition(e,s),bU(this.contentDOM,this.children,e),j0&&WPe(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof qn)||rn+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,a=GPe(this.node.content,s,r-n,i-n);return a<0?null:{node:o,pos:a,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new FPe(this,o,n,i);e.input.compositionNodes.push(s),this.children=ZN(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==md||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Pu}updateOuterDeco(e){if(Nk(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=wU(this.dom,this.nodeDOM,YN(this.outerDeco,this.node,n),YN(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function vU(t,e,n,r,i){xU(r,e,t);let o=new Xp(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Pk extends Xp{constructor(e,n,r,i,o,s,a){super(e,n,r,i,o,null,s,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==md||this.dirty!=Pu&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Pu||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Pu,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),o=document.createTextNode(i.text);return new Pk(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=md)}get domAtom(){return!1}isText(e){return this.node.text==e}}class _U extends uw{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Pu&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class $Pe extends Xp{constructor(e,n,r,i,o,s,a,l,c,u){super(e,n,r,i,o,s,a,c,u),this.spec=l}update(e,n,r,i){if(this.dirty==md)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,n,r);return o&&this.updateInner(e,n,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function bU(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o>1,s=Math.min(o,e.length);for(;i-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=Jg.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))o=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof Jg)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}function UPe(t,e){return t.type.side-e.type.side}function HPe(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let c=0;co;)a.push(i[s++]);let y=o+p.nodeSize;if(p.isText){let x=y;s!x.inline):a.slice();r(p,w,e.forChild(o,p),m),o=y}}function WPe(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function GPe(t,e,n,r){for(let i=0,o=0;i=n){if(o>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function ZN(t,e,n,r,i){let o=[];for(let s=0,a=0;s=n||u<=e?o.push(l):(cn&&o.push(l.slice(n-c,l.size,r)))}return o}function XN(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),o=i&&i.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(Lk(n)){for(l=s;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&Vn.isSelectable(d)&&i.parent&&!(d.isInline&&vPe(n.focusNode,n.focusOffset,i.dom))){let p=i.posBefore;c=new Vn(s==p?a:r.resolve(p))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,p=s;for(let m=0;m{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!SU(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function YPe(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let r=t.cursorWrapper.dom,i=r.nodeName=="IMG";i?n.setStart(r.parentNode,Aa(r)+1):n.setStart(r,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!i&&!t.state.selection.visible&&oc&&Yp<=11&&(r.disabled=!0,r.disabled=!1)}function MU(t,e){if(e instanceof Vn){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(AU(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else AU(t)}function AU(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function JN(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||qn.between(e,n,r)}function IU(t){return t.editable&&!t.hasFocus()?!1:LU(t)}function LU(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function ZPe(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Zg(e.node,e.offset,n.anchorNode,n.anchorOffset)}function QN(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return o&&Gn.findFrom(o,e)}function Kp(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function PU(t,e,n){let r=t.state.selection;if(r instanceof qn)if(n.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=t.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return Kp(t,new qn(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=QN(t.state,e);return i&&i instanceof Vn?Kp(t,i):!1}else if(!(Lu&&n.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let a=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?Vn.isSelectable(o)?Kp(t,new Vn(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):lw?Kp(t,new qn(t.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Vn&&r.node.isInline)return Kp(t,new qn(e>0?r.$to:r.$from));{let i=QN(t.state,e);return i?Kp(t,i):!1}}}function Ok(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function dw(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function H0(t,e){return e<0?XPe(t):KPe(t)}function XPe(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;for(vh&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(dw(a,-1))i=n,o=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(NU(n))break;{let a=n.previousSibling;for(;a&&dw(a,-1);)i=n.parentNode,o=Aa(a),a=a.previousSibling;if(a)n=a,r=Ok(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?eO(t,n,r):i&&eO(t,i,o)}function KPe(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Ok(n),o,s;for(;;)if(r{t.state==i&&Df(t)},50)}function OU(t,e){let n=t.state.doc.resolve(e);if(!(nl||wPe)&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>r.top&&o1)return i.leftr.top&&o1)return i.left>r.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function DU(t,e,n){let r=t.state.selection;if(r instanceof qn&&!r.empty||n.indexOf("s")>-1||Lu&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=QN(t.state,e);if(s&&s instanceof Vn)return Kp(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,a=r instanceof Au?Gn.near(s,e):Gn.findFrom(s,e);return a?Kp(t,a):!1}return!1}function RU(t,e){if(!(t.state.selection instanceof qn))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let s=t.state.tr;return e<0?s.delete(n.pos-o.nodeSize,n.pos):s.delete(n.pos,n.pos+o.nodeSize),t.dispatch(s),!0}return!1}function BU(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function e2e(t){if(!Ml||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;BU(t,r,"true"),setTimeout(()=>BU(t,r,"false"),20)}return!1}function t2e(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function n2e(t,e){let n=e.keyCode,r=t2e(e);if(n==8||Lu&&n==72&&r=="c")return RU(t,-1)||H0(t,-1);if(n==46&&!e.shiftKey||Lu&&n==68&&r=="c")return RU(t,1)||H0(t,1);if(n==13||n==27)return!0;if(n==37||Lu&&n==66&&r=="c"){let i=n==37?OU(t,t.state.selection.from)=="ltr"?-1:1:-1;return PU(t,i,r)||H0(t,i)}else if(n==39||Lu&&n==70&&r=="c"){let i=n==39?OU(t,t.state.selection.from)=="ltr"?1:-1:1;return PU(t,i,r)||H0(t,i)}else{if(n==38||Lu&&n==80&&r=="c")return DU(t,-1,r)||H0(t,-1);if(n==40||Lu&&n==78&&r=="c")return e2e(t)||DU(t,1,r)||H0(t,1);if(r==(Lu?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function tO(t,e){t.someProp("transformCopied",m=>{e=m(e,t)});let n=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let m=r.firstChild;n.push(m.type.name,m.attrs!=m.type.defaultAttrs?m.attrs:null),r=m.content}let s=t.someProp("clipboardSerializer")||qg.fromSchema(t.state.schema),a=WU(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=UU[c.nodeName.toLowerCase()]);){for(let m=u.length-1;m>=0;m--){let y=a.createElement(u[m]);for(;l.firstChild;)y.appendChild(l.firstChild);l.appendChild(y),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${d?` -${d}`:""} ${JSON.stringify(n)}`);let p=t.someProp("clipboardTextSerializer",m=>m(e,t))||e.content.textBetween(0,e.content.size,` `);return{dom:l,text:p,slice:e}}function FU(t,e,n,r,i){let o=i.parent.type.spec.code,s,a;if(!n&&!e)return null;let l=e&&(r||o||!n);if(l){if(t.someProp("transformPastedText",p=>{e=p(e,o||r,t)}),o)return e?new Zt(Mt.from(t.state.schema.text(e.replace(/\r\n?/g,` `))),0,0):Zt.empty;let d=t.someProp("clipboardTextParser",p=>p(e,i,r,t));if(d)a=d;else{let p=i.marks(),{schema:m}=t.state,y=qg.fromSchema(m);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let x=s.appendChild(document.createElement("p"));w&&x.appendChild(y.serializeNode(m.text(w,p)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=s2e(n),lw&&a2e(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||D0.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!r2e.test(d.parentNode.nodeName)?{ignore:!0}:null}})),u)a=l2e(jU(a,+u[1],+u[2]),u[4]);else if(a=Zt.maxOpen(i2e(a.content,i),!0),a.openStart||a.openEnd){let d=0,p=0;for(let m=a.content.firstChild;d{a=d(a,t)}),a}const r2e=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function i2e(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(s=>{if(!o)return;let a=r.findWrapping(s.type),l;if(!a)return o=null;if(l=o.length&&i.length&&zU(a,i,s,o[o.length-1],0))o[o.length-1]=l;else{o.length&&(o[o.length-1]=VU(o[o.length-1],i.length));let c=$U(s,a);o.push(c),r=r.matchType(c.type),i=a}}),o)return Mt.from(o)}return t}function $U(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,Mt.from(t));return t}function zU(t,e,n,r,i){if(i1&&(o=0),i=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(Mt.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function jU(t,e,n){return en})),rO.createHTML(t)):t}function s2e(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=WU().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&UU[r[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"").reverse().join("")),n.innerHTML=o2e(t),i)for(let o=0;o=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=Mt.from(l.create(r[a+1],i)),o++,s++}return new Zt(i,o,s)}const Al={},Il={},c2e={touchstart:!0,touchmove:!0};class u2e{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function h2e(t){for(let e in Al){let n=Al[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{f2e(t,r)&&!oO(t,r)&&(t.editable||!(r.type in Il))&&n(t,r)},c2e[e]?{passive:!0}:void 0)}Ml&&t.dom.addEventListener("input",()=>null),iO(t)}function Jp(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function d2e(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function iO(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>oO(t,r))})}function oO(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function f2e(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function p2e(t,e){!oO(t,e)&&Al[e.type]&&(t.editable||!(e.type in Il))&&Al[e.type](t,e)}Il.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!qU(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Nf&&nl&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),j0&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Xg(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||n2e(t,n)?n.preventDefault():Jp(t,"key")},Il.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},Il.keypress=(t,e)=>{let n=e;if(qU(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Lu&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof qn)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),o=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,i,o))&&t.dispatch(o()),n.preventDefault()}};function Dk(t){return{left:t.clientX,top:t.clientY}}function m2e(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function sO(t,e,n,r,i){if(r==-1)return!1;let o=t.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(t.someProp(e,a=>s>o.depth?a(t,n,o.nodeAfter,o.before(s),i,!0):a(t,n,o.node(s),o.before(s),i,!1)))return!0;return!1}function W0(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function g2e(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Vn.isSelectable(r)?(W0(t,new Vn(n)),!0):!1}function y2e(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Vn&&(r=n.node);let o=t.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let a=s>o.depth?o.nodeAfter:o.node(s);if(Vn.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(s);break}}return i!=null?(W0(t,Vn.create(t.state.doc,i)),!0):!1}function v2e(t,e,n,r,i){return sO(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?y2e(t,n):g2e(t,n))}function _2e(t,e,n,r){return sO(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function b2e(t,e,n,r){return sO(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||w2e(t,n,r)}function w2e(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(W0(t,qn.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),a=i.before(o);if(s.inlineContent)W0(t,qn.create(r,a+1,a+1+s.content.size));else if(Vn.isSelectable(s))W0(t,Vn.create(r,a));else continue;return!0}}function aO(t){return Rk(t)}const GU=Lu?"metaKey":"ctrlKey";Al.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=aO(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&m2e(n,t.input.lastClick)&&!n[GU]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o,button:n.button};let s=t.posAtCoords(Dk(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new x2e(t,s,n,!!r)):(o=="doubleClick"?_2e:b2e)(t,s.pos,s.inside,n)?n.preventDefault():Jp(t,"pointer"))};class x2e{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[GU],this.allowDefault=r.shiftKey;let o,s;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);o=u.parent,s=u.depth?u.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:c}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof Vn&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&vh&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Jp(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Df(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Dk(e))),this.updateAllowDefault(e),this.allowDefault||!n?Jp(this.view,"pointer"):v2e(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ml&&this.mightDrag&&!this.mightDrag.node.isAtom||nl&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(W0(this.view,Gn.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Jp(this.view,"pointer")}move(e){this.updateAllowDefault(e),Jp(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Al.touchstart=t=>{t.input.lastTouch=Date.now(),aO(t),Jp(t,"pointer")},Al.touchmove=t=>{t.input.lastTouch=Date.now(),Jp(t,"pointer")},Al.contextmenu=t=>aO(t);function qU(t,e){return t.composing?!0:Ml&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const E2e=Nf?5e3:-1;Il.compositionstart=Il.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof qn&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Rk(t,!0),t.markCursor=null;else if(Rk(t,!e.selection.empty),vh&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let a=t.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}t.input.composing=!0}YU(t,E2e)},Il.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,YU(t,20))};function YU(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Rk(t),e))}function ZU(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=C2e());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function S2e(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=gPe(e.focusNode,e.focusOffset),r=yPe(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function C2e(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Rk(t,e=!1){if(!(Nf&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),ZU(t),e||t.docView&&t.docView.dirty){let n=XN(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function k2e(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const fw=oc&&Yp<15||j0&&xPe<604;Al.copy=Il.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=fw?null:n.clipboardData,s=r.content(),{dom:a,text:l}=tO(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):k2e(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function T2e(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function M2e(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?pw(t,r.value,null,i,e):pw(t,r.textContent,r.innerHTML,i,e)},50)}function pw(t,e,n,r,i){let o=FU(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,o||Zt.empty)))return!0;if(!o)return!1;let s=T2e(o),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function XU(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Il.paste=(t,e)=>{let n=e;if(t.composing&&!Nf)return;let r=fw?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&pw(t,XU(r),r.getData("text/html"),i,n)?n.preventDefault():M2e(t,n)};class KU{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const A2e=Lu?"altKey":"ctrlKey";function JU(t,e){return t.someProp("dragCopies",r=>!r(e))??!e[A2e]}Al.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,o=i.empty?null:t.posAtCoords(Dk(n)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof Vn?i.to-1:i.to))){if(r&&r.mightDrag)s=Vn.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=Vn.create(t.state.doc,d.posBefore))}}let a=(s||t.state.selection).content(),{dom:l,text:c,slice:u}=tO(t,a);(!n.dataTransfer.files.length||!nl||iU>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(fw?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",fw||n.dataTransfer.setData("text/plain",c),t.dragging=new KU(u,JU(t,n),s)},Al.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},Il.dragover=Il.dragenter=(t,e)=>e.preventDefault(),Il.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(Dk(n));if(!i)return;let o=t.state.doc.resolve(i.pos),s=r&&r.slice;s?t.someProp("transformPasted",y=>{s=y(s,t)}):s=FU(t,XU(n.dataTransfer),fw?null:n.dataTransfer.getData("text/html"),!1,o);let a=!!(r&&JU(t,n));if(t.someProp("handleDrop",y=>y(t,n,s||Zt.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?iPe(t.state.doc,o.pos,s):o.pos;l==null&&(l=o.pos);let c=t.state.tr;if(a){let{node:y}=r;y?y.replace(c):c.deleteSelection()}let u=c.mapping.map(l),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,p=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(p))return;let m=c.doc.resolve(u);if(d&&Vn.isSelectable(s.content.firstChild)&&m.nodeAfter&&m.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new Vn(m));else{let y=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((w,x,C,S)=>y=S),c.setSelection(JN(t,m,c.doc.resolve(y)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))},Al.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Df(t)},20))},Al.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},Al.beforeinput=(t,e)=>{if(nl&&Nf&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:n}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=n||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,Xg(8,"Backspace")))))return;let{$cursor:r}=t.state.selection;r&&r.pos>0&&t.dispatch(t.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let t in Il)Al[t]=Il[t];function mw(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Bk{constructor(e,n){this.toDOM=e,this.spec=n||ey,this.side=this.spec.side||0}map(e,n,r,i){let{pos:o,deleted:s}=e.mapResult(n.from+i,this.side<0?-1:1);return s?null:new Ll(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Bk&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&mw(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Qp{constructor(e,n){this.attrs=e,this.spec=n||ey}map(e,n,r,i){let o=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new Ll(o,s,this)}valid(e,n){return n.from=e&&(!o||o(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let s=0;se){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,r,i+a,o)}}map(e,n,r){return this==rl||e.maps.length==0?this:this.mapInner(e,n,0,0,r||ey)}mapInner(e,n,r,i,o){let s;for(let a=0;a{let c=l+r,u;if(u=eH(n,a,c)){for(i||(i=this.children.slice());oa&&d.to=e){this.children[a]==e&&(r=this.children[a+2]);break}let o=e+1,s=o+n.content.size;for(let a=0;ao&&l.type instanceof Qp){let c=Math.max(o,l.from)-o,u=Math.min(s,l.to)-o;ci.map(e,n,ey));return em.from(r)}forChild(e,n){if(n.isLeaf)return Ho.empty;let r=[];for(let i=0;in instanceof Ho)?e:e.reduce((n,r)=>n.concat(r instanceof Ho?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let x=w-y-(m-p);for(let C=0;CS+u-d)continue;let M=a[C]+u-d;m>=M?a[C+1]=p<=M?-2:-1:p>=u&&x&&(a[C]+=x,a[C+1]+=x)}d+=x}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c=r.content.size){l=!0;continue}let p=n.map(t[c+1]+o,-1),m=p-i,{index:y,offset:w}=r.content.findIndex(d),x=r.maybeChild(y);if(x&&w==d&&w+x.nodeSize==m){let C=a[c+2].mapInner(n,x,u+1,t[c]+o+1,s);C!=rl?(a[c]=d,a[c+1]=m,a[c+2]=C):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=L2e(a,t,e,n,i,o,s),u=Fk(c,r,0,s);e=u.local;for(let d=0;dn&&s.to{let c=eH(t,a,l+n);if(c){o=!0;let u=Fk(c,a,n+l+1,r);u!=rl&&i.push(l,l+a.nodeSize,u)}});let s=QU(o?tH(t):t,-n).sort(ty);for(let a=0;a0;)e++;t.splice(e,0,n)}function uO(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=rl&&e.push(r)}),t.cursorWrapper&&e.push(Ho.create(t.state.doc,[t.cursorWrapper.deco])),em.from(e)}const P2e={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},N2e=oc&&Yp<=11;class O2e{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class D2e{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new O2e,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),N2e&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,P2e)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;nthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(IU(this.view)){if(this.suppressingSelectionUpdates)return Df(this.view);if(oc&&Yp<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Zg(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let o=e.focusNode;o;o=V0(o))n.add(o);for(let o=e.anchorNode;o;o=V0(o))if(n.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&IU(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(e.editable)for(let u=0;ud.nodeName=="BR");if(u.length==2){let[d,p]=u;d.parentNode&&d.parentNode.parentNode==p.parentNode?p.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let p of u){let m=p.parentNode;m&&m.nodeName=="LI"&&(!d||F2e(e,d)!=m)&&p.remove()}}}let c=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(o>-1&&(e.docView.markDirty(o,s),R2e(e)),this.handleDOMChange(o,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Df(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;ui;x--){let C=r.childNodes[x-1],S=C.pmViewDesc;if(C.nodeName=="BR"&&!S){o=x;break}if(!S||S.size)break}let d=t.state.doc,p=t.someProp("domParser")||D0.fromSchema(t.state.schema),m=d.resolve(s),y=null,w=p.parse(r,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:i,to:o,preserveWhitespace:m.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:z2e,context:m});if(c&&c[0].pos!=null){let x=c[0].pos,C=c[1]&&c[1].pos;C==null&&(C=x),y={anchor:x+s,head:C+s}}return{doc:w,sel:y,from:s,to:a}}function z2e(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ml&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Ml&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const V2e=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function j2e(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let z=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,$=XN(t,z);if($&&!t.state.selection.eq($)){if(nl&&Nf&&t.input.lastKeyCode===13&&Date.now()-100J(t,Xg(13,"Enter"))))return;let W=t.state.tr.setSelection($);z=="pointer"?W.setMeta("pointer",!0):z=="key"&&W.scrollIntoView(),o&&W.setMeta("composition",o),t.dispatch(W)}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=$2e(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),p,m;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Nf)&&i.some(z=>z.nodeType==1&&!V2e.test(z.nodeName))&&(!y||y.endA>=y.endB)&&t.someProp("handleKeyDown",z=>z(t,Xg(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!y)if(r&&l instanceof qn&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))y={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let z=sH(t,t.state.doc,c.sel);if(z&&!z.eq(t.state.selection)){let $=t.state.tr.setSelection(z);o&&$.setMeta("composition",o),t.dispatch($)}}return}t.state.selection.fromt.state.selection.from&&y.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?y.start=t.state.selection.from:y.endA=t.state.selection.to-2&&t.state.selection.to<=c.to&&(y.endB+=t.state.selection.to-y.endA,y.endA=t.state.selection.to)),oc&&Yp<=11&&y.endB==y.start+1&&y.endA==y.start&&y.start>c.from&&c.doc.textBetween(y.start-c.from-1,y.start-c.from+1)=="  "&&(y.start--,y.endA--,y.endB--);let w=c.doc.resolveNoCache(y.start-c.from),x=c.doc.resolveNoCache(y.endB-c.from),C=u.resolve(y.start),S=w.sameParent(x)&&w.parent.inlineContent&&C.end()>=y.endA,M;if((j0&&t.input.lastIOSEnter>Date.now()-225&&(!S||i.some(z=>z.nodeName=="DIV"||z.nodeName=="P"))||!S&&w.posw.pos)&&t.someProp("handleKeyDown",z=>z(t,Xg(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>y.start&&H2e(u,y.start,y.endA,w,x)&&t.someProp("handleKeyDown",z=>z(t,Xg(8,"Backspace")))){Nf&&nl&&t.domObserver.suppressSelectionUpdates();return}nl&&y.endB==y.start&&(t.input.lastChromeDelete=Date.now()),Nf&&!S&&w.start()!=x.start()&&x.parentOffset==0&&w.depth==x.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==y.endA&&(y.endB-=2,x=c.doc.resolveNoCache(y.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(z){return z(t,Xg(13,"Enter"))})},20));let E=y.start,A=y.endA,I=z=>{let $=z||t.state.tr.replace(E,A,c.doc.slice(y.start-c.from,y.endB-c.from));if(c.sel){let W=sH(t,$.doc,c.sel);W&&!(nl&&t.composing&&W.empty&&(y.start!=y.endB||t.input.lastChromeDeleteDf(t),20));let z=I(t.state.tr.delete(E,A)),$=u.resolve(y.start).marksAcross(u.resolve(y.endA));$&&z.ensureMarks($),t.dispatch(z)}else if(y.endA==y.endB&&(O=U2e(w.parent.content.cut(w.parentOffset,x.parentOffset),C.parent.content.cut(C.parentOffset,y.endA-C.start())))){let z=I(t.state.tr);O.type=="add"?z.addMark(E,A,O.mark):z.removeMark(E,A,O.mark),t.dispatch(z)}else if(w.parent.child(w.index()).isText&&w.index()==x.index()-(x.textOffset?0:1)){let z=w.parent.textBetween(w.parentOffset,x.parentOffset),$=()=>I(t.state.tr.insertText(z,E,A));t.someProp("handleTextInput",W=>W(t,E,A,z,$))||t.dispatch($())}}else t.dispatch(I())}function sH(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:JN(t,e.resolve(n.anchor),e.resolve(n.head))}function U2e(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,o=r,s,a,l;for(let u=0;uu.mark(a.addToSet(u.marks));else if(i.length==0&&o.length==1)a=o[0],s="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;un||hO(s,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let o=t.node(r).maybeChild(t.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function W2e(t,e,n,r,i){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,o-Math.min(s,a));r-=s+l-o}if(s=s?o-r:0;o-=l,o&&o=a?o-r:0;o-=l,o&&o=56320&&e<=57343&&n>=55296&&n<=56319}class lH{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new u2e,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(fH),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=hH(this),uH(this),this.nodeViews=dH(this),this.docView=vU(this.state.doc,cH(this),uO(this),this.dom,this),this.domObserver=new D2e(this,(r,i,o,s)=>j2e(this,r,i,o,s)),this.domObserver.start(),h2e(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&iO(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(fH),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(ZU(this),s=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let m=dH(this);q2e(m,this.nodeViews)&&(this.nodeViews=m,o=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&iO(this),this.editable=hH(this),uH(this);let l=uO(this),c=cH(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=o||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(i.selection))&&(s=!0);let p=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&CPe(this);if(s){this.domObserver.stop();let m=d&&(oc||nl)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&G2e(i.selection,e.selection);if(d){let y=nl?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=S2e(this)),(o||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=vU(e.doc,c,l,this.dom,this)),y&&!this.trackWrites&&(m=!0)}m||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&ZPe(this))?Df(this,m):(MU(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():p&&kPe(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Vn){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&oU(this,n.getBoundingClientRect(),e)}else oU(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new KU(e.slice,e.move,i<0?void 0:Vn.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let s=0;sn.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return PPe(this,e)}coordsAtPos(e,n=1){return hU(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return BPe(this,n||this.state,e)}pasteHTML(e,n){return pw(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return pw(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return tO(this,e)}destroy(){this.docView&&(d2e(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],uO(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,pPe())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return p2e(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ml&&this.root.nodeType===11&&_Pe(this.dom.ownerDocument)==this.dom&&B2e(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}lH.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function cH(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Ll.node(0,t.state.doc.content.size,e)]}function uH(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Ll.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function hH(t){return!t.someProp("editable",e=>e(t.state)===!1)}function G2e(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function dH(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function q2e(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function fH(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var tm={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:"'"},$k={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Y2e=typeof navigator<"u"&&/Mac/.test(navigator.platform),Z2e=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Ia=0;Ia<10;Ia++)tm[48+Ia]=tm[96+Ia]=String(Ia);for(var Ia=1;Ia<=24;Ia++)tm[Ia+111]="F"+Ia;for(var Ia=65;Ia<=90;Ia++)tm[Ia]=String.fromCharCode(Ia+32),$k[Ia]=String.fromCharCode(Ia);for(var dO in tm)$k.hasOwnProperty(dO)||($k[dO]=tm[dO]);function X2e(t){var e=Y2e&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Z2e&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?$k:tm)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const K2e=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),J2e=typeof navigator<"u"&&/Win/.test(navigator.platform);function Q2e(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let a=0;at.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function pH(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const mH=(t,e,n)=>{let r=pH(t,n);if(!r)return!1;let i=gO(r);if(!i){let s=r.blockRange(),a=s&&R0(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(SH(t,i,e,-1))return!0;if(r.parent.content.size==0&&(q0(o,"end")||Vn.isSelectable(o)))for(let s=r.depth;;s--){let a=Mk(t.doc,r.before(s),r.after(s),Zt.empty);if(a&&a.slice.size1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},nNe=(t,e,n)=>{let r=pH(t,n);if(!r)return!1;let i=gO(r);return i?gH(t,i,e):!1},rNe=(t,e,n)=>{let r=vH(t,n);if(!r)return!1;let i=yO(r);return i?gH(t,i,e):!1};function gH(t,e,n){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let s=e.nodeAfter,a=s,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=Mk(t.doc,o,l,Zt.empty);if(!c||c.from!=o||c instanceof ha&&c.slice.size>=l-o)return!1;if(n){let u=t.tr.step(c);u.setSelection(qn.create(u.doc,o)),n(u.scrollIntoView())}return!0}function q0(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const yH=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;o=gO(r)}let s=o&&o.nodeBefore;return!s||!Vn.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Vn.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function gO(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function vH(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=vH(t,n);if(!r)return!1;let i=yO(r);if(!i)return!1;let o=i.nodeAfter;if(SH(t,i,e,1))return!0;if(r.parent.content.size==0&&(q0(o,"start")||Vn.isSelectable(o))){let s=Mk(t.doc,r.before(),r.after(),Zt.empty);if(s&&s.slice.size{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,r=n instanceof Vn,i;if(r){if(n.node.isTextblock||!Gp(t.doc,n.from))return!1;i=n.from}else if(i=Tk(t.doc,n.from,-1),i==null)return!1;if(e){let o=t.tr.join(i);r&&o.setSelection(Vn.create(o.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},oNe=(t,e)=>{let n=t.selection,r;if(n instanceof Vn){if(n.node.isTextblock||!Gp(t.doc,n.to))return!1;r=n.to}else if(r=Tk(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},sNe=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&R0(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},wH=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(` `).scrollIntoView()),!0)};function vO(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=vO(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,s.createAndFill());l.setSelection(Gn.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},xH=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Au||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=vO(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(Lf(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&R0(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function lNe(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Vn&&e.selection.node.isBlock)return!r.parentOffset||!Lf(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],s,a,l=!1,c=!1;for(let m=r.depth;;m--)if(r.node(m).isBlock){l=r.end(m)==r.pos+(r.depth-m),c=r.start(m)==r.pos-(r.depth-m),a=vO(r.node(m-1).contentMatchAt(r.indexAfter(m-1))),o.unshift(l&&a?{type:a}:null),s=m;break}else{if(m==1)return!1;o.unshift(null)}let u=e.tr;(e.selection instanceof qn||e.selection instanceof Au)&&u.deleteSelection();let d=u.mapping.map(r.pos),p=Lf(u.doc,d,o.length,o);if(p||(o[0]=a?{type:a}:null,p=Lf(u.doc,d,o.length,o)),!p)return!1;if(u.split(d,o.length,o),!l&&c&&r.node(s).type!=a){let m=u.mapping.map(r.before(s)),y=u.doc.resolve(m);a&&r.node(s-1).canReplaceWith(y.index(),y.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(s)),a)}return n&&n(u.scrollIntoView()),!0}}const cNe=lNe(),uNe=(t,e)=>{let{$from:n,to:r}=t.selection,i,o=n.sharedDepth(r);return o==0?!1:(i=n.before(o),e&&e(t.tr.setSelection(Vn.create(t.doc,i))),!0)};function hNe(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||Gp(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function SH(t,e,n,r){let i=e.nodeBefore,o=e.nodeAfter,s,a,l=i.type.spec.isolating||o.type.spec.isolating;if(!l&&hNe(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(a=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&a.matchType(s[0]||o.type).validEnd){if(n){let m=e.pos+o.nodeSize,y=Mt.empty;for(let C=s.length-1;C>=0;C--)y=Mt.from(s[C].create(null,y));y=Mt.from(i.copy(y));let w=t.tr.step(new da(e.pos-1,m,e.pos,m,new Zt(y,1,0),s.length,!0)),x=w.doc.resolve(m+2*s.length);x.nodeAfter&&x.nodeAfter.type==i.type&&Gp(w.doc,x.pos)&&w.join(x.pos),n(w.scrollIntoView())}return!0}let u=o.type.spec.isolating||r>0&&l?null:Gn.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),p=d&&R0(d);if(p!=null&&p>=e.depth)return n&&n(t.tr.lift(d,p).scrollIntoView()),!0;if(c&&q0(o,"start",!0)&&q0(i,"end")){let m=i,y=[];for(;y.push(m),!m.isTextblock;)m=m.lastChild;let w=o,x=1;for(;!w.isTextblock;w=w.firstChild)x++;if(m.canReplace(m.childCount,m.childCount,w.content)){if(n){let C=Mt.empty;for(let M=y.length-1;M>=0;M--)C=Mt.from(y[M].copy(C));let S=t.tr.step(new da(e.pos-y.length,e.pos+o.nodeSize,e.pos+x,e.pos+o.nodeSize-x,new Zt(C,y.length,0),0,!0));n(S.scrollIntoView())}return!0}}return!1}function CH(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(e.tr.setSelection(qn.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}const dNe=CH(-1),fNe=CH(1);function pNe(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&ON(s,t,e);return a?(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function kH(t,e=null){return function(n,r){let i=!1;for(let o=0;o{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let u=n.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,t)}})}if(!i)return!1;if(r){let o=n.tr;for(let s=0;s=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=s.resolve(e.start-2);o=new wk(l,l,e.depth),e.endIndex=0;u--)o=Mt.from(n[u].type.create(n[u].attrs,o));t.step(new da(e.start-(r?2:0),e.end,e.start,e.end,new Zt(o,0,0),n.length,!0));let s=0;for(let u=0;us.childCount>0&&s.firstChild.type==t);return o?n?r.node(o.depth-1).type==t?_Ne(e,n,t,o):bNe(e,n,o):!0:!1}}function _Ne(t,e,n,r){let i=t.tr,o=r.end,s=r.$to.end(r.depth);ow;y--)m-=i.child(y).nodeSize,r.delete(m-1,m+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==i.childCount,c=o.node(-1),u=o.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?Mt.empty:Mt.from(i))))return!1;let d=o.pos,p=d+s.nodeSize;return r.step(new da(d-(a?1:0),p+(l?1:0),d+1,p-1,new Zt((a?Mt.empty:Mt.from(i.copy(Mt.empty))).append(l?Mt.empty:Mt.from(i.copy(Mt.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function wNe(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==t);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let a=o.parent,l=a.child(s-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=Mt.from(c?t.create():null),d=new Zt(Mt.from(t.create(null,Mt.from(a.type.create(null,u)))),c?3:1,0),p=o.start,m=o.end;n(e.tr.step(new da(p-(c?3:1),m,p,m,d,1,!0)).scrollIntoView())}return!0}}function zk(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}class Vk{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:o}=r,s=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>{const u=l(...c)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,a=[],l=!!e,c=e||o.tr,u=()=>(!l&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),a.every(p=>p===!0)),d={...Object.fromEntries(Object.entries(r).map(([p,m])=>[p,(...y)=>{const w=this.buildProps(c,n),x=m(...y)(w);return a.push(x),d}])),run:u};return d}createCan(e){const{rawCommands:n,state:r}=this,i=!1,o=e||r.tr,s=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...c)=>l(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,a={tr:e,editor:i,view:s,state:zk({state:o,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,c])=>[l,(...u)=>c(...u)(a)]))}};return a}}class xNe{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}once(e,n){const r=(...i)=>{this.off(e,r),n.apply(this,i)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function gn(t,e,n){return t.config[e]===void 0&&t.parent?gn(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?gn(t.parent,e,n):null}):t.config[e]}function jk(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function TH(t){const e=[],{nodeExtensions:n,markExtensions:r}=jk(t),i=[...n,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage,extensions:i},l=gn(s,"addGlobalAttributes",a);l&&l().forEach(c=>{c.types.forEach(u=>{Object.entries(c.attributes).forEach(([d,p])=>{e.push({type:u,name:d,attribute:{...o,...p}})})})})}),i.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},l=gn(s,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,d])=>{const p={...o,...d};typeof(p==null?void 0:p.default)=="function"&&(p.default=p.default()),p!=null&&p.isRequired&&(p==null?void 0:p.default)===void 0&&delete p.default,e.push({type:s.name,name:u,attribute:p})})}),e}function pa(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function ro(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const s=o?o.split(" "):[],a=r[i]?r[i].split(" "):[],l=s.filter(c=>!a.includes(c));r[i]=[...a,...l].join(" ")}else if(i==="style"){const s=o?o.split(";").map(c=>c.trim()).filter(Boolean):[],a=r[i]?r[i].split(";").map(c=>c.trim()).filter(Boolean):[],l=new Map;a.forEach(c=>{const[u,d]=c.split(":").map(p=>p.trim());l.set(u,d)}),s.forEach(c=>{const[u,d]=c.split(":").map(p=>p.trim());l.set(u,d)}),r[i]=Array.from(l.entries()).map(([c,u])=>`${c}: ${u}`).join("; ")}else r[i]=o}),r},{})}function bO(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>ro(n,r),{})}function MH(t){return typeof t=="function"}function wr(t,e=void 0,...n){return MH(t)?e?t.bind(e)(...n):t(...n):t}function ENe(t={}){return Object.keys(t).length===0&&t.constructor===Object}function SNe(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function AH(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((o,s)=>{const a=s.attribute.parseHTML?s.attribute.parseHTML(n):SNe(n.getAttribute(s.name));return a==null?o:{...o,[s.name]:a}},{});return{...r,...i}}}}function IH(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&ENe(n)?!1:n!=null))}function CNe(t,e){var n;const r=TH(t),{nodeExtensions:i,markExtensions:o}=jk(t),s=(n=i.find(c=>gn(c,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(c=>{const u=r.filter(C=>C.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},p=t.reduce((C,S)=>{const M=gn(S,"extendNodeSchema",d);return{...C,...M?M(c):{}}},{}),m=IH({...p,content:wr(gn(c,"content",d)),marks:wr(gn(c,"marks",d)),group:wr(gn(c,"group",d)),inline:wr(gn(c,"inline",d)),atom:wr(gn(c,"atom",d)),selectable:wr(gn(c,"selectable",d)),draggable:wr(gn(c,"draggable",d)),code:wr(gn(c,"code",d)),whitespace:wr(gn(c,"whitespace",d)),linebreakReplacement:wr(gn(c,"linebreakReplacement",d)),defining:wr(gn(c,"defining",d)),isolating:wr(gn(c,"isolating",d)),attrs:Object.fromEntries(u.map(C=>{var S;return[C.name,{default:(S=C==null?void 0:C.attribute)===null||S===void 0?void 0:S.default}]}))}),y=wr(gn(c,"parseHTML",d));y&&(m.parseDOM=y.map(C=>AH(C,u)));const w=gn(c,"renderHTML",d);w&&(m.toDOM=C=>w({node:C,HTMLAttributes:bO(C,u)}));const x=gn(c,"renderText",d);return x&&(m.toText=x),[c.name,m]})),l=Object.fromEntries(o.map(c=>{const u=r.filter(x=>x.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},p=t.reduce((x,C)=>{const S=gn(C,"extendMarkSchema",d);return{...x,...S?S(c):{}}},{}),m=IH({...p,inclusive:wr(gn(c,"inclusive",d)),excludes:wr(gn(c,"excludes",d)),group:wr(gn(c,"group",d)),spanning:wr(gn(c,"spanning",d)),code:wr(gn(c,"code",d)),attrs:Object.fromEntries(u.map(x=>{var C;return[x.name,{default:(C=x==null?void 0:x.attribute)===null||C===void 0?void 0:C.default}]}))}),y=wr(gn(c,"parseHTML",d));y&&(m.parseDOM=y.map(x=>AH(x,u)));const w=gn(c,"renderHTML",d);return w&&(m.toDOM=x=>w({mark:x,HTMLAttributes:bO(x,u)})),[c.name,m]}));return new x7({topNode:s,nodes:a,marks:l})}function wO(t,e){return e.nodes[t]||e.marks[t]||null}function LH(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function xO(t,e){const n=qg.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}const kNe=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,a)=>{var l,c;const u=((c=(l=i.type.spec).toText)===null||c===void 0?void 0:c.call(l,{node:i,pos:o,parent:s,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-o))}),n};function EO(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Uk{constructor(e){this.find=e.find,this.handler=e.handler}}const TNe=(t,e)=>{if(EO(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Hk(t){var e;const{editor:n,from:r,to:i,text:o,rules:s,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(p=>p.type.spec.code))return!1;let u=!1;const d=kNe(c)+o;return s.forEach(p=>{if(u)return;const m=TNe(d,p.find);if(!m)return;const y=l.state.tr,w=zk({state:l.state,transaction:y}),x={from:r-(m[0].length-o.length),to:i},{commands:C,chain:S,can:M}=new Vk({editor:n,state:w});p.handler({state:w,range:x,match:m,commands:C,chain:S,can:M})===null||!y.steps.length||(y.setMeta(a,{transform:y,from:r,to:i,text:o}),l.dispatch(y),u=!0)}),u}function MNe(t){const{editor:e,rules:n}=t,r=new xs({state:{init(){return null},apply(i,o,s){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:c}=l;typeof c=="string"?c=c:c=xO(Mt.from(c),s.schema);const{from:u}=l,d=u+c.length;Hk({editor:e,from:u,to:d,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,a){return Hk({editor:e,from:o,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&Hk({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?Hk({editor:e,from:s.pos,to:s.pos,text:` `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function ANe(t){return Object.prototype.toString.call(t).slice(8,-1)}function Wk(t){return ANe(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Gk(t,e){const n={...t};return Wk(t)&&Wk(e)&&Object.keys(e).forEach(r=>{Wk(e[r])&&Wk(t[r])?n[r]=Gk(t[r],e[r]):n[r]=e[r]}),n}class sc{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=wr(gn(this,"addOptions",{name:this.name}))),this.storage=wr(gn(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new sc(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Gk(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new sc(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=wr(gn(n,"addOptions",{name:n.name})),n.storage=wr(gn(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!o.find(a=>(a==null?void 0:a.type.name)===n.name))return!1;const s=o.find(a=>(a==null?void 0:a.type.name)===n.name);return s&&r.removeStoredMark(s),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function INe(t){return typeof t=="number"}class LNe{constructor(e){this.find=e.find,this.handler=e.handler}}const PNe=(t,e,n)=>{if(EO(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=t,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function NNe(t){const{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:c,can:u}=new Vk({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,i,(p,m)=>{if(!p.isTextblock||p.type.spec.code)return;const y=Math.max(r,m),w=Math.min(i,m+p.content.size),x=p.textBetween(y-m,w-m,void 0,"");PNe(x,o.find,s).forEach(C=>{if(C.index===void 0)return;const S=y+C.index+1,M=S+C[0].length,E={from:n.tr.mapping.map(S),to:n.tr.mapping.map(M)},A=o.handler({state:n,range:E,match:C,commands:l,chain:c,can:u,pasteEvent:s,dropEvent:a});d.push(A)})}),d.every(p=>p!==null)}const ONe=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function DNe(t){const{editor:e,rules:n}=t;let r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:c,from:u,to:d,rule:p,pasteEvt:m})=>{const y=c.tr,w=zk({state:c,transaction:y});if(!(!NNe({editor:e,state:w,from:Math.max(u-1,0),to:d.b-1,rule:p,pasteEvent:m,dropEvent:a})||!y.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,y}};return n.map(c=>new xs({view(u){const d=p=>{var m;r=!((m=u.dom.parentElement)===null||m===void 0)&&m.contains(p.target)?u.dom.parentElement:null};return window.addEventListener("dragstart",d),{destroy(){window.removeEventListener("dragstart",d)}}},props:{handleDOMEvents:{drop:(u,d)=>(o=r===u.dom.parentElement,a=d,!1),paste:(u,d)=>{var p;const m=(p=d.clipboardData)===null||p===void 0?void 0:p.getData("text/html");return s=d,i=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(u,d,p)=>{const m=u[0],y=m.getMeta("uiEvent")==="paste"&&!i,w=m.getMeta("uiEvent")==="drop"&&!o,x=m.getMeta("applyPasteRules"),C=!!x;if(!y&&!w&&!C)return;if(C){let{text:E}=x;typeof E=="string"?E=E:E=xO(Mt.from(E),p.schema);const{from:A}=x,I=A+E.length,O=ONe(E);return l({rule:c,state:p,from:A,to:{b:I},pasteEvt:O})}const S=d.doc.content.findDiffStart(p.doc.content),M=d.doc.content.findDiffEnd(p.doc.content);if(!(!INe(S)||!M||S===M.b))return l({rule:c,state:p,from:S,to:M,pasteEvt:s})}}))}function RNe(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class Y0{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=Y0.resolve(e),this.schema=CNe(this.extensions,n),this.setupExtensions()}static resolve(e){const n=Y0.sort(Y0.flatten(e)),r=RNe(n.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},i=gn(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((n,r)=>{const i=gn(n,"priority")||100,o=gn(r,"priority")||100;return i>o?-1:i{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:wO(n.name,this.schema)},i=gn(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=Y0.sort([...this.extensions].reverse()),r=[],i=[],o=n.map(s=>{const a={name:s.name,options:s.options,storage:s.storage,editor:e,type:wO(s.name,this.schema)},l=[],c=gn(s,"addKeyboardShortcuts",a);let u={};if(s.type==="mark"&&gn(s,"exitable",a)&&(u.ArrowRight=()=>sc.handleExit({editor:e,mark:s})),c){const w=Object.fromEntries(Object.entries(c()).map(([x,C])=>[x,()=>C({editor:e})]));u={...u,...w}}const d=tNe(u);l.push(d);const p=gn(s,"addInputRules",a);LH(s,e.options.enableInputRules)&&p&&r.push(...p());const m=gn(s,"addPasteRules",a);LH(s,e.options.enablePasteRules)&&m&&i.push(...m());const y=gn(s,"addProseMirrorPlugins",a);if(y){const w=y();l.push(...w)}return l}).flat();return[MNe({editor:e,rules:r}),...DNe({editor:e,rules:i}),...o]}get attributes(){return TH(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=jk(this.extensions);return Object.fromEntries(n.filter(r=>!!gn(r,"addNodeView")).map(r=>{const i=this.attributes.filter(l=>l.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:pa(r.name,this.schema)},s=gn(r,"addNodeView",o);if(!s)return[];const a=(l,c,u,d,p)=>{const m=bO(l,i);return s()({node:l,view:c,getPos:u,decorations:d,innerDecorations:p,editor:e,extension:r,HTMLAttributes:m})};return[r.name,a]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:wO(e.name,this.schema)};e.type==="mark"&&(!((n=wr(gn(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=gn(e,"onBeforeCreate",r),o=gn(e,"onCreate",r),s=gn(e,"onUpdate",r),a=gn(e,"onSelectionUpdate",r),l=gn(e,"onTransaction",r),c=gn(e,"onFocus",r),u=gn(e,"onBlur",r),d=gn(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}}class ma{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=wr(gn(this,"addOptions",{name:this.name}))),this.storage=wr(gn(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new ma(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Gk(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new ma({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=wr(gn(n,"addOptions",{name:n.name})),n.storage=wr(gn(n,"addStorage",{name:n.name,options:n.options})),n}}function PH(t,e,n){const{from:r,to:i}=e,{blockSeparator:o=` `,textSerializers:s={}}=n||{};let a="";return t.nodesBetween(r,i,(l,c,u,d)=>{var p;l.isBlock&&c>r&&(a+=o);const m=s==null?void 0:s[l.type.name];if(m)return u&&(a+=m({node:l,pos:c,parent:u,index:d,range:e})),!1;l.isText&&(a+=(p=l==null?void 0:l.text)===null||p===void 0?void 0:p.slice(Math.max(r,c)-c,i-c))}),a}function SO(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const BNe=ma.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new xs({key:new fa("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:o}=i,s=Math.min(...o.map(c=>c.$from.pos)),a=Math.max(...o.map(c=>c.$to.pos)),l=SO(n);return PH(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),FNe=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),$Ne=(t=!1)=>({commands:e})=>e.setContent("",t),zNe=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:o,$to:s})=>{t.doc.nodesBetween(o.pos,s.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),p=c.resolve(u.map(l+a.nodeSize)),m=d.blockRange(p);if(!m)return;const y=R0(m);if(a.type.isTextblock){const{defaultType:w}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(m.start,w)}(y||y===0)&&e.lift(m,y)})}),!0},VNe=t=>e=>t(e),jNe=()=>({state:t,dispatch:e})=>xH(t,e),UNe=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,o=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new qn(r.doc.resolve(s-1))),!0},HNe=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const s=i.before(o),a=i.after(o);t.delete(s,a).scrollIntoView()}return!0}return!1},WNe=t=>({tr:e,state:n,dispatch:r})=>{const i=pa(t,n.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){const a=o.before(s),l=o.after(s);e.delete(a,l).scrollIntoView()}return!0}return!1},GNe=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},qNe=()=>({state:t,dispatch:e})=>mO(t,e),YNe=()=>({commands:t})=>t.keyboardShortcut("Enter"),ZNe=()=>({state:t,dispatch:e})=>aNe(t,e);function qk(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:EO(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function NH(t,e,n={}){return t.find(r=>r.type===e&&qk(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function OH(t,e,n={}){return!!NH(t,e,n)}function CO(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(c=>c.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(c=>c.type===e)||(n=n||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!NH([...i.node.marks],e,n)))return;let o=i.index,s=t.start()+i.offset,a=o+1,l=s+i.node.nodeSize;for(;o>0&&OH([...t.parent.child(o-1).marks],e,n);)o-=1,s-=t.parent.child(o).nodeSize;for(;a({tr:n,state:r,dispatch:i})=>{const o=nm(t,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:u}=a;if(i){const d=CO(l,o,e);if(d&&d.from<=c&&d.to>=u){const p=qn.create(s,d.from,d.to);n.setSelection(p)}}return!0},KNe=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r({editor:n,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{TO()&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(o&&t===null&&!kO(n.state.selection))return s(),!0;const a=DH(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return o&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},QNe=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),eOe=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),RH=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&RH(r)}return t};function Yk(t){const e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return RH(n)}function Zk(t,e,n){if(t instanceof Up||t instanceof Mt)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return Mt.fromArray(t.map(s=>e.nodeFromJSON(s)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),Zk("",e,n)}if(i){if(n.errorOnInvalidContent){let s=!1,a="";const l=new x7({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?D0.fromSchema(l).parseSlice(Yk(t),n.parseOptions):D0.fromSchema(l).parse(Yk(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const o=D0.fromSchema(e);return n.slice?o.parseSlice(Yk(t),n.parseOptions).content:o.parse(Yk(t),n.parseOptions)}return Zk("",e,n)}function tOe(t,e,n){const r=t.steps.length-1;if(r{s===0&&(s=u)}),t.setSelection(Gn.near(t.doc.resolve(s),n))}const nOe=t=>!("type"in t),rOe=(t,e,n)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;try{a=Zk(e,o.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:(s=n.errorOnInvalidContent)!==null&&s!==void 0?s:o.options.enableContentCheck})}catch(m){return o.emit("contentError",{editor:o,error:m,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}}),!1}let{from:l,to:c}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},u=!0,d=!0;if((nOe(a)?a:[a]).forEach(m=>{m.check(),u=u?m.isText&&m.marks.length===0:!1,d=d?m.isBlock:!1}),l===c&&d){const{parent:m}=r.doc.resolve(l);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(l-=1,c+=1)}let p;if(u){if(Array.isArray(e))p=e.map(m=>m.text||"").join("");else if(e instanceof Mt){let m="";e.forEach(y=>{y.text&&(m+=y.text)}),p=m}else typeof e=="object"&&e&&e.text?p=e.text:p=e;r.insertText(p,l,c)}else p=a,r.replaceWith(l,c,p);n.updateSelection&&tOe(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:l,text:p}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:l,text:p})}return!0},iOe=()=>({state:t,dispatch:e})=>iNe(t,e),oOe=()=>({state:t,dispatch:e})=>oNe(t,e),sOe=()=>({state:t,dispatch:e})=>mH(t,e),aOe=()=>({state:t,dispatch:e})=>_H(t,e),lOe=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Tk(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},cOe=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Tk(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},uOe=()=>({state:t,dispatch:e})=>nNe(t,e),hOe=()=>({state:t,dispatch:e})=>rNe(t,e);function BH(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function dOe(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,o,s;for(let a=0;a({editor:e,view:n,tr:r,dispatch:i})=>{const o=dOe(t).split(/-(?!$)/),s=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,a))});return l==null||l.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function gw(t,e,n={}){const{from:r,to:i,empty:o}=t.selection,s=e?pa(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(u,d)=>{if(u.isText)return;const p=Math.max(r,d),m=Math.min(i,d+u.nodeSize);a.push({node:u,from:p,to:m})});const l=i-r,c=a.filter(u=>s?s.name===u.node.type.name:!0).filter(u=>qk(u.node.attrs,n,{strict:!1}));return o?!!c.length:c.reduce((u,d)=>u+d.to-d.from,0)>=l}const pOe=(t,e={})=>({state:n,dispatch:r})=>{const i=pa(t,n.schema);return gw(n,i,e)?sNe(n,r):!1},mOe=()=>({state:t,dispatch:e})=>EH(t,e),gOe=t=>({state:e,dispatch:n})=>{const r=pa(t,e.schema);return vNe(r)(e,n)},yOe=()=>({state:t,dispatch:e})=>wH(t,e);function Xk(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function FH(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}const vOe=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const a=Xk(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=pa(t,r.schema)),a==="mark"&&(s=nm(t,r.schema)),i&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{o&&o===c.type&&n.setNodeMarkup(u,void 0,FH(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&n.addMark(u,u+c.nodeSize,s.create(FH(d.attrs,e)))})})}),!0):!1},_Oe=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),bOe=()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),wOe=()=>({state:t,dispatch:e})=>yH(t,e),xOe=()=>({state:t,dispatch:e})=>bH(t,e),EOe=()=>({state:t,dispatch:e})=>uNe(t,e),SOe=()=>({state:t,dispatch:e})=>fNe(t,e),COe=()=>({state:t,dispatch:e})=>dNe(t,e);function MO(t,e,n={},r={}){return Zk(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const kOe=(t,e=!1,n={},r={})=>({editor:i,tr:o,dispatch:s,commands:a})=>{var l,c;const{doc:u}=o;if(n.preserveWhitespace!=="full"){const d=MO(t,i.schema,n,{errorOnInvalidContent:(l=r.errorOnInvalidContent)!==null&&l!==void 0?l:i.options.enableContentCheck});return s&&o.replaceWith(0,u.content.size,d).setMeta("preventUpdate",!e),!0}return s&&o.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:u.content.size},t,{parseOptions:n,errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:i.options.enableContentCheck})};function AO(t,e){const n=nm(e,t.schema),{from:r,to:i,empty:o}=t.selection,s=[];o?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{s.push(...l.marks)});const a=s.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function TOe(t,e){const n=new BN(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function MOe(t){for(let e=0;e{n(i)&&r.push({node:i,pos:o})}),r}function $H(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function IO(t){return e=>$H(e.$from,t)}function zH(t,e){const n={from:0,to:t.content.size};return PH(t,n,e)}function IOe(t,e){const n=pa(e,t.schema),{from:r,to:i}=t.selection,o=[];t.doc.nodesBetween(r,i,a=>{o.push(a)});const s=o.reverse().find(a=>a.type.name===n.name);return s?{...s.attrs}:{}}function VH(t,e){const n=Xk(typeof e=="string"?e:e.name,t.schema);return n==="node"?IOe(t,e):n==="mark"?AO(t,e):{}}function LOe(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function POe(t){const e=LOe(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function NOe(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,o)=>{const s=[];if(i.ranges.length)i.forEach((a,l)=>{s.push({from:a,to:l})});else{const{from:a,to:l}=n[o];if(a===void 0||l===void 0)return;s.push({from:a,to:l})}s.forEach(({from:a,to:l})=>{const c=e.slice(o).map(a,-1),u=e.slice(o).map(l),d=e.invert().map(c,-1),p=e.invert().map(u);r.push({oldRange:{from:d,to:p},newRange:{from:c,to:u}})})}),POe(r)}function LO(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const o=n.resolve(t),s=CO(o,i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(t,e,(i,o)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}function Kk(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function PO(t,e,n={}){const{empty:r,ranges:i}=t.selection,o=e?nm(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(u=>o?o.name===u.type.name:!0).find(u=>qk(u.attrs,n,{strict:!1}));let s=0;const a=[];if(i.forEach(({$from:u,$to:d})=>{const p=u.pos,m=d.pos;t.doc.nodesBetween(p,m,(y,w)=>{if(!y.isText&&!y.marks.length)return;const x=Math.max(p,w),C=Math.min(m,w+y.nodeSize),S=C-x;s+=S,a.push(...y.marks.map(M=>({mark:M,from:x,to:C})))})}),s===0)return!1;const l=a.filter(u=>o?o.name===u.mark.type.name:!0).filter(u=>qk(u.mark.attrs,n,{strict:!1})).reduce((u,d)=>u+d.to-d.from,0),c=a.filter(u=>o?u.mark.type!==o&&u.mark.type.excludes(o):!0).reduce((u,d)=>u+d.to-d.from,0);return(l>0?l+c:l)>=s}function OOe(t,e,n={}){if(!e)return gw(t,null,n)||PO(t,null,n);const r=Xk(e,t.schema);return r==="node"?gw(t,e,n):r==="mark"?PO(t,e,n):!1}function jH(t,e){const{nodeExtensions:n}=jk(e),r=n.find(s=>s.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=wr(gn(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function NO(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!==null&&r!==void 0?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(o=>{i!==!1&&(NO(o,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function DOe(t){return t instanceof Vn}function UH(t,e,n){const r=t.state.doc.content.size,i=Rf(e,0,r),o=Rf(n,0,r),s=t.coordsAtPos(i),a=t.coordsAtPos(o,-1),l=Math.min(s.top,a.top),c=Math.max(s.bottom,a.bottom),u=Math.min(s.left,a.left),d=Math.max(s.right,a.right),p=d-u,m=c-l,y={top:l,bottom:c,left:u,right:d,width:p,height:m,x:u,y:l};return{...y,toJSON:()=>y}}function ROe(t,e,n){var r;const{selection:i}=e;let o=null;if(kO(i)&&(o=i.$cursor),o){const a=(r=t.storedMarks)!==null&&r!==void 0?r:o.marks();return!!n.isInSet(a)||!a.some(l=>l.type.excludes(n))}const{ranges:s}=i;return s.some(({$from:a,$to:l})=>{let c=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(u,d,p)=>{if(c)return!1;if(u.isInline){const m=!p||p.type.allowsMarkType(n),y=!!n.isInSet(u.marks)||!u.marks.some(w=>w.type.excludes(n));c=m&&y}return!c}),c})}const BOe=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=n,{empty:s,ranges:a}=o,l=nm(t,r.schema);if(i)if(s){const c=AO(r,l);n.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(p,m)=>{const y=Math.max(m,u),w=Math.min(m+p.nodeSize,d);p.marks.find(x=>x.type===l)?p.marks.forEach(x=>{l===x.type&&n.addMark(y,w,l.create({...x.attrs,...e}))}):n.addMark(y,w,l.create(e))})});return ROe(r,n,l)},FOe=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),$Oe=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const o=pa(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:a})=>kH(o,{...s,...e})(n)?!0:a.clearNodes()).command(({state:a})=>kH(o,{...s,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},zOe=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Rf(t,0,r.content.size),o=Vn.create(r,i);e.setSelection(o)}return!0},VOe=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,s=qn.atStart(r).from,a=qn.atEnd(r).to,l=Rf(i,s,a),c=Rf(o,s,a),u=qn.create(r,l,c);e.setSelection(u)}return!0},jOe=t=>({state:e,dispatch:n})=>{const r=pa(t,e.schema);return wNe(r)(e,n)};function HH(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(r)}}const UOe=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:o,doc:s}=e,{$from:a,$to:l}=o,c=i.extensionManager.attributes,u=Kk(c,a.node().type.name,a.node().attrs);if(o instanceof Vn&&o.node.isBlock)return!a.parentOffset||!Lf(s,a.pos)?!1:(r&&(t&&HH(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,p=a.depth===0?void 0:MOe(a.node(-1).contentMatchAt(a.indexAfter(-1)));let m=d&&p?[{type:p,attrs:u}]:void 0,y=Lf(e.doc,e.mapping.map(a.pos),1,m);if(!m&&!y&&Lf(e.doc,e.mapping.map(a.pos),1,p?[{type:p}]:void 0)&&(y=!0,m=p?[{type:p,attrs:u}]:void 0),r){if(y&&(o instanceof qn&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,m),p&&!d&&!a.parentOffset&&a.parent.type!==p)){const w=e.mapping.map(a.before()),x=e.doc.resolve(w);a.node(-1).canReplaceWith(x.index(),x.index()+1,p)&&e.setNodeMarkup(e.mapping.map(a.before()),p)}t&&HH(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return y},HOe=(t,e={})=>({tr:n,state:r,dispatch:i,editor:o})=>{var s;const a=pa(t,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const p=o.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let C=Mt.empty;const S=l.index(-1)?1:l.index(-2)?2:3;for(let z=l.depth-S;z>=l.depth-3;z-=1)C=Mt.from(l.node(z).copy(C));const M=l.indexAfter(-1){if(O>-1)return!1;z.isTextblock&&z.content.size===0&&(O=$+1)}),O>-1&&n.setSelection(qn.near(n.doc.resolve(O))),n.scrollIntoView()}return!0}const m=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,y={...Kk(p,d.type.name,d.attrs),...e},w={...Kk(p,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);const x=m?[{type:a,attrs:y},{type:m,attrs:w}]:[{type:a,attrs:y}];if(!Lf(n.doc,l.pos,2))return!1;if(i){const{selection:C,storedMarks:S}=r,{splittableMarks:M}=o.extensionManager,E=S||C.$to.parentOffset&&C.$from.marks();if(n.split(l.pos,2,x).scrollIntoView(),!E||!i)return!0;const A=E.filter(I=>M.includes(I.type.name));n.ensureMarks(A)}return!0},OO=(t,e)=>{const n=IO(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Gp(t.doc,n.pos)&&t.join(n.pos),!0},DO=(t,e)=>{const n=IO(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Gp(t.doc,r)&&t.join(r),!0};var WOe=Object.freeze({__proto__:null,blur:FNe,clearContent:$Ne,clearNodes:zNe,command:VNe,createParagraphNear:jNe,cut:UNe,deleteCurrentNode:HNe,deleteNode:WNe,deleteRange:GNe,deleteSelection:qNe,enter:YNe,exitCode:ZNe,extendMarkRange:XNe,first:KNe,focus:JNe,forEach:QNe,insertContent:eOe,insertContentAt:rOe,joinBackward:sOe,joinDown:oOe,joinForward:aOe,joinItemBackward:lOe,joinItemForward:cOe,joinTextblockBackward:uOe,joinTextblockForward:hOe,joinUp:iOe,keyboardShortcut:fOe,lift:pOe,liftEmptyBlock:mOe,liftListItem:gOe,newlineInCode:yOe,resetAttributes:vOe,scrollIntoView:_Oe,selectAll:bOe,selectNodeBackward:wOe,selectNodeForward:xOe,selectParentNode:EOe,selectTextblockEnd:SOe,selectTextblockStart:COe,setContent:kOe,setMark:BOe,setMeta:FOe,setNode:$Oe,setNodeSelection:zOe,setTextSelection:VOe,sinkListItem:jOe,splitBlock:UOe,splitListItem:HOe,toggleList:(t,e,n,r={})=>({editor:i,tr:o,state:s,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:p}=i.extensionManager,m=pa(t,s.schema),y=pa(e,s.schema),{selection:w,storedMarks:x}=s,{$from:C,$to:S}=w,M=C.blockRange(S),E=x||w.$to.parentOffset&&w.$from.marks();if(!M)return!1;const A=IO(I=>jH(I.type.name,d))(w);if(M.depth>=1&&A&&M.depth-A.depth<=1){if(A.node.type===m)return c.liftListItem(y);if(jH(A.node.type.name,d)&&m.validContent(A.node.content)&&a)return l().command(()=>(o.setNodeMarkup(A.pos,m),!0)).command(()=>OO(o,m)).command(()=>DO(o,m)).run()}return!n||!E||!a?l().command(()=>u().wrapInList(m,r)?!0:c.clearNodes()).wrapInList(m,r).command(()=>OO(o,m)).command(()=>DO(o,m)).run():l().command(()=>{const I=u().wrapInList(m,r),O=E.filter(z=>p.includes(z.type.name));return o.ensureMarks(O),I?!0:c.clearNodes()}).wrapInList(m,r).command(()=>OO(o,m)).command(()=>DO(o,m)).run()},toggleMark:(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,s=nm(t,r.schema);return PO(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},toggleNode:(t,e,n={})=>({state:r,commands:i})=>{const o=pa(t,r.schema),s=pa(e,r.schema),a=gw(r,o,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(s,l):i.setNode(o,{...l,...n})},toggleWrap:(t,e={})=>({state:n,commands:r})=>{const i=pa(t,n.schema);return gw(n,i,e)?r.lift(i):r.wrapIn(i,e)},undoInputRule:()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(o.text){const l=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,t.schema.text(o.text,l))}else s.delete(o.from,o.to)}return!0}}return!1},unsetAllMarks:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(o=>{t.removeMark(o.$from.pos,o.$to.pos)}),!0},unsetMark:(t,e={})=>({tr:n,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=nm(t,r.schema),{$from:c,empty:u,ranges:d}=a;if(!i)return!0;if(u&&s){let{from:p,to:m}=a;const y=(o=c.marks().find(x=>x.type===l))===null||o===void 0?void 0:o.attrs,w=CO(c,l,y);w&&(p=w.from,m=w.to),n.removeMark(p,m,l)}else d.forEach(p=>{n.removeMark(p.$from.pos,p.$to.pos,l)});return n.removeStoredMark(l),!0},updateAttributes:(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const a=Xk(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=pa(t,r.schema)),a==="mark"&&(s=nm(t,r.schema)),i&&n.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;let d,p,m,y;n.selection.empty?r.doc.nodesBetween(c,u,(w,x)=>{o&&o===w.type&&(m=Math.max(x,c),y=Math.min(x+w.nodeSize,u),d=x,p=w)}):r.doc.nodesBetween(c,u,(w,x)=>{x=c&&x<=u&&(o&&o===w.type&&n.setNodeMarkup(x,void 0,{...w.attrs,...e}),s&&w.marks.length&&w.marks.forEach(C=>{if(s===C.type){const S=Math.max(x,c),M=Math.min(x+w.nodeSize,u);n.addMark(S,M,s.create({...C.attrs,...e}))}}))}),p&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...p.attrs,...e}),s&&p.marks.length&&p.marks.forEach(w=>{s===w.type&&n.addMark(m,y,s.create({...w.attrs,...e}))}))}),!0):!1},wrapIn:(t,e={})=>({state:n,dispatch:r})=>{const i=pa(t,n.schema);return pNe(i,e)(n,r)},wrapInList:(t,e={})=>({state:n,dispatch:r})=>{const i=pa(t,n.schema);return mNe(i,e)(n,r)}});const GOe=ma.create({name:"commands",addCommands(){return{...WOe}}}),qOe=ma.create({name:"drop",addProseMirrorPlugins(){return[new xs({key:new fa("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),YOe=ma.create({name:"editable",addProseMirrorPlugins(){return[new xs({key:new fa("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ZOe=ma.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new xs({key:new fa("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),XOe=ma.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:s})=>{const{selection:a,doc:l}=s,{empty:c,$anchor:u}=a,{pos:d,parent:p}=u,m=u.parent.isTextblock&&d>0?s.doc.resolve(d-1):u,y=m.parent.type.spec.isolating,w=u.pos-u.parentOffset,x=y&&m.parent.childCount===1?w===u.pos:Gn.atStart(l).from===d;return!c||!p.type.isTextblock||p.textContent.length||!x||x&&u.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return TO()||BH()?i:r},addProseMirrorPlugins(){return[new xs({key:new fa("clearDocument"),appendTransaction:(t,e,n)=>{const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),i=t.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:s,to:a}=e.selection,l=Gn.atStart(e.doc).from,c=Gn.atEnd(e.doc).to;if(o||!(s===l&&a===c)||!NO(n.doc))return;const u=n.tr,d=zk({state:n,transaction:u}),{commands:p}=new Vk({editor:this.editor,state:d});if(p.clearNodes(),!!u.steps.length)return u}})]}}),KOe=ma.create({name:"paste",addProseMirrorPlugins(){return[new xs({key:new fa("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),JOe=ma.create({name:"tabindex",addProseMirrorPlugins(){return[new xs({key:new fa("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class ny{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new ny(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new ny(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new ny(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,s=this.pos+r+(o?0:1),a=this.resolvedPos.doc.resolve(s);if(!i&&a.depth<=this.depth)return;const l=new ny(a,this.editor,i,i?n:null);i&&(l.actualDepth=this.depth+1),e.push(new ny(a,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const o=i.node.attrs,s=Object.keys(n);for(let a=0;a{r&&i.length>0||(s.node.type.name===e&&o.every(a=>n[a]===s.node.attrs[a])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const QOe=`.ProseMirror { position: relative; } .ProseMirror { word-wrap: break-word; white-space: pre-wrap; white-space: break-spaces; -webkit-font-variant-ligatures: none; font-variant-ligatures: none; font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ } .ProseMirror [contenteditable="false"] { white-space: normal; } .ProseMirror [contenteditable="false"] [contenteditable="true"] { white-space: pre-wrap; } .ProseMirror pre { white-space: pre-wrap; } img.ProseMirror-separator { display: inline !important; border: none !important; margin: 0 !important; width: 0 !important; height: 0 !important; } .ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; margin: 0; } .ProseMirror-gapcursor:after { content: ""; display: block; position: absolute; top: -2px; width: 20px; border-top: 1px solid black; animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; } @keyframes ProseMirror-cursor-blink { to { visibility: hidden; } } .ProseMirror-hideselection *::selection { background: transparent; } .ProseMirror-hideselection *::-moz-selection { background: transparent; } .ProseMirror-hideselection * { caret-color: transparent; } .ProseMirror-focused .ProseMirror-gapcursor { display: block; } .tippy-box[data-animation=fade][data-state=hidden] { opacity: 0 }`;function eDe(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}let tDe=class extends xNe{constructor(t={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:n,moved:r})=>this.options.onDrop(e,n,r)),this.on("paste",({event:e,slice:n})=>this.options.onPaste(e,n)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=eDe(QOe,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(t,e){const n=MH(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(i=>{const o=typeof i=="string"?`${i}$`:i.key;n=e.filter(s=>!s.key.startsWith(o))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const n=[...this.options.enableCoreExtensions?[YOe,BNe.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)===null||t===void 0?void 0:t.clipboardTextSerializer)===null||e===void 0?void 0:e.blockSeparator}),GOe,ZOe,XOe,JOe,qOe,KOe].filter(r=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[r.name]!==!1:!0):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r==null?void 0:r.type));this.extensionManager=new Y0(n,this)}createCommandManager(){this.commandManager=new Vk({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var t;let e;try{e=MO(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(o){if(!(o instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(o.message))throw o;this.emit("contentError",{editor:this,error:o,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(s=>s.name!=="collaboration"),this.createExtensionManager()}}),e=MO(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const n=DH(e,this.options.autofocus);this.view=new lH(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)===null||t===void 0?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:z0.create({doc:e,selection:n||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(o=>{var s;return(s=this.capturedTransaction)===null||s===void 0?void 0:s.step(o)});return}const e=this.state.apply(t),n=!this.state.selection.eq(e.selection);this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t}),n&&this.emit("selectionUpdate",{editor:this,transaction:t});const r=t.getMeta("focus"),i=t.getMeta("blur");r&&this.emit("focus",{editor:this,event:r.event,transaction:t}),i&&this.emit("blur",{editor:this,event:i.event,transaction:t}),!(!t.docChanged||t.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return VH(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return OOe(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return xO(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` `,textSerializers:n={}}=t||{};return zH(this.state.doc,{blockSeparator:e,textSerializers:{...SO(this.schema),...n}})}get isEmpty(){return NO(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const t=this.view.dom;t&&t.editor&&delete t.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var t;return!(!((t=this.view)===null||t===void 0)&&t.docView)}$node(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new ny(e,this)}get $doc(){return this.$pos(0)}};function ry(t){return new Uk({find:t.find,handler:({state:e,range:n,match:r})=>{const i=wr(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=e,s=r[r.length-1],a=r[0];if(s){const l=a.search(/\S/),c=n.from+a.indexOf(s),u=c+s.length;if(LO(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(m=>m===t.type&&m!==p.mark.type)).filter(p=>p.to>c).length)return null;un.from&&o.delete(n.from+l,c);const d=n.from+l+s.length;o.addMark(n.from+l,d,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}function nDe(t){return new Uk({find:t.find,handler:({state:e,range:n,match:r})=>{const i=wr(t.getAttributes,void 0,r)||{},{tr:o}=e,s=n.from;let a=n.to;const l=t.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=s+c;u>a?u=a:a=u+r[1].length;const d=r[0][r[0].length-1];o.insertText(d,s+r[0].length-1),o.replaceWith(u,a,l)}else if(r[0]){const c=t.type.isInline?s:s-1;o.insert(c,t.type.create(i)).delete(o.mapping.map(s),o.mapping.map(a))}o.scrollIntoView()}})}function RO(t){return new Uk({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),o=wr(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,o)}})}function yw(t){return new Uk({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const o=wr(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&ON(a,t.type,o);if(!l)return null;if(s.wrap(a,l),t.keepMarks&&t.editor){const{selection:u,storedMarks:d}=e,{splittableMarks:p}=t.editor.extensionManager,m=d||u.$to.parentOffset&&u.$from.marks();if(m){const y=m.filter(w=>p.includes(w.type.name));s.ensureMarks(y)}}if(t.keepAttributes){const u=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(u,o).run()}const c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&Gp(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&s.join(n.from-1)}})}let Pl=class X3{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=wr(gn(this,"addOptions",{name:this.name}))),this.storage=wr(gn(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new X3(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Gk(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new X3(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=wr(gn(n,"addOptions",{name:n.name})),n.storage=wr(gn(n,"addStorage",{name:n.name,options:n.options})),n}};function rm(t){return new LNe({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const o=wr(t.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:s}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const u=l.search(/\S/),d=n.from+l.indexOf(a),p=d+a.length;if(LO(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===t.type&&y!==m.mark.type)).filter(m=>m.to>d).length)return null;pn.from&&s.delete(n.from+u,d),c=n.from+u+a.length,s.addMark(n.from+u,c,t.type.create(o||{})),s.removeStoredMark(t.type)}}})}var ac="top",Nu="bottom",Ou="right",lc="left",BO="auto",vw=[ac,Nu,Ou,lc],Z0="start",_w="end",rDe="clippingParents",WH="viewport",bw="popper",iDe="reference",GH=vw.reduce(function(t,e){return t.concat([e+"-"+Z0,e+"-"+_w])},[]),qH=[].concat(vw,[BO]).reduce(function(t,e){return t.concat([e,e+"-"+Z0,e+"-"+_w])},[]),oDe="beforeRead",sDe="read",aDe="afterRead",lDe="beforeMain",cDe="main",uDe="afterMain",hDe="beforeWrite",dDe="write",fDe="afterWrite",pDe=[oDe,sDe,aDe,lDe,cDe,uDe,hDe,dDe,fDe];function gd(t){return t?(t.nodeName||"").toLowerCase():null}function $c(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function iy(t){var e=$c(t).Element;return t instanceof e||t instanceof Element}function Du(t){var e=$c(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function FO(t){if(typeof ShadowRoot>"u")return!1;var e=$c(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function mDe(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},i=e.attributes[n]||{},o=e.elements[n];!Du(o)||!gd(o)||(Object.assign(o.style,r),Object.keys(i).forEach(function(s){var a=i[s];a===!1?o.removeAttribute(s):o.setAttribute(s,a===!0?"":a)}))})}function gDe(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],o=e.attributes[r]||{},s=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),a=s.reduce(function(l,c){return l[c]="",l},{});!Du(i)||!gd(i)||(Object.assign(i.style,a),Object.keys(o).forEach(function(l){i.removeAttribute(l)}))})}}const YH={name:"applyStyles",enabled:!0,phase:"write",fn:mDe,effect:gDe,requires:["computeStyles"]};function yd(t){return t.split("-")[0]}var oy=Math.max,Jk=Math.min,X0=Math.round;function $O(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function ZH(){return!/^((?!chrome|android).)*safari/i.test($O())}function K0(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,o=1;e&&Du(t)&&(i=t.offsetWidth>0&&X0(r.width)/t.offsetWidth||1,o=t.offsetHeight>0&&X0(r.height)/t.offsetHeight||1);var s=iy(t)?$c(t):window,a=s.visualViewport,l=!ZH()&&n,c=(r.left+(l&&a?a.offsetLeft:0))/i,u=(r.top+(l&&a?a.offsetTop:0))/o,d=r.width/i,p=r.height/o;return{width:d,height:p,top:u,right:c+d,bottom:u+p,left:c,x:c,y:u}}function zO(t){var e=K0(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function XH(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&FO(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Bf(t){return $c(t).getComputedStyle(t)}function yDe(t){return["table","td","th"].indexOf(gd(t))>=0}function im(t){return((iy(t)?t.ownerDocument:t.document)||window.document).documentElement}function Qk(t){return gd(t)==="html"?t:t.assignedSlot||t.parentNode||(FO(t)?t.host:null)||im(t)}function KH(t){return!Du(t)||Bf(t).position==="fixed"?null:t.offsetParent}function vDe(t){var e=/firefox/i.test($O()),n=/Trident/i.test($O());if(n&&Du(t)){var r=Bf(t);if(r.position==="fixed")return null}var i=Qk(t);for(FO(i)&&(i=i.host);Du(i)&&["html","body"].indexOf(gd(i))<0;){var o=Bf(i);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||e&&o.willChange==="filter"||e&&o.filter&&o.filter!=="none")return i;i=i.parentNode}return null}function ww(t){for(var e=$c(t),n=KH(t);n&&yDe(n)&&Bf(n).position==="static";)n=KH(n);return n&&(gd(n)==="html"||gd(n)==="body"&&Bf(n).position==="static")?e:n||vDe(t)||e}function VO(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function xw(t,e,n){return oy(t,Jk(e,n))}function _De(t,e,n){var r=xw(t,e,n);return r>n?n:r}function JH(){return{top:0,right:0,bottom:0,left:0}}function QH(t){return Object.assign({},JH(),t)}function eW(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var bDe=function(t,e){return t=typeof t=="function"?t(Object.assign({},e.rects,{placement:e.placement})):t,QH(typeof t!="number"?t:eW(t,vw))};function wDe(t){var e,n=t.state,r=t.name,i=t.options,o=n.elements.arrow,s=n.modifiersData.popperOffsets,a=yd(n.placement),l=VO(a),c=[lc,Ou].indexOf(a)>=0,u=c?"height":"width";if(!(!o||!s)){var d=bDe(i.padding,n),p=zO(o),m=l==="y"?ac:lc,y=l==="y"?Nu:Ou,w=n.rects.reference[u]+n.rects.reference[l]-s[l]-n.rects.popper[u],x=s[l]-n.rects.reference[l],C=ww(o),S=C?l==="y"?C.clientHeight||0:C.clientWidth||0:0,M=w/2-x/2,E=d[m],A=S-p[u]-d[y],I=S/2-p[u]/2+M,O=xw(E,I,A),z=l;n.modifiersData[r]=(e={},e[z]=O,e.centerOffset=O-I,e)}}function xDe(t){var e=t.state,n=t.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||XH(e.elements.popper,i)&&(e.elements.arrow=i))}const EDe={name:"arrow",enabled:!0,phase:"main",fn:wDe,effect:xDe,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function J0(t){return t.split("-")[1]}var SDe={top:"auto",right:"auto",bottom:"auto",left:"auto"};function CDe(t,e){var n=t.x,r=t.y,i=e.devicePixelRatio||1;return{x:X0(n*i)/i||0,y:X0(r*i)/i||0}}function tW(t){var e,n=t.popper,r=t.popperRect,i=t.placement,o=t.variation,s=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,u=t.roundOffsets,d=t.isFixed,p=s.x,m=p===void 0?0:p,y=s.y,w=y===void 0?0:y,x=typeof u=="function"?u({x:m,y:w}):{x:m,y:w};m=x.x,w=x.y;var C=s.hasOwnProperty("x"),S=s.hasOwnProperty("y"),M=lc,E=ac,A=window;if(c){var I=ww(n),O="clientHeight",z="clientWidth";if(I===$c(n)&&(I=im(n),Bf(I).position!=="static"&&a==="absolute"&&(O="scrollHeight",z="scrollWidth")),I=I,i===ac||(i===lc||i===Ou)&&o===_w){E=Nu;var $=d&&I===A&&A.visualViewport?A.visualViewport.height:I[O];w-=$-r.height,w*=l?1:-1}if(i===lc||(i===ac||i===Nu)&&o===_w){M=Ou;var W=d&&I===A&&A.visualViewport?A.visualViewport.width:I[z];m-=W-r.width,m*=l?1:-1}}var J=Object.assign({position:a},c&&SDe),Z=u===!0?CDe({x:m,y:w},$c(n)):{x:m,y:w};if(m=Z.x,w=Z.y,l){var q;return Object.assign({},J,(q={},q[E]=S?"0":"",q[M]=C?"0":"",q.transform=(A.devicePixelRatio||1)<=1?"translate("+m+"px, "+w+"px)":"translate3d("+m+"px, "+w+"px, 0)",q))}return Object.assign({},J,(e={},e[E]=S?w+"px":"",e[M]=C?m+"px":"",e.transform="",e))}function kDe(t){var e=t.state,n=t.options,r=n.gpuAcceleration,i=r===void 0?!0:r,o=n.adaptive,s=o===void 0?!0:o,a=n.roundOffsets,l=a===void 0?!0:a,c={placement:yd(e.placement),variation:J0(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,tW(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,tW(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const TDe={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:kDe,data:{}};var eT={passive:!0};function MDe(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,o=i===void 0?!0:i,s=r.resize,a=s===void 0?!0:s,l=$c(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&c.forEach(function(u){u.addEventListener("scroll",n.update,eT)}),a&&l.addEventListener("resize",n.update,eT),function(){o&&c.forEach(function(u){u.removeEventListener("scroll",n.update,eT)}),a&&l.removeEventListener("resize",n.update,eT)}}const ADe={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:MDe,data:{}};var IDe={left:"right",right:"left",bottom:"top",top:"bottom"};function tT(t){return t.replace(/left|right|bottom|top/g,function(e){return IDe[e]})}var LDe={start:"end",end:"start"};function nW(t){return t.replace(/start|end/g,function(e){return LDe[e]})}function jO(t){var e=$c(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function UO(t){return K0(im(t)).left+jO(t).scrollLeft}function PDe(t,e){var n=$c(t),r=im(t),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;var c=ZH();(c||!c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a+UO(t),y:l}}function NDe(t){var e,n=im(t),r=jO(t),i=(e=t.ownerDocument)==null?void 0:e.body,o=oy(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=oy(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+UO(t),l=-r.scrollTop;return Bf(i||n).direction==="rtl"&&(a+=oy(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:s,x:a,y:l}}function HO(t){var e=Bf(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function rW(t){return["html","body","#document"].indexOf(gd(t))>=0?t.ownerDocument.body:Du(t)&&HO(t)?t:rW(Qk(t))}function Ew(t,e){var n;e===void 0&&(e=[]);var r=rW(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),o=$c(r),s=i?[o].concat(o.visualViewport||[],HO(r)?r:[]):r,a=e.concat(s);return i?a:a.concat(Ew(Qk(s)))}function WO(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function ODe(t,e){var n=K0(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function iW(t,e,n){return e===WH?WO(PDe(t,n)):iy(e)?ODe(e,n):WO(NDe(im(t)))}function DDe(t){var e=Ew(Qk(t)),n=["absolute","fixed"].indexOf(Bf(t).position)>=0,r=n&&Du(t)?ww(t):t;return iy(r)?e.filter(function(i){return iy(i)&&XH(i,r)&&gd(i)!=="body"}):[]}function RDe(t,e,n,r){var i=e==="clippingParents"?DDe(t):[].concat(e),o=[].concat(i,[n]),s=o[0],a=o.reduce(function(l,c){var u=iW(t,c,r);return l.top=oy(u.top,l.top),l.right=Jk(u.right,l.right),l.bottom=Jk(u.bottom,l.bottom),l.left=oy(u.left,l.left),l},iW(t,s,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function oW(t){var e=t.reference,n=t.element,r=t.placement,i=r?yd(r):null,o=r?J0(r):null,s=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,l;switch(i){case ac:l={x:s,y:e.y-n.height};break;case Nu:l={x:s,y:e.y+e.height};break;case Ou:l={x:e.x+e.width,y:a};break;case lc:l={x:e.x-n.width,y:a};break;default:l={x:e.x,y:e.y}}var c=i?VO(i):null;if(c!=null){var u=c==="y"?"height":"width";switch(o){case Z0:l[c]=l[c]-(e[u]/2-n[u]/2);break;case _w:l[c]=l[c]+(e[u]/2-n[u]/2);break}}return l}function Sw(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=r===void 0?t.placement:r,o=n.strategy,s=o===void 0?t.strategy:o,a=n.boundary,l=a===void 0?rDe:a,c=n.rootBoundary,u=c===void 0?WH:c,d=n.elementContext,p=d===void 0?bw:d,m=n.altBoundary,y=m===void 0?!1:m,w=n.padding,x=w===void 0?0:w,C=QH(typeof x!="number"?x:eW(x,vw)),S=p===bw?iDe:bw,M=t.rects.popper,E=t.elements[y?S:p],A=RDe(iy(E)?E:E.contextElement||im(t.elements.popper),l,u,s),I=K0(t.elements.reference),O=oW({reference:I,element:M,placement:i}),z=WO(Object.assign({},M,O)),$=p===bw?z:I,W={top:A.top-$.top+C.top,bottom:$.bottom-A.bottom+C.bottom,left:A.left-$.left+C.left,right:$.right-A.right+C.right},J=t.modifiersData.offset;if(p===bw&&J){var Z=J[i];Object.keys(W).forEach(function(q){var j=[Ou,Nu].indexOf(q)>=0?1:-1,G=[ac,Nu].indexOf(q)>=0?"y":"x";W[q]+=Z[G]*j})}return W}function BDe(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=n.boundary,o=n.rootBoundary,s=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,c=l===void 0?qH:l,u=J0(r),d=u?a?GH:GH.filter(function(y){return J0(y)===u}):vw,p=d.filter(function(y){return c.indexOf(y)>=0});p.length===0&&(p=d);var m=p.reduce(function(y,w){return y[w]=Sw(t,{placement:w,boundary:i,rootBoundary:o,padding:s})[yd(w)],y},{});return Object.keys(m).sort(function(y,w){return m[y]-m[w]})}function FDe(t){if(yd(t)===BO)return[];var e=tT(t);return[nW(t),e,nW(e)]}function $De(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,a=s===void 0?!0:s,l=n.fallbackPlacements,c=n.padding,u=n.boundary,d=n.rootBoundary,p=n.altBoundary,m=n.flipVariations,y=m===void 0?!0:m,w=n.allowedAutoPlacements,x=e.options.placement,C=yd(x),S=C===x,M=l||(S||!y?[tT(x)]:FDe(x)),E=[x].concat(M).reduce(function(Ie,Oe){return Ie.concat(yd(Oe)===BO?BDe(e,{placement:Oe,boundary:u,rootBoundary:d,padding:c,flipVariations:y,allowedAutoPlacements:w}):Oe)},[]),A=e.rects.reference,I=e.rects.popper,O=new Map,z=!0,$=E[0],W=0;W=0,G=j?"width":"height",U=Sw(e,{placement:J,boundary:u,rootBoundary:d,altBoundary:p,padding:c}),Q=j?q?Ou:lc:q?Nu:ac;A[G]>I[G]&&(Q=tT(Q));var re=tT(Q),le=[];if(o&&le.push(U[Z]<=0),a&&le.push(U[Q]<=0,U[re]<=0),le.every(function(Ie){return Ie})){$=J,z=!1;break}O.set(J,le)}if(z)for(var oe=y?3:1,he=function(Ie){var Oe=E.find(function($e){var Ze=O.get($e);if(Ze)return Ze.slice(0,Ie).every(function(lt){return lt})});if(Oe)return $=Oe,"break"},xe=oe;xe>0;xe--){var Ee=he(xe);if(Ee==="break")break}e.placement!==$&&(e.modifiersData[r]._skip=!0,e.placement=$,e.reset=!0)}}const zDe={name:"flip",enabled:!0,phase:"main",fn:$De,requiresIfExists:["offset"],data:{_skip:!1}};function sW(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function aW(t){return[ac,Ou,Nu,lc].some(function(e){return t[e]>=0})}function VDe(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,s=Sw(e,{elementContext:"reference"}),a=Sw(e,{altBoundary:!0}),l=sW(s,r),c=sW(a,i,o),u=aW(l),d=aW(c);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}const jDe={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:VDe};function UDe(t,e,n){var r=yd(t),i=[lc,ac].indexOf(r)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,s=o[0],a=o[1];return s=s||0,a=(a||0)*i,[lc,Ou].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}function HDe(t){var e=t.state,n=t.options,r=t.name,i=n.offset,o=i===void 0?[0,0]:i,s=qH.reduce(function(u,d){return u[d]=UDe(d,e.rects,o),u},{}),a=s[e.placement],l=a.x,c=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=s}const WDe={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:HDe};function GDe(t){var e=t.state,n=t.name;e.modifiersData[n]=oW({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const qDe={name:"popperOffsets",enabled:!0,phase:"read",fn:GDe,data:{}};function YDe(t){return t==="x"?"y":"x"}function ZDe(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,a=s===void 0?!1:s,l=n.boundary,c=n.rootBoundary,u=n.altBoundary,d=n.padding,p=n.tether,m=p===void 0?!0:p,y=n.tetherOffset,w=y===void 0?0:y,x=Sw(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:u}),C=yd(e.placement),S=J0(e.placement),M=!S,E=VO(C),A=YDe(E),I=e.modifiersData.popperOffsets,O=e.rects.reference,z=e.rects.popper,$=typeof w=="function"?w(Object.assign({},e.rects,{placement:e.placement})):w,W=typeof $=="number"?{mainAxis:$,altAxis:$}:Object.assign({mainAxis:0,altAxis:0},$),J=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,Z={x:0,y:0};if(I){if(o){var q,j=E==="y"?ac:lc,G=E==="y"?Nu:Ou,U=E==="y"?"height":"width",Q=I[E],re=Q+x[j],le=Q-x[G],oe=m?-z[U]/2:0,he=S===Z0?O[U]:z[U],xe=S===Z0?-z[U]:-O[U],Ee=e.elements.arrow,Ie=m&&Ee?zO(Ee):{width:0,height:0},Oe=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:JH(),$e=Oe[j],Ze=Oe[G],lt=xw(0,O[U],Ie[U]),pt=M?O[U]/2-oe-lt-$e-W.mainAxis:he-lt-$e-W.mainAxis,yt=M?-O[U]/2+oe+lt+Ze+W.mainAxis:xe+lt+Ze+W.mainAxis,Lt=e.elements.arrow&&ww(e.elements.arrow),hn=Lt?E==="y"?Lt.clientTop||0:Lt.clientLeft||0:0,Ht=(q=J==null?void 0:J[E])!=null?q:0,wn=Q+pt-Ht-hn,cn=Q+yt-Ht,Hn=xw(m?Jk(re,wn):re,Q,m?oy(le,cn):le);I[E]=Hn,Z[E]=Hn-Q}if(a){var Bn,Ue=E==="x"?ac:lc,qe=E==="x"?Nu:Ou,Et=I[A],qt=A==="y"?"height":"width",rn=Et+x[Ue],it=Et-x[qe],St=[ac,lc].indexOf(C)!==-1,an=(Bn=J==null?void 0:J[A])!=null?Bn:0,Ne=St?rn:Et-O[qt]-z[qt]-an+W.altAxis,nt=St?Et+O[qt]+z[qt]-an-W.altAxis:it,It=m&&St?_De(Ne,Et,nt):xw(m?Ne:rn,Et,m?nt:it);I[A]=It,Z[A]=It-Et}e.modifiersData[r]=Z}}const XDe={name:"preventOverflow",enabled:!0,phase:"main",fn:ZDe,requiresIfExists:["offset"]};function KDe(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function JDe(t){return t===$c(t)||!Du(t)?jO(t):KDe(t)}function QDe(t){var e=t.getBoundingClientRect(),n=X0(e.width)/t.offsetWidth||1,r=X0(e.height)/t.offsetHeight||1;return n!==1||r!==1}function eRe(t,e,n){n===void 0&&(n=!1);var r=Du(e),i=Du(e)&&QDe(e),o=im(e),s=K0(t,i,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((gd(e)!=="body"||HO(o))&&(a=JDe(e)),Du(e)?(l=K0(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):o&&(l.x=UO(o))),{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function tRe(t){var e=new Map,n=new Set,r=[];t.forEach(function(o){e.set(o.name,o)});function i(o){n.add(o.name);var s=[].concat(o.requires||[],o.requiresIfExists||[]);s.forEach(function(a){if(!n.has(a)){var l=e.get(a);l&&i(l)}}),r.push(o)}return t.forEach(function(o){n.has(o.name)||i(o)}),r}function nRe(t){var e=tRe(t);return pDe.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function rRe(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function iRe(t){var e=t.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var lW={placement:"bottom",modifiers:[],strategy:"absolute"};function cW(){for(var t=arguments.length,e=new Array(t),n=0;n-1}function pW(t,e){return typeof t=="function"?t.apply(void 0,e):t}function mW(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function hRe(t,e){var n=Object.assign({},t);return e.forEach(function(r){delete n[r]}),n}function dRe(t){return t.split(/\s+/).filter(Boolean)}function Q0(t){return[].concat(t)}function gW(t,e){t.indexOf(e)===-1&&t.push(e)}function fRe(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function pRe(t){return t.split("-")[0]}function nT(t){return[].slice.call(t)}function yW(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function Cw(){return document.createElement("div")}function kw(t){return["Element","Fragment"].some(function(e){return qO(t,e)})}function mRe(t){return qO(t,"NodeList")}function gRe(t){return qO(t,"MouseEvent")}function yRe(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function vRe(t){return kw(t)?[t]:mRe(t)?nT(t):Array.isArray(t)?t:nT(document.querySelectorAll(t))}function YO(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function vW(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function _Re(t){var e,n=Q0(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function bRe(t,e){var n=e.clientX,r=e.clientY;return t.every(function(i){var o=i.popperRect,s=i.popperState,a=i.props,l=a.interactiveBorder,c=pRe(s.placement),u=s.modifiersData.offset;if(!u)return!0;var d=c==="bottom"?u.top.y:0,p=c==="top"?u.bottom.y:0,m=c==="right"?u.left.x:0,y=c==="left"?u.right.x:0,w=o.top-r+d>l,x=r-o.bottom-p>l,C=o.left-n+m>l,S=n-o.right-y>l;return w||x||C||S})}function ZO(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){t[r](i,n)})}function _W(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var vd={isTouch:!1},bW=0;function wRe(){vd.isTouch||(vd.isTouch=!0,window.performance&&document.addEventListener("mousemove",wW))}function wW(){var t=performance.now();t-bW<20&&(vd.isTouch=!1,document.removeEventListener("mousemove",wW)),bW=t}function xRe(){var t=document.activeElement;if(yRe(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function ERe(){document.addEventListener("touchstart",wRe,sy),window.addEventListener("blur",xRe)}var SRe=typeof window<"u"&&typeof document<"u",CRe=SRe?!!window.msCrypto:!1;function e_(t){var e=t==="destroy"?"n already-":" ";return[t+"() was called on a"+e+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function xW(t){var e=/[ \t]{2,}/g,n=/^[ \t]*/gm;return t.replace(e," ").replace(n,"").trim()}function kRe(t){return xW(` %ctippy.js %c`+xW(t)+` %c👷‍ This is a development-only message. It will be removed in production. `)}function EW(t){return[kRe(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var Tw;_n.NODE_ENV!=="production"&&TRe();function TRe(){Tw=new Set}function Ff(t,e){if(t&&!Tw.has(e)){var n;Tw.add(e),(n=console).warn.apply(n,EW(e))}}function XO(t,e){if(t&&!Tw.has(e)){var n;Tw.add(e),(n=console).error.apply(n,EW(e))}}function MRe(t){var e=!t,n=Object.prototype.toString.call(t)==="[object Object]"&&!t.addEventListener;XO(e,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),XO(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var SW={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},ARe={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},zc=Object.assign({appendTo:fW,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},SW,ARe),IRe=Object.keys(zc),LRe=function(t){_n.NODE_ENV!=="production"&&TW(t,[]);var e=Object.keys(t);e.forEach(function(n){zc[n]=t[n]})};function CW(t){var e=t.plugins||[],n=e.reduce(function(r,i){var o=i.name,s=i.defaultValue;if(o){var a;r[o]=t[o]!==void 0?t[o]:(a=zc[o])!=null?a:s}return r},{});return Object.assign({},t,n)}function PRe(t,e){var n=e?Object.keys(CW(Object.assign({},zc,{plugins:e}))):IRe,r=n.reduce(function(i,o){var s=(t.getAttribute("data-tippy-"+o)||"").trim();if(!s)return i;if(o==="content")i[o]=s;else try{i[o]=JSON.parse(s)}catch{i[o]=s}return i},{});return r}function kW(t,e){var n=Object.assign({},e,{content:pW(e.content,[t])},e.ignoreAttributes?{}:PRe(t,e.plugins));return n.aria=Object.assign({},zc.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}function TW(t,e){t===void 0&&(t={}),e===void 0&&(e=[]);var n=Object.keys(t);n.forEach(function(r){var i=hRe(zc,Object.keys(SW)),o=!uRe(i,r);o&&(o=e.filter(function(s){return s.name===r}).length===0),Ff(o,["`"+r+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",` `,`All props: https://atomiks.github.io/tippyjs/v6/all-props/ `,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var NRe=function(){return"innerHTML"};function KO(t,e){t[NRe()]=e}function MW(t){var e=Cw();return t===!0?e.className=hW:(e.className=dW,kw(t)?e.appendChild(t):KO(e,t)),e}function AW(t,e){kw(e.content)?(KO(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?KO(t,e.content):t.textContent=e.content)}function JO(t){var e=t.firstElementChild,n=nT(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(uW)}),arrow:n.find(function(r){return r.classList.contains(hW)||r.classList.contains(dW)}),backdrop:n.find(function(r){return r.classList.contains(cRe)})}}function IW(t){var e=Cw(),n=Cw();n.className=lRe,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=Cw();r.className=uW,r.setAttribute("data-state","hidden"),AW(r,t.props),e.appendChild(n),n.appendChild(r),i(t.props,t.props);function i(o,s){var a=JO(e),l=a.box,c=a.content,u=a.arrow;s.theme?l.setAttribute("data-theme",s.theme):l.removeAttribute("data-theme"),typeof s.animation=="string"?l.setAttribute("data-animation",s.animation):l.removeAttribute("data-animation"),s.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?l.setAttribute("role",s.role):l.removeAttribute("role"),(o.content!==s.content||o.allowHTML!==s.allowHTML)&&AW(c,t.props),s.arrow?u?o.arrow!==s.arrow&&(l.removeChild(u),l.appendChild(MW(s.arrow))):l.appendChild(MW(s.arrow)):u&&l.removeChild(u)}return{popper:e,onUpdate:i}}IW.$$tippy=!0;var ORe=1,rT=[],QO=[];function DRe(t,e){var n=kW(t,Object.assign({},zc,CW(yW(e)))),r,i,o,s=!1,a=!1,l=!1,c=!1,u,d,p,m=[],y=mW(wn,n.interactiveDebounce),w,x=ORe++,C=null,S=fRe(n.plugins),M={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},E={id:x,reference:t,popper:Cw(),popperInstance:C,props:n,state:M,plugins:S,clearDelayTimeouts:Ne,setProps:nt,setContent:It,show:en,hide:Fn,hideWithInteractivity:lr,enable:St,disable:an,unmount:Ye,destroy:ye};if(!n.render)return _n.NODE_ENV!=="production"&&XO(!0,"render() function has not been supplied."),E;var A=n.render(E),I=A.popper,O=A.onUpdate;I.setAttribute("data-tippy-root",""),I.id="tippy-"+E.id,E.popper=I,t._tippy=E,I._tippy=E;var z=S.map(function(ue){return ue.fn(E)}),$=t.hasAttribute("aria-expanded");return Lt(),oe(),Q(),re("onCreate",[E]),n.showOnCreate&&rn(),I.addEventListener("mouseenter",function(){E.props.interactive&&E.state.isVisible&&E.clearDelayTimeouts()}),I.addEventListener("mouseleave",function(){E.props.interactive&&E.props.trigger.indexOf("mouseenter")>=0&&j().addEventListener("mousemove",y)}),E;function W(){var ue=E.props.touch;return Array.isArray(ue)?ue:[ue,0]}function J(){return W()[0]==="hold"}function Z(){var ue;return!!((ue=E.props.render)!=null&&ue.$$tippy)}function q(){return w||t}function j(){var ue=q().parentNode;return ue?_Re(ue):document}function G(){return JO(I)}function U(ue){return E.state.isMounted&&!E.state.isVisible||vd.isTouch||u&&u.type==="focus"?0:GO(E.props.delay,ue?0:1,zc.delay)}function Q(ue){ue===void 0&&(ue=!1),I.style.pointerEvents=E.props.interactive&&!ue?"":"none",I.style.zIndex=""+E.props.zIndex}function re(ue,ve,ke){if(ke===void 0&&(ke=!0),z.forEach(function(He){He[ue]&&He[ue].apply(He,ve)}),ke){var ze;(ze=E.props)[ue].apply(ze,ve)}}function le(){var ue=E.props.aria;if(ue.content){var ve="aria-"+ue.content,ke=I.id,ze=Q0(E.props.triggerTarget||t);ze.forEach(function(He){var tt=He.getAttribute(ve);if(E.state.isVisible)He.setAttribute(ve,tt?tt+" "+ke:ke);else{var Ke=tt&&tt.replace(ke,"").trim();Ke?He.setAttribute(ve,Ke):He.removeAttribute(ve)}})}}function oe(){if(!($||!E.props.aria.expanded)){var ue=Q0(E.props.triggerTarget||t);ue.forEach(function(ve){E.props.interactive?ve.setAttribute("aria-expanded",E.state.isVisible&&ve===q()?"true":"false"):ve.removeAttribute("aria-expanded")})}}function he(){j().removeEventListener("mousemove",y),rT=rT.filter(function(ue){return ue!==y})}function xe(ue){if(!(vd.isTouch&&(l||ue.type==="mousedown"))){var ve=ue.composedPath&&ue.composedPath()[0]||ue.target;if(!(E.props.interactive&&_W(I,ve))){if(Q0(E.props.triggerTarget||t).some(function(ke){return _W(ke,ve)})){if(vd.isTouch||E.state.isVisible&&E.props.trigger.indexOf("click")>=0)return}else re("onClickOutside",[E,ue]);E.props.hideOnClick===!0&&(E.clearDelayTimeouts(),E.hide(),a=!0,setTimeout(function(){a=!1}),E.state.isMounted||$e())}}}function Ee(){l=!0}function Ie(){l=!1}function Oe(){var ue=j();ue.addEventListener("mousedown",xe,!0),ue.addEventListener("touchend",xe,sy),ue.addEventListener("touchstart",Ie,sy),ue.addEventListener("touchmove",Ee,sy)}function $e(){var ue=j();ue.removeEventListener("mousedown",xe,!0),ue.removeEventListener("touchend",xe,sy),ue.removeEventListener("touchstart",Ie,sy),ue.removeEventListener("touchmove",Ee,sy)}function Ze(ue,ve){pt(ue,function(){!E.state.isVisible&&I.parentNode&&I.parentNode.contains(I)&&ve()})}function lt(ue,ve){pt(ue,ve)}function pt(ue,ve){var ke=G().box;function ze(He){He.target===ke&&(ZO(ke,"remove",ze),ve())}if(ue===0)return ve();ZO(ke,"remove",d),ZO(ke,"add",ze),d=ze}function yt(ue,ve,ke){ke===void 0&&(ke=!1);var ze=Q0(E.props.triggerTarget||t);ze.forEach(function(He){He.addEventListener(ue,ve,ke),m.push({node:He,eventType:ue,handler:ve,options:ke})})}function Lt(){J()&&(yt("touchstart",Ht,{passive:!0}),yt("touchend",cn,{passive:!0})),dRe(E.props.trigger).forEach(function(ue){if(ue!=="manual")switch(yt(ue,Ht),ue){case"mouseenter":yt("mouseleave",cn);break;case"focus":yt(CRe?"focusout":"blur",Hn);break;case"focusin":yt("focusout",Hn);break}})}function hn(){m.forEach(function(ue){var ve=ue.node,ke=ue.eventType,ze=ue.handler,He=ue.options;ve.removeEventListener(ke,ze,He)}),m=[]}function Ht(ue){var ve,ke=!1;if(!(!E.state.isEnabled||Bn(ue)||a)){var ze=((ve=u)==null?void 0:ve.type)==="focus";u=ue,w=ue.currentTarget,oe(),!E.state.isVisible&&gRe(ue)&&rT.forEach(function(He){return He(ue)}),ue.type==="click"&&(E.props.trigger.indexOf("mouseenter")<0||s)&&E.props.hideOnClick!==!1&&E.state.isVisible?ke=!0:rn(ue),ue.type==="click"&&(s=!ke),ke&&!ze&&it(ue)}}function wn(ue){var ve=ue.target,ke=q().contains(ve)||I.contains(ve);if(!(ue.type==="mousemove"&&ke)){var ze=qt().concat(I).map(function(He){var tt,Ke=He._tippy,mt=(tt=Ke.popperInstance)==null?void 0:tt.state;return mt?{popperRect:He.getBoundingClientRect(),popperState:mt,props:n}:null}).filter(Boolean);bRe(ze,ue)&&(he(),it(ue))}}function cn(ue){var ve=Bn(ue)||E.props.trigger.indexOf("click")>=0&&s;if(!ve){if(E.props.interactive){E.hideWithInteractivity(ue);return}it(ue)}}function Hn(ue){E.props.trigger.indexOf("focusin")<0&&ue.target!==q()||E.props.interactive&&ue.relatedTarget&&I.contains(ue.relatedTarget)||it(ue)}function Bn(ue){return vd.isTouch?J()!==ue.type.indexOf("touch")>=0:!1}function Ue(){qe();var ue=E.props,ve=ue.popperOptions,ke=ue.placement,ze=ue.offset,He=ue.getReferenceClientRect,tt=ue.moveTransition,Ke=Z()?JO(I).arrow:null,mt=He?{getBoundingClientRect:He,contextElement:He.contextElement||q()}:t,dt={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(wt){var We=wt.state;if(Z()){var Vt=G(),xn=Vt.box;["placement","reference-hidden","escaped"].forEach(function(jt){jt==="placement"?xn.setAttribute("data-placement",We.placement):We.attributes.popper["data-popper-"+jt]?xn.setAttribute("data-"+jt,""):xn.removeAttribute("data-"+jt)}),We.attributes.popper={}}}},Qe=[{name:"offset",options:{offset:ze}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!tt}},dt];Z()&&Ke&&Qe.push({name:"arrow",options:{element:Ke,padding:3}}),Qe.push.apply(Qe,(ve==null?void 0:ve.modifiers)||[]),E.popperInstance=aRe(mt,I,Object.assign({},ve,{placement:ke,onFirstUpdate:p,modifiers:Qe}))}function qe(){E.popperInstance&&(E.popperInstance.destroy(),E.popperInstance=null)}function Et(){var ue=E.props.appendTo,ve,ke=q();E.props.interactive&&ue===fW||ue==="parent"?ve=ke.parentNode:ve=pW(ue,[ke]),ve.contains(I)||ve.appendChild(I),E.state.isMounted=!0,Ue(),_n.NODE_ENV!=="production"&&Ff(E.props.interactive&&ue===zc.appendTo&&ke.nextElementSibling!==I,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",` `,"Using a wrapper
or tag around the reference element","solves this by creating a new parentNode context.",` `,"Specifying `appendTo: document.body` silences this warning, but it","assumes you are using a focus management solution to handle","keyboard navigation.",` `,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function qt(){return nT(I.querySelectorAll("[data-tippy-root]"))}function rn(ue){E.clearDelayTimeouts(),ue&&re("onTrigger",[E,ue]),Oe();var ve=U(!0),ke=W(),ze=ke[0],He=ke[1];vd.isTouch&&ze==="hold"&&He&&(ve=He),ve?r=setTimeout(function(){E.show()},ve):E.show()}function it(ue){if(E.clearDelayTimeouts(),re("onUntrigger",[E,ue]),!E.state.isVisible){$e();return}if(!(E.props.trigger.indexOf("mouseenter")>=0&&E.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(ue.type)>=0&&s)){var ve=U(!1);ve?i=setTimeout(function(){E.state.isVisible&&E.hide()},ve):o=requestAnimationFrame(function(){E.hide()})}}function St(){E.state.isEnabled=!0}function an(){E.hide(),E.state.isEnabled=!1}function Ne(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(o)}function nt(ue){if(_n.NODE_ENV!=="production"&&Ff(E.state.isDestroyed,e_("setProps")),!E.state.isDestroyed){re("onBeforeUpdate",[E,ue]),hn();var ve=E.props,ke=kW(t,Object.assign({},ve,yW(ue),{ignoreAttributes:!0}));E.props=ke,Lt(),ve.interactiveDebounce!==ke.interactiveDebounce&&(he(),y=mW(wn,ke.interactiveDebounce)),ve.triggerTarget&&!ke.triggerTarget?Q0(ve.triggerTarget).forEach(function(ze){ze.removeAttribute("aria-expanded")}):ke.triggerTarget&&t.removeAttribute("aria-expanded"),oe(),Q(),O&&O(ve,ke),E.popperInstance&&(Ue(),qt().forEach(function(ze){requestAnimationFrame(ze._tippy.popperInstance.forceUpdate)})),re("onAfterUpdate",[E,ue])}}function It(ue){E.setProps({content:ue})}function en(){_n.NODE_ENV!=="production"&&Ff(E.state.isDestroyed,e_("show"));var ue=E.state.isVisible,ve=E.state.isDestroyed,ke=!E.state.isEnabled,ze=vd.isTouch&&!E.props.touch,He=GO(E.props.duration,0,zc.duration);if(!(ue||ve||ke||ze)&&!q().hasAttribute("disabled")&&(re("onShow",[E],!1),E.props.onShow(E)!==!1)){if(E.state.isVisible=!0,Z()&&(I.style.visibility="visible"),Q(),Oe(),E.state.isMounted||(I.style.transition="none"),Z()){var tt=G(),Ke=tt.box,mt=tt.content;YO([Ke,mt],0)}p=function(){var dt;if(!(!E.state.isVisible||c)){if(c=!0,I.offsetHeight,I.style.transition=E.props.moveTransition,Z()&&E.props.animation){var Qe=G(),wt=Qe.box,We=Qe.content;YO([wt,We],He),vW([wt,We],"visible")}le(),oe(),gW(QO,E),(dt=E.popperInstance)==null||dt.forceUpdate(),re("onMount",[E]),E.props.animation&&Z()&<(He,function(){E.state.isShown=!0,re("onShown",[E])})}},Et()}}function Fn(){_n.NODE_ENV!=="production"&&Ff(E.state.isDestroyed,e_("hide"));var ue=!E.state.isVisible,ve=E.state.isDestroyed,ke=!E.state.isEnabled,ze=GO(E.props.duration,1,zc.duration);if(!(ue||ve||ke)&&(re("onHide",[E],!1),E.props.onHide(E)!==!1)){if(E.state.isVisible=!1,E.state.isShown=!1,c=!1,s=!1,Z()&&(I.style.visibility="hidden"),he(),$e(),Q(!0),Z()){var He=G(),tt=He.box,Ke=He.content;E.props.animation&&(YO([tt,Ke],ze),vW([tt,Ke],"hidden"))}le(),oe(),E.props.animation?Z()&&Ze(ze,E.unmount):E.unmount()}}function lr(ue){_n.NODE_ENV!=="production"&&Ff(E.state.isDestroyed,e_("hideWithInteractivity")),j().addEventListener("mousemove",y),gW(rT,y),y(ue)}function Ye(){_n.NODE_ENV!=="production"&&Ff(E.state.isDestroyed,e_("unmount")),E.state.isVisible&&E.hide(),E.state.isMounted&&(qe(),qt().forEach(function(ue){ue._tippy.unmount()}),I.parentNode&&I.parentNode.removeChild(I),QO=QO.filter(function(ue){return ue!==E}),E.state.isMounted=!1,re("onHidden",[E]))}function ye(){_n.NODE_ENV!=="production"&&Ff(E.state.isDestroyed,e_("destroy")),!E.state.isDestroyed&&(E.clearDelayTimeouts(),E.unmount(),hn(),delete t._tippy,E.state.isDestroyed=!0,re("onDestroy",[E]))}}function t_(t,e){e===void 0&&(e={});var n=zc.plugins.concat(e.plugins||[]);_n.NODE_ENV!=="production"&&(MRe(t),TW(e,n)),ERe();var r=Object.assign({},e,{plugins:n}),i=vRe(t);if(_n.NODE_ENV!=="production"){var o=kw(r.content),s=i.length>1;Ff(o&&s,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",` `,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",` `,`1) content: element.innerHTML `,"2) content: () => element.cloneNode(true)"].join(" "))}var a=i.reduce(function(l,c){var u=c&&DRe(c,r);return u&&l.push(u),l},[]);return kw(t)?a[0]:a}t_.defaultProps=zc,t_.setDefaultProps=LRe,t_.currentInput=vd,Object.assign({},YH,{effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow)}}),t_.setDefaultProps({render:IW});class RRe{constructor({editor:e,element:n,view:r,tippyOptions:i={},updateDelay:o=250,shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:a,state:l,from:c,to:u})=>{const{doc:d,selection:p}=l,{empty:m}=p,y=!d.textBetween(c,u).length&&kO(l.selection),w=this.element.contains(document.activeElement);return!(!(a.hasFocus()||w)||m||y||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:a})=>{var l;if(this.preventHide){this.preventHide=!1;return}a!=null&&a.relatedTarget&&!((l=this.element.parentNode)===null||l===void 0)&&l.contains(a.relatedTarget)||(a==null?void 0:a.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=a=>{this.blurHandler({event:a})},this.handleDebouncedUpdate=(a,l)=>{const c=!(l!=null&&l.selection.eq(a.state.selection)),u=!(l!=null&&l.doc.eq(a.state.doc));!c&&!u||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(a,c,u,l)},this.updateDelay))},this.updateHandler=(a,l,c,u)=>{var d,p,m;const{state:y,composing:w}=a,{selection:x}=y;if(w||!l&&!c)return;this.createTooltip();const{ranges:C}=x,S=Math.min(...C.map(E=>E.$from.pos)),M=Math.max(...C.map(E=>E.$to.pos));if(!(!((d=this.shouldShow)===null||d===void 0)&&d.call(this,{editor:this.editor,element:this.element,view:a,state:y,oldState:u,from:S,to:M}))){this.hide();return}(p=this.tippy)===null||p===void 0||p.setProps({getReferenceClientRect:((m=this.tippyOptions)===null||m===void 0?void 0:m.getReferenceClientRect)||(()=>{if(DOe(y.selection)){let E=a.nodeDOM(S);if(E){const A=E.dataset.nodeViewWrapper?E:E.querySelector("[data-node-view-wrapper]");if(A&&(E=A.firstChild),E)return E.getBoundingClientRect()}}return UH(a,S,M)})}),this.show()},this.editor=e,this.element=n,this.view=r,this.updateDelay=o,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=t_(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){const{state:r}=e,i=r.selection.from!==r.selection.to;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(e,n);return}const o=!(n!=null&&n.selection.eq(e.state.selection)),s=!(n!=null&&n.doc.eq(e.state.doc));this.updateHandler(e,o,s,n)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const LW=t=>new xs({key:typeof t.pluginKey=="string"?new fa(t.pluginKey):t.pluginKey,view:e=>new RRe({view:e,...t})});ma.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[LW({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class BRe{getTextContent(e){return zH(e,{textSerializers:SO(this.editor.schema)})}constructor({editor:e,element:n,view:r,tippyOptions:i={},shouldShow:o}){this.preventHide=!1,this.shouldShow=({view:s,state:a})=>{const{selection:l}=a,{$anchor:c,empty:u}=l,d=c.depth===1,p=c.parent.isTextblock&&!c.parent.type.spec.code&&!c.parent.textContent&&c.parent.childCount===0&&!this.getTextContent(c.parent);return!(!s.hasFocus()||!u||!d||!p||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:s})=>{var a;if(this.preventHide){this.preventHide=!1;return}s!=null&&s.relatedTarget&&!((a=this.element.parentNode)===null||a===void 0)&&a.contains(s.relatedTarget)||(s==null?void 0:s.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=s=>{this.blurHandler({event:s})},this.editor=e,this.element=n,this.view=r,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=t_(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){var r,i,o;const{state:s}=e,{doc:a,selection:l}=s,{from:c,to:u}=l;if(!(n&&n.doc.eq(a)&&n.selection.eq(l))){if(this.createTooltip(),!(!((r=this.shouldShow)===null||r===void 0)&&r.call(this,{editor:this.editor,view:e,state:s,oldState:n}))){this.hide();return}(i=this.tippy)===null||i===void 0||i.setProps({getReferenceClientRect:((o=this.tippyOptions)===null||o===void 0?void 0:o.getReferenceClientRect)||(()=>UH(e,c,u))}),this.show()}}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const PW=t=>new xs({key:typeof t.pluginKey=="string"?new fa(t.pluginKey):t.pluginKey,view:e=>new BRe({view:e,...t})});ma.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[PW({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}}),g.defineComponent({name:"BubbleMenu",props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=g.ref(null);return g.onMounted(()=>{const{updateDelay:r,editor:i,pluginKey:o,shouldShow:s,tippyOptions:a}=t;i.registerPlugin(LW({updateDelay:r,editor:i,element:n.value,pluginKey:o,shouldShow:s,tippyOptions:a}))}),g.onBeforeUnmount(()=>{const{pluginKey:r,editor:i}=t;i.unregisterPlugin(r)}),()=>{var r;return g.h("div",{ref:n},(r=e.default)===null||r===void 0?void 0:r.call(e))}}});function NW(t){return g.customRef((e,n)=>({get(){return e(),t},set(r){t=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class FRe extends tDe{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=NW(this.view.state),this.reactiveExtensionStorage=NW(this.extensionStorage),this.on("beforeTransaction",({nextState:n})=>{this.reactiveState.value=n,this.reactiveExtensionStorage.value=this.extensionStorage}),g.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,n){const r=super.registerPlugin(e,n);return this.reactiveState&&(this.reactiveState.value=r),r}unregisterPlugin(e){const n=super.unregisterPlugin(e);return this.reactiveState&&n&&(this.reactiveState.value=n),n}}const OW=g.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=g.ref(),n=g.getCurrentInstance();return g.watchEffect(()=>{const r=t.editor;r&&r.options.element&&e.value&&g.nextTick(()=>{if(!e.value||!r.options.element.firstChild)return;const i=g.unref(e.value);e.value.append(...r.options.element.childNodes),r.contentComponent=n.ctx._,n&&(r.appContext={...n.appContext,provides:n.provides}),r.setOptions({element:i}),r.createNodeViews()})}),g.onBeforeUnmount(()=>{const r=t.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return g.h("div",{ref:t=>{this.rootEl=t}})}});g.defineComponent({name:"FloatingMenu",props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=g.ref(null);return g.onMounted(()=>{const{pluginKey:r,editor:i,tippyOptions:o,shouldShow:s}=t;i.registerPlugin(PW({pluginKey:r,editor:i,element:n.value,tippyOptions:o,shouldShow:s}))}),g.onBeforeUnmount(()=>{const{pluginKey:r,editor:i}=t;i.unregisterPlugin(r)}),()=>{var r;return g.h("div",{ref:n},(r=e.default)===null||r===void 0?void 0:r.call(e))}}}),g.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return g.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),g.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var t,e;return g.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(t=this.$slots).default)===null||e===void 0?void 0:e.call(t))}});const DW=(t={})=>{const e=g.shallowRef();return g.onMounted(()=>{e.value=new FRe(t)}),g.onBeforeUnmount(()=>{var n,r,i;const o=(n=e.value)===null||n===void 0?void 0:n.options.element,s=o==null?void 0:o.cloneNode(!0);(r=o==null?void 0:o.parentNode)===null||r===void 0||r.replaceChild(s,o),(i=e.value)===null||i===void 0||i.destroy()}),e},$Re=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,zRe=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,VRe=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,jRe=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,RW=sc.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",ro(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[ry({find:$Re,type:this.type}),ry({find:VRe,type:this.type})]},addPasteRules(){return[rm({find:zRe,type:this.type}),rm({find:jRe,type:this.type})]}}),URe=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,HRe=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,WRe=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,GRe=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,BW=sc.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",ro(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ry({find:URe,type:this.type}),ry({find:WRe,type:this.type})]},addPasteRules(){return[rm({find:HRe,type:this.type}),rm({find:GRe,type:this.type})]}}),qRe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,YRe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,FW=sc.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",ro(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[ry({find:qRe,type:this.type})]},addPasteRules(){return[rm({find:YRe,type:this.type})]}}),ZRe=/(^|[^`])`([^`]+)`(?!`)/,XRe=/(^|[^`])`([^`]+)`(?!`)/g,$W=sc.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",ro(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[ry({find:ZRe,type:this.type})]},addPasteRules(){return[rm({find:XRe,type:this.type})]}}),KRe=/^```([a-z]+)?[\s\n]$/,JRe=/^~~~([a-z]+)?[\s\n]$/,zW=Pl.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;return[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(i=>i.startsWith(n)).map(i=>i.replace(n,""))[0]||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",ro(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(` `);return!o||!s?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;const s=i.after();return s===void 0?!1:r.nodeAt(s)?t.commands.command(({tr:a})=>(a.setSelection(Gn.near(r.resolve(s))),!0)):t.commands.exitCode()}}},addInputRules(){return[RO({find:KRe,type:this.type,getAttributes:t=>({language:t[1]})}),RO({find:JRe,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new xs({key:new fa("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i==null?void 0:i.mode;if(!n||!o)return!1;const{tr:s,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,` `));return s.replaceSelectionWith(this.type.create({language:o},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(qn.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),QRe="listItem",VW="textStyle",jW=/^\s*([-+*])\s$/,UW=Pl.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",ro(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(QRe,this.editor.getAttributes(VW)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=yw({find:jW,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=yw({find:jW,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(VW),editor:this.editor})),[t]}}),e3e="listItem",HW="textStyle",WW=/^(\d+)\.\s$/,GW=Pl.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",ro(this.options.HTMLAttributes,n),0]:["ol",ro(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(e3e,this.editor.getAttributes(HW)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=yw({find:WW,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=yw({find:WW,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(HW)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),qW=Pl.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",ro(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),t3e=/^\s*>\s$/,YW=Pl.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",ro(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[yw({find:t3e,type:this.type})]}}),ZW=Pl.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",ro(this.options.HTMLAttributes,t)]},renderText(){return` `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:a}=r.extensionManager,l=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&s){const d=l.filter(p=>a.includes(p.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var iT=200,ga=function(){};ga.prototype.append=function(t){return t.length?(t=ga.from(t),!this.length&&t||t.length=e?ga.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},ga.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},ga.prototype.forEach=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},ga.prototype.map=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(i,o){return r.push(t(i,o))},e,n),r},ga.from=function(t){return t instanceof ga?t:t&&t.length?new XW(t):ga.empty};var XW=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,i){return r==0&&i==this.length?this:new e(this.values.slice(r,i))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,i,o,s){for(var a=i;a=o;a--)if(r(this.values[a],s+a)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=iT)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=iT)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(ga);ga.empty=new XW([]);var n3e=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return ns&&this.right.forEachInner(n,Math.max(r-s,0),Math.min(this.length,i)-s,o+s)===!1)return!1},e.prototype.forEachInvertedInner=function(n,r,i,o){var s=this.left.length;if(r>s&&this.right.forEachInvertedInner(n,r-s,Math.max(i,s)-s,o+s)===!1||i=i?this.right.slice(n-i,r-i):this.left.slice(n,i).append(this.right.slice(0,r-i))},e.prototype.leafAppend=function(n){var r=this.right.leafAppend(n);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(n){var r=this.left.leafPrepend(n);if(r)return new e(r,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(ga);const r3e=500;class _h{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,a,l,c=[],u=[];return this.items.forEach((d,p)=>{if(!d.step){i||(i=this.remapping(r,p+1),o=i.maps.length),o--,u.push(d);return}if(i){u.push(new _d(d.map));let m=d.step.map(i.slice(o)),y;m&&s.maybeStep(m).doc&&(y=s.mapping.maps[s.mapping.maps.length-1],c.push(new _d(y,void 0,void 0,c.length+u.length))),o--,y&&i.appendMap(y,o)}else s.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(o)):d.selection,l=new _h(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,n,r,i){let o=[],s=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let u=0;uo3e&&(a=i3e(a,c),s-=c),new _h(a.append(o),s)}remapping(e,n){let r=new nw;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new _h(this.items.append(e.map(n=>new _d(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(p=>{p.selection&&a--},i);let l=n;this.items.forEach(p=>{let m=o.getMirror(--l);if(m==null)return;s=Math.min(s,m);let y=o.maps[m];if(p.step){let w=e.steps[m].invert(e.docs[m]),x=p.selection&&p.selection.map(o.slice(l+1,m));x&&a++,r.push(new _d(y,w,x))}else r.push(new _d(y))},i);let c=[];for(let p=n;pr3e&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],o=0;return this.items.forEach((s,a)=>{if(a>=e)i.push(s),s.selection&&o++;else if(s.step){let l=s.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=s.selection&&s.selection.map(n.slice(r));u&&o++;let d=new _d(c.invert(),l,u),p,m=i.length-1;(p=i.length&&i[m].merge(d))?i[m]=p:i.push(d)}}else s.map&&r--},this.items.length,0),new _h(ga.from(i.reverse()),o)}}_h.empty=new _h(ga.empty,0);function i3e(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class _d{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new _d(n.getMap().invert(),n,this.selection)}}}class om{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const o3e=20;function s3e(t,e,n,r){let i=n.getMeta(ay),o;if(i)return i.historyState;n.getMeta(c3e)&&(t=new om(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(ay))return s.getMeta(ay).redo?new om(t.done.addTransform(n,void 0,r,oT(e)),t.undone,KW(n.mapping.maps),t.prevTime,t.prevComposition):new om(t.done,t.undone.addTransform(n,void 0,r,oT(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!a3e(n,t.prevRanges)),c=s?eD(t.prevRanges,n.mapping):KW(n.mapping.maps);return new om(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,oT(e)),_h.empty,c,n.time,a??t.prevComposition)}else return(o=n.getMeta("rebased"))?new om(t.done.rebased(n,o),t.undone.rebased(n,o),eD(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new om(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),eD(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function a3e(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let o=0;o=e[o]&&(n=!0)}),n}function KW(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,o,s)=>e.push(o,s));return e}function eD(t,e){if(!t)return null;let n=[];for(let r=0;r{let i=ay.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=l3e(i,n,t);o&&r(o.scrollIntoView())}return!0}}const eG=QW(!1),tG=QW(!0),nG=ma.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>eG(t,e),redo:()=>({state:t,dispatch:e})=>tG(t,e)}},addProseMirrorPlugins(){return[u3e(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),h3e=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,d3e=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,rG=sc.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",ro(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[ry({find:h3e,type:this.type})]},addPasteRules(){return[rm({find:d3e,type:this.type})]}}),iG=sc.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",ro(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),oG=sc.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",ro(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),sG=sc.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",ro(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),f3e="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",p3e="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",n_=(t,e)=>{for(const n in e)t[n]=e[n];return t},nD="numeric",rD="ascii",iD="alpha",Mw="asciinumeric",Aw="alphanumeric",oD="domain",aG="emoji",m3e="scheme",g3e="slashscheme",sD="whitespace";function y3e(t,e){return t in e||(e[t]=[]),e[t]}function ly(t,e,n){e[nD]&&(e[Mw]=!0,e[Aw]=!0),e[rD]&&(e[Mw]=!0,e[iD]=!0),e[Mw]&&(e[Aw]=!0),e[iD]&&(e[Aw]=!0),e[Aw]&&(e[oD]=!0),e[aG]&&(e[oD]=!0);for(const r in e){const i=y3e(r,n);i.indexOf(t)<0&&i.push(t)}}function v3e(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function cc(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}cc.groups={},cc.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;rt.ta(e,n,r,i),Wo=(t,e,n,r,i)=>t.tr(e,n,r,i),lG=(t,e,n,r,i)=>t.ts(e,n,r,i),Ft=(t,e,n,r,i)=>t.tt(e,n,r,i),$f="WORD",aD="UWORD",cG="ASCIINUMERICAL",uG="ALPHANUMERICAL",Iw="LOCALHOST",lD="TLD",cD="UTLD",sT="SCHEME",r_="SLASH_SCHEME",uD="NUM",hD="WS",dD="NL",Lw="OPENBRACE",Pw="CLOSEBRACE",aT="OPENBRACKET",lT="CLOSEBRACKET",cT="OPENPAREN",uT="CLOSEPAREN",hT="OPENANGLEBRACKET",dT="CLOSEANGLEBRACKET",fT="FULLWIDTHLEFTPAREN",pT="FULLWIDTHRIGHTPAREN",mT="LEFTCORNERBRACKET",gT="RIGHTCORNERBRACKET",yT="LEFTWHITECORNERBRACKET",vT="RIGHTWHITECORNERBRACKET",_T="FULLWIDTHLESSTHAN",bT="FULLWIDTHGREATERTHAN",wT="AMPERSAND",xT="APOSTROPHE",ET="ASTERISK",sm="AT",ST="BACKSLASH",CT="BACKTICK",kT="CARET",am="COLON",fD="COMMA",TT="DOLLAR",bd="DOT",MT="EQUALS",pD="EXCLAMATION",Ru="HYPHEN",Nw="PERCENT",AT="PIPE",IT="PLUS",LT="POUND",Ow="QUERY",mD="QUOTE",hG="FULLWIDTHMIDDLEDOT",gD="SEMI",wd="SLASH",Dw="TILDE",PT="UNDERSCORE",dG="EMOJI",NT="SYM";var fG=Object.freeze({__proto__:null,ALPHANUMERICAL:uG,AMPERSAND:wT,APOSTROPHE:xT,ASCIINUMERICAL:cG,ASTERISK:ET,AT:sm,BACKSLASH:ST,BACKTICK:CT,CARET:kT,CLOSEANGLEBRACKET:dT,CLOSEBRACE:Pw,CLOSEBRACKET:lT,CLOSEPAREN:uT,COLON:am,COMMA:fD,DOLLAR:TT,DOT:bd,EMOJI:dG,EQUALS:MT,EXCLAMATION:pD,FULLWIDTHGREATERTHAN:bT,FULLWIDTHLEFTPAREN:fT,FULLWIDTHLESSTHAN:_T,FULLWIDTHMIDDLEDOT:hG,FULLWIDTHRIGHTPAREN:pT,HYPHEN:Ru,LEFTCORNERBRACKET:mT,LEFTWHITECORNERBRACKET:yT,LOCALHOST:Iw,NL:dD,NUM:uD,OPENANGLEBRACKET:hT,OPENBRACE:Lw,OPENBRACKET:aT,OPENPAREN:cT,PERCENT:Nw,PIPE:AT,PLUS:IT,POUND:LT,QUERY:Ow,QUOTE:mD,RIGHTCORNERBRACKET:gT,RIGHTWHITECORNERBRACKET:vT,SCHEME:sT,SEMI:gD,SLASH:wd,SLASH_SCHEME:r_,SYM:NT,TILDE:Dw,TLD:lD,UNDERSCORE:PT,UTLD:cD,UWORD:aD,WORD:$f,WS:hD});const zf=/[a-z]/,Rw=new RegExp("\\p{L}","u"),yD=new RegExp("\\p{Emoji}","u"),Vf=/\d/,vD=/\s/,pG="\r",_D=` `,_3e="️",b3e="‍",bD="";let OT=null,DT=null;function w3e(t=[]){const e={};cc.groups=e;const n=new cc;OT==null&&(OT=gG(f3e)),DT==null&&(DT=gG(p3e)),Ft(n,"'",xT),Ft(n,"{",Lw),Ft(n,"}",Pw),Ft(n,"[",aT),Ft(n,"]",lT),Ft(n,"(",cT),Ft(n,")",uT),Ft(n,"<",hT),Ft(n,">",dT),Ft(n,"(",fT),Ft(n,")",pT),Ft(n,"「",mT),Ft(n,"」",gT),Ft(n,"『",yT),Ft(n,"』",vT),Ft(n,"<",_T),Ft(n,">",bT),Ft(n,"&",wT),Ft(n,"*",ET),Ft(n,"@",sm),Ft(n,"`",CT),Ft(n,"^",kT),Ft(n,":",am),Ft(n,",",fD),Ft(n,"$",TT),Ft(n,".",bd),Ft(n,"=",MT),Ft(n,"!",pD),Ft(n,"-",Ru),Ft(n,"%",Nw),Ft(n,"|",AT),Ft(n,"+",IT),Ft(n,"#",LT),Ft(n,"?",Ow),Ft(n,'"',mD),Ft(n,"/",wd),Ft(n,";",gD),Ft(n,"~",Dw),Ft(n,"_",PT),Ft(n,"\\",ST),Ft(n,"・",hG);const r=Wo(n,Vf,uD,{[nD]:!0});Wo(r,Vf,r);const i=Wo(r,zf,cG,{[Mw]:!0}),o=Wo(r,Rw,uG,{[Aw]:!0}),s=Wo(n,zf,$f,{[rD]:!0});Wo(s,Vf,i),Wo(s,zf,s),Wo(i,Vf,i),Wo(i,zf,i);const a=Wo(n,Rw,aD,{[iD]:!0});Wo(a,zf),Wo(a,Vf,o),Wo(a,Rw,a),Wo(o,Vf,o),Wo(o,zf),Wo(o,Rw,o);const l=Ft(n,_D,dD,{[sD]:!0}),c=Ft(n,pG,hD,{[sD]:!0}),u=Wo(n,vD,hD,{[sD]:!0});Ft(n,bD,u),Ft(c,_D,l),Ft(c,bD,u),Wo(c,vD,u),Ft(u,pG),Ft(u,_D),Wo(u,vD,u),Ft(u,bD,u);const d=Wo(n,yD,dG,{[aG]:!0});Ft(d,"#"),Wo(d,yD,d),Ft(d,_3e,d);const p=Ft(d,b3e);Ft(p,"#"),Wo(p,yD,d);const m=[[zf,s],[Vf,i]],y=[[zf,null],[Rw,a],[Vf,o]];for(let w=0;ww[0]>x[0]?1:-1);for(let w=0;w=0?C[oD]=!0:zf.test(x)?Vf.test(x)?C[Mw]=!0:C[rD]=!0:C[nD]=!0,lG(n,x,x,C)}return lG(n,"localhost",Iw,{ascii:!0}),n.jd=new cc(NT),{start:n,tokens:n_({groups:e},fG)}}function mG(t,e){const n=x3e(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,i=[];let o=0,s=0;for(;s=0&&(d+=n[s].length,p++),c+=n[s].length,o+=n[s].length,s++;o-=d,s-=p,c-=d,i.push({t:u.t,v:e.slice(o-c,o),s:o-c,e:o})}return i}function x3e(t){const e=[],n=t.length;let r=0;for(;r56319||r+1===n||(o=t.charCodeAt(r+1))<56320||o>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function lm(t,e,n,r,i){let o;const s=e.length;for(let a=0;a=0;)o++;if(o>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+o),10);s>0;s--)n.pop();r+=o}else n.push(t[r]),r++}return e}const Bw={defaultProtocol:"http",events:null,format:yG,formatHref:yG,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function wD(t,e=null){let n=n_({},Bw);t&&(n=n_(n,t instanceof wD?t.o:t));const r=n.ignoreTags,i=[];for(let o=0;on?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Bw.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),o=this.toFormattedString(t),s={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return s.href=r,a&&(s.class=a),l&&(s.target=l),c&&(s.rel=c),u&&n_(s,u),{tagName:i,attributes:s,content:o,eventListeners:d}}};function RT(t,e){class n extends vG{constructor(i,o){super(i,o),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const _G=RT("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),bG=RT("text"),E3e=RT("nl"),BT=RT("url",{isLink:!0,toHref(t=Bw.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Iw&&t[1].t===am}}),Bu=t=>new cc(t);function S3e({groups:t}){const e=t.domain.concat([wT,ET,sm,ST,CT,kT,TT,MT,Ru,uD,Nw,AT,IT,LT,wd,NT,Dw,PT]),n=[xT,am,fD,bd,pD,Nw,Ow,mD,gD,hT,dT,Lw,Pw,lT,aT,cT,uT,fT,pT,mT,gT,yT,vT,_T,bT],r=[wT,xT,ET,ST,CT,kT,TT,MT,Ru,Lw,Pw,Nw,AT,IT,LT,Ow,wd,NT,Dw,PT],i=Bu(),o=Ft(i,Dw);xr(o,r,o),xr(o,t.domain,o);const s=Bu(),a=Bu(),l=Bu();xr(i,t.domain,s),xr(i,t.scheme,a),xr(i,t.slashscheme,l),xr(s,r,o),xr(s,t.domain,s);const c=Ft(s,sm);Ft(o,sm,c),Ft(a,sm,c),Ft(l,sm,c);const u=Ft(o,bd);xr(u,r,o),xr(u,t.domain,o);const d=Bu();xr(c,t.domain,d),xr(d,t.domain,d);const p=Ft(d,bd);xr(p,t.domain,d);const m=Bu(_G);xr(p,t.tld,m),xr(p,t.utld,m),Ft(c,Iw,m);const y=Ft(d,Ru);Ft(y,Ru,y),xr(y,t.domain,d),xr(m,t.domain,d),Ft(m,bd,p),Ft(m,Ru,y);const w=Ft(m,am);xr(w,t.numeric,_G);const x=Ft(s,Ru),C=Ft(s,bd);Ft(x,Ru,x),xr(x,t.domain,s),xr(C,r,o),xr(C,t.domain,s);const S=Bu(BT);xr(C,t.tld,S),xr(C,t.utld,S),xr(S,t.domain,s),xr(S,r,o),Ft(S,bd,C),Ft(S,Ru,x),Ft(S,sm,c);const M=Ft(S,am),E=Bu(BT);xr(M,t.numeric,E);const A=Bu(BT),I=Bu();xr(A,e,A),xr(A,n,I),xr(I,e,A),xr(I,n,I),Ft(S,wd,A),Ft(E,wd,A);const O=Ft(a,am),z=Ft(l,am),$=Ft(z,wd),W=Ft($,wd);xr(a,t.domain,s),Ft(a,bd,C),Ft(a,Ru,x),xr(l,t.domain,s),Ft(l,bd,C),Ft(l,Ru,x),xr(O,t.domain,A),Ft(O,wd,A),Ft(O,Ow,A),xr(W,t.domain,A),xr(W,e,A),Ft(W,wd,A);const J=[[Lw,Pw],[aT,lT],[cT,uT],[hT,dT],[fT,pT],[mT,gT],[yT,vT],[_T,bT]];for(let Z=0;Z=0&&p++,i++,u++;if(p<0)i-=u,i0&&(o.push(xD(bG,e,s)),s=[]),i-=p,u-=p;const m=d.t,y=n.slice(i-u,i);o.push(xD(m,e,y))}}return s.length>0&&o.push(xD(bG,e,s)),o}function xD(t,e,n){const r=n[0].s,i=n[n.length-1].e,o=e.slice(r,i);return new t(o,n)}const k3e=typeof console<"u"&&console&&console.warn||(()=>{}),T3e="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",_o={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function M3e(){return cc.groups={},_o.scanner=null,_o.parser=null,_o.tokenQueue=[],_o.pluginQueue=[],_o.customSchemes=[],_o.initialized=!1,_o}function wG(t,e=!1){if(_o.initialized&&k3e(`linkifyjs: already initialized - will not register custom scheme "${t}" ${T3e}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. 1. Must only contain digits, lowercase ASCII letters or "-" 2. Cannot start or end with "-" 3. "-" cannot repeat`);_o.customSchemes.push([t,e])}function A3e(){_o.scanner=w3e(_o.customSchemes);for(let t=0;t<_o.tokenQueue.length;t++)_o.tokenQueue[t][1]({scanner:_o.scanner});_o.parser=S3e(_o.scanner.tokens);for(let t=0;t<_o.pluginQueue.length;t++)_o.pluginQueue[t][1]({scanner:_o.scanner,parser:_o.parser});return _o.initialized=!0,_o}function ED(t){return _o.initialized||A3e(),C3e(_o.parser.start,t,mG(_o.scanner.start,t))}ED.scan=mG;function xG(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new wD(n),i=ED(t),o=[];for(let s=0;s{const i=e.some(l=>l.docChanged)&&!n.doc.eq(r.doc),o=e.some(l=>l.getMeta("preventAutolink"));if(!i||o)return;const{tr:s}=r,a=TOe(n.doc,[...e]);if(NOe(a).forEach(({newRange:l})=>{const c=AOe(r.doc,l,p=>p.isTextblock);let u,d;if(c.length>1?(u=c[0],d=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ")):c.length&&r.doc.textBetween(l.from,l.to," "," ").endsWith(" ")&&(u=c[0],d=r.doc.textBetween(u.pos,l.to,void 0," ")),u&&d){const p=d.split(" ").filter(x=>x!=="");if(p.length<=0)return!1;const m=p[p.length-1],y=u.pos+d.lastIndexOf(m);if(!m)return!1;const w=ED(m).map(x=>x.toObject(t.defaultProtocol));if(!I3e(w))return!1;w.filter(x=>x.isLink).map(x=>({...x,from:y+x.start+1,to:y+x.end+1})).filter(x=>r.schema.marks.code?!r.doc.rangeHasMark(x.from,x.to,r.schema.marks.code):!0).filter(x=>t.validate(x.value)).filter(x=>t.shouldAutoLink(x.value)).forEach(x=>{LO(x.from,x.to,r.doc).some(C=>C.mark.type===t.type)||s.addMark(x.from,x.to,t.type.create({href:x.href}))})}}),!!s.steps.length)return s}})}function P3e(t){return new xs({key:new fa("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,o;if(r.button!==0||!e.editable)return!1;let s=r.target;const a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(p=>p.nodeName==="A"))return!1;const l=VH(e.state,t.type.name),c=r.target,u=(i=c==null?void 0:c.href)!==null&&i!==void 0?i:l.href,d=(o=c==null?void 0:c.target)!==null&&o!==void 0?o:l.target;return c&&u?(window.open(u,d),!0):!1}}})}function N3e(t){return new xs({key:new fa("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:i}=e,{selection:o}=i,{empty:s}=o;if(s)return!1;let a="";r.content.forEach(c=>{a+=c.textContent});const l=xG(a,{defaultProtocol:t.defaultProtocol}).find(c=>c.isLink&&c.value===a);return!a||!l?!1:(t.editor.commands.setMark(t.type,{href:l.href}),!0)}}})}const O3e=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function cy(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(O3e,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`,"i"))}const EG=sc.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){wG(t);return}wG(t.scheme,t.optionalSlashes)})},onDestroy(){M3e()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!cy(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!cy(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!cy(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ro(this.options.HTMLAttributes,t),0]:["a",ro(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!cy(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!cy(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[rm({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=xG(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:s=>!!cy(s,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(o=>e.push({text:o.value,data:{href:o.href},index:o.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(L3e({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!cy(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(P3e({type:this.type})),this.options.linkOnPaste&&t.push(N3e({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),SG=sc.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",ro(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=AO(t,this.type);return Object.entries(n).some(([,r])=>!!r)?!0:e.unsetMark(this.name)}}}}),CG=ma.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),D3e=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,kG=Pl.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",ro(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[nDe({find:D3e,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}});var SD,CD;if(typeof WeakMap<"u"){let t=new WeakMap;SD=e=>t.get(e),CD=(e,n)=>(t.set(e,n),n)}else{const t=[];let e=0;SD=n=>{for(let r=0;r(e==10&&(e=0),t[e++]=n,t[e++]=r)}var Go=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e=n){(o||(o=[])).push({type:"overlong_rowspan",pos:u,n:C-M});break}const E=i+M*e;for(let A=0;Ar&&(o+=c.attrs.colspan)}}for(let s=0;s1&&(n=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function F3e(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function z3e(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function bh(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function FT(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=i_(e.$head)||V3e(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function V3e(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function kD(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function j3e(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function TD(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function TG(t,e,n){const r=t.node(-1),i=Go.get(r),o=t.start(-1),s=i.nextCell(t.pos-o,e,n);return s==null?null:t.node(0).resolve(o+s)}function uy(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function MG(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;iu!=n.pos-o);l.unshift(n.pos-o);const c=l.map(u=>{const d=r.nodeAt(u);if(!d)throw RangeError(`No cell with offset ${u} found`);const p=o+u+1;return new G7(a.resolve(p),a.resolve(p+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(kD(r)&&kD(i)&&TD(r,i)){const o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?ap.rowSelection(r,i):o&&this.isColSelection()?ap.colSelection(r,i):new ap(r,i)}return qn.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Go.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},s=[];for(let l=i.top;l0||x>0){let C=y.attrs;if(w>0&&(C=uy(C,0,w)),x>0&&(C=uy(C,C.colspan-x,x)),m.lefti.bottom){const C={...y.attrs,rowspan:Math.min(m.bottom,i.bottom)-Math.max(m.top,i.top)};m.top0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=Go.get(r),o=e.start(-1),s=i.findCell(e.pos-o),a=i.findCell(n.pos-o),l=e.node(0);return s.top<=a.top?(s.top>0&&(e=l.resolve(o+i.map[s.left])),a.bottom0&&(n=l.resolve(o+i.map[a.left])),s.bottom0)return!1;const s=i+this.$anchorCell.nodeAfter.attrs.colspan,a=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,a)==n.width}eq(e){return e instanceof ap&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=Go.get(r),o=e.start(-1),s=i.findCell(e.pos-o),a=i.findCell(n.pos-o),l=e.node(0);return s.left<=a.left?(s.left>0&&(e=l.resolve(o+i.map[s.top*i.width])),a.right0&&(n=l.resolve(o+i.map[a.top*i.width])),s.right{e.push(Ll.node(r,r+n.nodeSize,{class:"selectedCell"}))}),Ho.create(t.doc,e)}function G3e({$from:t,$to:e}){if(t.pos==e.pos||t.pos=0&&!(t.after(i+1)=0&&!(e.before(o+1)>e.start(o));o--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function q3e({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const o=t.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}for(let i=e.depth;i>0;i--){const o=e.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){r=o;break}}return n!==r&&e.parentOffset===0}function Y3e(t,e,n){const r=(e||t).selection,i=(e||t).doc;let o,s;if(r instanceof Vn&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=io.create(i,r.from);else if(s=="row"){const a=i.resolve(r.from+1);o=io.rowSelection(a,a)}else if(!n){const a=Go.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];o=io.create(i,l+1,c)}}else r instanceof qn&&G3e(r)?o=qn.create(i,r.from):r instanceof qn&&q3e(r)&&(o=qn.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=t.tr)).setSelection(o),e}var Z3e=new fa("fix-tables");function AG(t,e,n,r){const i=t.childCount,o=e.childCount;e:for(let s=0,a=0;s{i.type.spec.tableRole=="table"&&(n=X3e(t,i,o,n))};return e?e.doc!=t.doc&&AG(e.doc,t.doc,0,r):t.doc.descendants(r),n}function X3e(t,e,n,r){const i=Go.get(e);if(!i.problems)return r;r||(r=t.tr);const o=[];for(let l=0;l0){let m="cell";u.firstChild&&(m=u.firstChild.type.spec.tableRole);const y=[];for(let x=0;x0?-1:0;U3e(e,r,i+o)&&(o=i==0||i==e.width?null:0);for(let s=0;s0&&i0&&e.map[a-1]==l||i0?-1:0;tBe(e,r,i+l)&&(l=i==0||i==e.height?null:0);for(let c=0,u=e.width*i;c0&&i0&&d==e.map[u-e.width]){const p=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...p,rowspan:p.rowspan-1}),c+=p.colspan-1}else if(i0&&n[o]==n[o-1]||r.right0&&n[i]==n[i-t]||r.bottomn[r.type.spec.tableRole])(t,e)}function aBe(t){return(e,n)=>{var r;const i=e.selection;let o,s;if(i instanceof io){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;o=i.$anchorCell.nodeAfter,s=i.$anchorCell.pos}else{if(o=z3e(i.$from),!o)return!1;s=(r=i_(i.$from))==null?void 0:r.pos}if(o==null||s==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(n){let a=o.attrs;const l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const u=xd(e),d=e.tr;for(let m=0;m{s.attrs[t]!==e&&o.setNodeMarkup(a,null,{...s.attrs,[t]:e})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(o)}return!0}}function cBe(t){return function(e,n){if(!bh(e))return!1;if(n){const r=il(e.schema),i=xd(e),o=e.tr,s=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=s.map(l=>i.table.nodeAt(l));for(let l=0;l{const m=p+o.tableStart,y=s.doc.nodeAt(m);y&&s.setNodeMarkup(m,d,y.attrs)}),r(s)}return!0}}Fw("row",{useDeprecatedLogic:!0}),Fw("column",{useDeprecatedLogic:!0});var uBe=Fw("cell",{useDeprecatedLogic:!0});function hBe(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const o=t.node(-1).child(r),s=o.lastChild;if(s)return i-1-s.nodeSize;i-=o.nodeSize}}else{if(t.index()0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function $T(t,e){const n=t.selection;if(!(n instanceof io))return!1;if(e){const r=t.tr,i=il(t.schema).cell.createAndFill().content;n.forEachCell((o,s)=>{o.content.eq(i)||r.replace(r.mapping.map(s+1),r.mapping.map(s+o.nodeSize-1),new Zt(i,0,0))}),r.docChanged&&e(r)}return!0}function fBe(t){if(!t.size)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),o=i.type.spec.tableRole,s=i.type.schema,a=[];if(o=="row")for(let l=0;l=0;s--){const{rowspan:a,colspan:l}=o.child(s).attrs;for(let c=i;c=e.length&&e.push(Mt.empty),n[i]r&&(p=p.type.createChecked(uy(p.attrs,p.attrs.colspan,u+p.attrs.colspan-r),p.content)),c.push(p),u+=p.attrs.colspan;for(let m=1;mi&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),l.push(d)}o.push(Mt.from(l))}n=o,e=i}return{width:t,height:e,rows:n}}function gBe(t,e,n,r,i,o,s){const a=t.doc.type.schema,l=il(a);let c,u;if(i>e.width)for(let d=0,p=0;de.height){const d=[];for(let y=0,w=(e.height-1)*e.width;y=e.width?!1:n.nodeAt(e.map[w+y]).type==l.header_cell;d.push(x?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const p=l.row.create(null,Mt.from(d)),m=[];for(let y=e.height;y{if(!i)return!1;const o=n.selection;if(o instanceof io)return zT(n,r,Gn.near(o.$headCell,e));if(t!="horiz"&&!o.empty)return!1;const s=VG(i,t,e);if(s==null)return!1;if(t=="horiz")return zT(n,r,Gn.near(n.doc.resolve(o.head+e),e));{const a=n.doc.resolve(s),l=TG(a,t,e);let c;return l?c=Gn.near(l,1):e<0?c=Gn.near(n.doc.resolve(a.before(-1)),-1):c=Gn.near(n.doc.resolve(a.after(-1)),1),zT(n,r,c)}}}function jT(t,e){return(n,r,i)=>{if(!i)return!1;const o=n.selection;let s;if(o instanceof io)s=o;else{const l=VG(i,t,e);if(l==null)return!1;s=new io(n.doc.resolve(l))}const a=TG(s.$headCell,t,e);return a?zT(n,r,new io(s.$anchorCell,a)):!1}}function vBe(t,e){const n=t.state.doc,r=i_(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new io(r))),!0):!1}function _Be(t,e,n){if(!bh(t.state))return!1;let r=fBe(n);const i=t.state.selection;if(i instanceof io){r||(r={width:1,height:1,rows:[Mt.from(MD(il(t.state.schema).cell,n))]});const o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),a=Go.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=mBe(r,a.right-a.left,a.bottom-a.top),zG(t.state,t.dispatch,s,a,r),!0}else if(r){const o=FT(t.state),s=o.start(-1);return zG(t.state,t.dispatch,s,Go.get(o.node(-1)).findCell(o.pos-s),r),!0}else return!1}function bBe(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=jG(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof io)o(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=i_(t.state.selection.$anchor))!=null&&((n=AD(t,e))==null?void 0:n.pos)!=i.pos)o(i,e),e.preventDefault();else if(!r)return;function o(l,c){let u=AD(t,c);const d=cm.getState(t.state)==null;if(!u||!TD(l,u))if(d)u=l;else return;const p=new io(l,u);if(d||!t.state.selection.eq(p)){const m=t.state.tr.setSelection(p);d&&m.setMeta(cm,l.pos),t.dispatch(m)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",a),cm.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(cm,-1))}function a(l){const c=l,u=cm.getState(t.state);let d;if(u!=null)d=t.state.doc.resolve(u);else if(jG(t,c.target)!=r&&(d=AD(t,e),!d))return s();d&&o(d,c)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",a)}function VG(t,e,n){if(!(t.state.selection instanceof qn))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const s=r.before(i),a=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(a)?s:null}}return null}function jG(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function AD(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?i_(t.state.doc.resolve(n.pos)):null}var wBe=class{constructor(t,e){this.node=t,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ID(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,ID(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function ID(t,e,n,r,i,o){var s;let a=0,l=!0,c=e.firstChild;const u=t.firstChild;if(u){for(let d=0,p=0;dnew r(p,n,m)),new EBe(-1,!1)},apply(s,a){return a.apply(s)}},props:{attributes:s=>{const a=Vc.getState(s);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,a)=>{SBe(s,a,t,i)},mouseleave:s=>{CBe(s)},mousedown:(s,a)=>{kBe(s,a,e,n)}},decorations:s=>{const a=Vc.getState(s);if(a&&a.activeHandle>-1)return LBe(s,a.activeHandle)},nodeViews:{}}});return o}var EBe=class IA{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Vc);if(r&&r.setHandle!=null)return new IA(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new IA(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return kD(e.doc.resolve(i))||(i=-1),new IA(i,n.dragging)}return n}};function SBe(t,e,n,r){if(!t.editable)return;const i=Vc.getState(t.state);if(i&&!i.dragging){const o=MBe(e.target);let s=-1;if(o){const{left:a,right:l}=o.getBoundingClientRect();e.clientX-a<=n?s=UG(t,e,"left",n):l-e.clientX<=n&&(s=UG(t,e,"right",n))}if(s!=i.activeHandle){if(!r&&s!==-1){const a=t.state.doc.resolve(s),l=a.node(-1),c=Go.get(l),u=a.start(-1);if(c.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==c.width-1)return}WG(t,s)}}}function CBe(t){if(!t.editable)return;const e=Vc.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&WG(t,-1)}function kBe(t,e,n,r){var i;if(!t.editable)return!1;const o=(i=t.dom.ownerDocument.defaultView)!=null?i:window,s=Vc.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const a=t.state.doc.nodeAt(s.activeHandle),l=TBe(t,s.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(Vc,{setDragging:{startX:e.clientX,startWidth:l}}));function c(d){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",u);const p=Vc.getState(t.state);p!=null&&p.dragging&&(ABe(t,p.activeHandle,HG(p.dragging,d,n)),t.dispatch(t.state.tr.setMeta(Vc,{setDragging:null})))}function u(d){if(!d.which)return c(d);const p=Vc.getState(t.state);if(p&&p.dragging){const m=HG(p.dragging,d,n);GG(t,p.activeHandle,m,r)}}return GG(t,s.activeHandle,l,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",u),e.preventDefault(),!0}function TBe(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const o=t.domAtPos(e);let s=o.node.childNodes[o.offset].offsetWidth,a=n;if(r)for(let l=0;l{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function RBe(t,e,n,r,i){const o=DBe(t),s=[],a=[];for(let c=0;c{const{selection:e}=t.state;if(!BBe(e))return!1;let n=0;const r=$H(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},ZG=Pl.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:NBe,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:i}=OBe(t,this.options.cellMinWidth);return["table",ro(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]]},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:o})=>{const s=RBe(o.schema,t,e,n);if(i){const a=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(qn.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>K3e(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>J3e(t,e),deleteColumn:()=>({state:t,dispatch:e})=>eBe(t,e),addRowBefore:()=>({state:t,dispatch:e})=>nBe(t,e),addRowAfter:()=>({state:t,dispatch:e})=>rBe(t,e),deleteRow:()=>({state:t,dispatch:e})=>oBe(t,e),deleteTable:()=>({state:t,dispatch:e})=>dBe(t,e),mergeCells:()=>({state:t,dispatch:e})=>OG(t,e),splitCell:()=>({state:t,dispatch:e})=>DG(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Fw("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Fw("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>uBe(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>OG(t,e)?!0:DG(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>lBe(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>BG(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>BG(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&IG(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=io.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:UT,"Mod-Backspace":UT,Delete:UT,"Mod-Delete":UT}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[xBe({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],PBe({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:wr(gn(t,"tableRole",e))}}}),XG=ma.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign||this.options.defaultAlignment;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${t.textAlign}`}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e)}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),KG=Pl.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",ro(this.options.HTMLAttributes,t),0]}}),JG=Pl.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",ro(this.options.HTMLAttributes,t),0]}}),QG=Pl.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",ro(this.options.HTMLAttributes,t),0]}}),eq=Pl.create({name:"doc",topNode:!0,content:"block+"});class qo extends Gn{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return qo.valid(r)?new qo(r):Gn.near(r)}content(){return Zt.empty}eq(e){return e instanceof qo&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new qo(e.resolve(n.pos))}getBookmark(){return new PD(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!FBe(e)||!$Be(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&qo.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)0){o=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=n;let l=e.doc.resolve(i);if(qo.valid(l))return l}for(;;){let s=n>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!Vn.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=s,i+=n;let a=e.doc.resolve(i);if(qo.valid(a))return a}return null}}}qo.prototype.visible=!1,qo.findFrom=qo.findGapCursorFrom,Gn.jsonID("gapcursor",qo);class PD{constructor(e){this.pos=e}map(e){return new PD(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return qo.valid(n)?new qo(n):Gn.near(n)}}function FBe(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function $Be(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function zBe(){return new xs({props:{decorations:HBe,createSelectionBetween(t,e,n){return e.pos==n.pos&&qo.valid(n)?new qo(n):null},handleClick:jBe,handleKeyDown:VBe,handleDOMEvents:{beforeinput:UBe}}})}const VBe=pO({ArrowLeft:HT("horiz",-1),ArrowRight:HT("horiz",1),ArrowUp:HT("vert",-1),ArrowDown:HT("vert",1)});function HT(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof qn){if(!o.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=qo.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new qo(c))),!0):!1}}function jBe(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!qo.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Vn.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new qo(r))),!0)}function UBe(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof qo))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=Mt.empty;for(let s=r.length-1;s>=0;s--)i=Mt.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new Zt(i,0,0));return o.setSelection(qn.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function HBe(t){if(!(t.selection instanceof qo))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Ho.create(t.doc,[Ll.widget(t.selection.head,e,{key:"gapcursor"})])}const tq=ma.create({name:"gapCursor",addProseMirrorPlugins(){return[zBe()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=wr(gn(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),nq=Pl.create({name:"text",group:"inline"}),rq=ma.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;return(e=t.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),ol=(t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n},WBe={props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function GBe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("button",{onClick:e[0]||(e[0]=(...s)=>o.toggleBlockquote&&o.toggleBlockquote(...s)),class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none"},e[1]||(e[1]=[g.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[g.createElementVNode("path",{"fill-rule":"evenodd",d:"M6 6a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3H5a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2H6Zm9 0a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3h-1a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3Z"})],-1)]))}const qBe=ol(WBe,[["render",GBe]]),YBe={props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function ZBe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("button",{onClick:e[0]||(e[0]=(...s)=>o.toggleBulletList&&o.toggleBulletList(...s)),class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100"},e[1]||(e[1]=[g.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 8h10M9 12h10M9 16h10M4.99 8H5m-.02 4h.01m0 4H5"})],-1)]))}const XBe=ol(YBe,[["render",ZBe]]),KBe={props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function JBe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("button",{onClick:e[0]||(e[0]=(...s)=>o.toggleOrderedList&&o.toggleOrderedList(...s)),class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100"},e[1]||(e[1]=[g.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6h8m-8 6h8m-8 6h8M4 16a2 2 0 1 1 3.321 1.5L4 20h5M4 5l2-1v6m-2 0h4"})],-1)]))}const QBe=ol(KBe,[["render",JBe]]),eFe={props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function tFe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("button",{onClick:e[0]||(e[0]=(...s)=>o.toggleCodeBlock&&o.toggleCodeBlock(...s)),class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100"},e[1]||(e[1]=[g.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8 8-4 4 4 4m8 0 4-4-4-4m-2-3-4 14"})],-1)]))}const nFe=ol(eFe,[["render",tFe]]),rFe={props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.chain().toggleBold().run()}}};function iFe(t,e,n,r,i,o){var s;return g.openBlock(),g.createElementBlock("button",{onClick:e[0]||(e[0]=(...a)=>o.toggleBold&&o.toggleBold(...a)),class:g.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":(s=n.editor)==null?void 0:s.isActive("bold")}])},e[1]||(e[1]=[g.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 5h4.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0-7H6m2 7h6.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0 0H6"})],-1),g.createElementVNode("span",{class:"sr-only"},"Bold",-1)]),2)}const oFe=ol(rFe,[["render",iFe]]),sFe={props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function aFe(t,e,n,r,i,o){var s;return g.openBlock(),g.createElementBlock("button",{onClick:e[0]||(e[0]=(...a)=>o.toggleItalic&&o.toggleItalic(...a)),class:g.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":(s=n.editor)==null?void 0:s.isActive("italic")}])},e[1]||(e[1]=[g.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8.874 19 6.143-14M6 19h6.33m-.66-14H18"})],-1),g.createElementVNode("span",{class:"sr-only"},"Italic",-1)]),2)}const lFe=ol(sFe,[["render",aFe]]),$w=async(t,e,n,r=10)=>{var w,x,C,S;if(!e||!n)return;await g.nextTick();const i=await(n==null?void 0:n.getBoundingClientRect()),o=await(e==null?void 0:e.getBoundingClientRect());if(!o||!i)return;const s=await parseInt((w=e==null?void 0:e.getBoundingClientRect())==null?void 0:w.height),a=await parseInt((x=e==null?void 0:e.getBoundingClientRect())==null?void 0:x.width),l=await parseInt((C=n==null?void 0:n.getBoundingClientRect())==null?void 0:C.height),c=await parseInt((S=n==null?void 0:n.getBoundingClientRect())==null?void 0:S.width),u=await window.innerHeight,d=await window.innerWidth;let p=0,m=0;const y=o.bottom+r+l;switch(t){case"top":o.top-i.height-r<0?p=o.top-i.height+r+l+s:p=o.top-i.height-r,d>c+o.right+30?m=o.left-i.width/2+o.width/2:m=d-30-c;break;case"bottom":u>y?p=o.bottom+r:p=o.bottom-r-l-s,m=o.left-i.width/2+o.width/2;break;case"left":p=o.top-i.height/2+o.height/2,o.left-i.width-r>0?m=o.left-i.width-r:m=10;break;case"right":p=o.top-i.height/2+o.height/2,d-a>c?m=o.right+r:m=d-30-c;break;case"top-right":o.top-i.height-r<0?p=o.top-i.height+r+l+s:p=o.top-i.height-r,d-a>c?m=o.right+r:m=d-30-c;break;case"top-left":o.top-i.height-r<0?p=o.top-i.height+r+l+s:p=o.top-i.height-r,o.left-i.width-r>0?m=o.left-i.width-r:m=10;break;case"top-start":o.top-i.height-r<0?p=o.top-i.height+r+l+s:p=o.top-i.height-r,o.left>0?m=o.left:m=10;break;case"bottom-right":u>y?p=o.bottom+r:p=o.bottom-r-l-s,d-a>c?m=o.left:m=d-30-c;break;case"bottom-left":u>y?p=o.bottom+r:p=o.bottom-r-l-s,o.left>0?m=o.right-c:m=10;break;case"bottom-start":u>y?p=o.bottom+r:p=o.bottom-r-l-s,o.left>0?m=o.left:m=10;break}p+l>u?p=u-l-r:p<0&&(p=r),m+c>d?m=d-c-r:m<0&&(m=r),n instanceof HTMLElement&&(n.style.top=`${p}px`,n.style.left=`${m}px`,n.style.position="fixed")},cFe={class:"text-center"},uFe={class:"py-2 px-4 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},zw={__name:"vs-popover",props:{isOpen:{type:Boolean,default:()=>!1},placement:{type:String,default:"top"},gap:{type:Number,default:8},width:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},trigger:{type:String,default:"click"},teleport:{type:String,default:"#modal"}},emits:["isvisible"],setup(t,{expose:e,emit:n}){const r=t,i=n,o=g.ref(!1),s=g.ref([]),a=g.ref(null),l=g.ref(null),c=g.ref(null);g.watch(o,M=>{M?(u(),window.addEventListener("resize",()=>$w(r.placement,l.value,c.value)),$w(r.placement,l.value,c.value)):window.removeEventListener("resize",()=>$w(r.placement,l.value,c.value)),i("isvisible",M)}),g.onMounted(()=>{window.addEventListener("click",x),window.addEventListener("popstate",C),window.addEventListener("scroll",S,!0),u()}),g.onBeforeUnmount(()=>{window.removeEventListener("click",x),window.removeEventListener("popstate",C),d()});const u=()=>{let M=a.value;for(;M&&M!==document.body;)(M.scrollHeight>M.clientHeight||M.scrollWidth>M.clientWidth)&&(M.addEventListener("scroll",w),s.value.push(M)),M=M.parentElement;document.body&&(document.body.addEventListener("scroll",w),s.value.push(document.body))},d=()=>{s.value.forEach(M=>{M.removeEventListener("scroll",w)}),s.value=[]},p=()=>{o.value=!0,$w(r.placement,l.value,c.value)},m=()=>{o.value=!1},y=async()=>{await $w(r.placement,l.value,c.value),o.value=!o.value},w=()=>{o.value=!1},x=M=>{var E,A;if(!M){o.value=!1;return}(E=l.value)!=null&&E.contains(M.target)||(A=c.value)!=null&&A.contains(M.target)||(o.value=!1)},C=()=>{o.value&&(o.value=!1)},S=M=>{o.value&&c.value&&!c.value.contains(M.target)&&(o.value=!1)};return e({togglePopover:y}),(M,E)=>(g.openBlock(),g.createElementBlock("div",{ref_key:"popover",ref:a,class:"vs-popover inline-block"},[g.createElementVNode("div",cFe,[t.trigger==="click"?(g.openBlock(),g.createElementBlock("div",{key:0,ref_key:"popoverRef",ref:l,onClick:y,class:g.normalizeClass({"pointer-events-none":t.disabled})},[g.renderSlot(M.$slots,"reference",{},()=>[E[0]||(E[0]=g.createElementVNode("button",null,"Click me!",-1))])],2)):g.createCommentVNode("",!0),t.trigger==="hover"?(g.openBlock(),g.createElementBlock("div",{key:1,ref_key:"popoverRef",ref:l,onMouseover:p,onMouseleave:m,class:g.normalizeClass({"pointer-events-none":t.disabled})},[g.renderSlot(M.$slots,"reference",{},()=>[E[1]||(E[1]=g.createElementVNode("button",null,"Click me!",-1))])],34)):g.createCommentVNode("",!0),(g.openBlock(),g.createBlock(g.Teleport,{to:t.teleport},[g.createVNode(g.Transition,{name:"fade"},{default:g.withCtx(()=>[g.withDirectives(g.createElementVNode("div",{class:g.normalizeClass(["vsTailwind vs-popover__content",t.placement]),ref_key:"contentPop",ref:c,style:g.normalizeStyle({width:t.width?t.width+"px":"fit-content",zIndex:10002})},[g.createElementVNode("div",uFe,[g.renderSlot(M.$slots,"default",{},()=>[E[2]||(E[2]=g.createElementVNode("span",null,"Popover content",-1))])])],6),[[g.vShow,o.value]])]),_:3})],8,["to"]))])],512))}},hFe={class:"w-[30px] h-[30px] rounded-full hover:bg-gray-100 justify-center items-center relative flex"},dFe={class:"flex w-[160px] flex-wrap gap-[4px]"},fFe=["onClick"],pFe={__name:"vs-editor-color",props:{editor:Object},setup(t){const e=t,n=g.ref("popover"),r=g.ref("#000000"),i=g.ref(["#000000","#0055CC","#206A83","#216E4E","#E56910","#AE2E24","#5E4DB2","#758195","#FF0000","#008000","#28A9AB","#AB7222"]),o=s=>{e.editor&&(e.editor.chain().focus().setColor(s).run(),r.value=s,n.value&&n.value.togglePopover())};return(s,a)=>(g.openBlock(),g.createBlock(zw,{ref_key:"popover",ref:n,placement:"bottom"},{reference:g.withCtx(()=>[g.createElementVNode("button",hFe,[a[0]||(a[0]=g.createElementVNode("svg",{class:"text-gray-500",height:"16",width:"16","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 19.2H5.5c-.3 0-.5-.2-.5-.5V16c0-.2.2-.4.5-.4h13c.3 0 .5.2.5.4v2.7c0 .3-.2.5-.5.5H18m-6-1 1.4 1.8h.2l1.4-1.7m-7-5.4L12 4c0-.1 0-.1 0 0l4 8.8m-6-2.7h4m-7 2.7h2.5m5 0H17"})],-1)),g.createElementVNode("span",{class:"absolute h-[2px] w-[40%] bottom-[10px] left-[9px]",style:g.normalizeStyle({backgroundColor:r.value})},null,4)])]),default:g.withCtx(()=>[g.createElementVNode("div",null,[g.createElementVNode("ul",dFe,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(i.value,l=>(g.openBlock(),g.createElementBlock("li",{class:"h-[37px] w-[37px] rounded",style:g.normalizeStyle({backgroundColor:l}),onClick:c=>o(l),key:l},null,12,fFe))),128))])])]),_:1},512))}},mFe={__name:"vs-editor-underline",props:{editor:Object},setup(t){const e=t,n=()=>{e.editor&&e.editor.chain().focus().toggleUnderline().run()};return(r,i)=>{var o;return g.openBlock(),g.createElementBlock("button",{onClick:n,class:g.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[(o=t.editor)!=null&&o.isActive("underline")?"bg-gray-100 text-gray-900":"text-gray-500"]])},i[0]||(i[0]=[g.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[g.createElementVNode("path",{d:"M6 4v6a6 6 0 0 0 12 0V4"}),g.createElementVNode("line",{x1:"4",x2:"20",y1:"20",y2:"20"})],-1)]),2)}}},gFe={__name:"vs-editor-strike",props:{editor:Object},setup(t){const e=t,n=()=>{e.editor&&e.editor.chain().focus().toggleStrike().run()};return(r,i)=>{var o;return g.openBlock(),g.createElementBlock("button",{onClick:n,class:g.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[(o=t.editor)!=null&&o.isActive("strike")?"bg-gray-100 text-gray-900":"text-gray-500"]])},i[0]||(i[0]=[g.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-strikethrough"},[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g.createElementVNode("path",{d:"M5 12l14 0"}),g.createElementVNode("path",{d:"M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5"})],-1)]),2)}}},yFe={props:{visible:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},size:{type:String,default:()=>""},closeClickBack:{type:Boolean,default:()=>!1}},emits:["update:visible","onClose"],name:"vs-dialog",mounted(){window.addEventListener("keydown",this.checkKey)},unmounted(){window.removeEventListener("keydown",this.checkKey)},computed:{hasSlot(){var t;return!!((t=this.$slots)!=null&&t.footer)},checkSize(){return this.size==="small"?"md:w-5/12 w-9/12":this.size==="medium"?"md:w-6/12 w-9/12":"lg:w-7/12 w-11/12"}},methods:{checkKey({key:t}){t==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("onClose")},closeByClickBack(t,e){e&&t.target.classList.contains("vs-dialog-overlay")&&this.handleClose()}}},vFe={key:0,class:"vsTailwind ui-dialog__wrapper"},_Fe={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},bFe={class:"font-medium text-gray-800 dark:text-[#ffffff]"},wFe={class:"ui-dialog__content p-4"},xFe={key:0,class:"flex justify-end gap-x-2"};function EFe(t,e,n,r,i,o){return g.openBlock(),g.createBlock(g.Teleport,{to:"#modal"},[n.visible?(g.openBlock(),g.createElementBlock("div",vFe,[g.createElementVNode("div",{onMousedown:e[1]||(e[1]=s=>o.closeByClickBack(s,n.closeClickBack)),class:"vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},[g.createVNode(g.Transition,{name:"content",appear:""},{default:g.withCtx(()=>[g.createElementVNode("div",{class:g.normalizeClass(["ui-dialog__modal opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",[o.checkSize]])},[g.createElementVNode("div",_Fe,[g.createElementVNode("h3",bFe,g.toDisplayString(n.title),1),g.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:e[0]||(e[0]=(...s)=>o.handleClose&&o.handleClose(...s))},e[2]||(e[2]=[g.createElementVNode("span",{class:"sr-only"},"Close",-1),g.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[g.createElementVNode("path",{d:"M18 6 6 18"}),g.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),g.createElementVNode("div",wFe,[g.renderSlot(t.$slots,"default",{},void 0,!0)]),o.hasSlot?(g.openBlock(),g.createElementBlock("div",xFe,[g.renderSlot(t.$slots,"footer",{handleClose:o.handleClose},void 0,!0)])):g.createCommentVNode("",!0)],2)]),_:3})],32)])):g.createCommentVNode("",!0)])}const SFe=ol(yFe,[["render",EFe],["__scopeId","data-v-6d4e684d"]]),CFe={},kFe={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function TFe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",kFe,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),g.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const MFe=ol(CFe,[["render",TFe]]),AFe={},IFe={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search"};function LFe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",IFe,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),g.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const PFe=ol(AFe,[["render",LFe]]),NFe={},OFe={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-mail"};function DFe(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",OFe,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"},null,-1),g.createElementVNode("path",{d:"M3 7l9 6l9 -6"},null,-1)]))}const RFe=ol(NFe,[["render",DFe]]),BFe=g.defineComponent({components:{IconClose:MFe,IconSearch:PFe,IconEmail:RFe},props:{icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},modelValue:{type:String,default:()=>""},placeholder:{type:String,default:()=>""},iconPosition:{type:String,default:()=>"right"},type:{type:String,default:()=>"text"},style:{type:Object,default:()=>null},size:{type:String,default:()=>"md"},attrs:{type:Object,default:()=>{}}},emits:["onInput","update:modelValue","blur","focus"],computed:{checkSize(){var t,e,n;if((((t=this.style)==null?void 0:t.size)||this.size)==="xs")return"h-[32px] text-sm";if((((e=this.style)==null?void 0:e.size)||this.size)==="md")return"h-[38px] text-sm";(n=this.style)!=null&&n.size||this.size},value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t.trim())}},clearIconStyle(){return[{"right-8":this.icon&&this.iconPosition==="right","right-3":!this.icon||this.iconPosition!=="right","pointer-events-none":this.disabled}]},iconStylePosition(){return[{"left-3":this.icon&&this.iconPosition==="left","right-3":this.icon&&this.iconPosition==="right"}]},inputStyle(){return[{"!pr-8":this.clearable&&!this.icon,"!pr-7":this.clearable,"!pr-16":this.clearable&&this.icon&&this.iconPosition==="right","!pl-8":this.icon&&this.iconPosition==="left","!pr-[50px]":this.clearable&&this.value&&this.icon&&this.iconPosition==="right","!cursor-not-allowed bg-slate-100":this.disabled,"bg-white":!this.disabled}]}},methods:{handleInput(){this.$emit("onInput",this.modelValue)},handleBlur(){this.$emit("blur")},handleFocus(){this.$emit("focus")},clearInput(){this.$emit("update:modelValue",""),this.$emit("onInput","")},async inputFocus(){const{vsText:t}=await this.$refs;await t.focus()}}}),FFe={class:"vs-form-text relative bg-white rounded-lg"},$Fe={key:2,class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},zFe=["disabled","type","placeholder"];function VFe(t,e,n,r,i,o){var c;const s=g.resolveComponent("IconClose"),a=g.resolveComponent("IconSearch"),l=g.resolveComponent("IconEmail");return g.openBlock(),g.createElementBlock("div",FFe,[t.clearable&&t.value?(g.openBlock(),g.createElementBlock("div",{key:0,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:e[0]||(e[0]=(...u)=>t.clearInput&&t.clearInput(...u))},[g.createVNode(s,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500 transition-all"})])):g.createCommentVNode("",!0),t.icon&&t.icon==="search"?(g.openBlock(),g.createElementBlock("div",{key:1,class:g.normalizeClass(["absolute bottom-2/4 translate-y-2/4 cursor-pointer",t.iconStylePosition])},[g.createVNode(a,{width:"15px",height:"15px",class:"stroke-gray-500 transition-all"})],2)):t.icon&&t.icon==="email"?(g.openBlock(),g.createElementBlock("div",$Fe,[g.createVNode(l,{width:"16",height:"16",class:"stroke-gray-500 transition-all"})])):(g.openBlock(),g.createElementBlock("i",{key:3,class:g.normalizeClass(["absolute bottom-2/4 translate-y-2/4 text-gray-500 cursor-pointer",["ti "+t.icon,t.iconStylePosition]])},null,2)),t.clearable&&t.value?(g.openBlock(),g.createElementBlock("div",{key:4,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:e[1]||(e[1]=(...u)=>t.clearInput&&t.clearInput(...u))},[g.createVNode(s,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500 transition-all"})])):g.createCommentVNode("",!0),g.withDirectives(g.createElementVNode("input",g.mergeProps({ref:"vsText",disabled:t.disabled,type:t.type,onInput:e[2]||(e[2]=(...u)=>t.handleInput&&t.handleInput(...u)),placeholder:t.placeholder,"onUpdate:modelValue":e[3]||(e[3]=u=>t.value=u)},((c=t.style)==null?void 0:c.attrs)||t.attrs||{},{onFocus:e[4]||(e[4]=(...u)=>t.handleFocus&&t.handleFocus(...u)),onBlur:e[5]||(e[5]=(...u)=>t.handleBlur&&t.handleBlur(...u)),class:[[t.inputStyle,t.checkSize],"py-2 px-3 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg text-sm text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"]}),null,16,zFe),[[g.vModelDynamic,t.value]])])}const iq=ol(BFe,[["render",VFe],["__scopeId","data-v-00f5150b"]]);/*! * shared v11.1.7 * (c) 2025 kazuya kawaguchi * Released under the MIT License. */const wh=typeof window<"u";let jc,hy;if(_n.NODE_ENV!=="production"){const t=wh&&window.performance;t&&t.mark&&t.measure&&t.clearMarks&&t.clearMeasures&&(jc=e=>{t.mark(e)},hy=(e,n,r)=>{t.measure(e,n,r),t.clearMarks(n),t.clearMarks(r)})}const jFe=/\{([0-9a-zA-Z]+)\}/g;function WT(t,...e){return e.length===1&&gi(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),t.replace(jFe,(n,r)=>e.hasOwnProperty(r)?e[r]:"")}const Ed=(t,e=!1)=>e?Symbol.for(t):Symbol(t),UFe=(t,e,n)=>HFe({l:t,k:e,s:n}),HFe=t=>JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),Es=t=>typeof t=="number"&&isFinite(t),WFe=t=>ND(t)==="[object Date]",o_=t=>ND(t)==="[object RegExp]",GT=t=>Jr(t)&&Object.keys(t).length===0,js=Object.assign,GFe=Object.create,Hi=(t=null)=>GFe(t);let oq;const dy=()=>oq||(oq=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:Hi());function sq(t){return t.replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}const qFe=Object.prototype.hasOwnProperty;function xh(t,e){return qFe.call(t,e)}const zo=Array.isArray,Ji=t=>typeof t=="function",sn=t=>typeof t=="string",wi=t=>typeof t=="boolean",gi=t=>t!==null&&typeof t=="object",YFe=t=>gi(t)&&Ji(t.then)&&Ji(t.catch),aq=Object.prototype.toString,ND=t=>aq.call(t),Jr=t=>ND(t)==="[object Object]",ZFe=t=>t==null?"":zo(t)||Jr(t)&&t.toString===aq?JSON.stringify(t,null,2):String(t);function OD(t,e=""){return t.reduce((n,r,i)=>i===0?n+r:n+e+r,"")}const lq=2;function XFe(t,e=0,n=t.length){const r=t.split(/\r?\n/);let i=0;const o=[];for(let s=0;s=e){for(let a=s-lq;a<=s+lq||n>i;a++){if(a<0||a>=r.length)continue;const l=a+1;o.push(`${l}${" ".repeat(3-String(l).length)}| ${r[a]}`);const c=r[a].length;if(a===s){const u=e-(i-c)+1,d=Math.max(1,n>i?c-u:n-e);o.push(" | "+" ".repeat(u)+"^".repeat(d))}else if(a>s){if(n>i){const u=Math.max(Math.min(n-i,c),1);o.push(" | "+"^".repeat(u))}i+=c+1}}break}return o.join(` `)}function um(t,e){typeof console<"u"&&(console.warn("[intlify] "+t),e&&console.warn(e.stack))}const cq={};function DD(t){cq[t]||(cq[t]=!0,um(t))}function RD(){const t=new Map;return{events:t,on(e,n){const r=t.get(e);r&&r.push(n)||t.set(e,[n])},off(e,n){const r=t.get(e);r&&r.splice(r.indexOf(n)>>>0,1)},emit(e,n){(t.get(e)||[]).slice().map(r=>r(n)),(t.get("*")||[]).slice().map(r=>r(e,n))}}}const qT=t=>!gi(t)||zo(t);function YT(t,e){if(qT(t)||qT(e))throw new Error("Invalid value");const n=[{src:t,des:e}];for(;n.length;){const{src:r,des:i}=n.pop();Object.keys(r).forEach(o=>{o!=="__proto__"&&(gi(r[o])&&!gi(i[o])&&(i[o]=Array.isArray(r[o])?[]:Hi()),qT(i[o])||qT(r[o])?i[o]=r[o]:n.push({src:r[o],des:i[o]}))})}}/*! * message-compiler v11.1.7 * (c) 2025 kazuya kawaguchi * Released under the MIT License. */function KFe(t,e,n){return{line:t,column:e,offset:n}}function BD(t,e,n){return{start:t,end:e}}const Jn={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16},JFe=17,QFe={[Jn.EXPECTED_TOKEN]:"Expected token: '{0}'",[Jn.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[Jn.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[Jn.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[Jn.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[Jn.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[Jn.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[Jn.EMPTY_PLACEHOLDER]:"Empty placeholder",[Jn.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[Jn.INVALID_LINKED_FORMAT]:"Invalid linked format",[Jn.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[Jn.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[Jn.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[Jn.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[Jn.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[Jn.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function s_(t,e,n={}){const{domain:r,messages:i,args:o}=n,s=_n.NODE_ENV!=="production"?WT((i||QFe)[t]||"",...o||[]):t,a=new SyntaxError(String(s));return a.code=t,e&&(a.location=e),a.domain=r,a}function e5e(t){throw t}const t5e=/<\/?[\w\s="/.':;#-\/]+>/,n5e=t=>t5e.test(t),jf=" ",r5e="\r",uc=` `,i5e="\u2028",o5e="\u2029";function s5e(t){const e=t;let n=0,r=1,i=1,o=0;const s=O=>e[O]===r5e&&e[O+1]===uc,a=O=>e[O]===uc,l=O=>e[O]===o5e,c=O=>e[O]===i5e,u=O=>s(O)||a(O)||l(O)||c(O),d=()=>n,p=()=>r,m=()=>i,y=()=>o,w=O=>s(O)||l(O)||c(O)?uc:e[O],x=()=>w(n),C=()=>w(n+o);function S(){return o=0,u(n)&&(r++,i=0),s(n)&&n++,n++,i++,e[n]}function M(){return s(n+o)&&o++,o++,e[n+o]}function E(){n=0,r=1,i=1,o=0}function A(O=0){o=O}function I(){const O=n+o;for(;O!==n;)S();o=0}return{index:d,line:p,column:m,peekOffset:y,charAt:w,currentChar:x,currentPeek:C,next:S,peek:M,reset:E,resetPeek:A,skipToPeek:I}}const hm=void 0,uq="'",a5e="tokenizer";function l5e(t,e={}){const n=e.location!==!1,r=s5e(t),i=()=>r.index(),o=()=>KFe(r.line(),r.column(),r.index()),s=o(),a=i(),l={currentType:13,offset:a,startLoc:s,endLoc:s,lastType:13,lastOffset:a,lastStartLoc:s,lastEndLoc:s,braceNest:0,inLinked:!1,text:""},c=()=>l,{onError:u}=e;function d(Ue,qe,Et,...qt){const rn=c();if(qe.column+=Et,qe.offset+=Et,u){const it=n?BD(rn.startLoc,qe):null,St=s_(Ue,it,{domain:a5e,args:qt});u(St)}}function p(Ue,qe,Et){Ue.endLoc=o(),Ue.currentType=qe;const qt={type:qe};return n&&(qt.loc=BD(Ue.startLoc,Ue.endLoc)),Et!=null&&(qt.value=Et),qt}const m=Ue=>p(Ue,13);function y(Ue,qe){return Ue.currentChar()===qe?(Ue.next(),qe):(d(Jn.EXPECTED_TOKEN,o(),0,qe),"")}function w(Ue){let qe="";for(;Ue.currentPeek()===jf||Ue.currentPeek()===uc;)qe+=Ue.currentPeek(),Ue.peek();return qe}function x(Ue){const qe=w(Ue);return Ue.skipToPeek(),qe}function C(Ue){if(Ue===hm)return!1;const qe=Ue.charCodeAt(0);return qe>=97&&qe<=122||qe>=65&&qe<=90||qe===95}function S(Ue){if(Ue===hm)return!1;const qe=Ue.charCodeAt(0);return qe>=48&&qe<=57}function M(Ue,qe){const{currentType:Et}=qe;if(Et!==2)return!1;w(Ue);const qt=C(Ue.currentPeek());return Ue.resetPeek(),qt}function E(Ue,qe){const{currentType:Et}=qe;if(Et!==2)return!1;w(Ue);const qt=Ue.currentPeek()==="-"?Ue.peek():Ue.currentPeek(),rn=S(qt);return Ue.resetPeek(),rn}function A(Ue,qe){const{currentType:Et}=qe;if(Et!==2)return!1;w(Ue);const qt=Ue.currentPeek()===uq;return Ue.resetPeek(),qt}function I(Ue,qe){const{currentType:Et}=qe;if(Et!==7)return!1;w(Ue);const qt=Ue.currentPeek()===".";return Ue.resetPeek(),qt}function O(Ue,qe){const{currentType:Et}=qe;if(Et!==8)return!1;w(Ue);const qt=C(Ue.currentPeek());return Ue.resetPeek(),qt}function z(Ue,qe){const{currentType:Et}=qe;if(!(Et===7||Et===11))return!1;w(Ue);const qt=Ue.currentPeek()===":";return Ue.resetPeek(),qt}function $(Ue,qe){const{currentType:Et}=qe;if(Et!==9)return!1;const qt=()=>{const it=Ue.currentPeek();return it==="{"?C(Ue.peek()):it==="@"||it==="|"||it===":"||it==="."||it===jf||!it?!1:it===uc?(Ue.peek(),qt()):J(Ue,!1)},rn=qt();return Ue.resetPeek(),rn}function W(Ue){w(Ue);const qe=Ue.currentPeek()==="|";return Ue.resetPeek(),qe}function J(Ue,qe=!0){const Et=(rn=!1,it="")=>{const St=Ue.currentPeek();return St==="{"||St==="@"||!St?rn:St==="|"?!(it===jf||it===uc):St===jf?(Ue.peek(),Et(!0,jf)):St===uc?(Ue.peek(),Et(!0,uc)):!0},qt=Et();return qe&&Ue.resetPeek(),qt}function Z(Ue,qe){const Et=Ue.currentChar();return Et===hm?hm:qe(Et)?(Ue.next(),Et):null}function q(Ue){const qe=Ue.charCodeAt(0);return qe>=97&&qe<=122||qe>=65&&qe<=90||qe>=48&&qe<=57||qe===95||qe===36}function j(Ue){return Z(Ue,q)}function G(Ue){const qe=Ue.charCodeAt(0);return qe>=97&&qe<=122||qe>=65&&qe<=90||qe>=48&&qe<=57||qe===95||qe===36||qe===45}function U(Ue){return Z(Ue,G)}function Q(Ue){const qe=Ue.charCodeAt(0);return qe>=48&&qe<=57}function re(Ue){return Z(Ue,Q)}function le(Ue){const qe=Ue.charCodeAt(0);return qe>=48&&qe<=57||qe>=65&&qe<=70||qe>=97&&qe<=102}function oe(Ue){return Z(Ue,le)}function he(Ue){let qe="",Et="";for(;qe=re(Ue);)Et+=qe;return Et}function xe(Ue){let qe="";for(;;){const Et=Ue.currentChar();if(Et==="{"||Et==="}"||Et==="@"||Et==="|"||!Et)break;if(Et===jf||Et===uc)if(J(Ue))qe+=Et,Ue.next();else{if(W(Ue))break;qe+=Et,Ue.next()}else qe+=Et,Ue.next()}return qe}function Ee(Ue){x(Ue);let qe="",Et="";for(;qe=U(Ue);)Et+=qe;return Ue.currentChar()===hm&&d(Jn.UNTERMINATED_CLOSING_BRACE,o(),0),Et}function Ie(Ue){x(Ue);let qe="";return Ue.currentChar()==="-"?(Ue.next(),qe+=`-${he(Ue)}`):qe+=he(Ue),Ue.currentChar()===hm&&d(Jn.UNTERMINATED_CLOSING_BRACE,o(),0),qe}function Oe(Ue){return Ue!==uq&&Ue!==uc}function $e(Ue){x(Ue),y(Ue,"'");let qe="",Et="";for(;qe=Z(Ue,Oe);)qe==="\\"?Et+=Ze(Ue):Et+=qe;const qt=Ue.currentChar();return qt===uc||qt===hm?(d(Jn.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,o(),0),qt===uc&&(Ue.next(),y(Ue,"'")),Et):(y(Ue,"'"),Et)}function Ze(Ue){const qe=Ue.currentChar();switch(qe){case"\\":case"'":return Ue.next(),`\\${qe}`;case"u":return lt(Ue,qe,4);case"U":return lt(Ue,qe,6);default:return d(Jn.UNKNOWN_ESCAPE_SEQUENCE,o(),0,qe),""}}function lt(Ue,qe,Et){y(Ue,qe);let qt="";for(let rn=0;rn{const qt=Ue.currentChar();return qt==="{"||qt==="@"||qt==="|"||qt==="("||qt===")"||!qt||qt===jf?Et:(Et+=qt,Ue.next(),qe(Et))};return qe("")}function Ht(Ue){x(Ue);const qe=y(Ue,"|");return x(Ue),qe}function wn(Ue,qe){let Et=null;switch(Ue.currentChar()){case"{":return qe.braceNest>=1&&d(Jn.NOT_ALLOW_NEST_PLACEHOLDER,o(),0),Ue.next(),Et=p(qe,2,"{"),x(Ue),qe.braceNest++,Et;case"}":return qe.braceNest>0&&qe.currentType===2&&d(Jn.EMPTY_PLACEHOLDER,o(),0),Ue.next(),Et=p(qe,3,"}"),qe.braceNest--,qe.braceNest>0&&x(Ue),qe.inLinked&&qe.braceNest===0&&(qe.inLinked=!1),Et;case"@":return qe.braceNest>0&&d(Jn.UNTERMINATED_CLOSING_BRACE,o(),0),Et=cn(Ue,qe)||m(qe),qe.braceNest=0,Et;default:{let qt=!0,rn=!0,it=!0;if(W(Ue))return qe.braceNest>0&&d(Jn.UNTERMINATED_CLOSING_BRACE,o(),0),Et=p(qe,1,Ht(Ue)),qe.braceNest=0,qe.inLinked=!1,Et;if(qe.braceNest>0&&(qe.currentType===4||qe.currentType===5||qe.currentType===6))return d(Jn.UNTERMINATED_CLOSING_BRACE,o(),0),qe.braceNest=0,Hn(Ue,qe);if(qt=M(Ue,qe))return Et=p(qe,4,Ee(Ue)),x(Ue),Et;if(rn=E(Ue,qe))return Et=p(qe,5,Ie(Ue)),x(Ue),Et;if(it=A(Ue,qe))return Et=p(qe,6,$e(Ue)),x(Ue),Et;if(!qt&&!rn&&!it)return Et=p(qe,12,yt(Ue)),d(Jn.INVALID_TOKEN_IN_PLACEHOLDER,o(),0,Et.value),x(Ue),Et;break}}return Et}function cn(Ue,qe){const{currentType:Et}=qe;let qt=null;const rn=Ue.currentChar();switch((Et===7||Et===8||Et===11||Et===9)&&(rn===uc||rn===jf)&&d(Jn.INVALID_LINKED_FORMAT,o(),0),rn){case"@":return Ue.next(),qt=p(qe,7,"@"),qe.inLinked=!0,qt;case".":return x(Ue),Ue.next(),p(qe,8,".");case":":return x(Ue),Ue.next(),p(qe,9,":");default:return W(Ue)?(qt=p(qe,1,Ht(Ue)),qe.braceNest=0,qe.inLinked=!1,qt):I(Ue,qe)||z(Ue,qe)?(x(Ue),cn(Ue,qe)):O(Ue,qe)?(x(Ue),p(qe,11,Lt(Ue))):$(Ue,qe)?(x(Ue),rn==="{"?wn(Ue,qe)||qt:p(qe,10,hn(Ue))):(Et===7&&d(Jn.INVALID_LINKED_FORMAT,o(),0),qe.braceNest=0,qe.inLinked=!1,Hn(Ue,qe))}}function Hn(Ue,qe){let Et={type:13};if(qe.braceNest>0)return wn(Ue,qe)||m(qe);if(qe.inLinked)return cn(Ue,qe)||m(qe);switch(Ue.currentChar()){case"{":return wn(Ue,qe)||m(qe);case"}":return d(Jn.UNBALANCED_CLOSING_BRACE,o(),0),Ue.next(),p(qe,3,"}");case"@":return cn(Ue,qe)||m(qe);default:{if(W(Ue))return Et=p(qe,1,Ht(Ue)),qe.braceNest=0,qe.inLinked=!1,Et;if(J(Ue))return p(qe,0,xe(Ue));break}}return Et}function Bn(){const{currentType:Ue,offset:qe,startLoc:Et,endLoc:qt}=l;return l.lastType=Ue,l.lastOffset=qe,l.lastStartLoc=Et,l.lastEndLoc=qt,l.offset=i(),l.startLoc=o(),r.currentChar()===hm?p(l,13):Hn(r,l)}return{nextToken:Bn,currentOffset:i,currentPosition:o,context:c}}const c5e="parser",u5e=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function h5e(t,e,n){switch(t){case"\\\\":return"\\";case"\\'":return"'";default:{const r=parseInt(e||n,16);return r<=55295||r>=57344?String.fromCodePoint(r):"�"}}}function d5e(t={}){const e=t.location!==!1,{onError:n}=t;function r(C,S,M,E,...A){const I=C.currentPosition();if(I.offset+=E,I.column+=E,n){const O=e?BD(M,I):null,z=s_(S,O,{domain:c5e,args:A});n(z)}}function i(C,S,M){const E={type:C};return e&&(E.start=S,E.end=S,E.loc={start:M,end:M}),E}function o(C,S,M,E){e&&(C.end=S,C.loc&&(C.loc.end=M))}function s(C,S){const M=C.context(),E=i(3,M.offset,M.startLoc);return E.value=S,o(E,C.currentOffset(),C.currentPosition()),E}function a(C,S){const M=C.context(),{lastOffset:E,lastStartLoc:A}=M,I=i(5,E,A);return I.index=parseInt(S,10),C.nextToken(),o(I,C.currentOffset(),C.currentPosition()),I}function l(C,S){const M=C.context(),{lastOffset:E,lastStartLoc:A}=M,I=i(4,E,A);return I.key=S,C.nextToken(),o(I,C.currentOffset(),C.currentPosition()),I}function c(C,S){const M=C.context(),{lastOffset:E,lastStartLoc:A}=M,I=i(9,E,A);return I.value=S.replace(u5e,h5e),C.nextToken(),o(I,C.currentOffset(),C.currentPosition()),I}function u(C){const S=C.nextToken(),M=C.context(),{lastOffset:E,lastStartLoc:A}=M,I=i(8,E,A);return S.type!==11?(r(C,Jn.UNEXPECTED_EMPTY_LINKED_MODIFIER,M.lastStartLoc,0),I.value="",o(I,E,A),{nextConsumeToken:S,node:I}):(S.value==null&&r(C,Jn.UNEXPECTED_LEXICAL_ANALYSIS,M.lastStartLoc,0,Sd(S)),I.value=S.value||"",o(I,C.currentOffset(),C.currentPosition()),{node:I})}function d(C,S){const M=C.context(),E=i(7,M.offset,M.startLoc);return E.value=S,o(E,C.currentOffset(),C.currentPosition()),E}function p(C){const S=C.context(),M=i(6,S.offset,S.startLoc);let E=C.nextToken();if(E.type===8){const A=u(C);M.modifier=A.node,E=A.nextConsumeToken||C.nextToken()}switch(E.type!==9&&r(C,Jn.UNEXPECTED_LEXICAL_ANALYSIS,S.lastStartLoc,0,Sd(E)),E=C.nextToken(),E.type===2&&(E=C.nextToken()),E.type){case 10:E.value==null&&r(C,Jn.UNEXPECTED_LEXICAL_ANALYSIS,S.lastStartLoc,0,Sd(E)),M.key=d(C,E.value||"");break;case 4:E.value==null&&r(C,Jn.UNEXPECTED_LEXICAL_ANALYSIS,S.lastStartLoc,0,Sd(E)),M.key=l(C,E.value||"");break;case 5:E.value==null&&r(C,Jn.UNEXPECTED_LEXICAL_ANALYSIS,S.lastStartLoc,0,Sd(E)),M.key=a(C,E.value||"");break;case 6:E.value==null&&r(C,Jn.UNEXPECTED_LEXICAL_ANALYSIS,S.lastStartLoc,0,Sd(E)),M.key=c(C,E.value||"");break;default:{r(C,Jn.UNEXPECTED_EMPTY_LINKED_KEY,S.lastStartLoc,0);const A=C.context(),I=i(7,A.offset,A.startLoc);return I.value="",o(I,A.offset,A.startLoc),M.key=I,o(M,A.offset,A.startLoc),{nextConsumeToken:E,node:M}}}return o(M,C.currentOffset(),C.currentPosition()),{node:M}}function m(C){const S=C.context(),M=S.currentType===1?C.currentOffset():S.offset,E=S.currentType===1?S.endLoc:S.startLoc,A=i(2,M,E);A.items=[];let I=null;do{const $=I||C.nextToken();switch(I=null,$.type){case 0:$.value==null&&r(C,Jn.UNEXPECTED_LEXICAL_ANALYSIS,S.lastStartLoc,0,Sd($)),A.items.push(s(C,$.value||""));break;case 5:$.value==null&&r(C,Jn.UNEXPECTED_LEXICAL_ANALYSIS,S.lastStartLoc,0,Sd($)),A.items.push(a(C,$.value||""));break;case 4:$.value==null&&r(C,Jn.UNEXPECTED_LEXICAL_ANALYSIS,S.lastStartLoc,0,Sd($)),A.items.push(l(C,$.value||""));break;case 6:$.value==null&&r(C,Jn.UNEXPECTED_LEXICAL_ANALYSIS,S.lastStartLoc,0,Sd($)),A.items.push(c(C,$.value||""));break;case 7:{const W=p(C);A.items.push(W.node),I=W.nextConsumeToken||null;break}}}while(S.currentType!==13&&S.currentType!==1);const O=S.currentType===1?S.lastOffset:C.currentOffset(),z=S.currentType===1?S.lastEndLoc:C.currentPosition();return o(A,O,z),A}function y(C,S,M,E){const A=C.context();let I=E.items.length===0;const O=i(1,S,M);O.cases=[],O.cases.push(E);do{const z=m(C);I||(I=z.items.length===0),O.cases.push(z)}while(A.currentType!==13);return I&&r(C,Jn.MUST_HAVE_MESSAGES_IN_PLURAL,M,0),o(O,C.currentOffset(),C.currentPosition()),O}function w(C){const S=C.context(),{offset:M,startLoc:E}=S,A=m(C);return S.currentType===13?A:y(C,M,E,A)}function x(C){const S=l5e(C,js({},t)),M=S.context(),E=i(0,M.offset,M.startLoc);return e&&E.loc&&(E.loc.source=C),E.body=w(S),t.onCacheKey&&(E.cacheKey=t.onCacheKey(C)),M.currentType!==13&&r(S,Jn.UNEXPECTED_LEXICAL_ANALYSIS,M.lastStartLoc,0,C[M.offset]||""),o(E,S.currentOffset(),S.currentPosition()),E}return{parse:x}}function Sd(t){if(t.type===13)return"EOF";const e=(t.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function f5e(t,e={}){const n={ast:t,helpers:new Set};return{context:()=>n,helper:r=>(n.helpers.add(r),r)}}function hq(t,e){for(let n=0;ndq(n)),t}function dq(t){if(t.items.length===1){const e=t.items[0];(e.type===3||e.type===9)&&(t.static=e.value,delete e.value)}else{const e=[];for(let n=0;ns;function l(m,y){s.code+=m}function c(m,y=!0){const w=y?r:"";l(i?w+" ".repeat(m):w)}function u(m=!0){const y=++s.indentLevel;m&&c(y)}function d(m=!0){const y=--s.indentLevel;m&&c(y)}function p(){c(s.indentLevel)}return{context:a,push:l,indent:u,deindent:d,newline:p,helper:m=>`_${m}`,needIndent:()=>s.needIndent}}function _5e(t,e){const{helper:n}=t;t.push(`${n("linked")}(`),l_(t,e.key),e.modifier?(t.push(", "),l_(t,e.modifier),t.push(", _type")):t.push(", undefined, _type"),t.push(")")}function b5e(t,e){const{helper:n,needIndent:r}=t;t.push(`${n("normalize")}([`),t.indent(r());const i=e.items.length;for(let o=0;o1){t.push(`${n("plural")}([`),t.indent(r());const i=e.cases.length;for(let o=0;o{const n=sn(e.mode)?e.mode:"normal",r=sn(e.filename)?e.filename:"message.intl";e.sourceMap;const i=e.breakLineCode!=null?e.breakLineCode:n==="arrow"?";":` `,o=e.needIndent?e.needIndent:n!=="arrow",s=t.helpers||[],a=v5e(t,{filename:r,breakLineCode:i,needIndent:o});a.push(n==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),a.indent(o),s.length>0&&(a.push(`const { ${OD(s.map(u=>`${u}: _${u}`),", ")} } = ctx`),a.newline()),a.push("return "),l_(a,t),a.deindent(o),a.push("}"),delete t.helpers;const{code:l,map:c}=a.context();return{ast:t,code:l,map:c?c.toJSON():void 0}};function S5e(t,e={}){const n=js({},e),r=!!n.jit,i=!!n.minify,o=n.optimize==null?!0:n.optimize,s=d5e(n).parse(t);return r?(o&&m5e(s),i&&a_(s),{ast:s,code:""}):(p5e(s,n),E5e(s,n))}/*! * core-base v11.1.7 * (c) 2025 kazuya kawaguchi * Released under the MIT License. */function C5e(){typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(dy().__INTLIFY_PROD_DEVTOOLS__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(dy().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function Fu(t){return gi(t)&&$D(t)===0&&(xh(t,"b")||xh(t,"body"))}const fq=["b","body"];function k5e(t){return dm(t,fq)}const pq=["c","cases"];function T5e(t){return dm(t,pq,[])}const mq=["s","static"];function M5e(t){return dm(t,mq)}const gq=["i","items"];function A5e(t){return dm(t,gq,[])}const yq=["t","type"];function $D(t){return dm(t,yq)}const vq=["v","value"];function ZT(t,e){const n=dm(t,vq);if(n!=null)return n;throw Vw(e)}const _q=["m","modifier"];function I5e(t){return dm(t,_q)}const bq=["k","key"];function L5e(t){const e=dm(t,bq);if(e)return e;throw Vw(6)}function dm(t,e,n){for(let r=0;rP5e(e,t)}function P5e(t,e){const n=k5e(e);if(n==null)throw Vw(0);if($D(n)===1){const r=T5e(n);return t.plural(r.reduce((i,o)=>[...i,xq(t,o)],[]))}else return xq(t,n)}function xq(t,e){const n=M5e(e);if(n!=null)return t.type==="text"?n:t.normalize([n]);{const r=A5e(e).reduce((i,o)=>[...i,VD(t,o)],[]);return t.normalize(r)}}function VD(t,e){const n=$D(e);switch(n){case 3:return ZT(e,n);case 9:return ZT(e,n);case 4:{const r=e;if(xh(r,"k")&&r.k)return t.interpolate(t.named(r.k));if(xh(r,"key")&&r.key)return t.interpolate(t.named(r.key));throw Vw(n)}case 5:{const r=e;if(xh(r,"i")&&Es(r.i))return t.interpolate(t.list(r.i));if(xh(r,"index")&&Es(r.index))return t.interpolate(t.list(r.index));throw Vw(n)}case 6:{const r=e,i=I5e(r),o=L5e(r);return t.linked(VD(t,o),i?VD(t,i):void 0,t.type)}case 7:return ZT(e,n);case 8:return ZT(e,n);default:throw new Error(`unhandled node on format message part: ${n}`)}}const N5e="Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.";function O5e(t,e){e&&n5e(t)&&um(WT(N5e,{source:t}))}const D5e=t=>t;let XT=Hi();function R5e(t,e={}){let n=!1;const r=e.onError||e5e;return e.onError=i=>{n=!0,r(i)},{...S5e(t,e),detectError:n}}function B5e(t,e){if(!__INTLIFY_DROP_MESSAGE_COMPILER__&&sn(t)){const n=wi(e.warnHtmlMessage)?e.warnHtmlMessage:!0;_n.NODE_ENV!=="production"&&O5e(t,n);const r=(e.onCacheKey||D5e)(t),i=XT[r];if(i)return i;const{ast:o,detectError:s}=R5e(t,{...e,location:_n.NODE_ENV!=="production",jit:!0}),a=zD(o);return s?a:XT[r]=a}else{if(_n.NODE_ENV!=="production"&&!Fu(t))return um(`the message that is resolve with key '${e.key}' is not supported for jit compilation`),()=>t;const n=t.cacheKey;return n?XT[n]||(XT[n]=zD(t)):zD(t)}}let jw=null;function F5e(t){jw=t}function $5e(t,e,n){jw&&jw.emit("i18n:init",{timestamp:Date.now(),i18n:t,version:e,meta:n})}const z5e=V5e("function:translate");function V5e(t){return e=>jw&&jw.emit(t,e)}const sl={INVALID_ARGUMENT:JFe,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_NON_STRING_MESSAGE:20,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23},j5e=24;function Uf(t){return s_(t,null,_n.NODE_ENV!=="production"?{messages:U5e}:void 0)}const U5e={[sl.INVALID_ARGUMENT]:"Invalid arguments",[sl.INVALID_DATE_ARGUMENT]:"The date provided is an invalid Date object.Make sure your Date represents a valid date.",[sl.INVALID_ISO_DATE_ARGUMENT]:"The argument provided is not a valid ISO date string",[sl.NOT_SUPPORT_NON_STRING_MESSAGE]:"Not support non-string message",[sl.NOT_SUPPORT_LOCALE_PROMISE_VALUE]:"cannot support promise value",[sl.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION]:"cannot support async function",[sl.NOT_SUPPORT_LOCALE_TYPE]:"cannot support locale type"};function jD(t,e){return e.locale!=null?Eq(e.locale):Eq(t.locale)}let UD;function Eq(t){if(sn(t))return t;if(Ji(t)){if(t.resolvedOnce&&UD!=null)return UD;if(t.constructor.name==="Function"){const e=t();if(YFe(e))throw Uf(sl.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return UD=e}else throw Uf(sl.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw Uf(sl.NOT_SUPPORT_LOCALE_TYPE)}function H5e(t,e,n){return[...new Set([n,...zo(e)?e:gi(e)?Object.keys(e):sn(e)?[e]:[n]])]}function Sq(t,e,n){const r=sn(n)?n:Uw,i=t;i.__localeChainCache||(i.__localeChainCache=new Map);let o=i.__localeChainCache.get(r);if(!o){o=[];let s=[n];for(;zo(s);)s=Cq(o,s,e);const a=zo(e)||!Jr(e)?e:e.default?e.default:null;s=sn(a)?[a]:a,zo(s)&&Cq(o,s,!1),i.__localeChainCache.set(r,o)}return o}function Cq(t,e,n){let r=!0;for(let i=0;i{s===void 0?s=a:s+=a},p[1]=()=>{s!==void 0&&(e.push(s),s=void 0)},p[2]=()=>{p[0](),i++},p[3]=()=>{if(i>0)i--,r=4,p[0]();else{if(i=0,s===void 0||(s=K5e(s),s===!1))return!1;p[1]()}};function m(){const y=t[n+1];if(r===5&&y==="'"||r===6&&y==='"')return n++,a="\\"+y,p[0](),!0}for(;r!==null;)if(n++,o=t[n],!(o==="\\"&&m())){if(l=X5e(o),d=fm[r],c=d[l]||d.l||8,c===8||(r=c[0],c[1]!==void 0&&(u=p[c[1]],u&&(a=o,u()===!1))))return;if(r===7)return e}}const kq=new Map;function Q5e(t,e){return gi(t)?t[e]:null}function e$e(t,e){if(!gi(t))return null;let n=kq.get(e);if(n||(n=J5e(e),n&&kq.set(e,n)),!n)return null;const r=n.length;let i=t,o=0;for(;o`${t.charAt(0).toLocaleUpperCase()}${t.substr(1)}`;function i$e(){return{upper:(t,e)=>e==="text"&&sn(t)?t.toUpperCase():e==="vnode"&&gi(t)&&"__v_isVNode"in t?t.children.toUpperCase():t,lower:(t,e)=>e==="text"&&sn(t)?t.toLowerCase():e==="vnode"&&gi(t)&&"__v_isVNode"in t?t.children.toLowerCase():t,capitalize:(t,e)=>e==="text"&&sn(t)?Tq(t):e==="vnode"&&gi(t)&&"__v_isVNode"in t?Tq(t.children):t}}let Mq;function o$e(t){Mq=t}let Aq;function s$e(t){Aq=t}let Iq;function a$e(t){Iq=t}let Lq=null;const Pq=t=>{Lq=t},l$e=()=>Lq;let Nq=0;function c$e(t={}){const e=Ji(t.onWarn)?t.onWarn:um,n=sn(t.version)?t.version:r$e,r=sn(t.locale)||Ji(t.locale)?t.locale:Uw,i=Ji(r)?Uw:r,o=zo(t.fallbackLocale)||Jr(t.fallbackLocale)||sn(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:i,s=Jr(t.messages)?t.messages:HD(i),a=Jr(t.datetimeFormats)?t.datetimeFormats:HD(i),l=Jr(t.numberFormats)?t.numberFormats:HD(i),c=js(Hi(),t.modifiers,i$e()),u=t.pluralRules||Hi(),d=Ji(t.missing)?t.missing:null,p=wi(t.missingWarn)||o_(t.missingWarn)?t.missingWarn:!0,m=wi(t.fallbackWarn)||o_(t.fallbackWarn)?t.fallbackWarn:!0,y=!!t.fallbackFormat,w=!!t.unresolving,x=Ji(t.postTranslation)?t.postTranslation:null,C=Jr(t.processor)?t.processor:null,S=wi(t.warnHtmlMessage)?t.warnHtmlMessage:!0,M=!!t.escapeParameter,E=Ji(t.messageCompiler)?t.messageCompiler:Mq;_n.NODE_ENV!=="production"&&Ji(t.messageCompiler)&&DD(fy(hc.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER));const A=Ji(t.messageResolver)?t.messageResolver:Aq||Q5e,I=Ji(t.localeFallbacker)?t.localeFallbacker:Iq||H5e,O=gi(t.fallbackContext)?t.fallbackContext:void 0,z=t,$=gi(z.__datetimeFormatters)?z.__datetimeFormatters:new Map,W=gi(z.__numberFormatters)?z.__numberFormatters:new Map,J=gi(z.__meta)?z.__meta:{};Nq++;const Z={version:n,cid:Nq,locale:r,fallbackLocale:o,messages:s,modifiers:c,pluralRules:u,missing:d,missingWarn:p,fallbackWarn:m,fallbackFormat:y,unresolving:w,postTranslation:x,processor:C,warnHtmlMessage:S,escapeParameter:M,messageCompiler:E,messageResolver:A,localeFallbacker:I,fallbackContext:O,onWarn:e,__meta:J};return Z.datetimeFormats=a,Z.numberFormats=l,Z.__datetimeFormatters=$,Z.__numberFormatters=W,_n.NODE_ENV!=="production"&&(Z.__v_emitter=z.__v_emitter!=null?z.__v_emitter:void 0),(_n.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__)&&$5e(Z,n,J),Z}const HD=t=>({[t]:Hi()});function QT(t,e){return t instanceof RegExp?t.test(e):t}function Oq(t,e){return t instanceof RegExp?t.test(e):t}function WD(t,e,n,r,i){const{missing:o,onWarn:s}=t;if(_n.NODE_ENV!=="production"){const a=t.__v_emitter;a&&a.emit("missing",{locale:n,key:e,type:i,groupId:`${i}:${e}`})}if(o!==null){const a=o(t,n,e,i);return sn(a)?a:e}else return _n.NODE_ENV!=="production"&&Oq(r,e)&&s(fy(hc.NOT_FOUND_KEY,{key:e,locale:n})),e}function Hw(t,e,n){const r=t;r.__localeChainCache=new Map,t.localeFallbacker(t,n,e)}function Dq(t,e){return t===e?!1:t.split("-")[0]===e.split("-")[0]}function u$e(t,e){const n=e.indexOf(t);if(n===-1)return!1;for(let r=n+1;r{$q.includes(l)?s[l]=n[l]:o[l]=n[l]}),sn(r)?o.locale=r:Jr(r)&&(s=r),Jr(i)&&(s=i),[o.key||"",a,o,s]}function zq(t,e,n){const r=t;for(const i in n){const o=`${e}__${i}`;r.__datetimeFormatters.has(o)&&r.__datetimeFormatters.delete(o)}}function Vq(t,...e){const{numberFormats:n,unresolving:r,fallbackLocale:i,onWarn:o,localeFallbacker:s}=t,{__numberFormatters:a}=t;if(_n.NODE_ENV!=="production"&&!Bq.numberFormat)return o(fy(hc.CANNOT_FORMAT_NUMBER)),JT;const[l,c,u,d]=qD(...e),p=wi(u.missingWarn)?u.missingWarn:t.missingWarn,m=wi(u.fallbackWarn)?u.fallbackWarn:t.fallbackWarn,y=!!u.part,w=jD(t,u),x=s(t,i,w);if(!sn(l)||l==="")return new Intl.NumberFormat(w,d).format(c);let C={},S,M=null,E=w,A=null;const I="number format";for(let $=0;${jq.includes(l)?s[l]=n[l]:o[l]=n[l]}),sn(r)?o.locale=r:Jr(r)&&(s=r),Jr(i)&&(s=i),[o.key||"",a,o,s]}function Uq(t,e,n){const r=t;for(const i in n){const o=`${e}__${i}`;r.__numberFormatters.has(o)&&r.__numberFormatters.delete(o)}}const h$e=t=>t,d$e=t=>"",f$e="text",p$e=t=>t.length===0?"":OD(t),m$e=ZFe;function Hq(t,e){return t=Math.abs(t),e===2?t?t>1?1:0:1:t?Math.min(t,2):0}function g$e(t){const e=Es(t.pluralIndex)?t.pluralIndex:-1;return t.named&&(Es(t.named.count)||Es(t.named.n))?Es(t.named.count)?t.named.count:Es(t.named.n)?t.named.n:e:e}function y$e(t,e){e.count||(e.count=t),e.n||(e.n=t)}function v$e(t={}){const e=t.locale,n=g$e(t),r=gi(t.pluralRules)&&sn(e)&&Ji(t.pluralRules[e])?t.pluralRules[e]:Hq,i=gi(t.pluralRules)&&sn(e)&&Ji(t.pluralRules[e])?Hq:void 0,o=x=>x[r(n,x.length,i)],s=t.list||[],a=x=>s[x],l=t.named||Hi();Es(t.pluralIndex)&&y$e(n,l);const c=x=>l[x];function u(x,C){return(Ji(t.messages)?t.messages(x,!!C):gi(t.messages)?t.messages[x]:!1)||(t.parent?t.parent.message(x):d$e)}const d=x=>t.modifiers?t.modifiers[x]:h$e,p=Jr(t.processor)&&Ji(t.processor.normalize)?t.processor.normalize:p$e,m=Jr(t.processor)&&Ji(t.processor.interpolate)?t.processor.interpolate:m$e,y=Jr(t.processor)&&sn(t.processor.type)?t.processor.type:f$e,w={list:a,named:c,plural:o,linked:(x,...C)=>{const[S,M]=C;let E="text",A="";C.length===1?gi(S)?(A=S.modifier||A,E=S.type||E):sn(S)&&(A=S||A):C.length===2&&(sn(S)&&(A=S||A),sn(M)&&(E=M||E));const I=u(x,!0)(w),O=E==="vnode"&&zo(I)&&A?I[0]:I;return A?d(A)(O,E):O},message:u,type:y,interpolate:m,normalize:p,values:js(Hi(),s,l)};return w}const Wq=()=>"",Eh=t=>Ji(t);function Gq(t,...e){const{fallbackFormat:n,postTranslation:r,unresolving:i,messageCompiler:o,fallbackLocale:s,messages:a}=t,[l,c]=YD(...e),u=wi(c.missingWarn)?c.missingWarn:t.missingWarn,d=wi(c.fallbackWarn)?c.fallbackWarn:t.fallbackWarn,p=wi(c.escapeParameter)?c.escapeParameter:t.escapeParameter,m=!!c.resolvedMessage,y=sn(c.default)||wi(c.default)?wi(c.default)?o?l:()=>l:c.default:n?o?l:()=>l:null,w=n||y!=null&&(sn(y)||Ji(y)),x=jD(t,c);p&&_$e(c);let[C,S,M]=m?[l,x,a[x]||Hi()]:qq(t,l,x,s,d,u),E=C,A=l;if(!m&&!(sn(E)||Fu(E)||Eh(E))&&w&&(E=y,A=E),!m&&(!(sn(E)||Fu(E)||Eh(E))||!sn(S)))return i?KT:l;if(_n.NODE_ENV!=="production"&&sn(E)&&t.messageCompiler==null)return um(`The message format compilation is not supported in this build. Because message compiler isn't included. You need to pre-compilation all message format. So translate function return '${l}'.`),l;let I=!1;const O=()=>{I=!0},z=Eh(E)?E:Yq(t,l,S,E,A,O);if(I)return E;const $=E$e(t,S,M,c),W=v$e($),J=b$e(t,z,W),Z=r?r(J,l):J;if(_n.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const q={timestamp:Date.now(),key:sn(l)?l:Eh(E)?E.key:"",locale:S||(Eh(E)?E.locale:""),format:sn(E)?E:Eh(E)?E.source:"",message:Z};q.meta=js({},t.__meta,{}),z5e(q)}return Z}function _$e(t){zo(t.list)?t.list=t.list.map(e=>sn(e)?sq(e):e):gi(t.named)&&Object.keys(t.named).forEach(e=>{sn(t.named[e])&&(t.named[e]=sq(t.named[e]))})}function qq(t,e,n,r,i,o){const{messages:s,onWarn:a,messageResolver:l,localeFallbacker:c}=t,u=c(t,r,n);let d=Hi(),p,m=null,y=n,w=null;const x="translate";for(let C=0;Cr;return p.locale=n,p.key=e,p}let l=null,c,u;_n.NODE_ENV!=="production"&&wh&&(l=window.performance.now(),c="intlify-message-compilation-start",u="intlify-message-compilation-end",jc&&jc(c));const d=s(r,w$e(t,n,i,r,a,o));if(_n.NODE_ENV!=="production"&&wh){const p=window.performance.now(),m=t.__v_emitter;m&&l&&m.emit("message-compilation",{type:"message-compilation",message:r,time:p-l,groupId:`translate:${e}`}),c&&u&&jc&&hy&&(jc(u),hy("intlify message compilation",c,u))}return d.locale=n,d.key=e,d.source=r,d}function b$e(t,e,n){let r=null,i,o;_n.NODE_ENV!=="production"&&wh&&(r=window.performance.now(),i="intlify-message-evaluation-start",o="intlify-message-evaluation-end",jc&&jc(i));const s=e(n);if(_n.NODE_ENV!=="production"&&wh){const a=window.performance.now(),l=t.__v_emitter;l&&r&&l.emit("message-evaluation",{type:"message-evaluation",value:s,time:a-r,groupId:`translate:${e.key}`}),i&&o&&jc&&hy&&(jc(o),hy("intlify message evaluation",i,o))}return s}function YD(...t){const[e,n,r]=t,i=Hi();if(!sn(e)&&!Es(e)&&!Eh(e)&&!Fu(e))throw Uf(sl.INVALID_ARGUMENT);const o=Es(e)?String(e):e;return Es(n)?i.plural=n:sn(n)?i.default=n:Jr(n)&&!GT(n)?i.named=n:zo(n)&&(i.list=n),Es(r)?i.plural=r:sn(r)?i.default=r:Jr(r)&&js(i,r),[o,i]}function w$e(t,e,n,r,i,o){return{locale:e,key:n,warnHtmlMessage:i,onError:s=>{if(o&&o(s),_n.NODE_ENV!=="production"){const a=x$e(r),l=`Message compilation error: ${s.message}`,c=s.location&&a&&XFe(a,s.location.start.offset,s.location.end.offset),u=t.__v_emitter;u&&a&&u.emit("compile-error",{message:a,error:s.message,start:s.location&&s.location.start.offset,end:s.location&&s.location.end.offset,groupId:`translate:${n}`}),console.error(c?`${l} ${c}`:l)}else throw s},onCacheKey:s=>UFe(e,n,s)}}function x$e(t){if(sn(t))return t;if(t.loc&&t.loc.source)return t.loc.source}function E$e(t,e,n,r){const{modifiers:i,pluralRules:o,messageResolver:s,fallbackLocale:a,fallbackWarn:l,missingWarn:c,fallbackContext:u}=t,d={locale:e,modifiers:i,pluralRules:o,messages:(p,m)=>{let y=s(n,p);if(y==null&&(u||m)){const[,,w]=qq(u||t,p,e,a,l,c);y=s(w,p)}if(sn(y)||Fu(y)){let w=!1;const x=Yq(t,p,e,y,p,()=>{w=!0});return w?Wq:x}else return Eh(y)?y:Wq}};return t.processor&&(d.processor=t.processor),r.list&&(d.list=r.list),r.named&&(d.named=r.named),Es(r.plural)&&(d.pluralIndex=r.plural),d}C5e();function S$e(){return Zq().__VUE_DEVTOOLS_GLOBAL_HOOK__}function Zq(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const C$e=typeof Proxy=="function",k$e="devtools-plugin:setup",T$e="plugin:settings:set";let Ww,ZD;function M$e(){var t;return Ww!==void 0||(typeof window<"u"&&window.performance?(Ww=!0,ZD=window.performance):typeof globalThis<"u"&&!((t=globalThis.perf_hooks)===null||t===void 0)&&t.performance?(Ww=!0,ZD=globalThis.perf_hooks.performance):Ww=!1),Ww}function A$e(){return M$e()?ZD.now():Date.now()}class I$e{constructor(e,n){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=n;const r={};if(e.settings)for(const s in e.settings){const a=e.settings[s];r[s]=a.defaultValue}const i=`__vue-devtools-plugin-settings__${e.id}`;let o=Object.assign({},r);try{const s=localStorage.getItem(i),a=JSON.parse(s);Object.assign(o,a)}catch{}this.fallbacks={getSettings(){return o},setSettings(s){try{localStorage.setItem(i,JSON.stringify(s))}catch{}o=s},now(){return A$e()}},n&&n.on(T$e,(s,a)=>{s===this.plugin.id&&this.fallbacks.setSettings(a)}),this.proxiedOn=new Proxy({},{get:(s,a)=>this.target?this.target.on[a]:(...l)=>{this.onQueue.push({method:a,args:l})}}),this.proxiedTarget=new Proxy({},{get:(s,a)=>this.target?this.target[a]:a==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(a)?(...l)=>(this.targetQueue.push({method:a,args:l,resolve:()=>{}}),this.fallbacks[a](...l)):(...l)=>new Promise(c=>{this.targetQueue.push({method:a,args:l,resolve:c})})})}async setRealTarget(e){this.target=e;for(const n of this.onQueue)this.target.on[n.method](...n.args);for(const n of this.targetQueue)n.resolve(await this.target[n.method](...n.args))}}function L$e(t,e){const n=t,r=Zq(),i=S$e(),o=C$e&&n.enableEarlyProxy;if(i&&(r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!o))i.emit(k$e,t,e);else{const s=o?new I$e(n,i):null;(r.__VUE_DEVTOOLS_PLUGINS__=r.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:n,setupFn:e,proxy:s}),s&&e(s.proxiedTarget)}}/*! * vue-i18n v11.1.7 * (c) 2025 kazuya kawaguchi * Released under the MIT License. */const P$e="11.1.7";function N$e(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(dy().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!="boolean"&&(dy().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(dy().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(dy().__INTLIFY_PROD_DEVTOOLS__=!1)}const Wi={UNEXPECTED_RETURN_TYPE:j5e,INVALID_ARGUMENT:25,MUST_BE_CALL_SETUP_TOP:26,NOT_INSTALLED:27,REQUIRED_VALUE:28,INVALID_VALUE:29,CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:30,NOT_INSTALLED_WITH_PROVIDE:31,UNEXPECTED_ERROR:32,NOT_COMPATIBLE_LEGACY_VUE_I18N:33,NOT_AVAILABLE_COMPOSITION_IN_LEGACY:34,DUPLICATE_USE_I18N_CALLING:35};function Nl(t,...e){return s_(t,null,_n.NODE_ENV!=="production"?{messages:O$e,args:e}:void 0)}const O$e={[Wi.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[Wi.INVALID_ARGUMENT]:"Invalid argument",[Wi.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[Wi.NOT_INSTALLED]:"Need to install with `app.use` function",[Wi.UNEXPECTED_ERROR]:"Unexpected error",[Wi.REQUIRED_VALUE]:"Required in value: {0}",[Wi.INVALID_VALUE]:"Invalid value",[Wi.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[Wi.NOT_INSTALLED_WITH_PROVIDE]:"Need to install with `provide` function",[Wi.NOT_COMPATIBLE_LEGACY_VUE_I18N]:"Not compatible legacy VueI18n.",[Wi.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]:"Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly",[Wi.DUPLICATE_USE_I18N_CALLING]:"Duplicate `useI18n` calling by local scope. Please don't call it on local scope"},XD=Ed("__translateVNode"),KD=Ed("__datetimeParts"),JD=Ed("__numberParts"),py=Ed("__enableEmitter"),Gw=Ed("__disableEmitter"),Xq=Ed("__setPluralRules"),Kq=Ed("__injectWithOption"),QD=Ed("__dispose"),Cd={FALLBACK_TO_ROOT:t$e,NOT_FOUND_PARENT_SCOPE:9,IGNORE_OBJ_FLATTEN:10,DEPRECATE_LEGACY_MODE:11,DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE:12},D$e={[Cd.FALLBACK_TO_ROOT]:"Fall back to {type} '{key}' with root locale.",[Cd.NOT_FOUND_PARENT_SCOPE]:"Not found parent scope. use the global scope.",[Cd.IGNORE_OBJ_FLATTEN]:"Ignore object flatten: '{key}' key has an string value",[Cd.DEPRECATE_LEGACY_MODE]:`Legacy API mode has been deprecated in v11. Use Composition API mode instead. About how to use the Composition API mode, see https://vue-i18n.intlify.dev/guide/advanced/composition.html`,[Cd.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE]:"'v-t' has been deprecated in v11. Use translate APIs ('t' or '$t') instead."};function qw(t,...e){return WT(D$e[t],...e)}function Yw(t){if(!gi(t)||Fu(t))return t;for(const e in t)if(xh(t,e))if(!e.includes("."))gi(t[e])&&Yw(t[e]);else{const n=e.split("."),r=n.length-1;let i=t,o=!1;for(let s=0;s{if("locale"in a&&"resource"in a){const{locale:l,resource:c}=a;l?(s[l]=s[l]||Hi(),YT(c,s[l])):YT(c,s)}else sn(a)&&YT(JSON.parse(a),s)}),i==null&&o)for(const a in s)xh(s,a)&&Yw(s[a]);return s}function R$e(t){return t.type}function Jq(t,e,n){let r=gi(e.messages)?e.messages:Hi();"__i18nGlobal"in n&&(r=eR(t.locale.value,{messages:r,__i18n:n.__i18nGlobal}));const i=Object.keys(r);i.length&&i.forEach(o=>{t.mergeLocaleMessage(o,r[o])});{if(gi(e.datetimeFormats)){const o=Object.keys(e.datetimeFormats);o.length&&o.forEach(s=>{t.mergeDateTimeFormat(s,e.datetimeFormats[s])})}if(gi(e.numberFormats)){const o=Object.keys(e.numberFormats);o.length&&o.forEach(s=>{t.mergeNumberFormat(s,e.numberFormats[s])})}}}function Qq(t){return g.createVNode(g.Text,null,t,0)}const eY=()=>[],B$e=()=>!1;let tY=0;function nY(t){return(e,n,r,i)=>t(n,r,g.getCurrentInstance()||void 0,i)}function tR(t={}){const{__root:e,__injectWithOption:n}=t,r=e===void 0,i=t.flatJson,o=wh?g.ref:g.shallowRef;let s=wi(t.inheritLocale)?t.inheritLocale:!0;const a=o(e&&s?e.locale.value:sn(t.locale)?t.locale:Uw),l=o(e&&s?e.fallbackLocale.value:sn(t.fallbackLocale)||zo(t.fallbackLocale)||Jr(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:a.value),c=o(eR(a.value,t)),u=o(Jr(t.datetimeFormats)?t.datetimeFormats:{[a.value]:{}}),d=o(Jr(t.numberFormats)?t.numberFormats:{[a.value]:{}});let p=e?e.missingWarn:wi(t.missingWarn)||o_(t.missingWarn)?t.missingWarn:!0,m=e?e.fallbackWarn:wi(t.fallbackWarn)||o_(t.fallbackWarn)?t.fallbackWarn:!0,y=e?e.fallbackRoot:wi(t.fallbackRoot)?t.fallbackRoot:!0,w=!!t.fallbackFormat,x=Ji(t.missing)?t.missing:null,C=Ji(t.missing)?nY(t.missing):null,S=Ji(t.postTranslation)?t.postTranslation:null,M=e?e.warnHtmlMessage:wi(t.warnHtmlMessage)?t.warnHtmlMessage:!0,E=!!t.escapeParameter;const A=e?e.modifiers:Jr(t.modifiers)?t.modifiers:{};let I=t.pluralRules||e&&e.pluralRules,O;O=(()=>{r&&Pq(null);const it={version:P$e,locale:a.value,fallbackLocale:l.value,messages:c.value,modifiers:A,pluralRules:I,missing:C===null?void 0:C,missingWarn:p,fallbackWarn:m,fallbackFormat:w,unresolving:!0,postTranslation:S===null?void 0:S,warnHtmlMessage:M,escapeParameter:E,messageResolver:t.messageResolver,messageCompiler:t.messageCompiler,__meta:{framework:"vue"}};it.datetimeFormats=u.value,it.numberFormats=d.value,it.__datetimeFormatters=Jr(O)?O.__datetimeFormatters:void 0,it.__numberFormatters=Jr(O)?O.__numberFormatters:void 0,_n.NODE_ENV!=="production"&&(it.__v_emitter=Jr(O)?O.__v_emitter:void 0);const St=c$e(it);return r&&Pq(St),St})(),Hw(O,a.value,l.value);function z(){return[a.value,l.value,c.value,u.value,d.value]}const $=g.computed({get:()=>a.value,set:it=>{O.locale=it,a.value=it}}),W=g.computed({get:()=>l.value,set:it=>{O.fallbackLocale=it,l.value=it,Hw(O,a.value,it)}}),J=g.computed(()=>c.value),Z=g.computed(()=>u.value),q=g.computed(()=>d.value);function j(){return Ji(S)?S:null}function G(it){S=it,O.postTranslation=it}function U(){return x}function Q(it){it!==null&&(C=nY(it)),x=it,O.missing=C}function re(it,St){return it!=="translate"||!St.resolvedMessage}const le=(it,St,an,Ne,nt,It)=>{z();let en;try{_n.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(O.fallbackContext=e?l$e():void 0),en=it(O)}finally{_n.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(O.fallbackContext=void 0)}if(an!=="translate exists"&&Es(en)&&en===KT||an==="translate exists"&&!en){const[Fn,lr]=St();if(_n.NODE_ENV!=="production"&&e&&sn(Fn)&&re(an,lr)&&(y&&(QT(m,Fn)||Oq(p,Fn))&&um(qw(Cd.FALLBACK_TO_ROOT,{key:Fn,type:an})),_n.NODE_ENV!=="production")){const{__v_emitter:Ye}=O;Ye&&y&&Ye.emit("fallback",{type:an,key:Fn,to:"global",groupId:`${an}:${Fn}`})}return e&&y?Ne(e):nt(Fn)}else{if(It(en))return en;throw Nl(Wi.UNEXPECTED_RETURN_TYPE)}};function oe(...it){return le(St=>Reflect.apply(Gq,null,[St,...it]),()=>YD(...it),"translate",St=>Reflect.apply(St.t,St,[...it]),St=>St,St=>sn(St))}function he(...it){const[St,an,Ne]=it;if(Ne&&!gi(Ne))throw Nl(Wi.INVALID_ARGUMENT);return oe(St,an,js({resolvedMessage:!0},Ne||{}))}function xe(...it){return le(St=>Reflect.apply(Fq,null,[St,...it]),()=>GD(...it),"datetime format",St=>Reflect.apply(St.d,St,[...it]),()=>JT,St=>sn(St)||zo(St))}function Ee(...it){return le(St=>Reflect.apply(Vq,null,[St,...it]),()=>qD(...it),"number format",St=>Reflect.apply(St.n,St,[...it]),()=>JT,St=>sn(St)||zo(St))}function Ie(it){return it.map(St=>sn(St)||Es(St)||wi(St)?Qq(String(St)):St)}const Oe={normalize:Ie,interpolate:it=>it,type:"vnode"};function $e(...it){return le(St=>{let an;const Ne=St;try{Ne.processor=Oe,an=Reflect.apply(Gq,null,[Ne,...it])}finally{Ne.processor=null}return an},()=>YD(...it),"translate",St=>St[XD](...it),St=>[Qq(St)],St=>zo(St))}function Ze(...it){return le(St=>Reflect.apply(Vq,null,[St,...it]),()=>qD(...it),"number format",St=>St[JD](...it),eY,St=>sn(St)||zo(St))}function lt(...it){return le(St=>Reflect.apply(Fq,null,[St,...it]),()=>GD(...it),"datetime format",St=>St[KD](...it),eY,St=>sn(St)||zo(St))}function pt(it){I=it,O.pluralRules=I}function yt(it,St){return le(()=>{if(!it)return!1;const an=sn(St)?St:a.value,Ne=Ht(an),nt=O.messageResolver(Ne,it);return Fu(nt)||Eh(nt)||sn(nt)},()=>[it],"translate exists",an=>Reflect.apply(an.te,an,[it,St]),B$e,an=>wi(an))}function Lt(it){let St=null;const an=Sq(O,l.value,a.value);for(let Ne=0;Ne{s&&(a.value=it,O.locale=it,Hw(O,a.value,l.value))}),g.watch(e.fallbackLocale,it=>{s&&(l.value=it,O.fallbackLocale=it,Hw(O,a.value,l.value))}));const rn={id:tY,locale:$,fallbackLocale:W,get inheritLocale(){return s},set inheritLocale(it){s=it,it&&e&&(a.value=e.locale.value,l.value=e.fallbackLocale.value,Hw(O,a.value,l.value))},get availableLocales(){return Object.keys(c.value).sort()},messages:J,get modifiers(){return A},get pluralRules(){return I||{}},get isGlobal(){return r},get missingWarn(){return p},set missingWarn(it){p=it,O.missingWarn=p},get fallbackWarn(){return m},set fallbackWarn(it){m=it,O.fallbackWarn=m},get fallbackRoot(){return y},set fallbackRoot(it){y=it},get fallbackFormat(){return w},set fallbackFormat(it){w=it,O.fallbackFormat=w},get warnHtmlMessage(){return M},set warnHtmlMessage(it){M=it,O.warnHtmlMessage=it},get escapeParameter(){return E},set escapeParameter(it){E=it,O.escapeParameter=it},t:oe,getLocaleMessage:Ht,setLocaleMessage:wn,mergeLocaleMessage:cn,getPostTranslationHandler:j,setPostTranslationHandler:G,getMissingHandler:U,setMissingHandler:Q,[Xq]:pt};return rn.datetimeFormats=Z,rn.numberFormats=q,rn.rt=he,rn.te=yt,rn.tm=hn,rn.d=xe,rn.n=Ee,rn.getDateTimeFormat=Hn,rn.setDateTimeFormat=Bn,rn.mergeDateTimeFormat=Ue,rn.getNumberFormat=qe,rn.setNumberFormat=Et,rn.mergeNumberFormat=qt,rn[Kq]=n,rn[XD]=$e,rn[KD]=lt,rn[JD]=Ze,_n.NODE_ENV!=="production"&&(rn[py]=it=>{O.__v_emitter=it},rn[Gw]=()=>{O.__v_emitter=void 0}),rn}const rY="vue-i18n: composer properties",nR={"vue-devtools-plugin-vue-i18n":"Vue I18n DevTools","vue-i18n-resource-inspector":"Vue I18n DevTools","vue-i18n-timeline":"Vue I18n"},F$e={"vue-i18n-resource-inspector":"Search for scopes ..."},$$e={"vue-i18n-timeline":16764185};let rR;async function z$e(t,e){return new Promise((n,r)=>{try{L$e({id:"vue-devtools-plugin-vue-i18n",label:nR["vue-devtools-plugin-vue-i18n"],packageName:"vue-i18n",homepage:"https://vue-i18n.intlify.dev",logo:"https://vue-i18n.intlify.dev/vue-i18n-devtools-logo.png",componentStateTypes:[rY],app:t},i=>{rR=i,i.on.visitComponentTree(({componentInstance:s,treeNode:a})=>{V$e(s,a,e)}),i.on.inspectComponent(({componentInstance:s,instanceData:a})=>{s.vnode.el&&s.vnode.el.__VUE_I18N__&&a&&(e.mode==="legacy"?s.vnode.el.__VUE_I18N__!==e.global.__composer&&oY(a,s.vnode.el.__VUE_I18N__):oY(a,s.vnode.el.__VUE_I18N__))}),i.addInspector({id:"vue-i18n-resource-inspector",label:nR["vue-i18n-resource-inspector"],icon:"language",treeFilterPlaceholder:F$e["vue-i18n-resource-inspector"]}),i.on.getInspectorTree(s=>{s.app===t&&s.inspectorId==="vue-i18n-resource-inspector"&&G$e(s,e)});const o=new Map;i.on.getInspectorState(async s=>{if(s.app===t&&s.inspectorId==="vue-i18n-resource-inspector")if(i.unhighlightElement(),Y$e(s,e),s.nodeId==="global"){if(!o.has(s.app)){const[a]=await i.getComponentInstances(s.app);o.set(s.app,a)}i.highlightElement(o.get(s.app))}else{const a=q$e(s.nodeId,e);a&&i.highlightElement(a)}}),i.on.editInspectorState(s=>{s.app===t&&s.inspectorId==="vue-i18n-resource-inspector"&&X$e(s,e)}),i.addTimelineLayer({id:"vue-i18n-timeline",label:nR["vue-i18n-timeline"],color:$$e["vue-i18n-timeline"]}),n(!0)})}catch(i){console.error(i),r(!1)}})}function iY(t){return t.type.name||t.type.displayName||t.type.__file||"Anonymous"}function V$e(t,e,n){const r=n.mode==="composition"?n.global:n.global.__composer;if(t&&t.vnode.el&&t.vnode.el.__VUE_I18N__&&t.vnode.el.__VUE_I18N__!==r){const i={label:`i18n (${iY(t)} Scope)`,textColor:0,backgroundColor:16764185};e.tags.push(i)}}function oY(t,e){const n=rY;t.state.push({type:n,key:"locale",editable:!0,value:e.locale.value}),t.state.push({type:n,key:"availableLocales",editable:!1,value:e.availableLocales}),t.state.push({type:n,key:"fallbackLocale",editable:!0,value:e.fallbackLocale.value}),t.state.push({type:n,key:"inheritLocale",editable:!0,value:e.inheritLocale}),t.state.push({type:n,key:"messages",editable:!1,value:iR(e.messages.value)}),t.state.push({type:n,key:"datetimeFormats",editable:!1,value:e.datetimeFormats.value}),t.state.push({type:n,key:"numberFormats",editable:!1,value:e.numberFormats.value})}function iR(t){const e={};return Object.keys(t).forEach(n=>{const r=t[n];Ji(r)&&"source"in r?e[n]=W$e(r):Fu(r)&&r.loc&&r.loc.source?e[n]=r.loc.source:gi(r)?e[n]=iR(r):e[n]=r}),e}const j$e={"<":"<",">":">",'"':""","&":"&"};function U$e(t){return t.replace(/[<>"&]/g,H$e)}function H$e(t){return j$e[t]||t}function W$e(t){return{_custom:{type:"function",display:`ƒ ${t.source?`("${U$e(t.source)}")`:"(?)"}`}}}function G$e(t,e){t.rootNodes.push({id:"global",label:"Global Scope"});const n=e.mode==="composition"?e.global:e.global.__composer;for(const[r,i]of e.__instances){const o=e.mode==="composition"?i:i.__composer;n!==o&&t.rootNodes.push({id:o.id.toString(),label:`${iY(r)} Scope`})}}function q$e(t,e){let n=null;if(t!=="global"){for(const[r,i]of e.__instances.entries())if(i.id.toString()===t){n=r;break}}return n}function sY(t,e){if(t==="global")return e.mode==="composition"?e.global:e.global.__composer;{const n=Array.from(e.__instances.values()).find(r=>r.id.toString()===t);return n?e.mode==="composition"?n:n.__composer:null}}function Y$e(t,e){const n=sY(t.nodeId,e);return n&&(t.state=Z$e(n)),null}function Z$e(t){const e={},n="Locale related info",r=[{type:n,key:"locale",editable:!0,value:t.locale.value},{type:n,key:"fallbackLocale",editable:!0,value:t.fallbackLocale.value},{type:n,key:"availableLocales",editable:!1,value:t.availableLocales},{type:n,key:"inheritLocale",editable:!0,value:t.inheritLocale}];e[n]=r;const i="Locale messages info",o=[{type:i,key:"messages",editable:!1,value:iR(t.messages.value)}];e[i]=o;{const s="Datetime formats info",a=[{type:s,key:"datetimeFormats",editable:!1,value:t.datetimeFormats.value}];e[s]=a;const l="Datetime formats info",c=[{type:l,key:"numberFormats",editable:!1,value:t.numberFormats.value}];e[l]=c}return e}function Zw(t,e){if(rR){let n;e&&"groupId"in e&&(n=e.groupId,delete e.groupId),rR.addTimelineEvent({layerId:"vue-i18n-timeline",event:{title:t,groupId:n,time:Date.now(),meta:{},data:e||{},logType:t==="compile-error"?"error":t==="fallback"||t==="missing"?"warning":"default"}})}}function X$e(t,e){const n=sY(t.nodeId,e);if(n){const[r]=t.path;r==="locale"&&sn(t.state.value)?n.locale.value=t.state.value:r==="fallbackLocale"&&(sn(t.state.value)||zo(t.state.value)||gi(t.state.value))?n.fallbackLocale.value=t.state.value:r==="inheritLocale"&&wi(t.state.value)&&(n.inheritLocale=t.state.value)}}function K$e(t){const e=sn(t.locale)?t.locale:Uw,n=sn(t.fallbackLocale)||zo(t.fallbackLocale)||Jr(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:e,r=Ji(t.missing)?t.missing:void 0,i=wi(t.silentTranslationWarn)||o_(t.silentTranslationWarn)?!t.silentTranslationWarn:!0,o=wi(t.silentFallbackWarn)||o_(t.silentFallbackWarn)?!t.silentFallbackWarn:!0,s=wi(t.fallbackRoot)?t.fallbackRoot:!0,a=!!t.formatFallbackMessages,l=Jr(t.modifiers)?t.modifiers:{},c=t.pluralizationRules,u=Ji(t.postTranslation)?t.postTranslation:void 0,d=sn(t.warnHtmlInMessage)?t.warnHtmlInMessage!=="off":!0,p=!!t.escapeParameterHtml,m=wi(t.sync)?t.sync:!0;let y=t.messages;if(Jr(t.sharedMessages)){const A=t.sharedMessages;y=Object.keys(A).reduce((I,O)=>{const z=I[O]||(I[O]={});return js(z,A[O]),I},y||{})}const{__i18n:w,__root:x,__injectWithOption:C}=t,S=t.datetimeFormats,M=t.numberFormats,E=t.flatJson;return{locale:e,fallbackLocale:n,messages:y,flatJson:E,datetimeFormats:S,numberFormats:M,missing:r,missingWarn:i,fallbackWarn:o,fallbackRoot:s,fallbackFormat:a,modifiers:l,pluralRules:c,postTranslation:u,warnHtmlMessage:d,escapeParameter:p,messageResolver:t.messageResolver,inheritLocale:m,__i18n:w,__root:x,__injectWithOption:C}}function oR(t={}){const e=tR(K$e(t)),{__extender:n}=t,r={id:e.id,get locale(){return e.locale.value},set locale(i){e.locale.value=i},get fallbackLocale(){return e.fallbackLocale.value},set fallbackLocale(i){e.fallbackLocale.value=i},get messages(){return e.messages.value},get datetimeFormats(){return e.datetimeFormats.value},get numberFormats(){return e.numberFormats.value},get availableLocales(){return e.availableLocales},get missing(){return e.getMissingHandler()},set missing(i){e.setMissingHandler(i)},get silentTranslationWarn(){return wi(e.missingWarn)?!e.missingWarn:e.missingWarn},set silentTranslationWarn(i){e.missingWarn=wi(i)?!i:i},get silentFallbackWarn(){return wi(e.fallbackWarn)?!e.fallbackWarn:e.fallbackWarn},set silentFallbackWarn(i){e.fallbackWarn=wi(i)?!i:i},get modifiers(){return e.modifiers},get formatFallbackMessages(){return e.fallbackFormat},set formatFallbackMessages(i){e.fallbackFormat=i},get postTranslation(){return e.getPostTranslationHandler()},set postTranslation(i){e.setPostTranslationHandler(i)},get sync(){return e.inheritLocale},set sync(i){e.inheritLocale=i},get warnHtmlInMessage(){return e.warnHtmlMessage?"warn":"off"},set warnHtmlInMessage(i){e.warnHtmlMessage=i!=="off"},get escapeParameterHtml(){return e.escapeParameter},set escapeParameterHtml(i){e.escapeParameter=i},get pluralizationRules(){return e.pluralRules||{}},__composer:e,t(...i){return Reflect.apply(e.t,e,[...i])},rt(...i){return Reflect.apply(e.rt,e,[...i])},te(i,o){return e.te(i,o)},tm(i){return e.tm(i)},getLocaleMessage(i){return e.getLocaleMessage(i)},setLocaleMessage(i,o){e.setLocaleMessage(i,o)},mergeLocaleMessage(i,o){e.mergeLocaleMessage(i,o)},d(...i){return Reflect.apply(e.d,e,[...i])},getDateTimeFormat(i){return e.getDateTimeFormat(i)},setDateTimeFormat(i,o){e.setDateTimeFormat(i,o)},mergeDateTimeFormat(i,o){e.mergeDateTimeFormat(i,o)},n(...i){return Reflect.apply(e.n,e,[...i])},getNumberFormat(i){return e.getNumberFormat(i)},setNumberFormat(i,o){e.setNumberFormat(i,o)},mergeNumberFormat(i,o){e.mergeNumberFormat(i,o)}};return r.__extender=n,_n.NODE_ENV!=="production"&&(r.__enableEmitter=i=>{const o=e;o[py]&&o[py](i)},r.__disableEmitter=()=>{const i=e;i[Gw]&&i[Gw]()}),r}function J$e(t,e,n){return{beforeCreate(){const r=g.getCurrentInstance();if(!r)throw Nl(Wi.UNEXPECTED_ERROR);const i=this.$options;if(i.i18n){const o=i.i18n;if(i.__i18n&&(o.__i18n=i.__i18n),o.__root=e,this===this.$root)this.$i18n=aY(t,o);else{o.__injectWithOption=!0,o.__extender=n.__vueI18nExtend,this.$i18n=oR(o);const s=this.$i18n;s.__extender&&(s.__disposer=s.__extender(this.$i18n))}}else if(i.__i18n)if(this===this.$root)this.$i18n=aY(t,i);else{this.$i18n=oR({__i18n:i.__i18n,__injectWithOption:!0,__extender:n.__vueI18nExtend,__root:e});const o=this.$i18n;o.__extender&&(o.__disposer=o.__extender(this.$i18n))}else this.$i18n=t;i.__i18nGlobal&&Jq(e,i,i),this.$t=(...o)=>this.$i18n.t(...o),this.$rt=(...o)=>this.$i18n.rt(...o),this.$te=(o,s)=>this.$i18n.te(o,s),this.$d=(...o)=>this.$i18n.d(...o),this.$n=(...o)=>this.$i18n.n(...o),this.$tm=o=>this.$i18n.tm(o),n.__setInstance(r,this.$i18n)},mounted(){if(_n.NODE_ENV!=="production"&&this.$el&&this.$i18n){const r=this.$i18n;this.$el.__VUE_I18N__=r.__composer;const i=this.__v_emitter=RD();r.__enableEmitter&&r.__enableEmitter(i),i.on("*",Zw)}},unmounted(){const r=g.getCurrentInstance();if(!r)throw Nl(Wi.UNEXPECTED_ERROR);const i=this.$i18n;_n.NODE_ENV!=="production"&&this.$el&&this.$el.__VUE_I18N__&&(this.__v_emitter&&(this.__v_emitter.off("*",Zw),delete this.__v_emitter),this.$i18n&&(i.__disableEmitter&&i.__disableEmitter(),delete this.$el.__VUE_I18N__)),delete this.$t,delete this.$rt,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,i.__disposer&&(i.__disposer(),delete i.__disposer,delete i.__extender),n.__deleteInstance(r),delete this.$i18n}}}function aY(t,e){t.locale=e.locale||t.locale,t.fallbackLocale=e.fallbackLocale||t.fallbackLocale,t.missing=e.missing||t.missing,t.silentTranslationWarn=e.silentTranslationWarn||t.silentFallbackWarn,t.silentFallbackWarn=e.silentFallbackWarn||t.silentFallbackWarn,t.formatFallbackMessages=e.formatFallbackMessages||t.formatFallbackMessages,t.postTranslation=e.postTranslation||t.postTranslation,t.warnHtmlInMessage=e.warnHtmlInMessage||t.warnHtmlInMessage,t.escapeParameterHtml=e.escapeParameterHtml||t.escapeParameterHtml,t.sync=e.sync||t.sync,t.__composer[Xq](e.pluralizationRules||t.pluralizationRules);const n=eR(t.locale,{messages:e.messages,__i18n:e.__i18n});return Object.keys(n).forEach(r=>t.mergeLocaleMessage(r,n[r])),e.datetimeFormats&&Object.keys(e.datetimeFormats).forEach(r=>t.mergeDateTimeFormat(r,e.datetimeFormats[r])),e.numberFormats&&Object.keys(e.numberFormats).forEach(r=>t.mergeNumberFormat(r,e.numberFormats[r])),t}const sR={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:t=>t==="parent"||t==="global",default:"parent"},i18n:{type:Object}};function Q$e({slots:t},e){return e.length===1&&e[0]==="default"?(t.default?t.default():[]).reduce((n,r)=>[...n,...r.type===g.Fragment?r.children:[r]],[]):e.reduce((n,r)=>{const i=t[r];return i&&(n[r]=i()),n},Hi())}function lY(){return g.Fragment}const e4e=g.defineComponent({name:"i18n-t",props:js({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:t=>Es(t)||!isNaN(t)}},sR),setup(t,e){const{slots:n,attrs:r}=e,i=t.i18n||eM({useScope:t.scope,__useComponent:!0});return()=>{const o=Object.keys(n).filter(d=>d[0]!=="_"),s=Hi();t.locale&&(s.locale=t.locale),t.plural!==void 0&&(s.plural=sn(t.plural)?+t.plural:t.plural);const a=Q$e(e,o),l=i[XD](t.keypath,a,s),c=js(Hi(),r),u=sn(t.tag)||gi(t.tag)?t.tag:lY();return g.h(u,c,l)}}}),cY=e4e;function t4e(t){return zo(t)&&!sn(t[0])}function uY(t,e,n,r){const{slots:i,attrs:o}=e;return()=>{const s={part:!0};let a=Hi();t.locale&&(s.locale=t.locale),sn(t.format)?s.key=t.format:gi(t.format)&&(sn(t.format.key)&&(s.key=t.format.key),a=Object.keys(t.format).reduce((p,m)=>n.includes(m)?js(Hi(),p,{[m]:t.format[m]}):p,Hi()));const l=r(t.value,s,a);let c=[s.key];zo(l)?c=l.map((p,m)=>{const y=i[p.type],w=y?y({[p.type]:p.value,index:m,parts:l}):[p.value];return t4e(w)&&(w[0].key=`${p.type}-${m}`),w}):sn(l)&&(c=[l]);const u=js(Hi(),o),d=sn(t.tag)||gi(t.tag)?t.tag:lY();return g.h(d,u,c)}}const n4e=g.defineComponent({name:"i18n-n",props:js({value:{type:Number,required:!0},format:{type:[String,Object]}},sR),setup(t,e){const n=t.i18n||eM({useScope:t.scope,__useComponent:!0});return uY(t,e,jq,(...r)=>n[JD](...r))}}),hY=n4e;function r4e(t,e){const n=t;if(t.mode==="composition")return n.__getInstance(e)||t.global;{const r=n.__getInstance(e);return r!=null?r.__composer:t.global.__composer}}function i4e(t){const e=n=>{_n.NODE_ENV!=="production"&&DD(qw(Cd.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE));const{instance:r,value:i}=n;if(!r||!r.$)throw Nl(Wi.UNEXPECTED_ERROR);const o=r4e(t,r.$),s=dY(i);return[Reflect.apply(o.t,o,[...fY(s)]),o]};return{created:(n,r)=>{const[i,o]=e(r);wh&&t.global===o&&(n.__i18nWatcher=g.watch(o.locale,()=>{r.instance&&r.instance.$forceUpdate()})),n.__composer=o,n.textContent=i},unmounted:n=>{wh&&n.__i18nWatcher&&(n.__i18nWatcher(),n.__i18nWatcher=void 0,delete n.__i18nWatcher),n.__composer&&(n.__composer=void 0,delete n.__composer)},beforeUpdate:(n,{value:r})=>{if(n.__composer){const i=n.__composer,o=dY(r);n.textContent=Reflect.apply(i.t,i,[...fY(o)])}},getSSRProps:n=>{const[r]=e(n);return{textContent:r}}}}function dY(t){if(sn(t))return{path:t};if(Jr(t)){if(!("path"in t))throw Nl(Wi.REQUIRED_VALUE,"path");return t}else throw Nl(Wi.INVALID_VALUE)}function fY(t){const{path:e,locale:n,args:r,choice:i,plural:o}=t,s={},a=r||{};return sn(n)&&(s.locale=n),Es(i)&&(s.plural=i),Es(o)&&(s.plural=o),[e,a,s]}function o4e(t,e,...n){const r=Jr(n[0])?n[0]:{};(!wi(r.globalInstall)||r.globalInstall)&&([cY.name,"I18nT"].forEach(i=>t.component(i,cY)),[hY.name,"I18nN"].forEach(i=>t.component(i,hY)),[mY.name,"I18nD"].forEach(i=>t.component(i,mY))),t.directive("t",i4e(e))}const s4e=Ed("global-vue-i18n");function a4e(t={}){const e=__VUE_I18N_LEGACY_API__&&wi(t.legacy)?t.legacy:__VUE_I18N_LEGACY_API__;_n.NODE_ENV!=="production"&&e&&DD(qw(Cd.DEPRECATE_LEGACY_MODE));const n=wi(t.globalInjection)?t.globalInjection:!0,r=new Map,[i,o]=l4e(t,e),s=Ed(_n.NODE_ENV!=="production"?"vue-i18n":"");function a(d){return r.get(d)||null}function l(d,p){r.set(d,p)}function c(d){r.delete(d)}const u={get mode(){return __VUE_I18N_LEGACY_API__&&e?"legacy":"composition"},async install(d,...p){if(_n.NODE_ENV!=="production"&&(d.__VUE_I18N__=u),d.__VUE_I18N_SYMBOL__=s,d.provide(d.__VUE_I18N_SYMBOL__,u),Jr(p[0])){const w=p[0];u.__composerExtend=w.__composerExtend,u.__vueI18nExtend=w.__vueI18nExtend}let m=null;!e&&n&&(m=g4e(d,u.global)),__VUE_I18N_FULL_INSTALL__&&o4e(d,u,...p),__VUE_I18N_LEGACY_API__&&e&&d.mixin(J$e(o,o.__composer,u));const y=d.unmount;if(d.unmount=()=>{m&&m(),u.dispose(),y()},_n.NODE_ENV!=="production"){if(!await z$e(d,u))throw Nl(Wi.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);const w=RD();if(e){const x=o;x.__enableEmitter&&x.__enableEmitter(w)}else{const x=o;x[py]&&x[py](w)}w.on("*",Zw)}},get global(){return o},dispose(){i.stop()},__instances:r,__getInstance:a,__setInstance:l,__deleteInstance:c};return u}function eM(t={}){const e=g.getCurrentInstance();if(e==null)throw Nl(Wi.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw Nl(Wi.NOT_INSTALLED);const n=c4e(e),r=h4e(n),i=R$e(e),o=u4e(t,i);if(o==="global")return Jq(r,t,i),r;if(o==="parent"){let l=d4e(n,e,t.__useComponent);return l==null&&(_n.NODE_ENV!=="production"&&um(qw(Cd.NOT_FOUND_PARENT_SCOPE)),l=r),l}const s=n;let a=s.__getInstance(e);if(a==null){const l=js({},t);"__i18n"in i&&(l.__i18n=i.__i18n),r&&(l.__root=r),a=tR(l),s.__composerExtend&&(a[QD]=s.__composerExtend(a)),p4e(s,e,a),s.__setInstance(e,a)}else if(_n.NODE_ENV!=="production"&&o==="local")throw Nl(Wi.DUPLICATE_USE_I18N_CALLING);return a}function l4e(t,e){const n=g.effectScope(),r=__VUE_I18N_LEGACY_API__&&e?n.run(()=>oR(t)):n.run(()=>tR(t));if(r==null)throw Nl(Wi.UNEXPECTED_ERROR);return[n,r]}function c4e(t){const e=g.inject(t.isCE?s4e:t.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw Nl(t.isCE?Wi.NOT_INSTALLED_WITH_PROVIDE:Wi.UNEXPECTED_ERROR);return e}function u4e(t,e){return GT(t)?"__i18n"in e?"local":"global":t.useScope?t.useScope:"local"}function h4e(t){return t.mode==="composition"?t.global:t.global.__composer}function d4e(t,e,n=!1){let r=null;const i=e.root;let o=f4e(e,n);for(;o!=null;){const s=t;if(t.mode==="composition")r=s.__getInstance(o);else if(__VUE_I18N_LEGACY_API__){const a=s.__getInstance(o);a!=null&&(r=a.__composer,n&&r&&!r[Kq]&&(r=null))}if(r!=null||i===o)break;o=o.parent}return r}function f4e(t,e=!1){return t==null?null:e&&t.vnode.ctx||t.parent}function p4e(t,e,n){let r=null;g.onMounted(()=>{if(_n.NODE_ENV!=="production"&&e.vnode.el){e.vnode.el.__VUE_I18N__=n,r=RD();const i=n;i[py]&&i[py](r),r.on("*",Zw)}},e),g.onUnmounted(()=>{const i=n;_n.NODE_ENV!=="production"&&e.vnode.el&&e.vnode.el.__VUE_I18N__&&(r&&r.off("*",Zw),i[Gw]&&i[Gw](),delete e.vnode.el.__VUE_I18N__),t.__deleteInstance(e);const o=i[QD];o&&(o(),delete i[QD])},e)}const m4e=["locale","fallbackLocale","availableLocales"],pY=["t","rt","d","n","tm","te"];function g4e(t,e){const n=Object.create(null);return m4e.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i)throw Nl(Wi.UNEXPECTED_ERROR);const o=g.isRef(i.value)?{get(){return i.value.value},set(s){i.value.value=s}}:{get(){return i.get&&i.get()}};Object.defineProperty(n,r,o)}),t.config.globalProperties.$i18n=n,pY.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i||!i.value)throw Nl(Wi.UNEXPECTED_ERROR);Object.defineProperty(t.config.globalProperties,`$${r}`,i)}),()=>{delete t.config.globalProperties.$i18n,pY.forEach(r=>{delete t.config.globalProperties[`$${r}`]})}}const y4e=g.defineComponent({name:"i18n-d",props:js({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},sR),setup(t,e){const n=t.i18n||eM({useScope:t.scope,__useComponent:!0});return uY(t,e,$q,(...r)=>n[KD](...r))}}),mY=y4e;if(N$e(),o$e(B5e),s$e(e$e),a$e(Sq),_n.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const t=dy();t.__INTLIFY__=!0,F5e(t.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}const v4e={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},_4e={__name:"vs-editor-link",props:{editor:Object},setup(t){const{t:e}=eM(),n=t,r=g.ref(!1),i=g.ref(""),o=()=>{n.editor.chain().focus().toggleLink({href:i.value}).run(),r.value=!1,i.value=""};return(s,a)=>(g.openBlock(),g.createElementBlock(g.Fragment,null,[g.createElementVNode("button",{onClick:a[0]||(a[0]=l=>r.value=!0),class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none"},a[4]||(a[4]=[g.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13.213 9.787a3.391 3.391 0 0 0-4.795 0l-3.425 3.426a3.39 3.39 0 0 0 4.795 4.794l.321-.304m-.321-4.49a3.39 3.39 0 0 0 4.795 0l3.424-3.426a3.39 3.39 0 0 0-4.794-4.795l-1.028.961"})],-1)])),g.createVNode(SFe,{title:g.unref(e)("tiptap.linkTitle"),visible:r.value,"onUpdate:visible":a[3]||(a[3]=l=>r.value=l),size:"small"},{footer:g.withCtx(()=>[g.createElementVNode("div",v4e,[g.createElementVNode("button",{style:{border:"1px solid #000"},onClick:a[2]||(a[2]=l=>{r.value=!1,i.value=""}),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"},g.toDisplayString(g.unref(e)("tiptap.cancel")),1),g.createElementVNode("button",{onClick:o,class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"},g.toDisplayString(g.unref(e)("tiptap.create")),1)])]),default:g.withCtx(()=>[g.createVNode(iq,{modelValue:i.value,"onUpdate:modelValue":a[1]||(a[1]=l=>i.value=l),placeholder:g.unref(e)("tiptap.linkTitle")},null,8,["modelValue","placeholder"])]),_:1},8,["title","visible"])],64))}},b4e={class:"flex flex-col gap-[2px] p-[2px]"},w4e=["onClick"],x4e={__name:"vs-editor-table",props:{editor:Object},setup(t){const{$t:e}=g.getCurrentInstance().proxy,n=t,r=g.ref(!1),i=g.ref("popover"),o=()=>{n.editor&&(n.editor.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),i.value.togglePopover())},s=()=>{n.editor&&(n.editor.chain().focus().addColumnAfter().run(),i.value.togglePopover())},a=()=>{n.editor&&(n.editor.chain().focus().addRowAfter().run(),i.value.togglePopover())},l=()=>{n.editor&&(n.editor.chain().focus().deleteColumn().run(),i.value.togglePopover())},c=()=>{n.editor&&(n.editor.chain().focus().deleteRow().run(),i.value.togglePopover())},u=()=>{n.editor&&(n.editor.chain().focus().deleteTable().run(),i.value.togglePopover())},d=[{text:e("tiptap.createTable"),function:o},{text:e("tiptap.addColumn"),function:s},{text:e("tiptap.addRow"),function:a},{text:e("tiptap.deleteColumn"),function:l},{text:e("tiptap.deleteRow"),function:c},{text:e("tiptap.deleteTable"),function:u}];return(p,m)=>(g.openBlock(),g.createBlock(zw,{ref_key:"popover",ref:i,placement:"bottom",onIsvisible:m[0]||(m[0]=y=>r.value=y)},{reference:g.withCtx(()=>[g.createElementVNode("button",{class:g.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[r.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},m[1]||(m[1]=[g.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-table"},[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g.createElementVNode("path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"}),g.createElementVNode("path",{d:"M3 10h18"}),g.createElementVNode("path",{d:"M10 3v18"})],-1)]),2)]),default:g.withCtx(()=>[g.createElementVNode("div",b4e,[(g.openBlock(),g.createElementBlock(g.Fragment,null,g.renderList(d,(y,w)=>g.createElementVNode("button",{key:w,onClick:y==null?void 0:y.function,class:"px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded"},g.toDisplayString(y.text),9,w4e)),64))])]),_:1},512))}},E4e={},S4e={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-center"};function C4e(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",S4e,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M4 6l16 0"},null,-1),g.createElementVNode("path",{d:"M8 12l8 0"},null,-1),g.createElementVNode("path",{d:"M6 18l12 0"},null,-1)]))}const k4e=ol(E4e,[["render",C4e]]),T4e={},M4e={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-right"};function A4e(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",M4e,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M4 6l16 0"},null,-1),g.createElementVNode("path",{d:"M10 12l10 0"},null,-1),g.createElementVNode("path",{d:"M6 18l14 0"},null,-1)]))}const I4e=ol(T4e,[["render",A4e]]),L4e={},P4e={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-left"};function N4e(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",P4e,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M4 6l16 0"},null,-1),g.createElementVNode("path",{d:"M4 12l10 0"},null,-1),g.createElementVNode("path",{d:"M4 18l14 0"},null,-1)]))}const O4e=ol(L4e,[["render",N4e]]),gY={left:O4e,center:k4e,right:I4e},D4e={class:"flex gap-[4px] p-1"},R4e=["onClick"],B4e={__name:"vs-editor-align",props:{editor:Object},setup(t){const e=t,n=g.ref(!1),r=g.ref("popover"),i=g.ref("left"),o=g.computed(()=>{var u;return(u=e.editor)==null?void 0:u.isActive({textAlign:"left"})}),s=g.computed(()=>{var u;return(u=e.editor)==null?void 0:u.isActive({textAlign:"right"})}),a=g.computed(()=>{var u;return(u=e.editor)==null?void 0:u.isActive({textAlign:"center"})}),l=u=>{e.editor&&e.editor.chain().focus().setTextAlign(u).run()},c=g.ref([{id:"left",isActive:o},{id:"center",isActive:a},{id:"right",isActive:s}]);return(u,d)=>(g.openBlock(),g.createBlock(zw,{ref_key:"popover",ref:r,placement:"bottom",onIsvisible:d[0]||(d[0]=p=>n.value=p)},{reference:g.withCtx(()=>[g.createElementVNode("button",{class:g.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[n.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[(g.openBlock(),g.createBlock(g.resolveDynamicComponent(g.unref(gY)[i.value]),{height:"16",width:"16"}))],2)]),default:g.withCtx(()=>[g.createElementVNode("div",D4e,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(c.value,p=>(g.openBlock(),g.createElementBlock("button",{class:g.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":p==null?void 0:p.isActive}]),key:p==null?void 0:p.id,onClick:m=>l(p==null?void 0:p.id)},[(g.openBlock(),g.createBlock(g.resolveDynamicComponent(g.unref(gY)[p==null?void 0:p.id]),{height:"16",width:"16"}))],10,R4e))),128))])]),_:1},512))}},F4e={class:"flex flex-col gap-[2px] p-[2px]"},$4e=["onClick"],z4e={__name:"vs-editor-type-tag",props:{editor:Object},setup(t){const{$t:e}=g.getCurrentInstance().proxy,n=t,r=g.ref(!1),i=g.ref("popover"),o=()=>{var l;n.editor&&((l=n.editor)==null||l.chain().focus().setParagraph().run(),i.value.togglePopover())},s=l=>{var c;n.editor&&((c=n.editor)==null||c.chain().focus().toggleHeading({level:l}).run(),i.value.togglePopover())},a=[{text:"Заголовок 1",id:1,style:"font-[700] text-[30px]"},{text:"Заголовок 2",id:2,style:"font-[700] text-[26px]"},{text:"Заголовок 3",id:3,style:"font-[700] text-[22px]"},{text:"Заголовок 4",id:4,style:"font-[700] text-[18px]"},{text:"Заголовок 5",id:5,style:"font-[500] text-[16px]"},{text:"Заголовок 6",id:6,style:"font-[400] text-[14px]"}];return(l,c)=>(g.openBlock(),g.createBlock(zw,{ref_key:"popover",ref:i,placement:"bottom",onIsvisible:c[0]||(c[0]=u=>r.value=u)},{reference:g.withCtx(()=>[g.createElementVNode("button",{class:g.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[r.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},c[1]||(c[1]=[g.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-text-size"},[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g.createElementVNode("path",{d:"M3 7v-2h13v2"}),g.createElementVNode("path",{d:"M10 5v14"}),g.createElementVNode("path",{d:"M12 19h-4"}),g.createElementVNode("path",{d:"M15 13v-1h6v1"}),g.createElementVNode("path",{d:"M18 12v7"}),g.createElementVNode("path",{d:"M17 19h2"})],-1)]),2)]),default:g.withCtx(()=>{var u;return[g.createElementVNode("div",F4e,[g.createElementVNode("button",{onClick:o,class:g.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded",[(u=t.editor)!=null&&u.isActive("paragraph")?"bg-gray-100":""]])},g.toDisplayString(g.unref(e)("tiptap.paragraph")),3),(g.openBlock(),g.createElementBlock(g.Fragment,null,g.renderList(a,(d,p)=>{var m;return g.createElementVNode("button",{key:p,onClick:y=>s(d==null?void 0:d.id),class:g.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded leading-[100%]",[d==null?void 0:d.style,(m=t.editor)!=null&&m.isActive("heading",{level:d==null?void 0:d.id})?"bg-gray-100":""]])},g.toDisplayString(g.unref(e)(`tiptap.heading${d==null?void 0:d.id}`)),11,$4e)}),64))])]}),_:1},512))}},V4e={},j4e={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function U4e(t,e,n,r,i,o){return g.openBlock(),g.createElementBlock("svg",j4e,e[0]||(e[0]=[g.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),g.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const H4e=ol(V4e,[["render",U4e]]),W4e={components:{VsText:iq},events:["update:modelValue"],props:{modelValue:{type:String,default:()=>"#000000"},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},isTextInputShown:{type:Boolean,default:()=>!0}},computed:{value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}}}},G4e={class:"flex items-center w-full"},q4e=["disabled"];function Y4e(t,e,n,r,i,o){const s=g.resolveComponent("vs-text");return g.openBlock(),g.createElementBlock("div",G4e,[g.withDirectives(g.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=a=>o.value=a),type:"color",class:g.normalizeClass(["w-10 h-10 py-[2px] px-[3px] dark:bg-neutral-800 border dark:border-neutral-700 border-stone-200 rounded-lg",n.disabled?"cursor-not-allowed":"cursor-pointer"]),disabled:n.disabled},null,10,q4e),[[g.vModelText,o.value]]),n.isTextInputShown?(g.openBlock(),g.createBlock(s,{key:0,modelValue:o.value,"onUpdate:modelValue":e[1]||(e[1]=a=>o.value=a),class:"ml-2 w-full",disabled:n.disabled,clearable:n.clearable},null,8,["modelValue","disabled","clearable"])):g.createCommentVNode("",!0)])}const Z4e=ol(W4e,[["render",Y4e]]),X4e={class:"w-[30px] h-[30px] rounded-full hover:bg-gray-100 justify-center items-center relative flex"},K4e={class:"w-[160px]"},J4e={class:"flex gap-[4px] mb-[8px]"},Q4e={class:"flex w-[160px] flex-wrap gap-[4px]"},eze=["onClick"],tze={__name:"vs-editor-colorpicker",props:{editor:Object},setup(t){const e=t,n=g.ref("popover"),r=g.ref("#000000"),i=g.ref("#000000"),o=g.ref(["#000000","#0055CC","#206A83","#216E4E","#E56910","#AE2E24","#5E4DB2","#758195","#FF0000","#008000","#28A9AB","#AB7222"]),s=l=>{e.editor&&(e.editor.chain().focus().setColor(l).run(),i.value=l,n.value&&n.value.togglePopover())},a=()=>{s(r.value),r.value=""};return(l,c)=>(g.openBlock(),g.createBlock(zw,{ref_key:"popover",ref:n,placement:"bottom"},{reference:g.withCtx(()=>[g.createElementVNode("button",X4e,[c[1]||(c[1]=g.createElementVNode("svg",{class:"text-gray-500",height:"16",width:"16","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 19.2H5.5c-.3 0-.5-.2-.5-.5V16c0-.2.2-.4.5-.4h13c.3 0 .5.2.5.4v2.7c0 .3-.2.5-.5.5H18m-6-1 1.4 1.8h.2l1.4-1.7m-7-5.4L12 4c0-.1 0-.1 0 0l4 8.8m-6-2.7h4m-7 2.7h2.5m5 0H17"})],-1)),g.createElementVNode("span",{class:"absolute h-[2px] w-[40%] bottom-[10px] left-[9px]",style:g.normalizeStyle({backgroundColor:i.value})},null,4)])]),default:g.withCtx(()=>[g.createElementVNode("div",K4e,[g.createElementVNode("div",J4e,[g.createVNode(Z4e,{modelValue:r.value,"onUpdate:modelValue":c[0]||(c[0]=u=>r.value=u)},null,8,["modelValue"]),g.createElementVNode("button",{onClick:a,class:"h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"},[g.createVNode(H4e,{class:"h-[24px] w-[24px] text-white"})])]),g.createElementVNode("ul",Q4e,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(o.value,u=>(g.openBlock(),g.createElementBlock("li",{class:"h-[37px] w-[37px] rounded",style:g.normalizeStyle({backgroundColor:u}),onClick:d=>s(u),key:u},null,12,eze))),128))])])]),_:1},512))}},yY={bold:oFe,italic:lFe,color:pFe,color_picker:tze,bullet_list:XBe,ordered_list:QBe,blockquote:qBe,codeblock:nFe,underline:mFe,strike:gFe,link:_4e,table:x4e,text_align:B4e,type_tag:z4e};function vY(t,e){return function(){return t.apply(e,arguments)}}const{toString:nze}=Object.prototype,{getPrototypeOf:aR}=Object,{iterator:tM,toStringTag:_Y}=Symbol,nM=(t=>e=>{const n=nze.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Sh=t=>(t=t.toLowerCase(),e=>nM(e)===t),rM=t=>e=>typeof e===t,{isArray:c_}=Array,Xw=rM("undefined");function rze(t){return t!==null&&!Xw(t)&&t.constructor!==null&&!Xw(t.constructor)&&dc(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const bY=Sh("ArrayBuffer");function ize(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&bY(t.buffer),e}const oze=rM("string"),dc=rM("function"),wY=rM("number"),iM=t=>t!==null&&typeof t=="object",sze=t=>t===!0||t===!1,oM=t=>{if(nM(t)!=="object")return!1;const e=aR(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(_Y in t)&&!(tM in t)},aze=Sh("Date"),lze=Sh("File"),cze=Sh("Blob"),uze=Sh("FileList"),hze=t=>iM(t)&&dc(t.pipe),dze=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||dc(t.append)&&((e=nM(t))==="formdata"||e==="object"&&dc(t.toString)&&t.toString()==="[object FormData]"))},fze=Sh("URLSearchParams"),[pze,mze,gze,yze]=["ReadableStream","Request","Response","Headers"].map(Sh),vze=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Kw(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,i;if(typeof t!="object"&&(t=[t]),c_(t))for(r=0,i=t.length;r0;)if(i=n[r],e===i.toLowerCase())return i;return null}const my=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,EY=t=>!Xw(t)&&t!==my;function lR(){const{caseless:t}=EY(this)&&this||{},e={},n=(r,i)=>{const o=t&&xY(e,i)||i;oM(e[o])&&oM(r)?e[o]=lR(e[o],r):oM(r)?e[o]=lR({},r):c_(r)?e[o]=r.slice():e[o]=r};for(let r=0,i=arguments.length;r(Kw(e,(i,o)=>{n&&dc(i)?t[o]=vY(i,n):t[o]=i},{allOwnKeys:r}),t),bze=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),wze=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},xze=(t,e,n,r)=>{let i,o,s;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)s=i[o],(!r||r(s,t,e))&&!a[s]&&(e[s]=t[s],a[s]=!0);t=n!==!1&&aR(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},Eze=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},Sze=t=>{if(!t)return null;if(c_(t))return t;let e=t.length;if(!wY(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},Cze=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&aR(Uint8Array)),kze=(t,e)=>{const n=(t&&t[tM]).call(t);let r;for(;(r=n.next())&&!r.done;){const i=r.value;e.call(t,i[0],i[1])}},Tze=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},Mze=Sh("HTMLFormElement"),Aze=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,n,r){return n.toUpperCase()+r}),SY=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Ize=Sh("RegExp"),CY=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};Kw(n,(i,o)=>{let s;(s=e(i,o,t))!==!1&&(r[o]=s||i)}),Object.defineProperties(t,r)},Lze=t=>{CY(t,(e,n)=>{if(dc(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(dc(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Pze=(t,e)=>{const n={},r=i=>{i.forEach(o=>{n[o]=!0})};return c_(t)?r(t):r(String(t).split(e)),n},Nze=()=>{},Oze=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Dze(t){return!!(t&&dc(t.append)&&t[_Y]==="FormData"&&t[tM])}const Rze=t=>{const e=new Array(10),n=(r,i)=>{if(iM(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const o=c_(r)?[]:{};return Kw(r,(s,a)=>{const l=n(s,i+1);!Xw(l)&&(o[a]=l)}),e[i]=void 0,o}}return r};return n(t,0)},Bze=Sh("AsyncFunction"),Fze=t=>t&&(iM(t)||dc(t))&&dc(t.then)&&dc(t.catch),kY=((t,e)=>t?setImmediate:e?((n,r)=>(my.addEventListener("message",({source:i,data:o})=>{i===my&&o===n&&r.length&&r.shift()()},!1),i=>{r.push(i),my.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",dc(my.postMessage)),$ze=typeof queueMicrotask<"u"?queueMicrotask.bind(my):typeof process<"u"&&process.nextTick||kY,zze=t=>t!=null&&dc(t[tM]),bt={isArray:c_,isArrayBuffer:bY,isBuffer:rze,isFormData:dze,isArrayBufferView:ize,isString:oze,isNumber:wY,isBoolean:sze,isObject:iM,isPlainObject:oM,isReadableStream:pze,isRequest:mze,isResponse:gze,isHeaders:yze,isUndefined:Xw,isDate:aze,isFile:lze,isBlob:cze,isRegExp:Ize,isFunction:dc,isStream:hze,isURLSearchParams:fze,isTypedArray:Cze,isFileList:uze,forEach:Kw,merge:lR,extend:_ze,trim:vze,stripBOM:bze,inherits:wze,toFlatObject:xze,kindOf:nM,kindOfTest:Sh,endsWith:Eze,toArray:Sze,forEachEntry:kze,matchAll:Tze,isHTMLForm:Mze,hasOwnProperty:SY,hasOwnProp:SY,reduceDescriptors:CY,freezeMethods:Lze,toObjectSet:Pze,toCamelCase:Aze,noop:Nze,toFiniteNumber:Oze,findKey:xY,global:my,isContextDefined:EY,isSpecCompliantForm:Dze,toJSONObject:Rze,isAsyncFn:Bze,isThenable:Fze,setImmediate:kY,asap:$ze,isIterable:zze};function hr(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}bt.inherits(hr,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:bt.toJSONObject(this.config),code:this.code,status:this.status}}});const TY=hr.prototype,MY={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{MY[t]={value:t}}),Object.defineProperties(hr,MY),Object.defineProperty(TY,"isAxiosError",{value:!0}),hr.from=(t,e,n,r,i,o)=>{const s=Object.create(TY);return bt.toFlatObject(t,s,function(a){return a!==Error.prototype},a=>a!=="isAxiosError"),hr.call(s,t.message,e,n,r,i),s.cause=t,s.name=t.name,o&&Object.assign(s,o),s};const Vze=null;function cR(t){return bt.isPlainObject(t)||bt.isArray(t)}function AY(t){return bt.endsWith(t,"[]")?t.slice(0,-2):t}function IY(t,e,n){return t?t.concat(e).map(function(r,i){return r=AY(r),!n&&i?"["+r+"]":r}).join(n?".":""):e}function jze(t){return bt.isArray(t)&&!t.some(cR)}const Uze=bt.toFlatObject(bt,{},null,function(t){return/^is[A-Z]/.test(t)});function sM(t,e,n){if(!bt.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=bt.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,y){return!bt.isUndefined(y[m])});const r=n.metaTokens,i=n.visitor||c,o=n.dots,s=n.indexes,a=(n.Blob||typeof Blob<"u"&&Blob)&&bt.isSpecCompliantForm(e);if(!bt.isFunction(i))throw new TypeError("visitor must be a function");function l(m){if(m===null)return"";if(bt.isDate(m))return m.toISOString();if(bt.isBoolean(m))return m.toString();if(!a&&bt.isBlob(m))throw new hr("Blob is not supported. Use a Buffer instead.");return bt.isArrayBuffer(m)||bt.isTypedArray(m)?a&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function c(m,y,w){let x=m;if(m&&!w&&typeof m=="object"){if(bt.endsWith(y,"{}"))y=r?y:y.slice(0,-2),m=JSON.stringify(m);else if(bt.isArray(m)&&jze(m)||(bt.isFileList(m)||bt.endsWith(y,"[]"))&&(x=bt.toArray(m)))return y=AY(y),x.forEach(function(C,S){!(bt.isUndefined(C)||C===null)&&e.append(s===!0?IY([y],S,o):s===null?y:y+"[]",l(C))}),!1}return cR(m)?!0:(e.append(IY(w,y,o),l(m)),!1)}const u=[],d=Object.assign(Uze,{defaultVisitor:c,convertValue:l,isVisitable:cR});function p(m,y){if(!bt.isUndefined(m)){if(u.indexOf(m)!==-1)throw Error("Circular reference detected in "+y.join("."));u.push(m),bt.forEach(m,function(w,x){(!(bt.isUndefined(w)||w===null)&&i.call(e,w,bt.isString(x)?x.trim():x,y,d))===!0&&p(w,y?y.concat(x):[x])}),u.pop()}}if(!bt.isObject(t))throw new TypeError("data must be an object");return p(t),e}function LY(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function uR(t,e){this._pairs=[],t&&sM(t,this,e)}const PY=uR.prototype;PY.append=function(t,e){this._pairs.push([t,e])},PY.toString=function(t){const e=t?function(n){return t.call(this,n,LY)}:LY;return this._pairs.map(function(n){return e(n[0])+"="+e(n[1])},"").join("&")};function Hze(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function NY(t,e,n){if(!e)return t;const r=n&&n.encode||Hze;bt.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let o;if(i?o=i(e,n):o=bt.isURLSearchParams(e)?e.toString():new uR(e,n).toString(r),o){const s=t.indexOf("#");s!==-1&&(t=t.slice(0,s)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class OY{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){bt.forEach(this.handlers,function(n){n!==null&&e(n)})}}const DY={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Wze=typeof URLSearchParams<"u"?URLSearchParams:uR,Gze=typeof FormData<"u"?FormData:null,qze=typeof Blob<"u"?Blob:null,Yze={isBrowser:!0,classes:{URLSearchParams:Wze,FormData:Gze,Blob:qze},protocols:["http","https","file","blob","url","data"]},hR=typeof window<"u"&&typeof document<"u",dR=typeof navigator=="object"&&navigator||void 0,Zze=hR&&(!dR||["ReactNative","NativeScript","NS"].indexOf(dR.product)<0),Xze=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Kze=hR&&window.location.href||"http://localhost",Jze=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:hR,hasStandardBrowserEnv:Zze,hasStandardBrowserWebWorkerEnv:Xze,navigator:dR,origin:Kze},Symbol.toStringTag,{value:"Module"})),al={...Jze,...Yze};function Qze(t,e){return sM(t,new al.classes.URLSearchParams,Object.assign({visitor:function(n,r,i,o){return al.isNode&&bt.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},e))}function eVe(t){return bt.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function tVe(t){const e={},n=Object.keys(t);let r;const i=n.length;let o;for(r=0;r=n.length;return s=!s&&bt.isArray(i)?i.length:s,l?(bt.hasOwnProp(i,s)?i[s]=[i[s],r]:i[s]=r,!a):((!i[s]||!bt.isObject(i[s]))&&(i[s]=[]),e(n,r,i[s],o)&&bt.isArray(i[s])&&(i[s]=tVe(i[s])),!a)}if(bt.isFormData(t)&&bt.isFunction(t.entries)){const n={};return bt.forEachEntry(t,(r,i)=>{e(eVe(r),i,n,0)}),n}return null}function nVe(t,e,n){if(bt.isString(t))try{return(e||JSON.parse)(t),bt.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const Jw={transitional:DY,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const n=e.getContentType()||"",r=n.indexOf("application/json")>-1,i=bt.isObject(t);if(i&&bt.isHTMLForm(t)&&(t=new FormData(t)),bt.isFormData(t))return r?JSON.stringify(RY(t)):t;if(bt.isArrayBuffer(t)||bt.isBuffer(t)||bt.isStream(t)||bt.isFile(t)||bt.isBlob(t)||bt.isReadableStream(t))return t;if(bt.isArrayBufferView(t))return t.buffer;if(bt.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Qze(t,this.formSerializer).toString();if((o=bt.isFileList(t))||n.indexOf("multipart/form-data")>-1){const s=this.env&&this.env.FormData;return sM(o?{"files[]":t}:t,s&&new s,this.formSerializer)}}return i||r?(e.setContentType("application/json",!1),nVe(t)):t}],transformResponse:[function(t){const e=this.transitional||Jw.transitional,n=e&&e.forcedJSONParsing,r=this.responseType==="json";if(bt.isResponse(t)||bt.isReadableStream(t))return t;if(t&&bt.isString(t)&&(n&&!this.responseType||r)){const i=!(e&&e.silentJSONParsing)&&r;try{return JSON.parse(t)}catch(o){if(i)throw o.name==="SyntaxError"?hr.from(o,hr.ERR_BAD_RESPONSE,this,null,this.response):o}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:al.classes.FormData,Blob:al.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};bt.forEach(["delete","get","head","post","put","patch"],t=>{Jw.headers[t]={}});const rVe=bt.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),iVe=t=>{const e={};let n,r,i;return t&&t.split(` `).forEach(function(o){i=o.indexOf(":"),n=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!n||e[n]&&rVe[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},BY=Symbol("internals");function Qw(t){return t&&String(t).trim().toLowerCase()}function aM(t){return t===!1||t==null?t:bt.isArray(t)?t.map(aM):String(t)}function oVe(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const sVe=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function fR(t,e,n,r,i){if(bt.isFunction(r))return r.call(this,e,n);if(i&&(e=n),!!bt.isString(e)){if(bt.isString(r))return e.indexOf(r)!==-1;if(bt.isRegExp(r))return r.test(e)}}function aVe(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function lVe(t,e){const n=bt.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(i,o,s){return this[r].call(this,e,i,o,s)},configurable:!0})})}let fc=class{constructor(t){t&&this.set(t)}set(t,e,n){const r=this;function i(s,a,l){const c=Qw(a);if(!c)throw new Error("header name must be a non-empty string");const u=bt.findKey(r,c);(!u||r[u]===void 0||l===!0||l===void 0&&r[u]!==!1)&&(r[u||a]=aM(s))}const o=(s,a)=>bt.forEach(s,(l,c)=>i(l,c,a));if(bt.isPlainObject(t)||t instanceof this.constructor)o(t,e);else if(bt.isString(t)&&(t=t.trim())&&!sVe(t))o(iVe(t),e);else if(bt.isObject(t)&&bt.isIterable(t)){let s={},a,l;for(const c of t){if(!bt.isArray(c))throw TypeError("Object iterator must return a key-value pair");s[l=c[0]]=(a=s[l])?bt.isArray(a)?[...a,c[1]]:[a,c[1]]:c[1]}o(s,e)}else t!=null&&i(e,t,n);return this}get(t,e){if(t=Qw(t),t){const n=bt.findKey(this,t);if(n){const r=this[n];if(!e)return r;if(e===!0)return oVe(r);if(bt.isFunction(e))return e.call(this,r,n);if(bt.isRegExp(e))return e.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=Qw(t),t){const n=bt.findKey(this,t);return!!(n&&this[n]!==void 0&&(!e||fR(this,this[n],n,e)))}return!1}delete(t,e){const n=this;let r=!1;function i(o){if(o=Qw(o),o){const s=bt.findKey(n,o);s&&(!e||fR(n,n[s],s,e))&&(delete n[s],r=!0)}}return bt.isArray(t)?t.forEach(i):i(t),r}clear(t){const e=Object.keys(this);let n=e.length,r=!1;for(;n--;){const i=e[n];(!t||fR(this,this[i],i,t,!0))&&(delete this[i],r=!0)}return r}normalize(t){const e=this,n={};return bt.forEach(this,(r,i)=>{const o=bt.findKey(n,i);if(o){e[o]=aM(r),delete e[i];return}const s=t?aVe(i):String(i).trim();s!==i&&delete e[i],e[s]=aM(r),n[s]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return bt.forEach(this,(n,r)=>{n!=null&&n!==!1&&(e[r]=t&&bt.isArray(n)?n.join(", "):n)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join(` `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach(r=>n.set(r)),n}static accessor(t){const e=(this[BY]=this[BY]={accessors:{}}).accessors,n=this.prototype;function r(i){const o=Qw(i);e[o]||(lVe(n,i),e[o]=!0)}return bt.isArray(t)?t.forEach(r):r(t),this}};fc.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),bt.reduceDescriptors(fc.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}}),bt.freezeMethods(fc);function pR(t,e){const n=this||Jw,r=e||n,i=fc.from(r.headers);let o=r.data;return bt.forEach(t,function(s){o=s.call(n,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function FY(t){return!!(t&&t.__CANCEL__)}function u_(t,e,n){hr.call(this,t??"canceled",hr.ERR_CANCELED,e,n),this.name="CanceledError"}bt.inherits(u_,hr,{__CANCEL__:!0});function $Y(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new hr("Request failed with status code "+n.status,[hr.ERR_BAD_REQUEST,hr.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function cVe(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function uVe(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i=0,o=0,s;return e=e!==void 0?e:1e3,function(a){const l=Date.now(),c=r[o];s||(s=l),n[i]=a,r[i]=l;let u=o,d=0;for(;u!==i;)d+=n[u++],u=u%t;if(i=(i+1)%t,i===o&&(o=(o+1)%t),l-s{n=l,i=null,o&&(clearTimeout(o),o=null),t.apply(null,a)};return[(...a)=>{const l=Date.now(),c=l-n;c>=r?s(a,l):(i=a,o||(o=setTimeout(()=>{o=null,s(i)},r-c)))},()=>i&&s(i)]}const lM=(t,e,n=3)=>{let r=0;const i=uVe(50,250);return hVe(o=>{const s=o.loaded,a=o.lengthComputable?o.total:void 0,l=s-r,c=i(l),u=s<=a;r=s;const d={loaded:s,total:a,progress:a?s/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&u?(a-s)/c:void 0,event:o,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(d)},n)},zY=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},VY=t=>(...e)=>bt.asap(()=>t(...e)),dVe=al.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,al.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(al.origin),al.navigator&&/(msie|trident)/i.test(al.navigator.userAgent)):()=>!0,fVe=al.hasStandardBrowserEnv?{write(t,e,n,r,i,o){const s=[t+"="+encodeURIComponent(e)];bt.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),bt.isString(r)&&s.push("path="+r),bt.isString(i)&&s.push("domain="+i),o===!0&&s.push("secure"),document.cookie=s.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function pVe(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function mVe(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function jY(t,e,n){let r=!pVe(e);return t&&(r||n==!1)?mVe(t,e):e}const UY=t=>t instanceof fc?{...t}:t;function gy(t,e){e=e||{};const n={};function r(c,u,d,p){return bt.isPlainObject(c)&&bt.isPlainObject(u)?bt.merge.call({caseless:p},c,u):bt.isPlainObject(u)?bt.merge({},u):bt.isArray(u)?u.slice():u}function i(c,u,d,p){if(bt.isUndefined(u)){if(!bt.isUndefined(c))return r(void 0,c,d,p)}else return r(c,u,d,p)}function o(c,u){if(!bt.isUndefined(u))return r(void 0,u)}function s(c,u){if(bt.isUndefined(u)){if(!bt.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function a(c,u,d){if(d in e)return r(c,u);if(d in t)return r(void 0,c)}const l={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(c,u,d)=>i(UY(c),UY(u),d,!0)};return bt.forEach(Object.keys(Object.assign({},t,e)),function(c){const u=l[c]||i,d=u(t[c],e[c],c);bt.isUndefined(d)&&u!==a||(n[c]=d)}),n}const HY=t=>{const e=gy({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=e;e.headers=s=fc.from(s),e.url=NY(jY(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let l;if(bt.isFormData(n)){if(al.hasStandardBrowserEnv||al.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if((l=s.getContentType())!==!1){const[c,...u]=l?l.split(";").map(d=>d.trim()).filter(Boolean):[];s.setContentType([c||"multipart/form-data",...u].join("; "))}}if(al.hasStandardBrowserEnv&&(r&&bt.isFunction(r)&&(r=r(e)),r||r!==!1&&dVe(e.url))){const c=i&&o&&fVe.read(o);c&&s.set(i,c)}return e},gVe=typeof XMLHttpRequest<"u",yVe=gVe&&function(t){return new Promise(function(e,n){const r=HY(t);let i=r.data;const o=fc.from(r.headers).normalize();let{responseType:s,onUploadProgress:a,onDownloadProgress:l}=r,c,u,d,p,m;function y(){p&&p(),m&&m(),r.cancelToken&&r.cancelToken.unsubscribe(c),r.signal&&r.signal.removeEventListener("abort",c)}let w=new XMLHttpRequest;w.open(r.method.toUpperCase(),r.url,!0),w.timeout=r.timeout;function x(){if(!w)return;const S=fc.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders()),M={data:!s||s==="text"||s==="json"?w.responseText:w.response,status:w.status,statusText:w.statusText,headers:S,config:t,request:w};$Y(function(E){e(E),y()},function(E){n(E),y()},M),w=null}"onloadend"in w?w.onloadend=x:w.onreadystatechange=function(){!w||w.readyState!==4||w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)||setTimeout(x)},w.onabort=function(){w&&(n(new hr("Request aborted",hr.ECONNABORTED,t,w)),w=null)},w.onerror=function(){n(new hr("Network Error",hr.ERR_NETWORK,t,w)),w=null},w.ontimeout=function(){let S=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const M=r.transitional||DY;r.timeoutErrorMessage&&(S=r.timeoutErrorMessage),n(new hr(S,M.clarifyTimeoutError?hr.ETIMEDOUT:hr.ECONNABORTED,t,w)),w=null},i===void 0&&o.setContentType(null),"setRequestHeader"in w&&bt.forEach(o.toJSON(),function(S,M){w.setRequestHeader(M,S)}),bt.isUndefined(r.withCredentials)||(w.withCredentials=!!r.withCredentials),s&&s!=="json"&&(w.responseType=r.responseType),l&&([d,m]=lM(l,!0),w.addEventListener("progress",d)),a&&w.upload&&([u,p]=lM(a),w.upload.addEventListener("progress",u),w.upload.addEventListener("loadend",p)),(r.cancelToken||r.signal)&&(c=S=>{w&&(n(!S||S.type?new u_(null,t,w):S),w.abort(),w=null)},r.cancelToken&&r.cancelToken.subscribe(c),r.signal&&(r.signal.aborted?c():r.signal.addEventListener("abort",c)));const C=cVe(r.url);if(C&&al.protocols.indexOf(C)===-1){n(new hr("Unsupported protocol "+C+":",hr.ERR_BAD_REQUEST,t));return}w.send(i||null)})},vVe=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,i;const o=function(c){if(!i){i=!0,a();const u=c instanceof Error?c:this.reason;r.abort(u instanceof hr?u:new u_(u instanceof Error?u.message:u))}};let s=e&&setTimeout(()=>{s=null,o(new hr(`timeout ${e} of ms exceeded`,hr.ETIMEDOUT))},e);const a=()=>{t&&(s&&clearTimeout(s),s=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(o):c.removeEventListener("abort",o)}),t=null)};t.forEach(c=>c.addEventListener("abort",o));const{signal:l}=r;return l.unsubscribe=()=>bt.asap(a),l}},_Ve=function*(t,e){let n=t.byteLength;if(n{const i=bVe(t,e);let o=0,s,a=l=>{s||(s=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await i.next();if(c){a(),l.close();return}let d=u.byteLength;if(n){let p=o+=d;n(p)}l.enqueue(new Uint8Array(u))}catch(c){throw a(c),c}},cancel(l){return a(l),i.return()}},{highWaterMark:2})},cM=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",GY=cM&&typeof ReadableStream=="function",xVe=cM&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),qY=(t,...e)=>{try{return!!t(...e)}catch{return!1}},EVe=GY&&qY(()=>{let t=!1;const e=new Request(al.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),YY=64*1024,mR=GY&&qY(()=>bt.isReadableStream(new Response("").body)),uM={stream:mR&&(t=>t.body)};cM&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!uM[e]&&(uM[e]=bt.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new hr(`Response type '${e}' is not supported`,hr.ERR_NOT_SUPPORT,r)})})})(new Response);const SVe=async t=>{if(t==null)return 0;if(bt.isBlob(t))return t.size;if(bt.isSpecCompliantForm(t))return(await new Request(al.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(bt.isArrayBufferView(t)||bt.isArrayBuffer(t))return t.byteLength;if(bt.isURLSearchParams(t)&&(t=t+""),bt.isString(t))return(await xVe(t)).byteLength},CVe=async(t,e)=>bt.toFiniteNumber(t.getContentLength())??SVe(e),kVe=cM&&(async t=>{let{url:e,method:n,data:r,signal:i,cancelToken:o,timeout:s,onDownloadProgress:a,onUploadProgress:l,responseType:c,headers:u,withCredentials:d="same-origin",fetchOptions:p}=HY(t);c=c?(c+"").toLowerCase():"text";let m=vVe([i,o&&o.toAbortSignal()],s),y;const w=m&&m.unsubscribe&&(()=>{m.unsubscribe()});let x;try{if(l&&EVe&&n!=="get"&&n!=="head"&&(x=await CVe(u,r))!==0){let A=new Request(e,{method:"POST",body:r,duplex:"half"}),I;if(bt.isFormData(r)&&(I=A.headers.get("content-type"))&&u.setContentType(I),A.body){const[O,z]=zY(x,lM(VY(l)));r=WY(A.body,YY,O,z)}}bt.isString(d)||(d=d?"include":"omit");const C="credentials"in Request.prototype;y=new Request(e,{...p,signal:m,method:n.toUpperCase(),headers:u.normalize().toJSON(),body:r,duplex:"half",credentials:C?d:void 0});let S=await fetch(y,p);const M=mR&&(c==="stream"||c==="response");if(mR&&(a||M&&w)){const A={};["status","statusText","headers"].forEach($=>{A[$]=S[$]});const I=bt.toFiniteNumber(S.headers.get("content-length")),[O,z]=a&&zY(I,lM(VY(a),!0))||[];S=new Response(WY(S.body,YY,O,()=>{z&&z(),w&&w()}),A)}c=c||"text";let E=await uM[bt.findKey(uM,c)||"text"](S,t);return!M&&w&&w(),await new Promise((A,I)=>{$Y(A,I,{data:E,headers:fc.from(S.headers),status:S.status,statusText:S.statusText,config:t,request:y})})}catch(C){throw w&&w(),C&&C.name==="TypeError"&&/Load failed|fetch/i.test(C.message)?Object.assign(new hr("Network Error",hr.ERR_NETWORK,t,y),{cause:C.cause||C}):hr.from(C,C&&C.code,t,y)}}),gR={http:Vze,xhr:yVe,fetch:kVe};bt.forEach(gR,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const ZY=t=>`- ${t}`,TVe=t=>bt.isFunction(t)||t===null||t===!1,XY={getAdapter:t=>{t=bt.isArray(t)?t:[t];const{length:e}=t;let n,r;const i={};for(let o=0;o`adapter ${a} `+(l===!1?"is not supported by the environment":"is not available in the build"));let s=e?o.length>1?`since : `+o.map(ZY).join(` `):" "+ZY(o[0]):"as no adapter specified";throw new hr("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return r},adapters:gR};function yR(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new u_(null,t)}function KY(t){return yR(t),t.headers=fc.from(t.headers),t.data=pR.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),XY.getAdapter(t.adapter||Jw.adapter)(t).then(function(e){return yR(t),e.data=pR.call(t,t.transformResponse,e),e.headers=fc.from(e.headers),e},function(e){return FY(e)||(yR(t),e&&e.response&&(e.response.data=pR.call(t,t.transformResponse,e.response),e.response.headers=fc.from(e.response.headers))),Promise.reject(e)})}const JY="1.10.0",hM={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{hM[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const QY={};hM.transitional=function(t,e,n){function r(i,o){return"[Axios v"+JY+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,s)=>{if(t===!1)throw new hr(r(o," has been removed"+(e?" in "+e:"")),hr.ERR_DEPRECATED);return e&&!QY[o]&&(QY[o]=!0,console.warn(r(o," has been deprecated since v"+e+" and will be removed in the near future"))),t?t(i,o,s):!0}},hM.spelling=function(t){return(e,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function MVe(t,e,n){if(typeof t!="object")throw new hr("options must be an object",hr.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const o=r[i],s=e[o];if(s){const a=t[o],l=a===void 0||s(a,o,t);if(l!==!0)throw new hr("option "+o+" must be "+l,hr.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new hr("Unknown option "+o,hr.ERR_BAD_OPTION)}}const dM={assertOptions:MVe,validators:hM},kd=dM.validators;let yy=class{constructor(t){this.defaults=t||{},this.interceptors={request:new OY,response:new OY}}async request(t,e){try{return await this._request(t,e)}catch(n){if(n instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const i=r.stack?r.stack.replace(/^.+\n/,""):"";try{n.stack?i&&!String(n.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(n.stack+=` `+i):n.stack=i}catch{}}throw n}}_request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=gy(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:i}=e;n!==void 0&&dM.assertOptions(n,{silentJSONParsing:kd.transitional(kd.boolean),forcedJSONParsing:kd.transitional(kd.boolean),clarifyTimeoutError:kd.transitional(kd.boolean)},!1),r!=null&&(bt.isFunction(r)?e.paramsSerializer={serialize:r}:dM.assertOptions(r,{encode:kd.function,serialize:kd.function},!0)),e.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),dM.assertOptions(e,{baseUrl:kd.spelling("baseURL"),withXsrfToken:kd.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=i&&bt.merge(i.common,i[e.method]);i&&bt.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),e.headers=fc.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(e)===!1||(a=a&&m.synchronous,s.unshift(m.fulfilled,m.rejected))});const l=[];this.interceptors.response.forEach(function(m){l.push(m.fulfilled,m.rejected)});let c,u=0,d;if(!a){const m=[KY.bind(this),void 0];for(m.unshift.apply(m,s),m.push.apply(m,l),d=m.length,c=Promise.resolve(e);u{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](i);r._listeners=null}),this.promise.then=i=>{let o;const s=new Promise(a=>{r.subscribe(a),o=a}).then(i);return s.cancel=function(){r.unsubscribe(o)},s},e(function(i,o,s){r.reason||(r.reason=new u_(i,o,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new $K(function(n){e=n}),cancel:e}}};function IVe(t){return function(e){return t.apply(null,e)}}function LVe(t){return bt.isObject(t)&&t.isAxiosError===!0}const vR={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,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(vR).forEach(([t,e])=>{vR[e]=t});function eZ(t){const e=new yy(t),n=vY(yy.prototype.request,e);return bt.extend(n,yy.prototype,e,{allOwnKeys:!0}),bt.extend(n,e,null,{allOwnKeys:!0}),n.create=function(r){return eZ(gy(t,r))},n}const ns=eZ(Jw);ns.Axios=yy,ns.CanceledError=u_,ns.CancelToken=AVe,ns.isCancel=FY,ns.VERSION=JY,ns.toFormData=sM,ns.AxiosError=hr,ns.Cancel=ns.CanceledError,ns.all=function(t){return Promise.all(t)},ns.spread=IVe,ns.isAxiosError=LVe,ns.mergeConfig=gy,ns.AxiosHeaders=fc,ns.formToJSON=t=>RY(bt.isHTMLForm(t)?new FormData(t):t),ns.getAdapter=XY.getAdapter,ns.HttpStatusCode=vR,ns.default=ns;const{Axios:EUe,AxiosError:SUe,CanceledError:CUe,isCancel:kUe,CancelToken:TUe,VERSION:MUe,all:AUe,Cancel:IUe,isAxiosError:LUe,spread:PUe,toFormData:NUe,AxiosHeaders:OUe,HttpStatusCode:DUe,formToJSON:RUe,getAdapter:BUe,mergeConfig:FUe}=ns,PVe=async t=>{try{const e=new FormData;e.append("unique","true"),e.append("file",t);const{data:n}=await ns.post("/file/upload/uploads?id=&form=&table=",e);return n==null?void 0:n.result}catch(e){console.error(e)}},tZ=async(t,e)=>{var r,i,o;const n=(r=e.clipboardData)==null?void 0:r.items;if(n){const s=(i=e.clipboardData)==null?void 0:i.getData("text/html"),a=(o=e.clipboardData)==null?void 0:o.getData("text/plain");if(s){const{state:l,dispatch:c}=t,{tr:u}=l,d=D0.fromSchema(t.state.schema),p=new DOMParser().parseFromString(s,"text/html").body,m=d.parse(p),y=u.replaceSelectionWith(m);return c(y),e.preventDefault(),!0}if(a){const{state:l,dispatch:c}=t,{tr:u}=l,d=u.insertText(a,l.selection.from,l.selection.to);return c(d),e.preventDefault(),!0}for(let l=0;l({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,ro(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>RO({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),OVe={1:"font-weight:700; font-size:30px;",2:"font-weight:700; font-size:26px;",3:"font-weight:700; font-size:22px;",4:"font-weight:700; font-size:18px;",5:"font-weight:500; font-size:16px;",6:"font-weight:400; font-size:14px;"},nZ=NVe.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),levels:[1,2,3,4,5,6]}}}).extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),level:{default:1,renderHTML:e=>{const n=e.level||1;return{class:`heading-level-${n}`,style:OVe[n-1]}}}}}}),DVe=Pl.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",ro(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),rZ=DVe.configure({HTMLAttributes:{style:"min-height: 1rem;"}}),RVe={class:"bg-white border border border-solid border-gray-200 rounded-xl"},BVe={class:"flex align-middle gap-x-0.5 border-b flex-wrap border-b-gray-200 px-[10px] py-[6px] border-solid border-transparent"},FVe={__name:"vs-richtext",props:{modelValue:{type:String,default:()=>""},toolbar:{type:Array,default:()=>["bold","italic","underline","text_align","color","color_picker","blockquote","bullet_list","ordered_list","codeblock","text_more","strike","link","table"]}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=DW({content:n.modelValue,extensions:[eq,nq,RW,BW,FW,$W,zW,UW,GW,qW,YW,ZW,nG,rZ,iG,rq,SG,sG,rG,oG,nZ,tq,CG,XG.configure({types:["heading","paragraph"]}),kG,ZG.configure({HTMLAttributes:{class:"editor-content"},resizable:!0}),QG,JG,KG,EG.configure({HTMLAttributes:{class:"editor-link"},openOnClick:!1,autolink:!0})],editorProps:{handlePaste:tZ}}),o=g.computed(()=>n.toolbar.map(a=>yY[a]));g.watch(i,a=>{a&&i.value.on("update",l=>{const c=l.editor.getHTML();c!==n.modelValue&&r("update:modelValue",c==='

'?null:c)})});const s=()=>{i.value&&!i.value.isFocused&&i.value.commands.focus()};return(a,l)=>(g.openBlock(),g.createElementBlock("div",RVe,[g.createElementVNode("div",BVe,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(o.value,c=>(g.openBlock(),g.createBlock(g.resolveDynamicComponent(c),{editor:g.unref(i)},null,8,["editor"]))),256))]),g.createElementVNode("div",{onClick:s,class:"relative w-full px-4 py-2 bg-white rounded-b-lg editor-content dark:bg-gray-800"},[g.createVNode(g.unref(OW),{editor:g.unref(i),class:"relative w-full"},null,8,["editor"])])]))}};function $Ve(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var _R={exports:{}},zVe=_R.exports,iZ;function VVe(){return iZ||(iZ=1,function(t){(function(){function e(E){var A={omitExtraWLInCodeBlocks:{defaultValue:!1,describe:"Omit the default extra whiteline added to code blocks",type:"boolean"},noHeaderId:{defaultValue:!1,describe:"Turn on/off generated header id",type:"boolean"},prefixHeaderId:{defaultValue:!1,describe:"Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix",type:"string"},rawPrefixHeaderId:{defaultValue:!1,describe:'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',type:"boolean"},ghCompatibleHeaderId:{defaultValue:!1,describe:"Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)",type:"boolean"},rawHeaderId:{defaultValue:!1,describe:`Remove only spaces, ' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids`,type:"boolean"},headerLevelStart:{defaultValue:!1,describe:"The header blocks level start",type:"integer"},parseImgDimensions:{defaultValue:!1,describe:"Turn on/off image dimension parsing",type:"boolean"},simplifiedAutoLink:{defaultValue:!1,describe:"Turn on/off GFM autolink style",type:"boolean"},excludeTrailingPunctuationFromURLs:{defaultValue:!1,describe:"Excludes trailing punctuation from links generated with autoLinking",type:"boolean"},literalMidWordUnderscores:{defaultValue:!1,describe:"Parse midword underscores as literal underscores",type:"boolean"},literalMidWordAsterisks:{defaultValue:!1,describe:"Parse midword asterisks as literal asterisks",type:"boolean"},strikethrough:{defaultValue:!1,describe:"Turn on/off strikethrough support",type:"boolean"},tables:{defaultValue:!1,describe:"Turn on/off tables support",type:"boolean"},tablesHeaderId:{defaultValue:!1,describe:"Add an id to table headers",type:"boolean"},ghCodeBlocks:{defaultValue:!0,describe:"Turn on/off GFM fenced code blocks support",type:"boolean"},tasklists:{defaultValue:!1,describe:"Turn on/off GFM tasklist support",type:"boolean"},smoothLivePreview:{defaultValue:!1,describe:"Prevents weird effects in live previews due to incomplete input",type:"boolean"},smartIndentationFix:{defaultValue:!1,describe:"Tries to smartly fix indentation in es6 strings",type:"boolean"},disableForced4SpacesIndentedSublists:{defaultValue:!1,describe:"Disables the requirement of indenting nested sublists by 4 spaces",type:"boolean"},simpleLineBreaks:{defaultValue:!1,describe:"Parses simple line breaks as
(GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:!1,describe:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:!1,describe:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",describe:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:!0,describe:"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",type:"boolean"},openLinksInNewWindow:{defaultValue:!1,describe:"Open all links in new windows",type:"boolean"},backslashEscapesHTMLTags:{defaultValue:!1,describe:"Support for HTML Tag escaping. ex:
foo
",type:"boolean"},emoji:{defaultValue:!1,describe:"Enable emoji support. Ex: `this is a :smile: emoji`",type:"boolean"},underline:{defaultValue:!1,describe:"Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `` and ``",type:"boolean"},ellipsis:{defaultValue:!0,describe:"Replaces three dots with the ellipsis unicode character",type:"boolean"},completeHTMLDocument:{defaultValue:!1,describe:"Outputs a complete html document, including ``, `` and `` tags",type:"boolean"},metadata:{defaultValue:!1,describe:"Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).",type:"boolean"},splitAdjacentBlockquotes:{defaultValue:!1,describe:"Split adjacent blockquote blocks",type:"boolean"}};if(E===!1)return JSON.parse(JSON.stringify(A));var I={};for(var O in A)A.hasOwnProperty(O)&&(I[O]=A[O].defaultValue);return I}function n(){var E=e(!0),A={};for(var I in E)E.hasOwnProperty(I)&&(A[I]=!0);return A}var r={},i={},o={},s=e(!0),a="vanilla",l={github:{omitExtraWLInCodeBlocks:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,disableForced4SpacesIndentedSublists:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghCompatibleHeaderId:!0,ghMentions:!0,backslashEscapesHTMLTags:!0,emoji:!0,splitAdjacentBlockquotes:!0},original:{noHeaderId:!0,ghCodeBlocks:!1},ghost:{omitExtraWLInCodeBlocks:!0,parseImgDimensions:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,smoothLivePreview:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghMentions:!1,encodeEmails:!0},vanilla:e(!0),allOn:n()};r.helper={},r.extensions={},r.setOption=function(E,A){return s[E]=A,this},r.getOption=function(E){return s[E]},r.getOptions=function(){return s},r.resetOptions=function(){s=e(!0)},r.setFlavor=function(E){if(!l.hasOwnProperty(E))throw Error(E+" flavor was not found");r.resetOptions();var A=l[E];a=E;for(var I in A)A.hasOwnProperty(I)&&(s[I]=A[I])},r.getFlavor=function(){return a},r.getFlavorOptions=function(E){if(l.hasOwnProperty(E))return l[E]},r.getDefaultOptions=function(E){return e(E)},r.subParser=function(E,A){if(r.helper.isString(E))if(typeof A<"u")i[E]=A;else{if(i.hasOwnProperty(E))return i[E];throw Error("SubParser named "+E+" not registered!")}},r.extension=function(E,A){if(!r.helper.isString(E))throw Error("Extension 'name' must be a string");if(E=r.helper.stdExtName(E),r.helper.isUndefined(A)){if(!o.hasOwnProperty(E))throw Error("Extension named "+E+" is not registered!");return o[E]}else{typeof A=="function"&&(A=A()),r.helper.isArray(A)||(A=[A]);var I=c(A,E);if(I.valid)o[E]=A;else throw Error(I.error)}},r.getAllExtensions=function(){return o},r.removeExtension=function(E){delete o[E]},r.resetExtensions=function(){o={}};function c(E,A){var I=A?"Error in "+A+" extension->":"Error in unnamed extension",O={valid:!0,error:""};r.helper.isArray(E)||(E=[E]);for(var z=0;z"u"},r.helper.forEach=function(E,A){if(r.helper.isUndefined(E))throw new Error("obj param is required");if(r.helper.isUndefined(A))throw new Error("callback param is required");if(!r.helper.isFunction(A))throw new Error("callback param must be a function/closure");if(typeof E.forEach=="function")E.forEach(A);else if(r.helper.isArray(E))for(var I=0;I").replace(/&/g,"&")};var d=function(E,A,I,O){var z=O||"",$=z.indexOf("g")>-1,W=new RegExp(A+"|"+I,"g"+z.replace(/g/g,"")),J=new RegExp(A,z.replace(/g/g,"")),Z=[],q,j,G,U,Q;do for(q=0;G=W.exec(E);)if(J.test(G[0]))q++||(j=W.lastIndex,U=j-G[0].length);else if(q&&!--q){Q=G.index+G[0].length;var re={left:{start:U,end:j},match:{start:j,end:G.index},right:{start:G.index,end:Q},wholeMatch:{start:U,end:Q}};if(Z.push(re),!$)return Z}while(q&&(W.lastIndex=j));return Z};r.helper.matchRecursiveRegExp=function(E,A,I,O){for(var z=d(E,A,I,O),$=[],W=0;W0){var q=[];W[0].wholeMatch.start!==0&&q.push(E.slice(0,W[0].wholeMatch.start));for(var j=0;j=0?O+(I||0):O},r.helper.splitAtIndex=function(E,A){if(!r.helper.isString(E))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";return[E.substring(0,A),E.substring(A)]},r.helper.encodeEmailAddress=function(E){var A=[function(I){return"&#"+I.charCodeAt(0)+";"},function(I){return"&#x"+I.charCodeAt(0).toString(16)+";"},function(I){return I}];return E=E.replace(/./g,function(I){if(I==="@")I=A[Math.floor(Math.random()*2)](I);else{var O=Math.random();I=O>.9?A[2](I):O>.45?A[1](I):A[0](I)}return I}),E},r.helper.padEnd=function(E,A,I){return A=A>>0,I=String(I||" "),E.length>A?String(E):(A=A-E.length,A>I.length&&(I+=I.repeat(A/I.length)),String(E)+I.slice(0,A))},typeof console>"u"&&(console={warn:function(E){alert(E)},log:function(E){alert(E)},error:function(E){throw E}}),r.helper.regexes={asteriskDashAndColon:/([*_:~])/g},r.helper.emojis={"+1":"👍","-1":"👎",100:"💯",1234:"🔢","1st_place_medal":"🥇","2nd_place_medal":"🥈","3rd_place_medal":"🥉","8ball":"🎱",a:"🅰️",ab:"🆎",abc:"🔤",abcd:"🔡",accept:"🉑",aerial_tramway:"🚡",airplane:"✈️",alarm_clock:"⏰",alembic:"⚗️",alien:"👽",ambulance:"🚑",amphora:"🏺",anchor:"⚓️",angel:"👼",anger:"💢",angry:"😠",anguished:"😧",ant:"🐜",apple:"🍎",aquarius:"♒️",aries:"♈️",arrow_backward:"◀️",arrow_double_down:"⏬",arrow_double_up:"⏫",arrow_down:"⬇️",arrow_down_small:"🔽",arrow_forward:"▶️",arrow_heading_down:"⤵️",arrow_heading_up:"⤴️",arrow_left:"⬅️",arrow_lower_left:"↙️",arrow_lower_right:"↘️",arrow_right:"➡️",arrow_right_hook:"↪️",arrow_up:"⬆️",arrow_up_down:"↕️",arrow_up_small:"🔼",arrow_upper_left:"↖️",arrow_upper_right:"↗️",arrows_clockwise:"🔃",arrows_counterclockwise:"🔄",art:"🎨",articulated_lorry:"🚛",artificial_satellite:"🛰",astonished:"😲",athletic_shoe:"👟",atm:"🏧",atom_symbol:"⚛️",avocado:"🥑",b:"🅱️",baby:"👶",baby_bottle:"🍼",baby_chick:"🐤",baby_symbol:"🚼",back:"🔙",bacon:"🥓",badminton:"🏸",baggage_claim:"🛄",baguette_bread:"🥖",balance_scale:"⚖️",balloon:"🎈",ballot_box:"🗳",ballot_box_with_check:"☑️",bamboo:"🎍",banana:"🍌",bangbang:"‼️",bank:"🏦",bar_chart:"📊",barber:"💈",baseball:"⚾️",basketball:"🏀",basketball_man:"⛹️",basketball_woman:"⛹️‍♀️",bat:"🦇",bath:"🛀",bathtub:"🛁",battery:"🔋",beach_umbrella:"🏖",bear:"🐻",bed:"🛏",bee:"🐝",beer:"🍺",beers:"🍻",beetle:"🐞",beginner:"🔰",bell:"🔔",bellhop_bell:"🛎",bento:"🍱",biking_man:"🚴",bike:"🚲",biking_woman:"🚴‍♀️",bikini:"👙",biohazard:"☣️",bird:"🐦",birthday:"🎂",black_circle:"⚫️",black_flag:"🏴",black_heart:"🖤",black_joker:"🃏",black_large_square:"⬛️",black_medium_small_square:"◾️",black_medium_square:"◼️",black_nib:"✒️",black_small_square:"▪️",black_square_button:"🔲",blonde_man:"👱",blonde_woman:"👱‍♀️",blossom:"🌼",blowfish:"🐡",blue_book:"📘",blue_car:"🚙",blue_heart:"💙",blush:"😊",boar:"🐗",boat:"⛵️",bomb:"💣",book:"📖",bookmark:"🔖",bookmark_tabs:"📑",books:"📚",boom:"💥",boot:"👢",bouquet:"💐",bowing_man:"🙇",bow_and_arrow:"🏹",bowing_woman:"🙇‍♀️",bowling:"🎳",boxing_glove:"🥊",boy:"👦",bread:"🍞",bride_with_veil:"👰",bridge_at_night:"🌉",briefcase:"💼",broken_heart:"💔",bug:"🐛",building_construction:"🏗",bulb:"💡",bullettrain_front:"🚅",bullettrain_side:"🚄",burrito:"🌯",bus:"🚌",business_suit_levitating:"🕴",busstop:"🚏",bust_in_silhouette:"👤",busts_in_silhouette:"👥",butterfly:"🦋",cactus:"🌵",cake:"🍰",calendar:"📆",call_me_hand:"🤙",calling:"📲",camel:"🐫",camera:"📷",camera_flash:"📸",camping:"🏕",cancer:"♋️",candle:"🕯",candy:"🍬",canoe:"🛶",capital_abcd:"🔠",capricorn:"♑️",car:"🚗",card_file_box:"🗃",card_index:"📇",card_index_dividers:"🗂",carousel_horse:"🎠",carrot:"🥕",cat:"🐱",cat2:"🐈",cd:"💿",chains:"⛓",champagne:"🍾",chart:"💹",chart_with_downwards_trend:"📉",chart_with_upwards_trend:"📈",checkered_flag:"🏁",cheese:"🧀",cherries:"🍒",cherry_blossom:"🌸",chestnut:"🌰",chicken:"🐔",children_crossing:"🚸",chipmunk:"🐿",chocolate_bar:"🍫",christmas_tree:"🎄",church:"⛪️",cinema:"🎦",circus_tent:"🎪",city_sunrise:"🌇",city_sunset:"🌆",cityscape:"🏙",cl:"🆑",clamp:"🗜",clap:"👏",clapper:"🎬",classical_building:"🏛",clinking_glasses:"🥂",clipboard:"📋",clock1:"🕐",clock10:"🕙",clock1030:"🕥",clock11:"🕚",clock1130:"🕦",clock12:"🕛",clock1230:"🕧",clock130:"🕜",clock2:"🕑",clock230:"🕝",clock3:"🕒",clock330:"🕞",clock4:"🕓",clock430:"🕟",clock5:"🕔",clock530:"🕠",clock6:"🕕",clock630:"🕡",clock7:"🕖",clock730:"🕢",clock8:"🕗",clock830:"🕣",clock9:"🕘",clock930:"🕤",closed_book:"📕",closed_lock_with_key:"🔐",closed_umbrella:"🌂",cloud:"☁️",cloud_with_lightning:"🌩",cloud_with_lightning_and_rain:"⛈",cloud_with_rain:"🌧",cloud_with_snow:"🌨",clown_face:"🤡",clubs:"♣️",cocktail:"🍸",coffee:"☕️",coffin:"⚰️",cold_sweat:"😰",comet:"☄️",computer:"💻",computer_mouse:"🖱",confetti_ball:"🎊",confounded:"😖",confused:"😕",congratulations:"㊗️",construction:"🚧",construction_worker_man:"👷",construction_worker_woman:"👷‍♀️",control_knobs:"🎛",convenience_store:"🏪",cookie:"🍪",cool:"🆒",policeman:"👮",copyright:"©️",corn:"🌽",couch_and_lamp:"🛋",couple:"👫",couple_with_heart_woman_man:"💑",couple_with_heart_man_man:"👨‍❤️‍👨",couple_with_heart_woman_woman:"👩‍❤️‍👩",couplekiss_man_man:"👨‍❤️‍💋‍👨",couplekiss_man_woman:"💏",couplekiss_woman_woman:"👩‍❤️‍💋‍👩",cow:"🐮",cow2:"🐄",cowboy_hat_face:"🤠",crab:"🦀",crayon:"🖍",credit_card:"💳",crescent_moon:"🌙",cricket:"🏏",crocodile:"🐊",croissant:"🥐",crossed_fingers:"🤞",crossed_flags:"🎌",crossed_swords:"⚔️",crown:"👑",cry:"😢",crying_cat_face:"😿",crystal_ball:"🔮",cucumber:"🥒",cupid:"💘",curly_loop:"➰",currency_exchange:"💱",curry:"🍛",custard:"🍮",customs:"🛃",cyclone:"🌀",dagger:"🗡",dancer:"💃",dancing_women:"👯",dancing_men:"👯‍♂️",dango:"🍡",dark_sunglasses:"🕶",dart:"🎯",dash:"💨",date:"📅",deciduous_tree:"🌳",deer:"🦌",department_store:"🏬",derelict_house:"🏚",desert:"🏜",desert_island:"🏝",desktop_computer:"🖥",male_detective:"🕵️",diamond_shape_with_a_dot_inside:"💠",diamonds:"♦️",disappointed:"😞",disappointed_relieved:"😥",dizzy:"💫",dizzy_face:"😵",do_not_litter:"🚯",dog:"🐶",dog2:"🐕",dollar:"💵",dolls:"🎎",dolphin:"🐬",door:"🚪",doughnut:"🍩",dove:"🕊",dragon:"🐉",dragon_face:"🐲",dress:"👗",dromedary_camel:"🐪",drooling_face:"🤤",droplet:"💧",drum:"🥁",duck:"🦆",dvd:"📀","e-mail":"📧",eagle:"🦅",ear:"👂",ear_of_rice:"🌾",earth_africa:"🌍",earth_americas:"🌎",earth_asia:"🌏",egg:"🥚",eggplant:"🍆",eight_pointed_black_star:"✴️",eight_spoked_asterisk:"✳️",electric_plug:"🔌",elephant:"🐘",email:"✉️",end:"🔚",envelope_with_arrow:"📩",euro:"💶",european_castle:"🏰",european_post_office:"🏤",evergreen_tree:"🌲",exclamation:"❗️",expressionless:"😑",eye:"👁",eye_speech_bubble:"👁‍🗨",eyeglasses:"👓",eyes:"👀",face_with_head_bandage:"🤕",face_with_thermometer:"🤒",fist_oncoming:"👊",factory:"🏭",fallen_leaf:"🍂",family_man_woman_boy:"👪",family_man_boy:"👨‍👦",family_man_boy_boy:"👨‍👦‍👦",family_man_girl:"👨‍👧",family_man_girl_boy:"👨‍👧‍👦",family_man_girl_girl:"👨‍👧‍👧",family_man_man_boy:"👨‍👨‍👦",family_man_man_boy_boy:"👨‍👨‍👦‍👦",family_man_man_girl:"👨‍👨‍👧",family_man_man_girl_boy:"👨‍👨‍👧‍👦",family_man_man_girl_girl:"👨‍👨‍👧‍👧",family_man_woman_boy_boy:"👨‍👩‍👦‍👦",family_man_woman_girl:"👨‍👩‍👧",family_man_woman_girl_boy:"👨‍👩‍👧‍👦",family_man_woman_girl_girl:"👨‍👩‍👧‍👧",family_woman_boy:"👩‍👦",family_woman_boy_boy:"👩‍👦‍👦",family_woman_girl:"👩‍👧",family_woman_girl_boy:"👩‍👧‍👦",family_woman_girl_girl:"👩‍👧‍👧",family_woman_woman_boy:"👩‍👩‍👦",family_woman_woman_boy_boy:"👩‍👩‍👦‍👦",family_woman_woman_girl:"👩‍👩‍👧",family_woman_woman_girl_boy:"👩‍👩‍👧‍👦",family_woman_woman_girl_girl:"👩‍👩‍👧‍👧",fast_forward:"⏩",fax:"📠",fearful:"😨",feet:"🐾",female_detective:"🕵️‍♀️",ferris_wheel:"🎡",ferry:"⛴",field_hockey:"🏑",file_cabinet:"🗄",file_folder:"📁",film_projector:"📽",film_strip:"🎞",fire:"🔥",fire_engine:"🚒",fireworks:"🎆",first_quarter_moon:"🌓",first_quarter_moon_with_face:"🌛",fish:"🐟",fish_cake:"🍥",fishing_pole_and_fish:"🎣",fist_raised:"✊",fist_left:"🤛",fist_right:"🤜",flags:"🎏",flashlight:"🔦",fleur_de_lis:"⚜️",flight_arrival:"🛬",flight_departure:"🛫",floppy_disk:"💾",flower_playing_cards:"🎴",flushed:"😳",fog:"🌫",foggy:"🌁",football:"🏈",footprints:"👣",fork_and_knife:"🍴",fountain:"⛲️",fountain_pen:"🖋",four_leaf_clover:"🍀",fox_face:"🦊",framed_picture:"🖼",free:"🆓",fried_egg:"🍳",fried_shrimp:"🍤",fries:"🍟",frog:"🐸",frowning:"😦",frowning_face:"☹️",frowning_man:"🙍‍♂️",frowning_woman:"🙍",middle_finger:"🖕",fuelpump:"⛽️",full_moon:"🌕",full_moon_with_face:"🌝",funeral_urn:"⚱️",game_die:"🎲",gear:"⚙️",gem:"💎",gemini:"♊️",ghost:"👻",gift:"🎁",gift_heart:"💝",girl:"👧",globe_with_meridians:"🌐",goal_net:"🥅",goat:"🐐",golf:"⛳️",golfing_man:"🏌️",golfing_woman:"🏌️‍♀️",gorilla:"🦍",grapes:"🍇",green_apple:"🍏",green_book:"📗",green_heart:"💚",green_salad:"🥗",grey_exclamation:"❕",grey_question:"❔",grimacing:"😬",grin:"😁",grinning:"😀",guardsman:"💂",guardswoman:"💂‍♀️",guitar:"🎸",gun:"🔫",haircut_woman:"💇",haircut_man:"💇‍♂️",hamburger:"🍔",hammer:"🔨",hammer_and_pick:"⚒",hammer_and_wrench:"🛠",hamster:"🐹",hand:"✋",handbag:"👜",handshake:"🤝",hankey:"💩",hatched_chick:"🐥",hatching_chick:"🐣",headphones:"🎧",hear_no_evil:"🙉",heart:"❤️",heart_decoration:"💟",heart_eyes:"😍",heart_eyes_cat:"😻",heartbeat:"💓",heartpulse:"💗",hearts:"♥️",heavy_check_mark:"✔️",heavy_division_sign:"➗",heavy_dollar_sign:"💲",heavy_heart_exclamation:"❣️",heavy_minus_sign:"➖",heavy_multiplication_x:"✖️",heavy_plus_sign:"➕",helicopter:"🚁",herb:"🌿",hibiscus:"🌺",high_brightness:"🔆",high_heel:"👠",hocho:"🔪",hole:"🕳",honey_pot:"🍯",horse:"🐴",horse_racing:"🏇",hospital:"🏥",hot_pepper:"🌶",hotdog:"🌭",hotel:"🏨",hotsprings:"♨️",hourglass:"⌛️",hourglass_flowing_sand:"⏳",house:"🏠",house_with_garden:"🏡",houses:"🏘",hugs:"🤗",hushed:"😯",ice_cream:"🍨",ice_hockey:"🏒",ice_skate:"⛸",icecream:"🍦",id:"🆔",ideograph_advantage:"🉐",imp:"👿",inbox_tray:"📥",incoming_envelope:"📨",tipping_hand_woman:"💁",information_source:"ℹ️",innocent:"😇",interrobang:"⁉️",iphone:"📱",izakaya_lantern:"🏮",jack_o_lantern:"🎃",japan:"🗾",japanese_castle:"🏯",japanese_goblin:"👺",japanese_ogre:"👹",jeans:"👖",joy:"😂",joy_cat:"😹",joystick:"🕹",kaaba:"🕋",key:"🔑",keyboard:"⌨️",keycap_ten:"🔟",kick_scooter:"🛴",kimono:"👘",kiss:"💋",kissing:"😗",kissing_cat:"😽",kissing_closed_eyes:"😚",kissing_heart:"😘",kissing_smiling_eyes:"😙",kiwi_fruit:"🥝",koala:"🐨",koko:"🈁",label:"🏷",large_blue_circle:"🔵",large_blue_diamond:"🔷",large_orange_diamond:"🔶",last_quarter_moon:"🌗",last_quarter_moon_with_face:"🌜",latin_cross:"✝️",laughing:"😆",leaves:"🍃",ledger:"📒",left_luggage:"🛅",left_right_arrow:"↔️",leftwards_arrow_with_hook:"↩️",lemon:"🍋",leo:"♌️",leopard:"🐆",level_slider:"🎚",libra:"♎️",light_rail:"🚈",link:"🔗",lion:"🦁",lips:"👄",lipstick:"💄",lizard:"🦎",lock:"🔒",lock_with_ink_pen:"🔏",lollipop:"🍭",loop:"➿",loud_sound:"🔊",loudspeaker:"📢",love_hotel:"🏩",love_letter:"💌",low_brightness:"🔅",lying_face:"🤥",m:"Ⓜ️",mag:"🔍",mag_right:"🔎",mahjong:"🀄️",mailbox:"📫",mailbox_closed:"📪",mailbox_with_mail:"📬",mailbox_with_no_mail:"📭",man:"👨",man_artist:"👨‍🎨",man_astronaut:"👨‍🚀",man_cartwheeling:"🤸‍♂️",man_cook:"👨‍🍳",man_dancing:"🕺",man_facepalming:"🤦‍♂️",man_factory_worker:"👨‍🏭",man_farmer:"👨‍🌾",man_firefighter:"👨‍🚒",man_health_worker:"👨‍⚕️",man_in_tuxedo:"🤵",man_judge:"👨‍⚖️",man_juggling:"🤹‍♂️",man_mechanic:"👨‍🔧",man_office_worker:"👨‍💼",man_pilot:"👨‍✈️",man_playing_handball:"🤾‍♂️",man_playing_water_polo:"🤽‍♂️",man_scientist:"👨‍🔬",man_shrugging:"🤷‍♂️",man_singer:"👨‍🎤",man_student:"👨‍🎓",man_teacher:"👨‍🏫",man_technologist:"👨‍💻",man_with_gua_pi_mao:"👲",man_with_turban:"👳",tangerine:"🍊",mans_shoe:"👞",mantelpiece_clock:"🕰",maple_leaf:"🍁",martial_arts_uniform:"🥋",mask:"😷",massage_woman:"💆",massage_man:"💆‍♂️",meat_on_bone:"🍖",medal_military:"🎖",medal_sports:"🏅",mega:"📣",melon:"🍈",memo:"📝",men_wrestling:"🤼‍♂️",menorah:"🕎",mens:"🚹",metal:"🤘",metro:"🚇",microphone:"🎤",microscope:"🔬",milk_glass:"🥛",milky_way:"🌌",minibus:"🚐",minidisc:"💽",mobile_phone_off:"📴",money_mouth_face:"🤑",money_with_wings:"💸",moneybag:"💰",monkey:"🐒",monkey_face:"🐵",monorail:"🚝",moon:"🌔",mortar_board:"🎓",mosque:"🕌",motor_boat:"🛥",motor_scooter:"🛵",motorcycle:"🏍",motorway:"🛣",mount_fuji:"🗻",mountain:"⛰",mountain_biking_man:"🚵",mountain_biking_woman:"🚵‍♀️",mountain_cableway:"🚠",mountain_railway:"🚞",mountain_snow:"🏔",mouse:"🐭",mouse2:"🐁",movie_camera:"🎥",moyai:"🗿",mrs_claus:"🤶",muscle:"💪",mushroom:"🍄",musical_keyboard:"🎹",musical_note:"🎵",musical_score:"🎼",mute:"🔇",nail_care:"💅",name_badge:"📛",national_park:"🏞",nauseated_face:"🤢",necktie:"👔",negative_squared_cross_mark:"❎",nerd_face:"🤓",neutral_face:"😐",new:"🆕",new_moon:"🌑",new_moon_with_face:"🌚",newspaper:"📰",newspaper_roll:"🗞",next_track_button:"⏭",ng:"🆖",no_good_man:"🙅‍♂️",no_good_woman:"🙅",night_with_stars:"🌃",no_bell:"🔕",no_bicycles:"🚳",no_entry:"⛔️",no_entry_sign:"🚫",no_mobile_phones:"📵",no_mouth:"😶",no_pedestrians:"🚷",no_smoking:"🚭","non-potable_water":"🚱",nose:"👃",notebook:"📓",notebook_with_decorative_cover:"📔",notes:"🎶",nut_and_bolt:"🔩",o:"⭕️",o2:"🅾️",ocean:"🌊",octopus:"🐙",oden:"🍢",office:"🏢",oil_drum:"🛢",ok:"🆗",ok_hand:"👌",ok_man:"🙆‍♂️",ok_woman:"🙆",old_key:"🗝",older_man:"👴",older_woman:"👵",om:"🕉",on:"🔛",oncoming_automobile:"🚘",oncoming_bus:"🚍",oncoming_police_car:"🚔",oncoming_taxi:"🚖",open_file_folder:"📂",open_hands:"👐",open_mouth:"😮",open_umbrella:"☂️",ophiuchus:"⛎",orange_book:"📙",orthodox_cross:"☦️",outbox_tray:"📤",owl:"🦉",ox:"🐂",package:"📦",page_facing_up:"📄",page_with_curl:"📃",pager:"📟",paintbrush:"🖌",palm_tree:"🌴",pancakes:"🥞",panda_face:"🐼",paperclip:"📎",paperclips:"🖇",parasol_on_ground:"⛱",parking:"🅿️",part_alternation_mark:"〽️",partly_sunny:"⛅️",passenger_ship:"🛳",passport_control:"🛂",pause_button:"⏸",peace_symbol:"☮️",peach:"🍑",peanuts:"🥜",pear:"🍐",pen:"🖊",pencil2:"✏️",penguin:"🐧",pensive:"😔",performing_arts:"🎭",persevere:"😣",person_fencing:"🤺",pouting_woman:"🙎",phone:"☎️",pick:"⛏",pig:"🐷",pig2:"🐖",pig_nose:"🐽",pill:"💊",pineapple:"🍍",ping_pong:"🏓",pisces:"♓️",pizza:"🍕",place_of_worship:"🛐",plate_with_cutlery:"🍽",play_or_pause_button:"⏯",point_down:"👇",point_left:"👈",point_right:"👉",point_up:"☝️",point_up_2:"👆",police_car:"🚓",policewoman:"👮‍♀️",poodle:"🐩",popcorn:"🍿",post_office:"🏣",postal_horn:"📯",postbox:"📮",potable_water:"🚰",potato:"🥔",pouch:"👝",poultry_leg:"🍗",pound:"💷",rage:"😡",pouting_cat:"😾",pouting_man:"🙎‍♂️",pray:"🙏",prayer_beads:"📿",pregnant_woman:"🤰",previous_track_button:"⏮",prince:"🤴",princess:"👸",printer:"🖨",purple_heart:"💜",purse:"👛",pushpin:"📌",put_litter_in_its_place:"🚮",question:"❓",rabbit:"🐰",rabbit2:"🐇",racehorse:"🐎",racing_car:"🏎",radio:"📻",radio_button:"🔘",radioactive:"☢️",railway_car:"🚃",railway_track:"🛤",rainbow:"🌈",rainbow_flag:"🏳️‍🌈",raised_back_of_hand:"🤚",raised_hand_with_fingers_splayed:"🖐",raised_hands:"🙌",raising_hand_woman:"🙋",raising_hand_man:"🙋‍♂️",ram:"🐏",ramen:"🍜",rat:"🐀",record_button:"⏺",recycle:"♻️",red_circle:"🔴",registered:"®️",relaxed:"☺️",relieved:"😌",reminder_ribbon:"🎗",repeat:"🔁",repeat_one:"🔂",rescue_worker_helmet:"⛑",restroom:"🚻",revolving_hearts:"💞",rewind:"⏪",rhinoceros:"🦏",ribbon:"🎀",rice:"🍚",rice_ball:"🍙",rice_cracker:"🍘",rice_scene:"🎑",right_anger_bubble:"🗯",ring:"💍",robot:"🤖",rocket:"🚀",rofl:"🤣",roll_eyes:"🙄",roller_coaster:"🎢",rooster:"🐓",rose:"🌹",rosette:"🏵",rotating_light:"🚨",round_pushpin:"📍",rowing_man:"🚣",rowing_woman:"🚣‍♀️",rugby_football:"🏉",running_man:"🏃",running_shirt_with_sash:"🎽",running_woman:"🏃‍♀️",sa:"🈂️",sagittarius:"♐️",sake:"🍶",sandal:"👡",santa:"🎅",satellite:"📡",saxophone:"🎷",school:"🏫",school_satchel:"🎒",scissors:"✂️",scorpion:"🦂",scorpius:"♏️",scream:"😱",scream_cat:"🙀",scroll:"📜",seat:"💺",secret:"㊙️",see_no_evil:"🙈",seedling:"🌱",selfie:"🤳",shallow_pan_of_food:"🥘",shamrock:"☘️",shark:"🦈",shaved_ice:"🍧",sheep:"🐑",shell:"🐚",shield:"🛡",shinto_shrine:"⛩",ship:"🚢",shirt:"👕",shopping:"🛍",shopping_cart:"🛒",shower:"🚿",shrimp:"🦐",signal_strength:"📶",six_pointed_star:"🔯",ski:"🎿",skier:"⛷",skull:"💀",skull_and_crossbones:"☠️",sleeping:"😴",sleeping_bed:"🛌",sleepy:"😪",slightly_frowning_face:"🙁",slightly_smiling_face:"🙂",slot_machine:"🎰",small_airplane:"🛩",small_blue_diamond:"🔹",small_orange_diamond:"🔸",small_red_triangle:"🔺",small_red_triangle_down:"🔻",smile:"😄",smile_cat:"😸",smiley:"😃",smiley_cat:"😺",smiling_imp:"😈",smirk:"😏",smirk_cat:"😼",smoking:"🚬",snail:"🐌",snake:"🐍",sneezing_face:"🤧",snowboarder:"🏂",snowflake:"❄️",snowman:"⛄️",snowman_with_snow:"☃️",sob:"😭",soccer:"⚽️",soon:"🔜",sos:"🆘",sound:"🔉",space_invader:"👾",spades:"♠️",spaghetti:"🍝",sparkle:"❇️",sparkler:"🎇",sparkles:"✨",sparkling_heart:"💖",speak_no_evil:"🙊",speaker:"🔈",speaking_head:"🗣",speech_balloon:"💬",speedboat:"🚤",spider:"🕷",spider_web:"🕸",spiral_calendar:"🗓",spiral_notepad:"🗒",spoon:"🥄",squid:"🦑",stadium:"🏟",star:"⭐️",star2:"🌟",star_and_crescent:"☪️",star_of_david:"✡️",stars:"🌠",station:"🚉",statue_of_liberty:"🗽",steam_locomotive:"🚂",stew:"🍲",stop_button:"⏹",stop_sign:"🛑",stopwatch:"⏱",straight_ruler:"📏",strawberry:"🍓",stuck_out_tongue:"😛",stuck_out_tongue_closed_eyes:"😝",stuck_out_tongue_winking_eye:"😜",studio_microphone:"🎙",stuffed_flatbread:"🥙",sun_behind_large_cloud:"🌥",sun_behind_rain_cloud:"🌦",sun_behind_small_cloud:"🌤",sun_with_face:"🌞",sunflower:"🌻",sunglasses:"😎",sunny:"☀️",sunrise:"🌅",sunrise_over_mountains:"🌄",surfing_man:"🏄",surfing_woman:"🏄‍♀️",sushi:"🍣",suspension_railway:"🚟",sweat:"😓",sweat_drops:"💦",sweat_smile:"😅",sweet_potato:"🍠",swimming_man:"🏊",swimming_woman:"🏊‍♀️",symbols:"🔣",synagogue:"🕍",syringe:"💉",taco:"🌮",tada:"🎉",tanabata_tree:"🎋",taurus:"♉️",taxi:"🚕",tea:"🍵",telephone_receiver:"📞",telescope:"🔭",tennis:"🎾",tent:"⛺️",thermometer:"🌡",thinking:"🤔",thought_balloon:"💭",ticket:"🎫",tickets:"🎟",tiger:"🐯",tiger2:"🐅",timer_clock:"⏲",tipping_hand_man:"💁‍♂️",tired_face:"😫",tm:"™️",toilet:"🚽",tokyo_tower:"🗼",tomato:"🍅",tongue:"👅",top:"🔝",tophat:"🎩",tornado:"🌪",trackball:"🖲",tractor:"🚜",traffic_light:"🚥",train:"🚋",train2:"🚆",tram:"🚊",triangular_flag_on_post:"🚩",triangular_ruler:"📐",trident:"🔱",triumph:"😤",trolleybus:"🚎",trophy:"🏆",tropical_drink:"🍹",tropical_fish:"🐠",truck:"🚚",trumpet:"🎺",tulip:"🌷",tumbler_glass:"🥃",turkey:"🦃",turtle:"🐢",tv:"📺",twisted_rightwards_arrows:"🔀",two_hearts:"💕",two_men_holding_hands:"👬",two_women_holding_hands:"👭",u5272:"🈹",u5408:"🈴",u55b6:"🈺",u6307:"🈯️",u6708:"🈷️",u6709:"🈶",u6e80:"🈵",u7121:"🈚️",u7533:"🈸",u7981:"🈲",u7a7a:"🈳",umbrella:"☔️",unamused:"😒",underage:"🔞",unicorn:"🦄",unlock:"🔓",up:"🆙",upside_down_face:"🙃",v:"✌️",vertical_traffic_light:"🚦",vhs:"📼",vibration_mode:"📳",video_camera:"📹",video_game:"🎮",violin:"🎻",virgo:"♍️",volcano:"🌋",volleyball:"🏐",vs:"🆚",vulcan_salute:"🖖",walking_man:"🚶",walking_woman:"🚶‍♀️",waning_crescent_moon:"🌘",waning_gibbous_moon:"🌖",warning:"⚠️",wastebasket:"🗑",watch:"⌚️",water_buffalo:"🐃",watermelon:"🍉",wave:"👋",wavy_dash:"〰️",waxing_crescent_moon:"🌒",wc:"🚾",weary:"😩",wedding:"💒",weight_lifting_man:"🏋️",weight_lifting_woman:"🏋️‍♀️",whale:"🐳",whale2:"🐋",wheel_of_dharma:"☸️",wheelchair:"♿️",white_check_mark:"✅",white_circle:"⚪️",white_flag:"🏳️",white_flower:"💮",white_large_square:"⬜️",white_medium_small_square:"◽️",white_medium_square:"◻️",white_small_square:"▫️",white_square_button:"🔳",wilted_flower:"🥀",wind_chime:"🎐",wind_face:"🌬",wine_glass:"🍷",wink:"😉",wolf:"🐺",woman:"👩",woman_artist:"👩‍🎨",woman_astronaut:"👩‍🚀",woman_cartwheeling:"🤸‍♀️",woman_cook:"👩‍🍳",woman_facepalming:"🤦‍♀️",woman_factory_worker:"👩‍🏭",woman_farmer:"👩‍🌾",woman_firefighter:"👩‍🚒",woman_health_worker:"👩‍⚕️",woman_judge:"👩‍⚖️",woman_juggling:"🤹‍♀️",woman_mechanic:"👩‍🔧",woman_office_worker:"👩‍💼",woman_pilot:"👩‍✈️",woman_playing_handball:"🤾‍♀️",woman_playing_water_polo:"🤽‍♀️",woman_scientist:"👩‍🔬",woman_shrugging:"🤷‍♀️",woman_singer:"👩‍🎤",woman_student:"👩‍🎓",woman_teacher:"👩‍🏫",woman_technologist:"👩‍💻",woman_with_turban:"👳‍♀️",womans_clothes:"👚",womans_hat:"👒",women_wrestling:"🤼‍♀️",womens:"🚺",world_map:"🗺",worried:"😟",wrench:"🔧",writing_hand:"✍️",x:"❌",yellow_heart:"💛",yen:"💴",yin_yang:"☯️",yum:"😋",zap:"⚡️",zipper_mouth_face:"🤐",zzz:"💤",octocat:':octocat:',showdown:`S`},r.Converter=function(E){var A={},I=[],O=[],z={},$=a,W={parsed:{},raw:"",format:""};J();function J(){E=E||{};for(var U in s)s.hasOwnProperty(U)&&(A[U]=s[U]);if(typeof E=="object")for(var Q in E)E.hasOwnProperty(Q)&&(A[Q]=E[Q]);else throw Error("Converter expects the passed parameter to be an object, but "+typeof E+" was passed instead.");A.extensions&&r.helper.forEach(A.extensions,Z)}function Z(U,Q){if(Q=Q||null,r.helper.isString(U))if(U=r.helper.stdExtName(U),Q=U,r.extensions[U]){console.warn("DEPRECATION WARNING: "+U+" is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"),q(r.extensions[U],U);return}else if(!r.helper.isUndefined(o[U]))U=o[U];else throw Error('Extension "'+U+'" could not be loaded. It was either not found or is not a valid extension.');typeof U=="function"&&(U=U()),r.helper.isArray(U)||(U=[U]);var re=c(U,Q);if(!re.valid)throw Error(re.error);for(var le=0;le[ \t]+¨NBSP;<"),!Q)if(window&&window.document)Q=window.document;else throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM");var re=Q.createElement("div");re.innerHTML=U;var le={preList:Ie(re)};Ee(re);for(var oe=re.childNodes,he="",xe=0;xe'}else Ze.push($e[lt].innerHTML),$e[lt].innerHTML="",$e[lt].setAttribute("prenum",lt.toString());return Ze}return he},this.setOption=function(U,Q){A[U]=Q},this.getOption=function(U){return A[U]},this.getOptions=function(){return A},this.addExtension=function(U,Q){Q=Q||null,Z(U,Q)},this.useExtension=function(U){Z(U)},this.setFlavor=function(U){if(!l.hasOwnProperty(U))throw Error(U+" flavor was not found");var Q=l[U];$=U;for(var re in Q)Q.hasOwnProperty(re)&&(A[re]=Q[re])},this.getFlavor=function(){return $},this.removeExtension=function(U){r.helper.isArray(U)||(U=[U]);for(var Q=0;Q? ?(['"].*['"])?\)$/m)>-1)J="";else if(!J)if(W||(W=$.toLowerCase().replace(/ ?\n/g," ")),J="#"+W,!r.helper.isUndefined(I.gUrls[W]))J=I.gUrls[W],r.helper.isUndefined(I.gTitles[W])||(j=I.gTitles[W]);else return z;J=J.replace(r.helper.regexes.asteriskDashAndColon,r.helper.escapeCharactersCallback);var G='",G};return E=E.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g,O),E=E.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,O),E=E.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]??(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,O),E=E.replace(/\[([^\[\]]+)]()()()()()/g,O),A.ghMentions&&(E=E.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi,function(z,$,W,J,Z){if(W==="\\")return $+J;if(!r.helper.isString(A.ghMentionsLink))throw new Error("ghMentionsLink option must be a string");var q=A.ghMentionsLink.replace(/\{u}/g,Z),j="";return A.openLinksInNewWindow&&(j=' rel="noopener noreferrer" target="¨E95Eblank"'),$+'"+J+""})),E=I.converter._dispatch("anchors.after",E,A,I),E});var p=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,m=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,y=/()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,w=/(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi,x=/<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,C=function(E){return function(A,I,O,z,$,W,J){O=O.replace(r.helper.regexes.asteriskDashAndColon,r.helper.escapeCharactersCallback);var Z=O,q="",j="",G=I||"",U=J||"";return/^www\./i.test(O)&&(O=O.replace(/^www\./i,"http://www.")),E.excludeTrailingPunctuationFromURLs&&W&&(q=W),E.openLinksInNewWindow&&(j=' rel="noopener noreferrer" target="¨E95Eblank"'),G+'"+Z+""+q+U}},S=function(E,A){return function(I,O,z){var $="mailto:";return O=O||"",z=r.subParser("unescapeSpecialChars")(z,E,A),E.encodeEmails?($=r.helper.encodeEmailAddress($+z),z=r.helper.encodeEmailAddress(z)):$=$+z,O+''+z+""}};r.subParser("autoLinks",function(E,A,I){return E=I.converter._dispatch("autoLinks.before",E,A,I),E=E.replace(y,C(A)),E=E.replace(x,S(A,I)),E=I.converter._dispatch("autoLinks.after",E,A,I),E}),r.subParser("simplifiedAutoLinks",function(E,A,I){return A.simplifiedAutoLink&&(E=I.converter._dispatch("simplifiedAutoLinks.before",E,A,I),A.excludeTrailingPunctuationFromURLs?E=E.replace(m,C(A)):E=E.replace(p,C(A)),E=E.replace(w,S(A,I)),E=I.converter._dispatch("simplifiedAutoLinks.after",E,A,I)),E}),r.subParser("blockGamut",function(E,A,I){return E=I.converter._dispatch("blockGamut.before",E,A,I),E=r.subParser("blockQuotes")(E,A,I),E=r.subParser("headers")(E,A,I),E=r.subParser("horizontalRule")(E,A,I),E=r.subParser("lists")(E,A,I),E=r.subParser("codeBlocks")(E,A,I),E=r.subParser("tables")(E,A,I),E=r.subParser("hashHTMLBlocks")(E,A,I),E=r.subParser("paragraphs")(E,A,I),E=I.converter._dispatch("blockGamut.after",E,A,I),E}),r.subParser("blockQuotes",function(E,A,I){E=I.converter._dispatch("blockQuotes.before",E,A,I),E=E+` `;var O=/(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;return A.splitAdjacentBlockquotes&&(O=/^ {0,3}>[\s\S]*?(?:\n\n)/gm),E=E.replace(O,function(z){return z=z.replace(/^[ \t]*>[ \t]?/gm,""),z=z.replace(/¨0/g,""),z=z.replace(/^[ \t]+$/gm,""),z=r.subParser("githubCodeBlocks")(z,A,I),z=r.subParser("blockGamut")(z,A,I),z=z.replace(/(^|\n)/g,"$1 "),z=z.replace(/(\s*
[^\r]+?<\/pre>)/gm,function($,W){var J=W;return J=J.replace(/^  /mg,"¨0"),J=J.replace(/¨0/g,""),J}),r.subParser("hashBlock")(`
`+z+`
`,A,I)}),E=I.converter._dispatch("blockQuotes.after",E,A,I),E}),r.subParser("codeBlocks",function(E,A,I){E=I.converter._dispatch("codeBlocks.before",E,A,I),E+="¨0";var O=/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g;return E=E.replace(O,function(z,$,W){var J=$,Z=W,q=` `;return J=r.subParser("outdent")(J,A,I),J=r.subParser("encodeCode")(J,A,I),J=r.subParser("detab")(J,A,I),J=J.replace(/^\n+/g,""),J=J.replace(/\n+$/g,""),A.omitExtraWLInCodeBlocks&&(q=""),J="
"+J+q+"
",r.subParser("hashBlock")(J,A,I)+Z}),E=E.replace(/¨0/,""),E=I.converter._dispatch("codeBlocks.after",E,A,I),E}),r.subParser("codeSpans",function(E,A,I){return E=I.converter._dispatch("codeSpans.before",E,A,I),typeof E>"u"&&(E=""),E=E.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(O,z,$,W){var J=W;return J=J.replace(/^([ \t]*)/g,""),J=J.replace(/[ \t]*$/g,""),J=r.subParser("encodeCode")(J,A,I),J=z+""+J+"",J=r.subParser("hashHTMLSpans")(J,A,I),J}),E=I.converter._dispatch("codeSpans.after",E,A,I),E}),r.subParser("completeHTMLDocument",function(E,A,I){if(!A.completeHTMLDocument)return E;E=I.converter._dispatch("completeHTMLDocument.before",E,A,I);var O="html",z=` `,$="",W=` `,J="",Z="";typeof I.metadata.parsed.doctype<"u"&&(z=" `,O=I.metadata.parsed.doctype.toString().toLowerCase(),(O==="html"||O==="html5")&&(W=''));for(var q in I.metadata.parsed)if(I.metadata.parsed.hasOwnProperty(q))switch(q.toLowerCase()){case"doctype":break;case"title":$=""+I.metadata.parsed.title+` `;break;case"charset":O==="html"||O==="html5"?W=' `:W=' `;break;case"language":case"lang":J=' lang="'+I.metadata.parsed[q]+'"',Z+=' `;break;default:Z+=' `}return E=z+" `+$+W+Z+` `+E.trim()+` `,E=I.converter._dispatch("completeHTMLDocument.after",E,A,I),E}),r.subParser("detab",function(E,A,I){return E=I.converter._dispatch("detab.before",E,A,I),E=E.replace(/\t(?=\t)/g," "),E=E.replace(/\t/g,"¨A¨B"),E=E.replace(/¨B(.+?)¨A/g,function(O,z){for(var $=z,W=4-$.length%4,J=0;J/g,">"),E=I.converter._dispatch("encodeAmpsAndAngles.after",E,A,I),E}),r.subParser("encodeBackslashEscapes",function(E,A,I){return E=I.converter._dispatch("encodeBackslashEscapes.before",E,A,I),E=E.replace(/\\(\\)/g,r.helper.escapeCharactersCallback),E=E.replace(/\\([`*_{}\[\]()>#+.!~=|:-])/g,r.helper.escapeCharactersCallback),E=I.converter._dispatch("encodeBackslashEscapes.after",E,A,I),E}),r.subParser("encodeCode",function(E,A,I){return E=I.converter._dispatch("encodeCode.before",E,A,I),E=E.replace(/&/g,"&").replace(//g,">").replace(/([*_{}\[\]\\=~-])/g,r.helper.escapeCharactersCallback),E=I.converter._dispatch("encodeCode.after",E,A,I),E}),r.subParser("escapeSpecialCharsWithinTagAttributes",function(E,A,I){E=I.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before",E,A,I);var O=/<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,z=/-]|-[^>])(?:[^-]|-[^-])*)--)>/gi;return E=E.replace(O,function($){return $.replace(/(.)<\/?code>(?=.)/g,"$1`").replace(/([\\`*_~=|])/g,r.helper.escapeCharactersCallback)}),E=E.replace(z,function($){return $.replace(/([\\`*_~=|])/g,r.helper.escapeCharactersCallback)}),E=I.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after",E,A,I),E}),r.subParser("githubCodeBlocks",function(E,A,I){return A.ghCodeBlocks?(E=I.converter._dispatch("githubCodeBlocks.before",E,A,I),E+="¨0",E=E.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g,function(O,z,$,W){var J=A.omitExtraWLInCodeBlocks?"":` `;return W=r.subParser("encodeCode")(W,A,I),W=r.subParser("detab")(W,A,I),W=W.replace(/^\n+/g,""),W=W.replace(/\n+$/g,""),W="
"+W+J+"
",W=r.subParser("hashBlock")(W,A,I),` ¨G`+(I.ghCodeBlocks.push({text:O,codeblock:W})-1)+`G `}),E=E.replace(/¨0/,""),I.converter._dispatch("githubCodeBlocks.after",E,A,I)):E}),r.subParser("hashBlock",function(E,A,I){return E=I.converter._dispatch("hashBlock.before",E,A,I),E=E.replace(/(^\n+|\n+$)/g,""),E=` ¨K`+(I.gHtmlBlocks.push(E)-1)+`K `,E=I.converter._dispatch("hashBlock.after",E,A,I),E}),r.subParser("hashCodeTags",function(E,A,I){E=I.converter._dispatch("hashCodeTags.before",E,A,I);var O=function(z,$,W,J){var Z=W+r.subParser("encodeCode")($,A,I)+J;return"¨C"+(I.gHtmlSpans.push(Z)-1)+"C"};return E=r.helper.replaceRecursiveRegExp(E,O,"]*>","","gim"),E=I.converter._dispatch("hashCodeTags.after",E,A,I),E}),r.subParser("hashElement",function(E,A,I){return function(O,z){var $=z;return $=$.replace(/\n\n/g,` `),$=$.replace(/^\n/,""),$=$.replace(/\n+$/g,""),$=` ¨K`+(I.gHtmlBlocks.push($)-1)+`K `,$}}),r.subParser("hashHTMLBlocks",function(E,A,I){E=I.converter._dispatch("hashHTMLBlocks.before",E,A,I);var O=["pre","div","h1","h2","h3","h4","h5","h6","blockquote","table","dl","ol","ul","script","noscript","form","fieldset","iframe","math","style","section","header","footer","nav","article","aside","address","audio","canvas","figure","hgroup","output","video","p"],z=function(U,Q,re,le){var oe=U;return re.search(/\bmarkdown\b/)!==-1&&(oe=re+I.converter.makeHtml(Q)+le),` ¨K`+(I.gHtmlBlocks.push(oe)-1)+`K `};A.backslashEscapesHTMLTags&&(E=E.replace(/\\<(\/?[^>]+?)>/g,function(U,Q){return"<"+Q+">"}));for(var $=0;$]*>)","im"),Z="<"+O[$]+"\\b[^>]*>",q="";(W=r.helper.regexIndexOf(E,J))!==-1;){var j=r.helper.splitAtIndex(E,W),G=r.helper.replaceRecursiveRegExp(j[1],z,Z,q,"im");if(G===j[1])break;E=j[0].concat(G)}return E=E.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,r.subParser("hashElement")(E,A,I)),E=r.helper.replaceRecursiveRegExp(E,function(U){return` ¨K`+(I.gHtmlBlocks.push(U)-1)+`K `},"^ {0,3}","gm"),E=E.replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,r.subParser("hashElement")(E,A,I)),E=I.converter._dispatch("hashHTMLBlocks.after",E,A,I),E}),r.subParser("hashHTMLSpans",function(E,A,I){E=I.converter._dispatch("hashHTMLSpans.before",E,A,I);function O(z){return"¨C"+(I.gHtmlSpans.push(z)-1)+"C"}return E=E.replace(/<[^>]+?\/>/gi,function(z){return O(z)}),E=E.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g,function(z){return O(z)}),E=E.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g,function(z){return O(z)}),E=E.replace(/<[^>]+?>/gi,function(z){return O(z)}),E=I.converter._dispatch("hashHTMLSpans.after",E,A,I),E}),r.subParser("unhashHTMLSpans",function(E,A,I){E=I.converter._dispatch("unhashHTMLSpans.before",E,A,I);for(var O=0;O]*>\\s*]*>","^ {0,3}\\s*
","gim"),E=I.converter._dispatch("hashPreCodeTags.after",E,A,I),E}),r.subParser("headers",function(E,A,I){E=I.converter._dispatch("headers.before",E,A,I);var O=isNaN(parseInt(A.headerLevelStart))?1:parseInt(A.headerLevelStart),z=A.smoothLivePreview?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,$=A.smoothLivePreview?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;E=E.replace(z,function(Z,q){var j=r.subParser("spanGamut")(q,A,I),G=A.noHeaderId?"":' id="'+J(q)+'"',U=O,Q=""+j+"";return r.subParser("hashBlock")(Q,A,I)}),E=E.replace($,function(Z,q){var j=r.subParser("spanGamut")(q,A,I),G=A.noHeaderId?"":' id="'+J(q)+'"',U=O+1,Q=""+j+"";return r.subParser("hashBlock")(Q,A,I)});var W=A.requireSpaceBeforeHeadingText?/^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm:/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;E=E.replace(W,function(Z,q,j){var G=j;A.customizedHeaderId&&(G=j.replace(/\s?\{([^{]+?)}\s*$/,""));var U=r.subParser("spanGamut")(G,A,I),Q=A.noHeaderId?"":' id="'+J(j)+'"',re=O-1+q.length,le=""+U+"";return r.subParser("hashBlock")(le,A,I)});function J(Z){var q,j;if(A.customizedHeaderId){var G=Z.match(/\{([^{]+?)}\s*$/);G&&G[1]&&(Z=G[1])}return q=Z,r.helper.isString(A.prefixHeaderId)?j=A.prefixHeaderId:A.prefixHeaderId===!0?j="section-":j="",A.rawPrefixHeaderId||(q=j+q),A.ghCompatibleHeaderId?q=q.replace(/ /g,"-").replace(/&/g,"").replace(/¨T/g,"").replace(/¨D/g,"").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g,"").toLowerCase():A.rawHeaderId?q=q.replace(/ /g,"-").replace(/&/g,"&").replace(/¨T/g,"¨").replace(/¨D/g,"$").replace(/["']/g,"-").toLowerCase():q=q.replace(/[^\w]/g,"").toLowerCase(),A.rawPrefixHeaderId&&(q=j+q),I.hashLinkCounts[q]?q=q+"-"+I.hashLinkCounts[q]++:I.hashLinkCounts[q]=1,q}return E=I.converter._dispatch("headers.after",E,A,I),E}),r.subParser("horizontalRule",function(E,A,I){E=I.converter._dispatch("horizontalRule.before",E,A,I);var O=r.subParser("hashBlock")("
",A,I);return E=E.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm,O),E=E.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm,O),E=E.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm,O),E=I.converter._dispatch("horizontalRule.after",E,A,I),E}),r.subParser("images",function(E,A,I){E=I.converter._dispatch("images.before",E,A,I);var O=/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,z=/!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,$=/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,W=/!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,J=/!\[([^\[\]]+)]()()()()()/g;function Z(j,G,U,Q,re,le,oe,he){return Q=Q.replace(/\s/g,""),q(j,G,U,Q,re,le,oe,he)}function q(j,G,U,Q,re,le,oe,he){var xe=I.gUrls,Ee=I.gTitles,Ie=I.gDimensions;if(U=U.toLowerCase(),he||(he=""),j.search(/\(? ?(['"].*['"])?\)$/m)>-1)Q="";else if(Q===""||Q===null)if((U===""||U===null)&&(U=G.toLowerCase().replace(/ ?\n/g," ")),Q="#"+U,!r.helper.isUndefined(xe[U]))Q=xe[U],r.helper.isUndefined(Ee[U])||(he=Ee[U]),r.helper.isUndefined(Ie[U])||(re=Ie[U].width,le=Ie[U].height);else return j;G=G.replace(/"/g,""").replace(r.helper.regexes.asteriskDashAndColon,r.helper.escapeCharactersCallback),Q=Q.replace(r.helper.regexes.asteriskDashAndColon,r.helper.escapeCharactersCallback);var Oe=''+G+'","
")}),E=E.replace(/\b__(\S[\s\S]*?)__\b/g,function(z,$){return O($,"","")}),E=E.replace(/\b_(\S[\s\S]*?)_\b/g,function(z,$){return O($,"","")})):(E=E.replace(/___(\S[\s\S]*?)___/g,function(z,$){return/\S$/.test($)?O($,"",""):z}),E=E.replace(/__(\S[\s\S]*?)__/g,function(z,$){return/\S$/.test($)?O($,"",""):z}),E=E.replace(/_([^\s_][\s\S]*?)_/g,function(z,$){return/\S$/.test($)?O($,"",""):z})),A.literalMidWordAsterisks?(E=E.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g,function(z,$,W){return O(W,$+"","")}),E=E.replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g,function(z,$,W){return O(W,$+"","")}),E=E.replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g,function(z,$,W){return O(W,$+"","")})):(E=E.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g,function(z,$){return/\S$/.test($)?O($,"",""):z}),E=E.replace(/\*\*(\S[\s\S]*?)\*\*/g,function(z,$){return/\S$/.test($)?O($,"",""):z}),E=E.replace(/\*([^\s*][\s\S]*?)\*/g,function(z,$){return/\S$/.test($)?O($,"",""):z})),E=I.converter._dispatch("italicsAndBold.after",E,A,I),E}),r.subParser("lists",function(E,A,I){function O(W,J){I.gListLevel++,W=W.replace(/\n{2,}$/,` `),W+="¨0";var Z=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,q=/\n[ \t]*\n(?!¨0)/.test(W);return A.disableForced4SpacesIndentedSublists&&(Z=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm),W=W.replace(Z,function(j,G,U,Q,re,le,oe){oe=oe&&oe.trim()!=="";var he=r.subParser("outdent")(re,A,I),xe="";return le&&A.tasklists&&(xe=' class="task-list-item" style="list-style-type: none;"',he=he.replace(/^[ \t]*\[(x|X| )?]/m,function(){var Ee='-1?(he=r.subParser("githubCodeBlocks")(he,A,I),he=r.subParser("blockGamut")(he,A,I)):(he=r.subParser("lists")(he,A,I),he=he.replace(/\n$/,""),he=r.subParser("hashHTMLBlocks")(he,A,I),he=he.replace(/\n\n+/g,` `),q?he=r.subParser("paragraphs")(he,A,I):he=r.subParser("spanGamut")(he,A,I)),he=he.replace("¨A",""),he=""+he+` `,he}),W=W.replace(/¨0/g,""),I.gListLevel--,J&&(W=W.replace(/\s+$/,"")),W}function z(W,J){if(J==="ol"){var Z=W.match(/^ *(\d+)\./);if(Z&&Z[1]!=="1")return' start="'+Z[1]+'"'}return""}function $(W,J,Z){var q=A.disableForced4SpacesIndentedSublists?/^ ?\d+\.[ \t]/gm:/^ {0,3}\d+\.[ \t]/gm,j=A.disableForced4SpacesIndentedSublists?/^ ?[*+-][ \t]/gm:/^ {0,3}[*+-][ \t]/gm,G=J==="ul"?q:j,U="";if(W.search(G)!==-1)(function re(le){var oe=le.search(G),he=z(W,J);oe!==-1?(U+=` <`+J+he+`> `+O(le.slice(0,oe),!!Z)+" `,J=J==="ul"?"ol":"ul",G=J==="ul"?q:j,re(le.slice(oe))):U+=` <`+J+he+`> `+O(le,!!Z)+" `})(W);else{var Q=z(W,J);U=` <`+J+Q+`> `+O(W,!!Z)+" `}return U}return E=I.converter._dispatch("lists.before",E,A,I),E+="¨0",I.gListLevel?E=E.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(W,J,Z){var q=Z.search(/[*+-]/g)>-1?"ul":"ol";return $(J,q,!0)}):E=E.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(W,J,Z,q){var j=q.search(/[*+-]/g)>-1?"ul":"ol";return $(Z,j,!1)}),E=E.replace(/¨0/,""),E=I.converter._dispatch("lists.after",E,A,I),E}),r.subParser("metadata",function(E,A,I){if(!A.metadata)return E;E=I.converter._dispatch("metadata.before",E,A,I);function O(z){I.metadata.raw=z,z=z.replace(/&/g,"&").replace(/"/g,"""),z=z.replace(/\n {4}/g," "),z.replace(/^([\S ]+): +([\s\S]+?)$/gm,function($,W,J){return I.metadata.parsed[W]=J,""})}return E=E.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/,function(z,$,W){return O(W),"¨M"}),E=E.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/,function(z,$,W){return $&&(I.metadata.format=$),O(W),"¨M"}),E=E.replace(/¨M/g,""),E=I.converter._dispatch("metadata.after",E,A,I),E}),r.subParser("outdent",function(E,A,I){return E=I.converter._dispatch("outdent.before",E,A,I),E=E.replace(/^(\t|[ ]{1,4})/gm,"¨0"),E=E.replace(/¨0/g,""),E=I.converter._dispatch("outdent.after",E,A,I),E}),r.subParser("paragraphs",function(E,A,I){E=I.converter._dispatch("paragraphs.before",E,A,I),E=E.replace(/^\n+/g,""),E=E.replace(/\n+$/g,"");for(var O=E.split(/\n{2,}/g),z=[],$=O.length,W=0;W<$;W++){var J=O[W];J.search(/¨(K|G)(\d+)\1/g)>=0?z.push(J):J.search(/\S/)>=0&&(J=r.subParser("spanGamut")(J,A,I),J=J.replace(/^([ \t]*)/g,"

"),J+="

",z.push(J))}for($=z.length,W=0;W<$;W++){for(var Z="",q=z[W],j=!1;/¨(K|G)(\d+)\1/.test(q);){var G=RegExp.$1,U=RegExp.$2;G==="K"?Z=I.gHtmlBlocks[U]:j?Z=r.subParser("encodeCode")(I.ghCodeBlocks[U].text,A,I):Z=I.ghCodeBlocks[U].codeblock,Z=Z.replace(/\$/g,"$$$$"),q=q.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/,Z),/^]*>\s*]*>/.test(q)&&(j=!0)}z[W]=q}return E=z.join(` `),E=E.replace(/^\n+/g,""),E=E.replace(/\n+$/g,""),I.converter._dispatch("paragraphs.after",E,A,I)}),r.subParser("runExtension",function(E,A,I,O){if(E.filter)A=E.filter(A,O.converter,I);else if(E.regex){var z=E.regex;z instanceof RegExp||(z=new RegExp(z,"g")),A=A.replace(z,E.replace)}return A}),r.subParser("spanGamut",function(E,A,I){return E=I.converter._dispatch("spanGamut.before",E,A,I),E=r.subParser("codeSpans")(E,A,I),E=r.subParser("escapeSpecialCharsWithinTagAttributes")(E,A,I),E=r.subParser("encodeBackslashEscapes")(E,A,I),E=r.subParser("images")(E,A,I),E=r.subParser("anchors")(E,A,I),E=r.subParser("autoLinks")(E,A,I),E=r.subParser("simplifiedAutoLinks")(E,A,I),E=r.subParser("emoji")(E,A,I),E=r.subParser("underline")(E,A,I),E=r.subParser("italicsAndBold")(E,A,I),E=r.subParser("strikethrough")(E,A,I),E=r.subParser("ellipsis")(E,A,I),E=r.subParser("hashHTMLSpans")(E,A,I),E=r.subParser("encodeAmpsAndAngles")(E,A,I),A.simpleLineBreaks?/\n\n¨K/.test(E)||(E=E.replace(/\n+/g,`
`)):E=E.replace(/ +\n/g,`
`),E=I.converter._dispatch("spanGamut.after",E,A,I),E}),r.subParser("strikethrough",function(E,A,I){function O(z){return A.simplifiedAutoLink&&(z=r.subParser("simplifiedAutoLinks")(z,A,I)),""+z+""}return A.strikethrough&&(E=I.converter._dispatch("strikethrough.before",E,A,I),E=E.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g,function(z,$){return O($)}),E=I.converter._dispatch("strikethrough.after",E,A,I)),E}),r.subParser("stripLinkDefinitions",function(E,A,I){var O=/^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,z=/^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm;E+="¨0";var $=function(W,J,Z,q,j,G,U){return J=J.toLowerCase(),E.toLowerCase().split(J).length-1<2?W:(Z.match(/^data:.+?\/.+?;base64,/)?I.gUrls[J]=Z.replace(/\s/g,""):I.gUrls[J]=r.subParser("encodeAmpsAndAngles")(Z,A,I),G?G+U:(U&&(I.gTitles[J]=U.replace(/"|'/g,""")),A.parseImgDimensions&&q&&j&&(I.gDimensions[J]={width:q,height:j}),""))};return E=E.replace(z,$),E=E.replace(O,$),E=E.replace(/¨0/,""),E}),r.subParser("tables",function(E,A,I){if(!A.tables)return E;var O=/^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,z=/^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm;function $(j){return/^:[ \t]*--*$/.test(j)?' style="text-align:left;"':/^--*[ \t]*:[ \t]*$/.test(j)?' style="text-align:right;"':/^:[ \t]*--*[ \t]*:$/.test(j)?' style="text-align:center;"':""}function W(j,G){var U="";return j=j.trim(),(A.tablesHeaderId||A.tableHeaderId)&&(U=' id="'+j.replace(/ /g,"_").toLowerCase()+'"'),j=r.subParser("spanGamut")(j,A,I),""+j+` `}function J(j,G){var U=r.subParser("spanGamut")(j,A,I);return""+U+` `}function Z(j,G){for(var U=` `,Q=j.length,re=0;re `,re=0;re `;for(var le=0;le `}return U+=`
`,U}function q(j){var G,U=j.split(` `);for(G=0;G"+z+""}),E=E.replace(/\b__(\S[\s\S]*?)__\b/g,function(O,z){return""+z+""})):(E=E.replace(/___(\S[\s\S]*?)___/g,function(O,z){return/\S$/.test(z)?""+z+"":O}),E=E.replace(/__(\S[\s\S]*?)__/g,function(O,z){return/\S$/.test(z)?""+z+"":O})),E=E.replace(/(_)/g,r.helper.escapeCharactersCallback),E=I.converter._dispatch("underline.after",E,A,I)),E}),r.subParser("unescapeSpecialChars",function(E,A,I){return E=I.converter._dispatch("unescapeSpecialChars.before",E,A,I),E=E.replace(/¨E(\d+)E/g,function(O,z){var $=parseInt(z);return String.fromCharCode($)}),E=I.converter._dispatch("unescapeSpecialChars.after",E,A,I),E}),r.subParser("makeMarkdown.blockquote",function(E,A){var I="";if(E.hasChildNodes())for(var O=E.childNodes,z=O.length,$=0;$ "+I.split(` `).join(` > `),I}),r.subParser("makeMarkdown.codeBlock",function(E,A){var I=E.getAttribute("language"),O=E.getAttribute("precodenum");return"```"+I+` `+A.preList[O]+"\n```"}),r.subParser("makeMarkdown.codeSpan",function(E){return"`"+E.innerHTML+"`"}),r.subParser("makeMarkdown.emphasis",function(E,A){var I="";if(E.hasChildNodes()){I+="*";for(var O=E.childNodes,z=O.length,$=0;$",E.hasAttribute("width")&&E.hasAttribute("height")&&(A+=" ="+E.getAttribute("width")+"x"+E.getAttribute("height")),E.hasAttribute("title")&&(A+=' "'+E.getAttribute("title")+'"'),A+=")"),A}),r.subParser("makeMarkdown.links",function(E,A){var I="";if(E.hasChildNodes()&&E.hasAttribute("href")){var O=E.childNodes,z=O.length;I="[";for(var $=0;$",E.hasAttribute("title")&&(I+=' "'+E.getAttribute("title")+'"'),I+=")"}return I}),r.subParser("makeMarkdown.list",function(E,A,I){var O="";if(!E.hasChildNodes())return"";for(var z=E.childNodes,$=z.length,W=E.getAttribute("start")||1,J=0;J<$;++J)if(!(typeof z[J].tagName>"u"||z[J].tagName.toLowerCase()!=="li")){var Z="";I==="ol"?Z=W.toString()+". ":Z="- ",O+=Z+r.subParser("makeMarkdown.listItem")(z[J],A),++W}return O+=` `,O.trim()}),r.subParser("makeMarkdown.listItem",function(E,A){for(var I="",O=E.childNodes,z=O.length,$=0;$ `;if(E.nodeType!==1)return"";var z=E.tagName.toLowerCase();switch(z){case"h1":I||(O=r.subParser("makeMarkdown.header")(E,A,1)+` `);break;case"h2":I||(O=r.subParser("makeMarkdown.header")(E,A,2)+` `);break;case"h3":I||(O=r.subParser("makeMarkdown.header")(E,A,3)+` `);break;case"h4":I||(O=r.subParser("makeMarkdown.header")(E,A,4)+` `);break;case"h5":I||(O=r.subParser("makeMarkdown.header")(E,A,5)+` `);break;case"h6":I||(O=r.subParser("makeMarkdown.header")(E,A,6)+` `);break;case"p":I||(O=r.subParser("makeMarkdown.paragraph")(E,A)+` `);break;case"blockquote":I||(O=r.subParser("makeMarkdown.blockquote")(E,A)+` `);break;case"hr":I||(O=r.subParser("makeMarkdown.hr")(E,A)+` `);break;case"ol":I||(O=r.subParser("makeMarkdown.list")(E,A,"ol")+` `);break;case"ul":I||(O=r.subParser("makeMarkdown.list")(E,A,"ul")+` `);break;case"precode":I||(O=r.subParser("makeMarkdown.codeBlock")(E,A)+` `);break;case"pre":I||(O=r.subParser("makeMarkdown.pre")(E,A)+` `);break;case"table":I||(O=r.subParser("makeMarkdown.table")(E,A)+` `);break;case"code":O=r.subParser("makeMarkdown.codeSpan")(E,A);break;case"em":case"i":O=r.subParser("makeMarkdown.emphasis")(E,A);break;case"strong":case"b":O=r.subParser("makeMarkdown.strong")(E,A);break;case"del":O=r.subParser("makeMarkdown.strikethrough")(E,A);break;case"a":O=r.subParser("makeMarkdown.links")(E,A);break;case"img":O=r.subParser("makeMarkdown.image")(E,A);break;default:O=E.outerHTML+` `}return O}),r.subParser("makeMarkdown.paragraph",function(E,A){var I="";if(E.hasChildNodes())for(var O=E.childNodes,z=O.length,$=0;$"+A.preList[I]+""}),r.subParser("makeMarkdown.strikethrough",function(E,A){var I="";if(E.hasChildNodes()){I+="~~";for(var O=E.childNodes,z=O.length,$=0;$tr>th"),$=E.querySelectorAll("tbody>tr"),W,J;for(W=0;Wre&&(re=le)}for(W=0;W/g,"\\$1>"),A=A.replace(/^#/gm,"\\#"),A=A.replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3"),A=A.replace(/^( {0,3}\d+)\./gm,"$1\\."),A=A.replace(/^( {0,3})([+-])/gm,"$1\\$2"),A=A.replace(/]([\s]*)\(/g,"\\]$1\\("),A=A.replace(/^ {0,3}\[([\S \t]*?)]:/gm,"\\[$1]:"),A});var M=this;t.exports?t.exports=r:M.showdown=r}).call(zVe)}(_R)),_R.exports}var jVe=VVe();const UVe=$Ve(jVe);function HVe(t){for(var e=1;e0&&t[e-1]===` `;)e--;return t.substring(0,e)}var qVe=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function wR(t){return xR(t,qVe)}var oZ=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function sZ(t){return xR(t,oZ)}function YVe(t){return lZ(t,oZ)}var aZ=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function ZVe(t){return xR(t,aZ)}function XVe(t){return lZ(t,aZ)}function xR(t,e){return e.indexOf(t.nodeName)>=0}function lZ(t,e){return t.getElementsByTagName&&e.some(function(n){return t.getElementsByTagName(n).length})}var ll={};ll.paragraph={filter:"p",replacement:function(t){return` `+t+` `}},ll.lineBreak={filter:"br",replacement:function(t,e,n){return n.br+` `}},ll.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(t,e,n){var r=Number(e.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){var i=bR(r===1?"=":"-",t.length);return` `+t+` `+i+` `}else return` `+bR("#",r)+" "+t+` `}},ll.blockquote={filter:"blockquote",replacement:function(t){return t=t.replace(/^\n+|\n+$/g,""),t=t.replace(/^/gm,"> "),` `+t+` `}},ll.list={filter:["ul","ol"],replacement:function(t,e){var n=e.parentNode;return n.nodeName==="LI"&&n.lastElementChild===e?` `+t:` `+t+` `}},ll.listItem={filter:"li",replacement:function(t,e,n){t=t.replace(/^\n+/,"").replace(/\n+$/,` `).replace(/\n/gm,` `);var r=n.bulletListMarker+" ",i=e.parentNode;if(i.nodeName==="OL"){var o=i.getAttribute("start"),s=Array.prototype.indexOf.call(i.children,e);r=(o?Number(o)+s:s+1)+". "}return r+t+(e.nextSibling&&!/\n$/.test(t)?` `:"")}},ll.indentedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="indented"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,n){return` `+e.firstChild.textContent.replace(/\n/g,` `)+` `}},ll.fencedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="fenced"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,n){for(var r=e.firstChild.getAttribute("class")||"",i=(r.match(/language-(\S+)/)||[null,""])[1],o=e.firstChild.textContent,s=n.fence.charAt(0),a=3,l=new RegExp("^"+s+"{3,}","gm"),c;c=l.exec(o);)c[0].length>=a&&(a=c[0].length+1);var u=bR(s,a);return` `+u+i+` `+o.replace(/\n$/,"")+` `+u+` `}},ll.horizontalRule={filter:"hr",replacement:function(t,e,n){return` `+n.hr+` `}},ll.inlineLink={filter:function(t,e){return e.linkStyle==="inlined"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e){var n=e.getAttribute("href");n&&(n=n.replace(/([()])/g,"\\$1"));var r=fM(e.getAttribute("title"));return r&&(r=' "'+r.replace(/"/g,'\\"')+'"'),"["+t+"]("+n+r+")"}},ll.referenceLink={filter:function(t,e){return e.linkStyle==="referenced"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e,n){var r=e.getAttribute("href"),i=fM(e.getAttribute("title"));i&&(i=' "'+i+'"');var o,s;switch(n.linkReferenceStyle){case"collapsed":o="["+t+"][]",s="["+t+"]: "+r+i;break;case"shortcut":o="["+t+"]",s="["+t+"]: "+r+i;break;default:var a=this.references.length+1;o="["+t+"]["+a+"]",s="["+a+"]: "+r+i}return this.references.push(s),o},references:[],append:function(t){var e="";return this.references.length&&(e=` `+this.references.join(` `)+` `,this.references=[]),e}},ll.emphasis={filter:["em","i"],replacement:function(t,e,n){return t.trim()?n.emDelimiter+t+n.emDelimiter:""}},ll.strong={filter:["strong","b"],replacement:function(t,e,n){return t.trim()?n.strongDelimiter+t+n.strongDelimiter:""}},ll.code={filter:function(t){var e=t.previousSibling||t.nextSibling,n=t.parentNode.nodeName==="PRE"&&!e;return t.nodeName==="CODE"&&!n},replacement:function(t){if(!t)return"";t=t.replace(/\r?\n|\r/g," ");for(var e=/^`|^ .*?[^ ].* $|`$/.test(t)?" ":"",n="`",r=t.match(/`+/gm)||[];r.indexOf(n)!==-1;)n=n+"`";return n+e+t+e+n}},ll.image={filter:"img",replacement:function(t,e){var n=fM(e.getAttribute("alt")),r=e.getAttribute("src")||"",i=fM(e.getAttribute("title")),o=i?' "'+i+'"':"";return r?"!["+n+"]("+r+o+")":""}};function fM(t){return t?t.replace(/(\n+\s*)+/g,` `):""}function cZ(t){this.options=t,this._keep=[],this._remove=[],this.blankRule={replacement:t.blankReplacement},this.keepReplacement=t.keepReplacement,this.defaultRule={replacement:t.defaultReplacement},this.array=[];for(var e in t.rules)this.array.push(t.rules[e])}cZ.prototype={add:function(t,e){this.array.unshift(e)},keep:function(t){this._keep.unshift({filter:t,replacement:this.keepReplacement})},remove:function(t){this._remove.unshift({filter:t,replacement:function(){return""}})},forNode:function(t){if(t.isBlank)return this.blankRule;var e;return(e=ER(this.array,t,this.options))||(e=ER(this._keep,t,this.options))||(e=ER(this._remove,t,this.options))?e:this.defaultRule},forEach:function(t){for(var e=0;e-1)return!0}else if(typeof r=="function"){if(r.call(t,e,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function JVe(t){var e=t.element,n=t.isBlock,r=t.isVoid,i=t.isPre||function(d){return d.nodeName==="PRE"};if(!(!e.firstChild||i(e))){for(var o=null,s=!1,a=null,l=uZ(a,e,i);l!==e;){if(l.nodeType===3||l.nodeType===4){var c=l.data.replace(/[ \r\n\t]+/g," ");if((!o||/ $/.test(o.data))&&!s&&c[0]===" "&&(c=c.substr(1)),!c){l=SR(l);continue}l.data=c,o=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(o&&(o.data=o.data.replace(/ $/,"")),o=null,s=!1):r(l)||i(l)?(o=null,s=!0):o&&(s=!1);else{l=SR(l);continue}var u=uZ(a,l,i);a=l,l=u}o&&(o.data=o.data.replace(/ $/,""),o.data||SR(o))}}function SR(t){var e=t.nextSibling||t.parentNode;return t.parentNode.removeChild(t),e}function uZ(t,e,n){return t&&t.parentNode===e||n(e)?e.nextSibling||e.parentNode:e.firstChild||e.nextSibling||e.parentNode}var CR=typeof window<"u"?window:{};function QVe(){var t=CR.DOMParser,e=!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}function e6e(){var t=function(){};return t6e()?t.prototype.parseFromString=function(e){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(e),n.close(),n}:t.prototype.parseFromString=function(e){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(e),n.close(),n},t}function t6e(){var t=!1;try{document.implementation.createHTMLDocument("").open()}catch{CR.ActiveXObject&&(t=!0)}return t}var n6e=QVe()?CR.DOMParser:e6e();function r6e(t,e){var n;if(typeof t=="string"){var r=i6e().parseFromString(''+t+"","text/html");n=r.getElementById("turndown-root")}else n=t.cloneNode(!0);return JVe({element:n,isBlock:wR,isVoid:sZ,isPre:e.preformattedCode?o6e:null}),n}var kR;function i6e(){return kR=kR||new n6e,kR}function o6e(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}function s6e(t,e){return t.isBlock=wR(t),t.isCode=t.nodeName==="CODE"||t.parentNode.isCode,t.isBlank=a6e(t),t.flankingWhitespace=l6e(t,e),t}function a6e(t){return!sZ(t)&&!ZVe(t)&&/^\s*$/i.test(t.textContent)&&!YVe(t)&&!XVe(t)}function l6e(t,e){if(t.isBlock||e.preformattedCode&&t.isCode)return{leading:"",trailing:""};var n=c6e(t.textContent);return n.leadingAscii&&hZ("left",t,e)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&hZ("right",t,e)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function c6e(t){var e=t.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:e[1],leadingAscii:e[2],leadingNonAscii:e[3],trailing:e[4],trailingNonAscii:e[5],trailingAscii:e[6]}}function hZ(t,e,n){var r,i,o;return t==="left"?(r=e.previousSibling,i=/ $/):(r=e.nextSibling,i=/^ /),r&&(r.nodeType===3?o=i.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?o=!1:r.nodeType===1&&!wR(r)&&(o=i.test(r.textContent))),o}var u6e=Array.prototype.reduce,h6e=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function pM(t){if(!(this instanceof pM))return new pM(t);var e={rules:ll,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?` `:""},keepReplacement:function(n,r){return r.isBlock?` `+r.outerHTML+` `:r.outerHTML},defaultReplacement:function(n,r){return r.isBlock?` `+n+` `:n}};this.options=HVe({},e,t),this.rules=new cZ(this.options)}pM.prototype={turndown:function(t){if(!p6e(t))throw new TypeError(t+" is not a string, or an element/document/fragment node.");if(t==="")return"";var e=dZ.call(this,new r6e(t,this.options));return d6e.call(this,e)},use:function(t){if(Array.isArray(t))for(var e=0;e""},toolbar:{type:Array,default:()=>["bold","italic","text_align","blockquote","bullet_list","ordered_list"]}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=new UVe.Converter({tables:!0,strikethrough:!0,tasklists:!0,ghCodeBlocks:!0}),o=DW({content:'

',extensions:[eq,nq,RW,BW,FW,$W,zW,UW,GW,qW,YW,ZW,nG,rZ,iG,rq,SG,sG,rG,oG,nZ,tq,CG,XG.configure({types:["heading","paragraph"]}),kG,ZG.configure({HTMLAttributes:{class:"editor-content"},resizable:!0}),QG,JG,KG,EG.configure({HTMLAttributes:{class:"editor-link"},openOnClick:!1,autolink:!0})],editorProps:{handlePaste:tZ}}),s=g.computed(()=>n.toolbar.map(l=>yY[l]));g.onMounted(()=>{if(o.value&&n.modelValue){const l=i.makeHtml(n.modelValue);o.value.commands.setContent(l)}}),g.watch(o,l=>{l&&l.on("update",()=>{const c=l.getHTML(),u=new pM().turndown(c);r("update:modelValue",u)})});const a=()=>{o.value&&!o.value.isFocused&&o.value.commands.focus()};return(l,c)=>(g.openBlock(),g.createElementBlock("div",m6e,[g.createElementVNode("div",g6e,[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(s.value,u=>(g.openBlock(),g.createBlock(g.resolveDynamicComponent(u),{editor:g.unref(o)},null,8,["editor"]))),256))]),g.createElementVNode("div",{onClick:a,class:"relative w-full px-4 py-2 bg-white rounded-b-lg editor-content dark:bg-gray-800"},[g.createVNode(g.unref(OW),{editor:g.unref(o),class:"relative w-full"},null,8,["editor"])])]))}},v6e={},_6e={},b6e="Paragraph",w6e="Heading 1",x6e="Heading 2",E6e="Heading 3",S6e="Heading 4",C6e="Heading 5",k6e="Heading 6",T6e="Create Table",M6e="Add Column",A6e="Add Row",I6e="Delete Column",L6e="Delete Row",P6e="Delete Table",N6e="Enter Link",O6e="Create",D6e="Cancel",R6e={paragraph:b6e,heading1:w6e,heading2:x6e,heading3:E6e,heading4:S6e,heading5:C6e,heading6:k6e,createTable:T6e,addColumn:M6e,addRow:A6e,deleteColumn:I6e,deleteRow:L6e,deleteTable:P6e,linkTitle:N6e,create:O6e,cancel:D6e},B6e="Звичайний текст",F6e="Заголовок 1",$6e="Заголовок 2",z6e="Заголовок 3",V6e="Заголовок 4",j6e="Заголовок 5",U6e="Заголовок 6",H6e="Створити таблицю",W6e="Додати колонку",G6e="Додати рядок",q6e="Видалити колонку",Y6e="Видалити рядок",Z6e="Видалити таблицю",X6e="Введіть посилання",K6e="Створити",J6e="Скасувати",Q6e={paragraph:B6e,heading1:F6e,heading2:$6e,heading3:z6e,heading4:V6e,heading5:j6e,heading6:U6e,createTable:H6e,addColumn:W6e,addRow:G6e,deleteColumn:q6e,deleteRow:Y6e,deleteTable:Z6e,linkTitle:X6e,create:K6e,cancel:J6e},TR=a4e({legacy:!1,locale:"uk",fallbackLocale:"en",messages:{en:{...v6e,tiptap:R6e},uk:{..._6e,tiptap:Q6e}}}),e8e={install:(t,e={})=>{var n,r,i,o;if(e.i18nConfig){const s=e.i18nConfig,a=((r=(n=TR.global)==null?void 0:n.messages)==null?void 0:r.value)||TR.messages;a&&((o=(i=s.global)==null?void 0:i.messages)!=null&&o.value)&&Object.keys(a).forEach(l=>{s.global.mergeLocaleMessage?s.global.mergeLocaleMessage(l,a[l]):s.global.setLocaleMessage(l,a[l])})}else t.use(TR);t.component("vs-richtext",FVe),t.component("vs-richtext-md",y6e)}},pZ={VsTextValue:oTe,VsDataValue:tTe,VsBadgeValue:Kke,VsFormRadio:c8,VsDialog:Ag,VsPassword:uhe,VsButton:Fh,VsText:Yu,VsConfirm:mAe,VsTiptapEditor:F2,VsNumber:h8,VsRadio:aP,VsSwitch:OV,VsDropdown:bhe,VsDropdownOption:Vme,VsTextMask:rhe,VsCheckbox:m1,VsAutocomplete:nP,VsAutocompleteOption:rP,VsTabs:N6,VsTabsPanel:lge,VsTree:tMe,VsDatepicker:P6,VsPopover:Dp,VsBasicMap:lAe,VsTooltip:p1,VsPagination:Rj,VsCalendar:HP,VsForm:U1,VsFormContainer:qke,VsDialogForm:kj,VsFileList:QSe,VsFormWrapper:WP,VsLayout:ek,VsSimpleMap:Uue,VsSlider:$ke,VsFormDropzone:dj,VsLoadingApi:yTe,VsErrorOnLoading:wTe,VsNumberValue:IEe,VsLoader:tk,VsSelect:B6,VsTable:NTe,VsDataTable:gj,VsDataList:yj,VsCollapse:UTe,VsCollapseItem:qTe,VsGallery:kMe,VsGridGallery:$Me,VsStepper:XMe,VsInlineEdit:iAe,VsColorPicker:vj,VsFormAce:_j,VsFormList:u8,VsListbox:bj,VsFormCheckBox:l8,VsFormCalendar:wj,VsFormMultiText:h2,VsDiff:vAe,VsHighLight:qP,VsFormWithNavigation:kAe,VsCombobox:wC,VsFormGeom:mj,VsDrower:ege},mM={install:(t,e,n={defaultColorTheme:"light"})=>{var i,o,s,a;if(An.value={...An.value,...n},n.i18nConfig){const l=n.i18nConfig,c=((o=(i=SN.global)==null?void 0:i.messages)==null?void 0:o.value)||SN.messages;c&&((a=(s=l.global)==null?void 0:s.messages)!=null&&a.value)&&Object.keys(c).forEach(u=>{l.global.mergeLocaleMessage?l.global.mergeLocaleMessage(u,c[u]):l.global.setLocaleMessage(u,c[u])})}else t.use(SN);e8e.install(t,{i18nConfig:n.i18nConfig});const r=(n==null?void 0:n.apiPrefix)||"";r&&(un.defaults.baseURL=r),e&&t.use(ySe,{createApp:e}),Object.entries(pZ).forEach(([l,c])=>{t.component(l,c)}),t.config.globalProperties.utils=xV},components:pZ,plugins:{modalPlugin:Mj,notifyPlugin:Tj,confirmPlugin:Ij,queryPlugin:Aj,loadingPlugin:Lj,apiPlugin:Dj,dialogFormPlugin:Pj},formComponents:Ej,utils:xV};typeof window<"u"&&(window.v3core=mM);var mZ={exports:{}};(function(t,e){(function(){var n="ace",r=function(){return this}();!r&&typeof window<"u"&&(r=window);var i=function(u,d,p){if(typeof u!="string"){i.original?i.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace());return}arguments.length==2&&(p=d),i.modules[u]||(i.payloads[u]=p,i.modules[u]=null)};i.modules={},i.payloads={};var o=function(u,d,p){if(typeof d=="string"){var m=l(u,d);if(m!=null)return p&&p(),m}else if(Object.prototype.toString.call(d)==="[object Array]"){for(var y=[],w=0,x=d.length;wl.length)&&(a=l.length),a-=s.length;var c=l.indexOf(s,a);return c!==-1&&c===a}),String.prototype.repeat||o(String.prototype,"repeat",function(s){for(var a="",l=this;s>0;)s&1&&(a+=l),(s>>=1)&&(l+=l);return a}),String.prototype.includes||o(String.prototype,"includes",function(s,a){return this.indexOf(s,a)!=-1}),Object.assign||(Object.assign=function(s){if(s==null)throw new TypeError("Cannot convert undefined or null to object");for(var a=Object(s),l=1;l>>0,c=arguments[1],u=c>>0,d=u<0?Math.max(l+u,0):Math.min(u,l),p=arguments[2],m=p===void 0?l:p>>0,y=m<0?Math.max(l+m,0):Math.min(m,l);d0;)l&1&&(c+=a),(l>>=1)&&(a+=a);return c};var o=/^\s\s*/,s=/\s\s*$/;r.stringTrimLeft=function(a){return a.replace(o,"")},r.stringTrimRight=function(a){return a.replace(s,"")},r.copyObject=function(a){var l={};for(var c in a)l[c]=a[c];return l},r.copyArray=function(a){for(var l=[],c=0,u=a.length;c65535?2:1}}),ace.define("ace/lib/useragent",["require","exports","module"],function(n,r,i){r.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},r.getOS=function(){return r.isMac?r.OS.MAC:r.isLinux?r.OS.LINUX:r.OS.WINDOWS};var o=typeof navigator=="object"?navigator:{},s=(/mac|win|linux/i.exec(o.platform)||["other"])[0].toLowerCase(),a=o.userAgent||"",l=o.appName||"";r.isWin=s=="win",r.isMac=s=="mac",r.isLinux=s=="linux",r.isIE=l=="Microsoft Internet Explorer"||l.indexOf("MSAppHost")>=0?parseFloat((a.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((a.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),r.isOldIE=r.isIE&&r.isIE<9,r.isGecko=r.isMozilla=a.match(/ Gecko\/\d+/),r.isOpera=typeof opera=="object"&&Object.prototype.toString.call(window.opera)=="[object Opera]",r.isWebKit=parseFloat(a.split("WebKit/")[1])||void 0,r.isChrome=parseFloat(a.split(" Chrome/")[1])||void 0,r.isSafari=parseFloat(a.split(" Safari/")[1])&&!r.isChrome||void 0,r.isEdge=parseFloat(a.split(" Edge/")[1])||void 0,r.isAIR=a.indexOf("AdobeAIR")>=0,r.isAndroid=a.indexOf("Android")>=0,r.isChromeOS=a.indexOf(" CrOS ")>=0,r.isIOS=/iPad|iPhone|iPod/.test(a)&&!window.MSStream,r.isIOS&&(r.isMac=!0),r.isMobile=r.isIOS||r.isAndroid}),ace.define("ace/lib/dom",["require","exports","module","ace/lib/useragent"],function(n,r,i){var o=n("./useragent"),s="http://www.w3.org/1999/xhtml";r.buildDom=function p(m,y,w){if(typeof m=="string"&&m){var x=document.createTextNode(m);return y&&y.appendChild(x),x}if(!Array.isArray(m))return m&&m.appendChild&&y&&y.appendChild(m),m;if(typeof m[0]!="string"||!m[0]){for(var C=[],S=0;S"u")){if(l){if(y)c();else if(y===!1)return l.push([p,m])}if(!a){var w=y;!y||!y.getRootNode?w=document:(w=y.getRootNode(),(!w||w==y)&&(w=document));var x=w.ownerDocument||w;if(m&&r.hasCssString(m,w))return null;m&&(p+=` /*# sourceURL=ace/css/`+m+" */");var C=r.createElement("style");C.appendChild(x.createTextNode(p)),m&&(C.id=m),w==x&&(w=r.getDocumentHead(x)),w.insertBefore(C,w.firstChild)}}}if(r.importCssString=u,r.importCssStylsheet=function(p,m){r.buildDom(["link",{rel:"stylesheet",href:p}],r.getDocumentHead(m))},r.scrollbarWidth=function(p){var m=r.createElement("ace_inner");m.style.width="100%",m.style.minWidth="0px",m.style.height="200px",m.style.display="block";var y=r.createElement("ace_outer"),w=y.style;w.position="absolute",w.left="-10000px",w.overflow="hidden",w.width="200px",w.minWidth="0px",w.height="150px",w.display="block",y.appendChild(m);var x=p&&p.documentElement||document&&document.documentElement;if(!x)return 0;x.appendChild(y);var C=m.offsetWidth;w.overflow="scroll";var S=m.offsetWidth;return C===S&&(S=y.clientWidth),x.removeChild(y),C-S},r.computedStyle=function(p,m){return window.getComputedStyle(p,"")||{}},r.setStyle=function(p,m,y){p[m]!==y&&(p[m]=y)},r.HAS_CSS_ANIMATION=!1,r.HAS_CSS_TRANSFORMS=!1,r.HI_DPI=o.isWin?typeof window<"u"&&window.devicePixelRatio>=1.5:!0,o.isChromeOS&&(r.HI_DPI=!1),typeof document<"u"){var d=document.createElement("div");r.HI_DPI&&d.style.transform!==void 0&&(r.HAS_CSS_TRANSFORMS=!0),!o.isEdge&&typeof d.style.animationName<"u"&&(r.HAS_CSS_ANIMATION=!0),d=null}r.HAS_CSS_TRANSFORMS?r.translate=function(p,m,y){p.style.transform="translate("+Math.round(m)+"px, "+Math.round(y)+"px)"}:r.translate=function(p,m,y){p.style.top=Math.round(y)+"px",p.style.left=Math.round(m)+"px"}}),ace.define("ace/lib/net",["require","exports","module","ace/lib/dom"],function(n,r,i){/* * based on code from: * * @license RequireJS text 0.25.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/jrburke/requirejs for details */var o=n("./dom");r.get=function(s,a){var l=new XMLHttpRequest;l.open("GET",s,!0),l.onreadystatechange=function(){l.readyState===4&&a(l.responseText)},l.send(null)},r.loadScript=function(s,a){var l=o.getDocumentHead(),c=document.createElement("script");c.src=s,l.appendChild(c),c.onload=c.onreadystatechange=function(u,d){(d||!c.readyState||c.readyState=="loaded"||c.readyState=="complete")&&(c=c.onload=c.onreadystatechange=null,d||a())}},r.qualifyURL=function(s){var a=document.createElement("a");return a.href=s,a.href}}),ace.define("ace/lib/oop",["require","exports","module"],function(n,r,i){r.inherits=function(o,s){o.super_=s,o.prototype=Object.create(s.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}})},r.mixin=function(o,s){for(var a in s)o[a]=s[a];return o},r.implement=function(o,s){r.mixin(o,s)}}),ace.define("ace/lib/event_emitter",["require","exports","module"],function(n,r,i){var o={},s=function(){this.propagationStopped=!0},a=function(){this.defaultPrevented=!0};o._emit=o._dispatchEvent=function(l,c){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var u=this._eventRegistry[l]||[],d=this._defaultHandlers[l];if(!(!u.length&&!d)){(typeof c!="object"||!c)&&(c={}),c.type||(c.type=l),c.stopPropagation||(c.stopPropagation=s),c.preventDefault||(c.preventDefault=a),u=u.slice();for(var p=0;p1&&(C=w[w.length-2]);var M=c[y+"Path"];return M==null?M=c.basePath:x=="/"&&(y=x=""),M&&M.slice(-1)!="/"&&(M+="/"),M+y+x+C+this.get("suffix")},r.setModuleUrl=function(m,y){return c.$moduleUrls[m]=y};var u=function(m,y){if(m==="ace/theme/textmate"||m==="./theme/textmate")return y(null,n("./theme/textmate"));if(d)return d(m,y);console.error("loader is not configured")},d;r.setLoader=function(m){d=m},r.dynamicModules=Object.create(null),r.$loading={},r.$loaded={},r.loadModule=function(m,y){var w;if(Array.isArray(m))var x=m[0],C=m[1];else if(typeof m=="string")var C=m;var S=function(M){if(M&&!r.$loading[C])return y&&y(M);if(r.$loading[C]||(r.$loading[C]=[]),r.$loading[C].push(y),!(r.$loading[C].length>1)){var E=function(){u(C,function(A,I){I&&(r.$loaded[C]=I),r._emit("load.module",{name:C,module:I});var O=r.$loading[C];r.$loading[C]=null,O.forEach(function(z){z&&z(I)})})};if(!r.get("packaged"))return E();s.loadScript(r.moduleUrl(C,x),E),p()}};if(r.dynamicModules[C])r.dynamicModules[C]().then(function(M){M.default?S(M.default):S(M)});else{try{w=this.$require(C)}catch{}S(w||r.$loaded[C])}},r.$require=function(m){if(typeof i.require=="function"){var y="require";return i[y](m)}},r.setModuleLoader=function(m,y){r.dynamicModules[m]=y};var p=function(){!c.basePath&&!c.workerPath&&!c.modePath&&!c.themePath&&!Object.keys(c.$moduleUrls).length&&(console.error("Unable to infer path to ace from script src,","use ace.config.set('basePath', 'path') to enable dynamic loading of modes and themes","or with webpack use ace/webpack-resolver"),p=function(){})};r.version="1.42.0"}),ace.define("ace/loader_build",["require","exports","module","ace/lib/fixoldbrowsers","ace/config"],function(n,r,i){n("./lib/fixoldbrowsers");var o=n("./config");o.setLoader(function(c,u){n([c],function(d){u(null,d)})});var s=function(){return this||typeof window<"u"&&window}();i.exports=function(c){o.init=a,o.$require=n,c.require=n},a(!0);function a(c){if(!(!s||!s.document)){o.set("packaged",c||n.packaged||i.packaged||s.define&&(void 0).packaged);var u={},d="",p=document.currentScript||document._currentScript,m=p&&p.ownerDocument||document;p&&p.src&&(d=p.src.split(/[?#]/)[0].split("/").slice(0,-1).join("/")||"");for(var y=m.getElementsByTagName("script"),w=0;w ["+this.end.row+"/"+this.end.column+"]"},s.prototype.contains=function(a,l){return this.compare(a,l)==0},s.prototype.compareRange=function(a){var l,c=a.end,u=a.start;return l=this.compare(c.row,c.column),l==1?(l=this.compare(u.row,u.column),l==1?2:l==0?1:0):l==-1?-2:(l=this.compare(u.row,u.column),l==-1?-1:l==1?42:0)},s.prototype.comparePoint=function(a){return this.compare(a.row,a.column)},s.prototype.containsRange=function(a){return this.comparePoint(a.start)==0&&this.comparePoint(a.end)==0},s.prototype.intersects=function(a){var l=this.compareRange(a);return l==-1||l==0||l==1},s.prototype.isEnd=function(a,l){return this.end.row==a&&this.end.column==l},s.prototype.isStart=function(a,l){return this.start.row==a&&this.start.column==l},s.prototype.setStart=function(a,l){typeof a=="object"?(this.start.column=a.column,this.start.row=a.row):(this.start.row=a,this.start.column=l)},s.prototype.setEnd=function(a,l){typeof a=="object"?(this.end.column=a.column,this.end.row=a.row):(this.end.row=a,this.end.column=l)},s.prototype.inside=function(a,l){return this.compare(a,l)==0?!(this.isEnd(a,l)||this.isStart(a,l)):!1},s.prototype.insideStart=function(a,l){return this.compare(a,l)==0?!this.isEnd(a,l):!1},s.prototype.insideEnd=function(a,l){return this.compare(a,l)==0?!this.isStart(a,l):!1},s.prototype.compare=function(a,l){return!this.isMultiLine()&&a===this.start.row?lthis.end.column?1:0:athis.end.row?1:this.start.row===a?l>=this.start.column?0:-1:this.end.row===a?l<=this.end.column?0:1:0},s.prototype.compareStart=function(a,l){return this.start.row==a&&this.start.column==l?-1:this.compare(a,l)},s.prototype.compareEnd=function(a,l){return this.end.row==a&&this.end.column==l?1:this.compare(a,l)},s.prototype.compareInside=function(a,l){return this.end.row==a&&this.end.column==l?1:this.start.row==a&&this.start.column==l?-1:this.compare(a,l)},s.prototype.clipRows=function(a,l){if(this.end.row>l)var c={row:l+1,column:0};else if(this.end.rowl)var u={row:l+1,column:0};else if(this.start.row1?(z++,z>4&&(z=1)):z=1,s.isIE){var G=Math.abs(j.clientX-$)>5||Math.abs(j.clientY-W)>5;(!J||G)&&(z=1),J&&clearTimeout(J),J=setTimeout(function(){J=null},E[z-1]||600),z==1&&($=j.clientX,W=j.clientY)}if(j._clicks=z,A[I]("mousedown",j),z>4)z=0;else if(z>1)return A[I](Z[z],j)}Array.isArray(M)||(M=[M]),M.forEach(function(j){m(j,"mousedown",q,O)})};function w(M){return 0|(M.ctrlKey?1:0)|(M.altKey?2:0)|(M.shiftKey?4:0)|(M.metaKey?8:0)}r.getModifierString=function(M){return o.KEY_MODS[w(M)]};function x(M,E,A){var I=w(E);if(!A&&E.code&&(A=o.$codeToKeyCode[E.code]||A),!s.isMac&&a){if(E.getModifierState&&(E.getModifierState("OS")||E.getModifierState("Win"))&&(I|=8),a.altGr)if((3&I)!=3)a.altGr=0;else return;if(A===18||A===17){var O=E.location;if(A===17&&O===1)a[A]==1&&(l=E.timeStamp);else if(A===18&&I===3&&O===2){var z=E.timeStamp-l;z<50&&(a.altGr=!0)}}}if(A in o.MODIFIER_KEYS&&(A=-1),!(!I&&A===13&&E.location===3&&(M(E,I,-A),E.defaultPrevented))){if(s.isChromeOS&&I&8){if(M(E,I,A),E.defaultPrevented)return;I&=-9}return!I&&!(A in o.FUNCTION_KEYS)&&!(A in o.PRINTABLE_KEYS)?!1:M(E,I,A)}}r.addCommandKeyListener=function(M,E,A){var I=null;m(M,"keydown",function(O){a[O.keyCode]=(a[O.keyCode]||0)+1;var z=x(E,O,O.keyCode);return I=O.defaultPrevented,z},A),m(M,"keypress",function(O){I&&(O.ctrlKey||O.altKey||O.shiftKey||O.metaKey)&&(r.stopEvent(O),I=null)},A),m(M,"keyup",function(O){a[O.keyCode]=null},A),a||(C(),m(window,"focus",C))};function C(){a=Object.create(null)}if(typeof window=="object"&&window.postMessage&&!s.isOldIE){var S=1;r.nextTick=function(M,E){E=E||window;var A="zero-timeout-message-"+S++,I=function(O){O.data==A&&(r.stopPropagation(O),y(E,"message",I),M())};m(E,"message",I),E.postMessage(A,"*")}}r.$idleBlocked=!1,r.onIdle=function(M,E){return setTimeout(function A(){r.$idleBlocked?setTimeout(A,100):M()},E)},r.$idleBlockId=null,r.blockIdle=function(M){r.$idleBlockId&&clearTimeout(r.$idleBlockId),r.$idleBlocked=!0,r.$idleBlockId=setTimeout(function(){r.$idleBlocked=!1},M||100)},r.nextFrame=typeof window=="object"&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),r.nextFrame?r.nextFrame=r.nextFrame.bind(window):r.nextFrame=function(M){setTimeout(M,17)}}),ace.define("ace/clipboard",["require","exports","module"],function(n,r,i){var o;i.exports={lineMode:!1,pasteCancelled:function(){return o&&o>Date.now()-50?!0:o=!1},cancel:function(){o=Date.now()}}}),ace.define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/config","ace/lib/useragent","ace/lib/dom","ace/lib/lang","ace/clipboard","ace/lib/keys"],function(n,r,i){var o=n("../lib/event"),s=n("../config").nls,a=n("../lib/useragent"),l=n("../lib/dom"),c=n("../lib/lang"),u=n("../clipboard"),d=a.isChrome<18,p=a.isIE,m=a.isChrome>63,y=400,w=n("../lib/keys"),x=w.KEY_MODS,C=a.isIOS,S=C?/\s/:/\n/,M=a.isMobile,E;E=function(A,I){var O=l.createElement("textarea");O.className="ace_text-input",O.setAttribute("wrap","off"),O.setAttribute("autocorrect","off"),O.setAttribute("autocapitalize","off"),O.setAttribute("spellcheck","false"),O.style.opacity="0",A.insertBefore(O,A.firstChild),this.setHost=function(Ne){I=Ne};var z=!1,$=!1,W=!1,J=!1,Z="";M||(O.style.fontSize="1px");var q=!1,j=!1,G="",U=0,Q=0,re=0,le=Number.MAX_SAFE_INTEGER,oe=Number.MIN_SAFE_INTEGER,he=0;try{var xe=document.activeElement===O}catch{}this.setNumberOfExtraLines=function(Ne){if(le=Number.MAX_SAFE_INTEGER,oe=Number.MIN_SAFE_INTEGER,Ne<0){he=0;return}he=Ne},this.setAriaLabel=function(){var Ne="";if(I.$textInputAriaLabel&&(Ne+="".concat(I.$textInputAriaLabel,", ")),I.session){var nt=I.session.selection.cursor.row;Ne+=s("text-input.aria-label","Cursor at row $0",[nt+1])}O.setAttribute("aria-label",Ne)},this.setAriaOptions=function(Ne){Ne.activeDescendant?(O.setAttribute("aria-haspopup","true"),O.setAttribute("aria-autocomplete",Ne.inline?"both":"list"),O.setAttribute("aria-activedescendant",Ne.activeDescendant)):(O.setAttribute("aria-haspopup","false"),O.setAttribute("aria-autocomplete","both"),O.removeAttribute("aria-activedescendant")),Ne.role&&O.setAttribute("role",Ne.role),Ne.setLabel&&(O.setAttribute("aria-roledescription",s("text-input.aria-roledescription","editor")),this.setAriaLabel())},this.setAriaOptions({role:"textbox"}),o.addListener(O,"blur",function(Ne){j||(I.onBlur(Ne),xe=!1)},I),o.addListener(O,"focus",function(Ne){if(!j){if(xe=!0,a.isEdge)try{if(!document.hasFocus())return}catch{}I.onFocus(Ne),a.isEdge?setTimeout(Ie):Ie()}},I),this.$focusScroll=!1,this.focus=function(){if(this.setAriaOptions({setLabel:I.renderer.enableKeyboardAccessibility}),Z||m||this.$focusScroll=="browser")return O.focus({preventScroll:!0});var Ne=O.style.top;O.style.position="fixed",O.style.top="0px";try{var nt=O.getBoundingClientRect().top!=0}catch{return}var It=[];if(nt)for(var en=O.parentElement;en&&en.nodeType==1;)It.push(en),en.setAttribute("ace_nocontext","true"),!en.parentElement&&en.getRootNode?en=en.getRootNode().host:en=en.parentElement;O.focus({preventScroll:!0}),nt&&It.forEach(function(Fn){Fn.removeAttribute("ace_nocontext")}),setTimeout(function(){O.style.position="",O.style.top=="0px"&&(O.style.top=Ne)},0)},this.blur=function(){O.blur()},this.isFocused=function(){return xe},I.on("beforeEndOperation",function(){var Ne=I.curOp,nt=Ne&&Ne.command&&Ne.command.name;if(nt!="insertstring"){var It=nt&&(Ne.docChanged||Ne.selectionChanged);W&&It&&(G=O.value="",Ue()),Ie()}}),I.on("changeSelection",this.setAriaLabel);var Ee=function(Ne,nt){for(var It=nt,en=1;en<=Ne-le&&en<2*he+1;en++)It+=I.session.getLine(Ne-en).length+1;return It},Ie=C?function(Ne){if(!(!xe||z&&!Ne||J)){Ne||(Ne="");var nt=` ab`+Ne+`cde fg `;nt!=O.value&&(O.value=G=nt);var It=4,en=4+(Ne.length||(I.selection.isEmpty()?0:1));(U!=It||Q!=en)&&O.setSelectionRange(It,en),U=It,Q=en}}:function(){if(!(W||J)&&!(!xe&&!lt)){W=!0;var Ne=0,nt=0,It="";if(I.session){var en=I.selection,Fn=en.getRange(),lr=en.cursor.row;lr===oe+1?(le=oe+1,oe=le+2*he):lr===le-1?(oe=le-1,le=oe-2*he):(lroe+1)&&(le=lr>he?lr-he:0,oe=lr>he?lr+he:2*he);for(var Ye=[],ye=le;ye<=oe;ye++)Ye.push(I.session.getLine(ye));if(It=Ye.join(` `),Ne=Ee(Fn.start.row,Fn.start.column),nt=Ee(Fn.end.row,Fn.end.column),Fn.start.rowoe){var ve=I.session.getLine(oe+1);nt=Fn.end.row>oe+1?ve.length:Fn.end.column,nt+=It.length+1,It=It+` `+ve}else M&&lr>0&&(It=` `+It,nt+=1,Ne+=1);It.length>y&&(Ne=G.length&&Ne.value===G&&G&&Ne.selectionEnd!==Q},$e=function(Ne){W||(z?z=!1:Oe(O)?(I.selectAll(),Ie()):M&&O.selectionStart!=U&&Ie())},Ze=null;this.setInputHandler=function(Ne){Ze=Ne},this.getInputHandler=function(){return Ze};var lt=!1,pt=function(Ne,nt){if(lt&&(lt=!1),$)return Ie(),Ne&&I.onPaste(Ne),$=!1,"";for(var It=O.selectionStart,en=O.selectionEnd,Fn=U,lr=G.length-Q,Ye=Ne,ye=Ne.length-It,ue=Ne.length-en,ve=0;Fn>0&&G[ve]==Ne[ve];)ve++,Fn--;for(Ye=Ye.slice(ve),ve=1;lr>0&&G.length-ve>U-1&&G[G.length-ve]==Ne[Ne.length-ve];)ve++,lr--;ye-=ve-1,ue-=ve-1;var ke=Ye.length-ve+1;if(ke<0&&(Fn=-ke,ke=0),Ye=Ye.slice(0,ke),!nt&&!Ye&&!ye&&!Fn&&!lr&&!ue)return"";J=!0;var ze=!1;return a.isAndroid&&Ye==". "&&(Ye=" ",ze=!0),Ye&&!Fn&&!lr&&!ye&&!ue||q?I.onTextInput(Ye):I.onTextInput(Ye,{extendLeft:Fn,extendRight:lr,restoreStart:ye,restoreEnd:ue}),J=!1,G=Ne,U=It,Q=en,re=ue,ze?` `:Ye},yt=function(Ne){if(W)return Bn();if(Ne&&Ne.inputType){if(Ne.inputType=="historyUndo")return I.execCommand("undo");if(Ne.inputType=="historyRedo")return I.execCommand("redo")}var nt=O.value,It=pt(nt,!0);(nt.length>y+100||S.test(It)||M&&U<1&&U==Q)&&Ie()},Lt=function(Ne,nt,It){var en=Ne.clipboardData||window.clipboardData;if(!(!en||d)){var Fn=p||It?"Text":"text/plain";try{return nt?en.setData(Fn,nt)!==!1:en.getData(Fn)}catch(lr){if(!It)return Lt(lr,nt,!0)}}},hn=function(Ne,nt){var It=I.getCopyText();if(!It)return o.preventDefault(Ne);Lt(Ne,It)?(C&&(Ie(It),z=It,setTimeout(function(){z=!1},10)),nt?I.onCut():I.onCopy(),o.preventDefault(Ne)):(z=!0,O.value=It,O.select(),setTimeout(function(){z=!1,Ie(),nt?I.onCut():I.onCopy()}))},Ht=function(Ne){hn(Ne,!0)},wn=function(Ne){hn(Ne,!1)},cn=function(Ne){var nt=Lt(Ne);u.pasteCancelled()||(typeof nt=="string"?(nt&&I.onPaste(nt,Ne),a.isIE&&setTimeout(Ie),o.preventDefault(Ne)):(O.value="",$=!0))};o.addCommandKeyListener(O,function(Ne,nt,It){if(!W)return I.onCommandKey(Ne,nt,It)},I),o.addListener(O,"select",$e,I),o.addListener(O,"input",yt,I),o.addListener(O,"cut",Ht,I),o.addListener(O,"copy",wn,I),o.addListener(O,"paste",cn,I),(!("oncut"in O)||!("oncopy"in O)||!("onpaste"in O))&&o.addListener(A,"keydown",function(Ne){if(!(a.isMac&&!Ne.metaKey||!Ne.ctrlKey))switch(Ne.keyCode){case 67:wn(Ne);break;case 86:cn(Ne);break;case 88:Ht(Ne);break}},I);var Hn=function(Ne){if(!(W||!I.onCompositionStart||I.$readOnly)&&(W={},!q)){Ne.data&&(W.useTextareaForIME=!1),setTimeout(Bn,0),I._signal("compositionStart"),I.on("mousedown",qe);var nt=I.getSelectionRange();nt.end.row=nt.start.row,nt.end.column=nt.start.column,W.markerRange=nt,W.selectionStart=U,I.onCompositionStart(W),W.useTextareaForIME?(G=O.value="",U=0,Q=0):(O.msGetInputContext&&(W.context=O.msGetInputContext()),O.getInputContext&&(W.context=O.getInputContext()))}},Bn=function(){if(!(!W||!I.onCompositionUpdate||I.$readOnly)){if(q)return qe();if(W.useTextareaForIME)I.onCompositionUpdate(O.value);else{var Ne=O.value;pt(Ne),W.markerRange&&(W.context&&(W.markerRange.start.column=W.selectionStart=W.context.compositionStartOffset),W.markerRange.end.column=W.markerRange.start.column+Q-W.selectionStart+re)}}},Ue=function(Ne){!I.onCompositionEnd||I.$readOnly||(W=!1,I.onCompositionEnd(),I.off("mousedown",qe),Ne&&yt())};function qe(){j=!0,O.blur(),O.focus(),j=!1}var Et=c.delayedCall(Bn,50).schedule.bind(null,null);function qt(Ne){Ne.keyCode==27&&O.value.lengthQ&&G[ue]==` `?ve=w.end:yeQ&&G.slice(0,ue).split(` `).length>2?ve=w.down:ue>Q&&G[ue-1]==" "?(ve=w.right,ke=x.option):(ue>Q||ue==Q&&Q!=U&&ye==ue)&&(ve=w.right),ye!==ue&&(ke|=x.shift),ve){var ze=nt.onCommandKey({},ke,ve);if(!ze&&nt.commands){ve=w.keyCodeToString(ve);var He=nt.commands.findKeyCommand(ke,ve);He&&nt.execCommand(He)}U=ye,Q=ue,Ie("")}}};document.addEventListener("selectionchange",lr),nt.on("destroy",function(){document.removeEventListener("selectionchange",lr)})}this.destroy=function(){O.parentElement&&O.parentElement.removeChild(O)}},r.TextInput=E,r.$setUserAgentForTests=function(A,I){M=A,C=I}}),ace.define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"],function(n,r,i){var o=n("../lib/useragent"),s=0,a=550,l=function(){function d(p){p.$clickSelection=null;var m=p.editor;m.setDefaultHandler("mousedown",this.onMouseDown.bind(p)),m.setDefaultHandler("dblclick",this.onDoubleClick.bind(p)),m.setDefaultHandler("tripleclick",this.onTripleClick.bind(p)),m.setDefaultHandler("quadclick",this.onQuadClick.bind(p)),m.setDefaultHandler("mousewheel",this.onMouseWheel.bind(p));var y=["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"];y.forEach(function(w){p[w]=this[w]},this),p.selectByLines=this.extendSelectionBy.bind(p,"getLineRange"),p.selectByWords=this.extendSelectionBy.bind(p,"getWordRange")}return d.prototype.onMouseDown=function(p){var m=p.inSelection(),y=p.getDocumentPosition();this.mousedownEvent=p;var w=this.editor,x=p.getButton();if(x!==0){var C=w.getSelectionRange(),S=C.isEmpty();(S||x==1)&&w.selection.moveToPosition(y),x==2&&(w.textInput.onContextMenu(p.domEvent),o.isMozilla||p.preventDefault());return}if(this.mousedownEvent.time=Date.now(),m&&!w.isFocused()&&(w.focus(),this.$focusTimeout&&!this.$clickSelection&&!w.inMultiSelectMode)){this.setState("focusWait"),this.captureMouse(p);return}return this.captureMouse(p),this.startSelect(y,p.domEvent._clicks>1),p.preventDefault()},d.prototype.startSelect=function(p,m){p=p||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var y=this.editor;this.mousedownEvent&&(this.mousedownEvent.getShiftKey()?y.selection.selectToPosition(p):m||y.selection.moveToPosition(p),m||this.select(),y.setStyle("ace_selecting"),this.setState("select"))},d.prototype.select=function(){var p,m=this.editor,y=m.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var w=this.$clickSelection.comparePoint(y);if(w==-1)p=this.$clickSelection.end;else if(w==1)p=this.$clickSelection.start;else{var x=u(this.$clickSelection,y);y=x.cursor,p=x.anchor}m.selection.setSelectionAnchor(p.row,p.column)}m.selection.selectToPosition(y),m.renderer.scrollCursorIntoView()},d.prototype.extendSelectionBy=function(p){var m,y=this.editor,w=y.renderer.screenToTextCoordinates(this.x,this.y),x=y.selection[p](w.row,w.column);if(this.$clickSelection){var C=this.$clickSelection.comparePoint(x.start),S=this.$clickSelection.comparePoint(x.end);if(C==-1&&S<=0)m=this.$clickSelection.end,(x.end.row!=w.row||x.end.column!=w.column)&&(w=x.start);else if(S==1&&C>=0)m=this.$clickSelection.start,(x.start.row!=w.row||x.start.column!=w.column)&&(w=x.end);else if(C==-1&&S==1)w=x.end,m=x.start;else{var M=u(this.$clickSelection,w);w=M.cursor,m=M.anchor}y.selection.setSelectionAnchor(m.row,m.column)}y.selection.selectToPosition(w),y.renderer.scrollCursorIntoView()},d.prototype.selectByLinesEnd=function(){this.$clickSelection=null,this.editor.unsetStyle("ace_selecting")},d.prototype.focusWait=function(){var p=c(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),m=Date.now();(p>s||m-this.mousedownEvent.time>this.$focusTimeout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},d.prototype.onDoubleClick=function(p){var m=p.getDocumentPosition(),y=this.editor,w=y.session,x=w.getBracketRange(m);x?(x.isEmpty()&&(x.start.column--,x.end.column++),this.setState("select")):(x=y.selection.getWordRange(m.row,m.column),this.setState("selectByWords")),this.$clickSelection=x,this.select()},d.prototype.onTripleClick=function(p){var m=p.getDocumentPosition(),y=this.editor;this.setState("selectByLines");var w=y.getSelectionRange();w.isMultiLine()&&w.contains(m.row,m.column)?(this.$clickSelection=y.selection.getLineRange(w.start.row),this.$clickSelection.end=y.selection.getLineRange(w.end.row).end):this.$clickSelection=y.selection.getLineRange(m.row),this.select()},d.prototype.onQuadClick=function(p){var m=this.editor;m.selectAll(),this.$clickSelection=m.getSelectionRange(),this.setState("selectAll")},d.prototype.onMouseWheel=function(p){if(!p.getAccelKey()){p.getShiftKey()&&p.wheelY&&!p.wheelX&&(p.wheelX=p.wheelY,p.wheelY=0);var m=this.editor;this.$lastScroll||(this.$lastScroll={t:0,vx:0,vy:0,allowed:0});var y=this.$lastScroll,w=p.domEvent.timeStamp,x=w-y.t,C=x?p.wheelX/x:y.vx,S=x?p.wheelY/x:y.vy;x=1&&m.renderer.isScrollableBy(p.wheelX*p.speed,0)&&(E=!0),M<=1&&m.renderer.isScrollableBy(0,p.wheelY*p.speed)&&(E=!0),E)y.allowed=w;else if(w-y.alloweda.clientHeight;l||s.preventDefault()}}),ace.define("ace/tooltip",["require","exports","module","ace/lib/dom","ace/lib/event","ace/range","ace/lib/scroll"],function(n,r,i){var o=this&&this.__extends||function(){var w=function(x,C){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(S,M){S.__proto__=M}||function(S,M){for(var E in M)Object.prototype.hasOwnProperty.call(M,E)&&(S[E]=M[E])},w(x,C)};return function(x,C){if(typeof C!="function"&&C!==null)throw new TypeError("Class extends value "+String(C)+" is not a constructor or null");w(x,C);function S(){this.constructor=x}x.prototype=C===null?Object.create(C):(S.prototype=C.prototype,new S)}}(),s=this&&this.__values||function(w){var x=typeof Symbol=="function"&&Symbol.iterator,C=x&&w[x],S=0;if(C)return C.call(w);if(w&&typeof w.length=="number")return{next:function(){return w&&S>=w.length&&(w=void 0),{value:w&&w[S++],done:!w}}};throw new TypeError(x?"Object is not iterable.":"Symbol.iterator is not defined.")},a=n("./lib/dom");n("./lib/event");var l=n("./range").Range,c=n("./lib/scroll").preventParentScroll,u="ace_tooltip",d=function(){function w(x){this.isOpen=!1,this.$element=null,this.$parentNode=x}return w.prototype.$init=function(){return this.$element=a.createElement("div"),this.$element.className=u,this.$element.style.display="none",this.$parentNode.appendChild(this.$element),this.$element},w.prototype.getElement=function(){return this.$element||this.$init()},w.prototype.setText=function(x){this.getElement().textContent=x},w.prototype.setHtml=function(x){this.getElement().innerHTML=x},w.prototype.setPosition=function(x,C){this.getElement().style.left=x+"px",this.getElement().style.top=C+"px"},w.prototype.setClassName=function(x){a.addCssClass(this.getElement(),x)},w.prototype.setTheme=function(x){this.$element.className=u+" "+(x.isDark?"ace_dark ":"")+(x.cssClass||"")},w.prototype.show=function(x,C,S){x!=null&&this.setText(x),C!=null&&S!=null&&this.setPosition(C,S),this.isOpen||(this.getElement().style.display="block",this.isOpen=!0)},w.prototype.hide=function(x){this.isOpen&&(this.getElement().style.display="none",this.getElement().className=u,this.isOpen=!1)},w.prototype.getHeight=function(){return this.getElement().offsetHeight},w.prototype.getWidth=function(){return this.getElement().offsetWidth},w.prototype.destroy=function(){this.isOpen=!1,this.$element&&this.$element.parentNode&&this.$element.parentNode.removeChild(this.$element)},w}(),p=function(){function w(){this.popups=[]}return w.prototype.addPopup=function(x){this.popups.push(x),this.updatePopups()},w.prototype.removePopup=function(x){var C=this.popups.indexOf(x);C!==-1&&(this.popups.splice(C,1),this.updatePopups())},w.prototype.updatePopups=function(){var x,C,S,M;this.popups.sort(function(Z,q){return q.priority-Z.priority});var E=[];try{for(var A=s(this.popups),I=A.next();!I.done;I=A.next()){var O=I.value,z=!0;try{for(var $=(S=void 0,s(E)),W=$.next();!W.done;W=$.next()){var J=W.value;if(this.doPopupsOverlap(J,O)){z=!1;break}}}catch(Z){S={error:Z}}finally{try{W&&!W.done&&(M=$.return)&&M.call($)}finally{if(S)throw S.error}}z?E.push(O):O.hide()}}catch(Z){x={error:Z}}finally{try{I&&!I.done&&(C=A.return)&&C.call(A)}finally{if(x)throw x.error}}},w.prototype.doPopupsOverlap=function(x,C){var S=x.getElement().getBoundingClientRect(),M=C.getElement().getBoundingClientRect();return S.leftM.left&&S.topM.top},w}(),m=new p;r.popupManager=m,r.Tooltip=d;var y=function(w){o(x,w);function x(C){C===void 0&&(C=document.body);var S=w.call(this,C)||this;S.timeout=void 0,S.lastT=0,S.idleTime=350,S.lastEvent=void 0,S.onMouseOut=S.onMouseOut.bind(S),S.onMouseMove=S.onMouseMove.bind(S),S.waitForHover=S.waitForHover.bind(S),S.hide=S.hide.bind(S);var M=S.getElement();return M.style.whiteSpace="pre-wrap",M.style.pointerEvents="auto",M.addEventListener("mouseout",S.onMouseOut),M.tabIndex=-1,M.addEventListener("blur",(function(){M.contains(document.activeElement)||this.hide()}).bind(S)),M.addEventListener("wheel",c),S}return x.prototype.addToEditor=function(C){C.on("mousemove",this.onMouseMove),C.on("mousedown",this.hide),C.renderer.getMouseEventTarget().addEventListener("mouseout",this.onMouseOut,!0)},x.prototype.removeFromEditor=function(C){C.off("mousemove",this.onMouseMove),C.off("mousedown",this.hide),C.renderer.getMouseEventTarget().removeEventListener("mouseout",this.onMouseOut,!0),this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},x.prototype.onMouseMove=function(C,S){this.lastEvent=C,this.lastT=Date.now();var M=S.$mouseHandler.isMousePressed;if(this.isOpen){var E=this.lastEvent&&this.lastEvent.getDocumentPosition();(!this.range||!this.range.contains(E.row,E.column)||M||this.isOutsideOfText(this.lastEvent))&&this.hide()}this.timeout||M||(this.lastEvent=C,this.timeout=setTimeout(this.waitForHover,this.idleTime))},x.prototype.waitForHover=function(){this.timeout&&clearTimeout(this.timeout);var C=Date.now()-this.lastT;if(this.idleTime-C>10){this.timeout=setTimeout(this.waitForHover,this.idleTime-C);return}this.timeout=null,this.lastEvent&&!this.isOutsideOfText(this.lastEvent)&&this.$gatherData(this.lastEvent,this.lastEvent.editor)},x.prototype.isOutsideOfText=function(C){var S=C.editor,M=C.getDocumentPosition(),E=S.session.getLine(M.row);if(M.column==E.length){var A=S.renderer.pixelToScreenCoordinates(C.clientX,C.clientY),I=S.session.documentToScreenPosition(M.row,M.column);if(I.column!=A.column||I.row!=A.row)return!0}return!1},x.prototype.setDataProvider=function(C){this.$gatherData=C},x.prototype.showForRange=function(C,S,M,E){var A=10;if(!(E&&E!=this.lastEvent)&&!(this.isOpen&&document.activeElement==this.getElement())){var I=C.renderer;this.isOpen||(m.addPopup(this),this.$registerCloseEvents(),this.setTheme(I.theme)),this.isOpen=!0,this.addMarker(S,C.session),this.range=l.fromPoints(S.start,S.end);var O=I.textToScreenCoordinates(S.start.row,S.start.column),z=I.scroller.getBoundingClientRect();O.pageX=w.length&&(w=void 0),{value:w&&w[S++],done:!w}}};throw new TypeError(x?"Object is not iterable.":"Symbol.iterator is not defined.")},a=n("../lib/dom"),l=n("../lib/event"),c=n("../tooltip").Tooltip,u=n("../config").nls,d=5,p=3;r.GUTTER_TOOLTIP_LEFT_OFFSET=d,r.GUTTER_TOOLTIP_TOP_OFFSET=p;function m(w){var x=w.editor,C=x.renderer.$gutterLayer,S=new y(x,!0);w.editor.setDefaultHandler("guttermousedown",function(z){if(!(!x.isFocused()||z.getButton()!=0)){var $=C.getRegion(z);if($!="foldWidgets"){var W=z.getDocumentPosition().row,J=x.session.selection;if(z.getShiftKey())J.selectTo(W,0);else{if(z.domEvent.detail==2)return x.selectAll(),z.preventDefault();w.$clickSelection=x.selection.getLineRange(W)}return w.setState("selectByLines"),w.captureMouse(z),z.preventDefault()}}});var M,E;function A(){var z=E.getDocumentPosition().row,$=x.session.getLength();if(z==$){var W=x.renderer.pixelToScreenCoordinates(0,E.y).row,J=E.$pos;if(W>x.session.documentToScreenRow(J.row,J.column))return I()}if(S.showTooltip(z),!!S.isOpen)if(x.on("mousewheel",I),x.on("changeSession",I),window.addEventListener("keydown",I,!0),w.$tooltipFollowsMouse)O(E);else{var Z=E.getGutterRow(),q=C.$lines.get(Z);if(q){var j=q.element.querySelector(".ace_gutter_annotation"),G=j.getBoundingClientRect(),U=S.getElement().style;U.left=G.right-d+"px",U.top=G.bottom-p+"px"}else O(E)}}function I(z){z&&z.type==="keydown"&&(z.ctrlKey||z.metaKey)||z&&z.type==="mouseout"&&(!z.relatedTarget||S.getElement().contains(z.relatedTarget))||(M&&(M=clearTimeout(M)),S.isOpen&&(S.hideTooltip(),x.off("mousewheel",I),x.off("changeSession",I),window.removeEventListener("keydown",I,!0)))}function O(z){S.setPosition(z.x,z.y)}w.editor.setDefaultHandler("guttermousemove",function(z){var $=z.domEvent.target||z.domEvent.srcElement;if(a.hasCssClass($,"ace_fold-widget")||a.hasCssClass($,"ace_custom-widget"))return I();S.isOpen&&w.$tooltipFollowsMouse&&O(z),E=z,!M&&(M=setTimeout(function(){M=null,E&&!w.isMousePressed&&A()},50))}),l.addListener(x.renderer.$gutter,"mouseout",function(z){E=null,S.isOpen&&(M=setTimeout(function(){M=null,I(z)},50))},x)}r.GutterHandler=m;var y=function(w){o(x,w);function x(C,S){S===void 0&&(S=!1);var M=w.call(this,C.container)||this;M.editor=C,M.visibleTooltipRow;var E=M.getElement();return E.setAttribute("role","tooltip"),E.style.pointerEvents="auto",S&&(M.onMouseOut=M.onMouseOut.bind(M),E.addEventListener("mouseout",M.onMouseOut)),M}return x.prototype.onMouseOut=function(C){this.isOpen&&(!C.relatedTarget||this.getElement().contains(C.relatedTarget)||C&&C.currentTarget.contains(C.relatedTarget)||this.hideTooltip())},x.prototype.setPosition=function(C,S){var M=window.innerWidth||document.documentElement.clientWidth,E=window.innerHeight||document.documentElement.clientHeight,A=this.getWidth(),I=this.getHeight();C+=15,S+=15,C+A>M&&(C-=C+A-M),S+I>E&&(S-=20+I),c.prototype.setPosition.call(this,C,S)},Object.defineProperty(x,"annotationLabels",{get:function(){return{error:{singular:u("gutter-tooltip.aria-label.error.singular","error"),plural:u("gutter-tooltip.aria-label.error.plural","errors")},security:{singular:u("gutter-tooltip.aria-label.security.singular","security finding"),plural:u("gutter-tooltip.aria-label.security.plural","security findings")},warning:{singular:u("gutter-tooltip.aria-label.warning.singular","warning"),plural:u("gutter-tooltip.aria-label.warning.plural","warnings")},info:{singular:u("gutter-tooltip.aria-label.info.singular","information message"),plural:u("gutter-tooltip.aria-label.info.plural","information messages")},hint:{singular:u("gutter-tooltip.aria-label.hint.singular","suggestion"),plural:u("gutter-tooltip.aria-label.hint.plural","suggestions")}}},enumerable:!1,configurable:!0}),x.prototype.showTooltip=function(C){var S,M=this.editor.renderer.$gutterLayer,E=M.$annotations[C],A;E?A={displayText:Array.from(E.displayText),type:Array.from(E.type)}:A={displayText:[],type:[]};var I=M.session.getFoldLine(C);if(I&&M.$showFoldedAnnotations){for(var O={error:[],security:[],warning:[],info:[],hint:[]},z={error:1,security:2,warning:3,info:4,hint:5},$,W=C+1;W<=I.end.row;W++)if(M.$annotations[W])for(var J=0;Ju?Z=null:Oe-Z>=c&&(y.renderer.scrollCursorIntoView(),Z=null)}}function G(Ee,Ie){var Oe=Date.now(),$e=y.renderer.layerConfig.lineHeight,Ze=y.renderer.layerConfig.characterWidth,lt=y.renderer.scroller.getBoundingClientRect(),pt={x:{left:M-lt.left,right:lt.right-M},y:{top:E-lt.top,bottom:lt.bottom-E}},yt=Math.min(pt.x.left,pt.x.right),Lt=Math.min(pt.y.top,pt.y.bottom),hn={row:Ee.row,column:Ee.column};yt/Ze<=2&&(hn.column+=pt.x.left=l&&y.renderer.scrollCursorIntoView(hn):J=Oe:J=null}function U(){var Ee=O;O=y.renderer.screenToTextCoordinates(M,E),j(O,Ee),G(O,Ee)}function Q(){I=y.selection.toOrientedRange(),S=y.session.addMarker(I,"ace_selection",y.getSelectionStyle()),y.clearSelection(),y.isFocused()&&y.renderer.$cursorLayer.setBlinking(!1),clearInterval(A),U(),A=setInterval(U,20),z=0,s.addListener(document,"mousemove",oe)}function re(){clearInterval(A),y.session.removeMarker(S),S=null,y.selection.fromOrientedRange(I),y.isFocused()&&!W&&y.$resetCursorStyle(),I=null,O=null,z=0,J=null,Z=null,s.removeListener(document,"mousemove",oe)}var le=null;function oe(){le==null&&(le=setTimeout(function(){le!=null&&S&&re()},20))}function he(Ee){var Ie=Ee.types;return!Ie||Array.prototype.some.call(Ie,function(Oe){return Oe=="text/plain"||Oe=="Text"})}function xe(Ee){var Ie=["copy","copymove","all","uninitialized"],Oe=["move","copymove","linkmove","all","uninitialized"],$e=a.isMac?Ee.altKey:Ee.ctrlKey,Ze="uninitialized";try{Ze=Ee.dataTransfer.effectAllowed.toLowerCase()}catch{}var lt="none";return $e&&Ie.indexOf(Ze)>=0?lt="copy":Oe.indexOf(Ze)>=0?lt="move":Ie.indexOf(Ze)>=0&&(lt="copy"),lt}}(function(){this.dragWait=function(){var m=Date.now()-this.mousedownEvent.time;m>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){var m=this.editor.container;m.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(m){this.editor.$resetCursorStyle(),this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle(""),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var m=this.editor,y=m.container;y.draggable=!0,m.renderer.$cursorLayer.setBlinking(!1),m.setStyle("ace_dragging");var w=a.isWin?"default":"move";m.renderer.setCursorStyle(w),this.setState("dragReady")},this.onMouseDrag=function(m){var y=this.editor.container;if(a.isIE&&this.state=="dragReady"){var w=p(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);w>3&&y.dragDrop()}if(this.state==="dragWait"){var w=p(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);w>0&&(y.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(m){if(this.$dragEnabled){this.mousedownEvent=m;var y=this.editor,w=m.inSelection(),x=m.getButton(),C=m.domEvent.detail||1;if(C===1&&x===0&&w){if(m.editor.inMultiSelectMode&&(m.getAccelKey()||m.getShiftKey()))return;this.mousedownEvent.time=Date.now();var S=m.domEvent.target||m.domEvent.srcElement;if("unselectable"in S&&(S.unselectable="on"),y.getDragDelay()){if(a.isWebKit){this.cancelDrag=!0;var M=y.container;M.draggable=!0}this.setState("dragWait")}else this.startDrag();this.captureMouse(m,this.onMouseDrag.bind(this)),m.defaultPrevented=!0}}}}).call(d.prototype);function p(m,y,w,x){return Math.sqrt(Math.pow(w-m,2)+Math.pow(x-y,2))}r.DragdropHandler=d}),ace.define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/event","ace/lib/dom"],function(n,r,i){var o=n("./mouse_event").MouseEvent,s=n("../lib/event"),a=n("../lib/dom");r.addTouchListeners=function(l,c){var u="scroll",d,p,m,y,w,x,C=0,S,M=0,E=0,A=0,I,O;function z(){var j=window.navigator&&window.navigator.clipboard,G=!1,U=function(){var le=c.getCopyText(),oe=c.session.getUndoManager().hasUndo();O.replaceChild(a.buildDom(G?["span",!le&&Q("selectall")&&["span",{class:"ace_mobile-button",action:"selectall"},"Select All"],le&&Q("copy")&&["span",{class:"ace_mobile-button",action:"copy"},"Copy"],le&&Q("cut")&&["span",{class:"ace_mobile-button",action:"cut"},"Cut"],j&&Q("paste")&&["span",{class:"ace_mobile-button",action:"paste"},"Paste"],oe&&Q("undo")&&["span",{class:"ace_mobile-button",action:"undo"},"Undo"],Q("find")&&["span",{class:"ace_mobile-button",action:"find"},"Find"],Q("openCommandPalette")&&["span",{class:"ace_mobile-button",action:"openCommandPalette"},"Palette"]]:["span"]),O.firstChild)},Q=function(le){return c.commands.canExecute(le,c)},re=function(le){var oe=le.target.getAttribute("action");if(oe=="more"||!G)return G=!G,U();oe=="paste"?j.readText().then(function(he){c.execCommand(oe,he)}):oe&&((oe=="cut"||oe=="copy")&&(j?j.writeText(c.getCopyText()):document.execCommand("copy")),c.execCommand(oe)),O.firstChild.style.display="none",G=!1,oe!="openCommandPalette"&&c.focus()};O=a.buildDom(["div",{class:"ace_mobile-menu",ontouchstart:function(le){u="menu",le.stopPropagation(),le.preventDefault(),c.textInput.focus()},ontouchend:function(le){le.stopPropagation(),le.preventDefault(),re(le)},onclick:re},["span"],["span",{class:"ace_mobile-button",action:"more"},"..."]],c.container)}function $(){if(!c.getOption("enableMobileMenu")){O&&W();return}O||z();var j=c.selection.cursor,G=c.renderer.textToScreenCoordinates(j.row,j.column),U=c.renderer.textToScreenCoordinates(0,0).pageX,Q=c.renderer.scrollLeft,re=c.container.getBoundingClientRect();O.style.top=G.pageY-re.top-3+"px",G.pageX-re.left=2?c.selection.getLineRange(S.row):c.session.getBracketRange(S);j&&!j.isEmpty()?c.selection.setRange(j):c.selection.selectWord(),u="wait"}s.addListener(l,"contextmenu",function(j){if(I){var G=c.textInput.getElement();G.focus()}},c),s.addListener(l,"touchstart",function(j){var G=j.touches;if(w||G.length>1){clearTimeout(w),w=null,m=-1,u="zoom";return}I=c.$mouseHandler.isMousePressed=!0;var U=c.renderer.layerConfig.lineHeight,Q=c.renderer.layerConfig.lineHeight,re=j.timeStamp;y=re;var le=G[0],oe=le.clientX,he=le.clientY;Math.abs(d-oe)+Math.abs(p-he)>U&&(m=-1),d=j.clientX=oe,p=j.clientY=he,E=A=0;var xe=new o(j,c);if(S=xe.getDocumentPosition(),re-m<500&&G.length==1&&!C)M++,j.preventDefault(),j.button=0,Z();else{M=0;var Ee=c.selection.cursor,Ie=c.selection.isEmpty()?Ee:c.selection.anchor,Oe=c.renderer.$cursorLayer.getPixelPosition(Ee,!0),$e=c.renderer.$cursorLayer.getPixelPosition(Ie,!0),Ze=c.renderer.scroller.getBoundingClientRect(),lt=c.renderer.layerConfig.offset,pt=c.renderer.scrollLeft,yt=function(Ht,wn){return Ht=Ht/Q,wn=wn/U-.75,Ht*Ht+wn*wn};if(j.clientXhn?"cursor":"anchor"),hn<3.5?u="anchor":Lt<3.5?u="cursor":u="scroll",w=setTimeout(J,450)}m=re},c),s.addListener(l,"touchend",function(j){I=c.$mouseHandler.isMousePressed=!1,x&&clearInterval(x),u=="zoom"?(u="",C=0):w?(c.selection.moveToPosition(S),C=0,$()):u=="scroll"?(q(),W()):$(),clearTimeout(w),w=null},c),s.addListener(l,"touchmove",function(j){w&&(clearTimeout(w),w=null);var G=j.touches;if(!(G.length>1||u=="zoom")){var U=G[0],Q=d-U.clientX,re=p-U.clientY;if(u=="wait")if(Q*Q+re*re>4)u="cursor";else return j.preventDefault();d=U.clientX,p=U.clientY,j.clientX=U.clientX,j.clientY=U.clientY;var le=j.timeStamp,oe=le-y;if(y=le,u=="scroll"){var he=new o(j,c);he.speed=1,he.wheelX=Q,he.wheelY=re,10*Math.abs(Q)0)if(hn==16){for(cn=wn;cn-1){for(cn=wn;cn=0&&$e[Ue]==I;Ue--)Ie[Ue]=o}}}function oe(Ee,Ie,Oe){if(!(s=Ee){for(lt=Ze+1;lt<$e&&Ie[lt]>=Ee;)lt++;for(pt=Ze,yt=lt-1;pt=Ie.length||(lt=Oe[$e-1])!=x&<!=C||(pt=Ie[$e+1])!=x&&pt!=C?S:(a&&(pt=C),pt==lt?pt:S);case z:return lt=$e>0?Oe[$e-1]:M,lt==x&&$e+10&&Oe[$e-1]==x)return x;if(a)return S;for(Lt=$e+1,yt=Ie.length;Lt=1425&&hn<=2303||hn==64286;if(lt=Ie[Lt],Ht&&(lt==w||lt==A))return w}return $e<1||(lt=Ie[$e-1])==M?S:Oe[$e-1];case M:return a=!1,l=!0,o;case E:return c=!0,S;case J:case Z:case j:case G:case q:a=!1;case U:return S}}function xe(Ee){var Ie=Ee.charCodeAt(0),Oe=Ie>>8;return Oe==0?Ie>191?y:Q[Ie]:Oe==5?/[\u0591-\u05f4]/.test(Ee)?w:y:Oe==6?/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(Ee)?W:/[\u0660-\u0669\u066b-\u066c]/.test(Ee)?C:Ie==1642?$:/[\u06f0-\u06f9]/.test(Ee)?x:A:Oe==32&&Ie<=8287?re[Ie&255]:Oe==254&&Ie>=65136?A:S}r.L=y,r.R=w,r.EN=x,r.ON_R=3,r.AN=4,r.R_H=5,r.B=6,r.RLE=7,r.DOT="·",r.doBidiReorder=function(Ee,Ie,Oe){if(Ee.length<2)return{};var $e=Ee.split(""),Ze=new Array($e.length),lt=new Array($e.length),pt=[];o=Oe?m:p,le($e,pt,$e.length,Ie);for(var yt=0;ytA&&Ie[yt]0&&$e[yt-1]==="ل"&&/\u0622|\u0623|\u0625|\u0627/.test($e[yt])&&(pt[yt-1]=pt[yt]=r.R_H,yt++);$e[$e.length-1]===r.DOT&&(pt[$e.length-1]=r.B),$e[0]==="‫"&&(pt[0]=r.RLE);for(var yt=0;yt=0&&(u=this.session.$docRowCache[p])}return u},c.prototype.getSplitIndex=function(){var u=0,d=this.session.$screenRowCache;if(d.length)for(var p,m=this.session.$getRowCacheIndex(d,this.currentRow);this.currentRow-u>0&&(p=this.session.$getRowCacheIndex(d,this.currentRow-u-1),p===m);)m=p,u++;else u=this.currentRow;return u},c.prototype.updateRowLine=function(u,d){u===void 0&&(u=this.getDocumentRow());var p=u===this.session.getLength()-1,m=p?this.EOF:this.EOL;if(this.wrapIndent=0,this.line=this.session.getLine(u),this.isRtlDir=this.$isRtl||this.line.charAt(0)===this.RLE,this.session.$useWrapMode){var y=this.session.$wrapData[u];y&&(d===void 0&&(d=this.getSplitIndex()),d>0&&y.length?(this.wrapIndent=y.indent,this.wrapOffset=this.wrapIndent*this.charWidths[o.L],this.line=dd?this.session.getOverwrite()?u:u-1:d,m=o.getVisualFromLogicalIdx(p,this.bidiMap),y=this.bidiMap.bidiLevels,w=0;!this.session.getOverwrite()&&u<=d&&y[m]%2!==0&&m++;for(var x=0;xd&&y[m]%2===0&&(w+=this.charWidths[y[m]]),this.wrapIndent&&(w+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset),this.isRtlDir&&(w+=this.rtlLineOffset),w},c.prototype.getSelections=function(u,d){var p=this.bidiMap,m=p.bidiLevels,y,w=[],x=0,C=Math.min(u,d)-this.wrapIndent,S=Math.max(u,d)-this.wrapIndent,M=!1,E=!1,A=0;this.wrapIndent&&(x+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);for(var I,O=0;O=C&&Im+x/2;){if(m+=x,y===w.length-1){x=0;break}x=this.charWidths[w[++y]]}return y>0&&w[y-1]%2!==0&&w[y]%2===0?(p0&&w[y-1]%2===0&&w[y]%2!==0?d=1+(p>m?this.bidiMap.logicalFromVisual[y]:this.bidiMap.logicalFromVisual[y-1]):this.isRtlDir&&y===w.length-1&&x===0&&w[y-1]%2===0||!this.isRtlDir&&y===0&&w[y]%2!==0?d=1+this.bidiMap.logicalFromVisual[y]:(y>0&&w[y-1]%2!==0&&x!==0&&y--,d=this.bidiMap.logicalFromVisual[y]),d===0&&this.isRtlDir&&d++,d+this.wrapIndent},c}();r.BidiHandler=l}),ace.define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],function(n,r,i){var o=n("./lib/oop"),s=n("./lib/lang"),a=n("./lib/event_emitter").EventEmitter,l=n("./range").Range,c=function(){function u(d){this.session=d,this.doc=d.getDocument(),this.clearSelection(),this.cursor=this.lead=this.doc.createAnchor(0,0),this.anchor=this.doc.createAnchor(0,0),this.$silent=!1;var p=this;this.cursor.on("change",function(m){p.$cursorChanged=!0,p.$silent||p._emit("changeCursor"),!p.$isEmpty&&!p.$silent&&p._emit("changeSelection"),!p.$keepDesiredColumnOnChange&&m.old.column!=m.value.column&&(p.$desiredColumn=null)}),this.anchor.on("change",function(){p.$anchorChanged=!0,!p.$isEmpty&&!p.$silent&&p._emit("changeSelection")})}return u.prototype.isEmpty=function(){return this.$isEmpty||this.anchor.row==this.lead.row&&this.anchor.column==this.lead.column},u.prototype.isMultiLine=function(){return!this.$isEmpty&&this.anchor.row!=this.cursor.row},u.prototype.getCursor=function(){return this.lead.getPosition()},u.prototype.setAnchor=function(d,p){this.$isEmpty=!1,this.anchor.setPosition(d,p)},u.prototype.getAnchor=function(){return this.$isEmpty?this.getSelectionLead():this.anchor.getPosition()},u.prototype.getSelectionLead=function(){return this.lead.getPosition()},u.prototype.isBackwards=function(){var d=this.anchor,p=this.lead;return d.row>p.row||d.row==p.row&&d.column>p.column},u.prototype.getRange=function(){var d=this.anchor,p=this.lead;return this.$isEmpty?l.fromPoints(p,p):this.isBackwards()?l.fromPoints(p,d):l.fromPoints(d,p)},u.prototype.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit("changeSelection"))},u.prototype.selectAll=function(){this.$setSelection(0,0,Number.MAX_VALUE,Number.MAX_VALUE)},u.prototype.setRange=function(d,p){var m=p?d.end:d.start,y=p?d.start:d.end;this.$setSelection(m.row,m.column,y.row,y.column)},u.prototype.$setSelection=function(d,p,m,y){if(!this.$silent){var w=this.$isEmpty,x=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(d,p),this.cursor.setPosition(m,y),this.$isEmpty=!l.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||w!=this.$isEmpty||x)&&this._emit("changeSelection")}},u.prototype.$moveSelection=function(d){var p=this.lead;this.$isEmpty&&this.setSelectionAnchor(p.row,p.column),d.call(this)},u.prototype.selectTo=function(d,p){this.$moveSelection(function(){this.moveCursorTo(d,p)})},u.prototype.selectToPosition=function(d){this.$moveSelection(function(){this.moveCursorToPosition(d)})},u.prototype.moveTo=function(d,p){this.clearSelection(),this.moveCursorTo(d,p)},u.prototype.moveToPosition=function(d){this.clearSelection(),this.moveCursorToPosition(d)},u.prototype.selectUp=function(){this.$moveSelection(this.moveCursorUp)},u.prototype.selectDown=function(){this.$moveSelection(this.moveCursorDown)},u.prototype.selectRight=function(){this.$moveSelection(this.moveCursorRight)},u.prototype.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},u.prototype.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},u.prototype.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},u.prototype.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},u.prototype.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},u.prototype.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},u.prototype.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},u.prototype.getWordRange=function(d,p){if(typeof p>"u"){var m=d||this.lead;d=m.row,p=m.column}return this.session.getWordRange(d,p)},u.prototype.selectWord=function(){this.setSelectionRange(this.getWordRange())},u.prototype.selectAWord=function(){var d=this.getCursor(),p=this.session.getAWordRange(d.row,d.column);this.setSelectionRange(p)},u.prototype.getLineRange=function(d,p){var m=typeof d=="number"?d:this.lead.row,y,w=this.session.getFoldLine(m);return w?(m=w.start.row,y=w.end.row):y=m,p===!0?new l(m,0,y,this.session.getLine(y).length):new l(m,0,y+1,0)},u.prototype.selectLine=function(){this.setSelectionRange(this.getLineRange())},u.prototype.moveCursorUp=function(){this.moveCursorBy(-1,0)},u.prototype.moveCursorDown=function(){this.moveCursorBy(1,0)},u.prototype.wouldMoveIntoSoftTab=function(d,p,m){var y=d.column,w=d.column+p;return m<0&&(y=d.column-p,w=d.column),this.session.isTabStop(d)&&this.doc.getLine(d.row).slice(y,w).split(" ").length-1==p},u.prototype.moveCursorLeft=function(){var d=this.lead.getPosition(),p;if(p=this.session.getFoldAt(d.row,d.column,-1))this.moveCursorTo(p.start.row,p.start.column);else if(d.column===0)d.row>0&&this.moveCursorTo(d.row-1,this.doc.getLine(d.row-1).length);else{var m=this.session.getTabSize();this.wouldMoveIntoSoftTab(d,m,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-m):this.moveCursorBy(0,-1)}},u.prototype.moveCursorRight=function(){var d=this.lead.getPosition(),p;if(p=this.session.getFoldAt(d.row,d.column,1))this.moveCursorTo(p.end.row,p.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row0&&(p.column=y)}}this.moveCursorTo(p.row,p.column)},u.prototype.moveCursorFileEnd=function(){var d=this.doc.getLength()-1,p=this.doc.getLine(d).length;this.moveCursorTo(d,p)},u.prototype.moveCursorFileStart=function(){this.moveCursorTo(0,0)},u.prototype.moveCursorLongWordRight=function(){var d=this.lead.row,p=this.lead.column,m=this.doc.getLine(d),y=m.substring(p);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var w=this.session.getFoldAt(d,p,1);if(w){this.moveCursorTo(w.end.row,w.end.column);return}if(this.session.nonTokenRe.exec(y)&&(p+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,y=m.substring(p)),p>=m.length){this.moveCursorTo(d,m.length),this.moveCursorRight(),d0&&this.moveCursorWordLeft();return}this.session.tokenRe.exec(w)&&(p-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(d,p)},u.prototype.$shortWordEndIndex=function(d){var p=0,m,y=/\s/,w=this.session.tokenRe;if(w.lastIndex=0,this.session.tokenRe.exec(d))p=this.session.tokenRe.lastIndex;else{for(;(m=d[p])&&y.test(m);)p++;if(p<1){for(w.lastIndex=0;(m=d[p])&&!w.test(m);)if(w.lastIndex=0,p++,y.test(m))if(p>2){p--;break}else{for(;(m=d[p])&&y.test(m);)p++;if(p>2)break}}}return w.lastIndex=0,p},u.prototype.moveCursorShortWordRight=function(){var d=this.lead.row,p=this.lead.column,m=this.doc.getLine(d),y=m.substring(p),w=this.session.getFoldAt(d,p,1);if(w)return this.moveCursorTo(w.end.row,w.end.column);if(p==m.length){var x=this.doc.getLength();do d++,y=this.doc.getLine(d);while(d0&&/^\s*$/.test(y));p=y.length,/\s+$/.test(y)||(y="")}var w=s.stringReverse(y),x=this.$shortWordEndIndex(w);return this.moveCursorTo(d,p-x)},u.prototype.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},u.prototype.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},u.prototype.moveCursorBy=function(d,p){var m=this.session.documentToScreenPosition(this.lead.row,this.lead.column),y;if(p===0&&(d!==0&&(this.session.$bidiHandler.isBidiRow(m.row,this.lead.row)?(y=this.session.$bidiHandler.getPosLeft(m.column),m.column=Math.round(y/this.session.$bidiHandler.charWidths[0])):y=m.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?m.column=this.$desiredColumn:this.$desiredColumn=m.column),d!=0&&this.session.lineWidgets&&this.session.lineWidgets[this.lead.row]){var w=this.session.lineWidgets[this.lead.row];d<0?d-=w.rowsAbove||0:d>0&&(d+=w.rowCount-(w.rowsAbove||0))}var x=this.session.screenToDocumentPosition(m.row+d,m.column,y);d!==0&&p===0&&x.row===this.lead.row&&(x.column,this.lead.column),this.moveCursorTo(x.row,x.column+p,p===0)},u.prototype.moveCursorToPosition=function(d){this.moveCursorTo(d.row,d.column)},u.prototype.moveCursorTo=function(d,p,m){var y=this.session.getFoldAt(d,p,1);y&&(d=y.start.row,p=y.start.column),this.$keepDesiredColumnOnChange=!0;var w=this.session.getLine(d);/[\uDC00-\uDFFF]/.test(w.charAt(p))&&w.charAt(p-1)&&(this.lead.row==d&&this.lead.column==p+1?p=p-1:p=p+1),this.lead.setPosition(d,p),this.$keepDesiredColumnOnChange=!1,m||(this.$desiredColumn=null)},u.prototype.moveCursorToScreen=function(d,p,m){var y=this.session.screenToDocumentPosition(d,p);this.moveCursorTo(y.row,y.column,m)},u.prototype.detach=function(){this.lead.detach(),this.anchor.detach()},u.prototype.fromOrientedRange=function(d){this.setSelectionRange(d,d.cursor==d.start),this.$desiredColumn=d.desiredColumn||this.$desiredColumn},u.prototype.toOrientedRange=function(d){var p=this.getRange();return d?(d.start.column=p.start.column,d.start.row=p.start.row,d.end.column=p.end.column,d.end.row=p.end.row):d=p,d.cursor=this.isBackwards()?d.start:d.end,d.desiredColumn=this.$desiredColumn,d},u.prototype.getRangeOfMovements=function(d){var p=this.getCursor();try{d(this);var m=this.getCursor();return l.fromPoints(p,m)}catch{return l.fromPoints(p,p)}finally{this.moveCursorToPosition(p)}},u.prototype.toJSON=function(){if(this.rangeCount)var d=this.ranges.map(function(p){var m=p.clone();return m.isBackwards=p.cursor==p.start,m});else{var d=this.getRange();d.isBackwards=this.isBackwards()}return d},u.prototype.fromJSON=function(d){if(d.start==null)if(this.rangeList&&d.length>1){this.toSingleRange(d[0]);for(var p=d.length;p--;){var m=l.fromPoints(d[p].start,d[p].end);d[p].isBackwards&&(m.cursor=m.start),this.addRange(m,!0)}return}else d=d[0];this.rangeList&&this.toSingleRange(d),this.setSelectionRange(d,d.isBackwards)},u.prototype.isEqual=function(d){if((d.length||this.rangeCount)&&d.length!=this.rangeCount)return!1;if(!d.length||!this.ranges)return this.getRange().isEqual(d);for(var p=this.ranges.length;p--;)if(!this.ranges[p].isEqual(d[p]))return!1;return!0},u}();c.prototype.setSelectionAnchor=c.prototype.setAnchor,c.prototype.getSelectionAnchor=c.prototype.getAnchor,c.prototype.setSelectionRange=c.prototype.setRange,o.implement(c.prototype,a),r.Selection=c}),ace.define("ace/tokenizer",["require","exports","module","ace/lib/report_error"],function(n,r,i){var o=n("./lib/report_error").reportError,s=2e3,a=function(){function l(c){this.splitRegex,this.states=c,this.regExps={},this.matchMappings={};for(var u in this.states){for(var d=this.states[u],p=[],m=0,y=this.matchMappings[u]={defaultToken:"text"},w="g",x=[],C=0;C1?S.onMatch=this.$applyToken:S.onMatch=S.token),E>1&&(/\\\d/.test(S.regex)?M=S.regex.replace(/\\([0-9]+)/g,function(A,I){return"\\"+(parseInt(I,10)+m+1)}):(E=1,M=this.removeCapturingGroups(S.regex)),!S.splitRegex&&typeof S.token!="string"&&x.push(S)),y[m]=C,m+=E,p.push(M),S.onMatch||(S.onMatch=null)}}p.length||(y[0]=0,p.push("$")),x.forEach(function(A){A.splitRegex=this.createSplitterRegexp(A.regex,w)},this),this.regExps[u]=new RegExp("("+p.join(")|(")+")|($)",w)}}return l.prototype.$setMaxTokenCount=function(c){s=c|0},l.prototype.$applyToken=function(c){var u=this.splitRegex.exec(c).slice(1),d=this.token.apply(this,u);if(typeof d=="string")return[{type:d,value:c}];for(var p=[],m=0,y=d.length;mS){var $=c.substring(S,z-O.length);E.type==A?E.value+=$:(E.type&&C.push(E),E={type:A,value:$})}for(var W=0;Ws){for(M>2*c.length&&this.reportError("infinite loop with in ace tokenizer",{startState:u,line:c});S1&&d[0]!==p&&d.unshift("#tmp",p),{tokens:C,state:d.length?d:p}},l}();a.prototype.reportError=o,r.Tokenizer=a}),ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/deep_copy"],function(n,r,i){var o=n("../lib/deep_copy").deepCopy,s;s=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}},(function(){this.addRules=function(c,u){if(!u){for(var d in c)this.$rules[d]=c[d];return}for(var d in c){for(var p=c[d],m=0;m=this.$rowTokens.length;){if(this.$row+=1,l||(l=this.$session.getLength()),this.$row>=l)return this.$row=l-1,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=0}return this.$rowTokens[this.$tokenIndex]},a.prototype.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},a.prototype.getCurrentTokenRow=function(){return this.$row},a.prototype.getCurrentTokenColumn=function(){var l=this.$rowTokens,c=this.$tokenIndex,u=l[c].start;if(u!==void 0)return u;for(u=0;c>0;)c-=1,u+=l[c].value.length;return u},a.prototype.getCurrentTokenPosition=function(){return{row:this.$row,column:this.getCurrentTokenColumn()}},a.prototype.getCurrentTokenRange=function(){var l=this.$rowTokens[this.$tokenIndex],c=this.getCurrentTokenColumn();return new o(this.$row,c,this.$row,c+l.value.length)},a}();r.TokenIterator=s}),ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(n,r,i){var o=n("../../lib/oop"),s=n("../behaviour").Behaviour,a=n("../../token_iterator").TokenIterator,l=n("../../lib/lang"),c=["text","paren.rparen","rparen","paren","punctuation.operator"],u=["text","paren.rparen","rparen","paren","punctuation.operator","comment"],d,p={},m={'"':'"',"'":"'"},y=function(C){var S=-1;if(C.multiSelect&&(S=C.selection.index,p.rangeCount!=C.multiSelect.rangeCount&&(p={rangeCount:C.multiSelect.rangeCount})),p[S])return d=p[S];d=p[S]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},w=function(C,S,M,E){var A=C.end.row-C.start.row;return{text:M+S+E,selection:[0,C.start.column+1,A,C.end.column+(A?0:1)]}},x;x=function(C){C=C||{},this.add("braces","insertion",function(S,M,E,A,I){var O=E.getCursorPosition(),z=A.doc.getLine(O.row);if(I=="{"){y(E);var $=E.getSelectionRange(),W=A.doc.getTextRange($),J=A.getTokenAt(O.row,O.column);if(W!==""&&W!=="{"&&E.getWrapBehavioursEnabled())return w($,W,"{","}");if(J&&/(?:string)\.quasi|\.xml/.test(J.type)){var Z=[/tag\-(?:open|name)/,/attribute\-name/];return Z.some(function(le){return le.test(J.type)})||/(string)\.quasi/.test(J.type)&&J.value[O.column-J.start-1]!=="$"?void 0:(x.recordAutoInsert(E,A,"}"),{text:"{}",selection:[1,1]})}else if(x.isSaneInsertion(E,A))return/[\]\}\)]/.test(z[O.column])||E.inMultiSelectMode||C.braces?(x.recordAutoInsert(E,A,"}"),{text:"{}",selection:[1,1]}):(x.recordMaybeInsert(E,A,"{"),{text:"{",selection:[1,1]})}else if(I=="}"){y(E);var q=z.substring(O.column,O.column+1);if(q=="}"){var j=A.$findOpeningBracket("}",{column:O.column+1,row:O.row});if(j!==null&&x.isAutoInsertedClosing(O,z,I))return x.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}else if(I==` `||I==`\r `){y(E);var G="";x.isMaybeInsertedClosing(O,z)&&(G=l.stringRepeat("}",d.maybeInsertedBrackets),x.clearMaybeInsertedClosing());var q=z.substring(O.column,O.column+1);if(q==="}"){var U=A.findMatchingBracket({row:O.row,column:O.column+1},"}");if(!U)return null;var Q=this.$getIndent(A.getLine(U.row))}else if(G)var Q=this.$getIndent(z);else{x.clearMaybeInsertedClosing();return}var re=Q+A.getTabString();return{text:` `+re+` `+Q+G,selection:[1,re.length,1,re.length]}}else x.clearMaybeInsertedClosing()}),this.add("braces","deletion",function(S,M,E,A,I){var O=A.doc.getTextRange(I);if(!I.isMultiLine()&&O=="{"){y(E);var z=A.doc.getLine(I.start.row),$=z.substring(I.end.column,I.end.column+1);if($=="}")return I.end.column++,I;d.maybeInsertedBrackets--}}),this.add("parens","insertion",function(S,M,E,A,I){if(I=="("){y(E);var O=E.getSelectionRange(),z=A.doc.getTextRange(O);if(z!==""&&E.getWrapBehavioursEnabled())return w(O,z,"(",")");if(x.isSaneInsertion(E,A))return x.recordAutoInsert(E,A,")"),{text:"()",selection:[1,1]}}else if(I==")"){y(E);var $=E.getCursorPosition(),W=A.doc.getLine($.row),J=W.substring($.column,$.column+1);if(J==")"){var Z=A.$findOpeningBracket(")",{column:$.column+1,row:$.row});if(Z!==null&&x.isAutoInsertedClosing($,W,I))return x.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("parens","deletion",function(S,M,E,A,I){var O=A.doc.getTextRange(I);if(!I.isMultiLine()&&O=="("){y(E);var z=A.doc.getLine(I.start.row),$=z.substring(I.start.column+1,I.start.column+2);if($==")")return I.end.column++,I}}),this.add("brackets","insertion",function(S,M,E,A,I){if(I=="["){y(E);var O=E.getSelectionRange(),z=A.doc.getTextRange(O);if(z!==""&&E.getWrapBehavioursEnabled())return w(O,z,"[","]");if(x.isSaneInsertion(E,A))return x.recordAutoInsert(E,A,"]"),{text:"[]",selection:[1,1]}}else if(I=="]"){y(E);var $=E.getCursorPosition(),W=A.doc.getLine($.row),J=W.substring($.column,$.column+1);if(J=="]"){var Z=A.$findOpeningBracket("]",{column:$.column+1,row:$.row});if(Z!==null&&x.isAutoInsertedClosing($,W,I))return x.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("brackets","deletion",function(S,M,E,A,I){var O=A.doc.getTextRange(I);if(!I.isMultiLine()&&O=="["){y(E);var z=A.doc.getLine(I.start.row),$=z.substring(I.start.column+1,I.start.column+2);if($=="]")return I.end.column++,I}}),this.add("string_dquotes","insertion",function(S,M,E,A,I){var O=A.$mode.$quotes||m;if(I.length==1&&O[I]){if(this.lineCommentStart&&this.lineCommentStart.indexOf(I)!=-1)return;y(E);var z=I,$=E.getSelectionRange(),W=A.doc.getTextRange($);if(W!==""&&(W.length!=1||!O[W])&&E.getWrapBehavioursEnabled())return w($,W,z,z);if(!W){var J=E.getCursorPosition(),Z=A.doc.getLine(J.row),q=Z.substring(J.column-1,J.column),j=Z.substring(J.column,J.column+1),G=A.getTokenAt(J.row,J.column),U=A.getTokenAt(J.row,J.column+1);if(q=="\\"&&G&&/escape/.test(G.type))return null;var Q=G&&/string|escape/.test(G.type),re=!U||/string|escape/.test(U.type),le;if(j==z)le=Q!==re,le&&/string\.end/.test(U.type)&&(le=!1);else{if(Q&&!re||Q&&re)return null;var oe=A.$mode.tokenRe;oe.lastIndex=0;var he=oe.test(q);oe.lastIndex=0;var xe=oe.test(j),Ee=A.$mode.$pairQuotesAfter,Ie=Ee&&Ee[z]&&Ee[z].test(q);if(!Ie&&he||xe||j&&!/[\s;,.})\]\\]/.test(j))return null;var Oe=Z[J.column-2];if(q==z&&(Oe==z||oe.test(Oe)))return null;le=!0}return{text:le?z+z:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(S,M,E,A,I){var O=A.$mode.$quotes||m,z=A.doc.getTextRange(I);if(!I.isMultiLine()&&O.hasOwnProperty(z)){y(E);var $=A.doc.getLine(I.start.row),W=$.substring(I.start.column+1,I.start.column+2);if(W==z)return I.end.column++,I}}),C.closeDocComment!==!1&&this.add("doc comment end","insertion",function(S,M,E,A,I){if(S==="doc-start"&&(I===` `||I===`\r `)&&E.selection.isEmpty()){var O=E.getCursorPosition();if(O.column===0)return;for(var z=A.doc.getLine(O.row),$=A.doc.getLine(O.row+1),W=A.getTokens(O.row),J=0,Z=0;Z=O.column){if(J===O.column){if(!/\.doc/.test(q.type))return;if(/\*\//.test(q.value)){var j=W[Z+1];if(!j||!/\.doc/.test(j.type))return}}var G=O.column-(J-q.value.length),U=q.value.indexOf("*/"),Q=q.value.indexOf("/**",U>-1?U+2:0);if(Q!==-1&&G>Q&&G=U&&G<=Q||!/\.doc/.test(q.type))return;break}}var re=this.$getIndent(z);if(/\s*\*/.test($))return/^\s*\*/.test(z)?{text:I+re+"* ",selection:[1,2+re.length,1,2+re.length]}:{text:I+re+" * ",selection:[1,3+re.length,1,3+re.length]};if(/\/\*\*/.test(z.substring(0,O.column)))return{text:I+re+" * "+I+" "+re+"*/",selection:[1,4+re.length,1,4+re.length]}}})},x.isSaneInsertion=function(C,S){var M=C.getCursorPosition(),E=new a(S,M.row,M.column);if(!this.$matchTokenType(E.getCurrentToken()||"text",c)){if(/[)}\]]/.test(C.session.getLine(M.row)[M.column]))return!0;var A=new a(S,M.row,M.column+1);if(!this.$matchTokenType(A.getCurrentToken()||"text",c))return!1}return E.stepForward(),E.getCurrentTokenRow()!==M.row||this.$matchTokenType(E.getCurrentToken()||"text",u)},x.$matchTokenType=function(C,S){return S.indexOf(C.type||C)>-1},x.recordAutoInsert=function(C,S,M){var E=C.getCursorPosition(),A=S.doc.getLine(E.row);this.isAutoInsertedClosing(E,A,d.autoInsertedLineEnd[0])||(d.autoInsertedBrackets=0),d.autoInsertedRow=E.row,d.autoInsertedLineEnd=M+A.substr(E.column),d.autoInsertedBrackets++},x.recordMaybeInsert=function(C,S,M){var E=C.getCursorPosition(),A=S.doc.getLine(E.row);this.isMaybeInsertedClosing(E,A)||(d.maybeInsertedBrackets=0),d.maybeInsertedRow=E.row,d.maybeInsertedLineStart=A.substr(0,E.column)+M,d.maybeInsertedLineEnd=A.substr(E.column),d.maybeInsertedBrackets++},x.isAutoInsertedClosing=function(C,S,M){return d.autoInsertedBrackets>0&&C.row===d.autoInsertedRow&&M===d.autoInsertedLineEnd[0]&&S.substr(C.column)===d.autoInsertedLineEnd},x.isMaybeInsertedClosing=function(C,S){return d.maybeInsertedBrackets>0&&C.row===d.maybeInsertedRow&&S.substr(C.column)===d.maybeInsertedLineEnd&&S.substr(0,C.column)==d.maybeInsertedLineStart},x.popAutoInsertedClosing=function(){d.autoInsertedLineEnd=d.autoInsertedLineEnd.substr(1),d.autoInsertedBrackets--},x.clearMaybeInsertedClosing=function(){d&&(d.maybeInsertedBrackets=0,d.maybeInsertedRow=-1)},o.inherits(x,s),r.CstyleBehaviour=x}),ace.define("ace/unicode",["require","exports","module"],function(n,r,i){for(var o=[48,9,8,25,5,0,2,25,48,0,11,0,5,0,6,22,2,30,2,457,5,11,15,4,8,0,2,0,18,116,2,1,3,3,9,0,2,2,2,0,2,19,2,82,2,138,2,4,3,155,12,37,3,0,8,38,10,44,2,0,2,1,2,1,2,0,9,26,6,2,30,10,7,61,2,9,5,101,2,7,3,9,2,18,3,0,17,58,3,100,15,53,5,0,6,45,211,57,3,18,2,5,3,11,3,9,2,1,7,6,2,2,2,7,3,1,3,21,2,6,2,0,4,3,3,8,3,1,3,3,9,0,5,1,2,4,3,11,16,2,2,5,5,1,3,21,2,6,2,1,2,1,2,1,3,0,2,4,5,1,3,2,4,0,8,3,2,0,8,15,12,2,2,8,2,2,2,21,2,6,2,1,2,4,3,9,2,2,2,2,3,0,16,3,3,9,18,2,2,7,3,1,3,21,2,6,2,1,2,4,3,8,3,1,3,2,9,1,5,1,2,4,3,9,2,0,17,1,2,5,4,2,2,3,4,1,2,0,2,1,4,1,4,2,4,11,5,4,4,2,2,3,3,0,7,0,15,9,18,2,2,7,2,2,2,22,2,9,2,4,4,7,2,2,2,3,8,1,2,1,7,3,3,9,19,1,2,7,2,2,2,22,2,9,2,4,3,8,2,2,2,3,8,1,8,0,2,3,3,9,19,1,2,7,2,2,2,22,2,15,4,7,2,2,2,3,10,0,9,3,3,9,11,5,3,1,2,17,4,23,2,8,2,0,3,6,4,0,5,5,2,0,2,7,19,1,14,57,6,14,2,9,40,1,2,0,3,1,2,0,3,0,7,3,2,6,2,2,2,0,2,0,3,1,2,12,2,2,3,4,2,0,2,5,3,9,3,1,35,0,24,1,7,9,12,0,2,0,2,0,5,9,2,35,5,19,2,5,5,7,2,35,10,0,58,73,7,77,3,37,11,42,2,0,4,328,2,3,3,6,2,0,2,3,3,40,2,3,3,32,2,3,3,6,2,0,2,3,3,14,2,56,2,3,3,66,5,0,33,15,17,84,13,619,3,16,2,25,6,74,22,12,2,6,12,20,12,19,13,12,2,2,2,1,13,51,3,29,4,0,5,1,3,9,34,2,3,9,7,87,9,42,6,69,11,28,4,11,5,11,11,39,3,4,12,43,5,25,7,10,38,27,5,62,2,28,3,10,7,9,14,0,89,75,5,9,18,8,13,42,4,11,71,55,9,9,4,48,83,2,2,30,14,230,23,280,3,5,3,37,3,5,3,7,2,0,2,0,2,0,2,30,3,52,2,6,2,0,4,2,2,6,4,3,3,5,5,12,6,2,2,6,67,1,20,0,29,0,14,0,17,4,60,12,5,0,4,11,18,0,5,0,3,9,2,0,4,4,7,0,2,0,2,0,2,3,2,10,3,3,6,4,5,0,53,1,2684,46,2,46,2,132,7,6,15,37,11,53,10,0,17,22,10,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,31,48,0,470,1,36,5,2,4,6,1,5,85,3,1,3,2,2,89,2,3,6,40,4,93,18,23,57,15,513,6581,75,20939,53,1164,68,45,3,268,4,27,21,31,3,13,13,1,2,24,9,69,11,1,38,8,3,102,3,1,111,44,25,51,13,68,12,9,7,23,4,0,5,45,3,35,13,28,4,64,15,10,39,54,10,13,3,9,7,22,4,1,5,66,25,2,227,42,2,1,3,9,7,11171,13,22,5,48,8453,301,3,61,3,105,39,6,13,4,6,11,2,12,2,4,2,0,2,1,2,1,2,107,34,362,19,63,3,53,41,11,5,15,17,6,13,1,25,2,33,4,2,134,20,9,8,25,5,0,2,25,12,88,4,5,3,5,3,5,3,2],s=0,a=[],l=0;l2?Oe%I!=I-1:Oe%I==0}}else{if(!this.blockComment)return!1;var z=this.blockComment.start,$=this.blockComment.end,W=new RegExp("^(\\s*)(?:"+u.escapeRegExp(z)+")"),J=new RegExp("(?:"+u.escapeRegExp($)+")\\s*$"),Z=function(le,oe){j(le,oe)||(!M||/\S/.test(le))&&(S.insertInLine({row:oe,column:le.length},$),S.insertInLine({row:oe,column:A},z))},q=function(le,oe){var he;(he=le.match(J))&&S.removeInLine(oe,le.length-he[0].length,le.length),(he=le.match(W))&&S.removeInLine(oe,he[1].length,he[0].length)},j=function(le,oe){if(W.test(le))return!0;for(var he=w.getTokens(oe),xe=0;xele.length&&(re=le.length)}),A==1/0&&(A=re,M=!1,E=!1),O&&A%I!=0&&(A=Math.floor(A/I)*I),Q(E?q:Z)},this.toggleBlockComment=function(y,w,x,C){var S=this.blockComment;if(S){!S.start&&S[0]&&(S=S[0]);var M=new d(w,C.row,C.column),E=M.getCurrentToken();w.selection;var A=w.selection.toOrientedRange(),I,O;if(E&&/comment/.test(E.type)){for(var z,$;E&&/comment/.test(E.type);){var W=E.value.indexOf(S.start);if(W!=-1){var J=M.getCurrentTokenRow(),Z=M.getCurrentTokenColumn()+W;z=new p(J,Z,J,Z+S.start.length);break}E=M.stepBackward()}for(var M=new d(w,C.row,C.column),E=M.getCurrentToken();E&&/comment/.test(E.type);){var W=E.value.indexOf(S.end);if(W!=-1){var J=M.getCurrentTokenRow(),Z=M.getCurrentTokenColumn()+W;$=new p(J,Z,J,Z+S.end.length);break}E=M.stepForward()}$&&w.remove($),z&&(w.remove(z),I=z.start.row,O=-S.start.length)}else O=S.start.length,I=x.start.row,w.insert(x.end,S.end),w.insert(x.start,S.start);A.start.row==I&&(A.start.column+=O),A.end.row==I&&(A.end.column+=O),w.selection.fromOrientedRange(A)}},this.getNextLineIndent=function(y,w,x){return this.$getIndent(w)},this.checkOutdent=function(y,w,x){return!1},this.autoOutdent=function(y,w,x){},this.$getIndent=function(y){return y.match(/^\s*/)[0]},this.createWorker=function(y){return null},this.createModeDelegates=function(y){this.$embeds=[],this.$modes={};for(var w in y)if(y[w]){var x=y[w],C=x.prototype.$id,S=o.$modes[C];S||(o.$modes[C]=S=new x),o.$modes[w]||(o.$modes[w]=S),this.$embeds.push(w),this.$modes[w]=S}for(var M=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"],E=function(I){(function(O){var z=M[I],$=O[z];O[M[I]]=function(){return this.$delegator(z,arguments,$)}})(A)},A=this,w=0;wc[u].column&&u++,m.unshift(u,0),c.splice.apply(c,m),this.$updateRows()}}},a.prototype.$updateRows=function(){var l=this.session.lineWidgets;if(l){var c=!0;l.forEach(function(u,d){if(u)for(c=!1,u.row=d;u.$oldWidget;)u.$oldWidget.row=d,u=u.$oldWidget}),c&&(this.session.lineWidgets=null)}},a.prototype.$registerLineWidget=function(l){this.session.lineWidgets||(this.session.lineWidgets=new Array(this.session.getLength()));var c=this.session.lineWidgets[l.row];return c&&(l.$oldWidget=c,c.el&&c.el.parentNode&&(c.el.parentNode.removeChild(c.el),c._inDocument=!1)),this.session.lineWidgets[l.row]=l,l},a.prototype.addLineWidget=function(l){if(this.$registerLineWidget(l),l.session=this.session,!this.editor)return l;var c=this.editor.renderer;l.html&&!l.el&&(l.el=o.createElement("div"),l.el.innerHTML=l.html),l.text&&!l.el&&(l.el=o.createElement("div"),l.el.textContent=l.text),l.el&&(o.addCssClass(l.el,"ace_lineWidgetContainer"),l.className&&o.addCssClass(l.el,l.className),l.el.style.position="absolute",l.el.style.zIndex="5",c.container.appendChild(l.el),l._inDocument=!0,l.coverGutter||(l.el.style.zIndex="3"),l.pixelHeight==null&&(l.pixelHeight=l.el.offsetHeight)),l.rowCount==null&&(l.rowCount=l.pixelHeight/c.layerConfig.lineHeight);var u=this.session.getFoldAt(l.row,0);if(l.$fold=u,u){var d=this.session.lineWidgets;l.row==u.end.row&&!d[u.start.row]?d[u.start.row]=l:l.hidden=!0}return this.session._emit("changeFold",{data:{start:{row:l.row}}}),this.$updateRows(),this.renderWidgets(null,c),this.onWidgetChanged(l),l},a.prototype.removeLineWidget=function(l){if(l._inDocument=!1,l.session=null,l.el&&l.el.parentNode&&l.el.parentNode.removeChild(l.el),l.editor&&l.editor.destroy)try{l.editor.destroy()}catch{}if(this.session.lineWidgets){var c=this.session.lineWidgets[l.row];if(c==l)this.session.lineWidgets[l.row]=l.$oldWidget,l.$oldWidget&&this.onWidgetChanged(l.$oldWidget);else for(;c;){if(c.$oldWidget==l){c.$oldWidget=l.$oldWidget;break}c=c.$oldWidget}}this.session._emit("changeFold",{data:{start:{row:l.row}}}),this.$updateRows()},a.prototype.getWidgetsAtRow=function(l){for(var c=this.session.lineWidgets,u=c&&c[l],d=[];u;)d.push(u),u=u.$oldWidget;return d},a.prototype.onWidgetChanged=function(l){this.session._changedWidgets.push(l),this.editor&&this.editor.renderer.updateFull()},a.prototype.measureWidgets=function(l,c){var u=this.session._changedWidgets,d=c.layerConfig;if(!(!u||!u.length)){for(var p=1/0,m=0;m0&&!d[p];)p--;this.firstRow=u.firstRow,this.lastRow=u.lastRow,c.$cursorLayer.config=u;for(var y=p;y<=m;y++){var w=d[y];if(!(!w||!w.el)){if(w.hidden){w.el.style.top=-100-(w.pixelHeight||0)+"px";continue}w._inDocument||(w._inDocument=!0,c.container.appendChild(w.el));var x=c.$cursorLayer.getPixelPosition({row:y,column:0},!0).top;w.coverLine||(x+=u.lineHeight*this.session.getRowLineCount(w.row)),w.el.style.top=x-u.offset+"px";var C=w.coverGutter?0:c.gutterWidth;w.fixedWidth||(C-=c.scrollLeft),w.el.style.left=C+"px",w.fullWidth&&w.screenWidth&&(w.el.style.minWidth=u.width+2*u.padding+"px"),w.fixedWidth?w.el.style.right=c.scrollBar.getWidth()+"px":w.el.style.right=""}}}},a}();r.LineWidgets=s}),ace.define("ace/apply_delta",["require","exports","module"],function(n,r,i){r.applyDelta=function(o,s,a){var l=s.start.row,c=s.start.column,u=o[l]||"";switch(s.action){case"insert":var d=s.lines;if(d.length===1)o[l]=u.substring(0,c)+s.lines[0]+u.substring(c);else{var p=[l,1].concat(s.lines);o.splice.apply(o,p),o[l]=u.substring(0,c)+o[l],o[l+s.lines.length-1]+=u.substring(c)}break;case"remove":var m=s.end.column,y=s.end.row;l===y?o[l]=u.substring(0,c)+u.substring(m):o.splice(l,y-l+1,u.substring(0,c)+o[y].substring(m));break}}}),ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(n,r,i){var o=n("./lib/oop"),s=n("./lib/event_emitter").EventEmitter,a=function(){function u(d,p,m){this.$onChange=this.onChange.bind(this),this.attach(d),typeof p!="number"?this.setPosition(p.row,p.column):this.setPosition(p,m)}return u.prototype.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},u.prototype.getDocument=function(){return this.document},u.prototype.onChange=function(d){if(!(d.start.row==d.end.row&&d.start.row!=this.row)&&!(d.start.row>this.row)){var p=c(d,{row:this.row,column:this.column},this.$insertRight);this.setPosition(p.row,p.column,!0)}},u.prototype.setPosition=function(d,p,m){var y;if(m?y={row:d,column:p}:y=this.$clipPositionToDocument(d,p),!(this.row==y.row&&this.column==y.column)){var w={row:this.row,column:this.column};this.row=y.row,this.column=y.column,this._signal("change",{old:w,value:y})}},u.prototype.detach=function(){this.document.off("change",this.$onChange)},u.prototype.attach=function(d){this.document=d||this.document,this.document.on("change",this.$onChange)},u.prototype.$clipPositionToDocument=function(d,p){var m={};return d>=this.document.getLength()?(m.row=Math.max(0,this.document.getLength()-1),m.column=this.document.getLine(m.row).length):d<0?(m.row=0,m.column=0):(m.row=d,m.column=Math.min(this.document.getLine(m.row).length,Math.max(0,p))),p<0&&(m.column=0),m},u}();a.prototype.$insertRight=!1,o.implement(a.prototype,s);function l(u,d,p){var m=p?u.column<=d.column:u.column=y&&(p=y-1,m=void 0);var w=this.getLine(p);return m==null&&(m=w.length),m=Math.min(Math.max(m,0),w.length),{row:p,column:m}},d.prototype.clonePos=function(p){return{row:p.row,column:p.column}},d.prototype.pos=function(p,m){return{row:p,column:m}},d.prototype.$clipPosition=function(p){var m=this.getLength();return p.row>=m?(p.row=Math.max(0,m-1),p.column=this.getLine(m-1).length):(p.row=Math.max(0,p.row),p.column=Math.min(Math.max(p.column,0),this.getLine(p.row).length)),p},d.prototype.insertFullLines=function(p,m){p=Math.min(Math.max(p,0),this.getLength());var y=0;p0,w=m=0&&this.applyDelta({start:this.pos(p,this.getLine(p).length),end:this.pos(p+1,0),action:"remove",lines:["",""]})},d.prototype.replace=function(p,m){if(p instanceof l||(p=l.fromPoints(p.start,p.end)),m.length===0&&p.isEmpty())return p.start;if(m==this.getTextRange(p))return p.end;this.remove(p);var y;return m?y=this.insert(p.start,m):y=p.start,y},d.prototype.applyDeltas=function(p){for(var m=0;m=0;m--)this.revertDelta(p[m])},d.prototype.applyDelta=function(p,m){var y=p.action=="insert";(y?p.lines.length<=1&&!p.lines[0]:!l.comparePoints(p.start,p.end))||(y&&p.lines.length>2e4?this.$splitAndapplyLargeDelta(p,2e4):(s(this.$lines,p,m),this._signal("change",p)))},d.prototype.$safeApplyDelta=function(p){var m=this.$lines.length;(p.action=="remove"&&p.start.row20){d.running=setTimeout(d.$worker,20);break}}d.currentLine=m,y==-1&&(y=m),x<=y&&d.fireUpdateEvent(x,y)}}}return l.prototype.setTokenizer=function(c){this.tokenizer=c,this.lines=[],this.states=[],this.start(0)},l.prototype.setDocument=function(c){this.doc=c,this.lines=[],this.states=[],this.stop()},l.prototype.fireUpdateEvent=function(c,u){var d={first:c,last:u};this._signal("update",{data:d})},l.prototype.start=function(c){this.currentLine=Math.min(c||0,this.currentLine,this.doc.getLength()),this.lines.splice(this.currentLine,this.lines.length),this.states.splice(this.currentLine,this.states.length),this.stop(),this.running=setTimeout(this.$worker,700)},l.prototype.scheduleStart=function(){this.running||(this.running=setTimeout(this.$worker,700))},l.prototype.$updateOnChange=function(c){var u=c.start.row,d=c.end.row-u;if(d===0)this.lines[u]=null;else if(c.action=="remove")this.lines.splice(u,d+1,null),this.states.splice(u,d+1,null);else{var p=Array(d+1);p.unshift(u,1),this.lines.splice.apply(this.lines,p),this.states.splice.apply(this.states,p)}this.currentLine=Math.min(u,this.currentLine,this.doc.getLength()),this.stop()},l.prototype.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},l.prototype.getTokens=function(c){return this.lines[c]||this.$tokenizeRow(c)},l.prototype.getState=function(c){return this.currentLine==c&&this.$tokenizeRow(c),this.states[c]||"start"},l.prototype.$tokenizeRow=function(c){var u=this.doc.getLine(c),d=this.states[c-1],p=this.tokenizer.getLineTokens(u,d,c);return this.states[c]+""!=p.state+""?(this.states[c]=p.state,this.lines[c+1]=null,this.currentLine>c+1&&(this.currentLine=c+1)):this.currentLine==c&&(this.currentLine=c+1),this.lines[c]=p.tokens},l.prototype.cleanup=function(){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.removeAllListeners()},l}();o.implement(a.prototype,s),r.BackgroundTokenizer=a}),ace.define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/range"],function(n,r,i){var o=n("./lib/lang"),s=n("./range").Range,a=function(){function l(c,u,d){d===void 0&&(d="text"),this.setRegexp(c),this.clazz=u,this.type=d,this.docLen=0}return l.prototype.setRegexp=function(c){this.regExp+""!=c+""&&(this.regExp=c,this.cache=[])},l.prototype.update=function(c,u,d,p){if(this.regExp){for(var m=p.firstRow,y=p.lastRow,w={},x=d.$editor&&d.$editor.$search,C=x&&x.$isMultilineSearch(d.$editor.getLastSearchOptions()),S=m;S<=y;S++){var M=this.cache[S];if(M==null||d.getValue().length!=this.docLen){if(C){M=[];var E=x.$multiLineForward(d,this.regExp,S,y);if(E){var A=E.endRow<=y?E.endRow-1:y;A>S&&(S=A),M.push(new s(E.startRow,E.startCol,E.endRow,E.endCol))}M.length>this.MAX_RANGES&&(M=M.slice(0,this.MAX_RANGES))}else M=o.getMatchOffsets(d.getLine(S),this.regExp),M.length>this.MAX_RANGES&&(M=M.slice(0,this.MAX_RANGES)),M=M.map(function($){return new s(S,$.offset,S,$.offset+$.length)});this.cache[S]=M.length?M:""}if(M.length!==0)for(var I=M.length;I--;){var O=M[I].toScreenRange(d),z=O.toString();w[z]||(w[z]=!0,u.drawSingleLineMarker(c,O,this.clazz,p))}}this.docLen=d.getValue().length}},l}();a.prototype.MAX_RANGES=500,r.SearchHighlight=a}),ace.define("ace/undomanager",["require","exports","module","ace/range"],function(n,r,i){var o=function(){function A(){this.$keepRedoStack,this.$maxRev=0,this.$fromUndo=!1,this.$undoDepth=1/0,this.reset()}return A.prototype.addSession=function(I){this.$session=I},A.prototype.add=function(I,O,z){if(!this.$fromUndo&&I!=this.$lastDelta){if(this.$keepRedoStack||(this.$redoStack.length=0),O===!1||!this.lastDeltas){this.lastDeltas=[];var $=this.$undoStack.length;$>this.$undoDepth-1&&this.$undoStack.splice(0,$-this.$undoDepth+1),this.$undoStack.push(this.lastDeltas),I.id=this.$rev=++this.$maxRev}(I.action=="remove"||I.action=="insert")&&(this.$lastDelta=I),this.lastDeltas.push(I)}},A.prototype.addSelection=function(I,O){this.selections.push({value:I,rev:O||this.$rev})},A.prototype.startNewGroup=function(){return this.lastDeltas=null,this.$rev},A.prototype.markIgnored=function(I,O){O==null&&(O=this.$rev+1);for(var z=this.$undoStack,$=z.length;$--;){var W=z[$][0];if(W.id<=I)break;W.id0},A.prototype.canRedo=function(){return this.$redoStack.length>0},A.prototype.bookmark=function(I){I==null&&(I=this.$rev),this.mark=I},A.prototype.isAtBookmark=function(){return this.$rev===this.mark},A.prototype.toJSON=function(){return{$redoStack:this.$redoStack,$undoStack:this.$undoStack}},A.prototype.fromJSON=function(I){this.reset(),this.$undoStack=I.$undoStack,this.$redoStack=I.$redoStack},A.prototype.$prettyPrint=function(I){return I?d(I):d(this.$undoStack)+` --- `+d(this.$redoStack)},A}();o.prototype.hasUndo=o.prototype.canUndo,o.prototype.hasRedo=o.prototype.canRedo,o.prototype.isClean=o.prototype.isAtBookmark,o.prototype.markClean=o.prototype.bookmark;function s(A,I){for(var O=I;O--;){var z=A[O];if(z&&!z[0].ignore){for(;O"+A.end.row+":"+A.end.column}function m(A,I){var O=A.action=="insert",z=I.action=="insert";if(O&&z)if(l(I.start,A.end)>=0)x(I,A,-1);else if(l(I.start,A.start)<=0)x(A,I,1);else return null;else if(O&&!z)if(l(I.start,A.end)>=0)x(I,A,-1);else if(l(I.end,A.start)<=0)x(A,I,-1);else return null;else if(!O&&z)if(l(I.start,A.start)>=0)x(I,A,1);else if(l(I.start,A.start)<=0)x(A,I,1);else return null;else if(!O&&!z)if(l(I.start,A.start)>=0)x(I,A,1);else if(l(I.end,A.start)<=0)x(A,I,-1);else return null;return[I,A]}function y(A,I){for(var O=A.length;O--;)for(var z=0;z=0?x(A,I,-1):(l(A.start,I.start)<=0||x(A,a.fromPoints(I.start,A.start),-1),x(I,A,1));else if(!O&&z)l(I.start,A.end)>=0?x(I,A,-1):(l(I.start,A.start)<=0||x(I,a.fromPoints(A.start,I.start),-1),x(A,I,1));else if(!O&&!z)if(l(I.start,A.end)>=0)x(I,A,-1);else if(l(I.end,A.start)<=0)x(A,I,-1);else{var $,W;return l(A.start,I.start)<0&&($=A,A=S(A,I.start)),l(A.end,I.end)>0&&(W=S(A,I.end)),C(I.end,A.start,A.end,-1),W&&!$&&(A.lines=W.lines,A.start=W.start,A.end=W.end,W=A),[I,$,W].filter(Boolean)}return[I,A]}function x(A,I,O){C(A.start,I.start,I.end,O),C(A.end,I.start,I.end,O)}function C(A,I,O,z){A.row==(z==1?I:O).row&&(A.column+=z*(O.column-I.column)),A.row+=z*(O.row-I.row)}function S(A,I){var O=A.lines,z=A.end;A.end=c(I);var $=A.end.row-A.start.row,W=O.splice($,O.length),J=$?I.column:I.column-A.start.column;O.push(W[0].substring(0,J)),W[0]=W[0].substr(J);var Z={start:c(I),end:z,lines:W,action:A.action};return Z}function M(A,I){I=u(I);for(var O=A.length;O--;){for(var z=A[O],$=0;$this.endRow)throw new Error("Can't add a fold to this FoldLine as it has no connection");this.folds.push(l),this.folds.sort(function(c,u){return-c.range.compareEnd(u.start.row,u.start.column)}),this.range.compareEnd(l.start.row,l.start.column)>0?(this.end.row=l.end.row,this.end.column=l.end.column):this.range.compareStart(l.end.row,l.end.column)<0&&(this.start.row=l.start.row,this.start.column=l.start.column)}else if(l.start.row==this.end.row)this.folds.push(l),this.end.row=l.end.row,this.end.column=l.end.column;else if(l.end.row==this.start.row)this.folds.unshift(l),this.start.row=l.start.row,this.start.column=l.start.column;else throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");l.foldLine=this},a.prototype.containsRow=function(l){return l>=this.start.row&&l<=this.end.row},a.prototype.walk=function(l,c,u){var d=0,p=this.folds,m,y,w,x=!0;c==null&&(c=this.end.row,u=this.end.column);for(var C=0;C0)){var x=s(c,y.start);return w===0?u&&x!==0?-m-2:m:x>0||x===0&&!u?m:-m-1}}return-m-1},l.prototype.add=function(c){var u=!c.isEmpty(),d=this.pointIndex(c.start,u);d<0&&(d=-d-1);var p=this.pointIndex(c.end,u,d);return p<0?p=-p-1:p++,this.ranges.splice(d,p-d,c)},l.prototype.addList=function(c){for(var u=[],d=c.length;d--;)u.push.apply(u,this.add(c[d]));return u},l.prototype.substractPoint=function(c){var u=this.pointIndex(c);if(u>=0)return this.ranges.splice(u,1)},l.prototype.merge=function(){var c=[],u=this.ranges;u=u.sort(function(w,x){return s(w.start,x.start)});for(var d=u[0],p,m=1;m=0},l.prototype.containsPoint=function(c){return this.pointIndex(c)>=0},l.prototype.rangeAtPoint=function(c){var u=this.pointIndex(c);if(u>=0)return this.ranges[u]},l.prototype.clipRows=function(c,u){var d=this.ranges;if(d[0].start.row>u||d[d.length-1].start.row=p)break}if(c.action=="insert")for(var S=m-p,M=-u.column+d.column;wp)break;if(C.start.row==p&&C.start.column>=u.column&&(C.start.column==u.column&&this.$bias<=0||(C.start.column+=M,C.start.row+=S)),C.end.row==p&&C.end.column>=u.column){if(C.end.column==u.column&&this.$bias<0)continue;C.end.column==u.column&&M>0&&wC.start.column&&C.end.column==y[w+1].start.column&&(C.end.column-=M),C.end.column+=M,C.end.row+=S}}else for(var S=p-m,M=u.column-d.column;wm)break;C.end.rowu.column)&&(C.end.column=u.column,C.end.row=u.row):(C.end.column+=M,C.end.row+=S):C.end.row>m&&(C.end.row+=S),C.start.rowu.column)&&(C.start.column=u.column,C.start.row=u.row):(C.start.column+=M,C.start.row+=S):C.start.row>m&&(C.start.row+=S)}if(S!=0&&w=d)return w;if(w.end.row>d)return null}return null},this.getNextFoldLine=function(d,p){var m=this.$foldData,y=0;for(p&&(y=m.indexOf(p)),y==-1&&(y=0),y;y=d)return w}return null},this.getFoldedRowCount=function(d,p){for(var m=this.$foldData,y=p-d+1,w=0;w=p){S=d?y-=p-S:y=0);break}else C>=d&&(S>=d?y-=C-S:y-=C-d+1)}return y},this.$addFoldLine=function(d){return this.$foldData.push(d),this.$foldData.sort(function(p,m){return p.start.row-m.start.row}),d},this.addFold=function(d,p){var m=this.$foldData,y=!1,w;d instanceof a?w=d:(w=new a(p,d),w.collapseChildren=p.collapseChildren),this.$clipRangeToDocument(w.range);var x=w.start.row,C=w.start.column,S=w.end.row,M=w.end.column,E=this.getFoldAt(x,C,1),A=this.getFoldAt(S,M,-1);if(E&&A==E)return E.addSubFold(w);E&&!E.range.isStart(x,C)&&this.removeFold(E),A&&!A.range.isEnd(S,M)&&this.removeFold(A);var I=this.getFoldsInRange(w.range);I.length>0&&(this.removeFolds(I),w.collapseChildren||I.forEach(function(W){w.addSubFold(W)}));for(var O=0;O0&&this.foldAll(d.start.row+1,d.end.row,d.collapseChildren-1),d.subFolds=[]},this.expandFolds=function(d){d.forEach(function(p){this.expandFold(p)},this)},this.unfold=function(d,p){var m,y;if(d==null)m=new o(0,0,this.getLength(),0),p==null&&(p=!0);else if(typeof d=="number")m=new o(d,0,d,this.getLine(d).length);else if("row"in d)m=o.fromPoints(d,d);else{if(Array.isArray(d))return y=[],d.forEach(function(x){y=y.concat(this.unfold(x))},this),y;m=d}y=this.getFoldsInRangeList(m);for(var w=y;y.length==1&&o.comparePoints(y[0].start,m.start)<0&&o.comparePoints(y[0].end,m.end)>0;)this.expandFolds(y),y=this.getFoldsInRangeList(m);if(p!=!1?this.removeFolds(y):this.expandFolds(y),w.length)return w},this.isRowFolded=function(d,p){return!!this.getFoldLine(d,p)},this.getRowFoldEnd=function(d,p){var m=this.getFoldLine(d,p);return m?m.end.row:d},this.getRowFoldStart=function(d,p){var m=this.getFoldLine(d,p);return m?m.start.row:d},this.getFoldDisplayLine=function(d,p,m,y,w){y==null&&(y=d.start.row),w==null&&(w=0),p==null&&(p=d.end.row),m==null&&(m=this.getLine(p).length);var x=this.doc,C="";return d.walk(function(S,M,E,A){if(!(ME)break;while(w&&C.test(w.type));w=y.stepBackward()}else w=y.getCurrentToken();return S.end.row=y.getCurrentTokenRow(),S.end.column=y.getCurrentTokenColumn(),S.start.row==S.end.row&&S.start.column>S.end.column?void 0:S}},this.foldAll=function(d,p,m,y){m==null&&(m=1e5);var w=this.foldWidgets;if(w){p=p||this.getLength(),d=d||0;for(var x=d;x=d&&(x=C.end.row,C.collapseChildren=m,this.addFold("...",C))}}},this.foldToLevel=function(d){for(this.foldAll();d-- >0;)this.unfold(null,!1)},this.foldAllComments=function(){var d=this;this.foldAll(null,null,null,function(p){for(var m=d.getTokens(p),y=0;y=0;){var x=m[y];if(x==null&&(x=m[y]=this.getFoldWidget(y)),x=="start"){var C=this.getFoldWidgetRange(y);if(w||(w=C),C&&C.end.row>=d)break}y--}return{range:y!==-1&&C,firstRange:w}},this.onFoldWidgetClick=function(d,p){p instanceof c&&(p=p.domEvent);var m={children:p.shiftKey,all:p.ctrlKey||p.metaKey,siblings:p.altKey},y=this.$toggleFoldWidget(d,m);if(!y){var w=p.target||p.srcElement;w&&/ace_fold-widget/.test(w.className)&&(w.className+=" ace_invalid")}},this.$toggleFoldWidget=function(d,p){if(this.getFoldWidget){var m=this.getFoldWidget(d),y=this.getLine(d),w=m==="end"?-1:1,x=this.getFoldAt(d,w===-1?0:y.length,w);if(x)return p.children||p.all?this.removeFold(x):this.expandFold(x),x;var C=this.getFoldWidgetRange(d,!0);if(C&&!C.isMultiLine()&&(x=this.getFoldAt(C.start.row,C.start.column,1),x&&C.isEqual(x.range)))return this.removeFold(x),x;if(p.siblings){var S=this.getParentFoldRangeData(d);if(S.range)var M=S.range.start.row+1,E=S.range.end.row;this.foldAll(M,E,p.all?1e4:0)}else p.children?(E=C?C.end.row:this.getLength(),this.foldAll(d+1,E,p.all?1e4:0)):C&&(p.all&&(C.collapseChildren=1e4),this.addFold("...",C));return C}},this.toggleFoldWidget=function(d){var p=this.selection.getCursor().row;p=this.getRowFoldStart(p);var m=this.$toggleFoldWidget(p,{});if(!m){var y=this.getParentFoldRangeData(p,!0);if(m=y.range||y.firstRange,m){p=m.start.row;var w=this.getFoldAt(p,this.getLine(p).length,1);w?this.removeFold(w):this.addFold("...",m)}}},this.updateFoldWidgets=function(d){var p=d.start.row,m=d.end.row-p;if(m===0)this.foldWidgets[p]=null;else if(d.action=="remove")this.foldWidgets.splice(p,m+1,null);else{var y=Array(m+1);y.unshift(p,1),this.foldWidgets.splice.apply(this.foldWidgets,y)}},this.tokenizerUpdateFoldWidgets=function(d){var p=d.data;p.first!=p.last&&this.foldWidgets.length>p.first&&this.foldWidgets.splice(p.first,this.foldWidgets.length)}}r.Folding=u}),ace.define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(n,r,i){var o=n("../token_iterator").TokenIterator,s=n("../range").Range;function a(){this.findMatchingBracket=function(l,c){if(l.column==0)return null;var u=c||this.getLine(l.row).charAt(l.column-1);if(u=="")return null;var d=u.match(/([\(\[\{])|([\)\]\}])/);return d?d[1]?this.$findClosingBracket(d[1],l):this.$findOpeningBracket(d[2],l):null},this.getBracketRange=function(l){var c=this.getLine(l.row),u=!0,d,p=c.charAt(l.column-1),m=p&&p.match(/([\(\[\{])|([\)\]\}])/);if(m||(p=c.charAt(l.column),l={row:l.row,column:l.column+1},m=p&&p.match(/([\(\[\{])|([\)\]\}])/),u=!1),!m)return null;if(m[1]){var y=this.$findClosingBracket(m[1],l);if(!y)return null;d=s.fromPoints(l,y),u||(d.end.column++,d.start.column--),d.cursor=d.end}else{var y=this.$findOpeningBracket(m[2],l);if(!y)return null;d=s.fromPoints(y,l),u||(d.start.column++,d.end.column--),d.cursor=d.start}return d},this.getMatchingBracketRanges=function(l,c){var u=this.getLine(l.row),d=/([\(\[\{])|([\)\]\}])/,p=!c&&u.charAt(l.column-1),m=p&&p.match(d);if(m||(p=(c===void 0||c)&&u.charAt(l.column),l={row:l.row,column:l.column+1},m=p&&p.match(d)),!m)return null;var y=new s(l.row,l.column-1,l.row,l.column),w=m[1]?this.$findClosingBracket(m[1],l):this.$findOpeningBracket(m[2],l);if(!w)return[y];var x=new s(w.row,w.column,w.row,w.column+1);return[y,x]},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{","<":">",">":"<"},this.$findOpeningBracket=function(l,c,u){var d=this.$brackets[l],p=1,m=new o(this,c.row,c.column),y=m.getCurrentToken();if(y||(y=m.stepForward()),!!y){u||(u=new RegExp("(\\.?"+y.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end)\b/,"(?:start|begin|end)").replace(/-close\b/,"-(close|open)")+")+"));for(var w=c.column-m.getCurrentTokenColumn()-2,x=y.value;;){for(;w>=0;){var C=x.charAt(w);if(C==d){if(p-=1,p==0)return{row:m.getCurrentTokenRow(),column:w+m.getCurrentTokenColumn()}}else C==l&&(p+=1);w-=1}do y=m.stepBackward();while(y&&!u.test(y.type));if(y==null)break;x=y.value,w=x.length-1}return null}},this.$findClosingBracket=function(l,c,u){var d=this.$brackets[l],p=1,m=new o(this,c.row,c.column),y=m.getCurrentToken();if(y||(y=m.stepForward()),!!y){u||(u=new RegExp("(\\.?"+y.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:start|begin)\b/,"(?:start|begin|end)").replace(/-open\b/,"-(close|open)")+")+"));for(var w=c.column-m.getCurrentTokenColumn();;){for(var x=y.value,C=x.length;w"?d=!0:c.type.indexOf("tag-name")!==-1&&(u=!0));while(c&&!u);return c},this.$findClosingTag=function(l,c){var u,d=c.value,p=c.value,m=0,y=new s(l.getCurrentTokenRow(),l.getCurrentTokenColumn(),l.getCurrentTokenRow(),l.getCurrentTokenColumn()+1);c=l.stepForward();var w=new s(l.getCurrentTokenRow(),l.getCurrentTokenColumn(),l.getCurrentTokenRow(),l.getCurrentTokenColumn()+c.value.length),x=!1;do{if(u=c,u.type.indexOf("tag-close")!==-1&&!x){var C=new s(l.getCurrentTokenRow(),l.getCurrentTokenColumn(),l.getCurrentTokenRow(),l.getCurrentTokenColumn()+1);x=!0}if(c=l.stepForward(),c){if(c.value===">"&&!x){var C=new s(l.getCurrentTokenRow(),l.getCurrentTokenColumn(),l.getCurrentTokenRow(),l.getCurrentTokenColumn()+1);x=!0}if(c.type.indexOf("tag-name")!==-1){if(d=c.value,p===d){if(u.value==="<")m++;else if(u.value==="")var E=new s(l.getCurrentTokenRow(),l.getCurrentTokenColumn(),l.getCurrentTokenRow(),l.getCurrentTokenColumn()+1);else return}}}else if(p===d&&c.value==="/>"&&(m--,m<0))var S=new s(l.getCurrentTokenRow(),l.getCurrentTokenColumn(),l.getCurrentTokenRow(),l.getCurrentTokenColumn()+2),M=S,E=M,C=new s(w.end.row,w.end.column,w.end.row,w.end.column+1)}}while(c&&m>=0);if(y&&C&&S&&E&&w&&M)return{openTag:new s(y.start.row,y.start.column,C.end.row,C.end.column),closeTag:new s(S.start.row,S.start.column,E.end.row,E.end.column),openTagName:w,closeTagName:M}},this.$findOpeningTag=function(l,c){var u=l.getCurrentToken(),d=c.value,p=0,m=l.getCurrentTokenRow(),y=l.getCurrentTokenColumn(),w=y+2,x=new s(m,y,m,w);l.stepForward();var C=new s(l.getCurrentTokenRow(),l.getCurrentTokenColumn(),l.getCurrentTokenRow(),l.getCurrentTokenColumn()+c.value.length);if(c.type.indexOf("tag-close")===-1&&(c=l.stepForward()),!(!c||c.value!==">")){var S=new s(l.getCurrentTokenRow(),l.getCurrentTokenColumn(),l.getCurrentTokenRow(),l.getCurrentTokenColumn()+1);l.stepBackward(),l.stepBackward();do if(c=u,m=l.getCurrentTokenRow(),y=l.getCurrentTokenColumn(),w=y+c.value.length,u=l.stepBackward(),c){if(c.type.indexOf("tag-name")!==-1){if(d===c.value)if(u.value==="<"){if(p++,p>0){var M=new s(m,y,m,w),E=new s(l.getCurrentTokenRow(),l.getCurrentTokenColumn(),l.getCurrentTokenRow(),l.getCurrentTokenColumn()+1);do c=l.stepForward();while(c&&c.value!==">");var A=new s(l.getCurrentTokenRow(),l.getCurrentTokenColumn(),l.getCurrentTokenRow(),l.getCurrentTokenColumn()+1)}}else u.value===""){for(var I=0,O=u;O;){if(O.type.indexOf("tag-name")!==-1&&O.value===d){p--;break}else if(O.value==="<")break;O=l.stepBackward(),I++}for(var z=0;zG&&(this.$docRowCache.splice(G,j),this.$screenRowCache.splice(G,j))},Z.prototype.$getRowCacheIndex=function(q,j){for(var G=0,U=q.length-1;G<=U;){var Q=G+U>>1,re=q[Q];if(j>re)G=Q+1;else if(j=j));re++);return U=G[re],U?(U.index=re,U.start=Q-U.value.length,U):null},Z.prototype.setUndoManager=function(q){if(this.$undoManager=q,this.$informUndoManager&&this.$informUndoManager.cancel(),q){var j=this;q.addSession(this),this.$syncInformUndoManager=function(){j.$informUndoManager.cancel(),j.mergeUndoDeltas=!1},this.$informUndoManager=s.delayedCall(this.$syncInformUndoManager)}else this.$syncInformUndoManager=function(){}},Z.prototype.markUndoGroup=function(){this.$syncInformUndoManager&&this.$syncInformUndoManager()},Z.prototype.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},Z.prototype.getTabString=function(){return this.getUseSoftTabs()?s.stringRepeat(" ",this.getTabSize()):" "},Z.prototype.setUseSoftTabs=function(q){this.setOption("useSoftTabs",q)},Z.prototype.getUseSoftTabs=function(){return this.$useSoftTabs&&!this.$mode.$indentWithTabs},Z.prototype.setTabSize=function(q){this.setOption("tabSize",q)},Z.prototype.getTabSize=function(){return this.$tabSize},Z.prototype.isTabStop=function(q){return this.$useSoftTabs&&q.column%this.$tabSize===0},Z.prototype.setNavigateWithinSoftTabs=function(q){this.setOption("navigateWithinSoftTabs",q)},Z.prototype.getNavigateWithinSoftTabs=function(){return this.$navigateWithinSoftTabs},Z.prototype.setOverwrite=function(q){this.setOption("overwrite",q)},Z.prototype.getOverwrite=function(){return this.$overwrite},Z.prototype.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},Z.prototype.addGutterDecoration=function(q,j){this.$decorations[q]||(this.$decorations[q]=""),this.$decorations[q]+=" "+j,this._signal("changeBreakpoint",{})},Z.prototype.removeGutterCustomWidget=function(q){this.$editor&&this.$editor.renderer.$gutterLayer.$removeCustomWidget(q)},Z.prototype.addGutterCustomWidget=function(q,j){this.$editor&&this.$editor.renderer.$gutterLayer.$addCustomWidget(q,j)},Z.prototype.removeGutterDecoration=function(q,j){this.$decorations[q]=(this.$decorations[q]||"").replace(" "+j,""),this._signal("changeBreakpoint",{})},Z.prototype.getBreakpoints=function(){return this.$breakpoints},Z.prototype.setBreakpoints=function(q){this.$breakpoints=[];for(var j=0;j0&&(U=!!G.charAt(j-1).match(this.tokenRe)),U||(U=!!G.charAt(j).match(this.tokenRe)),U)var Q=this.tokenRe;else if(/^\s+$/.test(G.slice(j-1,j+1)))var Q=/\s/;else var Q=this.nonTokenRe;var re=j;if(re>0){do re--;while(re>=0&&G.charAt(re).match(Q));re++}for(var le=j;leq&&(q=j.screenWidth)}),this.lineWidgetWidth=q},Z.prototype.$computeWidth=function(q){if(this.$modified||q){if(this.$modified=!1,this.$useWrapMode)return this.screenWidth=this.$wrapLimit;for(var j=this.doc.getAllLines(),G=this.$rowLengthCache,U=0,Q=0,re=this.$foldData[Q],le=re?re.start.row:1/0,oe=j.length,he=0;hele){if(he=re.end.row+1,he>=oe)break;re=this.$foldData[Q++],le=re?re.start.row:1/0}G[he]==null&&(G[he]=this.$getStringScreenWidth(j[he])[0]),G[he]>U&&(U=G[he])}this.screenWidth=U}},Z.prototype.getLine=function(q){return this.doc.getLine(q)},Z.prototype.getLines=function(q,j){return this.doc.getLines(q,j)},Z.prototype.getLength=function(){return this.doc.getLength()},Z.prototype.getTextRange=function(q){return this.doc.getTextRange(q||this.selection.getRange())},Z.prototype.insert=function(q,j){return this.doc.insert(q,j)},Z.prototype.remove=function(q){return this.doc.remove(q)},Z.prototype.removeFullLines=function(q,j){return this.doc.removeFullLines(q,j)},Z.prototype.undoChanges=function(q,j){if(q.length){this.$fromUndo=!0;for(var G=q.length-1;G!=-1;G--){var U=q[G];U.action=="insert"||U.action=="remove"?this.doc.revertDelta(U):U.folds&&this.addFolds(U.folds)}!j&&this.$undoSelect&&(q.selectionBefore?this.selection.fromJSON(q.selectionBefore):this.selection.setRange(this.$getUndoSelection(q,!0))),this.$fromUndo=!1}},Z.prototype.redoChanges=function(q,j){if(q.length){this.$fromUndo=!0;for(var G=0;Gq.end.column&&(re.start.column+=oe),re.end.row==q.end.row&&re.end.column>q.end.column&&(re.end.column+=oe)),le&&re.start.row>=q.end.row&&(re.start.row+=le,re.end.row+=le)}if(re.end=this.insert(re.start,U),Q.length){var he=q.start,xe=re.start,le=xe.row-he.row,oe=xe.column-he.column;this.addFolds(Q.map(function(Oe){return Oe=Oe.clone(),Oe.start.row==he.row&&(Oe.start.column+=oe),Oe.end.row==he.row&&(Oe.end.column+=oe),Oe.start.row+=le,Oe.end.row+=le,Oe}))}return re},Z.prototype.indentRows=function(q,j,G){G=G.replace(/\t/g,this.getTabString());for(var U=q;U<=j;U++)this.doc.insertInLine({row:U,column:0},G)},Z.prototype.outdentRows=function(q){for(var j=q.collapseRows(),G=new p(0,0,0,0),U=this.getTabSize(),Q=j.start.row;Q<=j.end.row;++Q){var re=this.getLine(Q);G.start.row=Q,G.end.row=Q;for(var le=0;le0){var U=this.getRowFoldEnd(j+G);if(U>this.doc.getLength()-1)return 0;var Q=U-j}else{q=this.$clipRowToDocument(q),j=this.$clipRowToDocument(j);var Q=j-q+1}var re=new p(q,0,j,Number.MAX_VALUE),le=this.getFoldsInRange(re).map(function(he){return he=he.clone(),he.start.row+=Q,he.end.row+=Q,he}),oe=G==0?this.doc.getLines(q,j):this.doc.removeFullLines(q,j);return this.doc.insertFullLines(q+Q,oe),le.length&&this.addFolds(le),Q},Z.prototype.moveLinesUp=function(q,j){return this.$moveLines(q,j,-1)},Z.prototype.moveLinesDown=function(q,j){return this.$moveLines(q,j,1)},Z.prototype.duplicateLines=function(q,j){return this.$moveLines(q,j,0)},Z.prototype.$clipRowToDocument=function(q){return Math.max(0,Math.min(q,this.doc.getLength()-1))},Z.prototype.$clipColumnToRow=function(q,j){return j<0?0:Math.min(this.doc.getLine(q).length,j)},Z.prototype.$clipPositionToDocument=function(q,j){if(j=Math.max(0,j),q<0)q=0,j=0;else{var G=this.doc.getLength();q>=G?(q=G-1,j=this.doc.getLine(G-1).length):j=Math.min(this.doc.getLine(q).length,j)}return{row:q,column:j}},Z.prototype.$clipRangeToDocument=function(q){q.start.row<0?(q.start.row=0,q.start.column=0):q.start.column=this.$clipColumnToRow(q.start.row,q.start.column);var j=this.doc.getLength()-1;return q.end.row>j?(q.end.row=j,q.end.column=this.doc.getLine(j).length):q.end.column=this.$clipColumnToRow(q.end.row,q.end.column),q},Z.prototype.setUseWrapMode=function(q){if(q!=this.$useWrapMode){if(this.$useWrapMode=q,this.$modified=!0,this.$resetRowCache(0),q){var j=this.getLength();this.$wrapData=Array(j),this.$updateWrapData(0,j-1)}this._signal("changeWrapMode")}},Z.prototype.getUseWrapMode=function(){return this.$useWrapMode},Z.prototype.setWrapLimitRange=function(q,j){(this.$wrapLimitRange.min!==q||this.$wrapLimitRange.max!==j)&&(this.$wrapLimitRange={min:q,max:j},this.$modified=!0,this.$bidiHandler.markAsDirty(),this.$useWrapMode&&this._signal("changeWrapMode"))},Z.prototype.adjustWrapLimit=function(q,j){var G=this.$wrapLimitRange;G.max<0&&(G={min:j,max:j});var U=this.$constrainWrapLimit(q,G.min,G.max);return U!=this.$wrapLimit&&U>1?(this.$wrapLimit=U,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0):!1},Z.prototype.$constrainWrapLimit=function(q,j,G){return j&&(q=Math.max(j,q)),G&&(q=Math.min(G,q)),q},Z.prototype.getWrapLimit=function(){return this.$wrapLimit},Z.prototype.setWrapLimit=function(q){this.setWrapLimitRange(q,q)},Z.prototype.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},Z.prototype.$updateInternalDataOnChange=function(q){var j=this.$useWrapMode,G=q.action,U=q.start,Q=q.end,re=U.row,le=Q.row,oe=le-re,he=null;if(this.$updating=!0,oe!=0)if(G==="remove"){this[j?"$wrapData":"$rowLengthCache"].splice(re,oe);var xe=this.$foldData;he=this.getFoldsInRange(q),this.removeFolds(he);var Ee=this.getFoldLine(Q.row),Ie=0;if(Ee){Ee.addRemoveChars(Q.row,Q.column,U.column-Q.column),Ee.shiftRow(-oe);var Oe=this.getFoldLine(re);Oe&&Oe!==Ee&&(Oe.merge(Ee),Ee=Oe),Ie=xe.indexOf(Ee)+1}for(Ie;Ie=Q.row&&Ee.shiftRow(-oe)}le=re}else{var $e=Array(oe);$e.unshift(re,0);var Ze=j?this.$wrapData:this.$rowLengthCache;Ze.splice.apply(Ze,$e);var xe=this.$foldData,Ee=this.getFoldLine(re),Ie=0;if(Ee){var lt=Ee.range.compareInside(U.row,U.column);lt==0?(Ee=Ee.split(U.row,U.column),Ee&&(Ee.shiftRow(oe),Ee.addRemoveChars(le,0,Q.column-U.column))):lt==-1&&(Ee.addRemoveChars(re,0,Q.column-U.column),Ee.shiftRow(oe)),Ie=xe.indexOf(Ee)+1}for(Ie;Ie=re&&Ee.shiftRow(oe)}}else{oe=Math.abs(q.start.column-q.end.column),G==="remove"&&(he=this.getFoldsInRange(q),this.removeFolds(he),oe=-oe);var Ee=this.getFoldLine(re);Ee&&Ee.addRemoveChars(re,U.column,oe)}return j&&this.$wrapData.length!=this.doc.getLength()&&console.error("doc.getLength() and $wrapData.length have to be the same!"),this.$updating=!1,j?this.$updateWrapData(re,le):this.$updateRowLengthCache(re,le),he},Z.prototype.$updateRowLengthCache=function(q,j){this.$rowLengthCache[q]=null,this.$rowLengthCache[j]=null},Z.prototype.$updateWrapData=function(q,j){var G=this.doc.getAllLines(),U=this.getTabSize(),Q=this.$wrapData,re=this.$wrapLimit,le,oe,he=q;for(j=Math.min(j,G.length-1);he<=j;)oe=this.getFoldLine(he,oe),oe?(le=[],oe.walk((function(xe,Ee,Ie,Oe){var $e;if(xe!=null){$e=this.$getDisplayTokens(xe,le.length),$e[0]=A;for(var Ze=1;Ze<$e.length;Ze++)$e[Ze]=I}else $e=this.$getDisplayTokens(G[Ee].substring(Oe,Ie),le.length);le=le.concat($e)}).bind(this),oe.end.row,G[oe.end.row].length+1),Q[oe.start.row]=this.$computeWrapSplits(le,re,U),he=oe.end.row+1):(le=this.$getDisplayTokens(G[he]),Q[he]=this.$computeWrapSplits(le,re,U),he++)},Z.prototype.$computeWrapSplits=function(q,j,G){if(q.length==0)return[];var U=[],Q=q.length,re=0,le=0,oe=this.$wrapAsCode,he=this.$indentedSoftWrap,xe=j<=Math.max(2*G,8)||he===!1?0:Math.floor(j/2);function Ee(){var lt=0;if(xe===0)return lt;if(he)for(var pt=0;ptj-Oe;){var $e=re+j-Oe;if(q[$e-1]>=z&&q[$e]>=z){Ie($e);continue}if(q[$e]==A||q[$e]==I){for($e;$e!=re-1&&q[$e]!=A;$e--);if($e>re){Ie($e);continue}for($e=re+j,$e;$e>2)),re-1);$e>Ze&&q[$e]Ze&&q[$e]Ze&&q[$e]==O;)$e--}else for(;$e>Ze&&q[$e]Ze){Ie(++$e);continue}$e=re+j,q[$e]==E&&$e--,Ie($e-Oe)}return U},Z.prototype.$getDisplayTokens=function(q,j){var G=[],U;j=j||0;for(var Q=0;Q39&&re<48||re>57&&re<64?G.push(O):re>=4352&&J(re)?G.push(M,E):G.push(M)}return G},Z.prototype.$getStringScreenWidth=function(q,j,G){if(j==0)return[0,0];j==null&&(j=1/0),G=G||0;var U,Q;for(Q=0;Q=4352&&J(U)?G+=2:G+=1,!(G>j));Q++);return[G,Q]},Z.prototype.getRowLength=function(q){var j=1;return this.lineWidgets&&(j+=this.lineWidgets[q]&&this.lineWidgets[q].rowCount||0),!this.$useWrapMode||!this.$wrapData[q]?j:this.$wrapData[q].length+j},Z.prototype.getRowLineCount=function(q){return!this.$useWrapMode||!this.$wrapData[q]?1:this.$wrapData[q].length+1},Z.prototype.getRowWrapIndent=function(q){if(this.$useWrapMode){var j=this.screenToDocumentPosition(q,Number.MAX_VALUE),G=this.$wrapData[j.row];return G.length&&G[0]=0)var oe=xe[Ee],Q=this.$docRowCache[Ee],Oe=q>xe[Ie-1];else var Oe=!Ie;for(var $e=this.getLength()-1,Ze=this.getNextFoldLine(Q),lt=Ze?Ze.start.row:1/0;oe<=q&&(he=this.getRowLength(Q),!(oe+he>q||Q>=$e));)oe+=he,Q++,Q>lt&&(Q=Ze.end.row+1,Ze=this.getNextFoldLine(Q,Ze),lt=Ze?Ze.start.row:1/0),Oe&&(this.$docRowCache.push(Q),this.$screenRowCache.push(oe));if(Ze&&Ze.start.row<=Q)U=this.getFoldDisplayLine(Ze),Q=Ze.start.row;else{if(oe+he<=q||Q>$e)return{row:$e,column:this.getLine($e).length};U=this.getLine(Q),Ze=null}var pt=0,yt=Math.floor(q-oe);if(this.$useWrapMode){var Lt=this.$wrapData[Q];Lt&&(le=Lt[yt],yt>0&&Lt.length&&(pt=Lt.indent,re=Lt[yt-1]||Lt[Lt.length-1],U=U.substring(re)))}return G!==void 0&&this.$bidiHandler.isBidiRow(oe+yt,Q,yt)&&(j=this.$bidiHandler.offsetToCol(G)),re+=this.$getStringScreenWidth(U,j-pt)[1],this.$useWrapMode&&re>=le&&(re=le-1),Ze?Ze.idxToPosition(re):{row:Q,column:re}},Z.prototype.documentToScreenPosition=function(q,j){if(typeof j>"u")var G=this.$clipPositionToDocument(q.row,q.column);else G=this.$clipPositionToDocument(q,j);q=G.row,j=G.column;var U=0,Q=null,re=null;re=this.getFoldAt(q,j,1),re&&(q=re.start.row,j=re.start.column);var le,oe=0,he=this.$docRowCache,xe=this.$getRowCacheIndex(he,q),Ee=he.length;if(Ee&&xe>=0)var oe=he[xe],U=this.$screenRowCache[xe],Ie=q>he[Ee-1];else var Ie=!Ee;for(var Oe=this.getNextFoldLine(oe),$e=Oe?Oe.start.row:1/0;oe=$e){if(le=Oe.end.row+1,le>q)break;Oe=this.getNextFoldLine(le,Oe),$e=Oe?Oe.start.row:1/0}else le=oe+1;U+=this.getRowLength(oe),oe=le,Ie&&(this.$docRowCache.push(oe),this.$screenRowCache.push(U))}var Ze="";Oe&&oe>=$e?(Ze=this.getFoldDisplayLine(Oe,q,j),Q=Oe.start.row):(Ze=this.getLine(q).substring(0,j),Q=q);var lt=0;if(this.$useWrapMode){var pt=this.$wrapData[Q];if(pt){for(var yt=0;Ze.length>=pt[yt];)U++,yt++;Ze=Ze.substring(pt[yt-1]||0,Ze.length),lt=yt>0?pt.indent:0}}return this.lineWidgets&&this.lineWidgets[oe]&&this.lineWidgets[oe].rowsAbove&&(U+=this.lineWidgets[oe].rowsAbove),{row:U,column:lt+this.$getStringScreenWidth(Ze)[0]}},Z.prototype.documentToScreenColumn=function(q,j){return this.documentToScreenPosition(q,j).column},Z.prototype.documentToScreenRow=function(q,j){return this.documentToScreenPosition(q,j).row},Z.prototype.getScreenLength=function(){var q=0,j=null;if(this.$useWrapMode)for(var Q=this.$wrapData.length,re=0,U=0,j=this.$foldData[U++],le=j?j.start.row:1/0;rele&&(re=j.end.row+1,j=this.$foldData[U++],le=j?j.start.row:1/0)}else{q=this.getLength();for(var G=this.$foldData,U=0;UG));re++);return[U,re]})},Z.prototype.getPrecedingCharacter=function(){var q=this.selection.getCursor();if(q.column===0)return q.row===0?"":this.doc.getNewLineCharacter();var j=this.getLine(q.row);return j[q.column-1]},Z.prototype.destroy=function(){this.destroyed||(this.bgTokenizer.setDocument(null),this.bgTokenizer.cleanup(),this.destroyed=!0),this.endOperation(),this.$stopWorker(),this.removeAllListeners(),this.doc&&this.doc.off("change",this.$onChange),this.selection&&(this.selection.off("changeCursor",this.$onSelectionChange),this.selection.off("changeSelection",this.$onSelectionChange)),this.selection.detach()},Z}();S.$uid=0,S.prototype.$modes=l.$modes,S.prototype.getValue=S.prototype.toString,S.prototype.$defaultUndoManager={undo:function(){},redo:function(){},hasUndo:function(){},hasRedo:function(){},reset:function(){},add:function(){},addSelection:function(){},startNewGroup:function(){},addSession:function(){}},S.prototype.$overwrite=!1,S.prototype.$mode=null,S.prototype.$modeId=null,S.prototype.$scrollTop=0,S.prototype.$scrollLeft=0,S.prototype.$wrapLimit=80,S.prototype.$useWrapMode=!1,S.prototype.$wrapLimitRange={min:null,max:null},S.prototype.lineWidgets=null,S.prototype.isFullWidth=J,o.implement(S.prototype,c);var M=1,E=2,A=3,I=4,O=9,z=10,$=11,W=12;function J(Z){return Z<4352?!1:Z>=4352&&Z<=4447||Z>=4515&&Z<=4519||Z>=4602&&Z<=4607||Z>=9001&&Z<=9002||Z>=11904&&Z<=11929||Z>=11931&&Z<=12019||Z>=12032&&Z<=12245||Z>=12272&&Z<=12283||Z>=12288&&Z<=12350||Z>=12353&&Z<=12438||Z>=12441&&Z<=12543||Z>=12549&&Z<=12589||Z>=12593&&Z<=12686||Z>=12688&&Z<=12730||Z>=12736&&Z<=12771||Z>=12784&&Z<=12830||Z>=12832&&Z<=12871||Z>=12880&&Z<=13054||Z>=13056&&Z<=19903||Z>=19968&&Z<=42124||Z>=42128&&Z<=42182||Z>=43360&&Z<=43388||Z>=44032&&Z<=55203||Z>=55216&&Z<=55238||Z>=55243&&Z<=55291||Z>=63744&&Z<=64255||Z>=65040&&Z<=65049||Z>=65072&&Z<=65106||Z>=65108&&Z<=65126||Z>=65128&&Z<=65131||Z>=65281&&Z<=65376||Z>=65504&&Z<=65510}n("./edit_session/folding").Folding.call(S.prototype),n("./edit_session/bracket_match").BracketMatch.call(S.prototype),l.defineOptions(S.prototype,"session",{wrap:{set:function(Z){if(!Z||Z=="off"?Z=!1:Z=="free"?Z=!0:Z=="printMargin"?Z=-1:typeof Z=="string"&&(Z=parseInt(Z,10)||!1),this.$wrap!=Z)if(this.$wrap=Z,!Z)this.setUseWrapMode(!1);else{var q=typeof Z=="number"?Z:null;this.setWrapLimitRange(q,q),this.setUseWrapMode(!0)}},get:function(){return this.getUseWrapMode()?this.$wrap==-1?"printMargin":this.getWrapLimitRange().min?this.$wrap:"free":"off"},handlesSet:!0},wrapMethod:{set:function(Z){Z=Z=="auto"?this.$mode.type!="text":Z!="text",Z!=this.$wrapAsCode&&(this.$wrapAsCode=Z,this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0)))},initialValue:"auto"},indentedSoftWrap:{set:function(){this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0))},initialValue:!0},firstLineNumber:{set:function(){this._signal("changeBreakpoint")},initialValue:1},useWorker:{set:function(Z){this.$useWorker=Z,this.$stopWorker(),Z&&this.$startWorker()},initialValue:!0},useSoftTabs:{initialValue:!0},tabSize:{set:function(Z){Z=parseInt(Z),Z>0&&this.$tabSize!==Z&&(this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=Z,this._signal("changeTabSize"))},initialValue:4,handlesSet:!0},navigateWithinSoftTabs:{initialValue:!1},foldStyle:{set:function(Z){this.setFoldStyle(Z)},handlesSet:!0},overwrite:{set:function(Z){this._signal("changeOverwrite")},initialValue:!1},newLineMode:{set:function(Z){this.doc.setNewLineMode(Z)},get:function(){return this.doc.getNewLineMode()},handlesSet:!0},mode:{set:function(Z){this.setMode(Z)},get:function(){return this.$modeId},handlesSet:!0}}),r.EditSession=S}),ace.define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(n,r,i){var o=n("./lib/lang"),s=n("./lib/oop"),a=n("./range").Range,l=function(){function p(){this.$options={}}return p.prototype.set=function(m){return s.mixin(this.$options,m),this},p.prototype.getOptions=function(){return o.copyObject(this.$options)},p.prototype.setOptions=function(m){this.$options=m},p.prototype.find=function(m){var y=this.$options,w=this.$matchIterator(m,y);if(!w)return!1;var x=null;return w.forEach(function(C,S,M,E){return x=new a(C,S,M,E),S==E&&y.start&&y.start.start&&y.skipCurrent!=!1&&x.isEqual(y.start)?(x=null,!1):!0}),x},p.prototype.findAll=function(m){var y=this.$options;if(!y.needle)return[];this.$assembleRegExp(y);var w=y.range,x=w?m.getLines(w.start.row,w.end.row):m.doc.getAllLines(),C=[],S=y.re;if(y.$isMultiLine){var M=S.length,E=x.length-M,A;e:for(var I=S.offset||0;I<=E;I++){for(var O=0;OW||(C.push(A=new a(I,W,I+M-1,J)),M>2&&(I=I+M-2))}}else for(var Z,q=0;qq&&(q=G),C.push(new a(Z.startRow,Z.startCol,Z.endRow,Z.endCol))}}else{Z=o.getMatchOffsets(x[q],S);for(var O=0;Ore&&C[O].end.row==le;)O--;for(C=C.slice(q,O+1),q=0,O=C.length;q=C){w+="\\";break}var M=m.charCodeAt(x);switch(M){case y.Backslash:w+="\\";break;case y.n:w+=` `;break;case y.t:w+=" ";break}continue}if(S===y.DollarSign){if(x++,x>=C){w+="$";break}var E=m.charCodeAt(x);if(E===y.DollarSign){w+="$$";continue}if(E===y.Digit0||E===y.Ampersand){w+="$&";continue}if(y.Digit1<=E&&E<=y.Digit9){w+="$"+m[x];continue}}w+=m[x]}return w||m},p.prototype.replace=function(m,y){var w=this.$options,x=this.$assembleRegExp(w);if(w.$isMultiLine)return y;if(x){var C=this.$isMultilineSearch(w);C&&(m=m.replace(/\r\n|\r|\n/g,` `));var S=x.exec(m);if(!S||!C&&S[0].length!=m.length)return null;if(y=w.regExp?this.parseReplaceString(y):y.replace(/\$/g,"$$$$"),y=m.replace(x,y),w.preserveCase){y=y.split("");for(var M=Math.min(m.length,m.length);M--;){var E=m[M];E&&E.toLowerCase()!=E?y[M]=y[M].toUpperCase():y[M]=y[M].toLowerCase()}y=y.join("")}return y}},p.prototype.$assembleRegExp=function(m,y){if(m.needle instanceof RegExp)return m.re=m.needle;var w=m.needle;if(!m.needle)return m.re=!1;m.regExp||(w=o.escapeRegExp(w));var x=m.caseSensitive?"gm":"gmi";try{new RegExp(w,"u"),m.$supportsUnicodeFlag=!0,x+="u"}catch{m.$supportsUnicodeFlag=!1}if(m.wholeWord&&(w=c(w,m)),m.$isMultiLine=!y&&/[\n\r]/.test(w),m.$isMultiLine)return m.re=this.$assembleMultilineRegExp(w,x);try{var C=new RegExp(w,x)}catch{C=!1}return m.re=C},p.prototype.$assembleMultilineRegExp=function(m,y){for(var w=m.replace(/\r\n|\r|\n/g,`$ ^`).split(` `),x=[],C=0;Cx);E++){var A=m.getLine(M++);C=C==null?A:C+` `+A}var I=y.exec(C);if(y.lastIndex=0,I){var O=C.slice(0,I.index).split(` `),z=I[0].split(` `),$=w+O.length-1,W=O[O.length-1].length,J=$+z.length-1,Z=z.length==1?W+z[0].length:z[z.length-1].length;return{startRow:$,startCol:W,endRow:J,endCol:Z}}}return null},p.prototype.$multiLineBackward=function(m,y,w,x,C){for(var S,M=d(m,x),E=m.getLine(x).length-w,A=x;A>=C;){for(var I=0;I=C;I++){var O=m.getLine(A--);S=S==null?O:O+` `+S}var z=u(S,y,E);if(z){var $=S.slice(0,z.index).split(` `),W=z[0].split(` `),J=A+$.length,Z=$[$.length-1].length,q=J+W.length-1,j=W.length==1?Z+W[0].length:W[W.length-1].length;return{startRow:J,startCol:Z,endRow:q,endCol:j}}}return null},p.prototype.$matchIterator=function(m,y){var w=this.$assembleRegExp(y);if(!w)return!1;var x=this.$isMultilineSearch(y),C=this.$multiLineForward,S=this.$multiLineBackward,M=y.backwards==!0,E=y.skipCurrent!=!1,A=w.unicode,I=y.range,O=y.start;O||(O=I?I[M?"end":"start"]:m.selection.getRange()),O.start&&(O=O[E!=M?"end":"start"]);var z=I?I.start.row:0,$=I?I.end.row:m.getLength()-1;if(M)var W=function(q){var j=O.row;if(!Z(j,O.column,q)){for(j--;j>=z;j--)if(Z(j,Number.MAX_VALUE,q))return;if(y.wrap!=!1){for(j=$,z=O.row;j>=z;j--)if(Z(j,Number.MAX_VALUE,q))return}}};else var W=function(j){var G=O.row;if(!Z(G,O.column,j)){for(G=G+1;G<=$;G++)if(Z(G,0,j))return;if(y.wrap!=!1){for(G=z,$=O.row;G<=$;G++)if(Z(G,0,j))return}}};if(y.$isMultiLine)var J=w.length,Z=function(q,j,G){var U=M?q-J+1:q;if(!(U<0||U+J>m.getLength())){var Q=m.getLine(U),re=Q.search(w[0]);if(!(!M&&rej)&&G(U,re,U+J-1,oe))return!0}}};else if(M)var Z=function(j,G,U){if(x){var Q=S(m,w,G,j,z);if(!Q)return!1;if(U(Q.startRow,Q.startCol,Q.endRow,Q.endCol))return!0}else{var re=m.getLine(j),le=[],oe,he=0;for(w.lastIndex=0;oe=w.exec(re);){var xe=oe[0].length;if(he=oe.index,!xe){if(he>=re.length)break;w.lastIndex=he+=o.skipEmptyMatch(re,he,A)}if(oe.index+xe>G)break;le.push(oe.index,xe)}for(var Ee=le.length-1;Ee>=0;Ee-=2){var Ie=le[Ee-1],xe=le[Ee];if(U(j,Ie,j,Ie+xe))return!0}}};else var Z=function(j,G,U){if(w.lastIndex=G,x){var Q=C(m,w,j,$);if(Q){var re=Q.endRow<=$?Q.endRow-1:$;re>j&&(j=re)}if(!Q)return!1;if(U(Q.startRow,Q.startCol,Q.endRow,Q.endCol))return!0}else for(var le=m.getLine(j),oe,he;he=w.exec(le);){var xe=he[0].length;if(oe=he.index,U(j,oe,j,oe+xe))return!0;if(!xe&&(w.lastIndex=oe+=o.skipEmptyMatch(le,oe,A),oe>=le.length))return!1}};return{forEach:W}},p}();function c(p,m){var y=o.supportsLookbehind();function w(M,E){E===void 0&&(E=!0);var A=y&&m.$supportsUnicodeFlag?new RegExp("[\\p{L}\\p{N}_]","u"):new RegExp("\\w");return A.test(M)||m.regExp?y&&m.$supportsUnicodeFlag?E?"(?<=^|[^\\p{L}\\p{N}_])":"(?=[^\\p{L}\\p{N}_]|$)":"\\b":""}var x=Array.from(p),C=x[0],S=x[x.length-1];return w(C)+p+w(S,!1)}function u(p,m,y){for(var w=null,x=0;x<=p.length;){m.lastIndex=x;var C=m.exec(p);if(!C)break;var S=C.index+C[0].length;if(S>p.length-y)break;(!w||S>w.index+w[0].length)&&(w=C),x=C.index+1}return w}function d(p,m){var y=5e3,w={row:m,column:0},x=p.doc.positionToIndex(w),C=x+y,S=p.doc.indexToPosition(C),M=S.row;return M+1}r.Search=l}),ace.define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(n,r,i){var o=this&&this.__extends||function(){var p=function(m,y){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(w,x){w.__proto__=x}||function(w,x){for(var C in x)Object.prototype.hasOwnProperty.call(x,C)&&(w[C]=x[C])},p(m,y)};return function(m,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");p(m,y);function w(){this.constructor=m}m.prototype=y===null?Object.create(y):(w.prototype=y.prototype,new w)}}(),s=n("../lib/keys"),a=n("../lib/useragent"),l=s.KEY_MODS,c=function(){function p(m,y){this.$init(m,y,!1)}return p.prototype.$init=function(m,y,w){this.platform=y||(a.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(m),this.$singleCommand=w},p.prototype.addCommand=function(m){this.commands[m.name]&&this.removeCommand(m),this.commands[m.name]=m,m.bindKey&&this._buildKeyHash(m)},p.prototype.removeCommand=function(m,y){var w=m&&(typeof m=="string"?m:m.name);m=this.commands[w],y||delete this.commands[w];var x=this.commandKeyBinding;for(var C in x){var S=x[C];if(S==m)delete x[C];else if(Array.isArray(S)){var M=S.indexOf(m);M!=-1&&(S.splice(M,1),S.length==1&&(x[C]=S[0]))}}},p.prototype.bindKey=function(m,y,w){if(typeof m=="object"&&m&&(w==null&&(w=m.position),m=m[this.platform]),!!m){if(typeof y=="function")return this.addCommand({exec:y,bindKey:m,name:y.name||m});m.split("|").forEach(function(x){var C="";if(x.indexOf(" ")!=-1){var S=x.split(/\s+/);x=S.pop(),S.forEach(function(A){var I=this.parseKeys(A),O=l[I.hashId]+I.key;C+=(C?" ":"")+O,this._addCommandToBinding(C,"chainKeys")},this),C+=" "}var M=this.parseKeys(x),E=l[M.hashId]+M.key;this._addCommandToBinding(C+E,y,w)},this)}},p.prototype._addCommandToBinding=function(m,y,w){var x=this.commandKeyBinding,C;if(!y)delete x[m];else if(!x[m]||this.$singleCommand)x[m]=y;else{Array.isArray(x[m])?(C=x[m].indexOf(y))!=-1&&x[m].splice(C,1):x[m]=[x[m]],typeof w!="number"&&(w=u(y));var S=x[m];for(C=0;Cw)break}S.splice(C,0,y)}},p.prototype.addCommands=function(m){m&&Object.keys(m).forEach(function(y){var w=m[y];if(w){if(typeof w=="string")return this.bindKey(w,y);typeof w=="function"&&(w={exec:w}),typeof w=="object"&&(w.name||(w.name=y),this.addCommand(w))}},this)},p.prototype.removeCommands=function(m){Object.keys(m).forEach(function(y){this.removeCommand(m[y])},this)},p.prototype.bindKeys=function(m){Object.keys(m).forEach(function(y){this.bindKey(y,m[y])},this)},p.prototype._buildKeyHash=function(m){this.bindKey(m.bindKey,m)},p.prototype.parseKeys=function(m){var y=m.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(E){return E}),w=y.pop(),x=s[w];if(s.FUNCTION_KEYS[x])w=s.FUNCTION_KEYS[x].toLowerCase();else if(y.length){if(y.length==1&&y[0]=="shift")return{key:w.toUpperCase(),hashId:-1}}else return{key:w,hashId:-1};for(var C=0,S=y.length;S--;){var M=s.KEY_MODS[y[S]];if(M==null)return typeof console<"u"&&console.error("invalid modifier "+y[S]+" in "+m),!1;C|=M}return{key:w,hashId:C}},p.prototype.findKeyCommand=function(m,y){var w=l[m]+y;return this.commandKeyBinding[w]},p.prototype.handleKeyboard=function(m,y,w,x){if(!(x<0)){var C=l[y]+w,S=this.commandKeyBinding[C];return m.$keyChain&&(m.$keyChain+=" "+C,S=this.commandKeyBinding[m.$keyChain]||S),S&&(S=="chainKeys"||S[S.length-1]=="chainKeys")?(m.$keyChain=m.$keyChain||C,{command:"null"}):(m.$keyChain&&((!y||y==4)&&w.length==1?m.$keyChain=m.$keyChain.slice(0,-C.length-1):(y==-1||x>0)&&(m.$keyChain="")),{command:S})}},p.prototype.getStatusText=function(m,y){return y.$keyChain||""},p}();function u(p){return typeof p=="object"&&p.bindKey&&p.bindKey.position||(p.isDefault?-100:0)}var d=function(p){o(m,p);function m(y,w){var x=p.call(this,y,w)||this;return x.$singleCommand=!0,x}return m}(c);d.call=function(p,m,y){c.prototype.$init.call(p,m,y,!0)},c.call=function(p,m,y){c.prototype.$init.call(p,m,y,!1)},r.HashHandler=d,r.MultiHashHandler=c}),ace.define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(n,r,i){var o=this&&this.__extends||function(){var u=function(d,p){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,y){m.__proto__=y}||function(m,y){for(var w in y)Object.prototype.hasOwnProperty.call(y,w)&&(m[w]=y[w])},u(d,p)};return function(d,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");u(d,p);function m(){this.constructor=d}d.prototype=p===null?Object.create(p):(m.prototype=p.prototype,new m)}}(),s=n("../lib/oop"),a=n("../keyboard/hash_handler").MultiHashHandler,l=n("../lib/event_emitter").EventEmitter,c=function(u){o(d,u);function d(p,m){var y=u.call(this,m,p)||this;return y.byName=y.commands,y.setDefaultHandler("exec",function(w){return w.args?w.command.exec(w.editor,w.args,w.event,!1):w.command.exec(w.editor,{},w.event,!0)}),y}return d.prototype.exec=function(p,m,y){if(Array.isArray(p)){for(var w=p.length;w--;)if(this.exec(p[w],m,y))return!0;return!1}typeof p=="string"&&(p=this.commands[p]);var x={editor:m,command:p,args:y};return this.canExecute(p,m)?(x.returnValue=this._emit("exec",x),this._signal("afterExec",x),x.returnValue!==!1):(this._signal("commandUnavailable",x),!1)},d.prototype.canExecute=function(p,m){return typeof p=="string"&&(p=this.commands[p]),!(!p||m&&m.$readOnly&&!p.readOnly||this.$checkCommandState!=!1&&p.isAvailable&&!p.isAvailable(m))},d.prototype.toggleRecording=function(p){if(!this.$inReplay)return p&&p._emit("changeStatus"),this.recording?(this.macro.pop(),this.off("exec",this.$addCommandToMacro),this.macro.length||(this.macro=this.oldMacro),this.recording=!1):(this.$addCommandToMacro||(this.$addCommandToMacro=(function(m){this.macro.push([m.command,m.args])}).bind(this)),this.oldMacro=this.macro,this.macro=[],this.on("exec",this.$addCommandToMacro),this.recording=!0)},d.prototype.replay=function(p){if(!(this.$inReplay||!this.macro)){if(this.recording)return this.toggleRecording(p);try{this.$inReplay=!0,this.macro.forEach(function(m){typeof m=="string"?this.exec(m,p):this.exec(m[0],p,m[1])},this)}finally{this.$inReplay=!1}}},d.prototype.trimMacro=function(p){return p.map(function(m){return typeof m[0]!="string"&&(m[0]=m[0].name),m[1]||(m=m[0]),m})},d}(a);s.implement(c.prototype,l),r.CommandManager=c}),ace.define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"],function(n,r,i){var o=n("../lib/lang"),s=n("../config"),a=n("../range").Range;function l(u,d){return{win:u,mac:d}}r.commands=[{name:"showSettingsMenu",description:"Show settings menu",bindKey:l("Ctrl-,","Command-,"),exec:function(u){s.loadModule("ace/ext/settings_menu",function(d){d.init(u),u.showSettingsMenu()})},readOnly:!0},{name:"goToNextError",description:"Go to next error",bindKey:l("Alt-E","F4"),exec:function(u){s.loadModule("ace/ext/error_marker",function(d){d.showErrorMarker(u,1)})},scrollIntoView:"animate",readOnly:!0},{name:"goToPreviousError",description:"Go to previous error",bindKey:l("Alt-Shift-E","Shift-F4"),exec:function(u){s.loadModule("ace/ext/error_marker",function(d){d.showErrorMarker(u,-1)})},scrollIntoView:"animate",readOnly:!0},{name:"selectall",description:"Select all",bindKey:l("Ctrl-A","Command-A"),exec:function(u){u.selectAll()},readOnly:!0},{name:"centerselection",description:"Center selection",bindKey:l(null,"Ctrl-L"),exec:function(u){u.centerSelection()},readOnly:!0},{name:"gotoline",description:"Go to line...",bindKey:l("Ctrl-L","Command-L"),exec:function(u,d){typeof d=="number"&&!isNaN(d)&&u.gotoLine(d),u.prompt({$type:"gotoLine"})},readOnly:!0},{name:"fold",bindKey:l("Alt-L|Ctrl-F1","Command-Alt-L|Command-F1"),exec:function(u){u.session.toggleFold(!1)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"unfold",bindKey:l("Alt-Shift-L|Ctrl-Shift-F1","Command-Alt-Shift-L|Command-Shift-F1"),exec:function(u){u.session.toggleFold(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleFoldWidget",description:"Toggle fold widget",bindKey:l("F2","F2"),exec:function(u){u.session.toggleFoldWidget()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleParentFoldWidget",description:"Toggle parent fold widget",bindKey:l("Alt-F2","Alt-F2"),exec:function(u){u.session.toggleFoldWidget(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"foldall",description:"Fold all",bindKey:l(null,"Ctrl-Command-Option-0"),exec:function(u){u.session.foldAll()},scrollIntoView:"center",readOnly:!0},{name:"foldAllComments",description:"Fold all comments",bindKey:l(null,"Ctrl-Command-Option-0"),exec:function(u){u.session.foldAllComments()},scrollIntoView:"center",readOnly:!0},{name:"foldOther",description:"Fold other",bindKey:l("Alt-0","Command-Option-0"),exec:function(u){u.session.foldAll(),u.session.unfold(u.selection.getAllRanges())},scrollIntoView:"center",readOnly:!0},{name:"unfoldall",description:"Unfold all",bindKey:l("Alt-Shift-0","Command-Option-Shift-0"),exec:function(u){u.session.unfold()},scrollIntoView:"center",readOnly:!0},{name:"findnext",description:"Find next",bindKey:l("Ctrl-K","Command-G"),exec:function(u){u.findNext()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"findprevious",description:"Find previous",bindKey:l("Ctrl-Shift-K","Command-Shift-G"),exec:function(u){u.findPrevious()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"selectOrFindNext",description:"Select or find next",bindKey:l("Alt-K","Ctrl-G"),exec:function(u){u.selection.isEmpty()?u.selection.selectWord():u.findNext()},readOnly:!0},{name:"selectOrFindPrevious",description:"Select or find previous",bindKey:l("Alt-Shift-K","Ctrl-Shift-G"),exec:function(u){u.selection.isEmpty()?u.selection.selectWord():u.findPrevious()},readOnly:!0},{name:"find",description:"Find",bindKey:l("Ctrl-F","Command-F"),exec:function(u){s.loadModule("ace/ext/searchbox",function(d){d.Search(u)})},readOnly:!0},{name:"overwrite",description:"Overwrite",bindKey:"Insert",exec:function(u){u.toggleOverwrite()},readOnly:!0},{name:"selecttostart",description:"Select to start",bindKey:l("Ctrl-Shift-Home","Command-Shift-Home|Command-Shift-Up"),exec:function(u){u.getSelection().selectFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotostart",description:"Go to start",bindKey:l("Ctrl-Home","Command-Home|Command-Up"),exec:function(u){u.navigateFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectup",description:"Select up",bindKey:l("Shift-Up","Shift-Up|Ctrl-Shift-P"),exec:function(u){u.getSelection().selectUp()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golineup",description:"Go line up",bindKey:l("Up","Up|Ctrl-P"),exec:function(u,d){u.navigateUp(d.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttoend",description:"Select to end",bindKey:l("Ctrl-Shift-End","Command-Shift-End|Command-Shift-Down"),exec:function(u){u.getSelection().selectFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotoend",description:"Go to end",bindKey:l("Ctrl-End","Command-End|Command-Down"),exec:function(u){u.navigateFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectdown",description:"Select down",bindKey:l("Shift-Down","Shift-Down|Ctrl-Shift-N"),exec:function(u){u.getSelection().selectDown()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golinedown",description:"Go line down",bindKey:l("Down","Down|Ctrl-N"),exec:function(u,d){u.navigateDown(d.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordleft",description:"Select word left",bindKey:l("Ctrl-Shift-Left","Option-Shift-Left"),exec:function(u){u.getSelection().selectWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordleft",description:"Go to word left",bindKey:l("Ctrl-Left","Option-Left"),exec:function(u){u.navigateWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolinestart",description:"Select to line start",bindKey:l("Alt-Shift-Left","Command-Shift-Left|Ctrl-Shift-A"),exec:function(u){u.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolinestart",description:"Go to line start",bindKey:l("Alt-Left|Home","Command-Left|Home|Ctrl-A"),exec:function(u){u.navigateLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectleft",description:"Select left",bindKey:l("Shift-Left","Shift-Left|Ctrl-Shift-B"),exec:function(u){u.getSelection().selectLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoleft",description:"Go to left",bindKey:l("Left","Left|Ctrl-B"),exec:function(u,d){u.navigateLeft(d.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordright",description:"Select word right",bindKey:l("Ctrl-Shift-Right","Option-Shift-Right"),exec:function(u){u.getSelection().selectWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordright",description:"Go to word right",bindKey:l("Ctrl-Right","Option-Right"),exec:function(u){u.navigateWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolineend",description:"Select to line end",bindKey:l("Alt-Shift-Right","Command-Shift-Right|Shift-End|Ctrl-Shift-E"),exec:function(u){u.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolineend",description:"Go to line end",bindKey:l("Alt-Right|End","Command-Right|End|Ctrl-E"),exec:function(u){u.navigateLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectright",description:"Select right",bindKey:l("Shift-Right","Shift-Right"),exec:function(u){u.getSelection().selectRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoright",description:"Go to right",bindKey:l("Right","Right|Ctrl-F"),exec:function(u,d){u.navigateRight(d.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectpagedown",description:"Select page down",bindKey:"Shift-PageDown",exec:function(u){u.selectPageDown()},readOnly:!0},{name:"pagedown",description:"Page down",bindKey:l(null,"Option-PageDown"),exec:function(u){u.scrollPageDown()},readOnly:!0},{name:"gotopagedown",description:"Go to page down",bindKey:l("PageDown","PageDown|Ctrl-V"),exec:function(u){u.gotoPageDown()},readOnly:!0},{name:"selectpageup",description:"Select page up",bindKey:"Shift-PageUp",exec:function(u){u.selectPageUp()},readOnly:!0},{name:"pageup",description:"Page up",bindKey:l(null,"Option-PageUp"),exec:function(u){u.scrollPageUp()},readOnly:!0},{name:"gotopageup",description:"Go to page up",bindKey:"PageUp",exec:function(u){u.gotoPageUp()},readOnly:!0},{name:"scrollup",description:"Scroll up",bindKey:l("Ctrl-Up",null),exec:function(u){u.renderer.scrollBy(0,-2*u.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",description:"Scroll down",bindKey:l("Ctrl-Down",null),exec:function(u){u.renderer.scrollBy(0,2*u.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"selectlinestart",description:"Select line start",bindKey:"Shift-Home",exec:function(u){u.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectlineend",description:"Select line end",bindKey:"Shift-End",exec:function(u){u.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"togglerecording",description:"Toggle recording",bindKey:l("Ctrl-Alt-E","Command-Option-E"),exec:function(u){u.commands.toggleRecording(u)},readOnly:!0},{name:"replaymacro",description:"Replay macro",bindKey:l("Ctrl-Shift-E","Command-Shift-E"),exec:function(u){u.commands.replay(u)},readOnly:!0},{name:"jumptomatching",description:"Jump to matching",bindKey:l("Ctrl-\\|Ctrl-P","Command-\\"),exec:function(u){u.jumpToMatching()},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"selecttomatching",description:"Select to matching",bindKey:l("Ctrl-Shift-\\|Ctrl-Shift-P","Command-Shift-\\"),exec:function(u){u.jumpToMatching(!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"expandToMatching",description:"Expand to matching",bindKey:l("Ctrl-Shift-M","Ctrl-Shift-M"),exec:function(u){u.jumpToMatching(!0,!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"passKeysToBrowser",description:"Pass keys to browser",bindKey:l(null,null),exec:function(){},passEvent:!0,readOnly:!0},{name:"copy",description:"Copy",exec:function(u){},readOnly:!0},{name:"cut",description:"Cut",exec:function(u){var d=u.$copyWithEmptySelection&&u.selection.isEmpty(),p=d?u.selection.getLineRange():u.selection.getRange();u._emit("cut",p),p.isEmpty()||u.session.remove(p),u.clearSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"paste",description:"Paste",exec:function(u,d){u.$handlePaste(d)},scrollIntoView:"cursor"},{name:"removeline",description:"Remove line",bindKey:l("Ctrl-D","Command-D"),exec:function(u){u.removeLines()},scrollIntoView:"cursor",multiSelectAction:"forEachLine"},{name:"duplicateSelection",description:"Duplicate selection",bindKey:l("Ctrl-Shift-D","Command-Shift-D"),exec:function(u){u.duplicateSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"sortlines",description:"Sort lines",bindKey:l("Ctrl-Alt-S","Command-Alt-S"),exec:function(u){u.sortLines()},scrollIntoView:"selection",multiSelectAction:"forEachLine"},{name:"togglecomment",description:"Toggle comment",bindKey:l("Ctrl-/","Command-/"),exec:function(u){u.toggleCommentLines()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"toggleBlockComment",description:"Toggle block comment",bindKey:l("Ctrl-Shift-/","Command-Shift-/"),exec:function(u){u.toggleBlockComment()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"modifyNumberUp",description:"Modify number up",bindKey:l("Ctrl-Shift-Up","Alt-Shift-Up"),exec:function(u){u.modifyNumber(1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"modifyNumberDown",description:"Modify number down",bindKey:l("Ctrl-Shift-Down","Alt-Shift-Down"),exec:function(u){u.modifyNumber(-1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"replace",description:"Replace",bindKey:l("Ctrl-H","Command-Option-F"),exec:function(u){s.loadModule("ace/ext/searchbox",function(d){d.Search(u,!0)})}},{name:"undo",description:"Undo",bindKey:l("Ctrl-Z","Command-Z"),exec:function(u){u.undo()}},{name:"redo",description:"Redo",bindKey:l("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(u){u.redo()}},{name:"copylinesup",description:"Copy lines up",bindKey:l("Alt-Shift-Up","Command-Option-Up"),exec:function(u){u.copyLinesUp()},scrollIntoView:"cursor"},{name:"movelinesup",description:"Move lines up",bindKey:l("Alt-Up","Option-Up"),exec:function(u){u.moveLinesUp()},scrollIntoView:"cursor"},{name:"copylinesdown",description:"Copy lines down",bindKey:l("Alt-Shift-Down","Command-Option-Down"),exec:function(u){u.copyLinesDown()},scrollIntoView:"cursor"},{name:"movelinesdown",description:"Move lines down",bindKey:l("Alt-Down","Option-Down"),exec:function(u){u.moveLinesDown()},scrollIntoView:"cursor"},{name:"del",description:"Delete",bindKey:l("Delete","Delete|Ctrl-D|Shift-Delete"),exec:function(u){u.remove("right")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"backspace",description:"Backspace",bindKey:l("Shift-Backspace|Backspace","Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),exec:function(u){u.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"cut_or_delete",description:"Cut or delete",bindKey:l("Shift-Delete",null),exec:function(u){if(u.selection.isEmpty())u.remove("left");else return!1},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestart",description:"Remove to line start",bindKey:l("Alt-Backspace","Command-Backspace"),exec:function(u){u.removeToLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineend",description:"Remove to line end",bindKey:l("Alt-Delete","Ctrl-K|Command-Delete"),exec:function(u){u.removeToLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestarthard",description:"Remove to line start hard",bindKey:l("Ctrl-Shift-Backspace",null),exec:function(u){var d=u.selection.getRange();d.start.column=0,u.session.remove(d)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineendhard",description:"Remove to line end hard",bindKey:l("Ctrl-Shift-Delete",null),exec:function(u){var d=u.selection.getRange();d.end.column=Number.MAX_VALUE,u.session.remove(d)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordleft",description:"Remove word left",bindKey:l("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(u){u.removeWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordright",description:"Remove word right",bindKey:l("Ctrl-Delete","Alt-Delete"),exec:function(u){u.removeWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"outdent",description:"Outdent",bindKey:l("Shift-Tab","Shift-Tab"),exec:function(u){u.blockOutdent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"indent",description:"Indent",bindKey:l("Tab","Tab"),exec:function(u){u.indent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"blockoutdent",description:"Block outdent",bindKey:l("Ctrl-[","Ctrl-["),exec:function(u){u.blockOutdent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"blockindent",description:"Block indent",bindKey:l("Ctrl-]","Ctrl-]"),exec:function(u){u.blockIndent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"insertstring",description:"Insert string",exec:function(u,d){u.insert(d)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"inserttext",description:"Insert text",exec:function(u,d){u.insert(o.stringRepeat(d.text||"",d.times||1))},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"splitline",description:"Split line",bindKey:l(null,"Ctrl-O"),exec:function(u){u.splitLine()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"transposeletters",description:"Transpose letters",bindKey:l("Alt-Shift-X","Ctrl-T"),exec:function(u){u.transposeLetters()},multiSelectAction:function(u){u.transposeSelections(1)},scrollIntoView:"cursor"},{name:"touppercase",description:"To uppercase",bindKey:l("Ctrl-U","Ctrl-U"),exec:function(u){u.toUpperCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"tolowercase",description:"To lowercase",bindKey:l("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(u){u.toLowerCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"autoindent",description:"Auto Indent",bindKey:l(null,null),exec:function(u){u.autoIndent()},scrollIntoView:"animate"},{name:"expandtoline",description:"Expand to line",bindKey:l("Ctrl-Shift-L","Command-Shift-L"),exec:function(u){var d=u.selection.getRange();d.start.column=d.end.column=0,d.end.row++,u.selection.setRange(d,!1)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"openlink",bindKey:l("Ctrl+F3","F3"),exec:function(u){u.openLink()}},{name:"joinlines",description:"Join lines",bindKey:l(null,null),exec:function(u){for(var d=u.selection.isBackwards(),p=d?u.selection.getSelectionLead():u.selection.getSelectionAnchor(),m=d?u.selection.getSelectionAnchor():u.selection.getSelectionLead(),y=u.session.doc.getLine(p.row).length,w=u.session.doc.getTextRange(u.selection.getRange()),x=w.replace(/\n\s*/," ").length,C=u.session.doc.getLine(p.row),S=p.row+1;S<=m.row+1;S++){var M=o.stringTrimLeft(o.stringTrimRight(u.session.doc.getLine(S)));M.length!==0&&(M=" "+M),C+=M}m.row+10?(u.selection.moveCursorTo(p.row,p.column),u.selection.selectTo(p.row,p.column+x)):(y=u.session.doc.getLine(p.row).length>y?y+1:y,u.selection.moveCursorTo(p.row,y))},multiSelectAction:"forEach",readOnly:!0},{name:"invertSelection",description:"Invert selection",bindKey:l(null,null),exec:function(u){var d=u.session.doc.getLength()-1,p=u.session.doc.getLine(d).length,m=u.selection.rangeList.ranges,y=[];m.length<1&&(m=[u.selection.getRange()]);for(var w=0;w0||u+d=0&&this.$isCustomWidgetVisible(u-d))return u-d;if(u+d<=this.lines.getLength()-1&&this.$isCustomWidgetVisible(u+d))return u+d;if(u-d>=0&&this.$isFoldWidgetVisible(u-d))return u-d;if(u+d<=this.lines.getLength()-1&&this.$isFoldWidgetVisible(u+d))return u+d}return null},c.prototype.$findNearestAnnotation=function(u){if(this.$isAnnotationVisible(u))return u;for(var d=0;u-d>0||u+d=0&&this.$isAnnotationVisible(u-d))return u-d;if(u+d<=this.lines.getLength()-1&&this.$isAnnotationVisible(u+d))return u+d}return null},c.prototype.$focusFoldWidget=function(u){if(u!=null){var d=this.$getFoldWidget(u);d.classList.add(this.editor.renderer.keyboardFocusClassName),d.focus()}},c.prototype.$focusCustomWidget=function(u){if(u!=null){var d=this.$getCustomWidget(u);d&&(d.classList.add(this.editor.renderer.keyboardFocusClassName),d.focus())}},c.prototype.$focusAnnotation=function(u){if(u!=null){var d=this.$getAnnotation(u);d.classList.add(this.editor.renderer.keyboardFocusClassName),d.focus()}},c.prototype.$blurFoldWidget=function(u){var d=this.$getFoldWidget(u);d.classList.remove(this.editor.renderer.keyboardFocusClassName),d.blur()},c.prototype.$blurCustomWidget=function(u){var d=this.$getCustomWidget(u);d&&(d.classList.remove(this.editor.renderer.keyboardFocusClassName),d.blur())},c.prototype.$blurAnnotation=function(u){var d=this.$getAnnotation(u);d.classList.remove(this.editor.renderer.keyboardFocusClassName),d.blur()},c.prototype.$moveFoldWidgetUp=function(){for(var u=this.activeRowIndex;u>0;)if(u--,this.$isFoldWidgetVisible(u)||this.$isCustomWidgetVisible(u)){this.$blurFoldWidget(this.activeRowIndex),this.$blurCustomWidget(this.activeRowIndex),this.activeRowIndex=u,this.$isFoldWidgetVisible(u)?this.$focusFoldWidget(this.activeRowIndex):this.$focusCustomWidget(this.activeRowIndex);return}},c.prototype.$moveFoldWidgetDown=function(){for(var u=this.activeRowIndex;u0;)if(u--,this.$isAnnotationVisible(u)){this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=u,this.$focusAnnotation(this.activeRowIndex);return}},c.prototype.$moveAnnotationDown=function(){for(var u=this.activeRowIndex;u=j.length&&(j=void 0),{value:j&&j[Q++],done:!j}}};throw new TypeError(G?"Object is not iterable.":"Symbol.iterator is not defined.")},s=n("./lib/oop"),a=n("./lib/dom"),l=n("./lib/lang"),c=n("./lib/useragent"),u=n("./keyboard/textinput").TextInput,d=n("./mouse/mouse_handler").MouseHandler,p=n("./mouse/fold_handler").FoldHandler,m=n("./keyboard/keybinding").KeyBinding,y=n("./edit_session").EditSession,w=n("./search").Search,x=n("./range").Range,C=n("./lib/event_emitter").EventEmitter,S=n("./commands/command_manager").CommandManager,M=n("./commands/default_commands").commands,E=n("./config"),A=n("./token_iterator").TokenIterator,I=n("./keyboard/gutter_handler").GutterKeyboardHandler,O=n("./config").nls,z=n("./clipboard"),$=n("./lib/keys"),W=n("./lib/event"),J=n("./tooltip").HoverTooltip,Z=function(){function j(G,U,Q){this.id="editor"+ ++j.$uid,this.session,this.$toDestroy=[];var re=G.getContainerElement();this.container=re,this.renderer=G,this.commands=new S(c.isMac?"mac":"win",M),typeof document=="object"&&(this.textInput=new u(G.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.$mouseHandler=new d(this),new p(this)),this.keyBinding=new m(this),this.$search=new w().set({wrap:!0}),this.$historyTracker=this.$historyTracker.bind(this),this.commands.on("exec",this.$historyTracker),this.$initOperationListeners(),this._$emitInputEvent=l.delayedCall((function(){this._signal("input",{}),this.session&&!this.session.destroyed&&this.session.bgTokenizer.scheduleStart()}).bind(this)),this.on("change",function(le,oe){oe._$emitInputEvent.schedule(31)}),this.setSession(U||Q&&Q.session||new y("")),E.resetOptions(this),Q&&this.setOptions(Q),E._signal("editor",this)}return j.prototype.$initOperationListeners=function(){this.commands.on("exec",this.startOperation.bind(this),!0),this.commands.on("afterExec",this.endOperation.bind(this),!0)},j.prototype.startOperation=function(G){this.session.startOperation(G)},j.prototype.endOperation=function(G){this.session.endOperation(G)},j.prototype.onStartOperation=function(G){this.curOp=this.session.curOp,this.curOp.scrollTop=this.renderer.scrollTop,this.prevOp=this.session.prevOp,G||(this.previousCommand=null)},j.prototype.onEndOperation=function(G){if(this.curOp&&this.session){if(G&&G.returnValue===!1){this.curOp=null;return}if(this._signal("beforeEndOperation"),!this.curOp)return;var U=this.curOp.command,Q=U&&U.scrollIntoView;if(Q){switch(Q){case"center-animate":Q="animate";case"center":this.renderer.scrollCursorIntoView(null,.5);break;case"animate":case"cursor":this.renderer.scrollCursorIntoView();break;case"selectionPart":var re=this.selection.getRange(),le=this.renderer.layerConfig;(re.start.row>=le.lastRow||re.end.row<=le.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead);break}Q=="animate"&&this.renderer.animateScrolling(this.curOp.scrollTop)}this.$lastSel=this.session.selection.toJSON(),this.prevOp=this.curOp,this.curOp=null}},j.prototype.$historyTracker=function(G){if(this.$mergeUndoDeltas){var U=this.prevOp,Q=this.$mergeableCommands,re=U.command&&G.command.name==U.command.name;if(G.command.name=="insertstring"){var le=G.args;this.mergeNextCommand===void 0&&(this.mergeNextCommand=!0),re=re&&this.mergeNextCommand&&(!/\s/.test(le)||/\s/.test(U.args)),this.mergeNextCommand=!0}else re=re&&Q.indexOf(G.command.name)!==-1;this.$mergeUndoDeltas!="always"&&Date.now()-this.sequenceStartTime>2e3&&(re=!1),re?this.session.mergeUndoDeltas=!0:Q.indexOf(G.command.name)!==-1&&(this.sequenceStartTime=Date.now())}},j.prototype.setKeyboardHandler=function(G,U){if(G&&typeof G=="string"&&G!="ace"){this.$keybindingId=G;var Q=this;E.loadModule(["keybinding",G],function(re){Q.$keybindingId==G&&Q.keyBinding.setKeyboardHandler(re&&re.handler),U&&U()})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(G),U&&U()},j.prototype.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},j.prototype.setSession=function(G){if(this.session!=G){this.curOp&&this.endOperation(),this.curOp={};var U=this.session;if(U){this.session.off("change",this.$onDocumentChange),this.session.off("changeMode",this.$onChangeMode),this.session.off("tokenizerUpdate",this.$onTokenizerUpdate),this.session.off("changeTabSize",this.$onChangeTabSize),this.session.off("changeWrapLimit",this.$onChangeWrapLimit),this.session.off("changeWrapMode",this.$onChangeWrapMode),this.session.off("changeFold",this.$onChangeFold),this.session.off("changeFrontMarker",this.$onChangeFrontMarker),this.session.off("changeBackMarker",this.$onChangeBackMarker),this.session.off("changeBreakpoint",this.$onChangeBreakpoint),this.session.off("changeAnnotation",this.$onChangeAnnotation),this.session.off("changeOverwrite",this.$onCursorChange),this.session.off("changeScrollTop",this.$onScrollTopChange),this.session.off("changeScrollLeft",this.$onScrollLeftChange),this.session.off("startOperation",this.$onStartOperation),this.session.off("endOperation",this.$onEndOperation);var Q=this.session.getSelection();Q.off("changeCursor",this.$onCursorChange),Q.off("changeSelection",this.$onSelectionChange)}this.session=G,G?(this.$onDocumentChange=this.onDocumentChange.bind(this),G.on("change",this.$onDocumentChange),this.renderer.setSession(G),this.$onChangeMode=this.onChangeMode.bind(this),G.on("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),G.on("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),G.on("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),G.on("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),G.on("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),G.on("changeFold",this.$onChangeFold),this.$onChangeFrontMarker=this.onChangeFrontMarker.bind(this),this.session.on("changeFrontMarker",this.$onChangeFrontMarker),this.$onChangeBackMarker=this.onChangeBackMarker.bind(this),this.session.on("changeBackMarker",this.$onChangeBackMarker),this.$onChangeBreakpoint=this.onChangeBreakpoint.bind(this),this.session.on("changeBreakpoint",this.$onChangeBreakpoint),this.$onChangeAnnotation=this.onChangeAnnotation.bind(this),this.session.on("changeAnnotation",this.$onChangeAnnotation),this.$onCursorChange=this.onCursorChange.bind(this),this.session.on("changeOverwrite",this.$onCursorChange),this.$onScrollTopChange=this.onScrollTopChange.bind(this),this.session.on("changeScrollTop",this.$onScrollTopChange),this.$onScrollLeftChange=this.onScrollLeftChange.bind(this),this.session.on("changeScrollLeft",this.$onScrollLeftChange),this.selection=G.getSelection(),this.selection.on("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.$onStartOperation=this.onStartOperation.bind(this),this.session.on("startOperation",this.$onStartOperation),this.$onEndOperation=this.onEndOperation.bind(this),this.session.on("endOperation",this.$onEndOperation),this.onChangeMode(),this.onCursorChange(),this.onScrollTopChange(),this.onScrollLeftChange(),this.onSelectionChange(),this.onChangeFrontMarker(),this.onChangeBackMarker(),this.onChangeBreakpoint(),this.onChangeAnnotation(),this.session.getUseWrapMode()&&this.renderer.adjustWrapLimit(),this.renderer.updateFull()):(this.selection=null,this.renderer.setSession(G)),this._signal("changeSession",{session:G,oldSession:U}),this.curOp=null,U&&U._signal("changeEditor",{oldEditor:this}),U&&(U.$editor=null),G&&G._signal("changeEditor",{editor:this}),G&&(G.$editor=this),G&&!G.destroyed&&G.bgTokenizer.scheduleStart()}},j.prototype.getSession=function(){return this.session},j.prototype.setValue=function(G,U){return this.session.doc.setValue(G),U?U==1?this.navigateFileEnd():U==-1&&this.navigateFileStart():this.selectAll(),G},j.prototype.getValue=function(){return this.session.getValue()},j.prototype.getSelection=function(){return this.selection},j.prototype.resize=function(G){this.renderer.onResize(G)},j.prototype.setTheme=function(G,U){this.renderer.setTheme(G,U)},j.prototype.getTheme=function(){return this.renderer.getTheme()},j.prototype.setStyle=function(G,U){this.renderer.setStyle(G,U)},j.prototype.unsetStyle=function(G){this.renderer.unsetStyle(G)},j.prototype.getFontSize=function(){return this.getOption("fontSize")||a.computedStyle(this.container).fontSize},j.prototype.setFontSize=function(G){this.setOption("fontSize",G)},j.prototype.$highlightBrackets=function(){if(!this.$highlightPending){var G=this;this.$highlightPending=!0,setTimeout(function(){G.$highlightPending=!1;var U=G.session;if(!(!U||U.destroyed)){U.$bracketHighlight&&(U.$bracketHighlight.markerIds.forEach(function(Oe){U.removeMarker(Oe)}),U.$bracketHighlight=null);var Q=G.getCursorPosition(),re=G.getKeyboardHandler(),le=re&&re.$getDirectionForHighlight&&re.$getDirectionForHighlight(G),oe=U.getMatchingBracketRanges(Q,le);if(!oe){var he=new A(U,Q.row,Q.column),xe=he.getCurrentToken();if(xe&&/\b(?:tag-open|tag-name)/.test(xe.type)){var Ee=U.getMatchingTags(Q);Ee&&(oe=[Ee.openTagName.isEmpty()?Ee.openTag:Ee.openTagName,Ee.closeTagName.isEmpty()?Ee.closeTag:Ee.closeTagName])}}if(!oe&&U.$mode.getMatching&&(oe=U.$mode.getMatching(G.session)),!oe){G.getHighlightIndentGuides()&&G.renderer.$textLayer.$highlightIndentGuide();return}var Ie="ace_bracket";Array.isArray(oe)?oe.length==1&&(Ie="ace_error_bracket"):oe=[oe],oe.length==2&&(x.comparePoints(oe[0].end,oe[1].start)==0?oe=[x.fromPoints(oe[0].start,oe[1].end)]:x.comparePoints(oe[0].start,oe[1].end)==0&&(oe=[x.fromPoints(oe[1].start,oe[0].end)])),U.$bracketHighlight={ranges:oe,markerIds:oe.map(function(Oe){return U.addMarker(Oe,Ie,"text")})},G.getHighlightIndentGuides()&&G.renderer.$textLayer.$highlightIndentGuide()}},50)}},j.prototype.focus=function(){this.textInput.focus()},j.prototype.isFocused=function(){return this.textInput.isFocused()},j.prototype.blur=function(){this.textInput.blur()},j.prototype.onFocus=function(G){this.$isFocused||(this.$isFocused=!0,this.renderer.showCursor(),this.renderer.visualizeFocus(),this._emit("focus",G))},j.prototype.onBlur=function(G){this.$isFocused&&(this.$isFocused=!1,this.renderer.hideCursor(),this.renderer.visualizeBlur(),this._emit("blur",G))},j.prototype.$cursorChange=function(){this.renderer.updateCursor(),this.$highlightBrackets(),this.$updateHighlightActiveLine()},j.prototype.onDocumentChange=function(G){var U=this.session.$useWrapMode,Q=G.start.row==G.end.row?G.end.row:1/0;this.renderer.updateLines(G.start.row,Q,U),this._signal("change",G),this.$cursorChange()},j.prototype.onTokenizerUpdate=function(G){var U=G.data;this.renderer.updateLines(U.first,U.last)},j.prototype.onScrollTopChange=function(){this.renderer.scrollToY(this.session.getScrollTop())},j.prototype.onScrollLeftChange=function(){this.renderer.scrollToX(this.session.getScrollLeft())},j.prototype.onCursorChange=function(){this.$cursorChange(),this._signal("changeSelection")},j.prototype.$updateHighlightActiveLine=function(){var G=this.getSession(),U;if(this.$highlightActiveLine&&((this.$selectionStyle!="line"||!this.selection.isMultiLine())&&(U=this.getCursorPosition()),this.renderer.theme&&this.renderer.theme.$selectionColorConflict&&!this.selection.isEmpty()&&(U=!1),this.renderer.$maxLines&&this.session.getLength()===1&&!(this.renderer.$minLines>1)&&(U=!1)),G.$highlightLineMarker&&!U)G.removeMarker(G.$highlightLineMarker.id),G.$highlightLineMarker=null;else if(!G.$highlightLineMarker&&U){var Q=new x(U.row,U.column,U.row,1/0);Q.id=G.addMarker(Q,"ace_active-line","screenLine"),G.$highlightLineMarker=Q}else U&&(G.$highlightLineMarker.start.row=U.row,G.$highlightLineMarker.end.row=U.row,G.$highlightLineMarker.start.column=U.column,G._signal("changeBackMarker"))},j.prototype.onSelectionChange=function(G){var U=this.session;if(U.$selectionMarker&&U.removeMarker(U.$selectionMarker),U.$selectionMarker=null,this.selection.isEmpty())this.$updateHighlightActiveLine();else{var Q=this.selection.getRange(),re=this.getSelectionStyle();U.$selectionMarker=U.addMarker(Q,"ace_selection",re)}var le=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(le),this._signal("changeSelection")},j.prototype.$getSelectionHighLightRegexp=function(){var G=this.session,U=this.getSelectionRange();if(!(U.isEmpty()||U.isMultiLine())){var Q=U.start.column,re=U.end.column,le=G.getLine(U.start.row),oe=le.substring(Q,re);if(!(oe.length>5e3||!/[\w\d]/.test(oe))){var he=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:oe}),xe=le.substring(Q-1,re+1);if(he.test(xe))return he}}},j.prototype.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},j.prototype.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},j.prototype.onChangeBreakpoint=function(){this.renderer.updateBreakpoints()},j.prototype.onChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},j.prototype.onChangeMode=function(G){this.renderer.updateText(),this._emit("changeMode",G)},j.prototype.onChangeWrapLimit=function(){this.renderer.updateFull()},j.prototype.onChangeWrapMode=function(){this.renderer.onResize(!0)},j.prototype.onChangeFold=function(){this.$updateHighlightActiveLine(),this.renderer.updateFull()},j.prototype.getSelectedText=function(){return this.session.getTextRange(this.getSelectionRange())},j.prototype.getCopyText=function(){var G=this.getSelectedText(),U=this.session.doc.getNewLineCharacter(),Q=!1;if(!G&&this.$copyWithEmptySelection){Q=!0;for(var re=this.selection.getAllRanges(),le=0;leOe.search(/\S|$/)){var xe=Oe.substr(le.column).search(/\S|$/);Q.doc.removeInLine(le.row,le.column,le.column+xe)}}this.clearSelection();var Ee=le.column,Ie=Q.getState(le.row),Oe=Q.getLine(le.row),$e=re.checkOutdent(Ie,Oe,G);if(Q.insert(le,G),oe&&oe.selection&&(oe.selection.length==2?this.selection.setSelectionRange(new x(le.row,Ee+oe.selection[0],le.row,Ee+oe.selection[1])):this.selection.setSelectionRange(new x(le.row+oe.selection[0],oe.selection[1],le.row+oe.selection[2],oe.selection[3]))),this.$enableAutoIndent){if(Q.getDocument().isNewLine(G)){var Ze=re.getNextLineIndent(Ie,Oe.slice(0,le.column),Q.getTabString());Q.insert({row:le.row+1,column:0},Ze)}$e&&re.autoOutdent(Ie,Q,le.row)}},j.prototype.autoIndent=function(){for(var G=this.session,U=G.getMode(),Q=this.selection.isEmpty()?[new x(0,0,G.doc.getLength()-1,0)]:this.selection.getAllRanges(),re="",le="",oe="",he=G.getTabString(),xe=0;xe0&&(re=G.getState(Oe-1),le=G.getLine(Oe-1),oe=U.getNextLineIndent(re,le,he));var $e=G.getLine(Oe),Ze=U.$getIndent($e);if(oe!==Ze){if(Ze.length>0){var lt=new x(Oe,0,Oe,Ze.length);G.remove(lt)}oe.length>0&&G.insert({row:Oe,column:0},oe)}U.autoOutdent(re,G,Oe)}},j.prototype.onTextInput=function(G,U){if(!U)return this.keyBinding.onTextInput(G);this.startOperation({command:{name:"insertstring"}});var Q=this.applyComposition.bind(this,G,U);this.selection.rangeCount?this.forEachSelection(Q):Q(),this.endOperation()},j.prototype.applyComposition=function(G,U){if(U.extendLeft||U.extendRight){var Q=this.selection.getRange();Q.start.column-=U.extendLeft,Q.end.column+=U.extendRight,Q.start.column<0&&(Q.start.row--,Q.start.column+=this.session.getLine(Q.start.row).length+1),this.selection.setRange(Q),!G&&!Q.isEmpty()&&this.remove()}if((G||!this.selection.isEmpty())&&this.insert(G,!0),U.restoreStart||U.restoreEnd){var Q=this.selection.getRange();Q.start.column-=U.restoreStart,Q.end.column-=U.restoreEnd,this.selection.setRange(Q)}},j.prototype.onCommandKey=function(G,U,Q){return this.keyBinding.onCommandKey(G,U,Q)},j.prototype.setOverwrite=function(G){this.session.setOverwrite(G)},j.prototype.getOverwrite=function(){return this.session.getOverwrite()},j.prototype.toggleOverwrite=function(){this.session.toggleOverwrite()},j.prototype.setScrollSpeed=function(G){this.setOption("scrollSpeed",G)},j.prototype.getScrollSpeed=function(){return this.getOption("scrollSpeed")},j.prototype.setDragDelay=function(G){this.setOption("dragDelay",G)},j.prototype.getDragDelay=function(){return this.getOption("dragDelay")},j.prototype.setSelectionStyle=function(G){this.setOption("selectionStyle",G)},j.prototype.getSelectionStyle=function(){return this.getOption("selectionStyle")},j.prototype.setHighlightActiveLine=function(G){this.setOption("highlightActiveLine",G)},j.prototype.getHighlightActiveLine=function(){return this.getOption("highlightActiveLine")},j.prototype.setHighlightGutterLine=function(G){this.setOption("highlightGutterLine",G)},j.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},j.prototype.setHighlightSelectedWord=function(G){this.setOption("highlightSelectedWord",G)},j.prototype.getHighlightSelectedWord=function(){return this.$highlightSelectedWord},j.prototype.setAnimatedScroll=function(G){this.renderer.setAnimatedScroll(G)},j.prototype.getAnimatedScroll=function(){return this.renderer.getAnimatedScroll()},j.prototype.setShowInvisibles=function(G){this.renderer.setShowInvisibles(G)},j.prototype.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},j.prototype.setDisplayIndentGuides=function(G){this.renderer.setDisplayIndentGuides(G)},j.prototype.getDisplayIndentGuides=function(){return this.renderer.getDisplayIndentGuides()},j.prototype.setHighlightIndentGuides=function(G){this.renderer.setHighlightIndentGuides(G)},j.prototype.getHighlightIndentGuides=function(){return this.renderer.getHighlightIndentGuides()},j.prototype.setShowPrintMargin=function(G){this.renderer.setShowPrintMargin(G)},j.prototype.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},j.prototype.setPrintMarginColumn=function(G){this.renderer.setPrintMarginColumn(G)},j.prototype.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},j.prototype.setReadOnly=function(G){this.setOption("readOnly",G)},j.prototype.getReadOnly=function(){return this.getOption("readOnly")},j.prototype.setBehavioursEnabled=function(G){this.setOption("behavioursEnabled",G)},j.prototype.getBehavioursEnabled=function(){return this.getOption("behavioursEnabled")},j.prototype.setWrapBehavioursEnabled=function(G){this.setOption("wrapBehavioursEnabled",G)},j.prototype.getWrapBehavioursEnabled=function(){return this.getOption("wrapBehavioursEnabled")},j.prototype.setShowFoldWidgets=function(G){this.setOption("showFoldWidgets",G)},j.prototype.getShowFoldWidgets=function(){return this.getOption("showFoldWidgets")},j.prototype.setFadeFoldWidgets=function(G){this.setOption("fadeFoldWidgets",G)},j.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},j.prototype.remove=function(G){this.selection.isEmpty()&&(G=="left"?this.selection.selectLeft():this.selection.selectRight());var U=this.getSelectionRange();if(this.getBehavioursEnabled()){var Q=this.session,re=Q.getState(U.start.row),le=Q.getMode().transformAction(re,"deletion",this,Q,U);if(U.end.column===0){var oe=Q.getTextRange(U);if(oe[oe.length-1]==` `){var he=Q.getLine(U.end.row);/^\s+$/.test(he)&&(U.end.column=he.length)}}le&&(U=le)}this.session.remove(U),this.clearSelection()},j.prototype.removeWordRight=function(){this.selection.isEmpty()&&this.selection.selectWordRight(),this.session.remove(this.getSelectionRange()),this.clearSelection()},j.prototype.removeWordLeft=function(){this.selection.isEmpty()&&this.selection.selectWordLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},j.prototype.removeToLineStart=function(){this.selection.isEmpty()&&this.selection.selectLineStart(),this.selection.isEmpty()&&this.selection.selectLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},j.prototype.removeToLineEnd=function(){this.selection.isEmpty()&&this.selection.selectLineEnd();var G=this.getSelectionRange();G.start.column==G.end.column&&G.start.row==G.end.row&&(G.end.column=0,G.end.row++),this.session.remove(G),this.clearSelection()},j.prototype.splitLine=function(){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var G=this.getCursorPosition();this.insert(` `),this.moveCursorToPosition(G)},j.prototype.setGhostText=function(G,U){this.renderer.setGhostText(G,U)},j.prototype.removeGhostText=function(){this.renderer.removeGhostText()},j.prototype.transposeLetters=function(){if(this.selection.isEmpty()){var G=this.getCursorPosition(),U=G.column;if(U!==0){var Q=this.session.getLine(G.row),re,le;Uxe.toLowerCase()?1:0});for(var le=new x(0,0,0,0),re=G.first;re<=G.last;re++){var oe=U.getLine(re);le.start.row=re,le.end.row=re,le.end.column=oe.length,U.replace(le,Q[re-G.first])}},j.prototype.toggleCommentLines=function(){var G=this.session.getState(this.getCursorPosition().row),U=this.$getSelectedRows();this.session.getMode().toggleCommentLines(G,this.session,U.first,U.last)},j.prototype.toggleBlockComment=function(){var G=this.getCursorPosition(),U=this.session.getState(G.row),Q=this.getSelectionRange();this.session.getMode().toggleBlockComment(U,this.session,Q,G)},j.prototype.getNumberAt=function(G,U){var Q=/[\-]?[0-9]+(?:\.[0-9]+)?/g;Q.lastIndex=0;for(var re=this.session.getLine(G);Q.lastIndex=U){var oe={value:le[0],start:le.index,end:le.index+le[0].length};return oe}}return null},j.prototype.modifyNumber=function(G){var U=this.selection.getCursor().row,Q=this.selection.getCursor().column,re=new x(U,Q-1,U,Q),le=this.session.getTextRange(re);if(!isNaN(parseFloat(le))&&isFinite(le)){var oe=this.getNumberAt(U,Q);if(oe){var he=oe.value.indexOf(".")>=0?oe.start+oe.value.indexOf(".")+1:oe.end,xe=oe.start+oe.value.length-he,Ee=parseFloat(oe.value);Ee*=Math.pow(10,xe),he!==oe.end&&Q=he&&oe<=xe&&(Q=hn,Ee.selection.clearSelection(),Ee.moveCursorTo(G,he+re),Ee.selection.selectTo(G,xe+re)),he=xe});for(var Ie=this.$toggleWordPairs,Oe,$e=0;$e=xe&&he<=Ee&&Ze.match(/((?:https?|ftp):\/\/[\S]+)/)){Ie=Ze.replace(/[\s:.,'";}\]]+$/,"");break}xe=Ee}}catch(lt){Q={error:lt}}finally{try{$e&&!$e.done&&(re=Oe.return)&&re.call(Oe)}finally{if(Q)throw Q.error}}return Ie},j.prototype.openLink=function(){var G=this.selection.getCursor(),U=this.findLinkAt(G.row,G.column);return U&&window.open(U,"_blank"),U!=null},j.prototype.removeLines=function(){var G=this.$getSelectedRows();this.session.removeFullLines(G.first,G.last),this.clearSelection()},j.prototype.duplicateSelection=function(){var G=this.selection,U=this.session,Q=G.getRange(),re=G.isBackwards();if(Q.isEmpty()){var le=Q.start.row;U.duplicateLines(le,le)}else{var oe=re?Q.start:Q.end,he=U.insert(oe,U.getTextRange(Q));Q.start=oe,Q.end=he,G.setSelectionRange(Q,re)}},j.prototype.moveLinesDown=function(){this.$moveLines(1,!1)},j.prototype.moveLinesUp=function(){this.$moveLines(-1,!1)},j.prototype.moveText=function(G,U,Q){return this.session.moveText(G,U,Q)},j.prototype.copyLinesUp=function(){this.$moveLines(-1,!0)},j.prototype.copyLinesDown=function(){this.$moveLines(1,!0)},j.prototype.$moveLines=function(G,U){var Q,re,le=this.selection;if(!le.inMultiSelectMode||this.inVirtualSelectionMode){var oe=le.toOrientedRange();Q=this.$getSelectedRows(oe),re=this.session.$moveLines(Q.first,Q.last,U?0:G),U&&G==-1&&(re=0),oe.moveBy(re,0),le.fromOrientedRange(oe)}else{var he=le.rangeList.ranges;le.rangeList.detach(this.session),this.inVirtualSelectionMode=!0;for(var xe=0,Ee=0,Ie=he.length,Oe=0;Oelt+1)break;lt=pt.last}for(Oe--,xe=this.session.$moveLines(Ze,lt,U?0:G),U&&G==-1&&($e=Oe+1);$e<=Oe;)he[$e].moveBy(xe,0),$e++;U||(xe=0),Ee+=xe}le.fromOrientedRange(le.ranges[0]),le.rangeList.attach(this.session),this.inVirtualSelectionMode=!1}},j.prototype.$getSelectedRows=function(G){return G=(G||this.getSelectionRange()).collapseRows(),{first:this.session.getRowFoldStart(G.start.row),last:this.session.getRowFoldEnd(G.end.row)}},j.prototype.onCompositionStart=function(G){this.renderer.showComposition(G)},j.prototype.onCompositionUpdate=function(G){this.renderer.setCompositionText(G)},j.prototype.onCompositionEnd=function(){this.renderer.hideComposition()},j.prototype.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},j.prototype.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},j.prototype.isRowVisible=function(G){return G>=this.getFirstVisibleRow()&&G<=this.getLastVisibleRow()},j.prototype.isRowFullyVisible=function(G){return G>=this.renderer.getFirstFullyVisibleRow()&&G<=this.renderer.getLastFullyVisibleRow()},j.prototype.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},j.prototype.$moveByPage=function(G,U){var Q=this.renderer,re=this.renderer.layerConfig,le=G*Math.floor(re.height/re.lineHeight);U===!0?this.selection.$moveSelection(function(){this.moveCursorBy(le,0)}):U===!1&&(this.selection.moveCursorBy(le,0),this.selection.clearSelection());var oe=Q.scrollTop;Q.scrollBy(0,le*re.lineHeight),U!=null&&Q.scrollCursorIntoView(null,.5),Q.animateScrolling(oe)},j.prototype.selectPageDown=function(){this.$moveByPage(1,!0)},j.prototype.selectPageUp=function(){this.$moveByPage(-1,!0)},j.prototype.gotoPageDown=function(){this.$moveByPage(1,!1)},j.prototype.gotoPageUp=function(){this.$moveByPage(-1,!1)},j.prototype.scrollPageDown=function(){this.$moveByPage(1)},j.prototype.scrollPageUp=function(){this.$moveByPage(-1)},j.prototype.scrollToRow=function(G){this.renderer.scrollToRow(G)},j.prototype.scrollToLine=function(G,U,Q,re){this.renderer.scrollToLine(G,U,Q,re)},j.prototype.centerSelection=function(){var G=this.getSelectionRange(),U={row:Math.floor(G.start.row+(G.end.row-G.start.row)/2),column:Math.floor(G.start.column+(G.end.column-G.start.column)/2)};this.renderer.alignCursor(U,.5)},j.prototype.getCursorPosition=function(){return this.selection.getCursor()},j.prototype.getCursorPositionScreen=function(){return this.session.documentToScreenPosition(this.getCursorPosition())},j.prototype.getSelectionRange=function(){return this.selection.getRange()},j.prototype.selectAll=function(){this.selection.selectAll()},j.prototype.clearSelection=function(){this.selection.clearSelection()},j.prototype.moveCursorTo=function(G,U){this.selection.moveCursorTo(G,U)},j.prototype.moveCursorToPosition=function(G){this.selection.moveCursorToPosition(G)},j.prototype.jumpToMatching=function(G,U){var Q=this.getCursorPosition(),re=new A(this.session,Q.row,Q.column),le=re.getCurrentToken(),oe=0;le&&le.type.indexOf("tag-name")!==-1&&(le=re.stepBackward());var he=le||re.stepForward();if(he){var xe,Ee=!1,Ie={},Oe=Q.column-he.start,$e,Ze={")":"(","(":"(","]":"[","[":"[","{":"{","}":"{"};do{if(he.value.match(/[{}()\[\]]/g)){for(;Oe1?Ie[he.value]++:le.value==="=0;--oe)this.$tryReplace(Q[oe],G)&&re++;return this.selection.setSelectionRange(le),re},j.prototype.$tryReplace=function(G,U){var Q=this.session.getTextRange(G);return U=this.$search.replace(Q,U),U!==null?(G.end=this.session.replace(G,U),G):null},j.prototype.getLastSearchOptions=function(){return this.$search.getOptions()},j.prototype.find=function(G,U,Q){U||(U={}),typeof G=="string"||G instanceof RegExp?U.needle=G:typeof G=="object"&&s.mixin(U,G);var re=this.selection.getRange();U.needle==null&&(G=this.session.getTextRange(re)||this.$search.$options.needle,G||(re=this.session.getWordRange(re.start.row,re.start.column),G=this.session.getTextRange(re)),this.$search.set({needle:G})),this.$search.set(U),U.start||this.$search.set({start:re});var le=this.$search.find(this.session);if(U.preventScroll)return le;if(le)return this.revealRange(le,Q),le;U.backwards?re.start=re.end:re.end=re.start,this.selection.setRange(re)},j.prototype.findNext=function(G,U){this.find({skipCurrent:!0,backwards:!1},G,U)},j.prototype.findPrevious=function(G,U){this.find(G,{skipCurrent:!0,backwards:!0},U)},j.prototype.revealRange=function(G,U){this.session.unfold(G),this.selection.setSelectionRange(G);var Q=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(G.start,G.end,.5),U!==!1&&this.renderer.animateScrolling(Q)},j.prototype.undo=function(){this.session.getUndoManager().undo(this.session),this.renderer.scrollCursorIntoView(null,.5)},j.prototype.redo=function(){this.session.getUndoManager().redo(this.session),this.renderer.scrollCursorIntoView(null,.5)},j.prototype.destroy=function(){this.$toDestroy&&(this.$toDestroy.forEach(function(G){G.destroy()}),this.$toDestroy=null),this.$mouseHandler&&this.$mouseHandler.destroy(),this.renderer.destroy(),this._signal("destroy",this),this.session&&this.session.destroy(),this._$emitInputEvent&&this._$emitInputEvent.cancel(),this.removeAllListeners()},j.prototype.setAutoScrollEditorIntoView=function(G){if(G){var U,Q=this,re=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement("div"));var le=this.$scrollAnchor;le.style.cssText="position:absolute",this.container.insertBefore(le,this.container.firstChild);var oe=this.on("changeSelection",function(){re=!0}),he=this.renderer.on("beforeRender",function(){re&&(U=Q.renderer.container.getBoundingClientRect())}),xe=this.renderer.on("afterRender",function(){if(re&&U&&(Q.isFocused()||Q.searchBox&&Q.searchBox.isFocused())){var Ee=Q.renderer,Ie=Ee.$cursorLayer.$pixelPos,Oe=Ee.layerConfig,$e=Ie.top-Oe.offset;Ie.top>=0&&$e+U.top<0?re=!0:Ie.topwindow.innerHeight?re=!1:re=null,re!=null&&(le.style.top=$e+"px",le.style.left=Ie.left+"px",le.style.height=Oe.lineHeight+"px",le.scrollIntoView(re)),re=U=null}});this.setAutoScrollEditorIntoView=function(Ee){Ee||(delete this.setAutoScrollEditorIntoView,this.off("changeSelection",oe),this.renderer.off("afterRender",xe),this.renderer.off("beforeRender",he))}}},j.prototype.$resetCursorStyle=function(){var G=this.$cursorStyle||"ace",U=this.renderer.$cursorLayer;U&&(U.setSmoothBlinking(/smooth/.test(G)),U.isBlinking=!this.$readOnly&&G!="wide",a.setCssClass(U.element,"ace_slim-cursors",/slim/.test(G)))},j.prototype.prompt=function(G,U,Q){var re=this;E.loadModule("ace/ext/prompt",function(le){le.prompt(re,G,U,Q)})},j}();Z.$uid=0,Z.prototype.curOp=null,Z.prototype.prevOp={},Z.prototype.$mergeableCommands=["backspace","del","insertstring"],Z.prototype.$toggleWordPairs=[["first","last"],["true","false"],["yes","no"],["width","height"],["top","bottom"],["right","left"],["on","off"],["x","y"],["get","set"],["max","min"],["horizontal","vertical"],["show","hide"],["add","remove"],["up","down"],["before","after"],["even","odd"],["in","out"],["inside","outside"],["next","previous"],["increase","decrease"],["attach","detach"],["&&","||"],["==","!="]],s.implement(Z.prototype,C),E.defineOptions(Z.prototype,"editor",{selectionStyle:{set:function(j){this.onSelectionChange(),this._signal("changeSelectionStyle",{data:j})},initialValue:"line"},highlightActiveLine:{set:function(){this.$updateHighlightActiveLine()},initialValue:!0},highlightSelectedWord:{set:function(j){this.$onSelectionChange()},initialValue:!0},readOnly:{set:function(j){var G=this;this.textInput.setReadOnly(j),this.$resetCursorStyle(),this.$readOnlyCallback||(this.$readOnlyCallback=function(Q){var re=!1;if(Q&&Q.type=="keydown"){if(re=Q&&Q.key&&Q.key.length==1&&!Q.ctrlKey&&!Q.metaKey,!re)return}else Q&&Q.type!=="exec"&&(re=!0);if(re){G.hoverTooltip||(G.hoverTooltip=new J);var le=a.createElement("div");le.textContent=O("editor.tooltip.disable-editing","Editing is disabled"),G.hoverTooltip.isOpen||G.hoverTooltip.showForRange(G,G.getSelectionRange(),le)}else G.hoverTooltip&&G.hoverTooltip.isOpen&&G.hoverTooltip.hide()});var U=this.textInput.getElement();j?(W.addListener(U,"keydown",this.$readOnlyCallback,this),this.commands.on("exec",this.$readOnlyCallback),this.commands.on("commandUnavailable",this.$readOnlyCallback)):(W.removeListener(U,"keydown",this.$readOnlyCallback),this.commands.off("exec",this.$readOnlyCallback),this.commands.off("commandUnavailable",this.$readOnlyCallback),this.hoverTooltip&&(this.hoverTooltip.destroy(),this.hoverTooltip=null))},initialValue:!1},copyWithEmptySelection:{set:function(j){this.textInput.setCopyWithEmptySelection(j)},initialValue:!1},cursorStyle:{set:function(j){this.$resetCursorStyle()},values:["ace","slim","smooth","wide"],initialValue:"ace"},mergeUndoDeltas:{values:[!1,!0,"always"],initialValue:!0},behavioursEnabled:{initialValue:!0},wrapBehavioursEnabled:{initialValue:!0},enableAutoIndent:{initialValue:!0},autoScrollEditorIntoView:{set:function(j){this.setAutoScrollEditorIntoView(j)}},keyboardHandler:{set:function(j){this.setKeyboardHandler(j)},get:function(){return this.$keybindingId},handlesSet:!0},value:{set:function(j){this.session.setValue(j)},get:function(){return this.getValue()},handlesSet:!0,hidden:!0},session:{set:function(j){this.setSession(j)},get:function(){return this.session},handlesSet:!0,hidden:!0},showLineNumbers:{set:function(j){this.renderer.$gutterLayer.setShowLineNumbers(j),this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER),j&&this.$relativeLineNumbers?q.attach(this):q.detach(this)},initialValue:!0},relativeLineNumbers:{set:function(j){this.$showLineNumbers&&j?q.attach(this):q.detach(this)}},placeholder:{set:function(j){this.$updatePlaceholder||(this.$updatePlaceholder=(function(){var G=this.session&&(this.renderer.$composition||this.session.getLength()>1||this.session.getLine(0).length>0);if(G&&this.renderer.placeholderNode)this.renderer.off("afterRender",this.$updatePlaceholder),a.removeCssClass(this.container,"ace_hasPlaceholder"),this.renderer.placeholderNode.remove(),this.renderer.placeholderNode=null;else if(!G&&!this.renderer.placeholderNode){this.renderer.on("afterRender",this.$updatePlaceholder),a.addCssClass(this.container,"ace_hasPlaceholder");var U=a.createElement("div");U.className="ace_placeholder",U.textContent=this.$placeholder||"",this.renderer.placeholderNode=U,this.renderer.content.appendChild(this.renderer.placeholderNode)}else!G&&this.renderer.placeholderNode&&(this.renderer.placeholderNode.textContent=this.$placeholder||"")}).bind(this),this.on("input",this.$updatePlaceholder)),this.$updatePlaceholder()}},enableKeyboardAccessibility:{set:function(j){var G={name:"blurTextInput",description:"Set focus to the editor content div to allow tabbing through the page",bindKey:"Esc",exec:function(re){re.blur(),re.renderer.scroller.focus()},readOnly:!0},U=function(re){if(re.target==this.renderer.scroller&&re.keyCode===$.enter){re.preventDefault();var le=this.getCursorPosition().row;this.isRowVisible(le)||this.scrollToLine(le,!0,!0),this.focus()}},Q;j?(this.renderer.enableKeyboardAccessibility=!0,this.renderer.keyboardFocusClassName="ace_keyboard-focus",this.textInput.getElement().setAttribute("tabindex",-1),this.textInput.setNumberOfExtraLines(c.isWin?3:0),this.renderer.scroller.setAttribute("tabindex",0),this.renderer.scroller.setAttribute("role","group"),this.renderer.scroller.setAttribute("aria-roledescription",O("editor.scroller.aria-roledescription","editor")),this.renderer.scroller.classList.add(this.renderer.keyboardFocusClassName),this.renderer.scroller.setAttribute("aria-label",O("editor.scroller.aria-label","Editor content, press Enter to start editing, press Escape to exit")),this.renderer.scroller.addEventListener("keyup",U.bind(this)),this.commands.addCommand(G),this.renderer.$gutter.setAttribute("tabindex",0),this.renderer.$gutter.setAttribute("aria-hidden",!1),this.renderer.$gutter.setAttribute("role","group"),this.renderer.$gutter.setAttribute("aria-roledescription",O("editor.gutter.aria-roledescription","editor gutter")),this.renderer.$gutter.setAttribute("aria-label",O("editor.gutter.aria-label","Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit")),this.renderer.$gutter.classList.add(this.renderer.keyboardFocusClassName),this.renderer.content.setAttribute("aria-hidden",!0),Q||(Q=new I(this)),Q.addListener(),this.textInput.setAriaOptions({setLabel:!0})):(this.renderer.enableKeyboardAccessibility=!1,this.textInput.getElement().setAttribute("tabindex",0),this.textInput.setNumberOfExtraLines(0),this.renderer.scroller.setAttribute("tabindex",-1),this.renderer.scroller.removeAttribute("role"),this.renderer.scroller.removeAttribute("aria-roledescription"),this.renderer.scroller.classList.remove(this.renderer.keyboardFocusClassName),this.renderer.scroller.removeAttribute("aria-label"),this.renderer.scroller.removeEventListener("keyup",U.bind(this)),this.commands.removeCommand(G),this.renderer.content.removeAttribute("aria-hidden"),this.renderer.$gutter.setAttribute("tabindex",-1),this.renderer.$gutter.setAttribute("aria-hidden",!0),this.renderer.$gutter.removeAttribute("role"),this.renderer.$gutter.removeAttribute("aria-roledescription"),this.renderer.$gutter.removeAttribute("aria-label"),this.renderer.$gutter.classList.remove(this.renderer.keyboardFocusClassName),Q&&Q.removeListener())},initialValue:!1},textInputAriaLabel:{set:function(j){this.$textInputAriaLabel=j},initialValue:""},enableMobileMenu:{set:function(j){this.$enableMobileMenu=j},initialValue:!0},customScrollbar:"renderer",hScrollBarAlwaysVisible:"renderer",vScrollBarAlwaysVisible:"renderer",highlightGutterLine:"renderer",animatedScroll:"renderer",showInvisibles:"renderer",showPrintMargin:"renderer",printMarginColumn:"renderer",printMargin:"renderer",fadeFoldWidgets:"renderer",showFoldWidgets:"renderer",displayIndentGuides:"renderer",highlightIndentGuides:"renderer",showGutter:"renderer",fontSize:"renderer",fontFamily:"renderer",maxLines:"renderer",minLines:"renderer",scrollPastEnd:"renderer",fixedWidthGutter:"renderer",theme:"renderer",hasCssTransforms:"renderer",maxPixelHeight:"renderer",useTextareaForIME:"renderer",useResizeObserver:"renderer",useSvgGutterIcons:"renderer",showFoldedAnnotations:"renderer",scrollSpeed:"$mouseHandler",dragDelay:"$mouseHandler",dragEnabled:"$mouseHandler",focusTimeout:"$mouseHandler",tooltipFollowsMouse:"$mouseHandler",firstLineNumber:"session",overwrite:"session",newLineMode:"session",useWorker:"session",useSoftTabs:"session",navigateWithinSoftTabs:"session",tabSize:"session",wrap:"session",indentedSoftWrap:"session",foldStyle:"session",mode:"session"});var q={getText:function(j,G){return(Math.abs(j.selection.lead.row-G)||G+1+(G<9?"·":""))+""},getWidth:function(j,G,U){return Math.max(G.toString().length,(U.lastRow+1).toString().length,2)*U.characterWidth},update:function(j,G){G.renderer.$loop.schedule(G.renderer.CHANGE_GUTTER)},attach:function(j){j.renderer.$gutterLayer.$renderer=this,j.on("changeSelection",this.update),this.update(null,j)},detach:function(j){j.renderer.$gutterLayer.$renderer==this&&(j.renderer.$gutterLayer.$renderer=null),j.off("changeSelection",this.update),this.update(null,j)}};r.Editor=Z}),ace.define("ace/layer/lines",["require","exports","module","ace/lib/dom"],function(n,r,i){var o=n("../lib/dom"),s=function(){function a(l,c){this.element=l,this.canvasHeight=c||5e5,this.element.style.height=this.canvasHeight*2+"px",this.cells=[],this.cellCache=[],this.$offsetCoefficient=0}return a.prototype.moveContainer=function(l){o.translate(this.element,0,-(l.firstRowScreen*l.lineHeight%this.canvasHeight)-l.offset*this.$offsetCoefficient)},a.prototype.pageChanged=function(l,c){return Math.floor(l.firstRowScreen*l.lineHeight/this.canvasHeight)!==Math.floor(c.firstRowScreen*c.lineHeight/this.canvasHeight)},a.prototype.computeLineTop=function(l,c,u){var d=c.firstRowScreen*c.lineHeight,p=Math.floor(d/this.canvasHeight),m=u.documentToScreenRow(l,0)*c.lineHeight;return m-p*this.canvasHeight},a.prototype.computeLineHeight=function(l,c,u){return c.lineHeight*u.getRowLineCount(l)},a.prototype.getLength=function(){return this.cells.length},a.prototype.get=function(l){return this.cells[l]},a.prototype.shift=function(){this.$cacheCell(this.cells.shift())},a.prototype.pop=function(){this.$cacheCell(this.cells.pop())},a.prototype.push=function(l){if(Array.isArray(l)){this.cells.push.apply(this.cells,l);for(var c=o.createFragment(this.element),u=0;uM&&(I=S.end.row+1,S=w.getNextFoldLine(I,S),M=S?S.start.row:1/0),I>C){for(;this.$lines.getLength()>A+1;)this.$lines.pop();break}E=this.$lines.get(++A),E?E.row=I:(E=this.$lines.createCell(I,y,this.session,p),this.$lines.push(E)),this.$renderCell(E,y,S,I),I++}this._signal("afterRender"),this.$updateGutterWidth(y)},m.prototype.$updateGutterWidth=function(y){var w=this.session,x=w.gutterRenderer||this.$renderer,C=w.$firstLineNumber,S=this.$lines.last()?this.$lines.last().text:"";(this.$fixedWidth||w.$useWrapMode)&&(S=w.getLength()+C-1);var M=x?x.getWidth(w,S,y):S.toString().length*y.characterWidth,E=this.$padding||this.$computePadding();M+=E.left+E.right,M!==this.gutterWidth&&!isNaN(M)&&(this.gutterWidth=M,this.element.parentNode.style.width=this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._signal("changeGutterWidth",M))},m.prototype.$updateCursorRow=function(){if(this.$highlightGutterLine){var y=this.session.selection.getCursor();this.$cursorRow!==y.row&&(this.$cursorRow=y.row)}},m.prototype.updateLineHighlight=function(){if(this.$highlightGutterLine){var y=this.session.selection.cursor.row;if(this.$cursorRow=y,!(this.$cursorCell&&this.$cursorCell.row==y)){this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ",""));var w=this.$lines.cells;this.$cursorCell=null;for(var x=0;x=this.$cursorRow){if(C.row>this.$cursorRow){var S=this.session.getFoldLine(this.$cursorRow);if(x>0&&S&&S.start.row==w[x-1].row)C=w[x-1];else break}C.element.className="ace_gutter-active-line "+C.element.className,this.$cursorCell=C;break}}}}},m.prototype.scrollLines=function(y){var w=this.config;if(this.config=y,this.$updateCursorRow(),this.$lines.pageChanged(w,y))return this.update(y);this.$lines.moveContainer(y);var x=Math.min(y.lastRow+y.gutterOffset,this.session.getLength()-1),C=this.oldLastRow;if(this.oldLastRow=x,!w||C0;S--)this.$lines.shift();if(C>x)for(var S=this.session.getFoldedRowCount(x+1,C);S>0;S--)this.$lines.pop();y.firstRowC&&this.$lines.push(this.$renderLines(y,C+1,x)),this.updateLineHighlight(),this._signal("afterRender"),this.$updateGutterWidth(y)},m.prototype.$renderLines=function(y,w,x){for(var C=[],S=w,M=this.session.getNextFoldLine(S),E=M?M.start.row:1/0;S>E&&(S=M.end.row+1,M=this.session.getNextFoldLine(S,M),E=M?M.start.row:1/0),!(S>x);){var A=this.$lines.createCell(S,y,this.session,p);this.$renderCell(A,y,M,S),C.push(A),S++}return C},m.prototype.$renderCell=function(y,w,x,C){var S=y.element,M=this.session,E=S.childNodes[0],A=S.childNodes[1],I=S.childNodes[2],O=S.childNodes[3],z=I.firstChild,$=M.$firstLineNumber,W=M.$breakpoints,J=M.$decorations,Z=M.gutterRenderer||this.$renderer,q=this.$showFoldWidgets&&M.foldWidgets,j=x?x.start.row:Number.MAX_VALUE,G=w.lineHeight+"px",U=this.$useSvgGutterIcons?"ace_gutter-cell_svg-icons ":"ace_gutter-cell ",Q=this.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",re=(Z?Z.getText(M,C):C+$).toString();if(this.$highlightGutterLine&&(C==this.$cursorRow||x&&C=j&&this.$cursorRow<=x.end.row)&&(U+="ace_gutter-active-line ",this.$cursorCell!=y&&(this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ","")),this.$cursorCell=y)),W[C]&&(U+=W[C]),J[C]&&(U+=J[C]),this.$annotations[C]&&C!==j&&(U+=this.$annotations[C].className),q){var le=q[C];le==null&&(le=q[C]=M.getFoldWidget(C))}if(le){var oe="ace_fold-widget ace_"+le,he=le=="start"&&C==j&&Cx.right-w.right)return"foldWidgets"},m}();d.prototype.$fixedWidth=!1,d.prototype.$highlightGutterLine=!0,d.prototype.$renderer="",d.prototype.$showLineNumbers=!0,d.prototype.$showFoldWidgets=!0,s.implement(d.prototype,l);function p(m){var y=document.createTextNode("");m.appendChild(y);var w=o.createElement("span");m.appendChild(w);var x=o.createElement("span");m.appendChild(x);var C=o.createElement("span");return x.appendChild(C),m}r.Gutter=d}),ace.define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(n,r,i){var o=n("../range").Range,s=n("../lib/dom"),a=function(){function c(u){this.element=s.createElement("div"),this.element.className="ace_layer ace_marker-layer",u.appendChild(this.element)}return c.prototype.setPadding=function(u){this.$padding=u},c.prototype.setSession=function(u){this.session=u},c.prototype.setMarkers=function(u){this.markers=u},c.prototype.elt=function(u,d){var p=this.i!=-1&&this.element.childNodes[this.i];p?this.i++:(p=document.createElement("div"),this.element.appendChild(p),this.i=-1),p.style.cssText=d,p.className=u},c.prototype.update=function(u){if(u){this.config=u,this.i=0;var d;for(var p in this.markers){var m=this.markers[p];if(!m.range){m.update(d,this,this.session,u);continue}var y=m.range.clipRows(u.firstRow,u.lastRow);if(!y.isEmpty())if(y=y.toScreenRange(this.session),m.renderer){var w=this.$getTop(y.start.row,u),x=this.$padding+y.start.column*u.characterWidth;m.renderer(d,y,x,w,u)}else m.type=="fullLine"?this.drawFullLineMarker(d,y,m.clazz,u):m.type=="screenLine"?this.drawScreenLineMarker(d,y,m.clazz,u):y.isMultiLine()?m.type=="text"?this.drawTextMarker(d,y,m.clazz,u):this.drawMultiLineMarker(d,y,m.clazz,u):this.drawSingleLineMarker(d,y,m.clazz+" ace_start ace_br15",u)}if(this.i!=-1)for(;this.iA,S==C),m,S==C?0:1,y)},c.prototype.drawMultiLineMarker=function(u,d,p,m,y){var w=this.$padding,x=m.lineHeight,C=this.$getTop(d.start.row,m),S=w+d.start.column*m.characterWidth;if(y=y||"",this.session.$bidiHandler.isBidiRow(d.start.row)){var M=d.clone();M.end.row=M.start.row,M.end.column=this.session.getLine(M.start.row).length,this.drawBidiSingleLineMarker(u,M,p+" ace_br1 ace_start",m,null,y)}else this.elt(p+" ace_br1 ace_start","height:"+x+"px;right:"+w+"px;top:"+C+"px;left:"+S+"px;"+(y||""));if(this.session.$bidiHandler.isBidiRow(d.end.row)){var M=d.clone();M.start.row=M.end.row,M.start.column=0,this.drawBidiSingleLineMarker(u,M,p+" ace_br12",m,null,y)}else{C=this.$getTop(d.end.row,m);var E=d.end.column*m.characterWidth;this.elt(p+" ace_br12","height:"+x+"px;width:"+E+"px;top:"+C+"px;left:"+w+"px;"+(y||""))}if(x=(d.end.row-d.start.row-1)*m.lineHeight,!(x<=0)){C=this.$getTop(d.start.row+1,m);var A=(d.start.column?1:0)|(d.end.column?0:8);this.elt(p+(A?" ace_br"+A:""),"height:"+x+"px;right:"+w+"px;top:"+C+"px;left:"+w+"px;"+(y||""))}},c.prototype.drawSingleLineMarker=function(u,d,p,m,y,w){if(this.session.$bidiHandler.isBidiRow(d.start.row))return this.drawBidiSingleLineMarker(u,d,p,m,y,w);var x=m.lineHeight,C=(d.end.column+(y||0)-d.start.column)*m.characterWidth,S=this.$getTop(d.start.row,m),M=this.$padding+d.start.column*m.characterWidth;this.elt(p,"height:"+x+"px;width:"+C+"px;top:"+S+"px;left:"+M+"px;"+(w||""))},c.prototype.drawBidiSingleLineMarker=function(u,d,p,m,y,w){var x=m.lineHeight,C=this.$getTop(d.start.row,m),S=this.$padding,M=this.session.$bidiHandler.getSelections(d.start.column,d.end.column);M.forEach(function(E){this.elt(p,"height:"+x+"px;width:"+(E.width+(y||0))+"px;top:"+C+"px;left:"+(S+E.left)+"px;"+(w||""))},this)},c.prototype.drawFullLineMarker=function(u,d,p,m,y){var w=this.$getTop(d.start.row,m),x=m.lineHeight;d.start.row!=d.end.row&&(x+=this.$getTop(d.end.row,m)-w),this.elt(p,"height:"+x+"px;top:"+w+"px;left:0;right:0;"+(y||""))},c.prototype.drawScreenLineMarker=function(u,d,p,m,y){var w=this.$getTop(d.start.row,m),x=m.lineHeight;this.elt(p,"height:"+x+"px;top:"+w+"px;left:0;right:0;"+(y||""))},c}();a.prototype.$padding=0;function l(c,u,d,p){return(c?1:0)|(u?2:0)|(d?4:0)|(p?8:0)}r.Marker=a}),ace.define("ace/layer/text_util",["require","exports","module"],function(n,r,i){var o=new Set(["text","rparen","lparen"]);r.isTextToken=function(s){return o.has(s)}}),ace.define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/layer/lines","ace/lib/event_emitter","ace/config","ace/layer/text_util"],function(n,r,i){var o=n("../lib/oop"),s=n("../lib/dom"),a=n("../lib/lang"),l=n("./lines").Lines,c=n("../lib/event_emitter").EventEmitter,u=n("../config").nls,d=n("./text_util").isTextToken,p=function(){function m(y){this.dom=s,this.element=this.dom.createElement("div"),this.element.className="ace_layer ace_text-layer",y.appendChild(this.element),this.$updateEolChar=this.$updateEolChar.bind(this),this.$lines=new l(this.element)}return m.prototype.$updateEolChar=function(){var y=this.session.doc,w=y.getNewLineCharacter()==` `&&y.getNewLineMode()!="windows",x=w?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;if(this.EOL_CHAR!=x)return this.EOL_CHAR=x,!0},m.prototype.setPadding=function(y){this.$padding=y,this.element.style.margin="0 "+y+"px"},m.prototype.getLineHeight=function(){return this.$fontMetrics.$characterSize.height||0},m.prototype.getCharacterWidth=function(){return this.$fontMetrics.$characterSize.width||0},m.prototype.$setFontMetrics=function(y){this.$fontMetrics=y,this.$fontMetrics.on("changeCharacterSize",(function(w){this._signal("changeCharacterSize",w)}).bind(this)),this.$pollSizeChanges()},m.prototype.checkForSizeChanges=function(){this.$fontMetrics.checkForSizeChanges()},m.prototype.$pollSizeChanges=function(){return this.$pollSizeChangesTimer=this.$fontMetrics.$pollSizeChanges()},m.prototype.setSession=function(y){this.session=y,y&&this.$computeTabString()},m.prototype.setShowInvisibles=function(y){return this.showInvisibles==y?!1:(this.showInvisibles=y,typeof y=="string"?(this.showSpaces=/tab/i.test(y),this.showTabs=/space/i.test(y),this.showEOL=/eol/i.test(y)):this.showSpaces=this.showTabs=this.showEOL=y,this.$computeTabString(),!0)},m.prototype.setDisplayIndentGuides=function(y){return this.displayIndentGuides==y?!1:(this.displayIndentGuides=y,this.$computeTabString(),!0)},m.prototype.setHighlightIndentGuides=function(y){return this.$highlightIndentGuides===y?!1:(this.$highlightIndentGuides=y,y)},m.prototype.$computeTabString=function(){var y=this.session.getTabSize();this.tabSize=y;for(var w=this.$tabStrings=[0],x=1;xz&&(I=O.end.row+1,O=this.session.getNextFoldLine(I,O),z=O?O.start.row:1/0),!(I>S);){var $=M[E++];if($){this.dom.removeChildren($),this.$renderLine($,I,I==z?O:!1),A&&($.style.top=this.$lines.computeLineTop(I,y,this.session)+"px");var W=y.lineHeight*this.session.getRowLength(I)+"px";$.style.height!=W&&(A=!0,$.style.height=W)}I++}if(A)for(;E0;S--)this.$lines.shift();if(w.lastRow>y.lastRow)for(var S=this.session.getFoldedRowCount(y.lastRow+1,w.lastRow);S>0;S--)this.$lines.pop();y.firstRoww.lastRow&&this.$lines.push(this.$renderLinesFragment(y,w.lastRow+1,y.lastRow)),this.$highlightIndentGuide()},m.prototype.$renderLinesFragment=function(y,w,x){for(var C=[],S=w,M=this.session.getNextFoldLine(S),E=M?M.start.row:1/0;S>E&&(S=M.end.row+1,M=this.session.getNextFoldLine(S,M),E=M?M.start.row:1/0),!(S>x);){var A=this.$lines.createCell(S,y,this.session),I=A.element;this.dom.removeChildren(I),s.setStyle(I.style,"height",this.$lines.computeLineHeight(S,y,this.session)+"px"),s.setStyle(I.style,"top",this.$lines.computeLineTop(S,y,this.session)+"px"),this.$renderLine(I,S,S==E?M:!1),this.$useLineGroups()?I.className="ace_line_group":I.className="ace_line",C.push(A),S++}return C},m.prototype.update=function(y){this.$lines.moveContainer(y),this.config=y;for(var w=y.firstRow,x=y.lastRow,C=this.$lines;C.getLength();)C.pop();C.push(this.$renderLinesFragment(y,w,x))},m.prototype.$renderToken=function(y,w,x,C){for(var S=this,M=/(\t)|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\uFEFF\uFFF9-\uFFFC\u2066\u2067\u2068\u202A\u202B\u202D\u202E\u202C\u2069\u2060\u2061\u2062\u2063\u2064\u206A\u206B\u206B\u206C\u206D\u206E\u206F]+)|(\u3000)|([\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g,E=this.dom.createFragment(this.element),A,I=0;A=M.exec(C);){var O=A[1],z=A[2],$=A[3],W=A[4],J=A[5];if(!(!S.showSpaces&&z)){var Z=I!=A.index?C.slice(I,A.index):"";if(I=A.index+A[0].length,Z&&E.appendChild(this.dom.createTextNode(Z,this.element)),O){var q=S.session.getScreenTabSize(w+A.index);E.appendChild(S.$tabStrings[q].cloneNode(!0)),w+=q-1}else if(z)if(S.showSpaces){var j=this.dom.createElement("span");j.className="ace_invisible ace_invisible_space",j.textContent=a.stringRepeat(S.SPACE_CHAR,z.length),E.appendChild(j)}else E.appendChild(this.dom.createTextNode(z,this.element));else if($){var j=this.dom.createElement("span");j.className="ace_invisible ace_invisible_space ace_invalid",j.textContent=a.stringRepeat(S.SPACE_CHAR,$.length),E.appendChild(j)}else if(W){w+=1;var j=this.dom.createElement("span");j.style.width=S.config.characterWidth*2+"px",j.className=S.showSpaces?"ace_cjk ace_invisible ace_invisible_space":"ace_cjk",j.textContent=S.showSpaces?S.SPACE_CHAR:W,E.appendChild(j)}else if(J){w+=1;var j=this.dom.createElement("span");j.style.width=S.config.characterWidth*2+"px",j.className="ace_cjk",j.textContent=J,E.appendChild(j)}}}if(E.appendChild(this.dom.createTextNode(I?C.slice(I):C,this.element)),d(x.type))y.appendChild(E);else{var G="ace_"+x.type.replace(/\./g," ace_"),j=this.dom.createElement("span");x.type=="fold"&&(j.style.width=x.value.length*this.config.characterWidth+"px",j.setAttribute("title",u("inline-fold.closed.title","Unfold code"))),j.className=G,j.appendChild(E),y.appendChild(j)}return w+C.length},m.prototype.renderIndentGuide=function(y,w,x){var C=w.search(this.$indentGuideRe);if(C<=0||C>=x)return w;if(w[0]==" "){C-=C%this.tabSize;for(var S=C/this.tabSize,M=0;MM[E].start.row?this.$highlightIndentGuideMarker.dir=-1:this.$highlightIndentGuideMarker.dir=1;break}}if(!this.$highlightIndentGuideMarker.end&&y[w.row]!==""&&w.column===y[w.row].length){this.$highlightIndentGuideMarker.dir=1;for(var E=w.row+1;E0)C=y.element.childNodes[0];else return;var S=C.childNodes;if(S){var M=S[w-1];M&&M.classList&&M.classList.contains("ace_indent-guide")&&M.classList.add("ace_indent-guide-active")}}},m.prototype.$renderHighlightIndentGuide=function(){if(this.$lines){var y=this.$lines.cells;this.$clearActiveIndentGuide();var w=this.$highlightIndentGuideMarker.indentLevel;if(w!==0)if(this.$highlightIndentGuideMarker.dir===1)for(var x=0;x=this.$highlightIndentGuideMarker.start+1){if(C.row>=this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(C,w)}}else for(var x=y.length-1;x>=0;x--){var C=y[x];if(this.$highlightIndentGuideMarker.end&&C.row=M;)E=this.$renderToken(A,E,O,z.substring(0,M-C)),z=z.substring(M-C),C=M,A=this.$createLineElement(),y.appendChild(A),A.appendChild(this.dom.createTextNode(a.stringRepeat(" ",x.indent),this.element)),S++,E=0,M=x[S]||Number.MAX_VALUE;z.length!=0&&(C+=z.length,E=this.$renderToken(A,E,O,z))}}x[x.length-1]>this.MAX_LINE_LENGTH&&this.$renderOverflowMessage(A,E,null,"",!0)},m.prototype.$renderSimpleLine=function(y,w){for(var x=0,C=0;Cthis.MAX_LINE_LENGTH)return this.$renderOverflowMessage(y,x,S,M);x=this.$renderToken(y,x,S,M)}}},m.prototype.$renderOverflowMessage=function(y,w,x,C,S){x&&this.$renderToken(y,w,x,C.slice(0,this.MAX_LINE_LENGTH-w));var M=this.dom.createElement("span");M.className="ace_inline_button ace_keyword ace_toggle_wrap",M.textContent=S?"":"",y.appendChild(M)},m.prototype.$renderLine=function(y,w,x){if(!x&&x!=!1&&(x=this.session.getFoldLine(w)),x)var C=this.$getFoldLineTokens(w,x);else var C=this.session.getTokens(w);var S=y;if(C.length){var M=this.session.getRowSplitData(w);if(M&&M.length){this.$renderWrappedLine(y,C,M);var S=y.lastChild}else{var S=y;this.$useLineGroups()&&(S=this.$createLineElement(),y.appendChild(S)),this.$renderSimpleLine(S,C)}}else this.$useLineGroups()&&(S=this.$createLineElement(),y.appendChild(S));if(this.showEOL&&S){x&&(w=x.end.row);var E=this.dom.createElement("span");E.className="ace_invisible ace_invisible_eol",E.textContent=w==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,S.appendChild(E)}},m.prototype.$getFoldLineTokens=function(y,w){var x=this.session,C=[];function S(E,A,I){for(var O=0,z=0;z+E[O].value.lengthI-A&&($=$.substring(0,I-A)),C.push({type:E[O].type,value:$}),z=A+$.length,O+=1}for(;zI?C.push({type:E[O].type,value:$.substring(0,I-z)}):C.push(E[O]),z+=$.length,O+=1}}var M=x.getTokens(y);return w.walk(function(E,A,I,O,z){E!=null?C.push({type:"fold",value:E}):(z&&(M=x.getTokens(A)),M.length&&S(M,O,I))},w.end.row,this.session.getLine(w.end.row).length),C},m.prototype.$useLineGroups=function(){return this.session.getUseWrapMode()},m}();p.prototype.EOF_CHAR="¶",p.prototype.EOL_CHAR_LF="¬",p.prototype.EOL_CHAR_CRLF="¤",p.prototype.EOL_CHAR=p.prototype.EOL_CHAR_LF,p.prototype.TAB_CHAR="—",p.prototype.SPACE_CHAR="·",p.prototype.$padding=0,p.prototype.MAX_LINE_LENGTH=1e4,p.prototype.showInvisibles=!1,p.prototype.showSpaces=!1,p.prototype.showTabs=!1,p.prototype.showEOL=!1,p.prototype.displayIndentGuides=!0,p.prototype.$highlightIndentGuides=!0,p.prototype.$tabStrings=[],p.prototype.destroy={},p.prototype.onChangeTabSize=p.prototype.$computeTabString,o.implement(p.prototype,c),r.Text=p}),ace.define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(n,r,i){var o=n("../lib/dom"),s=function(){function a(l){this.element=o.createElement("div"),this.element.className="ace_layer ace_cursor-layer",l.appendChild(this.element),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),o.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=this.$updateOpacity.bind(this)}return a.prototype.$updateOpacity=function(l){for(var c=this.cursors,u=c.length;u--;)o.setStyle(c[u].style,"opacity",l?"":"0")},a.prototype.$startCssAnimation=function(){for(var l=this.cursors,c=l.length;c--;)l[c].style.animationDuration=this.blinkInterval+"ms";this.$isAnimating=!0,setTimeout((function(){this.$isAnimating&&o.addCssClass(this.element,"ace_animate-blinking")}).bind(this))},a.prototype.$stopCssAnimation=function(){this.$isAnimating=!1,o.removeCssClass(this.element,"ace_animate-blinking")},a.prototype.setPadding=function(l){this.$padding=l},a.prototype.setSession=function(l){this.session=l},a.prototype.setBlinking=function(l){l!=this.isBlinking&&(this.isBlinking=l,this.restartTimer())},a.prototype.setBlinkInterval=function(l){l!=this.blinkInterval&&(this.blinkInterval=l,this.restartTimer())},a.prototype.setSmoothBlinking=function(l){l!=this.smoothBlinking&&(this.smoothBlinking=l,o.setCssClass(this.element,"ace_smooth-blinking",l),this.$updateCursors(!0),this.restartTimer())},a.prototype.addCursor=function(){var l=o.createElement("div");return l.className="ace_cursor",this.element.appendChild(l),this.cursors.push(l),l},a.prototype.removeCursor=function(){if(this.cursors.length>1){var l=this.cursors.pop();return l.parentNode.removeChild(l),l}},a.prototype.hideCursor=function(){this.isVisible=!1,o.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},a.prototype.showCursor=function(){this.isVisible=!0,o.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},a.prototype.restartTimer=function(){var l=this.$updateCursors;if(clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.$stopCssAnimation(),this.smoothBlinking&&(this.$isSmoothBlinking=!1,o.removeCssClass(this.element,"ace_smooth-blinking")),l(!0),!this.isBlinking||!this.blinkInterval||!this.isVisible){this.$stopCssAnimation();return}if(this.smoothBlinking&&(this.$isSmoothBlinking=!0,setTimeout((function(){this.$isSmoothBlinking&&o.addCssClass(this.element,"ace_smooth-blinking")}).bind(this))),o.HAS_CSS_ANIMATION)this.$startCssAnimation();else{var c=(function(){this.timeoutId=setTimeout(function(){l(!1)},.6*this.blinkInterval)}).bind(this);this.intervalId=setInterval(function(){l(!0),c()},this.blinkInterval),c()}},a.prototype.getPixelPosition=function(l,c){if(!this.config||!this.session)return{left:0,top:0};l||(l=this.session.selection.getCursor());var u=this.session.documentToScreenPosition(l),d=this.$padding+(this.session.$bidiHandler.isBidiRow(u.row,l.row)?this.session.$bidiHandler.getPosLeft(u.column):u.column*this.config.characterWidth),p=(u.row-(c?this.config.firstRowScreen:0))*this.config.lineHeight;return{left:d,top:p}},a.prototype.isCursorInView=function(l,c){return l.top>=0&&l.topl.height+l.offset||m.top<0)&&u>1)){var y=this.cursors[d++]||this.addCursor(),w=y.style;this.drawCursor?this.drawCursor(y,m,l,c[u],this.session):this.isCursorInView(m,l)?(o.setStyle(w,"display","block"),o.translate(y,m.left,m.top),o.setStyle(w,"width",Math.round(l.characterWidth)+"px"),o.setStyle(w,"height",l.lineHeight+"px")):o.setStyle(w,"display","none")}}for(;this.cursors.length>d;)this.removeCursor();var x=this.session.getOverwrite();this.$setOverwrite(x),this.$pixelPos=m,this.restartTimer()},a.prototype.$setOverwrite=function(l){l!=this.overwrite&&(this.overwrite=l,l?o.addCssClass(this.element,"ace_overwrite-cursors"):o.removeCssClass(this.element,"ace_overwrite-cursors"))},a.prototype.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)},a}();s.prototype.$padding=0,s.prototype.drawCursor=null,r.Cursor=s}),ace.define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(n,r,i){var o=this&&this.__extends||function(){var y=function(w,x){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,S){C.__proto__=S}||function(C,S){for(var M in S)Object.prototype.hasOwnProperty.call(S,M)&&(C[M]=S[M])},y(w,x)};return function(w,x){if(typeof x!="function"&&x!==null)throw new TypeError("Class extends value "+String(x)+" is not a constructor or null");y(w,x);function C(){this.constructor=w}w.prototype=x===null?Object.create(x):(C.prototype=x.prototype,new C)}}(),s=n("./lib/oop"),a=n("./lib/dom"),l=n("./lib/event"),c=n("./lib/event_emitter").EventEmitter,u=32768,d=function(){function y(w,x){this.element=a.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+x,this.inner=a.createElement("div"),this.inner.className="ace_scrollbar-inner",this.inner.textContent=" ",this.element.appendChild(this.inner),w.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,l.addListener(this.element,"scroll",this.onScroll.bind(this)),l.addListener(this.element,"mousedown",l.preventDefault)}return y.prototype.setVisible=function(w){this.element.style.display=w?"":"none",this.isVisible=w,this.coeff=1},y}();s.implement(d.prototype,c);var p=function(y){o(w,y);function w(x,C){var S=y.call(this,x,"-v")||this;return S.scrollTop=0,S.scrollHeight=0,C.$scrollbarWidth=S.width=a.scrollbarWidth(x.ownerDocument),S.inner.style.width=S.element.style.width=(S.width||15)+5+"px",S.$minWidth=0,S}return w.prototype.onScroll=function(){if(!this.skipEvent){if(this.scrollTop=this.element.scrollTop,this.coeff!=1){var x=this.element.clientHeight/this.scrollHeight;this.scrollTop=this.scrollTop*(1-x)/(this.coeff-x)}this._emit("scroll",{data:this.scrollTop})}this.skipEvent=!1},w.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},w.prototype.setHeight=function(x){this.element.style.height=x+"px"},w.prototype.setScrollHeight=function(x){this.scrollHeight=x,x>u?(this.coeff=u/x,x=u):this.coeff!=1&&(this.coeff=1),this.inner.style.height=x+"px"},w.prototype.setScrollTop=function(x){this.scrollTop!=x&&(this.skipEvent=!0,this.scrollTop=x,this.element.scrollTop=x*this.coeff)},w}(d);p.prototype.setInnerHeight=p.prototype.setScrollHeight;var m=function(y){o(w,y);function w(x,C){var S=y.call(this,x,"-h")||this;return S.scrollLeft=0,S.height=C.$scrollbarWidth,S.inner.style.height=S.element.style.height=(S.height||15)+5+"px",S}return w.prototype.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},w.prototype.getHeight=function(){return this.isVisible?this.height:0},w.prototype.setWidth=function(x){this.element.style.width=x+"px"},w.prototype.setInnerWidth=function(x){this.inner.style.width=x+"px"},w.prototype.setScrollWidth=function(x){this.inner.style.width=x+"px"},w.prototype.setScrollLeft=function(x){this.scrollLeft!=x&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=x)},w}(d);r.ScrollBar=p,r.ScrollBarV=p,r.ScrollBarH=m,r.VScrollBar=p,r.HScrollBar=m}),ace.define("ace/scrollbar_custom",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(n,r,i){var o=this&&this.__extends||function(){var m=function(y,w){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,C){x.__proto__=C}||function(x,C){for(var S in C)Object.prototype.hasOwnProperty.call(C,S)&&(x[S]=C[S])},m(y,w)};return function(y,w){if(typeof w!="function"&&w!==null)throw new TypeError("Class extends value "+String(w)+" is not a constructor or null");m(y,w);function x(){this.constructor=y}y.prototype=w===null?Object.create(w):(x.prototype=w.prototype,new x)}}(),s=n("./lib/oop"),a=n("./lib/dom"),l=n("./lib/event"),c=n("./lib/event_emitter").EventEmitter;a.importCssString(`.ace_editor>.ace_sb-v div, .ace_editor>.ace_sb-h div{ position: absolute; background: rgba(128, 128, 128, 0.6); -moz-box-sizing: border-box; box-sizing: border-box; border: 1px solid #bbb; border-radius: 2px; z-index: 8; } .ace_editor>.ace_sb-v, .ace_editor>.ace_sb-h { position: absolute; z-index: 6; background: none; overflow: hidden!important; } .ace_editor>.ace_sb-v { z-index: 6; right: 0; top: 0; width: 12px; } .ace_editor>.ace_sb-v div { z-index: 8; right: 0; width: 100%; } .ace_editor>.ace_sb-h { bottom: 0; left: 0; height: 12px; } .ace_editor>.ace_sb-h div { bottom: 0; height: 100%; } .ace_editor>.ace_sb_grabbed { z-index: 8; background: #000; }`,"ace_scrollbar.css",!1);var u=function(){function m(y,w){this.element=a.createElement("div"),this.element.className="ace_sb"+w,this.inner=a.createElement("div"),this.inner.className="",this.element.appendChild(this.inner),this.VScrollWidth=12,this.HScrollHeight=12,y.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,l.addMultiMouseDownListener(this.element,[500,300,300],this,"onMouseDown")}return m.prototype.setVisible=function(y){this.element.style.display=y?"":"none",this.isVisible=y,this.coeff=1},m}();s.implement(u.prototype,c);var d=function(m){o(y,m);function y(w,x){var C=m.call(this,w,"-v")||this;return C.scrollTop=0,C.scrollHeight=0,C.parent=w,C.width=C.VScrollWidth,C.renderer=x,C.inner.style.width=C.element.style.width=(C.width||15)+"px",C.$minWidth=0,C}return y.prototype.onMouseDown=function(w,x){if(w==="mousedown"&&!(l.getButton(x)!==0||x.detail===2)){if(x.target===this.inner){var C=this,S=x.clientY,M=function(W){S=W.clientY},E=function(){clearInterval(z)},A=x.clientY,I=this.thumbTop,O=function(){if(S!==void 0){var W=C.scrollTopFromThumbTop(I+S-A);W!==C.scrollTop&&C._emit("scroll",{data:W})}};l.capture(this.inner,M,E);var z=setInterval(O,20);return l.preventDefault(x)}var $=x.clientY-this.element.getBoundingClientRect().top-this.thumbHeight/2;return this._emit("scroll",{data:this.scrollTopFromThumbTop($)}),l.preventDefault(x)}},y.prototype.getHeight=function(){return this.height},y.prototype.scrollTopFromThumbTop=function(w){var x=w*(this.pageHeight-this.viewHeight)/(this.slideHeight-this.thumbHeight);return x=x>>0,x<0?x=0:x>this.pageHeight-this.viewHeight&&(x=this.pageHeight-this.viewHeight),x},y.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},y.prototype.setHeight=function(w){this.height=Math.max(0,w),this.slideHeight=this.height,this.viewHeight=this.height,this.setScrollHeight(this.pageHeight,!0)},y.prototype.setScrollHeight=function(w,x){this.pageHeight===w&&!x||(this.pageHeight=w,this.thumbHeight=this.slideHeight*this.viewHeight/this.pageHeight,this.thumbHeight>this.slideHeight&&(this.thumbHeight=this.slideHeight),this.thumbHeight<15&&(this.thumbHeight=15),this.inner.style.height=this.thumbHeight+"px",this.scrollTop>this.pageHeight-this.viewHeight&&(this.scrollTop=this.pageHeight-this.viewHeight,this.scrollTop<0&&(this.scrollTop=0),this._emit("scroll",{data:this.scrollTop})))},y.prototype.setScrollTop=function(w){this.scrollTop=w,w<0&&(w=0),this.thumbTop=w*(this.slideHeight-this.thumbHeight)/(this.pageHeight-this.viewHeight),this.inner.style.top=this.thumbTop+"px"},y}(u);d.prototype.setInnerHeight=d.prototype.setScrollHeight;var p=function(m){o(y,m);function y(w,x){var C=m.call(this,w,"-h")||this;return C.scrollLeft=0,C.scrollWidth=0,C.height=C.HScrollHeight,C.inner.style.height=C.element.style.height=(C.height||12)+"px",C.renderer=x,C}return y.prototype.onMouseDown=function(w,x){if(w==="mousedown"&&!(l.getButton(x)!==0||x.detail===2)){if(x.target===this.inner){var C=this,S=x.clientX,M=function(W){S=W.clientX},E=function(){clearInterval(z)},A=x.clientX,I=this.thumbLeft,O=function(){if(S!==void 0){var W=C.scrollLeftFromThumbLeft(I+S-A);W!==C.scrollLeft&&C._emit("scroll",{data:W})}};l.capture(this.inner,M,E);var z=setInterval(O,20);return l.preventDefault(x)}var $=x.clientX-this.element.getBoundingClientRect().left-this.thumbWidth/2;return this._emit("scroll",{data:this.scrollLeftFromThumbLeft($)}),l.preventDefault(x)}},y.prototype.getHeight=function(){return this.isVisible?this.height:0},y.prototype.scrollLeftFromThumbLeft=function(w){var x=w*(this.pageWidth-this.viewWidth)/(this.slideWidth-this.thumbWidth);return x=x>>0,x<0?x=0:x>this.pageWidth-this.viewWidth&&(x=this.pageWidth-this.viewWidth),x},y.prototype.setWidth=function(w){this.width=Math.max(0,w),this.element.style.width=this.width+"px",this.slideWidth=this.width,this.viewWidth=this.width,this.setScrollWidth(this.pageWidth,!0)},y.prototype.setScrollWidth=function(w,x){this.pageWidth===w&&!x||(this.pageWidth=w,this.thumbWidth=this.slideWidth*this.viewWidth/this.pageWidth,this.thumbWidth>this.slideWidth&&(this.thumbWidth=this.slideWidth),this.thumbWidth<15&&(this.thumbWidth=15),this.inner.style.width=this.thumbWidth+"px",this.scrollLeft>this.pageWidth-this.viewWidth&&(this.scrollLeft=this.pageWidth-this.viewWidth,this.scrollLeft<0&&(this.scrollLeft=0),this._emit("scroll",{data:this.scrollLeft})))},y.prototype.setScrollLeft=function(w){this.scrollLeft=w,w<0&&(w=0),this.thumbLeft=w*(this.slideWidth-this.thumbWidth)/(this.pageWidth-this.viewWidth),this.inner.style.left=this.thumbLeft+"px"},y}(u);p.prototype.setInnerWidth=p.prototype.setScrollWidth,r.ScrollBar=d,r.ScrollBarV=d,r.ScrollBarH=p,r.VScrollBar=d,r.HScrollBar=p}),ace.define("ace/renderloop",["require","exports","module","ace/lib/event"],function(n,r,i){var o=n("./lib/event"),s=function(){function a(l,c){this.onRender=l,this.pending=!1,this.changes=0,this.$recursionLimit=2,this.window=c||window;var u=this;this._flush=function(d){u.pending=!1;var p=u.changes;if(p&&(o.blockIdle(100),u.changes=0,u.onRender(p)),u.changes){if(u.$recursionLimit--<0)return;u.schedule()}else u.$recursionLimit=2}}return a.prototype.schedule=function(l){this.changes=this.changes|l,this.changes&&!this.pending&&(o.nextFrame(this._flush),this.pending=!0)},a.prototype.clear=function(l){var c=this.changes;return this.changes=0,c},a}();r.RenderLoop=s}),ace.define("ace/layer/font_metrics",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/lib/useragent","ace/lib/event_emitter"],function(n,r,i){var o=n("../lib/oop"),s=n("../lib/dom"),a=n("../lib/lang"),l=n("../lib/event"),c=n("../lib/useragent"),u=n("../lib/event_emitter").EventEmitter,d=512,p=typeof ResizeObserver=="function",m=200,y=function(){function w(x){this.el=s.createElement("div"),this.$setMeasureNodeStyles(this.el.style,!0),this.$main=s.createElement("div"),this.$setMeasureNodeStyles(this.$main.style),this.$measureNode=s.createElement("div"),this.$setMeasureNodeStyles(this.$measureNode.style),this.el.appendChild(this.$main),this.el.appendChild(this.$measureNode),x.appendChild(this.el),this.$measureNode.textContent=a.stringRepeat("X",d),this.$characterSize={width:0,height:0},p?this.$addObserver():this.checkForSizeChanges()}return w.prototype.$setMeasureNodeStyles=function(x,C){x.width=x.height="auto",x.left=x.top="0px",x.visibility="hidden",x.position="absolute",x.whiteSpace="pre",c.isIE<8?x["font-family"]="inherit":x.font="inherit",x.overflow=C?"hidden":"visible"},w.prototype.checkForSizeChanges=function(x){if(x===void 0&&(x=this.$measureSizes()),x&&(this.$characterSize.width!==x.width||this.$characterSize.height!==x.height)){this.$measureNode.style.fontWeight="bold";var C=this.$measureSizes();this.$measureNode.style.fontWeight="",this.$characterSize=x,this.charSizes=Object.create(null),this.allowBoldFonts=C&&C.width===x.width&&C.height===x.height,this._emit("changeCharacterSize",{data:x})}},w.prototype.$addObserver=function(){var x=this;this.$observer=new window.ResizeObserver(function(C){x.checkForSizeChanges()}),this.$observer.observe(this.$measureNode)},w.prototype.$pollSizeChanges=function(){if(this.$pollSizeChangesTimer||this.$observer)return this.$pollSizeChangesTimer;var x=this;return this.$pollSizeChangesTimer=l.onIdle(function C(){x.checkForSizeChanges(),l.onIdle(C,500)},500)},w.prototype.setPolling=function(x){x?this.$pollSizeChanges():this.$pollSizeChangesTimer&&(clearInterval(this.$pollSizeChangesTimer),this.$pollSizeChangesTimer=0)},w.prototype.$measureSizes=function(x){var C={height:(x||this.$measureNode).clientHeight,width:(x||this.$measureNode).clientWidth/d};return C.width===0||C.height===0?null:C},w.prototype.$measureCharWidth=function(x){this.$main.textContent=a.stringRepeat(x,d);var C=this.$main.getBoundingClientRect();return C.width/d},w.prototype.getCharacterWidth=function(x){var C=this.charSizes[x];return C===void 0&&(C=this.charSizes[x]=this.$measureCharWidth(x)/this.$characterSize.width),C},w.prototype.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$observer&&this.$observer.disconnect(),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},w.prototype.$getZoom=function(x){return!x||!x.parentElement?1:(Number(window.getComputedStyle(x).zoom)||1)*this.$getZoom(x.parentElement)},w.prototype.$initTransformMeasureNodes=function(){var x=function(C,S){return["div",{style:"position: absolute;top:"+C+"px;left:"+S+"px;"}]};this.els=s.buildDom([x(0,0),x(m,0),x(0,m),x(m,m)],this.el)},w.prototype.transformCoordinates=function(x,C){if(x){var S=this.$getZoom(this.el);x=I(1/S,x)}function M(oe,he,xe){var Ee=oe[1]*he[0]-oe[0]*he[1];return[(-he[1]*xe[0]+he[0]*xe[1])/Ee,(+oe[1]*xe[0]-oe[0]*xe[1])/Ee]}function E(oe,he){return[oe[0]-he[0],oe[1]-he[1]]}function A(oe,he){return[oe[0]+he[0],oe[1]+he[1]]}function I(oe,he){return[oe*he[0],oe*he[1]]}this.els||this.$initTransformMeasureNodes();function O(oe){var he=oe.getBoundingClientRect();return[he.left,he.top]}var z=O(this.els[0]),$=O(this.els[1]),W=O(this.els[2]),J=O(this.els[3]),Z=M(E(J,$),E(J,W),E(A($,W),A(J,z))),q=I(1+Z[0],E($,z)),j=I(1+Z[1],E(W,z));if(C){var G=C,U=Z[0]*G[0]/m+Z[1]*G[1]/m+1,Q=A(I(G[0],q),I(G[1],j));return A(I(1/U/m,Q),z)}var re=E(x,z),le=M(E(q,I(Z[0],re)),E(j,I(Z[1],re)),re);return I(m,le)},w}();y.prototype.$characterSize={width:0,height:0},o.implement(y.prototype,u),r.FontMetrics=y}),ace.define("ace/css/editor-css",["require","exports","module"],function(n,r,i){i.exports=` .ace_br1 {border-top-left-radius : 3px;} .ace_br2 {border-top-right-radius : 3px;} .ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;} .ace_br4 {border-bottom-right-radius: 3px;} .ace_br5 {border-top-left-radius : 3px; border-bottom-right-radius: 3px;} .ace_br6 {border-top-right-radius : 3px; border-bottom-right-radius: 3px;} .ace_br7 {border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;} .ace_br8 {border-bottom-left-radius : 3px;} .ace_br9 {border-top-left-radius : 3px; border-bottom-left-radius: 3px;} .ace_br10{border-top-right-radius : 3px; border-bottom-left-radius: 3px;} .ace_br11{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px;} .ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;} .ace_br13{border-top-left-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;} .ace_br14{border-top-right-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;} .ace_br15{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;} .ace_editor { position: relative; overflow: hidden; padding: 0; font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Source Code Pro', 'source-code-pro', monospace; direction: ltr; text-align: left; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); forced-color-adjust: none; } .ace_scroller { position: absolute; overflow: hidden; top: 0; bottom: 0; background-color: inherit; -ms-user-select: none; -moz-user-select: none; -webkit-user-select: none; user-select: none; cursor: text; } .ace_content { position: absolute; box-sizing: border-box; min-width: 100%; contain: style size layout; font-variant-ligatures: no-common-ligatures; } .ace_invisible { font-variant-ligatures: none; } .ace_keyboard-focus:focus { box-shadow: inset 0 0 0 2px #5E9ED6; outline: none; } .ace_dragging .ace_scroller:before{ position: absolute; top: 0; left: 0; right: 0; bottom: 0; content: ''; background: rgba(250, 250, 250, 0.01); z-index: 1000; } .ace_dragging.ace_dark .ace_scroller:before{ background: rgba(0, 0, 0, 0.01); } .ace_gutter { position: absolute; overflow : hidden; width: auto; top: 0; bottom: 0; left: 0; cursor: default; z-index: 4; -ms-user-select: none; -moz-user-select: none; -webkit-user-select: none; user-select: none; contain: style size layout; } .ace_gutter-active-line { position: absolute; left: 0; right: 0; } .ace_scroller.ace_scroll-left:after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset; pointer-events: none; } .ace_gutter-cell, .ace_gutter-cell_svg-icons { position: absolute; top: 0; left: 0; right: 0; padding-left: 19px; padding-right: 6px; background-repeat: no-repeat; } .ace_gutter-cell_svg-icons .ace_gutter_annotation { margin-left: -14px; float: left; } .ace_gutter-cell .ace_gutter_annotation { margin-left: -19px; float: left; } .ace_gutter-cell.ace_error, .ace_icon.ace_error, .ace_icon.ace_error_fold, .ace_gutter-cell.ace_security, .ace_icon.ace_security, .ace_icon.ace_security_fold { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg=="); background-repeat: no-repeat; background-position: 2px center; } .ace_gutter-cell.ace_warning, .ace_icon.ace_warning, .ace_icon.ace_warning_fold { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg=="); background-repeat: no-repeat; background-position: 2px center; } .ace_gutter-cell.ace_info, .ace_icon.ace_info, .ace_gutter-cell.ace_hint, .ace_icon.ace_hint { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII="); background-repeat: no-repeat; background-position: 2px center; } .ace_dark .ace_gutter-cell.ace_info, .ace_dark .ace_icon.ace_info, .ace_dark .ace_gutter-cell.ace_hint, .ace_dark .ace_icon.ace_hint { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC"); } .ace_icon_svg.ace_error { -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJyZWQiIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIj4KPGNpcmNsZSBmaWxsPSJub25lIiBjeD0iOCIgY3k9IjgiIHI9IjciIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPGxpbmUgeDE9IjExIiB5MT0iNSIgeDI9IjUiIHkyPSIxMSIvPgo8bGluZSB4MT0iMTEiIHkxPSIxMSIgeDI9IjUiIHkyPSI1Ii8+CjwvZz4KPC9zdmc+"); background-color: crimson; } .ace_icon_svg.ace_security { -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0iZGFya29yYW5nZSIgZmlsbD0ibm9uZSIgc2hhcGUtcmVuZGVyaW5nPSJnZW9tZXRyaWNQcmVjaXNpb24iPgogICAgICAgIDxwYXRoIGNsYXNzPSJzdHJva2UtbGluZWpvaW4tcm91bmQiIGQ9Ik04IDE0LjgzMDdDOCAxNC44MzA3IDIgMTIuOTA0NyAyIDguMDg5OTJWMy4yNjU0OEM1LjMxIDMuMjY1NDggNy45ODk5OSAxLjM0OTE4IDcuOTg5OTkgMS4zNDkxOEM3Ljk4OTk5IDEuMzQ5MTggMTAuNjkgMy4yNjU0OCAxNCAzLjI2NTQ4VjguMDg5OTJDMTQgMTIuOTA0NyA4IDE0LjgzMDcgOCAxNC44MzA3WiIvPgogICAgICAgIDxwYXRoIGQ9Ik0yIDguMDg5OTJWMy4yNjU0OEM1LjMxIDMuMjY1NDggNy45ODk5OSAxLjM0OTE4IDcuOTg5OTkgMS4zNDkxOCIvPgogICAgICAgIDxwYXRoIGQ9Ik0xMy45OSA4LjA4OTkyVjMuMjY1NDhDMTAuNjggMy4yNjU0OCA4IDEuMzQ5MTggOCAxLjM0OTE4Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTggNFY5Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTggMTBWMTIiLz4KICAgIDwvZz4KPC9zdmc+"); background-color: crimson; } .ace_icon_svg.ace_warning { -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJkYXJrb3JhbmdlIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+Cjxwb2x5Z29uIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGZpbGw9Im5vbmUiIHBvaW50cz0iOCAxIDE1IDE1IDEgMTUgOCAxIi8+CjxyZWN0IHg9IjgiIHk9IjEyIiB3aWR0aD0iMC4wMSIgaGVpZ2h0PSIwLjAxIi8+CjxsaW5lIHgxPSI4IiB5MT0iNiIgeDI9IjgiIHkyPSIxMCIvPgo8L2c+Cjwvc3ZnPg=="); background-color: darkorange; } .ace_icon_svg.ace_info { -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJibHVlIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CjxjaXJjbGUgZmlsbD0ibm9uZSIgY3g9IjgiIGN5PSI4IiByPSI3IiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjxwb2x5bGluZSBwb2ludHM9IjggMTEgOCA4Ii8+Cjxwb2x5bGluZSBwb2ludHM9IjkgOCA2IDgiLz4KPGxpbmUgeDE9IjEwIiB5MT0iMTEiIHgyPSI2IiB5Mj0iMTEiLz4KPHJlY3QgeD0iOCIgeT0iNSIgd2lkdGg9IjAuMDEiIGhlaWdodD0iMC4wMSIvPgo8L2c+Cjwvc3ZnPg=="); background-color: royalblue; } .ace_icon_svg.ace_hint { -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0ic2lsdmVyIiBmaWxsPSJub25lIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTYgMTRIMTAiLz4KICAgICAgICA8cGF0aCBkPSJNOCAxMUg5QzkgOS40NzAwMiAxMiA4LjU0MDAyIDEyIDUuNzYwMDJDMTIuMDIgNC40MDAwMiAxMS4zOSAzLjM2MDAyIDEwLjQzIDIuNjcwMDJDOSAxLjY0MDAyIDcuMDAwMDEgMS42NDAwMiA1LjU3MDAxIDIuNjcwMDJDNC42MTAwMSAzLjM2MDAyIDMuOTggNC40MDAwMiA0IDUuNzYwMDJDNCA4LjU0MDAyIDcuMDAwMDEgOS40NzAwMiA3LjAwMDAxIDExSDhaIi8+CiAgICA8L2c+Cjwvc3ZnPg=="); background-color: silver; } .ace_icon_svg.ace_error_fold { -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSI+CiAgPHBhdGggZD0ibSAxOC45Mjk4NTEsNy44Mjk4MDc2IGMgMC4xNDYzNTMsNi4zMzc0NjA0IC02LjMyMzE0Nyw3Ljc3Nzg0NDQgLTcuNDc3OTEyLDcuNzc3ODQ0NCAtMi4xMDcyNzI2LC0wLjEyODc1IDUuMTE3Njc4LDAuMzU2MjQ5IDUuMDUxNjk4LC03Ljg3MDA2MTggLTAuNjA0NjcyLC04LjAwMzk3MzQ5IC03LjA3NzI3MDYsLTcuNTYzMTE4OSAtNC44NTczLC03LjQzMDM5NTU2IDEuNjA2LC0wLjExNTE0MjI1IDYuODk3NDg1LDEuMjYyNTQ1OTYgNy4yODM1MTQsNy41MjI2MTI5NiB6IiBmaWxsPSJjcmltc29uIiBzdHJva2Utd2lkdGg9IjIiLz4KICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0ibSA4LjExNDc1NjIsMi4wNTI5ODI4IGMgMy4zNDkxNjk4LDAgNi4wNjQxMzI4LDIuNjc2ODYyNyA2LjA2NDEzMjgsNS45Nzg5NTMgMCwzLjMwMjExMjIgLTIuNzE0OTYzLDUuOTc4OTIwMiAtNi4wNjQxMzI4LDUuOTc4OTIwMiAtMy4zNDkxNDczLDAgLTYuMDY0MTc3MiwtMi42NzY4MDggLTYuMDY0MTc3MiwtNS45Nzg5MjAyIDAuMDA1MzksLTMuMjk5ODg2MSAyLjcxNzI2NTYsLTUuOTczNjQwOCA2LjA2NDE3NzIsLTUuOTc4OTUzIHogbSAwLC0xLjczNTgyNzE5IGMgLTQuMzIxNDgzNiwwIC03LjgyNDc0MDM4LDMuNDU0MDE4NDkgLTcuODI0NzQwMzgsNy43MTQ3ODAxOSAwLDQuMjYwNzI4MiAzLjUwMzI1Njc4LDcuNzE0NzQ1MiA3LjgyNDc0MDM4LDcuNzE0NzQ1MiA0LjMyMTQ0OTgsMCA3LjgyNDY5OTgsLTMuNDU0MDE3IDcuODI0Njk5OCwtNy43MTQ3NDUyIDAsLTIuMDQ2MDkxNCAtMC44MjQzOTIsLTQuMDA4MzY3MiAtMi4yOTE3NTYsLTUuNDU1MTc0NiBDIDEyLjE4MDIyNSwxLjEyOTk2NDggMTAuMTkwMDEzLDAuMzE3MTU1NjEgOC4xMTQ3NTYyLDAuMzE3MTU1NjEgWiBNIDYuOTM3NDU2Myw4LjI0MDU5ODUgNC42NzE4Njg1LDEwLjQ4NTg1MiA2LjAwODY4MTQsMTEuODc2NzI4IDguMzE3MDAzNSw5LjYwMDc5MTEgMTAuNjI1MzM3LDExLjg3NjcyOCAxMS45NjIxMzgsMTAuNDg1ODUyIDkuNjk2NTUwOCw4LjI0MDU5ODUgMTEuOTYyMTM4LDYuMDA2ODA2NiAxMC41NzMyNDYsNC42Mzc0MzM1IDguMzE3MDAzNSw2Ljg3MzQyOTcgNi4wNjA3NjA3LDQuNjM3NDMzNSA0LjY3MTg2ODUsNi4wMDY4MDY2IFoiIGZpbGw9ImNyaW1zb24iIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4="); background-color: crimson; } .ace_icon_svg.ace_security_fold { -webkit-mask-image: url("data:image/svg+xml;base64,CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTcgMTQiIGZpbGw9Im5vbmUiPgogICAgPHBhdGggZD0iTTEwLjAwMDEgMTMuNjk5MkMxMC4wMDAxIDEzLjY5OTIgMTEuOTI0MSAxMy40NzYzIDEzIDEyLjY5OTJDMTQuNDEzOSAxMS42NzgxIDE2IDEwLjUgMTYuMTI1MSA2LjgxMTI2VjIuNTg5ODdDMTYuMTI1MSAyLjU0NzY4IDE2LjEyMjEgMi41MDYxOSAxNi4xMTY0IDIuNDY1NTlWMS43MTQ4NUgxNS4yNDE0TDE1LjIzMDcgMS43MTQ4NEwxNC42MjUxIDEuNjk5MjJWNi44MTEyM0MxNC42MjUxIDguNTEwNjEgMTQuNjI1MSA5LjQ2NDYxIDEyLjc4MjQgMTEuNzIxQzEyLjE1ODYgMTIuNDg0OCAxMC4wMDAxIDEzLjY5OTIgMTAuMDAwMSAxMy42OTkyWiIgZmlsbD0iY3JpbXNvbiIgc3Ryb2tlLXdpZHRoPSIyIi8+CiAgICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTcuMzM2MDkgMC4zNjc0NzVDNy4wMzIxNCAwLjE1MjY1MiA2LjYyNTQ4IDAuMTUzNjE0IDYuMzIyNTMgMC4zNjk5OTdMNi4zMDg2OSAwLjM3OTU1NEM2LjI5NTUzIDAuMzg4NTg4IDYuMjczODggMC40MDMyNjYgNi4yNDQxNyAwLjQyMjc4OUM2LjE4NDcxIDAuNDYxODYgNi4wOTMyMSAwLjUyMDE3MSA1Ljk3MzEzIDAuNTkxMzczQzUuNzMyNTEgMC43MzQwNTkgNS4zNzk5IDAuOTI2ODY0IDQuOTQyNzkgMS4xMjAwOUM0LjA2MTQ0IDEuNTA5NyAyLjg3NTQxIDEuODgzNzcgMS41ODk4NCAxLjg4Mzc3SDAuNzE0ODQ0VjIuNzU4NzdWNi45ODAxNUMwLjcxNDg0NCA5LjQ5Mzc0IDIuMjg4NjYgMTEuMTk3MyAzLjcwMjU0IDEyLjIxODVDNC40MTg0NSAxMi43MzU1IDUuMTI4NzQgMTMuMTA1MyA1LjY1NzMzIDEzLjM0NTdDNS45MjI4NCAxMy40NjY0IDYuMTQ1NjYgMTMuNTU1OSA2LjMwNDY1IDEzLjYxNjFDNi4zODQyMyAxMy42NDYyIDYuNDQ4MDUgMTMuNjY5IDYuNDkzNDkgMTMuNjg0OEM2LjUxNjIyIDEzLjY5MjcgNi41MzQzOCAxMy42OTg5IDYuNTQ3NjQgMTMuNzAzM0w2LjU2MzgyIDEzLjcwODdMNi41NjkwOCAxMy43MTA0TDYuNTcwOTkgMTMuNzExTDYuODM5ODQgMTMuNzUzM0w2LjU3MjQyIDEzLjcxMTVDNi43NDYzMyAxMy43NjczIDYuOTMzMzUgMTMuNzY3MyA3LjEwNzI3IDEzLjcxMTVMNy4xMDg3IDEzLjcxMUw3LjExMDYxIDEzLjcxMDRMNy4xMTU4NyAxMy43MDg3TDcuMTMyMDUgMTMuNzAzM0M3LjE0NTMxIDEzLjY5ODkgNy4xNjM0NiAxMy42OTI3IDcuMTg2MTkgMTMuNjg0OEM3LjIzMTY0IDEzLjY2OSA3LjI5NTQ2IDEzLjY0NjIgNy4zNzUwMyAxMy42MTYxQzcuNTM0MDMgMTMuNTU1OSA3Ljc1Njg1IDEzLjQ2NjQgOC4wMjIzNiAxMy4zNDU3QzguNTUwOTUgMTMuMTA1MyA5LjI2MTIzIDEyLjczNTUgOS45NzcxNSAxMi4yMTg1QzExLjM5MSAxMS4xOTczIDEyLjk2NDggOS40OTM3NyAxMi45NjQ4IDYuOTgwMThWMi43NTg4QzEyLjk2NDggMi43MTY2IDEyLjk2MTkgMi42NzUxMSAxMi45NTYxIDIuNjM0NTFWMS44ODM3N0gxMi4wODExQzEyLjA3NzUgMS44ODM3NyAxMi4wNzQgMS44ODM3NyAxMi4wNzA0IDEuODgzNzdDMTAuNzk3OSAxLjg4MDA0IDkuNjE5NjIgMS41MTEwMiA4LjczODk0IDEuMTI0ODZDOC43MzUzNCAxLjEyMzI3IDguNzMxNzQgMS4xMjE2OCA4LjcyODE0IDEuMTIwMDlDOC4yOTEwMyAwLjkyNjg2NCA3LjkzODQyIDAuNzM0MDU5IDcuNjk3NzkgMC41OTEzNzNDNy41Nzc3MiAwLjUyMDE3MSA3LjQ4NjIyIDAuNDYxODYgNy40MjY3NiAwLjQyMjc4OUM3LjM5NzA1IDAuNDAzMjY2IDcuMzc1MzkgMC4zODg1ODggNy4zNjIyNCAwLjM3OTU1NEw3LjM0ODk2IDAuMzcwMzVDNy4zNDg5NiAwLjM3MDM1IDcuMzQ4NDcgMC4zNzAwMiA3LjM0NTYzIDAuMzc0MDU0TDcuMzM3NzkgMC4zNjg2NTlMNy4zMzYwOSAwLjM2NzQ3NVpNOC4wMzQ3MSAyLjcyNjkxQzguODYwNCAzLjA5MDYzIDkuOTYwNjYgMy40NjMwOSAxMS4yMDYxIDMuNTg5MDdWNi45ODAxNUgxMS4yMTQ4QzExLjIxNDggOC42Nzk1MyAxMC4xNjM3IDkuOTI1MDcgOC45NTI1NCAxMC43OTk4QzguMzU1OTUgMTEuMjMwNiA3Ljc1Mzc0IDExLjU0NTQgNy4yOTc5NiAxMS43NTI3QzcuMTE2NzEgMTEuODM1MSA2Ljk2MDYyIDExLjg5OTYgNi44Mzk4NCAxMS45NDY5QzYuNzE5MDYgMTEuODk5NiA2LjU2Mjk3IDExLjgzNTEgNi4zODE3MyAxMS43NTI3QzUuOTI1OTUgMTEuNTQ1NCA1LjMyMzczIDExLjIzMDYgNC43MjcxNSAxMC43OTk4QzMuNTE2MDMgOS45MjUwNyAyLjQ2NDg0IDguNjc5NTUgMi40NjQ4NCA2Ljk4MDE4VjMuNTg5MDlDMy43MTczOCAzLjQ2MjM5IDQuODIzMDggMy4wODYzOSA1LjY1MDMzIDIuNzIwNzFDNi4xNDIyOCAyLjUwMzI0IDYuNTQ0ODUgMi4yODUzNyA2LjgzMjU0IDIuMTE2MjRDNy4xMjE4MSAyLjI4NTM1IDcuNTI3IDIuNTAzNTIgOC4wMjE5NiAyLjcyMTMxQzguMDI2MiAyLjcyMzE3IDguMDMwNDUgMi43MjUwNCA4LjAzNDcxIDIuNzI2OTFaTTUuOTY0ODQgMy40MDE0N1Y3Ljc3NjQ3SDcuNzE0ODRWMy40MDE0N0g1Ljk2NDg0Wk01Ljk2NDg0IDEwLjQwMTVWOC42NTE0N0g3LjcxNDg0VjEwLjQwMTVINS45NjQ4NFoiIGZpbGw9ImNyaW1zb24iIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4="); background-color: crimson; } .ace_icon_svg.ace_warning_fold { -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNC43NzY5IDE0LjczMzdMOC42NTE5MiAyLjQ4MzY5QzguMzI5NDYgMS44Mzg3NyA3LjQwOTEzIDEuODM4NzcgNy4wODY2NyAyLjQ4MzY5TDAuOTYxNjY5IDE0LjczMzdDMC42NzA3NzUgMTUuMzE1NSAxLjA5MzgzIDE2IDEuNzQ0MjkgMTZIMTMuOTk0M0MxNC42NDQ4IDE2IDE1LjA2NzggMTUuMzE1NSAxNC43NzY5IDE0LjczMzdaTTMuMTYwMDcgMTQuMjVMNy44NjkyOSA0LjgzMTU2TDEyLjU3ODUgMTQuMjVIMy4xNjAwN1pNOC43NDQyOSAxMS42MjVWMTMuMzc1SDYuOTk0MjlWMTEuNjI1SDguNzQ0MjlaTTYuOTk0MjkgMTAuNzVWNy4yNUg4Ljc0NDI5VjEwLjc1SDYuOTk0MjlaIiBmaWxsPSIjRUM3MjExIi8+CjxwYXRoIGQ9Ik0xMS4xOTkxIDIuOTUyMzhDMTAuODgwOSAyLjMxNDY3IDEwLjM1MzcgMS44MDUyNiA5LjcwNTUgMS41MDlMMTEuMDQxIDEuMDY5NzhDMTEuNjg4MyAwLjk0OTgxNCAxMi4zMzcgMS4yNzI2MyAxMi42MzE3IDEuODYxNDFMMTcuNjEzNiAxMS44MTYxQzE4LjM1MjcgMTMuMjkyOSAxNy41OTM4IDE1LjA4MDQgMTYuMDE4IDE1LjU3NDVDMTYuNDA0NCAxNC40NTA3IDE2LjMyMzEgMTMuMjE4OCAxNS43OTI0IDEyLjE1NTVMMTEuMTk5MSAyLjk1MjM4WiIgZmlsbD0iI0VDNzIxMSIvPgo8L3N2Zz4="); background-color: darkorange; } .ace_scrollbar { contain: strict; position: absolute; right: 0; bottom: 0; z-index: 6; } .ace_scrollbar-inner { position: absolute; cursor: text; left: 0; top: 0; } .ace_scrollbar-v{ overflow-x: hidden; overflow-y: scroll; top: 0; } .ace_scrollbar-h { overflow-x: scroll; overflow-y: hidden; left: 0; } .ace_print-margin { position: absolute; height: 100%; } .ace_text-input { position: absolute; z-index: 0; width: 0.5em; height: 1em; opacity: 0; background: transparent; -moz-appearance: none; appearance: none; border: none; resize: none; outline: none; overflow: hidden; font: inherit; padding: 0 1px; margin: 0 -1px; contain: strict; -ms-user-select: text; -moz-user-select: text; -webkit-user-select: text; user-select: text; /*with \`pre-line\` chrome inserts   instead of space*/ white-space: pre!important; } .ace_text-input.ace_composition { background: transparent; color: inherit; z-index: 1000; opacity: 1; } .ace_composition_placeholder { color: transparent } .ace_composition_marker { border-bottom: 1px solid; position: absolute; border-radius: 0; margin-top: 1px; } [ace_nocontext=true] { transform: none!important; filter: none!important; clip-path: none!important; mask : none!important; contain: none!important; perspective: none!important; mix-blend-mode: initial!important; z-index: auto; } .ace_layer { z-index: 1; position: absolute; overflow: hidden; /* workaround for chrome bug https://github.com/ajaxorg/ace/issues/2312*/ word-wrap: normal; white-space: pre; height: 100%; width: 100%; box-sizing: border-box; /* setting pointer-events: auto; on node under the mouse, which changes during scroll, will break mouse wheel scrolling in Safari */ pointer-events: none; } .ace_gutter-layer { position: relative; width: auto; text-align: right; pointer-events: auto; height: 1000000px; contain: style size layout; } .ace_text-layer { font: inherit !important; position: absolute; height: 1000000px; width: 1000000px; contain: style size layout; } .ace_text-layer > .ace_line, .ace_text-layer > .ace_line_group { contain: style size layout; position: absolute; top: 0; left: 0; right: 0; } .ace_hidpi .ace_text-layer, .ace_hidpi .ace_gutter-layer, .ace_hidpi .ace_content, .ace_hidpi .ace_gutter { contain: strict; } .ace_hidpi .ace_text-layer > .ace_line, .ace_hidpi .ace_text-layer > .ace_line_group { contain: strict; } .ace_cjk { display: inline-block; text-align: center; } .ace_cursor-layer { z-index: 4; } .ace_cursor { z-index: 4; position: absolute; box-sizing: border-box; border-left: 2px solid; /* workaround for smooth cursor repaintng whole screen in chrome */ transform: translatez(0); } .ace_multiselect .ace_cursor { border-left-width: 1px; } .ace_slim-cursors .ace_cursor { border-left-width: 1px; } .ace_overwrite-cursors .ace_cursor { border-left-width: 0; border-bottom: 1px solid; } .ace_hidden-cursors .ace_cursor { opacity: 0.2; } .ace_hasPlaceholder .ace_hidden-cursors .ace_cursor { opacity: 0; } .ace_smooth-blinking .ace_cursor { transition: opacity 0.18s; } .ace_animate-blinking .ace_cursor { animation-duration: 1000ms; animation-timing-function: step-end; animation-name: blink-ace-animate; animation-iteration-count: infinite; } .ace_animate-blinking.ace_smooth-blinking .ace_cursor { animation-duration: 1000ms; animation-timing-function: ease-in-out; animation-name: blink-ace-animate-smooth; } @keyframes blink-ace-animate { from, to { opacity: 1; } 60% { opacity: 0; } } @keyframes blink-ace-animate-smooth { from, to { opacity: 1; } 45% { opacity: 1; } 60% { opacity: 0; } 85% { opacity: 0; } } .ace_marker-layer .ace_step, .ace_marker-layer .ace_stack { position: absolute; z-index: 3; } .ace_marker-layer .ace_selection { position: absolute; z-index: 5; } .ace_marker-layer .ace_bracket { position: absolute; z-index: 6; } .ace_marker-layer .ace_error_bracket { position: absolute; border-bottom: 1px solid #DE5555; border-radius: 0; } .ace_marker-layer .ace_active-line { position: absolute; z-index: 2; } .ace_marker-layer .ace_selected-word { position: absolute; z-index: 4; box-sizing: border-box; } .ace_line .ace_fold { box-sizing: border-box; display: inline-block; height: 11px; margin-top: -2px; vertical-align: middle; background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="), url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII="); background-repeat: no-repeat, repeat-x; background-position: center center, top left; color: transparent; border: 1px solid black; border-radius: 2px; cursor: pointer; pointer-events: auto; } .ace_dark .ace_fold { } .ace_fold:hover{ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="), url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC"); } .ace_tooltip { background-color: #f5f5f5; border: 1px solid gray; border-radius: 1px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); color: black; padding: 3px 4px; position: fixed; z-index: 999999; box-sizing: border-box; cursor: default; white-space: pre-wrap; word-wrap: break-word; line-height: normal; font-style: normal; font-weight: normal; letter-spacing: normal; pointer-events: none; overflow: auto; max-width: min(33em, 66vw); overscroll-behavior: contain; } .ace_tooltip pre { white-space: pre-wrap; } .ace_tooltip.ace_dark { background-color: #636363; color: #fff; } .ace_tooltip:focus { outline: 1px solid #5E9ED6; } .ace_icon { display: inline-block; width: 18px; vertical-align: top; } .ace_icon_svg { display: inline-block; width: 12px; vertical-align: top; -webkit-mask-repeat: no-repeat; -webkit-mask-size: 12px; -webkit-mask-position: center; } .ace_folding-enabled > .ace_gutter-cell, .ace_folding-enabled > .ace_gutter-cell_svg-icons { padding-right: 13px; } .ace_fold-widget, .ace_custom-widget { box-sizing: border-box; margin: 0 -12px 0 1px; display: none; width: 11px; vertical-align: top; background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg=="); background-repeat: no-repeat; background-position: center; border-radius: 3px; border: 1px solid transparent; cursor: pointer; pointer-events: auto; } .ace_custom-widget { background: none; } .ace_folding-enabled .ace_fold-widget { display: inline-block; } .ace_fold-widget.ace_end { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg=="); } .ace_fold-widget.ace_closed { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA=="); } .ace_fold-widget:hover { border: 1px solid rgba(0, 0, 0, 0.3); background-color: rgba(255, 255, 255, 0.2); box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7); } .ace_fold-widget:active { border: 1px solid rgba(0, 0, 0, 0.4); background-color: rgba(0, 0, 0, 0.05); box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8); } /** * Dark version for fold widgets */ .ace_dark .ace_fold-widget { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC"); } .ace_dark .ace_fold-widget.ace_end { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg=="); } .ace_dark .ace_fold-widget.ace_closed { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg=="); } .ace_dark .ace_fold-widget:hover { box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2); background-color: rgba(255, 255, 255, 0.1); } .ace_dark .ace_fold-widget:active { box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2); } .ace_inline_button { border: 1px solid lightgray; display: inline-block; margin: -1px 8px; padding: 0 5px; pointer-events: auto; cursor: pointer; } .ace_inline_button:hover { border-color: gray; background: rgba(200,200,200,0.2); display: inline-block; pointer-events: auto; } .ace_fold-widget.ace_invalid { background-color: #FFB4B4; border-color: #DE5555; } .ace_fade-fold-widgets .ace_fold-widget { transition: opacity 0.4s ease 0.05s; opacity: 0; } .ace_fade-fold-widgets:hover .ace_fold-widget { transition: opacity 0.05s ease 0.05s; opacity:1; } .ace_underline { text-decoration: underline; } .ace_bold { font-weight: bold; } .ace_nobold .ace_bold { font-weight: normal; } .ace_italic { font-style: italic; } .ace_error-marker { background-color: rgba(255, 0, 0,0.2); position: absolute; z-index: 9; } .ace_highlight-marker { background-color: rgba(255, 255, 0,0.2); position: absolute; z-index: 8; } .ace_mobile-menu { position: absolute; line-height: 1.5; border-radius: 4px; -ms-user-select: none; -moz-user-select: none; -webkit-user-select: none; user-select: none; background: white; box-shadow: 1px 3px 2px grey; border: 1px solid #dcdcdc; color: black; } .ace_dark > .ace_mobile-menu { background: #333; color: #ccc; box-shadow: 1px 3px 2px grey; border: 1px solid #444; } .ace_mobile-button { padding: 2px; cursor: pointer; overflow: hidden; } .ace_mobile-button:hover { background-color: #eee; opacity:1; } .ace_mobile-button:active { background-color: #ddd; } .ace_placeholder { position: relative; font-family: arial; transform: scale(0.9); transform-origin: left; white-space: pre; opacity: 0.7; margin: 0 10px; z-index: 1; } .ace_ghost_text { opacity: 0.5; font-style: italic; } .ace_ghost_text_container > div { white-space: pre; } .ghost_text_line_wrapped::after { content: "↩"; position: absolute; } .ace_lineWidgetContainer.ace_ghost_text { margin: 0px 4px } .ace_screenreader-only { position:absolute; left:-10000px; top:auto; width:1px; height:1px; overflow:hidden; } .ace_hidden_token { display: none; }`}),ace.define("ace/layer/decorators",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter"],function(n,r,i){var o=n("../lib/dom"),s=n("../lib/oop"),a=n("../lib/event_emitter").EventEmitter,l=function(){function c(u,d){this.parentEl=u,this.canvas=o.createElement("canvas"),this.renderer=d,this.pixelRatio=1,this.maxHeight=d.layerConfig.maxHeight,this.lineHeight=d.layerConfig.lineHeight,this.minDecorationHeight=2*this.pixelRatio|0,this.halfMinDecorationHeight=this.minDecorationHeight/2|0,this.canvas.style.top="0px",this.canvas.style.right="0px",this.canvas.style.zIndex="7px",this.canvas.style.position="absolute",this.colors={},this.colors.dark={error:"rgba(255, 18, 18, 1)",warning:"rgba(18, 136, 18, 1)",info:"rgba(18, 18, 136, 1)"},this.colors.light={error:"rgb(255,51,51)",warning:"rgb(32,133,72)",info:"rgb(35,68,138)"},this.setDimensions(),u.element.appendChild(this.canvas)}return c.prototype.$updateDecorators=function(u){var d=this.renderer.theme.isDark===!0?this.colors.dark:this.colors.light;this.setDimensions(u);var p=this.canvas.getContext("2d");function m($,W){return $.priorityW.priority?1:0}var y=this.renderer.session.$annotations;if(p.clearRect(0,0,this.canvas.width,this.canvas.height),y){var w={info:1,warning:2,error:3};y.forEach(function($){$.priority=w[$.type]||null}),y=y.sort(m);for(var x=0;xthis.canvasHeight&&(O=this.canvasHeight-this.halfMinDecorationHeight),E=Math.round(O-this.halfMinDecorationHeight),A=Math.round(O+this.halfMinDecorationHeight)}p.fillStyle=d[y[x].type]||null,p.fillRect(0,M,this.canvasWidth,A-E)}}var z=this.renderer.session.selection.getCursor();if(z){var S=this.compensateFoldRows(z.row),M=Math.round((z.row-S)*this.lineHeight*this.heightRatio);p.fillStyle="rgba(0, 0, 0, 0.5)",p.fillRect(0,M,this.canvasWidth,2)}},c.prototype.compensateFoldRows=function(u){var d=this.renderer.session.$foldData,p=0;if(d&&d.length>0)for(var m=0;md[m].start.row&&u=d[m].end.row&&(p+=d[m].end.row-d[m].start.row);return p},c.prototype.compensateLineWidgets=function(u){var d=this.renderer.session.widgetManager;if(d){var p=0;return d.lineWidgets.forEach(function(m,y){u>y&&(p+=m.rowCount||0)}),p-1}return 0},c.prototype.setDimensions=function(u){u?(this.maxHeight=u.maxHeight,this.lineHeight=u.lineHeight,this.canvasHeight=u.height,this.maxHeightW&&(this.$changedLines.firstRow=W),this.$changedLines.lastRowthis.layerConfig.lastRow||this.$loop.schedule(this.CHANGE_LINES)},$.prototype.onChangeNewLineMode=function(){this.$loop.schedule(this.CHANGE_TEXT),this.$textLayer.$updateEolChar(),this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR)},$.prototype.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},$.prototype.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},$.prototype.updateFull=function(W){W?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},$.prototype.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},$.prototype.$updateSizeAsync=function(){this.$loop.pending?this.$size.$dirty=!0:this.onResize()},$.prototype.onResize=function(W,J,Z,q){if(!(this.resizing>2)){this.resizing>0?this.resizing++:this.resizing=W?1:0;var j=this.container;q||(q=j.clientHeight||j.scrollHeight),!q&&this.$maxLines&&this.lineHeight>1&&(!j.style.height||j.style.height=="0px")&&(j.style.height="1px",q=j.clientHeight||j.scrollHeight),Z||(Z=j.clientWidth||j.scrollWidth);var G=this.$updateCachedSize(W,J,Z,q);if(this.$resizeTimer&&this.$resizeTimer.cancel(),!this.$size.scrollerHeight||!Z&&!q)return this.resizing=0;W&&(this.$gutterLayer.$padding=null),W?this.$renderChanges(G|this.$changes,!0):this.$loop.schedule(G|this.$changes),this.resizing&&(this.resizing=0),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.$customScrollbar&&this.$updateCustomScrollbar(!0)}},$.prototype.$updateCachedSize=function(W,J,Z,q){q-=this.$extraHeight||0;var j=0,G=this.$size,U={width:G.width,height:G.height,scrollerHeight:G.scrollerHeight,scrollerWidth:G.scrollerWidth};if(q&&(W||G.height!=q)&&(G.height=q,j|=this.CHANGE_SIZE,G.scrollerHeight=G.height,this.$horizScroll&&(G.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.setHeight(G.scrollerHeight),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",j=j|this.CHANGE_SCROLL),Z&&(W||G.width!=Z)){j|=this.CHANGE_SIZE,G.width=Z,J==null&&(J=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=J,s.setStyle(this.scrollBarH.element.style,"left",J+"px"),s.setStyle(this.scroller.style,"left",J+this.margin.left+"px"),G.scrollerWidth=Math.max(0,Z-J-this.scrollBarV.getWidth()-this.margin.h),s.setStyle(this.$gutter.style,"left",this.margin.left+"px");var Q=this.scrollBarV.getWidth()+"px";s.setStyle(this.scrollBarH.element.style,"right",Q),s.setStyle(this.scroller.style,"right",Q),s.setStyle(this.scroller.style,"bottom",this.scrollBarH.getHeight()),this.scrollBarH.setWidth(G.scrollerWidth),(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||W)&&(j|=this.CHANGE_FULL)}return G.$dirty=!Z||!q,j&&this._signal("resize",U),j},$.prototype.onGutterResize=function(W){var J=this.$showGutter?W:0;J!=this.gutterWidth&&(this.$changes|=this.$updateCachedSize(!0,J,this.$size.width,this.$size.height)),this.session.getUseWrapMode()&&this.adjustWrapLimit()?this.$loop.schedule(this.CHANGE_FULL):this.$size.$dirty?this.$loop.schedule(this.CHANGE_FULL):this.$computeLayerConfig()},$.prototype.adjustWrapLimit=function(){var W=this.$size.scrollerWidth-this.$padding*2,J=Math.floor(W/this.characterWidth);return this.session.adjustWrapLimit(J,this.$showPrintMargin&&this.$printMarginColumn)},$.prototype.setAnimatedScroll=function(W){this.setOption("animatedScroll",W)},$.prototype.getAnimatedScroll=function(){return this.$animatedScroll},$.prototype.setShowInvisibles=function(W){this.setOption("showInvisibles",W),this.session.$bidiHandler.setShowInvisibles(W)},$.prototype.getShowInvisibles=function(){return this.getOption("showInvisibles")},$.prototype.getDisplayIndentGuides=function(){return this.getOption("displayIndentGuides")},$.prototype.setDisplayIndentGuides=function(W){this.setOption("displayIndentGuides",W)},$.prototype.getHighlightIndentGuides=function(){return this.getOption("highlightIndentGuides")},$.prototype.setHighlightIndentGuides=function(W){this.setOption("highlightIndentGuides",W)},$.prototype.setShowPrintMargin=function(W){this.setOption("showPrintMargin",W)},$.prototype.getShowPrintMargin=function(){return this.getOption("showPrintMargin")},$.prototype.setPrintMarginColumn=function(W){this.setOption("printMarginColumn",W)},$.prototype.getPrintMarginColumn=function(){return this.getOption("printMarginColumn")},$.prototype.getShowGutter=function(){return this.getOption("showGutter")},$.prototype.setShowGutter=function(W){return this.setOption("showGutter",W)},$.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},$.prototype.setFadeFoldWidgets=function(W){this.setOption("fadeFoldWidgets",W)},$.prototype.setHighlightGutterLine=function(W){this.setOption("highlightGutterLine",W)},$.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},$.prototype.$updatePrintMargin=function(){if(!(!this.$showPrintMargin&&!this.$printMarginEl)){if(!this.$printMarginEl){var W=s.createElement("div");W.className="ace_layer ace_print-margin-layer",this.$printMarginEl=s.createElement("div"),this.$printMarginEl.className="ace_print-margin",W.appendChild(this.$printMarginEl),this.content.insertBefore(W,this.content.firstChild)}var J=this.$printMarginEl.style;J.left=Math.round(this.characterWidth*this.$printMarginColumn+this.$padding)+"px",J.visibility=this.$showPrintMargin?"visible":"hidden",this.session&&this.session.$wrap==-1&&this.adjustWrapLimit()}},$.prototype.getContainerElement=function(){return this.container},$.prototype.getMouseEventTarget=function(){return this.scroller},$.prototype.getTextAreaContainer=function(){return this.container},$.prototype.$moveTextAreaToCursor=function(){if(!this.$isMousePressed){var W=this.textarea.style,J=this.$composition;if(!this.$keepTextAreaAtCursor&&!J){s.translate(this.textarea,-100,0);return}var Z=this.$cursorLayer.$pixelPos;if(Z){J&&J.markerRange&&(Z=this.$cursorLayer.getPixelPosition(J.markerRange.start,!0));var q=this.layerConfig,j=Z.top,G=Z.left;j-=q.offset;var U=J&&J.useTextareaForIME||I.isMobile?this.lineHeight:1;if(j<0||j>q.height-U){s.translate(this.textarea,0,0);return}var Q=1,re=this.$size.height-U;if(!J)j+=this.lineHeight;else if(J.useTextareaForIME){var le=this.textarea.value;Q=this.characterWidth*this.session.$getStringScreenWidth(le)[0]}else j+=this.lineHeight+2;G-=this.scrollLeft,G>this.$size.scrollerWidth-Q&&(G=this.$size.scrollerWidth-Q),G+=this.gutterWidth+this.margin.left,s.setStyle(W,"height",U+"px"),s.setStyle(W,"width",Q+"px"),s.translate(this.textarea,Math.min(G,this.$size.scrollerWidth-Q),Math.min(j,re))}}},$.prototype.getFirstVisibleRow=function(){return this.layerConfig.firstRow},$.prototype.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+(this.layerConfig.offset===0?0:1)},$.prototype.getLastFullyVisibleRow=function(){var W=this.layerConfig,J=W.lastRow,Z=this.session.documentToScreenRow(J,0)*W.lineHeight;return Z-this.session.getScrollTop()>W.height-W.lineHeight?J-1:J},$.prototype.getLastVisibleRow=function(){return this.layerConfig.lastRow},$.prototype.setPadding=function(W){this.$padding=W,this.$textLayer.setPadding(W),this.$cursorLayer.setPadding(W),this.$markerFront.setPadding(W),this.$markerBack.setPadding(W),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},$.prototype.setScrollMargin=function(W,J,Z,q){var j=this.scrollMargin;j.top=W|0,j.bottom=J|0,j.right=q|0,j.left=Z|0,j.v=j.top+j.bottom,j.h=j.left+j.right,j.top&&this.scrollTop<=0&&this.session&&this.session.setScrollTop(-j.top),this.updateFull()},$.prototype.setMargin=function(W,J,Z,q){var j=this.margin;j.top=W|0,j.bottom=J|0,j.right=q|0,j.left=Z|0,j.v=j.top+j.bottom,j.h=j.left+j.right,this.$updateCachedSize(!0,this.gutterWidth,this.$size.width,this.$size.height),this.updateFull()},$.prototype.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},$.prototype.setHScrollBarAlwaysVisible=function(W){this.setOption("hScrollBarAlwaysVisible",W)},$.prototype.getVScrollBarAlwaysVisible=function(){return this.$vScrollBarAlwaysVisible},$.prototype.setVScrollBarAlwaysVisible=function(W){this.setOption("vScrollBarAlwaysVisible",W)},$.prototype.$updateScrollBarV=function(){var W=this.layerConfig.maxHeight,J=this.$size.scrollerHeight;!this.$maxLines&&this.$scrollPastEnd&&(W-=(J-this.lineHeight)*this.$scrollPastEnd,this.scrollTop>W-J&&(W=this.scrollTop+J,this.scrollBarV.scrollTop=null)),this.scrollBarV.setScrollHeight(W+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},$.prototype.$updateScrollBarH=function(){this.scrollBarH.setScrollWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},$.prototype.freeze=function(){this.$frozen=!0},$.prototype.unfreeze=function(){this.$frozen=!1},$.prototype.$renderChanges=function(W,J){if(this.$changes&&(W|=this.$changes,this.$changes=0),!this.session||!this.container.offsetWidth||this.$frozen||!W&&!J){this.$changes|=W;return}if(this.$size.$dirty)return this.$changes|=W,this.onResize(!0);this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal("beforeRender",W),this.session&&this.session.$bidiHandler&&this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);var Z=this.layerConfig;if(W&this.CHANGE_FULL||W&this.CHANGE_SIZE||W&this.CHANGE_TEXT||W&this.CHANGE_LINES||W&this.CHANGE_SCROLL||W&this.CHANGE_H_SCROLL){if(W|=this.$computeLayerConfig()|this.$loop.clear(),Z.firstRow!=this.layerConfig.firstRow&&Z.firstRowScreen==this.layerConfig.firstRowScreen){var q=this.scrollTop+(Z.firstRow-Math.max(this.layerConfig.firstRow,0))*this.lineHeight;q>0&&(this.scrollTop=q,W=W|this.CHANGE_SCROLL,W|=this.$computeLayerConfig()|this.$loop.clear())}Z=this.layerConfig,this.$updateScrollBarV(),W&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),s.translate(this.content,-this.scrollLeft,-Z.offset);var j=Z.width+2*this.$padding+"px",G=Z.minHeight+"px";s.setStyle(this.content.style,"width",j),s.setStyle(this.content.style,"height",G)}if(W&this.CHANGE_H_SCROLL&&(s.translate(this.content,-this.scrollLeft,-Z.offset),this.scroller.className=this.scrollLeft<=0?"ace_scroller ":"ace_scroller ace_scroll-left ",this.enableKeyboardAccessibility&&(this.scroller.className+=this.keyboardFocusClassName)),W&this.CHANGE_FULL){this.$changedLines=null,this.$textLayer.update(Z),this.$showGutter&&this.$gutterLayer.update(Z),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(Z),this.$markerBack.update(Z),this.$markerFront.update(Z),this.$cursorLayer.update(Z),this.$moveTextAreaToCursor(),this._signal("afterRender",W);return}if(W&this.CHANGE_SCROLL){this.$changedLines=null,W&this.CHANGE_TEXT||W&this.CHANGE_LINES?this.$textLayer.update(Z):this.$textLayer.scrollLines(Z),this.$showGutter&&(W&this.CHANGE_GUTTER||W&this.CHANGE_LINES?this.$gutterLayer.update(Z):this.$gutterLayer.scrollLines(Z)),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(Z),this.$markerBack.update(Z),this.$markerFront.update(Z),this.$cursorLayer.update(Z),this.$moveTextAreaToCursor(),this._signal("afterRender",W);return}W&this.CHANGE_TEXT?(this.$changedLines=null,this.$textLayer.update(Z),this.$showGutter&&this.$gutterLayer.update(Z),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(Z)):W&this.CHANGE_LINES?((this.$updateLines()||W&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(Z),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(Z)):W&this.CHANGE_TEXT||W&this.CHANGE_GUTTER?(this.$showGutter&&this.$gutterLayer.update(Z),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(Z)):W&this.CHANGE_CURSOR&&(this.$highlightGutterLine&&this.$gutterLayer.updateLineHighlight(Z),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(Z)),W&this.CHANGE_CURSOR&&(this.$cursorLayer.update(Z),this.$moveTextAreaToCursor()),W&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(Z),W&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(Z),this._signal("afterRender",W)},$.prototype.$autosize=function(){var W=this.session.getScreenLength()*this.lineHeight,J=this.$maxLines*this.lineHeight,Z=Math.min(J,Math.max((this.$minLines||1)*this.lineHeight,W))+this.scrollMargin.v+(this.$extraHeight||0);this.$horizScroll&&(Z+=this.scrollBarH.getHeight()),this.$maxPixelHeight&&Z>this.$maxPixelHeight&&(Z=this.$maxPixelHeight);var q=Z<=2*this.lineHeight,j=!q&&W>J;if(Z!=this.desiredHeight||this.$size.height!=this.desiredHeight||j!=this.$vScroll){j!=this.$vScroll&&(this.$vScroll=j,this.scrollBarV.setVisible(j));var G=this.container.clientWidth;this.container.style.height=Z+"px",this.$updateCachedSize(!0,this.$gutterWidth,G,Z),this.desiredHeight=Z,this._signal("autosize")}},$.prototype.$computeLayerConfig=function(){var W=this.session,J=this.$size,Z=J.height<=2*this.lineHeight,q=this.session.getScreenLength(),j=q*this.lineHeight,G=this.$getLongestLine(),U=!Z&&(this.$hScrollBarAlwaysVisible||J.scrollerWidth-G-2*this.$padding<0),Q=this.$horizScroll!==U;Q&&(this.$horizScroll=U,this.scrollBarH.setVisible(U));var re=this.$vScroll;this.$maxLines&&this.lineHeight>1&&(this.$autosize(),Z=J.height<=2*this.lineHeight);var le=J.scrollerHeight+this.lineHeight,oe=!this.$maxLines&&this.$scrollPastEnd?(J.scrollerHeight-this.lineHeight)*this.$scrollPastEnd:0;j+=oe;var he=this.scrollMargin;this.session.setScrollTop(Math.max(-he.top,Math.min(this.scrollTop,j-J.scrollerHeight+he.bottom))),this.session.setScrollLeft(Math.max(-he.left,Math.min(this.scrollLeft,G+2*this.$padding-J.scrollerWidth+he.right)));var xe=!Z&&(this.$vScrollBarAlwaysVisible||J.scrollerHeight-j+oe<0||this.scrollTop>he.top),Ee=re!==xe;Ee&&(this.$vScroll=xe,this.scrollBarV.setVisible(xe));var Ie=this.scrollTop%this.lineHeight,Oe=Math.ceil(le/this.lineHeight)-1,$e=Math.max(0,Math.round((this.scrollTop-Ie)/this.lineHeight)),Ze=$e+Oe,lt,pt,yt=this.lineHeight;$e=W.screenToDocumentRow($e,0);var Lt=W.getFoldLine($e);Lt&&($e=Lt.start.row),lt=W.documentToScreenRow($e,0),pt=W.getRowLength($e)*yt,Ze=Math.min(W.screenToDocumentRow(Ze,0),W.getLength()-1),le=J.scrollerHeight+W.getRowLength(Ze)*yt+pt,Ie=this.scrollTop-lt*yt,Ie<0&<>0&&(lt=Math.max(0,lt+Math.floor(Ie/yt)),Ie=this.scrollTop-lt*yt);var hn=0;return(this.layerConfig.width!=G||Q)&&(hn=this.CHANGE_H_SCROLL),(Q||Ee)&&(hn|=this.$updateCachedSize(!0,this.gutterWidth,J.width,J.height),this._signal("scrollbarVisibilityChanged"),Ee&&(G=this.$getLongestLine())),this.layerConfig={width:G,padding:this.$padding,firstRow:$e,firstRowScreen:lt,lastRow:Ze,lineHeight:yt,characterWidth:this.characterWidth,minHeight:le,maxHeight:j,offset:Ie,gutterOffset:yt?Math.max(0,Math.ceil((Ie+J.height-J.scrollerHeight)/yt)):0,height:this.$size.scrollerHeight},this.session.$bidiHandler&&this.session.$bidiHandler.setContentWidth(G-this.$padding),hn},$.prototype.$updateLines=function(){if(this.$changedLines){var W=this.$changedLines.firstRow,J=this.$changedLines.lastRow;this.$changedLines=null;var Z=this.layerConfig;if(!(W>Z.lastRow+1)&&!(Jthis.$textLayer.MAX_LINE_LENGTH&&(W=this.$textLayer.MAX_LINE_LENGTH+30),Math.max(this.$size.scrollerWidth-2*this.$padding,Math.round(W*this.characterWidth))},$.prototype.updateFrontMarkers=function(){this.$markerFront.setMarkers(this.session.getMarkers(!0)),this.$loop.schedule(this.CHANGE_MARKER_FRONT)},$.prototype.updateBackMarkers=function(){this.$markerBack.setMarkers(this.session.getMarkers()),this.$loop.schedule(this.CHANGE_MARKER_BACK)},$.prototype.addGutterDecoration=function(W,J){this.$gutterLayer.addGutterDecoration(W,J)},$.prototype.removeGutterDecoration=function(W,J){this.$gutterLayer.removeGutterDecoration(W,J)},$.prototype.updateBreakpoints=function(W){this._rows=W,this.$loop.schedule(this.CHANGE_GUTTER)},$.prototype.setAnnotations=function(W){this.$gutterLayer.setAnnotations(W),this.$loop.schedule(this.CHANGE_GUTTER)},$.prototype.updateCursor=function(){this.$loop.schedule(this.CHANGE_CURSOR)},$.prototype.hideCursor=function(){this.$cursorLayer.hideCursor()},$.prototype.showCursor=function(){this.$cursorLayer.showCursor()},$.prototype.scrollSelectionIntoView=function(W,J,Z){this.scrollCursorIntoView(W,Z),this.scrollCursorIntoView(J,Z)},$.prototype.scrollCursorIntoView=function(W,J,Z){if(this.$size.scrollerHeight!==0){var q=this.$cursorLayer.getPixelPosition(W),j=q.left,G=q.top,U=Z&&Z.top||0,Q=Z&&Z.bottom||0;this.$scrollAnimation&&(this.$stopAnimation=!0);var re=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;re+U>G?(J&&re+U>G+this.lineHeight&&(G-=J*this.$size.scrollerHeight),G===0&&(G=-this.scrollMargin.top),this.session.setScrollTop(G)):re+this.$size.scrollerHeight-Q=1-this.scrollMargin.top||J>0&&this.session.getScrollTop()+this.$size.scrollerHeight-this.layerConfig.maxHeight<-1+this.scrollMargin.bottom||W<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left||W>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right)return!0},$.prototype.pixelToScreenCoordinates=function(W,J){var Z;if(this.$hasCssTransforms){Z={top:0,left:0};var q=this.$fontMetrics.transformCoordinates([W,J]);W=q[1]-this.gutterWidth-this.margin.left,J=q[0]}else Z=this.scroller.getBoundingClientRect();var j=W+this.scrollLeft-Z.left-this.$padding,G=j/this.characterWidth,U=Math.floor((J+this.scrollTop-Z.top)/this.lineHeight),Q=this.$blockCursor?Math.floor(G):Math.round(G);return{row:U,column:Q,side:G-Q>0?1:-1,offsetX:j}},$.prototype.screenToTextCoordinates=function(W,J){var Z;if(this.$hasCssTransforms){Z={top:0,left:0};var q=this.$fontMetrics.transformCoordinates([W,J]);W=q[1]-this.gutterWidth-this.margin.left,J=q[0]}else Z=this.scroller.getBoundingClientRect();var j=W+this.scrollLeft-Z.left-this.$padding,G=j/this.characterWidth,U=this.$blockCursor?Math.floor(G):Math.round(G),Q=Math.floor((J+this.scrollTop-Z.top)/this.lineHeight);return this.session.screenToDocumentPosition(Q,Math.max(U,0),j)},$.prototype.textToScreenCoordinates=function(W,J){var Z=this.scroller.getBoundingClientRect(),q=this.session.documentToScreenPosition(W,J),j=this.$padding+(this.session.$bidiHandler.isBidiRow(q.row,W)?this.session.$bidiHandler.getPosLeft(q.column):Math.round(q.column*this.characterWidth)),G=q.row*this.lineHeight;return{pageX:Z.left+j-this.scrollLeft,pageY:Z.top+G-this.scrollTop}},$.prototype.visualizeFocus=function(){s.addCssClass(this.container,"ace_focus")},$.prototype.visualizeBlur=function(){s.removeCssClass(this.container,"ace_focus")},$.prototype.showComposition=function(W){this.$composition=W,W.cssText||(W.cssText=this.textarea.style.cssText),W.useTextareaForIME==null&&(W.useTextareaForIME=this.$useTextareaForIME),this.$useTextareaForIME?(s.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor(),this.$cursorLayer.element.style.display="none"):W.markerId=this.session.addMarker(W.markerRange,"ace_composition_marker","text")},$.prototype.setCompositionText=function(W){var J=this.session.selection.cursor;this.addToken(W,"composition_placeholder",J.row,J.column),this.$moveTextAreaToCursor()},$.prototype.hideComposition=function(){if(this.$composition){this.$composition.markerId&&this.session.removeMarker(this.$composition.markerId),s.removeCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText=this.$composition.cssText;var W=this.session.selection.cursor;this.removeExtraToken(W.row,W.column),this.$composition=null,this.$cursorLayer.element.style.display=""}},$.prototype.setGhostText=function(W,J){var Z=this.session.selection.cursor,q=J||{row:Z.row,column:Z.column};this.removeGhostText();var j=this.$calculateWrappedTextChunks(W,q);this.addToken(j[0].text,"ghost_text",q.row,q.column),this.$ghostText={text:W,position:{row:q.row,column:q.column}};var G=s.createElement("div");if(j.length>1){var U=this.hideTokensAfterPosition(q.row,q.column),Q;j.slice(1).forEach(function(Ee){var Ie=s.createElement("div"),Oe=s.createElement("span");Oe.className="ace_ghost_text",Ee.wrapped&&(Ie.className="ghost_text_line_wrapped"),Ee.text.length===0&&(Ee.text=" "),Oe.appendChild(s.createTextNode(Ee.text)),Ie.appendChild(Oe),G.appendChild(Ie),Q=Ie}),U.forEach(function(Ee){var Ie=s.createElement("span");O(Ee.type)||(Ie.className="ace_"+Ee.type.replace(/\./g," ace_")),Ie.appendChild(s.createTextNode(Ee.value)),Q.appendChild(Ie)}),this.$ghostTextWidget={el:G,row:q.row,column:q.column,className:"ace_ghost_text_container"},this.session.widgetManager.addLineWidget(this.$ghostTextWidget);var re=this.$cursorLayer.getPixelPosition(q,!0),le=this.container,oe=le.getBoundingClientRect().height,he=j.length*this.lineHeight,xe=he0){var le=0;re.push(j[U].length);for(var oe=0;oe1||Math.abs(W.$size.height-q)>1?W.$resizeTimer.delay():W.$resizeTimer.cancel()}),this.$resizeObserver.observe(this.container)}},$}();z.prototype.CHANGE_CURSOR=1,z.prototype.CHANGE_MARKER=2,z.prototype.CHANGE_GUTTER=4,z.prototype.CHANGE_SCROLL=8,z.prototype.CHANGE_LINES=16,z.prototype.CHANGE_TEXT=32,z.prototype.CHANGE_SIZE=64,z.prototype.CHANGE_MARKER_BACK=128,z.prototype.CHANGE_MARKER_FRONT=256,z.prototype.CHANGE_FULL=512,z.prototype.CHANGE_H_SCROLL=1024,z.prototype.$changes=0,z.prototype.$padding=null,z.prototype.$frozen=!1,z.prototype.STEPS=8,o.implement(z.prototype,M),l.defineOptions(z.prototype,"renderer",{useResizeObserver:{set:function($){!$&&this.$resizeObserver?(this.$resizeObserver.disconnect(),this.$resizeTimer.cancel(),this.$resizeTimer=this.$resizeObserver=null):$&&!this.$resizeObserver&&this.$addResizeObserver()}},animatedScroll:{initialValue:!1},showInvisibles:{set:function($){this.$textLayer.setShowInvisibles($)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!1},showPrintMargin:{set:function(){this.$updatePrintMargin()},initialValue:!0},printMarginColumn:{set:function(){this.$updatePrintMargin()},initialValue:80},printMargin:{set:function($){typeof $=="number"&&(this.$printMarginColumn=$),this.$showPrintMargin=!!$,this.$updatePrintMargin()},get:function(){return this.$showPrintMargin&&this.$printMarginColumn}},showGutter:{set:function($){this.$gutter.style.display=$?"block":"none",this.$loop.schedule(this.CHANGE_FULL),this.onGutterResize()},initialValue:!0},useSvgGutterIcons:{set:function($){this.$gutterLayer.$useSvgGutterIcons=$},initialValue:!1},showFoldedAnnotations:{set:function($){this.$gutterLayer.$showFoldedAnnotations=$},initialValue:!1},fadeFoldWidgets:{set:function($){s.setCssClass(this.$gutter,"ace_fade-fold-widgets",$)},initialValue:!1},showFoldWidgets:{set:function($){this.$gutterLayer.setShowFoldWidgets($),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},displayIndentGuides:{set:function($){this.$textLayer.setDisplayIndentGuides($)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!0},highlightIndentGuides:{set:function($){this.$textLayer.setHighlightIndentGuides($)==!0?this.$textLayer.$highlightIndentGuide():this.$textLayer.$clearActiveIndentGuide(this.$textLayer.$lines.cells)},initialValue:!0},highlightGutterLine:{set:function($){this.$gutterLayer.setHighlightGutterLine($),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},hScrollBarAlwaysVisible:{set:function($){(!this.$hScrollBarAlwaysVisible||!this.$horizScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},vScrollBarAlwaysVisible:{set:function($){(!this.$vScrollBarAlwaysVisible||!this.$vScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},fontSize:{set:function($){typeof $=="number"&&($=$+"px"),this.container.style.fontSize=$,this.updateFontSize()},initialValue:12},fontFamily:{set:function($){this.container.style.fontFamily=$,this.updateFontSize()}},maxLines:{set:function($){this.updateFull()}},minLines:{set:function($){this.$minLines<562949953421311||(this.$minLines=0),this.updateFull()}},maxPixelHeight:{set:function($){this.updateFull()},initialValue:0},scrollPastEnd:{set:function($){$=+$||0,this.$scrollPastEnd!=$&&(this.$scrollPastEnd=$,this.$loop.schedule(this.CHANGE_SCROLL))},initialValue:0,handlesSet:!0},fixedWidthGutter:{set:function($){this.$gutterLayer.$fixedWidth=!!$,this.$loop.schedule(this.CHANGE_GUTTER)}},customScrollbar:{set:function($){this.$updateCustomScrollbar($)},initialValue:!1},theme:{set:function($){this.setTheme($)},get:function(){return this.$themeId||this.theme},initialValue:"./theme/textmate",handlesSet:!0},hasCssTransforms:{},useTextareaForIME:{initialValue:!I.isMobile&&!I.isIE}}),r.VirtualRenderer=z}),ace.define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"],function(n,r,i){var o=n("../lib/oop"),s=n("../lib/net"),a=n("../lib/event_emitter").EventEmitter,l=n("../config");function c(m){var y="importScripts('"+s.qualifyURL(m)+"');";try{return new Blob([y],{type:"application/javascript"})}catch{var w=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder,x=new w;return x.append(y),x.getBlob("application/javascript")}}function u(m){if(typeof Worker>"u")return{postMessage:function(){},terminate:function(){}};if(l.get("loadWorkerFromBlob")){var y=c(m),w=window.URL||window.webkitURL,x=w.createObjectURL(y);return new Worker(x)}return new Worker(m)}var d=function(m){m.postMessage||(m=this.$createWorkerFromOldConfig.apply(this,arguments)),this.$worker=m,this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.onMessage=this.onMessage.bind(this),this.callbackId=1,this.callbacks={},this.$worker.onmessage=this.onMessage};(function(){o.implement(this,a),this.$createWorkerFromOldConfig=function(m,y,w,x,C){if(n.nameToUrl&&!n.toUrl&&(n.toUrl=n.nameToUrl),l.get("packaged")||!n.toUrl)x=x||l.moduleUrl(y,"worker");else{var S=this.$normalizePath;x=x||S(n.toUrl("ace/worker/worker.js",null,"_"));var M={};m.forEach(function(E){M[E]=S(n.toUrl(E,null,"_").replace(/(\.js)?(\?.*)?$/,""))})}return this.$worker=u(x),C&&this.send("importScripts",C),this.$worker.postMessage({init:!0,tlns:M,module:y,classname:w}),this.$worker},this.onMessage=function(m){var y=m.data;switch(y.type){case"event":this._signal(y.name,{data:y.data});break;case"call":var w=this.callbacks[y.id];w&&(w(y.data),delete this.callbacks[y.id]);break;case"error":this.reportError(y.data);break;case"log":window.console&&console.log&&console.log.apply(console,y.data);break}},this.reportError=function(m){window.console&&console.error&&console.error(m)},this.$normalizePath=function(m){return s.qualifyURL(m)},this.terminate=function(){this._signal("terminate",{}),this.deltaQueue=null,this.$worker.terminate(),this.$worker.onerror=function(m){m.preventDefault()},this.$worker=null,this.$doc&&this.$doc.off("change",this.changeListener),this.$doc=null},this.send=function(m,y){this.$worker.postMessage({command:m,args:y})},this.call=function(m,y,w){if(w){var x=this.callbackId++;this.callbacks[x]=w,y.push(x)}this.send(m,y)},this.emit=function(m,y){try{y.data&&y.data.err&&(y.data.err={message:y.data.err.message,stack:y.data.err.stack,code:y.data.err.code}),this.$worker&&this.$worker.postMessage({event:m,data:{data:y.data}})}catch(w){console.error(w.stack)}},this.attachToDocument=function(m){this.$doc&&this.terminate(),this.$doc=m,this.call("setValue",[m.getValue()]),m.on("change",this.changeListener,!0)},this.changeListener=function(m){this.deltaQueue||(this.deltaQueue=[],setTimeout(this.$sendDeltaQueue,0)),m.action=="insert"?this.deltaQueue.push(m.start,m.lines):this.deltaQueue.push(m.start,m.end)},this.$sendDeltaQueue=function(){var m=this.deltaQueue;m&&(this.deltaQueue=null,m.length>50&&m.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:m}))}}).call(d.prototype);var p=function(m,y,w){var x=null,C=!1,S=Object.create(a),M=[],E=new d({messageBuffer:M,terminate:function(){},postMessage:function(I){M.push(I),x&&(C?setTimeout(A):A())}});E.setEmitSync=function(I){C=I};var A=function(){var I=M.shift();I.command?x[I.command].apply(x,I.args):I.event&&S._signal(I.event,I.data)};return S.postMessage=function(I){E.onMessage({data:I})},S.callback=function(I,O){this.postMessage({type:"call",id:O,data:I})},S.emit=function(I,O){this.postMessage({type:"event",name:I,data:O})},l.loadModule(["worker",y],function(I){for(x=new I[w](S);M.length;)A()}),E};r.UIWorkerClient=p,r.WorkerClient=d,r.createWorker=u}),ace.define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(n,r,i){var o=n("./range").Range,s=n("./lib/event_emitter").EventEmitter,a=n("./lib/oop"),l=function(){function c(u,d,p,m,y,w){var x=this;this.length=d,this.session=u,this.doc=u.getDocument(),this.mainClass=y,this.othersClass=w,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate,!0),this.$others=m,this.$onCursorChange=function(){setTimeout(function(){x.onCursorChange()})},this.$pos=p;var C=u.getUndoManager().$undoStack||u.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=C.length,this.setup(),u.selection.on("changeCursor",this.$onCursorChange)}return c.prototype.setup=function(){var u=this,d=this.doc,p=this.session;this.selectionBefore=p.selection.toJSON(),p.selection.inMultiSelectMode&&p.selection.toSingleRange(),this.pos=d.createAnchor(this.$pos.row,this.$pos.column);var m=this.pos;m.$insertRight=!0,m.detach(),m.markerId=p.addMarker(new o(m.row,m.column,m.row,m.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach(function(y){var w=d.createAnchor(y.row,y.column);w.$insertRight=!0,w.detach(),u.others.push(w)}),p.setUndoSelect(!1)},c.prototype.showOtherMarkers=function(){if(!this.othersActive){var u=this.session,d=this;this.othersActive=!0,this.others.forEach(function(p){p.markerId=u.addMarker(new o(p.row,p.column,p.row,p.column+d.length),d.othersClass,null,!1)})}},c.prototype.hideOtherMarkers=function(){if(this.othersActive){this.othersActive=!1;for(var u=0;u=this.pos.column&&d.start.column<=this.pos.column+this.length+1,y=d.start.column-this.pos.column;if(this.updateAnchors(u),m&&(this.length+=p),m&&!this.session.$fromUndo){if(u.action==="insert")for(var w=this.others.length-1;w>=0;w--){var x=this.others[w],C={row:x.row,column:x.column+y};this.doc.insertMergedLines(C,u.lines)}else if(u.action==="remove")for(var w=this.others.length-1;w>=0;w--){var x=this.others[w],C={row:x.row,column:x.column+y};this.doc.remove(new o(C.row,C.column,C.row,C.column-p))}}this.$updating=!1,this.updateMarkers()}},c.prototype.updateAnchors=function(u){this.pos.onChange(u);for(var d=this.others.length;d--;)this.others[d].onChange(u);this.updateMarkers()},c.prototype.updateMarkers=function(){if(!this.$updating){var u=this,d=this.session,p=function(y,w){d.removeMarker(y.markerId),y.markerId=d.addMarker(new o(y.row,y.column,y.row,y.column+u.length),w,null,!1)};p(this.pos,this.mainClass);for(var m=this.others.length;m--;)p(this.others[m],this.othersClass)}},c.prototype.onCursorChange=function(u){if(!(this.$updating||!this.session)){var d=this.session.selection.getCursor();d.row===this.pos.row&&d.column>=this.pos.column&&d.column<=this.pos.column+this.length?(this.showOtherMarkers(),this._emit("cursorEnter",u)):(this.hideOtherMarkers(),this._emit("cursorLeave",u))}},c.prototype.detach=function(){this.session.removeMarker(this.pos&&this.pos.markerId),this.hideOtherMarkers(),this.doc.off("change",this.$onUpdate),this.session.selection.off("changeCursor",this.$onCursorChange),this.session.setUndoSelect(!0),this.session=null},c.prototype.cancel=function(){if(this.$undoStackDepth!==-1){for(var u=this.session.getUndoManager(),d=(u.$undoStack||u.$undostack).length-this.$undoStackDepth,p=0;p1?s.multiSelect.joinSelections():s.multiSelect.splitIntoLines()},bindKey:{win:"Ctrl-Alt-L",mac:"Ctrl-Alt-L"},readOnly:!0},{name:"splitSelectionIntoLines",description:"Split into lines",exec:function(s){s.multiSelect.splitIntoLines()},readOnly:!0},{name:"alignCursors",description:"Align cursors",exec:function(s){s.alignCursors()},bindKey:{win:"Ctrl-Alt-A",mac:"Ctrl-Alt-A"},scrollIntoView:"cursor"},{name:"findAll",description:"Find all",exec:function(s){s.findAll()},bindKey:{win:"Ctrl-Alt-K",mac:"Ctrl-Alt-G"},scrollIntoView:"cursor",readOnly:!0}],r.multiSelectCommands=[{name:"singleSelection",description:"Single selection",bindKey:"esc",exec:function(s){s.exitMultiSelectMode()},scrollIntoView:"cursor",readOnly:!0,isAvailable:function(s){return s&&s.inMultiSelectMode}}];var o=n("../keyboard/hash_handler").HashHandler;r.keyboardHandler=new o(r.multiSelectCommands)}),ace.define("ace/multi_select",["require","exports","module","ace/range_list","ace/range","ace/selection","ace/mouse/multi_select_handler","ace/lib/event","ace/lib/lang","ace/commands/multi_select_commands","ace/search","ace/edit_session","ace/editor","ace/config"],function(n,r,i){var o=n("./range_list").RangeList,s=n("./range").Range,a=n("./selection").Selection,l=n("./mouse/multi_select_handler").onMouseDown,c=n("./lib/event"),u=n("./lib/lang"),d=n("./commands/multi_select_commands");r.commands=d.defaultCommands.concat(d.multiSelectCommands);var p=n("./search").Search,m=new p;function y(E,A,I){return m.$options.wrap=!0,m.$options.needle=A,m.$options.backwards=I==-1,m.find(E)}var w=n("./edit_session").EditSession;(function(){this.getSelectionMarkers=function(){return this.$selectionMarkers}}).call(w.prototype),(function(){this.ranges=null,this.rangeList=null,this.addRange=function(E,A){if(E){if(!this.inMultiSelectMode&&this.rangeCount===0){var I=this.toOrientedRange();if(this.rangeList.add(I),this.rangeList.add(E),this.rangeList.ranges.length!=2)return this.rangeList.removeAll(),A||this.fromOrientedRange(E);this.rangeList.removeAll(),this.rangeList.add(I),this.$onAddRange(I)}E.cursor||(E.cursor=E.end);var O=this.rangeList.add(E);return this.$onAddRange(E),O.length&&this.$onRemoveRange(O),this.rangeCount>1&&!this.inMultiSelectMode&&(this._signal("multiSelect"),this.inMultiSelectMode=!0,this.session.$undoSelect=!1,this.rangeList.attach(this.session)),A||this.fromOrientedRange(E)}},this.toSingleRange=function(E){E=E||this.ranges[0];var A=this.rangeList.removeAll();A.length&&this.$onRemoveRange(A),E&&this.fromOrientedRange(E)},this.substractPoint=function(E){var A=this.rangeList.substractPoint(E);if(A)return this.$onRemoveRange(A),A[0]},this.mergeOverlappingRanges=function(){var E=this.rangeList.merge();E.length&&this.$onRemoveRange(E)},this.$onAddRange=function(E){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(E),this._signal("addRange",{range:E})},this.$onRemoveRange=function(E){if(this.rangeCount=this.rangeList.ranges.length,this.rangeCount==1&&this.inMultiSelectMode){var A=this.rangeList.ranges.pop();E.push(A),this.rangeCount=0}for(var I=E.length;I--;){var O=this.ranges.indexOf(E[I]);this.ranges.splice(O,1)}this._signal("removeRange",{ranges:E}),this.rangeCount===0&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._signal("singleSelect"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),A=A||this.ranges[0],A&&!A.isEqual(this.getRange())&&this.fromOrientedRange(A)},this.$initRangeList=function(){this.rangeList||(this.rangeList=new o,this.ranges=[],this.rangeCount=0)},this.getAllRanges=function(){return this.rangeCount?this.rangeList.ranges.concat():[this.getRange()]},this.splitIntoLines=function(){for(var E=this.ranges.length?this.ranges:[this.getRange()],A=[],I=0;I1){var E=this.rangeList.ranges,A=E[E.length-1],I=s.fromPoints(E[0].start,A.end);this.toSingleRange(),this.setSelectionRange(I,A.cursor==A.start)}else{var O=this.session.documentToScreenPosition(this.cursor),z=this.session.documentToScreenPosition(this.anchor),$=this.rectangularRangeBlock(O,z);$.forEach(this.addRange,this)}},this.rectangularRangeBlock=function(E,A,I){var O=[],z=E.column0;)le--;if(le>0)for(var oe=0;O[oe].isEmpty();)oe++;for(var he=le;he>=oe;he--)O[he].isEmpty()&&O.splice(he,1)}return O}}).call(a.prototype);var x=n("./editor").Editor;(function(){this.updateSelectionMarkers=function(){this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.addSelectionMarker=function(E){E.cursor||(E.cursor=E.end);var A=this.getSelectionStyle();return E.marker=this.session.addMarker(E,"ace_selection",A),this.session.$selectionMarkers.push(E),this.session.selectionMarkerCount=this.session.$selectionMarkers.length,E},this.removeSelectionMarker=function(E){if(E.marker){this.session.removeMarker(E.marker);var A=this.session.$selectionMarkers.indexOf(E);A!=-1&&this.session.$selectionMarkers.splice(A,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length}},this.removeSelectionMarkers=function(E){for(var A=this.session.$selectionMarkers,I=E.length;I--;){var O=E[I];if(O.marker){this.session.removeMarker(O.marker);var z=A.indexOf(O);z!=-1&&A.splice(z,1)}}this.session.selectionMarkerCount=A.length},this.$onAddRange=function(E){this.addSelectionMarker(E.range),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onRemoveRange=function(E){this.removeSelectionMarkers(E.ranges),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelect=function(E){this.inMultiSelectMode||(this.inMultiSelectMode=!0,this.setStyle("ace_multiselect"),this.keyBinding.addKeyboardHandler(d.keyboardHandler),this.commands.setDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers())},this.$onSingleSelect=function(E){this.session.multiSelect.inVirtualMode||(this.inMultiSelectMode=!1,this.unsetStyle("ace_multiselect"),this.keyBinding.removeKeyboardHandler(d.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit("changeSelection"))},this.$onMultiSelectExec=function(E){var A=E.command,I=E.editor;if(I.multiSelect){if(A.multiSelectAction)A.multiSelectAction=="forEach"?O=I.forEachSelection(A,E.args):A.multiSelectAction=="forEachLine"?O=I.forEachSelection(A,E.args,!0):A.multiSelectAction=="single"?(I.exitMultiSelectMode(),O=A.exec(I,E.args||{})):O=A.multiSelectAction(I,E.args||{});else{var O=A.exec(I,E.args||{});I.multiSelect.addRange(I.multiSelect.toOrientedRange()),I.multiSelect.mergeOverlappingRanges()}return O}},this.forEachSelection=function(E,A,I){if(!this.inVirtualSelectionMode){var O=I&&I.keepOrder,z=I==!0||I&&I.$byLines,$=this.session,W=this.selection,J=W.rangeList,Z=(O?W:J).ranges,q;if(!Z.length)return E.exec?E.exec(this,A||{}):E(this,A||{});var j=W._eventRegistry;W._eventRegistry={};var G=new a($);this.inVirtualSelectionMode=!0;for(var U=Z.length;U--;){if(z)for(;U>0&&Z[U].start.row==Z[U-1].end.row;)U--;G.fromOrientedRange(Z[U]),G.index=U,this.selection=$.selection=G;var Q=E.exec?E.exec(this,A||{}):E(this,A||{});!q&&Q!==void 0&&(q=Q),G.toOrientedRange(Z[U])}G.detach(),this.selection=$.selection=W,this.inVirtualSelectionMode=!1,W._eventRegistry=j,W.mergeOverlappingRanges(),W.ranges[0]&&W.fromOrientedRange(W.ranges[0]);var re=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),re&&re.from==re.to&&this.renderer.animateScrolling(re.from),q}},this.exitMultiSelectMode=function(){!this.inMultiSelectMode||this.inVirtualSelectionMode||this.multiSelect.toSingleRange()},this.getSelectedText=function(){var E="";if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){for(var A=this.multiSelect.rangeList.ranges,I=[],O=0;O0);W<0&&(W=0),J>=q&&(J=q-1)}var G=this.session.removeFullLines(W,J);G=this.$reAlignText(G,Z),this.session.insert({row:W,column:0},G.join(` `)+` `),Z||($.start.column=0,$.end.column=G[G.length-1].length),this.selection.setRange($)}else{z.forEach(function(le){A.substractPoint(le.cursor)});var U=0,Q=1/0,re=I.map(function(le){var oe=le.cursor,he=E.getLine(oe.row),xe=he.substr(oe.column).search(/\S/g);return xe==-1&&(xe=0),oe.column>U&&(U=oe.column),xeEe?E.insert(he,u.stringRepeat(" ",xe-Ee)):E.remove(new s(he.row,he.column,he.row,he.column-xe+Ee)),le.start.column=le.end.column=U,le.start.row=le.end.row=he.row,le.cursor=le.end}),A.fromOrientedRange(I[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}},this.$reAlignText=function(E,A){var I=!0,O=!0,z,$,W;return E.map(function(G){var U=G.match(/(\s*)(.*?)(\s*)([=:].*)/);return U?z==null?(z=U[1].length,$=U[2].length,W=U[3].length,U):(z+$+W!=U[1].length+U[2].length+U[3].length&&(O=!1),z!=U[1].length&&(I=!1),z>U[1].length&&(z=U[1].length),$U[3].length&&(W=U[3].length),U):[G]}).map(A?Z:I?O?q:Z:j);function J(G){return u.stringRepeat(" ",G)}function Z(G){return G[2]?J(z)+G[2]+J($-G[2].length+W)+G[4].replace(/^([=:])\s+/,"$1 "):G[0]}function q(G){return G[2]?J(z+$-G[2].length)+G[2]+J(W)+G[4].replace(/^([=:])\s+/,"$1 "):G[0]}function j(G){return G[2]?J(z)+G[2]+J(W)+G[4].replace(/^([=:])\s+/,"$1 "):G[0]}}}).call(x.prototype);function C(E,A){return E.row==A.row&&E.column==A.column}r.onSessionChange=function(E){var A=E.session;A&&!A.multiSelect&&(A.$selectionMarkers=[],A.selection.$initRangeList(),A.multiSelect=A.selection),this.multiSelect=A&&A.multiSelect;var I=E.oldSession;I&&(I.multiSelect.off("addRange",this.$onAddRange),I.multiSelect.off("removeRange",this.$onRemoveRange),I.multiSelect.off("multiSelect",this.$onMultiSelect),I.multiSelect.off("singleSelect",this.$onSingleSelect),I.multiSelect.lead.off("change",this.$checkMultiselectChange),I.multiSelect.anchor.off("change",this.$checkMultiselectChange)),A&&(A.multiSelect.on("addRange",this.$onAddRange),A.multiSelect.on("removeRange",this.$onRemoveRange),A.multiSelect.on("multiSelect",this.$onMultiSelect),A.multiSelect.on("singleSelect",this.$onSingleSelect),A.multiSelect.lead.on("change",this.$checkMultiselectChange),A.multiSelect.anchor.on("change",this.$checkMultiselectChange)),A&&this.inMultiSelectMode!=A.selection.inMultiSelectMode&&(A.selection.inMultiSelectMode?this.$onMultiSelect():this.$onSingleSelect())};function S(E){E.$multiselectOnSessionChange||(E.$onAddRange=E.$onAddRange.bind(E),E.$onRemoveRange=E.$onRemoveRange.bind(E),E.$onMultiSelect=E.$onMultiSelect.bind(E),E.$onSingleSelect=E.$onSingleSelect.bind(E),E.$multiselectOnSessionChange=r.onSessionChange.bind(E),E.$checkMultiselectChange=E.$checkMultiselectChange.bind(E),E.$multiselectOnSessionChange(E),E.on("changeSession",E.$multiselectOnSessionChange),E.on("mousedown",l),E.commands.addCommands(d.defaultCommands),M(E))}function M(E){if(!E.textInput)return;var A=E.textInput.getElement(),I=!1;c.addListener(A,"keydown",function(z){var $=z.keyCode==18&&!(z.ctrlKey||z.shiftKey||z.metaKey);E.$blockSelectEnabled&&$?I||(E.renderer.setMouseCursor("crosshair"),I=!0):I&&O()},E),c.addListener(A,"keyup",O,E),c.addListener(A,"blur",O,E);function O(z){I&&(E.renderer.setMouseCursor(""),I=!1)}}r.MultiSelect=S,n("./config").defineOptions(x.prototype,"editor",{enableMultiselect:{set:function(E){S(this),E?this.on("mousedown",l):this.off("mousedown",l)},value:!0},enableBlockSelect:{set:function(E){this.$blockSelectEnabled=E},value:!0}})}),ace.define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"],function(n,r,i){var o=n("../../range").Range,s=r.FoldMode=function(){};(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(a,l,c){var u=a.getLine(c);return this.foldingStartMarker.test(u)?"start":l=="markbeginend"&&this.foldingStopMarker&&this.foldingStopMarker.test(u)?"end":""},this.getFoldWidgetRange=function(a,l,c){return null},this.indentationBlock=function(a,l,c){var u=/\S/,d=a.getLine(l),p=d.search(u);if(p!=-1){for(var m=c||d.length,y=a.getLength(),w=l,x=l;++lw){var M=a.getLine(x).length;return new o(w,m,x,M)}}},this.openingBracketBlock=function(a,l,c,u,d){var p={row:c,column:u+1},m=a.$findClosingBracket(l,p,d);if(m){var y=a.foldWidgets[m.row];return y==null&&(y=a.getFoldWidget(m.row)),y=="start"&&m.row>p.row&&(m.row--,m.column=a.getLine(m.row).length),o.fromPoints(p,m)}},this.closingBracketBlock=function(a,l,c,u,d){var p={row:c,column:u},m=a.$findOpeningBracket(l,p);if(m)return m.column++,p.column--,o.fromPoints(m,p)}}).call(s.prototype)}),ace.define("ace/ext/error_marker",["require","exports","module","ace/lib/dom","ace/range","ace/config"],function(n,r,i){var o=n("../lib/dom"),s=n("../range").Range,a=n("../config").nls;function l(u,d,p){for(var m=0,y=u.length-1;m<=y;){var w=m+y>>1,x=p(d,u[w]);if(x>0)m=w+1;else if(x<0)y=w-1;else return w}return-(m+1)}function c(u,d,p){var m=u.getAnnotations().sort(s.comparePoints);if(m.length){var y=l(m,{row:d,column:-1},s.comparePoints);y<0&&(y=-y-1),y>=m.length?y=p>0?0:m.length-1:y===0&&p<0&&(y=m.length-1);var w=m[y];if(!(!w||!p)){if(w.row===d){do w=m[y+=p];while(w&&w.row===d);if(!w)return m.slice()}var x=[];d=w.row;do x[p<0?"unshift":"push"](w),w=m[y+=p];while(w&&w.row==d);return x.length&&x}}}r.showErrorMarker=function(u,d){var p=u.session,m=u.getCursorPosition(),y=m.row,w=p.widgetManager.getWidgetsAtRow(y).filter(function(z){return z.type=="errorMarker"})[0];w?w.destroy():y-=d;var x=c(p,y,d),C;if(x){var S=x[0];m.column=(S.pos&&typeof S.column!="number"?S.pos.sc:S.column)||0,m.row=S.row,C=u.renderer.$gutterLayer.$annotations[m.row]}else{if(w)return;C={displayText:[a("error-marker.good-state","Looks good!")],className:"ace_ok"}}u.session.unfold(m.row),u.selection.moveToPosition(m);var M={row:m.row,fixedWidth:!0,coverGutter:!0,el:o.createElement("div"),type:"errorMarker"},E=M.el.appendChild(o.createElement("div")),A=M.el.appendChild(o.createElement("div"));A.className="error_widget_arrow "+C.className;var I=u.renderer.$cursorLayer.getPixelPosition(m).left;A.style.left=I+u.renderer.gutterWidth-5+"px",M.el.className="error_widget_wrapper",E.className="error_widget "+C.className,C.displayText.forEach(function(z,$){E.appendChild(o.createTextNode(z)),$0},t.prototype.connect_=function(){!MR||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),a8e?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},t.prototype.disconnect_=function(){!MR||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},t.prototype.onTransitionEnd_=function(e){var n=e.propertyName,r=n===void 0?"":n,i=s8e.some(function(o){return!!~r.indexOf(o)});i&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),_Z=function(t,e){for(var n=0,r=Object.keys(e);n"u"||!(Element instanceof Object))){if(!(e instanceof h_(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(e)||(n.set(e,new g8e(e)),this.controller_.addObserver(this),this.controller_.refresh())}},t.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(e instanceof h_(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(e)&&(n.delete(e),n.size||this.controller_.removeObserver(this))}},t.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},t.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&e.activeObservations_.push(n)})},t.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new y8e(r.target,r.broadcastRect())});this.callback_.call(e,n,e),this.clearActive()}},t.prototype.clearActive=function(){this.activeObservations_.splice(0)},t.prototype.hasActive=function(){return this.activeObservations_.length>0},t}(),xZ=typeof WeakMap<"u"?new WeakMap:new vZ,EZ=function(){function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=l8e.getInstance(),r=new v8e(e,n,this);xZ.set(this,r)}return t}();["observe","unobserve","disconnect"].forEach(function(t){EZ.prototype[t]=function(){var e;return(e=xZ.get(this))[t].apply(e,arguments)}});var _8e=function(){return typeof gM.ResizeObserver<"u"?gM.ResizeObserver:EZ}();const SZ=["blur","input","change","changeSelectionStyle","changeSession","copy","focus","paste"],b8e=g.defineComponent({name:"VAceEditor",props:{value:{type:String,required:!0},lang:{type:String,default:"text"},theme:{type:String,default:"chrome"},options:Object,placeholder:String,readonly:Boolean,wrap:Boolean,printMargin:{type:[Boolean,Number],default:!0},minLines:Number,maxLines:Number},emits:["update:value","init",...SZ],render(){return g.h("div")},mounted(){const t=this._editor=g.markRaw(yZ.edit(this.$el,{placeholder:this.placeholder,readOnly:this.readonly,value:this.value,mode:"ace/mode/"+this.lang,theme:"ace/theme/"+this.theme,wrap:this.wrap,printMargin:this.printMargin,useWorker:!1,minLines:this.minLines,maxLines:this.maxLines,...this.options}));this._contentBackup=this.value,this._isSettingContent=!1,t.on("change",()=>{if(this._isSettingContent)return;const e=t.getValue();this._contentBackup=e,this.$emit("update:value",e)}),SZ.forEach(e=>{const n="on"+g.capitalize(e);typeof this.$.vnode.props[n]=="function"&&t.on(e,this.$emit.bind(this,e))}),this._ro=new _8e(()=>t.resize()),this._ro.observe(this.$el),this.$emit("init",t)},beforeUnmount(){var t,e;(t=this._ro)===null||t===void 0||t.disconnect(),(e=this._editor)===null||e===void 0||e.destroy()},methods:{focus(){this._editor.focus()},blur(){this._editor.blur()},selectAll(){this._editor.selectAll()},getAceInstance(){return this._editor}},watch:{value(t){if(this._contentBackup!==t){try{this._isSettingContent=!0,this._editor.setValue(t,1)}finally{this._isSettingContent=!1}this._contentBackup=t}},theme(t){this._editor.setTheme("ace/theme/"+t)},options(t){this._editor.setOptions(t)},readonly(t){this._editor.setReadOnly(t)},placeholder(t){this._editor.setOption("placeholder",t)},wrap(t){this._editor.setWrapBehavioursEnabled(t)},printMargin(t){this._editor.setOption("printMargin",t)},lang(t){this._editor.setOption("mode","ace/mode/"+t)},minLines(t){this._editor.setOption("minLines",t)},maxLines(t){this._editor.setOption("maxLines",t)}}}),w8e=Object.freeze(Object.defineProperty({__proto__:null,VAceEditor:b8e},Symbol.toStringTag,{value:"Module"}));var CZ={exports:{}};(function(t,e){ace.define("ace/mode/jsdoc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(n,r,i){var o=n("../lib/oop"),s=n("./text_highlight_rules").TextHighlightRules,a=function(){this.$rules={start:[{token:["comment.doc.tag","comment.doc.text","lparen.doc"],regex:"(@(?:param|member|typedef|property|namespace|var|const|callback))(\\s*)({)",push:[{token:"lparen.doc",regex:"{",push:[{include:"doc-syntax"},{token:"rparen.doc",regex:"}|(?=$)",next:"pop"}]},{token:["rparen.doc","text.doc","variable.parameter.doc","lparen.doc","variable.parameter.doc","rparen.doc"],regex:/(})(\s*)(?:([\w=:\/\.]+)|(?:(\[)([\w=:\/\.\-\'\" ]+)(\])))/,next:"pop"},{token:"rparen.doc",regex:"}|(?=$)",next:"pop"},{include:"doc-syntax"},{defaultToken:"text.doc"}]},{token:["comment.doc.tag","text.doc","lparen.doc"],regex:"(@(?:returns?|yields|type|this|suppress|public|protected|private|package|modifies|implements|external|exception|throws|enum|define|extends))(\\s*)({)",push:[{token:"lparen.doc",regex:"{",push:[{include:"doc-syntax"},{token:"rparen.doc",regex:"}|(?=$)",next:"pop"}]},{token:"rparen.doc",regex:"}|(?=$)",next:"pop"},{include:"doc-syntax"},{defaultToken:"text.doc"}]},{token:["comment.doc.tag","text.doc","variable.parameter.doc"],regex:'(@(?:alias|memberof|instance|module|name|lends|namespace|external|this|template|requires|param|implements|function|extends|typedef|mixes|constructor|var|memberof\\!|event|listens|exports|class|constructs|interface|emits|fires|throws|const|callback|borrows|augments))(\\s+)(\\w[\\w#.:/~"\\-]*)?'},{token:["comment.doc.tag","text.doc","variable.parameter.doc"],regex:"(@method)(\\s+)(\\w[\\w.\\(\\)]*)"},{token:"comment.doc.tag",regex:"@access\\s+(?:private|public|protected)"},{token:"comment.doc.tag",regex:"@kind\\s+(?:class|constant|event|external|file|function|member|mixin|module|namespace|typedef)"},{token:"comment.doc.tag",regex:"@\\w+(?=\\s|$)"},a.getTagRule(),{defaultToken:"comment.doc.body",caseInsensitive:!0}],"doc-syntax":[{token:"operator.doc",regex:/[|:]/},{token:"paren.doc",regex:/[\[\]]/}]},this.normalizeRules()};o.inherits(a,s),a.getTagRule=function(l){return{token:"comment.doc.tag.storage.type",regex:"\\b(?:TODO|FIXME|XXX|HACK)\\b"}},a.getStartRule=function(l){return{token:"comment.doc",regex:/\/\*\*(?!\/)/,next:l}},a.getEndRule=function(l){return{token:"comment.doc",regex:"\\*\\/",next:l}},r.JsDocCommentHighlightRules=a}),ace.define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/jsdoc_comment_highlight_rules","ace/mode/text_highlight_rules"],function(n,r,i){var o=n("../lib/oop"),s=n("./jsdoc_comment_highlight_rules").JsDocCommentHighlightRules,a=n("./text_highlight_rules").TextHighlightRules,l="[a-zA-Z\\$_¡-￿][a-zA-Z\\d\\$_¡-￿]*",c=function(p){var m={"variable.language":"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Symbol|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document",keyword:"const|yield|import|get|set|async|await|break|case|catch|continue|default|delete|do|else|finally|for|if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static|constructor","storage.type":"const|let|var|function","constant.language":"null|Infinity|NaN|undefined","support.function":"alert","constant.language.boolean":"true|false"},y=this.createKeywordMapper(m,"identifier"),w="case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void",x="\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|u{[0-9a-fA-F]{1,6}}|[0-2][0-7]{0,2}|3[0-7][0-7]?|[4-7][0-7]?|.)",C="(function)(\\s*)(\\*?)",S={token:["identifier","text","paren.lparen"],regex:"(\\b(?!"+Object.values(m).join("|")+"\\b)"+l+")(\\s*)(\\()"};this.$rules={no_regex:[s.getStartRule("doc-start"),d("no_regex"),S,{token:"string",regex:"'(?=.)",next:"qstring"},{token:"string",regex:'"(?=.)',next:"qqstring"},{token:"constant.numeric",regex:/0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/},{token:"constant.numeric",regex:/(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/},{token:["entity.name.function","text","keyword.operator","text","storage.type","text","storage.type","text","paren.lparen"],regex:"("+l+")(\\s*)(=)(\\s*)"+C+"(\\s*)(\\()",next:"function_arguments"},{token:["storage.type","text","storage.type","text","text","entity.name.function","text","paren.lparen"],regex:"(function)(?:(?:(\\s*)(\\*)(\\s*))|(\\s+))("+l+")(\\s*)(\\()",next:"function_arguments"},{token:["entity.name.function","text","punctuation.operator","text","storage.type","text","storage.type","text","paren.lparen"],regex:"("+l+")(\\s*)(:)(\\s*)"+C+"(\\s*)(\\()",next:"function_arguments"},{token:["text","text","storage.type","text","storage.type","text","paren.lparen"],regex:"(:)(\\s*)"+C+"(\\s*)(\\()",next:"function_arguments"},{token:"keyword",regex:`from(?=\\s*('|"))`},{token:"keyword",regex:"(?:"+w+")\\b",next:"start"},{token:"support.constant",regex:/that\b/},{token:["storage.type","punctuation.operator","support.function.firebug"],regex:/(console)(\.)(warn|info|log|error|debug|time|trace|timeEnd|assert)\b/},{token:y,regex:l},{token:"punctuation.operator",regex:/[.](?![.])/,next:"property"},{token:"storage.type",regex:/=>/,next:"start"},{token:"keyword.operator",regex:/--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,next:"start"},{token:"punctuation.operator",regex:/[?:,;.]/,next:"start"},{token:"paren.lparen",regex:/[\[({]/,next:"start"},{token:"paren.rparen",regex:/[\])}]/},{token:"comment",regex:/^#!.*$/}],property:[{token:"text",regex:"\\s+"},{token:"keyword.operator",regex:/=/},{token:["storage.type","text","storage.type","text","paren.lparen"],regex:C+"(\\s*)(\\()",next:"function_arguments"},{token:["storage.type","text","storage.type","text","text","entity.name.function","text","paren.lparen"],regex:"(function)(?:(?:(\\s*)(\\*)(\\s*))|(\\s+))(\\w+)(\\s*)(\\()",next:"function_arguments"},{token:"punctuation.operator",regex:/[.](?![.])/},{token:"support.function",regex:"prototype"},{token:"support.function",regex:/(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|lter|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward|rEach)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/},{token:"support.function.dom",regex:/(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/},{token:"support.constant",regex:/(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/},{token:"identifier",regex:l},{regex:"",token:"empty",next:"no_regex"}],start:[s.getStartRule("doc-start"),d("start"),{token:"string.regexp",regex:"\\/",next:"regex"},{token:"text",regex:"\\s+|^$",next:"start"},{token:"empty",regex:"",next:"no_regex"}],regex:[{token:"regexp.keyword.operator",regex:"\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"},{token:"string.regexp",regex:"/[sxngimy]*",next:"no_regex"},{token:"invalid",regex:/\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/},{token:"constant.language.escape",regex:/\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/},{token:"constant.language.delimiter",regex:/\|/},{token:"constant.language.escape",regex:/\[\^?/,next:"regex_character_class"},{token:"empty",regex:"$",next:"no_regex"},{defaultToken:"string.regexp"}],regex_character_class:[{token:"regexp.charclass.keyword.operator",regex:"\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"},{token:"constant.language.escape",regex:"]",next:"regex"},{token:"constant.language.escape",regex:"-"},{token:"empty",regex:"$",next:"no_regex"},{defaultToken:"string.regexp.charachterclass"}],default_parameter:[{token:"string",regex:"'(?=.)",push:[{token:"string",regex:"'|$",next:"pop"},{include:"qstring"}]},{token:"string",regex:'"(?=.)',push:[{token:"string",regex:'"|$',next:"pop"},{include:"qqstring"}]},{token:"constant.language",regex:"null|Infinity|NaN|undefined"},{token:"constant.numeric",regex:/0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/},{token:"constant.numeric",regex:/(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/},{token:"punctuation.operator",regex:",",next:"function_arguments"},{token:"text",regex:"\\s+"},{token:"punctuation.operator",regex:"$"},{token:"empty",regex:"",next:"no_regex"}],function_arguments:[d("function_arguments"),{token:"variable.parameter",regex:l},{token:"punctuation.operator",regex:","},{token:"text",regex:"\\s+"},{token:"punctuation.operator",regex:"$"},{token:"empty",regex:"",next:"no_regex"}],qqstring:[{token:"constant.language.escape",regex:x},{token:"string",regex:"\\\\$",consumeLineEnd:!0},{token:"string",regex:'"|$',next:"no_regex"},{defaultToken:"string"}],qstring:[{token:"constant.language.escape",regex:x},{token:"string",regex:"\\\\$",consumeLineEnd:!0},{token:"string",regex:"'|$",next:"no_regex"},{defaultToken:"string"}]},(!p||!p.noES6)&&(this.$rules.no_regex.unshift({regex:"[{}]",onMatch:function(M,E,A){if(this.next=M=="{"?this.nextState:"",M=="{"&&A.length)A.unshift("start",E);else if(M=="}"&&A.length&&(A.shift(),this.next=A.shift(),this.next.indexOf("string")!=-1||this.next.indexOf("jsx")!=-1))return"paren.quasi.end";return M=="{"?"paren.lparen":"paren.rparen"},nextState:"start"},{token:"string.quasi.start",regex:/`/,push:[{token:"constant.language.escape",regex:x},{token:"paren.quasi.start",regex:/\${/,push:"start"},{token:"string.quasi.end",regex:/`/,next:"pop"},{defaultToken:"string.quasi"}]},{token:["variable.parameter","text"],regex:"("+l+")(\\s*)(?=\\=>)"},{token:"paren.lparen",regex:"(\\()(?=[^\\(]+\\s*=>)",next:"function_arguments"},{token:"variable.language",regex:"(?:(?:(?:Weak)?(?:Set|Map))|Promise)\\b"}),this.$rules.function_arguments.unshift({token:"keyword.operator",regex:"=",next:"default_parameter"},{token:"keyword.operator",regex:"\\.{3}"}),this.$rules.property.unshift({token:"support.function",regex:"(findIndex|repeat|startsWith|endsWith|includes|isSafeInteger|trunc|cbrt|log2|log10|sign|then|catch|finally|resolve|reject|race|any|all|allSettled|keys|entries|isInteger)\\b(?=\\()"},{token:"constant.language",regex:"(?:MAX_SAFE_INTEGER|MIN_SAFE_INTEGER|EPSILON)\\b"}),(!p||p.jsx!=!1)&&u.call(this)),this.embedRules(s,"doc-",[s.getEndRule("no_regex")]),this.normalizeRules()};o.inherits(c,a);function u(){var p=l.replace("\\d","\\d\\-"),m={onMatch:function(w,x,C){var S=w.charAt(1)=="/"?2:1;return S==1?(x!=this.nextState?C.unshift(this.next,this.nextState,0):C.unshift(this.next),C[2]++):S==2&&x==this.nextState&&(C[1]--,(!C[1]||C[1]<0)&&(C.shift(),C.shift())),[{type:"meta.tag.punctuation."+(S==1?"":"end-")+"tag-open.xml",value:w.slice(0,S)},{type:"meta.tag.tag-name.xml",value:w.substr(S)}]},regex:"))",next:"jsxAttributes",nextState:"jsx"};this.$rules.start.unshift(m);var y={regex:"{",token:"paren.quasi.start",push:"start"};this.$rules.jsx=[y,m,{include:"reference"},{defaultToken:"string.xml"}],this.$rules.jsxAttributes=[{token:"meta.tag.punctuation.tag-close.xml",regex:"/?>",onMatch:function(w,x,C){return x==C[0]&&C.shift(),w.length==2&&(C[0]==this.nextState&&C[1]--,(!C[1]||C[1]<0)&&C.splice(0,2)),this.next=C[0]||"start",[{type:this.token,value:w}]},nextState:"jsx"},y,d("jsxAttributes"),{token:"entity.other.attribute-name.xml",regex:p},{token:"keyword.operator.attribute-equals.xml",regex:"="},{token:"text.tag-whitespace.xml",regex:"\\s+"},{token:"string.attribute-value.xml",regex:"'",stateName:"jsx_attr_q",push:[{token:"string.attribute-value.xml",regex:"'",next:"pop"},{include:"reference"},{defaultToken:"string.attribute-value.xml"}]},{token:"string.attribute-value.xml",regex:'"',stateName:"jsx_attr_qq",push:[{token:"string.attribute-value.xml",regex:'"',next:"pop"},{include:"reference"},{defaultToken:"string.attribute-value.xml"}]},m],this.$rules.reference=[{token:"constant.language.escape.reference.xml",regex:"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"}]}function d(p){return[{token:"comment",regex:/\/\*/,next:[s.getTagRule(),{token:"comment",regex:"\\*\\/",next:p||"pop"},{defaultToken:"comment",caseInsensitive:!0}]},{token:"comment",regex:"\\/\\/",next:[s.getTagRule(),{token:"comment",regex:"$|^",next:p||"pop"},{defaultToken:"comment",caseInsensitive:!0}]}]}r.JavaScriptHighlightRules=c}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(n,r,i){var o=n("../range").Range,s=function(){};(function(){this.checkOutdent=function(a,l){return/^\s+$/.test(a)?/^\s*\}/.test(l):!1},this.autoOutdent=function(a,l){var c=a.getLine(l),u=c.match(/^(\s*\})/);if(!u)return 0;var d=u[1].length,p=a.findMatchingBracket({row:l,column:d});if(!p||p.row==l)return 0;var m=this.$getIndent(a.getLine(p.row));a.replace(new o(l,0,l,d-1),m)},this.$getIndent=function(a){return a.match(/^\s*/)[0]}}).call(s.prototype),r.MatchingBraceOutdent=s}),ace.define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator"],function(n,r,i){var o=n("../../lib/oop"),s=n("../behaviour").Behaviour,a=n("../../token_iterator").TokenIterator;function l(u,d){return u&&u.type.lastIndexOf(d+".xml")>-1}var c=function(){this.add("string_dquotes","insertion",function(u,d,p,m,y){if(y=='"'||y=="'"){var w=y,x=m.doc.getTextRange(p.getSelectionRange());if(x!==""&&x!=="'"&&x!='"'&&p.getWrapBehavioursEnabled())return{text:w+x+w,selection:!1};var C=p.getCursorPosition(),S=m.doc.getLine(C.row),M=S.substring(C.column,C.column+1),E=new a(m,C.row,C.column),A=E.getCurrentToken();if(M==w&&(l(A,"attribute-value")||l(A,"string")))return{text:"",selection:[1,1]};if(A||(A=E.stepBackward()),!A)return;for(;l(A,"tag-whitespace")||l(A,"whitespace");)A=E.stepBackward();var I=!M||M.match(/\s/);if(l(A,"attribute-equals")&&(I||M==">")||l(A,"decl-attribute-equals")&&(I||M=="?"))return{text:w+w,selection:[1,1]}}}),this.add("string_dquotes","deletion",function(u,d,p,m,y){var w=m.doc.getTextRange(y);if(!y.isMultiLine()&&(w=='"'||w=="'")){var x=m.doc.getLine(y.start.row),C=x.substring(y.start.column+1,y.start.column+2);if(C==w)return y.end.column++,y}}),this.add("autoclosing","insertion",function(u,d,p,m,y){if(y==">"){var w=p.getSelectionRange().start,x=new a(m,w.row,w.column),C=x.getCurrentToken()||x.stepBackward();if(!C||!(l(C,"tag-name")||l(C,"tag-whitespace")||l(C,"attribute-name")||l(C,"attribute-equals")||l(C,"attribute-value"))||l(C,"reference.attribute-value"))return;if(l(C,"attribute-value")){var S=x.getCurrentTokenColumn()+C.value.length;if(w.column/.test(m.getLine(w.row).slice(w.column)))return;for(;!l(C,"tag-name");)if(C=x.stepBackward(),C.value=="<"){C=x.stepForward();break}var E=x.getCurrentTokenRow(),A=x.getCurrentTokenColumn();if(l(x.stepBackward(),"end-tag-open"))return;var I=C.value;return E==w.row&&(I=I.substring(0,w.column-A)),this.voidElements&&this.voidElements.hasOwnProperty(I.toLowerCase())?void 0:{text:">",selection:[1,1]}}}),this.add("autoindent","insertion",function(u,d,p,m,y){if(y==` `){var w=p.getCursorPosition(),x=m.getLine(w.row),C=new a(m,w.row,w.column),S=C.getCurrentToken();if(l(S,"")&&S.type.indexOf("tag-close")!==-1){if(S.value=="/>")return;for(;S&&S.type.indexOf("tag-name")===-1;)S=C.stepBackward();if(!S)return;var M=S.value,E=C.getCurrentTokenRow();if(S=C.stepBackward(),!S||S.type.indexOf("end-tag")!==-1)return;if(this.voidElements&&!this.voidElements[M]||!this.voidElements){var A=m.getTokenAt(w.row,w.column+1),x=m.getLine(E),I=this.$getIndent(x),O=I+m.getTabString();return A&&A.value===""){var x=m.getSelectionRange().start,C=new s(y,x.row,x.column),S=C.getCurrentToken()||C.stepBackward();if(!S)return;if(S.value=="<")return{text:">",selection:[1,1]}}})};o.inherits(c,a),r.JavaScriptBehaviour=c}),ace.define("ace/mode/folding/xml",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(n,r,i){var o=n("../../lib/oop"),s=n("../../range").Range,a=n("./fold_mode").FoldMode,l=r.FoldMode=function(d,p){a.call(this),this.voidElements=d||{},this.optionalEndTags=o.mixin({},this.voidElements),p&&o.mixin(this.optionalEndTags,p)};o.inherits(l,a);var c=function(){this.tagName="",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};function u(d,p){return d&&d.type&&d.type.lastIndexOf(p+".xml")>-1}(function(){this.getFoldWidget=function(d,p,m){var y=this._getFirstTagInLine(d,m);return y?y.closing||!y.tagName&&y.selfClosing?p==="markbeginend"?"end":"":!y.tagName||y.selfClosing||this.voidElements.hasOwnProperty(y.tagName.toLowerCase())||this._findEndTagInLine(d,m,y.tagName,y.end.column)?"":"start":this.getCommentFoldWidget(d,m)},this.getCommentFoldWidget=function(d,p){return/comment/.test(d.getState(p))&&/";break}return y}else if(u(x,"tag-close"))return y.selfClosing=x.value=="/>",y;y.start.column+=x.value.length}return null},this._findEndTagInLine=function(d,p,m,y){for(var w=d.getTokens(p),x=0,C=0;CC)break;var S=this.getFoldWidgetRange(c,"all",u);if(S){if(S.start.row<=m)break;if(S.isMultiLine())u=S.end.row;else if(p==C)break}w=u}}return new s(m,y,w,c.getLine(w).length)},this.getCommentRegionBlock=function(c,u,d){for(var p=u.search(/\s*$/),m=c.getLength(),y=d,w=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,x=1;++dy)return new s(y,p,S,u.length)}}).call(l.prototype)}),ace.define("ace/mode/folding/javascript",["require","exports","module","ace/lib/oop","ace/mode/folding/xml","ace/mode/folding/cstyle"],function(n,r,i){var o=n("../../lib/oop"),s=n("./xml").FoldMode,a=n("./cstyle").FoldMode,l=r.FoldMode=function(c){c&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+c.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+c.end))),this.xmlFoldMode=new s};o.inherits(l,a),(function(){this.getFoldWidgetRangeBase=this.getFoldWidgetRange,this.getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(c,u,d){var p=this.getFoldWidgetBase(c,u,d);return p||this.xmlFoldMode.getFoldWidget(c,u,d)},this.getFoldWidgetRange=function(c,u,d,p){var m=this.getFoldWidgetRangeBase(c,u,d,p);return m||this.xmlFoldMode.getFoldWidgetRange(c,u,d)}}).call(l.prototype)}),ace.define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/javascript","ace/mode/folding/javascript"],function(n,r,i){var o=n("../lib/oop"),s=n("./text").Mode,a=n("./javascript_highlight_rules").JavaScriptHighlightRules,l=n("./matching_brace_outdent").MatchingBraceOutdent,c=n("../worker/worker_client").WorkerClient,u=n("./behaviour/javascript").JavaScriptBehaviour,d=n("./folding/javascript").FoldMode,p=function(){this.HighlightRules=a,this.$outdent=new l,this.$behaviour=new u,this.foldingRules=new d};o.inherits(p,s),(function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.$quotes={'"':'"',"'":"'","`":"`"},this.$pairQuotesAfter={"`":/\w/},this.getNextLineIndent=function(m,y,w){var x=this.$getIndent(y),C=this.getTokenizer().getLineTokens(y,m),S=C.tokens,M=C.state;if(S.length&&S[S.length-1].type=="comment")return x;if(m=="start"||m=="no_regex"){var E=y.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);E&&(x+=w)}else if(m=="doc-start"&&(M=="start"||M=="no_regex"))return"";return x},this.checkOutdent=function(m,y,w){return this.$outdent.checkOutdent(y,w)},this.autoOutdent=function(m,y,w){this.$outdent.autoOutdent(y,w)},this.createWorker=function(m){var y=new c(["ace"],"ace/mode/javascript_worker","JavaScriptWorker");return y.attachToDocument(m.getDocument()),y.on("annotate",function(w){m.setAnnotations(w.data)}),y.on("terminate",function(){m.clearAnnotations()}),y},this.$id="ace/mode/javascript",this.snippetFileId="ace/snippets/javascript"}).call(p.prototype),r.Mode=p}),function(){ace.require(["ace/mode/javascript"],function(n){t&&(t.exports=n)})}()})(CZ);var kZ=CZ.exports;const x8e=Vd({__proto__:null,default:gl(kZ)},[kZ]);var TZ={exports:{}};(function(t,e){ace.define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"],function(n,r,i){var o=n("../lib/oop");n("../lib/lang");var s=n("./text_highlight_rules").TextHighlightRules,a=r.supportType="align-content|align-items|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|border|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|bottom|box-shadow|box-sizing|caption-side|clear|clip|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|cursor|direction|display|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|font|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|hanging-punctuation|height|justify-content|left|letter-spacing|line-height|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|max-height|max-width|max-zoom|min-height|min-width|min-zoom|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|order|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page-break-after|page-break-before|page-break-inside|perspective|perspective-origin|position|quotes|resize|right|tab-size|table-layout|text-align|text-align-last|text-decoration|text-decoration-color|text-decoration-line|text-decoration-style|text-indent|text-justify|text-overflow|text-shadow|text-transform|top|transform|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|user-select|user-zoom|vertical-align|visibility|white-space|width|word-break|word-spacing|word-wrap|z-index",l=r.supportFunction="rgb|rgba|url|attr|counter|counters",c=r.supportConstant="absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|flex-end|flex-start|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero|zoom",u=r.supportConstantColor="aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen",d=r.supportConstantFonts="arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace",p=r.numRe="\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))",m=r.pseudoElements="(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b",y=r.pseudoClasses="(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b",w=function(){var x=this.createKeywordMapper({"support.function":l,"support.constant":c,"support.type":a,"support.constant.color":u,"support.constant.fonts":d},"text",!0);this.$rules={start:[{include:["strings","url","comments"]},{token:"paren.lparen",regex:"\\{",next:"ruleset"},{token:"paren.rparen",regex:"\\}"},{token:"string",regex:"@(?!viewport)",next:"media"},{token:"keyword",regex:"#[a-z0-9-_]+"},{token:"keyword",regex:"%"},{token:"variable",regex:"\\.[a-z0-9-_]+"},{token:"string",regex:":[a-z0-9-_]+"},{token:"constant.numeric",regex:p},{token:"constant",regex:"[a-z0-9-_]+"},{caseInsensitive:!0}],media:[{include:["strings","url","comments"]},{token:"paren.lparen",regex:"\\{",next:"start"},{token:"paren.rparen",regex:"\\}",next:"start"},{token:"string",regex:";",next:"start"},{token:"keyword",regex:"(?:media|supports|document|charset|import|namespace|media|supports|document|page|font|keyframes|viewport|counter-style|font-feature-values|swash|ornaments|annotation|stylistic|styleset|character-variant)"}],comments:[{token:"comment",regex:"\\/\\*",push:[{token:"comment",regex:"\\*\\/",next:"pop"},{defaultToken:"comment"}]}],ruleset:[{regex:"-(webkit|ms|moz|o)-",token:"text"},{token:"punctuation.operator",regex:"[:;]"},{token:"paren.rparen",regex:"\\}",next:"start"},{include:["strings","url","comments"]},{token:["constant.numeric","keyword"],regex:"("+p+")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vmax|vmin|vm|vw|%)"},{token:"constant.numeric",regex:p},{token:"constant.numeric",regex:"#[a-f0-9]{6}"},{token:"constant.numeric",regex:"#[a-f0-9]{3}"},{token:["punctuation","entity.other.attribute-name.pseudo-element.css"],regex:m},{token:["punctuation","entity.other.attribute-name.pseudo-class.css"],regex:y},{include:"url"},{token:x,regex:"\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"},{token:"paren.lparen",regex:"\\{"},{caseInsensitive:!0}],url:[{token:"support.function",regex:"(?:url(:?-prefix)?|domain|regexp)\\(",push:[{token:"support.function",regex:"\\)",next:"pop"},{defaultToken:"string"}]}],strings:[{token:"string.start",regex:"'",push:[{token:"string.end",regex:"'|$",next:"pop"},{include:"escapes"},{token:"constant.language.escape",regex:/\\$/,consumeLineEnd:!0},{defaultToken:"string"}]},{token:"string.start",regex:'"',push:[{token:"string.end",regex:'"|$',next:"pop"},{include:"escapes"},{token:"constant.language.escape",regex:/\\$/,consumeLineEnd:!0},{defaultToken:"string"}]}],escapes:[{token:"constant.language.escape",regex:/\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/}]},this.normalizeRules()};o.inherits(w,s),r.CssHighlightRules=w}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(n,r,i){var o=n("../range").Range,s=function(){};(function(){this.checkOutdent=function(a,l){return/^\s+$/.test(a)?/^\s*\}/.test(l):!1},this.autoOutdent=function(a,l){var c=a.getLine(l),u=c.match(/^(\s*\})/);if(!u)return 0;var d=u[1].length,p=a.findMatchingBracket({row:l,column:d});if(!p||p.row==l)return 0;var m=this.$getIndent(a.getLine(p.row));a.replace(new o(l,0,l,d-1),m)},this.$getIndent=function(a){return a.match(/^\s*/)[0]}}).call(s.prototype),r.MatchingBraceOutdent=s}),ace.define("ace/mode/css_completions",["require","exports","module"],function(n,r,i){var o={background:{"#$0":1},"background-color":{"#$0":1,transparent:1,fixed:1},"background-image":{"url('/$0')":1},"background-repeat":{repeat:1,"repeat-x":1,"repeat-y":1,"no-repeat":1,inherit:1},"background-position":{bottom:2,center:2,left:2,right:2,top:2,inherit:2},"background-attachment":{scroll:1,fixed:1},"background-size":{cover:1,contain:1},"background-clip":{"border-box":1,"padding-box":1,"content-box":1},"background-origin":{"border-box":1,"padding-box":1,"content-box":1},border:{"solid $0":1,"dashed $0":1,"dotted $0":1,"#$0":1},"border-color":{"#$0":1},"border-style":{solid:2,dashed:2,dotted:2,double:2,groove:2,hidden:2,inherit:2,inset:2,none:2,outset:2,ridged:2},"border-collapse":{collapse:1,separate:1},bottom:{px:1,em:1,"%":1},clear:{left:1,right:1,both:1,none:1},color:{"#$0":1,"rgb(#$00,0,0)":1},cursor:{default:1,pointer:1,move:1,text:1,wait:1,help:1,progress:1,"n-resize":1,"ne-resize":1,"e-resize":1,"se-resize":1,"s-resize":1,"sw-resize":1,"w-resize":1,"nw-resize":1},display:{none:1,block:1,inline:1,"inline-block":1,"table-cell":1},"empty-cells":{show:1,hide:1},float:{left:1,right:1,none:1},"font-family":{Arial:2,"Comic Sans MS":2,Consolas:2,"Courier New":2,Courier:2,Georgia:2,Monospace:2,"Sans-Serif":2,"Segoe UI":2,Tahoma:2,"Times New Roman":2,"Trebuchet MS":2,Verdana:1},"font-size":{px:1,em:1,"%":1},"font-weight":{bold:1,normal:1},"font-style":{italic:1,normal:1},"font-variant":{normal:1,"small-caps":1},height:{px:1,em:1,"%":1},left:{px:1,em:1,"%":1},"letter-spacing":{normal:1},"line-height":{normal:1},"list-style-type":{none:1,disc:1,circle:1,square:1,decimal:1,"decimal-leading-zero":1,"lower-roman":1,"upper-roman":1,"lower-greek":1,"lower-latin":1,"upper-latin":1,georgian:1,"lower-alpha":1,"upper-alpha":1},margin:{px:1,em:1,"%":1},"margin-right":{px:1,em:1,"%":1},"margin-left":{px:1,em:1,"%":1},"margin-top":{px:1,em:1,"%":1},"margin-bottom":{px:1,em:1,"%":1},"max-height":{px:1,em:1,"%":1},"max-width":{px:1,em:1,"%":1},"min-height":{px:1,em:1,"%":1},"min-width":{px:1,em:1,"%":1},overflow:{hidden:1,visible:1,auto:1,scroll:1},"overflow-x":{hidden:1,visible:1,auto:1,scroll:1},"overflow-y":{hidden:1,visible:1,auto:1,scroll:1},padding:{px:1,em:1,"%":1},"padding-top":{px:1,em:1,"%":1},"padding-right":{px:1,em:1,"%":1},"padding-bottom":{px:1,em:1,"%":1},"padding-left":{px:1,em:1,"%":1},"page-break-after":{auto:1,always:1,avoid:1,left:1,right:1},"page-break-before":{auto:1,always:1,avoid:1,left:1,right:1},position:{absolute:1,relative:1,fixed:1,static:1},right:{px:1,em:1,"%":1},"table-layout":{fixed:1,auto:1},"text-decoration":{none:1,underline:1,"line-through":1,blink:1},"text-align":{left:1,right:1,center:1,justify:1},"text-transform":{capitalize:1,uppercase:1,lowercase:1,none:1},top:{px:1,em:1,"%":1},"vertical-align":{top:1,bottom:1},visibility:{hidden:1,visible:1},"white-space":{nowrap:1,normal:1,pre:1,"pre-line":1,"pre-wrap":1},width:{px:1,em:1,"%":1},"word-spacing":{normal:1},filter:{"alpha(opacity=$0100)":1},"text-shadow":{"$02px 2px 2px #777":1},"text-overflow":{"ellipsis-word":1,clip:1,ellipsis:1},"-moz-border-radius":1,"-moz-border-radius-topright":1,"-moz-border-radius-bottomright":1,"-moz-border-radius-topleft":1,"-moz-border-radius-bottomleft":1,"-webkit-border-radius":1,"-webkit-border-top-right-radius":1,"-webkit-border-top-left-radius":1,"-webkit-border-bottom-right-radius":1,"-webkit-border-bottom-left-radius":1,"-moz-box-shadow":1,"-webkit-box-shadow":1,transform:{"rotate($00deg)":1,"skew($00deg)":1},"-moz-transform":{"rotate($00deg)":1,"skew($00deg)":1},"-webkit-transform":{"rotate($00deg)":1,"skew($00deg)":1}},s=function(){};(function(){this.completionsDefined=!1,this.defineCompletions=function(){if(document){var a=document.createElement("c").style;for(var l in a)if(typeof a[l]=="string"){var c=l.replace(/[A-Z]/g,function(u){return"-"+u.toLowerCase()});o.hasOwnProperty(c)||(o[c]=1)}}this.completionsDefined=!0},this.getCompletions=function(a,l,c,u){if(this.completionsDefined||this.defineCompletions(),a==="ruleset"||l.$mode.$id=="ace/mode/scss"){var d=l.getLine(c.row).substr(0,c.column),p=/\([^)]*$/.test(d);return p&&(d=d.substr(d.lastIndexOf("(")+1)),/:[^;]+$/.test(d)?this.getPropertyValueCompletions(a,l,c,u):this.getPropertyCompletions(a,l,c,u,p)}return[]},this.getPropertyCompletions=function(a,l,c,u,d){d=d||!1;var p=Object.keys(o);return p.map(function(m){return{caption:m,snippet:m+": $0"+(d?"":";"),meta:"property",score:1e6}})},this.getPropertyValueCompletions=function(a,l,c,u){var d=l.getLine(c.row).substr(0,c.column),p=(/([\w\-]+):[^:]*$/.exec(d)||{})[1];if(!p)return[];var m=[];return p in o&&typeof o[p]=="object"&&(m=Object.keys(o[p])),m.map(function(y){return{caption:y,snippet:y,meta:"property value",score:1e6}})}}).call(s.prototype),r.CssCompletions=s}),ace.define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"],function(n,r,i){var o=n("../../lib/oop");n("../behaviour").Behaviour;var s=n("./cstyle").CstyleBehaviour,a=n("../../token_iterator").TokenIterator,l=function(){this.inherit(s),this.add("colon","insertion",function(c,u,d,p,m){if(m===":"&&d.selection.isEmpty()){var y=d.getCursorPosition(),w=new a(p,y.row,y.column),x=w.getCurrentToken();if(x&&x.value.match(/\s+/)&&(x=w.stepBackward()),x&&x.type==="support.type"){var C=p.doc.getLine(y.row),S=C.substring(y.column,y.column+1);if(S===":")return{text:"",selection:[1,1]};if(/^(\s+[^;]|\s*$)/.test(C.substring(y.column)))return{text:":;",selection:[1,1]}}}}),this.add("colon","deletion",function(c,u,d,p,m){var y=p.doc.getTextRange(m);if(!m.isMultiLine()&&y===":"){var w=d.getCursorPosition(),x=new a(p,w.row,w.column),C=x.getCurrentToken();if(C&&C.value.match(/\s+/)&&(C=x.stepBackward()),C&&C.type==="support.type"){var S=p.doc.getLine(m.start.row),M=S.substring(m.end.column,m.end.column+1);if(M===";")return m.end.column++,m}}}),this.add("semicolon","insertion",function(c,u,d,p,m){if(m===";"&&d.selection.isEmpty()){var y=d.getCursorPosition(),w=p.doc.getLine(y.row),x=w.substring(y.column,y.column+1);if(x===";")return{text:"",selection:[1,1]}}}),this.add("!important","insertion",function(c,u,d,p,m){if(m==="!"&&d.selection.isEmpty()){var y=d.getCursorPosition(),w=p.doc.getLine(y.row);if(/^\s*(;|}|$)/.test(w.substring(y.column)))return{text:"!important",selection:[10,10]}}})};o.inherits(l,s),r.CssBehaviour=l}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(n,r,i){var o=n("../../lib/oop"),s=n("../../range").Range,a=n("./fold_mode").FoldMode,l=r.FoldMode=function(c){c&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+c.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+c.end)))};o.inherits(l,a),(function(){this.foldingStartMarker=/([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(c,u,d){var p=c.getLine(d);if(this.singleLineBlockCommentRe.test(p)&&!this.startRegionRe.test(p)&&!this.tripleStarBlockCommentRe.test(p))return"";var m=this._getFoldWidgetBase(c,u,d);return!m&&this.startRegionRe.test(p)?"start":m},this.getFoldWidgetRange=function(c,u,d,p){var m=c.getLine(d);if(this.startRegionRe.test(m))return this.getCommentRegionBlock(c,m,d);var x=m.match(this.foldingStartMarker);if(x){var y=x.index;if(x[1])return this.openingBracketBlock(c,x[1],d,y);var w=c.getCommentFoldRange(d,y+x[0].length,1);return w&&!w.isMultiLine()&&(p?w=this.getSectionRange(c,d):u!="all"&&(w=null)),w}if(u!=="markbegin"){var x=m.match(this.foldingStopMarker);if(x){var y=x.index+x[0].length;return x[1]?this.closingBracketBlock(c,x[1],d,y):c.getCommentFoldRange(d,y,-1)}}},this.getSectionRange=function(c,u){var d=c.getLine(u),p=d.search(/\S/),m=u,y=d.length;u=u+1;for(var w=u,x=c.getLength();++uC)break;var S=this.getFoldWidgetRange(c,"all",u);if(S){if(S.start.row<=m)break;if(S.isMultiLine())u=S.end.row;else if(p==C)break}w=u}}return new s(m,y,w,c.getLine(w).length)},this.getCommentRegionBlock=function(c,u,d){for(var p=u.search(/\s*$/),m=c.getLength(),y=d,w=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,x=1;++dy)return new s(y,p,S,u.length)}}).call(l.prototype)}),ace.define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/css_completions","ace/mode/behaviour/css","ace/mode/folding/cstyle"],function(n,r,i){var o=n("../lib/oop"),s=n("./text").Mode,a=n("./css_highlight_rules").CssHighlightRules,l=n("./matching_brace_outdent").MatchingBraceOutdent,c=n("../worker/worker_client").WorkerClient,u=n("./css_completions").CssCompletions,d=n("./behaviour/css").CssBehaviour,p=n("./folding/cstyle").FoldMode,m=function(){this.HighlightRules=a,this.$outdent=new l,this.$behaviour=new d,this.$completer=new u,this.foldingRules=new p};o.inherits(m,s),(function(){this.foldingRules="cStyle",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(y,w,x){var C=this.$getIndent(w),S=this.getTokenizer().getLineTokens(w,y).tokens;if(S.length&&S[S.length-1].type=="comment")return C;var M=w.match(/^.*\{\s*$/);return M&&(C+=x),C},this.checkOutdent=function(y,w,x){return this.$outdent.checkOutdent(w,x)},this.autoOutdent=function(y,w,x){this.$outdent.autoOutdent(w,x)},this.getCompletions=function(y,w,x,C){return this.$completer.getCompletions(y,w,x,C)},this.createWorker=function(y){var w=new c(["ace"],"ace/mode/css_worker","Worker");return w.attachToDocument(y.getDocument()),w.on("annotate",function(x){y.setAnnotations(x.data)}),w.on("terminate",function(){y.clearAnnotations()}),w},this.$id="ace/mode/css",this.snippetFileId="ace/snippets/css"}).call(m.prototype),r.Mode=m}),function(){ace.require(["ace/mode/css"],function(n){t&&(t.exports=n)})}()})(TZ);var MZ=TZ.exports;const E8e=Vd({__proto__:null,default:gl(MZ)},[MZ]);var AZ={exports:{}};(function(t,e){ace.define("ace/mode/sql_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(n,r,i){var o=n("../lib/oop"),s=n("./text_highlight_rules").TextHighlightRules,a=function(){var l="select|insert|update|delete|from|where|and|or|group|by|order|limit|offset|having|as|case|when|then|else|end|type|left|right|join|on|outer|desc|asc|union|create|table|primary|key|if|foreign|not|references|default|null|inner|cross|natural|database|drop|grant|distinct|is|in|all|alter|any|array|at|authorization|between|both|cast|check|collate|column|commit|constraint|cube|current|current_date|current_time|current_timestamp|current_user|describe|escape|except|exists|external|extract|fetch|filter|for|full|function|global|grouping|intersect|interval|into|leading|like|local|no|of|only|out|overlaps|partition|position|range|revoke|rollback|rollup|row|rows|session_user|set|some|start|tablesample|time|to|trailing|truncate|unique|unknown|user|using|values|window|with",c="true|false",u="avg|count|first|last|max|min|sum|ucase|lcase|mid|len|round|rank|now|format|coalesce|ifnull|isnull|nvl",d="int|numeric|decimal|date|varchar|char|bigint|float|double|bit|binary|text|set|timestamp|money|real|number|integer|string",p=this.createKeywordMapper({"support.function":u,keyword:l,"constant.language":c,"storage.type":d},"identifier",!0);this.$rules={start:[{token:"comment",regex:"--.*$"},{token:"comment",start:"/\\*",end:"\\*/"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"},{token:"string",regex:"`.*?`"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:p,regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"paren.lparen",regex:"[\\(]"},{token:"paren.rparen",regex:"[\\)]"},{token:"text",regex:"\\s+"}]},this.normalizeRules()};o.inherits(a,s),r.SqlHighlightRules=a}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(n,r,i){var o=n("../../lib/oop"),s=n("../../range").Range,a=n("./fold_mode").FoldMode,l=r.FoldMode=function(c){c&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+c.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+c.end)))};o.inherits(l,a),(function(){this.foldingStartMarker=/([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(c,u,d){var p=c.getLine(d);if(this.singleLineBlockCommentRe.test(p)&&!this.startRegionRe.test(p)&&!this.tripleStarBlockCommentRe.test(p))return"";var m=this._getFoldWidgetBase(c,u,d);return!m&&this.startRegionRe.test(p)?"start":m},this.getFoldWidgetRange=function(c,u,d,p){var m=c.getLine(d);if(this.startRegionRe.test(m))return this.getCommentRegionBlock(c,m,d);var x=m.match(this.foldingStartMarker);if(x){var y=x.index;if(x[1])return this.openingBracketBlock(c,x[1],d,y);var w=c.getCommentFoldRange(d,y+x[0].length,1);return w&&!w.isMultiLine()&&(p?w=this.getSectionRange(c,d):u!="all"&&(w=null)),w}if(u!=="markbegin"){var x=m.match(this.foldingStopMarker);if(x){var y=x.index+x[0].length;return x[1]?this.closingBracketBlock(c,x[1],d,y):c.getCommentFoldRange(d,y,-1)}}},this.getSectionRange=function(c,u){var d=c.getLine(u),p=d.search(/\S/),m=u,y=d.length;u=u+1;for(var w=u,x=c.getLength();++uC)break;var S=this.getFoldWidgetRange(c,"all",u);if(S){if(S.start.row<=m)break;if(S.isMultiLine())u=S.end.row;else if(p==C)break}w=u}}return new s(m,y,w,c.getLine(w).length)},this.getCommentRegionBlock=function(c,u,d){for(var p=u.search(/\s*$/),m=c.getLength(),y=d,w=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,x=1;++dy)return new s(y,p,S,u.length)}}).call(l.prototype)}),ace.define("ace/mode/folding/sql",["require","exports","module","ace/lib/oop","ace/mode/folding/cstyle"],function(n,r,i){var o=n("../../lib/oop"),s=n("./cstyle").FoldMode,a=r.FoldMode=function(){};o.inherits(a,s),(function(){}).call(a.prototype)}),ace.define("ace/mode/sql",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/sql_highlight_rules","ace/mode/folding/sql"],function(n,r,i){var o=n("../lib/oop"),s=n("./text").Mode,a=n("./sql_highlight_rules").SqlHighlightRules,l=n("./folding/sql").FoldMode,c=function(){this.HighlightRules=a,this.foldingRules=new l,this.$behaviour=this.$defaultBehaviour};o.inherits(c,s),(function(){this.lineCommentStart="--",this.blockComment={start:"/*",end:"*/"},this.$id="ace/mode/sql",this.snippetFileId="ace/snippets/sql"}).call(c.prototype),r.Mode=c}),function(){ace.require(["ace/mode/sql"],function(n){t&&(t.exports=n)})}()})(AZ);var IZ=AZ.exports;const S8e=Vd({__proto__:null,default:gl(IZ)},[IZ]);var LZ={exports:{}};(function(t,e){ace.define("ace/mode/jsdoc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(n,r,i){var o=n("../lib/oop"),s=n("./text_highlight_rules").TextHighlightRules,a=function(){this.$rules={start:[{token:["comment.doc.tag","comment.doc.text","lparen.doc"],regex:"(@(?:param|member|typedef|property|namespace|var|const|callback))(\\s*)({)",push:[{token:"lparen.doc",regex:"{",push:[{include:"doc-syntax"},{token:"rparen.doc",regex:"}|(?=$)",next:"pop"}]},{token:["rparen.doc","text.doc","variable.parameter.doc","lparen.doc","variable.parameter.doc","rparen.doc"],regex:/(})(\s*)(?:([\w=:\/\.]+)|(?:(\[)([\w=:\/\.\-\'\" ]+)(\])))/,next:"pop"},{token:"rparen.doc",regex:"}|(?=$)",next:"pop"},{include:"doc-syntax"},{defaultToken:"text.doc"}]},{token:["comment.doc.tag","text.doc","lparen.doc"],regex:"(@(?:returns?|yields|type|this|suppress|public|protected|private|package|modifies|implements|external|exception|throws|enum|define|extends))(\\s*)({)",push:[{token:"lparen.doc",regex:"{",push:[{include:"doc-syntax"},{token:"rparen.doc",regex:"}|(?=$)",next:"pop"}]},{token:"rparen.doc",regex:"}|(?=$)",next:"pop"},{include:"doc-syntax"},{defaultToken:"text.doc"}]},{token:["comment.doc.tag","text.doc","variable.parameter.doc"],regex:'(@(?:alias|memberof|instance|module|name|lends|namespace|external|this|template|requires|param|implements|function|extends|typedef|mixes|constructor|var|memberof\\!|event|listens|exports|class|constructs|interface|emits|fires|throws|const|callback|borrows|augments))(\\s+)(\\w[\\w#.:/~"\\-]*)?'},{token:["comment.doc.tag","text.doc","variable.parameter.doc"],regex:"(@method)(\\s+)(\\w[\\w.\\(\\)]*)"},{token:"comment.doc.tag",regex:"@access\\s+(?:private|public|protected)"},{token:"comment.doc.tag",regex:"@kind\\s+(?:class|constant|event|external|file|function|member|mixin|module|namespace|typedef)"},{token:"comment.doc.tag",regex:"@\\w+(?=\\s|$)"},a.getTagRule(),{defaultToken:"comment.doc.body",caseInsensitive:!0}],"doc-syntax":[{token:"operator.doc",regex:/[|:]/},{token:"paren.doc",regex:/[\[\]]/}]},this.normalizeRules()};o.inherits(a,s),a.getTagRule=function(l){return{token:"comment.doc.tag.storage.type",regex:"\\b(?:TODO|FIXME|XXX|HACK)\\b"}},a.getStartRule=function(l){return{token:"comment.doc",regex:/\/\*\*(?!\/)/,next:l}},a.getEndRule=function(l){return{token:"comment.doc",regex:"\\*\\/",next:l}},r.JsDocCommentHighlightRules=a}),ace.define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/jsdoc_comment_highlight_rules","ace/mode/text_highlight_rules"],function(n,r,i){var o=n("../lib/oop"),s=n("./jsdoc_comment_highlight_rules").JsDocCommentHighlightRules,a=n("./text_highlight_rules").TextHighlightRules,l="[a-zA-Z\\$_¡-￿][a-zA-Z\\d\\$_¡-￿]*",c=function(p){var m={"variable.language":"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Symbol|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document",keyword:"const|yield|import|get|set|async|await|break|case|catch|continue|default|delete|do|else|finally|for|if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static|constructor","storage.type":"const|let|var|function","constant.language":"null|Infinity|NaN|undefined","support.function":"alert","constant.language.boolean":"true|false"},y=this.createKeywordMapper(m,"identifier"),w="case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void",x="\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|u{[0-9a-fA-F]{1,6}}|[0-2][0-7]{0,2}|3[0-7][0-7]?|[4-7][0-7]?|.)",C="(function)(\\s*)(\\*?)",S={token:["identifier","text","paren.lparen"],regex:"(\\b(?!"+Object.values(m).join("|")+"\\b)"+l+")(\\s*)(\\()"};this.$rules={no_regex:[s.getStartRule("doc-start"),d("no_regex"),S,{token:"string",regex:"'(?=.)",next:"qstring"},{token:"string",regex:'"(?=.)',next:"qqstring"},{token:"constant.numeric",regex:/0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/},{token:"constant.numeric",regex:/(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/},{token:["entity.name.function","text","keyword.operator","text","storage.type","text","storage.type","text","paren.lparen"],regex:"("+l+")(\\s*)(=)(\\s*)"+C+"(\\s*)(\\()",next:"function_arguments"},{token:["storage.type","text","storage.type","text","text","entity.name.function","text","paren.lparen"],regex:"(function)(?:(?:(\\s*)(\\*)(\\s*))|(\\s+))("+l+")(\\s*)(\\()",next:"function_arguments"},{token:["entity.name.function","text","punctuation.operator","text","storage.type","text","storage.type","text","paren.lparen"],regex:"("+l+")(\\s*)(:)(\\s*)"+C+"(\\s*)(\\()",next:"function_arguments"},{token:["text","text","storage.type","text","storage.type","text","paren.lparen"],regex:"(:)(\\s*)"+C+"(\\s*)(\\()",next:"function_arguments"},{token:"keyword",regex:`from(?=\\s*('|"))`},{token:"keyword",regex:"(?:"+w+")\\b",next:"start"},{token:"support.constant",regex:/that\b/},{token:["storage.type","punctuation.operator","support.function.firebug"],regex:/(console)(\.)(warn|info|log|error|debug|time|trace|timeEnd|assert)\b/},{token:y,regex:l},{token:"punctuation.operator",regex:/[.](?![.])/,next:"property"},{token:"storage.type",regex:/=>/,next:"start"},{token:"keyword.operator",regex:/--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,next:"start"},{token:"punctuation.operator",regex:/[?:,;.]/,next:"start"},{token:"paren.lparen",regex:/[\[({]/,next:"start"},{token:"paren.rparen",regex:/[\])}]/},{token:"comment",regex:/^#!.*$/}],property:[{token:"text",regex:"\\s+"},{token:"keyword.operator",regex:/=/},{token:["storage.type","text","storage.type","text","paren.lparen"],regex:C+"(\\s*)(\\()",next:"function_arguments"},{token:["storage.type","text","storage.type","text","text","entity.name.function","text","paren.lparen"],regex:"(function)(?:(?:(\\s*)(\\*)(\\s*))|(\\s+))(\\w+)(\\s*)(\\()",next:"function_arguments"},{token:"punctuation.operator",regex:/[.](?![.])/},{token:"support.function",regex:"prototype"},{token:"support.function",regex:/(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|lter|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward|rEach)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/},{token:"support.function.dom",regex:/(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/},{token:"support.constant",regex:/(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/},{token:"identifier",regex:l},{regex:"",token:"empty",next:"no_regex"}],start:[s.getStartRule("doc-start"),d("start"),{token:"string.regexp",regex:"\\/",next:"regex"},{token:"text",regex:"\\s+|^$",next:"start"},{token:"empty",regex:"",next:"no_regex"}],regex:[{token:"regexp.keyword.operator",regex:"\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"},{token:"string.regexp",regex:"/[sxngimy]*",next:"no_regex"},{token:"invalid",regex:/\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/},{token:"constant.language.escape",regex:/\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/},{token:"constant.language.delimiter",regex:/\|/},{token:"constant.language.escape",regex:/\[\^?/,next:"regex_character_class"},{token:"empty",regex:"$",next:"no_regex"},{defaultToken:"string.regexp"}],regex_character_class:[{token:"regexp.charclass.keyword.operator",regex:"\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"},{token:"constant.language.escape",regex:"]",next:"regex"},{token:"constant.language.escape",regex:"-"},{token:"empty",regex:"$",next:"no_regex"},{defaultToken:"string.regexp.charachterclass"}],default_parameter:[{token:"string",regex:"'(?=.)",push:[{token:"string",regex:"'|$",next:"pop"},{include:"qstring"}]},{token:"string",regex:'"(?=.)',push:[{token:"string",regex:'"|$',next:"pop"},{include:"qqstring"}]},{token:"constant.language",regex:"null|Infinity|NaN|undefined"},{token:"constant.numeric",regex:/0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/},{token:"constant.numeric",regex:/(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/},{token:"punctuation.operator",regex:",",next:"function_arguments"},{token:"text",regex:"\\s+"},{token:"punctuation.operator",regex:"$"},{token:"empty",regex:"",next:"no_regex"}],function_arguments:[d("function_arguments"),{token:"variable.parameter",regex:l},{token:"punctuation.operator",regex:","},{token:"text",regex:"\\s+"},{token:"punctuation.operator",regex:"$"},{token:"empty",regex:"",next:"no_regex"}],qqstring:[{token:"constant.language.escape",regex:x},{token:"string",regex:"\\\\$",consumeLineEnd:!0},{token:"string",regex:'"|$',next:"no_regex"},{defaultToken:"string"}],qstring:[{token:"constant.language.escape",regex:x},{token:"string",regex:"\\\\$",consumeLineEnd:!0},{token:"string",regex:"'|$",next:"no_regex"},{defaultToken:"string"}]},(!p||!p.noES6)&&(this.$rules.no_regex.unshift({regex:"[{}]",onMatch:function(M,E,A){if(this.next=M=="{"?this.nextState:"",M=="{"&&A.length)A.unshift("start",E);else if(M=="}"&&A.length&&(A.shift(),this.next=A.shift(),this.next.indexOf("string")!=-1||this.next.indexOf("jsx")!=-1))return"paren.quasi.end";return M=="{"?"paren.lparen":"paren.rparen"},nextState:"start"},{token:"string.quasi.start",regex:/`/,push:[{token:"constant.language.escape",regex:x},{token:"paren.quasi.start",regex:/\${/,push:"start"},{token:"string.quasi.end",regex:/`/,next:"pop"},{defaultToken:"string.quasi"}]},{token:["variable.parameter","text"],regex:"("+l+")(\\s*)(?=\\=>)"},{token:"paren.lparen",regex:"(\\()(?=[^\\(]+\\s*=>)",next:"function_arguments"},{token:"variable.language",regex:"(?:(?:(?:Weak)?(?:Set|Map))|Promise)\\b"}),this.$rules.function_arguments.unshift({token:"keyword.operator",regex:"=",next:"default_parameter"},{token:"keyword.operator",regex:"\\.{3}"}),this.$rules.property.unshift({token:"support.function",regex:"(findIndex|repeat|startsWith|endsWith|includes|isSafeInteger|trunc|cbrt|log2|log10|sign|then|catch|finally|resolve|reject|race|any|all|allSettled|keys|entries|isInteger)\\b(?=\\()"},{token:"constant.language",regex:"(?:MAX_SAFE_INTEGER|MIN_SAFE_INTEGER|EPSILON)\\b"}),(!p||p.jsx!=!1)&&u.call(this)),this.embedRules(s,"doc-",[s.getEndRule("no_regex")]),this.normalizeRules()};o.inherits(c,a);function u(){var p=l.replace("\\d","\\d\\-"),m={onMatch:function(w,x,C){var S=w.charAt(1)=="/"?2:1;return S==1?(x!=this.nextState?C.unshift(this.next,this.nextState,0):C.unshift(this.next),C[2]++):S==2&&x==this.nextState&&(C[1]--,(!C[1]||C[1]<0)&&(C.shift(),C.shift())),[{type:"meta.tag.punctuation."+(S==1?"":"end-")+"tag-open.xml",value:w.slice(0,S)},{type:"meta.tag.tag-name.xml",value:w.substr(S)}]},regex:"))",next:"jsxAttributes",nextState:"jsx"};this.$rules.start.unshift(m);var y={regex:"{",token:"paren.quasi.start",push:"start"};this.$rules.jsx=[y,m,{include:"reference"},{defaultToken:"string.xml"}],this.$rules.jsxAttributes=[{token:"meta.tag.punctuation.tag-close.xml",regex:"/?>",onMatch:function(w,x,C){return x==C[0]&&C.shift(),w.length==2&&(C[0]==this.nextState&&C[1]--,(!C[1]||C[1]<0)&&C.splice(0,2)),this.next=C[0]||"start",[{type:this.token,value:w}]},nextState:"jsx"},y,d("jsxAttributes"),{token:"entity.other.attribute-name.xml",regex:p},{token:"keyword.operator.attribute-equals.xml",regex:"="},{token:"text.tag-whitespace.xml",regex:"\\s+"},{token:"string.attribute-value.xml",regex:"'",stateName:"jsx_attr_q",push:[{token:"string.attribute-value.xml",regex:"'",next:"pop"},{include:"reference"},{defaultToken:"string.attribute-value.xml"}]},{token:"string.attribute-value.xml",regex:'"',stateName:"jsx_attr_qq",push:[{token:"string.attribute-value.xml",regex:'"',next:"pop"},{include:"reference"},{defaultToken:"string.attribute-value.xml"}]},m],this.$rules.reference=[{token:"constant.language.escape.reference.xml",regex:"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"}]}function d(p){return[{token:"comment",regex:/\/\*/,next:[s.getTagRule(),{token:"comment",regex:"\\*\\/",next:p||"pop"},{defaultToken:"comment",caseInsensitive:!0}]},{token:"comment",regex:"\\/\\/",next:[s.getTagRule(),{token:"comment",regex:"$|^",next:p||"pop"},{defaultToken:"comment",caseInsensitive:!0}]}]}r.JavaScriptHighlightRules=c}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(n,r,i){var o=n("../range").Range,s=function(){};(function(){this.checkOutdent=function(a,l){return/^\s+$/.test(a)?/^\s*\}/.test(l):!1},this.autoOutdent=function(a,l){var c=a.getLine(l),u=c.match(/^(\s*\})/);if(!u)return 0;var d=u[1].length,p=a.findMatchingBracket({row:l,column:d});if(!p||p.row==l)return 0;var m=this.$getIndent(a.getLine(p.row));a.replace(new o(l,0,l,d-1),m)},this.$getIndent=function(a){return a.match(/^\s*/)[0]}}).call(s.prototype),r.MatchingBraceOutdent=s}),ace.define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator"],function(n,r,i){var o=n("../../lib/oop"),s=n("../behaviour").Behaviour,a=n("../../token_iterator").TokenIterator;function l(u,d){return u&&u.type.lastIndexOf(d+".xml")>-1}var c=function(){this.add("string_dquotes","insertion",function(u,d,p,m,y){if(y=='"'||y=="'"){var w=y,x=m.doc.getTextRange(p.getSelectionRange());if(x!==""&&x!=="'"&&x!='"'&&p.getWrapBehavioursEnabled())return{text:w+x+w,selection:!1};var C=p.getCursorPosition(),S=m.doc.getLine(C.row),M=S.substring(C.column,C.column+1),E=new a(m,C.row,C.column),A=E.getCurrentToken();if(M==w&&(l(A,"attribute-value")||l(A,"string")))return{text:"",selection:[1,1]};if(A||(A=E.stepBackward()),!A)return;for(;l(A,"tag-whitespace")||l(A,"whitespace");)A=E.stepBackward();var I=!M||M.match(/\s/);if(l(A,"attribute-equals")&&(I||M==">")||l(A,"decl-attribute-equals")&&(I||M=="?"))return{text:w+w,selection:[1,1]}}}),this.add("string_dquotes","deletion",function(u,d,p,m,y){var w=m.doc.getTextRange(y);if(!y.isMultiLine()&&(w=='"'||w=="'")){var x=m.doc.getLine(y.start.row),C=x.substring(y.start.column+1,y.start.column+2);if(C==w)return y.end.column++,y}}),this.add("autoclosing","insertion",function(u,d,p,m,y){if(y==">"){var w=p.getSelectionRange().start,x=new a(m,w.row,w.column),C=x.getCurrentToken()||x.stepBackward();if(!C||!(l(C,"tag-name")||l(C,"tag-whitespace")||l(C,"attribute-name")||l(C,"attribute-equals")||l(C,"attribute-value"))||l(C,"reference.attribute-value"))return;if(l(C,"attribute-value")){var S=x.getCurrentTokenColumn()+C.value.length;if(w.column/.test(m.getLine(w.row).slice(w.column)))return;for(;!l(C,"tag-name");)if(C=x.stepBackward(),C.value=="<"){C=x.stepForward();break}var E=x.getCurrentTokenRow(),A=x.getCurrentTokenColumn();if(l(x.stepBackward(),"end-tag-open"))return;var I=C.value;return E==w.row&&(I=I.substring(0,w.column-A)),this.voidElements&&this.voidElements.hasOwnProperty(I.toLowerCase())?void 0:{text:">",selection:[1,1]}}}),this.add("autoindent","insertion",function(u,d,p,m,y){if(y==` `){var w=p.getCursorPosition(),x=m.getLine(w.row),C=new a(m,w.row,w.column),S=C.getCurrentToken();if(l(S,"")&&S.type.indexOf("tag-close")!==-1){if(S.value=="/>")return;for(;S&&S.type.indexOf("tag-name")===-1;)S=C.stepBackward();if(!S)return;var M=S.value,E=C.getCurrentTokenRow();if(S=C.stepBackward(),!S||S.type.indexOf("end-tag")!==-1)return;if(this.voidElements&&!this.voidElements[M]||!this.voidElements){var A=m.getTokenAt(w.row,w.column+1),x=m.getLine(E),I=this.$getIndent(x),O=I+m.getTabString();return A&&A.value===""){var x=m.getSelectionRange().start,C=new s(y,x.row,x.column),S=C.getCurrentToken()||C.stepBackward();if(!S)return;if(S.value=="<")return{text:">",selection:[1,1]}}})};o.inherits(c,a),r.JavaScriptBehaviour=c}),ace.define("ace/mode/folding/xml",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(n,r,i){var o=n("../../lib/oop"),s=n("../../range").Range,a=n("./fold_mode").FoldMode,l=r.FoldMode=function(d,p){a.call(this),this.voidElements=d||{},this.optionalEndTags=o.mixin({},this.voidElements),p&&o.mixin(this.optionalEndTags,p)};o.inherits(l,a);var c=function(){this.tagName="",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};function u(d,p){return d&&d.type&&d.type.lastIndexOf(p+".xml")>-1}(function(){this.getFoldWidget=function(d,p,m){var y=this._getFirstTagInLine(d,m);return y?y.closing||!y.tagName&&y.selfClosing?p==="markbeginend"?"end":"":!y.tagName||y.selfClosing||this.voidElements.hasOwnProperty(y.tagName.toLowerCase())||this._findEndTagInLine(d,m,y.tagName,y.end.column)?"":"start":this.getCommentFoldWidget(d,m)},this.getCommentFoldWidget=function(d,p){return/comment/.test(d.getState(p))&&/";break}return y}else if(u(x,"tag-close"))return y.selfClosing=x.value=="/>",y;y.start.column+=x.value.length}return null},this._findEndTagInLine=function(d,p,m,y){for(var w=d.getTokens(p),x=0,C=0;CC)break;var S=this.getFoldWidgetRange(c,"all",u);if(S){if(S.start.row<=m)break;if(S.isMultiLine())u=S.end.row;else if(p==C)break}w=u}}return new s(m,y,w,c.getLine(w).length)},this.getCommentRegionBlock=function(c,u,d){for(var p=u.search(/\s*$/),m=c.getLength(),y=d,w=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,x=1;++dy)return new s(y,p,S,u.length)}}).call(l.prototype)}),ace.define("ace/mode/folding/javascript",["require","exports","module","ace/lib/oop","ace/mode/folding/xml","ace/mode/folding/cstyle"],function(n,r,i){var o=n("../../lib/oop"),s=n("./xml").FoldMode,a=n("./cstyle").FoldMode,l=r.FoldMode=function(c){c&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+c.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+c.end))),this.xmlFoldMode=new s};o.inherits(l,a),(function(){this.getFoldWidgetRangeBase=this.getFoldWidgetRange,this.getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(c,u,d){var p=this.getFoldWidgetBase(c,u,d);return p||this.xmlFoldMode.getFoldWidget(c,u,d)},this.getFoldWidgetRange=function(c,u,d,p){var m=this.getFoldWidgetRangeBase(c,u,d,p);return m||this.xmlFoldMode.getFoldWidgetRange(c,u,d)}}).call(l.prototype)}),ace.define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/javascript","ace/mode/folding/javascript"],function(n,r,i){var o=n("../lib/oop"),s=n("./text").Mode,a=n("./javascript_highlight_rules").JavaScriptHighlightRules,l=n("./matching_brace_outdent").MatchingBraceOutdent,c=n("../worker/worker_client").WorkerClient,u=n("./behaviour/javascript").JavaScriptBehaviour,d=n("./folding/javascript").FoldMode,p=function(){this.HighlightRules=a,this.$outdent=new l,this.$behaviour=new u,this.foldingRules=new d};o.inherits(p,s),(function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.$quotes={'"':'"',"'":"'","`":"`"},this.$pairQuotesAfter={"`":/\w/},this.getNextLineIndent=function(m,y,w){var x=this.$getIndent(y),C=this.getTokenizer().getLineTokens(y,m),S=C.tokens,M=C.state;if(S.length&&S[S.length-1].type=="comment")return x;if(m=="start"||m=="no_regex"){var E=y.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);E&&(x+=w)}else if(m=="doc-start"&&(M=="start"||M=="no_regex"))return"";return x},this.checkOutdent=function(m,y,w){return this.$outdent.checkOutdent(y,w)},this.autoOutdent=function(m,y,w){this.$outdent.autoOutdent(y,w)},this.createWorker=function(m){var y=new c(["ace"],"ace/mode/javascript_worker","JavaScriptWorker");return y.attachToDocument(m.getDocument()),y.on("annotate",function(w){m.setAnnotations(w.data)}),y.on("terminate",function(){m.clearAnnotations()}),y},this.$id="ace/mode/javascript",this.snippetFileId="ace/snippets/javascript"}).call(p.prototype),r.Mode=p}),ace.define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"],function(n,r,i){var o=n("../lib/oop");n("../lib/lang");var s=n("./text_highlight_rules").TextHighlightRules,a=r.supportType="align-content|align-items|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|border|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|bottom|box-shadow|box-sizing|caption-side|clear|clip|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|cursor|direction|display|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|font|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|hanging-punctuation|height|justify-content|left|letter-spacing|line-height|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|max-height|max-width|max-zoom|min-height|min-width|min-zoom|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|order|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page-break-after|page-break-before|page-break-inside|perspective|perspective-origin|position|quotes|resize|right|tab-size|table-layout|text-align|text-align-last|text-decoration|text-decoration-color|text-decoration-line|text-decoration-style|text-indent|text-justify|text-overflow|text-shadow|text-transform|top|transform|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|user-select|user-zoom|vertical-align|visibility|white-space|width|word-break|word-spacing|word-wrap|z-index",l=r.supportFunction="rgb|rgba|url|attr|counter|counters",c=r.supportConstant="absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|flex-end|flex-start|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero|zoom",u=r.supportConstantColor="aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen",d=r.supportConstantFonts="arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace",p=r.numRe="\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))",m=r.pseudoElements="(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b",y=r.pseudoClasses="(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b",w=function(){var x=this.createKeywordMapper({"support.function":l,"support.constant":c,"support.type":a,"support.constant.color":u,"support.constant.fonts":d},"text",!0);this.$rules={start:[{include:["strings","url","comments"]},{token:"paren.lparen",regex:"\\{",next:"ruleset"},{token:"paren.rparen",regex:"\\}"},{token:"string",regex:"@(?!viewport)",next:"media"},{token:"keyword",regex:"#[a-z0-9-_]+"},{token:"keyword",regex:"%"},{token:"variable",regex:"\\.[a-z0-9-_]+"},{token:"string",regex:":[a-z0-9-_]+"},{token:"constant.numeric",regex:p},{token:"constant",regex:"[a-z0-9-_]+"},{caseInsensitive:!0}],media:[{include:["strings","url","comments"]},{token:"paren.lparen",regex:"\\{",next:"start"},{token:"paren.rparen",regex:"\\}",next:"start"},{token:"string",regex:";",next:"start"},{token:"keyword",regex:"(?:media|supports|document|charset|import|namespace|media|supports|document|page|font|keyframes|viewport|counter-style|font-feature-values|swash|ornaments|annotation|stylistic|styleset|character-variant)"}],comments:[{token:"comment",regex:"\\/\\*",push:[{token:"comment",regex:"\\*\\/",next:"pop"},{defaultToken:"comment"}]}],ruleset:[{regex:"-(webkit|ms|moz|o)-",token:"text"},{token:"punctuation.operator",regex:"[:;]"},{token:"paren.rparen",regex:"\\}",next:"start"},{include:["strings","url","comments"]},{token:["constant.numeric","keyword"],regex:"("+p+")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vmax|vmin|vm|vw|%)"},{token:"constant.numeric",regex:p},{token:"constant.numeric",regex:"#[a-f0-9]{6}"},{token:"constant.numeric",regex:"#[a-f0-9]{3}"},{token:["punctuation","entity.other.attribute-name.pseudo-element.css"],regex:m},{token:["punctuation","entity.other.attribute-name.pseudo-class.css"],regex:y},{include:"url"},{token:x,regex:"\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"},{token:"paren.lparen",regex:"\\{"},{caseInsensitive:!0}],url:[{token:"support.function",regex:"(?:url(:?-prefix)?|domain|regexp)\\(",push:[{token:"support.function",regex:"\\)",next:"pop"},{defaultToken:"string"}]}],strings:[{token:"string.start",regex:"'",push:[{token:"string.end",regex:"'|$",next:"pop"},{include:"escapes"},{token:"constant.language.escape",regex:/\\$/,consumeLineEnd:!0},{defaultToken:"string"}]},{token:"string.start",regex:'"',push:[{token:"string.end",regex:'"|$',next:"pop"},{include:"escapes"},{token:"constant.language.escape",regex:/\\$/,consumeLineEnd:!0},{defaultToken:"string"}]}],escapes:[{token:"constant.language.escape",regex:/\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/}]},this.normalizeRules()};o.inherits(w,s),r.CssHighlightRules=w}),ace.define("ace/mode/css_completions",["require","exports","module"],function(n,r,i){var o={background:{"#$0":1},"background-color":{"#$0":1,transparent:1,fixed:1},"background-image":{"url('/$0')":1},"background-repeat":{repeat:1,"repeat-x":1,"repeat-y":1,"no-repeat":1,inherit:1},"background-position":{bottom:2,center:2,left:2,right:2,top:2,inherit:2},"background-attachment":{scroll:1,fixed:1},"background-size":{cover:1,contain:1},"background-clip":{"border-box":1,"padding-box":1,"content-box":1},"background-origin":{"border-box":1,"padding-box":1,"content-box":1},border:{"solid $0":1,"dashed $0":1,"dotted $0":1,"#$0":1},"border-color":{"#$0":1},"border-style":{solid:2,dashed:2,dotted:2,double:2,groove:2,hidden:2,inherit:2,inset:2,none:2,outset:2,ridged:2},"border-collapse":{collapse:1,separate:1},bottom:{px:1,em:1,"%":1},clear:{left:1,right:1,both:1,none:1},color:{"#$0":1,"rgb(#$00,0,0)":1},cursor:{default:1,pointer:1,move:1,text:1,wait:1,help:1,progress:1,"n-resize":1,"ne-resize":1,"e-resize":1,"se-resize":1,"s-resize":1,"sw-resize":1,"w-resize":1,"nw-resize":1},display:{none:1,block:1,inline:1,"inline-block":1,"table-cell":1},"empty-cells":{show:1,hide:1},float:{left:1,right:1,none:1},"font-family":{Arial:2,"Comic Sans MS":2,Consolas:2,"Courier New":2,Courier:2,Georgia:2,Monospace:2,"Sans-Serif":2,"Segoe UI":2,Tahoma:2,"Times New Roman":2,"Trebuchet MS":2,Verdana:1},"font-size":{px:1,em:1,"%":1},"font-weight":{bold:1,normal:1},"font-style":{italic:1,normal:1},"font-variant":{normal:1,"small-caps":1},height:{px:1,em:1,"%":1},left:{px:1,em:1,"%":1},"letter-spacing":{normal:1},"line-height":{normal:1},"list-style-type":{none:1,disc:1,circle:1,square:1,decimal:1,"decimal-leading-zero":1,"lower-roman":1,"upper-roman":1,"lower-greek":1,"lower-latin":1,"upper-latin":1,georgian:1,"lower-alpha":1,"upper-alpha":1},margin:{px:1,em:1,"%":1},"margin-right":{px:1,em:1,"%":1},"margin-left":{px:1,em:1,"%":1},"margin-top":{px:1,em:1,"%":1},"margin-bottom":{px:1,em:1,"%":1},"max-height":{px:1,em:1,"%":1},"max-width":{px:1,em:1,"%":1},"min-height":{px:1,em:1,"%":1},"min-width":{px:1,em:1,"%":1},overflow:{hidden:1,visible:1,auto:1,scroll:1},"overflow-x":{hidden:1,visible:1,auto:1,scroll:1},"overflow-y":{hidden:1,visible:1,auto:1,scroll:1},padding:{px:1,em:1,"%":1},"padding-top":{px:1,em:1,"%":1},"padding-right":{px:1,em:1,"%":1},"padding-bottom":{px:1,em:1,"%":1},"padding-left":{px:1,em:1,"%":1},"page-break-after":{auto:1,always:1,avoid:1,left:1,right:1},"page-break-before":{auto:1,always:1,avoid:1,left:1,right:1},position:{absolute:1,relative:1,fixed:1,static:1},right:{px:1,em:1,"%":1},"table-layout":{fixed:1,auto:1},"text-decoration":{none:1,underline:1,"line-through":1,blink:1},"text-align":{left:1,right:1,center:1,justify:1},"text-transform":{capitalize:1,uppercase:1,lowercase:1,none:1},top:{px:1,em:1,"%":1},"vertical-align":{top:1,bottom:1},visibility:{hidden:1,visible:1},"white-space":{nowrap:1,normal:1,pre:1,"pre-line":1,"pre-wrap":1},width:{px:1,em:1,"%":1},"word-spacing":{normal:1},filter:{"alpha(opacity=$0100)":1},"text-shadow":{"$02px 2px 2px #777":1},"text-overflow":{"ellipsis-word":1,clip:1,ellipsis:1},"-moz-border-radius":1,"-moz-border-radius-topright":1,"-moz-border-radius-bottomright":1,"-moz-border-radius-topleft":1,"-moz-border-radius-bottomleft":1,"-webkit-border-radius":1,"-webkit-border-top-right-radius":1,"-webkit-border-top-left-radius":1,"-webkit-border-bottom-right-radius":1,"-webkit-border-bottom-left-radius":1,"-moz-box-shadow":1,"-webkit-box-shadow":1,transform:{"rotate($00deg)":1,"skew($00deg)":1},"-moz-transform":{"rotate($00deg)":1,"skew($00deg)":1},"-webkit-transform":{"rotate($00deg)":1,"skew($00deg)":1}},s=function(){};(function(){this.completionsDefined=!1,this.defineCompletions=function(){if(document){var a=document.createElement("c").style;for(var l in a)if(typeof a[l]=="string"){var c=l.replace(/[A-Z]/g,function(u){return"-"+u.toLowerCase()});o.hasOwnProperty(c)||(o[c]=1)}}this.completionsDefined=!0},this.getCompletions=function(a,l,c,u){if(this.completionsDefined||this.defineCompletions(),a==="ruleset"||l.$mode.$id=="ace/mode/scss"){var d=l.getLine(c.row).substr(0,c.column),p=/\([^)]*$/.test(d);return p&&(d=d.substr(d.lastIndexOf("(")+1)),/:[^;]+$/.test(d)?this.getPropertyValueCompletions(a,l,c,u):this.getPropertyCompletions(a,l,c,u,p)}return[]},this.getPropertyCompletions=function(a,l,c,u,d){d=d||!1;var p=Object.keys(o);return p.map(function(m){return{caption:m,snippet:m+": $0"+(d?"":";"),meta:"property",score:1e6}})},this.getPropertyValueCompletions=function(a,l,c,u){var d=l.getLine(c.row).substr(0,c.column),p=(/([\w\-]+):[^:]*$/.exec(d)||{})[1];if(!p)return[];var m=[];return p in o&&typeof o[p]=="object"&&(m=Object.keys(o[p])),m.map(function(y){return{caption:y,snippet:y,meta:"property value",score:1e6}})}}).call(s.prototype),r.CssCompletions=s}),ace.define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"],function(n,r,i){var o=n("../../lib/oop");n("../behaviour").Behaviour;var s=n("./cstyle").CstyleBehaviour,a=n("../../token_iterator").TokenIterator,l=function(){this.inherit(s),this.add("colon","insertion",function(c,u,d,p,m){if(m===":"&&d.selection.isEmpty()){var y=d.getCursorPosition(),w=new a(p,y.row,y.column),x=w.getCurrentToken();if(x&&x.value.match(/\s+/)&&(x=w.stepBackward()),x&&x.type==="support.type"){var C=p.doc.getLine(y.row),S=C.substring(y.column,y.column+1);if(S===":")return{text:"",selection:[1,1]};if(/^(\s+[^;]|\s*$)/.test(C.substring(y.column)))return{text:":;",selection:[1,1]}}}}),this.add("colon","deletion",function(c,u,d,p,m){var y=p.doc.getTextRange(m);if(!m.isMultiLine()&&y===":"){var w=d.getCursorPosition(),x=new a(p,w.row,w.column),C=x.getCurrentToken();if(C&&C.value.match(/\s+/)&&(C=x.stepBackward()),C&&C.type==="support.type"){var S=p.doc.getLine(m.start.row),M=S.substring(m.end.column,m.end.column+1);if(M===";")return m.end.column++,m}}}),this.add("semicolon","insertion",function(c,u,d,p,m){if(m===";"&&d.selection.isEmpty()){var y=d.getCursorPosition(),w=p.doc.getLine(y.row),x=w.substring(y.column,y.column+1);if(x===";")return{text:"",selection:[1,1]}}}),this.add("!important","insertion",function(c,u,d,p,m){if(m==="!"&&d.selection.isEmpty()){var y=d.getCursorPosition(),w=p.doc.getLine(y.row);if(/^\s*(;|}|$)/.test(w.substring(y.column)))return{text:"!important",selection:[10,10]}}})};o.inherits(l,s),r.CssBehaviour=l}),ace.define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/css_completions","ace/mode/behaviour/css","ace/mode/folding/cstyle"],function(n,r,i){var o=n("../lib/oop"),s=n("./text").Mode,a=n("./css_highlight_rules").CssHighlightRules,l=n("./matching_brace_outdent").MatchingBraceOutdent,c=n("../worker/worker_client").WorkerClient,u=n("./css_completions").CssCompletions,d=n("./behaviour/css").CssBehaviour,p=n("./folding/cstyle").FoldMode,m=function(){this.HighlightRules=a,this.$outdent=new l,this.$behaviour=new d,this.$completer=new u,this.foldingRules=new p};o.inherits(m,s),(function(){this.foldingRules="cStyle",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(y,w,x){var C=this.$getIndent(w),S=this.getTokenizer().getLineTokens(w,y).tokens;if(S.length&&S[S.length-1].type=="comment")return C;var M=w.match(/^.*\{\s*$/);return M&&(C+=x),C},this.checkOutdent=function(y,w,x){return this.$outdent.checkOutdent(w,x)},this.autoOutdent=function(y,w,x){this.$outdent.autoOutdent(w,x)},this.getCompletions=function(y,w,x,C){return this.$completer.getCompletions(y,w,x,C)},this.createWorker=function(y){var w=new c(["ace"],"ace/mode/css_worker","Worker");return w.attachToDocument(y.getDocument()),w.on("annotate",function(x){y.setAnnotations(x.data)}),w.on("terminate",function(){y.clearAnnotations()}),w},this.$id="ace/mode/css",this.snippetFileId="ace/snippets/css"}).call(m.prototype),r.Mode=m}),ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(n,r,i){var o=n("../lib/oop"),s=n("./text_highlight_rules").TextHighlightRules,a=function(l){var c="[_:a-zA-ZÀ-￿][-_:.a-zA-Z0-9À-￿]*";this.$rules={start:[{token:"string.cdata.xml",regex:"<\\!\\[CDATA\\[",next:"cdata"},{token:["punctuation.instruction.xml","keyword.instruction.xml"],regex:"(<\\?)("+c+")",next:"processing_instruction"},{token:"comment.start.xml",regex:"<\\!--",next:"comment"},{token:["xml-pe.doctype.xml","xml-pe.doctype.xml"],regex:"(<\\!)(DOCTYPE)(?=[\\s])",next:"doctype",caseInsensitive:!0},{include:"tag"},{token:"text.end-tag-open.xml",regex:"",next:"start"}],doctype:[{include:"whitespace"},{include:"string"},{token:"xml-pe.doctype.xml",regex:">",next:"start"},{token:"xml-pe.xml",regex:"[-_a-zA-Z0-9:]+"},{token:"punctuation.int-subset",regex:"\\[",push:"int_subset"}],int_subset:[{token:"text.xml",regex:"\\s+"},{token:"punctuation.int-subset.xml",regex:"]",next:"pop"},{token:["punctuation.markup-decl.xml","keyword.markup-decl.xml"],regex:"(<\\!)("+c+")",push:[{token:"text",regex:"\\s+"},{token:"punctuation.markup-decl.xml",regex:">",next:"pop"},{include:"string"}]}],cdata:[{token:"string.cdata.xml",regex:"\\]\\]>",next:"start"},{token:"text.xml",regex:"\\s+"},{token:"text.xml",regex:"(?:[^\\]]|\\](?!\\]>))+"}],comment:[{token:"comment.end.xml",regex:"-->",next:"start"},{defaultToken:"comment.xml"}],reference:[{token:"constant.language.escape.reference.xml",regex:"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"}],attr_reference:[{token:"constant.language.escape.reference.attribute-value.xml",regex:"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"}],tag:[{token:["meta.tag.punctuation.tag-open.xml","meta.tag.punctuation.end-tag-open.xml","meta.tag.tag-name.xml"],regex:"(?:(<)|(",next:"start"}]}],tag_whitespace:[{token:"text.tag-whitespace.xml",regex:"\\s+"}],whitespace:[{token:"text.whitespace.xml",regex:"\\s+"}],string:[{token:"string.xml",regex:"'",push:[{token:"string.xml",regex:"'",next:"pop"},{defaultToken:"string.xml"}]},{token:"string.xml",regex:'"',push:[{token:"string.xml",regex:'"',next:"pop"},{defaultToken:"string.xml"}]}],attributes:[{token:"entity.other.attribute-name.xml",regex:c},{token:"keyword.operator.attribute-equals.xml",regex:"="},{include:"tag_whitespace"},{include:"attribute_value"}],attribute_value:[{token:"string.attribute-value.xml",regex:"'",push:[{token:"string.attribute-value.xml",regex:"'",next:"pop"},{include:"attr_reference"},{defaultToken:"string.attribute-value.xml"}]},{token:"string.attribute-value.xml",regex:'"',push:[{token:"string.attribute-value.xml",regex:'"',next:"pop"},{include:"attr_reference"},{defaultToken:"string.attribute-value.xml"}]}]},this.constructor===a&&this.normalizeRules()};(function(){this.embedTagRules=function(l,c,u){this.$rules.tag.unshift({token:["meta.tag.punctuation.tag-open.xml","meta.tag."+u+".tag-name.xml"],regex:"(<)("+u+"(?=\\s|>|$))",next:[{include:"attributes"},{token:"meta.tag.punctuation.tag-close.xml",regex:"/?>",next:c+"start"}]}),this.$rules[u+"-end"]=[{include:"attributes"},{token:"meta.tag.punctuation.tag-close.xml",regex:"/?>",next:"start",onMatch:function(d,p,m){return m.splice(0),this.token}}],this.embedRules(l,c,[{token:["meta.tag.punctuation.end-tag-open.xml","meta.tag."+u+".tag-name.xml"],regex:"(|$))",next:u+"-end"},{token:"string.cdata.xml",regex:"<\\!\\[CDATA\\["},{token:"string.cdata.xml",regex:"\\]\\]>"}])}}).call(s.prototype),o.inherits(a,s),r.XmlHighlightRules=a}),ace.define("ace/mode/html_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/css_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"],function(n,r,i){var o=n("../lib/oop"),s=n("../lib/lang"),a=n("./css_highlight_rules").CssHighlightRules,l=n("./javascript_highlight_rules").JavaScriptHighlightRules,c=n("./xml_highlight_rules").XmlHighlightRules,u=s.createMap({a:"anchor",button:"form",form:"form",img:"image",input:"form",label:"form",option:"form",script:"script",select:"form",textarea:"form",style:"style",table:"table",tbody:"table",td:"table",tfoot:"table",th:"table",tr:"table"}),d=function(){c.call(this),this.addRules({attributes:[{include:"tag_whitespace"},{token:"entity.other.attribute-name.xml",regex:"[-_a-zA-Z0-9:.]+"},{token:"keyword.operator.attribute-equals.xml",regex:"=",push:[{include:"tag_whitespace"},{token:"string.unquoted.attribute-value.html",regex:"[^<>='\"`\\s]+",next:"pop"},{token:"empty",regex:"",next:"pop"}]},{include:"attribute_value"}],tag:[{token:function(p,m){var y=u[m];return["meta.tag.punctuation."+(p=="<"?"":"end-")+"tag-open.xml","meta.tag"+(y?"."+y:"")+".tag-name.xml"]},regex:"(",next:"start"}]}),this.embedTagRules(a,"css-","style"),this.embedTagRules(new l({jsx:!1}).getRules(),"js-","script"),this.constructor===d&&this.normalizeRules()};o.inherits(d,c),r.HtmlHighlightRules=d}),ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"],function(n,r,i){var o=n("../../lib/oop"),s=n("./fold_mode").FoldMode,a=r.FoldMode=function(l,c){this.defaultMode=l,this.subModes=c};o.inherits(a,s),(function(){this.$getMode=function(l){typeof l!="string"&&(l=l[0]);for(var c in this.subModes)if(l.indexOf(c)===0)return this.subModes[c];return null},this.$tryMode=function(l,c,u,d){var p=this.$getMode(l);return p?p.getFoldWidget(c,u,d):""},this.getFoldWidget=function(l,c,u){return this.$tryMode(l.getState(u-1),l,c,u)||this.$tryMode(l.getState(u),l,c,u)||this.defaultMode.getFoldWidget(l,c,u)},this.getFoldWidgetRange=function(l,c,u){var d=this.$getMode(l.getState(u-1));return(!d||!d.getFoldWidget(l,c,u))&&(d=this.$getMode(l.getState(u))),(!d||!d.getFoldWidget(l,c,u))&&(d=this.defaultMode),d.getFoldWidgetRange(l,c,u)}}).call(a.prototype)}),ace.define("ace/mode/folding/html",["require","exports","module","ace/lib/oop","ace/mode/folding/mixed","ace/mode/folding/xml","ace/mode/folding/cstyle"],function(n,r,i){var o=n("../../lib/oop"),s=n("./mixed").FoldMode,a=n("./xml").FoldMode,l=n("./cstyle").FoldMode,c=r.FoldMode=function(u,d){s.call(this,new a(u,d),{"js-":new l,"css-":new l})};o.inherits(c,s)}),ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"],function(n,r,i){var o=n("../token_iterator").TokenIterator,s=["accesskey","class","contenteditable","contextmenu","dir","draggable","dropzone","hidden","id","inert","itemid","itemprop","itemref","itemscope","itemtype","lang","spellcheck","style","tabindex","title","translate"],a=["onabort","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextmenu","oncuechange","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onmousewheel","onpause","onplay","onplaying","onprogress","onratechange","onreset","onscroll","onseeked","onseeking","onselect","onshow","onstalled","onsubmit","onsuspend","ontimeupdate","onvolumechange","onwaiting"],l=s.concat(a),c={a:{href:1,target:{_blank:1,top:1},ping:1,rel:{nofollow:1,alternate:1,author:1,bookmark:1,help:1,license:1,next:1,noreferrer:1,prefetch:1,prev:1,search:1,tag:1},media:1,hreflang:1,type:1},abbr:{},address:{},area:{shape:1,coords:1,href:1,hreflang:1,alt:1,target:1,media:1,rel:1,ping:1,type:1},article:{pubdate:1},aside:{},audio:{src:1,autobuffer:1,autoplay:{autoplay:1},loop:{loop:1},controls:{controls:1},muted:{muted:1},preload:{auto:1,metadata:1,none:1}},b:{},base:{href:1,target:1},bdi:{},bdo:{},blockquote:{cite:1},body:{onafterprint:1,onbeforeprint:1,onbeforeunload:1,onhashchange:1,onmessage:1,onoffline:1,onpopstate:1,onredo:1,onresize:1,onstorage:1,onundo:1,onunload:1},br:{},button:{autofocus:1,disabled:{disabled:1},form:1,formaction:1,formenctype:1,formmethod:1,formnovalidate:1,formtarget:1,name:1,value:1,type:{button:1,submit:1}},canvas:{width:1,height:1},caption:{},cite:{},code:{},col:{span:1},colgroup:{span:1},command:{type:1,label:1,icon:1,disabled:1,checked:1,radiogroup:1,command:1},data:{},datalist:{},dd:{},del:{cite:1,datetime:1},details:{open:1},dfn:{},dialog:{open:1},div:{},dl:{},dt:{},em:{},embed:{src:1,height:1,width:1,type:1},fieldset:{disabled:1,form:1,name:1},figcaption:{},figure:{},footer:{},form:{"accept-charset":1,action:1,autocomplete:1,enctype:{"multipart/form-data":1,"application/x-www-form-urlencoded":1},method:{get:1,post:1},name:1,novalidate:1,target:{_blank:1,top:1}},h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},head:{},header:{},hr:{},html:{manifest:1},i:{},iframe:{name:1,src:1,height:1,width:1,sandbox:{"allow-same-origin":1,"allow-top-navigation":1,"allow-forms":1,"allow-scripts":1},seamless:{seamless:1}},img:{alt:1,src:1,height:1,width:1,usemap:1,ismap:1},input:{type:{text:1,password:1,hidden:1,checkbox:1,submit:1,radio:1,file:1,button:1,reset:1,image:31,color:1,date:1,datetime:1,"datetime-local":1,email:1,month:1,number:1,range:1,search:1,tel:1,time:1,url:1,week:1},accept:1,alt:1,autocomplete:{on:1,off:1},autofocus:{autofocus:1},checked:{checked:1},disabled:{disabled:1},form:1,formaction:1,formenctype:{"application/x-www-form-urlencoded":1,"multipart/form-data":1,"text/plain":1},formmethod:{get:1,post:1},formnovalidate:{formnovalidate:1},formtarget:{_blank:1,_self:1,_parent:1,_top:1},height:1,list:1,max:1,maxlength:1,min:1,multiple:{multiple:1},name:1,pattern:1,placeholder:1,readonly:{readonly:1},required:{required:1},size:1,src:1,step:1,width:1,files:1,value:1},ins:{cite:1,datetime:1},kbd:{},keygen:{autofocus:1,challenge:{challenge:1},disabled:{disabled:1},form:1,keytype:{rsa:1,dsa:1,ec:1},name:1},label:{form:1,for:1},legend:{},li:{value:1},link:{href:1,hreflang:1,rel:{stylesheet:1,icon:1},media:{all:1,screen:1,print:1},type:{"text/css":1,"image/png":1,"image/jpeg":1,"image/gif":1},sizes:1},main:{},map:{name:1},mark:{},math:{},menu:{type:1,label:1},meta:{"http-equiv":{"content-type":1},name:{description:1,keywords:1},content:{"text/html; charset=UTF-8":1},charset:1},meter:{value:1,min:1,max:1,low:1,high:1,optimum:1},nav:{},noscript:{href:1},object:{param:1,data:1,type:1,height:1,width:1,usemap:1,name:1,form:1,classid:1},ol:{start:1,reversed:1},optgroup:{disabled:1,label:1},option:{disabled:1,selected:1,label:1,value:1},output:{for:1,form:1,name:1},p:{},param:{name:1,value:1},pre:{},progress:{value:1,max:1},q:{cite:1},rp:{},rt:{},ruby:{},s:{},samp:{},script:{charset:1,type:{"text/javascript":1},src:1,defer:1,async:1},select:{autofocus:1,disabled:1,form:1,multiple:{multiple:1},name:1,size:1,readonly:{readonly:1}},small:{},source:{src:1,type:1,media:1},span:{},strong:{},style:{type:1,media:{all:1,screen:1,print:1},scoped:1},sub:{},sup:{},svg:{},table:{summary:1},tbody:{},td:{headers:1,rowspan:1,colspan:1},textarea:{autofocus:{autofocus:1},disabled:{disabled:1},form:1,maxlength:1,name:1,placeholder:1,readonly:{readonly:1},required:{required:1},rows:1,cols:1,wrap:{on:1,off:1,hard:1,soft:1}},tfoot:{},th:{headers:1,rowspan:1,colspan:1,scope:1},thead:{},time:{datetime:1},title:{},tr:{},track:{kind:1,src:1,srclang:1,label:1,default:1},section:{},summary:{},u:{},ul:{},var:{},video:{src:1,autobuffer:1,autoplay:{autoplay:1},loop:{loop:1},controls:{controls:1},width:1,height:1,poster:1,muted:{muted:1},preload:{auto:1,metadata:1,none:1}},wbr:{}},u=Object.keys(c);function d(w,x){return w.type.lastIndexOf(x+".xml")>-1}function p(w,x){for(var C=new o(w,x.row,x.column),S=C.getCurrentToken();S&&!d(S,"tag-name");)S=C.stepBackward();if(S)return S.value}function m(w,x){for(var C=new o(w,x.row,x.column),S=C.getCurrentToken();S&&!d(S,"attribute-name");)S=C.stepBackward();if(S)return S.value}var y=function(){};(function(){this.getCompletions=function(w,x,C,S){var M=x.getTokenAt(C.row,C.column);if(!M)return[];if(d(M,"tag-name")||d(M,"tag-open")||d(M,"end-tag-open"))return this.getTagCompletions(w,x,C,S);if(d(M,"tag-whitespace")||d(M,"attribute-name"))return this.getAttributeCompletions(w,x,C,S);if(d(M,"attribute-value"))return this.getAttributeValueCompletions(w,x,C,S);var E=x.getLine(C.row).substr(0,C.column);return/&[a-z]*$/i.test(E)?this.getHTMLEntityCompletions(w,x,C,S):[]},this.getTagCompletions=function(w,x,C,S){return u.map(function(M){return{value:M,meta:"tag",score:1e6}})},this.getAttributeCompletions=function(w,x,C,S){var M=p(x,C);if(!M)return[];var E=l;return M in c&&(E=E.concat(Object.keys(c[M]))),E.map(function(A){return{caption:A,snippet:A+'="$0"',meta:"attribute",score:1e6}})},this.getAttributeValueCompletions=function(w,x,C,S){var M=p(x,C),E=m(x,C);if(!M)return[];var A=[];return M in c&&E in c[M]&&typeof c[M][E]=="object"&&(A=Object.keys(c[M][E])),A.map(function(I){return{caption:I,snippet:I,meta:"attribute value",score:1e6}})},this.getHTMLEntityCompletions=function(w,x,C,S){var M=["Aacute;","aacute;","Acirc;","acirc;","acute;","AElig;","aelig;","Agrave;","agrave;","alefsym;","Alpha;","alpha;","amp;","and;","ang;","Aring;","aring;","asymp;","Atilde;","atilde;","Auml;","auml;","bdquo;","Beta;","beta;","brvbar;","bull;","cap;","Ccedil;","ccedil;","cedil;","cent;","Chi;","chi;","circ;","clubs;","cong;","copy;","crarr;","cup;","curren;","Dagger;","dagger;","dArr;","darr;","deg;","Delta;","delta;","diams;","divide;","Eacute;","eacute;","Ecirc;","ecirc;","Egrave;","egrave;","empty;","emsp;","ensp;","Epsilon;","epsilon;","equiv;","Eta;","eta;","ETH;","eth;","Euml;","euml;","euro;","exist;","fnof;","forall;","frac12;","frac14;","frac34;","frasl;","Gamma;","gamma;","ge;","gt;","hArr;","harr;","hearts;","hellip;","Iacute;","iacute;","Icirc;","icirc;","iexcl;","Igrave;","igrave;","image;","infin;","int;","Iota;","iota;","iquest;","isin;","Iuml;","iuml;","Kappa;","kappa;","Lambda;","lambda;","lang;","laquo;","lArr;","larr;","lceil;","ldquo;","le;","lfloor;","lowast;","loz;","lrm;","lsaquo;","lsquo;","lt;","macr;","mdash;","micro;","middot;","minus;","Mu;","mu;","nabla;","nbsp;","ndash;","ne;","ni;","not;","notin;","nsub;","Ntilde;","ntilde;","Nu;","nu;","Oacute;","oacute;","Ocirc;","ocirc;","OElig;","oelig;","Ograve;","ograve;","oline;","Omega;","omega;","Omicron;","omicron;","oplus;","or;","ordf;","ordm;","Oslash;","oslash;","Otilde;","otilde;","otimes;","Ouml;","ouml;","para;","part;","permil;","perp;","Phi;","phi;","Pi;","pi;","piv;","plusmn;","pound;","Prime;","prime;","prod;","prop;","Psi;","psi;","quot;","radic;","rang;","raquo;","rArr;","rarr;","rceil;","rdquo;","real;","reg;","rfloor;","Rho;","rho;","rlm;","rsaquo;","rsquo;","sbquo;","Scaron;","scaron;","sdot;","sect;","shy;","Sigma;","sigma;","sigmaf;","sim;","spades;","sub;","sube;","sum;","sup;","sup1;","sup2;","sup3;","supe;","szlig;","Tau;","tau;","there4;","Theta;","theta;","thetasym;","thinsp;","THORN;","thorn;","tilde;","times;","trade;","Uacute;","uacute;","uArr;","uarr;","Ucirc;","ucirc;","Ugrave;","ugrave;","uml;","upsih;","Upsilon;","upsilon;","Uuml;","uuml;","weierp;","Xi;","xi;","Yacute;","yacute;","yen;","Yuml;","yuml;","Zeta;","zeta;","zwj;","zwnj;"];return M.map(function(E){return{caption:E,snippet:E,meta:"html entity",score:1e6}})}}).call(y.prototype),r.HtmlCompletions=y}),ace.define("ace/mode/html",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/javascript","ace/mode/css","ace/mode/html_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/html","ace/mode/html_completions","ace/worker/worker_client"],function(n,r,i){var o=n("../lib/oop"),s=n("../lib/lang"),a=n("./text").Mode,l=n("./javascript").Mode,c=n("./css").Mode,u=n("./html_highlight_rules").HtmlHighlightRules,d=n("./behaviour/xml").XmlBehaviour,p=n("./folding/html").FoldMode,m=n("./html_completions").HtmlCompletions,y=n("../worker/worker_client").WorkerClient,w=["area","base","br","col","embed","hr","img","input","keygen","link","meta","menuitem","param","source","track","wbr"],x=["li","dt","dd","p","rt","rp","optgroup","option","colgroup","td","th"],C=function(S){this.fragmentContext=S&&S.fragmentContext,this.HighlightRules=u,this.$behaviour=new d,this.$completer=new m,this.createModeDelegates({"js-":l,"css-":c}),this.foldingRules=new p(this.voidElements,s.arrayToMap(x))};o.inherits(C,a),(function(){this.blockComment={start:""},this.voidElements=s.arrayToMap(w),this.getNextLineIndent=function(S,M,E){return this.$getIndent(M)},this.checkOutdent=function(S,M,E){return!1},this.getCompletions=function(S,M,E,A){return this.$completer.getCompletions(S,M,E,A)},this.createWorker=function(S){if(this.constructor==C){var M=new y(["ace"],"ace/mode/html_worker","Worker");return M.attachToDocument(S.getDocument()),this.fragmentContext&&M.call("setOptions",[{context:this.fragmentContext}]),M.on("error",function(E){S.setAnnotations(E.data)}),M.on("terminate",function(){S.clearAnnotations()}),M}},this.$id="ace/mode/html",this.snippetFileId="ace/snippets/html"}).call(C.prototype),r.Mode=C}),function(){ace.require(["ace/mode/html"],function(n){t&&(t.exports=n)})}()})(LZ);var PZ=LZ.exports;const C8e=Vd({__proto__:null,default:gl(PZ)},[PZ]);/*! * PhotoSwipe 5.4.4 - https://photoswipe.com * (c) 2024 Dmytro Semenov */function Uc(t,e,n){const r=document.createElement(e);return t&&(r.className=t),n&&n.appendChild(r),r}function Ss(t,e){return t.x=e.x,t.y=e.y,e.id!==void 0&&(t.id=e.id),t}function NZ(t){t.x=Math.round(t.x),t.y=Math.round(t.y)}function AR(t,e){const n=Math.abs(t.x-e.x),r=Math.abs(t.y-e.y);return Math.sqrt(n*n+r*r)}function ex(t,e){return t.x===e.x&&t.y===e.y}function tx(t,e,n){return Math.min(Math.max(t,e),n)}function nx(t,e,n){let r=`translate3d(${t}px,${e||0}px,0)`;return n!==void 0&&(r+=` scale3d(${n},${n},1)`),r}function vy(t,e,n,r){t.style.transform=nx(e,n,r)}const k8e="cubic-bezier(.4,0,.22,1)";function OZ(t,e,n,r){t.style.transition=e?`${e} ${n}ms ${r||k8e}`:"none"}function IR(t,e,n){t.style.width=typeof e=="number"?`${e}px`:e,t.style.height=typeof n=="number"?`${n}px`:n}function T8e(t){OZ(t)}function M8e(t){return"decode"in t?t.decode().catch(()=>{}):t.complete?Promise.resolve(t):new Promise((e,n)=>{t.onload=()=>e(t),t.onerror=n})}const $u={IDLE:"idle",LOADING:"loading",LOADED:"loaded",ERROR:"error"};function A8e(t){return"button"in t&&t.button===1||t.ctrlKey||t.metaKey||t.altKey||t.shiftKey}function I8e(t,e,n=document){let r=[];if(t instanceof Element)r=[t];else if(t instanceof NodeList||Array.isArray(t))r=Array.from(t);else{const i=typeof t=="string"?t:e;i&&(r=Array.from(n.querySelectorAll(i)))}return r}function DZ(){return!!(navigator.vendor&&navigator.vendor.match(/apple/i))}let RZ=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:()=>{RZ=!0}}))}catch{}class L8e{constructor(){this._pool=[]}add(e,n,r,i){this._toggleListener(e,n,r,i)}remove(e,n,r,i){this._toggleListener(e,n,r,i,!0)}removeAll(){this._pool.forEach(e=>{this._toggleListener(e.target,e.type,e.listener,e.passive,!0,!0)}),this._pool=[]}_toggleListener(e,n,r,i,o,s){if(!e)return;const a=o?"removeEventListener":"addEventListener";n.split(" ").forEach(c=>{if(c){s||(o?this._pool=this._pool.filter(d=>d.type!==c||d.listener!==r||d.target!==e):this._pool.push({target:e,type:c,listener:r,passive:i}));const u=RZ?{passive:i||!1}:!1;e[a](c,r,u)}})}}function BZ(t,e){if(t.getViewportSizeFn){const n=t.getViewportSizeFn(t,e);if(n)return n}return{x:document.documentElement.clientWidth,y:window.innerHeight}}function rx(t,e,n,r,i){let o=0;if(e.paddingFn)o=e.paddingFn(n,r,i)[t];else if(e.padding)o=e.padding[t];else{const s="padding"+t[0].toUpperCase()+t.slice(1);e[s]&&(o=e[s])}return Number(o)||0}function FZ(t,e,n,r){return{x:e.x-rx("left",t,e,n,r)-rx("right",t,e,n,r),y:e.y-rx("top",t,e,n,r)-rx("bottom",t,e,n,r)}}class P8e{constructor(e){this.slide=e,this.currZoomLevel=1,this.center={x:0,y:0},this.max={x:0,y:0},this.min={x:0,y:0}}update(e){this.currZoomLevel=e,this.slide.width?(this._updateAxis("x"),this._updateAxis("y"),this.slide.pswp.dispatch("calcBounds",{slide:this.slide})):this.reset()}_updateAxis(e){const{pswp:n}=this.slide,r=this.slide[e==="x"?"width":"height"]*this.currZoomLevel,o=rx(e==="x"?"left":"top",n.options,n.viewportSize,this.slide.data,this.slide.index),s=this.slide.panAreaSize[e];this.center[e]=Math.round((s-r)/2)+o,this.max[e]=r>s?Math.round(s-r)+o:this.center[e],this.min[e]=r>s?o:this.center[e]}reset(){this.center.x=0,this.center.y=0,this.max.x=0,this.max.y=0,this.min.x=0,this.min.y=0}correctPan(e,n){return tx(n,this.max[e],this.min[e])}}const $Z=4e3;class zZ{constructor(e,n,r,i){this.pswp=i,this.options=e,this.itemData=n,this.index=r,this.panAreaSize=null,this.elementSize=null,this.fit=1,this.fill=1,this.vFill=1,this.initial=1,this.secondary=1,this.max=1,this.min=1}update(e,n,r){const i={x:e,y:n};this.elementSize=i,this.panAreaSize=r;const o=r.x/i.x,s=r.y/i.y;this.fit=Math.min(1,os?o:s),this.vFill=Math.min(1,s),this.initial=this._getInitial(),this.secondary=this._getSecondary(),this.max=Math.max(this.initial,this.secondary,this._getMax()),this.min=Math.min(this.fit,this.initial,this.secondary),this.pswp&&this.pswp.dispatch("zoomLevelsUpdate",{zoomLevels:this,slideData:this.itemData})}_parseZoomLevelOption(e){const n=e+"ZoomLevel",r=this.options[n];if(r)return typeof r=="function"?r(this):r==="fill"?this.fill:r==="fit"?this.fit:Number(r)}_getSecondary(){let e=this._parseZoomLevelOption("secondary");return e||(e=Math.min(1,this.fit*3),this.elementSize&&e*this.elementSize.x>$Z&&(e=$Z/this.elementSize.x),e)}_getInitial(){return this._parseZoomLevelOption("initial")||this.fit}_getMax(){return this._parseZoomLevelOption("max")||Math.max(1,this.fit*4)}}class N8e{constructor(e,n,r){this.data=e,this.index=n,this.pswp=r,this.isActive=n===r.currIndex,this.currentResolution=0,this.panAreaSize={x:0,y:0},this.pan={x:0,y:0},this.isFirstSlide=this.isActive&&!r.opener.isOpen,this.zoomLevels=new zZ(r.options,e,n,r),this.pswp.dispatch("gettingData",{slide:this,data:this.data,index:n}),this.content=this.pswp.contentLoader.getContentBySlide(this),this.container=Uc("pswp__zoom-wrap","div"),this.holderElement=null,this.currZoomLevel=1,this.width=this.content.width,this.height=this.content.height,this.heavyAppended=!1,this.bounds=new P8e(this),this.prevDisplayedWidth=-1,this.prevDisplayedHeight=-1,this.pswp.dispatch("slideInit",{slide:this})}setIsActive(e){e&&!this.isActive?this.activate():!e&&this.isActive&&this.deactivate()}append(e){this.holderElement=e,this.container.style.transformOrigin="0 0",this.data&&(this.calculateSize(),this.load(),this.updateContentSize(),this.appendHeavy(),this.holderElement.appendChild(this.container),this.zoomAndPanToInitial(),this.pswp.dispatch("firstZoomPan",{slide:this}),this.applyCurrentZoomPan(),this.pswp.dispatch("afterSetContent",{slide:this}),this.isActive&&this.activate())}load(){this.content.load(!1),this.pswp.dispatch("slideLoad",{slide:this})}appendHeavy(){const{pswp:e}=this;this.heavyAppended||!e.opener.isOpen||e.mainScroll.isShifted()||!this.isActive&&!1||this.pswp.dispatch("appendHeavy",{slide:this}).defaultPrevented||(this.heavyAppended=!0,this.content.append(),this.pswp.dispatch("appendHeavyContent",{slide:this}))}activate(){this.isActive=!0,this.appendHeavy(),this.content.activate(),this.pswp.dispatch("slideActivate",{slide:this})}deactivate(){this.isActive=!1,this.content.deactivate(),this.currZoomLevel!==this.zoomLevels.initial&&this.calculateSize(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize(),this.pswp.dispatch("slideDeactivate",{slide:this})}destroy(){this.content.hasSlide=!1,this.content.remove(),this.container.remove(),this.pswp.dispatch("slideDestroy",{slide:this})}resize(){this.currZoomLevel===this.zoomLevels.initial||!this.isActive?(this.calculateSize(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize()):(this.calculateSize(),this.bounds.update(this.currZoomLevel),this.panTo(this.pan.x,this.pan.y))}updateContentSize(e){const n=this.currentResolution||this.zoomLevels.initial;if(!n)return;const r=Math.round(this.width*n)||this.pswp.viewportSize.x,i=Math.round(this.height*n)||this.pswp.viewportSize.y;!this.sizeChanged(r,i)&&!e||this.content.setDisplayedSize(r,i)}sizeChanged(e,n){return e!==this.prevDisplayedWidth||n!==this.prevDisplayedHeight?(this.prevDisplayedWidth=e,this.prevDisplayedHeight=n,!0):!1}getPlaceholderElement(){var e;return(e=this.content.placeholder)===null||e===void 0?void 0:e.element}zoomTo(e,n,r,i){const{pswp:o}=this;if(!this.isZoomable()||o.mainScroll.isShifted())return;o.dispatch("beforeZoomTo",{destZoomLevel:e,centerPoint:n,transitionDuration:r}),o.animations.stopAllPan();const s=this.currZoomLevel;i||(e=tx(e,this.zoomLevels.min,this.zoomLevels.max)),this.setZoomLevel(e),this.pan.x=this.calculateZoomToPanOffset("x",n,s),this.pan.y=this.calculateZoomToPanOffset("y",n,s),NZ(this.pan);const a=()=>{this._setResolution(e),this.applyCurrentZoomPan()};r?o.animations.startTransition({isPan:!0,name:"zoomTo",target:this.container,transform:this.getCurrentTransform(),onComplete:a,duration:r,easing:o.options.easing}):a()}toggleZoom(e){this.zoomTo(this.currZoomLevel===this.zoomLevels.initial?this.zoomLevels.secondary:this.zoomLevels.initial,e,this.pswp.options.zoomAnimationDuration)}setZoomLevel(e){this.currZoomLevel=e,this.bounds.update(this.currZoomLevel)}calculateZoomToPanOffset(e,n,r){if(this.bounds.max[e]-this.bounds.min[e]===0)return this.bounds.center[e];n||(n=this.pswp.getViewportCenterPoint()),r||(r=this.zoomLevels.initial);const o=this.currZoomLevel/r;return this.bounds.correctPan(e,(this.pan[e]-n[e])*o+n[e])}panTo(e,n){this.pan.x=this.bounds.correctPan("x",e),this.pan.y=this.bounds.correctPan("y",n),this.applyCurrentZoomPan()}isPannable(){return!!this.width&&this.currZoomLevel>this.zoomLevels.fit}isZoomable(){return!!this.width&&this.content.isZoomable()}applyCurrentZoomPan(){this._applyZoomTransform(this.pan.x,this.pan.y,this.currZoomLevel),this===this.pswp.currSlide&&this.pswp.dispatch("zoomPanUpdate",{slide:this})}zoomAndPanToInitial(){this.currZoomLevel=this.zoomLevels.initial,this.bounds.update(this.currZoomLevel),Ss(this.pan,this.bounds.center),this.pswp.dispatch("initialZoomPan",{slide:this})}_applyZoomTransform(e,n,r){r/=this.currentResolution||this.zoomLevels.initial,vy(this.container,e,n,r)}calculateSize(){const{pswp:e}=this;Ss(this.panAreaSize,FZ(e.options,e.viewportSize,this.data,this.index)),this.zoomLevels.update(this.width,this.height,this.panAreaSize),e.dispatch("calcSlideSize",{slide:this})}getCurrentTransform(){const e=this.currZoomLevel/(this.currentResolution||this.zoomLevels.initial);return nx(this.pan.x,this.pan.y,e)}_setResolution(e){e!==this.currentResolution&&(this.currentResolution=e,this.updateContentSize(),this.pswp.dispatch("resolutionChanged"))}}const O8e=.35,D8e=.6,VZ=.4,jZ=.5;function R8e(t,e){return t*e/(1-e)}class B8e{constructor(e){this.gestures=e,this.pswp=e.pswp,this.startPan={x:0,y:0}}start(){this.pswp.currSlide&&Ss(this.startPan,this.pswp.currSlide.pan),this.pswp.animations.stopAll()}change(){const{p1:e,prevP1:n,dragAxis:r}=this.gestures,{currSlide:i}=this.pswp;if(r==="y"&&this.pswp.options.closeOnVerticalDrag&&i&&i.currZoomLevel<=i.zoomLevels.fit&&!this.gestures.isMultitouch){const o=i.pan.y+(e.y-n.y);if(!this.pswp.dispatch("verticalDrag",{panY:o}).defaultPrevented){this._setPanWithFriction("y",o,D8e);const s=1-Math.abs(this._getVerticalDragRatio(i.pan.y));this.pswp.applyBgOpacity(s),i.applyCurrentZoomPan()}}else this._panOrMoveMainScroll("x")||(this._panOrMoveMainScroll("y"),i&&(NZ(i.pan),i.applyCurrentZoomPan()))}end(){const{velocity:e}=this.gestures,{mainScroll:n,currSlide:r}=this.pswp;let i=0;if(this.pswp.animations.stopAll(),n.isShifted()){const s=(n.x-n.getCurrSlideX())/this.pswp.viewportSize.x;e.x<-jZ&&s<0||e.x<.1&&s<-.5?(i=1,e.x=Math.min(e.x,0)):(e.x>jZ&&s>0||e.x>-.1&&s>.5)&&(i=-1,e.x=Math.max(e.x,0)),n.moveIndexBy(i,!0,e.x)}r&&r.currZoomLevel>r.zoomLevels.max||this.gestures.isMultitouch?this.gestures.zoomLevels.correctZoomPan(!0):(this._finishPanGestureForAxis("x"),this._finishPanGestureForAxis("y"))}_finishPanGestureForAxis(e){const{velocity:n}=this.gestures,{currSlide:r}=this.pswp;if(!r)return;const{pan:i,bounds:o}=r,s=i[e],a=this.pswp.bgOpacity<1&&e==="y",c=s+R8e(n[e],.995);if(a){const y=this._getVerticalDragRatio(s),w=this._getVerticalDragRatio(c);if(y<0&&w<-VZ||y>0&&w>VZ){this.pswp.close();return}}const u=o.correctPan(e,c);if(s===u)return;const d=u===c?1:.82,p=this.pswp.bgOpacity,m=u-s;this.pswp.animations.startSpring({name:"panGesture"+e,isPan:!0,start:s,end:u,velocity:n[e],dampingRatio:d,onUpdate:y=>{if(a&&this.pswp.bgOpacity<1){const w=1-(u-y)/m;this.pswp.applyBgOpacity(tx(p+(1-p)*w,0,1))}i[e]=Math.floor(y),r.applyCurrentZoomPan()}})}_panOrMoveMainScroll(e){const{p1:n,dragAxis:r,prevP1:i,isMultitouch:o}=this.gestures,{currSlide:s,mainScroll:a}=this.pswp,l=n[e]-i[e],c=a.x+l;if(!l||!s)return!1;if(e==="x"&&!s.isPannable()&&!o)return a.moveTo(c,!0),!0;const{bounds:u}=s,d=s.pan[e]+l;if(this.pswp.options.allowPanToNext&&r==="x"&&e==="x"&&!o){const p=a.getCurrSlideX(),m=a.x-p,y=l>0,w=!y;if(d>u.min[e]&&y){if(u.min[e]<=this.startPan[e])return a.moveTo(c,!0),!0;this._setPanWithFriction(e,d)}else if(d0)return a.moveTo(Math.max(c,p),!0),!0;if(m<0)return a.moveTo(Math.min(c,p),!0),!0}else this._setPanWithFriction(e,d)}else e==="y"?!a.isShifted()&&u.min.y!==u.max.y&&this._setPanWithFriction(e,d):this._setPanWithFriction(e,d);return!1}_getVerticalDragRatio(e){var n,r;return(e-((n=(r=this.pswp.currSlide)===null||r===void 0?void 0:r.bounds.center.y)!==null&&n!==void 0?n:0))/(this.pswp.viewportSize.y/3)}_setPanWithFriction(e,n,r){const{currSlide:i}=this.pswp;if(!i)return;const{pan:o,bounds:s}=i;if(s.correctPan(e,n)!==n||r){const l=Math.round(n-o[e]);o[e]+=l*(r||O8e)}else o[e]=n}}const F8e=.05,$8e=.15;function UZ(t,e,n){return t.x=(e.x+n.x)/2,t.y=(e.y+n.y)/2,t}class z8e{constructor(e){this.gestures=e,this._startPan={x:0,y:0},this._startZoomPoint={x:0,y:0},this._zoomPoint={x:0,y:0},this._wasOverFitZoomLevel=!1,this._startZoomLevel=1}start(){const{currSlide:e}=this.gestures.pswp;e&&(this._startZoomLevel=e.currZoomLevel,Ss(this._startPan,e.pan)),this.gestures.pswp.animations.stopAllPan(),this._wasOverFitZoomLevel=!1}change(){const{p1:e,startP1:n,p2:r,startP2:i,pswp:o}=this.gestures,{currSlide:s}=o;if(!s)return;const a=s.zoomLevels.min,l=s.zoomLevels.max;if(!s.isZoomable()||o.mainScroll.isShifted())return;UZ(this._startZoomPoint,n,i),UZ(this._zoomPoint,e,r);let c=1/AR(n,i)*AR(e,r)*this._startZoomLevel;if(c>s.zoomLevels.initial+s.zoomLevels.initial/15&&(this._wasOverFitZoomLevel=!0),cl&&(c=l+(c-l)*F8e);s.pan.x=this._calculatePanForZoomLevel("x",c),s.pan.y=this._calculatePanForZoomLevel("y",c),s.setZoomLevel(c),s.applyCurrentZoomPan()}end(){const{pswp:e}=this.gestures,{currSlide:n}=e;(!n||n.currZoomLevelr.zoomLevels.max?o=r.zoomLevels.max:(s=!1,o=i);const a=n.bgOpacity,l=n.bgOpacity<1,c=Ss({x:0,y:0},r.pan);let u=Ss({x:0,y:0},c);e&&(this._zoomPoint.x=0,this._zoomPoint.y=0,this._startZoomPoint.x=0,this._startZoomPoint.y=0,this._startZoomLevel=i,Ss(this._startPan,c)),s&&(u={x:this._calculatePanForZoomLevel("x",o),y:this._calculatePanForZoomLevel("y",o)}),r.setZoomLevel(o),u={x:r.bounds.correctPan("x",u.x),y:r.bounds.correctPan("y",u.y)},r.setZoomLevel(i);const d=!ex(u,c);if(!d&&!s&&!l){r._setResolution(o),r.applyCurrentZoomPan();return}n.animations.stopAllPan(),n.animations.startSpring({isPan:!0,start:0,end:1e3,velocity:0,dampingRatio:1,naturalFrequency:40,onUpdate:p=>{if(p/=1e3,d||s){if(d&&(r.pan.x=c.x+(u.x-c.x)*p,r.pan.y=c.y+(u.y-c.y)*p),s){const m=i+(o-i)*p;r.setZoomLevel(m)}r.applyCurrentZoomPan()}l&&n.bgOpacity<1&&n.applyBgOpacity(tx(a+(1-a)*p,0,1))},onComplete:()=>{r._setResolution(o),r.applyCurrentZoomPan()}})}}function HZ(t){return!!t.target.closest(".pswp__container")}class V8e{constructor(e){this.gestures=e}click(e,n){const r=n.target.classList,i=r.contains("pswp__img"),o=r.contains("pswp__item")||r.contains("pswp__zoom-wrap");i?this._doClickOrTapAction("imageClick",e,n):o&&this._doClickOrTapAction("bgClick",e,n)}tap(e,n){HZ(n)&&this._doClickOrTapAction("tap",e,n)}doubleTap(e,n){HZ(n)&&this._doClickOrTapAction("doubleTap",e,n)}_doClickOrTapAction(e,n,r){var i;const{pswp:o}=this.gestures,{currSlide:s}=o,a=e+"Action",l=o.options[a];if(!o.dispatch(a,{point:n,originalEvent:r}).defaultPrevented){if(typeof l=="function"){l.call(o,n,r);return}switch(l){case"close":case"next":o[l]();break;case"zoom":s==null||s.toggleZoom(n);break;case"zoom-or-close":s!=null&&s.isZoomable()&&s.zoomLevels.secondary!==s.zoomLevels.initial?s.toggleZoom(n):o.options.clickToCloseNonZoomable&&o.close();break;case"toggle-controls":(i=this.gestures.pswp.element)===null||i===void 0||i.classList.toggle("pswp--ui-visible");break}}}}const j8e=10,U8e=300,H8e=25;class W8e{constructor(e){this.pswp=e,this.dragAxis=null,this.p1={x:0,y:0},this.p2={x:0,y:0},this.prevP1={x:0,y:0},this.prevP2={x:0,y:0},this.startP1={x:0,y:0},this.startP2={x:0,y:0},this.velocity={x:0,y:0},this._lastStartP1={x:0,y:0},this._intervalP1={x:0,y:0},this._numActivePoints=0,this._ongoingPointers=[],this._touchEventEnabled="ontouchstart"in window,this._pointerEventEnabled=!!window.PointerEvent,this.supportsTouch=this._touchEventEnabled||this._pointerEventEnabled&&navigator.maxTouchPoints>1,this._numActivePoints=0,this._intervalTime=0,this._velocityCalculated=!1,this.isMultitouch=!1,this.isDragging=!1,this.isZooming=!1,this.raf=null,this._tapTimer=null,this.supportsTouch||(e.options.allowPanToNext=!1),this.drag=new B8e(this),this.zoomLevels=new z8e(this),this.tapHandler=new V8e(this),e.on("bindEvents",()=>{e.events.add(e.scrollWrap,"click",this._onClick.bind(this)),this._pointerEventEnabled?this._bindEvents("pointer","down","up","cancel"):this._touchEventEnabled?(this._bindEvents("touch","start","end","cancel"),e.scrollWrap&&(e.scrollWrap.ontouchmove=()=>{},e.scrollWrap.ontouchend=()=>{})):this._bindEvents("mouse","down","up")})}_bindEvents(e,n,r,i){const{pswp:o}=this,{events:s}=o,a=i?e+i:"";s.add(o.scrollWrap,e+n,this.onPointerDown.bind(this)),s.add(window,e+"move",this.onPointerMove.bind(this)),s.add(window,e+r,this.onPointerUp.bind(this)),a&&s.add(o.scrollWrap,a,this.onPointerUp.bind(this))}onPointerDown(e){const n=e.type==="mousedown"||e.pointerType==="mouse";if(n&&e.button>0)return;const{pswp:r}=this;if(!r.opener.isOpen){e.preventDefault();return}r.dispatch("pointerDown",{originalEvent:e}).defaultPrevented||(n&&(r.mouseDetected(),this._preventPointerEventBehaviour(e,"down")),r.animations.stopAll(),this._updatePoints(e,"down"),this._numActivePoints===1&&(this.dragAxis=null,Ss(this.startP1,this.p1)),this._numActivePoints>1?(this._clearTapTimer(),this.isMultitouch=!0):this.isMultitouch=!1)}onPointerMove(e){this._preventPointerEventBehaviour(e,"move"),this._numActivePoints&&(this._updatePoints(e,"move"),!this.pswp.dispatch("pointerMove",{originalEvent:e}).defaultPrevented&&(this._numActivePoints===1&&!this.isDragging?(this.dragAxis||this._calculateDragDirection(),this.dragAxis&&!this.isDragging&&(this.isZooming&&(this.isZooming=!1,this.zoomLevels.end()),this.isDragging=!0,this._clearTapTimer(),this._updateStartPoints(),this._intervalTime=Date.now(),this._velocityCalculated=!1,Ss(this._intervalP1,this.p1),this.velocity.x=0,this.velocity.y=0,this.drag.start(),this._rafStopLoop(),this._rafRenderLoop())):this._numActivePoints>1&&!this.isZooming&&(this._finishDrag(),this.isZooming=!0,this._updateStartPoints(),this.zoomLevels.start(),this._rafStopLoop(),this._rafRenderLoop())))}_finishDrag(){this.isDragging&&(this.isDragging=!1,this._velocityCalculated||this._updateVelocity(!0),this.drag.end(),this.dragAxis=null)}onPointerUp(e){this._numActivePoints&&(this._updatePoints(e,"up"),!this.pswp.dispatch("pointerUp",{originalEvent:e}).defaultPrevented&&(this._numActivePoints===0&&(this._rafStopLoop(),this.isDragging?this._finishDrag():!this.isZooming&&!this.isMultitouch&&this._finishTap(e)),this._numActivePoints<2&&this.isZooming&&(this.isZooming=!1,this.zoomLevels.end(),this._numActivePoints===1&&(this.dragAxis=null,this._updateStartPoints()))))}_rafRenderLoop(){(this.isDragging||this.isZooming)&&(this._updateVelocity(),this.isDragging?ex(this.p1,this.prevP1)||this.drag.change():(!ex(this.p1,this.prevP1)||!ex(this.p2,this.prevP2))&&this.zoomLevels.change(),this._updatePrevPoints(),this.raf=requestAnimationFrame(this._rafRenderLoop.bind(this)))}_updateVelocity(e){const n=Date.now(),r=n-this._intervalTime;r<50&&!e||(this.velocity.x=this._getVelocity("x",r),this.velocity.y=this._getVelocity("y",r),this._intervalTime=n,Ss(this._intervalP1,this.p1),this._velocityCalculated=!0)}_finishTap(e){const{mainScroll:n}=this.pswp;if(n.isShifted()){n.moveIndexBy(0,!0);return}if(e.type.indexOf("cancel")>0)return;if(e.type==="mouseup"||e.pointerType==="mouse"){this.tapHandler.click(this.startP1,e);return}const r=this.pswp.options.doubleTapAction?U8e:0;this._tapTimer?(this._clearTapTimer(),AR(this._lastStartP1,this.startP1){this.tapHandler.tap(this.startP1,e),this._clearTapTimer()},r))}_clearTapTimer(){this._tapTimer&&(clearTimeout(this._tapTimer),this._tapTimer=null)}_getVelocity(e,n){const r=this.p1[e]-this._intervalP1[e];return Math.abs(r)>1&&n>5?r/n:0}_rafStopLoop(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=null)}_preventPointerEventBehaviour(e,n){this.pswp.applyFilters("preventPointerEvent",!0,e,n)&&e.preventDefault()}_updatePoints(e,n){if(this._pointerEventEnabled){const r=e,i=this._ongoingPointers.findIndex(o=>o.id===r.pointerId);n==="up"&&i>-1?this._ongoingPointers.splice(i,1):n==="down"&&i===-1?this._ongoingPointers.push(this._convertEventPosToPoint(r,{x:0,y:0})):i>-1&&this._convertEventPosToPoint(r,this._ongoingPointers[i]),this._numActivePoints=this._ongoingPointers.length,this._numActivePoints>0&&Ss(this.p1,this._ongoingPointers[0]),this._numActivePoints>1&&Ss(this.p2,this._ongoingPointers[1])}else{const r=e;this._numActivePoints=0,r.type.indexOf("touch")>-1?r.touches&&r.touches.length>0&&(this._convertEventPosToPoint(r.touches[0],this.p1),this._numActivePoints++,r.touches.length>1&&(this._convertEventPosToPoint(r.touches[1],this.p2),this._numActivePoints++)):(this._convertEventPosToPoint(e,this.p1),n==="up"?this._numActivePoints=0:this._numActivePoints++)}}_updatePrevPoints(){Ss(this.prevP1,this.p1),Ss(this.prevP2,this.p2)}_updateStartPoints(){Ss(this.startP1,this.p1),Ss(this.startP2,this.p2),this._updatePrevPoints()}_calculateDragDirection(){if(this.pswp.mainScroll.isShifted())this.dragAxis="x";else{const e=Math.abs(this.p1.x-this.startP1.x)-Math.abs(this.p1.y-this.startP1.y);if(e!==0){const n=e>0?"x":"y";Math.abs(this.p1[n]-this.startP1[n])>=j8e&&(this.dragAxis=n)}}}_convertEventPosToPoint(e,n){return n.x=e.pageX-this.pswp.offset.x,n.y=e.pageY-this.pswp.offset.y,"pointerId"in e?n.id=e.pointerId:e.identifier!==void 0&&(n.id=e.identifier),n}_onClick(e){this.pswp.mainScroll.isShifted()&&(e.preventDefault(),e.stopPropagation())}}const G8e=.35;class q8e{constructor(e){this.pswp=e,this.x=0,this.slideWidth=0,this._currPositionIndex=0,this._prevPositionIndex=0,this._containerShiftIndex=-1,this.itemHolders=[]}resize(e){const{pswp:n}=this,r=Math.round(n.viewportSize.x+n.viewportSize.x*n.options.spacing),i=r!==this.slideWidth;i&&(this.slideWidth=r,this.moveTo(this.getCurrSlideX())),this.itemHolders.forEach((o,s)=>{i&&vy(o.el,(s+this._containerShiftIndex)*this.slideWidth),e&&o.slide&&o.slide.resize()})}resetPosition(){this._currPositionIndex=0,this._prevPositionIndex=0,this.slideWidth=0,this._containerShiftIndex=-1}appendHolders(){this.itemHolders=[];for(let e=0;e<3;e++){const n=Uc("pswp__item","div",this.pswp.container);n.setAttribute("role","group"),n.setAttribute("aria-roledescription","slide"),n.setAttribute("aria-hidden","true"),n.style.display=e===1?"block":"none",this.itemHolders.push({el:n})}}canBeSwiped(){return this.pswp.getNumItems()>1}moveIndexBy(e,n,r){const{pswp:i}=this;let o=i.potentialIndex+e;const s=i.getNumItems();if(i.canLoop()){o=i.getLoopedIndex(o);const l=(e+s)%s;l<=s/2?e=l:e=l-s}else o<0?o=0:o>=s&&(o=s-1),e=o-i.potentialIndex;i.potentialIndex=o,this._currPositionIndex-=e,i.animations.stopMainScroll();const a=this.getCurrSlideX();if(!n)this.moveTo(a),this.updateCurrItem();else{i.animations.startSpring({isMainScroll:!0,start:this.x,end:a,velocity:r||0,naturalFrequency:30,dampingRatio:1,onUpdate:c=>{this.moveTo(c)},onComplete:()=>{this.updateCurrItem(),i.appendHeavy()}});let l=i.potentialIndex-i.currIndex;if(i.canLoop()){const c=(l+s)%s;c<=s/2?l=c:l=c-s}Math.abs(l)>1&&this.updateCurrItem()}return!!e}getCurrSlideX(){return this.slideWidth*this._currPositionIndex}isShifted(){return this.x!==this.getCurrSlideX()}updateCurrItem(){var e;const{pswp:n}=this,r=this._prevPositionIndex-this._currPositionIndex;if(!r)return;this._prevPositionIndex=this._currPositionIndex,n.currIndex=n.potentialIndex;let i=Math.abs(r),o;i>=3&&(this._containerShiftIndex+=r+(r>0?-3:3),i=3,this.itemHolders.forEach(s=>{var a;(a=s.slide)===null||a===void 0||a.destroy(),s.slide=void 0}));for(let s=0;s0?(o=this.itemHolders.shift(),o&&(this.itemHolders[2]=o,this._containerShiftIndex++,vy(o.el,(this._containerShiftIndex+2)*this.slideWidth),n.setContent(o,n.currIndex-i+s+2))):(o=this.itemHolders.pop(),o&&(this.itemHolders.unshift(o),this._containerShiftIndex--,vy(o.el,this._containerShiftIndex*this.slideWidth),n.setContent(o,n.currIndex+i-s-2)));Math.abs(this._containerShiftIndex)>50&&!this.isShifted()&&(this.resetPosition(),this.resize()),n.animations.stopAllPan(),this.itemHolders.forEach((s,a)=>{s.slide&&s.slide.setIsActive(a===1)}),n.currSlide=(e=this.itemHolders[1])===null||e===void 0?void 0:e.slide,n.contentLoader.updateLazy(r),n.currSlide&&n.currSlide.applyCurrentZoomPan(),n.dispatch("change")}moveTo(e,n){if(!this.pswp.canLoop()&&n){let r=(this.slideWidth*this._currPositionIndex-e)/this.slideWidth;r+=this.pswp.currIndex;const i=Math.round(e-this.x);(r<0&&i>0||r>=this.pswp.getNumItems()-1&&i<0)&&(e=this.x+i*G8e)}this.x=e,this.pswp.container&&vy(this.pswp.container,e),this.pswp.dispatch("moveMainScroll",{x:e,dragging:n??!1})}}const Y8e={Escape:27,z:90,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Tab:9},_y=(t,e)=>e?t:Y8e[t];class Z8e{constructor(e){this.pswp=e,this._wasFocused=!1,e.on("bindEvents",()=>{e.options.trapFocus&&(e.options.initialPointerPos||this._focusRoot(),e.events.add(document,"focusin",this._onFocusIn.bind(this))),e.events.add(document,"keydown",this._onKeyDown.bind(this))});const n=document.activeElement;e.on("destroy",()=>{e.options.returnFocus&&n&&this._wasFocused&&n.focus()})}_focusRoot(){!this._wasFocused&&this.pswp.element&&(this.pswp.element.focus(),this._wasFocused=!0)}_onKeyDown(e){const{pswp:n}=this;if(n.dispatch("keydown",{originalEvent:e}).defaultPrevented||A8e(e))return;let r,i,o=!1;const s="key"in e;switch(s?e.key:e.keyCode){case _y("Escape",s):n.options.escKey&&(r="close");break;case _y("z",s):r="toggleZoom";break;case _y("ArrowLeft",s):i="x";break;case _y("ArrowUp",s):i="y";break;case _y("ArrowRight",s):i="x",o=!0;break;case _y("ArrowDown",s):o=!0,i="y";break;case _y("Tab",s):this._focusRoot();break}if(i){e.preventDefault();const{currSlide:a}=n;n.options.arrowKeys&&i==="x"&&n.getNumItems()>1?r=o?"next":"prev":a&&a.currZoomLevel>a.zoomLevels.fit&&(a.pan[i]+=o?-80:80,a.panTo(a.pan.x,a.pan.y))}r&&(e.preventDefault(),n[r]())}_onFocusIn(e){const{template:n}=this.pswp;n&&document!==e.target&&n!==e.target&&!n.contains(e.target)&&n.focus()}}const X8e="cubic-bezier(.4,0,.22,1)";class K8e{constructor(e){var n;this.props=e;const{target:r,onComplete:i,transform:o,onFinish:s=()=>{},duration:a=333,easing:l=X8e}=e;this.onFinish=s;const c=o?"transform":"opacity",u=(n=e[c])!==null&&n!==void 0?n:"";this._target=r,this._onComplete=i,this._finished=!1,this._onTransitionEnd=this._onTransitionEnd.bind(this),this._helperTimeout=setTimeout(()=>{OZ(r,c,a,l),this._helperTimeout=setTimeout(()=>{r.addEventListener("transitionend",this._onTransitionEnd,!1),r.addEventListener("transitioncancel",this._onTransitionEnd,!1),this._helperTimeout=setTimeout(()=>{this._finalizeAnimation()},a+500),r.style[c]=u},30)},0)}_onTransitionEnd(e){e.target===this._target&&this._finalizeAnimation()}_finalizeAnimation(){this._finished||(this._finished=!0,this.onFinish(),this._onComplete&&this._onComplete())}destroy(){this._helperTimeout&&clearTimeout(this._helperTimeout),T8e(this._target),this._target.removeEventListener("transitionend",this._onTransitionEnd,!1),this._target.removeEventListener("transitioncancel",this._onTransitionEnd,!1),this._finished||this._finalizeAnimation()}}const J8e=12,Q8e=.75;class eje{constructor(e,n,r){this.velocity=e*1e3,this._dampingRatio=n||Q8e,this._naturalFrequency=r||J8e,this._dampedFrequency=this._naturalFrequency,this._dampingRatio<1&&(this._dampedFrequency*=Math.sqrt(1-this._dampingRatio*this._dampingRatio))}easeFrame(e,n){let r=0,i;n/=1e3;const o=Math.E**(-this._dampingRatio*this._naturalFrequency*n);if(this._dampingRatio===1)i=this.velocity+this._naturalFrequency*e,r=(e+i*n)*o,this.velocity=r*-this._naturalFrequency+i*o;else if(this._dampingRatio<1){i=1/this._dampedFrequency*(this._dampingRatio*this._naturalFrequency*e+this.velocity);const s=Math.cos(this._dampedFrequency*n),a=Math.sin(this._dampedFrequency*n);r=o*(e*s+i*a),this.velocity=r*-this._naturalFrequency*this._dampingRatio+o*(-this._dampedFrequency*e*a+this._dampedFrequency*i*s)}return r}}class tje{constructor(e){this.props=e,this._raf=0;const{start:n,end:r,velocity:i,onUpdate:o,onComplete:s,onFinish:a=()=>{},dampingRatio:l,naturalFrequency:c}=e;this.onFinish=a;const u=new eje(i,l,c);let d=Date.now(),p=n-r;const m=()=>{this._raf&&(p=u.easeFrame(p,Date.now()-d),Math.abs(p)<1&&Math.abs(u.velocity)<50?(o(r),s&&s(),this.onFinish()):(d=Date.now(),o(p+r),this._raf=requestAnimationFrame(m)))};this._raf=requestAnimationFrame(m)}destroy(){this._raf>=0&&cancelAnimationFrame(this._raf),this._raf=0}}class nje{constructor(){this.activeAnimations=[]}startSpring(e){this._start(e,!0)}startTransition(e){this._start(e)}_start(e,n){const r=n?new tje(e):new K8e(e);return this.activeAnimations.push(r),r.onFinish=()=>this.stop(r),r}stop(e){e.destroy();const n=this.activeAnimations.indexOf(e);n>-1&&this.activeAnimations.splice(n,1)}stopAll(){this.activeAnimations.forEach(e=>{e.destroy()}),this.activeAnimations=[]}stopAllPan(){this.activeAnimations=this.activeAnimations.filter(e=>e.props.isPan?(e.destroy(),!1):!0)}stopMainScroll(){this.activeAnimations=this.activeAnimations.filter(e=>e.props.isMainScroll?(e.destroy(),!1):!0)}isPanRunning(){return this.activeAnimations.some(e=>e.props.isPan)}}class rje{constructor(e){this.pswp=e,e.events.add(e.element,"wheel",this._onWheel.bind(this))}_onWheel(e){e.preventDefault();const{currSlide:n}=this.pswp;let{deltaX:r,deltaY:i}=e;if(n&&!this.pswp.dispatch("wheel",{originalEvent:e}).defaultPrevented)if(e.ctrlKey||this.pswp.options.wheelToZoom){if(n.isZoomable()){let o=-i;e.deltaMode===1?o*=.05:o*=e.deltaMode?1:.002,o=2**o;const s=n.currZoomLevel*o;n.zoomTo(s,{x:e.clientX,y:e.clientY})}}else n.isPannable()&&(e.deltaMode===1&&(r*=18,i*=18),n.panTo(n.pan.x-r,n.pan.y-i))}}function ije(t){if(typeof t=="string")return t;if(!t||!t.isCustomSVG)return"";const e=t;let n='",n}class oje{constructor(e,n){var r;const i=n.name||n.className;let o=n.html;if(e.options[i]===!1)return;typeof e.options[i+"SVG"]=="string"&&(o=e.options[i+"SVG"]),e.dispatch("uiElementCreate",{data:n});let s="";n.isButton?(s+="pswp__button ",s+=n.className||`pswp__button--${n.name}`):s+=n.className||`pswp__${n.name}`;let a=n.isButton?n.tagName||"button":n.tagName||"div";a=a.toLowerCase();const l=Uc(s,a);if(n.isButton){a==="button"&&(l.type="button");let{title:d}=n;const{ariaLabel:p}=n;typeof e.options[i+"Title"]=="string"&&(d=e.options[i+"Title"]),d&&(l.title=d);const m=p||d;m&&l.setAttribute("aria-label",m)}l.innerHTML=ije(o),n.onInit&&n.onInit(l,e),n.onClick&&(l.onclick=d=>{typeof n.onClick=="string"?e[n.onClick]():typeof n.onClick=="function"&&n.onClick(d,l,e)});const c=n.appendTo||"bar";let u=e.element;c==="bar"?(e.topBar||(e.topBar=Uc("pswp__top-bar pswp__hide-on-close","div",e.scrollWrap)),u=e.topBar):(l.classList.add("pswp__hide-on-close"),c==="wrapper"&&(u=e.scrollWrap)),(r=u)===null||r===void 0||r.appendChild(e.applyFilters("uiElement",l,n))}}function WZ(t,e,n){t.classList.add("pswp__button--arrow"),t.setAttribute("aria-controls","pswp__items"),e.on("change",()=>{e.options.loop||(n?t.disabled=!(e.currIndex0))})}const sje={name:"arrowPrev",className:"pswp__button--arrow--prev",title:"Previous",order:10,isButton:!0,appendTo:"wrapper",html:{isCustomSVG:!0,size:60,inner:'',outlineID:"pswp__icn-arrow"},onClick:"prev",onInit:WZ},aje={name:"arrowNext",className:"pswp__button--arrow--next",title:"Next",order:11,isButton:!0,appendTo:"wrapper",html:{isCustomSVG:!0,size:60,inner:'',outlineID:"pswp__icn-arrow"},onClick:"next",onInit:(t,e)=>{WZ(t,e,!0)}},lje={name:"close",title:"Close",order:20,isButton:!0,html:{isCustomSVG:!0,inner:'',outlineID:"pswp__icn-close"},onClick:"close"},cje={name:"zoom",title:"Zoom",order:10,isButton:!0,html:{isCustomSVG:!0,inner:'',outlineID:"pswp__icn-zoom"},onClick:"toggleZoom"},uje={name:"preloader",appendTo:"bar",order:7,html:{isCustomSVG:!0,inner:'',outlineID:"pswp__icn-loading"},onInit:(t,e)=>{let n,r=null;const i=(a,l)=>{t.classList.toggle("pswp__preloader--"+a,l)},o=a=>{n!==a&&(n=a,i("active",a))},s=()=>{var a;if(!((a=e.currSlide)!==null&&a!==void 0&&a.content.isLoading())){o(!1),r&&(clearTimeout(r),r=null);return}r||(r=setTimeout(()=>{var l;o(!!(!((l=e.currSlide)===null||l===void 0)&&l.content.isLoading())),r=null},e.options.preloaderDelay))};e.on("change",s),e.on("loadComplete",a=>{e.currSlide===a.slide&&s()}),e.ui&&(e.ui.updatePreloaderVisibility=s)}},hje={name:"counter",order:5,onInit:(t,e)=>{e.on("change",()=>{t.innerText=e.currIndex+1+e.options.indexIndicatorSep+e.getNumItems()})}};function GZ(t,e){t.classList.toggle("pswp--zoomed-in",e)}class dje{constructor(e){this.pswp=e,this.isRegistered=!1,this.uiElementsData=[],this.items=[],this.updatePreloaderVisibility=()=>{},this._lastUpdatedZoomLevel=void 0}init(){const{pswp:e}=this;this.isRegistered=!1,this.uiElementsData=[lje,sje,aje,cje,uje,hje],e.dispatch("uiRegister"),this.uiElementsData.sort((n,r)=>(n.order||0)-(r.order||0)),this.items=[],this.isRegistered=!0,this.uiElementsData.forEach(n=>{this.registerElement(n)}),e.on("change",()=>{var n;(n=e.element)===null||n===void 0||n.classList.toggle("pswp--one-slide",e.getNumItems()===1)}),e.on("zoomPanUpdate",()=>this._onZoomPanUpdate())}registerElement(e){this.isRegistered?this.items.push(new oje(this.pswp,e)):this.uiElementsData.push(e)}_onZoomPanUpdate(){const{template:e,currSlide:n,options:r}=this.pswp;if(this.pswp.opener.isClosing||!e||!n)return;let{currZoomLevel:i}=n;if(this.pswp.opener.isOpen||(i=n.zoomLevels.initial),i===this._lastUpdatedZoomLevel)return;this._lastUpdatedZoomLevel=i;const o=n.zoomLevels.initial-n.zoomLevels.secondary;if(Math.abs(o)<.01||!n.isZoomable()){GZ(e,!1),e.classList.remove("pswp--zoom-allowed");return}e.classList.add("pswp--zoom-allowed");const s=i===n.zoomLevels.initial?n.zoomLevels.secondary:n.zoomLevels.initial;GZ(e,s<=i),(r.imageClickAction==="zoom"||r.imageClickAction==="zoom-or-close")&&e.classList.add("pswp--click-to-zoom")}}function fje(t){const e=t.getBoundingClientRect();return{x:e.left,y:e.top,w:e.width}}function pje(t,e,n){const r=t.getBoundingClientRect(),i=r.width/e,o=r.height/n,s=i>o?i:o,a=(r.width-e*s)/2,l=(r.height-n*s)/2,c={x:r.left+a,y:r.top+l,w:e*s};return c.innerRect={w:r.width,h:r.height,x:a,y:l},c}function mje(t,e,n){const r=n.dispatch("thumbBounds",{index:t,itemData:e,instance:n});if(r.thumbBounds)return r.thumbBounds;const{element:i}=e;let o,s;if(i&&n.options.thumbSelector!==!1){const a=n.options.thumbSelector||"img";s=i.matches(a)?i:i.querySelector(a)}return s=n.applyFilters("thumbEl",s,e,t),s&&(e.thumbCropped?o=pje(s,e.width||e.w||0,e.height||e.h||0):o=fje(s)),n.applyFilters("thumbBounds",o,e,t)}class gje{constructor(e,n){this.type=e,this.defaultPrevented=!1,n&&Object.assign(this,n)}preventDefault(){this.defaultPrevented=!0}}class yje{constructor(){this._listeners={},this._filters={},this.pswp=void 0,this.options=void 0}addFilter(e,n,r=100){var i,o,s;this._filters[e]||(this._filters[e]=[]),(i=this._filters[e])===null||i===void 0||i.push({fn:n,priority:r}),(o=this._filters[e])===null||o===void 0||o.sort((a,l)=>a.priority-l.priority),(s=this.pswp)===null||s===void 0||s.addFilter(e,n,r)}removeFilter(e,n){this._filters[e]&&(this._filters[e]=this._filters[e].filter(r=>r.fn!==n)),this.pswp&&this.pswp.removeFilter(e,n)}applyFilters(e,...n){var r;return(r=this._filters[e])===null||r===void 0||r.forEach(i=>{n[0]=i.fn.apply(this,n)}),n[0]}on(e,n){var r,i;this._listeners[e]||(this._listeners[e]=[]),(r=this._listeners[e])===null||r===void 0||r.push(n),(i=this.pswp)===null||i===void 0||i.on(e,n)}off(e,n){var r;this._listeners[e]&&(this._listeners[e]=this._listeners[e].filter(i=>n!==i)),(r=this.pswp)===null||r===void 0||r.off(e,n)}dispatch(e,n){var r;if(this.pswp)return this.pswp.dispatch(e,n);const i=new gje(e,n);return(r=this._listeners[e])===null||r===void 0||r.forEach(o=>{o.call(this,i)}),i}}class vje{constructor(e,n){if(this.element=Uc("pswp__img pswp__img--placeholder",e?"img":"div",n),e){const r=this.element;r.decoding="async",r.alt="",r.src=e,r.setAttribute("role","presentation")}this.element.setAttribute("aria-hidden","true")}setDisplayedSize(e,n){this.element&&(this.element.tagName==="IMG"?(IR(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=nx(0,0,e/250)):IR(this.element,e,n))}destroy(){var e;(e=this.element)!==null&&e!==void 0&&e.parentNode&&this.element.remove(),this.element=null}}class _je{constructor(e,n,r){this.instance=n,this.data=e,this.index=r,this.element=void 0,this.placeholder=void 0,this.slide=void 0,this.displayedImageWidth=0,this.displayedImageHeight=0,this.width=Number(this.data.w)||Number(this.data.width)||0,this.height=Number(this.data.h)||Number(this.data.height)||0,this.isAttached=!1,this.hasSlide=!1,this.isDecoding=!1,this.state=$u.IDLE,this.data.type?this.type=this.data.type:this.data.src?this.type="image":this.type="html",this.instance.dispatch("contentInit",{content:this})}removePlaceholder(){this.placeholder&&!this.keepPlaceholder()&&setTimeout(()=>{this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0)},1e3)}load(e,n){if(this.slide&&this.usePlaceholder())if(this.placeholder){const r=this.placeholder.element;r&&!r.parentElement&&this.slide.container.prepend(r)}else{const r=this.instance.applyFilters("placeholderSrc",this.data.msrc&&this.slide.isFirstSlide?this.data.msrc:!1,this);this.placeholder=new vje(r,this.slide.container)}this.element&&!n||this.instance.dispatch("contentLoad",{content:this,isLazy:e}).defaultPrevented||(this.isImageContent()?(this.element=Uc("pswp__img","img"),this.displayedImageWidth&&this.loadImage(e)):(this.element=Uc("pswp__content","div"),this.element.innerHTML=this.data.html||""),n&&this.slide&&this.slide.updateContentSize(!0))}loadImage(e){var n,r;if(!this.isImageContent()||!this.element||this.instance.dispatch("contentLoadImage",{content:this,isLazy:e}).defaultPrevented)return;const i=this.element;this.updateSrcsetSizes(),this.data.srcset&&(i.srcset=this.data.srcset),i.src=(n=this.data.src)!==null&&n!==void 0?n:"",i.alt=(r=this.data.alt)!==null&&r!==void 0?r:"",this.state=$u.LOADING,i.complete?this.onLoaded():(i.onload=()=>{this.onLoaded()},i.onerror=()=>{this.onError()})}setSlide(e){this.slide=e,this.hasSlide=!0,this.instance=e.pswp}onLoaded(){this.state=$u.LOADED,this.slide&&this.element&&(this.instance.dispatch("loadComplete",{slide:this.slide,content:this}),this.slide.isActive&&this.slide.heavyAppended&&!this.element.parentNode&&(this.append(),this.slide.updateContentSize(!0)),(this.state===$u.LOADED||this.state===$u.ERROR)&&this.removePlaceholder())}onError(){this.state=$u.ERROR,this.slide&&(this.displayError(),this.instance.dispatch("loadComplete",{slide:this.slide,isError:!0,content:this}),this.instance.dispatch("loadError",{slide:this.slide,content:this}))}isLoading(){return this.instance.applyFilters("isContentLoading",this.state===$u.LOADING,this)}isError(){return this.state===$u.ERROR}isImageContent(){return this.type==="image"}setDisplayedSize(e,n){if(this.element&&(this.placeholder&&this.placeholder.setDisplayedSize(e,n),!this.instance.dispatch("contentResize",{content:this,width:e,height:n}).defaultPrevented&&(IR(this.element,e,n),this.isImageContent()&&!this.isError()))){const r=!this.displayedImageWidth&&e;this.displayedImageWidth=e,this.displayedImageHeight=n,r?this.loadImage(!1):this.updateSrcsetSizes(),this.slide&&this.instance.dispatch("imageSizeChange",{slide:this.slide,width:e,height:n,content:this})}}isZoomable(){return this.instance.applyFilters("isContentZoomable",this.isImageContent()&&this.state!==$u.ERROR,this)}updateSrcsetSizes(){if(!this.isImageContent()||!this.element||!this.data.srcset)return;const e=this.element,n=this.instance.applyFilters("srcsetSizesWidth",this.displayedImageWidth,this);(!e.dataset.largestUsedSize||n>parseInt(e.dataset.largestUsedSize,10))&&(e.sizes=n+"px",e.dataset.largestUsedSize=String(n))}usePlaceholder(){return this.instance.applyFilters("useContentPlaceholder",this.isImageContent(),this)}lazyLoad(){this.instance.dispatch("contentLazyLoad",{content:this}).defaultPrevented||this.load(!0)}keepPlaceholder(){return this.instance.applyFilters("isKeepingPlaceholder",this.isLoading(),this)}destroy(){this.hasSlide=!1,this.slide=void 0,!this.instance.dispatch("contentDestroy",{content:this}).defaultPrevented&&(this.remove(),this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0),this.isImageContent()&&this.element&&(this.element.onload=null,this.element.onerror=null,this.element=void 0))}displayError(){if(this.slide){var e,n;let r=Uc("pswp__error-msg","div");r.innerText=(e=(n=this.instance.options)===null||n===void 0?void 0:n.errorMsg)!==null&&e!==void 0?e:"",r=this.instance.applyFilters("contentErrorElement",r,this),this.element=Uc("pswp__content pswp__error-msg-container","div"),this.element.appendChild(r),this.slide.container.innerText="",this.slide.container.appendChild(this.element),this.slide.updateContentSize(!0),this.removePlaceholder()}}append(){if(this.isAttached||!this.element)return;if(this.isAttached=!0,this.state===$u.ERROR){this.displayError();return}if(this.instance.dispatch("contentAppend",{content:this}).defaultPrevented)return;const e="decode"in this.element;this.isImageContent()?e&&this.slide&&(!this.slide.isActive||DZ())?(this.isDecoding=!0,this.element.decode().catch(()=>{}).finally(()=>{this.isDecoding=!1,this.appendImage()})):this.appendImage():this.slide&&!this.element.parentNode&&this.slide.container.appendChild(this.element)}activate(){this.instance.dispatch("contentActivate",{content:this}).defaultPrevented||!this.slide||(this.isImageContent()&&this.isDecoding&&!DZ()?this.appendImage():this.isError()&&this.load(!1,!0),this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","false"))}deactivate(){this.instance.dispatch("contentDeactivate",{content:this}),this.slide&&this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","true")}remove(){this.isAttached=!1,!this.instance.dispatch("contentRemove",{content:this}).defaultPrevented&&(this.element&&this.element.parentNode&&this.element.remove(),this.placeholder&&this.placeholder.element&&this.placeholder.element.remove())}appendImage(){this.isAttached&&(this.instance.dispatch("contentAppendImage",{content:this}).defaultPrevented||(this.slide&&this.element&&!this.element.parentNode&&this.slide.container.appendChild(this.element),(this.state===$u.LOADED||this.state===$u.ERROR)&&this.removePlaceholder()))}}const bje=5;function qZ(t,e,n){const r=e.createContentFromData(t,n);let i;const{options:o}=e;if(o){i=new zZ(o,t,-1);let s;e.pswp?s=e.pswp.viewportSize:s=BZ(o,e);const a=FZ(o,s,t,n);i.update(r.width,r.height,a)}return r.lazyLoad(),i&&r.setDisplayedSize(Math.ceil(r.width*i.initial),Math.ceil(r.height*i.initial)),r}function wje(t,e){const n=e.getItemData(t);if(!e.dispatch("lazyLoadSlide",{index:t,itemData:n}).defaultPrevented)return qZ(n,e,t)}class xje{constructor(e){this.pswp=e,this.limit=Math.max(e.options.preload[0]+e.options.preload[1]+1,bje),this._cachedItems=[]}updateLazy(e){const{pswp:n}=this;if(n.dispatch("lazyLoad").defaultPrevented)return;const{preload:r}=n.options,i=e===void 0?!0:e>=0;let o;for(o=0;o<=r[1];o++)this.loadSlideByIndex(n.currIndex+(i?o:-o));for(o=1;o<=r[0];o++)this.loadSlideByIndex(n.currIndex+(i?-o:o))}loadSlideByIndex(e){const n=this.pswp.getLoopedIndex(e);let r=this.getContentByIndex(n);r||(r=wje(n,this.pswp),r&&this.addToCache(r))}getContentBySlide(e){let n=this.getContentByIndex(e.index);return n||(n=this.pswp.createContentFromData(e.data,e.index),this.addToCache(n)),n.setSlide(e),n}addToCache(e){if(this.removeByIndex(e.index),this._cachedItems.push(e),this._cachedItems.length>this.limit){const n=this._cachedItems.findIndex(r=>!r.isAttached&&!r.hasSlide);n!==-1&&this._cachedItems.splice(n,1)[0].destroy()}}removeByIndex(e){const n=this._cachedItems.findIndex(r=>r.index===e);n!==-1&&this._cachedItems.splice(n,1)}getContentByIndex(e){return this._cachedItems.find(n=>n.index===e)}destroy(){this._cachedItems.forEach(e=>e.destroy()),this._cachedItems=[]}}class Eje extends yje{getNumItems(){var e;let n=0;const r=(e=this.options)===null||e===void 0?void 0:e.dataSource;r&&"length"in r?n=r.length:r&&"gallery"in r&&(r.items||(r.items=this._getGalleryDOMElements(r.gallery)),r.items&&(n=r.items.length));const i=this.dispatch("numItems",{dataSource:r,numItems:n});return this.applyFilters("numItems",i.numItems,r)}createContentFromData(e,n){return new _je(e,this,n)}getItemData(e){var n;const r=(n=this.options)===null||n===void 0?void 0:n.dataSource;let i={};Array.isArray(r)?i=r[e]:r&&"gallery"in r&&(r.items||(r.items=this._getGalleryDOMElements(r.gallery)),i=r.items[e]);let o=i;o instanceof Element&&(o=this._domElementToItemData(o));const s=this.dispatch("itemData",{itemData:o||{},index:e});return this.applyFilters("itemData",s.itemData,e)}_getGalleryDOMElements(e){var n,r;return(n=this.options)!==null&&n!==void 0&&n.children||(r=this.options)!==null&&r!==void 0&&r.childSelector?I8e(this.options.children,this.options.childSelector,e)||[]:[e]}_domElementToItemData(e){const n={element:e},r=e.tagName==="A"?e:e.querySelector("a");if(r){n.src=r.dataset.pswpSrc||r.href,r.dataset.pswpSrcset&&(n.srcset=r.dataset.pswpSrcset),n.width=r.dataset.pswpWidth?parseInt(r.dataset.pswpWidth,10):0,n.height=r.dataset.pswpHeight?parseInt(r.dataset.pswpHeight,10):0,n.w=n.width,n.h=n.height,r.dataset.pswpType&&(n.type=r.dataset.pswpType);const o=e.querySelector("img");if(o){var i;n.msrc=o.currentSrc||o.src,n.alt=(i=o.getAttribute("alt"))!==null&&i!==void 0?i:""}(r.dataset.pswpCropped||r.dataset.cropped)&&(n.thumbCropped=!0)}return this.applyFilters("domItemData",n,e,r)}lazyLoadData(e,n){return qZ(e,this,n)}}const ix=.003;class Sje{constructor(e){this.pswp=e,this.isClosed=!0,this.isOpen=!1,this.isClosing=!1,this.isOpening=!1,this._duration=void 0,this._useAnimation=!1,this._croppedZoom=!1,this._animateRootOpacity=!1,this._animateBgOpacity=!1,this._placeholder=void 0,this._opacityElement=void 0,this._cropContainer1=void 0,this._cropContainer2=void 0,this._thumbBounds=void 0,this._prepareOpen=this._prepareOpen.bind(this),e.on("firstZoomPan",this._prepareOpen)}open(){this._prepareOpen(),this._start()}close(){if(this.isClosed||this.isClosing||this.isOpening)return;const e=this.pswp.currSlide;this.isOpen=!1,this.isOpening=!1,this.isClosing=!0,this._duration=this.pswp.options.hideAnimationDuration,e&&e.currZoomLevel*e.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0),this._applyStartProps(),setTimeout(()=>{this._start()},this._croppedZoom?30:0)}_prepareOpen(){if(this.pswp.off("firstZoomPan",this._prepareOpen),!this.isOpening){const e=this.pswp.currSlide;this.isOpening=!0,this.isClosing=!1,this._duration=this.pswp.options.showAnimationDuration,e&&e.zoomLevels.initial*e.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0),this._applyStartProps()}}_applyStartProps(){const{pswp:e}=this,n=this.pswp.currSlide,{options:r}=e;if(r.showHideAnimationType==="fade"?(r.showHideOpacity=!0,this._thumbBounds=void 0):r.showHideAnimationType==="none"?(r.showHideOpacity=!1,this._duration=0,this._thumbBounds=void 0):this.isOpening&&e._initialThumbBounds?this._thumbBounds=e._initialThumbBounds:this._thumbBounds=this.pswp.getThumbBounds(),this._placeholder=n==null?void 0:n.getPlaceholderElement(),e.animations.stopAll(),this._useAnimation=!!(this._duration&&this._duration>50),this._animateZoom=!!this._thumbBounds&&(n==null?void 0:n.content.usePlaceholder())&&(!this.isClosing||!e.mainScroll.isShifted()),!this._animateZoom)this._animateRootOpacity=!0,this.isOpening&&n&&(n.zoomAndPanToInitial(),n.applyCurrentZoomPan());else{var i;this._animateRootOpacity=(i=r.showHideOpacity)!==null&&i!==void 0?i:!1}if(this._animateBgOpacity=!this._animateRootOpacity&&this.pswp.options.bgOpacity>ix,this._opacityElement=this._animateRootOpacity?e.element:e.bg,!this._useAnimation){this._duration=0,this._animateZoom=!1,this._animateBgOpacity=!1,this._animateRootOpacity=!0,this.isOpening&&(e.element&&(e.element.style.opacity=String(ix)),e.applyBgOpacity(1));return}if(this._animateZoom&&this._thumbBounds&&this._thumbBounds.innerRect){var o;this._croppedZoom=!0,this._cropContainer1=this.pswp.container,this._cropContainer2=(o=this.pswp.currSlide)===null||o===void 0?void 0:o.holderElement,e.container&&(e.container.style.overflow="hidden",e.container.style.width=e.viewportSize.x+"px")}else this._croppedZoom=!1;this.isOpening?(this._animateRootOpacity?(e.element&&(e.element.style.opacity=String(ix)),e.applyBgOpacity(1)):(this._animateBgOpacity&&e.bg&&(e.bg.style.opacity=String(ix)),e.element&&(e.element.style.opacity="1")),this._animateZoom&&(this._setClosedStateZoomPan(),this._placeholder&&(this._placeholder.style.willChange="transform",this._placeholder.style.opacity=String(ix)))):this.isClosing&&(e.mainScroll.itemHolders[0]&&(e.mainScroll.itemHolders[0].el.style.display="none"),e.mainScroll.itemHolders[2]&&(e.mainScroll.itemHolders[2].el.style.display="none"),this._croppedZoom&&e.mainScroll.x!==0&&(e.mainScroll.resetPosition(),e.mainScroll.resize()))}_start(){this.isOpening&&this._useAnimation&&this._placeholder&&this._placeholder.tagName==="IMG"?new Promise(e=>{let n=!1,r=!0;M8e(this._placeholder).finally(()=>{n=!0,r||e(!0)}),setTimeout(()=>{r=!1,n&&e(!0)},50),setTimeout(e,250)}).finally(()=>this._initiate()):this._initiate()}_initiate(){var e,n;(e=this.pswp.element)===null||e===void 0||e.style.setProperty("--pswp-transition-duration",this._duration+"ms"),this.pswp.dispatch(this.isOpening?"openingAnimationStart":"closingAnimationStart"),this.pswp.dispatch("initialZoom"+(this.isOpening?"In":"Out")),(n=this.pswp.element)===null||n===void 0||n.classList.toggle("pswp--ui-visible",this.isOpening),this.isOpening?(this._placeholder&&(this._placeholder.style.opacity="1"),this._animateToOpenState()):this.isClosing&&this._animateToClosedState(),this._useAnimation||this._onAnimationComplete()}_onAnimationComplete(){const{pswp:e}=this;if(this.isOpen=this.isOpening,this.isClosed=this.isClosing,this.isOpening=!1,this.isClosing=!1,e.dispatch(this.isOpen?"openingAnimationEnd":"closingAnimationEnd"),e.dispatch("initialZoom"+(this.isOpen?"InEnd":"OutEnd")),this.isClosed)e.destroy();else if(this.isOpen){var n;this._animateZoom&&e.container&&(e.container.style.overflow="visible",e.container.style.width="100%"),(n=e.currSlide)===null||n===void 0||n.applyCurrentZoomPan()}}_animateToOpenState(){const{pswp:e}=this;this._animateZoom&&(this._croppedZoom&&this._cropContainer1&&this._cropContainer2&&(this._animateTo(this._cropContainer1,"transform","translate3d(0,0,0)"),this._animateTo(this._cropContainer2,"transform","none")),e.currSlide&&(e.currSlide.zoomAndPanToInitial(),this._animateTo(e.currSlide.container,"transform",e.currSlide.getCurrentTransform()))),this._animateBgOpacity&&e.bg&&this._animateTo(e.bg,"opacity",String(e.options.bgOpacity)),this._animateRootOpacity&&e.element&&this._animateTo(e.element,"opacity","1")}_animateToClosedState(){const{pswp:e}=this;this._animateZoom&&this._setClosedStateZoomPan(!0),this._animateBgOpacity&&e.bgOpacity>.01&&e.bg&&this._animateTo(e.bg,"opacity","0"),this._animateRootOpacity&&e.element&&this._animateTo(e.element,"opacity","0")}_setClosedStateZoomPan(e){if(!this._thumbBounds)return;const{pswp:n}=this,{innerRect:r}=this._thumbBounds,{currSlide:i,viewportSize:o}=n;if(this._croppedZoom&&r&&this._cropContainer1&&this._cropContainer2){const s=-o.x+(this._thumbBounds.x-r.x)+r.w,a=-o.y+(this._thumbBounds.y-r.y)+r.h,l=o.x-r.w,c=o.y-r.h;e?(this._animateTo(this._cropContainer1,"transform",nx(s,a)),this._animateTo(this._cropContainer2,"transform",nx(l,c))):(vy(this._cropContainer1,s,a),vy(this._cropContainer2,l,c))}i&&(Ss(i.pan,r||this._thumbBounds),i.currZoomLevel=this._thumbBounds.w/i.width,e?this._animateTo(i.container,"transform",i.getCurrentTransform()):i.applyCurrentZoomPan())}_animateTo(e,n,r){if(!this._duration){e.style[n]=r;return}const{animations:i}=this.pswp,o={duration:this._duration,easing:this.pswp.options.easing,onComplete:()=>{i.activeAnimations.length||this._onAnimationComplete()},target:e};o[n]=r,i.startTransition(o)}}const Cje={allowPanToNext:!0,spacing:.1,loop:!0,pinchToClose:!0,closeOnVerticalDrag:!0,hideAnimationDuration:333,showAnimationDuration:333,zoomAnimationDuration:333,escKey:!0,arrowKeys:!0,trapFocus:!0,returnFocus:!0,maxWidthToAnimate:4e3,clickToCloseNonZoomable:!0,imageClickAction:"zoom-or-close",bgClickAction:"close",tapAction:"toggle-controls",doubleTapAction:"zoom",indexIndicatorSep:" / ",preloaderDelay:2e3,bgOpacity:.8,index:0,errorMsg:"The image cannot be loaded",preload:[1,2],easing:"cubic-bezier(.4,0,.22,1)"};class kje extends Eje{constructor(e){super(),this.options=this._prepareOptions(e||{}),this.offset={x:0,y:0},this._prevViewportSize={x:0,y:0},this.viewportSize={x:0,y:0},this.bgOpacity=1,this.currIndex=0,this.potentialIndex=0,this.isOpen=!1,this.isDestroying=!1,this.hasMouse=!1,this._initialItemData={},this._initialThumbBounds=void 0,this.topBar=void 0,this.element=void 0,this.template=void 0,this.container=void 0,this.scrollWrap=void 0,this.currSlide=void 0,this.events=new L8e,this.animations=new nje,this.mainScroll=new q8e(this),this.gestures=new W8e(this),this.opener=new Sje(this),this.keyboard=new Z8e(this),this.contentLoader=new xje(this)}init(){if(this.isOpen||this.isDestroying)return!1;this.isOpen=!0,this.dispatch("init"),this.dispatch("beforeOpen"),this._createMainStructure();let e="pswp--open";return this.gestures.supportsTouch&&(e+=" pswp--touch"),this.options.mainClass&&(e+=" "+this.options.mainClass),this.element&&(this.element.className+=" "+e),this.currIndex=this.options.index||0,this.potentialIndex=this.currIndex,this.dispatch("firstUpdate"),this.scrollWheel=new rje(this),(Number.isNaN(this.currIndex)||this.currIndex<0||this.currIndex>=this.getNumItems())&&(this.currIndex=0),this.gestures.supportsTouch||this.mouseDetected(),this.updateSize(),this.offset.y=window.pageYOffset,this._initialItemData=this.getItemData(this.currIndex),this.dispatch("gettingData",{index:this.currIndex,data:this._initialItemData,slide:void 0}),this._initialThumbBounds=this.getThumbBounds(),this.dispatch("initialLayout"),this.on("openingAnimationEnd",()=>{const{itemHolders:n}=this.mainScroll;n[0]&&(n[0].el.style.display="block",this.setContent(n[0],this.currIndex-1)),n[2]&&(n[2].el.style.display="block",this.setContent(n[2],this.currIndex+1)),this.appendHeavy(),this.contentLoader.updateLazy(),this.events.add(window,"resize",this._handlePageResize.bind(this)),this.events.add(window,"scroll",this._updatePageScrollOffset.bind(this)),this.dispatch("bindEvents")}),this.mainScroll.itemHolders[1]&&this.setContent(this.mainScroll.itemHolders[1],this.currIndex),this.dispatch("change"),this.opener.open(),this.dispatch("afterInit"),!0}getLoopedIndex(e){const n=this.getNumItems();return this.options.loop&&(e>n-1&&(e-=n),e<0&&(e+=n)),tx(e,0,n-1)}appendHeavy(){this.mainScroll.itemHolders.forEach(e=>{var n;(n=e.slide)===null||n===void 0||n.appendHeavy()})}goTo(e){this.mainScroll.moveIndexBy(this.getLoopedIndex(e)-this.potentialIndex)}next(){this.goTo(this.potentialIndex+1)}prev(){this.goTo(this.potentialIndex-1)}zoomTo(...e){var n;(n=this.currSlide)===null||n===void 0||n.zoomTo(...e)}toggleZoom(){var e;(e=this.currSlide)===null||e===void 0||e.toggleZoom()}close(){!this.opener.isOpen||this.isDestroying||(this.isDestroying=!0,this.dispatch("close"),this.events.removeAll(),this.opener.close())}destroy(){var e;if(!this.isDestroying){this.options.showHideAnimationType="none",this.close();return}this.dispatch("destroy"),this._listeners={},this.scrollWrap&&(this.scrollWrap.ontouchmove=null,this.scrollWrap.ontouchend=null),(e=this.element)===null||e===void 0||e.remove(),this.mainScroll.itemHolders.forEach(n=>{var r;(r=n.slide)===null||r===void 0||r.destroy()}),this.contentLoader.destroy(),this.events.removeAll()}refreshSlideContent(e){this.contentLoader.removeByIndex(e),this.mainScroll.itemHolders.forEach((n,r)=>{var i,o;let s=((i=(o=this.currSlide)===null||o===void 0?void 0:o.index)!==null&&i!==void 0?i:0)-1+r;if(this.canLoop()&&(s=this.getLoopedIndex(s)),s===e&&(this.setContent(n,e,!0),r===1)){var a;this.currSlide=n.slide,(a=n.slide)===null||a===void 0||a.setIsActive(!0)}}),this.dispatch("change")}setContent(e,n,r){if(this.canLoop()&&(n=this.getLoopedIndex(n)),e.slide){if(e.slide.index===n&&!r)return;e.slide.destroy(),e.slide=void 0}if(!this.canLoop()&&(n<0||n>=this.getNumItems()))return;const i=this.getItemData(n);e.slide=new N8e(i,n,this),n===this.currIndex&&(this.currSlide=e.slide),e.slide.append(e.el)}getViewportCenterPoint(){return{x:this.viewportSize.x/2,y:this.viewportSize.y/2}}updateSize(e){if(this.isDestroying)return;const n=BZ(this.options,this);!e&&ex(n,this._prevViewportSize)||(Ss(this._prevViewportSize,n),this.dispatch("beforeResize"),Ss(this.viewportSize,this._prevViewportSize),this._updatePageScrollOffset(),this.dispatch("viewportSize"),this.mainScroll.resize(this.opener.isOpen),!this.hasMouse&&window.matchMedia("(any-hover: hover)").matches&&this.mouseDetected(),this.dispatch("resize"))}applyBgOpacity(e){this.bgOpacity=Math.max(e,0),this.bg&&(this.bg.style.opacity=String(this.bgOpacity*this.options.bgOpacity))}mouseDetected(){if(!this.hasMouse){var e;this.hasMouse=!0,(e=this.element)===null||e===void 0||e.classList.add("pswp--has_mouse")}}_handlePageResize(){this.updateSize(),/iPhone|iPad|iPod/i.test(window.navigator.userAgent)&&setTimeout(()=>{this.updateSize()},500)}_updatePageScrollOffset(){this.setScrollOffset(0,window.pageYOffset)}setScrollOffset(e,n){this.offset.x=e,this.offset.y=n,this.dispatch("updateScrollOffset")}_createMainStructure(){this.element=Uc("pswp","div"),this.element.setAttribute("tabindex","-1"),this.element.setAttribute("role","dialog"),this.template=this.element,this.bg=Uc("pswp__bg","div",this.element),this.scrollWrap=Uc("pswp__scroll-wrap","section",this.element),this.container=Uc("pswp__container","div",this.scrollWrap),this.scrollWrap.setAttribute("aria-roledescription","carousel"),this.container.setAttribute("aria-live","off"),this.container.setAttribute("id","pswp__items"),this.mainScroll.appendHolders(),this.ui=new dje(this),this.ui.init(),(this.options.appendToEl||document.body).appendChild(this.element)}getThumbBounds(){return mje(this.currIndex,this.currSlide?this.currSlide.data:this._initialItemData,this)}canLoop(){return this.options.loop&&this.getNumItems()>2}_prepareOptions(e){return window.matchMedia("(prefers-reduced-motion), (update: slow)").matches&&(e.showHideAnimationType="none",e.zoomAnimationDuration=0),{...Cje,...e}}}const YZ=Object.freeze(Object.defineProperty({__proto__:null,default:kje},Symbol.toStringTag,{value:"Module"}));return mM});